@opencrvs/toolkit 2.2.0-rc.045257f → 2.2.0-rc.1a111f2
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/dist/cli.js +925 -356
- package/dist/commons/api/router.d.ts +4 -4
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -0
- package/dist/commons/events/Draft.d.ts +34 -1
- package/dist/commons/events/EventConfig.d.ts +385 -0
- package/dist/commons/events/defineConfig.d.ts +7 -2
- package/dist/commons/events/event.d.ts +4 -1
- package/dist/commons/events/field.d.ts +5 -0
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +57 -5
- package/dist/commons/events/utils.d.ts +13 -0
- package/dist/environment/custom-types.d.ts +1 -0
- package/dist/environment/custom-types.d.ts.map +1 -1
- package/dist/environment/derived-variables.d.ts +8 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +9 -0
- package/dist/environment/questions.d.ts +42 -9
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +70 -47
- package/dist/environment/registry.d.ts +15 -0
- package/dist/environment/registry.d.ts.map +1 -0
- package/dist/environment/registry.js +112 -0
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +98 -23
- package/dist/events/index.js +462 -99
- package/dist/migrations/add-notify-config.d.ts +40 -0
- package/dist/migrations/add-notify-config.d.ts.map +1 -0
- package/dist/migrations/add-notify-config.js +249 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +602 -143
- package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -1
- package/dist/migrations/move-declaration-to-declare-action.js +27 -144
- package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -1
- package/dist/migrations/read-declaration-through-helper.js +3 -61
- package/dist/migrations/resolve-versioned-event-config.d.ts +56 -0
- package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
- package/dist/migrations/resolve-versioned-event-config.js +353 -0
- package/dist/migrations/utils.d.ts +61 -0
- package/dist/migrations/utils.d.ts.map +1 -0
- package/dist/migrations/utils.js +218 -0
- package/dist/notification/index.js +510 -36
- package/dist/templates/charts-values/dependencies/values.yaml +2 -1
- package/dist/templates/charts-values/opencrvs-services/values.yaml +2 -2
- package/dist/verify/endpoints.d.ts +11 -0
- package/dist/verify/endpoints.d.ts.map +1 -1
- package/dist/verify/endpoints.js +21 -27
- package/opencrvs-toolkit-2.2.0-rc.1a111f2.tgz +0 -0
- package/package.json +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/environment/dockerhub.d.ts +0 -15
- package/dist/environment/dockerhub.d.ts.map +0 -1
- package/dist/environment/dockerhub.js +0 -104
- package/opencrvs-toolkit-2.2.0-rc.045257f.tgz +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UUID } from '../uuid';
|
|
2
|
-
import { ActionDocument, ActionUpdate } from './ActionDocument';
|
|
2
|
+
import { Action, ActionBase, ActionDocument, ActionStatus, ActionUpdate } from './ActionDocument';
|
|
3
3
|
import { ValidatorContext } from '../conditionals/validate';
|
|
4
4
|
import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput, RevokeRegistrationActionInput, ReinstateRegistrationActionInput } from './ActionInput';
|
|
5
5
|
import { ActionType } from './ActionType';
|
|
6
|
-
import { Draft } from './Draft';
|
|
7
|
-
import { EventConfig, EventConfigInput } from './EventConfig';
|
|
6
|
+
import { Draft, DraftInput, RemoteDraft } from './Draft';
|
|
7
|
+
import { EventConfig, EventConfigInput, VersionedEventConfig } from './EventConfig';
|
|
8
8
|
import { EventDocument } from './EventDocument';
|
|
9
9
|
import { EventIndex } from './EventIndex';
|
|
10
10
|
import { EventInput } from './EventInput';
|
|
@@ -278,6 +278,13 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
|
|
|
278
278
|
};
|
|
279
279
|
};
|
|
280
280
|
};
|
|
281
|
+
/**
|
|
282
|
+
* Generates a single action document with exactly the given status (Accepted by default).
|
|
283
|
+
*
|
|
284
|
+
* For realistic data use `generateActionDocuments`, which also creates the Requested
|
|
285
|
+
* action the events service stores for a confirmable action. Use this one for edge
|
|
286
|
+
* cases, such as pending or rejected requests, or actions without an original request.
|
|
287
|
+
*/
|
|
281
288
|
export declare function generateActionDocument<T extends ActionType>({ configuration, action, rng, defaults, declarationOverrides }: {
|
|
282
289
|
configuration: EventConfig;
|
|
283
290
|
action: T;
|
|
@@ -287,6 +294,45 @@ export declare function generateActionDocument<T extends ActionType>({ configura
|
|
|
287
294
|
}>>;
|
|
288
295
|
declarationOverrides?: ActionUpdate;
|
|
289
296
|
}): ActionDocument;
|
|
297
|
+
type GenerateActionDocumentsArgs<T extends ActionType> = Parameters<typeof generateActionDocument<T>>[0];
|
|
298
|
+
type ActionConfirmation<S extends ActionStatus> = {
|
|
299
|
+
status: S;
|
|
300
|
+
defaults?: Partial<ActionBase>;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Generates the action documents the events service stores for a single action.
|
|
304
|
+
*
|
|
305
|
+
* Mirrors the events service: a confirmable action is first stored as Requested,
|
|
306
|
+
* carrying the declaration and annotation, and then confirmed by a separate
|
|
307
|
+
* Accepted (or Rejected) action that points back to it through originalActionId.
|
|
308
|
+
* Other actions are stored once, as Accepted.
|
|
309
|
+
*
|
|
310
|
+
* `confirmation.status` picks the outcome of a confirmable action:
|
|
311
|
+
* - Accepted (default): [Requested, Accepted]
|
|
312
|
+
* - Rejected: [Requested, Rejected]
|
|
313
|
+
* - Requested: [Requested], i.e. still waiting for confirmation
|
|
314
|
+
*
|
|
315
|
+
* By default the request is confirmed synchronously, so both actions share the
|
|
316
|
+
* `transactionId`. `confirmation.defaults` apply to the confirming action only,
|
|
317
|
+
* e.g. a system user and a `transactionId` of its own for an asynchronous confirmation.
|
|
318
|
+
*
|
|
319
|
+
* The confirming action keeps the generated (or given) `id`, since references such
|
|
320
|
+
* as `requestId` of APPROVE_CORRECTION point to the accepted action.
|
|
321
|
+
*
|
|
322
|
+
* Use `generateActionDocument` instead to build a single action with an explicit status.
|
|
323
|
+
*
|
|
324
|
+
* Only a rejection yields an AsyncRejectActionDocument, so the result is typed
|
|
325
|
+
* as `ActionDocument[]` when `confirmation.status` is known not to be Rejected.
|
|
326
|
+
*/
|
|
327
|
+
export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
|
|
328
|
+
confirmation: ActionConfirmation<typeof ActionStatus.Rejected>;
|
|
329
|
+
}): Action[];
|
|
330
|
+
export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
|
|
331
|
+
confirmation?: Partial<ActionConfirmation<typeof ActionStatus.Accepted | typeof ActionStatus.Requested>>;
|
|
332
|
+
}): ActionDocument[];
|
|
333
|
+
export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
|
|
334
|
+
confirmation?: Partial<ActionConfirmation<ActionStatus>>;
|
|
335
|
+
}): Action[];
|
|
290
336
|
export declare function generateRandomDatetime(rng: () => number, start: Date, end: Date): string;
|
|
291
337
|
export declare function getRandomDate(rng: () => number, start: string, end: string): string;
|
|
292
338
|
export declare function generateEventDocument({ configuration, actions, rng, defaults }: {
|
|
@@ -310,11 +356,11 @@ export declare function generateEventDocument({ configuration, actions, rng, def
|
|
|
310
356
|
}): EventDocument;
|
|
311
357
|
export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
|
|
312
358
|
eventId: UUID;
|
|
313
|
-
actionType:
|
|
359
|
+
actionType: DraftInput['type'];
|
|
314
360
|
rng?: () => number;
|
|
315
361
|
declaration?: ActionUpdate;
|
|
316
362
|
annotation?: ActionUpdate;
|
|
317
|
-
}):
|
|
363
|
+
}): RemoteDraft;
|
|
318
364
|
/**
|
|
319
365
|
* Useful for testing when we need deterministic outcome.
|
|
320
366
|
* @param seed - Seed value for the pseudo-random number generator
|
|
@@ -373,4 +419,10 @@ export declare function generateTestValidatorContext(userRole?: TestUserRole, ev
|
|
|
373
419
|
event: EventDocument;
|
|
374
420
|
eventConfig: EventConfig;
|
|
375
421
|
}): ValidatorContext;
|
|
422
|
+
/**
|
|
423
|
+
* Serves `config` as country config does: as the only version of its event.
|
|
424
|
+
* For mocking `/config/events` and `event.config.get` with a configuration built in a test.
|
|
425
|
+
*/
|
|
426
|
+
export declare function toVersionedEventConfig({ id, label, advancedSearch, ...version }: EventConfig): VersionedEventConfig;
|
|
427
|
+
export {};
|
|
376
428
|
//# sourceMappingURL=test.utils.d.ts.map
|
|
@@ -654,6 +654,19 @@ export declare function getCompleteActionAnnotation(event: EventDocument, action
|
|
|
654
654
|
export declare function getCompleteActionContent(event: EventDocument, action: ActionDocument): Record<string, unknown> | null | undefined;
|
|
655
655
|
export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
|
|
656
656
|
export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
|
|
657
|
+
/**
|
|
658
|
+
* Returns the event with each Accepted action completed with the details of
|
|
659
|
+
* its original Requested action: who requested it, where, and the request's
|
|
660
|
+
* declaration, annotation and content (the Accepted action's own values win).
|
|
661
|
+
*
|
|
662
|
+
* `$event` conditionals match Accepted actions only, but an Accepted action
|
|
663
|
+
* does not carry everything its request did. A synchronous confirmation drops
|
|
664
|
+
* the request's annotation; an asynchronous `accept` is created by the system
|
|
665
|
+
* user and carries only what the country configuration sent. Without this,
|
|
666
|
+
* `event.hasAction(...).withTemplate(...)` / `.withFields(...)` would stop
|
|
667
|
+
* matching fields that matched the Requested action.
|
|
668
|
+
*/
|
|
669
|
+
export declare function getEventWithCompleteAcceptedActions(event: EventDocument): EventDocument;
|
|
657
670
|
export declare function aggregateActionDeclarations(event: EventDocument): EventState;
|
|
658
671
|
/**
|
|
659
672
|
* Returns the declaration after each of `event.actions`, which must be in chronological order.
|
|
@@ -5,6 +5,7 @@ export type Question<T extends string> = PromptObject<T> & {
|
|
|
5
5
|
valueType?: 'SECRET' | 'VARIABLE';
|
|
6
6
|
scope: 'ENVIRONMENT' | 'REPOSITORY';
|
|
7
7
|
valueLabel?: string;
|
|
8
|
+
legacyValueLabel?: string;
|
|
8
9
|
};
|
|
9
10
|
export type QuestionDescriptor<T extends string> = Omit<Question<T>, 'type'> & {
|
|
10
11
|
type: 'disabled' | PromptObject<T>['type'];
|
|
@@ -1 +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;
|
|
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,UAA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
|
}, {
|
|
50
50
|
readonly name: 'S3_ADMIN_ACCESS_KEY';
|
|
51
51
|
readonly valueLabel: 'S3_ADMIN_ACCESS_KEY';
|
|
52
|
+
readonly legacyValueLabel: 'MINIO_ROOT_USER';
|
|
52
53
|
readonly valueType: 'SECRET';
|
|
53
54
|
readonly type: 'disabled';
|
|
54
55
|
readonly scope: 'ENVIRONMENT';
|
|
55
56
|
}, {
|
|
56
57
|
readonly name: 'S3_ADMIN_SECRET_KEY';
|
|
57
58
|
readonly valueLabel: 'S3_ADMIN_SECRET_KEY';
|
|
59
|
+
readonly legacyValueLabel: 'MINIO_ROOT_PASSWORD';
|
|
58
60
|
readonly valueType: 'SECRET';
|
|
59
61
|
readonly type: 'disabled';
|
|
60
62
|
readonly scope: 'ENVIRONMENT';
|
|
@@ -142,5 +144,11 @@ export declare const derivedVariables: readonly [{
|
|
|
142
144
|
readonly valueType: 'VARIABLE';
|
|
143
145
|
readonly type: 'disabled';
|
|
144
146
|
readonly scope: 'ENVIRONMENT';
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: 'RUSTFS_HOST_DATA_PATH';
|
|
149
|
+
readonly valueLabel: 'RUSTFS_HOST_DATA_PATH';
|
|
150
|
+
readonly valueType: 'VARIABLE';
|
|
151
|
+
readonly type: 'disabled';
|
|
152
|
+
readonly scope: 'ENVIRONMENT';
|
|
145
153
|
}];
|
|
146
154
|
//# sourceMappingURL=derived-variables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derived-variables.d.ts","sourceRoot":"","sources":["../../src/environment/derived-variables.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;aAEzB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,qBAAqB;aAC3B,UAAU,EAAE,qBAAqB;aACjC,SAAS,EAAE,UAA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aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,wBAAwB;aAC9B,UAAU,EAAE,wBAAwB;aACpC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,oBAAoB;aAC1B,UAAU,EAAE,oBAAoB;aAChC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;EAEd,CAAA"}
|
|
1
|
+
{"version":3,"file":"derived-variables.d.ts","sourceRoot":"","sources":["../../src/environment/derived-variables.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;aAEzB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,qBAAqB;aAC3B,UAAU,EAAE,qBAAqB;aACjC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,cAAc;aACpB,UAAU,EAAE,cAAc;aAC1B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,kCAAkC;aACxC,UAAU,EAAE,kCAAkC;aAC9C,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,WAAW;aACjB,UAAU,EAAE,WAAW;aACvB,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uBAAuB;aAC7B,UAAU,EAAE,uBAAuB;aACnC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;EAEd,CAAA"}
|
|
@@ -71,6 +71,7 @@ exports.derivedVariables = [
|
|
|
71
71
|
{
|
|
72
72
|
name: 'S3_ADMIN_ACCESS_KEY',
|
|
73
73
|
valueLabel: 'S3_ADMIN_ACCESS_KEY',
|
|
74
|
+
legacyValueLabel: 'MINIO_ROOT_USER',
|
|
74
75
|
valueType: 'SECRET',
|
|
75
76
|
type: 'disabled',
|
|
76
77
|
scope: 'ENVIRONMENT'
|
|
@@ -78,6 +79,7 @@ exports.derivedVariables = [
|
|
|
78
79
|
{
|
|
79
80
|
name: 'S3_ADMIN_SECRET_KEY',
|
|
80
81
|
valueLabel: 'S3_ADMIN_SECRET_KEY',
|
|
82
|
+
legacyValueLabel: 'MINIO_ROOT_PASSWORD',
|
|
81
83
|
valueType: 'SECRET',
|
|
82
84
|
type: 'disabled',
|
|
83
85
|
scope: 'ENVIRONMENT'
|
|
@@ -179,5 +181,12 @@ exports.derivedVariables = [
|
|
|
179
181
|
valueType: 'VARIABLE',
|
|
180
182
|
type: 'disabled',
|
|
181
183
|
scope: 'ENVIRONMENT'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'RUSTFS_HOST_DATA_PATH',
|
|
187
|
+
valueLabel: 'RUSTFS_HOST_DATA_PATH',
|
|
188
|
+
valueType: 'VARIABLE',
|
|
189
|
+
type: 'disabled',
|
|
190
|
+
scope: 'ENVIRONMENT'
|
|
182
191
|
}
|
|
183
192
|
];
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
declare const notEmpty: (value: string | number) => "Please enter a value" | true;
|
|
2
2
|
declare function validateCIDRs(input: string): true | string;
|
|
3
|
-
|
|
3
|
+
declare function validateRegistryHost(input: string): true | string;
|
|
4
|
+
export declare const registryQuestions: ({
|
|
5
|
+
name: string;
|
|
6
|
+
type: 'text';
|
|
7
|
+
message: string;
|
|
8
|
+
valueType: 'VARIABLE';
|
|
9
|
+
valueLabel: string;
|
|
10
|
+
validate: typeof validateRegistryHost;
|
|
11
|
+
initial: string;
|
|
12
|
+
scope: 'REPOSITORY';
|
|
13
|
+
legacyValueLabel?: undefined;
|
|
14
|
+
} | {
|
|
4
15
|
name: string;
|
|
5
16
|
type: 'text';
|
|
6
17
|
message: string;
|
|
7
18
|
valueType: 'SECRET';
|
|
8
19
|
valueLabel: string;
|
|
20
|
+
legacyValueLabel: string;
|
|
9
21
|
validate: typeof notEmpty;
|
|
10
22
|
initial: string | undefined;
|
|
11
23
|
scope: 'REPOSITORY';
|
|
12
|
-
}[];
|
|
24
|
+
})[];
|
|
13
25
|
export declare const githubQuestions: {
|
|
14
26
|
name: string;
|
|
15
27
|
type: 'text';
|
|
@@ -18,7 +30,21 @@ export declare const githubQuestions: {
|
|
|
18
30
|
initial: string;
|
|
19
31
|
scope: 'REPOSITORY';
|
|
20
32
|
}[];
|
|
21
|
-
export declare const
|
|
33
|
+
export declare const githubApprovalRequiredQuestion: {
|
|
34
|
+
name: string;
|
|
35
|
+
type: 'select';
|
|
36
|
+
message: string;
|
|
37
|
+
choices: {
|
|
38
|
+
title: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}[];
|
|
41
|
+
valueType: 'VARIABLE';
|
|
42
|
+
validate: typeof notEmpty;
|
|
43
|
+
valueLabel: string;
|
|
44
|
+
initial: string | undefined;
|
|
45
|
+
scope: 'ENVIRONMENT';
|
|
46
|
+
};
|
|
47
|
+
export declare const githubApproversQuestion: {
|
|
22
48
|
name: string;
|
|
23
49
|
type: 'text';
|
|
24
50
|
message: string;
|
|
@@ -26,9 +52,8 @@ export declare const githubOtherQuestions: ({
|
|
|
26
52
|
valueType: 'VARIABLE';
|
|
27
53
|
valueLabel: string;
|
|
28
54
|
scope: 'REPOSITORY';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} | {
|
|
55
|
+
};
|
|
56
|
+
export declare const githubOtherQuestions: ({
|
|
32
57
|
name: string;
|
|
33
58
|
type: 'select';
|
|
34
59
|
message: string;
|
|
@@ -41,6 +66,14 @@ export declare const githubOtherQuestions: ({
|
|
|
41
66
|
valueLabel: string;
|
|
42
67
|
initial: string | undefined;
|
|
43
68
|
scope: 'ENVIRONMENT';
|
|
69
|
+
} | {
|
|
70
|
+
name: string;
|
|
71
|
+
type: 'text';
|
|
72
|
+
message: string;
|
|
73
|
+
initial: string | undefined;
|
|
74
|
+
valueType: 'VARIABLE';
|
|
75
|
+
valueLabel: string;
|
|
76
|
+
scope: 'REPOSITORY';
|
|
44
77
|
})[];
|
|
45
78
|
export declare const githubTokenQuestion: {
|
|
46
79
|
name: string;
|
|
@@ -71,7 +104,6 @@ export declare const infrastructureQuestions: ({
|
|
|
71
104
|
initial: string | undefined;
|
|
72
105
|
scope: 'ENVIRONMENT';
|
|
73
106
|
} | {
|
|
74
|
-
validate?: undefined;
|
|
75
107
|
name: string;
|
|
76
108
|
type: 'text';
|
|
77
109
|
message: string;
|
|
@@ -79,6 +111,7 @@ export declare const infrastructureQuestions: ({
|
|
|
79
111
|
valueLabel: string;
|
|
80
112
|
initial: string | undefined;
|
|
81
113
|
scope: 'ENVIRONMENT';
|
|
114
|
+
validate?: undefined;
|
|
82
115
|
} | {
|
|
83
116
|
name: string;
|
|
84
117
|
type: 'text';
|
|
@@ -100,7 +133,6 @@ export declare const staticSSLCertQuestions: {
|
|
|
100
133
|
scope: 'ENVIRONMENT';
|
|
101
134
|
}[];
|
|
102
135
|
export declare const backupQuestions: ({
|
|
103
|
-
choices?: undefined;
|
|
104
136
|
validate?: undefined;
|
|
105
137
|
name: string;
|
|
106
138
|
type: 'text';
|
|
@@ -109,8 +141,8 @@ export declare const backupQuestions: ({
|
|
|
109
141
|
valueLabel: string;
|
|
110
142
|
initial: string;
|
|
111
143
|
scope: 'ENVIRONMENT';
|
|
112
|
-
} | {
|
|
113
144
|
choices?: undefined;
|
|
145
|
+
} | {
|
|
114
146
|
name: string;
|
|
115
147
|
type: 'text';
|
|
116
148
|
message: string;
|
|
@@ -119,6 +151,7 @@ export declare const backupQuestions: ({
|
|
|
119
151
|
valueLabel: string;
|
|
120
152
|
initial: string;
|
|
121
153
|
scope: 'ENVIRONMENT';
|
|
154
|
+
choices?: undefined;
|
|
122
155
|
} | {
|
|
123
156
|
name: string;
|
|
124
157
|
type: 'select';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/environment/questions.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,QAAQ,UAAW,MAAM,GAAG,MAAM,kCAC4B,CAAA;AAepE,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBnD;
|
|
1
|
+
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/environment/questions.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,QAAQ,UAAW,MAAM,GAAG,MAAM,kCAC4B,CAAA;AAepE,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBnD;AAGD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAI1D;AAGD,eAAO,MAAM,iBAAiB;;UAGpB,MAAM;;eAGD,UAAU;;;;WAId,YAAY;;;;UAIb,MAAM;;eAGD,QAAQ;;;;;WAKZ,YAAY;IAoCtB,CAAA;AAED,eAAO,MAAM,eAAe;;UAGlB,MAAM;;;;WAIL,YAAY;GAUtB,CAAA;AACD,eAAO,MAAM,8BAA8B;;UAEnC,QAAQ;;;;;;eAaH,UAAU;;;;WAId,aAAa;CACrB,CAAA;AACD,eAAO,MAAM,uBAAuB;IAClC,IAAI;IACJ,IAAI,EAAE,MAAM;IACZ,OAAO;IACP,OAAO;IACP,SAAS,EAAE,UAAU;IACrB,UAAU;IACV,KAAK,EAAE,YAAY;CACpB,CAAA;AACD,eAA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mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.metabaseAdminQuestions = exports.sentryQuestions = exports.emailQuestions = exports.databaseAndMonitoringQuestions = exports.diskQuestions = exports.backupQuestions = exports.staticSSLCertQuestions = exports.infrastructureQuestions = exports.countryQuestions = exports.githubTokenQuestion = exports.githubOtherQuestions = exports.githubQuestions = exports.
|
|
16
|
+
exports.metabaseAdminQuestions = exports.sentryQuestions = exports.emailQuestions = exports.databaseAndMonitoringQuestions = exports.diskQuestions = exports.backupQuestions = exports.staticSSLCertQuestions = exports.infrastructureQuestions = exports.countryQuestions = exports.githubTokenQuestion = exports.githubOtherQuestions = exports.githubApproversQuestion = exports.githubApprovalRequiredQuestion = exports.githubQuestions = exports.registryQuestions = void 0;
|
|
17
17
|
const kleur_1 = __importDefault(require("kleur"));
|
|
18
18
|
const utils_1 = require("./utils");
|
|
19
19
|
const git_1 = require("./git");
|
|
@@ -40,45 +40,66 @@ function validateCIDRs(input) {
|
|
|
40
40
|
}
|
|
41
41
|
return true;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
// A host with an optional port, without protocol or path (e.g. docker.io, ghcr.io, registry.example.org:5000)
|
|
44
|
+
function validateRegistryHost(input) {
|
|
45
|
+
return /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:[0-9]+)?$/i.test(input)
|
|
46
|
+
? true
|
|
47
|
+
: 'Please enter a registry host without protocol or path (e.g. docker.io, ghcr.io)';
|
|
48
|
+
}
|
|
49
|
+
// The DOCKER_* and DOCKERHUB_* secrets are the previous names of the REGISTRY_* secrets
|
|
50
|
+
exports.registryQuestions = [
|
|
51
|
+
{
|
|
52
|
+
name: 'registryHost',
|
|
53
|
+
type: 'text',
|
|
54
|
+
message: 'What is the host of your container registry? (e.g. docker.io, ghcr.io)',
|
|
55
|
+
valueType: 'VARIABLE',
|
|
56
|
+
valueLabel: 'REGISTRY_HOST',
|
|
57
|
+
validate: validateRegistryHost,
|
|
58
|
+
initial: process.env.REGISTRY_HOST || 'docker.io',
|
|
59
|
+
scope: 'REPOSITORY'
|
|
60
|
+
},
|
|
44
61
|
{
|
|
45
|
-
name: '
|
|
62
|
+
name: 'registryOrganisation',
|
|
46
63
|
type: 'text',
|
|
47
|
-
message: 'What is the name of your
|
|
64
|
+
message: 'What is the name of your organisation (or user) in the container registry?',
|
|
48
65
|
valueType: 'SECRET',
|
|
49
|
-
valueLabel: '
|
|
66
|
+
valueLabel: 'REGISTRY_ORGANISATION',
|
|
67
|
+
legacyValueLabel: 'DOCKERHUB_ACCOUNT',
|
|
50
68
|
validate: notEmpty,
|
|
51
|
-
initial: process.env.
|
|
69
|
+
initial: process.env.REGISTRY_ORGANISATION,
|
|
52
70
|
scope: 'REPOSITORY'
|
|
53
71
|
},
|
|
54
72
|
{
|
|
55
|
-
name: '
|
|
73
|
+
name: 'registryRepository',
|
|
56
74
|
type: 'text',
|
|
57
|
-
message: 'What is the name of your private
|
|
75
|
+
message: 'What is the name of your private container repository?',
|
|
58
76
|
valueType: 'SECRET',
|
|
59
|
-
valueLabel: '
|
|
77
|
+
valueLabel: 'REGISTRY_REPOSITORY',
|
|
78
|
+
legacyValueLabel: 'DOCKERHUB_REPO',
|
|
60
79
|
validate: notEmpty,
|
|
61
|
-
initial: process.env.
|
|
80
|
+
initial: process.env.REGISTRY_REPOSITORY,
|
|
62
81
|
scope: 'REPOSITORY'
|
|
63
82
|
},
|
|
64
83
|
{
|
|
65
|
-
name: '
|
|
84
|
+
name: 'registryUsername',
|
|
66
85
|
type: 'text',
|
|
67
|
-
message: 'What is the
|
|
86
|
+
message: 'What is the container registry username the target server should be using?',
|
|
68
87
|
valueType: 'SECRET',
|
|
69
|
-
valueLabel: '
|
|
88
|
+
valueLabel: 'REGISTRY_USERNAME',
|
|
89
|
+
legacyValueLabel: 'DOCKER_USERNAME',
|
|
70
90
|
validate: notEmpty,
|
|
71
|
-
initial: process.env.
|
|
91
|
+
initial: process.env.REGISTRY_USERNAME,
|
|
72
92
|
scope: 'REPOSITORY'
|
|
73
93
|
},
|
|
74
94
|
{
|
|
75
|
-
name: '
|
|
95
|
+
name: 'registryToken',
|
|
76
96
|
type: 'text',
|
|
77
|
-
message: 'What is the token of this
|
|
97
|
+
message: 'What is the token of this container registry account?',
|
|
78
98
|
valueType: 'SECRET',
|
|
79
|
-
valueLabel: '
|
|
99
|
+
valueLabel: 'REGISTRY_TOKEN',
|
|
100
|
+
legacyValueLabel: 'DOCKER_TOKEN',
|
|
80
101
|
validate: notEmpty,
|
|
81
|
-
initial: process.env.
|
|
102
|
+
initial: process.env.REGISTRY_TOKEN,
|
|
82
103
|
scope: 'REPOSITORY'
|
|
83
104
|
}
|
|
84
105
|
];
|
|
@@ -100,36 +121,38 @@ exports.githubQuestions = [
|
|
|
100
121
|
scope: 'REPOSITORY'
|
|
101
122
|
}
|
|
102
123
|
];
|
|
124
|
+
exports.githubApprovalRequiredQuestion = {
|
|
125
|
+
name: 'approvalRequired',
|
|
126
|
+
type: 'select',
|
|
127
|
+
message: 'Would you like to enable approvals process for GitHub action workflows?',
|
|
128
|
+
choices: [
|
|
129
|
+
{
|
|
130
|
+
title: 'True',
|
|
131
|
+
value: 'true'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: 'False',
|
|
135
|
+
value: 'false'
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
valueType: 'VARIABLE',
|
|
139
|
+
validate: notEmpty,
|
|
140
|
+
valueLabel: 'APPROVAL_REQUIRED',
|
|
141
|
+
initial: process.env.APPROVAL_REQUIRED,
|
|
142
|
+
scope: 'ENVIRONMENT'
|
|
143
|
+
};
|
|
144
|
+
exports.githubApproversQuestion = {
|
|
145
|
+
name: 'githubApprovers',
|
|
146
|
+
type: 'text',
|
|
147
|
+
message: 'Please provide/update list of approvers?',
|
|
148
|
+
initial: process.env.GH_APPROVERS,
|
|
149
|
+
valueType: 'VARIABLE',
|
|
150
|
+
valueLabel: 'GH_APPROVERS',
|
|
151
|
+
scope: 'REPOSITORY'
|
|
152
|
+
};
|
|
103
153
|
exports.githubOtherQuestions = [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
type: 'text',
|
|
107
|
-
message: 'Please provide/update list of production approvers?',
|
|
108
|
-
initial: process.env.GH_APPROVERS,
|
|
109
|
-
valueType: 'VARIABLE',
|
|
110
|
-
valueLabel: 'GH_APPROVERS',
|
|
111
|
-
scope: 'REPOSITORY'
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: 'approvalRequired',
|
|
115
|
-
type: 'select',
|
|
116
|
-
message: 'Would you like to enable approvals process for GitHub action workflows?',
|
|
117
|
-
choices: [
|
|
118
|
-
{
|
|
119
|
-
title: 'True',
|
|
120
|
-
value: 'true'
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
title: 'False',
|
|
124
|
-
value: 'false'
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
valueType: 'VARIABLE',
|
|
128
|
-
validate: notEmpty,
|
|
129
|
-
valueLabel: 'APPROVAL_REQUIRED',
|
|
130
|
-
initial: process.env.APPROVAL_REQUIRED,
|
|
131
|
-
scope: 'ENVIRONMENT'
|
|
132
|
-
}
|
|
154
|
+
exports.githubApprovalRequiredQuestion,
|
|
155
|
+
exports.githubApproversQuestion
|
|
133
156
|
];
|
|
134
157
|
exports.githubTokenQuestion = [
|
|
135
158
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type RegistryValidationResult = {
|
|
2
|
+
status: 'valid' | 'skipped' | 'invalid-credentials' | 'repository-not-found' | 'unreachable';
|
|
3
|
+
reason?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Checks, using the OCI Distribution (Docker Registry HTTP API v2) that every
|
|
7
|
+
* registry implements, that the username/token pair is accepted by the registry
|
|
8
|
+
* and that the organisation/repository is visible to that account.
|
|
9
|
+
*
|
|
10
|
+
* Existing GitHub secrets cannot be read back, so when any value is missing
|
|
11
|
+
* (kept from an existing secret) the check is skipped.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateRegistryCredentials(registry: string | undefined, organisation: string | undefined, repository: string | undefined, username: string | undefined, token: string | undefined): Promise<RegistryValidationResult>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/environment/registry.ts"],"names":[],"mappings":"AAaA,KAAK,wBAAwB,GAAG;IAC9B,MAAM,EACF,OAAO,GAEP,SAAS,GACT,qBAAqB,GACrB,sBAAsB,GAEtB,aAAa,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAyCD;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,wBAAwB,CAAC,CA0DnC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.validateRegistryCredentials = validateRegistryCredentials;
|
|
23
|
+
const REQUEST_TIMEOUT_MS = 10000;
|
|
24
|
+
// Docker Hub serves its registry API from registry-1.docker.io, docker.io is the website
|
|
25
|
+
function registryApiHost(registry) {
|
|
26
|
+
const host = registry.trim().toLowerCase();
|
|
27
|
+
return host === 'docker.io' || host === 'index.docker.io'
|
|
28
|
+
? 'registry-1.docker.io'
|
|
29
|
+
: host;
|
|
30
|
+
}
|
|
31
|
+
function request(url, authorization) {
|
|
32
|
+
return fetch(url, {
|
|
33
|
+
headers: authorization ? { Authorization: authorization } : {},
|
|
34
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function failure(registry, step, response) {
|
|
38
|
+
const reason = `${registry} ${step} responded with HTTP ${response.status}`;
|
|
39
|
+
switch (response.status) {
|
|
40
|
+
case 401:
|
|
41
|
+
case 403:
|
|
42
|
+
return {
|
|
43
|
+
status: 'invalid-credentials',
|
|
44
|
+
reason: `${reason}. Check REGISTRY_USERNAME, REGISTRY_TOKEN, REGISTRY_ORGANISATION and REGISTRY_REPOSITORY`
|
|
45
|
+
};
|
|
46
|
+
case 404:
|
|
47
|
+
// The API cannot tell an empty repository from one that does not exist
|
|
48
|
+
return {
|
|
49
|
+
status: 'repository-not-found',
|
|
50
|
+
reason: `${reason}. This is also the answer for an empty repository. Check REGISTRY_ORGANISATION and REGISTRY_REPOSITORY`
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
return { status: 'unreachable', reason };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks, using the OCI Distribution (Docker Registry HTTP API v2) that every
|
|
58
|
+
* registry implements, that the username/token pair is accepted by the registry
|
|
59
|
+
* and that the organisation/repository is visible to that account.
|
|
60
|
+
*
|
|
61
|
+
* Existing GitHub secrets cannot be read back, so when any value is missing
|
|
62
|
+
* (kept from an existing secret) the check is skipped.
|
|
63
|
+
*/
|
|
64
|
+
function validateRegistryCredentials(registry, organisation, repository, username, token) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
var _c, _d;
|
|
68
|
+
if (!registry || !organisation || !repository || !username || !token) {
|
|
69
|
+
return {
|
|
70
|
+
status: 'skipped',
|
|
71
|
+
reason: 'Some values are kept from existing GitHub secrets, which cannot be read back'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const host = registryApiHost(registry);
|
|
75
|
+
const name = `${organisation}/${repository}`;
|
|
76
|
+
const basic = `Basic ${Buffer.from(`${username}:${token}`).toString('base64')}`;
|
|
77
|
+
try {
|
|
78
|
+
// A registry that wants a token names its token service in the challenge.
|
|
79
|
+
// For any other answer the credentials are sent as they are.
|
|
80
|
+
const challenge = (_c = (yield request(`https://${host}/v2/`, undefined)).headers.get('www-authenticate')) !== null && _c !== void 0 ? _c : '';
|
|
81
|
+
const realm = (_a = challenge.match(/realm="([^"]*)"/i)) === null || _a === void 0 ? void 0 : _a[1];
|
|
82
|
+
const service = (_b = challenge.match(/service="([^"]*)"/i)) === null || _b === void 0 ? void 0 : _b[1];
|
|
83
|
+
let authorization = basic;
|
|
84
|
+
if (/^\s*bearer/i.test(challenge) && realm) {
|
|
85
|
+
const tokenUrl = new URL(realm);
|
|
86
|
+
if (service) {
|
|
87
|
+
tokenUrl.searchParams.set('service', service);
|
|
88
|
+
}
|
|
89
|
+
tokenUrl.searchParams.set('scope', `repository:${name}:pull`);
|
|
90
|
+
const login = yield request(tokenUrl, basic);
|
|
91
|
+
if (!login.ok) {
|
|
92
|
+
return failure(registry, 'login', login);
|
|
93
|
+
}
|
|
94
|
+
const body = (yield login.json());
|
|
95
|
+
authorization = `Bearer ${(_d = body.token) !== null && _d !== void 0 ? _d : body.access_token}`;
|
|
96
|
+
}
|
|
97
|
+
const path = name.split('/').map(encodeURIComponent).join('/');
|
|
98
|
+
const response = yield request(`https://${host}/v2/${path}/tags/list?n=1`, authorization);
|
|
99
|
+
return response.ok
|
|
100
|
+
? { status: 'valid' }
|
|
101
|
+
: failure(registry, `lookup of repository ${name}`, response);
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
if (!(err instanceof Error)) {
|
|
105
|
+
return { status: 'unreachable', reason: String(err) };
|
|
106
|
+
}
|
|
107
|
+
// fetch only reports "fetch failed", the real error (e.g. ENOTFOUND) is its cause
|
|
108
|
+
const cause = err.cause instanceof Error ? `: ${err.cause.message}` : '';
|
|
109
|
+
return { status: 'unreachable', reason: `${err.message}${cause}` };
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"AA8aA,wBAAsB,mBAAmB,kBAosCxC"}
|