@salesforce/lds-adapters-analytics-tableau-embedding 1.148.0 → 1.149.0
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/analytics-tableau-embedding.js +245 -172
- package/dist/es/es2018/types/src/generated/adapters/getJWT.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/adapters/postJWT.d.ts +5 -16
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +1 -2
- package/dist/es/es2018/types/src/generated/resources/getTableauJwt.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/resources/postTableauJwt.d.ts +5 -7
- package/dist/es/es2018/types/src/generated/types/TableauJWTInputRepresentation.d.ts +4 -1
- package/dist/es/es2018/types/src/generated/types/TableauJWTRepresentation.d.ts +13 -1
- package/dist/es/es2018/types/src/generated/types/TableauJWTRepresentation2.d.ts +50 -0
- package/dist/es/es2018/types/src/sfdc.d.ts +1 -2
- package/package.json +1 -1
- package/sfdc/index.js +254 -199
- package/src/raml/api.raml +46 -3
- package/src/raml/luvio.raml +8 -1
|
@@ -58,9 +58,9 @@ function createLink(ref) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const TTL$
|
|
62
|
-
const VERSION$
|
|
63
|
-
function validate$
|
|
61
|
+
const TTL$2 = 180000;
|
|
62
|
+
const VERSION$2 = "97a38409c54dceea0317e696f6166bc4";
|
|
63
|
+
function validate$2(obj, path = 'TableauEASRepresentation') {
|
|
64
64
|
const v_error = (() => {
|
|
65
65
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
66
66
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -78,82 +78,82 @@ function validate$1(obj, path = 'TableauEASRepresentation') {
|
|
|
78
78
|
})();
|
|
79
79
|
return v_error === undefined ? null : v_error;
|
|
80
80
|
}
|
|
81
|
-
const RepresentationType$
|
|
82
|
-
function normalize$
|
|
81
|
+
const RepresentationType$2 = 'TableauEASRepresentation';
|
|
82
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
83
83
|
return input;
|
|
84
84
|
}
|
|
85
|
-
const select$
|
|
85
|
+
const select$5 = function TableauEASRepresentationSelect() {
|
|
86
86
|
return {
|
|
87
87
|
kind: 'Fragment',
|
|
88
|
-
version: VERSION$
|
|
88
|
+
version: VERSION$2,
|
|
89
89
|
private: [],
|
|
90
90
|
opaque: true
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
function equals$
|
|
93
|
+
function equals$2(existing, incoming) {
|
|
94
94
|
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
97
|
return true;
|
|
98
98
|
}
|
|
99
|
-
const ingest$
|
|
99
|
+
const ingest$2 = function TableauEASRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
100
100
|
if (process.env.NODE_ENV !== 'production') {
|
|
101
|
-
const validateError = validate$
|
|
101
|
+
const validateError = validate$2(input);
|
|
102
102
|
if (validateError !== null) {
|
|
103
103
|
throw validateError;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
const key = path.fullPath;
|
|
107
107
|
const existingRecord = store.readEntry(key);
|
|
108
|
-
const ttlToUse = TTL$
|
|
109
|
-
let incomingRecord = normalize$
|
|
108
|
+
const ttlToUse = TTL$2;
|
|
109
|
+
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
110
110
|
fullPath: key,
|
|
111
111
|
parent: path.parent,
|
|
112
112
|
propertyName: path.propertyName,
|
|
113
113
|
ttl: ttlToUse
|
|
114
114
|
});
|
|
115
|
-
if (existingRecord === undefined || equals$
|
|
115
|
+
if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
|
|
116
116
|
luvio.storePublish(key, incomingRecord);
|
|
117
117
|
}
|
|
118
118
|
{
|
|
119
119
|
const storeMetadataParams = {
|
|
120
120
|
ttl: ttlToUse,
|
|
121
121
|
namespace: "TableauEmbedding",
|
|
122
|
-
version: VERSION$
|
|
123
|
-
representationName: RepresentationType$
|
|
122
|
+
version: VERSION$2,
|
|
123
|
+
representationName: RepresentationType$2,
|
|
124
124
|
};
|
|
125
125
|
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
126
126
|
}
|
|
127
127
|
return createLink(key);
|
|
128
128
|
};
|
|
129
|
-
function getTypeCacheKeys$
|
|
129
|
+
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
130
130
|
const rootKeySet = new StoreKeyMap();
|
|
131
131
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
132
132
|
const rootKey = fullPathFactory();
|
|
133
133
|
rootKeySet.set(rootKey, {
|
|
134
134
|
namespace: keyPrefix,
|
|
135
|
-
representationName: RepresentationType$
|
|
135
|
+
representationName: RepresentationType$2,
|
|
136
136
|
mergeable: false
|
|
137
137
|
});
|
|
138
138
|
return rootKeySet;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
function select$
|
|
142
|
-
return select$
|
|
141
|
+
function select$4(luvio, params) {
|
|
142
|
+
return select$5();
|
|
143
143
|
}
|
|
144
|
-
function keyBuilder$
|
|
144
|
+
function keyBuilder$4(luvio, params) {
|
|
145
145
|
return keyPrefix + '::TableauEASRepresentation:(' + ')';
|
|
146
146
|
}
|
|
147
147
|
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
148
|
-
return getTypeCacheKeys$
|
|
148
|
+
return getTypeCacheKeys$2(luvio, response, () => keyBuilder$4());
|
|
149
149
|
}
|
|
150
150
|
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
151
151
|
const { body } = response;
|
|
152
|
-
const key = keyBuilder$
|
|
153
|
-
luvio.storeIngest(key, ingest$
|
|
152
|
+
const key = keyBuilder$4();
|
|
153
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
154
154
|
const snapshot = luvio.storeLookup({
|
|
155
155
|
recordId: key,
|
|
156
|
-
node: select$
|
|
156
|
+
node: select$4(),
|
|
157
157
|
variables: {},
|
|
158
158
|
}, snapshotRefresh);
|
|
159
159
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -164,14 +164,14 @@ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
164
164
|
deepFreeze(snapshot.data);
|
|
165
165
|
return snapshot;
|
|
166
166
|
}
|
|
167
|
-
function ingestError$
|
|
168
|
-
const key = keyBuilder$
|
|
167
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
168
|
+
const key = keyBuilder$4();
|
|
169
169
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
170
170
|
const storeMetadataParams = {
|
|
171
|
-
ttl: TTL$
|
|
171
|
+
ttl: TTL$2,
|
|
172
172
|
namespace: keyPrefix,
|
|
173
|
-
version: VERSION$
|
|
174
|
-
representationName: RepresentationType$
|
|
173
|
+
version: VERSION$2,
|
|
174
|
+
representationName: RepresentationType$2
|
|
175
175
|
};
|
|
176
176
|
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
177
177
|
return errorSnapshot;
|
|
@@ -201,8 +201,8 @@ function createResourceParams$2(config) {
|
|
|
201
201
|
const resourceParams = {};
|
|
202
202
|
return resourceParams;
|
|
203
203
|
}
|
|
204
|
-
function keyBuilder$
|
|
205
|
-
return keyBuilder$
|
|
204
|
+
function keyBuilder$3(luvio, config) {
|
|
205
|
+
return keyBuilder$4();
|
|
206
206
|
}
|
|
207
207
|
function typeCheckConfig$2(untrustedConfig) {
|
|
208
208
|
const config = {};
|
|
@@ -221,18 +221,18 @@ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
|
221
221
|
}
|
|
222
222
|
return config;
|
|
223
223
|
}
|
|
224
|
-
function adapterFragment$
|
|
225
|
-
return select$
|
|
224
|
+
function adapterFragment$1(luvio, config) {
|
|
225
|
+
return select$4();
|
|
226
226
|
}
|
|
227
|
-
function onFetchResponseSuccess$
|
|
227
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
228
228
|
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
229
229
|
config,
|
|
230
230
|
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
231
231
|
});
|
|
232
232
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
233
233
|
}
|
|
234
|
-
function onFetchResponseError$
|
|
235
|
-
const snapshot = ingestError$
|
|
234
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
235
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
236
236
|
config,
|
|
237
237
|
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
238
238
|
});
|
|
@@ -243,12 +243,12 @@ function buildNetworkSnapshot$2(luvio, config, options) {
|
|
|
243
243
|
const request = createResourceRequest$2();
|
|
244
244
|
return luvio.dispatchResourceRequest(request, options)
|
|
245
245
|
.then((response) => {
|
|
246
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$
|
|
246
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
247
247
|
}, (response) => {
|
|
248
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$
|
|
248
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
function buildNetworkSnapshotCachePolicy$
|
|
251
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
252
252
|
const { luvio, config } = context;
|
|
253
253
|
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
254
254
|
const dispatchOptions = {
|
|
@@ -265,11 +265,11 @@ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext
|
|
|
265
265
|
}
|
|
266
266
|
return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
|
|
267
267
|
}
|
|
268
|
-
function buildCachedSnapshotCachePolicy$
|
|
268
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
269
269
|
const { luvio, config } = context;
|
|
270
270
|
const selector = {
|
|
271
|
-
recordId: keyBuilder$
|
|
272
|
-
node: adapterFragment$
|
|
271
|
+
recordId: keyBuilder$3(),
|
|
272
|
+
node: adapterFragment$1(),
|
|
273
273
|
variables: {},
|
|
274
274
|
};
|
|
275
275
|
const cacheSnapshot = storeLookup(selector, {
|
|
@@ -285,16 +285,36 @@ const getEASAdapterFactory = (luvio) => function TableauEmbedding__getEAS(untrus
|
|
|
285
285
|
return null;
|
|
286
286
|
}
|
|
287
287
|
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
288
|
-
buildCachedSnapshotCachePolicy$
|
|
288
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
-
const TTL = 100;
|
|
292
|
-
const VERSION = "
|
|
293
|
-
function validate(obj, path = 'TableauJWTRepresentation') {
|
|
291
|
+
const TTL$1 = 100;
|
|
292
|
+
const VERSION$1 = "4d102ac5faa986113597892e5baa1d1f";
|
|
293
|
+
function validate$1(obj, path = 'TableauJWTRepresentation') {
|
|
294
294
|
const v_error = (() => {
|
|
295
295
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
296
296
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
297
297
|
}
|
|
298
|
+
const obj_cb = obj.cb;
|
|
299
|
+
const path_cb = path + '.cb';
|
|
300
|
+
if (typeof obj_cb !== 'string') {
|
|
301
|
+
return new TypeError('Expected "string" but received "' + typeof obj_cb + '" (at "' + path_cb + '")');
|
|
302
|
+
}
|
|
303
|
+
const obj_jti = obj.jti;
|
|
304
|
+
const path_jti = path + '.jti';
|
|
305
|
+
if (typeof obj_jti !== 'string') {
|
|
306
|
+
return new TypeError('Expected "string" but received "' + typeof obj_jti + '" (at "' + path_jti + '")');
|
|
307
|
+
}
|
|
308
|
+
const obj_siteId = obj.siteId;
|
|
309
|
+
const path_siteId = path + '.siteId';
|
|
310
|
+
if (typeof obj_siteId !== 'string') {
|
|
311
|
+
return new TypeError('Expected "string" but received "' + typeof obj_siteId + '" (at "' + path_siteId + '")');
|
|
312
|
+
}
|
|
313
|
+
const obj_tabUrl = obj.tabUrl;
|
|
314
|
+
const path_tabUrl = path + '.tabUrl';
|
|
315
|
+
if (typeof obj_tabUrl !== 'string') {
|
|
316
|
+
return new TypeError('Expected "string" but received "' + typeof obj_tabUrl + '" (at "' + path_tabUrl + '")');
|
|
317
|
+
}
|
|
298
318
|
const obj_token = obj.token;
|
|
299
319
|
const path_token = path + '.token';
|
|
300
320
|
if (typeof obj_token !== 'string') {
|
|
@@ -303,82 +323,82 @@ function validate(obj, path = 'TableauJWTRepresentation') {
|
|
|
303
323
|
})();
|
|
304
324
|
return v_error === undefined ? null : v_error;
|
|
305
325
|
}
|
|
306
|
-
const RepresentationType = 'TableauJWTRepresentation';
|
|
307
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
326
|
+
const RepresentationType$1 = 'TableauJWTRepresentation';
|
|
327
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
308
328
|
return input;
|
|
309
329
|
}
|
|
310
|
-
const select$
|
|
330
|
+
const select$3 = function TableauJWTRepresentationSelect() {
|
|
311
331
|
return {
|
|
312
332
|
kind: 'Fragment',
|
|
313
|
-
version: VERSION,
|
|
333
|
+
version: VERSION$1,
|
|
314
334
|
private: [],
|
|
315
335
|
opaque: true
|
|
316
336
|
};
|
|
317
337
|
};
|
|
318
|
-
function equals(existing, incoming) {
|
|
338
|
+
function equals$1(existing, incoming) {
|
|
319
339
|
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
320
340
|
return false;
|
|
321
341
|
}
|
|
322
342
|
return true;
|
|
323
343
|
}
|
|
324
|
-
const ingest = function TableauJWTRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
344
|
+
const ingest$1 = function TableauJWTRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
325
345
|
if (process.env.NODE_ENV !== 'production') {
|
|
326
|
-
const validateError = validate(input);
|
|
346
|
+
const validateError = validate$1(input);
|
|
327
347
|
if (validateError !== null) {
|
|
328
348
|
throw validateError;
|
|
329
349
|
}
|
|
330
350
|
}
|
|
331
351
|
const key = path.fullPath;
|
|
332
352
|
const existingRecord = store.readEntry(key);
|
|
333
|
-
const ttlToUse = TTL;
|
|
334
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
353
|
+
const ttlToUse = TTL$1;
|
|
354
|
+
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
335
355
|
fullPath: key,
|
|
336
356
|
parent: path.parent,
|
|
337
357
|
propertyName: path.propertyName,
|
|
338
358
|
ttl: ttlToUse
|
|
339
359
|
});
|
|
340
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
360
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
341
361
|
luvio.storePublish(key, incomingRecord);
|
|
342
362
|
}
|
|
343
363
|
{
|
|
344
364
|
const storeMetadataParams = {
|
|
345
365
|
ttl: ttlToUse,
|
|
346
366
|
namespace: "TableauEmbedding",
|
|
347
|
-
version: VERSION,
|
|
348
|
-
representationName: RepresentationType,
|
|
367
|
+
version: VERSION$1,
|
|
368
|
+
representationName: RepresentationType$1,
|
|
349
369
|
};
|
|
350
370
|
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
351
371
|
}
|
|
352
372
|
return createLink(key);
|
|
353
373
|
};
|
|
354
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
374
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
355
375
|
const rootKeySet = new StoreKeyMap();
|
|
356
376
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
357
377
|
const rootKey = fullPathFactory();
|
|
358
378
|
rootKeySet.set(rootKey, {
|
|
359
379
|
namespace: keyPrefix,
|
|
360
|
-
representationName: RepresentationType,
|
|
380
|
+
representationName: RepresentationType$1,
|
|
361
381
|
mergeable: false
|
|
362
382
|
});
|
|
363
383
|
return rootKeySet;
|
|
364
384
|
}
|
|
365
385
|
|
|
366
|
-
function select$
|
|
367
|
-
return select$
|
|
386
|
+
function select$2(luvio, params) {
|
|
387
|
+
return select$3();
|
|
368
388
|
}
|
|
369
|
-
function keyBuilder$
|
|
370
|
-
return keyPrefix + '::TableauJWTRepresentation:(' + 'siteId:' + params.queryParams.siteId + ',' + 'tabUrl:' + params.queryParams.tabUrl + ')';
|
|
389
|
+
function keyBuilder$2(luvio, params) {
|
|
390
|
+
return keyPrefix + '::TableauJWTRepresentation:(' + 'cb:' + params.queryParams.cb + ',' + 'siteId:' + params.queryParams.siteId + ',' + 'tabUrl:' + params.queryParams.tabUrl + ')';
|
|
371
391
|
}
|
|
372
392
|
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
373
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$
|
|
393
|
+
return getTypeCacheKeys$1(luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
374
394
|
}
|
|
375
395
|
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
376
396
|
const { body } = response;
|
|
377
|
-
const key = keyBuilder$
|
|
378
|
-
luvio.storeIngest(key, ingest, body);
|
|
397
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
398
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
379
399
|
const snapshot = luvio.storeLookup({
|
|
380
400
|
recordId: key,
|
|
381
|
-
node: select$
|
|
401
|
+
node: select$2(),
|
|
382
402
|
variables: {},
|
|
383
403
|
}, snapshotRefresh);
|
|
384
404
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -389,14 +409,14 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
389
409
|
deepFreeze(snapshot.data);
|
|
390
410
|
return snapshot;
|
|
391
411
|
}
|
|
392
|
-
function ingestError
|
|
393
|
-
const key = keyBuilder$
|
|
412
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
413
|
+
const key = keyBuilder$2(luvio, params);
|
|
394
414
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
395
415
|
const storeMetadataParams = {
|
|
396
|
-
ttl: TTL,
|
|
416
|
+
ttl: TTL$1,
|
|
397
417
|
namespace: keyPrefix,
|
|
398
|
-
version: VERSION,
|
|
399
|
-
representationName: RepresentationType
|
|
418
|
+
version: VERSION$1,
|
|
419
|
+
representationName: RepresentationType$1
|
|
400
420
|
};
|
|
401
421
|
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
402
422
|
return errorSnapshot;
|
|
@@ -419,23 +439,27 @@ const getJWT_ConfigPropertyNames = {
|
|
|
419
439
|
displayName: 'getJWT',
|
|
420
440
|
parameters: {
|
|
421
441
|
required: [],
|
|
422
|
-
optional: ['siteId', 'tabUrl']
|
|
442
|
+
optional: ['cb', 'siteId', 'tabUrl']
|
|
423
443
|
}
|
|
424
444
|
};
|
|
425
445
|
function createResourceParams$1(config) {
|
|
426
446
|
const resourceParams = {
|
|
427
447
|
queryParams: {
|
|
428
|
-
siteId: config.siteId, tabUrl: config.tabUrl
|
|
448
|
+
cb: config.cb, siteId: config.siteId, tabUrl: config.tabUrl
|
|
429
449
|
}
|
|
430
450
|
};
|
|
431
451
|
return resourceParams;
|
|
432
452
|
}
|
|
433
|
-
function keyBuilder$
|
|
453
|
+
function keyBuilder$1(luvio, config) {
|
|
434
454
|
const resourceParams = createResourceParams$1(config);
|
|
435
|
-
return keyBuilder$
|
|
455
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
436
456
|
}
|
|
437
457
|
function typeCheckConfig$1(untrustedConfig) {
|
|
438
458
|
const config = {};
|
|
459
|
+
const untrustedConfig_cb = untrustedConfig.cb;
|
|
460
|
+
if (typeof untrustedConfig_cb === 'string') {
|
|
461
|
+
config.cb = untrustedConfig_cb;
|
|
462
|
+
}
|
|
439
463
|
const untrustedConfig_siteId = untrustedConfig.siteId;
|
|
440
464
|
if (typeof untrustedConfig_siteId === 'string') {
|
|
441
465
|
config.siteId = untrustedConfig_siteId;
|
|
@@ -459,19 +483,19 @@ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
|
459
483
|
}
|
|
460
484
|
return config;
|
|
461
485
|
}
|
|
462
|
-
function adapterFragment
|
|
486
|
+
function adapterFragment(luvio, config) {
|
|
463
487
|
createResourceParams$1(config);
|
|
464
|
-
return select$
|
|
488
|
+
return select$2();
|
|
465
489
|
}
|
|
466
|
-
function onFetchResponseSuccess
|
|
490
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
467
491
|
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
468
492
|
config,
|
|
469
493
|
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
470
494
|
});
|
|
471
495
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
472
496
|
}
|
|
473
|
-
function onFetchResponseError
|
|
474
|
-
const snapshot = ingestError
|
|
497
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
498
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
475
499
|
config,
|
|
476
500
|
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
477
501
|
});
|
|
@@ -482,12 +506,12 @@ function buildNetworkSnapshot$1(luvio, config, options) {
|
|
|
482
506
|
const request = createResourceRequest$1(resourceParams);
|
|
483
507
|
return luvio.dispatchResourceRequest(request, options)
|
|
484
508
|
.then((response) => {
|
|
485
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess
|
|
509
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
486
510
|
}, (response) => {
|
|
487
|
-
return luvio.handleErrorResponse(() => onFetchResponseError
|
|
511
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
488
512
|
});
|
|
489
513
|
}
|
|
490
|
-
function buildNetworkSnapshotCachePolicy
|
|
514
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
491
515
|
const { luvio, config } = context;
|
|
492
516
|
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
493
517
|
const dispatchOptions = {
|
|
@@ -504,11 +528,11 @@ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext
|
|
|
504
528
|
}
|
|
505
529
|
return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
|
|
506
530
|
}
|
|
507
|
-
function buildCachedSnapshotCachePolicy
|
|
531
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
508
532
|
const { luvio, config } = context;
|
|
509
533
|
const selector = {
|
|
510
|
-
recordId: keyBuilder$
|
|
511
|
-
node: adapterFragment
|
|
534
|
+
recordId: keyBuilder$1(luvio, config),
|
|
535
|
+
node: adapterFragment(luvio, config),
|
|
512
536
|
variables: {},
|
|
513
537
|
};
|
|
514
538
|
const cacheSnapshot = storeLookup(selector, {
|
|
@@ -523,7 +547,7 @@ const defaultCacheFactory = {
|
|
|
523
547
|
type: 'no-cache',
|
|
524
548
|
},
|
|
525
549
|
};
|
|
526
|
-
// This implementation is based on the generated one from
|
|
550
|
+
// EUREKA: This implementation is based on the generated one from packages/lds-adapters-analytics-tableau-embedding/src/generated/adapters/getJWT.ts.
|
|
527
551
|
// However, we force a `no-cache` policy here in order to avoid the various runtimes where LDS is implemented making the wrong choice for this API.
|
|
528
552
|
//
|
|
529
553
|
// You can make sure this is included in the build by checking the contents of:
|
|
@@ -536,27 +560,128 @@ const getJWTAdapterFactory = (luvio) => function TableauEmbedding__getJWT(untrus
|
|
|
536
560
|
}
|
|
537
561
|
const ctx = { ...requestContext, ...defaultCacheFactory }; // override any runtime decisions w/ our desired policy
|
|
538
562
|
return luvio.applyCachePolicy(ctx, { config, luvio }, // BuildSnapshotContext
|
|
539
|
-
buildCachedSnapshotCachePolicy
|
|
563
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
540
564
|
};
|
|
541
565
|
|
|
542
|
-
|
|
543
|
-
|
|
566
|
+
const TTL = 100;
|
|
567
|
+
const VERSION = "88a8d9029774893417ad347424a8729c";
|
|
568
|
+
function validate(obj, path = 'TableauJWTRepresentation2') {
|
|
569
|
+
const v_error = (() => {
|
|
570
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
571
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
572
|
+
}
|
|
573
|
+
const obj_cb = obj.cb;
|
|
574
|
+
const path_cb = path + '.cb';
|
|
575
|
+
if (typeof obj_cb !== 'string') {
|
|
576
|
+
return new TypeError('Expected "string" but received "' + typeof obj_cb + '" (at "' + path_cb + '")');
|
|
577
|
+
}
|
|
578
|
+
const obj_jti = obj.jti;
|
|
579
|
+
const path_jti = path + '.jti';
|
|
580
|
+
if (typeof obj_jti !== 'string') {
|
|
581
|
+
return new TypeError('Expected "string" but received "' + typeof obj_jti + '" (at "' + path_jti + '")');
|
|
582
|
+
}
|
|
583
|
+
const obj_siteId = obj.siteId;
|
|
584
|
+
const path_siteId = path + '.siteId';
|
|
585
|
+
if (typeof obj_siteId !== 'string') {
|
|
586
|
+
return new TypeError('Expected "string" but received "' + typeof obj_siteId + '" (at "' + path_siteId + '")');
|
|
587
|
+
}
|
|
588
|
+
const obj_tabUrl = obj.tabUrl;
|
|
589
|
+
const path_tabUrl = path + '.tabUrl';
|
|
590
|
+
if (typeof obj_tabUrl !== 'string') {
|
|
591
|
+
return new TypeError('Expected "string" but received "' + typeof obj_tabUrl + '" (at "' + path_tabUrl + '")');
|
|
592
|
+
}
|
|
593
|
+
const obj_token = obj.token;
|
|
594
|
+
const path_token = path + '.token';
|
|
595
|
+
if (typeof obj_token !== 'string') {
|
|
596
|
+
return new TypeError('Expected "string" but received "' + typeof obj_token + '" (at "' + path_token + '")');
|
|
597
|
+
}
|
|
598
|
+
})();
|
|
599
|
+
return v_error === undefined ? null : v_error;
|
|
600
|
+
}
|
|
601
|
+
const RepresentationType = 'TableauJWTRepresentation2';
|
|
602
|
+
function keyBuilder(luvio, config) {
|
|
603
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
604
|
+
}
|
|
605
|
+
function keyBuilderFromType(luvio, object) {
|
|
606
|
+
const keyParams = {
|
|
607
|
+
id: object.jti
|
|
608
|
+
};
|
|
609
|
+
return keyBuilder(luvio, keyParams);
|
|
544
610
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
611
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
612
|
+
return input;
|
|
613
|
+
}
|
|
614
|
+
const select$1 = function TableauJWTRepresentation2Select() {
|
|
615
|
+
return {
|
|
616
|
+
kind: 'Fragment',
|
|
617
|
+
version: VERSION,
|
|
618
|
+
private: [],
|
|
619
|
+
opaque: true
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
function equals(existing, incoming) {
|
|
623
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
const ingest = function TableauJWTRepresentation2Ingest(input, path, luvio, store, timestamp) {
|
|
629
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
630
|
+
const validateError = validate(input);
|
|
631
|
+
if (validateError !== null) {
|
|
632
|
+
throw validateError;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
const key = keyBuilderFromType(luvio, input);
|
|
636
|
+
const existingRecord = store.readEntry(key);
|
|
637
|
+
const ttlToUse = TTL;
|
|
638
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
639
|
+
fullPath: key,
|
|
640
|
+
parent: path.parent,
|
|
641
|
+
propertyName: path.propertyName,
|
|
642
|
+
ttl: ttlToUse
|
|
643
|
+
});
|
|
644
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
645
|
+
luvio.storePublish(key, incomingRecord);
|
|
646
|
+
}
|
|
647
|
+
{
|
|
648
|
+
const storeMetadataParams = {
|
|
649
|
+
ttl: ttlToUse,
|
|
650
|
+
namespace: "TableauEmbedding",
|
|
651
|
+
version: VERSION,
|
|
652
|
+
representationName: RepresentationType,
|
|
653
|
+
};
|
|
654
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
655
|
+
}
|
|
656
|
+
return createLink(key);
|
|
657
|
+
};
|
|
658
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
659
|
+
const rootKeySet = new StoreKeyMap();
|
|
660
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
661
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
662
|
+
rootKeySet.set(rootKey, {
|
|
663
|
+
namespace: keyPrefix,
|
|
664
|
+
representationName: RepresentationType,
|
|
665
|
+
mergeable: false
|
|
666
|
+
});
|
|
667
|
+
return rootKeySet;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function select(luvio, params) {
|
|
671
|
+
return select$1();
|
|
547
672
|
}
|
|
548
673
|
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
549
|
-
return getTypeCacheKeys(luvio, response
|
|
674
|
+
return getTypeCacheKeys(luvio, response);
|
|
550
675
|
}
|
|
551
|
-
function ingestSuccess(luvio, resourceParams, response
|
|
676
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
552
677
|
const { body } = response;
|
|
553
|
-
const key =
|
|
678
|
+
const key = keyBuilderFromType(luvio, body);
|
|
554
679
|
luvio.storeIngest(key, ingest, body);
|
|
555
680
|
const snapshot = luvio.storeLookup({
|
|
556
681
|
recordId: key,
|
|
557
682
|
node: select(),
|
|
558
683
|
variables: {},
|
|
559
|
-
}
|
|
684
|
+
});
|
|
560
685
|
if (process.env.NODE_ENV !== 'production') {
|
|
561
686
|
if (snapshot.state !== 'Fulfilled') {
|
|
562
687
|
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
@@ -565,18 +690,6 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
565
690
|
deepFreeze(snapshot.data);
|
|
566
691
|
return snapshot;
|
|
567
692
|
}
|
|
568
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
569
|
-
const key = keyBuilder$1(luvio, params);
|
|
570
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
571
|
-
const storeMetadataParams = {
|
|
572
|
-
ttl: TTL,
|
|
573
|
-
namespace: keyPrefix,
|
|
574
|
-
version: VERSION,
|
|
575
|
-
representationName: RepresentationType
|
|
576
|
-
};
|
|
577
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
578
|
-
return errorSnapshot;
|
|
579
|
-
}
|
|
580
693
|
function createResourceRequest(config) {
|
|
581
694
|
const headers = {};
|
|
582
695
|
return {
|
|
@@ -595,13 +708,16 @@ const postJWT_ConfigPropertyNames = {
|
|
|
595
708
|
displayName: 'postJWT',
|
|
596
709
|
parameters: {
|
|
597
710
|
required: [],
|
|
598
|
-
optional: ['siteId', 'tabUrl']
|
|
711
|
+
optional: ['cb', 'siteId', 'tabUrl']
|
|
599
712
|
}
|
|
600
713
|
};
|
|
601
714
|
function createResourceParams(config) {
|
|
602
715
|
const resourceParams = {
|
|
603
716
|
body: {}
|
|
604
717
|
};
|
|
718
|
+
if (config['cb'] !== undefined) {
|
|
719
|
+
resourceParams.body['cb'] = config['cb'];
|
|
720
|
+
}
|
|
605
721
|
if (config['siteId'] !== undefined) {
|
|
606
722
|
resourceParams.body['siteId'] = config['siteId'];
|
|
607
723
|
}
|
|
@@ -610,12 +726,12 @@ function createResourceParams(config) {
|
|
|
610
726
|
}
|
|
611
727
|
return resourceParams;
|
|
612
728
|
}
|
|
613
|
-
function keyBuilder(luvio, config) {
|
|
614
|
-
const resourceParams = createResourceParams(config);
|
|
615
|
-
return keyBuilder$1(luvio, resourceParams);
|
|
616
|
-
}
|
|
617
729
|
function typeCheckConfig(untrustedConfig) {
|
|
618
730
|
const config = {};
|
|
731
|
+
const untrustedConfig_cb = untrustedConfig.cb;
|
|
732
|
+
if (typeof untrustedConfig_cb === 'string') {
|
|
733
|
+
config.cb = untrustedConfig_cb;
|
|
734
|
+
}
|
|
619
735
|
const untrustedConfig_siteId = untrustedConfig.siteId;
|
|
620
736
|
if (typeof untrustedConfig_siteId === 'string') {
|
|
621
737
|
config.siteId = untrustedConfig_siteId;
|
|
@@ -639,72 +755,29 @@ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
|
639
755
|
}
|
|
640
756
|
return config;
|
|
641
757
|
}
|
|
642
|
-
function adapterFragment(luvio, config) {
|
|
643
|
-
createResourceParams(config);
|
|
644
|
-
return select();
|
|
645
|
-
}
|
|
646
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
647
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
648
|
-
config,
|
|
649
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
650
|
-
});
|
|
651
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
652
|
-
}
|
|
653
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
654
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
655
|
-
config,
|
|
656
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
657
|
-
});
|
|
658
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
659
|
-
}
|
|
660
758
|
function buildNetworkSnapshot(luvio, config, options) {
|
|
661
759
|
const resourceParams = createResourceParams(config);
|
|
662
760
|
const request = createResourceRequest(resourceParams);
|
|
663
761
|
return luvio.dispatchResourceRequest(request, options)
|
|
664
762
|
.then((response) => {
|
|
665
|
-
return luvio.handleSuccessResponse(() =>
|
|
763
|
+
return luvio.handleSuccessResponse(() => {
|
|
764
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
765
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
766
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
666
767
|
}, (response) => {
|
|
667
|
-
|
|
768
|
+
deepFreeze(response);
|
|
769
|
+
throw response;
|
|
668
770
|
});
|
|
669
771
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
eventObservers
|
|
679
|
-
};
|
|
680
|
-
if (networkPriority !== 'normal') {
|
|
681
|
-
dispatchOptions.overrides = {
|
|
682
|
-
priority: networkPriority
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
686
|
-
}
|
|
687
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
688
|
-
const { luvio, config } = context;
|
|
689
|
-
const selector = {
|
|
690
|
-
recordId: keyBuilder(luvio, config),
|
|
691
|
-
node: adapterFragment(luvio, config),
|
|
692
|
-
variables: {},
|
|
772
|
+
const postJWTAdapterFactory = (luvio) => {
|
|
773
|
+
return function postJWT(untrustedConfig) {
|
|
774
|
+
const config = validateAdapterConfig(untrustedConfig, postJWT_ConfigPropertyNames);
|
|
775
|
+
// Invalid or incomplete config
|
|
776
|
+
if (config === null) {
|
|
777
|
+
throw new Error('Invalid config for "postJWT"');
|
|
778
|
+
}
|
|
779
|
+
return buildNetworkSnapshot(luvio, config);
|
|
693
780
|
};
|
|
694
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
695
|
-
config,
|
|
696
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
697
|
-
});
|
|
698
|
-
return cacheSnapshot;
|
|
699
|
-
}
|
|
700
|
-
const postJWTAdapterFactory = (luvio) => function TableauEmbedding__postJWT(untrustedConfig, requestContext) {
|
|
701
|
-
const config = validateAdapterConfig(untrustedConfig, postJWT_ConfigPropertyNames);
|
|
702
|
-
// Invalid or incomplete config
|
|
703
|
-
if (config === null) {
|
|
704
|
-
return null;
|
|
705
|
-
}
|
|
706
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
707
|
-
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
708
781
|
};
|
|
709
782
|
|
|
710
783
|
export { getEASAdapterFactory, getJWTAdapterFactory, postJWTAdapterFactory };
|