@opencrvs/toolkit 2.0.0-rc.bd45274 → 2.0.0-rc.bd55713

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 (79) hide show
  1. package/README.md +14 -0
  2. package/build.sh +1 -0
  3. package/dist/application-config/index.js +7 -1
  4. package/dist/cli.js +3191 -42
  5. package/dist/commons/api/router.d.ts +11 -2
  6. package/dist/commons/events/ActionConfig.d.ts +28 -2
  7. package/dist/commons/events/FieldConfig.d.ts +1 -0
  8. package/dist/commons/events/FieldType.d.ts +1 -0
  9. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  10. package/dist/environment/custom-types.d.ts +33 -0
  11. package/dist/environment/custom-types.d.ts.map +1 -0
  12. package/dist/environment/custom-types.js +2 -0
  13. package/dist/environment/derived-variables.d.ts +134 -0
  14. package/dist/environment/derived-variables.d.ts.map +1 -0
  15. package/dist/environment/derived-variables.js +159 -0
  16. package/dist/environment/editor-questions.d.ts +5 -0
  17. package/dist/environment/editor-questions.d.ts.map +1 -0
  18. package/dist/environment/editor-questions.js +56 -0
  19. package/dist/environment/git.d.ts +5 -0
  20. package/dist/environment/git.d.ts.map +1 -0
  21. package/dist/environment/git.js +28 -0
  22. package/dist/environment/github.d.ts +26 -0
  23. package/dist/environment/github.d.ts.map +1 -0
  24. package/dist/environment/github.js +234 -0
  25. package/dist/environment/index.d.ts +6 -0
  26. package/dist/environment/index.d.ts.map +1 -0
  27. package/dist/environment/index.js +61 -0
  28. package/dist/environment/logger.d.ts +15 -0
  29. package/dist/environment/logger.d.ts.map +1 -0
  30. package/dist/environment/logger.js +15 -0
  31. package/dist/environment/manage-users.d.ts +11 -0
  32. package/dist/environment/manage-users.d.ts.map +1 -0
  33. package/dist/environment/manage-users.js +484 -0
  34. package/dist/environment/questions-helper.d.ts +15 -0
  35. package/dist/environment/questions-helper.d.ts.map +1 -0
  36. package/dist/environment/questions-helper.js +60 -0
  37. package/dist/environment/questions.d.ts +222 -0
  38. package/dist/environment/questions.d.ts.map +1 -0
  39. package/dist/environment/questions.js +455 -0
  40. package/dist/environment/setup-environment.d.ts +2 -0
  41. package/dist/environment/setup-environment.d.ts.map +1 -0
  42. package/dist/environment/setup-environment.js +763 -0
  43. package/dist/environment/ssh-keygen.d.ts +5 -0
  44. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  45. package/dist/environment/ssh-keygen.js +8 -0
  46. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  47. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  48. package/dist/environment/swarm-to-k8s.js +162 -0
  49. package/dist/environment/templates/charts-values/dependencies/values.override.yaml +4 -0
  50. package/dist/environment/templates/charts-values/dependencies/values.yaml +82 -0
  51. package/dist/environment/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  52. package/dist/environment/templates/charts-values/opencrvs-services/values.yaml +79 -0
  53. package/dist/environment/templates/charts-values/traefik/values.override.yaml +4 -0
  54. package/dist/environment/templates/charts-values/traefik/values.yaml +116 -0
  55. package/dist/environment/templates/inventory/inventory.template.yml +100 -0
  56. package/dist/environment/templates/inventory/production.example.yml +77 -0
  57. package/dist/environment/templates/inventory/qa.example.yml +48 -0
  58. package/dist/environment/templates.d.ts +27 -0
  59. package/dist/environment/templates.d.ts.map +1 -0
  60. package/dist/environment/templates.js +149 -0
  61. package/dist/environment/update-workflows.d.ts +2 -0
  62. package/dist/environment/update-workflows.d.ts.map +1 -0
  63. package/dist/environment/update-workflows.js +151 -0
  64. package/dist/environment/users.d.ts +2 -0
  65. package/dist/environment/users.d.ts.map +1 -0
  66. package/dist/environment/users.js +92 -0
  67. package/dist/environment/utils.d.ts +18 -0
  68. package/dist/environment/utils.d.ts.map +1 -0
  69. package/dist/environment/utils.js +90 -0
  70. package/dist/events/index.js +153 -62
  71. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  72. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  73. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  74. package/dist/migrations/v2.0/index.js +1 -1
  75. package/dist/notification/index.js +96 -3
  76. package/opencrvs-toolkit-2.0.0-rc.bd55713.tgz +0 -0
  77. package/package.json +15 -1
  78. package/tsconfig.tsbuildinfo +1 -1
  79. package/opencrvs-toolkit-2.0.0-rc.bd45274.tgz +0 -0
