@opencrvs/toolkit 2.0.0-rc.a657c77 → 2.0.0-rc.a7c070e
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 +12 -20
- package/dist/cli.js +93 -187
- package/dist/commons/api/router.d.ts +7 -0
- package/dist/commons/events/ActionInput.d.ts +36 -0
- package/dist/commons/events/Draft.d.ts +1 -0
- package/dist/events/index.js +13 -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 +2 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +1 -9
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +20 -66
- package/dist/migrations/v2.0/index.d.ts +3 -5
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +93 -187
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +1 -11
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +16 -17
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +59 -140
- package/dist/notification/index.js +13 -20
- package/opencrvs-toolkit-2.0.0-rc.a7c070e.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.a657c77.tgz +0 -0
|
@@ -3686,10 +3686,6 @@ var ACTION_PROPERTY_NAME2 = "action";
|
|
|
3686
3686
|
var CONDITIONALS_PROPERTY_NAME = "conditionals";
|
|
3687
3687
|
var TYPE_PROPERTY_NAME7 = "type";
|
|
3688
3688
|
var SLUG_PROPERTY_NAME = "slug";
|
|
3689
|
-
var READ_ACTION_TYPE = "READ";
|
|
3690
|
-
var ACTION_TYPE_IMPORT_NAME = "ActionType";
|
|
3691
|
-
var TOOLKIT_EVENTS_MODULE2 = "@opencrvs/toolkit/events";
|
|
3692
|
-
var READ_ACTION_FALLBACK_INITIALIZER = `{ type: ${ACTION_TYPE_IMPORT_NAME}.${READ_ACTION_TYPE} }`;
|
|
3693
3689
|
var SUPPORTED_WORKQUEUE_ACTION_TYPES = /* @__PURE__ */ new Set([
|
|
3694
3690
|
"READ",
|
|
3695
3691
|
"DELETE",
|
|
@@ -3737,137 +3733,91 @@ function isUnsupportedActionType(action) {
|
|
|
3737
3733
|
}
|
|
3738
3734
|
return !SUPPORTED_WORKQUEUE_ACTION_TYPES.has(typeName);
|
|
3739
3735
|
}
|
|
3740
|
-
function ensureValidAction(workqueue, relPath) {
|
|
3741
|
-
const workqueueLabel = getWorkqueueLabel(workqueue);
|
|
3742
|
-
const actionProperty = workqueue.getProperty(ACTION_PROPERTY_NAME2);
|
|
3743
|
-
if (actionProperty && import_ts_morph17.Node.isPropertyAssignment(actionProperty)) {
|
|
3744
|
-
const initializer = actionProperty.getInitializer();
|
|
3745
|
-
if (initializer && import_ts_morph17.Node.isObjectLiteralExpression(initializer)) {
|
|
3746
|
-
if (!isUnsupportedActionType(initializer)) {
|
|
3747
|
-
return { changed: false, usedReadFallback: false };
|
|
3748
|
-
}
|
|
3749
|
-
actionProperty.set({
|
|
3750
|
-
name: ACTION_PROPERTY_NAME2,
|
|
3751
|
-
initializer: READ_ACTION_FALLBACK_INITIALIZER
|
|
3752
|
-
});
|
|
3753
|
-
console.log(
|
|
3754
|
-
` [${relPath}] Replaced unsupported 'action' type with '${ACTION_TYPE_IMPORT_NAME}.${READ_ACTION_TYPE}' on workqueue '${workqueueLabel}'`
|
|
3755
|
-
);
|
|
3756
|
-
return { changed: true, usedReadFallback: true };
|
|
3757
|
-
}
|
|
3758
|
-
}
|
|
3759
|
-
workqueue.addPropertyAssignment({
|
|
3760
|
-
name: ACTION_PROPERTY_NAME2,
|
|
3761
|
-
initializer: READ_ACTION_FALLBACK_INITIALIZER
|
|
3762
|
-
});
|
|
3763
|
-
console.log(
|
|
3764
|
-
` [${relPath}] Added default 'action: ${READ_ACTION_FALLBACK_INITIALIZER}' to workqueue '${workqueueLabel}'`
|
|
3765
|
-
);
|
|
3766
|
-
return { changed: true, usedReadFallback: true };
|
|
3767
|
-
}
|
|
3768
3736
|
function migrateWorkqueueActions(workqueue, relPath) {
|
|
3769
|
-
const workqueueLabel = getWorkqueueLabel(workqueue);
|
|
3770
3737
|
const actionsProperty = workqueue.getProperty(ACTIONS_PROPERTY_NAME5);
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
` [${relPath}] Removed deprecated 'conditionals' from 'action' on workqueue '${workqueueLabel}'`
|
|
3787
|
-
);
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
|
-
}
|
|
3791
|
-
actionsProperty.remove();
|
|
3792
|
-
console.log(
|
|
3793
|
-
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' (existing 'action' kept)`
|
|
3794
|
-
);
|
|
3795
|
-
actionsArrayMigrated = true;
|
|
3796
|
-
} else {
|
|
3797
|
-
const actionCandidates = actionsInitializer.getElements().filter(
|
|
3798
|
-
(element) => import_ts_morph17.Node.isObjectLiteralExpression(element)
|
|
3738
|
+
if (!actionsProperty || !import_ts_morph17.Node.isPropertyAssignment(actionsProperty)) {
|
|
3739
|
+
return 0;
|
|
3740
|
+
}
|
|
3741
|
+
const actionsInitializer = actionsProperty.getInitializer();
|
|
3742
|
+
if (!actionsInitializer || !import_ts_morph17.Node.isArrayLiteralExpression(actionsInitializer)) {
|
|
3743
|
+
return 0;
|
|
3744
|
+
}
|
|
3745
|
+
const workqueueLabel = getWorkqueueLabel(workqueue);
|
|
3746
|
+
const existingActionProperty = workqueue.getProperty(ACTION_PROPERTY_NAME2);
|
|
3747
|
+
if (existingActionProperty) {
|
|
3748
|
+
if (import_ts_morph17.Node.isPropertyAssignment(existingActionProperty)) {
|
|
3749
|
+
const existingActionInitializer = existingActionProperty.getInitializer();
|
|
3750
|
+
if (existingActionInitializer && import_ts_morph17.Node.isObjectLiteralExpression(existingActionInitializer)) {
|
|
3751
|
+
const conditionalsProperty2 = existingActionInitializer.getProperty(
|
|
3752
|
+
CONDITIONALS_PROPERTY_NAME
|
|
3799
3753
|
);
|
|
3800
|
-
if (
|
|
3801
|
-
|
|
3754
|
+
if (conditionalsProperty2) {
|
|
3755
|
+
conditionalsProperty2.remove();
|
|
3802
3756
|
console.log(
|
|
3803
|
-
` [${relPath}] Removed
|
|
3757
|
+
` [${relPath}] Removed deprecated 'conditionals' from 'action' on workqueue '${workqueueLabel}'`
|
|
3804
3758
|
);
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
` [${relPath}] Workqueue '${workqueueLabel}' has ${actionCandidates.length} actions; keeping first as 'action' and dropping ${droppedCount} extra action(s)`
|
|
3811
|
-
);
|
|
3812
|
-
}
|
|
3813
|
-
const conditionalsProperty = actionCandidates[0].getProperty(
|
|
3814
|
-
CONDITIONALS_PROPERTY_NAME
|
|
3759
|
+
}
|
|
3760
|
+
if (isUnsupportedActionType(existingActionInitializer)) {
|
|
3761
|
+
existingActionProperty.remove();
|
|
3762
|
+
console.log(
|
|
3763
|
+
` [${relPath}] Removed unsupported 'action' type on workqueue '${workqueueLabel}'`
|
|
3815
3764
|
);
|
|
3816
|
-
if (conditionalsProperty) {
|
|
3817
|
-
conditionalsProperty.remove();
|
|
3818
|
-
console.log(
|
|
3819
|
-
` [${relPath}] Removed deprecated 'conditionals' from migrated 'action' on workqueue '${workqueueLabel}'`
|
|
3820
|
-
);
|
|
3821
|
-
}
|
|
3822
|
-
if (isUnsupportedActionType(actionCandidates[0])) {
|
|
3823
|
-
actionsProperty.remove();
|
|
3824
|
-
console.log(
|
|
3825
|
-
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' because action type is unsupported`
|
|
3826
|
-
);
|
|
3827
|
-
actionsArrayMigrated = true;
|
|
3828
|
-
} else {
|
|
3829
|
-
const firstActionText = actionCandidates[0].getText();
|
|
3830
|
-
workqueue.addPropertyAssignment({
|
|
3831
|
-
name: ACTION_PROPERTY_NAME2,
|
|
3832
|
-
initializer: firstActionText
|
|
3833
|
-
});
|
|
3834
|
-
actionsProperty.remove();
|
|
3835
|
-
console.log(
|
|
3836
|
-
` [${relPath}] Replaced 'actions' with 'action' on workqueue '${workqueueLabel}'`
|
|
3837
|
-
);
|
|
3838
|
-
actionsArrayMigrated = true;
|
|
3839
|
-
}
|
|
3840
3765
|
}
|
|
3841
3766
|
}
|
|
3842
3767
|
}
|
|
3768
|
+
actionsProperty.remove();
|
|
3769
|
+
console.log(
|
|
3770
|
+
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' (existing 'action' kept)`
|
|
3771
|
+
);
|
|
3772
|
+
return 1;
|
|
3843
3773
|
}
|
|
3844
|
-
const
|
|
3845
|
-
|
|
3846
|
-
changed: actionsArrayMigrated || fallback.changed,
|
|
3847
|
-
usedReadFallback: fallback.usedReadFallback
|
|
3848
|
-
};
|
|
3849
|
-
}
|
|
3850
|
-
function ensureActionTypeImport(sourceFile) {
|
|
3851
|
-
const existingImport = sourceFile.getImportDeclaration(
|
|
3852
|
-
(decl) => decl.getModuleSpecifierValue() === TOOLKIT_EVENTS_MODULE2
|
|
3774
|
+
const actionCandidates = actionsInitializer.getElements().filter(
|
|
3775
|
+
(element) => import_ts_morph17.Node.isObjectLiteralExpression(element)
|
|
3853
3776
|
);
|
|
3854
|
-
if (
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
return;
|
|
3777
|
+
if (actionCandidates.length === 0) {
|
|
3778
|
+
actionsProperty.remove();
|
|
3779
|
+
console.log(
|
|
3780
|
+
` [${relPath}] Removed empty 'actions' from workqueue '${workqueueLabel}'`
|
|
3781
|
+
);
|
|
3782
|
+
return 1;
|
|
3860
3783
|
}
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3784
|
+
if (actionCandidates.length > 1) {
|
|
3785
|
+
const droppedCount = actionCandidates.length - 1;
|
|
3786
|
+
console.warn(
|
|
3787
|
+
` [${relPath}] Workqueue '${workqueueLabel}' has ${actionCandidates.length} actions; keeping first as 'action' and dropping ${droppedCount} extra action(s)`
|
|
3788
|
+
);
|
|
3789
|
+
}
|
|
3790
|
+
const conditionalsProperty = actionCandidates[0].getProperty(
|
|
3791
|
+
CONDITIONALS_PROPERTY_NAME
|
|
3792
|
+
);
|
|
3793
|
+
if (conditionalsProperty) {
|
|
3794
|
+
conditionalsProperty.remove();
|
|
3795
|
+
console.log(
|
|
3796
|
+
` [${relPath}] Removed deprecated 'conditionals' from migrated 'action' on workqueue '${workqueueLabel}'`
|
|
3797
|
+
);
|
|
3798
|
+
}
|
|
3799
|
+
if (isUnsupportedActionType(actionCandidates[0])) {
|
|
3800
|
+
actionsProperty.remove();
|
|
3801
|
+
console.log(
|
|
3802
|
+
` [${relPath}] Removed deprecated 'actions' from workqueue '${workqueueLabel}' because action type is unsupported`
|
|
3803
|
+
);
|
|
3804
|
+
return 1;
|
|
3805
|
+
}
|
|
3806
|
+
const firstActionText = actionCandidates[0].getText();
|
|
3807
|
+
workqueue.addPropertyAssignment({
|
|
3808
|
+
name: ACTION_PROPERTY_NAME2,
|
|
3809
|
+
initializer: firstActionText
|
|
3864
3810
|
});
|
|
3811
|
+
actionsProperty.remove();
|
|
3812
|
+
console.log(
|
|
3813
|
+
` [${relPath}] Replaced 'actions' with 'action' on workqueue '${workqueueLabel}'`
|
|
3814
|
+
);
|
|
3815
|
+
return 1;
|
|
3865
3816
|
}
|
|
3866
3817
|
function processFile13(filePath, project) {
|
|
3867
3818
|
const sourceFile = project.getSourceFile(filePath);
|
|
3868
3819
|
if (!sourceFile) return 0;
|
|
3869
3820
|
let migratedWorkqueues = 0;
|
|
3870
|
-
let needsActionTypeImport = false;
|
|
3871
3821
|
const relPath = import_path18.default.relative(process.cwd(), filePath);
|
|
3872
3822
|
const callExpressions = sourceFile.getDescendantsOfKind(
|
|
3873
3823
|
import_ts_morph17.SyntaxKind.CallExpression
|
|
@@ -3883,14 +3833,9 @@ function processFile13(filePath, project) {
|
|
|
3883
3833
|
if (!import_ts_morph17.Node.isArrayLiteralExpression(workqueuesArg)) continue;
|
|
3884
3834
|
for (const element of workqueuesArg.getElements()) {
|
|
3885
3835
|
if (!import_ts_morph17.Node.isObjectLiteralExpression(element)) continue;
|
|
3886
|
-
|
|
3887
|
-
if (result.changed) migratedWorkqueues++;
|
|
3888
|
-
if (result.usedReadFallback) needsActionTypeImport = true;
|
|
3836
|
+
migratedWorkqueues += migrateWorkqueueActions(element, relPath);
|
|
3889
3837
|
}
|
|
3890
3838
|
}
|
|
3891
|
-
if (needsActionTypeImport) {
|
|
3892
|
-
ensureActionTypeImport(sourceFile);
|
|
3893
|
-
}
|
|
3894
3839
|
return migratedWorkqueues;
|
|
3895
3840
|
}
|
|
3896
3841
|
async function main18() {
|
|
@@ -4225,7 +4170,7 @@ Saved ${handlerRelPath}.`);
|
|
|
4225
4170
|
// src/migrations/v2.0/checkout-upstream-files.ts
|
|
4226
4171
|
var import_child_process = require("child_process");
|
|
4227
4172
|
var UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
|
|
4228
|
-
var UPSTREAM_BRANCH = "
|
|
4173
|
+
var UPSTREAM_BRANCH = "develop";
|
|
4229
4174
|
var TEMP_REMOTE = "opencrvs-upgrade-v19-v20-codemod";
|
|
4230
4175
|
var FILES_TO_CHECKOUT = [
|
|
4231
4176
|
"src/analytics/analytics.ts",
|
|
@@ -4775,13 +4720,9 @@ function gitShowBytes(ref, path23) {
|
|
|
4775
4720
|
return null;
|
|
4776
4721
|
}
|
|
4777
4722
|
}
|
|
4778
|
-
async function main25({
|
|
4779
|
-
subdirs = []
|
|
4780
|
-
} = {}) {
|
|
4781
|
-
const pathspecs = subdirs.length > 0 ? subdirs.map((s) => `${INFRASTRUCTURE_DIR}/${s}/`) : [`${INFRASTRUCTURE_DIR}/`];
|
|
4782
|
-
const scopeLabel = pathspecs.map((p) => `'${p}'`).join(", ");
|
|
4723
|
+
async function main25() {
|
|
4783
4724
|
console.log(
|
|
4784
|
-
`Merging ${
|
|
4725
|
+
`Merging '${INFRASTRUCTURE_DIR}/' from ${UPSTREAM_URL}@${UPSTREAM_BRANCH} (base: ${BASE_BRANCH})...
|
|
4785
4726
|
`
|
|
4786
4727
|
);
|
|
4787
4728
|
assertIsGitRepo();
|
|
@@ -4796,12 +4737,20 @@ async function main25({
|
|
|
4796
4737
|
const ref = `${TEMP_REMOTE2}/${UPSTREAM_BRANCH}`;
|
|
4797
4738
|
const baseRef = `${TEMP_REMOTE2}/${BASE_BRANCH}`;
|
|
4798
4739
|
const upstreamFiles = runGit(
|
|
4799
|
-
[
|
|
4740
|
+
[
|
|
4741
|
+
"ls-tree",
|
|
4742
|
+
"-r",
|
|
4743
|
+
"--name-only",
|
|
4744
|
+
"-z",
|
|
4745
|
+
ref,
|
|
4746
|
+
"--",
|
|
4747
|
+
`${INFRASTRUCTURE_DIR}/`
|
|
4748
|
+
],
|
|
4800
4749
|
{ silent: true }
|
|
4801
4750
|
).split("\0").filter(Boolean);
|
|
4802
4751
|
if (upstreamFiles.length === 0) {
|
|
4803
4752
|
console.log(
|
|
4804
|
-
` No files found under ${
|
|
4753
|
+
` No files found under '${INFRASTRUCTURE_DIR}/' on ${ref}. Nothing to merge.`
|
|
4805
4754
|
);
|
|
4806
4755
|
return;
|
|
4807
4756
|
}
|
|
@@ -4876,9 +4825,7 @@ async function main25({
|
|
|
4876
4825
|
var import_fs6 = require("fs");
|
|
4877
4826
|
var import_path25 = require("path");
|
|
4878
4827
|
var INFRASTRUCTURE_DIR2 = "infrastructure";
|
|
4879
|
-
async function main26({
|
|
4880
|
-
keep = []
|
|
4881
|
-
} = {}) {
|
|
4828
|
+
async function main26() {
|
|
4882
4829
|
const fullPath = (0, import_path25.join)(process.cwd(), INFRASTRUCTURE_DIR2);
|
|
4883
4830
|
if (!(0, import_fs6.existsSync)(fullPath)) {
|
|
4884
4831
|
console.log(
|
|
@@ -4886,64 +4833,24 @@ async function main26({
|
|
|
4886
4833
|
);
|
|
4887
4834
|
return;
|
|
4888
4835
|
}
|
|
4889
|
-
|
|
4890
|
-
if (keep.length === 0) {
|
|
4891
|
-
console.log(`Deleting '${INFRASTRUCTURE_DIR2}/'...
|
|
4836
|
+
console.log(`Deleting '${INFRASTRUCTURE_DIR2}/'...
|
|
4892
4837
|
`);
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
console.log(
|
|
4902
|
-
` Removed remaining untracked files under '${INFRASTRUCTURE_DIR2}/'.`
|
|
4903
|
-
);
|
|
4904
|
-
}
|
|
4905
|
-
console.log(
|
|
4906
|
-
`
|
|
4907
|
-
Done. Review the staged deletion with: git diff --cached -- '${INFRASTRUCTURE_DIR2}/'`
|
|
4908
|
-
);
|
|
4909
|
-
return;
|
|
4910
|
-
}
|
|
4911
|
-
const keepSet = new Set(keep);
|
|
4912
|
-
console.log(
|
|
4913
|
-
`Deleting contents of '${INFRASTRUCTURE_DIR2}/' except: ${[...keepSet].map((name) => `'${name}'`).join(", ")}
|
|
4914
|
-
`
|
|
4915
|
-
);
|
|
4916
|
-
const topLevelEntries = (0, import_fs6.readdirSync)(fullPath, { withFileTypes: true });
|
|
4917
|
-
let deleted = 0;
|
|
4918
|
-
for (const entry of topLevelEntries) {
|
|
4919
|
-
if (keepSet.has(entry.name)) {
|
|
4920
|
-
console.log(` Keeping '${INFRASTRUCTURE_DIR2}/${entry.name}'.`);
|
|
4921
|
-
continue;
|
|
4922
|
-
}
|
|
4923
|
-
const relPath = `${INFRASTRUCTURE_DIR2}/${entry.name}${entry.isDirectory() ? "/" : ""}`;
|
|
4924
|
-
runGit(["rm", "-rf", "--ignore-unmatch", "--", relPath], { silent: true });
|
|
4925
|
-
const fullEntryPath = (0, import_path25.join)(fullPath, entry.name);
|
|
4926
|
-
if ((0, import_fs6.existsSync)(fullEntryPath)) {
|
|
4927
|
-
(0, import_fs6.rmSync)(fullEntryPath, { recursive: true, force: true });
|
|
4928
|
-
}
|
|
4929
|
-
console.log(` Deleted '${relPath}'.`);
|
|
4930
|
-
deleted++;
|
|
4931
|
-
}
|
|
4932
|
-
const presentNames = new Set(topLevelEntries.map((e) => e.name));
|
|
4933
|
-
const missingKeeps = [...keepSet].filter((name) => !presentNames.has(name));
|
|
4934
|
-
if (missingKeeps.length > 0) {
|
|
4935
|
-
console.warn(
|
|
4936
|
-
` [warn] Requested to keep ${missingKeeps.map((n) => `'${n}'`).join(", ")} but they don't exist under '${INFRASTRUCTURE_DIR2}/'.`
|
|
4937
|
-
);
|
|
4838
|
+
assertIsGitRepo();
|
|
4839
|
+
runGit(["rm", "-rf", "--ignore-unmatch", "--", `${INFRASTRUCTURE_DIR2}/`], {
|
|
4840
|
+
silent: true
|
|
4841
|
+
});
|
|
4842
|
+
console.log(` Staged deletion of tracked files under '${INFRASTRUCTURE_DIR2}/'.`);
|
|
4843
|
+
if ((0, import_fs6.existsSync)(fullPath)) {
|
|
4844
|
+
(0, import_fs6.rmSync)(fullPath, { recursive: true, force: true });
|
|
4845
|
+
console.log(` Removed remaining untracked files under '${INFRASTRUCTURE_DIR2}/'.`);
|
|
4938
4846
|
}
|
|
4939
4847
|
console.log(
|
|
4940
4848
|
`
|
|
4941
|
-
Done.
|
|
4849
|
+
Done. Review the staged deletion with: git diff --cached -- '${INFRASTRUCTURE_DIR2}/'`
|
|
4942
4850
|
);
|
|
4943
4851
|
}
|
|
4944
4852
|
|
|
4945
4853
|
// src/migrations/v2.0/index.ts
|
|
4946
|
-
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
4947
4854
|
async function runUpgrade(dockerSwarm) {
|
|
4948
4855
|
await main18();
|
|
4949
4856
|
await main();
|
|
@@ -4972,7 +4879,6 @@ async function runUpgrade(dockerSwarm) {
|
|
|
4972
4879
|
if (dockerSwarm) {
|
|
4973
4880
|
await main25();
|
|
4974
4881
|
} else {
|
|
4975
|
-
await main26(
|
|
4976
|
-
await main25({ subdirs: NON_SWARM_INFRA_SUBDIRS });
|
|
4882
|
+
await main26();
|
|
4977
4883
|
}
|
|
4978
4884
|
}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Top-level subdirectories of `infrastructure/` to scope the merge to.
|
|
4
|
-
* When omitted or empty, the entire `infrastructure/` tree is merged
|
|
5
|
-
* (legacy behavior). Each name is relative to `infrastructure/` —
|
|
6
|
-
* e.g. `['postgres', 'metabase']` merges only
|
|
7
|
-
* `infrastructure/postgres/` and `infrastructure/metabase/`.
|
|
8
|
-
*/
|
|
9
|
-
subdirs?: string[];
|
|
10
|
-
}
|
|
11
|
-
declare function main({ subdirs }?: MergeInfrastructureOptions): Promise<void>;
|
|
1
|
+
declare function main(): Promise<void>;
|
|
12
2
|
export { main };
|
|
13
3
|
//# sourceMappingURL=merge-infrastructure-directory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-infrastructure-directory.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/merge-infrastructure-directory.ts"],"names":[],"mappings":"AAsHA,
|
|
1
|
+
{"version":3,"file":"merge-infrastructure-directory.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/merge-infrastructure-directory.ts"],"names":[],"mappings":"AAsHA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAkInC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
exports.main = main;
|
|
23
23
|
/**
|
|
24
24
|
* Codemod: Merge upstream changes into the local `infrastructure/` directory
|
|
25
|
-
*
|
|
25
|
+
* from opencrvs/opencrvs-countryconfig.
|
|
26
26
|
*
|
|
27
27
|
* Usage:
|
|
28
28
|
* ts-node -r tsconfig-paths/register src/migrations/v2.0/merge-infrastructure-directory.ts
|
|
@@ -33,10 +33,8 @@ exports.main = main;
|
|
|
33
33
|
* - the upstream "theirs" branch (v2.0) → `UPSTREAM_BRANCH`
|
|
34
34
|
* - the synthetic merge-base branch (latest 1.9 release line)
|
|
35
35
|
* → `BASE_BRANCH`
|
|
36
|
-
* 2. For every file under `infrastructure/` on upstream "theirs"
|
|
37
|
-
*
|
|
38
|
-
* `infrastructure/<subdir>/` for each requested subdir), performs a
|
|
39
|
-
* file-scoped 3-way merge:
|
|
36
|
+
* 2. For every file under `infrastructure/` on upstream "theirs", performs
|
|
37
|
+
* a file-scoped 3-way merge:
|
|
40
38
|
* - new file on upstream → checked out and staged
|
|
41
39
|
* - existing file → 3-way merged in place via `git merge-file`,
|
|
42
40
|
* using the BASE_BRANCH version of the file
|
|
@@ -118,14 +116,8 @@ function gitShowBytes(ref, path) {
|
|
|
118
116
|
}
|
|
119
117
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
120
118
|
function main() {
|
|
121
|
-
return __awaiter(this,
|
|
122
|
-
|
|
123
|
-
// git treat them as tree paths (recurse into them).
|
|
124
|
-
const pathspecs = subdirs.length > 0
|
|
125
|
-
? subdirs.map((s) => `${INFRASTRUCTURE_DIR}/${s}/`)
|
|
126
|
-
: [`${INFRASTRUCTURE_DIR}/`];
|
|
127
|
-
const scopeLabel = pathspecs.map((p) => `'${p}'`).join(', ');
|
|
128
|
-
console.log(`Merging ${scopeLabel} from ${checkout_upstream_files_1.UPSTREAM_URL}@${checkout_upstream_files_1.UPSTREAM_BRANCH} (base: ${BASE_BRANCH})...\n`);
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
console.log(`Merging '${INFRASTRUCTURE_DIR}/' from ${checkout_upstream_files_1.UPSTREAM_URL}@${checkout_upstream_files_1.UPSTREAM_BRANCH} (base: ${BASE_BRANCH})...\n`);
|
|
129
121
|
(0, checkout_upstream_files_1.assertIsGitRepo)();
|
|
130
122
|
// Best-effort cleanup of a stale temp remote from a previous aborted run.
|
|
131
123
|
(0, checkout_upstream_files_1.tryGit)(['remote', 'remove', TEMP_REMOTE]);
|
|
@@ -139,13 +131,20 @@ function main() {
|
|
|
139
131
|
const ref = `${TEMP_REMOTE}/${checkout_upstream_files_1.UPSTREAM_BRANCH}`;
|
|
140
132
|
const baseRef = `${TEMP_REMOTE}/${BASE_BRANCH}`;
|
|
141
133
|
// -z gives NUL-separated paths so filenames with spaces or newlines
|
|
142
|
-
// survive the round-trip.
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
// survive the round-trip.
|
|
135
|
+
const upstreamFiles = (0, checkout_upstream_files_1.runGit)([
|
|
136
|
+
'ls-tree',
|
|
137
|
+
'-r',
|
|
138
|
+
'--name-only',
|
|
139
|
+
'-z',
|
|
140
|
+
ref,
|
|
141
|
+
'--',
|
|
142
|
+
`${INFRASTRUCTURE_DIR}/`
|
|
143
|
+
], { silent: true })
|
|
145
144
|
.split('\0')
|
|
146
145
|
.filter(Boolean);
|
|
147
146
|
if (upstreamFiles.length === 0) {
|
|
148
|
-
console.log(` No files found under ${
|
|
147
|
+
console.log(` No files found under '${INFRASTRUCTURE_DIR}/' on ${ref}. Nothing to merge.`);
|
|
149
148
|
return;
|
|
150
149
|
}
|
|
151
150
|
const tmpDir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), 'opencrvs-merge-infra-'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-workqueue-configs.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-workqueue-configs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate-workqueue-configs.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-workqueue-configs.ts"],"names":[],"mappings":"AA+OA,iBAAe,IAAI,kBAqDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|