@salesforce/lds-worker-api 1.283.0 → 1.284.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.
@@ -4183,7 +4183,7 @@
4183
4183
  }
4184
4184
  callbacks.push(callback);
4185
4185
  }
4186
- // version: 1.283.0-a330da944
4186
+ // version: 1.284.0-a7e8dc51c
4187
4187
 
4188
4188
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4189
4189
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15691,7 +15691,7 @@
15691
15691
  }
15692
15692
  return superResult;
15693
15693
  }
15694
- // version: 1.283.0-a330da944
15694
+ // version: 1.284.0-a7e8dc51c
15695
15695
 
15696
15696
  function unwrap(data) {
15697
15697
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16616,7 +16616,7 @@
16616
16616
  const { apiFamily, name } = metadata;
16617
16617
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16618
16618
  }
16619
- // version: 1.283.0-a330da944
16619
+ // version: 1.284.0-a7e8dc51c
16620
16620
 
16621
16621
  /**
16622
16622
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16829,6 +16829,41 @@
16829
16829
  * @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
16830
16830
  */
16831
16831
  let trackedFieldLeafNodeIdAndNameOnly$2 = false;
16832
+ /**
16833
+ * One store enabled Get Object Info adapter
16834
+ */
16835
+ let oneStoreGetObjectInfoAdapter$2 = undefined;
16836
+ /**
16837
+ * One store enabled Get Object Infos adapter
16838
+ */
16839
+ let oneStoreGetObjectInfosAdapter$2 = undefined;
16840
+ /**
16841
+ * Defines the configuration API and is exposed internally as well as externally.
16842
+ * Configuration for one store enabled REST adapters only.
16843
+ */
16844
+ const configurationForOneStoreEnabledAdapters$2 = {
16845
+ setGetObjectInfoAdapter: function (adapter) {
16846
+ oneStoreGetObjectInfoAdapter$2 = adapter;
16847
+ },
16848
+ getGetObjectInfoAdapter: function () {
16849
+ return oneStoreGetObjectInfoAdapter$2;
16850
+ },
16851
+ setGetObjectInfosAdapter: function (adapter) {
16852
+ oneStoreGetObjectInfosAdapter$2 = adapter;
16853
+ },
16854
+ getGetObjectInfosAdapter: function () {
16855
+ return oneStoreGetObjectInfosAdapter$2;
16856
+ },
16857
+ };
16858
+ /**
16859
+ * Helper function to return the one store adapter if it's defined, otherwise return the luvio adapter.
16860
+ * @param luvioAdapter - The luvio bound adapter.
16861
+ * @param oneStoreAdapter - The one store bound adapter.
16862
+ * @returns Luvio or one store wire adapter constructor.
16863
+ */
16864
+ function getLuvioOrOneStoreAdapter(luvioAdapter, oneStoreAdapter) {
16865
+ return oneStoreAdapter !== null && oneStoreAdapter !== void 0 ? oneStoreAdapter : luvioAdapter;
16866
+ }
16832
16867
  /**
16833
16868
  * Defines the configuration API and is exposed internally as well as externally.
16834
16869
  * Configuration for REST adapters only.
@@ -16893,6 +16928,7 @@
16893
16928
  getDraftAwareCreateContentVersionAdapter: function () {
16894
16929
  return draftAwareCreateContentVersionAdapter$2;
16895
16930
  },
16931
+ ...configurationForOneStoreEnabledAdapters$2,
16896
16932
  };
16897
16933
  /**
16898
16934
  * Defines the configuration API and is exposed internally as well as externally.
@@ -17249,15 +17285,17 @@
17249
17285
  /**
17250
17286
  * Returns the field API name, qualified with an object name if possible.
17251
17287
  * @param value The value from which to get the qualified field API name.
17288
+ * @param onlyQualifiedFieldNames - Whether or not this function should skip fieldApiName that do not include the delimiter '.'
17252
17289
  * @return The qualified field API name.
17253
17290
  */
