@opencrvs/toolkit 2.0.0-rc.3dce118 → 2.0.0-rc.3ddb687

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.
Files changed (130) hide show
  1. package/README.md +15 -0
  2. package/build.sh +5 -4
  3. package/create-countryconfig/index.js +50 -20
  4. package/create-countryconfig/package.json +12 -2
  5. package/dist/application-config/index.js +298 -123
  6. package/dist/cli.js +3223 -4688
  7. package/dist/commons/api/router.d.ts +3954 -211
  8. package/dist/commons/application-config/index.d.ts +1 -0
  9. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  10. package/dist/commons/conditionals/validate.d.ts +52 -2
  11. package/dist/commons/events/ActionConfig.d.ts +230 -2
  12. package/dist/commons/events/ActionDocument.d.ts +50 -0
  13. package/dist/commons/events/ActionInput.d.ts +140 -0
  14. package/dist/commons/events/ActionType.d.ts +6 -1
  15. package/dist/commons/events/AdvancedSearchConfig.d.ts +360 -0
  16. package/dist/commons/events/AuditLog.d.ts +2 -0
  17. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  18. package/dist/commons/events/Draft.d.ts +6 -2
  19. package/dist/commons/events/EventConfig.d.ts +2 -0
  20. package/dist/commons/events/EventDocument.d.ts +25 -0
  21. package/dist/commons/events/EventIndex.d.ts +25 -3
  22. package/dist/commons/events/EventMetadata.d.ts +26 -7
  23. package/dist/commons/events/FieldConfig.d.ts +393 -50
  24. package/dist/commons/events/FieldType.d.ts +1 -0
  25. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  26. package/dist/commons/events/FieldValue.d.ts +6 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +194 -152
  28. package/dist/commons/events/field.d.ts +53 -1
  29. package/dist/commons/events/index.d.ts +2 -0
  30. package/dist/commons/events/locations.d.ts +1 -0
  31. package/dist/commons/events/scopes.d.ts +1 -0
  32. package/dist/commons/events/state/flags.d.ts +16 -0
  33. package/dist/commons/events/state/index.d.ts +8 -4
  34. package/dist/commons/events/state/utils.d.ts +21 -289
  35. package/dist/commons/events/test.utils.d.ts +9 -1
  36. package/dist/commons/events/utils.d.ts +28 -3
  37. package/dist/conditionals/index.js +65 -5
  38. package/dist/environment/custom-types.d.ts +33 -0
  39. package/dist/environment/custom-types.d.ts.map +1 -0
  40. package/dist/environment/custom-types.js +12 -0
  41. package/dist/environment/derived-variables.d.ts +134 -0
  42. package/dist/environment/derived-variables.d.ts.map +1 -0
  43. package/dist/environment/derived-variables.js +169 -0
  44. package/dist/environment/editor-questions.d.ts +4 -0
  45. package/dist/environment/editor-questions.d.ts.map +1 -0
  46. package/dist/environment/editor-questions.js +67 -0
  47. package/dist/environment/git.d.ts +5 -0
  48. package/dist/environment/git.d.ts.map +1 -0
  49. package/dist/environment/git.js +38 -0
  50. package/dist/environment/github.d.ts +26 -0
  51. package/dist/environment/github.d.ts.map +1 -0
  52. package/dist/environment/github.js +247 -0
  53. package/dist/environment/index.d.ts +5 -0
  54. package/dist/environment/index.d.ts.map +1 -0
  55. package/dist/environment/index.js +71 -0
  56. package/dist/environment/logger.d.ts +15 -0
  57. package/dist/environment/logger.d.ts.map +1 -0
  58. package/dist/environment/logger.js +25 -0
  59. package/dist/environment/manage-users.d.ts +11 -0
  60. package/dist/environment/manage-users.d.ts.map +1 -0
  61. package/dist/environment/manage-users.js +497 -0
  62. package/dist/environment/questions-helper.d.ts +15 -0
  63. package/dist/environment/questions-helper.d.ts.map +1 -0
  64. package/dist/environment/questions-helper.js +70 -0
  65. package/dist/environment/questions.d.ts +199 -0
  66. package/dist/environment/questions.d.ts.map +1 -0
  67. package/dist/environment/questions.js +412 -0
  68. package/dist/environment/setup-environment.d.ts +2 -0
  69. package/dist/environment/setup-environment.d.ts.map +1 -0
  70. package/dist/environment/setup-environment.js +794 -0
  71. package/dist/environment/ssh-keygen.d.ts +5 -0
  72. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  73. package/dist/environment/ssh-keygen.js +21 -0
  74. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  75. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  76. package/dist/environment/swarm-to-k8s.js +173 -0
  77. package/dist/environment/templates.d.ts +27 -0
  78. package/dist/environment/templates.d.ts.map +1 -0
  79. package/dist/environment/templates.js +163 -0
  80. package/dist/environment/update-workflows.d.ts +2 -0
  81. package/dist/environment/update-workflows.d.ts.map +1 -0
  82. package/dist/environment/update-workflows.js +169 -0
  83. package/dist/environment/users.d.ts +2 -0
  84. package/dist/environment/users.d.ts.map +1 -0
  85. package/dist/environment/users.js +112 -0
  86. package/dist/environment/utils.d.ts +18 -0
  87. package/dist/environment/utils.d.ts.map +1 -0
  88. package/dist/environment/utils.js +100 -0
  89. package/dist/events/index.js +1272 -299
  90. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  91. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  92. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  93. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  94. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  95. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  96. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  97. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  98. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  99. package/dist/migrations/v2.0/index.d.ts +5 -3
  100. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  101. package/dist/migrations/v2.0/index.js +88 -4869
  102. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  103. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  104. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  105. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  106. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  107. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  108. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  109. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  110. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  111. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  112. package/dist/migrations/v2.1/index.d.ts +6 -0
  113. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  114. package/dist/migrations/v2.1/index.js +218 -0
  115. package/dist/notification/index.js +1038 -163
  116. package/dist/scopes/index.d.ts +100 -8
  117. package/dist/scopes/index.js +22 -7
  118. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  119. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  120. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  121. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  122. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  123. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  124. package/dist/templates/inventory/inventory.template.yml +100 -0
  125. package/dist/templates/inventory/production.example.yml +77 -0
  126. package/dist/templates/inventory/qa.example.yml +48 -0
  127. package/opencrvs-toolkit-2.0.0-rc.3ddb687.tgz +0 -0
  128. package/package.json +20 -2
  129. package/tsconfig.tsbuildinfo +1 -1
  130. package/opencrvs-toolkit-2.0.0-rc.3dce118.tgz +0 -0
