@salesforce/lds-adapters-analytics-tableau-embedding 0.1.0-dev1
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/LICENSE.txt +82 -0
- package/dist/es/es2018/analytics-tableau-embedding.js +694 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getEAS.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/adapters/getJWT.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/adapters/postJWT.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/resources/getTableauEas.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/getTableauJwt.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/resources/postTableauJwt.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/types/TableauEASRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/TableauJWTInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/TableauJWTRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/TableauJWTRepresentation2.d.ts +53 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/dist/es/es2018/types/src/main.d.ts +3 -0
- package/dist/es/es2018/types/src/sfdc.d.ts +6 -0
- package/dist/es/es2018/types/src/wire/getJWT/index.d.ts +4 -0
- package/package.json +76 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +724 -0
- package/src/raml/api.raml +171 -0
- package/src/raml/luvio.raml +39 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'TableauEmbedding';
|
|
83
|
+
|
|
84
|
+
const { isArray: ArrayIsArray } = Array;
|
|
85
|
+
const { stringify: JSONStringify } = JSON;
|
|
86
|
+
function createLink(ref) {
|
|
87
|
+
return {
|
|
88
|
+
__ref: serializeStructuredKey(ref),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const TTL$2 = 180000;
|
|
93
|
+
const VERSION$2 = "97a38409c54dceea0317e696f6166bc4";
|
|
94
|
+
function validate$2(obj, path = 'TableauEASRepresentation') {
|
|
95
|
+
const v_error = (() => {
|
|
96
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
97
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
98
|
+
}
|
|
99
|
+
const obj_issuer = obj.issuer;
|
|
100
|
+
const path_issuer = path + '.issuer';
|
|
101
|
+
if (typeof obj_issuer !== 'string') {
|
|
102
|
+
return new TypeError('Expected "string" but received "' + typeof obj_issuer + '" (at "' + path_issuer + '")');
|
|
103
|
+
}
|
|
104
|
+
const obj_jwks = obj.jwks;
|
|
105
|
+
const path_jwks = path + '.jwks';
|
|
106
|
+
if (typeof obj_jwks !== 'string') {
|
|
107
|
+
return new TypeError('Expected "string" but received "' + typeof obj_jwks + '" (at "' + path_jwks + '")');
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
return v_error === undefined ? null : v_error;
|
|
111
|
+
}
|
|
112
|
+
const RepresentationType$2 = 'TableauEASRepresentation';
|
|
113
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
const select$5 = function TableauEASRepresentationSelect() {
|
|
117
|
+
return {
|
|
118
|
+
kind: 'Fragment',
|
|
119
|
+
version: VERSION$2,
|
|
120
|
+
private: [],
|
|
121
|
+
opaque: true
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
function equals$2(existing, incoming) {
|
|
125
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
const ingest$2 = function TableauEASRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
131
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
132
|
+
const validateError = validate$2(input);
|
|
133
|
+
if (validateError !== null) {
|
|
134
|
+
throw validateError;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const key = path.fullPath;
|
|
138
|
+
const ttlToUse = TTL$2;
|
|
139
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "TableauEmbedding", VERSION$2, RepresentationType$2, equals$2);
|
|
140
|
+
return createLink(key);
|
|
141
|
+
};
|
|
142
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
143
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
144
|
+
const rootKey = fullPathFactory();
|
|
145
|
+
rootKeySet.set(rootKey, {
|
|
146
|
+
namespace: keyPrefix,
|
|
147
|
+
representationName: RepresentationType$2,
|
|
148
|
+
mergeable: false
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function select$4(luvio, params) {
|
|
153
|
+
return select$5();
|
|
154
|
+
}
|
|
155
|
+
function keyBuilder$4(luvio, params) {
|
|
156
|
+
return keyPrefix + '::TableauEASRepresentation:(' + ')';
|
|
157
|
+
}
|
|
158
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
159
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4());
|
|
160
|
+
}
|
|
161
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
162
|
+
const { body } = response;
|
|
163
|
+
const key = keyBuilder$4();
|
|
164
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
165
|
+
const snapshot = luvio.storeLookup({
|
|
166
|
+
recordId: key,
|
|
167
|
+
node: select$4(),
|
|
168
|
+
variables: {},
|
|
169
|
+
}, snapshotRefresh);
|
|
170
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
171
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
172
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
deepFreeze(snapshot.data);
|
|
176
|
+
return snapshot;
|
|
177
|
+
}
|
|
178
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
179
|
+
const key = keyBuilder$4();
|
|
180
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
181
|
+
const storeMetadataParams = {
|
|
182
|
+
ttl: TTL$2,
|
|
183
|
+
namespace: keyPrefix,
|
|
184
|
+
version: VERSION$2,
|
|
185
|
+
representationName: RepresentationType$2
|
|
186
|
+
};
|
|
187
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
188
|
+
return errorSnapshot;
|
|
189
|
+
}
|
|
190
|
+
function createResourceRequest$2(config) {
|
|
191
|
+
const headers = {};
|
|
192
|
+
return {
|
|
193
|
+
baseUri: '/services/data/v66.0',
|
|
194
|
+
basePath: '/tableau/eas',
|
|
195
|
+
method: 'get',
|
|
196
|
+
body: null,
|
|
197
|
+
urlParams: {},
|
|
198
|
+
queryParams: {},
|
|
199
|
+
headers,
|
|
200
|
+
priority: 'normal',
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const adapterName$2 = 'getEAS';
|
|
205
|
+
const getEAS_ConfigPropertyMetadata = [];
|
|
206
|
+
const getEAS_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getEAS_ConfigPropertyMetadata);
|
|
207
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getEAS_ConfigPropertyMetadata);
|
|
208
|
+
function keyBuilder$3(luvio, config) {
|
|
209
|
+
createResourceParams$2(config);
|
|
210
|
+
return keyBuilder$4();
|
|
211
|
+
}
|
|
212
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
213
|
+
const config = {};
|
|
214
|
+
return config;
|
|
215
|
+
}
|
|
216
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
217
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
221
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
222
|
+
}
|
|
223
|
+
const config = typeCheckConfig$2();
|
|
224
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
return config;
|
|
228
|
+
}
|
|
229
|
+
function adapterFragment$1(luvio, config) {
|
|
230
|
+
createResourceParams$2(config);
|
|
231
|
+
return select$4();
|
|
232
|
+
}
|
|
233
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
234
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
235
|
+
config,
|
|
236
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
237
|
+
});
|
|
238
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
239
|
+
}
|
|
240
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
241
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
242
|
+
config,
|
|
243
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
244
|
+
});
|
|
245
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
246
|
+
}
|
|
247
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
248
|
+
const resourceParams = createResourceParams$2(config);
|
|
249
|
+
const request = createResourceRequest$2();
|
|
250
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
251
|
+
.then((response) => {
|
|
252
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
253
|
+
const cache = new StoreKeyMap();
|
|
254
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
255
|
+
return cache;
|
|
256
|
+
});
|
|
257
|
+
}, (response) => {
|
|
258
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
262
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
263
|
+
}
|
|
264
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
265
|
+
const { luvio, config } = context;
|
|
266
|
+
const selector = {
|
|
267
|
+
recordId: keyBuilder$3(luvio, config),
|
|
268
|
+
node: adapterFragment$1(luvio, config),
|
|
269
|
+
variables: {},
|
|
270
|
+
};
|
|
271
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
272
|
+
config,
|
|
273
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
274
|
+
});
|
|
275
|
+
return cacheSnapshot;
|
|
276
|
+
}
|
|
277
|
+
const getEASAdapterFactory = (luvio) => function TableauEmbedding__getEAS(untrustedConfig, requestContext) {
|
|
278
|
+
const config = validateAdapterConfig$2(untrustedConfig, getEAS_ConfigPropertyNames);
|
|
279
|
+
// Invalid or incomplete config
|
|
280
|
+
if (config === null) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
284
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const TTL$1 = 100;
|
|
288
|
+
const VERSION$1 = "7c471499a5fc6c0f05f551d51897602f";
|
|
289
|
+
function validate$1(obj, path = 'TableauJWTRepresentation') {
|
|
290
|
+
const v_error = (() => {
|
|
291
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
292
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
293
|
+
}
|
|
294
|
+
const obj_cb = obj.cb;
|
|
295
|
+
const path_cb = path + '.cb';
|
|
296
|
+
if (typeof obj_cb !== 'string') {
|
|
297
|
+
return new TypeError('Expected "string" but received "' + typeof obj_cb + '" (at "' + path_cb + '")');
|
|
298
|
+
}
|
|
299
|
+
const obj_jti = obj.jti;
|
|
300
|
+
const path_jti = path + '.jti';
|
|
301
|
+
if (typeof obj_jti !== 'string') {
|
|
302
|
+
return new TypeError('Expected "string" but received "' + typeof obj_jti + '" (at "' + path_jti + '")');
|
|
303
|
+
}
|
|
304
|
+
const obj_siteId = obj.siteId;
|
|
305
|
+
const path_siteId = path + '.siteId';
|
|
306
|
+
if (typeof obj_siteId !== 'string') {
|
|
307
|
+
return new TypeError('Expected "string" but received "' + typeof obj_siteId + '" (at "' + path_siteId + '")');
|
|
308
|
+
}
|
|
309
|
+
const obj_tabUrl = obj.tabUrl;
|
|
310
|
+
const path_tabUrl = path + '.tabUrl';
|
|
311
|
+
if (typeof obj_tabUrl !== 'string') {
|
|
312
|
+
return new TypeError('Expected "string" but received "' + typeof obj_tabUrl + '" (at "' + path_tabUrl + '")');
|
|
313
|
+
}
|
|
314
|
+
const obj_token = obj.token;
|
|
315
|
+
const path_token = path + '.token';
|
|
316
|
+
if (typeof obj_token !== 'string') {
|
|
317
|
+
return new TypeError('Expected "string" but received "' + typeof obj_token + '" (at "' + path_token + '")');
|
|
318
|
+
}
|
|
319
|
+
const obj_uafClaims = obj.uafClaims;
|
|
320
|
+
const path_uafClaims = path + '.uafClaims';
|
|
321
|
+
if (typeof obj_uafClaims !== 'string') {
|
|
322
|
+
return new TypeError('Expected "string" but received "' + typeof obj_uafClaims + '" (at "' + path_uafClaims + '")');
|
|
323
|
+
}
|
|
324
|
+
})();
|
|
325
|
+
return v_error === undefined ? null : v_error;
|
|
326
|
+
}
|
|
327
|
+
const RepresentationType$1 = 'TableauJWTRepresentation';
|
|
328
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
329
|
+
return input;
|
|
330
|
+
}
|
|
331
|
+
const select$3 = function TableauJWTRepresentationSelect() {
|
|
332
|
+
return {
|
|
333
|
+
kind: 'Fragment',
|
|
334
|
+
version: VERSION$1,
|
|
335
|
+
private: [],
|
|
336
|
+
opaque: true
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
function equals$1(existing, incoming) {
|
|
340
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
const ingest$1 = function TableauJWTRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
346
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
347
|
+
const validateError = validate$1(input);
|
|
348
|
+
if (validateError !== null) {
|
|
349
|
+
throw validateError;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const key = path.fullPath;
|
|
353
|
+
const ttlToUse = TTL$1;
|
|
354
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "TableauEmbedding", VERSION$1, RepresentationType$1, equals$1);
|
|
355
|
+
return createLink(key);
|
|
356
|
+
};
|
|
357
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
358
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
359
|
+
const rootKey = fullPathFactory();
|
|
360
|
+
rootKeySet.set(rootKey, {
|
|
361
|
+
namespace: keyPrefix,
|
|
362
|
+
representationName: RepresentationType$1,
|
|
363
|
+
mergeable: false
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function select$2(luvio, params) {
|
|
368
|
+
return select$3();
|
|
369
|
+
}
|
|
370
|
+
function keyBuilder$2(luvio, params) {
|
|
371
|
+
return keyPrefix + '::TableauJWTRepresentation:(' + 'cb:' + params.queryParams.cb + ',' + 'siteId:' + params.queryParams.siteId + ',' + 'tabUrl:' + params.queryParams.tabUrl + ',' + 'uafDefinitionNames:' + params.queryParams.uafDefinitionNames + ',' + 'jwtAccessScopeSet:' + params.queryParams.jwtAccessScopeSet + ')';
|
|
372
|
+
}
|
|
373
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
374
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
375
|
+
}
|
|
376
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
377
|
+
const { body } = response;
|
|
378
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
379
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
380
|
+
const snapshot = luvio.storeLookup({
|
|
381
|
+
recordId: key,
|
|
382
|
+
node: select$2(),
|
|
383
|
+
variables: {},
|
|
384
|
+
}, snapshotRefresh);
|
|
385
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
386
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
387
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
deepFreeze(snapshot.data);
|
|
391
|
+
return snapshot;
|
|
392
|
+
}
|
|
393
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
394
|
+
const key = keyBuilder$2(luvio, params);
|
|
395
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
396
|
+
const storeMetadataParams = {
|
|
397
|
+
ttl: TTL$1,
|
|
398
|
+
namespace: keyPrefix,
|
|
399
|
+
version: VERSION$1,
|
|
400
|
+
representationName: RepresentationType$1
|
|
401
|
+
};
|
|
402
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
403
|
+
return errorSnapshot;
|
|
404
|
+
}
|
|
405
|
+
function createResourceRequest$1(config) {
|
|
406
|
+
const headers = {};
|
|
407
|
+
return {
|
|
408
|
+
baseUri: '/services/data/v66.0',
|
|
409
|
+
basePath: '/tableau/jwt',
|
|
410
|
+
method: 'get',
|
|
411
|
+
body: null,
|
|
412
|
+
urlParams: {},
|
|
413
|
+
queryParams: config.queryParams,
|
|
414
|
+
headers,
|
|
415
|
+
priority: 'normal',
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const adapterName$1 = 'getJWT';
|
|
420
|
+
const getJWT_ConfigPropertyMetadata = [
|
|
421
|
+
generateParamConfigMetadata('cb', false, 1 /* QueryParameter */, 0 /* String */),
|
|
422
|
+
generateParamConfigMetadata('siteId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
423
|
+
generateParamConfigMetadata('tabUrl', false, 1 /* QueryParameter */, 0 /* String */),
|
|
424
|
+
generateParamConfigMetadata('uafDefinitionNames', false, 1 /* QueryParameter */, 0 /* String */),
|
|
425
|
+
generateParamConfigMetadata('jwtAccessScopeSet', false, 1 /* QueryParameter */, 0 /* String */),
|
|
426
|
+
];
|
|
427
|
+
const getJWT_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getJWT_ConfigPropertyMetadata);
|
|
428
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getJWT_ConfigPropertyMetadata);
|
|
429
|
+
function keyBuilder$1(luvio, config) {
|
|
430
|
+
const resourceParams = createResourceParams$1(config);
|
|
431
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
432
|
+
}
|
|
433
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
434
|
+
const config = {};
|
|
435
|
+
typeCheckConfig$3(untrustedConfig, config, getJWT_ConfigPropertyMetadata);
|
|
436
|
+
return config;
|
|
437
|
+
}
|
|
438
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
439
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
443
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
444
|
+
}
|
|
445
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
446
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
return config;
|
|
450
|
+
}
|
|
451
|
+
function adapterFragment(luvio, config) {
|
|
452
|
+
createResourceParams$1(config);
|
|
453
|
+
return select$2();
|
|
454
|
+
}
|
|
455
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
456
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
457
|
+
config,
|
|
458
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
459
|
+
});
|
|
460
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
461
|
+
}
|
|
462
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
463
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
464
|
+
config,
|
|
465
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
466
|
+
});
|
|
467
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
468
|
+
}
|
|
469
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
470
|
+
const resourceParams = createResourceParams$1(config);
|
|
471
|
+
const request = createResourceRequest$1(resourceParams);
|
|
472
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
473
|
+
.then((response) => {
|
|
474
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
475
|
+
const cache = new StoreKeyMap();
|
|
476
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
477
|
+
return cache;
|
|
478
|
+
});
|
|
479
|
+
}, (response) => {
|
|
480
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
484
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
485
|
+
}
|
|
486
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
487
|
+
const { luvio, config } = context;
|
|
488
|
+
const selector = {
|
|
489
|
+
recordId: keyBuilder$1(luvio, config),
|
|
490
|
+
node: adapterFragment(luvio, config),
|
|
491
|
+
variables: {},
|
|
492
|
+
};
|
|
493
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
494
|
+
config,
|
|
495
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
496
|
+
});
|
|
497
|
+
return cacheSnapshot;
|
|
498
|
+
}
|
|
499
|
+
const getJWTAdapterFactory = (luvio) => function TableauEmbedding__getJWT(untrustedConfig, requestContext) {
|
|
500
|
+
const config = validateAdapterConfig$1(untrustedConfig, getJWT_ConfigPropertyNames);
|
|
501
|
+
// Invalid or incomplete config
|
|
502
|
+
if (config === null) {
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
506
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
const TTL = 100;
|
|
510
|
+
const VERSION = "b2170b0df06590260d72ee738c7c7494";
|
|
511
|
+
function validate(obj, path = 'TableauJWTRepresentation2') {
|
|
512
|
+
const v_error = (() => {
|
|
513
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
514
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
515
|
+
}
|
|
516
|
+
const obj_cb = obj.cb;
|
|
517
|
+
const path_cb = path + '.cb';
|
|
518
|
+
if (typeof obj_cb !== 'string') {
|
|
519
|
+
return new TypeError('Expected "string" but received "' + typeof obj_cb + '" (at "' + path_cb + '")');
|
|
520
|
+
}
|
|
521
|
+
const obj_jti = obj.jti;
|
|
522
|
+
const path_jti = path + '.jti';
|
|
523
|
+
if (typeof obj_jti !== 'string') {
|
|
524
|
+
return new TypeError('Expected "string" but received "' + typeof obj_jti + '" (at "' + path_jti + '")');
|
|
525
|
+
}
|
|
526
|
+
const obj_siteId = obj.siteId;
|
|
527
|
+
const path_siteId = path + '.siteId';
|
|
528
|
+
if (typeof obj_siteId !== 'string') {
|
|
529
|
+
return new TypeError('Expected "string" but received "' + typeof obj_siteId + '" (at "' + path_siteId + '")');
|
|
530
|
+
}
|
|
531
|
+
const obj_tabUrl = obj.tabUrl;
|
|
532
|
+
const path_tabUrl = path + '.tabUrl';
|
|
533
|
+
if (typeof obj_tabUrl !== 'string') {
|
|
534
|
+
return new TypeError('Expected "string" but received "' + typeof obj_tabUrl + '" (at "' + path_tabUrl + '")');
|
|
535
|
+
}
|
|
536
|
+
const obj_token = obj.token;
|
|
537
|
+
const path_token = path + '.token';
|
|
538
|
+
if (typeof obj_token !== 'string') {
|
|
539
|
+
return new TypeError('Expected "string" but received "' + typeof obj_token + '" (at "' + path_token + '")');
|
|
540
|
+
}
|
|
541
|
+
const obj_uafClaims = obj.uafClaims;
|
|
542
|
+
const path_uafClaims = path + '.uafClaims';
|
|
543
|
+
if (typeof obj_uafClaims !== 'string') {
|
|
544
|
+
return new TypeError('Expected "string" but received "' + typeof obj_uafClaims + '" (at "' + path_uafClaims + '")');
|
|
545
|
+
}
|
|
546
|
+
})();
|
|
547
|
+
return v_error === undefined ? null : v_error;
|
|
548
|
+
}
|
|
549
|
+
const RepresentationType = 'TableauJWTRepresentation2';
|
|
550
|
+
function keyBuilder(luvio, config) {
|
|
551
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
552
|
+
}
|
|
553
|
+
function keyBuilderFromType(luvio, object) {
|
|
554
|
+
const keyParams = {
|
|
555
|
+
id: object.jti
|
|
556
|
+
};
|
|
557
|
+
return keyBuilder(luvio, keyParams);
|
|
558
|
+
}
|
|
559
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
560
|
+
return input;
|
|
561
|
+
}
|
|
562
|
+
const select$1 = function TableauJWTRepresentation2Select() {
|
|
563
|
+
return {
|
|
564
|
+
kind: 'Fragment',
|
|
565
|
+
version: VERSION,
|
|
566
|
+
private: [],
|
|
567
|
+
opaque: true
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
function equals(existing, incoming) {
|
|
571
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
const ingest = function TableauJWTRepresentation2Ingest(input, path, luvio, store, timestamp) {
|
|
577
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
578
|
+
const validateError = validate(input);
|
|
579
|
+
if (validateError !== null) {
|
|
580
|
+
throw validateError;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
const key = keyBuilderFromType(luvio, input);
|
|
584
|
+
const ttlToUse = TTL;
|
|
585
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "TableauEmbedding", VERSION, RepresentationType, equals);
|
|
586
|
+
return createLink(key);
|
|
587
|
+
};
|
|
588
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
589
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
590
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
591
|
+
rootKeySet.set(rootKey, {
|
|
592
|
+
namespace: keyPrefix,
|
|
593
|
+
representationName: RepresentationType,
|
|
594
|
+
mergeable: false
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function select(luvio, params) {
|
|
599
|
+
return select$1();
|
|
600
|
+
}
|
|
601
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
602
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
603
|
+
}
|
|
604
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
605
|
+
const { body } = response;
|
|
606
|
+
const key = keyBuilderFromType(luvio, body);
|
|
607
|
+
luvio.storeIngest(key, ingest, body);
|
|
608
|
+
const snapshot = luvio.storeLookup({
|
|
609
|
+
recordId: key,
|
|
610
|
+
node: select(),
|
|
611
|
+
variables: {},
|
|
612
|
+
});
|
|
613
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
614
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
615
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
deepFreeze(snapshot.data);
|
|
619
|
+
return snapshot;
|
|
620
|
+
}
|
|
621
|
+
function createResourceRequest(config) {
|
|
622
|
+
const headers = {};
|
|
623
|
+
return {
|
|
624
|
+
baseUri: '/services/data/v66.0',
|
|
625
|
+
basePath: '/tableau/jwt',
|
|
626
|
+
method: 'post',
|
|
627
|
+
body: config.body,
|
|
628
|
+
urlParams: {},
|
|
629
|
+
queryParams: {},
|
|
630
|
+
headers,
|
|
631
|
+
priority: 'normal',
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
const adapterName = 'postJWT';
|
|
636
|
+
const postJWT_ConfigPropertyMetadata = [
|
|
637
|
+
generateParamConfigMetadata('cb', false, 2 /* Body */, 0 /* String */),
|
|
638
|
+
generateParamConfigMetadata('siteId', false, 2 /* Body */, 0 /* String */),
|
|
639
|
+
generateParamConfigMetadata('tabUrl', false, 2 /* Body */, 0 /* String */),
|
|
640
|
+
generateParamConfigMetadata('uafDefinitionNames', false, 2 /* Body */, 0 /* String */),
|
|
641
|
+
generateParamConfigMetadata('jwtAccessScopeSet', false, 2 /* Body */, 0 /* String */),
|
|
642
|
+
];
|
|
643
|
+
const postJWT_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, postJWT_ConfigPropertyMetadata);
|
|
644
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(postJWT_ConfigPropertyMetadata);
|
|
645
|
+
function typeCheckConfig(untrustedConfig) {
|
|
646
|
+
const config = {};
|
|
647
|
+
typeCheckConfig$3(untrustedConfig, config, postJWT_ConfigPropertyMetadata);
|
|
648
|
+
return config;
|
|
649
|
+
}
|
|
650
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
651
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
652
|
+
return null;
|
|
653
|
+
}
|
|
654
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
655
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
656
|
+
}
|
|
657
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
658
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
return config;
|
|
662
|
+
}
|
|
663
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
664
|
+
const resourceParams = createResourceParams(config);
|
|
665
|
+
const request = createResourceRequest(resourceParams);
|
|
666
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
667
|
+
.then((response) => {
|
|
668
|
+
return luvio.handleSuccessResponse(() => {
|
|
669
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
670
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
671
|
+
}, () => {
|
|
672
|
+
const cache = new StoreKeyMap();
|
|
673
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
674
|
+
return cache;
|
|
675
|
+
});
|
|
676
|
+
}, (response) => {
|
|
677
|
+
deepFreeze(response);
|
|
678
|
+
throw response;
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
const postJWTAdapterFactory = (luvio) => {
|
|
682
|
+
return function postJWT(untrustedConfig) {
|
|
683
|
+
const config = validateAdapterConfig(untrustedConfig, postJWT_ConfigPropertyNames);
|
|
684
|
+
// Invalid or incomplete config
|
|
685
|
+
if (config === null) {
|
|
686
|
+
throw new Error('Invalid config for "postJWT"');
|
|
687
|
+
}
|
|
688
|
+
return buildNetworkSnapshot(luvio, config);
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
// EUREKA: Original file is packages/lds-adapters-analytics-tableau-embedding/src/generated/artifacts/sfdc.ts
|
|
693
|
+
let getEAS;
|
|
694
|
+
let getJWT;
|
|
695
|
+
let postJWT;
|
|
696
|
+
// Imperative GET Adapters
|
|
697
|
+
let getEAS_imperative;
|
|
698
|
+
let getJWT_imperative;
|
|
699
|
+
// Adapter Metadata
|
|
700
|
+
const getEASMetadata = { apiFamily: 'TableauEmbedding', name: 'getEAS', ttl: 180000 };
|
|
701
|
+
const getJWTMetadata = { apiFamily: 'TableauEmbedding', name: 'getJWT', ttl: 100 };
|
|
702
|
+
function bindExportsTo(luvio) {
|
|
703
|
+
// LDS Adapters
|
|
704
|
+
const getEAS_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getEAS', getEASAdapterFactory), getEASMetadata);
|
|
705
|
+
const getJWT_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getJWT', getJWTAdapterFactory), getJWTMetadata);
|
|
706
|
+
function unwrapSnapshotData(factory) {
|
|
707
|
+
const adapter = factory(luvio);
|
|
708
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
709
|
+
}
|
|
710
|
+
return {
|
|
711
|
+
getEAS: createWireAdapterConstructor(luvio, getEAS_ldsAdapter, getEASMetadata),
|
|
712
|
+
getJWT: createWireAdapterConstructor(luvio, getJWT_ldsAdapter, getJWTMetadata),
|
|
713
|
+
postJWT: unwrapSnapshotData(postJWTAdapterFactory),
|
|
714
|
+
// Imperative GET Adapters
|
|
715
|
+
getEAS_imperative: createImperativeAdapter(luvio, getEAS_ldsAdapter, getEASMetadata),
|
|
716
|
+
getJWT_imperative: createImperativeAdapter(luvio, getJWT_ldsAdapter, getJWTMetadata),
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
withDefaultLuvio((luvio) => {
|
|
720
|
+
({ getEAS, getJWT, postJWT, getEAS_imperative, getJWT_imperative } = bindExportsTo(luvio));
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
export { getEAS, getEAS_imperative, getJWT, getJWT_imperative, postJWT };
|
|
724
|
+
// version: 0.1.0-dev1-c978a7b010
|