17254
- function getFieldApiName$2(value) {
17291
+ function getFieldApiName$2(value, onlyQualifiedFieldNames = false) {
17255
17292
  // Note: tightening validation logic changes behavior from userland getting
17256
17293
  // a server-provided error to the adapter noop'ing. In 224 we decided to not
17257
- // change the behavior.
17294
+ // change the behavior. In 250 we decided to add the 'onlyQualifiedFieldName' flag to tighten the logic
17295
+ // optionally to avoid issues with persisted invalid field names.
17258
17296
  if (isString$2(value)) {
17259
17297
  const trimmed = value.trim();
17260
- if (trimmed.length > 0) {
17298
+ if (trimmed.length > 0 && (onlyQualifiedFieldNames ? trimmed.indexOf('.') > -1 : true)) {
17261
17299
  return trimmed;
17262
17300
  }
17263
17301
  }
@@ -17270,15 +17308,19 @@
17270
17308
  /**
17271
17309
  * Returns the field API name.
17272
17310
  * @param value The value from which to get the field API name.
17311
+ * @param options Option bag. onlyQualifiedFieldNames is a boolean that allows this function to skip returning invalid FieldApiNames.
17273
17312
  * @returns The field API name.
17274
17313
  */
17275
- function getFieldApiNamesArray$2(value) {
17314
+ function getFieldApiNamesArray$2(value, options = { onlyQualifiedFieldNames: false }) {
17276
17315
  const valueArray = isArray$7(value) ? value : [value];
17277
17316
  const array = [];
17278
17317
  for (let i = 0, len = valueArray.length; i < len; i += 1) {
17279
17318
  const item = valueArray[i];
17280
- const apiName = getFieldApiName$2(item);
17319
+ const apiName = getFieldApiName$2(item, options.onlyQualifiedFieldNames);
17281
17320
  if (apiName === undefined) {
17321
+ if (options.onlyQualifiedFieldNames) {
17322
+ continue; // Just skips invalid field names rather than failing to return an array at all
17323
+ }
17282
17324
  return undefined;
17283
17325
  }
17284
17326
  push$4.call(array, apiName);
@@ -21645,17 +21687,16 @@
21645
21687
  }
21646
21688
 
21647
21689
  const TTL$x = 30000;
21648
- const VERSION$18$1 = "e635ab62cb633d32aeeb183e568bb2c7";
21690
+ const VERSION$18$1 = "e5c90c4081cd557f8ffec53028ede1e8";
21649
21691
  const RepresentationType$T = 'ListRecordCollectionRepresentation';
21650
21692
  function keyBuilder$23(luvio, config) {
21651
- return keyPrefix$2 + '::' + RepresentationType$T + ':' + config.objectApiName + ':' + (config.searchTerm === null ? '' : config.searchTerm) + ':' + (config.sortBy === null ? '' : '[' + config.sortBy.join(',') + ']') + ':' + (config.listViewId === null ? '' : config.listViewId) + ':' + (config.where === null ? '' : config.where) + ':' + (config.listViewApiName === null ? '' : config.listViewApiName);
21693
+ return keyPrefix$2 + '::' + RepresentationType$T + ':' + config.objectApiName + ':' + (config.searchTerm === null ? '' : config.searchTerm) + ':' + (config.sortBy === null ? '' : '[' + config.sortBy.join(',') + ']') + ':' + (config.where === null ? '' : config.where) + ':' + (config.listViewApiName === null ? '' : config.listViewApiName);
21652
21694
  }
21653
21695
  function keyBuilderFromType$B(luvio, object) {
21654
21696
  const keyParams = {
21655
21697
  objectApiName: object.listReference.objectApiName,
21656
21698
  searchTerm: object.searchTerm,
21657
21699
  sortBy: object.sortBy,
21658
- listViewId: object.listInfoETag,
21659
21700
  where: object.where,
21660
21701
  listViewApiName: object.listReference.listViewApiName
21661
21702
  };
@@ -22716,7 +22757,7 @@
22716
22757
  const keyElements = key.split(':');
22717
22758
  return {
22718
22759
  objectApiName: keyElements[3],
22719
- listViewApiName: keyElements[8],
22760
+ listViewApiName: keyElements[7],
22720
22761
  };
22721
22762
  }
22722
22763
  function splitListSummaryCollectionKey(key) {
@@ -23014,7 +23055,8 @@
23014
23055
  return keyBuilder$23(luvio, {
23015
23056
  objectApiName: listReference.objectApiName,
23016
23057
  listViewApiName: listReference.listViewApiName,
23017
- listViewId: listReference.id,
23058
+ // # removing listViewId from key only supporing getting records using api name
23059
+ // listViewId: listReference.id,
23018
23060
  searchTerm: params.body.searchTerm || null,
23019
23061
  where: params.body.where || null,
23020
23062
  sortBy: params.body.sortBy !== undefined && params.body.sortBy.length <= 0
@@ -23027,7 +23069,8 @@
23027
23069
  return keyBuilder$23(luvio, {
23028
23070
  objectApiName: params.urlParams.objectApiName,
23029
23071
  listViewApiName: params.urlParams.listViewApiName,
23030
- listViewId: '',
23072
+ // # removing listViewId from key only supporing getting records using api name
23073
+ // listViewId: '',
23031
23074
  searchTerm: params.body.searchTerm || null,
23032
23075
  where: params.body.where || null,
23033
23076
  sortBy: params.body.sortBy || [],
@@ -32199,7 +32242,7 @@
32199
32242
  }
32200
32243
 
32201
32244
  const TTL$k = 900000;
32202
- const VERSION$D$1 = "84e1e3ffdfcb59f65d7b8906e33027ac";
32245
+ const VERSION$D$1 = "2405a0b25c2c00f82e88b600edc16387";
32203
32246
  const RepresentationType$u = 'ListObjectInfoRepresentation';
32204
32247
  function keyBuilder$15$1(luvio, config) {
32205
32248
  return keyPrefix$2 + '::' + RepresentationType$u + ':' + config.objectApiName;
@@ -32241,6 +32284,10 @@
32241
32284
  name: 'objectApiName',
32242
32285
  kind: 'Scalar'
32243
32286
  },
32287
+ {
32288
+ name: 'publicOrSharedCreateable',
32289
+ kind: 'Scalar'
32290
+ },
32244
32291
  {
32245
32292
  name: 'relatedEntityApiName',
32246
32293
  kind: 'Scalar'
@@ -32254,6 +32301,11 @@
32254
32301
  if (!(existing_createable === incoming_createable)) {
32255
32302
  return false;
32256
32303
  }
32304
+ const existing_publicOrSharedCreateable = existing.publicOrSharedCreateable;
32305
+ const incoming_publicOrSharedCreateable = incoming.publicOrSharedCreateable;
32306
+ if (!(existing_publicOrSharedCreateable === incoming_publicOrSharedCreateable)) {
32307
+ return false;
32308
+ }
32257
32309
  const existing_objectApiName = existing.objectApiName;
32258
32310
  const incoming_objectApiName = incoming.objectApiName;
32259
32311
  if (!(existing_objectApiName === incoming_objectApiName)) {
@@ -40855,6 +40907,7 @@
40855
40907
  // Note: The original listReference will remain unchanged in the response.
40856
40908
  mutatedListRef.id = body.listInfoETag;
40857
40909
  addListReferenceWithId(mutatedListRef, context, body.listReference.id);
40910
+ // storing sortBy ensuring a cache hit when requesting records with no sortBy provided
40858
40911
  addServerDefaults(config, body, originalListRef, context);
40859
40912
  }
40860
40913
  return onFetchResponseSuccess$2$1(luvio, config, resourceParams, response);
@@ -43569,7 +43622,11 @@
43569
43622
  }
43570
43623
  ensureRegisteredOnce$2({
43571
43624
  id: '@salesforce/lds-adapters-uiapi',
43572
- configuration: { ...configurationForRestAdapters$2, ...configurationForGraphQLAdapters$2 },
43625
+ configuration: {
43626
+ ...configurationForRestAdapters$2,
43627
+ ...configurationForGraphQLAdapters$2,
43628
+ ...configurationForOneStoreEnabledAdapters$2,
43629
+ },
43573
43630
  instrument: instrument$3,
43574
43631
  });
43575
43632
 
@@ -43830,15 +43887,13 @@
43830
43887
  getListInfosByObjectName: createWireAdapterConstructor(luvio, getListInfosByObjectName_ldsAdapter, getListInfosByObjectNameMetadata),
43831
43888
  getListObjectInfo: createWireAdapterConstructor(luvio, getListObjectInfo_ldsAdapter, getListObjectInfoMetadata),
43832
43889
  getListPreferences: createWireAdapterConstructor(luvio, getListPreferences_ldsAdapter, getListPreferencesMetadata),
43833
- getListRecordsByName: createWireAdapterConstructor(luvio, getListRecordsByName_ldsAdapter, getListRecordsByNameMetadata),
43890
+ getListRecordsByName: createInfiniteScrollingWireAdapterConstructor(luvio, getListRecordsByName_ldsAdapter, getListRecordsByNameMetadata),
43834
43891
  getListUi: createInfiniteScrollingWireAdapterConstructor(luvio, getListUi_ldsAdapter, getListUiMetadata),
43835
43892
  getLookupActions: createWireAdapterConstructor(luvio, getLookupActions_ldsAdapter, getLookupActionsMetadata),
43836
43893
  getLookupMetadata: createWireAdapterConstructor(luvio, getLookupMetadata_ldsAdapter, getLookupMetadataMetadata),
43837
43894
  getLookupRecords: createWireAdapterConstructor(luvio, getLookupRecords_ldsAdapter, getLookupRecordsMetadata),
43838
43895
  getNavItems: createWireAdapterConstructor(luvio, getNavItems_ldsAdapter, getNavItemsMetadata),
43839
43896
  getObjectCreateActions: createWireAdapterConstructor(luvio, getObjectCreateActions_ldsAdapter, getObjectCreateActionsMetadata),
43840
- getObjectInfo: createWireAdapterConstructor(luvio, getObjectInfo_ldsAdapter, getObjectInfoMetadata),
43841
- getObjectInfos: createWireAdapterConstructor(luvio, getObjectInfos_ldsAdapter, getObjectInfosMetadata),
43842
43897
  getPathLayout: createWireAdapterConstructor(luvio, getPathLayout_ldsAdapter, getPathLayoutMetadata),
43843
43898
  getPicklistValues: createWireAdapterConstructor(luvio, getPicklistValues_ldsAdapter, getPicklistValuesMetadata),
43844
43899
  getPicklistValuesByRecordType: createWireAdapterConstructor(luvio, getPicklistValuesByRecordType_ldsAdapter, getPicklistValuesByRecordTypeMetadata),
@@ -43874,6 +43929,9 @@
43874
43929
  updateListPreferences: createLDSAdapter(luvio, adapterName$z, updateListPreferencesAdapterFactory),
43875
43930
  updateRecord: unwrapSnapshotData(factory$2),
43876
43931
  updateRecordAvatar: unwrapSnapshotData(factory$8),
43932
+ // One Store Enabled Adapters
43933
+ getObjectInfo: getLuvioOrOneStoreAdapter(createWireAdapterConstructor(luvio, getObjectInfo_ldsAdapter, getObjectInfoMetadata), configurationForOneStoreEnabledAdapters$2.getGetObjectInfoAdapter()),
43934
+ getObjectInfos: getLuvioOrOneStoreAdapter(createWireAdapterConstructor(luvio, getObjectInfos_ldsAdapter, getObjectInfosMetadata), configurationForOneStoreEnabledAdapters$2.getGetObjectInfosAdapter()),
43877
43935
  // Imperative Adapters
43878
43936
  unstable_getActionOverrides_imperative: createImperativeAdapter(luvio, getActionOverrides_ldsAdapter, getActionOverridesMetadata),
43879
43937
  getAllApps_imperative: createImperativeAdapter(luvio, getAllApps_ldsAdapter, getAllAppsMetadata),
@@ -44099,7 +44157,7 @@
44099
44157
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44100
44158
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44101
44159
  });
44102
- // version: 1.283.0-80ddb6c3c
44160
+ // version: 1.284.0-8b78b708e
44103
44161
 
44104
44162
  var ldsIdempotencyWriteDisabled = {
44105
44163
  isOpen: function (e) {
@@ -55530,7 +55588,7 @@
55530
55588
  * @param objectInfos
55531
55589
  * @returns
55532
55590
  */
55533
- function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
55591
+ function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
55534
55592
  const { selectionSet } = topNode;
55535
55593
  if (selectionSet === undefined)
55536
55594
  return [];
@@ -55544,13 +55602,8 @@
55544
55602
  displayValue = node;
55545
55603
  break;
55546
55604
  }
55547
- if (isInlineFragmentNode(node)) {
55548
- const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
55549
- displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
55550
- }
55551
55605
  }
55552
55606
  if (displayValue !== undefined) {
55553
- const apiName = parentNode.name.value;
55554
55607
  const objectInfo = objectInfos[apiName];
55555
55608
  if (objectInfo !== undefined &&
55556
55609
  objectInfo.nameFields !== undefined &&
@@ -55617,19 +55670,24 @@
55617
55670
  // example: TimeSheetId { value }
55618
55671
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
55619
55672
  }
55620
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
55621
- ...parent,
55622
- name: {
55623
- ...parent.name,
55624
- value: targetRelationship.childObjectApiName,
55625
- },
55626
- }, objectInfos));
55673
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
55627
55674
  }
55628
55675
  }
55629
55676
  }
55630
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
55677
+ else {
55678
+ let apiName = parent.name.value;
55679
+ if (pathToObjectApiNamesMap[parentPath] !== undefined &&
55680
+ pathToObjectApiNamesMap[parentPath].length === 1) {
55681
+ apiName = pathToObjectApiNamesMap[parentPath][0];
55682
+ }
55683
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
55684
+ }
55631
55685
  }
55632
55686
  }