@@ -131,7 +131,7 @@ export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate
131
131
  * * @param validatorContext - custom validation context
132
132
  * @returns {Partial<T>} A new object containing only the values for visible fields
133
133
  */
134
- export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean, declarationContext?: EventState): Partial<T>;
134
+ export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean): Partial<T>;
135
135
  export declare function omitHiddenPaginatedFields<T extends EventState | ActionUpdate>(formConfig: FormConfig, values: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean): Partial<Partial<T>>;
136
136
  /**
137
137
  *
@@ -328,6 +328,20 @@ export declare function findLastAssignmentAction(actions: Action[]): {
328
328
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
329
329
  annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
330
330
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
331
+ } | {
332
+ id: string & import("zod").$brand<"UUID">;
333
+ transactionId: string;
334
+ createdByUserType: "user" | "system";
335
+ createdAt: string;
336
+ createdBy: string;
337
+ declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
338
+ status: "Requested" | "Accepted" | "Rejected";
339
+ type: "UNARCHIVE";
340
+ createdByRole?: string | undefined;
341
+ createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
342
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
343
+ annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
344
+ originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
331
345
  } | {
332
346
  id: string & import("zod").$brand<"UUID">;
333
347
  transactionId: string;
@@ -386,6 +400,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
386
400
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
387
401
  annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
388
402
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
403
+ content?: {
404
+ immediateCorrection?: boolean | undefined;
405
+ } | undefined;
389
406
  } | {
390
407
  id: string & import("zod").$brand<"UUID">;
391
408
  transactionId: string;
@@ -438,7 +455,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
438
455
  createdByUserType: "user" | "system";
439
456
  createdAt: string;
440
457
  createdBy: string;
441
- type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
458
+ type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "UNARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
442
459
  status: "Rejected";
443
460
  createdByRole?: string | undefined;
444
461
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -559,7 +576,15 @@ export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
559
576
  };
560
577
  export declare function mergeDrafts(currentDraft: Draft, incomingDraft: Draft): Draft;
561
578
  export declare function getPendingAction(actions: Action[]): ActionDocument;
562
- export declare function getCompleteActionAnnotation(annotation: ActionUpdate, event: EventDocument, action: ActionDocument): ActionUpdate;
579
+ export declare function getCompleteActionAnnotation(event: EventDocument, action: ActionDocument): ActionUpdate;
580
+ /**
581
+ * Resolves the complete content for an action, inheriting from its original
582
+ * Requested action when the Accepted action carries no content of its own.
583
+ *
584
+ * Mirrors the same "originalActionId → merge from Requested" pattern used by
585
+ * getCompleteActionAnnotation and getCompleteActionDeclaration.
586
+ */
587
+ export declare function getCompleteActionContent(event: EventDocument, action: ActionDocument): Record<string, unknown> | null | undefined;
563
588
  export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