@@ -7374,9 +7374,18 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7374
7374
  output: void;
7375
7375
  meta: import("trpc-to-openapi").OpenApiMeta;
7376
7376
  }>;
7377
- sendVerifyCode: import("@trpc/server").TRPCMutationProcedure<{
7377
+ requestEmailChange: import("@trpc/server").TRPCMutationProcedure<{
7378
7378
  input: {
7379
- notificationEvent: "change-phone-number" | "change-email-address";
7379
+ email: string;
7380
+ };
7381
+ output: {
7382
+ nonce: string;
7383
+ };
7384
+ meta: import("trpc-to-openapi").OpenApiMeta;
7385
+ }>;
7386
+ requestPhoneChange: import("@trpc/server").TRPCMutationProcedure<{
7387
+ input: {
7388
+ phoneNumber: string;
7380
7389
  };
7381
7390
  output: {
7382
7391
  nonce: string;
@@ -85,6 +85,32 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
85
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
86
86
  }, z.core.$strip>;
87
87
  conditionals: z.ZodOptional<z.ZodNever>;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
91
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
92
+ readonly INCOMPLETE: "incomplete";
93
+ readonly REJECTED: "rejected";
94
+ readonly CORRECTION_REQUESTED: "correction-requested";
95
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
96
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
97
+ }>]>, z.ZodString]>;
98
+ operation: z.ZodEnum<{
99
+ add: "add";
100
+ remove: "remove";
101
+ }>;
102
+ conditional: z.ZodOptional<z.ZodAny>;
103
+ }, z.core.$strip>>>>;
104
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
105
+ icon: z.ZodOptional<z.ZodString>;
106
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
107
+ type: z.ZodLiteral<"SHOW">;
108
+ conditional: z.ZodAny;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ type: z.ZodLiteral<"ENABLE">;
111
+ conditional: z.ZodAny;
112
+ }, z.core.$strip>], "type">>>;
113
+ type: z.ZodLiteral<"NOTIFY">;
88
114
  }, z.core.$strip>, z.ZodObject<{
89
115
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
116
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -388,8 +414,8 @@ export declare const actionConfigTypes: Set<ActionConfigTypes>;
388
414
  *
389
415
  * These are not the same as the broader workflow `action.type` values.
390
416
  * `ActionConfigTypes` includes only the action kinds that can be defined
391
- * in the country configuration (e.g. DECLARE, VALIDATE, CUSTOM), and
392
- * excludes workflow-only types such as CREATE or NOTIFY.
417
+ * in the country configuration (e.g. NOTIFY, DECLARE, VALIDATE, CUSTOM), and
418
+ * excludes workflow-only types such as CREATE.
393
419
  */
394
420
  export type ActionConfigTypes = ActionConfig['type'];
395
421
  export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -267,6 +267,7 @@ declare const NumberField: z.ZodObject<{
267
267
  configuration: z.ZodOptional<z.ZodObject<{
268
268
  min: z.ZodOptional<z.ZodNumber>;
269
269
  max: z.ZodOptional<z.ZodNumber>;
270
+ integer: z.ZodOptional<z.ZodBoolean>;
270
271
  prefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
271
272
  postfix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
272
273
  }, z.core.$strip>>;
@@ -75,4 +75,5 @@ export type FieldType = (typeof fieldTypes)[number];
75
75
  */
76
76
  export declare const compositeFieldTypes: ("NAME" | "ADDRESS" | "DATE_RANGE" | "FILE" | "FILE_WITH_OPTIONS" | "DATA" | "ID_READER")[];
77
77
  export declare const FieldTypesToHideInReview: ("IMAGE_VIEW" | "PARAGRAPH" | "PAGE_HEADER" | "BULLET_LIST" | "DIVIDER" | "DATA" | "ALPHA_PRINT_BUTTON" | "HTTP" | "QUERY_PARAM_READER" | "ID_READER" | "LOADER" | "ALPHA_HIDDEN")[];
78
+ export declare const HiddenFieldTypes: ("HTTP" | "QUERY_PARAM_READER" | "ALPHA_HIDDEN")[];
78
79
  //# sourceMappingURL=FieldType.d.ts.map
@@ -690,7 +690,7 @@ export declare const isHiddenFieldType: (field: {
690
690
  value: undefined;
691
691
  config: HiddenField;
692
692
  };
693
- export type NonInteractiveFieldType = Divider | PageHeader | ImageViewField | Paragraph | Heading | BulletList | DataField | AlphaPrintButton | HttpField | LinkButtonField | QueryParamReaderField | LoaderField | AutocompleteField;
693
+ export type NonInteractiveFieldType = Divider | PageHeader | ImageViewField | Paragraph | Heading | BulletList | DataField | AlphaPrintButton | LinkButtonField | LoaderField | AutocompleteField;
694
694
  export type InteractiveFieldType = Exclude<FieldConfig, NonInteractiveFieldType>;
695
695
  export declare const isNonInteractiveFieldType: (field: FieldConfig) => field is NonInteractiveFieldType;
696
696
  export {};
@@ -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":"AAAA,OAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EACH,MAAM,EACN,QAAQ,EACX,MAAM,UAAU,CAAA;AAEjB,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,2 @@
1
+ "use strict";
2
+ 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":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2JnB,CAAC"}
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.derivedVariables = void 0;
4
+ exports.derivedVariables = [
5
+ {
6
+ name: 'ACTIVATE_USERS',
7
+ valueLabel: 'ACTIVATE_USERS',
8
+ valueType: 'VARIABLE',
9
+ type: 'disabled',
10
+ scope: 'ENVIRONMENT'
11
+ },
12
+ {
13
+ name: 'COUNTRY_CONFIG_HOST',
14
+ valueLabel: 'COUNTRY_CONFIG_HOST',
15
+ valueType: 'VARIABLE',
16
+ type: 'disabled',
17
+ scope: 'ENVIRONMENT'
18
+ },
19
+ {
20
+ name: 'GATEWAY_HOST',
21
+ valueLabel: 'GATEWAY_HOST',
22
+ valueType: 'VARIABLE',
23
+ type: 'disabled',
24
+ scope: 'ENVIRONMENT'
25
+ },
26
+ {
27
+ name: 'CONTENT_SECURITY_POLICY_WILDCARD',
28
+ valueLabel: 'CONTENT_SECURITY_POLICY_WILDCARD',
29
+ valueType: 'VARIABLE',
30
+ type: 'disabled',
31
+ scope: 'ENVIRONMENT'
32
+ },
33
+ {
34
+ name: 'CLIENT_APP_URL',
35
+ valueLabel: 'CLIENT_APP_URL',
36
+ valueType: 'VARIABLE',
37
+ type: 'disabled',
38
+ scope: 'ENVIRONMENT'
39
+ },
40
+ {
41
+ name: 'LOGIN_URL',
42
+ valueLabel: 'LOGIN_URL',
43
+ valueType: 'VARIABLE',
44
+ type: 'disabled',
45
+ scope: 'ENVIRONMENT'
46
+ },
47
+ {
48
+ name: 'ELASTICSEARCH_SUPERUSER_PASSWORD',
49
+ valueLabel: 'ELASTICSEARCH_SUPERUSER_PASSWORD',
50
+ valueType: 'SECRET',
51
+ type: 'disabled',
52
+ scope: 'ENVIRONMENT'
53
+ },
54
+ {
55
+ name: 'KIBANA_SYSTEM_PASSWORD',
56
+ valueLabel: 'KIBANA_SYSTEM_PASSWORD',
57
+ valueType: 'SECRET',
58
+ type: 'disabled',
59
+ scope: 'ENVIRONMENT'
60
+ },
61
+ {
62
+ name: 'MINIO_ROOT_USER',
63
+ valueLabel: 'MINIO_ROOT_USER',
64
+ valueType: 'SECRET',
65
+ type: 'disabled',
66
+ scope: 'ENVIRONMENT'
67
+ },
68
+ {
69
+ name: 'MINIO_ROOT_PASSWORD',
70
+ valueLabel: 'MINIO_ROOT_PASSWORD',
71
+ valueType: 'SECRET',
72
+ type: 'disabled',
73
+ scope: 'ENVIRONMENT'
74
+ },
75
+ {
76
+ name: 'MONGODB_ADMIN_USER',
77
+ valueLabel: 'MONGODB_ADMIN_USER',
78
+ valueType: 'SECRET',
79
+ type: 'disabled',
80
+ scope: 'ENVIRONMENT'
81
+ },
82
+ {
83
+ name: 'MONGODB_ADMIN_PASSWORD',
84
+ valueLabel: 'MONGODB_ADMIN_PASSWORD',
85
+ valueType: 'SECRET',
86
+ type: 'disabled',
87
+ scope: 'ENVIRONMENT'
88
+ },
89
+ {
90
+ name: 'POSTGRES_USER',
91
+ valueLabel: 'POSTGRES_USER',
92
+ valueType: 'SECRET',
93
+ type: 'disabled',
94
+ scope: 'ENVIRONMENT'
95
+ },
96
+ {
97
+ name: 'POSTGRES_PASSWORD',
98
+ valueLabel: 'POSTGRES_PASSWORD',
99
+ valueType: 'SECRET',
100
+ type: 'disabled',
101
+ scope: 'ENVIRONMENT'
102
+ },
103
+ {
104
+ name: 'SUPER_USER_PASSWORD',
105
+ valueLabel: 'SUPER_USER_PASSWORD',
106
+ valueType: 'SECRET',
107
+ type: 'disabled',
108
+ scope: 'ENVIRONMENT'
109
+ },
110
+ {
111
+ name: 'ENCRYPTION_KEY',
112
+ valueLabel: 'ENCRYPTION_KEY',
113
+ valueType: 'SECRET',
114
+ type: 'disabled',
115
+ scope: 'ENVIRONMENT'
116
+ },
117
+ {
118
+ name: 'GH_ENCRYPTION_PASSWORD',
119
+ valueLabel: 'GH_ENCRYPTION_PASSWORD',
120
+ valueType: 'SECRET',
121
+ type: 'disabled',
122
+ scope: 'REPOSITORY'
123
+ },
124
+ {
125
+ name: 'BACKUP_ENCRYPTION_PASSPHRASE',
126
+ valueLabel: 'BACKUP_ENCRYPTION_PASSPHRASE',
127
+ valueType: 'SECRET',
128
+ type: 'disabled',
129
+ scope: 'ENVIRONMENT'
130
+ },
131
+ {
132
+ name: 'BACKUP_HOST_PRIVATE_KEY',
133
+ valueLabel: 'BACKUP_HOST_PRIVATE_KEY',
134
+ valueType: 'SECRET',
135
+ type: 'disabled',
136
+ scope: 'ENVIRONMENT'
137
+ },
138
+ {
139
+ name: 'BACKUP_HOST_PUBLIC_KEY',
140
+ valueLabel: 'BACKUP_HOST_PUBLIC_KEY',
141
+ valueType: 'SECRET',
142
+ type: 'disabled',
143
+ scope: 'ENVIRONMENT'
144
+ },
145
+ {
146
+ name: 'RESTORE_ENVIRONMENT_NAME',
147
+ valueLabel: 'RESTORE_ENVIRONMENT_NAME',
148
+ valueType: 'VARIABLE',
149
+ type: 'disabled',
150
+ scope: 'ENVIRONMENT'
151
+ },
152
+ {
153
+ name: 'NOTIFICATION_TRANSPORT',
154
+ valueLabel: 'NOTIFICATION_TRANSPORT',
155
+ valueType: 'VARIABLE',
156
+ type: 'disabled',
157
+ scope: 'ENVIRONMENT'
158
+ },
159
+ ];
@@ -0,0 +1,5 @@
1
+ import { Secret, Variable } from './github';
2
+ import { AnswerWithNullValue, QuestionDescriptor } from './custom-types';
3
+ export declare function editorQuestion(question: string): Promise<string>;
4
+ export declare function askQuestionWithEditor(questions: Array<QuestionDescriptor<any>>, existingValues: Array<Secret | Variable>): Promise<AnswerWithNullValue[]>;
5
+ //# 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":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAW,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAKlF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIhE;AAED,wBAAsB,qBAAqB,CACvC,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,EACzC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GACzC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA6ChC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.editorQuestion = editorQuestion;
16
+ exports.askQuestionWithEditor = askQuestionWithEditor;
17
+ const utils_1 = require("./utils");
18
+ const kleur_1 = __importDefault(require("kleur"));
19
+ const prompts_1 = __importDefault(require("prompts"));
20
+ function editorQuestion(question) {
21
+ return import('@inquirer/prompts').then(({ editor }) => editor({ message: question }));
22
+ }
23
+ function askQuestionWithEditor(questions, existingValues) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ let answers = [];
26
+ for (const question of questions) {
27
+ const questionWithVariableLabel = Object.assign(Object.assign({}, question), { message: `${kleur_1.default.cyan(question.valueLabel || '')}: ${question.message}` });
28
+ if (!questionWithVariableLabel.valueLabel) {
29
+ throw Error("Undefined Label");
30
+ }
31
+ const existingSecret = (0, utils_1.findExistingValue)(questionWithVariableLabel.valueLabel, 'SECRET', questionWithVariableLabel.scope, existingValues);
32
+ let updateSecret = true;
33
+ if (existingSecret) {
34
+ updateSecret = (yield (0, prompts_1.default)([{
35
+ name: 'overWrite',
36
+ type: 'confirm',
37
+ message: `${kleur_1.default.yellow(`${existingSecret.scope === 'REPOSITORY'
38
+ ? 'Repository secret'
39
+ : 'Secret'} ${kleur_1.default.cyan(existingSecret.name)} already exists in Github. Do you want to update it?`)}`
40
+ }])).overWrite;
41
+ }
42
+ if (!existingSecret || updateSecret === true) {
43
+ const question_answer = yield editorQuestion(questionWithVariableLabel.message);
44
+ const answer = {
45
+ type: 'SECRET',
46
+ scope: 'ENVIRONMENT',
47
+ name: questionWithVariableLabel.valueLabel,
48
+ value: question_answer,
49
+ didExist: existingSecret
50
+ };
51
+ answers.push(answer);
52
+ }
53
+ }
54
+ return answers;
55
+ });
56
+ }
@@ -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":"AAEA,wBAAgB,WAAW;;;EAyB1B"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRepoInfo = getRepoInfo;
4
+ const child_process_1 = require("child_process");
5
+ function getRepoInfo() {
6
+ try {
7
+ const remoteUrl = (0, child_process_1.execSync)("git config --get remote.origin.url", {
8
+ stdio: ["ignore", "pipe", "ignore"]
9
+ })
10
+ .toString()
11
+ .trim();
12
+ // Handle both SSH and HTTPS formats
13
+ const match = remoteUrl.match(/github\.com[:/](.+?)\/(.+?)(\.git)?$/);
14
+ if (!match) {
15
+ return { organization: "", repository: "" };
16
+ }
17
+ return {
18
+ organization: match[1],
19
+ repository: match[2]
20
+ };
21
+ }
22
+ catch (_a) {
23
+ return {
24
+ organization: "",
25
+ repository: ""
26
+ };
27
+ }
28
+ }
@@ -0,0 +1,26 @@
1
+ import { Octokit } from '@octokit/core';
2
+ export declare function createEnvironmentVariable(octokit: Octokit, repositoryId: number, environment: string, name: string, value: string): Promise<void>;
3
+ export declare function updateEnvironmentVariable(octokit: Octokit, repositoryId: number, environment: string, name: string, value: string): Promise<void>;
4
+ export declare function createRepositoryVariable(octokit: Octokit, repositoryId: number, name: string, value: string): Promise<void>;
5
+ export declare function updateRepositoryVariable(octokit: Octokit, repositoryId: number, name: string, value: string): Promise<void>;
6
+ export declare function getRepositoryId(octokit: Octokit, owner: string, repo: string): Promise<number>;
7
+ export declare function createEnvironmentSecret(octokit: Octokit, repositoryId: number, environment: string, name: string, secret: string, organisationName: string, repositoryName: string): Promise<void>;
8
+ export declare function createRepositorySecret(octokit: Octokit, repositoryId: number, name: string, secret: string, organisationName: string, repositoryName: string): Promise<void>;
9
+ export declare function getRepositoryEnvironments(octokit: Octokit, githubOrganisation: string, repository: string): Promise<string[]>;
10
+ export declare function createEnvironment(octokit: Octokit, environment: string, ORGANISATION: string, REPOSITORY_NAME: string): Promise<boolean>;
11
+ export type Secret = {
12
+ type: 'SECRET';
13
+ name: string;
14
+ scope: 'ENVIRONMENT' | 'REPOSITORY';
15
+ };
16
+ export type Variable = {
17
+ type: 'VARIABLE';
18
+ name: string;
19
+ value: string;
20
+ scope: 'ENVIRONMENT' | 'REPOSITORY';
21
+ };
22
+ export declare function listEnvironmentSecrets(octokit: Octokit, owner: string, repositoryId: number, environmentName: string): Promise<Secret[]>;
23
+ export declare function listRepositorySecrets(octokit: Octokit, owner: string, repositoryName: string): Promise<Secret[]>;
24
+ export declare function listEnvironmentVariables(octokit: Octokit, repositoryId: number, environmentName: string): Promise<Variable[]>;
25
+ export declare function listRepositoryVariables(octokit: Octokit, owner: string, repositoryName: string): Promise<Variable[]>;
26
+ //# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/environment/github.ts"],"names":[],"mappings":"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"}