55687
+ else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
55688
+ const { typeCondition: { name: { value: apiName }, }, } = parentNode;
55689
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
55690
+ }
55633
55691
  return [
55634
55692
  ...rootQueryIdField,
55635
55693
  ...flat(parentRelaltionships),
@@ -57314,6 +57372,9 @@
57314
57372
  * Transforms a record for storage in the durable store. The transformation involves denormalizing
57315
57373
  * scalar fields and persisting link metadata to transform back into a normalized representation
57316
57374
  *
57375
+ * If the record contains pending fields this will return undefined as pending records do not get persisted
57376
+ * to the durable store. There should be a refresh operation outbound that will bring in the updated record.
57377
+ *
57317
57378
  * @param normalizedRecord Record containing normalized field links
57318
57379
  * @param recordStore a store containing referenced record fields
57319
57380
  */
@@ -57328,7 +57389,9 @@
57328
57389
  // pending fields get filtered out of the durable store
57329
57390
  const { pending } = field;
57330
57391
  if (pending === true) {
57331
- continue;
57392
+ // do not write records with pending fields to the durable store
57393
+ // there should be a refresh operation outbound that will bring in the updated record
57394
+ return undefined;
57332
57395
  }
57333
57396
  const { __ref } = field;
57334
57397
  if (__ref !== undefined) {
@@ -57494,10 +57557,12 @@
57494
57557
  };
57495
57558
  }
