@salesforce/lds-adapters-platform-i18n 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const VERSION = "6d8ba01c7f793414ae1851586d6a5b41";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: StateCountryOutputRepresentation, existing: StateCountryOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): StateCountryOutputRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: StateCountryOutputRepresentationNormalized, incoming: StateCountryOutputRepresentationNormalized): boolean;
8
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
9
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: StateCountryOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Representation for StateAndCountryTranslations
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface StateCountryOutputRepresentationNormalized {
17
+ /** List of Countries and respective states in localized way. */
18
+ addressCountry: Array<string>;
19
+ }
20
+ /**
21
+ * Representation for StateAndCountryTranslations
22
+ *
23
+ * Keys:
24
+ * (none)
25
+ */
26
+ export interface StateCountryOutputRepresentation {
27
+ addressCountry: Array<string>;
28
+ }
@@ -0,0 +1,29 @@
1
+ import { AddressCountry as AddressCountry_AddressCountry } from './AddressCountry';
2
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
3
+ export declare const VERSION = "0db6faae5abb89caea1827510cb103f4";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export declare function normalize(input: StateCountryTranslations, existing: StateCountryTranslationsNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): StateCountryTranslationsNormalized;
7
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
8
+ export declare function equals(existing: StateCountryTranslationsNormalized, incoming: StateCountryTranslationsNormalized): boolean;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: StateCountryTranslations, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Output representations of State and Country translations APIs response.
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface StateCountryTranslationsNormalized {
18
+ /** List of addressCountries. */
19
+ addressCountries: Array<AddressCountry_AddressCountry>;
20
+ }
21
+ /**
22
+ * Output representations of State and Country translations APIs response.
23
+ *
24
+ * Keys:
25
+ * (none)
26
+ */
27
+ export interface StateCountryTranslations {
28
+ addressCountries: Array<AddressCountry_AddressCountry>;
29
+ }
@@ -0,0 +1,29 @@
1
+ import { TimezoneRepresentation as TimezoneRepresentation_TimezoneRepresentation } from './TimezoneRepresentation';
2
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, BaseFragment as $64$luvio_engine_BaseFragment, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
3
+ export declare const VERSION = "e0cab40b3591377c632eb866ff79268c";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export declare function normalize(input: TimezoneOutputRepresentation, existing: TimezoneOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): TimezoneOutputRepresentationNormalized;
7
+ export declare const select: () => $64$luvio_engine_BaseFragment;
8
+ export declare function equals(existing: TimezoneOutputRepresentationNormalized, incoming: TimezoneOutputRepresentationNormalized): boolean;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: TimezoneOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Representation of Timezone localized list.
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface TimezoneOutputRepresentationNormalized {
18
+ /** List of Timezones with localized labels. */
19
+ timezones: Array<TimezoneRepresentation_TimezoneRepresentation>;
20
+ }
21
+ /**
22
+ * Representation of Timezone localized list.
23
+ *
24
+ * Keys:
25
+ * (none)
26
+ */
27
+ export interface TimezoneOutputRepresentation {
28
+ timezones: Array<TimezoneRepresentation_TimezoneRepresentation>;
29
+ }
@@ -0,0 +1,34 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const VERSION = "eb44fdaeb6edec41fe1bd509f0b9bced";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: TimezoneRepresentation, existing: TimezoneRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): TimezoneRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: TimezoneRepresentationNormalized, incoming: TimezoneRepresentationNormalized): boolean;
8
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
9
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: TimezoneRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Representation of Timezone
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface TimezoneRepresentationNormalized {
17
+ /** Timezone localized display label. */
18
+ displayLabel: string;
19
+ /** Timezone Offset. */
20
+ offset: string;
21
+ /** Timezone Id. */
22
+ timezoneId: string;
23
+ }
24
+ /**
25
+ * Representation of Timezone
26
+ *
27
+ * Keys:
28
+ * (none)
29
+ */
30
+ export interface TimezoneRepresentation {
31
+ displayLabel: string;
32
+ offset: string;
33
+ timezoneId: string;
34
+ }
@@ -0,0 +1,32 @@
1
+ import { NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const ObjectKeys: {
3
+ (o: object): string[];
4
+ (o: {}): string[];
5
+ }, ObjectCreate: {
6
+ (o: object | null): any;
7
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
8
+ }, ObjectAssign: {
9
+ <T extends {}, U>(target: T, source: U): T & U;
10
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
11
+ <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
12
+ (target: object, ...sources: any[]): any;
13
+ };
14
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
15
+ export declare const JSONStringify: {
16
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
17
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
18
+ };
19
+ type AllowedPrimitives = boolean | string | number | Date | null;
20
+ type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
21
+ export type RecursivePartial<T> = null | {
22
+ [P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> | null : Value<T[P]> | null;
23
+ };
24
+ export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (itemA: U, itemB: U) => boolean | void): boolean;
25
+ export declare function equalsObject<U, V extends {
26
+ [key: string]: U;
27
+ }>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
28
+ export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
29
+ __ref: string;
30
+ };
31
+ export declare function assignMetadataLink(entry: any, metadataKey: string | $64$luvio_engine_NormalizedKeyMetadata): void;
32
+ export {};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@salesforce/lds-adapters-platform-i18n",
3
+ "version": "0.1.0-dev1",
4
+ "description": "Glboalization Services",
5
+ "license": "MIT",
6
+ "main": "dist/es/es2018/platform-i18n.js",
7
+ "module": "dist/es/es2018/platform-i18n.js",
8
+ "types": "dist/es/es2018/types/src/generated/artifacts/main.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "sfdc",
12
+ "src/raml/*"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/es/es2018/types/src/generated/artifacts/main.d.ts",
17
+ "import": "./dist/es/es2018/platform-i18n.js",
18
+ "require": "./dist/es/es2018/platform-i18n.js"
19
+ },
20
+ "./sfdc": {
21
+ "types": "./sfdc/index.d.ts",
22
+ "import": "./sfdc/index.js",
23
+ "default": "./sfdc/index.js"
24
+ }
25
+ },
26
+ "contributors": [
27
+ "hnagpure@salesforce.com"
28
+ ],
29
+ "scripts": {
30
+ "build": "yarn build:services",
31
+ "build:karma": "rollup --bundleConfigAsCjs --config rollup.config.karma.js",
32
+ "build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
33
+ "build:services": "rollup --bundleConfigAsCjs --config rollup.config.js",
34
+ "clean": "rm -rf dist sfdc src/generated karma/dist",
35
+ "start": "nx build:karma && karma start",
36
+ "test": "nx build:karma && karma start --single-run",
37
+ "release:core": "../../scripts/release/core.js --adapter=lds-adapters-platform-i18n"
38
+ },
39
+ "dependencies": {
40
+ "@salesforce/lds-bindings": "^0.1.0-dev1"
41
+ },
42
+ "devDependencies": {
43
+ "@salesforce/lds-compiler-plugins": "^0.1.0-dev1",
44
+ "@salesforce/lds-karma": "^0.1.0-dev1"
45
+ },
46
+ "nx": {
47
+ "targets": {
48
+ "build": {
49
+ "outputs": [
50
+ "{projectRoot}/dist",
51
+ "{projectRoot}/sfdc"
52
+ ]
53
+ },
54
+ "build:raml": {
55
+ "outputs": [
56
+ "{projectRoot}/src/generated"
57
+ ]
58
+ },
59
+ "build:karma": {
60
+ "outputs": [
61
+ "{projectRoot}/karma/dist"
62
+ ]
63
+ }
64
+ }
65
+ },
66
+ "volta": {
67
+ "extends": "../../package.json"
68
+ }
69
+ }
@@ -0,0 +1 @@
1
+ export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
package/sfdc/index.js ADDED
@@ -0,0 +1,333 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /*
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ resourceType,
66
+ typeCheckShape,
67
+ isArrayShape,
68
+ coerceFn,
69
+ };
70
+ }
71
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
72
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
73
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
74
+ return {
75
+ displayName,
76
+ parameters: {
77
+ required,
78
+ optional,
79
+ }
80
+ };
81
+ }
82
+ const keyPrefix = 'platformi18n';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ const { stringify: JSONStringify } = JSON;
86
+ function createLink(ref) {
87
+ return {
88
+ __ref: serializeStructuredKey(ref),
89
+ };
90
+ }
91
+
92
+ function validate$1(obj, path = 'TimezoneRepresentation') {
93
+ const v_error = (() => {
94
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
95
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
96
+ }
97
+ const obj_displayLabel = obj.displayLabel;
98
+ const path_displayLabel = path + '.displayLabel';
99
+ if (typeof obj_displayLabel !== 'string') {
100
+ return new TypeError('Expected "string" but received "' + typeof obj_displayLabel + '" (at "' + path_displayLabel + '")');
101
+ }
102
+ const obj_offset = obj.offset;
103
+ const path_offset = path + '.offset';
104
+ if (typeof obj_offset !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_offset + '" (at "' + path_offset + '")');
106
+ }
107
+ const obj_timezoneId = obj.timezoneId;
108
+ const path_timezoneId = path + '.timezoneId';
109
+ if (typeof obj_timezoneId !== 'string') {
110
+ return new TypeError('Expected "string" but received "' + typeof obj_timezoneId + '" (at "' + path_timezoneId + '")');
111
+ }
112
+ })();
113
+ return v_error === undefined ? null : v_error;
114
+ }
115
+
116
+ const VERSION = "e0cab40b3591377c632eb866ff79268c";
117
+ function validate(obj, path = 'TimezoneOutputRepresentation') {
118
+ const v_error = (() => {
119
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
120
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
121
+ }
122
+ const obj_timezones = obj.timezones;
123
+ const path_timezones = path + '.timezones';
124
+ if (!ArrayIsArray(obj_timezones)) {
125
+ return new TypeError('Expected "array" but received "' + typeof obj_timezones + '" (at "' + path_timezones + '")');
126
+ }
127
+ for (let i = 0; i < obj_timezones.length; i++) {
128
+ const obj_timezones_item = obj_timezones[i];
129
+ const path_timezones_item = path_timezones + '[' + i + ']';
130
+ const referencepath_timezones_itemValidationError = validate$1(obj_timezones_item, path_timezones_item);
131
+ if (referencepath_timezones_itemValidationError !== null) {
132
+ let message = 'Object doesn\'t match TimezoneRepresentation (at "' + path_timezones_item + '")\n';
133
+ message += referencepath_timezones_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
134
+ return new TypeError(message);
135
+ }
136
+ }
137
+ })();
138
+ return v_error === undefined ? null : v_error;
139
+ }
140
+ const RepresentationType = 'TimezoneOutputRepresentation';
141
+ function normalize(input, existing, path, luvio, store, timestamp) {
142
+ return input;
143
+ }
144
+ const select$1 = function TimezoneOutputRepresentationSelect() {
145
+ return {
146
+ kind: 'Fragment',
147
+ version: VERSION,
148
+ private: [],
149
+ opaque: true
150
+ };
151
+ };
152
+ function equals(existing, incoming) {
153
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
154
+ return false;
155
+ }
156
+ return true;
157
+ }
158
+ const ingest = function TimezoneOutputRepresentationIngest(input, path, luvio, store, timestamp) {
159
+ if (process.env.NODE_ENV !== 'production') {
160
+ const validateError = validate(input);
161
+ if (validateError !== null) {
162
+ throw validateError;
163
+ }
164
+ }
165
+ const key = path.fullPath;
166
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
167
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "platformi18n", VERSION, RepresentationType, equals);
168
+ return createLink(key);
169
+ };
170
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
171
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
172
+ const rootKey = fullPathFactory();
173
+ rootKeySet.set(rootKey, {
174
+ namespace: keyPrefix,
175
+ representationName: RepresentationType,
176
+ mergeable: false
177
+ });
178
+ }
179
+
180
+ function select(luvio, params) {
181
+ return select$1();
182
+ }
183
+ function keyBuilder$1(luvio, params) {
184
+ return keyPrefix + '::TimezoneOutputRepresentation:(' + 'locale:' + params.urlParams.locale + ')';
185
+ }
186
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
187
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
188
+ }
189
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
190
+ const { body } = response;
191
+ const key = keyBuilder$1(luvio, resourceParams);
192
+ luvio.storeIngest(key, ingest, body);
193
+ const snapshot = luvio.storeLookup({
194
+ recordId: key,
195
+ node: select(),
196
+ variables: {},
197
+ }, snapshotRefresh);
198
+ if (process.env.NODE_ENV !== 'production') {
199
+ if (snapshot.state !== 'Fulfilled') {
200
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
201
+ }
202
+ }
203
+ deepFreeze(snapshot.data);
204
+ return snapshot;
205
+ }
206
+ function ingestError(luvio, params, error, snapshotRefresh) {
207
+ const key = keyBuilder$1(luvio, params);
208
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
209
+ luvio.storeIngestError(key, errorSnapshot);
210
+ return errorSnapshot;
211
+ }
212
+ function createResourceRequest(config) {
213
+ const headers = {};
214
+ return {
215
+ baseUri: '/services/data/v66.0',
216
+ basePath: '/connect/i18n/timezones/' + config.urlParams.locale + '',
217
+ method: 'get',
218
+ body: null,
219
+ urlParams: config.urlParams,
220
+ queryParams: {},
221
+ headers,
222
+ priority: 'normal',
223
+ };
224
+ }
225
+
226
+ const adapterName = 'getTimezonesByLocale';
227
+ const getTimezonesByLocale_ConfigPropertyMetadata = [
228
+ generateParamConfigMetadata('locale', true, 0 /* UrlParameter */, 0 /* String */),
229
+ ];
230
+ const getTimezonesByLocale_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getTimezonesByLocale_ConfigPropertyMetadata);
231
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(getTimezonesByLocale_ConfigPropertyMetadata);
232
+ function keyBuilder(luvio, config) {
233
+ const resourceParams = createResourceParams(config);
234
+ return keyBuilder$1(luvio, resourceParams);
235
+ }
236
+ function typeCheckConfig(untrustedConfig) {
237
+ const config = {};
238
+ typeCheckConfig$1(untrustedConfig, config, getTimezonesByLocale_ConfigPropertyMetadata);
239
+ return config;
240
+ }
241
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
242
+ if (!untrustedIsObject(untrustedConfig)) {
243
+ return null;
244
+ }
245
+ if (process.env.NODE_ENV !== 'production') {
246
+ validateConfig(untrustedConfig, configPropertyNames);
247
+ }
248
+ const config = typeCheckConfig(untrustedConfig);
249
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
250
+ return null;
251
+ }
252
+ return config;
253
+ }
254
+ function adapterFragment(luvio, config) {
255
+ createResourceParams(config);
256
+ return select();
257
+ }
258
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
259
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
260
+ config,
261
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
262
+ });
263
+ return luvio.storeBroadcast().then(() => snapshot);
264
+ }
265
+ function onFetchResponseError(luvio, config, resourceParams, response) {
266
+ const snapshot = ingestError(luvio, resourceParams, response, {
267
+ config,
268
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
269
+ });
270
+ return luvio.storeBroadcast().then(() => snapshot);
271
+ }
272
+ function buildNetworkSnapshot(luvio, config, options) {
273
+ const resourceParams = createResourceParams(config);
274
+ const request = createResourceRequest(resourceParams);
275
+ return luvio.dispatchResourceRequest(request, options)
276
+ .then((response) => {
277
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
278
+ const cache = new StoreKeyMap();
279
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
280
+ return cache;
281
+ });
282
+ }, (response) => {
283
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
284
+ });
285
+ }
286
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
287
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
288
+ }
289
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
290
+ const { luvio, config } = context;
291
+ const selector = {
292
+ recordId: keyBuilder(luvio, config),
293
+ node: adapterFragment(luvio, config),
294
+ variables: {},
295
+ };
296
+ const cacheSnapshot = storeLookup(selector, {
297
+ config,
298
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
299
+ });
300
+ return cacheSnapshot;
301
+ }
302
+ const getTimezonesByLocaleAdapterFactory = (luvio) => function platformi18n__getTimezonesByLocale(untrustedConfig, requestContext) {
303
+ const config = validateAdapterConfig(untrustedConfig, getTimezonesByLocale_ConfigPropertyNames);
304
+ // Invalid or incomplete config
305
+ if (config === null) {
306
+ return null;
307
+ }
308
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
309
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
310
+ };
311
+
312
+ let getTimezonesByLocale;
313
+ // Imperative GET Adapters
314
+ let getTimezonesByLocale_imperative;
315
+ // Adapter Metadata
316
+ const getTimezonesByLocaleMetadata = { apiFamily: 'platformi18n', name: 'getTimezonesByLocale' };
317
+ // Notify Update Available
318
+ function bindExportsTo(luvio) {
319
+ // LDS Adapters
320
+ const getTimezonesByLocale_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getTimezonesByLocale', getTimezonesByLocaleAdapterFactory), getTimezonesByLocaleMetadata);
321
+ return {
322
+ getTimezonesByLocale: createWireAdapterConstructor(luvio, getTimezonesByLocale_ldsAdapter, getTimezonesByLocaleMetadata),
323
+ // Imperative GET Adapters
324
+ getTimezonesByLocale_imperative: createImperativeAdapter(luvio, getTimezonesByLocale_ldsAdapter, getTimezonesByLocaleMetadata),
325
+ // Notify Update Availables
326
+ };
327
+ }
328
+ withDefaultLuvio((luvio) => {
329
+ ({ getTimezonesByLocale, getTimezonesByLocale_imperative } = bindExportsTo(luvio));
330
+ });
331
+
332
+ export { getTimezonesByLocale, getTimezonesByLocale_imperative };
333
+ // version: 0.1.0-dev1-c978a7b010