@opencrvs/toolkit 2.0.0-rc.c661677 → 2.0.0-rc.c7f111d
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 +15 -20
- package/dist/cli.js +187 -93
- package/dist/commons/api/router.d.ts +15 -27
- package/dist/commons/events/ActionInput.d.ts +36 -0
- package/dist/commons/events/Draft.d.ts +1 -0
- package/dist/commons/events/EventIndex.d.ts +1 -0
- package/dist/commons/events/EventMetadata.d.ts +1 -0
- package/dist/commons/events/state/index.d.ts +2 -1
- package/dist/events/index.js +16 -20
- 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 +187 -93
- 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 +16 -20
- package/opencrvs-toolkit-2.0.0-rc.c7f111d.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.c661677.tgz +0 -0
|
@@ -418,28 +418,20 @@ function schemaPriority(schema) {
|
|
|
418
418
|
return idx === -1 ? 9999 : idx;
|
|
419
419
|
}
|
|
420
420
|
function safeUnion(schemas) {
|
|
421
|
+
const sortedSchemas = [...schemas].sort(
|
|
422
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
423
|
+
);
|
|
421
424
|
return z7.any().superRefine((val, ctx) => {
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (successful.length === 0) {
|
|
427
|
-
ctx.addIssue({
|
|
428
|
-
code: "invalid_type",
|
|
429
|
-
expected: "custom",
|
|
430
|
-
message: "Value does not match any schema"
|
|
431
|
-
});
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
435
|
-
const best = successful[0];
|
|
436
|
-
if (!best.safeParse(val).success) {
|
|
437
|
-
ctx.addIssue({
|
|
438
|
-
expected: "custom",
|
|
439
|
-
code: "invalid_type",
|
|
440
|
-
message: "Value did not match the best schema"
|
|
441
|
-
});
|
|
425
|
+
for (const schema of sortedSchemas) {
|
|
426
|
+
if (schema.safeParse(val).success) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
442
429
|
}
|
|
430
|
+
ctx.addIssue({
|
|
431
|
+
code: "invalid_type",
|
|
432
|
+
expected: "custom",
|
|
433
|
+
message: "Value does not match any schema"
|
|
434
|
+
});
|
|
443
435
|
}).meta({
|
|
444
436
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
445
437
|
});
|
|
@@ -1152,6 +1144,9 @@ var EventMetadata = z15.object({
|
|
|
1152
1144
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1153
1145
|
),
|
|
1154
1146
|
assignedTo: z15.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1147
|
+
assignedToSignature: DocumentPath.nullish().describe(
|
|
1148
|
+
"Signature of the user who is currently assigned to the event."
|
|
1149
|
+
),
|
|
1155
1150
|
updatedBy: z15.string().nullish().describe("ID of the user who last changed the status."),
|
|
1156
1151
|
trackingId: z15.string().describe(
|
|
1157
1152
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
package/dist/cli.js
CHANGED
|
@@ -3674,6 +3674,10 @@ var ACTION_PROPERTY_NAME2 = "action";
|
|
|
3674
3674
|
var CONDITIONALS_PROPERTY_NAME = "conditionals";
|
|
3675
3675
|
var TYPE_PROPERTY_NAME7 = "type";
|
|
3676
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} }`;
|
|
3677
3681
|
var SUPPORTED_WORKQUEUE_ACTION_TYPES = /* @__PURE__ */ new Set([
|
|
3678
3682
|
"READ",
|
|
3679
3683
|
"DELETE",
|
|
@@ -3721,91 +3725,137 @@ function isUnsupportedActionType(action) {
|
|
|
3721
3725
|
}
|
|
3722
3726
|
return !SUPPORTED_WORKQUEUE_ACTION_TYPES.has(typeName);
|
|
3723
3727
|
}
|
|
3724
|
-
function
|
|
3725
|
-
const
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
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
|
+
}
|
|
3732
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) {
|
|
3733
3757
|
const workqueueLabel = getWorkqueueLabel(workqueue);
|
|
3734
|
-
const
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
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)
|
|
3741
3787
|
);
|
|
3742
|
-
if (
|
|
3743
|
-
|
|
3788
|
+
if (actionCandidates.length === 0) {
|
|
3789
|
+
actionsProperty.remove();
|
|
3744
3790
|
console.log(
|
|
3745
|
-
` [${relPath}] Removed
|
|
3791
|
+
` [${relPath}] Removed empty 'actions' from workqueue '${workqueueLabel}'`
|
|
3746
3792
|
);
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
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
|
|
3752
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
|
+
}
|
|
3753
3828
|
}
|
|
3754
3829
|
}
|
|
3755
3830
|
}
|
|
3756
|
-
actionsProperty.remove();
|
|
3757
|
-
console.log(
|
|
3758
|
-
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' (existing 'action' kept)`
|
|
3759
|
-
);
|
|
3760
|
-
return 1;
|
|
3761
|
-
}
|
|
3762
|
-
const actionCandidates = actionsInitializer.getElements().filter(
|
|
3763
|
-
(element) => import_ts_morph17.Node.isObjectLiteralExpression(element)
|
|
3764
|
-
);
|
|
3765
|
-
if (actionCandidates.length === 0) {
|
|
3766
|
-
actionsProperty.remove();
|
|
3767
|
-
console.log(
|
|
3768
|
-
` [${relPath}] Removed empty 'actions' from workqueue '${workqueueLabel}'`
|
|
3769
|
-
);
|
|
3770
|
-
return 1;
|
|
3771
3831
|
}
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
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
|
|
3780
3841
|
);
|
|
3781
|
-
if (
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
if (isUnsupportedActionType(actionCandidates[0])) {
|
|
3788
|
-
actionsProperty.remove();
|
|
3789
|
-
console.log(
|
|
3790
|
-
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' because action type is unsupported`
|
|
3791
|
-
);
|
|
3792
|
-
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;
|
|
3793
3848
|
}
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
initializer: firstActionText
|
|
3849
|
+
sourceFile.addImportDeclaration({
|
|
3850
|
+
moduleSpecifier: TOOLKIT_EVENTS_MODULE2,
|
|
3851
|
+
namedImports: [ACTION_TYPE_IMPORT_NAME]
|
|
3798
3852
|
});
|
|
3799
|
-
actionsProperty.remove();
|
|
3800
|
-
console.log(
|
|
3801
|
-
` [${relPath}] Replaced 'actions' with 'action' on workqueue '${workqueueLabel}'`
|
|
3802
|
-
);
|
|
3803
|
-
return 1;
|
|
3804
3853
|
}
|
|
3805
3854
|
function processFile13(filePath, project) {
|
|
3806
3855
|
const sourceFile = project.getSourceFile(filePath);
|
|
3807
3856
|
if (!sourceFile) return 0;
|
|
3808
3857
|
let migratedWorkqueues = 0;
|
|
3858
|
+
let needsActionTypeImport = false;
|
|
3809
3859
|
const relPath = import_path18.default.relative(process.cwd(), filePath);
|
|
3810
3860
|
const callExpressions = sourceFile.getDescendantsOfKind(
|
|
3811
3861
|
import_ts_morph17.SyntaxKind.CallExpression
|
|
@@ -3821,9 +3871,14 @@ function processFile13(filePath, project) {
|
|
|
3821
3871
|
if (!import_ts_morph17.Node.isArrayLiteralExpression(workqueuesArg)) continue;
|
|
3822
3872
|
for (const element of workqueuesArg.getElements()) {
|
|
3823
3873
|
if (!import_ts_morph17.Node.isObjectLiteralExpression(element)) continue;
|
|
3824
|
-
|
|
3874
|
+
const result = migrateWorkqueueActions(element, relPath);
|
|
3875
|
+
if (result.changed) migratedWorkqueues++;
|
|
3876
|
+
if (result.usedReadFallback) needsActionTypeImport = true;
|
|
3825
3877
|
}
|
|
3826
3878
|
}
|
|
3879
|
+
if (needsActionTypeImport) {
|
|
3880
|
+
ensureActionTypeImport(sourceFile);
|
|
3881
|
+
}
|
|
3827
3882
|
return migratedWorkqueues;
|
|
3828
3883
|
}
|
|
3829
3884
|
async function main18() {
|
|
@@ -4158,7 +4213,7 @@ Saved ${handlerRelPath}.`);
|
|
|
4158
4213
|
// src/migrations/v2.0/checkout-upstream-files.ts
|
|
4159
4214
|
var import_child_process = require("child_process");
|
|
4160
4215
|
var UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
|
|
4161
|
-
var UPSTREAM_BRANCH = "
|
|
4216
|
+
var UPSTREAM_BRANCH = "release-v2.0.0";
|
|
4162
4217
|
var TEMP_REMOTE = "opencrvs-upgrade-v19-v20-codemod";
|
|
4163
4218
|
var FILES_TO_CHECKOUT = [
|
|
4164
4219
|
"src/analytics/analytics.ts",
|
|
@@ -4708,9 +4763,13 @@ function gitShowBytes(ref, path23) {
|
|
|
4708
4763
|
return null;
|
|
4709
4764
|
}
|
|
4710
4765
|
}
|
|
4711
|
-
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(", ");
|
|
4712
4771
|
console.log(
|
|
4713
|
-
`Merging
|
|
4772
|
+
`Merging ${scopeLabel} from ${UPSTREAM_URL}@${UPSTREAM_BRANCH} (base: ${BASE_BRANCH})...
|
|
4714
4773
|
`
|
|
4715
4774
|
);
|
|
4716
4775
|
assertIsGitRepo();
|
|
@@ -4725,20 +4784,12 @@ async function main25() {
|
|
|
4725
4784
|
const ref = `${TEMP_REMOTE2}/${UPSTREAM_BRANCH}`;
|
|
4726
4785
|
const baseRef = `${TEMP_REMOTE2}/${BASE_BRANCH}`;
|
|
4727
4786
|
const upstreamFiles = runGit(
|
|
4728
|
-
[
|
|
4729
|
-
"ls-tree",
|
|
4730
|
-
"-r",
|
|
4731
|
-
"--name-only",
|
|
4732
|
-
"-z",
|
|
4733
|
-
ref,
|
|
4734
|
-
"--",
|
|
4735
|
-
`${INFRASTRUCTURE_DIR}/`
|
|
4736
|
-
],
|
|
4787
|
+
["ls-tree", "-r", "--name-only", "-z", ref, "--", ...pathspecs],
|
|
4737
4788
|
{ silent: true }
|
|
4738
4789
|
).split("\0").filter(Boolean);
|
|
4739
4790
|
if (upstreamFiles.length === 0) {
|
|
4740
4791
|
console.log(
|
|
4741
|
-
` No files found under
|
|
4792
|
+
` No files found under ${scopeLabel} on ${ref}. Nothing to merge.`
|
|
4742
4793
|
);
|
|
4743
4794
|
return;
|
|
4744
4795
|
}
|
|
@@ -4813,7 +4864,9 @@ async function main25() {
|
|
|
4813
4864
|
var import_fs6 = require("fs");
|
|
4814
4865
|
var import_path25 = require("path");
|
|
4815
4866
|
var INFRASTRUCTURE_DIR2 = "infrastructure";
|
|
4816
|
-
async function main26(
|
|
4867
|
+
async function main26({
|
|
4868
|
+
keep = []
|
|
4869
|
+
} = {}) {
|
|
4817
4870
|
const fullPath = (0, import_path25.join)(process.cwd(), INFRASTRUCTURE_DIR2);
|
|
4818
4871
|
if (!(0, import_fs6.existsSync)(fullPath)) {
|
|
4819
4872
|
console.log(
|
|
@@ -4821,24 +4874,64 @@ async function main26() {
|
|
|
4821
4874
|
);
|
|
4822
4875
|
return;
|
|
4823
4876
|
}
|
|
4824
|
-
console.log(`Deleting '${INFRASTRUCTURE_DIR2}/'...
|
|
4825
|
-
`);
|
|
4826
4877
|
assertIsGitRepo();
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
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
|
+
);
|
|
4834
4926
|
}
|
|
4835
4927
|
console.log(
|
|
4836
4928
|
`
|
|
4837
|
-
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}/'`
|
|
4838
4930
|
);
|
|
4839
4931
|
}
|
|
4840
4932
|
|
|
4841
4933
|
// src/migrations/v2.0/index.ts
|
|
4934
|
+
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
4842
4935
|
async function runUpgrade(dockerSwarm) {
|
|
4843
4936
|
await main18();
|
|
4844
4937
|
await main();
|
|
@@ -4867,7 +4960,8 @@ async function runUpgrade(dockerSwarm) {
|
|
|
4867
4960
|
if (dockerSwarm) {
|
|
4868
4961
|
await main25();
|
|
4869
4962
|
} else {
|
|
4870
|
-
await main26();
|
|
4963
|
+
await main26({ keep: NON_SWARM_INFRA_SUBDIRS });
|
|
4964
|
+
await main25({ subdirs: NON_SWARM_INFRA_SUBDIRS });
|
|
4871
4965
|
}
|
|
4872
4966
|
}
|
|
4873
4967
|
|
|
@@ -1105,6 +1105,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1105
1105
|
annotation?: Record<string, unknown> | undefined;
|
|
1106
1106
|
originalActionId?: string | undefined;
|
|
1107
1107
|
keepAssignment?: boolean | undefined;
|
|
1108
|
+
waitFor?: boolean | undefined;
|
|
1108
1109
|
createdAtLocation?: string | null | undefined;
|
|
1109
1110
|
};
|
|
1110
1111
|
output: {
|
|
@@ -1225,6 +1226,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1225
1226
|
annotation?: Record<string, unknown> | undefined;
|
|
1226
1227
|
originalActionId?: string | undefined;
|
|
1227
1228
|
keepAssignment?: boolean | undefined;
|
|
1229
|
+
waitFor?: boolean | undefined;
|
|
1228
1230
|
createdAtLocation?: string | null | undefined;
|
|
1229
1231
|
type?: "DECLARE" | undefined;
|
|
1230
1232
|
};
|
|
@@ -1799,6 +1801,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1799
1801
|
annotation?: Record<string, unknown> | undefined;
|
|
1800
1802
|
originalActionId?: string | undefined;
|
|
1801
1803
|
keepAssignment?: boolean | undefined;
|
|
1804
|
+
waitFor?: boolean | undefined;
|
|
1802
1805
|
createdAtLocation?: string | null | undefined;
|
|
1803
1806
|
type?: "CUSTOM" | undefined;
|
|
1804
1807
|
};
|
|
@@ -2154,6 +2157,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2154
2157
|
annotation?: Record<string, unknown> | undefined;
|
|
2155
2158
|
originalActionId?: string | undefined;
|
|
2156
2159
|
keepAssignment?: boolean | undefined;
|
|
2160
|
+
waitFor?: boolean | undefined;
|
|
2157
2161
|
createdAtLocation?: string | null | undefined;
|
|
2158
2162
|
};
|
|
2159
2163
|
output: {
|
|
@@ -2467,6 +2471,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2467
2471
|
annotation?: Record<string, unknown> | undefined;
|
|
2468
2472
|
originalActionId?: string | undefined;
|
|
2469
2473
|
keepAssignment?: boolean | undefined;
|
|
2474
|
+
waitFor?: boolean | undefined;
|
|
2470
2475
|
createdAtLocation?: string | null | undefined;
|
|
2471
2476
|
type?: "UNASSIGN" | undefined;
|
|
2472
2477
|
assignedTo?: null | undefined;
|
|
@@ -2960,6 +2965,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2960
2965
|
annotation?: Record<string, unknown> | undefined;
|
|
2961
2966
|
originalActionId?: string | undefined;
|
|
2962
2967
|
keepAssignment?: boolean | undefined;
|
|
2968
|
+
waitFor?: boolean | undefined;
|
|
2963
2969
|
createdAtLocation?: string | null | undefined;
|
|
2964
2970
|
type?: "MARK_AS_DUPLICATE" | undefined;
|
|
2965
2971
|
content?: {
|
|
@@ -3277,6 +3283,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3277
3283
|
annotation?: Record<string, unknown> | undefined;
|
|
3278
3284
|
originalActionId?: string | undefined;
|
|
3279
3285
|
keepAssignment?: boolean | undefined;
|
|
3286
|
+
waitFor?: boolean | undefined;
|
|
3280
3287
|
createdAtLocation?: string | null | undefined;
|
|
3281
3288
|
type?: "MARK_AS_NOT_DUPLICATE" | undefined;
|
|
3282
3289
|
};
|
|
@@ -3636,6 +3643,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3636
3643
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
3637
3644
|
updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
3638
3645
|
assignedTo?: string | null | undefined;
|
|
3646
|
+
assignedToSignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
3639
3647
|
updatedBy?: string | null | undefined;
|
|
3640
3648
|
}[];
|
|
3641
3649
|
total: number;
|
|
@@ -4092,33 +4100,22 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4092
4100
|
input: string[];
|
|
4093
4101
|
output: ({
|
|
4094
4102
|
id: string & import("zod").$brand<"UUID">;
|
|
4103
|
+
type: "user";
|
|
4095
4104
|
name: {
|
|
4096
4105
|
firstname: string;
|
|
4097
4106
|
surname: string;
|
|
4098
4107
|
};
|
|
4099
4108
|
role: string;
|
|
4100
4109
|
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
4101
|
-
|
|
4102
|
-
status: "active" | "pending" | "deactivated";
|
|
4110
|
+
fullHonorificName?: string | undefined;
|
|
4103
4111
|
avatar?: (string & import("zod").$brand<"DocumentPath">) | undefined;
|
|
4104
|
-
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
4105
4112
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4106
|
-
device?: string | undefined;
|
|
4107
|
-
fullHonorificName?: string | undefined;
|
|
4108
|
-
mobile?: string | undefined;
|
|
4109
|
-
email?: string | undefined;
|
|
4110
|
-
data?: Record<string, import("../commons").FieldValue> | undefined;
|
|
4111
4113
|
} | {
|
|
4112
4114
|
id: string & import("zod").$brand<"UUID">;
|
|
4113
|
-
name: string;
|
|
4114
4115
|
type: "system";
|
|
4116
|
+
name: string;
|
|
4115
4117
|
primaryOfficeId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
4116
4118
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
4117
|
-
signature?: undefined;
|
|
4118
|
-
avatar?: undefined;
|
|
4119
|
-
fullHonorificName?: string | undefined;
|
|
4120
|
-
legacyId?: string | undefined;
|
|
4121
|
-
status?: undefined;
|
|
4122
4119
|
})[];
|
|
4123
4120
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4124
4121
|
}>;
|
|
@@ -4136,33 +4133,24 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4136
4133
|
};
|
|
4137
4134
|
output: ({
|
|
4138
4135
|
id: string & import("zod").$brand<"UUID">;
|
|
4136
|
+
type: "user";
|
|
4139
4137
|
name: {
|
|
4140
4138
|
firstname: string;
|
|
4141
4139
|
surname: string;
|
|
4142
4140
|
};
|
|
4143
4141
|
role: string;
|
|
4144
4142
|
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
4145
|
-
type: "user";
|
|
4146
4143
|
status: "active" | "pending" | "deactivated";
|
|
4144
|
+
fullHonorificName?: string | undefined;
|
|
4147
4145
|
avatar?: (string & import("zod").$brand<"DocumentPath">) | undefined;
|
|
4148
|
-
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
4149
4146
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4150
|
-
device?: string | undefined;
|
|
4151
|
-
fullHonorificName?: string | undefined;
|
|
4152
|
-
mobile?: string | undefined;
|
|
4153
|
-
email?: string | undefined;
|
|
4154
|
-
data?: Record<string, import("../commons").FieldValue> | undefined;
|
|
4155
4147
|
} | {
|
|
4156
4148
|
id: string & import("zod").$brand<"UUID">;
|
|
4157
|
-
name: string;
|
|
4158
4149
|
type: "system";
|
|
4150
|
+
name: string;
|
|
4159
4151
|
primaryOfficeId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
4160
4152
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
4161
|
-
|
|
4162
|
-
avatar?: undefined;
|
|
4163
|
-
fullHonorificName?: string | undefined;
|
|
4164
|
-
legacyId?: string | undefined;
|
|
4165
|
-
status?: undefined;
|
|
4153
|
+
status?: "active" | "pending" | "deactivated" | undefined;
|
|
4166
4154
|
})[];
|
|
4167
4155
|
meta: object;
|
|
4168
4156
|
}>;
|