@opencrvs/toolkit 2.1.0-rc.f383722 → 2.1.0-rc.f5f3da9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/application-config/index.js +0 -1
- package/dist/cli.js +217 -77
- package/dist/commons/api/router.d.ts +0 -85
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -6
- package/dist/commons/events/AuditLog.d.ts +0 -37
- package/dist/commons/events/EventIndex.d.ts +2 -2
- package/dist/commons/events/FieldConfig.d.ts +1 -6
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +0 -7
- package/dist/conditionals/index.js +0 -1
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +3 -12
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/paths.d.ts +13 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +94 -0
- package/dist/environment/setup-environment.js +2 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +4 -3
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +100 -0
- package/dist/environment/users.js +11 -13
- package/dist/events/index.js +0 -88
- package/dist/notification/index.js +25 -99
- package/dist/scopes/index.d.ts +26 -28
- package/dist/scopes/index.js +0 -1
- package/opencrvs-toolkit-2.1.0-rc.f5f3da9.tgz +0 -0
- package/package.json +3 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/.nx/cache/file-map.json +0 -360
- package/.nx/cache/project-graph.json +0 -6
- package/dist/commons/events/locationPayloads.d.ts +0 -95
- package/opencrvs-toolkit-2.1.0-rc.f383722.tgz +0 -0
|
@@ -85,16 +85,16 @@ export declare const now: typeof todayDateTimeValueSerializer;
|
|
|
85
85
|
export declare const user: typeof userSerializer & {
|
|
86
86
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
87
87
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
88
|
-
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "
|
|
88
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
89
89
|
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
93
|
-
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "
|
|
93
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
94
94
|
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
|
|
95
95
|
}) => {
|
|
96
96
|
$jurisdiction: "administrativeArea" | "all" | "location" | {
|
|
97
|
-
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "
|
|
97
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
98
98
|
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
|
|
99
99
|
};
|
|
100
100
|
};
|
|
@@ -103,7 +103,6 @@ export declare const FieldConfigSchema: z.ZodObject<{
|
|
|
103
103
|
"config.update-all": "config.update-all";
|
|
104
104
|
"dashboard.view": "dashboard.view";
|
|
105
105
|
"integration.create": "integration.create";
|
|
106
|
-
"location.edit": "location.edit";
|
|
107
106
|
"organisation.read-locations": "organisation.read-locations";
|
|
108
107
|
"performance.read": "performance.read";
|
|
109
108
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -284,7 +283,6 @@ export declare const EventFieldConfigSchema: z.ZodObject<{
|
|
|
284
283
|
"config.update-all": "config.update-all";
|
|
285
284
|
"dashboard.view": "dashboard.view";
|
|
286
285
|
"integration.create": "integration.create";
|
|
287
|
-
"location.edit": "location.edit";
|
|
288
286
|
"organisation.read-locations": "organisation.read-locations";
|
|
289
287
|
"performance.read": "performance.read";
|
|
290
288
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -441,7 +439,6 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
441
439
|
"config.update-all": "config.update-all";
|
|
442
440
|
"dashboard.view": "dashboard.view";
|
|
443
441
|
"integration.create": "integration.create";
|
|
444
|
-
"location.edit": "location.edit";
|
|
445
442
|
"organisation.read-locations": "organisation.read-locations";
|
|
446
443
|
"performance.read": "performance.read";
|
|
447
444
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -590,7 +587,6 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
590
587
|
"config.update-all": "config.update-all";
|
|
591
588
|
"dashboard.view": "dashboard.view";
|
|
592
589
|
"integration.create": "integration.create";
|
|
593
|
-
"location.edit": "location.edit";
|
|
594
590
|
"organisation.read-locations": "organisation.read-locations";
|
|
595
591
|
"performance.read": "performance.read";
|
|
596
592
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -750,7 +746,6 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
|
|
|
750
746
|
"config.update-all": "config.update-all";
|
|
751
747
|
"dashboard.view": "dashboard.view";
|
|
752
748
|
"integration.create": "integration.create";
|
|
753
|
-
"location.edit": "location.edit";
|
|
754
749
|
"organisation.read-locations": "organisation.read-locations";
|
|
755
750
|
"performance.read": "performance.read";
|
|
756
751
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -899,7 +894,6 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
|
|
|
899
894
|
"config.update-all": "config.update-all";
|
|
900
895
|
"dashboard.view": "dashboard.view";
|
|
901
896
|
"integration.create": "integration.create";
|
|
902
|
-
"location.edit": "location.edit";
|
|
903
897
|
"organisation.read-locations": "organisation.read-locations";
|
|
904
898
|
"performance.read": "performance.read";
|
|
905
899
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -281,43 +281,6 @@ export declare const AuditLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
281
281
|
responseSummary: z.ZodObject<{
|
|
282
282
|
clientId: z.ZodString;
|
|
283
283
|
}, z.core.$strip>;
|
|
284
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
285
|
-
id: z.ZodString;
|
|
286
|
-
clientId: z.ZodString;
|
|
287
|
-
clientType: z.ZodEnum<{
|
|
288
|
-
system: "system";
|
|
289
|
-
user: "user";
|
|
290
|
-
}>;
|
|
291
|
-
createdAt: z.ZodString;
|
|
292
|
-
operation: z.ZodLiteral<"locations.create">;
|
|
293
|
-
requestData: z.ZodObject<{
|
|
294
|
-
id: z.ZodString;
|
|
295
|
-
versionId: z.ZodString;
|
|
296
|
-
name: z.ZodString;
|
|
297
|
-
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
298
|
-
effectiveFrom: z.ZodString;
|
|
299
|
-
status: z.ZodString;
|
|
300
|
-
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
301
|
-
locationType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
302
|
-
}, z.core.$strip>;
|
|
303
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
304
|
-
id: z.ZodString;
|
|
305
|
-
clientId: z.ZodString;
|
|
306
|
-
clientType: z.ZodEnum<{
|
|
307
|
-
system: "system";
|
|
308
|
-
user: "user";
|
|
309
|
-
}>;
|
|
310
|
-
createdAt: z.ZodString;
|
|
311
|
-
operation: z.ZodLiteral<"administrativeAreas.create">;
|
|
312
|
-
requestData: z.ZodObject<{
|
|
313
|
-
id: z.ZodString;
|
|
314
|
-
versionId: z.ZodString;
|
|
315
|
-
name: z.ZodString;
|
|
316
|
-
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
317
|
-
effectiveFrom: z.ZodString;
|
|
318
|
-
status: z.ZodString;
|
|
319
|
-
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
|
-
}, z.core.$strip>;
|
|
321
284
|
}, z.core.$strip>, z.ZodObject<{
|
|
322
285
|
id: z.ZodString;
|
|
323
286
|
clientId: z.ZodString;
|
|
@@ -340,10 +340,10 @@ export type QueryTypeShape = {
|
|
|
340
340
|
};
|
|
341
341
|
export declare const QueryType: z.ZodType<QueryTypeShape>;
|
|
342
342
|
export declare const SearchQuery: z.ZodObject<{
|
|
343
|
-
query: z.
|
|
343
|
+
query: z.ZodPipe<z.ZodTransform<any, unknown>, ZodType<QueryTypeShape, unknown, z.core.$ZodTypeInternals<QueryTypeShape, unknown>>>;
|
|
344
344
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
345
345
|
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
346
|
-
sort: z.ZodOptional<z.
|
|
346
|
+
sort: z.ZodOptional<z.ZodPipe<z.ZodTransform<any, unknown>, z.ZodArray<z.ZodObject<{
|
|
347
347
|
field: z.ZodString;
|
|
348
348
|
direction: z.ZodDefault<z.ZodEnum<{
|
|
349
349
|
asc: "asc";
|
|
@@ -1883,7 +1883,6 @@ declare const AdministrativeAreaField: z.ZodObject<{
|
|
|
1883
1883
|
"config.update-all": "config.update-all";
|
|
1884
1884
|
"dashboard.view": "dashboard.view";
|
|
1885
1885
|
"integration.create": "integration.create";
|
|
1886
|
-
"location.edit": "location.edit";
|
|
1887
1886
|
"organisation.read-locations": "organisation.read-locations";
|
|
1888
1887
|
"performance.read": "performance.read";
|
|
1889
1888
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -2013,7 +2012,6 @@ declare const LocationInput: z.ZodObject<{
|
|
|
2013
2012
|
"config.update-all": "config.update-all";
|
|
2014
2013
|
"dashboard.view": "dashboard.view";
|
|
2015
2014
|
"integration.create": "integration.create";
|
|
2016
|
-
"location.edit": "location.edit";
|
|
2017
2015
|
"organisation.read-locations": "organisation.read-locations";
|
|
2018
2016
|
"performance.read": "performance.read";
|
|
2019
2017
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -2214,7 +2212,6 @@ declare const Facility: z.ZodObject<{
|
|
|
2214
2212
|
"config.update-all": "config.update-all";
|
|
2215
2213
|
"dashboard.view": "dashboard.view";
|
|
2216
2214
|
"integration.create": "integration.create";
|
|
2217
|
-
"location.edit": "location.edit";
|
|
2218
2215
|
"organisation.read-locations": "organisation.read-locations";
|
|
2219
2216
|
"performance.read": "performance.read";
|
|
2220
2217
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -2330,7 +2327,6 @@ declare const Office: z.ZodObject<{
|
|
|
2330
2327
|
"config.update-all": "config.update-all";
|
|
2331
2328
|
"dashboard.view": "dashboard.view";
|
|
2332
2329
|
"integration.create": "integration.create";
|
|
2333
|
-
"location.edit": "location.edit";
|
|
2334
2330
|
"organisation.read-locations": "organisation.read-locations";
|
|
2335
2331
|
"performance.read": "performance.read";
|
|
2336
2332
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -2532,7 +2528,6 @@ declare const Address: z.ZodObject<{
|
|
|
2532
2528
|
"config.update-all": "config.update-all";
|
|
2533
2529
|
"dashboard.view": "dashboard.view";
|
|
2534
2530
|
"integration.create": "integration.create";
|
|
2535
|
-
"location.edit": "location.edit";
|
|
2536
2531
|
"organisation.read-locations": "organisation.read-locations";
|
|
2537
2532
|
"performance.read": "performance.read";
|
|
2538
2533
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -3050,7 +3045,7 @@ declare const SearchField: z.ZodObject<{
|
|
|
3050
3045
|
}, z.core.$strip>]>>;
|
|
3051
3046
|
type: z.ZodLiteral<"SEARCH">;
|
|
3052
3047
|
configuration: z.ZodObject<{
|
|
3053
|
-
query: z.
|
|
3048
|
+
query: z.ZodPipe<z.ZodTransform<any, unknown>, z.ZodType<import("./EventIndex").QueryTypeShape, unknown, z.core.$ZodTypeInternals<import("./EventIndex").QueryTypeShape, unknown>>>;
|
|
3054
3049
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
3055
3050
|
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
3056
3051
|
validation: z.ZodObject<{
|
|
@@ -45,7 +45,6 @@ export * from './field';
|
|
|
45
45
|
export * from './Flag';
|
|
46
46
|
export * from './event';
|
|
47
47
|
export * from './locations';
|
|
48
|
-
export * from './locationPayloads';
|
|
49
48
|
export { UUID } from '../uuid';
|
|
50
49
|
export { DocumentPath } from '../documents';
|
|
51
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -111,13 +111,6 @@ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaP
|
|
|
111
111
|
export declare function resolveVersion<T extends {
|
|
112
112
|
effectiveFrom: string;
|
|
113
113
|
}>(versions: T[], anchor: string): T;
|
|
114
|
-
/**
|
|
115
|
-
* Whether the entity holds the given externalId with active status at the
|
|
116
|
-
* anchor date or at any point after it. Used for point-in-time uniqueness of
|
|
117
|
-
* external codes: a new holder starting at `anchor` collides when an existing
|
|
118
|
-
* holder is (or is scheduled to be) active with the code from then on.
|
|
119
|
-
*/
|
|
120
|
-
export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
|
|
121
114
|
type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
|
|
122
115
|
/**
|
|
123
116
|
* For type T, convert fields K to arrays. If field is string, convert to string[].
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function runEnvironmentInit(): Promise<void>;
|
|
2
|
+
export declare function runEnvironmentUpgrade(): Promise<void>;
|
|
2
3
|
export declare function runEnvironmentUpdateWorkflows(): Promise<void>;
|
|
3
4
|
export declare function runEnvironmentUsers(): Promise<void>;
|
|
4
5
|
export declare function runEnvironmentSwarmToK8s(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":"AAyCA,wBAAsB,kBAAkB,kBAIvC;AAED,wBAAsB,qBAAqB,kBAI1C;AAED,wBAAsB,6BAA6B,kBAIlD;AAED,wBAAsB,mBAAmB,kBAIxC;AAED,wBAAsB,wBAAwB,kBAG7C"}
|
|
@@ -20,11 +20,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.runEnvironmentInit = runEnvironmentInit;
|
|
23
|
+
exports.runEnvironmentUpgrade = runEnvironmentUpgrade;
|
|
23
24
|
exports.runEnvironmentUpdateWorkflows = runEnvironmentUpdateWorkflows;
|
|
24
25
|
exports.runEnvironmentUsers = runEnvironmentUsers;
|
|
25
26
|
exports.runEnvironmentSwarmToK8s = runEnvironmentSwarmToK8s;
|
|
26
27
|
const fs_1 = require("fs");
|
|
27
28
|
const path_1 = require("path");
|
|
29
|
+
const paths_1 = require("./paths");
|
|
28
30
|
const REQUIRED_REPOSITORY_DIRECTORIES = [
|
|
29
31
|
'.github/workflows',
|
|
30
32
|
'environments',
|
|
@@ -46,9 +48,17 @@ function validateRepositoryStructure(repositoryRoot = process.cwd()) {
|
|
|
46
48
|
function runEnvironmentInit() {
|
|
47
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
50
|
validateRepositoryStructure();
|
|
51
|
+
(0, paths_1.assertNoOldInventoryLayout)();
|
|
49
52
|
yield import('./setup-environment.js');
|
|
50
53
|
});
|
|
51
54
|
}
|
|
55
|
+
function runEnvironmentUpgrade() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
validateRepositoryStructure();
|
|
58
|
+
const { upgradeEnvironmentLayout } = yield import('./upgrade.js');
|
|
59
|
+
yield upgradeEnvironmentLayout();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
52
62
|
function runEnvironmentUpdateWorkflows() {
|
|
53
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
64
|
validateRepositoryStructure();
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
export declare const log:
|
|
2
|
-
|
|
3
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
4
|
-
};
|
|
5
|
-
export declare const warn: {
|
|
6
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
7
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
8
|
-
};
|
|
1
|
+
export declare const log: (message?: any, ...optionalParams: any[]) => void;
|
|
2
|
+
export declare const warn: (message?: any, ...optionalParams: any[]) => void;
|
|
9
3
|
export declare const success: (...args: any[]) => void;
|
|
10
|
-
export declare const info:
|
|
11
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
12
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
13
|
-
};
|
|
4
|
+
export declare const info: (message?: any, ...optionalParams: any[]) => void;
|
|
14
5
|
export declare const error: (...args: any[]) => void;
|
|
15
6
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/environment/logger.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/environment/logger.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,GAAG,mDAAc,CAAA;AAC9B,eAAO,MAAM,IAAI,mDAAe,CAAA;AAChC,eAAO,MAAM,OAAO,YAAa,GAAG,EAAE,SACI,CAAA;AAC1C,eAAO,MAAM,IAAI,mDAAe,CAAA;AAChC,eAAO,MAAM,KAAK,YAAa,GAAG,EAAE,SAA2C,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const OLD_INVENTORY_DIR: string;
|
|
2
|
+
export declare const INVENTORY_FILE_NAME = "inventory.yml";
|
|
3
|
+
export declare const INVENTORY_VARS_FILE_NAME = "inventory-vars.yml";
|
|
4
|
+
export declare function getEnvironmentDir(environment: string): string;
|
|
5
|
+
export declare function getEnvironmentInventoryPath(environment: string): string;
|
|
6
|
+
export declare function getEnvironmentInventoryVarsPath(environment: string): string;
|
|
7
|
+
export declare function getOldInventoryPath(environment: string): string;
|
|
8
|
+
export declare function findOldInventoryFiles(): string[];
|
|
9
|
+
export declare function getEnvironmentNameFromOldInventoryPath(filePath: string): string;
|
|
10
|
+
export declare function hasOldInventoryLayout(): boolean;
|
|
11
|
+
export declare function assertNoOldInventoryLayout(): void;
|
|
12
|
+
export declare function hasEnvironmentInventory(environment: string): boolean;
|
|
13
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/environment/paths.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,iBAAiB,QAI7B,CAAA;AAED,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAClD,eAAO,MAAM,wBAAwB,uBAAuB,CAAA;AAE5D,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,UAEpD;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,UAE9D;AAED,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,UAElE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,UAEtD;AAED,wBAAgB,qBAAqB,aAEpC;AAED,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,MAAM,UAEtE;AAED,wBAAgB,qBAAqB,YAEpC;AAED,wBAAgB,0BAA0B,SAWzC;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,WAE1D"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.INVENTORY_VARS_FILE_NAME = exports.INVENTORY_FILE_NAME = exports.OLD_INVENTORY_DIR = void 0;
|
|
47
|
+
exports.getEnvironmentDir = getEnvironmentDir;
|
|
48
|
+
exports.getEnvironmentInventoryPath = getEnvironmentInventoryPath;
|
|
49
|
+
exports.getEnvironmentInventoryVarsPath = getEnvironmentInventoryVarsPath;
|
|
50
|
+
exports.getOldInventoryPath = getOldInventoryPath;
|
|
51
|
+
exports.findOldInventoryFiles = findOldInventoryFiles;
|
|
52
|
+
exports.getEnvironmentNameFromOldInventoryPath = getEnvironmentNameFromOldInventoryPath;
|
|
53
|
+
exports.hasOldInventoryLayout = hasOldInventoryLayout;
|
|
54
|
+
exports.assertNoOldInventoryLayout = assertNoOldInventoryLayout;
|
|
55
|
+
exports.hasEnvironmentInventory = hasEnvironmentInventory;
|
|
56
|
+
const fs_1 = require("fs");
|
|
57
|
+
const path_1 = require("path");
|
|
58
|
+
const glob = __importStar(require("glob"));
|
|
59
|
+
exports.OLD_INVENTORY_DIR = (0, path_1.join)('infrastructure', 'server-setup', 'inventory');
|
|
60
|
+
exports.INVENTORY_FILE_NAME = 'inventory.yml';
|
|
61
|
+
exports.INVENTORY_VARS_FILE_NAME = 'inventory-vars.yml';
|
|
62
|
+
function getEnvironmentDir(environment) {
|
|
63
|
+
return (0, path_1.join)('environments', environment);
|
|
64
|
+
}
|
|
65
|
+
function getEnvironmentInventoryPath(environment) {
|
|
66
|
+
return (0, path_1.join)(getEnvironmentDir(environment), exports.INVENTORY_FILE_NAME);
|
|
67
|
+
}
|
|
68
|
+
function getEnvironmentInventoryVarsPath(environment) {
|
|
69
|
+
return (0, path_1.join)(getEnvironmentDir(environment), exports.INVENTORY_VARS_FILE_NAME);
|
|
70
|
+
}
|
|
71
|
+
function getOldInventoryPath(environment) {
|
|
72
|
+
return (0, path_1.join)(exports.OLD_INVENTORY_DIR, `${environment}.yml`);
|
|
73
|
+
}
|
|
74
|
+
function findOldInventoryFiles() {
|
|
75
|
+
return glob.sync((0, path_1.join)(exports.OLD_INVENTORY_DIR, '*.yml')).sort();
|
|
76
|
+
}
|
|
77
|
+
function getEnvironmentNameFromOldInventoryPath(filePath) {
|
|
78
|
+
return (0, path_1.basename)(filePath, '.yml');
|
|
79
|
+
}
|
|
80
|
+
function hasOldInventoryLayout() {
|
|
81
|
+
return findOldInventoryFiles().length > 0;
|
|
82
|
+
}
|
|
83
|
+
function assertNoOldInventoryLayout() {
|
|
84
|
+
if (!hasOldInventoryLayout()) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
throw new Error([
|
|
88
|
+
`Old inventory layout detected at ${exports.OLD_INVENTORY_DIR}.`,
|
|
89
|
+
'Please run `yarn environment:upgrade` before running `yarn environment:init`.'
|
|
90
|
+
].join(' '));
|
|
91
|
+
}
|
|
92
|
+
function hasEnvironmentInventory(environment) {
|
|
93
|
+
return (0, fs_1.existsSync)(getEnvironmentInventoryPath(environment));
|
|
94
|
+
}
|
|
@@ -59,6 +59,7 @@ const questions_1 = require("./questions");
|
|
|
59
59
|
const editor_questions_1 = require("./editor-questions");
|
|
60
60
|
const questions_helper_1 = require("./questions-helper");
|
|
61
61
|
const manage_users_1 = require("./manage-users");
|
|
62
|
+
const paths_1 = require("./paths");
|
|
62
63
|
function questionToPrompt(_a) {
|
|
63
64
|
var { valueType, valueLabel, scope } = _a, promptOptions = __rest(_a, ["valueType", "valueLabel", "scope"]);
|
|
64
65
|
return promptOptions;
|
|
@@ -271,7 +272,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
271
272
|
? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
|
|
272
273
|
: [];
|
|
273
274
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('SSH Users'), '\n');
|
|
274
|
-
const users = yield (0, manage_users_1.manageUsers)(
|
|
275
|
+
const users = yield (0, manage_users_1.manageUsers)((0, paths_1.getEnvironmentInventoryPath)(environment));
|
|
275
276
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Traefik SSL Certificate'), '\n');
|
|
276
277
|
const sslCertExists = (0, utils_1.findExistingValue)('SSL_CRT', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
277
278
|
let ssl_answers = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAKvC;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAYpD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAWpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CASnD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,CAStD;AAGD;;;;GAIG;AACH;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QA0CzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAsBzE"}
|
|
@@ -34,6 +34,7 @@ exports.generateInventory = generateInventory;
|
|
|
34
34
|
const fs_1 = __importDefault(require("fs"));
|
|
35
35
|
const path_1 = __importDefault(require("path"));
|
|
36
36
|
const logger_1 = require("./logger");
|
|
37
|
+
const paths_1 = require("./paths");
|
|
37
38
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
38
39
|
// Register a helper to increment numbers
|
|
39
40
|
handlebars_1.default.registerHelper('data_label_idx', function (value) {
|
|
@@ -149,7 +150,7 @@ function copyChartsValues(env, values) {
|
|
|
149
150
|
function generateInventory(env, values) {
|
|
150
151
|
// Template and output paths
|
|
151
152
|
const templatePath = path_1.default.join(__dirname, 'templates', 'inventory', 'inventory.template.yml');
|
|
152
|
-
const outputPath = path_1.default.
|
|
153
|
+
const outputPath = path_1.default.resolve(process.cwd(), (0, paths_1.getEnvironmentInventoryPath)(env));
|
|
153
154
|
const templateFile = fs_1.default.readFileSync(templatePath, 'utf-8');
|
|
154
155
|
const template = handlebars_1.default.compile(templateFile);
|
|
155
156
|
values['single_node'] =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"AAiHA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgDhE"}
|
|
@@ -60,12 +60,13 @@ const path_1 = require("path");
|
|
|
60
60
|
const glob = __importStar(require("glob"));
|
|
61
61
|
const yaml = __importStar(require("js-yaml"));
|
|
62
62
|
const logger_1 = require("./logger");
|
|
63
|
+
const paths_1 = require("./paths");
|
|
63
64
|
function extractInfrastructureNames() {
|
|
64
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const files = glob.sync('
|
|
66
|
-
const infraEnvironments = files.map((file) => (0, path_1.basename)(
|
|
66
|
+
const files = glob.sync((0, path_1.join)('environments', '*', paths_1.INVENTORY_FILE_NAME));
|
|
67
|
+
const infraEnvironments = files.map((file) => (0, path_1.basename)((0, path_1.dirname)(file)));
|
|
67
68
|
if (infraEnvironments.length === 0) {
|
|
68
|
-
console.log(
|
|
69
|
+
console.log(`⚠️ Warning: No environment inventory files found at environments/*/${paths_1.INVENTORY_FILE_NAME}`);
|
|
69
70
|
return [];
|
|
70
71
|
}
|
|
71
72
|
(0, logger_1.log)('🔍 Found infrastructure configurations:', infraEnvironments.join(', '));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/environment/upgrade.ts"],"names":[],"mappings":"AAiHA,wBAAsB,wBAAwB,kBAY7C"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.upgradeEnvironmentLayout = upgradeEnvironmentLayout;
|
|
26
|
+
const fs_1 = require("fs");
|
|
27
|
+
const path_1 = require("path");
|
|
28
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
29
|
+
const logger_1 = require("./logger");
|
|
30
|
+
const paths_1 = require("./paths");
|
|
31
|
+
const update_workflows_1 = require("./update-workflows");
|
|
32
|
+
function moveFileIfDestinationMissing(sourcePath, destinationPath) {
|
|
33
|
+
if (!(0, fs_1.existsSync)(sourcePath)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if ((0, fs_1.existsSync)(destinationPath)) {
|
|
37
|
+
(0, logger_1.warn)(`⚠️ Skipped ${sourcePath}; destination already exists at ${destinationPath}`);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(destinationPath), { recursive: true });
|
|
41
|
+
(0, fs_1.renameSync)(sourcePath, destinationPath);
|
|
42
|
+
(0, logger_1.log)(` ✓ Moved ${sourcePath} -> ${destinationPath}`);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
function migrateInventoryFiles() {
|
|
46
|
+
const oldInventoryFiles = (0, paths_1.findOldInventoryFiles)();
|
|
47
|
+
if (oldInventoryFiles.length === 0) {
|
|
48
|
+
(0, logger_1.log)(`ℹ️ No old inventory files found at ${paths_1.OLD_INVENTORY_DIR}`);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
(0, logger_1.log)(kleur_1.default.bold('\nMigrating Ansible inventory files'));
|
|
52
|
+
let didMoveInventory = false;
|
|
53
|
+
for (const oldInventoryFile of oldInventoryFiles) {
|
|
54
|
+
const environment = (0, paths_1.getEnvironmentNameFromOldInventoryPath)(oldInventoryFile);
|
|
55
|
+
didMoveInventory =
|
|
56
|
+
moveFileIfDestinationMissing(oldInventoryFile, (0, paths_1.getEnvironmentInventoryPath)(environment)) || didMoveInventory;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
if ((0, fs_1.existsSync)(paths_1.OLD_INVENTORY_DIR) &&
|
|
60
|
+
(0, fs_1.readdirSync)(paths_1.OLD_INVENTORY_DIR).length === 0) {
|
|
61
|
+
(0, fs_1.rmdirSync)(paths_1.OLD_INVENTORY_DIR);
|
|
62
|
+
(0, logger_1.log)(` ✓ Removed empty ${paths_1.OLD_INVENTORY_DIR}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (_a) {
|
|
66
|
+
(0, logger_1.warn)(`⚠️ Could not remove ${paths_1.OLD_INVENTORY_DIR}; please review it manually`);
|
|
67
|
+
}
|
|
68
|
+
return didMoveInventory;
|
|
69
|
+
}
|
|
70
|
+
function migrateInventoryVarsFiles() {
|
|
71
|
+
if (!(0, fs_1.existsSync)('environments')) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
(0, logger_1.log)(kleur_1.default.bold('\nMigrating optional inventory variable files'));
|
|
75
|
+
let didMoveVars = false;
|
|
76
|
+
for (const entry of (0, fs_1.readdirSync)('environments')) {
|
|
77
|
+
const environmentDir = (0, path_1.join)('environments', entry);
|
|
78
|
+
if (!(0, fs_1.statSync)(environmentDir).isDirectory()) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
didMoveVars =
|
|
82
|
+
moveFileIfDestinationMissing((0, path_1.join)(environmentDir, 'inventory.override.yml'), (0, paths_1.getEnvironmentInventoryVarsPath)(entry)) || didMoveVars;
|
|
83
|
+
}
|
|
84
|
+
if (!didMoveVars) {
|
|
85
|
+
(0, logger_1.log)(`ℹ️ No inventory override files found to rename to ${paths_1.INVENTORY_VARS_FILE_NAME}`);
|
|
86
|
+
}
|
|
87
|
+
return didMoveVars;
|
|
88
|
+
}
|
|
89
|
+
function upgradeEnvironmentLayout() {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const didMoveInventory = migrateInventoryFiles();
|
|
92
|
+
const didMoveVars = migrateInventoryVarsFiles();
|
|
93
|
+
yield (0, update_workflows_1.updateWorkflowEnvironments)();
|
|
94
|
+
if (didMoveInventory || didMoveVars) {
|
|
95
|
+
(0, logger_1.success)('\n✅ Environment layout upgrade completed successfully.');
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
(0, logger_1.success)('\n✅ Environment layout already uses the current structure.');
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -62,6 +62,7 @@ const path = __importStar(require("path"));
|
|
|
62
62
|
const kleur_1 = __importDefault(require("kleur"));
|
|
63
63
|
const manage_users_1 = require("./manage-users");
|
|
64
64
|
const logger_1 = require("./logger");
|
|
65
|
+
const paths_1 = require("./paths");
|
|
65
66
|
function select(options) {
|
|
66
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
68
|
const inquirer = yield import('@inquirer/prompts');
|
|
@@ -76,32 +77,29 @@ function select(options) {
|
|
|
76
77
|
* * @returns {string} Inventory file
|
|
77
78
|
*/
|
|
78
79
|
function selectInventoryFile() {
|
|
79
|
-
return __awaiter(this, arguments, void 0, function* (dirPath = './
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* (dirPath = './environments') {
|
|
80
81
|
// Check if directory exists
|
|
81
82
|
if (!fs.existsSync(dirPath)) {
|
|
82
83
|
(0, logger_1.warn)(`⚠️ No environment configuration directory found at ${dirPath}`);
|
|
83
84
|
(0, logger_1.warn)('Hint: If this is a new infrastructure repository, run `opencrvs environment init` first.');
|
|
84
85
|
return null;
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
const files = fs
|
|
87
|
+
const environments = fs
|
|
88
88
|
.readdirSync(dirPath)
|
|
89
|
-
.filter((
|
|
90
|
-
const filePath = path.join(dirPath,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return isFile && (ext === 'yml' || ext === 'yaml');
|
|
89
|
+
.filter((entry) => {
|
|
90
|
+
const filePath = path.join(dirPath, entry);
|
|
91
|
+
return (fs.statSync(filePath).isDirectory() &&
|
|
92
|
+
fs.existsSync((0, paths_1.getEnvironmentInventoryPath)(entry)));
|
|
94
93
|
})
|
|
95
94
|
.sort();
|
|
96
|
-
if (
|
|
95
|
+
if (environments.length === 0) {
|
|
97
96
|
(0, logger_1.warn)(`⚠️ No environment configuration files found at ${dirPath}`);
|
|
98
97
|
(0, logger_1.warn)('Hint: If this is a new infrastructure repository, run `opencrvs environment init` first.');
|
|
99
98
|
return null;
|
|
100
99
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
value: path.join(dirPath, file)
|
|
100
|
+
const choices = environments.map((environment) => ({
|
|
101
|
+
name: environment,
|
|
102
|
+
value: (0, paths_1.getEnvironmentInventoryPath)(environment)
|
|
105
103
|
}));
|
|
106
104
|
const selectedFile = yield select({
|
|
107
105
|
message: 'Select environment (inventory file) to load users:',
|