@opencrvs/toolkit 2.0.0-rc.77e37b6 → 2.0.0-rc.878c395
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/application-config/index.js +5 -3
- package/dist/cli.js +192 -96
- package/dist/commons/api/router.d.ts +20 -20
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/conditionals/index.js +5 -3
- package/dist/events/index.js +5 -3
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
- package/dist/migrations/v2.0/index.d.ts +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +192 -96
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
- package/dist/notification/index.js +5 -3
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +5 -3
- package/opencrvs-toolkit-2.0.0-rc.878c395.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.77e37b6.tgz +0 -0
|
@@ -772,12 +772,14 @@ var SystemScopeType = z11.enum([
|
|
|
772
772
|
"organisation.read-locations",
|
|
773
773
|
"user.read",
|
|
774
774
|
"user.create",
|
|
775
|
-
"user.edit"
|
|
775
|
+
"user.edit",
|
|
776
|
+
"user.search"
|
|
776
777
|
]);
|
|
777
778
|
var UserScopeType = SystemScopeType.extract([
|
|
778
779
|
"user.read",
|
|
779
780
|
"user.create",
|
|
780
|
-
"user.edit"
|
|
781
|
+
"user.edit",
|
|
782
|
+
"user.search"
|
|
781
783
|
]);
|
|
782
784
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
783
785
|
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
@@ -786,7 +788,7 @@ var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
|
786
788
|
options: AllUserScopeOptions.optional()
|
|
787
789
|
}),
|
|
788
790
|
z11.object({
|
|
789
|
-
type: UserScopeType.extract(["user.read"]),
|
|
791
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
790
792
|
options: AccessLevelOptions.optional()
|
|
791
793
|
})
|
|
792
794
|
]);
|
package/dist/cli.js
CHANGED
|
@@ -2296,12 +2296,14 @@ var SystemScopeType = z3.enum([
|
|
|
2296
2296
|
"organisation.read-locations",
|
|
2297
2297
|
"user.read",
|
|
2298
2298
|
"user.create",
|
|
2299
|
-
"user.edit"
|
|
2299
|
+
"user.edit",
|
|
2300
|
+
"user.search"
|
|
2300
2301
|
]);
|
|
2301
2302
|
var UserScopeType = SystemScopeType.extract([
|
|
2302
2303
|
"user.read",
|
|
2303
2304
|
"user.create",
|
|
2304
|
-
"user.edit"
|
|
2305
|
+
"user.edit",
|
|
2306
|
+
"user.search"
|
|
2305
2307
|
]);
|
|
2306
2308
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
2307
2309
|
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
@@ -2310,7 +2312,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
|
2310
2312
|
options: AllUserScopeOptions.optional()
|
|
2311
2313
|
}),
|
|
2312
2314
|
z3.object({
|
|
2313
|
-
type: UserScopeType.extract(["user.read"]),
|
|
2315
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
2314
2316
|
options: AccessLevelOptions.optional()
|
|
2315
2317
|
})
|
|
2316
2318
|
]);
|
|
@@ -3672,6 +3674,10 @@ var ACTION_PROPERTY_NAME2 = "action";
|
|
|
3672
3674
|
var CONDITIONALS_PROPERTY_NAME = "conditionals";
|
|
3673
3675
|
var TYPE_PROPERTY_NAME7 = "type";
|
|
3674
3676
|
var SLUG_PROPERTY_NAME = "slug";
|
|
3677
|
+
var READ_ACTION_TYPE = "READ";
|
|
3678
|
+
var ACTION_TYPE_IMPORT_NAME = "ActionType";
|
|
3679
|
+
var TOOLKIT_EVENTS_MODULE2 = "@opencrvs/toolkit/events";
|
|
3680
|
+
var READ_ACTION_FALLBACK_INITIALIZER = `{ type: ${ACTION_TYPE_IMPORT_NAME}.${READ_ACTION_TYPE} }`;
|
|
3675
3681
|
var SUPPORTED_WORKQUEUE_ACTION_TYPES = /* @__PURE__ */ new Set([
|
|
3676
3682
|
"READ",
|
|
3677
3683
|
"DELETE",
|
|
@@ -3719,91 +3725,137 @@ function isUnsupportedActionType(action) {
|
|
|
3719
3725
|
}
|
|
3720
3726
|
return !SUPPORTED_WORKQUEUE_ACTION_TYPES.has(typeName);
|
|
3721
3727
|
}
|
|
3722
|
-
function
|
|
3723
|
-
const
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3728
|
+
function ensureValidAction(workqueue, relPath) {
|
|
3729
|
+
const workqueueLabel = getWorkqueueLabel(workqueue);
|
|
3730
|
+
const actionProperty = workqueue.getProperty(ACTION_PROPERTY_NAME2);
|
|
3731
|
+
if (actionProperty && import_ts_morph17.Node.isPropertyAssignment(actionProperty)) {
|
|
3732
|
+
const initializer = actionProperty.getInitializer();
|
|
3733
|
+
if (initializer && import_ts_morph17.Node.isObjectLiteralExpression(initializer)) {
|
|
3734
|
+
if (!isUnsupportedActionType(initializer)) {
|
|
3735
|
+
return { changed: false, usedReadFallback: false };
|
|
3736
|
+
}
|
|
3737
|
+
actionProperty.set({
|
|
3738
|
+
name: ACTION_PROPERTY_NAME2,
|
|
3739
|
+
initializer: READ_ACTION_FALLBACK_INITIALIZER
|
|
3740
|
+
});
|
|
3741
|
+
console.log(
|
|
3742
|
+
` [${relPath}] Replaced unsupported 'action' type with '${ACTION_TYPE_IMPORT_NAME}.${READ_ACTION_TYPE}' on workqueue '${workqueueLabel}'`
|
|
3743
|
+
);
|
|
3744
|
+
return { changed: true, usedReadFallback: true };
|
|
3745
|
+
}
|
|
3730
3746
|
}
|
|
3747
|
+
workqueue.addPropertyAssignment({
|
|
3748
|
+
name: ACTION_PROPERTY_NAME2,
|
|
3749
|
+
initializer: READ_ACTION_FALLBACK_INITIALIZER
|
|
3750
|
+
});
|
|
3751
|
+
console.log(
|
|
3752
|
+
` [${relPath}] Added default 'action: ${READ_ACTION_FALLBACK_INITIALIZER}' to workqueue '${workqueueLabel}'`
|
|
3753
|
+
);
|
|
3754
|
+
return { changed: true, usedReadFallback: true };
|
|
3755
|
+
}
|
|
3756
|
+
function migrateWorkqueueActions(workqueue, relPath) {
|
|
3731
3757
|
const workqueueLabel = getWorkqueueLabel(workqueue);
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3758
|
+
const actionsProperty = workqueue.getProperty(ACTIONS_PROPERTY_NAME5);
|
|
3759
|
+
let actionsArrayMigrated = false;
|
|
3760
|
+
if (actionsProperty && import_ts_morph17.Node.isPropertyAssignment(actionsProperty)) {
|
|
3761
|
+
const actionsInitializer = actionsProperty.getInitializer();
|
|
3762
|
+
if (actionsInitializer && import_ts_morph17.Node.isArrayLiteralExpression(actionsInitializer)) {
|
|
3763
|
+
const existingActionProperty = workqueue.getProperty(ACTION_PROPERTY_NAME2);
|
|
3764
|
+
if (existingActionProperty) {
|
|
3765
|
+
if (import_ts_morph17.Node.isPropertyAssignment(existingActionProperty)) {
|
|
3766
|
+
const existingActionInitializer = existingActionProperty.getInitializer();
|
|
3767
|
+
if (existingActionInitializer && import_ts_morph17.Node.isObjectLiteralExpression(existingActionInitializer)) {
|
|
3768
|
+
const conditionalsProperty = existingActionInitializer.getProperty(
|
|
3769
|
+
CONDITIONALS_PROPERTY_NAME
|
|
3770
|
+
);
|
|
3771
|
+
if (conditionalsProperty) {
|
|
3772
|
+
conditionalsProperty.remove();
|
|
3773
|
+
console.log(
|
|
3774
|
+
` [${relPath}] Removed deprecated 'conditionals' from 'action' on workqueue '${workqueueLabel}'`
|
|
3775
|
+
);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
actionsProperty.remove();
|
|
3780
|
+
console.log(
|
|
3781
|
+
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' (existing 'action' kept)`
|
|
3782
|
+
);
|
|
3783
|
+
actionsArrayMigrated = true;
|
|
3784
|
+
} else {
|
|
3785
|
+
const actionCandidates = actionsInitializer.getElements().filter(
|
|
3786
|
+
(element) => import_ts_morph17.Node.isObjectLiteralExpression(element)
|
|
3739
3787
|
);
|
|
3740
|
-
if (
|
|
3741
|
-
|
|
3788
|
+
if (actionCandidates.length === 0) {
|
|
3789
|
+
actionsProperty.remove();
|
|
3742
3790
|
console.log(
|
|
3743
|
-
` [${relPath}] Removed
|
|
3791
|
+
` [${relPath}] Removed empty 'actions' from workqueue '${workqueueLabel}'`
|
|
3744
3792
|
);
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3793
|
+
actionsArrayMigrated = true;
|
|
3794
|
+
} else {
|
|
3795
|
+
if (actionCandidates.length > 1) {
|
|
3796
|
+
const droppedCount = actionCandidates.length - 1;
|
|
3797
|
+
console.warn(
|
|
3798
|
+
` [${relPath}] Workqueue '${workqueueLabel}' has ${actionCandidates.length} actions; keeping first as 'action' and dropping ${droppedCount} extra action(s)`
|
|
3799
|
+
);
|
|
3800
|
+
}
|
|
3801
|
+
const conditionalsProperty = actionCandidates[0].getProperty(
|
|
3802
|
+
CONDITIONALS_PROPERTY_NAME
|
|
3750
3803
|
);
|
|
3804
|
+
if (conditionalsProperty) {
|
|
3805
|
+
conditionalsProperty.remove();
|
|
3806
|
+
console.log(
|
|
3807
|
+
` [${relPath}] Removed deprecated 'conditionals' from migrated 'action' on workqueue '${workqueueLabel}'`
|
|
3808
|
+
);
|
|
3809
|
+
}
|
|
3810
|
+
if (isUnsupportedActionType(actionCandidates[0])) {
|
|
3811
|
+
actionsProperty.remove();
|
|
3812
|
+
console.log(
|
|
3813
|
+
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' because action type is unsupported`
|
|
3814
|
+
);
|
|
3815
|
+
actionsArrayMigrated = true;
|
|
3816
|
+
} else {
|
|
3817
|
+
const firstActionText = actionCandidates[0].getText();
|
|
3818
|
+
workqueue.addPropertyAssignment({
|
|
3819
|
+
name: ACTION_PROPERTY_NAME2,
|
|
3820
|
+
initializer: firstActionText
|
|
3821
|
+
});
|
|
3822
|
+
actionsProperty.remove();
|
|
3823
|
+
console.log(
|
|
3824
|
+
` [${relPath}] Replaced 'actions' with 'action' on workqueue '${workqueueLabel}'`
|
|
3825
|
+
);
|
|
3826
|
+
actionsArrayMigrated = true;
|
|
3827
|
+
}
|
|
3751
3828
|
}
|
|
3752
3829
|
}
|
|
3753
3830
|
}
|
|
3754
|
-
actionsProperty.remove();
|
|
3755
|
-
console.log(
|
|
3756
|
-
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' (existing 'action' kept)`
|
|
3757
|
-
);
|
|
3758
|
-
return 1;
|
|
3759
|
-
}
|
|
3760
|
-
const actionCandidates = actionsInitializer.getElements().filter(
|
|
3761
|
-
(element) => import_ts_morph17.Node.isObjectLiteralExpression(element)
|
|
3762
|
-
);
|
|
3763
|
-
if (actionCandidates.length === 0) {
|
|
3764
|
-
actionsProperty.remove();
|
|
3765
|
-
console.log(
|
|
3766
|
-
` [${relPath}] Removed empty 'actions' from workqueue '${workqueueLabel}'`
|
|
3767
|
-
);
|
|
3768
|
-
return 1;
|
|
3769
3831
|
}
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3832
|
+
const fallback = ensureValidAction(workqueue, relPath);
|
|
3833
|
+
return {
|
|
3834
|
+
changed: actionsArrayMigrated || fallback.changed,
|
|
3835
|
+
usedReadFallback: fallback.usedReadFallback
|
|
3836
|
+
};
|
|
3837
|
+
}
|
|
3838
|
+
function ensureActionTypeImport(sourceFile) {
|
|
3839
|
+
const existingImport = sourceFile.getImportDeclaration(
|
|
3840
|
+
(decl) => decl.getModuleSpecifierValue() === TOOLKIT_EVENTS_MODULE2
|
|
3778
3841
|
);
|
|
3779
|
-
if (
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
if (isUnsupportedActionType(actionCandidates[0])) {
|
|
3786
|
-
actionsProperty.remove();
|
|
3787
|
-
console.log(
|
|
3788
|
-
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' because action type is unsupported`
|
|
3789
|
-
);
|
|
3790
|
-
return 1;
|
|
3842
|
+
if (existingImport) {
|
|
3843
|
+
const alreadyImported = existingImport.getNamedImports().some((ni) => ni.getName() === ACTION_TYPE_IMPORT_NAME);
|
|
3844
|
+
if (!alreadyImported) {
|
|
3845
|
+
existingImport.addNamedImport(ACTION_TYPE_IMPORT_NAME);
|
|
3846
|
+
}
|
|
3847
|
+
return;
|
|
3791
3848
|
}
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
initializer: firstActionText
|
|
3849
|
+
sourceFile.addImportDeclaration({
|
|
3850
|
+
moduleSpecifier: TOOLKIT_EVENTS_MODULE2,
|
|
3851
|
+
namedImports: [ACTION_TYPE_IMPORT_NAME]
|
|
3796
3852
|
});
|
|
3797
|
-
actionsProperty.remove();
|
|
3798
|
-
console.log(
|
|
3799
|
-
` [${relPath}] Replaced 'actions' with 'action' on workqueue '${workqueueLabel}'`
|
|
3800
|
-
);
|
|
3801
|
-
return 1;
|
|
3802
3853
|
}
|
|
3803
3854
|
function processFile13(filePath, project) {
|
|
3804
3855
|
const sourceFile = project.getSourceFile(filePath);
|
|
3805
3856
|
if (!sourceFile) return 0;
|
|
3806
3857
|
let migratedWorkqueues = 0;
|
|
3858
|
+
let needsActionTypeImport = false;
|
|
3807
3859
|
const relPath = import_path18.default.relative(process.cwd(), filePath);
|
|
3808
3860
|
const callExpressions = sourceFile.getDescendantsOfKind(
|
|
3809
3861
|
import_ts_morph17.SyntaxKind.CallExpression
|
|
@@ -3819,9 +3871,14 @@ function processFile13(filePath, project) {
|
|
|
3819
3871
|
if (!import_ts_morph17.Node.isArrayLiteralExpression(workqueuesArg)) continue;
|
|
3820
3872
|
for (const element of workqueuesArg.getElements()) {
|
|
3821
3873
|
if (!import_ts_morph17.Node.isObjectLiteralExpression(element)) continue;
|
|
3822
|
-
|
|
3874
|
+
const result = migrateWorkqueueActions(element, relPath);
|
|
3875
|
+
if (result.changed) migratedWorkqueues++;
|
|
3876
|
+
if (result.usedReadFallback) needsActionTypeImport = true;
|
|
3823
3877
|
}
|
|
3824
3878
|
}
|
|
3879
|
+
if (needsActionTypeImport) {
|
|
3880
|
+
ensureActionTypeImport(sourceFile);
|
|
3881
|
+
}
|
|
3825
3882
|
return migratedWorkqueues;
|
|
3826
3883
|
}
|
|
3827
3884
|
async function main18() {
|
|
@@ -4156,7 +4213,7 @@ Saved ${handlerRelPath}.`);
|
|
|
4156
4213
|
// src/migrations/v2.0/checkout-upstream-files.ts
|
|
4157
4214
|
var import_child_process = require("child_process");
|
|
4158
4215
|
var UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
|
|
4159
|
-
var UPSTREAM_BRANCH = "
|
|
4216
|
+
var UPSTREAM_BRANCH = "release-v2.0.0";
|
|
4160
4217
|
var TEMP_REMOTE = "opencrvs-upgrade-v19-v20-codemod";
|
|
4161
4218
|
var FILES_TO_CHECKOUT = [
|
|
4162
4219
|
"src/analytics/analytics.ts",
|
|
@@ -4706,9 +4763,13 @@ function gitShowBytes(ref, path23) {
|
|
|
4706
4763
|
return null;
|
|
4707
4764
|
}
|
|
4708
4765
|
}
|
|
4709
|
-
async function main25(
|
|
4766
|
+
async function main25({
|
|
4767
|
+
subdirs = []
|
|
4768
|
+
} = {}) {
|
|
4769
|
+
const pathspecs = subdirs.length > 0 ? subdirs.map((s) => `${INFRASTRUCTURE_DIR}/${s}/`) : [`${INFRASTRUCTURE_DIR}/`];
|
|
4770
|
+
const scopeLabel = pathspecs.map((p) => `'${p}'`).join(", ");
|
|
4710
4771
|
console.log(
|
|
4711
|
-
`Merging
|
|
4772
|
+
`Merging ${scopeLabel} from ${UPSTREAM_URL}@${UPSTREAM_BRANCH} (base: ${BASE_BRANCH})...
|
|
4712
4773
|
`
|
|
4713
4774
|
);
|
|
4714
4775
|
assertIsGitRepo();
|
|
@@ -4723,20 +4784,12 @@ async function main25() {
|
|
|
4723
4784
|
const ref = `${TEMP_REMOTE2}/${UPSTREAM_BRANCH}`;
|
|
4724
4785
|
const baseRef = `${TEMP_REMOTE2}/${BASE_BRANCH}`;
|
|
4725
4786
|
const upstreamFiles = runGit(
|
|
4726
|
-
[
|
|
4727
|
-
"ls-tree",
|
|
4728
|
-
"-r",
|
|
4729
|
-
"--name-only",
|
|
4730
|
-
"-z",
|
|
4731
|
-
ref,
|
|
4732
|
-
"--",
|
|
4733
|
-
`${INFRASTRUCTURE_DIR}/`
|
|
4734
|
-
],
|
|
4787
|
+
["ls-tree", "-r", "--name-only", "-z", ref, "--", ...pathspecs],
|
|
4735
4788
|
{ silent: true }
|
|
4736
4789
|
).split("\0").filter(Boolean);
|
|
4737
4790
|
if (upstreamFiles.length === 0) {
|
|
4738
4791
|
console.log(
|
|
4739
|
-
` No files found under
|
|
4792
|
+
` No files found under ${scopeLabel} on ${ref}. Nothing to merge.`
|
|
4740
4793
|
);
|
|
4741
4794
|
return;
|
|
4742
4795
|
}
|
|
@@ -4811,7 +4864,9 @@ async function main25() {
|
|
|
4811
4864
|
var import_fs6 = require("fs");
|
|
4812
4865
|
var import_path25 = require("path");
|
|
4813
4866
|
var INFRASTRUCTURE_DIR2 = "infrastructure";
|
|
4814
|
-
async function main26(
|
|
4867
|
+
async function main26({
|
|
4868
|
+
keep = []
|
|
4869
|
+
} = {}) {
|
|
4815
4870
|
const fullPath = (0, import_path25.join)(process.cwd(), INFRASTRUCTURE_DIR2);
|
|
4816
4871
|
if (!(0, import_fs6.existsSync)(fullPath)) {
|
|
4817
4872
|
console.log(
|
|
@@ -4819,24 +4874,64 @@ async function main26() {
|
|
|
4819
4874
|
);
|
|
4820
4875
|
return;
|
|
4821
4876
|
}
|
|
4822
|
-
console.log(`Deleting '${INFRASTRUCTURE_DIR2}/'...
|
|
4823
|
-
`);
|
|
4824
4877
|
assertIsGitRepo();
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
console.log(
|
|
4878
|
+
if (keep.length === 0) {
|
|
4879
|
+
console.log(`Deleting '${INFRASTRUCTURE_DIR2}/'...
|
|
4880
|
+
`);
|
|
4881
|
+
runGit(["rm", "-rf", "--ignore-unmatch", "--", `${INFRASTRUCTURE_DIR2}/`], {
|
|
4882
|
+
silent: true
|
|
4883
|
+
});
|
|
4884
|
+
console.log(
|
|
4885
|
+
` Staged deletion of tracked files under '${INFRASTRUCTURE_DIR2}/'.`
|
|
4886
|
+
);
|
|
4887
|
+
if ((0, import_fs6.existsSync)(fullPath)) {
|
|
4888
|
+
(0, import_fs6.rmSync)(fullPath, { recursive: true, force: true });
|
|
4889
|
+
console.log(
|
|
4890
|
+
` Removed remaining untracked files under '${INFRASTRUCTURE_DIR2}/'.`
|
|
4891
|
+
);
|
|
4892
|
+
}
|
|
4893
|
+
console.log(
|
|
4894
|
+
`
|
|
4895
|
+
Done. Review the staged deletion with: git diff --cached -- '${INFRASTRUCTURE_DIR2}/'`
|
|
4896
|
+
);
|
|
4897
|
+
return;
|
|
4898
|
+
}
|
|
4899
|
+
const keepSet = new Set(keep);
|
|
4900
|
+
console.log(
|
|
4901
|
+
`Deleting contents of '${INFRASTRUCTURE_DIR2}/' except: ${[...keepSet].map((name) => `'${name}'`).join(", ")}
|
|
4902
|
+
`
|
|
4903
|
+
);
|
|
4904
|
+
const topLevelEntries = (0, import_fs6.readdirSync)(fullPath, { withFileTypes: true });
|
|
4905
|
+
let deleted = 0;
|
|
4906
|
+
for (const entry of topLevelEntries) {
|
|
4907
|
+
if (keepSet.has(entry.name)) {
|
|
4908
|
+
console.log(` Keeping '${INFRASTRUCTURE_DIR2}/${entry.name}'.`);
|
|
4909
|
+
continue;
|
|
4910
|
+
}
|
|
4911
|
+
const relPath = `${INFRASTRUCTURE_DIR2}/${entry.name}${entry.isDirectory() ? "/" : ""}`;
|
|
4912
|
+
runGit(["rm", "-rf", "--ignore-unmatch", "--", relPath], { silent: true });
|
|
4913
|
+
const fullEntryPath = (0, import_path25.join)(fullPath, entry.name);
|
|
4914
|
+
if ((0, import_fs6.existsSync)(fullEntryPath)) {
|
|
4915
|
+
(0, import_fs6.rmSync)(fullEntryPath, { recursive: true, force: true });
|
|
4916
|
+
}
|
|
4917
|
+
console.log(` Deleted '${relPath}'.`);
|
|
4918
|
+
deleted++;
|
|
4919
|
+
}
|
|
4920
|
+
const presentNames = new Set(topLevelEntries.map((e) => e.name));
|
|
4921
|
+
const missingKeeps = [...keepSet].filter((name) => !presentNames.has(name));
|
|
4922
|
+
if (missingKeeps.length > 0) {
|
|
4923
|
+
console.warn(
|
|
4924
|
+
` [warn] Requested to keep ${missingKeeps.map((n) => `'${n}'`).join(", ")} but they don't exist under '${INFRASTRUCTURE_DIR2}/'.`
|
|
4925
|
+
);
|
|
4832
4926
|
}
|
|
4833
4927
|
console.log(
|
|
4834
4928
|
`
|
|
4835
|
-
Done. Review the staged
|
|
4929
|
+
Done. Deleted ${deleted} top-level entr${deleted === 1 ? "y" : "ies"}. Review the staged deletions with: git diff --cached -- '${INFRASTRUCTURE_DIR2}/'`
|
|
4836
4930
|
);
|
|
4837
4931
|
}
|
|
4838
4932
|
|
|
4839
4933
|
// src/migrations/v2.0/index.ts
|
|
4934
|
+
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
4840
4935
|
async function runUpgrade(dockerSwarm) {
|
|
4841
4936
|
await main18();
|
|
4842
4937
|
await main();
|
|
@@ -4865,7 +4960,8 @@ async function runUpgrade(dockerSwarm) {
|
|
|
4865
4960
|
if (dockerSwarm) {
|
|
4866
4961
|
await main25();
|
|
4867
4962
|
} else {
|
|
4868
|
-
await main26();
|
|
4963
|
+
await main26({ keep: NON_SWARM_INFRA_SUBDIRS });
|
|
4964
|
+
await main25({ subdirs: NON_SWARM_INFRA_SUBDIRS });
|
|
4869
4965
|
}
|
|
4870
4966
|
}
|
|
4871
4967
|
|
|
@@ -4774,7 +4774,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4774
4774
|
'legalStatuses.DECLARED.createdAtLocation'?: {
|
|
4775
4775
|
type: "within";
|
|
4776
4776
|
location: string | {
|
|
4777
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4777
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4778
4778
|
$location?: string | undefined;
|
|
4779
4779
|
};
|
|
4780
4780
|
} | undefined;
|
|
@@ -4796,7 +4796,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4796
4796
|
'legalStatuses.REGISTERED.createdAtLocation'?: {
|
|
4797
4797
|
type: "within";
|
|
4798
4798
|
location: string | {
|
|
4799
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4799
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4800
4800
|
$location?: string | undefined;
|
|
4801
4801
|
};
|
|
4802
4802
|
} | undefined;
|
|
@@ -4811,47 +4811,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4811
4811
|
createdAtLocation?: {
|
|
4812
4812
|
type: "within";
|
|
4813
4813
|
location: string | {
|
|
4814
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4814
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4815
4815
|
$location?: string | undefined;
|
|
4816
4816
|
};
|
|
4817
4817
|
} | {
|
|
4818
4818
|
type: "exact";
|
|
4819
4819
|
term: string | {
|
|
4820
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4820
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4821
4821
|
$location?: string | undefined;
|
|
4822
4822
|
};
|
|
4823
4823
|
} | undefined;
|
|
4824
4824
|
updatedAtLocation?: {
|
|
4825
4825
|
type: "within";
|
|
4826
4826
|
location: string | {
|
|
4827
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4827
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4828
4828
|
$location?: string | undefined;
|
|
4829
4829
|
};
|
|
4830
4830
|
} | {
|
|
4831
4831
|
type: "exact";
|
|
4832
4832
|
term: string | {
|
|
4833
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4833
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4834
4834
|
$location?: string | undefined;
|
|
4835
4835
|
};
|
|
4836
4836
|
} | undefined;
|
|
4837
4837
|
updatedByUserRole?: {
|
|
4838
4838
|
type: "exact";
|
|
4839
4839
|
term: string | {
|
|
4840
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4840
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4841
4841
|
$location?: string | undefined;
|
|
4842
4842
|
};
|
|
4843
4843
|
} | undefined;
|
|
4844
4844
|
assignedTo?: {
|
|
4845
4845
|
type: "exact";
|
|
4846
4846
|
term: string | {
|
|
4847
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4847
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4848
4848
|
$location?: string | undefined;
|
|
4849
4849
|
};
|
|
4850
4850
|
} | undefined;
|
|
4851
4851
|
createdBy?: {
|
|
4852
4852
|
type: "exact";
|
|
4853
4853
|
term: string | {
|
|
4854
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4854
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4855
4855
|
$location?: string | undefined;
|
|
4856
4856
|
};
|
|
4857
4857
|
} | undefined;
|
|
@@ -4862,7 +4862,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4862
4862
|
updatedBy?: {
|
|
4863
4863
|
type: "exact";
|
|
4864
4864
|
term: string | {
|
|
4865
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4865
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4866
4866
|
$location?: string | undefined;
|
|
4867
4867
|
};
|
|
4868
4868
|
} | undefined;
|
|
@@ -4912,7 +4912,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4912
4912
|
'legalStatuses.DECLARED.createdAtLocation'?: {
|
|
4913
4913
|
type: "within";
|
|
4914
4914
|
location: string | {
|
|
4915
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4915
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4916
4916
|
$location?: string | undefined;
|
|
4917
4917
|
};
|
|
4918
4918
|
} | undefined;
|
|
@@ -4934,7 +4934,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4934
4934
|
'legalStatuses.REGISTERED.createdAtLocation'?: {
|
|
4935
4935
|
type: "within";
|
|
4936
4936
|
location: string | {
|
|
4937
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4937
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4938
4938
|
$location?: string | undefined;
|
|
4939
4939
|
};
|
|
4940
4940
|
} | undefined;
|
|
@@ -4949,47 +4949,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4949
4949
|
createdAtLocation?: {
|
|
4950
4950
|
type: "within";
|
|
4951
4951
|
location: string | {
|
|
4952
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4952
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4953
4953
|
$location?: string | undefined;
|
|
4954
4954
|
};
|
|
4955
4955
|
} | {
|
|
4956
4956
|
type: "exact";
|
|
4957
4957
|
term: string | {
|
|
4958
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4958
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4959
4959
|
$location?: string | undefined;
|
|
4960
4960
|
};
|
|
4961
4961
|
} | undefined;
|
|
4962
4962
|
updatedAtLocation?: {
|
|
4963
4963
|
type: "within";
|
|
4964
4964
|
location: string | {
|
|
4965
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4965
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4966
4966
|
$location?: string | undefined;
|
|
4967
4967
|
};
|
|
4968
4968
|
} | {
|
|
4969
4969
|
type: "exact";
|
|
4970
4970
|
term: string | {
|
|
4971
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4971
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4972
4972
|
$location?: string | undefined;
|
|
4973
4973
|
};
|
|
4974
4974
|
} | undefined;
|
|
4975
4975
|
updatedByUserRole?: {
|
|
4976
4976
|
type: "exact";
|
|
4977
4977
|
term: string | {
|
|
4978
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4978
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4979
4979
|
$location?: string | undefined;
|
|
4980
4980
|
};
|
|
4981
4981
|
} | undefined;
|
|
4982
4982
|
assignedTo?: {
|
|
4983
4983
|
type: "exact";
|
|
4984
4984
|
term: string | {
|
|
4985
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4985
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4986
4986
|
$location?: string | undefined;
|
|
4987
4987
|
};
|
|
4988
4988
|
} | undefined;
|
|
4989
4989
|
createdBy?: {
|
|
4990
4990
|
type: "exact";
|
|
4991
4991
|
term: string | {
|
|
4992
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4992
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4993
4993
|
$location?: string | undefined;
|
|
4994
4994
|
};
|
|
4995
4995
|
} | undefined;
|
|
@@ -5000,7 +5000,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5000
5000
|
updatedBy?: {
|
|
5001
5001
|
type: "exact";
|
|
5002
5002
|
term: string | {
|
|
5003
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
5003
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
5004
5004
|
$location?: string | undefined;
|
|
5005
5005
|
};
|
|
5006
5006
|
} | undefined;
|
|
@@ -86,16 +86,16 @@ export declare const user: typeof userSerializer & {
|
|
|
86
86
|
};
|
|
87
87
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
88
88
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
89
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
89
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
90
90
|
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
94
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
94
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
95
95
|
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
96
96
|
}) => {
|
|
97
97
|
$jurisdiction: "administrativeArea" | "location" | "all" | {
|
|
98
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
98
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
99
99
|
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
100
100
|
};
|
|
101
101
|
};
|