Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:

strategy:
# The strategy matrix allows running tests across multiple Node.js versions in parallel.
# Here, the workflow will execute the same steps for Node.js versions 20, 22, and 24.
# Here, the workflow will execute the same steps for Node.js versions 22 and 24.
matrix:
node-version: [20, 22, 24]
node-version: [22, 24]

steps:
# Step 1: Checkout the repository code from GitHub
- uses: actions/checkout@v3

# Step 2: Set up the Node.js version based on the current matrix value (20, 22, or 24)
# Step 2: Set up the Node.js version based on the current matrix value (22 or 24)
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
Expand Down Expand Up @@ -50,4 +50,4 @@ jobs:
steps:
# Step 1: Print final success message after all Node.js version tests pass
- name: Final status
run: echo "✅ All tests passed for Node.js 20, 22, and 24"
run: echo "✅ All tests passed for Node.js 22 and 24"
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v3

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.28.0
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
with:
scan-type: "fs"
scan-ref: "${{ github.workspace }}"
Expand Down
6,981 changes: 2,989 additions & 3,992 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
],
"overrides": {
"semver": "^7.5.2",
"qs": "^6.14.1"
"qs": "^6.14.1",
"form-data":"4.0.4",
"underscore":"1.13.8",
"undici":"7.24.0"
},
"config": {
"commitizen": {
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-sf-changelog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"author": "Akshat Dubey",
"engines": {
"node": "18 || 20"
"node": "22 || 24"
},
"license": "ISC",
"dependencies": {
Expand Down
48 changes: 48 additions & 0 deletions services/orchestrator-service/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"openapi": "3.0.0",
"info": {
"title": "@sourceloop/ctrl-plane-orchestrator-service",
"version": "1.2.0",
"description": "ARC SaaS Orchestrator service.",
"contact": {
"name": "SourceFuse"
}
},
"paths": {
"/ping": {
"get": {
"x-controller-name": "PingController",
"x-operation-name": "ping",
"tags": [
"PingController"
],
"responses": {
"200": {
"description": "Return value of PingController.ping"
}
},
"operationId": "PingController.ping"
}
},
"/": {
"get": {
"x-controller-name": "HomePageController",
"x-operation-name": "homePage",
"tags": [
"HomePageController"
],
"responses": {
"200": {
"description": "Return value of HomePageController.homePage"
}
},
"operationId": "HomePageController.homePage"
}
}
},
"servers": [
{
"url": "/"
}
]
}
130 changes: 130 additions & 0 deletions services/orchestrator-service/openapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: "@sourceloop/ctrl-plane-orchestrator-service v1.2.0"
language_tabs:
- javascript: JavaScript
- javascript--nodejs: Node.JS
language_clients:
- javascript: request
- javascript--nodejs: ""
toc_footers: []
includes: []
search: true
highlight_theme: darkula
headingLevel: 2

---

<!-- Generator: Widdershins v4.0.1 -->

<h1 id="-sourceloop-ctrl-plane-orchestrator-service">@sourceloop/ctrl-plane-orchestrator-service v1.2.0</h1>

> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

ARC SaaS Orchestrator service.

Base URLs:

* <a href="/">/</a>

<h1 id="-sourceloop-ctrl-plane-orchestrator-service-pingcontroller">PingController</h1>

## PingController.ping

<a id="opIdPingController.ping"></a>

> Code samples

```javascript

fetch('/ping',
{
method: 'GET'

})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

```

```javascript--nodejs
const fetch = require('node-fetch');

fetch('/ping',
{
method: 'GET'

})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

```

`GET /ping`

<h3 id="pingcontroller.ping-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Return value of PingController.ping|None|

<aside class="success">
This operation does not require authentication
</aside>

<h1 id="-sourceloop-ctrl-plane-orchestrator-service-homepagecontroller">HomePageController</h1>

## HomePageController.homePage

<a id="opIdHomePageController.homePage"></a>

> Code samples

```javascript

fetch('/',
{
method: 'GET'

})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

```

```javascript--nodejs
const fetch = require('node-fetch');

fetch('/',
{
method: 'GET'

})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

```

`GET /`

<h3 id="homepagecontroller.homepage-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Return value of HomePageController.homePage|None|

<aside class="success">
This operation does not require authentication
</aside>

7 changes: 4 additions & 3 deletions services/orchestrator-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=20"
"node": "22 || 24"
},
"scripts": {
"build": "lb-tsc",
"build": "lb-tsc && npm run openapi-spec && npm run apidocs",
"build:watch": "lb-tsc --watch",
"lint": "npm run eslint && npm run prettier:check",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
Expand All @@ -38,8 +38,9 @@
"resolve-links": "npm run symlink-resolver build ./node_modules/@local",
"premigrate": "npm run build",
"migrate": "node ./dist/migrate",
"preopenapi-spec": "npm run build",
"preopenapi-spec": "lb-tsc",
"openapi-spec": "node ./dist/openapi-spec",
"apidocs": "npx widdershins --language_tabs 'javascript:JavaScript:request' 'javascript--nodejs:Node.JS' --summary openapi.json -o openapi.md",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things on the doc generation here (same applies to subscription-service and tenant-management-service — identical scripts):

  1. npx widdershins resolves and downloads widdershins from the registry at build time — non-deterministic (picks up new releases), network-dependent (fails on offline/air-gapped CI or a registry blip), and slow on a clean environment. Since build now calls apidocs, a bad widdershins release would break every build of every service. Pin it as a devDependency and call the local bin:
"devDependencies": { "widdershins": "4.0.1" },
"scripts": {
  "apidocs": "widdershins --language_tabs 'javascript:JavaScript:request' 'javascript--nodejs:Node.JS' --summary openapi.json -o openapi.md"
}
  1. build: lb-tsc && npm run openapi-spec && npm run apidocs couples doc generation into the standard build that Docker/deploy run, and since preopenapi-spec is lb-tsc, the compile runs twice per build. Consider keeping build as just lb-tsc, moving docs to a dedicated script, and adding a CI step that regenerates and fails if the committed spec drifted:
"build": "lb-tsc",
"docs": "npm run openapi-spec && npm run apidocs"
// CI: npm run docs && git diff --exit-code services/**/openapi.*

Keeps deploy builds offline-safe and avoids the double compile while still guaranteeing the committed spec matches the code.

"prestart": "npm run clean && npm run openapi-spec",
"start": "node -r source-map-support/register .",
"dev": "nodemon --watch src -e ts --exec \"npm run start\"",
Expand Down
31 changes: 31 additions & 0 deletions services/orchestrator-service/src/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) 2023 Sourcefuse Technologies
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import * as path from 'node:path';
import {OrchestratorServiceComponent} from './component';

export {ApplicationConfig};

export class OrchestratorServiceApplication extends BootMixin(
RepositoryMixin(RestApplication),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
this.static('/', path.join(__dirname, '../public'));
this.component(OrchestratorServiceComponent);

this.projectRoot = __dirname;
this.bootOptions = {
controllers: {
dirs: ['controllers'],
extensions: ['.controller.js'],
nested: true,
},
};
}
}
30 changes: 30 additions & 0 deletions services/orchestrator-service/src/openapi-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2023 Sourcefuse Technologies
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
import {ApplicationConfig} from '@loopback/core';
import {OrchestratorServiceApplication} from './application';

const PORT = 3000;
const ARGV_INDEX = 2;

/**
* Export the OpenAPI spec from the application
*/
async function exportOpenApiSpec(): Promise<void> {
const config: ApplicationConfig = {
rest: {
port: +(process.env.PORT ?? PORT),
host: process.env.HOST ?? 'localhost',
},
};
const outFile = process.argv[ARGV_INDEX] ?? './openapi.json';
const app = new OrchestratorServiceApplication(config);
await app.boot();
await app.exportOpenApiSpec(outFile);
}

exportOpenApiSpec().catch(err => {
console.error('Fail to export OpenAPI spec from the application.', err); //NOSONAR
process.exit(1);
});
Loading
Loading