57496
57559
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
57497
- putEntries[recordKey] = {
57498
- data: denormalizedRecord,
57499
- metadata,
57500
- };
57560
+ if (denormalizedRecord !== undefined) {
57561
+ putEntries[recordKey] = {
57562
+ data: denormalizedRecord,
57563
+ metadata,
57564
+ };
57565
+ }
57501
57566
  }
57502
57567
  else {
57503
57568
  putEntries[key] = value;
@@ -60930,17 +60995,6 @@
60930
60995
  },
60931
60996
  };
60932
60997
 
60933
- function setupInspection(luvio) {
60934
- if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
60935
- // when inspection is enabled, make luvio available as a global
60936
- // eslint-disable-next-line no-undef
60937
- globalThis.luvio = luvio;
60938
- registerReportObserver((report) => {
60939
- __nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1$1(report));
60940
- });
60941
- }
60942
- }
60943
-
60944
60998
  /**
60945
60999
  * Copyright (c) 2022, Salesforce, Inc.,
60946
61000
  * All rights reserved.
@@ -62062,6 +62116,21 @@
62062
62116
  return instrumentPrimingSession(session);
62063
62117
  }
62064
62118
 
62119
+ // so eslint doesn't complain about nimbus
62120
+ /* global __nimbus */
62121
+ function setupObserver() {
62122
+ if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
62123
+ registerReportObserver((report) => {
62124
+ __nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
62125
+ name: report.adapterName,
62126
+ serializedConfig: stringify$1$1(report.config),
62127
+ status: report.result,
62128
+ duration: report.executionTime,
62129
+ });
62130
+ });
62131
+ }
62132
+ }
62133
+
62065
62134
  // so eslint doesn't complain about nimbus
