@salesforce/lds-adapters-platform-i18n 1.124.2 → 1.124.4
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/platform-i18n.js +315 -315
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/getTimezonesByLocale.d.ts +26 -26
- package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +1 -1
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +3 -3
- package/dist/{types → es/es2018/types}/src/generated/resources/getConnectI18nTimezonesByLocale.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectI18nStatecountry.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/types/AddressCountry.d.ts +57 -57
- package/dist/{types → es/es2018/types}/src/generated/types/AddressState.d.ts +41 -41
- package/dist/{types → es/es2018/types}/src/generated/types/StateCountryInputRequest.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/StateCountryOutputRepresentation.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/StateCountryTranslations.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/TimezoneOutputRepresentation.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/TimezoneRepresentation.d.ts +35 -35
- 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 +335 -335
- package/dist/umd/es2018/platform-i18n.js +0 -344
- package/dist/umd/es5/platform-i18n.js +0 -346
|
@@ -6,331 +6,331 @@
|
|
|
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 = 'platformi18n';
|
|
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
|
-
function validate$1(obj, path = 'TimezoneRepresentation') {
|
|
63
|
-
const v_error = (() => {
|
|
64
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
65
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
66
|
-
}
|
|
67
|
-
const obj_displayLabel = obj.displayLabel;
|
|
68
|
-
const path_displayLabel = path + '.displayLabel';
|
|
69
|
-
if (typeof obj_displayLabel !== 'string') {
|
|
70
|
-
return new TypeError('Expected "string" but received "' + typeof obj_displayLabel + '" (at "' + path_displayLabel + '")');
|
|
71
|
-
}
|
|
72
|
-
const obj_offset = obj.offset;
|
|
73
|
-
const path_offset = path + '.offset';
|
|
74
|
-
if (typeof obj_offset !== 'string') {
|
|
75
|
-
return new TypeError('Expected "string" but received "' + typeof obj_offset + '" (at "' + path_offset + '")');
|
|
76
|
-
}
|
|
77
|
-
const obj_timezoneId = obj.timezoneId;
|
|
78
|
-
const path_timezoneId = path + '.timezoneId';
|
|
79
|
-
if (typeof obj_timezoneId !== 'string') {
|
|
80
|
-
return new TypeError('Expected "string" but received "' + typeof obj_timezoneId + '" (at "' + path_timezoneId + '")');
|
|
81
|
-
}
|
|
82
|
-
})();
|
|
83
|
-
return v_error === undefined ? null : v_error;
|
|
84
|
-
}
|
|
85
|
-
function deepFreeze$1(input) {
|
|
86
|
-
ObjectFreeze(input);
|
|
62
|
+
function validate$1(obj, path = 'TimezoneRepresentation') {
|
|
63
|
+
const v_error = (() => {
|
|
64
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
65
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
66
|
+
}
|
|
67
|
+
const obj_displayLabel = obj.displayLabel;
|
|
68
|
+
const path_displayLabel = path + '.displayLabel';
|
|
69
|
+
if (typeof obj_displayLabel !== 'string') {
|
|
70
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayLabel + '" (at "' + path_displayLabel + '")');
|
|
71
|
+
}
|
|
72
|
+
const obj_offset = obj.offset;
|
|
73
|
+
const path_offset = path + '.offset';
|
|
74
|
+
if (typeof obj_offset !== 'string') {
|
|
75
|
+
return new TypeError('Expected "string" but received "' + typeof obj_offset + '" (at "' + path_offset + '")');
|
|
76
|
+
}
|
|
77
|
+
const obj_timezoneId = obj.timezoneId;
|
|
78
|
+
const path_timezoneId = path + '.timezoneId';
|
|
79
|
+
if (typeof obj_timezoneId !== 'string') {
|
|
80
|
+
return new TypeError('Expected "string" but received "' + typeof obj_timezoneId + '" (at "' + path_timezoneId + '")');
|
|
81
|
+
}
|
|
82
|
+
})();
|
|
83
|
+
return v_error === undefined ? null : v_error;
|
|
84
|
+
}
|
|
85
|
+
function deepFreeze$1(input) {
|
|
86
|
+
ObjectFreeze(input);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
const VERSION = "e0cab40b3591377c632eb866ff79268c";
|
|
90
|
-
function validate(obj, path = 'TimezoneOutputRepresentation') {
|
|
91
|
-
const v_error = (() => {
|
|
92
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
93
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
94
|
-
}
|
|
95
|
-
const obj_timezones = obj.timezones;
|
|
96
|
-
const path_timezones = path + '.timezones';
|
|
97
|
-
if (!ArrayIsArray(obj_timezones)) {
|
|
98
|
-
return new TypeError('Expected "array" but received "' + typeof obj_timezones + '" (at "' + path_timezones + '")');
|
|
99
|
-
}
|
|
100
|
-
for (let i = 0; i < obj_timezones.length; i++) {
|
|
101
|
-
const obj_timezones_item = obj_timezones[i];
|
|
102
|
-
const path_timezones_item = path_timezones + '[' + i + ']';
|
|
103
|
-
const referencepath_timezones_itemValidationError = validate$1(obj_timezones_item, path_timezones_item);
|
|
104
|
-
if (referencepath_timezones_itemValidationError !== null) {
|
|
105
|
-
let message = 'Object doesn\'t match TimezoneRepresentation (at "' + path_timezones_item + '")\n';
|
|
106
|
-
message += referencepath_timezones_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
107
|
-
return new TypeError(message);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
})();
|
|
111
|
-
return v_error === undefined ? null : v_error;
|
|
112
|
-
}
|
|
113
|
-
const RepresentationType = 'TimezoneOutputRepresentation';
|
|
114
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
115
|
-
return input;
|
|
116
|
-
}
|
|
117
|
-
const select$1 = function TimezoneOutputRepresentationSelect() {
|
|
118
|
-
return {
|
|
119
|
-
kind: 'Fragment',
|
|
120
|
-
version: VERSION,
|
|
121
|
-
private: [],
|
|
122
|
-
opaque: true
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
function equals(existing, incoming) {
|
|
126
|
-
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
function deepFreeze(input) {
|
|
132
|
-
const input_timezones = input.timezones;
|
|
133
|
-
for (let i = 0; i < input_timezones.length; i++) {
|
|
134
|
-
const input_timezones_item = input_timezones[i];
|
|
135
|
-
deepFreeze$1(input_timezones_item);
|
|
136
|
-
}
|
|
137
|
-
ObjectFreeze(input_timezones);
|
|
138
|
-
ObjectFreeze(input);
|
|
139
|
-
}
|
|
140
|
-
const ingest = function TimezoneOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
141
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
142
|
-
const validateError = validate(input);
|
|
143
|
-
if (validateError !== null) {
|
|
144
|
-
throw validateError;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const key = path.fullPath;
|
|
148
|
-
const existingRecord = store.readEntry(key);
|
|
149
|
-
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
150
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
151
|
-
fullPath: key,
|
|
152
|
-
parent: path.parent,
|
|
153
|
-
propertyName: path.propertyName,
|
|
154
|
-
ttl: ttlToUse
|
|
155
|
-
});
|
|
156
|
-
deepFreeze(input);
|
|
157
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
158
|
-
luvio.storePublish(key, incomingRecord);
|
|
159
|
-
}
|
|
160
|
-
if (ttlToUse !== undefined) {
|
|
161
|
-
const storeMetadataParams = {
|
|
162
|
-
ttl: ttlToUse,
|
|
163
|
-
namespace: "platformi18n",
|
|
164
|
-
version: VERSION,
|
|
165
|
-
representationName: RepresentationType,
|
|
166
|
-
};
|
|
167
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
168
|
-
}
|
|
169
|
-
return createLink(key);
|
|
170
|
-
};
|
|
171
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
172
|
-
const rootKeySet = new StoreKeyMap();
|
|
173
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
174
|
-
const rootKey = fullPathFactory();
|
|
175
|
-
rootKeySet.set(rootKey, {
|
|
176
|
-
namespace: keyPrefix,
|
|
177
|
-
representationName: RepresentationType,
|
|
178
|
-
mergeable: false
|
|
179
|
-
});
|
|
180
|
-
return rootKeySet;
|
|
89
|
+
const VERSION = "e0cab40b3591377c632eb866ff79268c";
|
|
90
|
+
function validate(obj, path = 'TimezoneOutputRepresentation') {
|
|
91
|
+
const v_error = (() => {
|
|
92
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
93
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
94
|
+
}
|
|
95
|
+
const obj_timezones = obj.timezones;
|
|
96
|
+
const path_timezones = path + '.timezones';
|
|
97
|
+
if (!ArrayIsArray(obj_timezones)) {
|
|
98
|
+
return new TypeError('Expected "array" but received "' + typeof obj_timezones + '" (at "' + path_timezones + '")');
|
|
99
|
+
}
|
|
100
|
+
for (let i = 0; i < obj_timezones.length; i++) {
|
|
101
|
+
const obj_timezones_item = obj_timezones[i];
|
|
102
|
+
const path_timezones_item = path_timezones + '[' + i + ']';
|
|
103
|
+
const referencepath_timezones_itemValidationError = validate$1(obj_timezones_item, path_timezones_item);
|
|
104
|
+
if (referencepath_timezones_itemValidationError !== null) {
|
|
105
|
+
let message = 'Object doesn\'t match TimezoneRepresentation (at "' + path_timezones_item + '")\n';
|
|
106
|
+
message += referencepath_timezones_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
107
|
+
return new TypeError(message);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
return v_error === undefined ? null : v_error;
|
|
112
|
+
}
|
|
113
|
+
const RepresentationType = 'TimezoneOutputRepresentation';
|
|
114
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
115
|
+
return input;
|
|
116
|
+
}
|
|
117
|
+
const select$1 = function TimezoneOutputRepresentationSelect() {
|
|
118
|
+
return {
|
|
119
|
+
kind: 'Fragment',
|
|
120
|
+
version: VERSION,
|
|
121
|
+
private: [],
|
|
122
|
+
opaque: true
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
function equals(existing, incoming) {
|
|
126
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
function deepFreeze(input) {
|
|
132
|
+
const input_timezones = input.timezones;
|
|
133
|
+
for (let i = 0; i < input_timezones.length; i++) {
|
|
134
|
+
const input_timezones_item = input_timezones[i];
|
|
135
|
+
deepFreeze$1(input_timezones_item);
|
|
136
|
+
}
|
|
137
|
+
ObjectFreeze(input_timezones);
|
|
138
|
+
ObjectFreeze(input);
|
|
139
|
+
}
|
|
140
|
+
const ingest = function TimezoneOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
141
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
142
|
+
const validateError = validate(input);
|
|
143
|
+
if (validateError !== null) {
|
|
144
|
+
throw validateError;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const key = path.fullPath;
|
|
148
|
+
const existingRecord = store.readEntry(key);
|
|
149
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
150
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
151
|
+
fullPath: key,
|
|
152
|
+
parent: path.parent,
|
|
153
|
+
propertyName: path.propertyName,
|
|
154
|
+
ttl: ttlToUse
|
|
155
|
+
});
|
|
156
|
+
deepFreeze(input);
|
|
157
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
158
|
+
luvio.storePublish(key, incomingRecord);
|
|
159
|
+
}
|
|
160
|
+
if (ttlToUse !== undefined) {
|
|
161
|
+
const storeMetadataParams = {
|
|
162
|
+
ttl: ttlToUse,
|
|
163
|
+
namespace: "platformi18n",
|
|
164
|
+
version: VERSION,
|
|
165
|
+
representationName: RepresentationType,
|
|
166
|
+
};
|
|
167
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
168
|
+
}
|
|
169
|
+
return createLink(key);
|
|
170
|
+
};
|
|
171
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
172
|
+
const rootKeySet = new StoreKeyMap();
|
|
173
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
174
|
+
const rootKey = fullPathFactory();
|
|
175
|
+
rootKeySet.set(rootKey, {
|
|
176
|
+
namespace: keyPrefix,
|
|
177
|
+
representationName: RepresentationType,
|
|
178
|
+
mergeable: false
|
|
179
|
+
});
|
|
180
|
+
return rootKeySet;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
function select(luvio, params) {
|
|
184
|
-
return select$1();
|
|
185
|
-
}
|
|
186
|
-
function keyBuilder$1(luvio, params) {
|
|
187
|
-
return keyPrefix + '::TimezoneOutputRepresentation:(' + 'locale:' + params.urlParams.locale + ')';
|
|
188
|
-
}
|
|
189
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
190
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
191
|
-
}
|
|
192
|
-
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
193
|
-
const { body } = response;
|
|
194
|
-
const key = keyBuilder$1(luvio, resourceParams);
|
|
195
|
-
luvio.storeIngest(key, ingest, body);
|
|
196
|
-
const snapshot = luvio.storeLookup({
|
|
197
|
-
recordId: key,
|
|
198
|
-
node: select(),
|
|
199
|
-
variables: {},
|
|
200
|
-
}, snapshotRefresh);
|
|
201
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
202
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
203
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return snapshot;
|
|
207
|
-
}
|
|
208
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
209
|
-
const key = keyBuilder$1(luvio, params);
|
|
210
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
211
|
-
luvio.storeIngestError(key, errorSnapshot);
|
|
212
|
-
return errorSnapshot;
|
|
213
|
-
}
|
|
214
|
-
function createResourceRequest(config) {
|
|
215
|
-
const headers = {};
|
|
216
|
-
return {
|
|
217
|
-
baseUri: '/services/data/v58.0',
|
|
218
|
-
basePath: '/connect/i18n/timezones/' + config.urlParams.locale + '',
|
|
219
|
-
method: 'get',
|
|
220
|
-
body: null,
|
|
221
|
-
urlParams: config.urlParams,
|
|
222
|
-
queryParams: {},
|
|
223
|
-
headers,
|
|
224
|
-
priority: 'normal',
|
|
225
|
-
};
|
|
183
|
+
function select(luvio, params) {
|
|
184
|
+
return select$1();
|
|
185
|
+
}
|
|
186
|
+
function keyBuilder$1(luvio, params) {
|
|
187
|
+
return keyPrefix + '::TimezoneOutputRepresentation:(' + 'locale:' + params.urlParams.locale + ')';
|
|
188
|
+
}
|
|
189
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
190
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
191
|
+
}
|
|
192
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
193
|
+
const { body } = response;
|
|
194
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
195
|
+
luvio.storeIngest(key, ingest, body);
|
|
196
|
+
const snapshot = luvio.storeLookup({
|
|
197
|
+
recordId: key,
|
|
198
|
+
node: select(),
|
|
199
|
+
variables: {},
|
|
200
|
+
}, snapshotRefresh);
|
|
201
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
202
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
203
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return snapshot;
|
|
207
|
+
}
|
|
208
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
209
|
+
const key = keyBuilder$1(luvio, params);
|
|
210
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
211
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
212
|
+
return errorSnapshot;
|
|
213
|
+
}
|
|
214
|
+
function createResourceRequest(config) {
|
|
215
|
+
const headers = {};
|
|
216
|
+
return {
|
|
217
|
+
baseUri: '/services/data/v58.0',
|
|
218
|
+
basePath: '/connect/i18n/timezones/' + config.urlParams.locale + '',
|
|
219
|
+
method: 'get',
|
|
220
|
+
body: null,
|
|
221
|
+
urlParams: config.urlParams,
|
|
222
|
+
queryParams: {},
|
|
223
|
+
headers,
|
|
224
|
+
priority: 'normal',
|
|
225
|
+
};
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
const getTimezonesByLocale_ConfigPropertyNames = {
|
|
229
|
-
displayName: 'getTimezonesByLocale',
|
|
230
|
-
parameters: {
|
|
231
|
-
required: ['locale'],
|
|
232
|
-
optional: []
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
function createResourceParams(config) {
|
|
236
|
-
const resourceParams = {
|
|
237
|
-
urlParams: {
|
|
238
|
-
locale: config.locale
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
return resourceParams;
|
|
242
|
-
}
|
|
243
|
-
function keyBuilder(luvio, config) {
|
|
244
|
-
const resourceParams = createResourceParams(config);
|
|
245
|
-
return keyBuilder$1(luvio, resourceParams);
|
|
246
|
-
}
|
|
247
|
-
function typeCheckConfig(untrustedConfig) {
|
|
248
|
-
const config = {};
|
|
249
|
-
const untrustedConfig_locale = untrustedConfig.locale;
|
|
250
|
-
if (typeof untrustedConfig_locale === 'string') {
|
|
251
|
-
config.locale = untrustedConfig_locale;
|
|
252
|
-
}
|
|
253
|
-
return config;
|
|
254
|
-
}
|
|
255
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
256
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
260
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
261
|
-
}
|
|
262
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
263
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
264
|
-
return null;
|
|
265
|
-
}
|
|
266
|
-
return config;
|
|
267
|
-
}
|
|
268
|
-
function adapterFragment(luvio, config) {
|
|
269
|
-
createResourceParams(config);
|
|
270
|
-
return select();
|
|
271
|
-
}
|
|
272
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
273
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
274
|
-
config,
|
|
275
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
276
|
-
});
|
|
277
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
278
|
-
}
|
|
279
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
280
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
281
|
-
config,
|
|
282
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
283
|
-
});
|
|
284
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
285
|
-
}
|
|
286
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
287
|
-
const resourceParams = createResourceParams(config);
|
|
288
|
-
const request = createResourceRequest(resourceParams);
|
|
289
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
290
|
-
.then((response) => {
|
|
291
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
292
|
-
}, (response) => {
|
|
293
|
-
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
297
|
-
const { luvio, config } = context;
|
|
298
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
299
|
-
const dispatchOptions = {
|
|
300
|
-
resourceRequestContext: {
|
|
301
|
-
requestCorrelator,
|
|
302
|
-
luvioRequestMethod: undefined,
|
|
303
|
-
},
|
|
304
|
-
eventObservers
|
|
305
|
-
};
|
|
306
|
-
if (networkPriority !== 'normal') {
|
|
307
|
-
dispatchOptions.overrides = {
|
|
308
|
-
priority: networkPriority
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
312
|
-
}
|
|
313
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
314
|
-
const { luvio, config } = context;
|
|
315
|
-
const selector = {
|
|
316
|
-
recordId: keyBuilder(luvio, config),
|
|
317
|
-
node: adapterFragment(luvio, config),
|
|
318
|
-
variables: {},
|
|
319
|
-
};
|
|
320
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
321
|
-
config,
|
|
322
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
323
|
-
});
|
|
324
|
-
return cacheSnapshot;
|
|
325
|
-
}
|
|
326
|
-
const getTimezonesByLocaleAdapterFactory = (luvio) => function platformi18n__getTimezonesByLocale(untrustedConfig, requestContext) {
|
|
327
|
-
const config = validateAdapterConfig(untrustedConfig, getTimezonesByLocale_ConfigPropertyNames);
|
|
328
|
-
// Invalid or incomplete config
|
|
329
|
-
if (config === null) {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
333
|
-
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
228
|
+
const getTimezonesByLocale_ConfigPropertyNames = {
|
|
229
|
+
displayName: 'getTimezonesByLocale',
|
|
230
|
+
parameters: {
|
|
231
|
+
required: ['locale'],
|
|
232
|
+
optional: []
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
function createResourceParams(config) {
|
|
236
|
+
const resourceParams = {
|
|
237
|
+
urlParams: {
|
|
238
|
+
locale: config.locale
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
return resourceParams;
|
|
242
|
+
}
|
|
243
|
+
function keyBuilder(luvio, config) {
|
|
244
|
+
const resourceParams = createResourceParams(config);
|
|
245
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
246
|
+
}
|
|
247
|
+
function typeCheckConfig(untrustedConfig) {
|
|
248
|
+
const config = {};
|
|
249
|
+
const untrustedConfig_locale = untrustedConfig.locale;
|
|
250
|
+
if (typeof untrustedConfig_locale === 'string') {
|
|
251
|
+
config.locale = untrustedConfig_locale;
|
|
252
|
+
}
|
|
253
|
+
return config;
|
|
254
|
+
}
|
|
255
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
256
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
260
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
261
|
+
}
|
|
262
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
263
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return config;
|
|
267
|
+
}
|
|
268
|
+
function adapterFragment(luvio, config) {
|
|
269
|
+
createResourceParams(config);
|
|
270
|
+
return select();
|
|
271
|
+
}
|
|
272
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
273
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
274
|
+
config,
|
|
275
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
276
|
+
});
|
|
277
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
278
|
+
}
|
|
279
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
280
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
281
|
+
config,
|
|
282
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
283
|
+
});
|
|
284
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
285
|
+
}
|
|
286
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
287
|
+
const resourceParams = createResourceParams(config);
|
|
288
|
+
const request = createResourceRequest(resourceParams);
|
|
289
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
290
|
+
.then((response) => {
|
|
291
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
292
|
+
}, (response) => {
|
|
293
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
297
|
+
const { luvio, config } = context;
|
|
298
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
299
|
+
const dispatchOptions = {
|
|
300
|
+
resourceRequestContext: {
|
|
301
|
+
requestCorrelator,
|
|
302
|
+
luvioRequestMethod: undefined,
|
|
303
|
+
},
|
|
304
|
+
eventObservers
|
|
305
|
+
};
|
|
306
|
+
if (networkPriority !== 'normal') {
|
|
307
|
+
dispatchOptions.overrides = {
|
|
308
|
+
priority: networkPriority
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
312
|
+
}
|
|
313
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
314
|
+
const { luvio, config } = context;
|
|
315
|
+
const selector = {
|
|
316
|
+
recordId: keyBuilder(luvio, config),
|
|
317
|
+
node: adapterFragment(luvio, config),
|
|
318
|
+
variables: {},
|
|
319
|
+
};
|
|
320
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
321
|
+
config,
|
|
322
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
323
|
+
});
|
|
324
|
+
return cacheSnapshot;
|
|
325
|
+
}
|
|
326
|
+
const getTimezonesByLocaleAdapterFactory = (luvio) => function platformi18n__getTimezonesByLocale(untrustedConfig, requestContext) {
|
|
327
|
+
const config = validateAdapterConfig(untrustedConfig, getTimezonesByLocale_ConfigPropertyNames);
|
|
328
|
+
// Invalid or incomplete config
|
|
329
|
+
if (config === null) {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
333
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
334
334
|
};
|
|
335
335
|
|
|
336
336
|
export { getTimezonesByLocaleAdapterFactory };
|