@salesforce/lds-adapters-platform-i18n 0.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
2
+ export declare const VERSION = "53d515f4801c9d0c566d8dabb6f3fbfd";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: StateCountryInputRequest, existing: StateCountryInputRequestNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): StateCountryInputRequestNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: StateCountryInputRequestNormalized, incoming: StateCountryInputRequestNormalized): boolean;
8
+ export declare function deepFreeze(input: StateCountryInputRequest): void;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: StateCountryInputRequest, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
+ /**
12
+ * Input Representation to get locale and filter params for State and Country list API.
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface StateCountryInputRequestNormalized {
18
+ /** Property representing the list of countries to skip from output. */
19
+ countries: Array<string>;
20
+ /** Property representing the filter type */
21
+ filterType: string;
22
+ /** Property representing the locale for translation. */
23
+ locale: string;
24
+ /** Property representing the list of states to skip from the output. */
25
+ states: Array<string>;
26
+ }
27
+ /**
28
+ * Input Representation to get locale and filter params for State and Country list API.
29
+ *
30
+ * Keys:
31
+ * (none)
32
+ */
33
+ export interface StateCountryInputRequest {
34
+ countries: Array<string>;
35
+ filterType: string;
36
+ locale: string;
37
+ states: Array<string>;
38
+ }
@@ -0,0 +1,29 @@
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } 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 function deepFreeze(input: StateCountryOutputRepresentation): void;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: StateCountryOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
+ /**
12
+ * Representation for StateAndCountryTranslations
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface StateCountryOutputRepresentationNormalized {
18
+ /** List of Countries and respective states in localized way. */
19
+ addressCountry: Array<string>;
20
+ }
21
+ /**
22
+ * Representation for StateAndCountryTranslations
23
+ *
24
+ * Keys:
25
+ * (none)
26
+ */
27
+ export interface StateCountryOutputRepresentation {
28
+ addressCountry: Array<string>;
29
+ }
@@ -0,0 +1,30 @@
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } 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 function deepFreeze(input: StateCountryTranslations): void;
10
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
11
+ export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: StateCountryTranslations, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
12
+ /**
13
+ * Output representations of State and Country translations APIs response.
14
+ *
15
+ * Keys:
16
+ * (none)
17
+ */
18
+ export interface StateCountryTranslationsNormalized {
19
+ /** List of addressCountries. */
20
+ addressCountries: Array<AddressCountry_AddressCountry>;
21
+ }
22
+ /**
23
+ * Output representations of State and Country translations APIs response.
24
+ *
25
+ * Keys:
26
+ * (none)
27
+ */
28
+ export interface StateCountryTranslations {
29
+ addressCountries: Array<AddressCountry_AddressCountry>;
30
+ }
@@ -0,0 +1,30 @@
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } 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 function deepFreeze(input: TimezoneOutputRepresentation): void;
10
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
11
+ export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: TimezoneOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
12
+ /**
13
+ * Representation of Timezone localized list.
14
+ *
15
+ * Keys:
16
+ * (none)
17
+ */
18
+ export interface TimezoneOutputRepresentationNormalized {
19
+ /** List of Timezones with localized labels. */
20
+ timezones: Array<TimezoneRepresentation_TimezoneRepresentation>;
21
+ }
22
+ /**
23
+ * Representation of Timezone localized list.
24
+ *
25
+ * Keys:
26
+ * (none)
27
+ */
28
+ export interface TimezoneOutputRepresentation {
29
+ timezones: Array<TimezoneRepresentation_TimezoneRepresentation>;
30
+ }
@@ -0,0 +1,35 @@
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } 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 function deepFreeze(input: TimezoneRepresentation): void;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: TimezoneRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
+ /**
12
+ * Representation of Timezone
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface TimezoneRepresentationNormalized {
18
+ /** Timezone localized display label. */
19
+ displayLabel: string;
20
+ /** Timezone Offset. */
21
+ offset: string;
22
+ /** Timezone Id. */
23
+ timezoneId: string;
24
+ }
25
+ /**
26
+ * Representation of Timezone
27
+ *
28
+ * Keys:
29
+ * (none)
30
+ */
31
+ export interface TimezoneRepresentation {
32
+ displayLabel: string;
33
+ offset: string;
34
+ timezoneId: string;
35
+ }
@@ -0,0 +1,39 @@
1
+ import { NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const ObjectFreeze: {
3
+ <T extends Function>(f: T): T;
4
+ <T_1 extends {
5
+ [idx: string]: object | U | null | undefined;
6
+ }, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
7
+ <T_2>(o: T_2): Readonly<T_2>;
8
+ }, ObjectKeys: {
9
+ (o: object): string[];
10
+ (o: {}): string[];
11
+ }, ObjectCreate: {
12
+ (o: object | null): any;
13
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
14
+ }, ObjectAssign: {
15
+ <T extends {}, U>(target: T, source: U): T & U;
16
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
17
+ <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;
18
+ (target: object, ...sources: any[]): any;
19
+ };
20
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
21
+ export declare const JSONStringify: {
22
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
23
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
24
+ };
25
+ type AllowedPrimitives = boolean | string | number | Date | null;
26
+ type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
27
+ export type RecursivePartial<T> = null | {
28
+ [P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> | null : Value<T[P]> | null;
29
+ };
30
+ export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (itemA: U, itemB: U) => boolean | void): boolean;
31
+ export declare function equalsObject<U, V extends {
32
+ [key: string]: U;
33
+ }>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
34
+ export declare function deepFreeze(value: any): void;
35
+ export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
36
+ __ref: string;
37
+ };
38
+ export declare function assignMetadataLink(entry: any, metadataKey: string | $64$luvio_engine_NormalizedKeyMetadata): void;
39
+ export {};
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@salesforce/lds-adapters-platform-i18n",
3
+ "version": "0.131.0",
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
+ "import": "./dist/es/es2018/platform-i18n.js",
17
+ "require": "./dist/es/es2018/platform-i18n.js",
18
+ "types": "./dist/es/es2018/types/src/generated/artifacts/main.d.ts"
19
+ },
20
+ "./sfdc": {
21
+ "import": "./sfdc/index.js",
22
+ "types": "./sfdc/index.d.ts",
23
+ "default": "./sfdc/index.js"
24
+ }
25
+ },
26
+ "contributors": [
27
+ "hnagpure@salesforce.com"
28
+ ],
29
+ "scripts": {
30
+ "build": "yarn build:raml && yarn build:services && yarn build:karma",
31
+ "build:karma": "rollup --config rollup.config.karma.js",
32
+ "build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
33
+ "build:services": "rollup --config rollup.config.js",
34
+ "clean": "rm -rf dist sfdc src/generated karma/dist",
35
+ "start": "karma start",
36
+ "test": "karma start --single-run",
37
+ "test:compat": "karma start --single-run --compat",
38
+ "release:core": "../../scripts/release/core.js --adapter=lds-adapters-platform-i18n"
39
+ },
40
+ "dependencies": {
41
+ "@salesforce/lds-bindings": "1.131.0-244.6"
42
+ },
43
+ "devDependencies": {
44
+ "@salesforce/lds-compiler-plugins": "1.131.0-244.6",
45
+ "@salesforce/lds-karma": "1.131.0-244.6"
46
+ },
47
+ "nx": {
48
+ "targets": {
49
+ "build": {
50
+ "outputs": [
51
+ "packages/lds-adapters-platform-i18n/dist",
52
+ "packages/lds-adapters-platform-i18n/karma/dist",
53
+ "packages/lds-adapters-platform-i18n/sfdc",
54
+ "packages/lds-adapters-platform-i18n/src/generated"
55
+ ]
56
+ }
57
+ }
58
+ },
59
+ "volta": {
60
+ "extends": "../../package.json"
61
+ }
62
+ }
@@ -0,0 +1 @@
1
+ export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
package/sfdc/index.js ADDED
@@ -0,0 +1,368 @@
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, StoreKeyMap } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = 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$1(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
+ const keyPrefix = 'platformi18n';
62
+
63
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
+ const { isArray: ArrayIsArray } = Array;
65
+ const { stringify: JSONStringify } = JSON;
66
+ function createLink(ref) {
67
+ return {
68
+ __ref: serializeStructuredKey(ref),
69
+ };
70
+ }
71
+
72
+ function validate$1(obj, path = 'TimezoneRepresentation') {
73
+ const v_error = (() => {
74
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
75
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
76
+ }
77
+ const obj_displayLabel = obj.displayLabel;
78
+ const path_displayLabel = path + '.displayLabel';
79
+ if (typeof obj_displayLabel !== 'string') {
80
+ return new TypeError('Expected "string" but received "' + typeof obj_displayLabel + '" (at "' + path_displayLabel + '")');
81
+ }
82
+ const obj_offset = obj.offset;
83
+ const path_offset = path + '.offset';
84
+ if (typeof obj_offset !== 'string') {
85
+ return new TypeError('Expected "string" but received "' + typeof obj_offset + '" (at "' + path_offset + '")');
86
+ }
87
+ const obj_timezoneId = obj.timezoneId;
88
+ const path_timezoneId = path + '.timezoneId';
89
+ if (typeof obj_timezoneId !== 'string') {
90
+ return new TypeError('Expected "string" but received "' + typeof obj_timezoneId + '" (at "' + path_timezoneId + '")');
91
+ }
92
+ })();
93
+ return v_error === undefined ? null : v_error;
94
+ }
95
+ function deepFreeze$1(input) {
96
+ ObjectFreeze(input);
97
+ }
98
+
99
+ const VERSION = "e0cab40b3591377c632eb866ff79268c";
100
+ function validate(obj, path = 'TimezoneOutputRepresentation') {
101
+ const v_error = (() => {
102
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
103
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
104
+ }
105
+ const obj_timezones = obj.timezones;
106
+ const path_timezones = path + '.timezones';
107
+ if (!ArrayIsArray(obj_timezones)) {
108
+ return new TypeError('Expected "array" but received "' + typeof obj_timezones + '" (at "' + path_timezones + '")');
109
+ }
110
+ for (let i = 0; i < obj_timezones.length; i++) {
111
+ const obj_timezones_item = obj_timezones[i];
112
+ const path_timezones_item = path_timezones + '[' + i + ']';
113
+ const referencepath_timezones_itemValidationError = validate$1(obj_timezones_item, path_timezones_item);
114
+ if (referencepath_timezones_itemValidationError !== null) {
115
+ let message = 'Object doesn\'t match TimezoneRepresentation (at "' + path_timezones_item + '")\n';
116
+ message += referencepath_timezones_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
117
+ return new TypeError(message);
118
+ }
119
+ }
120
+ })();
121
+ return v_error === undefined ? null : v_error;
122
+ }
123
+ const RepresentationType = 'TimezoneOutputRepresentation';
124
+ function normalize(input, existing, path, luvio, store, timestamp) {
125
+ return input;
126
+ }
127
+ const select$1 = function TimezoneOutputRepresentationSelect() {
128
+ return {
129
+ kind: 'Fragment',
130
+ version: VERSION,
131
+ private: [],
132
+ opaque: true
133
+ };
134
+ };
135
+ function equals(existing, incoming) {
136
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
137
+ return false;
138
+ }
139
+ return true;
140
+ }
141
+ function deepFreeze(input) {
142
+ const input_timezones = input.timezones;
143
+ for (let i = 0; i < input_timezones.length; i++) {
144
+ const input_timezones_item = input_timezones[i];
145
+ deepFreeze$1(input_timezones_item);
146
+ }
147
+ ObjectFreeze(input_timezones);
148
+ ObjectFreeze(input);
149
+ }
150
+ const ingest = function TimezoneOutputRepresentationIngest(input, path, luvio, store, timestamp) {
151
+ if (process.env.NODE_ENV !== 'production') {
152
+ const validateError = validate(input);
153
+ if (validateError !== null) {
154
+ throw validateError;
155
+ }
156
+ }
157
+ const key = path.fullPath;
158
+ const existingRecord = store.readEntry(key);
159
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
160
+ let incomingRecord = normalize(input, store.readEntry(key), {
161
+ fullPath: key,
162
+ parent: path.parent,
163
+ propertyName: path.propertyName,
164
+ ttl: ttlToUse
165
+ });
166
+ deepFreeze(input);
167
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
168
+ luvio.storePublish(key, incomingRecord);
169
+ }
170
+ if (ttlToUse !== undefined) {
171
+ const storeMetadataParams = {
172
+ ttl: ttlToUse,
173
+ namespace: "platformi18n",
174
+ version: VERSION,
175
+ representationName: RepresentationType,
176
+ };
177
+ luvio.publishStoreMetadata(key, storeMetadataParams);
178
+ }
179
+ return createLink(key);
180
+ };
181
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
182
+ const rootKeySet = new StoreKeyMap();
183
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
184
+ const rootKey = fullPathFactory();
185
+ rootKeySet.set(rootKey, {
186
+ namespace: keyPrefix,
187
+ representationName: RepresentationType,
188
+ mergeable: false
189
+ });
190
+ return rootKeySet;
191
+ }
192
+
193
+ function select(luvio, params) {
194
+ return select$1();
195
+ }
196
+ function keyBuilder$1(luvio, params) {
197
+ return keyPrefix + '::TimezoneOutputRepresentation:(' + 'locale:' + params.urlParams.locale + ')';
198
+ }
199
+ function getResponseCacheKeys(luvio, resourceParams, response) {
200
+ return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
201
+ }
202
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
203
+ const { body } = response;
204
+ const key = keyBuilder$1(luvio, resourceParams);
205
+ luvio.storeIngest(key, ingest, body);
206
+ const snapshot = luvio.storeLookup({
207
+ recordId: key,
208
+ node: select(),
209
+ variables: {},
210
+ }, snapshotRefresh);
211
+ if (process.env.NODE_ENV !== 'production') {
212
+ if (snapshot.state !== 'Fulfilled') {
213
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
214
+ }
215
+ }
216
+ return snapshot;
217
+ }
218
+ function ingestError(luvio, params, error, snapshotRefresh) {
219
+ const key = keyBuilder$1(luvio, params);
220
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
221
+ luvio.storeIngestError(key, errorSnapshot);
222
+ return errorSnapshot;
223
+ }
224
+ function createResourceRequest(config) {
225
+ const headers = {};
226
+ return {
227
+ baseUri: '/services/data/v58.0',
228
+ basePath: '/connect/i18n/timezones/' + config.urlParams.locale + '',
229
+ method: 'get',
230
+ body: null,
231
+ urlParams: config.urlParams,
232
+ queryParams: {},
233
+ headers,
234
+ priority: 'normal',
235
+ };
236
+ }
237
+
238
+ const getTimezonesByLocale_ConfigPropertyNames = {
239
+ displayName: 'getTimezonesByLocale',
240
+ parameters: {
241
+ required: ['locale'],
242
+ optional: []
243
+ }
244
+ };
245
+ function createResourceParams(config) {
246
+ const resourceParams = {
247
+ urlParams: {
248
+ locale: config.locale
249
+ }
250
+ };
251
+ return resourceParams;
252
+ }
253
+ function keyBuilder(luvio, config) {
254
+ const resourceParams = createResourceParams(config);
255
+ return keyBuilder$1(luvio, resourceParams);
256
+ }
257
+ function typeCheckConfig(untrustedConfig) {
258
+ const config = {};
259
+ const untrustedConfig_locale = untrustedConfig.locale;
260
+ if (typeof untrustedConfig_locale === 'string') {
261
+ config.locale = untrustedConfig_locale;
262
+ }
263
+ return config;
264
+ }
265
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
266
+ if (!untrustedIsObject(untrustedConfig)) {
267
+ return null;
268
+ }
269
+ if (process.env.NODE_ENV !== 'production') {
270
+ validateConfig(untrustedConfig, configPropertyNames);
271
+ }
272
+ const config = typeCheckConfig(untrustedConfig);
273
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
274
+ return null;
275
+ }
276
+ return config;
277
+ }
278
+ function adapterFragment(luvio, config) {
279
+ createResourceParams(config);
280
+ return select();
281
+ }
282
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
283
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
284
+ config,
285
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
286
+ });
287
+ return luvio.storeBroadcast().then(() => snapshot);
288
+ }
289
+ function onFetchResponseError(luvio, config, resourceParams, response) {
290
+ const snapshot = ingestError(luvio, resourceParams, response, {
291
+ config,
292
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
293
+ });
294
+ return luvio.storeBroadcast().then(() => snapshot);
295
+ }
296
+ function buildNetworkSnapshot(luvio, config, options) {
297
+ const resourceParams = createResourceParams(config);
298
+ const request = createResourceRequest(resourceParams);
299
+ return luvio.dispatchResourceRequest(request, options)
300
+ .then((response) => {
301
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
302
+ }, (response) => {
303
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
304
+ });
305
+ }
306
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
307
+ const { luvio, config } = context;
308
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
309
+ const dispatchOptions = {
310
+ resourceRequestContext: {
311
+ requestCorrelator,
312
+ luvioRequestMethod: undefined,
313
+ },
314
+ eventObservers
315
+ };
316
+ if (networkPriority !== 'normal') {
317
+ dispatchOptions.overrides = {
318
+ priority: networkPriority
319
+ };
320
+ }
321
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
322
+ }
323
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
324
+ const { luvio, config } = context;
325
+ const selector = {
326
+ recordId: keyBuilder(luvio, config),
327
+ node: adapterFragment(luvio, config),
328
+ variables: {},
329
+ };
330
+ const cacheSnapshot = storeLookup(selector, {
331
+ config,
332
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
333
+ });
334
+ return cacheSnapshot;
335
+ }
336
+ const getTimezonesByLocaleAdapterFactory = (luvio) => function platformi18n__getTimezonesByLocale(untrustedConfig, requestContext) {
337
+ const config = validateAdapterConfig(untrustedConfig, getTimezonesByLocale_ConfigPropertyNames);
338
+ // Invalid or incomplete config
339
+ if (config === null) {
340
+ return null;
341
+ }
342
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
343
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
344
+ };
345
+
346
+ let getTimezonesByLocale;
347
+ // Imperative GET Adapters
348
+ let getTimezonesByLocale_imperative;
349
+ // Adapter Metadata
350
+ const getTimezonesByLocaleMetadata = { apiFamily: 'platformi18n', name: 'getTimezonesByLocale' };
351
+ function bindExportsTo(luvio) {
352
+ // LDS Adapters
353
+ const getTimezonesByLocale_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getTimezonesByLocale', getTimezonesByLocaleAdapterFactory), getTimezonesByLocaleMetadata);
354
+ return {
355
+ getTimezonesByLocale: createWireAdapterConstructor(luvio, getTimezonesByLocale_ldsAdapter, getTimezonesByLocaleMetadata),
356
+ // Imperative GET Adapters
357
+ getTimezonesByLocale_imperative: createImperativeAdapter(luvio, getTimezonesByLocale_ldsAdapter, getTimezonesByLocaleMetadata)
358
+ };
359
+ }
360
+ withDefaultLuvio((luvio) => {
361
+ ({
362
+ getTimezonesByLocale,
363
+ getTimezonesByLocale_imperative
364
+ } = bindExportsTo(luvio));
365
+ });
366
+
367
+ export { getTimezonesByLocale, getTimezonesByLocale_imperative };
368
+ // version: 0.131.0-c1ec5b7de