62066
62135
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
62067
62136
  /* global __nimbus */
@@ -62156,8 +62225,8 @@
62156
62225
  lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
62157
62226
  // Currently instruments store runtime perf
62158
62227
  setupMobileInstrumentation();
62159
- // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
62160
- setupInspection(lazyLuvio);
62228
+ // If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
62229
+ setupObserver();
62161
62230
  // set storeEval function for lds-adapters-graghql to use
62162
62231
  withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
62163
62232
  const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
@@ -62227,7 +62296,7 @@
62227
62296
  id: '@salesforce/lds-network-adapter',
62228
62297
  instrument: instrument$2,
62229
62298
  });
62230
- // version: 1.283.0-a330da944
62299
+ // version: 1.284.0-a7e8dc51c
62231
62300
 
62232
62301
  const { create: create$3, keys: keys$3 } = Object;
62233
62302
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -81159,6 +81228,32 @@
81159
81228
  * @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
81160
81229
  */
81161
81230
  let trackedFieldLeafNodeIdAndNameOnly$1 = false;
81231
+ /**
81232
+ * One store enabled Get Object Info adapter
81233
+ */
81234
+ let oneStoreGetObjectInfoAdapter$1 = undefined;
81235
+ /**
81236
+ * One store enabled Get Object Infos adapter
81237
+ */
81238
+ let oneStoreGetObjectInfosAdapter$1 = undefined;
81239
+ /**
81240
+ * Defines the configuration API and is exposed internally as well as externally.
81241
+ * Configuration for one store enabled REST adapters only.
81242
+ */
81243
+ const configurationForOneStoreEnabledAdapters$1 = {
81244
+ setGetObjectInfoAdapter: function (adapter) {
81245
+ oneStoreGetObjectInfoAdapter$1 = adapter;
81246
+ },
81247
+ getGetObjectInfoAdapter: function () {
81248
+ return oneStoreGetObjectInfoAdapter$1;
81249
+ },
81250
+ setGetObjectInfosAdapter: function (adapter) {
81251
+ oneStoreGetObjectInfosAdapter$1 = adapter;
81252
+ },
81253
+ getGetObjectInfosAdapter: function () {
81254
+ return oneStoreGetObjectInfosAdapter$1;
81255
+ },
81256
+ };
81162
81257
  /**
81163
81258
  * Defines the configuration API and is exposed internally as well as externally.
81164
81259
  * Configuration for REST adapters only.
@@ -81223,6 +81318,7 @@
81223
81318
  getDraftAwareCreateContentVersionAdapter: function () {
81224
81319
  return draftAwareCreateContentVersionAdapter$1;
81225
81320
  },
81321
+ ...configurationForOneStoreEnabledAdapters$1,
81226
81322
  };
81227
81323
  /**
81228
81324
  * Defines the configuration API and is exposed internally as well as externally.
@@ -81731,6 +81827,7 @@
81731
81827
  // Wire Adapters
81732
81828
  graphql: createGraphQLWireAdapterConstructor(luvio, graphql_ldsAdapter, graphqlMetadata, astResolver),
81733
81829
  graphqlBatch: createGraphQLWireAdapterConstructor(luvio, graphqlBatch_ldsAdapter, graphqlBatchMetadata, astResolver),
81830
+ // One Store Enabled Adapters
81734
81831
  // Imperative Adapters
81735
81832
  graphql_imperative: createGraphQLImperativeAdapter(luvio, graphql_ldsAdapter, graphqlMetadata, astResolver),
81736
81833
  graphqlBatch_imperative: createGraphQLImperativeAdapter(luvio, graphqlBatch_ldsAdapter, graphqlBatchMetadata, astResolver),
@@ -81852,15 +81949,17 @@
81852
81949
  /**
81853
81950
  * Returns the field API name, qualified with an object name if possible.
81854
81951
  * @param value The value from which to get the qualified field API name.
81952
+ * @param onlyQualifiedFieldNames - Whether or not this function should skip fieldApiName that do not include the delimiter '.'
81855
81953
  * @return The qualified field API name.
81856
81954
  */
