Skip to content

Commit c0f1b1a

Browse files
Sunny  TyagiVaibhav  Bhalla
authored andcommitted
feat(cli): add arc-saas support
gh-2270
1 parent 8644424 commit c0f1b1a

File tree

4 files changed

+50
-11
lines changed

4 files changed

+50
-11
lines changed

packages/cli/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ OPTIONS
163163
164164
-s, --baseService=(authentication-service|audit-service|chat-service|notification-service|bpmn-service|feature-toggle-
165165
service|in-mail-service|payment-service|scheduler-service|search-service|survey-service|task-service|video-conferencin
166-
g-service|user-tenant-service|reporting-service)
166+
g-service|user-tenant-service|ctrl-plane-tenant-management-service|ctrl-plane-subscription-service|ctrl-plane-orchestr
167+
ator-service|reporting-service)
167168
Base ARC microservice
168169
169170
--[no-]baseOnService

packages/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@
222222
"@sourceloop/task-service": "^4.0.2",
223223
"@sourceloop/user-tenant-service": "^3.0.2",
224224
"@sourceloop/video-conferencing-service": "^14.0.2",
225+
"@sourceloop/ctrl-plane-orchestrator-service": "^0.1.1",
226+
"@sourceloop/ctrl-plane-tenant-management-service": "^0.4.1",
227+
"@sourceloop/ctrl-plane-subscription-service": "^0.4.0",
225228
"@sourceloop/audit-log": "^8.0.5",
226229
"@sourceloop/vault": "^7.0.3",
227230
"loopback4-authentication": "^12.1.1",

packages/cli/src/enum.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export enum SERVICES {
1818
VIDEO_CONF = 'video-conferencing-service',
1919
USER_TENANT = 'user-tenant-service',
2020
REPORTING = 'reporting-service',
21+
TEANANT_MANAGEMENT = 'ctrl-plane-tenant-management-service',
22+
SUBSCRIPTION = 'ctrl-plane-subscription-service',
23+
ORCHESTRATOR = 'ctrl-plane-orchestrator-service',
2124
}
2225

2326
export enum DATASOURCES {
@@ -100,6 +103,28 @@ export const BASESERVICEDSLIST: {
100103
],
101104
'chat-service': [],
102105
'user-tenant-service': [],
106+
'ctrl-plane-tenant-management-service': [
107+
{
108+
type: 'store',
109+
name: 'TenantManagementDbSourceName',
110+
fileName: 'tenantManagement',
111+
},
112+
{type: 'cache', name: 'TenantManagementCacheSourceName', fileName: 'redis'},
113+
],
114+
115+
'ctrl-plane-subscription-service': [
116+
{
117+
type: 'store',
118+
name: 'SubscriptionDbSourceName',
119+
fileName: 'subscription',
120+
},
121+
{
122+
type: 'store',
123+
name: 'FeatureToggleDbName',
124+
fileName: 'feature',
125+
},
126+
],
127+
'ctrl-plane-orchestrator-service': [],
103128
};
104129

105130
export const BASESERVICECOMPONENTLIST: {
@@ -119,7 +144,10 @@ export const BASESERVICECOMPONENTLIST: {
119144
'video-conferencing-service': 'VideoConfServiceComponent',
120145
'chat-service': 'ChatServiceComponent',
121146
'user-tenant-service': 'UserTenantServiceComponent',
122-
'reporting-service': 'ReportingServiceComponent'
147+
'reporting-service': 'ReportingServiceComponent',
148+
'ctrl-plane-tenant-management-service': 'TenantManagementServiceComponent',
149+
'ctrl-plane-subscription-service': 'SubscriptionServiceComponent',
150+
'ctrl-plane-orchestrator-service': 'OrchestratorServiceComponent',
123151
};
124152

125153
export const BASESERVICEBINDINGLIST: {
@@ -139,7 +167,10 @@ export const BASESERVICEBINDINGLIST: {
139167
'video-conferencing-service': 'VideoChatBindings',
140168
'chat-service': 'ChatServiceBindings',
141169
'user-tenant-service': 'UserTenantServiceComponentBindings',
142-
'reporting-service': 'ReportingServiceComponentBindings'
170+
'reporting-service': 'ReportingServiceComponentBindings',
171+
'ctrl-plane-tenant-management-service': 'TenantManagementServiceComponent',
172+
'ctrl-plane-subscription-service': 'SubscriptionServiceBindings',
173+
'ctrl-plane-orchestrator-service': 'TenantManagementServiceBindings',
143174
};
144175

145176
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)