Skip to content

Commit 4de9261

Browse files
Sunny  TyagiSunny  Tyagi
authored andcommitted
feat(cli): add arc saas support in cli
add arc saas support in cli gh-2270
1 parent f2102cb commit 4de9261

File tree

4 files changed

+49
-10
lines changed

4 files changed

+49
-10
lines changed

packages/cli/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g @sourceloop/cli
1818
$ sl COMMAND
1919
running command...
2020
$ sl (-v|--version|version)
21-
@sourceloop/cli/9.2.3 linux-x64 node-v18.20.5
21+
@sourceloop/cli/9.2.3 darwin-arm64 node-v22.15.0
2222
$ sl --help [COMMAND]
2323
USAGE
2424
$ sl COMMAND
@@ -136,7 +136,8 @@ OPTIONS
136136
137137
-s, --baseService=(authentication-service|audit-service|chat-service|notification-service|bpmn-service|feature-toggle-
138138
service|in-mail-service|payment-service|scheduler-service|search-service|survey-service|task-service|video-conferencin
139-
g-service|user-tenant-service)
139+
g-service|user-tenant-service|ctrl-plane-tenant-management-service|ctrl-plane-subscription-service|ctrl-plane-orchestr
140+
ator-service)
140141
Base ARC microservice
141142
142143
--[no-]baseOnService

packages/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@
220220
"@sourceloop/task-service": "^4.0.2",
221221
"@sourceloop/user-tenant-service": "^3.0.2",
222222
"@sourceloop/video-conferencing-service": "^14.0.2",
223+
"@sourceloop/ctrl-plane-orchestrator-service": "^0.1.1",
224+
"@sourceloop/ctrl-plane-tenant-management-service": "^0.4.1",
225+
"@sourceloop/ctrl-plane-subscription-service": "^0.4.0",
223226
"@sourceloop/audit-log": "^8.0.5",
224227
"@sourceloop/vault": "^7.0.3",
225228
"loopback4-authentication": "^12.1.1",

packages/cli/src/enum.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export enum SERVICES {
1717
TASK = 'task-service',
1818
VIDEO_CONF = 'video-conferencing-service',
1919
USER_TENANT = 'user-tenant-service',
20+
TEANANT_MANAGEMENT = 'ctrl-plane-tenant-management-service',
21+
SUBSCRIPTION = 'ctrl-plane-subscription-service',
22+
ORCHESTRATOR = 'ctrl-plane-orchestrator-service',
2023
}
2124

2225
export enum DATASOURCES {
@@ -96,6 +99,28 @@ export const BASESERVICEDSLIST: {
9699
],
97100
'chat-service': [],
98101
'user-tenant-service': [],
102+
'ctrl-plane-tenant-management-service': [
103+
{
104+
type: 'store',
105+
name: 'TenantManagementDbSourceName',
106+
fileName: 'tenantManagement',
107+
},
108+
{type: 'cache', name: 'TenantManagementCacheSourceName', fileName: 'redis'},
109+
],
110+
111+
'ctrl-plane-subscription-service': [
112+
{
113+
type: 'store',
114+
name: 'SubscriptionDbSourceName',
115+
fileName: 'subscription',
116+
},
117+
{
118+
type: 'store',
119+
name: 'FeatureToggleDbName',
120+
fileName: 'feature',
121+
},
122+
],
123+
'ctrl-plane-orchestrator-service': [],
99124
};
100125

101126
export const BASESERVICECOMPONENTLIST: {
@@ -115,6 +140,9 @@ export const BASESERVICECOMPONENTLIST: {
115140
'video-conferencing-service': 'VideoConfServiceComponent',
116141
'chat-service': 'ChatServiceComponent',
117142
'user-tenant-service': 'UserTenantServiceComponent',
143+
'ctrl-plane-tenant-management-service': 'TenantManagementServiceComponent',
144+
'ctrl-plane-subscription-service': 'SubscriptionServiceComponent',
145+
'ctrl-plane-orchestrator-service': 'OrchestratorServiceComponent',
118146
};
119147

120148
export const BASESERVICEBINDINGLIST: {
@@ -134,6 +162,9 @@ export const BASESERVICEBINDINGLIST: {
134162
'video-conferencing-service': 'VideoChatBindings',
135163
'chat-service': 'ChatServiceBindings',
136164
'user-tenant-service': 'UserTenantServiceComponentBindings',
165+
'ctrl-plane-tenant-management-service': 'TenantManagementServiceComponent',
166+
'ctrl-plane-subscription-service': 'SubscriptionServiceBindings',
167+
'ctrl-plane-orchestrator-service': 'TenantManagementServiceBindings',
137168
};
138169

139170
export enum SEQUELIZESERVICES {

packages/cli/src/generators/microservice/index.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,18 @@ export default class MicroserviceGenerator extends AppGenerator<MicroserviceOpti
372372
} else {
373373
//do nothing
374374
}
375+
375376
const promises = baseServiceDSList.map(async ds => {
377+
const localProjectInfo = {...this.projectInfo};
378+
376379
if (ds.type === 'store') {
377-
if (!ds.isNotBase) this.projectInfo.baseServiceStoreName = ds.name;
378-
this.projectInfo.datasourceName = ds.fileName;
379-
this.projectInfo.datasourceClassName = this._capitalizeFirstLetter(
380+
if (!ds.isNotBase) localProjectInfo.baseServiceStoreName = ds.name;
381+
382+
localProjectInfo.datasourceName = ds.fileName;
383+
localProjectInfo.datasourceClassName = this._capitalizeFirstLetter(
380384
ds.fileName,
381385
);
386+
382387
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
383388
//@ts-ignore
384389
await this.fs.copyTplAsync(
@@ -387,13 +392,12 @@ export default class MicroserviceGenerator extends AppGenerator<MicroserviceOpti
387392
join('src', 'datasources', `${ds.fileName}.datasource.ts`),
388393
),
389394
{
390-
project: this.projectInfo,
395+
project: localProjectInfo,
391396
},
392397
);
393-
394-
this.projectInfo.baseServiceStoreName = undefined; //so that previous value is not used
395398
} else {
396-
this.projectInfo.baseServiceCacheName = ds.name;
399+
localProjectInfo.baseServiceCacheName = ds.name;
400+
397401
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
398402
//@ts-ignore
399403
await this.fs.copyTplAsync(
@@ -402,7 +406,7 @@ export default class MicroserviceGenerator extends AppGenerator<MicroserviceOpti
402406
join('src', 'datasources', `${ds.fileName}.datasource.ts`),
403407
),
404408
{
405-
project: this.projectInfo,
409+
project: localProjectInfo,
406410
},
407411
);
408412
}

0 commit comments

Comments
 (0)