@opencrvs/toolkit 2.2.0-rc.045257f → 2.2.0-rc.1a111f2
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/cli.js +925 -356
- package/dist/commons/api/router.d.ts +4 -4
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -0
- package/dist/commons/events/Draft.d.ts +34 -1
- package/dist/commons/events/EventConfig.d.ts +385 -0
- package/dist/commons/events/defineConfig.d.ts +7 -2
- package/dist/commons/events/event.d.ts +4 -1
- package/dist/commons/events/field.d.ts +5 -0
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +57 -5
- package/dist/commons/events/utils.d.ts +13 -0
- package/dist/environment/custom-types.d.ts +1 -0
- package/dist/environment/custom-types.d.ts.map +1 -1
- package/dist/environment/derived-variables.d.ts +8 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +9 -0
- package/dist/environment/questions.d.ts +42 -9
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +70 -47
- package/dist/environment/registry.d.ts +15 -0
- package/dist/environment/registry.d.ts.map +1 -0
- package/dist/environment/registry.js +112 -0
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +98 -23
- package/dist/events/index.js +462 -99
- package/dist/migrations/add-notify-config.d.ts +40 -0
- package/dist/migrations/add-notify-config.d.ts.map +1 -0
- package/dist/migrations/add-notify-config.js +249 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +602 -143
- package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -1
- package/dist/migrations/move-declaration-to-declare-action.js +27 -144
- package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -1
- package/dist/migrations/read-declaration-through-helper.js +3 -61
- package/dist/migrations/resolve-versioned-event-config.d.ts +56 -0
- package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
- package/dist/migrations/resolve-versioned-event-config.js +353 -0
- package/dist/migrations/utils.d.ts +61 -0
- package/dist/migrations/utils.d.ts.map +1 -0
- package/dist/migrations/utils.js +218 -0
- package/dist/notification/index.js +510 -36
- package/dist/templates/charts-values/dependencies/values.yaml +2 -1
- package/dist/templates/charts-values/opencrvs-services/values.yaml +2 -2
- package/dist/verify/endpoints.d.ts +11 -0
- package/dist/verify/endpoints.d.ts.map +1 -1
- package/dist/verify/endpoints.js +21 -27
- package/opencrvs-toolkit-2.2.0-rc.1a111f2.tgz +0 -0
- package/package.json +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/environment/dockerhub.d.ts +0 -15
- package/dist/environment/dockerhub.d.ts.map +0 -1
- package/dist/environment/dockerhub.js +0 -104
- package/opencrvs-toolkit-2.2.0-rc.045257f.tgz +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dockerhub.d.ts","sourceRoot":"","sources":["../../src/environment/dockerhub.ts"],"names":[],"mappings":"AAcA,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EACF,OAAO,GAEP,SAAS,GACT,qBAAqB,GACrB,sBAAsB,GAEtB,aAAa,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,yBAAyB,CAAC,CAoFpC"}
|
|
@@ -1,104 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.validateDockerHubCredentials = validateDockerHubCredentials;
|
|
23
|
-
const DOCKER_HUB_API = 'https://hub.docker.com/v2';
|
|
24
|
-
const REQUEST_TIMEOUT_MS = 10000;
|
|
25
|
-
/**
|
|
26
|
-
* Checks that the username/token pair is accepted by Docker Hub and that the
|
|
27
|
-
* organisation/repository exists and is visible to that account. An empty
|
|
28
|
-
* repository is fine, only its existence matters.
|
|
29
|
-
*
|
|
30
|
-
* Existing GitHub secrets cannot be read back, so when any value is missing
|
|
31
|
-
* (kept from an existing secret) the check is skipped.
|
|
32
|
-
*/
|
|
33
|
-
function validateDockerHubCredentials(organisation, repository, username, token) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
var _a;
|
|
36
|
-
if (!organisation || !repository || !username || !token) {
|
|
37
|
-
return {
|
|
38
|
-
status: 'skipped',
|
|
39
|
-
reason: 'Some values are kept from existing GitHub secrets, which cannot be read back'
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const login = yield fetch(`${DOCKER_HUB_API}/auth/token`, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: { 'Content-Type': 'application/json' },
|
|
46
|
-
body: JSON.stringify({ identifier: username, secret: token }),
|
|
47
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
48
|
-
});
|
|
49
|
-
if (login.status === 401 || login.status === 403) {
|
|
50
|
-
return {
|
|
51
|
-
status: 'invalid-credentials',
|
|
52
|
-
reason: 'Docker Hub rejected the username or token. Check DOCKER_USERNAME and DOCKER_TOKEN'
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
if (!login.ok) {
|
|
56
|
-
return {
|
|
57
|
-
status: 'unreachable',
|
|
58
|
-
reason: `Docker Hub login responded with HTTP ${login.status}`
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const body = (yield login.json());
|
|
62
|
-
const accessToken = (_a = body.access_token) !== null && _a !== void 0 ? _a : body.token;
|
|
63
|
-
if (!accessToken) {
|
|
64
|
-
return {
|
|
65
|
-
status: 'unreachable',
|
|
66
|
-
reason: 'Docker Hub login response did not contain an access token'
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const repositoryResponse = yield fetch(`${DOCKER_HUB_API}/repositories/${encodeURIComponent(organisation)}/${encodeURIComponent(repository)}/`, {
|
|
70
|
-
headers: { Authorization: `Bearer ${accessToken}` },
|
|
71
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
72
|
-
});
|
|
73
|
-
if (repositoryResponse.ok) {
|
|
74
|
-
return { status: 'valid' };
|
|
75
|
-
}
|
|
76
|
-
// Docker Hub answers 404 for private repositories the account cannot see
|
|
77
|
-
if (repositoryResponse.status === 404) {
|
|
78
|
-
return {
|
|
79
|
-
status: 'repository-not-found',
|
|
80
|
-
reason: `Login succeeded, but repository ${organisation}/${repository} was not found or is not accessible with this token. Check DOCKERHUB_ACCOUNT and DOCKERHUB_REPO`
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (repositoryResponse.status === 401 ||
|
|
84
|
-
repositoryResponse.status === 403) {
|
|
85
|
-
return {
|
|
86
|
-
status: 'invalid-credentials',
|
|
87
|
-
reason: `Login succeeded, but the token is not allowed to read repository ${organisation}/${repository}`
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
status: 'unreachable',
|
|
92
|
-
reason: `Docker Hub repository lookup responded with HTTP ${repositoryResponse.status}`
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
if (!(err instanceof Error)) {
|
|
97
|
-
return { status: 'unreachable', reason: String(err) };
|
|
98
|
-
}
|
|
99
|
-
// fetch only reports "fetch failed", the real error (e.g. ENOTFOUND) is its cause
|
|
100
|
-
const cause = err.cause instanceof Error ? `: ${err.cause.message}` : '';
|
|
101
|
-
return { status: 'unreachable', reason: `${err.message}${cause}` };
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
Binary file
|