@salesforce/lds-adapters-platform-data-provider 1.134.7 → 1.134.8

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.
@@ -4,10 +4,10 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
7
+ import { serializeStructuredKey, StoreKeyMap, deepFreeze } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
10
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
11
  const { isArray: ArrayIsArray$1 } = Array;
12
12
  /**
13
13
  * Validates an adapter config is well-formed.
@@ -50,27 +50,9 @@ const snapshotRefreshOptions = {
50
50
  };
51
51
  const keyPrefix = 'DataProviders';
52
52
 
53
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
53
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
54
  const { isArray: ArrayIsArray } = Array;
55
55
  const { stringify: JSONStringify } = JSON;
56
- function deepFreeze$1(value) {
57
- // No need to freeze primitives
58
- if (typeof value !== 'object' || value === null) {
59
- return;
60
- }
61
- if (ArrayIsArray(value)) {
62
- for (let i = 0, len = value.length; i < len; i += 1) {
63
- deepFreeze$1(value[i]);
64
- }
65
- }
66
- else {
67
- const keys = ObjectKeys(value);
68
- for (let i = 0, len = keys.length; i < len; i += 1) {
69
- deepFreeze$1(value[keys[i]]);
70
- }
71
- }
72
- ObjectFreeze(value);
73
- }
74
56
  function createLink(ref) {
75
57
  return {
76
58
  __ref: serializeStructuredKey(ref),
@@ -119,18 +101,6 @@ function equals(existing, incoming) {
119
101
  }
120
102
  return true;
121
103
  }
122
- function deepFreeze(input) {
123
- const input_schema = input.schema;
124
- const input_schema_keys = Object.keys(input_schema);
125
- const input_schema_length = input_schema_keys.length;
126
- for (let i = 0; i < input_schema_length; i++) {
127
- const key = input_schema_keys[i];
128
- const input_schema_prop = input_schema[key];
129
- deepFreeze$1(input_schema_prop);
130
- }
131
- ObjectFreeze(input_schema);
132
- ObjectFreeze(input);
133
- }
134
104
  const ingest = function DataProviderSchemaRepresentationIngest(input, path, luvio, store, timestamp) {
135
105
  if (process.env.NODE_ENV !== 'production') {
136
106
  const validateError = validate(input);
@@ -147,7 +117,6 @@ const ingest = function DataProviderSchemaRepresentationIngest(input, path, luvi
147
117
  propertyName: path.propertyName,
148
118
  ttl: ttlToUse
149
119
  });
150
- deepFreeze(input);
151
120
  if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
152
121
  luvio.storePublish(key, incomingRecord);
153
122
  }
@@ -197,6 +166,7 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
197
166
  throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
198
167
  }
199
168
  }
169
+ deepFreeze(snapshot.data);
200
170
  return snapshot;
201
171
  }
202
172
  function ingestError(luvio, params, error, snapshotRefresh) {
@@ -3,17 +3,11 @@ export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
3
  declare const ObjectKeys: {
4
4
  (o: object): string[];
5
5
  (o: {}): string[];
6
- }, ObjectFreeze: {
7
- <T extends Function>(f: T): T;
8
- <T_1 extends {
9
- [idx: string]: object | U | null | undefined;
10
- }, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
11
- <T_2>(o: T_2): Readonly<T_2>;
12
6
  }, ObjectCreate: {
13
7
  (o: object | null): any;
14
8
  (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
15
9
  };
16
- export { ObjectFreeze, ObjectCreate, ObjectKeys };
10
+ export { ObjectCreate, ObjectKeys };
17
11
  export declare const ArrayIsArray: (arg: any) => arg is any[];
18
12
  export declare const ArrayPrototypePush: (...items: any[]) => number;
19
13
  export interface AdapterValidationConfig {
@@ -6,7 +6,6 @@ export declare const RepresentationType: string;
6
6
  export declare function normalize(input: DataProviderSchemaRepresentation, existing: DataProviderSchemaRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): DataProviderSchemaRepresentationNormalized;
7
7
  export declare const select: () => $64$luvio_engine_BaseFragment;
8
8
  export declare function equals(existing: DataProviderSchemaRepresentationNormalized, incoming: DataProviderSchemaRepresentationNormalized): boolean;
9
- export declare function deepFreeze(input: DataProviderSchemaRepresentation): void;
10
9
  export declare const ingest: $64$luvio_engine_ResourceIngest;
11
10
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: DataProviderSchemaRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
12
11
  /**
@@ -5,7 +5,6 @@ export declare const RepresentationType: string;
5
5
  export declare function normalize(input: SchemaInputRepresentation, existing: SchemaInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): SchemaInputRepresentationNormalized;
6
6
  export declare const select: () => $64$luvio_engine_FragmentSelection;
7
7
  export declare function equals(existing: SchemaInputRepresentationNormalized, incoming: SchemaInputRepresentationNormalized): boolean;
8
- export declare function deepFreeze(input: SchemaInputRepresentation): void;
9
8
  export declare const ingest: $64$luvio_engine_ResourceIngest;
10
9
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: SchemaInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
10
  /**
@@ -1,11 +1,5 @@
1
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: {
2
+ export declare const ObjectKeys: {
9
3
  (o: object): string[];
10
4
  (o: {}): string[];
11
5
  }, ObjectCreate: {
@@ -31,7 +25,6 @@ export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (i
31
25
  export declare function equalsObject<U, V extends {
32
26
  [key: string]: U;
33
27
  }>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
34
- export declare function deepFreeze(value: any): void;
35
28
  export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
36
29
  __ref: string;
37
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-platform-data-provider",
3
- "version": "1.134.7",
3
+ "version": "1.134.8",
4
4
  "description": "Data Provider connect api resource family",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/platform-data-provider.js",
package/sfdc/index.js CHANGED
@@ -14,10 +14,10 @@
14
14
  /* proxy-compat-disable */
