@raytio/decrypt-helper 2.2.0 → 3.0.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/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 3.0.2 (2022-02-16)
11
+
12
+ - fix PDF bug for multiple POs from the same schema
13
+ - remove legacy internal property called `$source`
14
+ - fix field verification status being `undefined` instead of `NotVerified`/`60002`
15
+ - 💥 BREAKING CHANGE: we no longer use `schema_group` to group schema in the json, csv, and pdf
16
+
17
+ ## 3.0.1 (2022-02-15)
18
+
19
+ - fix bug with PDF generation
20
+
21
+ ## 3.0.0 (2022-02-04)
22
+
23
+ - 💥 BREAKING CHANGE: renamed the `USERNAME` & `PASSWORD` environment variables to `RAYTIO_USERNAME` & `RAYTIO_PASSWORD`
24
+ - 💥 BREAKING CHANGE: removed the `READABLE_FIELD_NAMES` option
25
+ - 💥 BREAKING CHANGE: [csv] added new columns, shifted other columns
26
+ - 💥 BREAKING CHANGE: [json] removed some duplicate legacy fields, see #33
27
+ - !156: various internal refactoring
28
+
29
+ ## 2.2.1 (2022-02-09)
30
+
31
+ - !158 include the submission score in the json and pdf
32
+
10
33
  ## 2.2.0 (2022-02-04)
11
34
 
12
35
  - !153 fix rendering of arrays of primitive values
package/README.md CHANGED
@@ -34,12 +34,9 @@ raytio
34
34
  // if using raytio.saveToS3Bucket, specify the ID of the bucket here
35
35
  S3_BUCKET: "",
36
36
 
37
- // whether the JSON and CSV output should use readable field names instead of the field IDs
38
- READABLE_FIELD_NAMES: true,
39
-
40
37
  // the credentials of an organization user
41
- USERNAME: "...",
42
- PASSWORD: "...",
38
+ RAYTIO_USERNAME: "...",
39
+ RAYTIO_PASSWORD: "...",
43
40
 
44
41
  // used when generating a PDF report, if not supplied defaults to "en-NZ" and "Pacific/Auckland"
45
42
  // for available timezone options, see the map on https://momentjs.com/timezone
