@salesforce/lds-adapters-industries-eri 1.124.2 → 1.124.4
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/es/es2018/industries-eri.js +501 -501
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/getERIDigest.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +1 -1
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +2 -2
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectEriDigest.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/types/DigestNotification.d.ts +63 -63
- package/dist/{types → es/es2018/types}/src/generated/types/ERIDigestInputRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ERIDigestInputRepresentationWrapper.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ERIDigestOutputRepresentation.d.ts +52 -52
- package/dist/{types → es/es2018/types}/src/generated/types/FollowingInfo.d.ts +35 -35
- package/dist/{types → es/es2018/types}/src/generated/types/FollowingInfoInputRepresentation.d.ts +41 -41
- package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
- package/package.json +5 -5
- package/sfdc/index.d.ts +1 -1
- package/sfdc/index.js +517 -517
- package/dist/umd/es2018/industries-eri.js +0 -536
- package/dist/umd/es5/industries-eri.js +0 -541
|
@@ -6,523 +6,523 @@
|
|
|
6
6
|
|
|
7
7
|
import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
|
|
8
8
|
|
|
9
|
-
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
-
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
|
|
11
|
-
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
-
/**
|
|
13
|
-
* Validates an adapter config is well-formed.
|
|
14
|
-
* @param config The config to validate.
|
|
15
|
-
* @param adapter The adapter validation configuration.
|
|
16
|
-
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
-
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
-
*/
|
|
19
|
-
function validateConfig(config, adapter, oneOf) {
|
|
20
|
-
const { displayName } = adapter;
|
|
21
|
-
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
-
if (config === undefined ||
|
|
23
|
-
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
-
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
-
}
|
|
26
|
-
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
-
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
-
}
|
|
29
|
-
if (unsupported !== undefined &&
|
|
30
|
-
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
-
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
-
}
|
|
33
|
-
const supported = required.concat(optional);
|
|
34
|
-
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
-
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function untrustedIsObject(untrusted) {
|
|
39
|
-
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
-
}
|
|
41
|
-
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
-
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
-
}
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
44
|
const keyPrefix = 'eri';
|
|
45
45
|
|
|
46
|
-
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
47
|
-
const { isArray: ArrayIsArray } = Array;
|
|
48
|
-
const { stringify: JSONStringify } = JSON;
|
|
49
|
-
function deepFreeze$3(value) {
|
|
50
|
-
// No need to freeze primitives
|
|
51
|
-
if (typeof value !== 'object' || value === null) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (ArrayIsArray(value)) {
|
|
55
|
-
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
56
|
-
deepFreeze$3(value[i]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
const keys = ObjectKeys(value);
|
|
61
|
-
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
62
|
-
deepFreeze$3(value[keys[i]]);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
ObjectFreeze(value);
|
|
66
|
-
}
|
|
67
|
-
function createLink(ref) {
|
|
68
|
-
return {
|
|
69
|
-
__ref: serializeStructuredKey(ref),
|
|
70
|
-
};
|
|
46
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
47
|
+
const { isArray: ArrayIsArray } = Array;
|
|
48
|
+
const { stringify: JSONStringify } = JSON;
|
|
49
|
+
function deepFreeze$3(value) {
|
|
50
|
+
// No need to freeze primitives
|
|
51
|
+
if (typeof value !== 'object' || value === null) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (ArrayIsArray(value)) {
|
|
55
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
56
|
+
deepFreeze$3(value[i]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const keys = ObjectKeys(value);
|
|
61
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
62
|
+
deepFreeze$3(value[keys[i]]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
ObjectFreeze(value);
|
|
66
|
+
}
|
|
67
|
+
function createLink(ref) {
|
|
68
|
+
return {
|
|
69
|
+
__ref: serializeStructuredKey(ref),
|
|
70
|
+
};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function validate$4(obj, path = 'FollowingInfoInputRepresentation') {
|
|
74
|
-
const v_error = (() => {
|
|
75
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
76
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
77
|
-
}
|
|
78
|
-
if (obj.demo !== undefined) {
|
|
79
|
-
const obj_demo = obj.demo;
|
|
80
|
-
const path_demo = path + '.demo';
|
|
81
|
-
if (typeof obj_demo !== 'boolean') {
|
|
82
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_demo + '" (at "' + path_demo + '")');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (obj.filterTypes !== undefined) {
|
|
86
|
-
const obj_filterTypes = obj.filterTypes;
|
|
87
|
-
const path_filterTypes = path + '.filterTypes';
|
|
88
|
-
if (!ArrayIsArray(obj_filterTypes)) {
|
|
89
|
-
return new TypeError('Expected "array" but received "' + typeof obj_filterTypes + '" (at "' + path_filterTypes + '")');
|
|
90
|
-
}
|
|
91
|
-
for (let i = 0; i < obj_filterTypes.length; i++) {
|
|
92
|
-
const obj_filterTypes_item = obj_filterTypes[i];
|
|
93
|
-
const path_filterTypes_item = path_filterTypes + '[' + i + ']';
|
|
94
|
-
if (typeof obj_filterTypes_item !== 'string') {
|
|
95
|
-
return new TypeError('Expected "string" but received "' + typeof obj_filterTypes_item + '" (at "' + path_filterTypes_item + '")');
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (obj.hasNext !== undefined) {
|
|
100
|
-
const obj_hasNext = obj.hasNext;
|
|
101
|
-
const path_hasNext = path + '.hasNext';
|
|
102
|
-
if (typeof obj_hasNext !== 'boolean') {
|
|
103
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_hasNext + '" (at "' + path_hasNext + '")');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (obj.page !== undefined) {
|
|
107
|
-
const obj_page = obj.page;
|
|
108
|
-
const path_page = path + '.page';
|
|
109
|
-
if (typeof obj_page !== 'number' || (typeof obj_page === 'number' && Math.floor(obj_page) !== obj_page)) {
|
|
110
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_page + '" (at "' + path_page + '")');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (obj.recordIds !== undefined) {
|
|
114
|
-
const obj_recordIds = obj.recordIds;
|
|
115
|
-
const path_recordIds = path + '.recordIds';
|
|
116
|
-
if (!ArrayIsArray(obj_recordIds)) {
|
|
117
|
-
return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
|
|
118
|
-
}
|
|
119
|
-
for (let i = 0; i < obj_recordIds.length; i++) {
|
|
120
|
-
const obj_recordIds_item = obj_recordIds[i];
|
|
121
|
-
const path_recordIds_item = path_recordIds + '[' + i + ']';
|
|
122
|
-
if (typeof obj_recordIds_item !== 'string') {
|
|
123
|
-
return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
})();
|
|
128
|
-
return v_error === undefined ? null : v_error;
|
|
73
|
+
function validate$4(obj, path = 'FollowingInfoInputRepresentation') {
|
|
74
|
+
const v_error = (() => {
|
|
75
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
76
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
77
|
+
}
|
|
78
|
+
if (obj.demo !== undefined) {
|
|
79
|
+
const obj_demo = obj.demo;
|
|
80
|
+
const path_demo = path + '.demo';
|
|
81
|
+
if (typeof obj_demo !== 'boolean') {
|
|
82
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_demo + '" (at "' + path_demo + '")');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (obj.filterTypes !== undefined) {
|
|
86
|
+
const obj_filterTypes = obj.filterTypes;
|
|
87
|
+
const path_filterTypes = path + '.filterTypes';
|
|
88
|
+
if (!ArrayIsArray(obj_filterTypes)) {
|
|
89
|
+
return new TypeError('Expected "array" but received "' + typeof obj_filterTypes + '" (at "' + path_filterTypes + '")');
|
|
90
|
+
}
|
|
91
|
+
for (let i = 0; i < obj_filterTypes.length; i++) {
|
|
92
|
+
const obj_filterTypes_item = obj_filterTypes[i];
|
|
93
|
+
const path_filterTypes_item = path_filterTypes + '[' + i + ']';
|
|
94
|
+
if (typeof obj_filterTypes_item !== 'string') {
|
|
95
|
+
return new TypeError('Expected "string" but received "' + typeof obj_filterTypes_item + '" (at "' + path_filterTypes_item + '")');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (obj.hasNext !== undefined) {
|
|
100
|
+
const obj_hasNext = obj.hasNext;
|
|
101
|
+
const path_hasNext = path + '.hasNext';
|
|
102
|
+
if (typeof obj_hasNext !== 'boolean') {
|
|
103
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_hasNext + '" (at "' + path_hasNext + '")');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (obj.page !== undefined) {
|
|
107
|
+
const obj_page = obj.page;
|
|
108
|
+
const path_page = path + '.page';
|
|
109
|
+
if (typeof obj_page !== 'number' || (typeof obj_page === 'number' && Math.floor(obj_page) !== obj_page)) {
|
|
110
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_page + '" (at "' + path_page + '")');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (obj.recordIds !== undefined) {
|
|
114
|
+
const obj_recordIds = obj.recordIds;
|
|
115
|
+
const path_recordIds = path + '.recordIds';
|
|
116
|
+
if (!ArrayIsArray(obj_recordIds)) {
|
|
117
|
+
return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
|
|
118
|
+
}
|
|
119
|
+
for (let i = 0; i < obj_recordIds.length; i++) {
|
|
120
|
+
const obj_recordIds_item = obj_recordIds[i];
|
|
121
|
+
const path_recordIds_item = path_recordIds + '[' + i + ']';
|
|
122
|
+
if (typeof obj_recordIds_item !== 'string') {
|
|
123
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
})();
|
|
128
|
+
return v_error === undefined ? null : v_error;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
function validate$3(obj, path = 'ERIDigestInputRepresentation') {
|
|
132
|
-
const v_error = (() => {
|
|
133
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
134
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
135
|
-
}
|
|
136
|
-
const obj_following = obj.following;
|
|
137
|
-
const path_following = path + '.following';
|
|
138
|
-
const referencepath_followingValidationError = validate$4(obj_following, path_following);
|
|
139
|
-
if (referencepath_followingValidationError !== null) {
|
|
140
|
-
let message = 'Object doesn\'t match FollowingInfoInputRepresentation (at "' + path_following + '")\n';
|
|
141
|
-
message += referencepath_followingValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
142
|
-
return new TypeError(message);
|
|
143
|
-
}
|
|
144
|
-
})();
|
|
145
|
-
return v_error === undefined ? null : v_error;
|
|
131
|
+
function validate$3(obj, path = 'ERIDigestInputRepresentation') {
|
|
132
|
+
const v_error = (() => {
|
|
133
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
134
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
135
|
+
}
|
|
136
|
+
const obj_following = obj.following;
|
|
137
|
+
const path_following = path + '.following';
|
|
138
|
+
const referencepath_followingValidationError = validate$4(obj_following, path_following);
|
|
139
|
+
if (referencepath_followingValidationError !== null) {
|
|
140
|
+
let message = 'Object doesn\'t match FollowingInfoInputRepresentation (at "' + path_following + '")\n';
|
|
141
|
+
message += referencepath_followingValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
142
|
+
return new TypeError(message);
|
|
143
|
+
}
|
|
144
|
+
})();
|
|
145
|
+
return v_error === undefined ? null : v_error;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
function validate$2(obj, path = 'FollowingInfo') {
|
|
149
|
-
const v_error = (() => {
|
|
150
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
151
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
152
|
-
}
|
|
153
|
-
const obj_filterTypes = obj.filterTypes;
|
|
154
|
-
const path_filterTypes = path + '.filterTypes';
|
|
155
|
-
if (!ArrayIsArray(obj_filterTypes)) {
|
|
156
|
-
return new TypeError('Expected "array" but received "' + typeof obj_filterTypes + '" (at "' + path_filterTypes + '")');
|
|
157
|
-
}
|
|
158
|
-
for (let i = 0; i < obj_filterTypes.length; i++) {
|
|
159
|
-
const obj_filterTypes_item = obj_filterTypes[i];
|
|
160
|
-
const path_filterTypes_item = path_filterTypes + '[' + i + ']';
|
|
161
|
-
if (typeof obj_filterTypes_item !== 'string') {
|
|
162
|
-
return new TypeError('Expected "string" but received "' + typeof obj_filterTypes_item + '" (at "' + path_filterTypes_item + '")');
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const obj_page = obj.page;
|
|
166
|
-
const path_page = path + '.page';
|
|
167
|
-
if (typeof obj_page !== 'number' || (typeof obj_page === 'number' && Math.floor(obj_page) !== obj_page)) {
|
|
168
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_page + '" (at "' + path_page + '")');
|
|
169
|
-
}
|
|
170
|
-
const obj_recordIds = obj.recordIds;
|
|
171
|
-
const path_recordIds = path + '.recordIds';
|
|
172
|
-
if (!ArrayIsArray(obj_recordIds)) {
|
|
173
|
-
return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
|
|
174
|
-
}
|
|
175
|
-
for (let i = 0; i < obj_recordIds.length; i++) {
|
|
176
|
-
const obj_recordIds_item = obj_recordIds[i];
|
|
177
|
-
const path_recordIds_item = path_recordIds + '[' + i + ']';
|
|
178
|
-
if (typeof obj_recordIds_item !== 'string') {
|
|
179
|
-
return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
})();
|
|
183
|
-
return v_error === undefined ? null : v_error;
|
|
184
|
-
}
|
|
185
|
-
function deepFreeze$2(input) {
|
|
186
|
-
const input_filterTypes = input.filterTypes;
|
|
187
|
-
ObjectFreeze(input_filterTypes);
|
|
188
|
-
const input_recordIds = input.recordIds;
|
|
189
|
-
ObjectFreeze(input_recordIds);
|
|
190
|
-
ObjectFreeze(input);
|
|
148
|
+
function validate$2(obj, path = 'FollowingInfo') {
|
|
149
|
+
const v_error = (() => {
|
|
150
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
151
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
152
|
+
}
|
|
153
|
+
const obj_filterTypes = obj.filterTypes;
|
|
154
|
+
const path_filterTypes = path + '.filterTypes';
|
|
155
|
+
if (!ArrayIsArray(obj_filterTypes)) {
|
|
156
|
+
return new TypeError('Expected "array" but received "' + typeof obj_filterTypes + '" (at "' + path_filterTypes + '")');
|
|
157
|
+
}
|
|
158
|
+
for (let i = 0; i < obj_filterTypes.length; i++) {
|
|
159
|
+
const obj_filterTypes_item = obj_filterTypes[i];
|
|
160
|
+
const path_filterTypes_item = path_filterTypes + '[' + i + ']';
|
|
161
|
+
if (typeof obj_filterTypes_item !== 'string') {
|
|
162
|
+
return new TypeError('Expected "string" but received "' + typeof obj_filterTypes_item + '" (at "' + path_filterTypes_item + '")');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const obj_page = obj.page;
|
|
166
|
+
const path_page = path + '.page';
|
|
167
|
+
if (typeof obj_page !== 'number' || (typeof obj_page === 'number' && Math.floor(obj_page) !== obj_page)) {
|
|
168
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_page + '" (at "' + path_page + '")');
|
|
169
|
+
}
|
|
170
|
+
const obj_recordIds = obj.recordIds;
|
|
171
|
+
const path_recordIds = path + '.recordIds';
|
|
172
|
+
if (!ArrayIsArray(obj_recordIds)) {
|
|
173
|
+
return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
|
|
174
|
+
}
|
|
175
|
+
for (let i = 0; i < obj_recordIds.length; i++) {
|
|
176
|
+
const obj_recordIds_item = obj_recordIds[i];
|
|
177
|
+
const path_recordIds_item = path_recordIds + '[' + i + ']';
|
|
178
|
+
if (typeof obj_recordIds_item !== 'string') {
|
|
179
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})();
|
|
183
|
+
return v_error === undefined ? null : v_error;
|
|
184
|
+
}
|
|
185
|
+
function deepFreeze$2(input) {
|
|
186
|
+
const input_filterTypes = input.filterTypes;
|
|
187
|
+
ObjectFreeze(input_filterTypes);
|
|
188
|
+
const input_recordIds = input.recordIds;
|
|
189
|
+
ObjectFreeze(input_recordIds);
|
|
190
|
+
ObjectFreeze(input);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
function validate$1(obj, path = 'DigestNotification') {
|
|
194
|
-
const v_error = (() => {
|
|
195
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
196
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
197
|
-
}
|
|
198
|
-
const obj_fields = obj.fields;
|
|
199
|
-
const path_fields = path + '.fields';
|
|
200
|
-
if (!ArrayIsArray(obj_fields)) {
|
|
201
|
-
return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
202
|
-
}
|
|
203
|
-
for (let i = 0; i < obj_fields.length; i++) {
|
|
204
|
-
const obj_fields_item = obj_fields[i];
|
|
205
|
-
const path_fields_item = path_fields + '[' + i + ']';
|
|
206
|
-
if (typeof obj_fields_item !== 'object' || ArrayIsArray(obj_fields_item) || obj_fields_item === null) {
|
|
207
|
-
return new TypeError('Expected "object" but received "' + typeof obj_fields_item + '" (at "' + path_fields_item + '")');
|
|
208
|
-
}
|
|
209
|
-
const obj_fields_item_keys = ObjectKeys(obj_fields_item);
|
|
210
|
-
for (let i = 0; i < obj_fields_item_keys.length; i++) {
|
|
211
|
-
const key = obj_fields_item_keys[i];
|
|
212
|
-
const obj_fields_item_prop = obj_fields_item[key];
|
|
213
|
-
const path_fields_item_prop = path_fields_item + '["' + key + '"]';
|
|
214
|
-
if (typeof obj_fields_item_prop !== 'string') {
|
|
215
|
-
return new TypeError('Expected "string" but received "' + typeof obj_fields_item_prop + '" (at "' + path_fields_item_prop + '")');
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const obj_id = obj.id;
|
|
220
|
-
const path_id = path + '.id';
|
|
221
|
-
if (typeof obj_id !== 'string') {
|
|
222
|
-
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
223
|
-
}
|
|
224
|
-
const obj_name = obj.name;
|
|
225
|
-
const path_name = path + '.name';
|
|
226
|
-
if (typeof obj_name !== 'string') {
|
|
227
|
-
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
228
|
-
}
|
|
229
|
-
const obj_navigationLink = obj.navigationLink;
|
|
230
|
-
const path_navigationLink = path + '.navigationLink';
|
|
231
|
-
if (typeof obj_navigationLink !== 'string') {
|
|
232
|
-
return new TypeError('Expected "string" but received "' + typeof obj_navigationLink + '" (at "' + path_navigationLink + '")');
|
|
233
|
-
}
|
|
234
|
-
if (obj.read !== undefined) {
|
|
235
|
-
const obj_read = obj.read;
|
|
236
|
-
const path_read = path + '.read';
|
|
237
|
-
if (typeof obj_read !== 'boolean') {
|
|
238
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_read + '" (at "' + path_read + '")');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const obj_recordId = obj.recordId;
|
|
242
|
-
const path_recordId = path + '.recordId';
|
|
243
|
-
if (typeof obj_recordId !== 'string') {
|
|
244
|
-
return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
245
|
-
}
|
|
246
|
-
if (obj.recordTypeId !== undefined) {
|
|
247
|
-
const obj_recordTypeId = obj.recordTypeId;
|
|
248
|
-
const path_recordTypeId = path + '.recordTypeId';
|
|
249
|
-
if (typeof obj_recordTypeId !== 'string') {
|
|
250
|
-
return new TypeError('Expected "string" but received "' + typeof obj_recordTypeId + '" (at "' + path_recordTypeId + '")');
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
const obj_sobjectType = obj.sobjectType;
|
|
254
|
-
const path_sobjectType = path + '.sobjectType';
|
|
255
|
-
if (typeof obj_sobjectType !== 'string') {
|
|
256
|
-
return new TypeError('Expected "string" but received "' + typeof obj_sobjectType + '" (at "' + path_sobjectType + '")');
|
|
257
|
-
}
|
|
258
|
-
const obj_sobjectTypeLabel = obj.sobjectTypeLabel;
|
|
259
|
-
const path_sobjectTypeLabel = path + '.sobjectTypeLabel';
|
|
260
|
-
if (typeof obj_sobjectTypeLabel !== 'string') {
|
|
261
|
-
return new TypeError('Expected "string" but received "' + typeof obj_sobjectTypeLabel + '" (at "' + path_sobjectTypeLabel + '")');
|
|
262
|
-
}
|
|
263
|
-
const obj_timeStamp = obj.timeStamp;
|
|
264
|
-
const path_timeStamp = path + '.timeStamp';
|
|
265
|
-
if (typeof obj_timeStamp !== 'string') {
|
|
266
|
-
return new TypeError('Expected "string" but received "' + typeof obj_timeStamp + '" (at "' + path_timeStamp + '")');
|
|
267
|
-
}
|
|
268
|
-
const obj_type = obj.type;
|
|
269
|
-
const path_type = path + '.type';
|
|
270
|
-
if (typeof obj_type !== 'string') {
|
|
271
|
-
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
272
|
-
}
|
|
273
|
-
})();
|
|
274
|
-
return v_error === undefined ? null : v_error;
|
|
275
|
-
}
|
|
276
|
-
function deepFreeze$1(input) {
|
|
277
|
-
const input_fields = input.fields;
|
|
278
|
-
for (let i = 0; i < input_fields.length; i++) {
|
|
279
|
-
const input_fields_item = input_fields[i];
|
|
280
|
-
const input_fields_item_keys = Object.keys(input_fields_item);
|
|
281
|
-
const input_fields_item_length = input_fields_item_keys.length;
|
|
282
|
-
for (let i = 0; i < input_fields_item_length; i++) {
|
|
283
|
-
input_fields_item_keys[i];
|
|
284
|
-
}
|
|
285
|
-
ObjectFreeze(input_fields_item);
|
|
286
|
-
}
|
|
287
|
-
ObjectFreeze(input_fields);
|
|
288
|
-
ObjectFreeze(input);
|
|
193
|
+
function validate$1(obj, path = 'DigestNotification') {
|
|
194
|
+
const v_error = (() => {
|
|
195
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
196
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
197
|
+
}
|
|
198
|
+
const obj_fields = obj.fields;
|
|
199
|
+
const path_fields = path + '.fields';
|
|
200
|
+
if (!ArrayIsArray(obj_fields)) {
|
|
201
|
+
return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
202
|
+
}
|
|
203
|
+
for (let i = 0; i < obj_fields.length; i++) {
|
|
204
|
+
const obj_fields_item = obj_fields[i];
|
|
205
|
+
const path_fields_item = path_fields + '[' + i + ']';
|
|
206
|
+
if (typeof obj_fields_item !== 'object' || ArrayIsArray(obj_fields_item) || obj_fields_item === null) {
|
|
207
|
+
return new TypeError('Expected "object" but received "' + typeof obj_fields_item + '" (at "' + path_fields_item + '")');
|
|
208
|
+
}
|
|
209
|
+
const obj_fields_item_keys = ObjectKeys(obj_fields_item);
|
|
210
|
+
for (let i = 0; i < obj_fields_item_keys.length; i++) {
|
|
211
|
+
const key = obj_fields_item_keys[i];
|
|
212
|
+
const obj_fields_item_prop = obj_fields_item[key];
|
|
213
|
+
const path_fields_item_prop = path_fields_item + '["' + key + '"]';
|
|
214
|
+
if (typeof obj_fields_item_prop !== 'string') {
|
|
215
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fields_item_prop + '" (at "' + path_fields_item_prop + '")');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const obj_id = obj.id;
|
|
220
|
+
const path_id = path + '.id';
|
|
221
|
+
if (typeof obj_id !== 'string') {
|
|
222
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
223
|
+
}
|
|
224
|
+
const obj_name = obj.name;
|
|
225
|
+
const path_name = path + '.name';
|
|
226
|
+
if (typeof obj_name !== 'string') {
|
|
227
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
228
|
+
}
|
|
229
|
+
const obj_navigationLink = obj.navigationLink;
|
|
230
|
+
const path_navigationLink = path + '.navigationLink';
|
|
231
|
+
if (typeof obj_navigationLink !== 'string') {
|
|
232
|
+
return new TypeError('Expected "string" but received "' + typeof obj_navigationLink + '" (at "' + path_navigationLink + '")');
|
|
233
|
+
}
|
|
234
|
+
if (obj.read !== undefined) {
|
|
235
|
+
const obj_read = obj.read;
|
|
236
|
+
const path_read = path + '.read';
|
|
237
|
+
if (typeof obj_read !== 'boolean') {
|
|
238
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_read + '" (at "' + path_read + '")');
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const obj_recordId = obj.recordId;
|
|
242
|
+
const path_recordId = path + '.recordId';
|
|
243
|
+
if (typeof obj_recordId !== 'string') {
|
|
244
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
245
|
+
}
|
|
246
|
+
if (obj.recordTypeId !== undefined) {
|
|
247
|
+
const obj_recordTypeId = obj.recordTypeId;
|
|
248
|
+
const path_recordTypeId = path + '.recordTypeId';
|
|
249
|
+
if (typeof obj_recordTypeId !== 'string') {
|
|
250
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordTypeId + '" (at "' + path_recordTypeId + '")');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const obj_sobjectType = obj.sobjectType;
|
|
254
|
+
const path_sobjectType = path + '.sobjectType';
|
|
255
|
+
if (typeof obj_sobjectType !== 'string') {
|
|
256
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sobjectType + '" (at "' + path_sobjectType + '")');
|
|
257
|
+
}
|
|
258
|
+
const obj_sobjectTypeLabel = obj.sobjectTypeLabel;
|
|
259
|
+
const path_sobjectTypeLabel = path + '.sobjectTypeLabel';
|
|
260
|
+
if (typeof obj_sobjectTypeLabel !== 'string') {
|
|
261
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sobjectTypeLabel + '" (at "' + path_sobjectTypeLabel + '")');
|
|
262
|
+
}
|
|
263
|
+
const obj_timeStamp = obj.timeStamp;
|
|
264
|
+
const path_timeStamp = path + '.timeStamp';
|
|
265
|
+
if (typeof obj_timeStamp !== 'string') {
|
|
266
|
+
return new TypeError('Expected "string" but received "' + typeof obj_timeStamp + '" (at "' + path_timeStamp + '")');
|
|
267
|
+
}
|
|
268
|
+
const obj_type = obj.type;
|
|
269
|
+
const path_type = path + '.type';
|
|
270
|
+
if (typeof obj_type !== 'string') {
|
|
271
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
272
|
+
}
|
|
273
|
+
})();
|
|
274
|
+
return v_error === undefined ? null : v_error;
|
|
275
|
+
}
|
|
276
|
+
function deepFreeze$1(input) {
|
|
277
|
+
const input_fields = input.fields;
|
|
278
|
+
for (let i = 0; i < input_fields.length; i++) {
|
|
279
|
+
const input_fields_item = input_fields[i];
|
|
280
|
+
const input_fields_item_keys = Object.keys(input_fields_item);
|
|
281
|
+
const input_fields_item_length = input_fields_item_keys.length;
|
|
282
|
+
for (let i = 0; i < input_fields_item_length; i++) {
|
|
283
|
+
input_fields_item_keys[i];
|
|
284
|
+
}
|
|
285
|
+
ObjectFreeze(input_fields_item);
|
|
286
|
+
}
|
|
287
|
+
ObjectFreeze(input_fields);
|
|
288
|
+
ObjectFreeze(input);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
const TTL = 1000;
|
|
292
|
-
const VERSION = "954674f4e56dd5b956cf98542401fda9";
|
|
293
|
-
function validate(obj, path = 'ERIDigestOutputRepresentation') {
|
|
294
|
-
const v_error = (() => {
|
|
295
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
296
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
297
|
-
}
|
|
298
|
-
if (obj.errorMsg !== undefined) {
|
|
299
|
-
const obj_errorMsg = obj.errorMsg;
|
|
300
|
-
const path_errorMsg = path + '.errorMsg';
|
|
301
|
-
if (typeof obj_errorMsg !== 'string') {
|
|
302
|
-
return new TypeError('Expected "string" but received "' + typeof obj_errorMsg + '" (at "' + path_errorMsg + '")');
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
if (obj.following !== undefined) {
|
|
306
|
-
const obj_following = obj.following;
|
|
307
|
-
const path_following = path + '.following';
|
|
308
|
-
const referencepath_followingValidationError = validate$2(obj_following, path_following);
|
|
309
|
-
if (referencepath_followingValidationError !== null) {
|
|
310
|
-
let message = 'Object doesn\'t match FollowingInfo (at "' + path_following + '")\n';
|
|
311
|
-
message += referencepath_followingValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
312
|
-
return new TypeError(message);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (obj.notifications !== undefined) {
|
|
316
|
-
const obj_notifications = obj.notifications;
|
|
317
|
-
const path_notifications = path + '.notifications';
|
|
318
|
-
if (!ArrayIsArray(obj_notifications)) {
|
|
319
|
-
return new TypeError('Expected "array" but received "' + typeof obj_notifications + '" (at "' + path_notifications + '")');
|
|
320
|
-
}
|
|
321
|
-
for (let i = 0; i < obj_notifications.length; i++) {
|
|
322
|
-
const obj_notifications_item = obj_notifications[i];
|
|
323
|
-
const path_notifications_item = path_notifications + '[' + i + ']';
|
|
324
|
-
const referencepath_notifications_itemValidationError = validate$1(obj_notifications_item, path_notifications_item);
|
|
325
|
-
if (referencepath_notifications_itemValidationError !== null) {
|
|
326
|
-
let message = 'Object doesn\'t match DigestNotification (at "' + path_notifications_item + '")\n';
|
|
327
|
-
message += referencepath_notifications_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
328
|
-
return new TypeError(message);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
const obj_requestSucceeded = obj.requestSucceeded;
|
|
333
|
-
const path_requestSucceeded = path + '.requestSucceeded';
|
|
334
|
-
if (typeof obj_requestSucceeded !== 'boolean') {
|
|
335
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_requestSucceeded + '" (at "' + path_requestSucceeded + '")');
|
|
336
|
-
}
|
|
337
|
-
const obj_statusCode = obj.statusCode;
|
|
338
|
-
const path_statusCode = path + '.statusCode';
|
|
339
|
-
if (typeof obj_statusCode !== 'string') {
|
|
340
|
-
return new TypeError('Expected "string" but received "' + typeof obj_statusCode + '" (at "' + path_statusCode + '")');
|
|
341
|
-
}
|
|
342
|
-
})();
|
|
343
|
-
return v_error === undefined ? null : v_error;
|
|
344
|
-
}
|
|
345
|
-
const RepresentationType = 'ERIDigestOutputRepresentation';
|
|
346
|
-
function keyBuilder(luvio, config) {
|
|
347
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
|
|
348
|
-
}
|
|
349
|
-
function keyBuilderFromType(luvio, object) {
|
|
350
|
-
const keyParams = {
|
|
351
|
-
isSuccess: object.requestSucceeded
|
|
352
|
-
};
|
|
353
|
-
return keyBuilder(luvio, keyParams);
|
|
354
|
-
}
|
|
355
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
356
|
-
return input;
|
|
357
|
-
}
|
|
358
|
-
const select$1 = function ERIDigestOutputRepresentationSelect() {
|
|
359
|
-
return {
|
|
360
|
-
kind: 'Fragment',
|
|
361
|
-
version: VERSION,
|
|
362
|
-
private: [],
|
|
363
|
-
opaque: true
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
function equals(existing, incoming) {
|
|
367
|
-
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
372
|
-
function deepFreeze(input) {
|
|
373
|
-
const input_following = input.following;
|
|
374
|
-
if (input_following !== undefined) {
|
|
375
|
-
deepFreeze$2(input_following);
|
|
376
|
-
}
|
|
377
|
-
const input_notifications = input.notifications;
|
|
378
|
-
if (input_notifications !== undefined) {
|
|
379
|
-
for (let i = 0; i < input_notifications.length; i++) {
|
|
380
|
-
const input_notifications_item = input_notifications[i];
|
|
381
|
-
deepFreeze$1(input_notifications_item);
|
|
382
|
-
}
|
|
383
|
-
ObjectFreeze(input_notifications);
|
|
384
|
-
}
|
|
385
|
-
ObjectFreeze(input);
|
|
386
|
-
}
|
|
387
|
-
const ingest = function ERIDigestOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
388
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
389
|
-
const validateError = validate(input);
|
|
390
|
-
if (validateError !== null) {
|
|
391
|
-
throw validateError;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
const key = keyBuilderFromType(luvio, input);
|
|
395
|
-
const existingRecord = store.readEntry(key);
|
|
396
|
-
const ttlToUse = TTL;
|
|
397
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
398
|
-
fullPath: key,
|
|
399
|
-
parent: path.parent,
|
|
400
|
-
propertyName: path.propertyName,
|
|
401
|
-
ttl: ttlToUse
|
|
402
|
-
});
|
|
403
|
-
deepFreeze(input);
|
|
404
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
405
|
-
luvio.storePublish(key, incomingRecord);
|
|
406
|
-
}
|
|
407
|
-
{
|
|
408
|
-
const storeMetadataParams = {
|
|
409
|
-
ttl: ttlToUse,
|
|
410
|
-
namespace: "eri",
|
|
411
|
-
version: VERSION,
|
|
412
|
-
representationName: RepresentationType,
|
|
413
|
-
};
|
|
414
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
415
|
-
}
|
|
416
|
-
return createLink(key);
|
|
417
|
-
};
|
|
418
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
419
|
-
const rootKeySet = new StoreKeyMap();
|
|
420
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
421
|
-
const rootKey = keyBuilderFromType(luvio, input);
|
|
422
|
-
rootKeySet.set(rootKey, {
|
|
423
|
-
namespace: keyPrefix,
|
|
424
|
-
representationName: RepresentationType,
|
|
425
|
-
mergeable: false
|
|
426
|
-
});
|
|
427
|
-
return rootKeySet;
|
|
291
|
+
const TTL = 1000;
|
|
292
|
+
const VERSION = "954674f4e56dd5b956cf98542401fda9";
|
|
293
|
+
function validate(obj, path = 'ERIDigestOutputRepresentation') {
|
|
294
|
+
const v_error = (() => {
|
|
295
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
296
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
297
|
+
}
|
|
298
|
+
if (obj.errorMsg !== undefined) {
|
|
299
|
+
const obj_errorMsg = obj.errorMsg;
|
|
300
|
+
const path_errorMsg = path + '.errorMsg';
|
|
301
|
+
if (typeof obj_errorMsg !== 'string') {
|
|
302
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMsg + '" (at "' + path_errorMsg + '")');
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (obj.following !== undefined) {
|
|
306
|
+
const obj_following = obj.following;
|
|
307
|
+
const path_following = path + '.following';
|
|
308
|
+
const referencepath_followingValidationError = validate$2(obj_following, path_following);
|
|
309
|
+
if (referencepath_followingValidationError !== null) {
|
|
310
|
+
let message = 'Object doesn\'t match FollowingInfo (at "' + path_following + '")\n';
|
|
311
|
+
message += referencepath_followingValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
312
|
+
return new TypeError(message);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (obj.notifications !== undefined) {
|
|
316
|
+
const obj_notifications = obj.notifications;
|
|
317
|
+
const path_notifications = path + '.notifications';
|
|
318
|
+
if (!ArrayIsArray(obj_notifications)) {
|
|
319
|
+
return new TypeError('Expected "array" but received "' + typeof obj_notifications + '" (at "' + path_notifications + '")');
|
|
320
|
+
}
|
|
321
|
+
for (let i = 0; i < obj_notifications.length; i++) {
|
|
322
|
+
const obj_notifications_item = obj_notifications[i];
|
|
323
|
+
const path_notifications_item = path_notifications + '[' + i + ']';
|
|
324
|
+
const referencepath_notifications_itemValidationError = validate$1(obj_notifications_item, path_notifications_item);
|
|
325
|
+
if (referencepath_notifications_itemValidationError !== null) {
|
|
326
|
+
let message = 'Object doesn\'t match DigestNotification (at "' + path_notifications_item + '")\n';
|
|
327
|
+
message += referencepath_notifications_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
328
|
+
return new TypeError(message);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const obj_requestSucceeded = obj.requestSucceeded;
|
|
333
|
+
const path_requestSucceeded = path + '.requestSucceeded';
|
|
334
|
+
if (typeof obj_requestSucceeded !== 'boolean') {
|
|
335
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_requestSucceeded + '" (at "' + path_requestSucceeded + '")');
|
|
336
|
+
}
|
|
337
|
+
const obj_statusCode = obj.statusCode;
|
|
338
|
+
const path_statusCode = path + '.statusCode';
|
|
339
|
+
if (typeof obj_statusCode !== 'string') {
|
|
340
|
+
return new TypeError('Expected "string" but received "' + typeof obj_statusCode + '" (at "' + path_statusCode + '")');
|
|
341
|
+
}
|
|
342
|
+
})();
|
|
343
|
+
return v_error === undefined ? null : v_error;
|
|
344
|
+
}
|
|
345
|
+
const RepresentationType = 'ERIDigestOutputRepresentation';
|
|
346
|
+
function keyBuilder(luvio, config) {
|
|
347
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
|
|
348
|
+
}
|
|
349
|
+
function keyBuilderFromType(luvio, object) {
|
|
350
|
+
const keyParams = {
|
|
351
|
+
isSuccess: object.requestSucceeded
|
|
352
|
+
};
|
|
353
|
+
return keyBuilder(luvio, keyParams);
|
|
354
|
+
}
|
|
355
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
356
|
+
return input;
|
|
357
|
+
}
|
|
358
|
+
const select$1 = function ERIDigestOutputRepresentationSelect() {
|
|
359
|
+
return {
|
|
360
|
+
kind: 'Fragment',
|
|
361
|
+
version: VERSION,
|
|
362
|
+
private: [],
|
|
363
|
+
opaque: true
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
function equals(existing, incoming) {
|
|
367
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
function deepFreeze(input) {
|
|
373
|
+
const input_following = input.following;
|
|
374
|
+
if (input_following !== undefined) {
|
|
375
|
+
deepFreeze$2(input_following);
|
|
376
|
+
}
|
|
377
|
+
const input_notifications = input.notifications;
|
|
378
|
+
if (input_notifications !== undefined) {
|
|
379
|
+
for (let i = 0; i < input_notifications.length; i++) {
|
|
380
|
+
const input_notifications_item = input_notifications[i];
|
|
381
|
+
deepFreeze$1(input_notifications_item);
|
|
382
|
+
}
|
|
383
|
+
ObjectFreeze(input_notifications);
|
|
384
|
+
}
|
|
385
|
+
ObjectFreeze(input);
|
|
386
|
+
}
|
|
387
|
+
const ingest = function ERIDigestOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
388
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
389
|
+
const validateError = validate(input);
|
|
390
|
+
if (validateError !== null) {
|
|
391
|
+
throw validateError;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const key = keyBuilderFromType(luvio, input);
|
|
395
|
+
const existingRecord = store.readEntry(key);
|
|
396
|
+
const ttlToUse = TTL;
|
|
397
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
398
|
+
fullPath: key,
|
|
399
|
+
parent: path.parent,
|
|
400
|
+
propertyName: path.propertyName,
|
|
401
|
+
ttl: ttlToUse
|
|
402
|
+
});
|
|
403
|
+
deepFreeze(input);
|
|
404
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
405
|
+
luvio.storePublish(key, incomingRecord);
|
|
406
|
+
}
|
|
407
|
+
{
|
|
408
|
+
const storeMetadataParams = {
|
|
409
|
+
ttl: ttlToUse,
|
|
410
|
+
namespace: "eri",
|
|
411
|
+
version: VERSION,
|
|
412
|
+
representationName: RepresentationType,
|
|
413
|
+
};
|
|
414
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
415
|
+
}
|
|
416
|
+
return createLink(key);
|
|
417
|
+
};
|
|
418
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
419
|
+
const rootKeySet = new StoreKeyMap();
|
|
420
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
421
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
422
|
+
rootKeySet.set(rootKey, {
|
|
423
|
+
namespace: keyPrefix,
|
|
424
|
+
representationName: RepresentationType,
|
|
425
|
+
mergeable: false
|
|
426
|
+
});
|
|
427
|
+
return rootKeySet;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
function select(luvio, params) {
|
|
431
|
-
return select$1();
|
|
432
|
-
}
|
|
433
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
434
|
-
return getTypeCacheKeys(luvio, response);
|
|
435
|
-
}
|
|
436
|
-
function ingestSuccess(luvio, resourceParams, response) {
|
|
437
|
-
const { body } = response;
|
|
438
|
-
const key = keyBuilderFromType(luvio, body);
|
|
439
|
-
luvio.storeIngest(key, ingest, body);
|
|
440
|
-
const snapshot = luvio.storeLookup({
|
|
441
|
-
recordId: key,
|
|
442
|
-
node: select(),
|
|
443
|
-
variables: {},
|
|
444
|
-
});
|
|
445
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
446
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
447
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
return snapshot;
|
|
451
|
-
}
|
|
452
|
-
function createResourceRequest(config) {
|
|
453
|
-
const headers = {};
|
|
454
|
-
return {
|
|
455
|
-
baseUri: '/services/data/v58.0',
|
|
456
|
-
basePath: '/connect/eri/digest',
|
|
457
|
-
method: 'post',
|
|
458
|
-
body: config.body,
|
|
459
|
-
urlParams: {},
|
|
460
|
-
queryParams: {},
|
|
461
|
-
headers,
|
|
462
|
-
priority: 'normal',
|
|
463
|
-
};
|
|
430
|
+
function select(luvio, params) {
|
|
431
|
+
return select$1();
|
|
432
|
+
}
|
|
433
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
434
|
+
return getTypeCacheKeys(luvio, response);
|
|
435
|
+
}
|
|
436
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
437
|
+
const { body } = response;
|
|
438
|
+
const key = keyBuilderFromType(luvio, body);
|
|
439
|
+
luvio.storeIngest(key, ingest, body);
|
|
440
|
+
const snapshot = luvio.storeLookup({
|
|
441
|
+
recordId: key,
|
|
442
|
+
node: select(),
|
|
443
|
+
variables: {},
|
|
444
|
+
});
|
|
445
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
446
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
447
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return snapshot;
|
|
451
|
+
}
|
|
452
|
+
function createResourceRequest(config) {
|
|
453
|
+
const headers = {};
|
|
454
|
+
return {
|
|
455
|
+
baseUri: '/services/data/v58.0',
|
|
456
|
+
basePath: '/connect/eri/digest',
|
|
457
|
+
method: 'post',
|
|
458
|
+
body: config.body,
|
|
459
|
+
urlParams: {},
|
|
460
|
+
queryParams: {},
|
|
461
|
+
headers,
|
|
462
|
+
priority: 'normal',
|
|
463
|
+
};
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
const getERIDigest_ConfigPropertyNames = {
|
|
467
|
-
displayName: 'getERIDigest',
|
|
468
|
-
parameters: {
|
|
469
|
-
required: ['eriDigestInput'],
|
|
470
|
-
optional: []
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
function createResourceParams(config) {
|
|
474
|
-
const resourceParams = {
|
|
475
|
-
body: {
|
|
476
|
-
eriDigestInput: config.eriDigestInput
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
return resourceParams;
|
|
480
|
-
}
|
|
481
|
-
function typeCheckConfig(untrustedConfig) {
|
|
482
|
-
const config = {};
|
|
483
|
-
const untrustedConfig_eriDigestInput = untrustedConfig.eriDigestInput;
|
|
484
|
-
const referenceERIDigestInputRepresentationValidationError = validate$3(untrustedConfig_eriDigestInput);
|
|
485
|
-
if (referenceERIDigestInputRepresentationValidationError === null) {
|
|
486
|
-
config.eriDigestInput = untrustedConfig_eriDigestInput;
|
|
487
|
-
}
|
|
488
|
-
return config;
|
|
489
|
-
}
|
|
490
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
491
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
492
|
-
return null;
|
|
493
|
-
}
|
|
494
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
495
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
496
|
-
}
|
|
497
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
498
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
499
|
-
return null;
|
|
500
|
-
}
|
|
501
|
-
return config;
|
|
502
|
-
}
|
|
503
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
504
|
-
const resourceParams = createResourceParams(config);
|
|
505
|
-
const request = createResourceRequest(resourceParams);
|
|
506
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
507
|
-
.then((response) => {
|
|
508
|
-
return luvio.handleSuccessResponse(() => {
|
|
509
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
510
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
511
|
-
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
512
|
-
}, (response) => {
|
|
513
|
-
deepFreeze$3(response);
|
|
514
|
-
throw response;
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
const getERIDigestAdapterFactory = (luvio) => {
|
|
518
|
-
return function getERIDigest(untrustedConfig) {
|
|
519
|
-
const config = validateAdapterConfig(untrustedConfig, getERIDigest_ConfigPropertyNames);
|
|
520
|
-
// Invalid or incomplete config
|
|
521
|
-
if (config === null) {
|
|
522
|
-
throw new Error('Invalid config for "getERIDigest"');
|
|
523
|
-
}
|
|
524
|
-
return buildNetworkSnapshot(luvio, config);
|
|
525
|
-
};
|
|
466
|
+
const getERIDigest_ConfigPropertyNames = {
|
|
467
|
+
displayName: 'getERIDigest',
|
|
468
|
+
parameters: {
|
|
469
|
+
required: ['eriDigestInput'],
|
|
470
|
+
optional: []
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
function createResourceParams(config) {
|
|
474
|
+
const resourceParams = {
|
|
475
|
+
body: {
|
|
476
|
+
eriDigestInput: config.eriDigestInput
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
return resourceParams;
|
|
480
|
+
}
|
|
481
|
+
function typeCheckConfig(untrustedConfig) {
|
|
482
|
+
const config = {};
|
|
483
|
+
const untrustedConfig_eriDigestInput = untrustedConfig.eriDigestInput;
|
|
484
|
+
const referenceERIDigestInputRepresentationValidationError = validate$3(untrustedConfig_eriDigestInput);
|
|
485
|
+
if (referenceERIDigestInputRepresentationValidationError === null) {
|
|
486
|
+
config.eriDigestInput = untrustedConfig_eriDigestInput;
|
|
487
|
+
}
|
|
488
|
+
return config;
|
|
489
|
+
}
|
|
490
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
491
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
495
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
496
|
+
}
|
|
497
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
498
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
return config;
|
|
502
|
+
}
|
|
503
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
504
|
+
const resourceParams = createResourceParams(config);
|
|
505
|
+
const request = createResourceRequest(resourceParams);
|
|
506
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
507
|
+
.then((response) => {
|
|
508
|
+
return luvio.handleSuccessResponse(() => {
|
|
509
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
510
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
511
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
512
|
+
}, (response) => {
|
|
513
|
+
deepFreeze$3(response);
|
|
514
|
+
throw response;
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
const getERIDigestAdapterFactory = (luvio) => {
|
|
518
|
+
return function getERIDigest(untrustedConfig) {
|
|
519
|
+
const config = validateAdapterConfig(untrustedConfig, getERIDigest_ConfigPropertyNames);
|
|
520
|
+
// Invalid or incomplete config
|
|
521
|
+
if (config === null) {
|
|
522
|
+
throw new Error('Invalid config for "getERIDigest"');
|
|
523
|
+
}
|
|
524
|
+
return buildNetworkSnapshot(luvio, config);
|
|
525
|
+
};
|
|
526
526
|
};
|
|
527
527
|
|
|
528
528
|
export { getERIDigestAdapterFactory };
|