564
589
  export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
565
590
  export declare function aggregateActionDeclarations(event: EventDocument): EventState;
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/conditionals/index.ts
31
31
  var conditionals_exports = {};
32
32
  __export(conditionals_exports, {
33
+ always: () => always,
33
34
  alwaysTrue: () => alwaysTrue,
34
35
  and: () => and,
35
36
  createFieldConditionals: () => createFieldConditionals,
@@ -151,6 +152,7 @@ var RecordScopeTypeV2 = z6.enum([
151
152
  "record.edit",
152
153
  "record.reject",
153
154
  "record.archive",
155
+ "record.unarchive",
154
156
  "record.review-duplicates",
155
157
  "record.register",
156
158
  "record.print-certified-copies",
@@ -190,11 +192,13 @@ var scopeOptionsPlaceEvent = z6.object({
190
192
  event: scopeByEvent,
191
193
  placeOfEvent: JurisdictionFilter.optional()
192
194
  }).describe("Options applicable to all record scopes.");
193
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
195
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
196
+ notifiedIn: JurisdictionFilter.optional(),
197
+ notifiedBy: UserFilter.optional(),
194
198
  declaredIn: JurisdictionFilter.optional(),
195
199
  declaredBy: UserFilter.optional()
196
200
  }).describe("Options applicable to actions that may take place after DECLARE");
197
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
201
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
198
202
  registeredIn: JurisdictionFilter.optional(),
199
203
  registeredBy: UserFilter.optional()
200
204
  }).describe(
@@ -232,6 +236,8 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
232
236
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
233
237
  );
234
238
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
239
+ notifiedIn: UUID.nullish(),
240
+ notifiedBy: z6.string().optional(),
235
241
  declaredIn: UUID.nullish(),
236
242
  declaredBy: z6.string().optional()
237
243
  }).describe(
@@ -252,6 +258,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
252
258
  "record.edit",
253
259
  "record.reject",
254
260
  "record.archive",
261
+ "record.unarchive",
255
262
  "record.review-duplicates",
256
263
  "record.register"
257
264
  ]);
@@ -277,7 +284,7 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
277
284
  }),
278
285
  z6.object({
279
286
  type: ScopesWithDeclaredOptions,
280
- options: scopeOptionsDeclared.optional()
287
+ options: scopeOptionsDeclaredOrNotified.optional()
281
288
  }),
