@salesforce/lds-adapters-analytics-tableau-embedding 1.147.4 → 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/sfdc/index.js CHANGED
@@ -68,9 +68,9 @@ function createLink(ref) {
68
68
  };
69
69
  }
70
70
 
71
- const TTL$1 = 180000;
72
- const VERSION$1 = "97a38409c54dceea0317e696f6166bc4";
73
- function validate$1(obj, path = 'TableauEASRepresentation') {
71
+ const TTL$2 = 180000;
72
+ const VERSION$2 = "97a38409c54dceea0317e696f6166bc4";
73
+ function validate$2(obj, path = 'TableauEASRepresentation') {
74
74
  const v_error = (() => {
75
75
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
76
76
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -88,82 +88,82 @@ function validate$1(obj, path = 'TableauEASRepresentation') {
88
88
  })();
89
89
  return v_error === undefined ? null : v_error;
90
90
  }
91
- const RepresentationType$1 = 'TableauEASRepresentation';
92
- function normalize$1(input, existing, path, luvio, store, timestamp) {
91
+ const RepresentationType$2 = 'TableauEASRepresentation';
92
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
93
93
  return input;
94
94
  }
95
- const select$4 = function TableauEASRepresentationSelect() {
95
+ const select$5 = function TableauEASRepresentationSelect() {
96
96
  return {
97
97
  kind: 'Fragment',
98
- version: VERSION$1,
98
+ version: VERSION$2,
99
99
  private: [],
100
100
  opaque: true
101
101
  };
102
102
  };
103
- function equals$1(existing, incoming) {
103
+ function equals$2(existing, incoming) {
104
104
  if (JSONStringify(incoming) !== JSONStringify(existing)) {
105
105
  return false;
106
106
  }
107
107
  return true;
108
108
  }
109
- const ingest$1 = function TableauEASRepresentationIngest(input, path, luvio, store, timestamp) {
109
+ const ingest$2 = function TableauEASRepresentationIngest(input, path, luvio, store, timestamp) {
110
110
  if (process.env.NODE_ENV !== 'production') {
111
- const validateError = validate$1(input);
111
+ const validateError = validate$2(input);
112
112
  if (validateError !== null) {
113
113
  throw validateError;
114
114
  }
115
115
  }
116
116
  const key = path.fullPath;
117
117
  const existingRecord = store.readEntry(key);
118
- const ttlToUse = TTL$1;
119
- let incomingRecord = normalize$1(input, store.readEntry(key), {
118
+ const ttlToUse = TTL$2;
119
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
120
120
  fullPath: key,
121
121
  parent: path.parent,
122
122
  propertyName: path.propertyName,
123
123
  ttl: ttlToUse
124
124
  });
125
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
125
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
126
126
  luvio.storePublish(key, incomingRecord);
127
127
  }
128
128
  {
129
129
  const storeMetadataParams = {
130
130
  ttl: ttlToUse,
131
131
  namespace: "TableauEmbedding",
132
- version: VERSION$1,
133
- representationName: RepresentationType$1,
132
+ version: VERSION$2,
133
+ representationName: RepresentationType$2,
134
134
  };
135
135
  luvio.publishStoreMetadata(key, storeMetadataParams);
136
136
  }
137
137
  return createLink(key);
138
138
  };
139
- function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
139
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
140
140
  const rootKeySet = new StoreKeyMap();
141
141
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
142
142
  const rootKey = fullPathFactory();
143
143
  rootKeySet.set(rootKey, {
144
144
  namespace: keyPrefix,
145
- representationName: RepresentationType$1,
145
+ representationName: RepresentationType$2,
146
146
  mergeable: false
147
147
  });
148
148
  return rootKeySet;
149
149
  }
150
150
 
151
- function select$3(luvio, params) {
152
- return select$4();
151
+ function select$4(luvio, params) {
152
+ return select$5();
153
153
  }
154
- function keyBuilder$5(luvio, params) {
154
+ function keyBuilder$4(luvio, params) {
155
155
  return keyPrefix + '::TableauEASRepresentation:(' + ')';
156
156
  }
157
157
  function getResponseCacheKeys$2(luvio, resourceParams, response) {
158
- return getTypeCacheKeys$1(luvio, response, () => keyBuilder$5());
158
+ return getTypeCacheKeys$2(luvio, response, () => keyBuilder$4());
159
159
  }
160
160
  function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
161
161
  const { body } = response;
162
- const key = keyBuilder$5();
163
- luvio.storeIngest(key, ingest$1, body);
162
+ const key = keyBuilder$4();
163
+ luvio.storeIngest(key, ingest$2, body);
164
164
  const snapshot = luvio.storeLookup({
165
165
  recordId: key,
166
- node: select$3(),
166
+ node: select$4(),
167
167
  variables: {},
168
168
  }, snapshotRefresh);
169
169
  if (process.env.NODE_ENV !== 'production') {
@@ -174,14 +174,14 @@ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
174
174
  deepFreeze(snapshot.data);
175
175
  return snapshot;
176
176
  }
177
- function ingestError$2(luvio, params, error, snapshotRefresh) {
178
- const key = keyBuilder$5();
177
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
178
+ const key = keyBuilder$4();
179
179
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
180
180
  const storeMetadataParams = {
181
- ttl: TTL$1,
181
+ ttl: TTL$2,
182
182
  namespace: keyPrefix,
183
- version: VERSION$1,
184
- representationName: RepresentationType$1
183
+ version: VERSION$2,
184
+ representationName: RepresentationType$2
185
185
  };
186
186
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
187
187
  return errorSnapshot;
@@ -211,8 +211,8 @@ function createResourceParams$2(config) {
211
211
  const resourceParams = {};
212
212
  return resourceParams;
213
213
  }
214
- function keyBuilder$4(luvio, config) {
215
- return keyBuilder$5();
214
+ function keyBuilder$3(luvio, config) {
215
+ return keyBuilder$4();
216
216
  }
217
217
  function typeCheckConfig$2(untrustedConfig) {
218
218
  const config = {};
@@ -231,18 +231,18 @@ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
231
231
  }
232
232
  return config;
233
233
  }
234
- function adapterFragment$2(luvio, config) {
235
- return select$3();
234
+ function adapterFragment$1(luvio, config) {
235
+ return select$4();
236
236
  }
237
- function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
237
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
238
238
  const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
239
239
  config,
240
240
  resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
241
241
  });
242
242
  return luvio.storeBroadcast().then(() => snapshot);
243
243
  }
244
- function onFetchResponseError$2(luvio, config, resourceParams, response) {
245
- const snapshot = ingestError$2(luvio, resourceParams, response, {
244
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
245
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
246
246
  config,
247
247
  resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
248
248
  });
@@ -253,12 +253,12 @@ function buildNetworkSnapshot$2(luvio, config, options) {
253
253
  const request = createResourceRequest$2();
254
254
  return luvio.dispatchResourceRequest(request, options)
255
255
  .then((response) => {
256
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
256
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
257
257
  }, (response) => {
258
- return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
258
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
259
259
  });
260
260
  }
261
- function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
261
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
262
262
  const { luvio, config } = context;
263
263
  const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
264
264
  const dispatchOptions = {
@@ -275,11 +275,11 @@ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext
275
275
  }
276
276
  return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
277
277
  }
278
- function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
278
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
279
279
  const { luvio, config } = context;
280
280
  const selector = {
281
- recordId: keyBuilder$4(),
282
- node: adapterFragment$2(),
281
+ recordId: keyBuilder$3(),
282
+ node: adapterFragment$1(),
283
283
  variables: {},
284
284
  };
285
285
  const cacheSnapshot = storeLookup(selector, {
@@ -295,16 +295,36 @@ const getEASAdapterFactory = (luvio) => function TableauEmbedding__getEAS(untrus
295
295
  return null;
296
296
  }
297
297
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
298
- buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
298
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
299
299
  };
300
300
 
301
- const TTL = 100;
302
- const VERSION = "53f57df1863a858a8575f7088b4d78cb";
303
- function validate(obj, path = 'TableauJWTRepresentation') {
301
+ const TTL$1 = 100;
302
+ const VERSION$1 = "4d102ac5faa986113597892e5baa1d1f";
303
+ function validate$1(obj, path = 'TableauJWTRepresentation') {
304
304
  const v_error = (() => {
305
305
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
306
306
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
307
307
  }
308
+ const obj_cb = obj.cb;
309
+ const path_cb = path + '.cb';
310
+ if (typeof obj_cb !== 'string') {
311
+ return new TypeError('Expected "string" but received "' + typeof obj_cb + '" (at "' + path_cb + '")');
312
+ }
313
+ const obj_jti = obj.jti;
314
+ const path_jti = path + '.jti';
315
+ if (typeof obj_jti !== 'string') {
316
+ return new TypeError('Expected "string" but received "' + typeof obj_jti + '" (at "' + path_jti + '")');
317
+ }
318
+ const obj_siteId = obj.siteId;
319
+ const path_siteId = path + '.siteId';
320
+ if (typeof obj_siteId !== 'string') {
321
+ return new TypeError('Expected "string" but received "' + typeof obj_siteId + '" (at "' + path_siteId + '")');
322
+ }
323
+ const obj_tabUrl = obj.tabUrl;
324
+ const path_tabUrl = path + '.tabUrl';
325
+ if (typeof obj_tabUrl !== 'string') {
326
+ return new TypeError('Expected "string" but received "' + typeof obj_tabUrl + '" (at "' + path_tabUrl + '")');
327
+ }
308
328
  const obj_token = obj.token;
309
329
  const path_token = path + '.token';
310
330
  if (typeof obj_token !== 'string') {
@@ -313,82 +333,82 @@ function validate(obj, path = 'TableauJWTRepresentation') {
313
333
  })();
314
334
  return v_error === undefined ? null : v_error;
315
335
  }
316
- const RepresentationType = 'TableauJWTRepresentation';
317
- function normalize(input, existing, path, luvio, store, timestamp) {
336
+ const RepresentationType$1 = 'TableauJWTRepresentation';
337
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
318
338
  return input;
319
339
  }
320
- const select$2 = function TableauJWTRepresentationSelect() {
340
+ const select$3 = function TableauJWTRepresentationSelect() {
321
341
  return {
322
342
  kind: 'Fragment',
323
- version: VERSION,
343
+ version: VERSION$1,
324
344
  private: [],
325
345
  opaque: true
326
346
  };
327
347
  };
328
- function equals(existing, incoming) {
348
+ function equals$1(existing, incoming) {
329
349
  if (JSONStringify(incoming) !== JSONStringify(existing)) {
330
350
  return false;
331
351
  }
332
352
  return true;
333
353
  }
334
- const ingest = function TableauJWTRepresentationIngest(input, path, luvio, store, timestamp) {
354
+ const ingest$1 = function TableauJWTRepresentationIngest(input, path, luvio, store, timestamp) {
335
355
  if (process.env.NODE_ENV !== 'production') {
336
- const validateError = validate(input);
356
+ const validateError = validate$1(input);
337
357
  if (validateError !== null) {
338
358
  throw validateError;
339
359
  }
340
360
  }
341
361
  const key = path.fullPath;
342
362
  const existingRecord = store.readEntry(key);
343
- const ttlToUse = TTL;
344
- let incomingRecord = normalize(input, store.readEntry(key), {
363
+ const ttlToUse = TTL$1;
364
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
345
365
  fullPath: key,
346
366
  parent: path.parent,
347
367
  propertyName: path.propertyName,
348
368
  ttl: ttlToUse
349
369
  });
350
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
370
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
351
371
  luvio.storePublish(key, incomingRecord);
352
372
  }
353
373
  {
354
374
  const storeMetadataParams = {
355
375
  ttl: ttlToUse,
356
376
  namespace: "TableauEmbedding",
357
- version: VERSION,
358
- representationName: RepresentationType,
377
+ version: VERSION$1,
378
+ representationName: RepresentationType$1,
359
379
  };
360
380
  luvio.publishStoreMetadata(key, storeMetadataParams);
361
381
  }
362
382
  return createLink(key);
363
383
  };
364
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
384
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
365
385
  const rootKeySet = new StoreKeyMap();
366
386
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
367
387
  const rootKey = fullPathFactory();
368
388
  rootKeySet.set(rootKey, {
369
389
  namespace: keyPrefix,
370
- representationName: RepresentationType,
390
+ representationName: RepresentationType$1,
371
391
  mergeable: false
372
392
  });
373
393
  return rootKeySet;
374
394
  }
375
395
 
376
- function select$1(luvio, params) {
377
- return select$2();
396
+ function select$2(luvio, params) {
397
+ return select$3();
378
398
  }
379
- function keyBuilder$3(luvio, params) {
380
- return keyPrefix + '::TableauJWTRepresentation:(' + 'siteId:' + params.queryParams.siteId + ',' + 'tabUrl:' + params.queryParams.tabUrl + ')';
399
+ function keyBuilder$2(luvio, params) {
400
+ return keyPrefix + '::TableauJWTRepresentation:(' + 'cb:' + params.queryParams.cb + ',' + 'siteId:' + params.queryParams.siteId + ',' + 'tabUrl:' + params.queryParams.tabUrl + ')';
381
401
  }
382
402
  function getResponseCacheKeys$1(luvio, resourceParams, response) {
383
- return getTypeCacheKeys(luvio, response, () => keyBuilder$3(luvio, resourceParams));
403
+ return getTypeCacheKeys$1(luvio, response, () => keyBuilder$2(luvio, resourceParams));
384
404
  }
385
405
  function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
386
406
  const { body } = response;
387
- const key = keyBuilder$3(luvio, resourceParams);
388
- luvio.storeIngest(key, ingest, body);
407
+ const key = keyBuilder$2(luvio, resourceParams);
408
+ luvio.storeIngest(key, ingest$1, body);
389
409
  const snapshot = luvio.storeLookup({
390
410
  recordId: key,
391
- node: select$1(),
411
+ node: select$2(),
392
412
  variables: {},
393
413
  }, snapshotRefresh);
394
414
  if (process.env.NODE_ENV !== 'production') {
@@ -399,14 +419,14 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
399
419
  deepFreeze(snapshot.data);
400
420
  return snapshot;
401
421
  }
402
- function ingestError$1(luvio, params, error, snapshotRefresh) {
403
- const key = keyBuilder$3(luvio, params);
422
+ function ingestError(luvio, params, error, snapshotRefresh) {
423
+ const key = keyBuilder$2(luvio, params);
404
424
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
405
425
  const storeMetadataParams = {
406
- ttl: TTL,
426
+ ttl: TTL$1,
407
427
  namespace: keyPrefix,
408
- version: VERSION,
409
- representationName: RepresentationType
428
+ version: VERSION$1,
429
+ representationName: RepresentationType$1
410
430
  };
411
431
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
412
432
  return errorSnapshot;
@@ -429,23 +449,27 @@ const getJWT_ConfigPropertyNames = {
429
449
  displayName: 'getJWT',
430
450
  parameters: {
431
451
  required: [],
432
- optional: ['siteId', 'tabUrl']
452
+ optional: ['cb', 'siteId', 'tabUrl']
433
453
  }
434
454
  };
435
455
  function createResourceParams$1(config) {
436
456
  const resourceParams = {
437
457
  queryParams: {
438
- siteId: config.siteId, tabUrl: config.tabUrl
458
+ cb: config.cb, siteId: config.siteId, tabUrl: config.tabUrl
439
459
  }
440
460
  };
441
461
  return resourceParams;
442
462
  }
443
- function keyBuilder$2(luvio, config) {
463
+ function keyBuilder$1(luvio, config) {
444
464
  const resourceParams = createResourceParams$1(config);
445
- return keyBuilder$3(luvio, resourceParams);
465
+ return keyBuilder$2(luvio, resourceParams);
446
466
  }
447
467
  function typeCheckConfig$1(untrustedConfig) {
448
468
  const config = {};
469
+ const untrustedConfig_cb = untrustedConfig.cb;
470
+ if (typeof untrustedConfig_cb === 'string') {
471
+ config.cb = untrustedConfig_cb;
472
+ }
449
473
  const untrustedConfig_siteId = untrustedConfig.siteId;
450
474
  if (typeof untrustedConfig_siteId === 'string') {
451
475
  config.siteId = untrustedConfig_siteId;
@@ -469,19 +493,19 @@ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
469
493
  }
470
494
  return config;
471
495
  }
472
- function adapterFragment$1(luvio, config) {
496
+ function adapterFragment(luvio, config) {
473
497
  createResourceParams$1(config);
474
- return select$1();
498
+ return select$2();
475
499
  }
476
- function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
500
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
477
501
  const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
478
502
  config,
479
503
  resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
480
504
  });
481
505
  return luvio.storeBroadcast().then(() => snapshot);
482
506
  }
483
- function onFetchResponseError$1(luvio, config, resourceParams, response) {
484
- const snapshot = ingestError$1(luvio, resourceParams, response, {
507
+ function onFetchResponseError(luvio, config, resourceParams, response) {
508
+ const snapshot = ingestError(luvio, resourceParams, response, {
485
509
  config,
486
510
  resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
487
511
  });
@@ -492,12 +516,12 @@ function buildNetworkSnapshot$1(luvio, config, options) {
492
516
  const request = createResourceRequest$1(resourceParams);
493
517
  return luvio.dispatchResourceRequest(request, options)
494
518
  .then((response) => {
495
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
519
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
496
520
  }, (response) => {
497
- return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
521
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
498
522
  });
499
523
  }
500
- function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
524
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
501
525
  const { luvio, config } = context;
502
526
  const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
503
527
  const dispatchOptions = {
@@ -514,11 +538,11 @@ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext
514
538
  }
515
539
  return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
516
540
  }
517
- function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
541
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
518
542
  const { luvio, config } = context;
519
543
  const selector = {
520
- recordId: keyBuilder$2(luvio, config),
521
- node: adapterFragment$1(luvio, config),
544
+ recordId: keyBuilder$1(luvio, config),
545
+ node: adapterFragment(luvio, config),
522
546
  variables: {},
523
547
  };
524
548
  const cacheSnapshot = storeLookup(selector, {
@@ -527,46 +551,135 @@ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
527
551
  });
528
552
  return cacheSnapshot;
529
553
  }
530
-
531
- const defaultCacheFactory = {
532
- cachePolicy: {
533
- type: 'no-cache',
534
- },
535
- };
536
- // This implementation is based on the generated one from: packages/lds-adapters-analytics-tableau-embedding/src/generated/adapters/getJWT.ts.
537
- // 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.
538
- //
539
- // You can make sure this is included in the build by checking the contents of:
540
- // packages/lds-adapters-analytics-tableau-embedding/sfdc/index.js after `yarn build:services`
541
554
  const getJWTAdapterFactory = (luvio) => function TableauEmbedding__getJWT(untrustedConfig, requestContext) {
542
555
  const config = validateAdapterConfig$1(untrustedConfig, getJWT_ConfigPropertyNames);
543
556
  // Invalid or incomplete config
544
557
  if (config === null) {
545
558
  return null;
546
559
  }
547
- const ctx = { ...requestContext, ...defaultCacheFactory }; // override any runtime decisions w/ our desired policy
548
- return luvio.applyCachePolicy(ctx, { config, luvio }, // BuildSnapshotContext
549
- buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
560
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
561
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
550
562
  };
551
563
 
552
- function select(luvio, params) {
553
- return select$2();
564
+ const TTL = 100;
565
+ const VERSION = "88a8d9029774893417ad347424a8729c";
566
+ function validate(obj, path = 'TableauJWTRepresentation2') {
567
+ const v_error = (() => {
568
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
569
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
570
+ }
571
+ const obj_cb = obj.cb;
572
+ const path_cb = path + '.cb';
573
+ if (typeof obj_cb !== 'string') {
574
+ return new TypeError('Expected "string" but received "' + typeof obj_cb + '" (at "' + path_cb + '")');
575
+ }
576
+ const obj_jti = obj.jti;
577
+ const path_jti = path + '.jti';
578
+ if (typeof obj_jti !== 'string') {
579
+ return new TypeError('Expected "string" but received "' + typeof obj_jti + '" (at "' + path_jti + '")');
580
+ }
581
+ const obj_siteId = obj.siteId;
582
+ const path_siteId = path + '.siteId';
583
+ if (typeof obj_siteId !== 'string') {
584
+ return new TypeError('Expected "string" but received "' + typeof obj_siteId + '" (at "' + path_siteId + '")');
585
+ }
586
+ const obj_tabUrl = obj.tabUrl;
587
+ const path_tabUrl = path + '.tabUrl';
588
+ if (typeof obj_tabUrl !== 'string') {
589
+ return new TypeError('Expected "string" but received "' + typeof obj_tabUrl + '" (at "' + path_tabUrl + '")');
590
+ }
591
+ const obj_token = obj.token;
592
+ const path_token = path + '.token';
593
+ if (typeof obj_token !== 'string') {
594
+ return new TypeError('Expected "string" but received "' + typeof obj_token + '" (at "' + path_token + '")');
595
+ }
596
+ })();
597
+ return v_error === undefined ? null : v_error;
598
+ }
599
+ const RepresentationType = 'TableauJWTRepresentation2';
600
+ function keyBuilder(luvio, config) {
601
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
602
+ }
603
+ function keyBuilderFromType(luvio, object) {
604
+ const keyParams = {
605
+ id: object.jti
606
+ };
607
+ return keyBuilder(luvio, keyParams);
554
608
  }
555
- function keyBuilder$1(luvio, params) {
556
- return keyPrefix + '::TableauJWTRepresentation:(' + (params.body.siteId === undefined ? 'siteId' : 'siteId:' + params.body.siteId) + '::' + (params.body.tabUrl === undefined ? 'tabUrl' : 'tabUrl:' + params.body.tabUrl) + ')';
609
+ function normalize(input, existing, path, luvio, store, timestamp) {
610
+ return input;
611
+ }
612
+ const select$1 = function TableauJWTRepresentation2Select() {
613
+ return {
614
+ kind: 'Fragment',
615
+ version: VERSION,
616
+ private: [],
617
+ opaque: true
618
+ };
619
+ };
620
+ function equals(existing, incoming) {
621
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
622
+ return false;
623
+ }
624
+ return true;
625
+ }
626
+ const ingest = function TableauJWTRepresentation2Ingest(input, path, luvio, store, timestamp) {
627
+ if (process.env.NODE_ENV !== 'production') {
628
+ const validateError = validate(input);
629
+ if (validateError !== null) {
630
+ throw validateError;
631
+ }
632
+ }
633
+ const key = keyBuilderFromType(luvio, input);
634
+ const existingRecord = store.readEntry(key);
635
+ const ttlToUse = TTL;
636
+ let incomingRecord = normalize(input, store.readEntry(key), {
637
+ fullPath: key,
638
+ parent: path.parent,
639
+ propertyName: path.propertyName,
640
+ ttl: ttlToUse
641
+ });
642
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
643
+ luvio.storePublish(key, incomingRecord);
644
+ }
645
+ {
646
+ const storeMetadataParams = {
647
+ ttl: ttlToUse,
648
+ namespace: "TableauEmbedding",
649
+ version: VERSION,
650
+ representationName: RepresentationType,
651
+ };
652
+ luvio.publishStoreMetadata(key, storeMetadataParams);
653
+ }
654
+ return createLink(key);
655
+ };
656
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
657
+ const rootKeySet = new StoreKeyMap();
658
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
659
+ const rootKey = keyBuilderFromType(luvio, input);
660
+ rootKeySet.set(rootKey, {
661
+ namespace: keyPrefix,
662
+ representationName: RepresentationType,
663
+ mergeable: false
664
+ });
665
+ return rootKeySet;
666
+ }
667
+
668
+ function select(luvio, params) {
669
+ return select$1();
557
670
  }
558
671
  function getResponseCacheKeys(luvio, resourceParams, response) {
559
- return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
672
+ return getTypeCacheKeys(luvio, response);
560
673
  }
561
- function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
674
+ function ingestSuccess(luvio, resourceParams, response) {
562
675
  const { body } = response;
563
- const key = keyBuilder$1(luvio, resourceParams);
676
+ const key = keyBuilderFromType(luvio, body);
564
677
  luvio.storeIngest(key, ingest, body);
565
678
  const snapshot = luvio.storeLookup({
566
679
  recordId: key,
567
680
  node: select(),
568
681
  variables: {},
569
- }, snapshotRefresh);
682
+ });
570
683
  if (process.env.NODE_ENV !== 'production') {
571
684
  if (snapshot.state !== 'Fulfilled') {
572
685
  throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
@@ -575,18 +688,6 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
575
688
  deepFreeze(snapshot.data);
576
689
  return snapshot;
577
690
  }
578
- function ingestError(luvio, params, error, snapshotRefresh) {
579
- const key = keyBuilder$1(luvio, params);
580
- const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
581
- const storeMetadataParams = {
582
- ttl: TTL,
583
- namespace: keyPrefix,
584
- version: VERSION,
585
- representationName: RepresentationType
586
- };
587
- luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
588
- return errorSnapshot;
589
- }
590
691
  function createResourceRequest(config) {
591
692
  const headers = {};
592
693
  return {
@@ -605,13 +706,16 @@ const postJWT_ConfigPropertyNames = {
605
706
  displayName: 'postJWT',
606
707
  parameters: {
607
708
  required: [],
608
- optional: ['siteId', 'tabUrl']
709
+ optional: ['cb', 'siteId', 'tabUrl']
609
710
  }
610
711
  };
611
712
  function createResourceParams(config) {
612
713
  const resourceParams = {
613
714
  body: {}
614
715
  };
716
+ if (config['cb'] !== undefined) {
717
+ resourceParams.body['cb'] = config['cb'];
718
+ }
615
719
  if (config['siteId'] !== undefined) {
616
720
  resourceParams.body['siteId'] = config['siteId'];
617
721
  }
@@ -620,12 +724,12 @@ function createResourceParams(config) {
620
724
  }
621
725
  return resourceParams;
622
726
  }
623
- function keyBuilder(luvio, config) {
624
- const resourceParams = createResourceParams(config);
625
- return keyBuilder$1(luvio, resourceParams);
626
- }
627
727
  function typeCheckConfig(untrustedConfig) {
628
728
  const config = {};
729
+ const untrustedConfig_cb = untrustedConfig.cb;
730
+ if (typeof untrustedConfig_cb === 'string') {
731
+ config.cb = untrustedConfig_cb;
732
+ }
629
733
  const untrustedConfig_siteId = untrustedConfig.siteId;
630
734
  if (typeof untrustedConfig_siteId === 'string') {
631
735
  config.siteId = untrustedConfig_siteId;
@@ -649,110 +753,61 @@ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
649
753
  }
650
754
  return config;
651
755
  }
652
- function adapterFragment(luvio, config) {
653
- createResourceParams(config);
654
- return select();
655
- }
656
- function onFetchResponseSuccess(luvio, config, resourceParams, response) {
657
- const snapshot = ingestSuccess(luvio, resourceParams, response, {
658
- config,
659
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
660
- });
661
- return luvio.storeBroadcast().then(() => snapshot);
662
- }
663
- function onFetchResponseError(luvio, config, resourceParams, response) {
664
- const snapshot = ingestError(luvio, resourceParams, response, {
665
- config,
666
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
667
- });
668
- return luvio.storeBroadcast().then(() => snapshot);
669
- }
670
756
  function buildNetworkSnapshot(luvio, config, options) {
671
757
  const resourceParams = createResourceParams(config);
672
758
  const request = createResourceRequest(resourceParams);
673
759
  return luvio.dispatchResourceRequest(request, options)
674
760
  .then((response) => {
675
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
761
+ return luvio.handleSuccessResponse(() => {
762
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
763
+ return luvio.storeBroadcast().then(() => snapshot);
764
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
676
765
  }, (response) => {
677
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
766
+ deepFreeze(response);
767
+ throw response;
678
768
  });
679
769
  }
680
- function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
681
- const { luvio, config } = context;
682
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
683
- const dispatchOptions = {
684
- resourceRequestContext: {
685
- requestCorrelator,
686
- luvioRequestMethod: 'get',
687
- },
688
- eventObservers
689
- };
690
- if (networkPriority !== 'normal') {
691
- dispatchOptions.overrides = {
692
- priority: networkPriority
693
- };
694
- }
695
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
696
- }
697
- function buildCachedSnapshotCachePolicy(context, storeLookup) {
698
- const { luvio, config } = context;
699
- const selector = {
700
- recordId: keyBuilder(luvio, config),
701
- node: adapterFragment(luvio, config),
702
- variables: {},
770
+ const postJWTAdapterFactory = (luvio) => {
771
+ return function postJWT(untrustedConfig) {
772
+ const config = validateAdapterConfig(untrustedConfig, postJWT_ConfigPropertyNames);
773
+ // Invalid or incomplete config
774
+ if (config === null) {
775
+ throw new Error('Invalid config for "postJWT"');
776
+ }
777
+ return buildNetworkSnapshot(luvio, config);
703
778
  };
704
- const cacheSnapshot = storeLookup(selector, {
705
- config,
706
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
707
- });
708
- return cacheSnapshot;
709
- }
710
- const postJWTAdapterFactory = (luvio) => function TableauEmbedding__postJWT(untrustedConfig, requestContext) {
711
- const config = validateAdapterConfig(untrustedConfig, postJWT_ConfigPropertyNames);
712
- // Invalid or incomplete config
713
- if (config === null) {
714
- return null;
715
- }
716
- return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
717
- buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
718
779
  };
719
780
 
720
- // Original file: packages/lds-adapters-analytics-tableau-embedding/src/generated/artifacts/sfdc.ts
781
+ // EUREKA: Original file is packages/lds-adapters-analytics-tableau-embedding/src/generated/artifacts/sfdc.ts
721
782
  let getEAS;
722
783
  let getJWT;
723
784
  let postJWT;
724
785
  // Imperative GET Adapters
725
786
  let getEAS_imperative;
726
787
  let getJWT_imperative;
727
- let postJWT_imperative;
728
788
  // Adapter Metadata
729
789
  const getEASMetadata = { apiFamily: 'TableauEmbedding', name: 'getEAS', ttl: 180000 };
730
790
  const getJWTMetadata = { apiFamily: 'TableauEmbedding', name: 'getJWT', ttl: 100 };
731
- const postJWTMetadata = { apiFamily: 'TableauEmbedding', name: 'postJWT', ttl: 100 };
732
791
  function bindExportsTo(luvio) {
733
792
  // LDS Adapters
734
793
  const getEAS_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getEAS', getEASAdapterFactory), getEASMetadata);
735
794
  const getJWT_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getJWT', getJWTAdapterFactory), getJWTMetadata);
736
- const postJWT_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'postJWT', postJWTAdapterFactory), postJWTMetadata);
737
- // Not used
738
- // function unwrapSnapshotData<Config,DataType>(factory: AdapterFactory<Config,DataType>) {
739
- // const adapter = factory(luvio);
740
- // return (config: Config) => (adapter(config) as Promise<Snapshot<DataType>>).then(snapshot => snapshot.data);
741
- // }
795
+ function unwrapSnapshotData(factory) {
796
+ const adapter = factory(luvio);
797
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
798
+ }
742
799
  return {
743
800
  getEAS: createWireAdapterConstructor(luvio, getEAS_ldsAdapter, getEASMetadata),
744
801
  getJWT: createWireAdapterConstructor(luvio, getJWT_ldsAdapter, getJWTMetadata),
745
- postJWT: createWireAdapterConstructor(luvio, postJWT_ldsAdapter, postJWTMetadata),
802
+ postJWT: unwrapSnapshotData(postJWTAdapterFactory),
746
803
  // Imperative GET Adapters
747
804
  getEAS_imperative: createImperativeAdapter(luvio, getEAS_ldsAdapter, getEASMetadata),
748
805
  getJWT_imperative: createImperativeAdapter(luvio, getJWT_ldsAdapter, getJWTMetadata),
749
- postJWT_imperative: createImperativeAdapter(luvio, postJWT_ldsAdapter, postJWTMetadata),
750
806
  };
751
807
  }
752
808
  withDefaultLuvio((luvio) => {
753
- ({ getEAS, getJWT, postJWT, getEAS_imperative, getJWT_imperative, postJWT_imperative } =
754
- bindExportsTo(luvio));
809
+ ({ getEAS, getJWT, postJWT, getEAS_imperative, getJWT_imperative } = bindExportsTo(luvio));
755
810
  });
756
811
 
757
- export { getEAS, getEAS_imperative, getJWT, getJWT_imperative, postJWT, postJWT_imperative };
758
- // version: 1.147.4-7830883a5
812
+ export { getEAS, getEAS_imperative, getJWT, getJWT_imperative, postJWT };
813
+ // version: 1.149.0-69a6ce242