@@ -0,0 +1,3 @@
1
+ import type { AId, AA } from "@raytio/types";
2
+ import { EnvConfig } from "./fetchEnvConfig";
3
+ export declare function fetchAA(apiToken: string, envConfig: EnvConfig, aId: AId): Promise<AA>;
@@ -0,0 +1,19 @@
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;
@@ -43,7 +43,7 @@ function getFiles(profileObjects, instance, apiToken, envConfig, applicationDecr
43
43
  // [nId: NId, fieldName: string, file: RaytFile][]
44
44
  const urnOrEncryptedList = profileObjects.flatMap((PO) => {
45
45
  return Object.entries(PO.properties)
46
- .filter((kv) => (0, file_1.isFile)(kv[1]))
46
+ .filter((kv) => (0, file_1.isFieldValueFile)(kv[1]))
47
47
  .map(([k, v]) => {
48
48
  return [
49
49
  PO.n_id,
@@ -1,3 +1,3 @@
1
1
  import type { Schema } from "@raytio/types";
2
2
  import { EnvConfig } from "./fetchEnvConfig";
3
- export declare function getSchema(envConfig: EnvConfig, apiToken: string, name: string): Promise<Schema>;
3
+ export declare function getSchema(envConfig: EnvConfig, name: string): Promise<Schema>;
@@ -12,18 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getSchema = void 0;
13
13
  const authedFetch_1 = require("./authedFetch");
14
14
  const cache = new Map();
15
- function $getSchema(envConfig, apiToken, name) {
15
+ function $getSchema(envConfig, name) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
17
  const [schemaHead, ...schemaTail] = name.split("_");
18
- const schema = yield (0, authedFetch_1.authedFetch)(apiToken, `${envConfig.api_url}/graph/v2/schema/${schemaHead}/${schemaTail.join("_")}?expand=true`);
18
+ const schema = yield (0, authedFetch_1.authedFetch)("", `${envConfig.api_url}/graph/v2/schema_public/${schemaHead}/${schemaTail.join("_")}?expand=true`);
19
19
  return Object.assign(Object.assign({}, schema), { name });
20
20
  });
21
21
  }
22
- function getSchema(envConfig, apiToken, name) {
22
+ function getSchema(envConfig, name) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  if (cache.has(name))
25
25
  return cache.get(name);
26
- const promise = $getSchema(envConfig, apiToken, name);
26
+ const promise = $getSchema(envConfig, name);
27
27
  cache.set(name, promise);
28
28
  return promise;
29
29
  });
@@ -1,4 +1,5 @@
1
1
  export * from "./authedFetch";
2
+ export * from "./fetchAA";
2
3
  export * from "./fetchEnvConfig";
3
4
  export * from "./fetchInstanceData";
4
5
  export * from "./getFiles";
package/dist/api/index.js CHANGED
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./authedFetch"), exports);
14
+ __exportStar(require("./fetchAA"), exports);
14
15
  __exportStar(require("./fetchEnvConfig"), exports);
15
16
  __exportStar(require("./fetchInstanceData"), exports);
16
17
  __exportStar(require("./getFiles"), exports);
@@ -24,11 +24,11 @@ function signIn(CONFIG, envConfig) {
24
24
  userPoolWebClientId: envConfig.cognito_web_client_id,
25
25
  });
26
26
  const userObj = yield auth_1.default.signIn({
27
- username: CONFIG.USERNAME,
28
- password: yield (0, core_1.hashPassword)(CONFIG.PASSWORD),
27
+ username: CONFIG.RAYTIO_USERNAME,
28
+ password: yield (0, core_1.hashPassword)(CONFIG.RAYTIO_PASSWORD),
29
29
  });
30
30
  if (userObj.challengeName === "SOFTWARE_TOKEN_MFA") {
31
- throw new Error(`The configured account (${CONFIG.USERNAME}) has two factor authentication enabled. You must disable 2FA or use a different account`);
31
+ throw new Error(`The configured account (${CONFIG.RAYTIO_USERNAME}) has two factor authentication enabled. You must disable 2FA or use a different account`);
32
32
  }
33
33
  const user = yield auth_1.default.currentAuthenticatedUser();
34
34
  const apiToken = (_b = (_a = user.signInUserSession) === null || _a === void 0 ? void 0 : _a.idToken) === null || _b === void 0 ? void 0 : _b.jwtToken;
@@ -1,3 +1,4 @@
1
+ import { ScoreResult } from "@raytio/core";
1
2
  import { FieldVerification, Instance, POVerification } from "@raytio/types";
2
3
  export declare const ATTRIBUTE_MAP: {
3
4
  "custom:kek_derivation": string[];
@@ -10,8 +11,10 @@ export declare const ATTRIBUTE_MAP: {
10
11
  export declare const VERIFICATION_SCHEMA = "ss_Verification";
11
12
  export declare const INSTANCE_FIELDS_TO_REMOVE: readonly ["profile_objects", "relationships", "keys"];
12
13
  export declare const FIELDS_TO_REMOVE: readonly ["n_id", "document"];
13
- export declare const ENV_VARIABLES: readonly ["CLIENT_URL", "READABLE_FIELD_NAMES", "USERNAME", "PASSWORD"];
14
+ export declare const ENV_VARIABLES: readonly ["CLIENT_URL", "RAYTIO_USERNAME", "RAYTIO_PASSWORD"];
14
15
  export declare type Config = Record<typeof ENV_VARIABLES[number], string>;
15
- export declare type InstanceDataToPassOn = Omit<Instance, typeof INSTANCE_FIELDS_TO_REMOVE[number]>;
16
+ export declare type InstanceDataToPassOn = Omit<Instance, typeof INSTANCE_FIELDS_TO_REMOVE[number]> & {
17
+ score?: ScoreResult;
18
+ };
16
19
  export declare const PO_VER_TEXT_MAP: Record<POVerification, string>;
17
20
  export declare const FIELD_VER_TEXT_MAP: Record<FieldVerification, string>;
package/dist/constants.js CHANGED
@@ -19,9 +19,8 @@ exports.INSTANCE_FIELDS_TO_REMOVE = [
19
19
  exports.FIELDS_TO_REMOVE = ["n_id", "document"];
20
20
  exports.ENV_VARIABLES = [
21
21
  "CLIENT_URL",
22
- "READABLE_FIELD_NAMES",
23
- "USERNAME",
24
- "PASSWORD",
22
+ "RAYTIO_USERNAME",
23
+ "RAYTIO_PASSWORD",
25
24
  ];
26
25
  exports.PO_VER_TEXT_MAP = {
27
26
  [types_1.POVerification.FullyVerified]: "Fully Verified",
@@ -52,12 +52,12 @@ describe("formatOutput", () => {
52
52
  beforeEach(() => {
53
53
  m(api_1.resolveVerificationDetails).mockResolvedValue(Symbol.for("VerificationDetails"));
54
54
  });
55
- it("uses schema_group to group schema", () => __awaiter(void 0, void 0, void 0, function* () {
55
+ it("does not use schema_group to group schema", () => __awaiter(void 0, void 0, void 0, function* () {
56
56
  const output = yield (0, formatOutput_1.formatOutput)(profileObjects, allSchemas, realVers, "[apiToken]",
57
57
  // @ts-expect-error testing if it works with booleans not stringied bools
58
- { READABLE_FIELD_NAMES: false }, Symbol.for("envConfig"));
58
+ Symbol.for("envConfig"));
59
59
  expect(output).toStrictEqual({
60
- DL: [
60
+ ss_nz_drivers_license: [
61
61
  {
62
62
  $verification_details: Symbol.for("VerificationDetails"),
63
63
  $verified: types_1.POVerification.NotVerified,
@@ -67,83 +67,20 @@ describe("formatOutput", () => {
67
67
  issuer: {
68
68
  title: "issuer",
69
69
  value: "NZTA",
70
- verification: undefined,
70
+ verification: types_1.FieldVerification.NotVerified,
71
71
  },
72
72
  license_number: {
73
73
  title: "license_number",
74
74
  value: "DW012345",
75
- verification: undefined,
75
+ verification: types_1.FieldVerification.NotVerified,
76
76
  },
77
77
  },
78
78
  $safeHarbour: "NOT_APPLICABLE",
79
79
  $schemaName: "ss_nz_drivers_license",
80
- // legacy
81
- issuer: "NZTA",
82
- "issuer.verification": undefined,
83
- license_number: "DW012345",
84
- "license_number.verification": undefined,
85
- },
86
- {
87
- $verification_details: Symbol.for("VerificationDetails"),
88
- $verified: types_1.POVerification.NotVerified,
89
- $shouldBeVerifiedFields: undefined,
90
- $nId: "n3",
91
- $properties: {
92
- city: {
93
- title: "city",
94
- value: "Sydney",
95
- verification: undefined,
96
- },
97
- license_number: {
98
- title: "license_number",
99
- value: "ABC123",
100
- verification: undefined,
101
- },
102
- },
103
- $safeHarbour: "NOT_APPLICABLE",
104
- $schemaName: "ss_nsw_drivers_license",
105
- // legacy
106
- city: "Sydney",
107
- "city.verification": undefined,
108
- license_number: "ABC123",
109
- "license_number.verification": undefined,
80
+ $schemaTitle: "NZ Drivers License",
110
81
  },
111
82
  ],
112
- ss_name: [
113
- {
114
- $verification_details: Symbol.for("VerificationDetails"),
115
- $verified: types_1.POVerification.NotVerified,
116
- $shouldBeVerifiedFields: undefined,
117
- $nId: "n1",
118
- $properties: {
119
- fName: {
120
- title: "fName",
121
- value: "john",
122
- verification: undefined,
123
- },
124
- lName: {
125
- title: "lName",
126
- value: "doe",
127
- verification: undefined,
128
- },
129
- },
130
- $safeHarbour: "NOT_APPLICABLE",
131
- $schemaName: "ss_name",
132
- // legacy
133
- fName: "john",
134
- "fName.verification": undefined,
135
- lName: "doe",
136
- "lName.verification": undefined,
137
- },
138
- ],
139
- });
140
- }));
141
- it("doesn't use schema_group if READABLE_FIELD_NAMES is true", () => __awaiter(void 0, void 0, void 0, function* () {
142
- const output = yield (0, formatOutput_1.formatOutput)(profileObjects, allSchemas, realVers, "[apiToken]",
143
- // @ts-expect-error testing if it works with booleans not stringied bools
144
- { READABLE_FIELD_NAMES: true }, Symbol.for("envConfig"));
145
- expect(output).toStrictEqual({
146
- "NSW Drivers License": [
83
+ ss_nsw_drivers_license: [
147
84
  {
148
85
  $verification_details: Symbol.for("VerificationDetails"),
149
86
  $verified: types_1.POVerification.NotVerified,
@@ -153,51 +90,20 @@ describe("formatOutput", () => {
153
90
  city: {
154
91
  title: "city",
155
92
  value: "Sydney",
156
- verification: undefined,
93
+ verification: types_1.FieldVerification.NotVerified,
157
94
  },
158
95
  license_number: {
159
96
  title: "license_number",
160
97
  value: "ABC123",
161
- verification: undefined,
98
+ verification: types_1.FieldVerification.NotVerified,
162
99
  },
163
100
  },
164
101
  $safeHarbour: "NOT_APPLICABLE",
165
102
  $schemaName: "ss_nsw_drivers_license",
166
- // legacy
167
- city: "Sydney",
168
- "city Verification": undefined,
169
- license_number: "ABC123",
170
- "license_number Verification": undefined,
103
+ $schemaTitle: "NSW Drivers License",
171
104
  },
172
105
  ],
173
- "NZ Drivers License": [
174
- {
175
- $verification_details: Symbol.for("VerificationDetails"),
176
- $verified: types_1.POVerification.NotVerified,
177
- $shouldBeVerifiedFields: undefined,
178
- $nId: "n2",
179
- $properties: {
180
- issuer: {
181
- title: "issuer",
182
- value: "NZTA",
183
- verification: undefined,
184
- },
185
- license_number: {
186
- title: "license_number",
187
- value: "DW012345",
188
- verification: undefined,
189
- },
190
- },
191
- $safeHarbour: "NOT_APPLICABLE",
192
- $schemaName: "ss_nz_drivers_license",
193
- // legacy
194
- issuer: "NZTA",
195
- "issuer Verification": undefined,
196
- license_number: "DW012345",
197
- "license_number Verification": undefined,
198
- },
199
- ],
200
- "Your Name": [
106
+ ss_name: [
201
107
  {
202
108
  $verification_details: Symbol.for("VerificationDetails"),
203
109
  $verified: types_1.POVerification.NotVerified,
@@ -207,21 +113,17 @@ describe("formatOutput", () => {
207
113
  fName: {
208
114
  title: "fName",
209
115
  value: "john",
210
- verification: undefined,
116
+ verification: types_1.FieldVerification.NotVerified,
211
117
  },
212
118
  lName: {
213
119
  title: "lName",
214
120
  value: "doe",
215
- verification: undefined,
121
+ verification: types_1.FieldVerification.NotVerified,
216
122
  },
217
123
  },
218
124
  $safeHarbour: "NOT_APPLICABLE",
219
125
  $schemaName: "ss_name",
220
- // legacy
221
- fName: "john",
222
- "fName Verification": undefined,
223
- lName: "doe",
224
- "lName Verification": undefined,
126
+ $schemaTitle: "Your Name",
225
127
  },
226
128
  ],
227
129
  });
@@ -1,4 +1,5 @@
1
1
  import type { Encrypted, NId, Urn } from "@raytio/types";
2
+ import type { FlatPO } from "./formatOutput";
2
3
  export declare type RaytFile = {
3
4
  n_id: NId;
4
5
  content: Urn | Encrypted;
@@ -6,4 +7,7 @@ export declare type RaytFile = {
6
7
  n_id: NId;
7
8
  Content: Urn | Encrypted;
8
9
  };
9
- export declare const isFile: (field: unknown) => field is RaytFile;
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;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFile = void 0;
3
+ exports.isPOFile = exports.isFieldValueFile = void 0;
4
4
  const core_1 = require("@raytio/core");
5
5
  const URN_PREFIX = "urn:";
6
6
  /** @internal */
7
7
  const isObject = (x) => !!x && typeof x === "object";
8
8
  /** @internal */
9
9
  const isUrnOrEncrypted = (x) => (typeof x === "string" && x.startsWith(URN_PREFIX)) || (0, core_1.isEncrypted)(x);
10
- const isFile = (field) => isObject(field) &&
11
- (isUrnOrEncrypted(field.content) || isUrnOrEncrypted(field.Content));
12
- exports.isFile = isFile;
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;
@@ -1,13 +1,19 @@
1
- import type { NId, POVerification, ProfileObject, RealVer, Schema } from "@raytio/types";
1
+ import { FieldVerification, NId, POVerification, ProfileObject, RealVer, Schema } from "@raytio/types";
2
2
  import { ResolvedVerificationProvider, EnvConfig } from "../api";
3
- import { Config } from "../constants";
4
3
  export declare type FlatPO = {
5
4
  $verified: POVerification;
6
5
  $verification_details: ResolvedVerificationProvider | undefined;
7
6
  $shouldBeVerifiedFields: string[] | undefined;
8
7
  $nId: NId;
9
8
  $schemaName: string;
9
+ $schemaTitle: string;
10
+ $properties: {
11
+ [fieldName: string]: {
12
+ title: string;
13
+ value: unknown;
14
+ verification: FieldVerification;
15
+ };
16
+ };
10
17
  $safeHarbour: boolean | "NOT_APPLICABLE";
11
- [schemaField: string]: any;
12
18
  };
13
- export declare function formatOutput(profileObjects: ProfileObject[], allSchemas: Schema[], realVers: RealVer[], apiToken: string, CONFIG: Config, envConfig: EnvConfig): Promise<Record<string, FlatPO[]>>;
19
+ export declare function formatOutput(profileObjects: ProfileObject[], allSchemas: Schema[], realVers: RealVer[], apiToken: string, envConfig: EnvConfig): Promise<Record<string, FlatPO[]>>;
@@ -12,25 +12,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.formatOutput = void 0;
13
13
  const core_1 = require("@raytio/core");
14
14
  const ramda_1 = require("ramda");
15
+ const types_1 = require("@raytio/types");
15
16
  const api_1 = require("../api");
16
17
  const constants_1 = require("../constants");
17
18
  const lookup_1 = require("./lookup");
18
- const types_1 = require("./types");
19
+ const types_2 = require("./types");
19
20
  const byPriority = (schema) => ([a], [b]) => {
20
21
  var _a, _b, _c, _d, _e, _f;
21
- (0, types_1.assertSafeProperty)(a);
22
- (0, types_1.assertSafeProperty)(b);
22
+ (0, types_2.assertSafeProperty)(a);
23
+ (0, types_2.assertSafeProperty)(b);
23
24
  // if no priority, it becomes the last
24
25
  const aPriority = (_c = (_b = (_a = schema.properties) === null || _a === void 0 ? void 0 : _a[a]) === null || _b === void 0 ? void 0 : _b.priority) !== null && _c !== void 0 ? _c : Infinity;
25
26
  const bPriority = (_f = (_e = (_d = schema.properties) === null || _d === void 0 ? void 0 : _d[b]) === null || _e === void 0 ? void 0 : _e.priority) !== null && _f !== void 0 ? _f : Infinity;
26
27
  return aPriority - bPriority;
27
28
  };
28
- // TODO: clean up
29
- function formatOutput(profileObjects, allSchemas, realVers, apiToken, CONFIG, envConfig) {
29
+ function formatOutput(profileObjects, allSchemas, realVers, apiToken, envConfig) {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
- const readable = CONFIG.READABLE_FIELD_NAMES.toString() === "true";
32
31
  const PODetails = profileObjects.reduce((acPromise, PO) => __awaiter(this, void 0, void 0, function* () {
33
- var _a, _b;
32
+ var _a;
34
33
  const ac = yield acPromise;
35
34
  const schemaName = (0, core_1.findSchemaLabel)(PO.labels);
36
35
  const schema = allSchemas.find((x) => x.name === schemaName);
@@ -38,49 +37,40 @@ function formatOutput(profileObjects, allSchemas, realVers, apiToken, CONFIG, en
38
37
  throw new Error(`${schema} is missing!`);
39
38
  const verDetails = (0, core_1.getPOVerification)({ PO, schema, realVers });
40
39
  const realProps = (0, ramda_1.omit)(constants_1.FIELDS_TO_REMOVE, PO.properties);
41
- const schemaNameOrGroup = (_a = schema.schema_group) !== null && _a !== void 0 ? _a : schema.name;
42
- (0, types_1.assertSafeProperty)(schemaNameOrGroup);
43
- const existing = ac[schemaNameOrGroup] || [];
40
+ (0, types_2.assertSafeProperty)(schemaName);
41
+ const existing = ac[schemaName] || [];
44
42
  const poProperties = Object.entries(realProps).sort(byPriority(schema));
45
43
  const reducedProperties = yield poProperties.reduce((acc, [key, value]) => __awaiter(this, void 0, void 0, function* () {
46
- var _c, _d;
44
+ var _b, _c;
47
45
  const accP = yield acc;
48
- (0, types_1.assertSafeProperty)(key);
46
+ (0, types_2.assertSafeProperty)(key);
49
47
  return Object.assign(Object.assign({}, accP), { [key]: {
50
- title: ((_d = (_c = schema.properties) === null || _c === void 0 ? void 0 : _c[key]) === null || _d === void 0 ? void 0 : _d.title) || key,
48
+ title: ((_c = (_b = schema.properties) === null || _b === void 0 ? void 0 : _b[key]) === null || _c === void 0 ? void 0 : _c.title) || key,
51
49
  value: typeof value === "string"
52
50
  ? yield (0, lookup_1.maybeAddLookupValue)(schema, key, value, apiToken)
53
51
  : value,
54
- verification: verDetails.fieldVerifications[key],
52
+ verification: verDetails.fieldVerifications[key] ||
53
+ types_1.FieldVerification.NotVerified,
55
54
  } });
56
55
  }), Promise.resolve({}));
57
- const thisPO = Object.assign({
58
- // these are always included
59
- $verified: verDetails.status, $verification_details: yield (0, api_1.resolveVerificationDetails)(verDetails.details.verifiers, apiToken, envConfig), $shouldBeVerifiedFields: (_b = schema.verified_fields) === null || _b === void 0 ? void 0 : _b.map((x) => typeof x === "string" ? x : x.field),
60
- // these are not included in the CSV for legacy reasons
61
- $nId: PO.n_id, $schemaName: schemaName, $properties: reducedProperties, $safeHarbour: schemaName === "ss_Person_Name"
56
+ const thisPO = {
57
+ $verified: verDetails.status,
58
+ $verification_details: yield (0, api_1.resolveVerificationDetails)(verDetails.details.verifiers, apiToken, envConfig),
59
+ $shouldBeVerifiedFields: (_a = schema.verified_fields) === null || _a === void 0 ? void 0 : _a.map((x) => typeof x === "string" ? x : x.field),
60
+ $nId: PO.n_id,
61
+ $schemaName: schemaName,
62
+ $schemaTitle: schema.title,
63
+ $properties: reducedProperties,
64
+ $safeHarbour: schemaName === "ss_Person_Name"
62
65
  ? (yield (0, core_1.calcSafeHarbourScore)({
63
66
  person: PO,
64
- getSchema: (name) => (0, api_1.getSchema)(envConfig, apiToken, name),
67
+ getSchema: (name) => (0, api_1.getSchema)(envConfig, name),
65
68
  profileObjects,
66
69
  realVers,
67
70
  })).isSafe
68
- : "NOT_APPLICABLE" }, Object.entries(realProps)
69
- .sort(byPriority(schema))
70
- .reduce((acc, [key, value]) => {
71
- var _a, _b;
72
- (0, types_1.assertSafeProperty)(key);
73
- const title = readable
74
- ? ((_b = (_a = schema.properties) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.title) || key
75
- : key;
76
- (0, types_1.assertSafeProperty)(title);
77
- const titleV = readable
78
- ? `${title} Verification`
79
- : `${title}.verification`;
80
- return Object.assign(Object.assign({}, acc), { [title]: value, [titleV]: verDetails.fieldVerifications[key] });
81
- }, {}));
82
- const schemaTitle = (readable && schema.title) || schemaNameOrGroup;
83
- return Object.assign(Object.assign({}, ac), { [schemaTitle]: [...existing, thisPO] });
71
+ : "NOT_APPLICABLE",
72
+ };
73
+ return Object.assign(Object.assign({}, ac), { [schemaName]: [...existing, thisPO] });
84
74
  }), Promise.resolve({}));
85
75
  return PODetails;
86
76
  });
@@ -21,7 +21,7 @@ function setupMaxcryptor(CONFIG, cognitoAttributes) {
21
21
  return acc;
22
22
  return (0, ramda_1.assocPath)(constants_1.ATTRIBUTE_MAP[Name], JSON.parse(Value), acc);
23
23
  }, {});
24
- const { encryptor: maxcryptor } = yield (0, maxcryptor_1.encryptorFromExistingUser)(userDoc, CONFIG.PASSWORD);
24
+ const { encryptor: maxcryptor } = yield (0, maxcryptor_1.encryptorFromExistingUser)(userDoc, CONFIG.RAYTIO_PASSWORD);
25
25
  return maxcryptor;
26
26
  });
27
27
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="jsx-pdf" />
2
- import { Files } from "../types";
2
+ import { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
3
3
  export declare const Images: ({ nIds, files, }: {
4
4
  nIds: string[];
5
- files: Files;
5
+ files: ProcessSubmissionOutput["files"];
6
6
  }) => JSX.Element;
@@ -1,9 +1,10 @@
1
1
  /// <reference types="jsx-pdf" />
2
- import { Files, PdfConfig } from "../types";
2
+ import { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
3
+ import { PdfConfig } from "../types";
3
4
  export declare const InnerTableRows: ({ key, value, imageFieldNames, config, files, color, }: {
4
5
  key: string;
5
6
  value: any;
6
- files: Files;
7
+ files: ProcessSubmissionOutput["files"];
7
8
  config: PdfConfig;
8
9
  color: string;
9
10
  imageFieldNames: string[];
@@ -1,8 +1,8 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { POVerification } from "@raytio/types";
3
- import { PdfSchema } from "../types";
3
+ import { FlatPO } from "../../helpers";
4
4
  export declare const FILE_MAP: Record<POVerification, string>;
5
- export declare const POVerificationBadge: ({ width, schema, }: {
5
+ export declare const POVerificationBadge: ({ width, POs, }: {
6
6
  width: number;
7
- schema: PdfSchema;
7
+ POs: FlatPO[];
8
8
  }) => JSX.Element;
@@ -18,10 +18,9 @@ exports.FILE_MAP = {
18
18
  [types_1.POVerification.Encrypted]: "not_verified_big",
19
19
  [types_1.POVerification.Loading]: "not_verified_big",
20
20
  };
21
- const POVerificationBadge = ({ width, schema, }) => {
22
- const [, profileObjects] = schema;
21
+ const POVerificationBadge = ({ width, POs, }) => {
23
22
  // TODO: this won't work if multiple POs of the same schema are shared
24
- const { $verified, $verification_details, $shouldBeVerifiedFields, $safeHarbour, } = profileObjects[0];
23
+ const { $verified, $verification_details, $shouldBeVerifiedFields, $safeHarbour, } = POs[0];
25
24
  const verifiedBy = $verification_details === null || $verification_details === void 0 ? void 0 : $verification_details.verifier_id;
26
25
  return (jsx_pdf_1.default.createElement(jsx_pdf_1.default.Fragment, null,
27
26
  $shouldBeVerifiedFields && (jsx_pdf_1.default.createElement(jsx_pdf_1.default.Fragment, null,
@@ -1,9 +1,10 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import type { AId } from "@raytio/types";
3
- import { Files, PdfConfig, ReportData } from "../types";
3
+ import { PdfConfig } from "../types";
4
+ import { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
4
5
  export declare const Report: ({ data, files, config, aId, clientUrl, version, }: {
5
- data: ReportData;
6
- files: Files;
6
+ data: ProcessSubmissionOutput["json"];
7
+ files: ProcessSubmissionOutput["files"];
7
8
  config: PdfConfig;
8
9
  aId: AId;
9
10
  clientUrl: string;
@@ -16,7 +16,6 @@ const VerifyBox_1 = require("./VerifyBox");
16
16
  const constants_1 = require("../constants");
17
17
  const transform_1 = require("../helpers/transform");
18
18
  const Report = ({ data, files, config, aId, clientUrl, version, }) => {
19
- const schemas = Object.entries(data).filter(([, val]) => Array.isArray(val) && val.length && "$verified" in val[0]);
20
19
  // The PDF is read only; there's no reason why anyone would ever need to unlock it.
21
20
  const randomToken = (0, crypto_1.randomBytes)(32).toString("base64");
22
21
  return (jsx_pdf_1.default.createElement("document", { defaultStyle: { font: "Lato", fontSize: 12 }, info: {
@@ -39,25 +38,30 @@ const Report = ({ data, files, config, aId, clientUrl, version, }) => {
39
38
  jsx_pdf_1.default.createElement("text", { style: ["header", "marginBottom"], alignment: "center" }, "Raytio Verification Report"),
40
39
  jsx_pdf_1.default.createElement("columns", { columnGap: 10 },
41
40
  jsx_pdf_1.default.createElement("column", { width: "auto" },
42
- jsx_pdf_1.default.createElement("text", { style: ["subheader", "marginBottom"] }, Object.entries(constants_1.SUBMISSION_DATA)
43
- .map(([id, label]) => `${label}: ${(0, transform_1.transform)(id, data[id], config)}`)
44
- .join("\n")),
41
+ jsx_pdf_1.default.createElement("text", { style: ["subheader", "marginBottom"] },
42
+ Object.entries(constants_1.SUBMISSION_DATA)
43
+ .map(([id, label]) => `${label}: ${(0, transform_1.transform)(id, data[id], config)}`)
44
+ .join("\n"),
45
+ data.score
46
+ ? `\nScore: ${data.score.score}\nScore Category: ${data.score.category}`
47
+ : ""),
45
48
  jsx_pdf_1.default.createElement(Subheader_1.Subheader, { data: data, config: config })),
46
49
  jsx_pdf_1.default.createElement("column", { width: "*" },
47
50
  jsx_pdf_1.default.createElement("text", null, " ")),
48
51
  jsx_pdf_1.default.createElement("column", { width: 150 },
49
52
  jsx_pdf_1.default.createElement(VerifyBox_1.VerifyBox, { aId: aId, iId: data.i_id, clientUrl: clientUrl }))),
50
- schemas.map((schema) => {
53
+ Object.values(data.profile_objects).map((POs) => {
54
+ // for each schema
51
55
  return (jsx_pdf_1.default.createElement("stack", {
52
56
  // unbreakable is off because it crashes if its too big for one page
53
- // TODO: PR to pdfmake to fix this
57
+ // This is a 7-year-old issue in pdfmake (https://github.com/bpampuch/pdfmake/issues/207)
54
58
  unbreakable: false, style: "marginY" },
55
- jsx_pdf_1.default.createElement(TableTitle_1.TableTitle, { schema: schema }),
59
+ jsx_pdf_1.default.createElement(TableTitle_1.TableTitle, { POs: POs }),
56
60
  jsx_pdf_1.default.createElement("columns", { columnGap: 15 },
57
61
  jsx_pdf_1.default.createElement("column", { width: 80 },
58
- jsx_pdf_1.default.createElement(POVerificationBadge_1.POVerificationBadge, { width: 80, schema: schema })),
62
+ jsx_pdf_1.default.createElement(POVerificationBadge_1.POVerificationBadge, { width: 80, POs: POs })),
59
63
  jsx_pdf_1.default.createElement("column", { width: "auto" },
60
- jsx_pdf_1.default.createElement(Table_1.Table, { schema: schema, files: files, config: config })))));
64
+ jsx_pdf_1.default.createElement(Table_1.Table, { POs: POs, files: files, config: config })))));
61
65
  })),
62
66
  jsx_pdf_1.default.createElement("footer", null, (currentPage, pageCount, pageSize) => (jsx_pdf_1.default.createElement("stack", { bold: true, color: "#333", fontSize: 10 },
63
67
  jsx_pdf_1.default.createElement("text", { margin: 16 },
@@ -1,7 +1,9 @@
1
1
  /// <reference types="jsx-pdf" />
2
- import { PdfSchema, Files, PdfConfig } from "../types";
3
- export declare const Table: ({ schema, files, config, }: {
4
- schema: PdfSchema;
5
- files: Files;
2
+ import { PdfConfig } from "../types";
3
+ import { FlatPO } from "../../helpers";
4
+ import { ProcessSubmissionOutput } from "../../public-methods/processSubmission";
5
+ export declare const Table: ({ POs, files, config, }: {
6
+ POs: FlatPO[];
7
+ files: ProcessSubmissionOutput["files"];
6
8
  config: PdfConfig;
7
9
  }) => JSX.Element;
@@ -10,36 +10,38 @@ const FieldVerificationBadge_1 = require("./FieldVerificationBadge");
10
10
  const Images_1 = require("./Images");
11
11
  const InnerTableRows_1 = require("./InnerTableRows");
12
12
  const helpers_1 = require("../../helpers");
13
- const Table = ({ schema, files, config, }) => {
14
- const [, profileObjects] = schema;
15
- /** every fieldName in this profile object */
13
+ const Table = ({ POs, files, config, }) => {
14
+ /** every fieldName in these profile object */
16
15
  const fieldNames = [
17
- ...new Set(profileObjects
18
- .flatMap(Object.keys)
19
- .filter((x) => !x.startsWith("$") &&
20
- !x.endsWith(".verification") &&
21
- !x.endsWith(" Verification"))),
16
+ ...new Set(POs.flatMap((PO) => Object.keys(PO.$properties))),
22
17
  ];
23
18
  // some or all POs in this schema are files themselves. So render the file, assuming it's an image
24
- const fileNIds = profileObjects.filter(helpers_1.isFile).map((x) => x.n_id);
19
+ const fileNIds = POs.filter(helpers_1.isPOFile).map((x) => x.$nId);
25
20
  if (fileNIds.length)
26
21
  return jsx_pdf_1.default.createElement(Images_1.Images, { nIds: fileNIds, files: files });
27
- const imageFieldNames = fieldNames.filter((x) => profileObjects.map((PO) => PO[x]).some(helpers_1.isFile));
28
- return (jsx_pdf_1.default.createElement("table", { layout: "noBorders" }, fieldNames.map((fieldName) => (jsx_pdf_1.default.createElement("row", null,
29
- jsx_pdf_1.default.createElement("cell", null,
30
- jsx_pdf_1.default.createElement("text", { color: "#12130e" }, fieldName.replace(/_/g, " "))),
31
- profileObjects.flatMap((PO) => {
32
- (0, helpers_1.assertSafeProperty)(fieldName);
33
- const status = PO[`${fieldName}.verification`] ||
34
- PO[`${fieldName} Verification`];
35
- const color = (0, general_1.verifyColour)(status);
36
- // jsx-pdf currently doesn't support fragments, will make a PR at some point
37
- return [
38
- jsx_pdf_1.default.createElement("cell", null,
39
- jsx_pdf_1.default.createElement(FieldVerificationBadge_1.FieldVerificationBadge, { width: 10, status: status })),
40
- jsx_pdf_1.default.createElement("cell", null,
41
- jsx_pdf_1.default.createElement(InnerTableRows_1.InnerTableRows, { key: fieldName, value: PO[fieldName], files: files, config: config, color: color, imageFieldNames: imageFieldNames })),
42
- ];
43
- }))))));
22
+ const imageFieldNames = fieldNames.filter((fieldName) => POs.map((PO) => { var _a; return (_a = PO.$properties[fieldName]) === null || _a === void 0 ? void 0 : _a.value; }).some(helpers_1.isFieldValueFile));
23
+ return (jsx_pdf_1.default.createElement("table", { layout: "noBorders" }, fieldNames.map((fieldName) => {
24
+ var _a;
25
+ return (jsx_pdf_1.default.createElement("row", null,
26
+ jsx_pdf_1.default.createElement("cell", null,
27
+ jsx_pdf_1.default.createElement("text", { color: "#12130e" }, ((_a = POs.find((PO) => PO.$properties[fieldName])) === null || _a === void 0 ? void 0 : _a.$properties[fieldName].title) || fieldName)),
28
+ POs.flatMap((PO) => {
29
+ (0, helpers_1.assertSafeProperty)(fieldName);
30
+ // if we're sharing multiple POs in this schema, and this field doesn't exist on this paticular PO,
31
+ // then just render some empty cells
32
+ if (!PO.$properties[fieldName]) {
33
+ return [jsx_pdf_1.default.createElement("cell", null, " "), jsx_pdf_1.default.createElement("cell", null, " ")];
34
+ }
35
+ const { value, verification } = PO.$properties[fieldName];
36
+ const color = (0, general_1.verifyColour)(verification);
37
+ // jsx-pdf currently doesn't support fragments, will make a PR at some point
38
+ return [
39
+ jsx_pdf_1.default.createElement("cell", null,
40
+ jsx_pdf_1.default.createElement(FieldVerificationBadge_1.FieldVerificationBadge, { width: 10, status: verification })),
41
+ jsx_pdf_1.default.createElement("cell", null,
42
+ jsx_pdf_1.default.createElement(InnerTableRows_1.InnerTableRows, { key: fieldName, value: value, files: files, config: config, color: color, imageFieldNames: imageFieldNames })),
43
+ ];
44
+ })));
45
+ })));
44
46
  };
45
47
  exports.Table = Table;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="jsx-pdf" />
2
- import { PdfSchema } from "../types";
3
- export declare const TableTitle: ({ schema }: {
4
- schema: PdfSchema;
2
+ import { FlatPO } from "../../helpers";
3
+ export declare const TableTitle: ({ POs }: {
4
+ POs: FlatPO[];
5
5
  }) => JSX.Element;
@@ -6,9 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TableTitle = void 0;
7
7
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
8
8
  const helpers_1 = require("../../helpers");
9
- const TableTitle = ({ schema }) => {
10
- const [schemaTitle, POs] = schema;
11
- const maybeFileName = POs.some(helpers_1.isFile) && (POs[0].title || POs[0].Title);
9
+ const TableTitle = ({ POs }) => {
10
+ var _a;
11
+ const schemaTitle = POs[0].$schemaTitle;
12
+ const maybeFileName = POs.some(helpers_1.isPOFile)
13
+ ? (_a = POs[0].$properties.title) === null || _a === void 0 ? void 0 : _a.value
14
+ : undefined;
12
15
  return (jsx_pdf_1.default.createElement("text", { bold: true, fontSize: 14, style: "marginBottom" }, maybeFileName || schemaTitle));
13
16
  };
14
17
  exports.TableTitle = TableTitle;
@@ -13,16 +13,16 @@ const asset = (name) => {
13
13
  exports.asset = asset;
14
14
  const loadAsset = (name) => (0, fs_1.readFileSync)((0, exports.asset)(name), { encoding: "utf-8" });
15
15
  exports.loadAsset = loadAsset;
16
- // TODO: clean this up
17
- /* eslint-disable no-nested-ternary */
18
- const verifyColour = (x) => x === types_1.FieldVerification.Verified
19
- ? "#12130e"
20
- : x === types_1.FieldVerification.VerifiedFalse ||
21
- x === types_1.POVerification.VerifiedFalse
22
- ? "#fb7171"
23
- : "#000";
16
+ const verifyColour = (x) => {
17
+ if (x === types_1.FieldVerification.Verified)
18
+ return "#12130e";
19
+ if (x === types_1.FieldVerification.VerifiedFalse ||
20
+ x === types_1.POVerification.VerifiedFalse) {
21
+ return "#fb7171";
22
+ }
23
+ return "#000";
24
+ };
24
25
  exports.verifyColour = verifyColour;
25
- /* eslint-enable no-nested-ternary */
26
26
  /**
27
27
  * Produces a date with a long month
28
28
  */
@@ -1,5 +1,6 @@
1
- import type { AId, IId, Instance, ProfileObject, RealVer, Schema } from "@raytio/types";
1
+ import type { AId, IId, Instance } from "@raytio/types";
2
2
  import { Config, InstanceDataToPassOn } from "../constants";
3
+ import { FlatPO } from "../helpers";
3
4
  import { ApplicationEncryptorLike } from "../types";
4
5
  declare type DecryptData = {
5
6
  apiToken: string;
@@ -23,7 +24,11 @@ export interface ProcessSubmissionInput {
23
24
  }
24
25
  export interface ProcessSubmissionOutput {
25
26
  /** details of the submission, included the decrypted profile objects */
26
- json: InstanceDataToPassOn & Record<string, any>;
27
+ json: InstanceDataToPassOn & {
28
+ profile_objects: {
29
+ [schemaName: string]: FlatPO[];
30
+ };
31
+ };
27
32
  /** A string of a CSV file containing the same data as in `json` */
28
33
  csv: string;
29
34
  /** an object of files that were attached to the submission, such as images */
@@ -34,12 +39,6 @@ export interface ProcessSubmissionOutput {
34
39
  a_id: AId;
35
40
  /** passed down so that pdf generation has access to it */
36
41
  client_url: string;
37
- /** @deprecated the low-level data for this submission - for Raytio internal use or advanced users */
38
- $source: {
39
- profileObjects: ProfileObject[];
40
- allSchemas: Schema[];
41
- realVers: RealVer[];
42
- };
43
42
  }
44
43
  export declare function processSubmission({ applicationId, instanceId, verbose, config, _supliedConfig, }: ProcessSubmissionInput): Promise<ProcessSubmissionOutput>;
45
44
  export {};
@@ -57,44 +57,49 @@ function processSubmission({ applicationId, instanceId, verbose, config, _suplie
57
57
  throw new Error("Submission contains invalid objects");
58
58
  return schemaName;
59
59
  });
60
- const allSchemas = yield Promise.all((0, ramda_1.uniq)(schemaNames).map((name) => (0, api_1.getSchema)(envConfig, apiToken, name)));
61
- // TODO: resolve URNs if any fields are URNs
60
+ const allSchemas = yield Promise.all((0, ramda_1.uniq)(schemaNames).map((name) => (0, api_1.getSchema)(envConfig, name)));
61
+ log("Fetching access application...");
62
+ const AA = yield (0, api_1.fetchAA)(apiToken, envConfig, instance.a_id);
63
+ let score;
64
+ if (AA.ruleset &&
65
+ typeof AA.ruleset === "object" &&
66
+ Object.keys(AA.ruleset).length) {
67
+ const ruleInputData = yield (0, core_1.convertInstanceToRuleInput)(instance, realVers, (schemaName) => (0, api_1.getSchema)(envConfig, schemaName));
68
+ try {
69
+ log("Calculating score...");
70
+ score = (0, core_1.calculateScore)(AA.ruleset, ruleInputData);
71
+ }
72
+ catch (ex) {
73
+ log(`Score calculation failed (${ex})`);
74
+ }
75
+ }
76
+ else {
77
+ log("No score rules configured on the AA.");
78
+ }
62
79
  log("Fetching verification providers...");
63
- const PODetails = yield (0, helpers_1.formatOutput)(profileObjects, allSchemas, realVers, apiToken, config, envConfig);
80
+ const PODetails = yield (0, helpers_1.formatOutput)(profileObjects, allSchemas, realVers, apiToken, envConfig);
64
81
  log("Fetching attached files...");
65
82
  const files = yield (0, api_1.getFiles)(profileObjects, instance, apiToken, envConfig, applicationDecryptor);
66
83
  const instanceDataToPassOn = (0, ramda_1.omit)(constants_1.INSTANCE_FIELDS_TO_REMOVE, instance);
67
84
  // final outputs
68
- const csv = (0, helpers_1.deepJsonToCsv)(Object.assign(Object.assign({}, (0, ramda_1.omit)(["a_id", "aa_name", "device_id", "source_ip"], instanceDataToPassOn)), (0, ramda_1.mapObjIndexed)(
69
- // TODO: (semver breaking) we omit these fields because it would a breaking change for the csv format.
70
- (v) => v.map((a) => {
71
- // TODO: (semver breaking) map the verification enums to the text to prevent a breaking change
72
- const b = Object.assign(Object.assign({}, (0, ramda_1.omit)([
73
- "$nId",
74
- "$schemaName",
75
- "$properties",
76
- "$shouldBeVerifiedFields",
77
- ], a)), { $verified: constants_1.PO_VER_TEXT_MAP[a.$verified] });
78
- return (0, ramda_1.mapObjIndexed)((fieldVal, fieldName) => {
79
- if (fieldName.endsWith(" Verification") ||
80
- fieldName.endsWith(".verification")) {
81
- return constants_1.FIELD_VER_TEXT_MAP[+fieldVal];
82
- }
83
- return fieldVal;
84
- }, b);
85
+ const csv = (0, helpers_1.deepJsonToCsv)(Object.assign(Object.assign({}, instanceDataToPassOn), (0, ramda_1.mapObjIndexed)((POList) => POList.map((flatPO) => {
86
+ // this is a bit weird, but it prevents an even bigger breaking change for the csv format
87
+ const obj = Object.entries(flatPO.$properties).flatMap(([fieldName, field]) => [
88
+ [fieldName, field.value],
89
+ [
90
+ `${fieldName}.verification`,
91
+ constants_1.FIELD_VER_TEXT_MAP[field.verification],
92
+ ],
93
+ ]);
94
+ return Object.assign(Object.assign(Object.assign({}, flatPO), { $verified: constants_1.PO_VER_TEXT_MAP[flatPO.$verified] }), Object.fromEntries(obj));
85
95
  }), PODetails)));
86
96
  log("Success!");
87
97
  return {
88
- json: Object.assign(Object.assign({}, instanceDataToPassOn), PODetails),
98
+ json: Object.assign(Object.assign({}, instanceDataToPassOn), { score, profile_objects: PODetails }),
89
99
  csv,
90
100
  files,
91
101
  a_id: applicationId,
92
102
  client_url: config.CLIENT_URL,
93
- $source: {
94
- profileObjects,
95
- allSchemas,
96
- realVers,
97
- },
98
103
  };
99
104
  }
100
105
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/decrypt-helper",
3
- "version": "2.2.0",
3
+ "version": "3.0.2",
4
4
  "author": "Raytio",
5
5
  "description": "A helper to decrypt data shared by Raytio users",
6
6
  "main": "dist",
@@ -22,9 +22,9 @@
22
22
  "dependencies": {
23
23
  "@aws-amplify/auth": "3.4.25",
24
24
  "@peculiar/webcrypto": "^1.2.3",
25
- "@raytio/core": "^9.0.0",
25
+ "@raytio/core": "^9.0.1",
26
26
  "@raytio/maxcryptor": "^3.1.0",
27
- "@raytio/types": "^5.2.1",
27
+ "@raytio/types": "^6.0.0",
28
28
  "aws-sdk": "^2.754.0",
29
29
  "jsx-pdf": "^2.3.0",
30
30
  "localstorage-polyfill": "^1.0.1",
@@ -38,19 +38,19 @@
38
38
  "@types/jest-image-snapshot": "^4.3.1",
39
39
  "@types/jsx-pdf": "^2.2.2",
40
40
  "@types/mime-types": "^2.1.1",
41
- "@types/node": "^16.11.22",
41
+ "@types/node": "^16.11.24",
42
42
  "@types/node-fetch": "^2.5.12",
43
43
  "@types/pdfmake": "^0.1.20",
44
44
  "@types/ramda": "^0.27.64",
45
45
  "dotenv": "^16.0.0",
46
46
  "eslint": "^8.8.0",
47
- "eslint-config-kyle": "^8.1.1",
48
- "jest": "^27.4.7",
47
+ "eslint-config-kyle": "^8.3.0",
48
+ "jest": "^27.5.1",
49
49
  "jest-image-snapshot": "^4.5.1",
50
50
  "jest-junit": "^13.0.0",
51
51
  "pdf-to-img": "^1.2.0",
52
52
  "ts-jest": "^27.1.3",
53
- "ts-node": "^10.4.0",
53
+ "ts-node": "^10.5.0",
54
54
  "typescript": "^4.5.5"
55
55
  },
56
56
  "eslintConfig": {