282
289
  z6.object({
283
290
  type: ScopesWithFullOptions,
@@ -365,7 +372,10 @@ var ScopeType2 = z6.enum([
365
372
  var EncodedScope2 = z6.string().brand("EncodedScope");
366
373
  var DEFAULT_SCOPE_OPTIONS = {
367
374
  placeOfEvent: JurisdictionFilter.enum.all,
368
- accessLevel: JurisdictionFilter.enum.all
375
+ accessLevel: JurisdictionFilter.enum.all,
376
+ notifiedIn: JurisdictionFilter.enum.all,
377
+ declaredIn: JurisdictionFilter.enum.all,
378
+ registeredIn: JurisdictionFilter.enum.all
369
379
  };
370
380
 
371
381
  // ../commons/src/users/userReferences.ts
@@ -452,6 +462,9 @@ function not(condition) {
452
462
  function never() {
453
463
  return not(alwaysTrue());
454
464
  }
465
+ function always() {
466
+ return defineConditional(alwaysTrue());
467
+ }
455
468
  function jsonFieldPath(field) {
456
469
  return [field.$$field, ...field.$$subfield].join("/");
457
470
  }
@@ -999,7 +1012,54 @@ function createFieldConditionals(fieldId) {
999
1012
  }
1000
1013
  },
1001
1014
  required: [fieldId]
1002
- })
1015
+ }),
1016
+ /**
1017
+ * Custom client-side validator. The provided function is serialised and executed
1018
+ * just-in-time on the client only. External references (e.g. lodash) are not
1019
+ * available inside the function body — all logic must be self-contained.
1020
+ *
1021
+ * @example
1022
+ * field('nid').customClientValidator((value) => {
1023
+ * // LUHN check — all logic must be inline
1024
+ * const digits = String(value).split('').map(Number)
1025
+ * // ...
1026
+ * return isValid
1027
+ * })
1028
+ */
1029
+ customClientValidator(validationFn) {
1030
+ const code = validationFn.toString();
1031
+ return defineFormConditional({
1032
+ type: "object",
1033
+ properties: wrapToPath(
1034
+ { [fieldId]: { customClientValidator: { code } } },
1035
+ this.$$subfield
1036
+ ),
1037
+ required: [fieldId]
1038
+ });
1039
+ },
1040
+ /**
1041
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1042
+ * that can be used as the `value` property or a DATA component entry.
1043
+ * The function receives the referenced field's value as the first argument and
1044
+ * the full form context as the second; its return value replaces the field reference.
1045
+ * The function is serialised and executed just-in-time on the client only.
1046
+ * External references (e.g. lodash) are not available inside the function body.
1047
+ *
1048
+ * For computing a default value without referencing a specific field, use
1049
+ * `evaluate(fn)` in the `defaultValue` property instead.
1050
+ *
1051
+ * @example
1052
+ * field('a').customClientEvaluation((aValue, ctx) =>
1053
+ * Number(aValue) + Number(ctx.$form.b)
1054
+ * )
1055
+ */
1056
+ customClientEvaluation(computationFn) {
1057
+ return {
1058
+ $$code: computationFn.toString(),
1059
+ $$field: fieldId,
1060
+ $$subfield: this.$$subfield
1061
+ };
1062
+ }
1003
1063
  };
1004
1064
  }
1005
1065
 
