@opencrvs/toolkit 1.9.12-rc.fdea6df → 1.9.12-rc.ff04697
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.sh +8 -0
- package/dist/application-config/index.js +2045 -41
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3799 -0
- package/dist/commons/api/router.d.ts +197 -159
- package/dist/commons/application-config/index.d.ts +13 -16
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionDocument.d.ts +198 -198
- package/dist/commons/events/ActionInput.d.ts +113 -113
- package/dist/commons/events/ActionType.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +16 -10
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/CountryConfigQueryInput.d.ts +443 -172
- package/dist/commons/events/Draft.d.ts +15 -15
- package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
- package/dist/commons/events/EventConfig.d.ts +4 -2
- package/dist/commons/events/EventDocument.d.ts +81 -81
- package/dist/commons/events/EventIndex.d.ts +35 -27
- package/dist/commons/events/EventInput.d.ts +1 -1
- package/dist/commons/events/EventMetadata.d.ts +24 -24
- package/dist/commons/events/FieldConfig.d.ts +157 -46
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +98 -72
- package/dist/commons/events/FieldValue.d.ts +54 -26
- package/dist/commons/events/PlainDate.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +16 -16
- package/dist/commons/events/WorkqueueConfig.d.ts +438 -194
- package/dist/commons/events/defineConfig.d.ts +0 -4
- package/dist/commons/events/locations.d.ts +4 -4
- package/dist/commons/events/scopes.d.ts +1 -1
- package/dist/commons/events/state/index.d.ts +2 -2
- package/dist/commons/events/state/utils.d.ts +3 -3
- package/dist/commons/events/utils.d.ts +5 -177
- package/dist/conditionals/index.js +13 -5
- package/dist/events/index.js +149 -36
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +404 -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 +2 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +828 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +158 -0
- 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 +11 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +3709 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +343 -0
- 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-scopes.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-scopes.js +281 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +267 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +236 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-delete-actions.js +156 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +74 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.js +96 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +77 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +109 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.js +163 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-api-paths.js +187 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-location-parent-id.js +180 -0
- 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/notification/index.js +78 -25
- package/dist/scopes/index.d.ts +31 -10
- package/dist/scopes/index.js +17 -5
- package/opencrvs-toolkit-1.9.12-rc.ff04697.tgz +0 -0
- package/package.json +11 -7
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-1.9.12-rc.fdea6df.tgz +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
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: Rename `parentId` to `administrativeAreaId` on `Location` typed expressions.
|
|
28
|
+
*
|
|
29
|
+
* Usage:
|
|
30
|
+
* ts-node -r tsconfig-paths/register src/migrations/v2.0/rename-location-parent-id.ts
|
|
31
|
+
*
|
|
32
|
+
* What it does:
|
|
33
|
+
* - Scans all TypeScript files under `src/`
|
|
34
|
+
* - Finds every property access expression whose property name is `parentId`
|
|
35
|
+
* - Uses the TypeScript type checker to resolve the type of the object being accessed
|
|
36
|
+
* - Only renames to `administrativeAreaId` when the type (or any union constituent) is
|
|
37
|
+
* the OpenCRVS `Location` type, identified via three strategies in order:
|
|
38
|
+
* 1. Alias symbol name equals 'Location' (works when TypeScript preserves alias info)
|
|
39
|
+
* 2. Direct symbol name equals 'Location'
|
|
40
|
+
* 3. Structural fallback: the type is an object with the property set that uniquely
|
|
41
|
+
* identifies the OpenCRVS Location shape (id, name, externalId, locationType, and
|
|
42
|
+
* either administrativeAreaId or parentId)
|
|
43
|
+
* - Skips `parentId` accesses on any other type (e.g. plain objects, other interfaces)
|
|
44
|
+
* - Saves the modified files in-place
|
|
45
|
+
*/
|
|
46
|
+
const ts_morph_1 = require("ts-morph");
|
|
47
|
+
const path_1 = __importDefault(require("path"));
|
|
48
|
+
const OLD_PROPERTY_NAME = 'parentId';
|
|
49
|
+
const NEW_PROPERTY_NAME = 'administrativeAreaId';
|
|
50
|
+
const LOCATION_TYPE_NAME = 'Location';
|
|
51
|
+
// Properties that together uniquely identify the OpenCRVS Location type.
|
|
52
|
+
// Used as a structural fallback when TypeScript loses the alias name through
|
|
53
|
+
// re-export chains (e.g. z.infer<…> re-exported via @opencrvs/toolkit/events).
|
|
54
|
+
const LOCATION_STRUCTURAL_PROPS = [
|
|
55
|
+
'id',
|
|
56
|
+
'name',
|
|
57
|
+
'externalId',
|
|
58
|
+
'locationType'
|
|
59
|
+
];
|
|
60
|
+
// At least one of these must also be present (old name or new name)
|
|
61
|
+
const LOCATION_AREA_ID_PROPS = ['administrativeAreaId', 'parentId'];
|
|
62
|
+
// ─── Type helpers ─────────────────────────────────────────────────────────────
|
|
63
|
+
/**
|
|
64
|
+
* Returns true if a single (non-union) type resolves to the OpenCRVS Location type.
|
|
65
|
+
*
|
|
66
|
+
* Three strategies are tried in order so that the check remains robust across
|
|
67
|
+
* different TypeScript/ts-morph resolution paths:
|
|
68
|
+
*
|
|
69
|
+
* 1. Alias symbol name — works when TypeScript preserves the `type Location =
|
|
70
|
+
* z.infer<typeof Location>` alias through the re-export chain.
|
|
71
|
+
* 2. Direct symbol name — works when the type is represented by a named interface
|
|
72
|
+
* or class rather than an alias.
|
|
73
|
+
* 3. Structural match — fallback for when both symbol lookups fail (e.g. the
|
|
74
|
+
* alias is lost because the type was re-exported through a barrel or because
|
|
75
|
+
* z.infer<…> fully unwraps the alias). Checks for the combination of
|
|
76
|
+
* properties that uniquely identify the OpenCRVS Location shape.
|
|
77
|
+
*/
|
|
78
|
+
function isSingleLocationType(t) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
// Strategy 1: alias symbol (zod-inferred type aliases surface here)
|
|
81
|
+
if (((_a = t.getAliasSymbol()) === null || _a === void 0 ? void 0 : _a.getName()) === LOCATION_TYPE_NAME)
|
|
82
|
+
return true;
|
|
83
|
+
// Strategy 2: direct symbol (plain interface / class)
|
|
84
|
+
if (((_b = t.getSymbol()) === null || _b === void 0 ? void 0 : _b.getName()) === LOCATION_TYPE_NAME)
|
|
85
|
+
return true;
|
|
86
|
+
// Strategy 3: structural fallback
|
|
87
|
+
if (t.isObject()) {
|
|
88
|
+
const propNames = new Set(t.getProperties().map((p) => p.getName()));
|
|
89
|
+
const hasCorePropNames = LOCATION_STRUCTURAL_PROPS.every((p) => propNames.has(p));
|
|
90
|
+
const hasAreaIdProp = LOCATION_AREA_ID_PROPS.some((p) => propNames.has(p));
|
|
91
|
+
if (hasCorePropNames && hasAreaIdProp)
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns true when the type of `node` is (or has a union constituent that is)
|
|
98
|
+
* the OpenCRVS Location type.
|
|
99
|
+
* Handles:
|
|
100
|
+
* - `Location`
|
|
101
|
+
* - `Location | undefined` (optional / nullable)
|
|
102
|
+
* - `Location | null | undefined`
|
|
103
|
+
*/
|
|
104
|
+
function isLocationType(node) {
|
|
105
|
+
let type;
|
|
106
|
+
try {
|
|
107
|
+
type = node.getType();
|
|
108
|
+
}
|
|
109
|
+
catch (_a) {
|
|
110
|
+
// getType() can throw on malformed/unresolvable nodes — skip them
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (isSingleLocationType(type))
|
|
114
|
+
return true;
|
|
115
|
+
// Walk union constituents (Location | undefined, Location | null, …)
|
|
116
|
+
for (const constituent of type.getUnionTypes()) {
|
|
117
|
+
if (isSingleLocationType(constituent))
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
// ─── File processor ──────────────────────────────────────────────────────────
|
|
123
|
+
function processFile(filePath, project) {
|
|
124
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
125
|
+
if (!sourceFile)
|
|
126
|
+
return 0;
|
|
127
|
+
let renamedCount = 0;
|
|
128
|
+
// Collect all matching nodes first to avoid mutating the tree while iterating
|
|
129
|
+
const candidates = sourceFile
|
|
130
|
+
.getDescendantsOfKind(ts_morph_1.SyntaxKind.PropertyAccessExpression)
|
|
131
|
+
.filter((propAccess) => propAccess.getName() === OLD_PROPERTY_NAME);
|
|
132
|
+
for (const propAccess of candidates) {
|
|
133
|
+
const obj = propAccess.getExpression();
|
|
134
|
+
if (!isLocationType(obj))
|
|
135
|
+
continue;
|
|
136
|
+
// Rename only the identifier node (the part after the dot) to preserve
|
|
137
|
+
// surrounding whitespace and optional-chain tokens (?.)
|
|
138
|
+
propAccess.getNameNode().replaceWithText(NEW_PROPERTY_NAME);
|
|
139
|
+
renamedCount++;
|
|
140
|
+
console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Renamed Location.${OLD_PROPERTY_NAME} → Location.${NEW_PROPERTY_NAME}`);
|
|
141
|
+
}
|
|
142
|
+
return renamedCount;
|
|
143
|
+
}
|
|
144
|
+
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
145
|
+
function main() {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
148
|
+
console.log(`Scanning for Location.${OLD_PROPERTY_NAME} references in: ${srcDir}\n`);
|
|
149
|
+
const project = new ts_morph_1.Project({
|
|
150
|
+
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
151
|
+
skipAddingFilesFromTsConfig: false
|
|
152
|
+
});
|
|
153
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
154
|
+
const fp = sf.getFilePath();
|
|
155
|
+
return fp.includes('/src/') && !fp.includes('/node_modules/');
|
|
156
|
+
});
|
|
157
|
+
console.log(`Found ${sourceFiles.length} source file(s) to analyse.\n`);
|
|
158
|
+
let totalRenamed = 0;
|
|
159
|
+
const modifiedFiles = [];
|
|
160
|
+
for (const sourceFile of sourceFiles) {
|
|
161
|
+
const filePath = sourceFile.getFilePath();
|
|
162
|
+
const renamed = processFile(filePath, project);
|
|
163
|
+
if (renamed > 0) {
|
|
164
|
+
totalRenamed += renamed;
|
|
165
|
+
modifiedFiles.push(filePath);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (modifiedFiles.length === 0) {
|
|
169
|
+
console.log(`No Location.${OLD_PROPERTY_NAME} references found. Nothing to do.`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
|
|
173
|
+
for (const filePath of modifiedFiles) {
|
|
174
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
175
|
+
yield sourceFile.save();
|
|
176
|
+
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
177
|
+
}
|
|
178
|
+
console.log(`\nDone. Renamed ${totalRenamed} Location.${OLD_PROPERTY_NAME} reference(s) to Location.${NEW_PROPERTY_NAME}.`);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -133,16 +133,16 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
133
133
|
var AccessLevelOptions = z2.object({
|
|
134
134
|
accessLevel: JurisdictionFilter.optional()
|
|
135
135
|
});
|
|
136
|
-
var
|
|
136
|
+
var WorkqueueOrDashboardOptions = z2.object({
|
|
137
137
|
ids: z2.preprocess(
|
|
138
138
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
139
139
|
z2.array(z2.string())
|
|
140
|
-
).describe("Must contain a list of workqueue ids.")
|
|
140
|
+
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
141
141
|
});
|
|
142
142
|
var AllScopeOptions = z2.object({
|
|
143
143
|
...AllRecordScopeOptions.shape,
|
|
144
144
|
...AccessLevelOptions.shape,
|
|
145
|
-
...
|
|
145
|
+
...WorkqueueOrDashboardOptions.shape
|
|
146
146
|
});
|
|
147
147
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
148
148
|
var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
@@ -244,13 +244,21 @@ var Scope = z2.discriminatedUnion("type", [
|
|
|
244
244
|
z2.object({ type: PlainScopeType }),
|
|
245
245
|
...RecordScopeV2.options,
|
|
246
246
|
z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
247
|
-
z2.object({
|
|
247
|
+
z2.object({
|
|
248
|
+
type: z2.literal("workqueue"),
|
|
249
|
+
options: WorkqueueOrDashboardOptions
|
|
250
|
+
}),
|
|
251
|
+
z2.object({
|
|
252
|
+
type: z2.literal("dashboard.view"),
|
|
253
|
+
options: WorkqueueOrDashboardOptions
|
|
254
|
+
})
|
|
248
255
|
]);
|
|
249
256
|
var ScopeType = z2.enum([
|
|
250
257
|
...SystemScopeType.options,
|
|
251
258
|
...RecordScopeTypeV2.options,
|
|
252
259
|
...PlainScopeType.options,
|
|
253
|
-
"workqueue"
|
|
260
|
+
"workqueue",
|
|
261
|
+
"dashboard.view"
|
|
254
262
|
]);
|
|
255
263
|
var EncodedScope = z2.string().brand("EncodedScope");
|
|
256
264
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
@@ -673,6 +681,7 @@ var FieldType = {
|
|
|
673
681
|
SIGNATURE: "SIGNATURE",
|
|
674
682
|
DATA: "DATA",
|
|
675
683
|
BUTTON: "BUTTON",
|
|
684
|
+
AUTOCOMPLETE: "AUTOCOMPLETE",
|
|
676
685
|
SEARCH: "SEARCH",
|
|
677
686
|
ALPHA_PRINT_BUTTON: "ALPHA_PRINT_BUTTON",
|
|
678
687
|
HTTP: "HTTP",
|
|
@@ -850,6 +859,11 @@ var AgeValue = z12.object({
|
|
|
850
859
|
asOfDateRef: z12.string()
|
|
851
860
|
});
|
|
852
861
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
862
|
+
var AutocompleteValue = z12.object({
|
|
863
|
+
label: z12.string(),
|
|
864
|
+
value: z12.string()
|
|
865
|
+
});
|
|
866
|
+
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
853
867
|
var TimeValue = z12.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
854
868
|
var DatetimeValue = z12.iso.datetime();
|
|
855
869
|
var SelectDateRangeValue = z12.enum([
|
|
@@ -896,7 +910,9 @@ var LeafFieldValues = z12.union([
|
|
|
896
910
|
IdReaderFieldValue,
|
|
897
911
|
NumberWithUnitFieldValue,
|
|
898
912
|
NumberWithUnitFieldUpdateValue,
|
|
899
|
-
CustomFieldValue
|
|
913
|
+
CustomFieldValue,
|
|
914
|
+
AutocompleteValue,
|
|
915
|
+
AutocompleteUpdateValue
|
|
900
916
|
]);
|
|
901
917
|
var FieldGroupValue = z12.record(z12.string(), LeafFieldValues);
|
|
902
918
|
var DataFieldValue = z12.object({
|
|
@@ -978,7 +994,8 @@ var FieldUpdateValue = safeUnion([
|
|
|
978
994
|
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
979
995
|
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
980
996
|
CustomFieldValue.describe("CustomFieldValue"),
|
|
981
|
-
HiddenFieldValue.describe("HiddenFieldValue")
|
|
997
|
+
HiddenFieldValue.describe("HiddenFieldValue"),
|
|
998
|
+
AutocompleteUpdateValue.describe("AutocompleteUpdateValue")
|
|
982
999
|
]);
|
|
983
1000
|
|
|
984
1001
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
@@ -1475,8 +1492,8 @@ var QueryExpression = import_v4.z.object({
|
|
|
1475
1492
|
"legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1476
1493
|
"legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
|
|
1477
1494
|
"legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
|
|
1478
|
-
createdAtLocation: import_v4.z.optional(Within),
|
|
1479
|
-
updatedAtLocation: import_v4.z.optional(Within),
|
|
1495
|
+
createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1496
|
+
updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1480
1497
|
assignedTo: import_v4.z.optional(Exact),
|
|
1481
1498
|
createdByUserType: import_v4.z.optional(ExactUserType),
|
|
1482
1499
|
updatedByUserRole: import_v4.z.optional(Exact),
|
|
@@ -1813,17 +1830,14 @@ var ImageViewField = BaseField.extend({
|
|
|
1813
1830
|
}).describe("A read-only image component for form pages");
|
|
1814
1831
|
var Paragraph = BaseField.extend({
|
|
1815
1832
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
1816
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1817
1833
|
configuration: ParagraphConfiguration
|
|
1818
1834
|
}).describe("A read-only HTML <p> paragraph");
|
|
1819
1835
|
var Heading = BaseField.extend({
|
|
1820
1836
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
1821
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1822
1837
|
configuration: HeadingConfiguration
|
|
1823
1838
|
}).describe("A read-only heading component for form pages");
|
|
1824
1839
|
var PageHeader = BaseField.extend({
|
|
1825
|
-
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
1826
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
1840
|
+
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
1827
1841
|
}).describe("A read-only header component for form pages");
|
|
1828
1842
|
var File = BaseField.extend({
|
|
1829
1843
|
type: import_v43.default.literal(FieldType.FILE),
|
|
@@ -1873,7 +1887,6 @@ var RadioGroup = BaseField.extend({
|
|
|
1873
1887
|
}).describe("Grouped radio options");
|
|
1874
1888
|
var BulletList = BaseField.extend({
|
|
1875
1889
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
1876
|
-
defaultValue: TextValue.optional(),
|
|
1877
1890
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
1878
1891
|
configuration: import_v43.default.object({
|
|
1879
1892
|
styles: import_v43.default.object({
|
|
@@ -1979,7 +1992,7 @@ var LocationInput = BaseField.extend({
|
|
|
1979
1992
|
configuration: import_v43.default.object({
|
|
1980
1993
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1981
1994
|
allowedLocations: AllowedLocations
|
|
1982
|
-
})
|
|
1995
|
+
}).optional()
|
|
1983
1996
|
}).describe("Input field for a location");
|
|
1984
1997
|
var FileUploadWithOptions = BaseField.extend({
|
|
1985
1998
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
@@ -2055,16 +2068,32 @@ var DataField = BaseField.extend({
|
|
|
2055
2068
|
data: import_v43.default.array(DataEntry)
|
|
2056
2069
|
})
|
|
2057
2070
|
}).describe("Data field for displaying read-only data");
|
|
2071
|
+
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2072
|
+
var ButtonType = import_v43.default.enum([
|
|
2073
|
+
"primary",
|
|
2074
|
+
"secondary",
|
|
2075
|
+
"tertiary",
|
|
2076
|
+
"positive",
|
|
2077
|
+
"negative",
|
|
2078
|
+
"secondaryNegative",
|
|
2079
|
+
"icon",
|
|
2080
|
+
"iconPrimary"
|
|
2081
|
+
]);
|
|
2082
|
+
var TextColor = import_v43.default.enum(["primary", "copy"]);
|
|
2083
|
+
var TextVariant = import_v43.default.enum(["bold14", "reg14"]);
|
|
2084
|
+
var ButtonConfiguration = import_v43.default.object({
|
|
2085
|
+
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit."),
|
|
2086
|
+
loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
2087
|
+
buttonSize: ButtonSize.optional().describe("Size of the button."),
|
|
2088
|
+
buttonType: ButtonType.optional().describe("Type of the button."),
|
|
2089
|
+
textColor: TextColor.optional().describe("Color of the text."),
|
|
2090
|
+
textVariant: TextVariant.optional().describe("Variant of the text."),
|
|
2091
|
+
text: TranslationConfig.describe("Text to display on the button")
|
|
2092
|
+
});
|
|
2058
2093
|
var ButtonField = BaseField.extend({
|
|
2059
2094
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2060
2095
|
defaultValue: ButtonFieldValue.optional(),
|
|
2061
|
-
configuration:
|
|
2062
|
-
icon: import_v43.default.string().optional().describe(
|
|
2063
|
-
"Icon for the button. You can find icons from OpenCRVS UI-Kit."
|
|
2064
|
-
),
|
|
2065
|
-
loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
2066
|
-
text: TranslationConfig.describe("Text to display on the button")
|
|
2067
|
-
})
|
|
2096
|
+
configuration: ButtonConfiguration
|
|
2068
2097
|
}).describe("Generic button without any built-in functionality");
|
|
2069
2098
|
var FieldGroup = BaseField.extend({
|
|
2070
2099
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
@@ -2096,6 +2125,19 @@ var HttpField = BaseField.extend({
|
|
|
2096
2125
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2097
2126
|
})
|
|
2098
2127
|
}).describe("HTTP request function triggered by a button click or other event");
|
|
2128
|
+
var AutocompleteField = BaseField.extend({
|
|
2129
|
+
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2130
|
+
configuration: import_v43.default.object({
|
|
2131
|
+
url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
|
|
2132
|
+
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2133
|
+
defaultOptions: import_v43.default.array(
|
|
2134
|
+
import_v43.default.object({
|
|
2135
|
+
label: import_v43.default.string(),
|
|
2136
|
+
value: import_v43.default.string()
|
|
2137
|
+
})
|
|
2138
|
+
).optional()
|
|
2139
|
+
})
|
|
2140
|
+
}).describe("Autocomplete input field");
|
|
2099
2141
|
var SearchField = HttpField.extend({
|
|
2100
2142
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2101
2143
|
configuration: SearchQuery.pick({
|
|
@@ -2181,8 +2223,11 @@ var CustomField = BaseField.extend({
|
|
|
2181
2223
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2182
2224
|
configuration: import_v43.default.unknown().optional()
|
|
2183
2225
|
});
|
|
2226
|
+
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2184
2227
|
var LoaderField = BaseField.extend({
|
|
2185
2228
|
type: import_v43.default.literal(FieldType.LOADER),
|
|
2229
|
+
variant: FieldStyleVariant.default("default").optional(),
|
|
2230
|
+
hideLabel: import_v43.default.boolean().default(true).optional().describe("Loader field does not show a label by default"),
|
|
2186
2231
|
configuration: import_v43.default.object({
|
|
2187
2232
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2188
2233
|
})
|
|
@@ -2239,6 +2284,7 @@ var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
|
2239
2284
|
ButtonField,
|
|
2240
2285
|
AlphaPrintButton,
|
|
2241
2286
|
HttpField,
|
|
2287
|
+
AutocompleteField,
|
|
2242
2288
|
LinkButtonField,
|
|
2243
2289
|
VerificationStatus,
|
|
2244
2290
|
QrReaderField,
|
|
@@ -3615,6 +3661,9 @@ var _EventConfigBase = z33.object({
|
|
|
3615
3661
|
),
|
|
3616
3662
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
3617
3663
|
"Configuration of flags associated with the actions of this event type."
|
|
3664
|
+
),
|
|
3665
|
+
analytics: z33.boolean().optional().default(true).describe(
|
|
3666
|
+
"Indicates whether the records of this event type are included in analytics"
|
|
3618
3667
|
)
|
|
3619
3668
|
});
|
|
3620
3669
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -3875,8 +3924,12 @@ var SerializedQueryExpression = z35.object({
|
|
|
3875
3924
|
"legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
|
|
3876
3925
|
"legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
|
|
3877
3926
|
"legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
|
|
3878
|
-
createdAtLocation: z35.optional(
|
|
3879
|
-
|
|
3927
|
+
createdAtLocation: z35.optional(
|
|
3928
|
+
z35.union([SerializableWithin, SerializableExact])
|
|
3929
|
+
),
|
|
3930
|
+
updatedAtLocation: z35.optional(
|
|
3931
|
+
z35.union([SerializableWithin, SerializableExact])
|
|
3932
|
+
),
|
|
3880
3933
|
updatedByUserRole: z35.optional(SerializableExact),
|
|
3881
3934
|
assignedTo: z35.optional(SerializableExact),
|
|
3882
3935
|
createdBy: z35.optional(SerializableExact),
|
|
@@ -6797,7 +6850,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
6797
6850
|
[ActionType.NOTIFY]: ["record.notify"],
|
|
6798
6851
|
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
6799
6852
|
[ActionType.EDIT]: ["record.edit"],
|
|
6800
|
-
[ActionType.DELETE]: ["record.declare"],
|
|
6853
|
+
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
6801
6854
|
[ActionType.REGISTER]: ["record.register"],
|
|
6802
6855
|
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
6803
6856
|
[ActionType.REQUEST_CORRECTION]: [
|