@opencrvs/toolkit 2.1.0-beta → 2.1.0-beta.2
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/README.md +2 -12
- package/create-countryconfig/index.js +21 -27
- package/dist/application-config/index.js +16 -14
- package/dist/authentication/index.js +6 -2
- package/dist/cli.js +43 -68
- package/dist/commons/api/router.d.ts +6 -42
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionConfig.d.ts +4 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/FieldConfig.d.ts +16 -5
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/utils.d.ts +4 -0
- package/dist/conditionals/index.js +6 -2
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/setup-environment.js +19 -21
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +3 -8
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +4 -0
- package/dist/environment/utils.d.ts +0 -12
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -28
- package/dist/events/index.js +37 -14
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/notification/index.js +20 -14
- package/dist/scopes/index.d.ts +108 -0
- package/dist/scopes/index.js +6 -2
- package/dist/translations/check.d.ts +2 -0
- package/dist/translations/check.d.ts.map +1 -1
- package/dist/translations/check.js +9 -4
- package/dist/verify/endpoints.js +1 -1
- package/opencrvs-toolkit-2.1.0-beta.2.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-beta.tgz +0 -0
package/README.md
CHANGED
|
@@ -55,19 +55,9 @@ Toolkit "re-exports" TRPC router to allow for easy client interaction.
|
|
|
55
55
|
|
|
56
56
|
Toolkit "re-exports" common definitions (e.g. events, conditionals) and make them available through npm.
|
|
57
57
|
|
|
58
|
-
###
|
|
58
|
+
### Publishing
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
1. Update version number in `package.json`
|
|
63
|
-
2. `yarn build:all`
|
|
64
|
-
3. `npm publish`
|
|
65
|
-
|
|
66
|
-
#### Through version control
|
|
67
|
-
|
|
68
|
-
1. Update version number in `package.json`
|
|
69
|
-
2. Create a pull request
|
|
70
|
-
3. Once merged, github action will get triggered.
|
|
60
|
+
Publish via [Publish toolkit to NPM registry](https://github.com/opencrvs/opencrvs-core/actions/workflows/publish-toolkit-to-npm.yml).
|
|
71
61
|
|
|
72
62
|
#### Gotchas, good to know
|
|
73
63
|
|
|
@@ -96,27 +96,29 @@ function getLatestCommonReleaseTag() {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* version (stripped of the "-rc.<sha>" suffix) tells apart two different
|
|
103
|
-
* situations: an RC for a version already being stabilized on its own
|
|
104
|
-
* "release/X.Y.Z" branch (e.g. "2.0.1-rc.*" while a patch release is in
|
|
105
|
-
* progress) versus an RC for a version that hasn't been branched off yet and
|
|
106
|
-
* only exists on develop (e.g. "2.1.0-rc.*" while that release branch hasn't
|
|
107
|
-
* been cut). Scaffold from the release branch when it exists in both
|
|
108
|
-
* repositories, otherwise fall back to develop.
|
|
99
|
+
* Resolves the ref that both repositories are cloned from. A single ref
|
|
100
|
+
* clones both, so every candidate must exist in *both* - a tag present in
|
|
101
|
+
* only one of them can't be used.
|
|
109
102
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
103
|
+
* The exact "v<version>" tag wins whenever it exists: it pins a commit, so
|
|
104
|
+
* a release, an explicit `@X.Y.Z` pin, or a blessed prerelease (npm `@beta`,
|
|
105
|
+
* published from that tag) reproduces however late it's scaffolded.
|
|
106
|
+
*
|
|
107
|
+
* Otherwise a prerelease falls back to a branch, since a rolling release
|
|
108
|
+
* candidate (npm `@next`) is never tagged: "release/X.Y.Z" of the base
|
|
109
|
+
* version when that release has been cut, otherwise develop. A release
|
|
110
|
+
* falls back to the highest tag common to both repositories - never a
|
|
111
|
+
* mismatched pairing of the two at different releases - or errors.
|
|
118
112
|
*/
|
|
119
113
|
function resolveRef() {
|
|
114
|
+
const versionTag = 'v' + version
|
|
115
|
+
if (
|
|
116
|
+
tagExists(CORE_REPO_URL, versionTag) &&
|
|
117
|
+
tagExists(INFRASTRUCTURE_REPO_URL, versionTag)
|
|
118
|
+
) {
|
|
119
|
+
return versionTag
|
|
120
|
+
}
|
|
121
|
+
|
|
120
122
|
if (version.includes('-')) {
|
|
121
123
|
const releaseBranch = 'release/' + version.split('-')[0]
|
|
122
124
|
if (
|
|
@@ -128,19 +130,11 @@ function resolveRef() {
|
|
|
128
130
|
return 'develop'
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
const tag = 'v' + version
|
|
132
|
-
if (
|
|
133
|
-
tagExists(CORE_REPO_URL, tag) &&
|
|
134
|
-
tagExists(INFRASTRUCTURE_REPO_URL, tag)
|
|
135
|
-
) {
|
|
136
|
-
return tag
|
|
137
|
-
}
|
|
138
|
-
|
|
139
133
|
const latestCommonTag = getLatestCommonReleaseTag()
|
|
140
134
|
if (latestCommonTag) {
|
|
141
135
|
console.warn(
|
|
142
136
|
'\nWarning: tag "' +
|
|
143
|
-
|
|
137
|
+
versionTag +
|
|
144
138
|
'" was not found in both repositories; falling back to the latest ' +
|
|
145
139
|
'available release, ' +
|
|
146
140
|
latestCommonTag +
|
|
@@ -762,7 +762,9 @@ var userRole = z13.preprocess(
|
|
|
762
762
|
).describe("User role, e.g. admin, field agent");
|
|
763
763
|
var scopeOptionsPlaceEvent = z13.object({
|
|
764
764
|
event: scopeByEvent,
|
|
765
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
765
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
766
|
+
createdBy: UserFilter.optional(),
|
|
767
|
+
createdIn: JurisdictionFilter.optional()
|
|
766
768
|
}).describe("Options applicable to all record scopes.");
|
|
767
769
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
768
770
|
notifiedIn: JurisdictionFilter.optional(),
|
|
@@ -805,7 +807,9 @@ var AllScopeOptions = z13.object({
|
|
|
805
807
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
806
808
|
var ResolvedScopeOptionsPlaceEvent = z13.object({
|
|
807
809
|
event: scopeByEvent,
|
|
808
|
-
placeOfEvent: UUID.nullish()
|
|
810
|
+
placeOfEvent: UUID.nullish(),
|
|
811
|
+
createdBy: z13.string().optional(),
|
|
812
|
+
createdIn: UUID.nullish()
|
|
809
813
|
}).describe(
|
|
810
814
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
811
815
|
);
|
|
@@ -1912,9 +1916,6 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1912
1916
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1913
1917
|
type: AdministrativeAreas,
|
|
1914
1918
|
allowedLocations: AllowedLocations,
|
|
1915
|
-
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1916
|
-
"List every historical name a location has had as a separate, selectable option."
|
|
1917
|
-
),
|
|
1918
1919
|
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1919
1920
|
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
1920
1921
|
),
|
|
@@ -1932,9 +1933,6 @@ var LocationInput = BaseField.extend({
|
|
|
1932
1933
|
configuration: import_v43.default.object({
|
|
1933
1934
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1934
1935
|
allowedLocations: AllowedLocations,
|
|
1935
|
-
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1936
|
-
"List every historical name a location has had as a separate, selectable option."
|
|
1937
|
-
),
|
|
1938
1936
|
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1939
1937
|
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
1940
1938
|
),
|
|
@@ -1968,7 +1966,6 @@ var Facility = BaseField.extend({
|
|
|
1968
1966
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1969
1967
|
configuration: import_v43.default.object({
|
|
1970
1968
|
allowedLocations: AllowedLocations,
|
|
1971
|
-
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
1972
1969
|
activeOnly: import_v43.default.boolean().optional(),
|
|
1973
1970
|
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
1974
1971
|
}).optional()
|
|
@@ -1978,7 +1975,6 @@ var Office = BaseField.extend({
|
|
|
1978
1975
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1979
1976
|
configuration: import_v43.default.object({
|
|
1980
1977
|
allowedLocations: AllowedLocations,
|
|
1981
|
-
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
1982
1978
|
activeOnly: import_v43.default.boolean().optional(),
|
|
1983
1979
|
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
1984
1980
|
}).optional()
|
|
@@ -2015,9 +2011,6 @@ var Address = BaseField.extend({
|
|
|
2015
2011
|
})
|
|
2016
2012
|
).optional(),
|
|
2017
2013
|
allowedLocations: AllowedLocations,
|
|
2018
|
-
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2019
|
-
"List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2020
|
-
),
|
|
2021
2014
|
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2022
2015
|
"Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
|
|
2023
2016
|
),
|
|
@@ -2078,10 +2071,19 @@ var ButtonField = BaseField.extend({
|
|
|
2078
2071
|
description: "A generic button that can be used to trigger an action",
|
|
2079
2072
|
id: "ButtonField"
|
|
2080
2073
|
});
|
|
2074
|
+
var FieldGroupConfiguration = import_v43.default.object({
|
|
2075
|
+
separator: import_v43.default.string().optional().describe(
|
|
2076
|
+
'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
|
|
2077
|
+
),
|
|
2078
|
+
hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
|
|
2079
|
+
"Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
|
|
2080
|
+
)
|
|
2081
|
+
});
|
|
2081
2082
|
var FieldGroup = BaseField.extend({
|
|
2082
2083
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2083
2084
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2084
|
-
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2085
|
+
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
|
|
2086
|
+
configuration: FieldGroupConfiguration.optional()
|
|
2085
2087
|
}).meta({
|
|
2086
2088
|
description: "A group of fields that are displayed together",
|
|
2087
2089
|
id: "FieldGroup"
|
|
@@ -404,7 +404,9 @@ var userRole = z7.preprocess(
|
|
|
404
404
|
).describe("User role, e.g. admin, field agent");
|
|
405
405
|
var scopeOptionsPlaceEvent = z7.object({
|
|
406
406
|
event: scopeByEvent,
|
|
407
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
407
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
408
|
+
createdBy: UserFilter.optional(),
|
|
409
|
+
createdIn: JurisdictionFilter.optional()
|
|
408
410
|
}).describe("Options applicable to all record scopes.");
|
|
409
411
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
410
412
|
notifiedIn: JurisdictionFilter.optional(),
|
|
@@ -447,7 +449,9 @@ var AllScopeOptions = z7.object({
|
|
|
447
449
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
448
450
|
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
449
451
|
event: scopeByEvent,
|
|
450
|
-
placeOfEvent: UUID.nullish()
|
|
452
|
+
placeOfEvent: UUID.nullish(),
|
|
453
|
+
createdBy: z7.string().optional(),
|
|
454
|
+
createdIn: UUID.nullish()
|
|
451
455
|
}).describe(
|
|
452
456
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
453
457
|
);
|
package/dist/cli.js
CHANGED
|
@@ -503,22 +503,6 @@ function findExistingValue(name, type, scope, existingValues) {
|
|
|
503
503
|
(value) => value.name === name && value.type === type && value.scope === scope
|
|
504
504
|
);
|
|
505
505
|
}
|
|
506
|
-
function storeSecrets(environment, answers) {
|
|
507
|
-
let envConfig = {};
|
|
508
|
-
try {
|
|
509
|
-
envConfig = import_dotenv.default.parse(
|
|
510
|
-
(0, import_fs4.readFileSync)(`${process.cwd()}/.env.${environment}`)
|
|
511
|
-
);
|
|
512
|
-
} catch (error3) {
|
|
513
|
-
envConfig = {};
|
|
514
|
-
}
|
|
515
|
-
const linesFromAnswers = answers.map(
|
|
516
|
-
(update) => `${update.name}="${update.value}"`
|
|
517
|
-
);
|
|
518
|
-
const linesFromEnvConfig = Object.entries(envConfig).filter(([name]) => !answers.find((update) => update.name === name)).map(([name, value]) => `${name}="${value}"`);
|
|
519
|
-
const allLines = [...linesFromEnvConfig, ...linesFromAnswers].sort();
|
|
520
|
-
(0, import_fs4.writeFileSync)(`.env.${environment}`, allLines.join("\n"));
|
|
521
|
-
}
|
|
522
506
|
function readYamlFile(filePath) {
|
|
523
507
|
const fileContent = import_fs4.default.readFileSync(filePath, "utf8");
|
|
524
508
|
return yaml.load(fileContent);
|
|
@@ -538,28 +522,24 @@ function writeYamlFile(filePath, data) {
|
|
|
538
522
|
throw new Error(`Failed to write inventory file: ${error3}`);
|
|
539
523
|
}
|
|
540
524
|
}
|
|
541
|
-
var import_fs4, yaml
|
|
525
|
+
var import_fs4, yaml;
|
|
542
526
|
var init_utils = __esm({
|
|
543
527
|
"src/environment/utils.ts"() {
|
|
544
528
|
"use strict";
|
|
545
529
|
import_fs4 = __toESM(require("fs"));
|
|
546
530
|
yaml = __toESM(require("js-yaml"));
|
|
547
|
-
import_dotenv = __toESM(require("dotenv"));
|
|
548
531
|
}
|
|
549
532
|
});
|
|
550
533
|
|
|
551
534
|
// src/environment/templates.ts
|
|
552
|
-
function getUsers(data) {
|
|
553
|
-
if (!data?.all?.vars?.users) {
|
|
554
|
-
return { users: [] };
|
|
555
|
-
}
|
|
556
|
-
return data.all.vars.users;
|
|
557
|
-
}
|
|
558
535
|
function extractAndModifyUsers(data) {
|
|
559
536
|
if (!data?.all?.vars?.users) {
|
|
560
537
|
return { users: [] };
|
|
561
538
|
}
|
|
562
539
|
const users = data.all.vars.users.map((user) => {
|
|
540
|
+
if (user.role) {
|
|
541
|
+
return user;
|
|
542
|
+
}
|
|
563
543
|
const { sudoer, ...rest } = user;
|
|
564
544
|
return {
|
|
565
545
|
...rest,
|
|
@@ -1247,7 +1227,7 @@ function updateInventoryFile(filePath, users) {
|
|
|
1247
1227
|
function parseInventoryFile(filePath) {
|
|
1248
1228
|
try {
|
|
1249
1229
|
const data = readYamlFile(filePath);
|
|
1250
|
-
return
|
|
1230
|
+
return extractAndModifyUsers(data);
|
|
1251
1231
|
} catch {
|
|
1252
1232
|
return [];
|
|
1253
1233
|
}
|
|
@@ -1705,7 +1685,7 @@ function getAnswers(existingValues) {
|
|
|
1705
1685
|
});
|
|
1706
1686
|
});
|
|
1707
1687
|
}
|
|
1708
|
-
async function promptAndStoreAnswer(
|
|
1688
|
+
async function promptAndStoreAnswer(questions, existingValues) {
|
|
1709
1689
|
log("");
|
|
1710
1690
|
const processedQuestions = questions.flatMap((question) => {
|
|
1711
1691
|
const questionWithVariableLabel = {
|
|
@@ -1784,7 +1764,6 @@ async function promptAndStoreAnswer(environment, questions, existingValues) {
|
|
|
1784
1764
|
}
|
|
1785
1765
|
});
|
|
1786
1766
|
ALL_ANSWERS.push(result);
|
|
1787
|
-
storeSecrets(environment, getAnswers(existingValues));
|
|
1788
1767
|
const existingValuesForQuestions = questions.filter((question) => question.valueType === "VARIABLE").map((question) => [
|
|
1789
1768
|
question.name,
|
|
1790
1769
|
findExistingValue(
|
|
@@ -1796,12 +1775,11 @@ async function promptAndStoreAnswer(environment, questions, existingValues) {
|
|
|
1796
1775
|
]);
|
|
1797
1776
|
return { ...Object.fromEntries(existingValuesForQuestions), ...result };
|
|
1798
1777
|
}
|
|
1799
|
-
var import_core,
|
|
1778
|
+
var import_core, import_kleur4, import_prompts2, ALL_QUESTIONS, ALL_ANSWERS;
|
|
1800
1779
|
var init_setup_environment = __esm({
|
|
1801
1780
|
"src/environment/setup-environment.ts"() {
|
|
1802
1781
|
"use strict";
|
|
1803
1782
|
import_core = require("@octokit/core");
|
|
1804
|
-
import_dotenv2 = __toESM(require("dotenv"));
|
|
1805
1783
|
import_kleur4 = __toESM(require("kleur"));
|
|
1806
1784
|
import_prompts2 = __toESM(require("prompts"));
|
|
1807
1785
|
init_github();
|
|
@@ -1841,11 +1819,7 @@ var init_setup_environment = __esm({
|
|
|
1841
1819
|
}
|
|
1842
1820
|
}
|
|
1843
1821
|
);
|
|
1844
|
-
const { githubToken } = await promptAndStoreAnswer(
|
|
1845
|
-
"",
|
|
1846
|
-
githubTokenQuestion,
|
|
1847
|
-
[]
|
|
1848
|
-
);
|
|
1822
|
+
const { githubToken } = await promptAndStoreAnswer(githubTokenQuestion, []);
|
|
1849
1823
|
const octokit = new import_core.Octokit({
|
|
1850
1824
|
auth: githubToken
|
|
1851
1825
|
});
|
|
@@ -1902,9 +1876,6 @@ var init_setup_environment = __esm({
|
|
|
1902
1876
|
if (!environment) {
|
|
1903
1877
|
process.exit(1);
|
|
1904
1878
|
}
|
|
1905
|
-
import_dotenv2.default.config({
|
|
1906
|
-
path: `${process.cwd()}/.env.${environment}`
|
|
1907
|
-
});
|
|
1908
1879
|
await createEnvironment(
|
|
1909
1880
|
octokit,
|
|
1910
1881
|
environment,
|
|
@@ -1962,17 +1933,12 @@ var init_setup_environment = __esm({
|
|
|
1962
1933
|
"WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n"
|
|
1963
1934
|
)
|
|
1964
1935
|
);
|
|
1965
|
-
await promptAndStoreAnswer(
|
|
1966
|
-
environment,
|
|
1967
|
-
githubOtherQuestions,
|
|
1968
|
-
existingValues
|
|
1969
|
-
);
|
|
1936
|
+
await promptAndStoreAnswer(githubOtherQuestions, existingValues);
|
|
1970
1937
|
}
|
|
1971
1938
|
log("\n", import_kleur4.default.bold().underline("Docker Hub"));
|
|
1972
|
-
await promptAndStoreAnswer(
|
|
1939
|
+
await promptAndStoreAnswer(dockerhubQuestions, existingValues);
|
|
1973
1940
|
log("\n", import_kleur4.default.bold().underline("Kubernetes & Runtime"));
|
|
1974
1941
|
const infrastructure = await promptAndStoreAnswer(
|
|
1975
|
-
environment,
|
|
1976
1942
|
infrastructureQuestions,
|
|
1977
1943
|
existingValues
|
|
1978
1944
|
);
|
|
@@ -2033,7 +1999,7 @@ var init_setup_environment = __esm({
|
|
|
2033
1999
|
import_kleur4.default.bold().green("\u2714"),
|
|
2034
2000
|
import_kleur4.default.bold().yellow(" Disk encryption is enabled")
|
|
2035
2001
|
);
|
|
2036
|
-
await promptAndStoreAnswer(
|
|
2002
|
+
await promptAndStoreAnswer(diskQuestions, existingValues);
|
|
2037
2003
|
} else {
|
|
2038
2004
|
if (!enableEncryption && !encryption_key_defined && environment_exists) {
|
|
2039
2005
|
log(
|
|
@@ -2089,7 +2055,6 @@ var init_setup_environment = __esm({
|
|
|
2089
2055
|
let backupHostPublicKey = "";
|
|
2090
2056
|
if (configureBackup) {
|
|
2091
2057
|
const backupAnswers = await promptAndStoreAnswer(
|
|
2092
|
-
environment,
|
|
2093
2058
|
backupQuestions,
|
|
2094
2059
|
existingValues
|
|
2095
2060
|
);
|
|
@@ -2154,11 +2119,7 @@ var init_setup_environment = __esm({
|
|
|
2154
2119
|
log(import_kleur4.default.bold().green("\u2714"), import_kleur4.default.bold().yellow("Restore is disabled"));
|
|
2155
2120
|
}
|
|
2156
2121
|
log("\n", import_kleur4.default.bold().underline("Monitoring"));
|
|
2157
|
-
await promptAndStoreAnswer(
|
|
2158
|
-
environment,
|
|
2159
|
-
databaseAndMonitoringQuestions,
|
|
2160
|
-
existingValues
|
|
2161
|
-
);
|
|
2122
|
+
await promptAndStoreAnswer(databaseAndMonitoringQuestions, existingValues);
|
|
2162
2123
|
const sentryDSNExists = findExistingValue(
|
|
2163
2124
|
"SENTRY_DSN",
|
|
2164
2125
|
"SECRET",
|
|
@@ -2167,7 +2128,7 @@ var init_setup_environment = __esm({
|
|
|
2167
2128
|
);
|
|
2168
2129
|
log("\n", import_kleur4.default.bold().underline("Sentry"));
|
|
2169
2130
|
if (sentryDSNExists) {
|
|
2170
|
-
await promptAndStoreAnswer(
|
|
2131
|
+
await promptAndStoreAnswer(sentryQuestions, existingValues);
|
|
2171
2132
|
} else {
|
|
2172
2133
|
const { useSentry } = await (0, import_prompts2.default)([
|
|
2173
2134
|
{
|
|
@@ -2178,17 +2139,13 @@ var init_setup_environment = __esm({
|
|
|
2178
2139
|
}
|
|
2179
2140
|
]);
|
|
2180
2141
|
if (useSentry) {
|
|
2181
|
-
await promptAndStoreAnswer(
|
|
2142
|
+
await promptAndStoreAnswer(sentryQuestions, existingValues);
|
|
2182
2143
|
}
|
|
2183
2144
|
}
|
|
2184
2145
|
log("\n", import_kleur4.default.bold().underline("METABASE ADMIN"));
|
|
2185
|
-
await promptAndStoreAnswer(
|
|
2186
|
-
environment,
|
|
2187
|
-
metabaseAdminQuestions,
|
|
2188
|
-
existingValues
|
|
2189
|
-
);
|
|
2146
|
+
await promptAndStoreAnswer(metabaseAdminQuestions, existingValues);
|
|
2190
2147
|
log("\n", import_kleur4.default.bold().underline("SMTP"));
|
|
2191
|
-
await promptAndStoreAnswer(
|
|
2148
|
+
await promptAndStoreAnswer(emailQuestions, existingValues);
|
|
2192
2149
|
const allAnswers = ALL_ANSWERS.reduce((acc, answer) => {
|
|
2193
2150
|
return { ...acc, ...answer };
|
|
2194
2151
|
});
|
|
@@ -2490,7 +2447,12 @@ var init_setup_environment = __esm({
|
|
|
2490
2447
|
name: "RESTORE_HOST",
|
|
2491
2448
|
value: answerOrExisting(
|
|
2492
2449
|
restoreHost,
|
|
2493
|
-
findExistingValue(
|
|
2450
|
+
findExistingValue(
|
|
2451
|
+
"RESTORE_HOST",
|
|
2452
|
+
"VARIABLE",
|
|
2453
|
+
"ENVIRONMENT",
|
|
2454
|
+
existingValues
|
|
2455
|
+
),
|
|
2494
2456
|
(val) => val || ""
|
|
2495
2457
|
),
|
|
2496
2458
|
didExist: findExistingValue(
|
|
@@ -2546,7 +2508,6 @@ var init_setup_environment = __esm({
|
|
|
2546
2508
|
(variable) => Boolean(variable.value) && // Only update values that changed
|
|
2547
2509
|
(variable.type !== "VARIABLE" || variable.value !== variable.didExist?.value)
|
|
2548
2510
|
);
|
|
2549
|
-
storeSecrets(environment, updates);
|
|
2550
2511
|
const newSecrets = updates.filter(
|
|
2551
2512
|
(update) => update.type === "SECRET" && !update.didExist
|
|
2552
2513
|
);
|
|
@@ -2648,6 +2609,12 @@ var init_setup_environment = __esm({
|
|
|
2648
2609
|
if ([].concat(newSecrets).concat(updatedSecrets).concat(newVariables).concat(updatedVariables).length === 0) {
|
|
2649
2610
|
process.exit(0);
|
|
2650
2611
|
}
|
|
2612
|
+
log(
|
|
2613
|
+
import_kleur4.default.bold().red(
|
|
2614
|
+
"\u26A0\uFE0F COPY THESE NOW INTO A PASSWORD MANAGER \u2014 YOU WON'T SEE THEM AGAIN"
|
|
2615
|
+
)
|
|
2616
|
+
);
|
|
2617
|
+
log("");
|
|
2651
2618
|
const saveChanges = await confirm2({
|
|
2652
2619
|
message: "Do you want to continue?",
|
|
2653
2620
|
default: true
|
|
@@ -2803,8 +2770,10 @@ ${addon_message}
|
|
|
2803
2770
|
${import_kleur4.default.yellow("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")}
|
|
2804
2771
|
${import_kleur4.default.yellow("Please KINDLY read hints above")}
|
|
2805
2772
|
`);
|
|
2806
|
-
log(
|
|
2807
|
-
|
|
2773
|
+
log(
|
|
2774
|
+
"\nAll secrets and variables were printed above.",
|
|
2775
|
+
import_kleur4.default.bold().yellow("Store them in a password manager \u2014 they are not saved to disk.")
|
|
2776
|
+
);
|
|
2808
2777
|
})();
|
|
2809
2778
|
}
|
|
2810
2779
|
});
|
|
@@ -2863,6 +2832,10 @@ function updateOptionsInYaml(content, envList) {
|
|
|
2863
2832
|
async function updateWorkflows(envList, config) {
|
|
2864
2833
|
const { workflows } = config;
|
|
2865
2834
|
for (const workflowPath of workflows) {
|
|
2835
|
+
if (!(0, import_fs6.existsSync)(workflowPath)) {
|
|
2836
|
+
log(` \u21B7 Skipped ${workflowPath} (not found in this repository)`);
|
|
2837
|
+
continue;
|
|
2838
|
+
}
|
|
2866
2839
|
try {
|
|
2867
2840
|
const fileContents = (0, import_fs6.readFileSync)(workflowPath, "utf8");
|
|
2868
2841
|
const workflowData = yaml2.load(fileContents);
|
|
@@ -4553,10 +4526,12 @@ function check(cwd) {
|
|
|
4553
4526
|
return { missing, outdated, dynamicIds };
|
|
4554
4527
|
}
|
|
4555
4528
|
function writeMissing(cwd, missing) {
|
|
4556
|
-
const file = readCsvFile(import_path5.default.join(cwd, OWN_FILE))
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4529
|
+
const file = readCsvFile(import_path5.default.join(cwd, OWN_FILE)) ?? {
|
|
4530
|
+
header: "id,description,en",
|
|
4531
|
+
body: [],
|
|
4532
|
+
newline: "\n",
|
|
4533
|
+
trailingNewline: true
|
|
4534
|
+
};
|
|
4560
4535
|
const columns = file.header.split(",");
|
|
4561
4536
|
const rows = missing.map(
|
|
4562
4537
|
(message) => toCsvLine(
|
|
@@ -4778,7 +4753,7 @@ function securedDetail(status) {
|
|
|
4778
4753
|
if (status === "error") {
|
|
4779
4754
|
return `${describeStatus(status)} \u2014 request failed`;
|
|
4780
4755
|
}
|
|
4781
|
-
return `${describeStatus(status)} \u2014 INSECURE:
|
|
4756
|
+
return `${describeStatus(status)} \u2014 INSECURE: ensure this endpoint requires authentication!`;
|
|
4782
4757
|
}
|
|
4783
4758
|
async function runVerifyEndpoints(target = DEFAULT_TARGET_URL) {
|
|
4784
4759
|
const baseUrl = resolveBaseUrl(target);
|
|
@@ -8046,46 +8046,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
8046
8046
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
8047
8047
|
transformer: true;
|
|
8048
8048
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
8049
|
-
record: import("@trpc/server").TRPCMutationProcedure<{
|
|
8050
|
-
input: {
|
|
8051
|
-
operation: "user.create_user";
|
|
8052
|
-
requestData: {
|
|
8053
|
-
subjectId: string;
|
|
8054
|
-
role: string;
|
|
8055
|
-
primaryOfficeId: string;
|
|
8056
|
-
};
|
|
8057
|
-
} | {
|
|
8058
|
-
operation: "user.deactivate" | "user.reactivate";
|
|
8059
|
-
requestData: {
|
|
8060
|
-
subjectId: string;
|
|
8061
|
-
reason: string;
|
|
8062
|
-
comment?: string | undefined;
|
|
8063
|
-
};
|
|
8064
|
-
} | {
|
|
8065
|
-
operation: "user.edit_user" | "user.logged_in" | "user.logged_out" | "user.password_changed" | "user.password_reset" | "user.password_reset_by_admin" | "user.resend_invite" | "user.username_reminder" | "user.username_reminder_by_admin";
|
|
8066
|
-
requestData: {
|
|
8067
|
-
subjectId: string;
|
|
8068
|
-
};
|
|
8069
|
-
} | {
|
|
8070
|
-
operation: "user.email_address_changed";
|
|
8071
|
-
requestData: {
|
|
8072
|
-
subjectId: string;
|
|
8073
|
-
};
|
|
8074
|
-
responseSummary: {
|
|
8075
|
-
email: string;
|
|
8076
|
-
};
|
|
8077
|
-
} | {
|
|
8078
|
-
operation: "user.phone_number_changed";
|
|
8079
|
-
requestData: {
|
|
8080
|
-
subjectId: string;
|
|
8081
|
-
};
|
|
8082
|
-
responseSummary: {
|
|
8083
|
-
phoneNumber: string;
|
|
8084
|
-
};
|
|
8085
|
-
};
|
|
8086
|
-
output: void;
|
|
8087
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
8088
|
-
}>;
|
|
8089
8049
|
list: import("@trpc/server").TRPCQueryProcedure<{
|
|
8090
8050
|
input: {
|
|
8091
8051
|
userId: string;
|
|
@@ -9105,6 +9065,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
9105
9065
|
input: {
|
|
9106
9066
|
name: string;
|
|
9107
9067
|
scopes: string[];
|
|
9068
|
+
credentials?: {
|
|
9069
|
+
clientId: string;
|
|
9070
|
+
clientSecret: string;
|
|
9071
|
+
} | undefined;
|
|
9108
9072
|
};
|
|
9109
9073
|
output: {
|
|
9110
9074
|
clientId: string;
|
|
@@ -9135,7 +9099,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
9135
9099
|
scopes: string[];
|
|
9136
9100
|
status: string;
|
|
9137
9101
|
createdAt: string;
|
|
9138
|
-
createdBy: string & import("zod").$brand<"UUID"
|
|
9102
|
+
createdBy: (string & import("zod").$brand<"UUID">) | null;
|
|
9139
9103
|
}[];
|
|
9140
9104
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
9141
9105
|
}>;
|
|
@@ -9150,7 +9114,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
9150
9114
|
status: string;
|
|
9151
9115
|
shaSecret: string | null;
|
|
9152
9116
|
createdAt: string;
|
|
9153
|
-
createdBy: string & import("zod").$brand<"UUID"
|
|
9117
|
+
createdBy: (string & import("zod").$brand<"UUID">) | null;
|
|
9154
9118
|
};
|
|
9155
9119
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
9156
9120
|
}>;
|
|
@@ -86,16 +86,16 @@ export declare const user: typeof userSerializer & {
|
|
|
86
86
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
87
87
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
88
88
|
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
89
|
-
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
89
|
+
$option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
93
93
|
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
94
|
-
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
94
|
+
$option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
95
95
|
}) => {
|
|
96
96
|
$jurisdiction: "administrativeArea" | "all" | "location" | {
|
|
97
97
|
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
98
|
-
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
98
|
+
$option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
101
|
hasScope: (scope: string) => JSONSchema;
|
|
@@ -368,6 +368,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
368
368
|
id: z.ZodString;
|
|
369
369
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
370
370
|
requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
|
|
371
|
+
showClearButton: z.ZodOptional<z.ZodBoolean>;
|
|
371
372
|
fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
|
|
372
373
|
conditional: z.ZodOptional<z.ZodAny>;
|
|
373
374
|
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
|
|
@@ -375,6 +376,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
375
376
|
id: z.ZodString;
|
|
376
377
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
377
378
|
requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
|
|
379
|
+
showClearButton: z.ZodOptional<z.ZodBoolean>;
|
|
378
380
|
fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
|
|
379
381
|
conditional: z.ZodOptional<z.ZodAny>;
|
|
380
382
|
type: z.ZodLiteral<"VERIFICATION">;
|
|
@@ -424,6 +426,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
424
426
|
id: z.ZodString;
|
|
425
427
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
426
428
|
requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
|
|
429
|
+
showClearButton: z.ZodOptional<z.ZodBoolean>;
|
|
427
430
|
fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
|
|
428
431
|
conditional: z.ZodOptional<z.ZodAny>;
|
|
429
432
|
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
|
|
@@ -431,6 +434,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
431
434
|
id: z.ZodString;
|
|
432
435
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
433
436
|
requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
|
|
437
|
+
showClearButton: z.ZodOptional<z.ZodBoolean>;
|
|
434
438
|
fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
|
|
435
439
|
conditional: z.ZodOptional<z.ZodAny>;
|
|
436
440
|
type: z.ZodLiteral<"VERIFICATION">;
|