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