81857
- function getFieldApiName$1(value) {
81955
+ function getFieldApiName$1(value, onlyQualifiedFieldNames = false) {
81858
81956
  // Note: tightening validation logic changes behavior from userland getting
81859
81957
  // a server-provided error to the adapter noop'ing. In 224 we decided to not
81860
- // change the behavior.
81958
+ // change the behavior. In 250 we decided to add the 'onlyQualifiedFieldName' flag to tighten the logic
81959
+ // optionally to avoid issues with persisted invalid field names.
81861
81960
  if (isString$1(value)) {
81862
81961
  const trimmed = value.trim();
81863
- if (trimmed.length > 0) {
81962
+ if (trimmed.length > 0 && (onlyQualifiedFieldNames ? trimmed.indexOf('.') > -1 : true)) {
81864
81963
  return trimmed;
81865
81964
  }
81866
81965
  }
@@ -81873,15 +81972,19 @@
81873
81972
  /**
81874
81973
  * Returns the field API name.
81875
81974
  * @param value The value from which to get the field API name.
81975
+ * @param options Option bag. onlyQualifiedFieldNames is a boolean that allows this function to skip returning invalid FieldApiNames.
81876
81976
  * @returns The field API name.
81877
81977
  */
81878
- function getFieldApiNamesArray$1(value) {
81978
+ function getFieldApiNamesArray$1(value, options = { onlyQualifiedFieldNames: false }) {
81879
81979
  const valueArray = isArray$2(value) ? value : [value];
81880
81980
  const array = [];
81881
81981
  for (let i = 0, len = valueArray.length; i < len; i += 1) {
81882
81982
  const item = valueArray[i];
81883
- const apiName = getFieldApiName$1(item);
81983
+ const apiName = getFieldApiName$1(item, options.onlyQualifiedFieldNames);
81884
81984
  if (apiName === undefined) {
81985
+ if (options.onlyQualifiedFieldNames) {
81986
+ continue; // Just skips invalid field names rather than failing to return an array at all
81987
+ }
81885
81988
  return undefined;
81886
81989
  }
81887
81990
  push$1.call(array, apiName);
@@ -82228,7 +82331,11 @@
82228
82331
  })(DiscriminatorValues$6 || (DiscriminatorValues$6 = {}));
82229
82332
  ensureRegisteredOnce$1({
82230
82333
  id: '@salesforce/lds-adapters-uiapi',
82231
- configuration: { ...configurationForRestAdapters$1, ...configurationForGraphQLAdapters$1 },
82334
+ configuration: {
82335
+ ...configurationForRestAdapters$1,
82336
+ ...configurationForGraphQLAdapters$1,
82337
+ ...configurationForOneStoreEnabledAdapters$1,
82338
+ },
82232
82339
  instrument: instrument$1,
82233
82340
  });
82234
82341
 
@@ -82237,7 +82344,7 @@
82237
82344
  configuration: { ...configurationForGraphQLAdapters$1 },
82238
82345
  instrument: instrument$1,
82239
82346
  });
82240
- // version: 1.283.0-80ddb6c3c
82347
+ // version: 1.284.0-8b78b708e
82241
82348
 
82242
82349
  // On core the unstable adapters are re-exported with different names,
82243
82350
  // we want to match them here.
@@ -84493,7 +84600,7 @@
84493
84600
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84494
84601
  graphQLImperative = ldsAdapter;
84495
84602
  });
84496
- // version: 1.283.0-80ddb6c3c
84603
+ // version: 1.284.0-8b78b708e
84497
84604
 
84498
84605
  var gqlApi = /*#__PURE__*/Object.freeze({
84499
84606
  __proto__: null,
@@ -84795,63 +84902,75 @@
84795
84902
  }
84796
84903
  }
84797
84904
  /**
84798
- * Executes the specified adapter with the given adapterId and config. Then
84799
- * it replaces the draft with the given id with the draft generated
84800
- * by the mutating adapter. Will call onResult callback once with data or error.
84905
+ * @deprecated There is no situation in which any consumer actually wants to replace the draft.
84906
+ * call {@link invokeAdapterWithDraftToMerge} instead`.
84907
+ * Keep it for now for app back compatibility.
84908
+ * Will be removed in future, ideally 2 releases later.
84909
+ */
84910
+ function invokeAdapterWithDraftToReplace(adapterId, config, draftIdToReplace, onResponse, nativeAdapterRequestContext) {
84911
+ invokeAdapterWithDraftToMerge(adapterId, config, draftIdToReplace, onResponse, nativeAdapterRequestContext);
84912
+ }
84913
+ /**
84914
+ * Executes the specified adapter with the given @param dapterId and @param config. Then
84915
+ * it merge the draft with the given id with the draft generated by
84916
+ * the mutating adapter. Will call onResult callback once with data or error.
84801
84917
  *
84802
84918
  * This function throws an error if the given adapterId cannot be found, or if the
84803
- * adapterId is not a mutating adapter, or if a draft isn't created, or if it
84804
- * fails to parse the given config string.
84919
+ * adapterId is not a mutating adapter if a draft isn't created, or
84920
+ * if it fails to parse the given config string.
84921
+ *
84922
+ * If the @param adapterId is deleteRecod, the invocation of it will generate a delele draft.
84923
+ * The newly generated delete draft will replace the draft specified by @param targetDraftId
84805
84924
  */
