@raytio/types 5.2.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +638 -0
- package/dist/crypto.d.ts +2 -2
- package/dist/index.js +5 -1
- package/dist/raytio.d.ts +20 -10
- package/dist/schema.d.ts +39 -19
- package/dist/theme.d.ts +4 -0
- package/dist/verification.d.ts +27 -20
- package/dist/verification.js +4 -0
- package/dist/wizard.d.ts +13 -5
- package/package.json +3 -2
- package/src/__tests__/schema.ts +23 -0
- package/src/crypto.ts +3 -2
- package/src/raytio.ts +26 -11
- package/src/schema.ts +72 -18
- package/src/theme.ts +2 -0
- package/src/verification.ts +36 -23
- package/src/wizard.ts +16 -5
package/dist/raytio.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Encrypted } from "./crypto";
|
|
2
|
-
import { Colors } from "./theme";
|
|
2
|
+
import { Colors, CustomFonts } from "./theme";
|
|
3
3
|
/** @internal see Microsoft/TypeScript#202 */
|
|
4
4
|
export declare type StringWithIdentity<T> = string & {
|
|
5
5
|
$$typeof$$: T;
|
|
6
6
|
};
|
|
7
|
+
/** @internal */
|
|
8
|
+
declare type Json = Record<string, any>;
|
|
7
9
|
/** A `p_id` is the ID of a @see Relationship */
|
|
8
10
|
export declare type PId = StringWithIdentity<"PId">;
|
|
9
11
|
/** An `i_id` is the ID of an @see Instance */
|
|
@@ -16,12 +18,12 @@ export declare type GId = StringWithIdentity<"GId">;
|
|
|
16
18
|
export declare type UId = StringWithIdentity<"UId">;
|
|
17
19
|
/** An `a_id` is the ID of an @see AA */
|
|
18
20
|
export declare type AId = StringWithIdentity<"AId">;
|
|
19
|
-
/** @
|
|
21
|
+
/** An `o_id` is the ID of an @see Organization */
|
|
22
|
+
export declare type OId = StringWithIdentity<"OId">;
|
|
20
23
|
export declare type DataTypes = "string" | "number" | "boolean" | "object" | "integer" | "array" | "null";
|
|
21
|
-
/** @internal */
|
|
22
24
|
export declare type SubmissionStatus = "Submitted" | "Processing" | "Rejected" | "Expired" | "Completed" | "DataChanged" | "Received" | "Accepted";
|
|
23
25
|
/** You can supply an option type argument if you know exactly what the properties will be */
|
|
24
|
-
export declare type ProfileObject<Properties =
|
|
26
|
+
export declare type ProfileObject<Properties = Json> = {
|
|
25
27
|
n_id: NId;
|
|
26
28
|
properties: Properties;
|
|
27
29
|
labels: string[];
|
|
@@ -31,10 +33,10 @@ export declare type ProfileObject<Properties = any> = {
|
|
|
31
33
|
* @internal the client adds this, if this PO doesn't actually belong to the current user,
|
|
32
34
|
* i.e. it's actually from a submission. If truthy, it's the `[aId, iId]` of the submission.
|
|
33
35
|
*/
|
|
34
|
-
isFromSubmission?: [aId:
|
|
36
|
+
isFromSubmission?: [aId: AId, iId: IId];
|
|
35
37
|
};
|
|
36
38
|
/** @internal This is what we send the API */
|
|
37
|
-
export declare type ProfileObjectForUpload<Properties =
|
|
39
|
+
export declare type ProfileObjectForUpload<Properties = Json> = {
|
|
38
40
|
properties: Properties;
|
|
39
41
|
document?: {
|
|
40
42
|
content?: string | Encrypted;
|
|
@@ -75,6 +77,8 @@ export declare type Lookup = {
|
|
|
75
77
|
label?: string | number;
|
|
76
78
|
children?: Lookup[];
|
|
77
79
|
description?: string;
|
|
80
|
+
/** used in AkahuDynamicSection only */
|
|
81
|
+
requires_2FA?: boolean;
|
|
78
82
|
};
|
|
79
83
|
export declare type AA = {
|
|
80
84
|
a_id: AId;
|
|
@@ -91,12 +95,17 @@ export declare type AA = {
|
|
|
91
95
|
/** markdown or string help information including [phoneNumber || email] */
|
|
92
96
|
aa_help?: string;
|
|
93
97
|
theme?: {
|
|
94
|
-
|
|
98
|
+
font?: CustomFonts;
|
|
99
|
+
colors?: Colors;
|
|
95
100
|
};
|
|
96
101
|
/** the n_id of the associated service provider */
|
|
97
102
|
service_provider_n_id?: NId;
|
|
98
103
|
/** the id of the associated organisation */
|
|
99
|
-
org_id:
|
|
104
|
+
org_id: OId;
|
|
105
|
+
/** configuration for the submission rules */
|
|
106
|
+
ruleset?: unknown;
|
|
107
|
+
/** if true, only specific email addresses can submit the form */
|
|
108
|
+
auth_list_enabled?: boolean;
|
|
100
109
|
/** @internal */
|
|
101
110
|
_transitions?: unknown[];
|
|
102
111
|
};
|
|
@@ -123,7 +132,7 @@ export declare type Instance = {
|
|
|
123
132
|
/** @depreacted The status of a submission */
|
|
124
133
|
_state?: SubmissionStatus;
|
|
125
134
|
/** Previous status of the shared information */
|
|
126
|
-
previous_state:
|
|
135
|
+
previous_state: SubmissionStatus;
|
|
127
136
|
/** Hash of the Service Provider ID */
|
|
128
137
|
sub_service_provider_hash?: string;
|
|
129
138
|
/** Service provider ID */
|
|
@@ -145,7 +154,7 @@ export declare type Instance = {
|
|
|
145
154
|
* NOTE: this is different to how the schema defines an Organization. **The schema is wrong (see #468)**
|
|
146
155
|
*/
|
|
147
156
|
export declare type Organization = {
|
|
148
|
-
id:
|
|
157
|
+
id: OId;
|
|
149
158
|
name: string;
|
|
150
159
|
email: string;
|
|
151
160
|
address: {
|
|
@@ -174,3 +183,4 @@ export declare type Validation = {
|
|
|
174
183
|
};
|
|
175
184
|
};
|
|
176
185
|
};
|
|
186
|
+
export {};
|
package/dist/schema.d.ts
CHANGED
|
@@ -7,27 +7,27 @@ export declare type ConditionallyRequired = {
|
|
|
7
7
|
[fieldName: string]: string[];
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export declare type SchemaFieldTag = "password" | `group:${string}` | `upload-group:${string}` | "display:stars" | "display:no_autofill" | "display:currency" | "display:cascade" | "display:survey" | "display:quoting" | "display:customModal" | "display:showOnWizard" | `display:main_media:${string}` | "action:client_upload" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:extract_required";
|
|
11
|
-
export declare type SchemaTag = "action:experimental_pass_object_store_id" | "action:verify" | "default_camera:rear" | "default_camera:front" | "type:service_provider" | "type:service_offer" | "type:marketplace" | "type:client_only" | "type:globally_unique_field";
|
|
10
|
+
export declare type SchemaFieldTag = "password" | `group:${string}` | `upload-group:${string}` | "display:stars" | "display:no_autofill" | "display:currency" | "display:cascade" | "display:survey" | "display:quoting" | "display:customModal" | "display:terms_conditions" | "display:showOnWizard" | `display:main_media:${string}` | "date_component:day" | "date_component:month" | "date_component:year" | "action:client_upload" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:capture_geolocation" | "type:extract_required";
|
|
11
|
+
export declare type SchemaTag = "action:experimental_pass_object_store_id" | "action:verify" | "default_camera:rear" | "default_camera:front" | `oauth2_component:name:${string}` | `oauth2_component:redirect_url:${string}` | `link_to:${string}:${string}` | "type:service_provider" | "type:service_offer" | "type:marketplace" | "type:client_only" | "type:globally_unique_field";
|
|
12
12
|
export declare type SchemaField = {
|
|
13
13
|
/** @deprecated don't use, it's inconsistent */
|
|
14
14
|
$id?: string;
|
|
15
15
|
title?: string;
|
|
16
|
+
title_plural?: string;
|
|
16
17
|
description?: string;
|
|
17
18
|
/** readOnly means the Wizard won't show this field */
|
|
18
19
|
readOnly?: boolean;
|
|
19
20
|
examples?: unknown[];
|
|
20
21
|
tags?: SchemaFieldTag[];
|
|
21
22
|
type?: DataTypes;
|
|
22
|
-
enum?:
|
|
23
|
+
enum?: string[];
|
|
23
24
|
maximum?: number;
|
|
24
25
|
minimum?: number;
|
|
25
26
|
/** @deprecated raytio's usage not documented */
|
|
26
27
|
maxLength?: number;
|
|
27
28
|
/** @deprecated raytio's usage not documented */
|
|
28
29
|
minLength?: number;
|
|
29
|
-
/**
|
|
30
|
-
defaultValue?: unknown;
|
|
30
|
+
/** the default value */
|
|
31
31
|
default?: unknown;
|
|
32
32
|
pattern?: string;
|
|
33
33
|
/** whether the field should be encrypted */
|
|
@@ -35,13 +35,17 @@ export declare type SchemaField = {
|
|
|
35
35
|
format?: "date" | "date-time";
|
|
36
36
|
contentMediaType?: string;
|
|
37
37
|
contentEncoding?: "base64";
|
|
38
|
-
/** for nested
|
|
38
|
+
/** `items` is used for nested arrays, (while `properties` is used for nested objects) */
|
|
39
39
|
items?: {
|
|
40
40
|
type: DataTypes;
|
|
41
41
|
properties: {
|
|
42
42
|
[subFieldName: string]: SchemaField;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
+
/** `properties` is used for nested objects, (while `items` is used for nested arrays) */
|
|
46
|
+
properties?: {
|
|
47
|
+
[subFieldName: string]: SchemaField;
|
|
48
|
+
};
|
|
45
49
|
/** If this field refers to a sub-object */
|
|
46
50
|
$ref?: string;
|
|
47
51
|
/**
|
|
@@ -61,10 +65,10 @@ export declare type SchemaField = {
|
|
|
61
65
|
/** URL to a JSON file in the `Lookup` format */
|
|
62
66
|
lookup?: string;
|
|
63
67
|
/** @internal the client adds this - it's the fieldName. */
|
|
64
|
-
$prop
|
|
68
|
+
$prop: string;
|
|
65
69
|
priority?: number;
|
|
66
70
|
/** @internal if supplied, it's the existing field values. Added by the client */
|
|
67
|
-
subObjectRef?:
|
|
71
|
+
subObjectRef?: unknown[];
|
|
68
72
|
/** specifies that the description is formatted in markdown */
|
|
69
73
|
description_decorator?: "md";
|
|
70
74
|
/** if a `pattern` is specified, this is the error message */
|
|
@@ -80,6 +84,8 @@ export declare type SchemaField = {
|
|
|
80
84
|
};
|
|
81
85
|
/** if this field is a table input, this determines the text to show on the "Add Row" btn */
|
|
82
86
|
add_row_btn_label?: string;
|
|
87
|
+
/** if this field is a table input, this determines the text to show if the table is empty */
|
|
88
|
+
table_empty_message?: string;
|
|
83
89
|
/**
|
|
84
90
|
* used on fields that are a signature file picker, see !849
|
|
85
91
|
* also used to determine if the MediaPicker should be shown inline
|
|
@@ -101,8 +107,12 @@ export declare type Schema = {
|
|
|
101
107
|
$id?: string;
|
|
102
108
|
$schema?: string;
|
|
103
109
|
n_id?: NId;
|
|
104
|
-
/**
|
|
110
|
+
/** these fields will always exist on schema */
|
|
105
111
|
name: string;
|
|
112
|
+
title: string;
|
|
113
|
+
description: string;
|
|
114
|
+
/** plural version of the title */
|
|
115
|
+
title_plural?: string;
|
|
106
116
|
/**
|
|
107
117
|
* the group that a schema belongs to, such as "passports". This is useful for
|
|
108
118
|
* forms that accept different types of similar documents.
|
|
@@ -110,10 +120,11 @@ export declare type Schema = {
|
|
|
110
120
|
schema_group?: string;
|
|
111
121
|
/** the localized title of the `schema_group`. added by the client */
|
|
112
122
|
group_title?: string;
|
|
113
|
-
title?: string;
|
|
114
|
-
description?: string;
|
|
115
123
|
/** @deprecated not sure why a schema would have this, only fields should */
|
|
116
124
|
$ref?: string;
|
|
125
|
+
version?: string;
|
|
126
|
+
/** whether the `version` is the latest version */
|
|
127
|
+
version_current?: boolean;
|
|
117
128
|
tags?: SchemaTag[];
|
|
118
129
|
/** originally `string[]`, the client modifies this */
|
|
119
130
|
verified_fields?: (string | ConditionallyRequired)[];
|
|
@@ -129,13 +140,10 @@ export declare type Schema = {
|
|
|
129
140
|
if?: Schema;
|
|
130
141
|
then?: Schema;
|
|
131
142
|
}[];
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* - if the schema is a sub-object
|
|
137
|
-
*/
|
|
138
|
-
properties?: {
|
|
143
|
+
/** If this tag exists, the schema is deprecated. ISO Date. */
|
|
144
|
+
end_date?: string;
|
|
145
|
+
/** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
|
|
146
|
+
properties: {
|
|
139
147
|
[fieldName: string]: SchemaField;
|
|
140
148
|
};
|
|
141
149
|
i18n?: {
|
|
@@ -171,7 +179,7 @@ export declare type Schema = {
|
|
|
171
179
|
$loading_pending_ver_resubmit: {
|
|
172
180
|
title: string;
|
|
173
181
|
};
|
|
174
|
-
[fieldNameOrGroupName: string]: SchemaField & {
|
|
182
|
+
[fieldNameOrGroupName: string]: Omit<SchemaField, "$prop"> & {
|
|
175
183
|
title_plural?: string;
|
|
176
184
|
};
|
|
177
185
|
};
|
|
@@ -270,3 +278,15 @@ export declare type Schema = {
|
|
|
270
278
|
return_to?: string;
|
|
271
279
|
};
|
|
272
280
|
};
|
|
281
|
+
/** Only certain properties from the schema */
|
|
282
|
+
export declare type SchemaMetadata = Pick<Schema, "name" | "title" | "description" | "schema_group" | "end_date" | "i18n" | "display" | "tags" | "clientLocale" | "groupNames" | "title_plural" | "group_title"> & {
|
|
283
|
+
/**
|
|
284
|
+
* @deprecated this prop exists so that SchemaMetadata does not extend Schema.
|
|
285
|
+
* use `getSchema(schemaName)` to fetch the full schema
|
|
286
|
+
*/
|
|
287
|
+
__typeof__: "You cannot supply SchemaMetadata to a function that expects Schema";
|
|
288
|
+
isProfileSchema: boolean;
|
|
289
|
+
isSpSchema: boolean;
|
|
290
|
+
};
|
|
291
|
+
/** @ignore */
|
|
292
|
+
export declare type RelationDefinition = NonNullable<Schema["relationships"]>[number];
|
package/dist/theme.d.ts
CHANGED
package/dist/verification.d.ts
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import { NId, ProfileObject } from "./raytio";
|
|
2
|
+
export declare type VerificationPayload<WithValue extends boolean> = {
|
|
3
|
+
field: string;
|
|
4
|
+
schema?: string;
|
|
5
|
+
metadata?: Record<string, unknown>;
|
|
6
|
+
passed: boolean;
|
|
7
|
+
request_div: string;
|
|
8
|
+
/** @deprecated don't use this, it looks like the schema name but it's not */
|
|
9
|
+
source: string;
|
|
10
|
+
/** the n_id of the parent profile object that this ver belongs (NOT the n_id of the field) */
|
|
11
|
+
source_n_id?: NId;
|
|
12
|
+
/** like `source_n_id` */
|
|
13
|
+
source_hashed_n_id?: NId;
|
|
14
|
+
type?: null;
|
|
15
|
+
v_id: string;
|
|
16
|
+
verification_date: string;
|
|
17
|
+
verifier_id?: NId;
|
|
18
|
+
verifier_source_id?: NId;
|
|
19
|
+
verifier_service_id?: NId;
|
|
20
|
+
verifier_div: string;
|
|
21
|
+
/** ISO Date */
|
|
22
|
+
valid_until?: string;
|
|
23
|
+
} & (WithValue extends true ? {
|
|
24
|
+
value: string | number;
|
|
25
|
+
} : {});
|
|
2
26
|
/**
|
|
3
27
|
* Different APIs inconsistently include the `value` prop. If you know it exists,
|
|
4
28
|
* use `Verification<true>`, otherwise just `Verification`. Verifications from
|
|
@@ -16,24 +40,7 @@ export declare type Verification<WithValue extends boolean = false> = ProfileObj
|
|
|
16
40
|
verifications: [
|
|
17
41
|
{
|
|
18
42
|
signature: string;
|
|
19
|
-
data:
|
|
20
|
-
field: string;
|
|
21
|
-
metadata?: Record<string, unknown>;
|
|
22
|
-
passed: boolean;
|
|
23
|
-
request_div: string;
|
|
24
|
-
/** @deprecated don't use this, it looks like the schema name but it's not */
|
|
25
|
-
source: string;
|
|
26
|
-
/** the n_id of the parent profile object that this ver belongs (NOT the n_id of the field) */
|
|
27
|
-
source_n_id: NId;
|
|
28
|
-
v_id: string;
|
|
29
|
-
verification_date: string;
|
|
30
|
-
verifier_id?: NId;
|
|
31
|
-
verifier_source_id?: NId;
|
|
32
|
-
verifier_service_id?: NId;
|
|
33
|
-
verifier_div: string;
|
|
34
|
-
} & (WithValue extends true ? {
|
|
35
|
-
value: string | number;
|
|
36
|
-
} : {});
|
|
43
|
+
data: VerificationPayload<WithValue>;
|
|
37
44
|
}
|
|
38
45
|
];
|
|
39
46
|
}>;
|
|
@@ -62,12 +69,12 @@ export declare type VerificationProvider = {
|
|
|
62
69
|
dataSourceNId?: NId;
|
|
63
70
|
serviceProviderNId?: NId;
|
|
64
71
|
/** the date which the verification was verified on, or last re-verified on */
|
|
65
|
-
date
|
|
72
|
+
date?: Date;
|
|
66
73
|
};
|
|
67
74
|
/** This is what @raytio/core exposes, which is more useable than @see Verification */
|
|
68
75
|
export declare type RealVer = {
|
|
69
76
|
fieldName: string;
|
|
70
|
-
value:
|
|
77
|
+
value: unknown;
|
|
71
78
|
provider: VerificationProvider;
|
|
72
79
|
signature: string;
|
|
73
80
|
/**
|
package/dist/verification.js
CHANGED
|
@@ -5,6 +5,8 @@ exports.POVerification = exports.FieldVerification = void 0;
|
|
|
5
5
|
* "Not Verified" means show no badge, cf. "Verified False" means the
|
|
6
6
|
* verifier revealed that the data was wrong. So show a ❌
|
|
7
7
|
*/
|
|
8
|
+
// We cannot change the enum values, since ScoreRules have been generated
|
|
9
|
+
// with the enum values hardcoded. The enum value are also used to find the "best" or "worst" verification (lower=better)
|
|
8
10
|
var FieldVerification;
|
|
9
11
|
(function (FieldVerification) {
|
|
10
12
|
FieldVerification[FieldVerification["Verified"] = 60001] = "Verified";
|
|
@@ -12,6 +14,8 @@ var FieldVerification;
|
|
|
12
14
|
FieldVerification[FieldVerification["VerifiedFalse"] = 60003] = "VerifiedFalse";
|
|
13
15
|
FieldVerification[FieldVerification["Expired"] = 60004] = "Expired";
|
|
14
16
|
})(FieldVerification = exports.FieldVerification || (exports.FieldVerification = {}));
|
|
17
|
+
// We cannot change the enum values, since ScoreRules have been generated
|
|
18
|
+
// with the enum values hardcoded.
|
|
15
19
|
var POVerification;
|
|
16
20
|
(function (POVerification) {
|
|
17
21
|
POVerification[POVerification["FullyVerified"] = 70001] = "FullyVerified";
|
package/dist/wizard.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { AId } from "./raytio";
|
|
2
2
|
/** configuration data for a single wizard page (@see WizardConfig) */
|
|
3
|
-
export
|
|
3
|
+
export declare type WizardPage = {
|
|
4
4
|
/** if undefined, the schema title will be used */
|
|
5
5
|
name?: string | symbol;
|
|
6
6
|
filter: "oneOf" | "anyOf";
|
|
7
7
|
schemas: string[];
|
|
8
|
+
/** the fallback description, if there isn't one for the specific situation */
|
|
8
9
|
description?: string;
|
|
10
|
+
description_select?: string;
|
|
11
|
+
description_create?: string;
|
|
12
|
+
description_update?: string;
|
|
9
13
|
/** if explictly == false, then it's an AO (not a PO), in which case there can only be one schema */
|
|
10
14
|
profile?: boolean;
|
|
11
15
|
/** if true this page can be skipped. The PageResult wil be undefined */
|
|
@@ -37,13 +41,17 @@ export interface WizardPage {
|
|
|
37
41
|
extract_threshold_pass_action?: "review" | "next_step";
|
|
38
42
|
/** for ImageDynamicSection, the action to take if pre-verify fails */
|
|
39
43
|
extract_threshold_fail_action?: "capture" | "capture_review" | "recapture_or_next_step" | "review" | "next_step";
|
|
44
|
+
/** for ImageDynamicSection, the action to take if the API returns no `validation: {}` object */
|
|
45
|
+
extract_threshold_null_action?: WizardPage["extract_threshold_fail_action"];
|
|
40
46
|
/** if `false`, ProfileObjects created while completing the form will not be verified. `undefined` implies `true` */
|
|
41
|
-
|
|
47
|
+
verify_data?: boolean;
|
|
42
48
|
/** a list of fields that should not be required, even if the schema says they're required */
|
|
43
49
|
optional_fields?: string[];
|
|
44
|
-
/** the
|
|
50
|
+
/** the information to share. undefined implies both. */
|
|
45
51
|
share?: "profile" | "verification" | "both";
|
|
46
|
-
|
|
52
|
+
/** can you force the colour theme to change for just one page (#1066, #1074). At the moment this on pages that use WebcamImageCapture */
|
|
53
|
+
display_mode?: "light" | "dark" | "default";
|
|
54
|
+
};
|
|
47
55
|
/**
|
|
48
56
|
* when a form link is generated, this is what gets saved on the API.
|
|
49
57
|
* Each value can be overriden in the query parameters. If specified
|
|
@@ -75,7 +83,7 @@ export declare type WizardConfig = {
|
|
|
75
83
|
/** if specified, the email addresses that a submission should be sent to */
|
|
76
84
|
emails?: string[];
|
|
77
85
|
/**
|
|
78
|
-
* whether the
|
|
86
|
+
* whether the passwordless-signup process should be used if the user visits
|
|
79
87
|
* this form, and they are not logged in. If false, the standard sign-up
|
|
80
88
|
* process will be used
|
|
81
89
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raytio/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"types": "index",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"docs": "sh ../../scripts/generate-docs.sh",
|
|
15
|
-
"
|
|
15
|
+
"test": "npm run build",
|
|
16
|
+
"build": "tsc && rm -rf dist/__tests__"
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable fp/no-let, @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { Schema, SchemaField, SchemaMetadata } from "..";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* this file is not run, it is just compiled by tsc
|
|
6
|
+
* If compilation suceeds, then the test passes.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
let schema: Schema;
|
|
10
|
+
let schemaField: SchemaField;
|
|
11
|
+
let schemaMetadata: SchemaMetadata;
|
|
12
|
+
|
|
13
|
+
function f() {
|
|
14
|
+
// @ts-expect-error SchemaField should not extend Schema
|
|
15
|
+
const test1: SchemaField = schema;
|
|
16
|
+
// @ts-expect-error Schema should not extend SchemaField
|
|
17
|
+
const test2: Schema = schemaField;
|
|
18
|
+
|
|
19
|
+
// @ts-expect-error SchemaMetadata should not extend Schema
|
|
20
|
+
const test3: SchemaMetadata = schema;
|
|
21
|
+
// @ts-expect-error Schema should not extend SchemaMetadata
|
|
22
|
+
const test4: Schema = schemaMetadata;
|
|
23
|
+
}
|
package/src/crypto.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
export type Encrypted<_Data = string> = {
|
|
2
3
|
encrypted_key: {
|
|
3
4
|
encrypted_key: string;
|
|
4
5
|
};
|
|
5
6
|
encrypted_data: {
|
|
6
7
|
iv: string;
|
|
7
|
-
data:
|
|
8
|
+
data: string;
|
|
8
9
|
algorithm: AesKeyAlgorithm;
|
|
9
10
|
};
|
|
10
11
|
};
|
package/src/raytio.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Encrypted } from "./crypto";
|
|
2
|
-
import { Colors } from "./theme";
|
|
2
|
+
import { Colors, CustomFonts } from "./theme";
|
|
3
3
|
|
|
4
4
|
/** @internal see Microsoft/TypeScript#202 */
|
|
5
5
|
export type StringWithIdentity<T> = string & { $$typeof$$: T };
|
|
6
6
|
|
|
7
|
+
/** @internal */
|
|
8
|
+
type Json = Record<string, any>; // TODO: (semver breaking) unknown
|
|
9
|
+
|
|
7
10
|
/** A `p_id` is the ID of a @see Relationship */
|
|
8
11
|
export type PId = StringWithIdentity<"PId">;
|
|
9
12
|
/** An `i_id` is the ID of an @see Instance */
|
|
@@ -16,8 +19,9 @@ export type GId = StringWithIdentity<"GId">;
|
|
|
16
19
|
export type UId = StringWithIdentity<"UId">;
|
|
17
20
|
/** An `a_id` is the ID of an @see AA */
|
|
18
21
|
export type AId = StringWithIdentity<"AId">;
|
|
22
|
+
/** An `o_id` is the ID of an @see Organization */
|
|
23
|
+
export type OId = StringWithIdentity<"OId">;
|
|
19
24
|
|
|
20
|
-
/** @internal */
|
|
21
25
|
export type DataTypes =
|
|
22
26
|
| "string"
|
|
23
27
|
| "number"
|
|
@@ -27,7 +31,6 @@ export type DataTypes =
|
|
|
27
31
|
| "array"
|
|
28
32
|
| "null";
|
|
29
33
|
|
|
30
|
-
/** @internal */
|
|
31
34
|
export type SubmissionStatus =
|
|
32
35
|
| "Submitted"
|
|
33
36
|
| "Processing"
|
|
@@ -39,7 +42,7 @@ export type SubmissionStatus =
|
|
|
39
42
|
| "Accepted";
|
|
40
43
|
|
|
41
44
|
/** You can supply an option type argument if you know exactly what the properties will be */
|
|
42
|
-
export type ProfileObject<Properties =
|
|
45
|
+
export type ProfileObject<Properties = Json> = {
|
|
43
46
|
n_id: NId;
|
|
44
47
|
properties: Properties;
|
|
45
48
|
labels: string[];
|
|
@@ -49,11 +52,11 @@ export type ProfileObject<Properties = any> = {
|
|
|
49
52
|
* @internal the client adds this, if this PO doesn't actually belong to the current user,
|
|
50
53
|
* i.e. it's actually from a submission. If truthy, it's the `[aId, iId]` of the submission.
|
|
51
54
|
*/
|
|
52
|
-
isFromSubmission?: [aId:
|
|
55
|
+
isFromSubmission?: [aId: AId, iId: IId];
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
/** @internal This is what we send the API */
|
|
56
|
-
export type ProfileObjectForUpload<Properties =
|
|
59
|
+
export type ProfileObjectForUpload<Properties = Json> = {
|
|
57
60
|
properties: Properties;
|
|
58
61
|
document?: {
|
|
59
62
|
content?: string | Encrypted;
|
|
@@ -82,7 +85,7 @@ export type UrnNodeType =
|
|
|
82
85
|
| "user"
|
|
83
86
|
| "profile_object"
|
|
84
87
|
| "instance"
|
|
85
|
-
| "temp_object" // this will only be encountered in backend environments which lack access to an applicationDecryptor
|
|
88
|
+
| "temp_object" // this will only be encountered in backend environments which lack access to an applicationDecryptor, or from RapidShare
|
|
86
89
|
| "document";
|
|
87
90
|
|
|
88
91
|
/** e.g. "urn:user:..." */
|
|
@@ -107,6 +110,9 @@ export type Lookup = {
|
|
|
107
110
|
label?: string | number;
|
|
108
111
|
children?: Lookup[];
|
|
109
112
|
description?: string;
|
|
113
|
+
|
|
114
|
+
/** used in AkahuDynamicSection only */
|
|
115
|
+
requires_2FA?: boolean;
|
|
110
116
|
};
|
|
111
117
|
|
|
112
118
|
export type AA = {
|
|
@@ -124,12 +130,21 @@ export type AA = {
|
|
|
124
130
|
/** markdown or string help information including [phoneNumber || email] */
|
|
125
131
|
aa_help?: string;
|
|
126
132
|
theme?: {
|
|
127
|
-
|
|
133
|
+
font?: CustomFonts;
|
|
134
|
+
colors?: Colors;
|
|
128
135
|
};
|
|
129
136
|
/** the n_id of the associated service provider */
|
|
130
137
|
service_provider_n_id?: NId;
|
|
131
138
|
/** the id of the associated organisation */
|
|
132
|
-
org_id:
|
|
139
|
+
org_id: OId;
|
|
140
|
+
|
|
141
|
+
/** configuration for the submission rules */
|
|
142
|
+
// we know the type should be `ScoreConfig`, but we can't rely that it's valid, or the right version
|
|
143
|
+
ruleset?: unknown;
|
|
144
|
+
|
|
145
|
+
/** if true, only specific email addresses can submit the form */
|
|
146
|
+
auth_list_enabled?: boolean;
|
|
147
|
+
|
|
133
148
|
/** @internal */
|
|
134
149
|
_transitions?: unknown[];
|
|
135
150
|
};
|
|
@@ -157,7 +172,7 @@ export type Instance = {
|
|
|
157
172
|
/** @depreacted The status of a submission */
|
|
158
173
|
_state?: SubmissionStatus;
|
|
159
174
|
/** Previous status of the shared information */
|
|
160
|
-
previous_state:
|
|
175
|
+
previous_state: SubmissionStatus;
|
|
161
176
|
/** Hash of the Service Provider ID */
|
|
162
177
|
sub_service_provider_hash?: string;
|
|
163
178
|
/** Service provider ID */
|
|
@@ -182,7 +197,7 @@ export type Instance = {
|
|
|
182
197
|
* NOTE: this is different to how the schema defines an Organization. **The schema is wrong (see #468)**
|
|
183
198
|
*/
|
|
184
199
|
export type Organization = {
|
|
185
|
-
id:
|
|
200
|
+
id: OId;
|
|
186
201
|
name: string;
|
|
187
202
|
email: string;
|
|
188
203
|
address: {
|