@raytio/decrypt-helper 6.0.0 → 6.1.0
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/package.json +12 -3
- package/dist/api/authedFetch.d.ts +0 -1
- package/dist/api/authedFetch.js +0 -32
- package/dist/api/fetchAA.d.ts +0 -3
- package/dist/api/fetchAA.js +0 -19
- package/dist/api/fetchEnvConfig.d.ts +0 -6
- package/dist/api/fetchEnvConfig.js +0 -39
- package/dist/api/fetchInstanceData.d.ts +0 -3
- package/dist/api/fetchInstanceData.js +0 -21
- package/dist/api/getFiles.d.ts +0 -4
- package/dist/api/getFiles.js +0 -78
- package/dist/api/getLookupOption.d.ts +0 -2
- package/dist/api/getLookupOption.js +0 -32
- package/dist/api/getSchema.d.ts +0 -3
- package/dist/api/getSchema.js +0 -23
- package/dist/api/index.d.ts +0 -9
- package/dist/api/index.js +0 -25
- package/dist/api/resolveVerificationDetails.d.ts +0 -11
- package/dist/api/resolveVerificationDetails.js +0 -36
- package/dist/api/signIn.d.ts +0 -7
- package/dist/api/signIn.js +0 -56
- package/dist/api/updateInstanceData.d.ts +0 -2
- package/dist/api/updateInstanceData.js +0 -19
- package/dist/configureEnv.d.ts +0 -1
- package/dist/configureEnv.js +0 -30
- package/dist/constants.d.ts +0 -23
- package/dist/constants.js +0 -45
- package/dist/helpers/file.d.ts +0 -13
- package/dist/helpers/file.js +0 -17
- package/dist/helpers/formatOutput.d.ts +0 -28
- package/dist/helpers/formatOutput.js +0 -92
- package/dist/helpers/index.d.ts +0 -6
- package/dist/helpers/index.js +0 -22
- package/dist/helpers/json2csv.d.ts +0 -2
- package/dist/helpers/json2csv.js +0 -24
- package/dist/helpers/lookup.d.ts +0 -2
- package/dist/helpers/lookup.js +0 -22
- package/dist/helpers/setupMaxcryptor.d.ts +0 -4
- package/dist/helpers/setupMaxcryptor.js +0 -28
- package/dist/helpers/splitPOAndVers.d.ts +0 -2
- package/dist/helpers/splitPOAndVers.js +0 -11
- package/dist/helpers/types.d.ts +0 -1
- package/dist/helpers/types.js +0 -9
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -18
- package/dist/locales/index.d.ts +0 -44
- package/dist/locales/index.js +0 -22
- package/dist/locales/translations/en.json +0 -33
- package/dist/pdf/components/FieldVerificationBadge.d.ts +0 -6
- package/dist/pdf/components/FieldVerificationBadge.js +0 -19
- package/dist/pdf/components/Images.d.ts +0 -6
- package/dist/pdf/components/Images.js +0 -19
- package/dist/pdf/components/InnerTableRows.d.ts +0 -11
- package/dist/pdf/components/InnerTableRows.js +0 -37
- package/dist/pdf/components/POVerificationBadge.d.ts +0 -8
- package/dist/pdf/components/POVerificationBadge.js +0 -41
- package/dist/pdf/components/Report.d.ts +0 -13
- package/dist/pdf/components/Report.js +0 -98
- package/dist/pdf/components/Subheader.d.ts +0 -2
- package/dist/pdf/components/Subheader.js +0 -28
- package/dist/pdf/components/Table.d.ts +0 -9
- package/dist/pdf/components/Table.js +0 -47
- package/dist/pdf/components/TableTitle.d.ts +0 -5
- package/dist/pdf/components/TableTitle.js +0 -17
- package/dist/pdf/components/ValidationDisplay.d.ts +0 -5
- package/dist/pdf/components/ValidationDisplay.js +0 -29
- package/dist/pdf/components/VerifyBox.d.ts +0 -9
- package/dist/pdf/components/VerifyBox.js +0 -19
- package/dist/pdf/components/pieChart.d.ts +0 -6
- package/dist/pdf/components/pieChart.js +0 -27
- package/dist/pdf/constants.d.ts +0 -3
- package/dist/pdf/constants.js +0 -12
- package/dist/pdf/helpers/general.d.ts +0 -8
- package/dist/pdf/helpers/general.js +0 -37
- package/dist/pdf/helpers/transform.d.ts +0 -4
- package/dist/pdf/helpers/transform.js +0 -39
- package/dist/pdf/style.d.ts +0 -10
- package/dist/pdf/style.js +0 -24
- package/dist/public-methods/generatePDF.d.ts +0 -4
- package/dist/public-methods/generatePDF.js +0 -59
- package/dist/public-methods/getAndValidateConfig.d.ts +0 -8
- package/dist/public-methods/getAndValidateConfig.js +0 -20
- package/dist/public-methods/processSubmission.d.ts +0 -49
- package/dist/public-methods/processSubmission.js +0 -128
- package/dist/public-methods/saveToS3Bucket.d.ts +0 -2
- package/dist/public-methods/saveToS3Bucket.js +0 -58
- package/dist/public-methods/version.d.ts +0 -2
- package/dist/public-methods/version.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raytio/decrypt-helper",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"author": "Raytio",
|
|
5
5
|
"description": "A helper to decrypt data shared by Raytio users",
|
|
6
6
|
"main": "dist",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"babel-preset-react-app": "^10.0.1",
|
|
45
45
|
"dotenv": "^16.0.3",
|
|
46
46
|
"eslint": "^8.38.0",
|
|
47
|
-
"eslint-config-kyle": "^11.
|
|
47
|
+
"eslint-config-kyle": "^11.14.2",
|
|
48
48
|
"jest": "^29.5.0",
|
|
49
49
|
"jest-image-snapshot": "^6.1.0",
|
|
50
50
|
"jest-junit": "^16.0.0",
|
|
@@ -61,7 +61,16 @@
|
|
|
61
61
|
"react/react-in-jsx-scope": 0,
|
|
62
62
|
"react/style-prop-object": 0,
|
|
63
63
|
"react/no-unknown-property": 0,
|
|
64
|
-
"
|
|
64
|
+
"unicorn/prevent-abbreviations": [
|
|
65
|
+
1,
|
|
66
|
+
{
|
|
67
|
+
"replacements": {
|
|
68
|
+
"i": false,
|
|
69
|
+
"env": false,
|
|
70
|
+
"props": false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
],
|
|
65
74
|
"@typescript-eslint/no-unused-vars": [
|
|
66
75
|
2,
|
|
67
76
|
{
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function authedFetch<T>(apiToken: string, url: string, options?: RequestInit, retrying?: boolean): Promise<T>;
|
package/dist/api/authedFetch.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.authedFetch = void 0;
|
|
13
|
-
function authedFetch(apiToken, url, options, retrying = false) {
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
console.log(`[API] ${retrying ? "Retry" : "Start"} ${url}`);
|
|
16
|
-
const startTime = +new Date();
|
|
17
|
-
const req = yield fetch(url, Object.assign(Object.assign({}, options), { headers: { Authorization: `Bearer ${apiToken}` } }));
|
|
18
|
-
const apiResp = yield req.json();
|
|
19
|
-
if (apiResp.message) {
|
|
20
|
-
if (!retrying && req.status === 504) {
|
|
21
|
-
console.log(`[API] Error ${req.status} (will retry) ${url}`);
|
|
22
|
-
return authedFetch(apiToken, url, options, true);
|
|
23
|
-
}
|
|
24
|
-
console.log(`[API] Error ${req.status} (no retry) ${url}`);
|
|
25
|
-
throw new Error(`Failed due to API Error from ${url}: "${apiResp.message}"`);
|
|
26
|
-
}
|
|
27
|
-
const totalTime = ((+new Date() - startTime) / 1000).toFixed(1);
|
|
28
|
-
console.log(`[API] Finish${retrying ? " after retry" : ""} (${totalTime}s) ${url}`);
|
|
29
|
-
return apiResp;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.authedFetch = authedFetch;
|
package/dist/api/fetchAA.d.ts
DELETED
package/dist/api/fetchAA.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.fetchAA = void 0;
|
|
13
|
-
const authedFetch_1 = require("./authedFetch");
|
|
14
|
-
function fetchAA(apiToken, envConfig, aId) {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
return (0, authedFetch_1.authedFetch)(apiToken, `${envConfig.api_url}/share/v2/access_application/${aId}`);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
exports.fetchAA = fetchAA;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
declare const PARAMS: readonly ["cognito_region", "cognito_user_pool_id", "cognito_web_client_id", "api_url", "app_name", "logo_url"];
|
|
2
|
-
export type EnvConfig = Record<(typeof PARAMS)[number], string> & {
|
|
3
|
-
clientUrl: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function fetchEnvConfig(clientUrl: string): Promise<EnvConfig>;
|
|
6
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.fetchEnvConfig = void 0;
|
|
13
|
-
const PARAMS = [
|
|
14
|
-
"cognito_region",
|
|
15
|
-
"cognito_user_pool_id",
|
|
16
|
-
"cognito_web_client_id",
|
|
17
|
-
"api_url",
|
|
18
|
-
"app_name",
|
|
19
|
-
"logo_url", // must be a URL to a png file
|
|
20
|
-
];
|
|
21
|
-
const DEFAULTS = {
|
|
22
|
-
app_name: "Raytio",
|
|
23
|
-
logo_url: undefined,
|
|
24
|
-
};
|
|
25
|
-
function fetchEnvConfig(clientUrl) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
try {
|
|
28
|
-
const envConfig = Object.assign(Object.assign({}, DEFAULTS), (yield fetch(`${clientUrl}/client_config.json`).then((r) => r.json())));
|
|
29
|
-
const missing = PARAMS.filter((p) => !(p in envConfig));
|
|
30
|
-
if (missing.length)
|
|
31
|
-
throw new Error(`Missing: ${missing.join(", ")}`);
|
|
32
|
-
return Object.assign(Object.assign({}, envConfig), { clientUrl });
|
|
33
|
-
}
|
|
34
|
-
catch (ex) {
|
|
35
|
-
throw new Error(`The CLIENT_URL you specified is not a valid Raytio client. Are you sure you used the client URL, not the API url? You supplied: "${clientUrl}" (${ex})`);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
exports.fetchEnvConfig = fetchEnvConfig;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.fetchInstanceData = void 0;
|
|
13
|
-
const core_1 = require("@raytio/core");
|
|
14
|
-
const authedFetch_1 = require("./authedFetch");
|
|
15
|
-
function fetchInstanceData(apiToken, envConfig, instanceId) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const instance = yield (0, authedFetch_1.authedFetch)(apiToken, `${envConfig.api_url}/share/v2/access_application/instance/${instanceId}`).then(core_1.cleanInstance);
|
|
18
|
-
return instance;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
exports.fetchInstanceData = fetchInstanceData;
|
package/dist/api/getFiles.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Instance, NId, ProfileObject } from "@raytio/types";
|
|
2
|
-
import { ApplicationEncryptorLike } from "../types";
|
|
3
|
-
import { EnvConfig } from "./fetchEnvConfig";
|
|
4
|
-
export declare function getFiles(profileObjects: ProfileObject[], instance: Instance, apiToken: string, envConfig: EnvConfig, applicationDecryptor: ApplicationEncryptorLike): Promise<Record<NId, [dataUrl: string, fileExtension: string]>>;
|
package/dist/api/getFiles.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getFiles = void 0;
|
|
13
|
-
const core_1 = require("@raytio/core");
|
|
14
|
-
const mime_types_1 = require("mime-types");
|
|
15
|
-
const file_1 = require("../helpers/file");
|
|
16
|
-
const authedFetch_1 = require("./authedFetch");
|
|
17
|
-
const TEMP_OBJ_PREFIX = "urn:temp_object:";
|
|
18
|
-
const getFileExtn = (b64) => { var _a; return (0, mime_types_1.extension)(((_a = b64.split(":")[1]) === null || _a === void 0 ? void 0 : _a.split(";base64,")[0]) || "text/plain") || "txt"; };
|
|
19
|
-
const decryptFile = (encryptedData, encryptedObj, applicationDecryptor, wdek) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const clonedEncryptedObj = JSON.parse(JSON.stringify(encryptedObj));
|
|
21
|
-
clonedEncryptedObj.encrypted_data.data = encryptedData;
|
|
22
|
-
const decrypted = yield applicationDecryptor.decrypt(clonedEncryptedObj, wdek);
|
|
23
|
-
return decrypted;
|
|
24
|
-
});
|
|
25
|
-
const cleanApiResponse = (responseBody) => {
|
|
26
|
-
try {
|
|
27
|
-
const realB64 = Buffer.from(responseBody, "base64").toString("binary");
|
|
28
|
-
if (realB64.slice(0, 5) === "data:") {
|
|
29
|
-
return realB64;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (_a) {
|
|
33
|
-
// for some reason we need to do this...
|
|
34
|
-
}
|
|
35
|
-
return responseBody;
|
|
36
|
-
};
|
|
37
|
-
function getFiles(profileObjects, instance, apiToken, envConfig, applicationDecryptor) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
// [nId: NId, fieldName: string, file: RaytFile][]
|
|
40
|
-
const urnOrEncryptedList = profileObjects.flatMap((PO) => {
|
|
41
|
-
return Object.entries(PO.properties)
|
|
42
|
-
.filter((kv) => (0, file_1.isFieldValueFile)(kv[1]))
|
|
43
|
-
.map(([k, v]) => {
|
|
44
|
-
return [
|
|
45
|
-
PO.n_id,
|
|
46
|
-
v.n_id,
|
|
47
|
-
k,
|
|
48
|
-
"content" in v ? v.content : v.Content,
|
|
49
|
-
];
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
const filesBase64 = yield Promise.all(urnOrEncryptedList.map(([PONId, fileNId, fieldName, urnOrEncrypted]) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
// handle urn:temp_object:
|
|
55
|
-
if (typeof urnOrEncrypted === "string" &&
|
|
56
|
-
urnOrEncrypted.startsWith(TEMP_OBJ_PREFIX)) {
|
|
57
|
-
const url = Buffer.from(urnOrEncrypted.slice(TEMP_OBJ_PREFIX.length), "base64").toString("binary");
|
|
58
|
-
const res = yield fetch(url);
|
|
59
|
-
const b64 = new TextDecoder().decode(yield res.arrayBuffer());
|
|
60
|
-
const type = res.headers.get("content-type") || "text/plain";
|
|
61
|
-
const dataUrl = `data:${type};base64,${b64}`;
|
|
62
|
-
return [fileNId, [dataUrl, getFileExtn(dataUrl)]];
|
|
63
|
-
}
|
|
64
|
-
// TODO: should realB64 be renamed to "realDataUrl"?
|
|
65
|
-
const realB64 = yield (0, authedFetch_1.authedFetch)(apiToken, `${envConfig.api_url}/share/v2/access_application/instance/${instance.i_id}/profile_object/${fileNId}/content`).then(cleanApiResponse);
|
|
66
|
-
if ((0, core_1.isEncrypted)(urnOrEncrypted)) {
|
|
67
|
-
const wdek = (_b = (_a = instance.keys[PONId]) === null || _a === void 0 ? void 0 : _a[fieldName]) === null || _b === void 0 ? void 0 : _b.data;
|
|
68
|
-
if (!wdek)
|
|
69
|
-
return [fileNId, undefined];
|
|
70
|
-
const decryptedDataUrl = yield decryptFile(realB64, urnOrEncrypted, applicationDecryptor, wdek);
|
|
71
|
-
return [fileNId, [decryptedDataUrl, getFileExtn(decryptedDataUrl)]];
|
|
72
|
-
}
|
|
73
|
-
return [fileNId, [realB64, getFileExtn(realB64)]];
|
|
74
|
-
})));
|
|
75
|
-
return Object.fromEntries(filesBase64.filter((file) => { var _a; return !!file[1] && ((_a = file[1][0]) === null || _a === void 0 ? void 0 : _a.includes(",")); }));
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
exports.getFiles = getFiles;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getLookupOption = void 0;
|
|
13
|
-
const authedFetch_1 = require("./authedFetch");
|
|
14
|
-
/**
|
|
15
|
-
* We cache the promise so that only one XHR request is ever sent
|
|
16
|
-
*/
|
|
17
|
-
const cache = new Map();
|
|
18
|
-
function getLookupOption(apiToken, lookup) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const { origin } = new URL(lookup);
|
|
21
|
-
const cached = cache.get(lookup);
|
|
22
|
-
if (cached)
|
|
23
|
-
return cached;
|
|
24
|
-
// if it's a lookup to our own API, then include the IdentityToken
|
|
25
|
-
const promise = origin.endsWith(".rayt.io")
|
|
26
|
-
? (0, authedFetch_1.authedFetch)(apiToken, lookup)
|
|
27
|
-
: fetch(lookup).then((r) => r.json());
|
|
28
|
-
cache.set(lookup, promise);
|
|
29
|
-
return promise;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.getLookupOption = getLookupOption;
|
package/dist/api/getSchema.d.ts
DELETED
package/dist/api/getSchema.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getAllSchema = void 0;
|
|
13
|
-
const core_1 = require("@raytio/core");
|
|
14
|
-
const authedFetch_1 = require("./authedFetch");
|
|
15
|
-
function getAllSchema(envConfig) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const list = yield (0, authedFetch_1.authedFetch)("", `${envConfig.api_url}/db/v1/schema?version_current=eq.true`);
|
|
18
|
-
return list.map((wrappedSchema) => (0, core_1.expandSchema)(wrappedSchema, list, [
|
|
19
|
-
process.env.PDF_LANGUAGE || process.env.DATE_FORMAT || "en-NZ",
|
|
20
|
-
]));
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
exports.getAllSchema = getAllSchema;
|
package/dist/api/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "./authedFetch";
|
|
2
|
-
export * from "./fetchAA";
|
|
3
|
-
export * from "./fetchEnvConfig";
|
|
4
|
-
export * from "./fetchInstanceData";
|
|
5
|
-
export * from "./getFiles";
|
|
6
|
-
export * from "./getSchema";
|
|
7
|
-
export * from "./resolveVerificationDetails";
|
|
8
|
-
export * from "./signIn";
|
|
9
|
-
export * from "./updateInstanceData";
|
package/dist/api/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./authedFetch"), exports);
|
|
18
|
-
__exportStar(require("./fetchAA"), exports);
|
|
19
|
-
__exportStar(require("./fetchEnvConfig"), exports);
|
|
20
|
-
__exportStar(require("./fetchInstanceData"), exports);
|
|
21
|
-
__exportStar(require("./getFiles"), exports);
|
|
22
|
-
__exportStar(require("./getSchema"), exports);
|
|
23
|
-
__exportStar(require("./resolveVerificationDetails"), exports);
|
|
24
|
-
__exportStar(require("./signIn"), exports);
|
|
25
|
-
__exportStar(require("./updateInstanceData"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { VerificationProvider } from "@raytio/types";
|
|
2
|
-
import { EnvConfig } from "./fetchEnvConfig";
|
|
3
|
-
export type ResolvedVerificationProvider = {
|
|
4
|
-
verifier_id?: string;
|
|
5
|
-
verifier_service_id?: string;
|
|
6
|
-
verifier_source_id?: string;
|
|
7
|
-
date?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function resolveVerificationDetails([details]: VerificationProvider[], envConfig: EnvConfig): Promise<ResolvedVerificationProvider | undefined>;
|
|
10
|
-
/** @deprecated - for use in unit tests only */
|
|
11
|
-
export declare const clearCache: () => void;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.clearCache = exports.resolveVerificationDetails = void 0;
|
|
13
|
-
let verifiersPromise;
|
|
14
|
-
function resolveVerificationDetails([details], envConfig) {
|
|
15
|
-
var _a, _b, _c, _d;
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
if (!details)
|
|
18
|
-
return undefined;
|
|
19
|
-
verifiersPromise || (verifiersPromise = fetch(`${envConfig.clientUrl}/verifiers.json`)
|
|
20
|
-
.then((r) => r.json())
|
|
21
|
-
.catch(() => ({ verifiers: {} })));
|
|
22
|
-
const { verifiers } = yield verifiersPromise;
|
|
23
|
-
return {
|
|
24
|
-
verifier_id: (_a = verifiers[details.verifierNId]) === null || _a === void 0 ? void 0 : _a.name,
|
|
25
|
-
verifier_service_id: (_b = verifiers[details.serviceProviderNId]) === null || _b === void 0 ? void 0 : _b.name,
|
|
26
|
-
verifier_source_id: (_c = verifiers[details.dataSourceNId]) === null || _c === void 0 ? void 0 : _c.name,
|
|
27
|
-
date: (_d = details.date) === null || _d === void 0 ? void 0 : _d.toISOString(),
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
exports.resolveVerificationDetails = resolveVerificationDetails;
|
|
32
|
-
/** @deprecated - for use in unit tests only */
|
|
33
|
-
const clearCache = () => {
|
|
34
|
-
verifiersPromise = null;
|
|
35
|
-
};
|
|
36
|
-
exports.clearCache = clearCache;
|
package/dist/api/signIn.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ICognitoUserAttributeData } from "amazon-cognito-identity-js";
|
|
2
|
-
import { Config } from "../constants";
|
|
3
|
-
import { EnvConfig } from "./fetchEnvConfig";
|
|
4
|
-
export declare function signIn(CONFIG: Config, envConfig: EnvConfig): Promise<{
|
|
5
|
-
apiToken: string;
|
|
6
|
-
cognitoAttributes: ICognitoUserAttributeData[];
|
|
7
|
-
}>;
|
package/dist/api/signIn.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.signIn = void 0;
|
|
13
|
-
const auth_1 = require("@aws-amplify/auth");
|
|
14
|
-
const core_1 = require("@raytio/core");
|
|
15
|
-
/** see #1252 in the client repo */
|
|
16
|
-
function signInWithPasswordMigration(username, password) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
try {
|
|
19
|
-
const userObj = yield auth_1.Auth.signIn(username, password);
|
|
20
|
-
return userObj;
|
|
21
|
-
}
|
|
22
|
-
catch (_a) {
|
|
23
|
-
// if the login fails, try again with their hashed password.
|
|
24
|
-
// if it's successful the second time, we quietly change their password.
|
|
25
|
-
const hashedPassword = yield (0, core_1.hashPassword)(password);
|
|
26
|
-
const userObj = yield auth_1.Auth.signIn(username, hashedPassword);
|
|
27
|
-
// the login was successful. So we need to migrate their account.
|
|
28
|
-
// No changes to the maxcryptor, purely to cognito.
|
|
29
|
-
// we can only migrate their password if there are no login challenges
|
|
30
|
-
if (!userObj.challengeName) {
|
|
31
|
-
console.log("Migrating credentials...");
|
|
32
|
-
yield auth_1.Auth.changePassword(userObj, hashedPassword, password);
|
|
33
|
-
}
|
|
34
|
-
return userObj;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function signIn(CONFIG, envConfig) {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
auth_1.Auth.configure({
|
|
42
|
-
region: envConfig.cognito_region,
|
|
43
|
-
userPoolId: envConfig.cognito_user_pool_id,
|
|
44
|
-
userPoolWebClientId: envConfig.cognito_web_client_id,
|
|
45
|
-
});
|
|
46
|
-
const userObj = yield signInWithPasswordMigration(CONFIG.RAYTIO_USERNAME, CONFIG.RAYTIO_PASSWORD);
|
|
47
|
-
if (userObj.challengeName === "SOFTWARE_TOKEN_MFA") {
|
|
48
|
-
throw new Error(`The configured account (${CONFIG.RAYTIO_USERNAME}) has two factor authentication enabled. You must disable 2FA or use a different account`);
|
|
49
|
-
}
|
|
50
|
-
const user = yield auth_1.Auth.currentAuthenticatedUser();
|
|
51
|
-
const apiToken = (_b = (_a = user.signInUserSession) === null || _a === void 0 ? void 0 : _a.accessToken) === null || _b === void 0 ? void 0 : _b.jwtToken;
|
|
52
|
-
const cognitoAttributes = yield auth_1.Auth.userAttributes(user);
|
|
53
|
-
return { apiToken, cognitoAttributes };
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.signIn = signIn;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.updateInstanceData = void 0;
|
|
13
|
-
const authedFetch_1 = require("./authedFetch");
|
|
14
|
-
function updateInstanceData(apiToken, instance) {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
yield (0, authedFetch_1.authedFetch)(apiToken, `share/v2/access_application/instance/${instance.i_id}`, { method: "PUT", body: JSON.stringify(instance) });
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
exports.updateInstanceData = updateInstanceData;
|
package/dist/configureEnv.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "localstorage-polyfill";
|
package/dist/configureEnv.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const crypto = __importStar(require("node:crypto"));
|
|
27
|
-
// for @aws-amplify/auth
|
|
28
|
-
require("localstorage-polyfill");
|
|
29
|
-
// @ts-expect-error it's not a perfect polyfill..
|
|
30
|
-
globalThis.crypto = crypto; // only required because jest-env-node hides globalThis.crypto
|
package/dist/constants.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ScoreResult } from "@raytio/core";
|
|
2
|
-
import { FieldVerification, Instance, POVerification } from "@raytio/types";
|
|
3
|
-
export declare const ATTRIBUTE_MAP: {
|
|
4
|
-
"custom:kek_derivation": string[];
|
|
5
|
-
"custom:dek_encryption": string[];
|
|
6
|
-
"custom:aek_public": string[];
|
|
7
|
-
"custom:aek_private": string[];
|
|
8
|
-
"custom:ask_public": string[];
|
|
9
|
-
"custom:ask_private": string[];
|
|
10
|
-
};
|
|
11
|
-
export declare const INSTANCE_FIELDS_TO_REMOVE: readonly ["profile_objects", "relationships", "keys", "score"];
|
|
12
|
-
export declare const FIELDS_TO_REMOVE: readonly ["n_id", "document"];
|
|
13
|
-
export declare const ENV_VARIABLES: readonly ["CLIENT_URL", "RAYTIO_USERNAME", "RAYTIO_PASSWORD"];
|
|
14
|
-
export type Config = Record<(typeof ENV_VARIABLES)[number], string>;
|
|
15
|
-
export type InstanceDataToPassOn = Omit<Instance, (typeof INSTANCE_FIELDS_TO_REMOVE)[number]> & {
|
|
16
|
-
score?: ScoreResult;
|
|
17
|
-
};
|
|
18
|
-
export declare const PO_VER_TEXT_MAP: Record<POVerification, string>;
|
|
19
|
-
export declare const FIELD_VER_TEXT_MAP: Record<FieldVerification, string>;
|
|
20
|
-
export declare const SCHEMA: {
|
|
21
|
-
readonly VERIFICATION: "ss_Verification";
|
|
22
|
-
readonly PERSON: "ss_Person_Name";
|
|
23
|
-
};
|
package/dist/constants.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SCHEMA = exports.FIELD_VER_TEXT_MAP = exports.PO_VER_TEXT_MAP = exports.ENV_VARIABLES = exports.FIELDS_TO_REMOVE = exports.INSTANCE_FIELDS_TO_REMOVE = exports.ATTRIBUTE_MAP = void 0;
|
|
4
|
-
const types_1 = require("@raytio/types");
|
|
5
|
-
const locales_1 = require("./locales");
|
|
6
|
-
exports.ATTRIBUTE_MAP = {
|
|
7
|
-
"custom:kek_derivation": ["kek_derivation_config"],
|
|
8
|
-
"custom:dek_encryption": ["private_key_encryption_config"],
|
|
9
|
-
"custom:aek_public": ["encryption_key_pair", "public_key"],
|
|
10
|
-
"custom:aek_private": ["encryption_key_pair", "private_key"],
|
|
11
|
-
"custom:ask_public": ["signing_key_pair", "public_key"],
|
|
12
|
-
"custom:ask_private": ["signing_key_pair", "private_key"],
|
|
13
|
-
};
|
|
14
|
-
exports.INSTANCE_FIELDS_TO_REMOVE = [
|
|
15
|
-
"profile_objects",
|
|
16
|
-
"relationships",
|
|
17
|
-
"keys",
|
|
18
|
-
"score",
|
|
19
|
-
];
|
|
20
|
-
exports.FIELDS_TO_REMOVE = ["n_id", "document"];
|
|
21
|
-
exports.ENV_VARIABLES = [
|
|
22
|
-
"CLIENT_URL",
|
|
23
|
-
"RAYTIO_USERNAME",
|
|
24
|
-
"RAYTIO_PASSWORD",
|
|
25
|
-
];
|
|
26
|
-
exports.PO_VER_TEXT_MAP = {
|
|
27
|
-
[types_1.POVerification.FullyVerified]: (0, locales_1.$$)("POVerification.FullyVerified"),
|
|
28
|
-
[types_1.POVerification.PartiallyVerified]: (0, locales_1.$$)("POVerification.PartiallyVerified"),
|
|
29
|
-
[types_1.POVerification.NotVerified]: (0, locales_1.$$)("POVerification.NotVerified"),
|
|
30
|
-
[types_1.POVerification.Expired]: (0, locales_1.$$)("POVerification.Expired"),
|
|
31
|
-
[types_1.POVerification.VerifiedFalse]: (0, locales_1.$$)("POVerification.VerifiedFalse"),
|
|
32
|
-
// not possible but included here for completeness
|
|
33
|
-
[types_1.POVerification.Encrypted]: (0, locales_1.$$)("POVerification.Encrypted"),
|
|
34
|
-
[types_1.POVerification.Loading]: (0, locales_1.$$)("POVerification.Loading"),
|
|
35
|
-
};
|
|
36
|
-
exports.FIELD_VER_TEXT_MAP = {
|
|
37
|
-
[types_1.FieldVerification.Verified]: (0, locales_1.$$)("FieldVerification.Verified"),
|
|
38
|
-
[types_1.FieldVerification.NotVerified]: (0, locales_1.$$)("FieldVerification.NotVerified"),
|
|
39
|
-
[types_1.FieldVerification.Expired]: (0, locales_1.$$)("FieldVerification.Expired"),
|
|
40
|
-
[types_1.FieldVerification.VerifiedFalse]: (0, locales_1.$$)("FieldVerification.VerifiedFalse"),
|
|
41
|
-
};
|
|
42
|
-
exports.SCHEMA = {
|
|
43
|
-
VERIFICATION: "ss_Verification",
|
|
44
|
-
PERSON: "ss_Person_Name",
|
|
45
|
-
};
|
package/dist/helpers/file.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Encrypted, NId, Urn } from "@raytio/types";
|
|
2
|
-
import type { FlatPO } from "./formatOutput";
|
|
3
|
-
export type RaytFile = {
|
|
4
|
-
n_id: NId;
|
|
5
|
-
content: Urn | Encrypted;
|
|
6
|
-
} | {
|
|
7
|
-
n_id: NId;
|
|
8
|
-
Content: Urn | Encrypted;
|
|
9
|
-
};
|
|
10
|
-
/** checks if a field value is a file */
|
|
11
|
-
export declare const isFieldValueFile: (fieldValue: unknown) => fieldValue is RaytFile;
|
|
12
|
-
/** checks if a PO is a file */
|
|
13
|
-
export declare const isPOFile: (PO: FlatPO) => boolean;
|
package/dist/helpers/file.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPOFile = exports.isFieldValueFile = void 0;
|
|
4
|
-
const core_1 = require("@raytio/core");
|
|
5
|
-
const URN_PREFIX = "urn:";
|
|
6
|
-
/** @internal */
|
|
7
|
-
const isObject = (x) => !!x && typeof x === "object";
|
|
8
|
-
/** @internal */
|
|
9
|
-
const isUrnOrEncrypted = (x) => (typeof x === "string" && x.startsWith(URN_PREFIX)) || (0, core_1.isEncrypted)(x);
|
|
10
|
-
/** checks if a field value is a file */
|
|
11
|
-
const isFieldValueFile = (fieldValue) => isObject(fieldValue) &&
|
|
12
|
-
"content" in fieldValue &&
|
|
13
|
-
isUrnOrEncrypted(fieldValue.content);
|
|
14
|
-
exports.isFieldValueFile = isFieldValueFile;
|
|
15
|
-
/** checks if a PO is a file */
|
|
16
|
-
const isPOFile = (PO) => { var _a; return (0, exports.isFieldValueFile)({ content: (_a = PO.$properties.content) === null || _a === void 0 ? void 0 : _a.value }); };
|
|
17
|
-
exports.isPOFile = isPOFile;
|