@opencrvs/toolkit 1.9.12-rc.a9b25f0 → 1.9.12-rc.ab196db
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 +1 -1
- package/dist/cli.js +1890 -278
- package/dist/commons/api/router.d.ts +175 -163
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/EventConfig.d.ts +3 -1
- package/dist/commons/events/FieldConfig.d.ts +2 -2
- package/dist/commons/notification/UserNotifications.d.ts +15 -0
- package/dist/events/index.js +17 -3
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +3 -4
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.js +356 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +22 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +147 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
- package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
- package/dist/migrations/v2.0/create-events-index.js +325 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +3 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +77 -0
- package/dist/migrations/v2.0/index.d.ts +8 -4
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +1860 -277
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +5 -6
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +3 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +221 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +6 -7
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +3 -4
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
- package/dist/migrations/v2.0/rename-api-paths.js +3 -4
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
- package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +195 -0
- package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
- package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
- package/dist/migrations/v2.0/update-package-json.js +105 -0
- package/dist/notification/index.js +10 -1
- package/opencrvs-toolkit-1.9.12-rc.ab196db.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-1.9.12-rc.a9b25f0.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-location-parent-id.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-location-parent-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rename-location-parent-id.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-location-parent-id.ts"],"names":[],"mappings":"AAmJA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -45,7 +45,6 @@ exports.main = main;
|
|
|
45
45
|
*/
|
|
46
46
|
const ts_morph_1 = require("ts-morph");
|
|
47
47
|
const path_1 = __importDefault(require("path"));
|
|
48
|
-
const _1 = require(".");
|
|
49
48
|
const OLD_PROPERTY_NAME = 'parentId';
|
|
50
49
|
const NEW_PROPERTY_NAME = 'administrativeAreaId';
|
|
51
50
|
const LOCATION_TYPE_NAME = 'Location';
|
|
@@ -138,14 +137,14 @@ function processFile(filePath, project) {
|
|
|
138
137
|
// surrounding whitespace and optional-chain tokens (?.)
|
|
139
138
|
propAccess.getNameNode().replaceWithText(NEW_PROPERTY_NAME);
|
|
140
139
|
renamedCount++;
|
|
141
|
-
console.log(` [${path_1.default.relative(
|
|
140
|
+
console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Renamed Location.${OLD_PROPERTY_NAME} → Location.${NEW_PROPERTY_NAME}`);
|
|
142
141
|
}
|
|
143
142
|
return renamedCount;
|
|
144
143
|
}
|
|
145
144
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
146
145
|
function main() {
|
|
147
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
const srcDir = path_1.default.join(
|
|
147
|
+
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
149
148
|
console.log(`Scanning for Location.${OLD_PROPERTY_NAME} references in: ${srcDir}\n`);
|
|
150
149
|
const project = new ts_morph_1.Project({
|
|
151
150
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -174,7 +173,7 @@ function main() {
|
|
|
174
173
|
for (const filePath of modifiedFiles) {
|
|
175
174
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
176
175
|
yield sourceFile.save();
|
|
177
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
176
|
+
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
178
177
|
}
|
|
179
178
|
console.log(`\nDone. Renamed ${totalRenamed} Location.${OLD_PROPERTY_NAME} reference(s) to Location.${NEW_PROPERTY_NAME}.`);
|
|
180
179
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplify-analytics-precalculations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/simplify-analytics-precalculations.ts"],"names":[],"mappings":"AAqLA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAyCnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.main = main;
|
|
26
|
+
/**
|
|
27
|
+
* Codemod: Clean up `src/analytics/analytics.ts` by removing the Farajaland
|
|
28
|
+
* sample precalculation wiring.
|
|
29
|
+
*
|
|
30
|
+
* Usage:
|
|
31
|
+
* ts-node -r tsconfig-paths/register src/migrations/v2.0/simplify-analytics-precalculations.ts
|
|
32
|
+
*
|
|
33
|
+
* Runs LAST, after `checkout-upstream-files` has replaced
|
|
34
|
+
* `src/analytics/analytics.ts` with the upstream v2.0 version. That upstream
|
|
35
|
+
* version hardcodes a Farajaland-specific birth-event precalculation (it
|
|
36
|
+
* imports `Event` and `precalculateBirthEvent`), which countries implementing
|
|
37
|
+
* their own flows don't want. This codemod strips that out so each country
|
|
38
|
+
* starts from a clean placeholder.
|
|
39
|
+
*
|
|
40
|
+
* What it does (only to `src/analytics/analytics.ts`, if present):
|
|
41
|
+
* 1. Removes the named imports `Event` and `precalculateBirthEvent`.
|
|
42
|
+
* If an import declaration becomes empty it is removed entirely.
|
|
43
|
+
* 2. Rewrites the body of `precalculateAdditionalAnalytics` so it contains
|
|
44
|
+
* nothing but `return declaration` — i.e. every statement that
|
|
45
|
+
* references `Event` or `precalculateBirthEvent` is dropped, and a
|
|
46
|
+
* `return declaration` is ensured at the end.
|
|
47
|
+
*
|
|
48
|
+
* The codemod is safe to re-run: if the imports are already gone and the
|
|
49
|
+
* function body is already `return declaration`, it is a no-op.
|
|
50
|
+
*/
|
|
51
|
+
const ts_morph_1 = require("ts-morph");
|
|
52
|
+
const fs_1 = __importDefault(require("fs"));
|
|
53
|
+
const path_1 = __importDefault(require("path"));
|
|
54
|
+
const ANALYTICS_FILE_REL = 'src/analytics/analytics.ts';
|
|
55
|
+
const FUNCTION_NAME = 'precalculateAdditionalAnalytics';
|
|
56
|
+
const IMPORT_NAMES_TO_REMOVE = new Set(['Event', 'precalculateBirthEvent']);
|
|
57
|
+
const RETURN_EXPRESSION_TEXT = 'declaration';
|
|
58
|
+
// ─── Import cleanup ──────────────────────────────────────────────────────────
|
|
59
|
+
/**
|
|
60
|
+
* Removes every named import in `sourceFile` whose local binding name is in
|
|
61
|
+
* `IMPORT_NAMES_TO_REMOVE`. If a given import declaration is left with no
|
|
62
|
+
* named imports, default import or namespace import, the declaration itself
|
|
63
|
+
* is removed.
|
|
64
|
+
*/
|
|
65
|
+
function removeTargetedNamedImports(sourceFile) {
|
|
66
|
+
const log = [];
|
|
67
|
+
for (const importDecl of [...sourceFile.getImportDeclarations()]) {
|
|
68
|
+
const namedImports = importDecl.getNamedImports();
|
|
69
|
+
if (namedImports.length === 0)
|
|
70
|
+
continue;
|
|
71
|
+
const matched = namedImports.filter((ni) => IMPORT_NAMES_TO_REMOVE.has(ni.getName()));
|
|
72
|
+
if (matched.length === 0)
|
|
73
|
+
continue;
|
|
74
|
+
const removedNames = matched.map((ni) => ni.getName());
|
|
75
|
+
for (const ni of matched)
|
|
76
|
+
ni.remove();
|
|
77
|
+
log.push(`removed import(s) ${removedNames.join(', ')} from '${importDecl.getModuleSpecifierValue()}'`);
|
|
78
|
+
const stillUsed = importDecl.getNamedImports().length > 0 ||
|
|
79
|
+
importDecl.getDefaultImport() ||
|
|
80
|
+
importDecl.getNamespaceImport();
|
|
81
|
+
if (!stillUsed)
|
|
82
|
+
importDecl.remove();
|
|
83
|
+
}
|
|
84
|
+
return log;
|
|
85
|
+
}
|
|
86
|
+
// ─── Function-body cleanup ───────────────────────────────────────────────────
|
|
87
|
+
/**
|
|
88
|
+
* Returns the `precalculateAdditionalAnalytics` declaration in `sourceFile`,
|
|
89
|
+
* whether it was written as `function precalculateAdditionalAnalytics(...)` or
|
|
90
|
+
* as `const precalculateAdditionalAnalytics = (...) => { ... }`.
|
|
91
|
+
*/
|
|
92
|
+
function findPrecalculateFunction(sourceFile) {
|
|
93
|
+
for (const fn of sourceFile.getFunctions()) {
|
|
94
|
+
if (fn.getName() === FUNCTION_NAME)
|
|
95
|
+
return fn;
|
|
96
|
+
}
|
|
97
|
+
for (const statement of sourceFile.getVariableStatements()) {
|
|
98
|
+
for (const decl of statement.getDeclarations()) {
|
|
99
|
+
if (decl.getName() === FUNCTION_NAME)
|
|
100
|
+
return decl;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns the block body of a function declaration or variable-declared arrow
|
|
107
|
+
* / function expression, or undefined if the function has an expression body
|
|
108
|
+
* or doesn't exist.
|
|
109
|
+
*/
|
|
110
|
+
function getFunctionBodyBlock(fn) {
|
|
111
|
+
if (ts_morph_1.Node.isFunctionDeclaration(fn))
|
|
112
|
+
return fn.getBody();
|
|
113
|
+
const initializer = fn.getInitializer();
|
|
114
|
+
if (!initializer)
|
|
115
|
+
return undefined;
|
|
116
|
+
if (!ts_morph_1.Node.isArrowFunction(initializer) &&
|
|
117
|
+
!ts_morph_1.Node.isFunctionExpression(initializer)) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
return initializer.getBody();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Rewrites the body of `precalculateAdditionalAnalytics` so that the only
|
|
124
|
+
* statement is `return declaration`. Any statement whose subtree references
|
|
125
|
+
* the removed imports (`Event`, `precalculateBirthEvent`) is dropped; a
|
|
126
|
+
* trailing `return declaration` is ensured.
|
|
127
|
+
*/
|
|
128
|
+
function simplifyPrecalculateFunction(sourceFile) {
|
|
129
|
+
var _a;
|
|
130
|
+
const log = [];
|
|
131
|
+
const fn = findPrecalculateFunction(sourceFile);
|
|
132
|
+
if (!fn)
|
|
133
|
+
return log;
|
|
134
|
+
const body = getFunctionBodyBlock(fn);
|
|
135
|
+
if (!body || !ts_morph_1.Node.isBlock(body))
|
|
136
|
+
return log;
|
|
137
|
+
// Drop every statement (not just `if`s) whose AST references an identifier
|
|
138
|
+
// in IMPORT_NAMES_TO_REMOVE. This handles both the upstream shape
|
|
139
|
+
// if (eventConfig.id === Event.Birth) return precalculateBirthEvent(...)
|
|
140
|
+
// and any equivalent variant a country might have typed.
|
|
141
|
+
for (const statement of [...body.getStatements()]) {
|
|
142
|
+
const references = statement
|
|
143
|
+
.getDescendantsOfKind(ts_morph_1.SyntaxKind.Identifier)
|
|
144
|
+
.some((id) => IMPORT_NAMES_TO_REMOVE.has(id.getText()));
|
|
145
|
+
if (references) {
|
|
146
|
+
statement.remove();
|
|
147
|
+
log.push(`removed statement in ${FUNCTION_NAME} referencing removed imports`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Ensure the function ends with `return declaration`. If nothing changed
|
|
151
|
+
// and the body already ends correctly, this is a no-op.
|
|
152
|
+
const remaining = body.getStatements();
|
|
153
|
+
const last = remaining[remaining.length - 1];
|
|
154
|
+
const alreadyCorrect = last &&
|
|
155
|
+
ts_morph_1.Node.isReturnStatement(last) &&
|
|
156
|
+
((_a = last.getExpression()) === null || _a === void 0 ? void 0 : _a.getText()) === RETURN_EXPRESSION_TEXT;
|
|
157
|
+
if (!alreadyCorrect) {
|
|
158
|
+
body.addStatements(`return ${RETURN_EXPRESSION_TEXT}`);
|
|
159
|
+
log.push(`ensured '${FUNCTION_NAME}' ends with 'return ${RETURN_EXPRESSION_TEXT}'`);
|
|
160
|
+
}
|
|
161
|
+
return log;
|
|
162
|
+
}
|
|
163
|
+
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
164
|
+
function main() {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const cwd = process.cwd();
|
|
167
|
+
const absPath = path_1.default.join(cwd, ANALYTICS_FILE_REL);
|
|
168
|
+
if (!fs_1.default.existsSync(absPath)) {
|
|
169
|
+
console.log(`[${ANALYTICS_FILE_REL}] does not exist — nothing to clean up.`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const project = new ts_morph_1.Project({
|
|
173
|
+
tsConfigFilePath: path_1.default.resolve(cwd, 'tsconfig.json'),
|
|
174
|
+
skipAddingFilesFromTsConfig: false
|
|
175
|
+
});
|
|
176
|
+
const sourceFile = project.getSourceFile(absPath);
|
|
177
|
+
if (!sourceFile) {
|
|
178
|
+
console.log(`[${ANALYTICS_FILE_REL}] is not part of the tsconfig project. Skipping.`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
console.log(`Cleaning up ${ANALYTICS_FILE_REL}...\n`);
|
|
182
|
+
const importLogs = removeTargetedNamedImports(sourceFile);
|
|
183
|
+
const fnLogs = simplifyPrecalculateFunction(sourceFile);
|
|
184
|
+
const allLogs = [...importLogs, ...fnLogs];
|
|
185
|
+
if (allLogs.length === 0) {
|
|
186
|
+
console.log(`[${ANALYTICS_FILE_REL}] already clean — nothing to do.`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
for (const log of allLogs) {
|
|
190
|
+
console.log(` [${ANALYTICS_FILE_REL}] ${log}`);
|
|
191
|
+
}
|
|
192
|
+
yield sourceFile.save();
|
|
193
|
+
console.log(`\nSaved ${ANALYTICS_FILE_REL}.`);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-package-json.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/update-package-json.ts"],"names":[],"mappings":"AA2CA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAyEnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.main = main;
|
|
26
|
+
/**
|
|
27
|
+
* Codemod: Update root `package.json` for the v1.9 → v2.0 upgrade.
|
|
28
|
+
*
|
|
29
|
+
* Changes applied:
|
|
30
|
+
* 1. Sets `version` to `2.0.0`.
|
|
31
|
+
* 2. Sets `zod` to `^4.2.1` in `dependencies` (or `devDependencies` if it
|
|
32
|
+
* already lives there). If `zod` is absent from both, it's added to
|
|
33
|
+
* `dependencies`.
|
|
34
|
+
*
|
|
35
|
+
* Caveats:
|
|
36
|
+
* - The codemod preserves the file's existing 2-space indentation and
|
|
37
|
+
* trailing newline. Any non-standard formatting (e.g. tabs) will be
|
|
38
|
+
* replaced with 2-space indentation.
|
|
39
|
+
* - No-op when `package.json` is missing.
|
|
40
|
+
* - No automatic `yarn install` is run; the developer should reinstall
|
|
41
|
+
* dependencies after the codemods complete.
|
|
42
|
+
*/
|
|
43
|
+
const fs_1 = require("fs");
|
|
44
|
+
const path_1 = __importDefault(require("path"));
|
|
45
|
+
const PACKAGE_JSON_RELATIVE = 'package.json';
|
|
46
|
+
const TARGET_VERSION = '2.0.0';
|
|
47
|
+
const TARGET_ZOD_RANGE = '^4.2.1';
|
|
48
|
+
function main() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const packageJsonPath = path_1.default.join(process.cwd(), PACKAGE_JSON_RELATIVE);
|
|
51
|
+
if (!(0, fs_1.existsSync)(packageJsonPath)) {
|
|
52
|
+
console.log(`'${PACKAGE_JSON_RELATIVE}' not found in ${process.cwd()} — skipping.`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const raw = (0, fs_1.readFileSync)(packageJsonPath, 'utf8');
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(raw);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.warn(` [${PACKAGE_JSON_RELATIVE}] Failed to parse JSON — skipping update. ${error.message}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
console.log(`Updating '${PACKAGE_JSON_RELATIVE}'...`);
|
|
65
|
+
const previousVersion = parsed.version;
|
|
66
|
+
const versionChanged = previousVersion !== TARGET_VERSION;
|
|
67
|
+
parsed.version = TARGET_VERSION;
|
|
68
|
+
if (versionChanged) {
|
|
69
|
+
console.log(` Set version: ${previousVersion !== null && previousVersion !== void 0 ? previousVersion : '<unset>'} → ${TARGET_VERSION}`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.log(` Version already ${TARGET_VERSION} — no change.`);
|
|
73
|
+
}
|
|
74
|
+
// Resolve which dependency bucket already holds zod, defaulting to
|
|
75
|
+
// `dependencies` when absent.
|
|
76
|
+
let zodBucket = 'dependencies';
|
|
77
|
+
if (parsed.devDependencies && 'zod' in parsed.devDependencies) {
|
|
78
|
+
zodBucket = 'devDependencies';
|
|
79
|
+
}
|
|
80
|
+
if (!parsed[zodBucket]) {
|
|
81
|
+
parsed[zodBucket] = {};
|
|
82
|
+
}
|
|
83
|
+
const bucket = parsed[zodBucket];
|
|
84
|
+
const previousZod = bucket.zod;
|
|
85
|
+
const zodChanged = previousZod !== TARGET_ZOD_RANGE;
|
|
86
|
+
bucket.zod = TARGET_ZOD_RANGE;
|
|
87
|
+
if (zodChanged) {
|
|
88
|
+
console.log(` Set ${zodBucket}.zod: ${previousZod !== null && previousZod !== void 0 ? previousZod : '<absent>'} → ${TARGET_ZOD_RANGE}`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(` ${zodBucket}.zod already ${TARGET_ZOD_RANGE} — no change.`);
|
|
92
|
+
}
|
|
93
|
+
// Preserve trailing newline if the source had one (default to LF since
|
|
94
|
+
// most repos commit JSON with a trailing newline).
|
|
95
|
+
const trailingNewline = raw.endsWith('\n') ? '\n' : '';
|
|
96
|
+
const next = JSON.stringify(parsed, null, 2) + trailingNewline;
|
|
97
|
+
if (next === raw) {
|
|
98
|
+
console.log('\n No changes to write.');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
(0, fs_1.writeFileSync)(packageJsonPath, next, 'utf8');
|
|
102
|
+
console.log(`\n Saved '${PACKAGE_JSON_RELATIVE}'.`);
|
|
103
|
+
console.log(` NOTE: run \`yarn install\` (or your package manager equivalent) to install the updated dependency versions.`);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
@@ -520,6 +520,7 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
520
520
|
"user.password_changed",
|
|
521
521
|
"user.password_reset",
|
|
522
522
|
"user.password_reset_by_admin",
|
|
523
|
+
"user.resend_invite",
|
|
523
524
|
"user.username_reminder",
|
|
524
525
|
"user.username_reminder_by_admin"
|
|
525
526
|
]),
|
|
@@ -1992,7 +1993,7 @@ var LocationInput = BaseField.extend({
|
|
|
1992
1993
|
configuration: import_v43.default.object({
|
|
1993
1994
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1994
1995
|
allowedLocations: AllowedLocations
|
|
1995
|
-
})
|
|
1996
|
+
}).optional()
|
|
1996
1997
|
}).describe("Input field for a location");
|
|
1997
1998
|
var FileUploadWithOptions = BaseField.extend({
|
|
1998
1999
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
@@ -3661,6 +3662,9 @@ var _EventConfigBase = z33.object({
|
|
|
3661
3662
|
),
|
|
3662
3663
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
3663
3664
|
"Configuration of flags associated with the actions of this event type."
|
|
3665
|
+
),
|
|
3666
|
+
analytics: z33.boolean().optional().default(true).describe(
|
|
3667
|
+
"Indicates whether the records of this event type are included in analytics"
|
|
3664
3668
|
)
|
|
3665
3669
|
});
|
|
3666
3670
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -6931,6 +6935,7 @@ var TriggerEvent = {
|
|
|
6931
6935
|
USERNAME_REMINDER: "username-reminder",
|
|
6932
6936
|
RESET_PASSWORD: "reset-password",
|
|
6933
6937
|
RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
|
|
6938
|
+
RESEND_INVITE: "resend-invite",
|
|
6934
6939
|
TWO_FA: "2fa",
|
|
6935
6940
|
ALL_USER_NOTIFICATION: "all-user-notification",
|
|
6936
6941
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
@@ -6968,6 +6973,10 @@ var TriggerPayload = {
|
|
|
6968
6973
|
role: z44.string()
|
|
6969
6974
|
})
|
|
6970
6975
|
}),
|
|
6976
|
+
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
6977
|
+
username: z44.string(),
|
|
6978
|
+
temporaryPassword: z44.string()
|
|
6979
|
+
}),
|
|
6971
6980
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
6972
6981
|
code: z44.string()
|
|
6973
6982
|
}),
|
|
Binary file
|
package/package.json
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
|
|
1
|
+
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
|
|
Binary file
|