@salesforce/lds-adapters-community-microbatching 1.212.1 → 1.213.1

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,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, deepFreeze, StoreKeyMap, typeCheckScalars } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, typeCheckScalars } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -41,6 +41,24 @@ function untrustedIsObject(untrusted) {
41
41
  function areRequiredParametersPresent(config, configPropertyNames) {
42
42
  return configPropertyNames.parameters.required.every(req => req in config);
43
43
  }
44
+ function generateParamConfigMetadata(name, required, coerceFn) {
45
+ return {
46
+ name,
47
+ required,
48
+ coerceFn,
49
+ };
50
+ }
51
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
52
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
53
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
54
+ return {
55
+ displayName,
56
+ parameters: {
57
+ required,
58
+ optional,
59
+ }
60
+ };
61
+ }
44
62
  const keyPrefix = 'microbatching';
45
63
 
46
64
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -150,26 +168,8 @@ const ingest = function MicrobatchingIngestionOutputRepresentationIngest(input,
150
168
  }
151
169
  }
152
170
  const key = keyBuilderFromType(luvio, input);
153
- const existingRecord = store.readEntry(key);
154
171
  const ttlToUse = TTL;
155
- let incomingRecord = normalize(input, store.readEntry(key), {
156
- fullPath: key,
157
- parent: path.parent,
158
- propertyName: path.propertyName,
159
- ttl: ttlToUse
160
- });
161
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
162
- luvio.storePublish(key, incomingRecord);
163
- }
164
- {
165
- const storeMetadataParams = {
166
- ttl: ttlToUse,
167
- namespace: "microbatching",
168
- version: VERSION,
169
- representationName: RepresentationType,
170
- };
171
- luvio.publishStoreMetadata(key, storeMetadataParams);
172
- }
172
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "microbatching", VERSION, RepresentationType, equals);
173
173
  return createLink(key);
174
174
  };
175
175
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -219,13 +219,12 @@ function createResourceRequest(config) {
219
219
  };
220
220
  }
221
221
 