@@ -0,0 +1,33 @@
1
+ import { PromptObject } from 'prompts';
2
+ import { Secret, Variable } from './github';
3
+ export type Question<T extends string> = PromptObject<T> & {
4
+ name: T;
5
+ valueType?: 'SECRET' | 'VARIABLE';
6
+ scope: 'ENVIRONMENT' | 'REPOSITORY';
7
+ valueLabel?: string;
8
+ };
9
+ export type QuestionDescriptor<T extends string> = Omit<Question<T>, 'type'> & {
10
+ type: 'disabled' | PromptObject<T>['type'];
11
+ };
12
+ export type SecretAnswer = {
13
+ type: 'SECRET';
14
+ scope: 'ENVIRONMENT' | 'REPOSITORY';
15
+ name: string;
16
+ value: string;
17
+ didExist: Secret | undefined;
18
+ };
19
+ export type VariableAnswer = {
20
+ type: 'VARIABLE';
21
+ name: string;
22
+ didExist: Variable | undefined;
23
+ value: string;
24
+ scope: 'ENVIRONMENT' | 'REPOSITORY';
25
+ };
26
+ export type Answer = SecretAnswer | VariableAnswer;
27
+ export type Answers = Answer[];
28
+ export type AnswerWithNullValue = (Omit<SecretAnswer, 'value'> & {
29
+ value: SecretAnswer['value'] | null;
30
+ }) | (Omit<VariableAnswer, 'value'> & {
31
+ value: VariableAnswer['value'] | null;
32
+ });
33
+ //# sourceMappingURL=custom-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-types.d.ts","sourceRoot":"","sources":["../../src/environment/custom-types.ts"],"names":[],"mappings":"AAWA,OAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE3C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG;IACzD,IAAI,EAAE,CAAC,CAAA;IACP,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IACjC,KAAK,EAAE,aAAa,GAAG,YAAY,CAAA;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;IAC7E,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,aAAa,GAAG,YAAY,CAAA;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,aAAa,GAAG,YAAY,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,cAAc,CAAA;AAClD,MAAM,MAAM,OAAO,GAAG,MAAM,EAAE,CAAA;AAC9B,MAAM,MAAM,mBAAmB,GAC3B,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAC7B,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CACpC,CAAC,GACF,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG;IAC/B,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CACtC,CAAC,CAAA"}
@@ -0,0 +1,12 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,134 @@
1
+ export declare const derivedVariables: readonly [{
2
+ readonly name: "ACTIVATE_USERS";
3
+ readonly valueLabel: "ACTIVATE_USERS";
4
+ readonly valueType: "VARIABLE";
5
+ readonly type: "disabled";
6
+ readonly scope: "ENVIRONMENT";
7
+ }, {
8
+ readonly name: "COUNTRY_CONFIG_HOST";
9
+ readonly valueLabel: "COUNTRY_CONFIG_HOST";
10
+ readonly valueType: "VARIABLE";
11
+ readonly type: "disabled";
12
+ readonly scope: "ENVIRONMENT";
13
+ }, {
14
+ readonly name: "GATEWAY_HOST";
15
+ readonly valueLabel: "GATEWAY_HOST";
16
+ readonly valueType: "VARIABLE";
17
+ readonly type: "disabled";
18
+ readonly scope: "ENVIRONMENT";
19
+ }, {
20
+ readonly name: "CONTENT_SECURITY_POLICY_WILDCARD";
21
+ readonly valueLabel: "CONTENT_SECURITY_POLICY_WILDCARD";
22
+ readonly valueType: "VARIABLE";
23
+ readonly type: "disabled";
24
+ readonly scope: "ENVIRONMENT";
25
+ }, {
26
+ readonly name: "CLIENT_APP_URL";
27
+ readonly valueLabel: "CLIENT_APP_URL";
28
+ readonly valueType: "VARIABLE";
29
+ readonly type: "disabled";
30
+ readonly scope: "ENVIRONMENT";
31
+ }, {
32
+ readonly name: "LOGIN_URL";
33
+ readonly valueLabel: "LOGIN_URL";
34
+ readonly valueType: "VARIABLE";
35
+ readonly type: "disabled";
36
+ readonly scope: "ENVIRONMENT";
37
+ }, {
38
+ readonly name: "ELASTICSEARCH_SUPERUSER_PASSWORD";
39
+ readonly valueLabel: "ELASTICSEARCH_SUPERUSER_PASSWORD";
40
+ readonly valueType: "SECRET";
41
+ readonly type: "disabled";
42
+ readonly scope: "ENVIRONMENT";
43
+ }, {
44
+ readonly name: "KIBANA_SYSTEM_PASSWORD";
45
+ readonly valueLabel: "KIBANA_SYSTEM_PASSWORD";
46
+ readonly valueType: "SECRET";
47
+ readonly type: "disabled";
48
+ readonly scope: "ENVIRONMENT";
49
+ }, {
50
+ readonly name: "MINIO_ROOT_USER";
51
+ readonly valueLabel: "MINIO_ROOT_USER";
52
+ readonly valueType: "SECRET";
53
+ readonly type: "disabled";
54
+ readonly scope: "ENVIRONMENT";
55
+ }, {
56
+ readonly name: "MINIO_ROOT_PASSWORD";
57
+ readonly valueLabel: "MINIO_ROOT_PASSWORD";
58
+ readonly valueType: "SECRET";
59
+ readonly type: "disabled";
60
+ readonly scope: "ENVIRONMENT";
61
+ }, {
62
+ readonly name: "MONGODB_ADMIN_USER";
63
+ readonly valueLabel: "MONGODB_ADMIN_USER";
64
+ readonly valueType: "SECRET";
65
+ readonly type: "disabled";
66
+ readonly scope: "ENVIRONMENT";
67
+ }, {
68
+ readonly name: "MONGODB_ADMIN_PASSWORD";
69
+ readonly valueLabel: "MONGODB_ADMIN_PASSWORD";
70
+ readonly valueType: "SECRET";
71
+ readonly type: "disabled";
72
+ readonly scope: "ENVIRONMENT";
73
+ }, {
74
+ readonly name: "POSTGRES_USER";
75
+ readonly valueLabel: "POSTGRES_USER";
76
+ readonly valueType: "SECRET";
77
+ readonly type: "disabled";
78
+ readonly scope: "ENVIRONMENT";
79
+ }, {
80
+ readonly name: "POSTGRES_PASSWORD";
81
+ readonly valueLabel: "POSTGRES_PASSWORD";
82
+ readonly valueType: "SECRET";
83
+ readonly type: "disabled";
84
+ readonly scope: "ENVIRONMENT";
85
+ }, {
86
+ readonly name: "SUPER_USER_PASSWORD";
87
+ readonly valueLabel: "SUPER_USER_PASSWORD";
88
+ readonly valueType: "SECRET";
89
+ readonly type: "disabled";
90
+ readonly scope: "ENVIRONMENT";
91
+ }, {
92
+ readonly name: "ENCRYPTION_KEY";
93
+ readonly valueLabel: "ENCRYPTION_KEY";
94
+ readonly valueType: "SECRET";
95
+ readonly type: "disabled";
96
+ readonly scope: "ENVIRONMENT";
97
+ }, {
98
+ readonly name: "GH_ENCRYPTION_PASSWORD";
99
+ readonly valueLabel: "GH_ENCRYPTION_PASSWORD";
100
+ readonly valueType: "SECRET";
101
+ readonly type: "disabled";
102
+ readonly scope: "REPOSITORY";
103
+ }, {
104
+ readonly name: "BACKUP_ENCRYPTION_PASSPHRASE";
105
+ readonly valueLabel: "BACKUP_ENCRYPTION_PASSPHRASE";
106
+ readonly valueType: "SECRET";
107
+ readonly type: "disabled";
108
+ readonly scope: "ENVIRONMENT";
109
+ }, {
110
+ readonly name: "BACKUP_HOST_PRIVATE_KEY";
111
+ readonly valueLabel: "BACKUP_HOST_PRIVATE_KEY";
112
+ readonly valueType: "SECRET";
113
+ readonly type: "disabled";
114
+ readonly scope: "ENVIRONMENT";
115
+ }, {
116
+ readonly name: "BACKUP_HOST_PUBLIC_KEY";
117
+ readonly valueLabel: "BACKUP_HOST_PUBLIC_KEY";
118
+ readonly valueType: "SECRET";
119
+ readonly type: "disabled";
120
+ readonly scope: "ENVIRONMENT";
121
+ }, {
122
+ readonly name: "RESTORE_ENVIRONMENT_NAME";
123
+ readonly valueLabel: "RESTORE_ENVIRONMENT_NAME";
124
+ readonly valueType: "VARIABLE";
125
+ readonly type: "disabled";
126
+ readonly scope: "ENVIRONMENT";
127
+ }, {
128
+ readonly name: "NOTIFICATION_TRANSPORT";
129
+ readonly valueLabel: "NOTIFICATION_TRANSPORT";
130
+ readonly valueType: "VARIABLE";
131
+ readonly type: "disabled";
132
+ readonly scope: "ENVIRONMENT";
133
+ }];
134
+ //# sourceMappingURL=derived-variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derived-variables.d.ts","sourceRoot":"","sources":["../../src/environment/derived-variables.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2JnB,CAAA"}
@@ -0,0 +1,169 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.derivedVariables = void 0;
14
+ exports.derivedVariables = [
15
+ {
16
+ name: 'ACTIVATE_USERS',
17
+ valueLabel: 'ACTIVATE_USERS',
18
+ valueType: 'VARIABLE',
19
+ type: 'disabled',
20
+ scope: 'ENVIRONMENT'
21
+ },
22
+ {
23
+ name: 'COUNTRY_CONFIG_HOST',
24
+ valueLabel: 'COUNTRY_CONFIG_HOST',
25
+ valueType: 'VARIABLE',
26
+ type: 'disabled',
27
+ scope: 'ENVIRONMENT'
28
+ },
29
+ {
30
+ name: 'GATEWAY_HOST',
31
+ valueLabel: 'GATEWAY_HOST',
32
+ valueType: 'VARIABLE',
33
+ type: 'disabled',
34
+ scope: 'ENVIRONMENT'
35
+ },
36
+ {
37
+ name: 'CONTENT_SECURITY_POLICY_WILDCARD',
38
+ valueLabel: 'CONTENT_SECURITY_POLICY_WILDCARD',
39
+ valueType: 'VARIABLE',
40
+ type: 'disabled',
41
+ scope: 'ENVIRONMENT'
42
+ },
43
+ {
44
+ name: 'CLIENT_APP_URL',
45
+ valueLabel: 'CLIENT_APP_URL',
46
+ valueType: 'VARIABLE',
47
+ type: 'disabled',
48
+ scope: 'ENVIRONMENT'
49
+ },
50
+ {
51
+ name: 'LOGIN_URL',
52
+ valueLabel: 'LOGIN_URL',
53
+ valueType: 'VARIABLE',
54
+ type: 'disabled',
55
+ scope: 'ENVIRONMENT'
56
+ },
57
+ {
58
+ name: 'ELASTICSEARCH_SUPERUSER_PASSWORD',
59
+ valueLabel: 'ELASTICSEARCH_SUPERUSER_PASSWORD',
60
+ valueType: 'SECRET',
61
+ type: 'disabled',
62
+ scope: 'ENVIRONMENT'
63
+ },
64
+ {
65
+ name: 'KIBANA_SYSTEM_PASSWORD',
66
+ valueLabel: 'KIBANA_SYSTEM_PASSWORD',
67
+ valueType: 'SECRET',
68
+ type: 'disabled',
69
+ scope: 'ENVIRONMENT'
70
+ },
71
+ {
72
+ name: 'MINIO_ROOT_USER',
73
+ valueLabel: 'MINIO_ROOT_USER',
74
+ valueType: 'SECRET',
75
+ type: 'disabled',
76
+ scope: 'ENVIRONMENT'
77
+ },
78
+ {
79
+ name: 'MINIO_ROOT_PASSWORD',
80
+ valueLabel: 'MINIO_ROOT_PASSWORD',
81
+ valueType: 'SECRET',
82
+ type: 'disabled',
83
+ scope: 'ENVIRONMENT'
84
+ },
85
+ {
86
+ name: 'MONGODB_ADMIN_USER',
87
+ valueLabel: 'MONGODB_ADMIN_USER',
88
+ valueType: 'SECRET',
89
+ type: 'disabled',
90
+ scope: 'ENVIRONMENT'
91
+ },
92
+ {
93
+ name: 'MONGODB_ADMIN_PASSWORD',
94
+ valueLabel: 'MONGODB_ADMIN_PASSWORD',
95
+ valueType: 'SECRET',
96
+ type: 'disabled',
97
+ scope: 'ENVIRONMENT'
98
+ },
99
+ {
100
+ name: 'POSTGRES_USER',
101
+ valueLabel: 'POSTGRES_USER',
102
+ valueType: 'SECRET',
103
+ type: 'disabled',
104
+ scope: 'ENVIRONMENT'
105
+ },
106
+ {
107
+ name: 'POSTGRES_PASSWORD',
108
+ valueLabel: 'POSTGRES_PASSWORD',
109
+ valueType: 'SECRET',
110
+ type: 'disabled',
111
+ scope: 'ENVIRONMENT'
112
+ },
113
+ {
114
+ name: 'SUPER_USER_PASSWORD',
115
+ valueLabel: 'SUPER_USER_PASSWORD',
116
+ valueType: 'SECRET',
117
+ type: 'disabled',
118
+ scope: 'ENVIRONMENT'
119
+ },
120
+ {
121
+ name: 'ENCRYPTION_KEY',
122
+ valueLabel: 'ENCRYPTION_KEY',
123
+ valueType: 'SECRET',
124
+ type: 'disabled',
125
+ scope: 'ENVIRONMENT'
126
+ },
127
+ {
128
+ name: 'GH_ENCRYPTION_PASSWORD',
129
+ valueLabel: 'GH_ENCRYPTION_PASSWORD',
130
+ valueType: 'SECRET',
131
+ type: 'disabled',
132
+ scope: 'REPOSITORY'
133
+ },
134
+ {
135
+ name: 'BACKUP_ENCRYPTION_PASSPHRASE',
136
+ valueLabel: 'BACKUP_ENCRYPTION_PASSPHRASE',
137
+ valueType: 'SECRET',
138
+ type: 'disabled',
139
+ scope: 'ENVIRONMENT'
140
+ },
141
+ {
142
+ name: 'BACKUP_HOST_PRIVATE_KEY',
143
+ valueLabel: 'BACKUP_HOST_PRIVATE_KEY',
144
+ valueType: 'SECRET',
145
+ type: 'disabled',
146
+ scope: 'ENVIRONMENT'
147
+ },
148
+ {
149
+ name: 'BACKUP_HOST_PUBLIC_KEY',
150
+ valueLabel: 'BACKUP_HOST_PUBLIC_KEY',
151
+ valueType: 'SECRET',
152
+ type: 'disabled',
153
+ scope: 'ENVIRONMENT'
154
+ },
155
+ {
156
+ name: 'RESTORE_ENVIRONMENT_NAME',
157
+ valueLabel: 'RESTORE_ENVIRONMENT_NAME',
158
+ valueType: 'VARIABLE',
159
+ type: 'disabled',
160
+ scope: 'ENVIRONMENT'
161
+ },
162
+ {
163
+ name: 'NOTIFICATION_TRANSPORT',
164
+ valueLabel: 'NOTIFICATION_TRANSPORT',
165
+ valueType: 'VARIABLE',
166
+ type: 'disabled',
167
+ scope: 'ENVIRONMENT'
168
+ }
169
+ ];
@@ -0,0 +1,4 @@
1
+ import { Secret, Variable } from './github';
2
+ import { AnswerWithNullValue, QuestionDescriptor } from './custom-types';
3
+ export declare function askQuestionWithEditor(questions: Array<QuestionDescriptor<any>>, existingValues: Array<Secret | Variable>): Promise<AnswerWithNullValue[]>;
4
+ //# sourceMappingURL=editor-questions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-questions.d.ts","sourceRoot":"","sources":["../../src/environment/editor-questions.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EACL,mBAAmB,EAEnB,kBAAkB,EACnB,MAAM,gBAAgB,CAAA;AAUvB,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,EACzC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GACvC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAoDhC"}
@@ -0,0 +1,67 @@
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.askQuestionWithEditor = askQuestionWithEditor;
26
+ const utils_1 = require("./utils");
27
+ const kleur_1 = __importDefault(require("kleur"));
28
+ const prompts_1 = __importDefault(require("prompts"));
29
+ function editorQuestion(question) {
30
+ return import('@inquirer/prompts').then(({ editor }) => editor({ message: question }));
31
+ }
32
+ function askQuestionWithEditor(questions, existingValues) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const answers = [];
35
+ for (const question of questions) {
36
+ const questionWithVariableLabel = Object.assign(Object.assign({}, question), { message: `${kleur_1.default.cyan(question.valueLabel || '')}: ${question.message}` });
37
+ if (!questionWithVariableLabel.valueLabel) {
38
+ throw Error('Undefined Label');
39
+ }
40
+ const existingSecret = (0, utils_1.findExistingValue)(questionWithVariableLabel.valueLabel, 'SECRET', questionWithVariableLabel.scope, existingValues);
41
+ let updateSecret = true;
42
+ if (existingSecret) {
43
+ updateSecret = (yield (0, prompts_1.default)([
44
+ {
45
+ name: 'overWrite',
46
+ type: 'confirm',
47
+ message: `${kleur_1.default.yellow(`${existingSecret.scope === 'REPOSITORY'
48
+ ? 'Repository secret'
49
+ : 'Secret'} ${kleur_1.default.cyan(existingSecret.name)} already exists in Github. Do you want to update it?`)}`
50
+ }
51
+ ])).overWrite;
52
+ }
53
+ if (!existingSecret || updateSecret === true) {
54
+ const question_answer = yield editorQuestion(questionWithVariableLabel.message);
55
+ const answer = {
56
+ type: 'SECRET',
57
+ scope: 'ENVIRONMENT',
58
+ name: questionWithVariableLabel.valueLabel,
59
+ value: question_answer,
60
+ didExist: existingSecret
61
+ };
62
+ answers.push(answer);
63
+ }
64
+ }
65
+ return answers;
66
+ });
67
+ }
@@ -0,0 +1,5 @@
1
+ export declare function getRepoInfo(): {
2
+ organization: string;
3
+ repository: string;
4
+ };
5
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/environment/git.ts"],"names":[],"mappings":"AAaA,wBAAgB,WAAW;;;EAyB1B"}