15
15
  import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
16
  import { withDefaultLuvio } from 'force/ldsEngine';
17
- import { serializeStructuredKey, StoreKeyMap } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, StoreKeyMap, deepFreeze } from 'force/luvioEngine';
18
18
 
19
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
20
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
21
21
  const { isArray: ArrayIsArray$1 } = Array;
22
22
  /**
23
23
  * Validates an adapter config is well-formed.
@@ -60,27 +60,9 @@ const snapshotRefreshOptions = {
60
60
  };
61
61
  const keyPrefix = 'DataProviders';
62
62
 
63
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
63
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
64
  const { isArray: ArrayIsArray } = Array;
65
65
  const { stringify: JSONStringify } = JSON;
66
- function deepFreeze$1(value) {
67
- // No need to freeze primitives
68
- if (typeof value !== 'object' || value === null) {
69
- return;
70
- }
71
- if (ArrayIsArray(value)) {
72
- for (let i = 0, len = value.length; i < len; i += 1) {
73
- deepFreeze$1(value[i]);
74
- }
75
- }
76
- else {
77
- const keys = ObjectKeys(value);
78
- for (let i = 0, len = keys.length; i < len; i += 1) {
79
- deepFreeze$1(value[keys[i]]);
80
- }
81
- }
82
- ObjectFreeze(value);
83
- }
84
66
  function createLink(ref) {
85
67
  return {
86
68
  __ref: serializeStructuredKey(ref),
@@ -129,18 +111,6 @@ function equals(existing, incoming) {
129
111
  }
130
112
  return true;
131
113
  }
132
- function deepFreeze(input) {
133
- const input_schema = input.schema;
134
- const input_schema_keys = Object.keys(input_schema);
135
- const input_schema_length = input_schema_keys.length;
136
- for (let i = 0; i < input_schema_length; i++) {
137
- const key = input_schema_keys[i];
138
- const input_schema_prop = input_schema[key];
139
- deepFreeze$1(input_schema_prop);
140
- }
141
- ObjectFreeze(input_schema);
142
- ObjectFreeze(input);
143
- }
144
114
  const ingest = function DataProviderSchemaRepresentationIngest(input, path, luvio, store, timestamp) {
145
115
  if (process.env.NODE_ENV !== 'production') {
146
116
  const validateError = validate(input);
@@ -157,7 +127,6 @@ const ingest = function DataProviderSchemaRepresentationIngest(input, path, luvi
157
127
  propertyName: path.propertyName,
158
128
  ttl: ttlToUse
159
129
  });
160
- deepFreeze(input);
161
130
  if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
162
131
  luvio.storePublish(key, incomingRecord);
163
132
  }
@@ -207,6 +176,7 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
207
176
  throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
208
177
  }
209
178
  }
179
+ deepFreeze(snapshot.data);
210
180
  return snapshot;
211
181
  }
212
182
  function ingestError(luvio, params, error, snapshotRefresh) {
@@ -370,4 +340,4 @@ withDefaultLuvio((luvio) => {
370
340
  });
371
341
 
372
342
  export { getSchema, getSchema_imperative };
373
- // version: 1.134.7-ed0df45ef
343
+ // version: 1.134.8-c3d6d2cfc