222
- const ingestRecord_ConfigPropertyNames = {
223
- displayName: 'ingestRecord',
224
- parameters: {
225
- required: ['communityId', 'requestIngestionInput'],
226
- optional: []
227
- }
228
- };
222
+ const adapterName = 'ingestRecord';
223
+ const ingestRecord_ConfigPropertyMetadata = [
224
+ generateParamConfigMetadata('communityId', true),
225
+ generateParamConfigMetadata('requestIngestionInput', true),
226
+ ];
227
+ const ingestRecord_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, ingestRecord_ConfigPropertyMetadata);
229
228
  function createResourceParams(config) {
230
229
  const resourceParams = {
231
230
  urlParams: {
@@ -1,4 +1,4 @@
1
- import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot } from '@luvio/engine';
1
+ import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot, AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata } from '@luvio/engine';
2
2
  export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
3
  declare const ObjectKeys: {
4
4
  (o: object): string[];
@@ -57,4 +57,6 @@ export declare const snapshotRefreshOptions: {
57
57
  export declare function stableJSONStringify(node: any): string | undefined;
58
58
  export declare function getFetchResponseStatusText(status: number): string;
59
59
  export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
60
+ export declare function generateParamConfigMetadata(name: string, required: boolean, coerceFn?: (v: unknown) => unknown): $64$luvio_engine_AdapterConfigMetadata;
61
+ export declare function buildAdapterValidationConfig(displayName: string, paramsMeta: $64$luvio_engine_AdapterConfigMetadata[]): AdapterValidationConfig;
60
62
  export declare const keyPrefix = "microbatching";
@@ -1,9 +1,10 @@
1
- import { AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig, Untrusted as adapter$45$utils_Untrusted } from './adapter-utils';
1
+ import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
2
+ import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
2
3
  import { MicrobatchingIngestionInputRepresentation as types_MicrobatchingIngestionInputRepresentation_MicrobatchingIngestionInputRepresentation } from '../types/MicrobatchingIngestionInputRepresentation';
3
4
  import { ResourceRequestConfig as resources_postConnectCommunitiesMicrobatchingByCommunityId_ResourceRequestConfig } from '../resources/postConnectCommunitiesMicrobatchingByCommunityId';
4
- import { Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
5
5
  import { MicrobatchingIngestionOutputRepresentation as types_MicrobatchingIngestionOutputRepresentation_MicrobatchingIngestionOutputRepresentation } from '../types/MicrobatchingIngestionOutputRepresentation';
6
6
  export declare const adapterName = "ingestRecord";
7
+ export declare const ingestRecord_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
8
  export declare const ingestRecord_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
9
  export interface IngestRecordConfig {
9
10
  communityId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-community-microbatching",
3
- "version": "1.212.1",
3
+ "version": "1.213.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Microbatching requests",
6
6
  "main": "dist/es/es2018/community-microbatching.js",
package/sfdc/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  /* proxy-compat-disable */
15
15
  import { withDefaultLuvio } from 'force/ldsEngine';
16
- import { serializeStructuredKey, deepFreeze, StoreKeyMap, typeCheckScalars } from 'force/luvioEngine';
16
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, typeCheckScalars } from 'force/luvioEngine';
17
17
 
18
18
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
19
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -50,6 +50,24 @@ function untrustedIsObject(untrusted) {
50
50
  function areRequiredParametersPresent(config, configPropertyNames) {
51
51
  return configPropertyNames.parameters.required.every(req => req in config);
52
52
  }
53
+ function generateParamConfigMetadata(name, required, coerceFn) {
54
+ return {
55
+ name,
56
+ required,
57
+ coerceFn,
58
+ };
59
+ }
60
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
61
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
62
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
63
+ return {
64
+ displayName,
65
+ parameters: {
66
+ required,
67
+ optional,
68
+ }
69
+ };
70
+ }
53
71
  const keyPrefix = 'microbatching';
54
72
 
55
73
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -159,26 +177,8 @@ const ingest = function MicrobatchingIngestionOutputRepresentationIngest(input,
159
177
  }
160
178
  }
161
179
  const key = keyBuilderFromType(luvio, input);
162
- const existingRecord = store.readEntry(key);
163
180
  const ttlToUse = TTL;
164
- let incomingRecord = normalize(input, store.readEntry(key), {
165
- fullPath: key,
166
- parent: path.parent,
167
- propertyName: path.propertyName,
168
- ttl: ttlToUse
169
- });
170
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
171
- luvio.storePublish(key, incomingRecord);
172
- }
173
- {
174
- const storeMetadataParams = {
175
- ttl: ttlToUse,
176
- namespace: "microbatching",
177
- version: VERSION,
178
- representationName: RepresentationType,
179
- };
180
- luvio.publishStoreMetadata(key, storeMetadataParams);
181
- }
181
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "microbatching", VERSION, RepresentationType, equals);
182
182
  return createLink(key);
183
183
  };
184
184
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -228,13 +228,12 @@ function createResourceRequest(config) {
228
228
  };
229
229
  }
230
230
 
231
- const ingestRecord_ConfigPropertyNames = {
232
- displayName: 'ingestRecord',
233
- parameters: {
234
- required: ['communityId', 'requestIngestionInput'],
235
- optional: []
236
- }
237
- };
231
+ const adapterName = 'ingestRecord';
232
+ const ingestRecord_ConfigPropertyMetadata = [
233
+ generateParamConfigMetadata('communityId', true),
234
+ generateParamConfigMetadata('requestIngestionInput', true),
235
+ ];
236
+ const ingestRecord_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, ingestRecord_ConfigPropertyMetadata);
238
237
  function createResourceParams(config) {
239
238
  const resourceParams = {
240
239
  urlParams: {
@@ -318,4 +317,4 @@ withDefaultLuvio((luvio) => {
318
317
  });
319
318
 
320
319
  export { ingestRecord };
321
- // version: 1.212.1-49679d2a7
320
+ // version: 1.213.1-79de10fe1