@opencrvs/toolkit 2.2.0-rc.3de6f63 → 2.2.0-rc.5bf5dfc
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/build.sh +7 -2
- package/dist/application-config/index.js +4 -4
- package/dist/authentication/index.d.ts +1 -1
- package/dist/authentication/index.js +4 -8
- package/dist/cli.js +48 -31
- package/dist/commons/api/router.d.ts +3 -3
- package/dist/commons/conditionals/conditionals.d.ts +4 -4
- package/dist/commons/conditionals/validate.d.ts +1 -1
- package/dist/commons/events/ActionStatus.d.ts +2 -2
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/Draft.d.ts +34 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/locations.d.ts +1 -1
- package/dist/commons/events/scopes.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +3 -3
- package/dist/commons/users/Role.d.ts +23 -0
- package/dist/commons/users/User.d.ts +263 -0
- package/dist/commons/users/authentication.d.ts +67 -0
- package/dist/commons/users/index.d.ts +5 -0
- package/dist/commons/users/roleValidations.d.ts +15 -0
- package/dist/commons/users/scopes.d.ts +1402 -0
- package/dist/commons/users/userReferences.d.ts +176 -0
- package/dist/conditionals/index.js +3 -3
- package/dist/environment/questions.d.ts +28 -7
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +32 -30
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +9 -1
- package/dist/events/index.js +17 -9
- package/dist/notification/index.js +15 -9
- package/dist/roles/index.d.ts +2 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +719 -0
- package/dist/scopes/index.d.ts +0 -10
- package/dist/scopes/index.js +3 -7
- package/opencrvs-toolkit-2.2.0-rc.5bf5dfc.tgz +0 -0
- package/package.json +3 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -5
- package/opencrvs-toolkit-2.2.0-rc.3de6f63.tgz +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { JurisdictionFilter, ScopeType, ScopeOptionKey } from './scopes';
|
|
2
|
+
import z from 'zod/v4';
|
|
3
|
+
declare const ScopeOptionReference: z.ZodObject<{
|
|
4
|
+
$scope: z.ZodEnum<{
|
|
5
|
+
"attachment.upload": "attachment.upload";
|
|
6
|
+
bypassratelimit: "bypassratelimit";
|
|
7
|
+
"config.update-all": "config.update-all";
|
|
8
|
+
"dashboard.view": "dashboard.view";
|
|
9
|
+
"integration.audit.read": "integration.audit.read";
|
|
10
|
+
"integration.create": "integration.create";
|
|
11
|
+
"location.edit": "location.edit";
|
|
12
|
+
"organisation.read-locations": "organisation.read-locations";
|
|
13
|
+
"performance.read": "performance.read";
|
|
14
|
+
"performance.read-dashboards": "performance.read-dashboards";
|
|
15
|
+
"performance.vital-statistics-export": "performance.vital-statistics-export";
|
|
16
|
+
"profile.electronic-signature": "profile.electronic-signature";
|
|
17
|
+
"record.action.accept": "record.action.accept";
|
|
18
|
+
"record.action.reject": "record.action.reject";
|
|
19
|
+
"record.archive": "record.archive";
|
|
20
|
+
"record.correct": "record.correct";
|
|
21
|
+
"record.create": "record.create";
|
|
22
|
+
"record.custom-action": "record.custom-action";
|
|
23
|
+
"record.declare": "record.declare";
|
|
24
|
+
"record.edit": "record.edit";
|
|
25
|
+
"record.import": "record.import";
|
|
26
|
+
"record.notify": "record.notify";
|
|
27
|
+
"record.print-certified-copies": "record.print-certified-copies";
|
|
28
|
+
"record.read": "record.read";
|
|
29
|
+
"record.register": "record.register";
|
|
30
|
+
"record.reindex": "record.reindex";
|
|
31
|
+
"record.reinstate-registration": "record.reinstate-registration";
|
|
32
|
+
"record.reject": "record.reject";
|
|
33
|
+
"record.request-correction": "record.request-correction";
|
|
34
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
35
|
+
"record.revoke-registration": "record.revoke-registration";
|
|
36
|
+
"record.search": "record.search";
|
|
37
|
+
"record.unarchive": "record.unarchive";
|
|
38
|
+
"record.unassign-others": "record.unassign-others";
|
|
39
|
+
"user.create": "user.create";
|
|
40
|
+
"user.data-seeding": "user.data-seeding";
|
|
41
|
+
"user.edit": "user.edit";
|
|
42
|
+
"user.read": "user.read";
|
|
43
|
+
"user.read-only-my-audit": "user.read-only-my-audit";
|
|
44
|
+
"user.search": "user.search";
|
|
45
|
+
workqueue: "workqueue";
|
|
46
|
+
}>;
|
|
47
|
+
$option: z.ZodEnum<{
|
|
48
|
+
accessLevel: "accessLevel";
|
|
49
|
+
createdBy: "createdBy";
|
|
50
|
+
createdIn: "createdIn";
|
|
51
|
+
declaredBy: "declaredBy";
|
|
52
|
+
declaredIn: "declaredIn";
|
|
53
|
+
event: "event";
|
|
54
|
+
flags: "flags";
|
|
55
|
+
ids: "ids";
|
|
56
|
+
notifiedBy: "notifiedBy";
|
|
57
|
+
notifiedIn: "notifiedIn";
|
|
58
|
+
placeOfEvent: "placeOfEvent";
|
|
59
|
+
registeredBy: "registeredBy";
|
|
60
|
+
registeredIn: "registeredIn";
|
|
61
|
+
role: "role";
|
|
62
|
+
status: "status";
|
|
63
|
+
}>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
type ScopeOptionReference = z.infer<typeof ScopeOptionReference>;
|
|
66
|
+
export declare const JurisdictionReference: z.ZodObject<{
|
|
67
|
+
$jurisdiction: z.ZodUnion<[z.ZodEnum<{
|
|
68
|
+
administrativeArea: "administrativeArea";
|
|
69
|
+
all: "all";
|
|
70
|
+
location: "location";
|
|
71
|
+
}>, z.ZodObject<{
|
|
72
|
+
$scope: z.ZodEnum<{
|
|
73
|
+
"attachment.upload": "attachment.upload";
|
|
74
|
+
bypassratelimit: "bypassratelimit";
|
|
75
|
+
"config.update-all": "config.update-all";
|
|
76
|
+
"dashboard.view": "dashboard.view";
|
|
77
|
+
"integration.audit.read": "integration.audit.read";
|
|
78
|
+
"integration.create": "integration.create";
|
|
79
|
+
"location.edit": "location.edit";
|
|
80
|
+
"organisation.read-locations": "organisation.read-locations";
|
|
81
|
+
"performance.read": "performance.read";
|
|
82
|
+
"performance.read-dashboards": "performance.read-dashboards";
|
|
83
|
+
"performance.vital-statistics-export": "performance.vital-statistics-export";
|
|
84
|
+
"profile.electronic-signature": "profile.electronic-signature";
|
|
85
|
+
"record.action.accept": "record.action.accept";
|
|
86
|
+
"record.action.reject": "record.action.reject";
|
|
87
|
+
"record.archive": "record.archive";
|
|
88
|
+
"record.correct": "record.correct";
|
|
89
|
+
"record.create": "record.create";
|
|
90
|
+
"record.custom-action": "record.custom-action";
|
|
91
|
+
"record.declare": "record.declare";
|
|
92
|
+
"record.edit": "record.edit";
|
|
93
|
+
"record.import": "record.import";
|
|
94
|
+
"record.notify": "record.notify";
|
|
95
|
+
"record.print-certified-copies": "record.print-certified-copies";
|
|
96
|
+
"record.read": "record.read";
|
|
97
|
+
"record.register": "record.register";
|
|
98
|
+
"record.reindex": "record.reindex";
|
|
99
|
+
"record.reinstate-registration": "record.reinstate-registration";
|
|
100
|
+
"record.reject": "record.reject";
|
|
101
|
+
"record.request-correction": "record.request-correction";
|
|
102
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
103
|
+
"record.revoke-registration": "record.revoke-registration";
|
|
104
|
+
"record.search": "record.search";
|
|
105
|
+
"record.unarchive": "record.unarchive";
|
|
106
|
+
"record.unassign-others": "record.unassign-others";
|
|
107
|
+
"user.create": "user.create";
|
|
108
|
+
"user.data-seeding": "user.data-seeding";
|
|
109
|
+
"user.edit": "user.edit";
|
|
110
|
+
"user.read": "user.read";
|
|
111
|
+
"user.read-only-my-audit": "user.read-only-my-audit";
|
|
112
|
+
"user.search": "user.search";
|
|
113
|
+
workqueue: "workqueue";
|
|
114
|
+
}>;
|
|
115
|
+
$option: z.ZodEnum<{
|
|
116
|
+
accessLevel: "accessLevel";
|
|
117
|
+
createdBy: "createdBy";
|
|
118
|
+
createdIn: "createdIn";
|
|
119
|
+
declaredBy: "declaredBy";
|
|
120
|
+
declaredIn: "declaredIn";
|
|
121
|
+
event: "event";
|
|
122
|
+
flags: "flags";
|
|
123
|
+
ids: "ids";
|
|
124
|
+
notifiedBy: "notifiedBy";
|
|
125
|
+
notifiedIn: "notifiedIn";
|
|
126
|
+
placeOfEvent: "placeOfEvent";
|
|
127
|
+
registeredBy: "registeredBy";
|
|
128
|
+
registeredIn: "registeredIn";
|
|
129
|
+
role: "role";
|
|
130
|
+
status: "status";
|
|
131
|
+
}>;
|
|
132
|
+
}, z.core.$strip>]>;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
export type JurisdictionReference = z.infer<typeof JurisdictionReference>;
|
|
135
|
+
/**
|
|
136
|
+
* Resolves a jurisdiction reference to a jurisdiction filter.
|
|
137
|
+
*
|
|
138
|
+
* @param jurisdictionReference - The jurisdiction reference to resolve. This can be a plain jurisdiction filter or a scope option reference.
|
|
139
|
+
* @returns The jurisdiction filter or undefined if the jurisdiction reference is not valid.
|
|
140
|
+
*/
|
|
141
|
+
export declare function resolveJurisdictionReference(jurisdictionReference: JurisdictionReference | undefined, token?: string, eventType?: string): JurisdictionFilter | undefined;
|
|
142
|
+
/** Functions for referencing values from the logged in user's details */
|
|
143
|
+
export declare const userReferenceFunctions: {
|
|
144
|
+
scope: (scope: ScopeType) => {
|
|
145
|
+
/**
|
|
146
|
+
* user.scope().attribute() is used to create a scope option reference.
|
|
147
|
+
*
|
|
148
|
+
* E.g.: user.scope('record.create').attribute('placeOfEvent')
|
|
149
|
+
*
|
|
150
|
+
* @param option - The option to create a reference for.
|
|
151
|
+
* @returns A scope option reference.
|
|
152
|
+
*/
|
|
153
|
+
attribute: (option: ScopeOptionKey) => {
|
|
154
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.action.accept" | "record.action.reject" | "record.archive" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reinstate-registration" | "record.reject" | "record.request-correction" | "record.review-duplicates" | "record.revoke-registration" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
155
|
+
$option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* user.jurisdicton() accepts two different kinds of parameters, either:
|
|
160
|
+
*
|
|
161
|
+
* 1. a plain jurisdiction filter: user.jurisdiction('administrativeArea')
|
|
162
|
+
* 2. a scope option reference: user.jurisdiction(user.scope('record.create').attribute('placeOfEvent'))
|
|
163
|
+
*
|
|
164
|
+
* These will be resolved during runtime.
|
|
165
|
+
*
|
|
166
|
+
* @param jurisdiction - The jurisdiction to resolve.
|
|
167
|
+
*/
|
|
168
|
+
jurisdiction: (jurisdiction: JurisdictionFilter | ScopeOptionReference) => {
|
|
169
|
+
$jurisdiction: "administrativeArea" | "all" | "location" | {
|
|
170
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.action.accept" | "record.action.reject" | "record.archive" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reinstate-registration" | "record.reject" | "record.request-correction" | "record.review-duplicates" | "record.revoke-registration" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
171
|
+
$option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
export {};
|
|
176
|
+
//# sourceMappingURL=userReferences.d.ts.map
|
|
@@ -123,7 +123,7 @@ function todayDateTimeValueSerializer() {
|
|
|
123
123
|
return { $$now: true };
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
// ../commons/src/scopes.ts
|
|
126
|
+
// ../commons/src/users/scopes.ts
|
|
127
127
|
var z11 = __toESM(require("zod/v4"));
|
|
128
128
|
var qs = __toESM(require("qs"));
|
|
129
129
|
|
|
@@ -132,7 +132,7 @@ var import_uuid = require("uuid");
|
|
|
132
132
|
var z4 = __toESM(require("zod/v4"));
|
|
133
133
|
var UUID = z4.uuid().brand("UUID");
|
|
134
134
|
|
|
135
|
-
// ../commons/src/authentication.ts
|
|
135
|
+
// ../commons/src/users/authentication.ts
|
|
136
136
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
137
137
|
var z5 = __toESM(require("zod/v4"));
|
|
138
138
|
var TokenUserType = z5.enum(["user", "system"]);
|
|
@@ -401,7 +401,7 @@ var EventStatus = z10.enum([
|
|
|
401
401
|
"ARCHIVED"
|
|
402
402
|
]);
|
|
403
403
|
|
|
404
|
-
// ../commons/src/scopes.ts
|
|
404
|
+
// ../commons/src/users/scopes.ts
|
|
405
405
|
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
406
406
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
407
407
|
);
|
|
@@ -30,7 +30,21 @@ export declare const githubQuestions: {
|
|
|
30
30
|
initial: string;
|
|
31
31
|
scope: 'REPOSITORY';
|
|
32
32
|
}[];
|
|
33
|
-
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: {
|
|
34
48
|
name: string;
|
|
35
49
|
type: 'text';
|
|
36
50
|
message: string;
|
|
@@ -38,9 +52,8 @@ export declare const githubOtherQuestions: ({
|
|
|
38
52
|
valueType: 'VARIABLE';
|
|
39
53
|
valueLabel: string;
|
|
40
54
|
scope: 'REPOSITORY';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} | {
|
|
55
|
+
};
|
|
56
|
+
export declare const githubOtherQuestions: ({
|
|
44
57
|
name: string;
|
|
45
58
|
type: 'select';
|
|
46
59
|
message: string;
|
|
@@ -53,6 +66,14 @@ export declare const githubOtherQuestions: ({
|
|
|
53
66
|
valueLabel: string;
|
|
54
67
|
initial: string | undefined;
|
|
55
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';
|
|
56
77
|
})[];
|
|
57
78
|
export declare const githubTokenQuestion: {
|
|
58
79
|
name: string;
|
|
@@ -83,7 +104,6 @@ export declare const infrastructureQuestions: ({
|
|
|
83
104
|
initial: string | undefined;
|
|
84
105
|
scope: 'ENVIRONMENT';
|
|
85
106
|
} | {
|
|
86
|
-
validate?: undefined;
|
|
87
107
|
name: string;
|
|
88
108
|
type: 'text';
|
|
89
109
|
message: string;
|
|
@@ -91,6 +111,7 @@ export declare const infrastructureQuestions: ({
|
|
|
91
111
|
valueLabel: string;
|
|
92
112
|
initial: string | undefined;
|
|
93
113
|
scope: 'ENVIRONMENT';
|
|
114
|
+
validate?: undefined;
|
|
94
115
|
} | {
|
|
95
116
|
name: string;
|
|
96
117
|
type: 'text';
|
|
@@ -112,7 +133,6 @@ export declare const staticSSLCertQuestions: {
|
|
|
112
133
|
scope: 'ENVIRONMENT';
|
|
113
134
|
}[];
|
|
114
135
|
export declare const backupQuestions: ({
|
|
115
|
-
choices?: undefined;
|
|
116
136
|
validate?: undefined;
|
|
117
137
|
name: string;
|
|
118
138
|
type: 'text';
|
|
@@ -121,8 +141,8 @@ export declare const backupQuestions: ({
|
|
|
121
141
|
valueLabel: string;
|
|
122
142
|
initial: string;
|
|
123
143
|
scope: 'ENVIRONMENT';
|
|
124
|
-
} | {
|
|
125
144
|
choices?: undefined;
|
|
145
|
+
} | {
|
|
126
146
|
name: string;
|
|
127
147
|
type: 'text';
|
|
128
148
|
message: string;
|
|
@@ -131,6 +151,7 @@ export declare const backupQuestions: ({
|
|
|
131
151
|
valueLabel: string;
|
|
132
152
|
initial: string;
|
|
133
153
|
scope: 'ENVIRONMENT';
|
|
154
|
+
choices?: undefined;
|
|
134
155
|
} | {
|
|
135
156
|
name: string;
|
|
136
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;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,
|
|
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,eAAO,MAAM,oBAAoB;;UA5BzB,QAAQ;;;;;;eAaH,UAAU;;;;WAId,aAAa;;;UAId,MAAM;;;eAGD,UAAU;;WAEd,YAAY;IAKpB,CAAA;AACD,eAAO,MAAM,mBAAmB;;UAGtB,MAAM;;;;eAID,QAAQ;WACZ,YAAY;;GAGtB,CAAA;AAED,eAAO,MAAM,gBAAgB;;UAGnB,MAAM;;eAGD,UAAU;;;WAGd,YAAY;GAEtB,CAAA;AAED,eAAO,MAAM,uBAAuB;;UAG1B,MAAM;;eAED,UAAU;;;;WAId,aAAa;;;UAId,MAAM;;eAED,UAAU;;;WAGd,aAAa;;;;UAsBd,MAAM;;eAED,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AAED,eAAO,MAAM,sBAAsB;;UAGzB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,eAAe;;;UAGlB,MAAM;;eAED,UAAU;;;WAGd,aAAa;;;;UAId,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;;;;UAId,QAAQ;;;;;;eAYH,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AAED,eAAO,MAAM,aAAa;;UAGhB,MAAM;;eAID,UAAU;;;;WAId,aAAa;GAEvB,CAAA;AAED,eAAO,MAAM,8BAA8B;;UAGjC,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,cAAc;;;UAGjB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;;;UAkCd,QAAQ;;;;;;eAYH,QAAQ;;;;WAIZ,aAAa;IAuBvB,CAAA;AAED,eAAO,MAAM,eAAe;;UAGlB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAEvB,CAAA;AAED,eAAO,MAAM,sBAAsB;eAEpB,QAAQ;;UAEb,MAAM;;;WAIL,aAAa;;GAYvB,CAAA"}
|
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (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.registryQuestions = void 0;
|
|
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");
|
|
@@ -121,36 +121,38 @@ exports.githubQuestions = [
|
|
|
121
121
|
scope: 'REPOSITORY'
|
|
122
122
|
}
|
|
123
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
|
+
};
|
|
124
153
|
exports.githubOtherQuestions = [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
type: 'text',
|
|
128
|
-
message: 'Please provide/update list of production approvers?',
|
|
129
|
-
initial: process.env.GH_APPROVERS,
|
|
130
|
-
valueType: 'VARIABLE',
|
|
131
|
-
valueLabel: 'GH_APPROVERS',
|
|
132
|
-
scope: 'REPOSITORY'
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: 'approvalRequired',
|
|
136
|
-
type: 'select',
|
|
137
|
-
message: 'Would you like to enable approvals process for GitHub action workflows?',
|
|
138
|
-
choices: [
|
|
139
|
-
{
|
|
140
|
-
title: 'True',
|
|
141
|
-
value: 'true'
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
title: 'False',
|
|
145
|
-
value: 'false'
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
valueType: 'VARIABLE',
|
|
149
|
-
validate: notEmpty,
|
|
150
|
-
valueLabel: 'APPROVAL_REQUIRED',
|
|
151
|
-
initial: process.env.APPROVAL_REQUIRED,
|
|
152
|
-
scope: 'ENVIRONMENT'
|
|
153
|
-
}
|
|
154
|
+
exports.githubApprovalRequiredQuestion,
|
|
155
|
+
exports.githubApproversQuestion
|
|
154
156
|
];
|
|
155
157
|
exports.githubTokenQuestion = [
|
|
156
158
|
{
|
|
@@ -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,kBA0qCxC"}
|
|
@@ -334,7 +334,15 @@ function runSetupEnvironment() {
|
|
|
334
334
|
(0, logger_1.log)('\n', kleur_1.default
|
|
335
335
|
.yellow()
|
|
336
336
|
.bold('WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n'));
|
|
337
|
-
|
|
337
|
+
}
|
|
338
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Workflow approvals'));
|
|
339
|
+
// The workflows require approval unless APPROVAL_REQUIRED is 'false'
|
|
340
|
+
const { approvalRequired } = yield promptAndStoreAnswer([
|
|
341
|
+
Object.assign(Object.assign({}, questions_1.githubApprovalRequiredQuestion), { initial: (0, questions_helper_1.getIndexFromChoices)(questions_1.githubApprovalRequiredQuestion.choices, process.env.APPROVAL_REQUIRED ||
|
|
342
|
+
(environment_type === 'production' ? 'true' : 'false')) })
|
|
343
|
+
], existingValues);
|
|
344
|
+
if (approvalRequired !== 'false') {
|
|
345
|
+
yield promptAndStoreAnswer([questions_1.githubApproversQuestion], existingValues);
|
|
338
346
|
}
|
|
339
347
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Two-factor authentication (2FA)'));
|
|
340
348
|
const existingTwoFaEnabled = (0, utils_1.findExistingValue)('TWO_FA_ENABLED', 'VARIABLE', 'ENVIRONMENT', existingValues);
|
package/dist/events/index.js
CHANGED
|
@@ -208,6 +208,7 @@ __export(events_exports, {
|
|
|
208
208
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
|
209
209
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
|
210
210
|
RejectedCorrectionAction: () => RejectedCorrectionAction,
|
|
211
|
+
RemoteDraft: () => RemoteDraft,
|
|
211
212
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
|
212
213
|
RevokeRegistrationActionInput: () => RevokeRegistrationActionInput,
|
|
213
214
|
SearchQuery: () => SearchQuery,
|
|
@@ -507,11 +508,11 @@ var import_compile = require("zod/compile");
|
|
|
507
508
|
// ../commons/src/events/AuditLog.ts
|
|
508
509
|
var z9 = __toESM(require("zod/v4"));
|
|
509
510
|
|
|
510
|
-
// ../commons/src/authentication.ts
|
|
511
|
+
// ../commons/src/users/authentication.ts
|
|
511
512
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
512
513
|
var z8 = __toESM(require("zod/v4"));
|
|
513
514
|
|
|
514
|
-
// ../commons/src/scopes.ts
|
|
515
|
+
// ../commons/src/users/scopes.ts
|
|
515
516
|
var z7 = __toESM(require("zod/v4"));
|
|
516
517
|
var qs = __toESM(require("qs"));
|
|
517
518
|
|
|
@@ -603,7 +604,9 @@ var ActionTypes = z2.enum([
|
|
|
603
604
|
"CUSTOM"
|
|
604
605
|
]);
|
|
605
606
|
var ClientSpecificAction = {
|
|
606
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
607
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST",
|
|
608
|
+
/** Opens the user's declare or notify draft of the event in its own flow */
|
|
609
|
+
CONTINUE_DRAFT: "CONTINUE_DRAFT"
|
|
607
610
|
};
|
|
608
611
|
var declarationActionValues = [
|
|
609
612
|
ActionTypes.enum.DECLARE,
|
|
@@ -798,7 +801,7 @@ var EventStatus = z6.enum([
|
|
|
798
801
|
"ARCHIVED"
|
|
799
802
|
]);
|
|
800
803
|
|
|
801
|
-
// ../commons/src/scopes.ts
|
|
804
|
+
// ../commons/src/users/scopes.ts
|
|
802
805
|
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
803
806
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
804
807
|
);
|
|
@@ -1130,7 +1133,7 @@ function getAcceptedScopesByType({
|
|
|
1130
1133
|
}).filter((scope) => scope !== null);
|
|
1131
1134
|
}
|
|
1132
1135
|
|
|
1133
|
-
// ../commons/src/authentication.ts
|
|
1136
|
+
// ../commons/src/users/authentication.ts
|
|
1134
1137
|
var TokenUserType = z8.enum(["user", "system"]);
|
|
1135
1138
|
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
1136
1139
|
|
|
@@ -7782,17 +7785,19 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
7782
7785
|
/*
|
|
7783
7786
|
* A draft can name a file that no action references. Such a file stays until
|
|
7784
7787
|
* the record is deleted or the record's next action sweeps its prefix.
|
|
7785
|
-
*
|
|
7786
|
-
*
|
|
7787
|
-
* which is about to be declared or registered.
|
|
7788
|
+
* Drafts are therefore saved only on a created record, which can still be deleted.
|
|
7789
|
+
* The server refuses them on any other record.
|
|
7788
7790
|
*/
|
|
7789
|
-
type: z40.
|
|
7791
|
+
type: z40.enum([ActionTypes.enum.DECLARE, ActionTypes.enum.NOTIFY]),
|
|
7790
7792
|
status: z40.enum([
|
|
7791
7793
|
ActionStatus.Requested,
|
|
7792
7794
|
ActionStatus.Accepted,
|
|
7793
7795
|
ActionStatus.Rejected
|
|
7794
7796
|
])
|
|
7795
7797
|
});
|
|
7798
|
+
var RemoteDraft = Draft.extend({
|
|
7799
|
+
action: Draft.shape.action.extend({ type: DraftInput.shape.type })
|
|
7800
|
+
});
|
|
7796
7801
|
|
|
7797
7802
|
// ../commons/src/events/EventInput.ts
|
|
7798
7803
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -11772,6 +11777,7 @@ function generateEventDraftDocument({
|
|
|
11772
11777
|
transactionId: getUUID(),
|
|
11773
11778
|
action: {
|
|
11774
11779
|
...action,
|
|
11780
|
+
type: actionType,
|
|
11775
11781
|
declaration: {
|
|
11776
11782
|
...action.declaration,
|
|
11777
11783
|
...declaration
|
|
@@ -12017,6 +12023,8 @@ var ACTION_SCOPE_MAP = {
|
|
|
12017
12023
|
"record.correct"
|
|
12018
12024
|
],
|
|
12019
12025
|
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
12026
|
+
// Not granted by a scope: the client checks the draft's own action instead
|
|
12027
|
+
[ClientSpecificAction.CONTINUE_DRAFT]: [],
|
|
12020
12028
|
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
12021
12029
|
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
12022
12030
|
[ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
|
|
@@ -46,11 +46,11 @@ var import_compile = require("zod/compile");
|
|
|
46
46
|
// ../commons/src/events/AuditLog.ts
|
|
47
47
|
var z9 = __toESM(require("zod/v4"));
|
|
48
48
|
|
|
49
|
-
// ../commons/src/authentication.ts
|
|
49
|
+
// ../commons/src/users/authentication.ts
|
|
50
50
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
51
51
|
var z8 = __toESM(require("zod/v4"));
|
|
52
52
|
|
|
53
|
-
// ../commons/src/scopes.ts
|
|
53
|
+
// ../commons/src/users/scopes.ts
|
|
54
54
|
var z7 = __toESM(require("zod/v4"));
|
|
55
55
|
var qs = __toESM(require("qs"));
|
|
56
56
|
|
|
@@ -136,7 +136,9 @@ var ActionTypes = z2.enum([
|
|
|
136
136
|
"CUSTOM"
|
|
137
137
|
]);
|
|
138
138
|
var ClientSpecificAction = {
|
|
139
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
139
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST",
|
|
140
|
+
/** Opens the user's declare or notify draft of the event in its own flow */
|
|
141
|
+
CONTINUE_DRAFT: "CONTINUE_DRAFT"
|
|
140
142
|
};
|
|
141
143
|
var declarationActionValues = [
|
|
142
144
|
ActionTypes.enum.DECLARE,
|
|
@@ -328,7 +330,7 @@ var EventStatus = z6.enum([
|
|
|
328
330
|
"ARCHIVED"
|
|
329
331
|
]);
|
|
330
332
|
|
|
331
|
-
// ../commons/src/scopes.ts
|
|
333
|
+
// ../commons/src/users/scopes.ts
|
|
332
334
|
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
333
335
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
334
336
|
);
|
|
@@ -601,7 +603,7 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
601
603
|
registeredIn: JurisdictionFilter.enum.all
|
|
602
604
|
};
|
|
603
605
|
|
|
604
|
-
// ../commons/src/authentication.ts
|
|
606
|
+
// ../commons/src/users/authentication.ts
|
|
605
607
|
var TokenUserType = z8.enum(["user", "system"]);
|
|
606
608
|
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
607
609
|
|
|
@@ -5486,17 +5488,19 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
5486
5488
|
/*
|
|
5487
5489
|
* A draft can name a file that no action references. Such a file stays until
|
|
5488
5490
|
* the record is deleted or the record's next action sweeps its prefix.
|
|
5489
|
-
*
|
|
5490
|
-
*
|
|
5491
|
-
* which is about to be declared or registered.
|
|
5491
|
+
* Drafts are therefore saved only on a created record, which can still be deleted.
|
|
5492
|
+
* The server refuses them on any other record.
|
|
5492
5493
|
*/
|
|
5493
|
-
type: z40.
|
|
5494
|
+
type: z40.enum([ActionTypes.enum.DECLARE, ActionTypes.enum.NOTIFY]),
|
|
5494
5495
|
status: z40.enum([
|
|
5495
5496
|
ActionStatus.Requested,
|
|
5496
5497
|
ActionStatus.Accepted,
|
|
5497
5498
|
ActionStatus.Rejected
|
|
5498
5499
|
])
|
|
5499
5500
|
});
|
|
5501
|
+
var RemoteDraft = Draft.extend({
|
|
5502
|
+
action: Draft.shape.action.extend({ type: DraftInput.shape.type })
|
|
5503
|
+
});
|
|
5500
5504
|
|
|
5501
5505
|
// ../commons/src/events/EventInput.ts
|
|
5502
5506
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -8527,6 +8531,8 @@ var ACTION_SCOPE_MAP = {
|
|
|
8527
8531
|
"record.correct"
|
|
8528
8532
|
],
|
|
8529
8533
|
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8534
|
+
// Not granted by a scope: the client checks the draft's own action instead
|
|
8535
|
+
[ClientSpecificAction.CONTINUE_DRAFT]: [],
|
|
8530
8536
|
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8531
8537
|
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8532
8538
|
[ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/roles/index.ts"],"names":[],"mappings":"AAaA,cAAc,8BAA8B,CAAA"}
|