@salesforce/lds-adapters-marketing-assetcreation 1.124.1 → 1.124.3
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/marketing-assetcreation.js +966 -966
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/createAsset.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/adapters/getStarterTemplateById.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/adapters/getStarterTemplates.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +3 -3
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +6 -6
- package/dist/{types → es/es2018/types}/src/generated/resources/getAssetCreationStarterTemplates.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/getAssetCreationStarterTemplatesByStarterTemplateId.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/resources/postAssetCreationObjects.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/types/AssetInputRepresentation.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/generated/types/AssetInputWrapperRepresentation.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/AssetOutputRepresentation.d.ts +42 -42
- package/dist/{types → es/es2018/types}/src/generated/types/StarterTemplateDetailRepresentation.d.ts +48 -48
- package/dist/{types → es/es2018/types}/src/generated/types/StarterTemplateListRepresentation.d.ts +31 -31
- package/dist/{types → es/es2018/types}/src/generated/types/StarterTemplateRepresentation.d.ts +38 -38
- 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 +1000 -1000
- package/dist/umd/es2018/marketing-assetcreation.js +0 -1011
- package/dist/umd/es5/marketing-assetcreation.js +0 -1016
|
@@ -6,996 +6,996 @@
|
|
|
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
|
-
}
|
|
44
|
-
const snapshotRefreshOptions = {
|
|
45
|
-
overrides: {
|
|
46
|
-
headers: {
|
|
47
|
-
'Cache-Control': 'no-cache',
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
};
|
|
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
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
51
|
const keyPrefix = 'assetcreation';
|
|
52
52
|
|
|
53
|
-
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
-
const { isArray: ArrayIsArray } = Array;
|
|
55
|
-
function equalsArray(a, b, equalsItem) {
|
|
56
|
-
const aLength = a.length;
|
|
57
|
-
const bLength = b.length;
|
|
58
|
-
if (aLength !== bLength) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
for (let i = 0; i < aLength; i++) {
|
|
62
|
-
if (equalsItem(a[i], b[i]) === false) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
function deepFreeze(value) {
|
|
69
|
-
// No need to freeze primitives
|
|
70
|
-
if (typeof value !== 'object' || value === null) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (ArrayIsArray(value)) {
|
|
74
|
-
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
75
|
-
deepFreeze(value[i]);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
const keys = ObjectKeys(value);
|
|
80
|
-
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
81
|
-
deepFreeze(value[keys[i]]);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
ObjectFreeze(value);
|
|
85
|
-
}
|
|
86
|
-
function createLink(ref) {
|
|
87
|
-
return {
|
|
88
|
-
__ref: serializeStructuredKey(ref),
|
|
89
|
-
};
|
|
53
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
+
const { isArray: ArrayIsArray } = Array;
|
|
55
|
+
function equalsArray(a, b, equalsItem) {
|
|
56
|
+
const aLength = a.length;
|
|
57
|
+
const bLength = b.length;
|
|
58
|
+
if (aLength !== bLength) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
for (let i = 0; i < aLength; i++) {
|
|
62
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
function deepFreeze(value) {
|
|
69
|
+
// No need to freeze primitives
|
|
70
|
+
if (typeof value !== 'object' || value === null) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (ArrayIsArray(value)) {
|
|
74
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
75
|
+
deepFreeze(value[i]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const keys = ObjectKeys(value);
|
|
80
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
81
|
+
deepFreeze(value[keys[i]]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
ObjectFreeze(value);
|
|
85
|
+
}
|
|
86
|
+
function createLink(ref) {
|
|
87
|
+
return {
|
|
88
|
+
__ref: serializeStructuredKey(ref),
|
|
89
|
+
};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
function validate$4(obj, path = 'AssetInputRepresentation') {
|
|
93
|
-
const v_error = (() => {
|
|
94
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
95
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
96
|
-
}
|
|
97
|
-
const obj_fields = obj.fields;
|
|
98
|
-
const path_fields = path + '.fields';
|
|
99
|
-
if (typeof obj_fields !== 'object' || ArrayIsArray(obj_fields) || obj_fields === null) {
|
|
100
|
-
return new TypeError('Expected "object" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
101
|
-
}
|
|
102
|
-
const obj_fields_keys = ObjectKeys(obj_fields);
|
|
103
|
-
for (let i = 0; i < obj_fields_keys.length; i++) {
|
|
104
|
-
const key = obj_fields_keys[i];
|
|
105
|
-
const obj_fields_prop = obj_fields[key];
|
|
106
|
-
const path_fields_prop = path_fields + '["' + key + '"]';
|
|
107
|
-
if (typeof obj_fields_prop !== 'string') {
|
|
108
|
-
return new TypeError('Expected "string" but received "' + typeof obj_fields_prop + '" (at "' + path_fields_prop + '")');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const obj_starterTemplateId = obj.starterTemplateId;
|
|
112
|
-
const path_starterTemplateId = path + '.starterTemplateId';
|
|
113
|
-
if (typeof obj_starterTemplateId !== 'string') {
|
|
114
|
-
return new TypeError('Expected "string" but received "' + typeof obj_starterTemplateId + '" (at "' + path_starterTemplateId + '")');
|
|
115
|
-
}
|
|
116
|
-
const obj_type = obj.type;
|
|
117
|
-
const path_type = path + '.type';
|
|
118
|
-
if (typeof obj_type !== 'string') {
|
|
119
|
-
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
120
|
-
}
|
|
121
|
-
})();
|
|
122
|
-
return v_error === undefined ? null : v_error;
|
|
92
|
+
function validate$4(obj, path = 'AssetInputRepresentation') {
|
|
93
|
+
const v_error = (() => {
|
|
94
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
95
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
96
|
+
}
|
|
97
|
+
const obj_fields = obj.fields;
|
|
98
|
+
const path_fields = path + '.fields';
|
|
99
|
+
if (typeof obj_fields !== 'object' || ArrayIsArray(obj_fields) || obj_fields === null) {
|
|
100
|
+
return new TypeError('Expected "object" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_fields_keys = ObjectKeys(obj_fields);
|
|
103
|
+
for (let i = 0; i < obj_fields_keys.length; i++) {
|
|
104
|
+
const key = obj_fields_keys[i];
|
|
105
|
+
const obj_fields_prop = obj_fields[key];
|
|
106
|
+
const path_fields_prop = path_fields + '["' + key + '"]';
|
|
107
|
+
if (typeof obj_fields_prop !== 'string') {
|
|
108
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fields_prop + '" (at "' + path_fields_prop + '")');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const obj_starterTemplateId = obj.starterTemplateId;
|
|
112
|
+
const path_starterTemplateId = path + '.starterTemplateId';
|
|
113
|
+
if (typeof obj_starterTemplateId !== 'string') {
|
|
114
|
+
return new TypeError('Expected "string" but received "' + typeof obj_starterTemplateId + '" (at "' + path_starterTemplateId + '")');
|
|
115
|
+
}
|
|
116
|
+
const obj_type = obj.type;
|
|
117
|
+
const path_type = path + '.type';
|
|
118
|
+
if (typeof obj_type !== 'string') {
|
|
119
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
120
|
+
}
|
|
121
|
+
})();
|
|
122
|
+
return v_error === undefined ? null : v_error;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
const TTL$2 = 1000;
|
|
126
|
-
const VERSION$3 = "b43d0a7e53f816bf92d87798789baf3a";
|
|
127
|
-
function validate$3(obj, path = 'AssetOutputRepresentation') {
|
|
128
|
-
const v_error = (() => {
|
|
129
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
130
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
131
|
-
}
|
|
132
|
-
const obj_contentBuilderUrl = obj.contentBuilderUrl;
|
|
133
|
-
const path_contentBuilderUrl = path + '.contentBuilderUrl';
|
|
134
|
-
if (typeof obj_contentBuilderUrl !== 'string') {
|
|
135
|
-
return new TypeError('Expected "string" but received "' + typeof obj_contentBuilderUrl + '" (at "' + path_contentBuilderUrl + '")');
|
|
136
|
-
}
|
|
137
|
-
const obj_id = obj.id;
|
|
138
|
-
const path_id = path + '.id';
|
|
139
|
-
if (typeof obj_id !== 'string') {
|
|
140
|
-
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
141
|
-
}
|
|
142
|
-
})();
|
|
143
|
-
return v_error === undefined ? null : v_error;
|
|
144
|
-
}
|
|
145
|
-
const RepresentationType$2 = 'AssetOutputRepresentation';
|
|
146
|
-
function keyBuilder$4(luvio, config) {
|
|
147
|
-
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
148
|
-
}
|
|
149
|
-
function keyBuilderFromType(luvio, object) {
|
|
150
|
-
const keyParams = {
|
|
151
|
-
id: object.id
|
|
152
|
-
};
|
|
153
|
-
return keyBuilder$4(luvio, keyParams);
|
|
154
|
-
}
|
|
155
|
-
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
156
|
-
return input;
|
|
157
|
-
}
|
|
158
|
-
const select$6 = function AssetOutputRepresentationSelect() {
|
|
159
|
-
return {
|
|
160
|
-
kind: 'Fragment',
|
|
161
|
-
version: VERSION$3,
|
|
162
|
-
private: [],
|
|
163
|
-
selections: [
|
|
164
|
-
{
|
|
165
|
-
name: 'contentBuilderUrl',
|
|
166
|
-
kind: 'Scalar'
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: 'id',
|
|
170
|
-
kind: 'Scalar'
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
function equals$3(existing, incoming) {
|
|
176
|
-
const existing_contentBuilderUrl = existing.contentBuilderUrl;
|
|
177
|
-
const incoming_contentBuilderUrl = incoming.contentBuilderUrl;
|
|
178
|
-
if (!(existing_contentBuilderUrl === incoming_contentBuilderUrl)) {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
const existing_id = existing.id;
|
|
182
|
-
const incoming_id = incoming.id;
|
|
183
|
-
if (!(existing_id === incoming_id)) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
return true;
|
|
187
|
-
}
|
|
188
|
-
const ingest$2 = function AssetOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
189
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
190
|
-
const validateError = validate$3(input);
|
|
191
|
-
if (validateError !== null) {
|
|
192
|
-
throw validateError;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const key = keyBuilderFromType(luvio, input);
|
|
196
|
-
const existingRecord = store.readEntry(key);
|
|
197
|
-
const ttlToUse = TTL$2;
|
|
198
|
-
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
199
|
-
fullPath: key,
|
|
200
|
-
parent: path.parent,
|
|
201
|
-
propertyName: path.propertyName,
|
|
202
|
-
ttl: ttlToUse
|
|
203
|
-
});
|
|
204
|
-
if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
|
|
205
|
-
luvio.storePublish(key, incomingRecord);
|
|
206
|
-
}
|
|
207
|
-
{
|
|
208
|
-
const storeMetadataParams = {
|
|
209
|
-
ttl: ttlToUse,
|
|
210
|
-
namespace: "assetcreation",
|
|
211
|
-
version: VERSION$3,
|
|
212
|
-
representationName: RepresentationType$2,
|
|
213
|
-
};
|
|
214
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
215
|
-
}
|
|
216
|
-
return createLink(key);
|
|
217
|
-
};
|
|
218
|
-
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
219
|
-
const rootKeySet = new StoreKeyMap();
|
|
220
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
221
|
-
const rootKey = keyBuilderFromType(luvio, input);
|
|
222
|
-
rootKeySet.set(rootKey, {
|
|
223
|
-
namespace: keyPrefix,
|
|
224
|
-
representationName: RepresentationType$2,
|
|
225
|
-
mergeable: false
|
|
226
|
-
});
|
|
227
|
-
return rootKeySet;
|
|
125
|
+
const TTL$2 = 1000;
|
|
126
|
+
const VERSION$3 = "b43d0a7e53f816bf92d87798789baf3a";
|
|
127
|
+
function validate$3(obj, path = 'AssetOutputRepresentation') {
|
|
128
|
+
const v_error = (() => {
|
|
129
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
130
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
131
|
+
}
|
|
132
|
+
const obj_contentBuilderUrl = obj.contentBuilderUrl;
|
|
133
|
+
const path_contentBuilderUrl = path + '.contentBuilderUrl';
|
|
134
|
+
if (typeof obj_contentBuilderUrl !== 'string') {
|
|
135
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentBuilderUrl + '" (at "' + path_contentBuilderUrl + '")');
|
|
136
|
+
}
|
|
137
|
+
const obj_id = obj.id;
|
|
138
|
+
const path_id = path + '.id';
|
|
139
|
+
if (typeof obj_id !== 'string') {
|
|
140
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
141
|
+
}
|
|
142
|
+
})();
|
|
143
|
+
return v_error === undefined ? null : v_error;
|
|
144
|
+
}
|
|
145
|
+
const RepresentationType$2 = 'AssetOutputRepresentation';
|
|
146
|
+
function keyBuilder$4(luvio, config) {
|
|
147
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
148
|
+
}
|
|
149
|
+
function keyBuilderFromType(luvio, object) {
|
|
150
|
+
const keyParams = {
|
|
151
|
+
id: object.id
|
|
152
|
+
};
|
|
153
|
+
return keyBuilder$4(luvio, keyParams);
|
|
154
|
+
}
|
|
155
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
156
|
+
return input;
|
|
157
|
+
}
|
|
158
|
+
const select$6 = function AssetOutputRepresentationSelect() {
|
|
159
|
+
return {
|
|
160
|
+
kind: 'Fragment',
|
|
161
|
+
version: VERSION$3,
|
|
162
|
+
private: [],
|
|
163
|
+
selections: [
|
|
164
|
+
{
|
|
165
|
+
name: 'contentBuilderUrl',
|
|
166
|
+
kind: 'Scalar'
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'id',
|
|
170
|
+
kind: 'Scalar'
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
function equals$3(existing, incoming) {
|
|
176
|
+
const existing_contentBuilderUrl = existing.contentBuilderUrl;
|
|
177
|
+
const incoming_contentBuilderUrl = incoming.contentBuilderUrl;
|
|
178
|
+
if (!(existing_contentBuilderUrl === incoming_contentBuilderUrl)) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
const existing_id = existing.id;
|
|
182
|
+
const incoming_id = incoming.id;
|
|
183
|
+
if (!(existing_id === incoming_id)) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
const ingest$2 = function AssetOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
190
|
+
const validateError = validate$3(input);
|
|
191
|
+
if (validateError !== null) {
|
|
192
|
+
throw validateError;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const key = keyBuilderFromType(luvio, input);
|
|
196
|
+
const existingRecord = store.readEntry(key);
|
|
197
|
+
const ttlToUse = TTL$2;
|
|
198
|
+
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
199
|
+
fullPath: key,
|
|
200
|
+
parent: path.parent,
|
|
201
|
+
propertyName: path.propertyName,
|
|
202
|
+
ttl: ttlToUse
|
|
203
|
+
});
|
|
204
|
+
if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
|
|
205
|
+
luvio.storePublish(key, incomingRecord);
|
|
206
|
+
}
|
|
207
|
+
{
|
|
208
|
+
const storeMetadataParams = {
|
|
209
|
+
ttl: ttlToUse,
|
|
210
|
+
namespace: "assetcreation",
|
|
211
|
+
version: VERSION$3,
|
|
212
|
+
representationName: RepresentationType$2,
|
|
213
|
+
};
|
|
214
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
215
|
+
}
|
|
216
|
+
return createLink(key);
|
|
217
|
+
};
|
|
218
|
+
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
219
|
+
const rootKeySet = new StoreKeyMap();
|
|
220
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
221
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
222
|
+
rootKeySet.set(rootKey, {
|
|
223
|
+
namespace: keyPrefix,
|
|
224
|
+
representationName: RepresentationType$2,
|
|
225
|
+
mergeable: false
|
|
226
|
+
});
|
|
227
|
+
return rootKeySet;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
function select$5(luvio, params) {
|
|
231
|
-
return select$6();
|
|
232
|
-
}
|
|
233
|
-
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
234
|
-
return getTypeCacheKeys$2(luvio, response);
|
|
235
|
-
}
|
|
236
|
-
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
237
|
-
const { body } = response;
|
|
238
|
-
const key = keyBuilderFromType(luvio, body);
|
|
239
|
-
luvio.storeIngest(key, ingest$2, body);
|
|
240
|
-
const snapshot = luvio.storeLookup({
|
|
241
|
-
recordId: key,
|
|
242
|
-
node: select$5(),
|
|
243
|
-
variables: {},
|
|
244
|
-
});
|
|
245
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
246
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
247
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return snapshot;
|
|
251
|
-
}
|
|
252
|
-
function createResourceRequest$2(config) {
|
|
253
|
-
const headers = {};
|
|
254
|
-
return {
|
|
255
|
-
baseUri: '/services/data/v58.0',
|
|
256
|
-
basePath: '/asset-creation/objects',
|
|
257
|
-
method: 'post',
|
|
258
|
-
body: config.body,
|
|
259
|
-
urlParams: {},
|
|
260
|
-
queryParams: {},
|
|
261
|
-
headers,
|
|
262
|
-
priority: 'normal',
|
|
263
|
-
};
|
|
230
|
+
function select$5(luvio, params) {
|
|
231
|
+
return select$6();
|
|
232
|
+
}
|
|
233
|
+
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
234
|
+
return getTypeCacheKeys$2(luvio, response);
|
|
235
|
+
}
|
|
236
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
237
|
+
const { body } = response;
|
|
238
|
+
const key = keyBuilderFromType(luvio, body);
|
|
239
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
240
|
+
const snapshot = luvio.storeLookup({
|
|
241
|
+
recordId: key,
|
|
242
|
+
node: select$5(),
|
|
243
|
+
variables: {},
|
|
244
|
+
});
|
|
245
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
246
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
247
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return snapshot;
|
|
251
|
+
}
|
|
252
|
+
function createResourceRequest$2(config) {
|
|
253
|
+
const headers = {};
|
|
254
|
+
return {
|
|
255
|
+
baseUri: '/services/data/v58.0',
|
|
256
|
+
basePath: '/asset-creation/objects',
|
|
257
|
+
method: 'post',
|
|
258
|
+
body: config.body,
|
|
259
|
+
urlParams: {},
|
|
260
|
+
queryParams: {},
|
|
261
|
+
headers,
|
|
262
|
+
priority: 'normal',
|
|
263
|
+
};
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
const createAsset_ConfigPropertyNames = {
|
|
267
|
-
displayName: 'createAsset',
|
|
268
|
-
parameters: {
|
|
269
|
-
required: ['AssetInput'],
|
|
270
|
-
optional: []
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
function createResourceParams$2(config) {
|
|
274
|
-
const resourceParams = {
|
|
275
|
-
body: {
|
|
276
|
-
AssetInput: config.AssetInput
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
return resourceParams;
|
|
280
|
-
}
|
|
281
|
-
function typeCheckConfig$2(untrustedConfig) {
|
|
282
|
-
const config = {};
|
|
283
|
-
const untrustedConfig_AssetInput = untrustedConfig.AssetInput;
|
|
284
|
-
const referenceAssetInputRepresentationValidationError = validate$4(untrustedConfig_AssetInput);
|
|
285
|
-
if (referenceAssetInputRepresentationValidationError === null) {
|
|
286
|
-
config.AssetInput = untrustedConfig_AssetInput;
|
|
287
|
-
}
|
|
288
|
-
return config;
|
|
289
|
-
}
|
|
290
|
-
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
291
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
295
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
296
|
-
}
|
|
297
|
-
const config = typeCheckConfig$2(untrustedConfig);
|
|
298
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
return config;
|
|
302
|
-
}
|
|
303
|
-
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
304
|
-
const resourceParams = createResourceParams$2(config);
|
|
305
|
-
const request = createResourceRequest$2(resourceParams);
|
|
306
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
307
|
-
.then((response) => {
|
|
308
|
-
return luvio.handleSuccessResponse(() => {
|
|
309
|
-
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
310
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
311
|
-
}, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
312
|
-
}, (response) => {
|
|
313
|
-
deepFreeze(response);
|
|
314
|
-
throw response;
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
const createAssetAdapterFactory = (luvio) => {
|
|
318
|
-
return function createAsset(untrustedConfig) {
|
|
319
|
-
const config = validateAdapterConfig$2(untrustedConfig, createAsset_ConfigPropertyNames);
|
|
320
|
-
// Invalid or incomplete config
|
|
321
|
-
if (config === null) {
|
|
322
|
-
throw new Error('Invalid config for "createAsset"');
|
|
323
|
-
}
|
|
324
|
-
return buildNetworkSnapshot$2(luvio, config);
|
|
325
|
-
};
|
|
266
|
+
const createAsset_ConfigPropertyNames = {
|
|
267
|
+
displayName: 'createAsset',
|
|
268
|
+
parameters: {
|
|
269
|
+
required: ['AssetInput'],
|
|
270
|
+
optional: []
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
function createResourceParams$2(config) {
|
|
274
|
+
const resourceParams = {
|
|
275
|
+
body: {
|
|
276
|
+
AssetInput: config.AssetInput
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
return resourceParams;
|
|
280
|
+
}
|
|
281
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
282
|
+
const config = {};
|
|
283
|
+
const untrustedConfig_AssetInput = untrustedConfig.AssetInput;
|
|
284
|
+
const referenceAssetInputRepresentationValidationError = validate$4(untrustedConfig_AssetInput);
|
|
285
|
+
if (referenceAssetInputRepresentationValidationError === null) {
|
|
286
|
+
config.AssetInput = untrustedConfig_AssetInput;
|
|
287
|
+
}
|
|
288
|
+
return config;
|
|
289
|
+
}
|
|
290
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
291
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
295
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
296
|
+
}
|
|
297
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
298
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
return config;
|
|
302
|
+
}
|
|
303
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
304
|
+
const resourceParams = createResourceParams$2(config);
|
|
305
|
+
const request = createResourceRequest$2(resourceParams);
|
|
306
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
307
|
+
.then((response) => {
|
|
308
|
+
return luvio.handleSuccessResponse(() => {
|
|
309
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
310
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
311
|
+
}, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
312
|
+
}, (response) => {
|
|
313
|
+
deepFreeze(response);
|
|
314
|
+
throw response;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
const createAssetAdapterFactory = (luvio) => {
|
|
318
|
+
return function createAsset(untrustedConfig) {
|
|
319
|
+
const config = validateAdapterConfig$2(untrustedConfig, createAsset_ConfigPropertyNames);
|
|
320
|
+
// Invalid or incomplete config
|
|
321
|
+
if (config === null) {
|
|
322
|
+
throw new Error('Invalid config for "createAsset"');
|
|
323
|
+
}
|
|
324
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
325
|
+
};
|
|
326
326
|
};
|
|
327
327
|
|
|
328
|
-
const VERSION$2 = "6940195c96726bc70b9ad00de7d9c58a";
|
|
329
|
-
function validate$2(obj, path = 'StarterTemplateRepresentation') {
|
|
330
|
-
const v_error = (() => {
|
|
331
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
332
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
333
|
-
}
|
|
334
|
-
const obj_description = obj.description;
|
|
335
|
-
const path_description = path + '.description';
|
|
336
|
-
if (typeof obj_description !== 'string') {
|
|
337
|
-
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
338
|
-
}
|
|
339
|
-
const obj_id = obj.id;
|
|
340
|
-
const path_id = path + '.id';
|
|
341
|
-
if (typeof obj_id !== 'string') {
|
|
342
|
-
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
343
|
-
}
|
|
344
|
-
const obj_name = obj.name;
|
|
345
|
-
const path_name = path + '.name';
|
|
346
|
-
if (typeof obj_name !== 'string') {
|
|
347
|
-
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
348
|
-
}
|
|
349
|
-
const obj_thumbnailUrl = obj.thumbnailUrl;
|
|
350
|
-
const path_thumbnailUrl = path + '.thumbnailUrl';
|
|
351
|
-
if (typeof obj_thumbnailUrl !== 'string') {
|
|
352
|
-
return new TypeError('Expected "string" but received "' + typeof obj_thumbnailUrl + '" (at "' + path_thumbnailUrl + '")');
|
|
353
|
-
}
|
|
354
|
-
})();
|
|
355
|
-
return v_error === undefined ? null : v_error;
|
|
356
|
-
}
|
|
357
|
-
const select$4 = function StarterTemplateRepresentationSelect() {
|
|
358
|
-
return {
|
|
359
|
-
kind: 'Fragment',
|
|
360
|
-
version: VERSION$2,
|
|
361
|
-
private: [],
|
|
362
|
-
selections: [
|
|
363
|
-
{
|
|
364
|
-
name: 'description',
|
|
365
|
-
kind: 'Scalar'
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
name: 'id',
|
|
369
|
-
kind: 'Scalar'
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
name: 'name',
|
|
373
|
-
kind: 'Scalar'
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
name: 'thumbnailUrl',
|
|
377
|
-
kind: 'Scalar'
|
|
378
|
-
}
|
|
379
|
-
]
|
|
380
|
-
};
|
|
381
|
-
};
|
|
382
|
-
function equals$2(existing, incoming) {
|
|
383
|
-
const existing_description = existing.description;
|
|
384
|
-
const incoming_description = incoming.description;
|
|
385
|
-
if (!(existing_description === incoming_description)) {
|
|
386
|
-
return false;
|
|
387
|
-
}
|
|
388
|
-
const existing_id = existing.id;
|
|
389
|
-
const incoming_id = incoming.id;
|
|
390
|
-
if (!(existing_id === incoming_id)) {
|
|
391
|
-
return false;
|
|
392
|
-
}
|
|
393
|
-
const existing_name = existing.name;
|
|
394
|
-
const incoming_name = incoming.name;
|
|
395
|
-
if (!(existing_name === incoming_name)) {
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
|
-
const existing_thumbnailUrl = existing.thumbnailUrl;
|
|
399
|
-
const incoming_thumbnailUrl = incoming.thumbnailUrl;
|
|
400
|
-
if (!(existing_thumbnailUrl === incoming_thumbnailUrl)) {
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
return true;
|
|
328
|
+
const VERSION$2 = "6940195c96726bc70b9ad00de7d9c58a";
|
|
329
|
+
function validate$2(obj, path = 'StarterTemplateRepresentation') {
|
|
330
|
+
const v_error = (() => {
|
|
331
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
332
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
333
|
+
}
|
|
334
|
+
const obj_description = obj.description;
|
|
335
|
+
const path_description = path + '.description';
|
|
336
|
+
if (typeof obj_description !== 'string') {
|
|
337
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
338
|
+
}
|
|
339
|
+
const obj_id = obj.id;
|
|
340
|
+
const path_id = path + '.id';
|
|
341
|
+
if (typeof obj_id !== 'string') {
|
|
342
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
343
|
+
}
|
|
344
|
+
const obj_name = obj.name;
|
|
345
|
+
const path_name = path + '.name';
|
|
346
|
+
if (typeof obj_name !== 'string') {
|
|
347
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
348
|
+
}
|
|
349
|
+
const obj_thumbnailUrl = obj.thumbnailUrl;
|
|
350
|
+
const path_thumbnailUrl = path + '.thumbnailUrl';
|
|
351
|
+
if (typeof obj_thumbnailUrl !== 'string') {
|
|
352
|
+
return new TypeError('Expected "string" but received "' + typeof obj_thumbnailUrl + '" (at "' + path_thumbnailUrl + '")');
|
|
353
|
+
}
|
|
354
|
+
})();
|
|
355
|
+
return v_error === undefined ? null : v_error;
|
|
356
|
+
}
|
|
357
|
+
const select$4 = function StarterTemplateRepresentationSelect() {
|
|
358
|
+
return {
|
|
359
|
+
kind: 'Fragment',
|
|
360
|
+
version: VERSION$2,
|
|
361
|
+
private: [],
|
|
362
|
+
selections: [
|
|
363
|
+
{
|
|
364
|
+
name: 'description',
|
|
365
|
+
kind: 'Scalar'
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: 'id',
|
|
369
|
+
kind: 'Scalar'
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: 'name',
|
|
373
|
+
kind: 'Scalar'
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
name: 'thumbnailUrl',
|
|
377
|
+
kind: 'Scalar'
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
function equals$2(existing, incoming) {
|
|
383
|
+
const existing_description = existing.description;
|
|
384
|
+
const incoming_description = incoming.description;
|
|
385
|
+
if (!(existing_description === incoming_description)) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
const existing_id = existing.id;
|
|
389
|
+
const incoming_id = incoming.id;
|
|
390
|
+
if (!(existing_id === incoming_id)) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
const existing_name = existing.name;
|
|
394
|
+
const incoming_name = incoming.name;
|
|
395
|
+
if (!(existing_name === incoming_name)) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
const existing_thumbnailUrl = existing.thumbnailUrl;
|
|
399
|
+
const incoming_thumbnailUrl = incoming.thumbnailUrl;
|
|
400
|
+
if (!(existing_thumbnailUrl === incoming_thumbnailUrl)) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
return true;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
const TTL$1 = 3000;
|
|
407
|
-
const VERSION$1 = "8b256fe58f3a26927a96dc6c87f2845e";
|
|
408
|
-
function validate$1(obj, path = 'StarterTemplateListRepresentation') {
|
|
409
|
-
const v_error = (() => {
|
|
410
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
411
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
412
|
-
}
|
|
413
|
-
const obj_starterTemplateList = obj.starterTemplateList;
|
|
414
|
-
const path_starterTemplateList = path + '.starterTemplateList';
|
|
415
|
-
if (!ArrayIsArray(obj_starterTemplateList)) {
|
|
416
|
-
return new TypeError('Expected "array" but received "' + typeof obj_starterTemplateList + '" (at "' + path_starterTemplateList + '")');
|
|
417
|
-
}
|
|
418
|
-
for (let i = 0; i < obj_starterTemplateList.length; i++) {
|
|
419
|
-
const obj_starterTemplateList_item = obj_starterTemplateList[i];
|
|
420
|
-
const path_starterTemplateList_item = path_starterTemplateList + '[' + i + ']';
|
|
421
|
-
const referencepath_starterTemplateList_itemValidationError = validate$2(obj_starterTemplateList_item, path_starterTemplateList_item);
|
|
422
|
-
if (referencepath_starterTemplateList_itemValidationError !== null) {
|
|
423
|
-
let message = 'Object doesn\'t match StarterTemplateRepresentation (at "' + path_starterTemplateList_item + '")\n';
|
|
424
|
-
message += referencepath_starterTemplateList_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
425
|
-
return new TypeError(message);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
})();
|
|
429
|
-
return v_error === undefined ? null : v_error;
|
|
430
|
-
}
|
|
431
|
-
const RepresentationType$1 = 'StarterTemplateListRepresentation';
|
|
432
|
-
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
433
|
-
return input;
|
|
434
|
-
}
|
|
435
|
-
const select$3 = function StarterTemplateListRepresentationSelect() {
|
|
436
|
-
const { selections: StarterTemplateRepresentation__selections, opaque: StarterTemplateRepresentation__opaque, } = select$4();
|
|
437
|
-
return {
|
|
438
|
-
kind: 'Fragment',
|
|
439
|
-
version: VERSION$1,
|
|
440
|
-
private: [],
|
|
441
|
-
selections: [
|
|
442
|
-
{
|
|
443
|
-
name: 'starterTemplateList',
|
|
444
|
-
kind: 'Object',
|
|
445
|
-
plural: true,
|
|
446
|
-
selections: StarterTemplateRepresentation__selections
|
|
447
|
-
}
|
|
448
|
-
]
|
|
449
|
-
};
|
|
450
|
-
};
|
|
451
|
-
function equals$1(existing, incoming) {
|
|
452
|
-
const existing_starterTemplateList = existing.starterTemplateList;
|
|
453
|
-
const incoming_starterTemplateList = incoming.starterTemplateList;
|
|
454
|
-
const equals_starterTemplateList_items = equalsArray(existing_starterTemplateList, incoming_starterTemplateList, (existing_starterTemplateList_item, incoming_starterTemplateList_item) => {
|
|
455
|
-
if (!(equals$2(existing_starterTemplateList_item, incoming_starterTemplateList_item))) {
|
|
456
|
-
return false;
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
if (equals_starterTemplateList_items === false) {
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
return true;
|
|
463
|
-
}
|
|
464
|
-
const ingest$1 = function StarterTemplateListRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
465
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
466
|
-
const validateError = validate$1(input);
|
|
467
|
-
if (validateError !== null) {
|
|
468
|
-
throw validateError;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
const key = path.fullPath;
|
|
472
|
-
const existingRecord = store.readEntry(key);
|
|
473
|
-
const ttlToUse = TTL$1;
|
|
474
|
-
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
475
|
-
fullPath: key,
|
|
476
|
-
parent: path.parent,
|
|
477
|
-
propertyName: path.propertyName,
|
|
478
|
-
ttl: ttlToUse
|
|
479
|
-
});
|
|
480
|
-
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
481
|
-
luvio.storePublish(key, incomingRecord);
|
|
482
|
-
}
|
|
483
|
-
{
|
|
484
|
-
const storeMetadataParams = {
|
|
485
|
-
ttl: ttlToUse,
|
|
486
|
-
namespace: "assetcreation",
|
|
487
|
-
version: VERSION$1,
|
|
488
|
-
representationName: RepresentationType$1,
|
|
489
|
-
};
|
|
490
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
491
|
-
}
|
|
492
|
-
return createLink(key);
|
|
493
|
-
};
|
|
494
|
-
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
495
|
-
const rootKeySet = new StoreKeyMap();
|
|
496
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
497
|
-
const rootKey = fullPathFactory();
|
|
498
|
-
rootKeySet.set(rootKey, {
|
|
499
|
-
namespace: keyPrefix,
|
|
500
|
-
representationName: RepresentationType$1,
|
|
501
|
-
mergeable: false
|
|
502
|
-
});
|
|
503
|
-
return rootKeySet;
|
|
406
|
+
const TTL$1 = 3000;
|
|
407
|
+
const VERSION$1 = "8b256fe58f3a26927a96dc6c87f2845e";
|
|
408
|
+
function validate$1(obj, path = 'StarterTemplateListRepresentation') {
|
|
409
|
+
const v_error = (() => {
|
|
410
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
411
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
412
|
+
}
|
|
413
|
+
const obj_starterTemplateList = obj.starterTemplateList;
|
|
414
|
+
const path_starterTemplateList = path + '.starterTemplateList';
|
|
415
|
+
if (!ArrayIsArray(obj_starterTemplateList)) {
|
|
416
|
+
return new TypeError('Expected "array" but received "' + typeof obj_starterTemplateList + '" (at "' + path_starterTemplateList + '")');
|
|
417
|
+
}
|
|
418
|
+
for (let i = 0; i < obj_starterTemplateList.length; i++) {
|
|
419
|
+
const obj_starterTemplateList_item = obj_starterTemplateList[i];
|
|
420
|
+
const path_starterTemplateList_item = path_starterTemplateList + '[' + i + ']';
|
|
421
|
+
const referencepath_starterTemplateList_itemValidationError = validate$2(obj_starterTemplateList_item, path_starterTemplateList_item);
|
|
422
|
+
if (referencepath_starterTemplateList_itemValidationError !== null) {
|
|
423
|
+
let message = 'Object doesn\'t match StarterTemplateRepresentation (at "' + path_starterTemplateList_item + '")\n';
|
|
424
|
+
message += referencepath_starterTemplateList_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
425
|
+
return new TypeError(message);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
})();
|
|
429
|
+
return v_error === undefined ? null : v_error;
|
|
430
|
+
}
|
|
431
|
+
const RepresentationType$1 = 'StarterTemplateListRepresentation';
|
|
432
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
433
|
+
return input;
|
|
434
|
+
}
|
|
435
|
+
const select$3 = function StarterTemplateListRepresentationSelect() {
|
|
436
|
+
const { selections: StarterTemplateRepresentation__selections, opaque: StarterTemplateRepresentation__opaque, } = select$4();
|
|
437
|
+
return {
|
|
438
|
+
kind: 'Fragment',
|
|
439
|
+
version: VERSION$1,
|
|
440
|
+
private: [],
|
|
441
|
+
selections: [
|
|
442
|
+
{
|
|
443
|
+
name: 'starterTemplateList',
|
|
444
|
+
kind: 'Object',
|
|
445
|
+
plural: true,
|
|
446
|
+
selections: StarterTemplateRepresentation__selections
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
function equals$1(existing, incoming) {
|
|
452
|
+
const existing_starterTemplateList = existing.starterTemplateList;
|
|
453
|
+
const incoming_starterTemplateList = incoming.starterTemplateList;
|
|
454
|
+
const equals_starterTemplateList_items = equalsArray(existing_starterTemplateList, incoming_starterTemplateList, (existing_starterTemplateList_item, incoming_starterTemplateList_item) => {
|
|
455
|
+
if (!(equals$2(existing_starterTemplateList_item, incoming_starterTemplateList_item))) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
if (equals_starterTemplateList_items === false) {
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
const ingest$1 = function StarterTemplateListRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
465
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
466
|
+
const validateError = validate$1(input);
|
|
467
|
+
if (validateError !== null) {
|
|
468
|
+
throw validateError;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
const key = path.fullPath;
|
|
472
|
+
const existingRecord = store.readEntry(key);
|
|
473
|
+
const ttlToUse = TTL$1;
|
|
474
|
+
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
475
|
+
fullPath: key,
|
|
476
|
+
parent: path.parent,
|
|
477
|
+
propertyName: path.propertyName,
|
|
478
|
+
ttl: ttlToUse
|
|
479
|
+
});
|
|
480
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
481
|
+
luvio.storePublish(key, incomingRecord);
|
|
482
|
+
}
|
|
483
|
+
{
|
|
484
|
+
const storeMetadataParams = {
|
|
485
|
+
ttl: ttlToUse,
|
|
486
|
+
namespace: "assetcreation",
|
|
487
|
+
version: VERSION$1,
|
|
488
|
+
representationName: RepresentationType$1,
|
|
489
|
+
};
|
|
490
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
491
|
+
}
|
|
492
|
+
return createLink(key);
|
|
493
|
+
};
|
|
494
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
495
|
+
const rootKeySet = new StoreKeyMap();
|
|
496
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
497
|
+
const rootKey = fullPathFactory();
|
|
498
|
+
rootKeySet.set(rootKey, {
|
|
499
|
+
namespace: keyPrefix,
|
|
500
|
+
representationName: RepresentationType$1,
|
|
501
|
+
mergeable: false
|
|
502
|
+
});
|
|
503
|
+
return rootKeySet;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
function select$2(luvio, params) {
|
|
507
|
-
return select$3();
|
|
508
|
-
}
|
|
509
|
-
function keyBuilder$3(luvio, params) {
|
|
510
|
-
return keyPrefix + '::StarterTemplateListRepresentation:(' + 'filter:' + params.queryParams.filter + ',' + 'type:' + params.queryParams.type + ')';
|
|
511
|
-
}
|
|
512
|
-
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
513
|
-
return getTypeCacheKeys$1(luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
514
|
-
}
|
|
515
|
-
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
516
|
-
const { body } = response;
|
|
517
|
-
const key = keyBuilder$3(luvio, resourceParams);
|
|
518
|
-
luvio.storeIngest(key, ingest$1, body);
|
|
519
|
-
const snapshot = luvio.storeLookup({
|
|
520
|
-
recordId: key,
|
|
521
|
-
node: select$2(),
|
|
522
|
-
variables: {},
|
|
523
|
-
}, snapshotRefresh);
|
|
524
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
525
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
526
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
return snapshot;
|
|
530
|
-
}
|
|
531
|
-
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
532
|
-
const key = keyBuilder$3(luvio, params);
|
|
533
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
534
|
-
const storeMetadataParams = {
|
|
535
|
-
ttl: TTL$1,
|
|
536
|
-
namespace: keyPrefix,
|
|
537
|
-
version: VERSION$1,
|
|
538
|
-
representationName: RepresentationType$1
|
|
539
|
-
};
|
|
540
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
541
|
-
return errorSnapshot;
|
|
542
|
-
}
|
|
543
|
-
function createResourceRequest$1(config) {
|
|
544
|
-
const headers = {};
|
|
545
|
-
return {
|
|
546
|
-
baseUri: '/services/data/v58.0',
|
|
547
|
-
basePath: '/asset-creation/starter-templates',
|
|
548
|
-
method: 'get',
|
|
549
|
-
body: null,
|
|
550
|
-
urlParams: {},
|
|
551
|
-
queryParams: config.queryParams,
|
|
552
|
-
headers,
|
|
553
|
-
priority: 'normal',
|
|
554
|
-
};
|
|
506
|
+
function select$2(luvio, params) {
|
|
507
|
+
return select$3();
|
|
508
|
+
}
|
|
509
|
+
function keyBuilder$3(luvio, params) {
|
|
510
|
+
return keyPrefix + '::StarterTemplateListRepresentation:(' + 'filter:' + params.queryParams.filter + ',' + 'type:' + params.queryParams.type + ')';
|
|
511
|
+
}
|
|
512
|
+
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
513
|
+
return getTypeCacheKeys$1(luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
514
|
+
}
|
|
515
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
516
|
+
const { body } = response;
|
|
517
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
518
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
519
|
+
const snapshot = luvio.storeLookup({
|
|
520
|
+
recordId: key,
|
|
521
|
+
node: select$2(),
|
|
522
|
+
variables: {},
|
|
523
|
+
}, snapshotRefresh);
|
|
524
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
525
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
526
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return snapshot;
|
|
530
|
+
}
|
|
531
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
532
|
+
const key = keyBuilder$3(luvio, params);
|
|
533
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
534
|
+
const storeMetadataParams = {
|
|
535
|
+
ttl: TTL$1,
|
|
536
|
+
namespace: keyPrefix,
|
|
537
|
+
version: VERSION$1,
|
|
538
|
+
representationName: RepresentationType$1
|
|
539
|
+
};
|
|
540
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
541
|
+
return errorSnapshot;
|
|
542
|
+
}
|
|
543
|
+
function createResourceRequest$1(config) {
|
|
544
|
+
const headers = {};
|
|
545
|
+
return {
|
|
546
|
+
baseUri: '/services/data/v58.0',
|
|
547
|
+
basePath: '/asset-creation/starter-templates',
|
|
548
|
+
method: 'get',
|
|
549
|
+
body: null,
|
|
550
|
+
urlParams: {},
|
|
551
|
+
queryParams: config.queryParams,
|
|
552
|
+
headers,
|
|
553
|
+
priority: 'normal',
|
|
554
|
+
};
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
const getStarterTemplates_ConfigPropertyNames = {
|
|
558
|
-
displayName: 'getStarterTemplates',
|
|
559
|
-
parameters: {
|
|
560
|
-
required: [],
|
|
561
|
-
optional: ['filter', 'type']
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
function createResourceParams$1(config) {
|
|
565
|
-
const resourceParams = {
|
|
566
|
-
queryParams: {
|
|
567
|
-
filter: config.filter, type: config.type
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
return resourceParams;
|
|
571
|
-
}
|
|
572
|
-
function keyBuilder$2(luvio, config) {
|
|
573
|
-
const resourceParams = createResourceParams$1(config);
|
|
574
|
-
return keyBuilder$3(luvio, resourceParams);
|
|
575
|
-
}
|
|
576
|
-
function typeCheckConfig$1(untrustedConfig) {
|
|
577
|
-
const config = {};
|
|
578
|
-
const untrustedConfig_filter = untrustedConfig.filter;
|
|
579
|
-
if (typeof untrustedConfig_filter === 'string') {
|
|
580
|
-
config.filter = untrustedConfig_filter;
|
|
581
|
-
}
|
|
582
|
-
const untrustedConfig_type = untrustedConfig.type;
|
|
583
|
-
if (typeof untrustedConfig_type === 'string') {
|
|
584
|
-
config.type = untrustedConfig_type;
|
|
585
|
-
}
|
|
586
|
-
return config;
|
|
587
|
-
}
|
|
588
|
-
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
589
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
590
|
-
return null;
|
|
591
|
-
}
|
|
592
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
593
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
594
|
-
}
|
|
595
|
-
const config = typeCheckConfig$1(untrustedConfig);
|
|
596
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
597
|
-
return null;
|
|
598
|
-
}
|
|
599
|
-
return config;
|
|
600
|
-
}
|
|
601
|
-
function adapterFragment$1(luvio, config) {
|
|
602
|
-
createResourceParams$1(config);
|
|
603
|
-
return select$2();
|
|
604
|
-
}
|
|
605
|
-
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
606
|
-
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
607
|
-
config,
|
|
608
|
-
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
609
|
-
});
|
|
610
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
611
|
-
}
|
|
612
|
-
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
613
|
-
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
614
|
-
config,
|
|
615
|
-
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
616
|
-
});
|
|
617
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
618
|
-
}
|
|
619
|
-
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
620
|
-
const resourceParams = createResourceParams$1(config);
|
|
621
|
-
const request = createResourceRequest$1(resourceParams);
|
|
622
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
623
|
-
.then((response) => {
|
|
624
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
625
|
-
}, (response) => {
|
|
626
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
630
|
-
const { luvio, config } = context;
|
|
631
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
632
|
-
const dispatchOptions = {
|
|
633
|
-
resourceRequestContext: {
|
|
634
|
-
requestCorrelator,
|
|
635
|
-
luvioRequestMethod: undefined,
|
|
636
|
-
},
|
|
637
|
-
eventObservers
|
|
638
|
-
};
|
|
639
|
-
if (networkPriority !== 'normal') {
|
|
640
|
-
dispatchOptions.overrides = {
|
|
641
|
-
priority: networkPriority
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
|
|
645
|
-
}
|
|
646
|
-
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
647
|
-
const { luvio, config } = context;
|
|
648
|
-
const selector = {
|
|
649
|
-
recordId: keyBuilder$2(luvio, config),
|
|
650
|
-
node: adapterFragment$1(luvio, config),
|
|
651
|
-
variables: {},
|
|
652
|
-
};
|
|
653
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
654
|
-
config,
|
|
655
|
-
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
656
|
-
});
|
|
657
|
-
return cacheSnapshot;
|
|
658
|
-
}
|
|
659
|
-
const getStarterTemplatesAdapterFactory = (luvio) => function assetcreation__getStarterTemplates(untrustedConfig, requestContext) {
|
|
660
|
-
const config = validateAdapterConfig$1(untrustedConfig, getStarterTemplates_ConfigPropertyNames);
|
|
661
|
-
// Invalid or incomplete config
|
|
662
|
-
if (config === null) {
|
|
663
|
-
return null;
|
|
664
|
-
}
|
|
665
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
666
|
-
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
557
|
+
const getStarterTemplates_ConfigPropertyNames = {
|
|
558
|
+
displayName: 'getStarterTemplates',
|
|
559
|
+
parameters: {
|
|
560
|
+
required: [],
|
|
561
|
+
optional: ['filter', 'type']
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
function createResourceParams$1(config) {
|
|
565
|
+
const resourceParams = {
|
|
566
|
+
queryParams: {
|
|
567
|
+
filter: config.filter, type: config.type
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
return resourceParams;
|
|
571
|
+
}
|
|
572
|
+
function keyBuilder$2(luvio, config) {
|
|
573
|
+
const resourceParams = createResourceParams$1(config);
|
|
574
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
575
|
+
}
|
|
576
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
577
|
+
const config = {};
|
|
578
|
+
const untrustedConfig_filter = untrustedConfig.filter;
|
|
579
|
+
if (typeof untrustedConfig_filter === 'string') {
|
|
580
|
+
config.filter = untrustedConfig_filter;
|
|
581
|
+
}
|
|
582
|
+
const untrustedConfig_type = untrustedConfig.type;
|
|
583
|
+
if (typeof untrustedConfig_type === 'string') {
|
|
584
|
+
config.type = untrustedConfig_type;
|
|
585
|
+
}
|
|
586
|
+
return config;
|
|
587
|
+
}
|
|
588
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
589
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
593
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
594
|
+
}
|
|
595
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
596
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
return config;
|
|
600
|
+
}
|
|
601
|
+
function adapterFragment$1(luvio, config) {
|
|
602
|
+
createResourceParams$1(config);
|
|
603
|
+
return select$2();
|
|
604
|
+
}
|
|
605
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
606
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
607
|
+
config,
|
|
608
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
609
|
+
});
|
|
610
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
611
|
+
}
|
|
612
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
613
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
614
|
+
config,
|
|
615
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
616
|
+
});
|
|
617
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
618
|
+
}
|
|
619
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
620
|
+
const resourceParams = createResourceParams$1(config);
|
|
621
|
+
const request = createResourceRequest$1(resourceParams);
|
|
622
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
623
|
+
.then((response) => {
|
|
624
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
625
|
+
}, (response) => {
|
|
626
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
630
|
+
const { luvio, config } = context;
|
|
631
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
632
|
+
const dispatchOptions = {
|
|
633
|
+
resourceRequestContext: {
|
|
634
|
+
requestCorrelator,
|
|
635
|
+
luvioRequestMethod: undefined,
|
|
636
|
+
},
|
|
637
|
+
eventObservers
|
|
638
|
+
};
|
|
639
|
+
if (networkPriority !== 'normal') {
|
|
640
|
+
dispatchOptions.overrides = {
|
|
641
|
+
priority: networkPriority
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
|
|
645
|
+
}
|
|
646
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
647
|
+
const { luvio, config } = context;
|
|
648
|
+
const selector = {
|
|
649
|
+
recordId: keyBuilder$2(luvio, config),
|
|
650
|
+
node: adapterFragment$1(luvio, config),
|
|
651
|
+
variables: {},
|
|
652
|
+
};
|
|
653
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
654
|
+
config,
|
|
655
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
656
|
+
});
|
|
657
|
+
return cacheSnapshot;
|
|
658
|
+
}
|
|
659
|
+
const getStarterTemplatesAdapterFactory = (luvio) => function assetcreation__getStarterTemplates(untrustedConfig, requestContext) {
|
|
660
|
+
const config = validateAdapterConfig$1(untrustedConfig, getStarterTemplates_ConfigPropertyNames);
|
|
661
|
+
// Invalid or incomplete config
|
|
662
|
+
if (config === null) {
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
665
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
666
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
667
667
|
};
|
|
668
668
|
|
|
669
|
-
const TTL = 1000;
|
|
670
|
-
const VERSION = "260c6823e9865ac87e1cb3929e85646c";
|
|
671
|
-
function validate(obj, path = 'StarterTemplateDetailRepresentation') {
|
|
672
|
-
const v_error = (() => {
|
|
673
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
674
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
675
|
-
}
|
|
676
|
-
const obj_contentBuilderUrl = obj.contentBuilderUrl;
|
|
677
|
-
const path_contentBuilderUrl = path + '.contentBuilderUrl';
|
|
678
|
-
if (typeof obj_contentBuilderUrl !== 'string') {
|
|
679
|
-
return new TypeError('Expected "string" but received "' + typeof obj_contentBuilderUrl + '" (at "' + path_contentBuilderUrl + '")');
|
|
680
|
-
}
|
|
681
|
-
const obj_createdBy = obj.createdBy;
|
|
682
|
-
const path_createdBy = path + '.createdBy';
|
|
683
|
-
if (typeof obj_createdBy !== 'string') {
|
|
684
|
-
return new TypeError('Expected "string" but received "' + typeof obj_createdBy + '" (at "' + path_createdBy + '")');
|
|
685
|
-
}
|
|
686
|
-
const obj_createdOn = obj.createdOn;
|
|
687
|
-
const path_createdOn = path + '.createdOn';
|
|
688
|
-
if (typeof obj_createdOn !== 'string') {
|
|
689
|
-
return new TypeError('Expected "string" but received "' + typeof obj_createdOn + '" (at "' + path_createdOn + '")');
|
|
690
|
-
}
|
|
691
|
-
const obj_description = obj.description;
|
|
692
|
-
const path_description = path + '.description';
|
|
693
|
-
if (typeof obj_description !== 'string') {
|
|
694
|
-
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
695
|
-
}
|
|
696
|
-
const obj_html = obj.html;
|
|
697
|
-
const path_html = path + '.html';
|
|
698
|
-
if (typeof obj_html !== 'string') {
|
|
699
|
-
return new TypeError('Expected "string" but received "' + typeof obj_html + '" (at "' + path_html + '")');
|
|
700
|
-
}
|
|
701
|
-
const obj_id = obj.id;
|
|
702
|
-
const path_id = path + '.id';
|
|
703
|
-
if (typeof obj_id !== 'string') {
|
|
704
|
-
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
705
|
-
}
|
|
706
|
-
const obj_name = obj.name;
|
|
707
|
-
const path_name = path + '.name';
|
|
708
|
-
if (typeof obj_name !== 'string') {
|
|
709
|
-
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
710
|
-
}
|
|
711
|
-
})();
|
|
712
|
-
return v_error === undefined ? null : v_error;
|
|
713
|
-
}
|
|
714
|
-
const RepresentationType = 'StarterTemplateDetailRepresentation';
|
|
715
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
716
|
-
return input;
|
|
717
|
-
}
|
|
718
|
-
const select$1 = function StarterTemplateDetailRepresentationSelect() {
|
|
719
|
-
return {
|
|
720
|
-
kind: 'Fragment',
|
|
721
|
-
version: VERSION,
|
|
722
|
-
private: [],
|
|
723
|
-
selections: [
|
|
724
|
-
{
|
|
725
|
-
name: 'contentBuilderUrl',
|
|
726
|
-
kind: 'Scalar'
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
name: 'createdBy',
|
|
730
|
-
kind: 'Scalar'
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
name: 'createdOn',
|
|
734
|
-
kind: 'Scalar'
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
name: 'description',
|
|
738
|
-
kind: 'Scalar'
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
name: 'html',
|
|
742
|
-
kind: 'Scalar'
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
name: 'id',
|
|
746
|
-
kind: 'Scalar'
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
name: 'name',
|
|
750
|
-
kind: 'Scalar'
|
|
751
|
-
}
|
|
752
|
-
]
|
|
753
|
-
};
|
|
754
|
-
};
|
|
755
|
-
function equals(existing, incoming) {
|
|
756
|
-
const existing_contentBuilderUrl = existing.contentBuilderUrl;
|
|
757
|
-
const incoming_contentBuilderUrl = incoming.contentBuilderUrl;
|
|
758
|
-
if (!(existing_contentBuilderUrl === incoming_contentBuilderUrl)) {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
const existing_createdBy = existing.createdBy;
|
|
762
|
-
const incoming_createdBy = incoming.createdBy;
|
|
763
|
-
if (!(existing_createdBy === incoming_createdBy)) {
|
|
764
|
-
return false;
|
|
765
|
-
}
|
|
766
|
-
const existing_createdOn = existing.createdOn;
|
|
767
|
-
const incoming_createdOn = incoming.createdOn;
|
|
768
|
-
if (!(existing_createdOn === incoming_createdOn)) {
|
|
769
|
-
return false;
|
|
770
|
-
}
|
|
771
|
-
const existing_description = existing.description;
|
|
772
|
-
const incoming_description = incoming.description;
|
|
773
|
-
if (!(existing_description === incoming_description)) {
|
|
774
|
-
return false;
|
|
775
|
-
}
|
|
776
|
-
const existing_html = existing.html;
|
|
777
|
-
const incoming_html = incoming.html;
|
|
778
|
-
if (!(existing_html === incoming_html)) {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
const existing_id = existing.id;
|
|
782
|
-
const incoming_id = incoming.id;
|
|
783
|
-
if (!(existing_id === incoming_id)) {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
const existing_name = existing.name;
|
|
787
|
-
const incoming_name = incoming.name;
|
|
788
|
-
if (!(existing_name === incoming_name)) {
|
|
789
|
-
return false;
|
|
790
|
-
}
|
|
791
|
-
return true;
|
|
792
|
-
}
|
|
793
|
-
const ingest = function StarterTemplateDetailRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
794
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
795
|
-
const validateError = validate(input);
|
|
796
|
-
if (validateError !== null) {
|
|
797
|
-
throw validateError;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
const key = path.fullPath;
|
|
801
|
-
const existingRecord = store.readEntry(key);
|
|
802
|
-
const ttlToUse = TTL;
|
|
803
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
804
|
-
fullPath: key,
|
|
805
|
-
parent: path.parent,
|
|
806
|
-
propertyName: path.propertyName,
|
|
807
|
-
ttl: ttlToUse
|
|
808
|
-
});
|
|
809
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
810
|
-
luvio.storePublish(key, incomingRecord);
|
|
811
|
-
}
|
|
812
|
-
{
|
|
813
|
-
const storeMetadataParams = {
|
|
814
|
-
ttl: ttlToUse,
|
|
815
|
-
namespace: "assetcreation",
|
|
816
|
-
version: VERSION,
|
|
817
|
-
representationName: RepresentationType,
|
|
818
|
-
};
|
|
819
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
820
|
-
}
|
|
821
|
-
return createLink(key);
|
|
822
|
-
};
|
|
823
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
824
|
-
const rootKeySet = new StoreKeyMap();
|
|
825
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
826
|
-
const rootKey = fullPathFactory();
|
|
827
|
-
rootKeySet.set(rootKey, {
|
|
828
|
-
namespace: keyPrefix,
|
|
829
|
-
representationName: RepresentationType,
|
|
830
|
-
mergeable: false
|
|
831
|
-
});
|
|
832
|
-
return rootKeySet;
|
|
669
|
+
const TTL = 1000;
|
|
670
|
+
const VERSION = "260c6823e9865ac87e1cb3929e85646c";
|
|
671
|
+
function validate(obj, path = 'StarterTemplateDetailRepresentation') {
|
|
672
|
+
const v_error = (() => {
|
|
673
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
674
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
675
|
+
}
|
|
676
|
+
const obj_contentBuilderUrl = obj.contentBuilderUrl;
|
|
677
|
+
const path_contentBuilderUrl = path + '.contentBuilderUrl';
|
|
678
|
+
if (typeof obj_contentBuilderUrl !== 'string') {
|
|
679
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentBuilderUrl + '" (at "' + path_contentBuilderUrl + '")');
|
|
680
|
+
}
|
|
681
|
+
const obj_createdBy = obj.createdBy;
|
|
682
|
+
const path_createdBy = path + '.createdBy';
|
|
683
|
+
if (typeof obj_createdBy !== 'string') {
|
|
684
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdBy + '" (at "' + path_createdBy + '")');
|
|
685
|
+
}
|
|
686
|
+
const obj_createdOn = obj.createdOn;
|
|
687
|
+
const path_createdOn = path + '.createdOn';
|
|
688
|
+
if (typeof obj_createdOn !== 'string') {
|
|
689
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdOn + '" (at "' + path_createdOn + '")');
|
|
690
|
+
}
|
|
691
|
+
const obj_description = obj.description;
|
|
692
|
+
const path_description = path + '.description';
|
|
693
|
+
if (typeof obj_description !== 'string') {
|
|
694
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
695
|
+
}
|
|
696
|
+
const obj_html = obj.html;
|
|
697
|
+
const path_html = path + '.html';
|
|
698
|
+
if (typeof obj_html !== 'string') {
|
|
699
|
+
return new TypeError('Expected "string" but received "' + typeof obj_html + '" (at "' + path_html + '")');
|
|
700
|
+
}
|
|
701
|
+
const obj_id = obj.id;
|
|
702
|
+
const path_id = path + '.id';
|
|
703
|
+
if (typeof obj_id !== 'string') {
|
|
704
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
705
|
+
}
|
|
706
|
+
const obj_name = obj.name;
|
|
707
|
+
const path_name = path + '.name';
|
|
708
|
+
if (typeof obj_name !== 'string') {
|
|
709
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
710
|
+
}
|
|
711
|
+
})();
|
|
712
|
+
return v_error === undefined ? null : v_error;
|
|
713
|
+
}
|
|
714
|
+
const RepresentationType = 'StarterTemplateDetailRepresentation';
|
|
715
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
716
|
+
return input;
|
|
717
|
+
}
|
|
718
|
+
const select$1 = function StarterTemplateDetailRepresentationSelect() {
|
|
719
|
+
return {
|
|
720
|
+
kind: 'Fragment',
|
|
721
|
+
version: VERSION,
|
|
722
|
+
private: [],
|
|
723
|
+
selections: [
|
|
724
|
+
{
|
|
725
|
+
name: 'contentBuilderUrl',
|
|
726
|
+
kind: 'Scalar'
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
name: 'createdBy',
|
|
730
|
+
kind: 'Scalar'
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: 'createdOn',
|
|
734
|
+
kind: 'Scalar'
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
name: 'description',
|
|
738
|
+
kind: 'Scalar'
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
name: 'html',
|
|
742
|
+
kind: 'Scalar'
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: 'id',
|
|
746
|
+
kind: 'Scalar'
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
name: 'name',
|
|
750
|
+
kind: 'Scalar'
|
|
751
|
+
}
|
|
752
|
+
]
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
function equals(existing, incoming) {
|
|
756
|
+
const existing_contentBuilderUrl = existing.contentBuilderUrl;
|
|
757
|
+
const incoming_contentBuilderUrl = incoming.contentBuilderUrl;
|
|
758
|
+
if (!(existing_contentBuilderUrl === incoming_contentBuilderUrl)) {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
const existing_createdBy = existing.createdBy;
|
|
762
|
+
const incoming_createdBy = incoming.createdBy;
|
|
763
|
+
if (!(existing_createdBy === incoming_createdBy)) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
const existing_createdOn = existing.createdOn;
|
|
767
|
+
const incoming_createdOn = incoming.createdOn;
|
|
768
|
+
if (!(existing_createdOn === incoming_createdOn)) {
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
const existing_description = existing.description;
|
|
772
|
+
const incoming_description = incoming.description;
|
|
773
|
+
if (!(existing_description === incoming_description)) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
const existing_html = existing.html;
|
|
777
|
+
const incoming_html = incoming.html;
|
|
778
|
+
if (!(existing_html === incoming_html)) {
|
|
779
|
+
return false;
|
|
780
|
+
}
|
|
781
|
+
const existing_id = existing.id;
|
|
782
|
+
const incoming_id = incoming.id;
|
|
783
|
+
if (!(existing_id === incoming_id)) {
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
const existing_name = existing.name;
|
|
787
|
+
const incoming_name = incoming.name;
|
|
788
|
+
if (!(existing_name === incoming_name)) {
|
|
789
|
+
return false;
|
|
790
|
+
}
|
|
791
|
+
return true;
|
|
792
|
+
}
|
|
793
|
+
const ingest = function StarterTemplateDetailRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
794
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
795
|
+
const validateError = validate(input);
|
|
796
|
+
if (validateError !== null) {
|
|
797
|
+
throw validateError;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
const key = path.fullPath;
|
|
801
|
+
const existingRecord = store.readEntry(key);
|
|
802
|
+
const ttlToUse = TTL;
|
|
803
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
804
|
+
fullPath: key,
|
|
805
|
+
parent: path.parent,
|
|
806
|
+
propertyName: path.propertyName,
|
|
807
|
+
ttl: ttlToUse
|
|
808
|
+
});
|
|
809
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
810
|
+
luvio.storePublish(key, incomingRecord);
|
|
811
|
+
}
|
|
812
|
+
{
|
|
813
|
+
const storeMetadataParams = {
|
|
814
|
+
ttl: ttlToUse,
|
|
815
|
+
namespace: "assetcreation",
|
|
816
|
+
version: VERSION,
|
|
817
|
+
representationName: RepresentationType,
|
|
818
|
+
};
|
|
819
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
820
|
+
}
|
|
821
|
+
return createLink(key);
|
|
822
|
+
};
|
|
823
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
824
|
+
const rootKeySet = new StoreKeyMap();
|
|
825
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
826
|
+
const rootKey = fullPathFactory();
|
|
827
|
+
rootKeySet.set(rootKey, {
|
|
828
|
+
namespace: keyPrefix,
|
|
829
|
+
representationName: RepresentationType,
|
|
830
|
+
mergeable: false
|
|
831
|
+
});
|
|
832
|
+
return rootKeySet;
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
function select(luvio, params) {
|
|
836
|
-
return select$1();
|
|
837
|
-
}
|
|
838
|
-
function keyBuilder$1(luvio, params) {
|
|
839
|
-
return keyPrefix + '::StarterTemplateDetailRepresentation:(' + 'type:' + params.queryParams.type + ',' + 'starterTemplateId:' + params.urlParams.starterTemplateId + ')';
|
|
840
|
-
}
|
|
841
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
842
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
843
|
-
}
|
|
844
|
-
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
845
|
-
const { body } = response;
|
|
846
|
-
const key = keyBuilder$1(luvio, resourceParams);
|
|
847
|
-
luvio.storeIngest(key, ingest, body);
|
|
848
|
-
const snapshot = luvio.storeLookup({
|
|
849
|
-
recordId: key,
|
|
850
|
-
node: select(),
|
|
851
|
-
variables: {},
|
|
852
|
-
}, snapshotRefresh);
|
|
853
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
854
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
855
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
return snapshot;
|
|
859
|
-
}
|
|
860
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
861
|
-
const key = keyBuilder$1(luvio, params);
|
|
862
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
863
|
-
const storeMetadataParams = {
|
|
864
|
-
ttl: TTL,
|
|
865
|
-
namespace: keyPrefix,
|
|
866
|
-
version: VERSION,
|
|
867
|
-
representationName: RepresentationType
|
|
868
|
-
};
|
|
869
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
870
|
-
return errorSnapshot;
|
|
871
|
-
}
|
|
872
|
-
function createResourceRequest(config) {
|
|
873
|
-
const headers = {};
|
|
874
|
-
return {
|
|
875
|
-
baseUri: '/services/data/v58.0',
|
|
876
|
-
basePath: '/asset-creation/starter-templates/' + config.urlParams.starterTemplateId + '',
|
|
877
|
-
method: 'get',
|
|
878
|
-
body: null,
|
|
879
|
-
urlParams: config.urlParams,
|
|
880
|
-
queryParams: config.queryParams,
|
|
881
|
-
headers,
|
|
882
|
-
priority: 'normal',
|
|
883
|
-
};
|
|
835
|
+
function select(luvio, params) {
|
|
836
|
+
return select$1();
|
|
837
|
+
}
|
|
838
|
+
function keyBuilder$1(luvio, params) {
|
|
839
|
+
return keyPrefix + '::StarterTemplateDetailRepresentation:(' + 'type:' + params.queryParams.type + ',' + 'starterTemplateId:' + params.urlParams.starterTemplateId + ')';
|
|
840
|
+
}
|
|
841
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
842
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
843
|
+
}
|
|
844
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
845
|
+
const { body } = response;
|
|
846
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
847
|
+
luvio.storeIngest(key, ingest, body);
|
|
848
|
+
const snapshot = luvio.storeLookup({
|
|
849
|
+
recordId: key,
|
|
850
|
+
node: select(),
|
|
851
|
+
variables: {},
|
|
852
|
+
}, snapshotRefresh);
|
|
853
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
854
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
855
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return snapshot;
|
|
859
|
+
}
|
|
860
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
861
|
+
const key = keyBuilder$1(luvio, params);
|
|
862
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
863
|
+
const storeMetadataParams = {
|
|
864
|
+
ttl: TTL,
|
|
865
|
+
namespace: keyPrefix,
|
|
866
|
+
version: VERSION,
|
|
867
|
+
representationName: RepresentationType
|
|
868
|
+
};
|
|
869
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
870
|
+
return errorSnapshot;
|
|
871
|
+
}
|
|
872
|
+
function createResourceRequest(config) {
|
|
873
|
+
const headers = {};
|
|
874
|
+
return {
|
|
875
|
+
baseUri: '/services/data/v58.0',
|
|
876
|
+
basePath: '/asset-creation/starter-templates/' + config.urlParams.starterTemplateId + '',
|
|
877
|
+
method: 'get',
|
|
878
|
+
body: null,
|
|
879
|
+
urlParams: config.urlParams,
|
|
880
|
+
queryParams: config.queryParams,
|
|
881
|
+
headers,
|
|
882
|
+
priority: 'normal',
|
|
883
|
+
};
|
|
884
884
|
}
|
|
885
885
|
|
|
886
|
-
const getStarterTemplateById_ConfigPropertyNames = {
|
|
887
|
-
displayName: 'getStarterTemplateById',
|
|
888
|
-
parameters: {
|
|
889
|
-
required: ['starterTemplateId'],
|
|
890
|
-
optional: ['type']
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
function createResourceParams(config) {
|
|
894
|
-
const resourceParams = {
|
|
895
|
-
urlParams: {
|
|
896
|
-
starterTemplateId: config.starterTemplateId
|
|
897
|
-
},
|
|
898
|
-
queryParams: {
|
|
899
|
-
type: config.type
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
return resourceParams;
|
|
903
|
-
}
|
|
904
|
-
function keyBuilder(luvio, config) {
|
|
905
|
-
const resourceParams = createResourceParams(config);
|
|
906
|
-
return keyBuilder$1(luvio, resourceParams);
|
|
907
|
-
}
|
|
908
|
-
function typeCheckConfig(untrustedConfig) {
|
|
909
|
-
const config = {};
|
|
910
|
-
const untrustedConfig_starterTemplateId = untrustedConfig.starterTemplateId;
|
|
911
|
-
if (typeof untrustedConfig_starterTemplateId === 'string') {
|
|
912
|
-
config.starterTemplateId = untrustedConfig_starterTemplateId;
|
|
913
|
-
}
|
|
914
|
-
const untrustedConfig_type = untrustedConfig.type;
|
|
915
|
-
if (typeof untrustedConfig_type === 'string') {
|
|
916
|
-
config.type = untrustedConfig_type;
|
|
917
|
-
}
|
|
918
|
-
return config;
|
|
919
|
-
}
|
|
920
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
921
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
922
|
-
return null;
|
|
923
|
-
}
|
|
924
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
925
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
926
|
-
}
|
|
927
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
928
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
929
|
-
return null;
|
|
930
|
-
}
|
|
931
|
-
return config;
|
|
932
|
-
}
|
|
933
|
-
function adapterFragment(luvio, config) {
|
|
934
|
-
createResourceParams(config);
|
|
935
|
-
return select();
|
|
936
|
-
}
|
|
937
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
938
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
939
|
-
config,
|
|
940
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
941
|
-
});
|
|
942
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
943
|
-
}
|
|
944
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
945
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
946
|
-
config,
|
|
947
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
948
|
-
});
|
|
949
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
950
|
-
}
|
|
951
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
952
|
-
const resourceParams = createResourceParams(config);
|
|
953
|
-
const request = createResourceRequest(resourceParams);
|
|
954
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
955
|
-
.then((response) => {
|
|
956
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
957
|
-
}, (response) => {
|
|
958
|
-
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
962
|
-
const { luvio, config } = context;
|
|
963
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
964
|
-
const dispatchOptions = {
|
|
965
|
-
resourceRequestContext: {
|
|
966
|
-
requestCorrelator,
|
|
967
|
-
luvioRequestMethod: undefined,
|
|
968
|
-
},
|
|
969
|
-
eventObservers
|
|
970
|
-
};
|
|
971
|
-
if (networkPriority !== 'normal') {
|
|
972
|
-
dispatchOptions.overrides = {
|
|
973
|
-
priority: networkPriority
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
977
|
-
}
|
|
978
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
979
|
-
const { luvio, config } = context;
|
|
980
|
-
const selector = {
|
|
981
|
-
recordId: keyBuilder(luvio, config),
|
|
982
|
-
node: adapterFragment(luvio, config),
|
|
983
|
-
variables: {},
|
|
984
|
-
};
|
|
985
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
986
|
-
config,
|
|
987
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
988
|
-
});
|
|
989
|
-
return cacheSnapshot;
|
|
990
|
-
}
|
|
991
|
-
const getStarterTemplateByIdAdapterFactory = (luvio) => function assetcreation__getStarterTemplateById(untrustedConfig, requestContext) {
|
|
992
|
-
const config = validateAdapterConfig(untrustedConfig, getStarterTemplateById_ConfigPropertyNames);
|
|
993
|
-
// Invalid or incomplete config
|
|
994
|
-
if (config === null) {
|
|
995
|
-
return null;
|
|
996
|
-
}
|
|
997
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
998
|
-
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
886
|
+
const getStarterTemplateById_ConfigPropertyNames = {
|
|
887
|
+
displayName: 'getStarterTemplateById',
|
|
888
|
+
parameters: {
|
|
889
|
+
required: ['starterTemplateId'],
|
|
890
|
+
optional: ['type']
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
function createResourceParams(config) {
|
|
894
|
+
const resourceParams = {
|
|
895
|
+
urlParams: {
|
|
896
|
+
starterTemplateId: config.starterTemplateId
|
|
897
|
+
},
|
|
898
|
+
queryParams: {
|
|
899
|
+
type: config.type
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
return resourceParams;
|
|
903
|
+
}
|
|
904
|
+
function keyBuilder(luvio, config) {
|
|
905
|
+
const resourceParams = createResourceParams(config);
|
|
906
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
907
|
+
}
|
|
908
|
+
function typeCheckConfig(untrustedConfig) {
|
|
909
|
+
const config = {};
|
|
910
|
+
const untrustedConfig_starterTemplateId = untrustedConfig.starterTemplateId;
|
|
911
|
+
if (typeof untrustedConfig_starterTemplateId === 'string') {
|
|
912
|
+
config.starterTemplateId = untrustedConfig_starterTemplateId;
|
|
913
|
+
}
|
|
914
|
+
const untrustedConfig_type = untrustedConfig.type;
|
|
915
|
+
if (typeof untrustedConfig_type === 'string') {
|
|
916
|
+
config.type = untrustedConfig_type;
|
|
917
|
+
}
|
|
918
|
+
return config;
|
|
919
|
+
}
|
|
920
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
921
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
922
|
+
return null;
|
|
923
|
+
}
|
|
924
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
925
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
926
|
+
}
|
|
927
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
928
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
return config;
|
|
932
|
+
}
|
|
933
|
+
function adapterFragment(luvio, config) {
|
|
934
|
+
createResourceParams(config);
|
|
935
|
+
return select();
|
|
936
|
+
}
|
|
937
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
938
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
939
|
+
config,
|
|
940
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
941
|
+
});
|
|
942
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
943
|
+
}
|
|
944
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
945
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
946
|
+
config,
|
|
947
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
948
|
+
});
|
|
949
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
950
|
+
}
|
|
951
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
952
|
+
const resourceParams = createResourceParams(config);
|
|
953
|
+
const request = createResourceRequest(resourceParams);
|
|
954
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
955
|
+
.then((response) => {
|
|
956
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
957
|
+
}, (response) => {
|
|
958
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
962
|
+
const { luvio, config } = context;
|
|
963
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
964
|
+
const dispatchOptions = {
|
|
965
|
+
resourceRequestContext: {
|
|
966
|
+
requestCorrelator,
|
|
967
|
+
luvioRequestMethod: undefined,
|
|
968
|
+
},
|
|
969
|
+
eventObservers
|
|
970
|
+
};
|
|
971
|
+
if (networkPriority !== 'normal') {
|
|
972
|
+
dispatchOptions.overrides = {
|
|
973
|
+
priority: networkPriority
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
977
|
+
}
|
|
978
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
979
|
+
const { luvio, config } = context;
|
|
980
|
+
const selector = {
|
|
981
|
+
recordId: keyBuilder(luvio, config),
|
|
982
|
+
node: adapterFragment(luvio, config),
|
|
983
|
+
variables: {},
|
|
984
|
+
};
|
|
985
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
986
|
+
config,
|
|
987
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
988
|
+
});
|
|
989
|
+
return cacheSnapshot;
|
|
990
|
+
}
|
|
991
|
+
const getStarterTemplateByIdAdapterFactory = (luvio) => function assetcreation__getStarterTemplateById(untrustedConfig, requestContext) {
|
|
992
|
+
const config = validateAdapterConfig(untrustedConfig, getStarterTemplateById_ConfigPropertyNames);
|
|
993
|
+
// Invalid or incomplete config
|
|
994
|
+
if (config === null) {
|
|
995
|
+
return null;
|
|
996
|
+
}
|
|
997
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
998
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
999
999
|
};
|
|
1000
1000
|
|
|
1001
1001
|
export { createAssetAdapterFactory, getStarterTemplateByIdAdapterFactory, getStarterTemplatesAdapterFactory };
|