84806
- function invokeAdapterWithDraftToReplace(adapterId, config, draftIdToReplace, onResponse, nativeAdapterRequestContext) {
84925
+ function invokeAdapterWithDraftToMerge(adapterId, config, targetDraftId, onResponse, nativeAdapterRequestContext) {
84926
+ const adapter = getDMLAdapterFromName(adapterId);
84927
+ if (adapter === undefined) {
84928
+ // Check if the adapter is non-mutating adapter and create proper error message.
84929
+ const message = getImperativeAdapterFromName(imperativeAdapterKeyBuilder(adapterId)) !== undefined
84930
+ ? NON_MUTATING_ADAPTER_MESSAGE
84931
+ : `adapter ${adapterId} not recognized`;
84932
+ onResponse({
84933
+ data: undefined,
84934
+ error: createNativeFetchErrorResponse(message),
84935
+ });
84936
+ return;
84937
+ }
84938
+ // deleteRecord adapter call will generate a delete draft and
84939
+ // the newly generate draft will replace the target draft
84940
+ if (adapterId === 'deleteRecord') {
84941
+ invokeAdapterWithDraftToMergeDeleteRecord(adapter, config, targetDraftId, onResponse, nativeAdapterRequestContext);
84942
+ return;
84943
+ }
84807
84944
  draftManager.getQueue().then((draftInfo) => {
84808
84945
  const draftIds = draftInfo.items.map((draft) => draft.id);
84809
- if (draftIds.includes(draftIdToReplace) === false) {
84946
+ if (draftIds.includes(targetDraftId) === false) {
84810
84947
  onResponse({
84811
84948
  data: undefined,
84812
84949
  error: createNativeFetchErrorResponse(DRAFT_DOESNT_EXIST_MESSAGE),
84813
84950
  });
84814
84951
  return;
84815
84952
  }
84816
- const adapter = getDMLAdapterFromName(adapterId);
84817
- if (adapter === undefined) {
84818
- // This check is here for legacy purpose
84819
- // So the consumers still get the same errors
84820
- if (getImperativeAdapterFromName(imperativeAdapterKeyBuilder(adapterId)) !== undefined) {
84821
- onResponse({
84822
- data: undefined,
84823
- error: createNativeFetchErrorResponse(NON_MUTATING_ADAPTER_MESSAGE),
84953
+ invokeDmlAdapter(adapter, parse$1(config), (responseValue) => {
84954
+ const draftIds = draftIdsForResponseValue(responseValue);
84955
+ if (responseValue.error === undefined &&
84956
+ draftIds !== undefined &&
84957
+ draftIds.length > 0) {
84958
+ const draftId = draftIds[draftIds.length - 1];
84959
+ draftManager
84960
+ .mergeActions(targetDraftId, draftId)
84961
+ .then(() => {
84962
+ onResponse(responseValue);
84963
+ })
84964
+ .catch((error) => {
84965
+ onResponse(convertErrorIntoNativeFetchError(error, `Unknown error merging draft`));
84824
84966
  });
84825
- return;
84826
84967
  }
84827
- throw Error(`adapter ${adapterId} not recognized`);
84828
- }
84829
- if (adapterId === 'deleteRecord') {
84830
- invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToReplace, onResponse, nativeAdapterRequestContext);
84831
- }
84832
- else {
84833
- invokeDmlAdapter(adapter, parse$1(config), (responseValue) => {
84834
- const draftIds = draftIdsForResponseValue(responseValue);
84835
- if (responseValue.error === undefined &&
84836
- draftIds !== undefined &&
84837
- draftIds.length > 0) {
84838
- const draftId = draftIds[draftIds.length - 1];
84839
- draftManager
84840
- .replaceAction(draftIdToReplace, draftId)
84841
- .then(() => {
84842
- onResponse(responseValue);
84843
- })
84844
- .catch((error) => {
84845
- onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
84846
- });
84847
- }
84848
- else {
84849
- let response = responseValue;
84850
- response.error = createNativeFetchErrorResponse(NO_DRAFT_CREATED_MESSAGE);
84851
- onResponse(response);
84852
- }
84853
- }, nativeAdapterRequestContext);
84854
- }
84968
+ else {
84969
+ let response = responseValue;
84970
+ response.error = createNativeFetchErrorResponse(NO_DRAFT_CREATED_MESSAGE);
84971
+ onResponse(response);
84972
+ }
84973
+ }, nativeAdapterRequestContext);
84855
84974
  });
84856
84975
  }
84857
84976
  /**
@@ -84959,11 +85078,11 @@
84959
85078
  }
84960
85079
  /*
84961
85080
  //TODO W-10284305: Remove this function in 238
84962
- This is a special case version of the invokeAdapterWithDraftToReplace function
85081
+ This is a special case version of the invokeAdapterWithDraftToMerge function
84963
85082
  which should only be used for the deleteRecord wire adapter, since it does not
84964
85083
  contain record data in the result and has to do special querying of the draft queue
84965
85084
  */
84966
- function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToReplace, onResponse, nativeAdapterRequestContext) {
85085
+ function invokeAdapterWithDraftToMergeDeleteRecord(adapter, config, draftIdToReplace, onResponse, nativeAdapterRequestContext) {
84967
85086
  const targetedRecordId = parse$1(config);
84968
85087
  let priorDraftIds;
84969
85088
  draftManager.getQueue().then((draftState) => {
@@ -85219,7 +85338,7 @@
85219
85338
  function register(r) {
85220
85339
  callbacks$1.forEach((callback) => callback(r));
85221
85340
  }
85222
- // version: 1.283.0-a330da944
85341
+ // version: 1.284.0-a7e8dc51c
85223
85342
 
85224
85343
  /**
85225
85344
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -89203,6 +89322,32 @@
89203
89322
  * @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
89204
89323
  */
89205
89324
  let trackedFieldLeafNodeIdAndNameOnly = false;
89325
+ /**
89326
+ * One store enabled Get Object Info adapter
89327
+ */
89328
+ let oneStoreGetObjectInfoAdapter = undefined;
89329
+ /**
89330
+ * One store enabled Get Object Infos adapter
89331
+ */
89332
+ let oneStoreGetObjectInfosAdapter = undefined;
89333
+ /**
89334
+ * Defines the configuration API and is exposed internally as well as externally.
89335
+ * Configuration for one store enabled REST adapters only.
89336
+ */
89337
+ const configurationForOneStoreEnabledAdapters = {
89338
+ setGetObjectInfoAdapter: function (adapter) {
89339
+ oneStoreGetObjectInfoAdapter = adapter;
89340
+ },
89341
+ getGetObjectInfoAdapter: function () {
89342
+ return oneStoreGetObjectInfoAdapter;
89343
+ },
89344
+ setGetObjectInfosAdapter: function (adapter) {
89345
+ oneStoreGetObjectInfosAdapter = adapter;
89346
+ },
89347
+ getGetObjectInfosAdapter: function () {
89348
+ return oneStoreGetObjectInfosAdapter;
89349
+ },
89350
+ };
89206
89351
  /**
89207
89352
  * Defines the configuration API and is exposed internally as well as externally.
89208
89353
  * Configuration for REST adapters only.
@@ -89267,6 +89412,7 @@
89267
89412
  getDraftAwareCreateContentVersionAdapter: function () {
89268
89413
  return draftAwareCreateContentVersionAdapter;
89269
89414
  },
89415
+ ...configurationForOneStoreEnabledAdapters,
89270
89416
  };
89271
89417
  /**
89272
89418
  * Defines the configuration API and is exposed internally as well as externally.
@@ -89439,15 +89585,17 @@
89439
89585
  /**
89440
89586
  * Returns the field API name, qualified with an object name if possible.
89441
89587
  * @param value The value from which to get the qualified field API name.
89588
+ * @param onlyQualifiedFieldNames - Whether or not this function should skip fieldApiName that do not include the delimiter '.'
89442
89589
  * @return The qualified field API name.
89443
89590
  */
89444
- function getFieldApiName(value) {
89591
+ function getFieldApiName(value, onlyQualifiedFieldNames = false) {
89445
89592
  // Note: tightening validation logic changes behavior from userland getting
89446
89593
  // a server-provided error to the adapter noop'ing. In 224 we decided to not
89447
- // change the behavior.
89594
+ // change the behavior. In 250 we decided to add the 'onlyQualifiedFieldName' flag to tighten the logic
89595
+ // optionally to avoid issues with persisted invalid field names.
89448
89596
  if (isString(value)) {
89449
89597
  const trimmed = value.trim();
89450
- if (trimmed.length > 0) {
89598
+ if (trimmed.length > 0 && (onlyQualifiedFieldNames ? trimmed.indexOf('.') > -1 : true)) {
89451
89599
  return trimmed;
89452
89600
  }
89453
89601
  }
@@ -89460,15 +89608,19 @@
89460
89608
  /**
89461
89609
  * Returns the field API name.
89462
89610
  * @param value The value from which to get the field API name.
89611
+ * @param options Option bag. onlyQualifiedFieldNames is a boolean that allows this function to skip returning invalid FieldApiNames.
89463
89612
  * @returns The field API name.
89464
89613
  */
89465
- function getFieldApiNamesArray(value) {
89614
+ function getFieldApiNamesArray(value, options = { onlyQualifiedFieldNames: false }) {
89466
89615
  const valueArray = isArray(value) ? value : [value];
89467
89616
  const array = [];
89468
89617
  for (let i = 0, len = valueArray.length; i < len; i += 1) {
89469
89618
  const item = valueArray[i];
89470
- const apiName = getFieldApiName(item);
89619
+ const apiName = getFieldApiName(item, options.onlyQualifiedFieldNames);
89471
89620
  if (apiName === undefined) {
89621
+ if (options.onlyQualifiedFieldNames) {
89622
+ continue; // Just skips invalid field names rather than failing to return an array at all
89623
+ }
89472
89624
  return undefined;
89473
89625
  }
89474
89626
  push.call(array, apiName);
@@ -89817,7 +89969,11 @@
89817
89969
  ObjectCreate$1(null);
89818
89970
  ensureRegisteredOnce({
89819
89971
  id: '@salesforce/lds-adapters-uiapi',
89820
- configuration: { ...configurationForRestAdapters, ...configurationForGraphQLAdapters },
89972
+ configuration: {
89973
+ ...configurationForRestAdapters,
89974
+ ...configurationForGraphQLAdapters,
89975
+ ...configurationForOneStoreEnabledAdapters,
89976
+ },
89821
89977
  instrument,
89822
89978
  });
89823
89979
 
@@ -90142,6 +90298,7 @@
90142
90298
  exports.executeMutatingAdapter = executeMutatingAdapter;
90143
90299
  exports.getImperativeAdapterNames = getImperativeAdapterNames;
90144
90300
  exports.invokeAdapter = invokeAdapter;
90301
+ exports.invokeAdapterWithDraftToMerge = invokeAdapterWithDraftToMerge;
90145
90302
  exports.invokeAdapterWithDraftToReplace = invokeAdapterWithDraftToReplace;
90146
90303
  exports.invokeAdapterWithMetadata = invokeAdapterWithMetadata;
90147
90304
  exports.nimbusDraftQueue = nimbusDraftQueue;
@@ -90152,4 +90309,4 @@
90152
90309
  exports.subscribeToAdapter = subscribeToAdapter;
90153
90310
 
90154
90311
  }));
90155
- // version: 1.283.0-a330da944
90312
+ // version: 1.284.0-a7e8dc51c