@raytio/decrypt-helper 6.3.0 → 6.3.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/dist/api/fetchAA.d.ts +1 -1
- package/dist/api/fetchAA.js +1 -1
- package/dist/api/fetchInstanceData.d.ts +1 -1
- package/dist/api/fetchInstanceData.js +1 -1
- package/dist/api/getFiles.d.ts +2 -2
- package/dist/api/getFiles.js +3 -3
- package/dist/api/getLookupOption.js +1 -1
- package/dist/api/getSchema.d.ts +1 -1
- package/dist/api/getSchema.js +1 -1
- package/dist/api/index.d.ts +9 -9
- package/dist/api/index.js +9 -9
- package/dist/api/resolveVerificationDetails.d.ts +1 -1
- package/dist/api/signIn.d.ts +2 -2
- package/dist/api/updateInstanceData.d.ts +1 -1
- package/dist/api/updateInstanceData.js +1 -1
- package/dist/api/uploadToObjectStore.d.ts +1 -1
- package/dist/api/uploadToObjectStore.js +1 -1
- package/dist/api/videoToImage.d.ts +1 -1
- package/dist/api/videoToImage.js +2 -2
- package/dist/configureEnv.js +16 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +1 -1
- package/dist/helpers/file.d.ts +1 -1
- package/dist/helpers/formatOutput.d.ts +1 -1
- package/dist/helpers/formatOutput.js +5 -5
- package/dist/helpers/index.d.ts +6 -6
- package/dist/helpers/index.js +6 -6
- package/dist/helpers/lookup.js +15 -2
- package/dist/helpers/pathUtils.d.ts +1 -0
- package/dist/helpers/pathUtils.js +6 -0
- package/dist/helpers/setupMaxcryptor.d.ts +3 -3
- package/dist/helpers/setupMaxcryptor.js +5 -4
- package/dist/helpers/splitPOAndVers.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/locales/index.d.ts +2 -34
- package/dist/locales/index.js +4 -1
- package/dist/locales/translations/en.json +31 -31
- package/dist/pdf/components/FieldVerificationBadge.js +1 -1
- package/dist/pdf/components/Images.d.ts +1 -1
- package/dist/pdf/components/Images.js +2 -2
- package/dist/pdf/components/InnerTableRows.d.ts +2 -2
- package/dist/pdf/components/InnerTableRows.js +4 -4
- package/dist/pdf/components/POVerificationBadge.d.ts +1 -1
- package/dist/pdf/components/POVerificationBadge.js +3 -3
- package/dist/pdf/components/Report.d.ts +3 -3
- package/dist/pdf/components/Report.js +12 -12
- package/dist/pdf/components/Subheader.js +2 -2
- package/dist/pdf/components/Table.d.ts +3 -3
- package/dist/pdf/components/Table.js +5 -5
- package/dist/pdf/components/TableTitle.d.ts +1 -1
- package/dist/pdf/components/TableTitle.js +1 -1
- package/dist/pdf/components/ValidationDisplay.js +3 -3
- package/dist/pdf/components/VerifyBox.js +2 -2
- package/dist/pdf/constants.js +1 -1
- package/dist/pdf/helpers/general.js +2 -1
- package/dist/pdf/helpers/transform.js +2 -2
- package/dist/pdf/style.js +1 -1
- package/dist/public-methods/generatePDF.d.ts +1 -1
- package/dist/public-methods/generatePDF.js +5 -4
- package/dist/public-methods/getAndValidateConfig.d.ts +1 -1
- package/dist/public-methods/getAndValidateConfig.js +1 -1
- package/dist/public-methods/processSubmission.d.ts +4 -4
- package/dist/public-methods/processSubmission.js +4 -4
- package/dist/public-methods/saveToS3Bucket.d.ts +1 -1
- package/dist/public-methods/version.js +2 -1
- package/package.json +8 -6
package/dist/api/fetchAA.d.ts
CHANGED
package/dist/api/fetchAA.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authedFetch } from "./authedFetch";
|
|
10
|
+
import { authedFetch } from "./authedFetch.js";
|
|
11
11
|
export function fetchAA(apiToken, envConfig, aId) {
|
|
12
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
13
|
const [AA] = yield authedFetch(apiToken, `${envConfig.api_url}/db/v1/dsm_access_applications?id=eq.${aId}`);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IId, InstanceWithoutData } from "@raytio/types";
|
|
2
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
2
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
3
3
|
export declare function fetchInstanceData(apiToken: string, envConfig: EnvConfig, instanceId: IId): Promise<InstanceWithoutData>;
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authedFetch } from "./authedFetch";
|
|
10
|
+
import { authedFetch } from "./authedFetch.js";
|
|
11
11
|
export function fetchInstanceData(apiToken, envConfig, instanceId) {
|
|
12
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
13
|
const [instance] = yield authedFetch(apiToken, `${envConfig.api_url}/db/v1/dsm_access_application_instances?id=eq.${instanceId}`);
|
package/dist/api/getFiles.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Instance, NId, ProfileObject } from "@raytio/types";
|
|
2
|
-
import type { ApplicationEncryptorLike } from "../types";
|
|
3
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
2
|
+
import type { ApplicationEncryptorLike } from "../types.js";
|
|
3
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
4
4
|
type FileObject = Record<NId, [dataUrl: string, fileExtension: string]>;
|
|
5
5
|
export declare function getFiles(profileObjects: ProfileObject[], instance: Instance, apiToken: string, envConfig: EnvConfig, applicationDecryptor: ApplicationEncryptorLike): Promise<FileObject>;
|
|
6
6
|
export {};
|
package/dist/api/getFiles.js
CHANGED
|
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { getNidFromUrn, isEncrypted } from "@raytio/core";
|
|
11
11
|
import { extension, types } from "mime-types";
|
|
12
|
-
import { isFieldValueFile, isTruthy, isUrn } from "../helpers/file";
|
|
13
|
-
import { authedFetch } from "./authedFetch";
|
|
14
|
-
import { videoToImage } from "./videoToImage";
|
|
12
|
+
import { isFieldValueFile, isTruthy, isUrn } from "../helpers/file.js";
|
|
13
|
+
import { authedFetch } from "./authedFetch.js";
|
|
14
|
+
import { videoToImage } from "./videoToImage.js";
|
|
15
15
|
const TEMP_OBJ_PREFIX = "urn:temp_object:";
|
|
16
16
|
const getFileExtn = (b64) => { var _a; return extension(((_a = b64.split(":")[1]) === null || _a === void 0 ? void 0 : _a.split(";base64,")[0]) || "text/plain") || "txt"; };
|
|
17
17
|
const decryptFile = (encryptedData, encryptedObject, applicationDecryptor, wdek) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authedFetch } from "./authedFetch";
|
|
10
|
+
import { authedFetch } from "./authedFetch.js";
|
|
11
11
|
/**
|
|
12
12
|
* We cache the promise so that only one XHR request is ever sent
|
|
13
13
|
*/
|
package/dist/api/getSchema.d.ts
CHANGED
package/dist/api/getSchema.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { expandSchema } from "@raytio/core";
|
|
11
|
-
import { authedFetch } from "./authedFetch";
|
|
11
|
+
import { authedFetch } from "./authedFetch.js";
|
|
12
12
|
export function getAllSchema(envConfig) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
const list = yield authedFetch("", `${envConfig.api_url}/db/v1/dsm_schema?version_current=eq.true`);
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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";
|
|
1
|
+
export * from "./authedFetch.js";
|
|
2
|
+
export * from "./fetchAA.js";
|
|
3
|
+
export * from "./fetchEnvConfig.js";
|
|
4
|
+
export * from "./fetchInstanceData.js";
|
|
5
|
+
export * from "./getFiles.js";
|
|
6
|
+
export * from "./getSchema.js";
|
|
7
|
+
export * from "./resolveVerificationDetails.js";
|
|
8
|
+
export * from "./signIn.js";
|
|
9
|
+
export * from "./updateInstanceData.js";
|
package/dist/api/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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";
|
|
1
|
+
export * from "./authedFetch.js";
|
|
2
|
+
export * from "./fetchAA.js";
|
|
3
|
+
export * from "./fetchEnvConfig.js";
|
|
4
|
+
export * from "./fetchInstanceData.js";
|
|
5
|
+
export * from "./getFiles.js";
|
|
6
|
+
export * from "./getSchema.js";
|
|
7
|
+
export * from "./resolveVerificationDetails.js";
|
|
8
|
+
export * from "./signIn.js";
|
|
9
|
+
export * from "./updateInstanceData.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VerificationProvider } from "@raytio/types";
|
|
2
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
2
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
3
3
|
export type ResolvedVerificationProvider = {
|
|
4
4
|
verifier_id?: string;
|
|
5
5
|
verifier_service_id?: string;
|
package/dist/api/signIn.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ICognitoUserAttributeData } from "amazon-cognito-identity-js";
|
|
2
|
-
import type { Config } from "../constants";
|
|
3
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
2
|
+
import type { Config } from "../constants.js";
|
|
3
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
4
4
|
export declare function signIn(CONFIG: Config, envConfig: EnvConfig): Promise<{
|
|
5
5
|
apiToken: string;
|
|
6
6
|
cognitoAttributes: ICognitoUserAttributeData[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IId, InstanceWithoutData } from "@raytio/types";
|
|
2
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
2
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
3
3
|
/**
|
|
4
4
|
* only specific fields can be updated, passing the entire
|
|
5
5
|
* instance object to the v3 API will cause an error.
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authedFetch } from "./authedFetch";
|
|
10
|
+
import { authedFetch } from "./authedFetch.js";
|
|
11
11
|
/**
|
|
12
12
|
* only specific fields can be updated, passing the entire
|
|
13
13
|
* instance object to the v3 API will cause an error.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
1
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
2
2
|
export declare function uploadToObjectStore(apiToken: string, envConfig: EnvConfig, dataUrl: string, expiryDate?: Date): Promise<{
|
|
3
3
|
objectStoreId: string;
|
|
4
4
|
retrievalUrl: string;
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authedFetch } from "./authedFetch";
|
|
10
|
+
import { authedFetch } from "./authedFetch.js";
|
|
11
11
|
//
|
|
12
12
|
// this file is mostly copy-pasted from the client repo. If you make
|
|
13
13
|
// a change here, consider making the same change in the client.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { EnvConfig } from "./fetchEnvConfig";
|
|
1
|
+
import type { EnvConfig } from "./fetchEnvConfig.js";
|
|
2
2
|
/** Use the extractor API to get the middle frame from a video */
|
|
3
3
|
export declare function videoToImage(apiToken: string, envConfig: EnvConfig, videoDataUrl: string): Promise<string>;
|
package/dist/api/videoToImage.js
CHANGED
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authedFetch } from "./authedFetch";
|
|
11
|
-
import { uploadToObjectStore } from "./uploadToObjectStore";
|
|
10
|
+
import { authedFetch } from "./authedFetch.js";
|
|
11
|
+
import { uploadToObjectStore } from "./uploadToObjectStore.js";
|
|
12
12
|
/** Use the extractor API to get the middle frame from a video */
|
|
13
13
|
export function videoToImage(apiToken, envConfig, videoDataUrl) {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/configureEnv.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
// for @aws-amplify/auth
|
|
2
11
|
import "localstorage-polyfill";
|
|
3
12
|
// Polyfill crypto for node ≤18.
|
|
4
|
-
|
|
13
|
+
if (!globalThis.crypto) {
|
|
14
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const { webcrypto } = yield import("node:crypto");
|
|
16
|
+
// @ts-expect-error fix
|
|
17
|
+
globalThis.crypto = webcrypto;
|
|
18
|
+
}))();
|
|
19
|
+
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as RaytioCore from "@raytio/core";
|
|
2
2
|
import { FieldVerification, type Instance, POVerification } from "@raytio/types";
|
|
3
3
|
export declare const ATTRIBUTE_MAP: {
|
|
4
4
|
"custom:kek_derivation": string[];
|
|
@@ -13,7 +13,7 @@ export declare const FIELDS_TO_REMOVE: readonly ["n_id", "document"];
|
|
|
13
13
|
export declare const ENV_VARIABLES: readonly ["CLIENT_URL", "RAYTIO_USERNAME", "RAYTIO_PASSWORD"];
|
|
14
14
|
export type Config = Record<(typeof ENV_VARIABLES)[number], string>;
|
|
15
15
|
export type InstanceDataToPassOn = Omit<Instance, (typeof INSTANCE_FIELDS_TO_REMOVE)[number]> & {
|
|
16
|
-
score?: ScoreResult;
|
|
16
|
+
score?: RaytioCore.ScoreResult;
|
|
17
17
|
};
|
|
18
18
|
export declare const PO_VER_TEXT_MAP: Record<POVerification, string>;
|
|
19
19
|
export declare const FIELD_VER_TEXT_MAP: Record<FieldVerification, string>;
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldVerification, POVerification, } from "@raytio/types";
|
|
2
|
-
import { $$ } from "./locales";
|
|
2
|
+
import { $$ } from "./locales/index.js";
|
|
3
3
|
export const ATTRIBUTE_MAP = {
|
|
4
4
|
"custom:kek_derivation": ["kek_derivation_config"],
|
|
5
5
|
"custom:dek_encryption": ["private_key_encryption_config"],
|
package/dist/helpers/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Encrypted, NId, Urn } from "@raytio/types";
|
|
2
|
-
import type { FlatPO } from "./formatOutput";
|
|
2
|
+
import type { FlatPO } from "./formatOutput.js";
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare const isTruthy: <T>(x: "" | 0 | T | null | undefined) => x is T;
|
|
5
5
|
/** @internal */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldVerification, type NId, type POVerification, type ProfileObject, type RealVer, type Schema } from "@raytio/types";
|
|
2
|
-
import { type EnvConfig, type ResolvedVerificationProvider } from "../api";
|
|
2
|
+
import { type EnvConfig, type ResolvedVerificationProvider } from "../api/index.js";
|
|
3
3
|
export type FlatPO = {
|
|
4
4
|
$verification_details: ResolvedVerificationProvider | undefined;
|
|
5
5
|
$shouldBeVerifiedFields: string[] | undefined;
|
|
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { calcSafeHarbourScore, findSchemaLabel, getPOVerification, } from "@raytio/core";
|
|
11
11
|
import { omit } from "ramda";
|
|
12
12
|
import { FieldVerification, } from "@raytio/types";
|
|
13
|
-
import { $$ } from "../locales";
|
|
14
|
-
import { resolveVerificationDetails, } from "../api";
|
|
15
|
-
import { FIELDS_TO_REMOVE, PO_VER_TEXT_MAP, SCHEMA } from "../constants";
|
|
16
|
-
import { maybeGetLookupValue } from "./lookup";
|
|
17
|
-
import { assertSafeProperty } from "./types";
|
|
13
|
+
import { $$ } from "../locales/index.js";
|
|
14
|
+
import { resolveVerificationDetails, } from "../api/index.js";
|
|
15
|
+
import { FIELDS_TO_REMOVE, PO_VER_TEXT_MAP, SCHEMA } from "../constants.js";
|
|
16
|
+
import { maybeGetLookupValue } from "./lookup.js";
|
|
17
|
+
import { assertSafeProperty } from "./types.js";
|
|
18
18
|
const byPriority = (schema) => ([a], [b]) => {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f;
|
|
20
20
|
assertSafeProperty(a);
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./formatOutput";
|
|
2
|
-
export * from "./json2csv";
|
|
3
|
-
export * from "./setupMaxcryptor";
|
|
4
|
-
export * from "./splitPOAndVers";
|
|
5
|
-
export * from "./file";
|
|
6
|
-
export * from "./types";
|
|
1
|
+
export * from "./formatOutput.js";
|
|
2
|
+
export * from "./json2csv.js";
|
|
3
|
+
export * from "./setupMaxcryptor.js";
|
|
4
|
+
export * from "./splitPOAndVers.js";
|
|
5
|
+
export * from "./file.js";
|
|
6
|
+
export * from "./types.js";
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./formatOutput";
|
|
2
|
-
export * from "./json2csv";
|
|
3
|
-
export * from "./setupMaxcryptor";
|
|
4
|
-
export * from "./splitPOAndVers";
|
|
5
|
-
export * from "./file";
|
|
6
|
-
export * from "./types";
|
|
1
|
+
export * from "./formatOutput.js";
|
|
2
|
+
export * from "./json2csv.js";
|
|
3
|
+
export * from "./setupMaxcryptor.js";
|
|
4
|
+
export * from "./splitPOAndVers.js";
|
|
5
|
+
export * from "./file.js";
|
|
6
|
+
export * from "./types.js";
|
package/dist/helpers/lookup.js
CHANGED
|
@@ -7,12 +7,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { getLookupOption } from "../api/getLookupOption";
|
|
10
|
+
import { getLookupOption } from "../api/getLookupOption.js";
|
|
11
11
|
export const maybeGetLookupValue = (schema, k, value, apiToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
12
|
var _a, _b, _c;
|
|
13
13
|
const lookupUrl = (_b = (_a = schema.properties) === null || _a === void 0 ? void 0 : _a[k]) === null || _b === void 0 ? void 0 : _b.lookup;
|
|
14
14
|
if (!lookupUrl)
|
|
15
15
|
return undefined;
|
|
16
|
-
|
|
16
|
+
// Replace environment variables in the lookup URL
|
|
17
|
+
const regex = /{([^}]+)}/g;
|
|
18
|
+
const matches = lookupUrl.match(regex);
|
|
19
|
+
const replaced = matches === null || matches === void 0 ? void 0 : matches.map((match) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const toReplace = match.replace("{", "").replace("}", "");
|
|
22
|
+
return (_a = process.env[toReplace]) !== null && _a !== void 0 ? _a : "";
|
|
23
|
+
});
|
|
24
|
+
const resolvedLookupUrl = matches
|
|
25
|
+
? matches
|
|
26
|
+
.reduce((url, match, i) => { var _a; return url.replace(match, (_a = replaced === null || replaced === void 0 ? void 0 : replaced[i]) !== null && _a !== void 0 ? _a : ""); }, lookupUrl)
|
|
27
|
+
.replaceAll(/([^:]\/)\/+/g, "$1") // replaces doubles slashes (bar http://)
|
|
28
|
+
: lookupUrl;
|
|
29
|
+
const lookup = yield getLookupOption(apiToken, resolvedLookupUrl);
|
|
17
30
|
return (_c = lookup.find((l) => l.key === value)) === null || _c === void 0 ? void 0 : _c.value;
|
|
18
31
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDirname(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as maxcryptor from "@raytio/maxcryptor";
|
|
2
2
|
import type { ICognitoUserAttributeData } from "amazon-cognito-identity-js";
|
|
3
|
-
import { type Config } from "../constants";
|
|
4
|
-
export declare function setupMaxcryptor(CONFIG: Config, cognitoAttributes: ICognitoUserAttributeData[]): Promise<Maxcryptor>;
|
|
3
|
+
import { type Config } from "../constants.js";
|
|
4
|
+
export declare function setupMaxcryptor(CONFIG: Config, cognitoAttributes: ICognitoUserAttributeData[]): Promise<maxcryptor.Maxcryptor>;
|
|
@@ -7,9 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import
|
|
10
|
+
import * as maxcryptor from "@raytio/maxcryptor";
|
|
11
11
|
import { assocPath } from "ramda";
|
|
12
|
-
import { ATTRIBUTE_MAP } from "../constants";
|
|
12
|
+
import { ATTRIBUTE_MAP } from "../constants.js";
|
|
13
|
+
const { encryptorFromExistingUser } = maxcryptor;
|
|
13
14
|
const isMaxcryptorAttribute = (name) => name in ATTRIBUTE_MAP;
|
|
14
15
|
export function setupMaxcryptor(CONFIG, cognitoAttributes) {
|
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -18,7 +19,7 @@ export function setupMaxcryptor(CONFIG, cognitoAttributes) {
|
|
|
18
19
|
return accumulator;
|
|
19
20
|
return assocPath(ATTRIBUTE_MAP[Name], JSON.parse(Value), accumulator);
|
|
20
21
|
}, {});
|
|
21
|
-
const { encryptor:
|
|
22
|
-
return
|
|
22
|
+
const { encryptor: maxcryptorEncryptor } = yield encryptorFromExistingUser(userDocument, CONFIG.RAYTIO_PASSWORD);
|
|
23
|
+
return maxcryptorEncryptor;
|
|
23
24
|
});
|
|
24
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findSchemaLabel } from "@raytio/core";
|
|
2
|
-
import { SCHEMA } from "../constants";
|
|
2
|
+
import { SCHEMA } from "../constants.js";
|
|
3
3
|
export const splitPOAndVers = (list) => list.reduce((accumulator, PO) => {
|
|
4
4
|
const isVerification = findSchemaLabel(PO.labels) === SCHEMA.VERIFICATION;
|
|
5
5
|
// move to the left or right array depending on whther +isVerification is 0 or 1
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./configureEnv";
|
|
2
|
-
export { fetchEnvConfig, EnvConfig } from "./api/fetchEnvConfig";
|
|
3
|
-
export { generatePDF } from "./public-methods/generatePDF";
|
|
4
|
-
export { processSubmission } from "./public-methods/processSubmission";
|
|
5
|
-
export { getAndValidateConfig } from "./public-methods/getAndValidateConfig";
|
|
6
|
-
export { saveToS3Bucket } from "./public-methods/saveToS3Bucket";
|
|
7
|
-
export { version } from "./public-methods/version";
|
|
1
|
+
import "./configureEnv.js";
|
|
2
|
+
export { fetchEnvConfig, EnvConfig } from "./api/fetchEnvConfig.js";
|
|
3
|
+
export { generatePDF } from "./public-methods/generatePDF.js";
|
|
4
|
+
export { processSubmission } from "./public-methods/processSubmission.js";
|
|
5
|
+
export { getAndValidateConfig } from "./public-methods/getAndValidateConfig.js";
|
|
6
|
+
export { saveToS3Bucket } from "./public-methods/saveToS3Bucket.js";
|
|
7
|
+
export { version } from "./public-methods/version.js";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// do this first
|
|
2
|
-
import "./configureEnv";
|
|
2
|
+
import "./configureEnv.js";
|
|
3
3
|
/* this is what consumers of the package have access to */
|
|
4
|
-
export { fetchEnvConfig } from "./api/fetchEnvConfig";
|
|
5
|
-
export { generatePDF } from "./public-methods/generatePDF";
|
|
6
|
-
export { processSubmission } from "./public-methods/processSubmission";
|
|
7
|
-
export { getAndValidateConfig } from "./public-methods/getAndValidateConfig";
|
|
8
|
-
export { saveToS3Bucket } from "./public-methods/saveToS3Bucket";
|
|
9
|
-
export { version } from "./public-methods/version";
|
|
4
|
+
export { fetchEnvConfig } from "./api/fetchEnvConfig.js";
|
|
5
|
+
export { generatePDF } from "./public-methods/generatePDF.js";
|
|
6
|
+
export { processSubmission } from "./public-methods/processSubmission.js";
|
|
7
|
+
export { getAndValidateConfig } from "./public-methods/getAndValidateConfig.js";
|
|
8
|
+
export { saveToS3Bucket } from "./public-methods/saveToS3Bucket.js";
|
|
9
|
+
export { version } from "./public-methods/version.js";
|
package/dist/locales/index.d.ts
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
declare const en: any;
|
|
2
2
|
declare const locales: {
|
|
3
|
-
readonly en:
|
|
4
|
-
"FieldVerification.Expired": string;
|
|
5
|
-
"FieldVerification.NotVerified": string;
|
|
6
|
-
"FieldVerification.Verified": string;
|
|
7
|
-
"FieldVerification.VerifiedFalse": string;
|
|
8
|
-
"Images.file-not-found": string;
|
|
9
|
-
"POVerification.Encrypted": string;
|
|
10
|
-
"POVerification.Expired": string;
|
|
11
|
-
"POVerification.FullyVerified": string;
|
|
12
|
-
"POVerification.Loading": string;
|
|
13
|
-
"POVerification.NotVerified": string;
|
|
14
|
-
"POVerification.PartiallyVerified": string;
|
|
15
|
-
"POVerification.VerifiedFalse": string;
|
|
16
|
-
"POVerificationBadge.safe-harbour-no": string;
|
|
17
|
-
"POVerificationBadge.safe-harbour-yes": string;
|
|
18
|
-
"POVerificationBadge.verified-by": string;
|
|
19
|
-
"Report.footer-private": string;
|
|
20
|
-
"Report.header": string;
|
|
21
|
-
"Report.meta.title": string;
|
|
22
|
-
"Report.pagecount": string;
|
|
23
|
-
"ValidationDisplay.text": string;
|
|
24
|
-
"VerifyBox.text": string;
|
|
25
|
-
"constants.confirmation_code": string;
|
|
26
|
-
"constants.end_date": string;
|
|
27
|
-
"constants.i_id": string;
|
|
28
|
-
"constants.reference": string;
|
|
29
|
-
"constants.score": string;
|
|
30
|
-
"constants.score-category": string;
|
|
31
|
-
"constants.start_date": string;
|
|
32
|
-
"field.boolean.no": string;
|
|
33
|
-
"field.boolean.yes": string;
|
|
34
|
-
"field.undefined": string;
|
|
35
|
-
};
|
|
3
|
+
readonly en: any;
|
|
36
4
|
};
|
|
37
5
|
export type I18nKey = keyof typeof en;
|
|
38
6
|
export type I18nLang = keyof typeof locales;
|
package/dist/locales/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { getDirname } from "../helpers/pathUtils.js";
|
|
4
|
+
const en = JSON.parse(readFileSync(join(getDirname(), "../locales/translations/en.json"), "utf8"));
|
|
2
5
|
const locales = { en };
|
|
3
6
|
export const isValidLocale = (lang) => lang in locales;
|
|
4
7
|
export const $$ = (key, variables) => {
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"FieldVerification.Expired": "Expired",
|
|
3
|
+
"FieldVerification.NotVerified": "Not Verified",
|
|
4
|
+
"FieldVerification.Verified": "Verified",
|
|
5
|
+
"FieldVerification.VerifiedFalse": "Verified False",
|
|
6
|
+
"Images.file-not-found": "File not found",
|
|
7
|
+
"POVerification.Encrypted": "Encrypted",
|
|
8
|
+
"POVerification.Expired": "Expired",
|
|
9
|
+
"POVerification.FullyVerified": "Fully Verified",
|
|
10
|
+
"POVerification.Loading": "Loading...",
|
|
11
|
+
"POVerification.NotVerified": "Not Verified",
|
|
12
|
+
"POVerification.PartiallyVerified": "Partially Verified",
|
|
13
|
+
"POVerification.VerifiedFalse": "Verified False",
|
|
14
|
+
"POVerificationBadge.safe-harbour-no": "Not Safe Harbour Compliant",
|
|
15
|
+
"POVerificationBadge.safe-harbour-yes": "Safe Harbour Compliant",
|
|
16
|
+
"POVerificationBadge.verified-by": "by {verifiedBy}",
|
|
17
|
+
"Report.footer-private": "Private and Confidential",
|
|
18
|
+
"Report.header": "{appName} Verification Report",
|
|
19
|
+
"Report.meta.title": "{appName} Verification Report - {iId}",
|
|
20
|
+
"Report.pagecount": "{currentPage} of {pageCount}",
|
|
21
|
+
"ValidationDisplay.text": "Score: {n}/10",
|
|
22
|
+
"VerifyBox.text": "To verify this submission, scan the QR Code or click here",
|
|
23
|
+
"constants.confirmation_code": "Code",
|
|
24
|
+
"constants.end_date": "Expiry Date",
|
|
25
|
+
"constants.i_id": "Submission ID",
|
|
26
|
+
"constants.reference": "Reference",
|
|
27
|
+
"constants.score": "Score",
|
|
28
|
+
"constants.score-category": "Score Category",
|
|
29
|
+
"constants.start_date": "Date Shared",
|
|
30
|
+
"field.boolean.no": "No",
|
|
31
|
+
"field.boolean.yes": "Yes",
|
|
32
|
+
"field.undefined": "N/A"
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import JsxPdf from "jsx-pdf";
|
|
2
2
|
import { FieldVerification } from "@raytio/types";
|
|
3
|
-
import { loadAsset } from "../helpers/general";
|
|
3
|
+
import { loadAsset } from "../helpers/general.js";
|
|
4
4
|
export const FieldVerificationBadge = ({ status, width, }) => {
|
|
5
5
|
if (status === FieldVerification.VerifiedFalse) {
|
|
6
6
|
return (JsxPdf.createElement("svg", { content: loadAsset("verified_false_small.svg"), width: width }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
|
|
1
|
+
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission.js";
|
|
2
2
|
export declare const Images: ({ nIds, files, }: {
|
|
3
3
|
nIds: string[];
|
|
4
4
|
files: ProcessSubmissionOutput["files"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import JsxPdf from "jsx-pdf";
|
|
2
|
-
import { $$ } from "../../locales";
|
|
3
|
-
import { assertSafeProperty } from "../../helpers";
|
|
2
|
+
import { $$ } from "../../locales/index.js";
|
|
3
|
+
import { assertSafeProperty } from "../../helpers/index.js";
|
|
4
4
|
export const Images = ({ nIds, files, }) => {
|
|
5
5
|
return (JsxPdf.createElement(JsxPdf.Fragment, null, nIds.map((nId) => {
|
|
6
6
|
var _a;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
|
|
2
|
-
import type { PdfConfig } from "../types";
|
|
1
|
+
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission.js";
|
|
2
|
+
import type { PdfConfig } from "../types.js";
|
|
3
3
|
export declare const InnerTableRows: ({ key, value, imageFieldNames, config, files, color, }: {
|
|
4
4
|
key: string;
|
|
5
5
|
value: any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import JsxPdf from "jsx-pdf";
|
|
2
2
|
import { uniq } from "ramda";
|
|
3
|
-
import { assertSafeProperty } from "../../helpers";
|
|
4
|
-
import { IS_ARRAY_OF_OBJECTS, IS_IMAGE, transform } from "../helpers/transform";
|
|
5
|
-
import { Images } from "./Images";
|
|
6
|
-
import { ValidationDisplay } from "./ValidationDisplay";
|
|
3
|
+
import { assertSafeProperty } from "../../helpers/index.js";
|
|
4
|
+
import { IS_ARRAY_OF_OBJECTS, IS_IMAGE, transform, } from "../helpers/transform.js";
|
|
5
|
+
import { Images } from "./Images.js";
|
|
6
|
+
import { ValidationDisplay } from "./ValidationDisplay.js";
|
|
7
7
|
export const InnerTableRows = ({ key, value, imageFieldNames, config, files, color, }) => {
|
|
8
8
|
if (typeof value === "object" &&
|
|
9
9
|
value &&
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { POVerification } from "@raytio/types";
|
|
2
|
-
import type { FlatPO } from "../../helpers";
|
|
2
|
+
import type { FlatPO } from "../../helpers/index.js";
|
|
3
3
|
export declare const FILE_MAP: Record<POVerification, string>;
|
|
4
4
|
export declare const POVerificationBadge: ({ width, POs, }: {
|
|
5
5
|
width: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { POVerification } from "@raytio/types";
|
|
2
2
|
import JsxPdf from "jsx-pdf";
|
|
3
|
-
import { $$ } from "../../locales";
|
|
4
|
-
import { loadAsset } from "../helpers/general";
|
|
5
|
-
import { PO_VER_TEXT_MAP } from "../../constants";
|
|
3
|
+
import { $$ } from "../../locales/index.js";
|
|
4
|
+
import { loadAsset } from "../helpers/general.js";
|
|
5
|
+
import { PO_VER_TEXT_MAP } from "../../constants.js";
|
|
6
6
|
export const FILE_MAP = {
|
|
7
7
|
[POVerification.FullyVerified]: "verified_user_big",
|
|
8
8
|
[POVerification.PartiallyVerified]: "verified_partial_big",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AId } from "@raytio/types";
|
|
2
|
-
import type { PdfConfig } from "../types";
|
|
3
|
-
import type { EnvConfig } from "../../api";
|
|
4
|
-
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
|
|
2
|
+
import type { PdfConfig } from "../types.js";
|
|
3
|
+
import type { EnvConfig } from "../../api/index.js";
|
|
4
|
+
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission.js";
|
|
5
5
|
export declare const Report: ({ data, files, config, aId, clientUrl, envConfig, }: {
|
|
6
6
|
data: ProcessSubmissionOutput["json"];
|
|
7
7
|
files: ProcessSubmissionOutput["files"];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import JsxPdf from "jsx-pdf";
|
|
3
3
|
import { isScoreResultValid } from "@raytio/core";
|
|
4
|
-
import { $$ } from "../../locales";
|
|
5
|
-
import { classes } from "../style";
|
|
6
|
-
import { asset } from "../helpers/general";
|
|
7
|
-
import { NULL_I_ID, SUBMISSION_DATA } from "../constants";
|
|
8
|
-
import { transform } from "../helpers/transform";
|
|
9
|
-
import { SCHEMA } from "../../constants";
|
|
10
|
-
import { version } from "../../public-methods/version";
|
|
11
|
-
import { VerifyBox } from "./VerifyBox";
|
|
12
|
-
import { Table } from "./Table";
|
|
13
|
-
import { TableTitle } from "./TableTitle";
|
|
14
|
-
import { Subheader } from "./Subheader";
|
|
15
|
-
import { POVerificationBadge } from "./POVerificationBadge";
|
|
4
|
+
import { $$ } from "../../locales/index.js";
|
|
5
|
+
import { classes } from "../style.js";
|
|
6
|
+
import { asset } from "../helpers/general.js";
|
|
7
|
+
import { NULL_I_ID, SUBMISSION_DATA } from "../constants.js";
|
|
8
|
+
import { transform } from "../helpers/transform.js";
|
|
9
|
+
import { SCHEMA } from "../../constants.js";
|
|
10
|
+
import { version } from "../../public-methods/version.js";
|
|
11
|
+
import { VerifyBox } from "./VerifyBox.js";
|
|
12
|
+
import { Table } from "./Table.js";
|
|
13
|
+
import { TableTitle } from "./TableTitle.js";
|
|
14
|
+
import { Subheader } from "./Subheader.js";
|
|
15
|
+
import { POVerificationBadge } from "./POVerificationBadge.js";
|
|
16
16
|
export const Report = ({ data, files, config, aId, clientUrl, envConfig, }) => {
|
|
17
17
|
// The PDF is read only; there's no reason why anyone would ever need to unlock it.
|
|
18
18
|
const randomToken = randomBytes(32).toString("base64");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldVerification } from "@raytio/types";
|
|
2
2
|
import JsxPdf from "jsx-pdf";
|
|
3
|
-
import { $$ } from "../../locales";
|
|
4
|
-
import { FieldVerificationBadge } from "./FieldVerificationBadge";
|
|
3
|
+
import { $$ } from "../../locales/index.js";
|
|
4
|
+
import { FieldVerificationBadge } from "./FieldVerificationBadge.js";
|
|
5
5
|
export const Subheader = () => {
|
|
6
6
|
return (JsxPdf.createElement(JsxPdf.Fragment, null,
|
|
7
7
|
JsxPdf.createElement("text", { bold: true, style: "marginBottom" }, "Key:"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PdfConfig } from "../types";
|
|
2
|
-
import { type FlatPO } from "../../helpers";
|
|
3
|
-
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
|
|
1
|
+
import type { PdfConfig } from "../types.js";
|
|
2
|
+
import { type FlatPO } from "../../helpers/index.js";
|
|
3
|
+
import type { ProcessSubmissionOutput } from "../../public-methods/processSubmission.js";
|
|
4
4
|
export declare const Table: ({ POs, files, config, }: {
|
|
5
5
|
POs: FlatPO[];
|
|
6
6
|
files: ProcessSubmissionOutput["files"];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import JsxPdf from "jsx-pdf";
|
|
2
|
-
import { verifyColour } from "../helpers/general";
|
|
3
|
-
import { assertSafeProperty, isFieldValueFile, isPOFile, } from "../../helpers";
|
|
4
|
-
import { FieldVerificationBadge } from "./FieldVerificationBadge";
|
|
5
|
-
import { Images } from "./Images";
|
|
6
|
-
import { InnerTableRows } from "./InnerTableRows";
|
|
2
|
+
import { verifyColour } from "../helpers/general.js";
|
|
3
|
+
import { assertSafeProperty, isFieldValueFile, isPOFile, } from "../../helpers/index.js";
|
|
4
|
+
import { FieldVerificationBadge } from "./FieldVerificationBadge.js";
|
|
5
|
+
import { Images } from "./Images.js";
|
|
6
|
+
import { InnerTableRows } from "./InnerTableRows.js";
|
|
7
7
|
export const Table = ({ POs, files, config, }) => {
|
|
8
8
|
/** every fieldName in these profile object */
|
|
9
9
|
const fieldNames = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import JsxPdf from "jsx-pdf";
|
|
2
|
-
import { $$ } from "../../locales";
|
|
3
|
-
import { assertSafeProperty } from "../../helpers";
|
|
4
|
-
import { pieChart } from "./pieChart";
|
|
2
|
+
import { $$ } from "../../locales/index.js";
|
|
3
|
+
import { assertSafeProperty } from "../../helpers/index.js";
|
|
4
|
+
import { pieChart } from "./pieChart.js";
|
|
5
5
|
const SEVERITY_COLOURS = {
|
|
6
6
|
low: "#2e8bc0",
|
|
7
7
|
medium: "#ff9800",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import JsxPdf from "jsx-pdf";
|
|
2
|
-
import { $$ } from "../../locales";
|
|
3
|
-
import { NULL_I_ID } from "../constants";
|
|
2
|
+
import { $$ } from "../../locales/index.js";
|
|
3
|
+
import { NULL_I_ID } from "../constants.js";
|
|
4
4
|
export const VerifyBox = ({ aId, iId, clientUrl }) => {
|
|
5
5
|
if (iId === NULL_I_ID)
|
|
6
6
|
return null;
|
package/dist/pdf/constants.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { FieldVerification, POVerification } from "@raytio/types";
|
|
4
|
+
import { getDirname } from "../../helpers/pathUtils.js";
|
|
4
5
|
export const asset = (name) => {
|
|
5
6
|
if (/[^.A-Z_a-z-]/.test(name) || name.includes("..")) {
|
|
6
7
|
throw new Error("Invalid asset name");
|
|
7
8
|
}
|
|
8
|
-
return join(
|
|
9
|
+
return join(getDirname(), "./../../assets/", name);
|
|
9
10
|
};
|
|
10
11
|
export const loadAsset = (name) => readFileSync(asset(name), { encoding: "utf8" });
|
|
11
12
|
export const verifyColour = (x) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { repairDate } from "@raytio/core";
|
|
2
|
-
import { $$ } from "../../locales";
|
|
3
|
-
import { formatDate } from "./general";
|
|
2
|
+
import { $$ } from "../../locales/index.js";
|
|
3
|
+
import { formatDate } from "./general.js";
|
|
4
4
|
export const IS_IMAGE = Symbol.for("image");
|
|
5
5
|
export const IS_ARRAY_OF_OBJECTS = Symbol.for("ArrayOfObjects");
|
|
6
6
|
export function transform(key, value, pdfConfig, imageFieldNames) {
|
package/dist/pdf/style.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TDocumentDefinitions } from "pdfmake/interfaces";
|
|
2
|
-
import type { ProcessSubmissionOutput } from "./processSubmission";
|
|
2
|
+
import type { ProcessSubmissionOutput } from "./processSubmission.js";
|
|
3
3
|
export declare function generatePdfJson(data: ProcessSubmissionOutput, DATE_FORMAT: string, TIMEZONE: string): TDocumentDefinitions;
|
|
4
4
|
export declare const generatePDF: () => (data: ProcessSubmissionOutput) => Promise<ProcessSubmissionOutput>;
|
|
@@ -11,9 +11,10 @@ import { promises as fs } from "node:fs";
|
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import PdfPrinter from "pdfmake";
|
|
13
13
|
import JsxPdf from "jsx-pdf";
|
|
14
|
-
import { isValidLocale } from "../locales";
|
|
15
|
-
import { Report } from "../pdf/components/Report";
|
|
16
|
-
import { fonts } from "../pdf/style";
|
|
14
|
+
import { isValidLocale } from "../locales/index.js";
|
|
15
|
+
import { Report } from "../pdf/components/Report.js";
|
|
16
|
+
import { fonts } from "../pdf/style.js";
|
|
17
|
+
import { getDirname } from "../helpers/pathUtils.js";
|
|
17
18
|
export function generatePdfJson(data, DATE_FORMAT, TIMEZONE) {
|
|
18
19
|
return JsxPdf.renderPdf(JsxPdf.createElement(Report, { data: data.json, files: data.files, aId: data.a_id, clientUrl: data.client_url, envConfig: data.envConfig, config: { DATE_FORMAT, TIMEZONE } }));
|
|
19
20
|
}
|
|
@@ -25,7 +26,7 @@ export const generatePDF = () =>
|
|
|
25
26
|
if (data.envConfig.logo_url) {
|
|
26
27
|
// there is a white labelling URL, so fetch it and write it to disk, overriding the default logo
|
|
27
28
|
const arrayBuf = yield fetch(data.envConfig.logo_url).then((r) => r.arrayBuffer());
|
|
28
|
-
yield fs.writeFile(join(
|
|
29
|
+
yield fs.writeFile(join(getDirname(), "../../assets/custom-logo.png"), Buffer.from(arrayBuf));
|
|
29
30
|
}
|
|
30
31
|
if (customLang) {
|
|
31
32
|
if (isValidLocale(customLang)) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AId, IId, Instance, RealVer } from "@raytio/types";
|
|
2
|
-
import { type Config, type InstanceDataToPassOn } from "../constants";
|
|
3
|
-
import { type FlatPO } from "../helpers";
|
|
4
|
-
import { type EnvConfig } from "../api";
|
|
5
|
-
import type { ApplicationEncryptorLike } from "../types";
|
|
2
|
+
import { type Config, type InstanceDataToPassOn } from "../constants.js";
|
|
3
|
+
import { type FlatPO } from "../helpers/index.js";
|
|
4
|
+
import { type EnvConfig } from "../api/index.js";
|
|
5
|
+
import type { ApplicationEncryptorLike } from "../types.js";
|
|
6
6
|
type DecryptData = {
|
|
7
7
|
apiToken: string;
|
|
8
8
|
instance: Instance;
|
|
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { equals, mapObjIndexed, omit } from "ramda";
|
|
11
11
|
import { calculateScore, convertInstanceToRuleInput, decryptSharedData, getMissingDataForInstance, getSomeoneElsesRealVerifications, isScoreConfigValid, } from "@raytio/core";
|
|
12
|
-
import { FIELD_VER_TEXT_MAP, INSTANCE_FIELDS_TO_REMOVE, } from "../constants";
|
|
13
|
-
import { deepJsonToCsv, formatOutput, setupMaxcryptor, splitPOAndVers, } from "../helpers";
|
|
14
|
-
import { fetchAA, fetchEnvConfig, fetchInstanceData, getAllSchema, getFiles, signIn, updateInstanceData, } from "../api";
|
|
15
|
-
import { NULL_I_ID } from "../pdf/constants";
|
|
12
|
+
import { FIELD_VER_TEXT_MAP, INSTANCE_FIELDS_TO_REMOVE, } from "../constants.js";
|
|
13
|
+
import { deepJsonToCsv, formatOutput, setupMaxcryptor, splitPOAndVers, } from "../helpers/index.js";
|
|
14
|
+
import { fetchAA, fetchEnvConfig, fetchInstanceData, getAllSchema, getFiles, signIn, updateInstanceData, } from "../api/index.js";
|
|
15
|
+
import { NULL_I_ID } from "../pdf/constants.js";
|
|
16
16
|
function decryptStage(log, config, envConfig, instanceId) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
log("Authenticating...");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ProcessSubmissionOutput } from "./processSubmission";
|
|
1
|
+
import type { ProcessSubmissionOutput } from "./processSubmission.js";
|
|
2
2
|
export declare const saveToS3Bucket: () => (input: ProcessSubmissionOutput) => Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
|
|
3
|
+
import { getDirname } from "../helpers/pathUtils.js";
|
|
4
|
+
export const packageDotJson = JSON.parse(readFileSync(join(getDirname(), "../../package.json"), "utf8"));
|
|
4
5
|
export const version = Object.entries({
|
|
5
6
|
LANG: process.env.PDF_LANGUAGE || "default",
|
|
6
7
|
N: process.version.slice(1),
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raytio/decrypt-helper",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
4
4
|
"author": "Raytio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A helper to decrypt data shared by Raytio users",
|
|
7
|
-
"main": "dist",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"assets",
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev-pdf": "ts-node src/test/pdf",
|
|
14
|
-
"build": "tsc && find dist -path \"*/__tests__*\" -delete && rm -rf dist/test",
|
|
14
|
+
"build": "tsc && find dist -path \"*/__tests__*\" -delete && rm -rf dist/test && cp -r src/locales/translations dist/locales/",
|
|
15
15
|
"i18n": "react-intl-manager",
|
|
16
16
|
"lint": "eslint --ext .js,.ts,.tsx --color --ignore-path .gitignore .",
|
|
17
17
|
"test": "vitest"
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"jsx-pdf": "^2.3.0",
|
|
31
31
|
"localstorage-polyfill": "^1.0.1",
|
|
32
32
|
"mime-types": "^2.1.35",
|
|
33
|
-
"pdfmake": "^0.
|
|
34
|
-
"ramda": "^0.
|
|
33
|
+
"pdfmake": "^0.1.59",
|
|
34
|
+
"ramda": "^0.30.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
+
"@babel/plugin-transform-react-jsx": "^7.0.0",
|
|
37
38
|
"@raytio/react-intl-manager": "^6.4.0",
|
|
38
39
|
"@types/jest-image-snapshot": "^6.3.0",
|
|
39
40
|
"@types/jsx-pdf": "^2.2.6",
|
|
@@ -44,8 +45,9 @@
|
|
|
44
45
|
"@vitest/ui": "^1.2.2",
|
|
45
46
|
"babel-preset-react-app": "^10.0.1",
|
|
46
47
|
"dotenv": "^16.3.1",
|
|
47
|
-
"eslint": "^8.
|
|
48
|
+
"eslint": "^8.57.0",
|
|
48
49
|
"eslint-config-kyle": "^18.0.1",
|
|
50
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
49
51
|
"jest-image-snapshot": "^6.3.0",
|
|
50
52
|
"pdf-to-img": "^2.1.2",
|
|
51
53
|
"ts-node": "^10.9.1",
|