@salesforce/lds-runtime-bridge 1.296.0 → 1.297.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.
@@ -11,12 +11,10 @@
11
11
  * Any changes made to this file in p4 will be automatically overwritten.
12
12
  * *******************************************************************************************
13
13
  */
14
- import { setDefaultLuvio } from 'force/ldsEngine';
14
+ import { register, setDefaultLuvio } from 'force/ldsEngine';
15
15
  import { setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, InMemoryStore, Environment, Luvio } from 'force/luvioEngine';
16
16
  import { instrumentLuvio } from 'force/ldsInstrumentation';
17
- import { isStoreKeyRecordViewEntity, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, extractRecordIdFromStoreKey, RECORD_VIEW_ENTITY_ID_PREFIX, keyBuilderRecord } from 'native/ldsAdaptersUiapiMobile';
18
- import '@salesforce/gate/lds.idempotencyWriteDisabled';
19
- import '@salesforce/gate/lds.backdatingEnabled';
17
+ import 'force/ldsGraphqlParser';
20
18
  import networkAdapter from 'force/ldsNetwork';
21
19
  import ldsEngineCreator from 'force/ldsEngineCreator';
22
20
 
@@ -42,7 +40,7 @@ const RedirectDurableSegment = 'REDIRECT_KEYS';
42
40
  const MessagingDurableSegment = 'MESSAGING';
43
41
  const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
44
42
 
45
- const { keys: keys$2, create: create$2, assign: assign$2, freeze: freeze$1 } = Object;
43
+ const { keys: keys$3, create: create$3, assign: assign$3, freeze: freeze$2 } = Object;
46
44
 
47
45
  //Durable store error instrumentation key
48
46
  const DURABLE_STORE_ERROR = 'durable-store-error';
@@ -92,7 +90,7 @@ function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
92
90
  if (durableRecords === undefined) {
93
91
  return { revivedKeys, hadUnexpectedShape };
94
92
  }
95
- const durableKeys = keys$2(durableRecords);
93
+ const durableKeys = keys$3(durableRecords);
96
94
  if (durableKeys.length === 0) {
97
95
  // no records to revive
98
96
  return { revivedKeys, hadUnexpectedShape };
@@ -277,7 +275,7 @@ class DurableTTLStore {
277
275
  overrides,
278
276
  };
279
277
  }
280
- const keys$1 = keys$2(entries);
278
+ const keys$1 = keys$3(entries);
281
279
  for (let i = 0, len = keys$1.length; i < len; i++) {
282
280
  const key = keys$1[i];
283
281
  const entry = entries[key];
@@ -299,14 +297,14 @@ class DurableTTLStore {
299
297
  }
300
298
 
301
299
  function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
302
- const durableRecords = create$2(null);
303
- const refreshedDurableRecords = create$2(null);
304
- const evictedRecords = create$2(null);
300
+ const durableRecords = create$3(null);
301
+ const refreshedDurableRecords = create$3(null);
302
+ const evictedRecords = create$3(null);
305
303
  const { visitedIds, refreshedIds } = store.fallbackStringKeyInMemoryStore;
306
304
  // TODO: W-8909393 Once metadata is stored in its own segment we need to
307
305
  // call setEntries for the visitedIds on default segment and call setEntries
308
306
  // on the metadata segment for the refreshedIds
309
- const keys$1 = keys$2({ ...visitedIds, ...refreshedIds });
307
+ const keys$1 = keys$3({ ...visitedIds, ...refreshedIds });
310
308
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
311
309
  const key = keys$1[i];
312
310
  const canonicalKey = store.getCanonicalRecordId(key);
@@ -329,7 +327,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
329
327
  setRecordTo(entries, key, record, metadata);
330
328
  }
331
329
  const durableStoreOperations = additionalDurableStoreOperations;
332
- const recordKeys = keys$2(durableRecords);
330
+ const recordKeys = keys$3(durableRecords);
333
331
  if (recordKeys.length > 0) {
334
332
  // publishes with data
335
333
  durableStoreOperations.push({
@@ -338,7 +336,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
338
336
  segment: DefaultDurableSegment,
339
337
  });
340
338
  }
341
- const refreshKeys = keys$2(refreshedDurableRecords);
339
+ const refreshKeys = keys$3(refreshedDurableRecords);
342
340
  if (refreshKeys.length > 0) {
343
341
  // publishes with only metadata updates
344
342
  durableStoreOperations.push({
@@ -360,7 +358,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
360
358
  });
361
359
  });
362
360
  // evicts
363
- const evictedKeys = keys$2(evictedRecords);
361
+ const evictedKeys = keys$3(evictedRecords);
364
362
  if (evictedKeys.length > 0) {
365
363
  durableStoreOperations.push({
366
364
  type: 'evictEntries',
@@ -464,7 +462,7 @@ function buildRevivingStagingStore(upstreamStore) {
464
462
  // A reviving store is only "active" during a call to `environment.storeLookup`, and will
465
463
  // be used by the reader attempting to build an L1 snapshot. Immediately after the L1 rebuild
466
464
  // the reviving store becomes inactive other than receiving change notifications.
467
- return create$2(upstreamStore, {
465
+ return create$3(upstreamStore, {
468
466
  readEntry: { value: readEntry },
469
467
  markStale: { value: markStale },
470
468
  clearStale: { value: clearStale },
@@ -476,7 +474,7 @@ const AdapterContextSegment = 'ADAPTER-CONTEXT';
476
474
  const ADAPTER_CONTEXT_ID_SUFFIX = '__NAMED_CONTEXT';
477
475
  async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorHandler, contextStores, pendingContextStoreKeys, onContextLoaded) {
478
476
  // initialize empty context store
479
- contextStores[adapterId] = create$2(null);
477
+ contextStores[adapterId] = create$3(null);
480
478
  const context = {
481
479
  set(key, value) {
482
480
  contextStores[adapterId][key] = value;
@@ -541,7 +539,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
541
539
  const revivingStores = new Set();
542
540
  // redirects that need to be flushed to the durable store
543
541
  const pendingStoreRedirects = new Map();
544
- const contextStores = create$2(null);
542
+ const contextStores = create$3(null);
545
543
  let initializationPromise = new Promise((resolve) => {
546
544
  const finish = () => {
547
545
  resolve();
@@ -618,7 +616,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
618
616
  try {
619
617
  const entries = await durableStore.getEntries(adapterContextKeysFromDifferentInstance, AdapterContextSegment);
620
618
  if (entries !== undefined) {
621
- const entryKeys = keys$2(entries);
619
+ const entryKeys = keys$3(entries);
622
620
  for (let i = 0, len = entryKeys.length; i < len; i++) {
623
621
  const entryKey = entryKeys[i];
624
622
  const entry = entries[entryKey];
@@ -653,7 +651,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
653
651
  if (filteredKeys.length > 0) {
654
652
  const entries = await durableStore.getMetadata(filteredKeys, DefaultDurableSegment);
655
653
  if (entries !== undefined) {
656
- const entryKeys = keys$2(entries);
654
+ const entryKeys = keys$3(entries);
657
655
  for (let i = 0, len = entryKeys.length; i < len; i++) {
658
656
  const entryKey = entryKeys[i];
659
657
  const { metadata } = entries[entryKey];
@@ -1025,7 +1023,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1025
1023
  validateNotDisposed();
1026
1024
  const entryKeys = keys$1.map(serializeStructuredKey);
1027
1025
  const entries = await durableStore.getEntries(entryKeys, DefaultDurableSegment);
1028
- if (entries === undefined || keys$2(entries).length === 0) {
1026
+ if (entries === undefined || keys$3(entries).length === 0) {
1029
1027
  return environment.notifyStoreUpdateAvailable(keys$1);
1030
1028
  }
1031
1029
  const now = Date.now();
@@ -1077,7 +1075,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1077
1075
  type: 'stale-while-revalidate',
1078
1076
  staleDurationSeconds: Number.MAX_SAFE_INTEGER,
1079
1077
  });
1080
- return create$2(environment, {
1078
+ return create$3(environment, {
1081
1079
  publishStoreMetadata: { value: publishStoreMetadata },
1082
1080
  storeIngest: { value: storeIngest },
1083
1081
  storeIngestError: { value: storeIngestError },
@@ -1107,7 +1105,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1107
1105
  });
1108
1106
  }
1109
1107
 
1110
- const { keys: keys$1, create: create$1, assign: assign$1, entries: entries$1, values: values$1 } = Object;
1108
+ const { keys: keys$2, create: create$2, assign: assign$2, entries: entries$1, values: values$1 } = Object;
1111
1109
  const { stringify, parse } = JSON;
1112
1110
 
1113
1111
  function selectColumnsFromTableWhereKeyIn(columnNames, table, keyColumnName, whereIn) {
@@ -1174,7 +1172,7 @@ class LdsDataTable {
1174
1172
  },
1175
1173
  conflictColumns: this.conflictColumnNames,
1176
1174
  columns: this.columnNames,
1177
- rows: keys$1(entries).reduce((rows, key) => {
1175
+ rows: keys$2(entries).reduce((rows, key) => {
1178
1176
  const entry = entries[key];
1179
1177
  const { data, metadata } = entry;
1180
1178
  const row = [key, stringify(data), metadata ? stringify(metadata) : null];
@@ -1193,7 +1191,7 @@ class LdsDataTable {
1193
1191
  type: 'setMetadata',
1194
1192
  },
1195
1193
  columns: [COLUMN_NAME_METADATA$1],
1196
- values: keys$1(entries).reduce((values, key) => {
1194
+ values: keys$2(entries).reduce((values, key) => {
1197
1195
  const { metadata } = entries[key];
1198
1196
  const row = [metadata ? stringify(metadata) : null];
1199
1197
  values[key] = row;
@@ -1283,7 +1281,7 @@ class LdsInternalDataTable {
1283
1281
  },
1284
1282
  conflictColumns: this.conflictColumnNames,
1285
1283
  columns: this.columnNames,
1286
- rows: keys$1(entries).reduce((rows, key) => {
1284
+ rows: keys$2(entries).reduce((rows, key) => {
1287
1285
  const entry = entries[key];
1288
1286
  const { data, metadata } = entry;
1289
1287
  const row = [key, stringify(data)];
@@ -1309,7 +1307,7 @@ class LdsInternalDataTable {
1309
1307
  type: 'setMetadata',
1310
1308
  },
1311
1309
  columns: [COLUMN_NAME_METADATA],
1312
- values: keys$1(entries).reduce((values, key) => {
1310
+ values: keys$2(entries).reduce((values, key) => {
1313
1311
  const { metadata } = entries[key];
1314
1312
  const row = [metadata ? stringify(metadata) : null];
1315
1313
  values[key] = row;
@@ -1318,7 +1316,7 @@ class LdsInternalDataTable {
1318
1316
  };
1319
1317
  }
1320
1318
  metadataToUpdateSQLQueries(entries, segment) {
1321
- return keys$1(entries).reduce((accu, key) => {
1319
+ return keys$2(entries).reduce((accu, key) => {
1322
1320
  const { metadata } = entries[key];
1323
1321
  if (metadata !== undefined) {
1324
1322
  accu.push({
@@ -1389,7 +1387,7 @@ class NimbusSqliteStore {
1389
1387
  return this.getTable(segment).getAll(segment);
1390
1388
  }
1391
1389
  setEntries(entries, segment) {
1392
- if (keys$1(entries).length === 0) {
1390
+ if (keys$2(entries).length === 0) {
1393
1391
  return Promise.resolve();
1394
1392
  }
1395
1393
  const table = this.getTable(segment);
@@ -1397,7 +1395,7 @@ class NimbusSqliteStore {
1397
1395
  return this.batchOperationAsPromise([upsertOperation]);
1398
1396
  }
1399
1397
  setMetadata(entries, segment) {
1400
- if (keys$1(entries).length === 0) {
1398
+ if (keys$2(entries).length === 0) {
1401
1399
  return Promise.resolve();
1402
1400
  }
1403
1401
  const table = this.getTable(segment);
@@ -1416,13 +1414,13 @@ class NimbusSqliteStore {
1416
1414
  batchOperations(operations) {
1417
1415
  const sqliteOperations = operations.reduce((acc, cur) => {
1418
1416
  if (cur.type === 'setEntries') {
1419
- if (keys$1(cur.entries).length > 0) {
1417
+ if (keys$2(cur.entries).length > 0) {
1420
1418
  const table = this.getTable(cur.segment);
1421
1419
  acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
1422
1420
  }
1423
1421
  }
1424
1422
  else if (cur.type === 'setMetadata') {
1425
- if (keys$1(cur.entries).length > 0) {
1423
+ if (keys$2(cur.entries).length > 0) {
1426
1424
  const table = this.getTable(cur.segment);
1427
1425
  if (this.supportsBatchUpdates) {
1428
1426
  acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
@@ -1521,143 +1519,746 @@ class NimbusSqliteStore {
1521
1519
  */
1522
1520
 
1523
1521
 
1524
- function isStoreKeyRecordId(key) {
1525
- return key.indexOf(RECORD_ID_PREFIX) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1;
1526
- }
1527
- function buildRecordFieldStoreKey(recordKey, fieldName) {
1528
- return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION}${fieldName}`;
1529
- }
1530
-
1531
- function isStoreRecordError(storeRecord) {
1532
- return storeRecord.__type === 'error';
1533
- }
1534
- function isEntryDurableRecordRepresentation(entry, key) {
1535
- // Either a DurableRecordRepresentation or StoreRecordError can live at a record key
1536
- return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity(key)) &&
1537
- entry.data.__type === undefined);
1538
- }
1539
-
1540
1522
  /**
1541
- * Copyright (c) 2022, Salesforce, Inc.,
1542
- * All rights reserved.
1543
- * For full license text, see the LICENSE.txt file
1523
+ * Defines configuration for the module with a default value which can be overridden by the runtime environment.
1544
1524
  */
1525
+ /**
1526
+ * Environment Aware GraphQLBatch adapter
1527
+ */
1528
+ let environmentAwareGraphQLBatchAdapter = undefined;
1529
+ /**
1530
+ * Draft-aware GraphQL adapter
1531
+ */
1532
+ let draftAwareGraphQLAdapter = undefined;
1533
+ /**
1534
+ * Draft-aware createRecord adapter
1535
+ */
1536
+ let draftAwareCreateRecordAdapter = undefined;
1537
+ /**
1538
+ * Draft-aware updateRecord adapter
1539
+ */
1540
+ let draftAwareUpdateRecordAdapter = undefined;
1541
+ /**
1542
+ * Draft-aware deleteRecord adapter
1543
+ */
1544
+ let draftAwareDeleteRecordAdapter = undefined;
1545
+ /**
1546
+ * Draft-aware createContentDocumentAndVersion adapter
1547
+ */
1548
+ let draftAwareCreateContentDocumentAndVersionAdapter = undefined;
1549
+ /**
1550
+ * Draft-aware createContentVersion adapter
1551
+ */
1552
+ let draftAwareCreateContentVersionAdapter = undefined;
1553
+ /**
1554
+ * Depth to which tracked fields will be added to a request that results from a cache miss.
1555
+ * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
1556
+ * be reached by following 1 relationship from the root record, etc.
1557
+ * @defaultValue '5', replicates the current behavior
1558
+ */
1559
+ let trackedFieldDepthOnCacheMiss = 5;
1560
+ /**
1561
+ * Depth to which tracked fields will be added to a request that results from a merge conflict
1562
+ * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
1563
+ * be reached by following 1 relationship from the root record, etc.
1564
+ * @defaultValue '5', replicates the current behavior
1565
+ */
1566
+ let trackedFieldDepthOnCacheMergeConflict = 5;
1567
+ /**
1568
+ * Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
1569
+ * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
1570
+ * be reached by following 1 relationship from the root record, etc.
1571
+ * @defaultValue '5', replicates the current behavior
1572
+ */
1573
+ let trackedFieldDepthOnNotifyChange = 5;
1574
+ /**
1575
+ * Determines if we will only fetch the 'Id' field for the leaf relationship record
1576
+ * @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
1577
+ */
1578
+ let trackedFieldLeafNodeIdAndNameOnly = false;
1579
+ /**
1580
+ * One store enabled Get Object Info adapter
1581
+ */
1582
+ let oneStoreGetObjectInfoAdapter = undefined;
1583
+ /**
1584
+ * One store enabled Get Object Infos adapter
1585
+ */
1586
+ let oneStoreGetObjectInfosAdapter = undefined;
1587
+ /**
1588
+ * Determines when to include PDL strategies for Related Lists
1589
+ */
1590
+ let relatedListsPredictionsEnabled = false;
1591
+ /**
1592
+ * Defines the configuration API and is exposed internally as well as externally.
1593
+ * Configuration for one store enabled REST adapters only.
1594
+ */
1595
+ const configurationForOneStoreEnabledAdapters = {
1596
+ setGetObjectInfoAdapter: function (adapter) {
1597
+ oneStoreGetObjectInfoAdapter = adapter;
1598
+ },
1599
+ getGetObjectInfoAdapter: function () {
1600
+ return oneStoreGetObjectInfoAdapter;
1601
+ },
1602
+ setGetObjectInfosAdapter: function (adapter) {
1603
+ oneStoreGetObjectInfosAdapter = adapter;
1604
+ },
1605
+ getGetObjectInfosAdapter: function () {
1606
+ return oneStoreGetObjectInfosAdapter;
1607
+ },
1608
+ };
1609
+ /**
1610
+ * Defines the configuration API and is exposed internally as well as externally.
1611
+ * Configuration for REST adapters only.
1612
+ */
1613
+ const configurationForRestAdapters = {
1614
+ setTrackedFieldDepthOnCacheMiss: function (trackedFieldDepthOnCacheMissParam) {
1615
+ trackedFieldDepthOnCacheMiss = trackedFieldDepthOnCacheMissParam;
1616
+ },
1617
+ getTrackedFieldDepthOnCacheMiss: function () {
1618
+ return trackedFieldDepthOnCacheMiss;
1619
+ },
1620
+ setTrackedFieldDepthOnCacheMergeConflict: function (trackedFieldDepthOnCacheMergeConflictParam) {
1621
+ trackedFieldDepthOnCacheMergeConflict = trackedFieldDepthOnCacheMergeConflictParam;
1622
+ },
1623
+ getTrackedFieldDepthOnCacheMergeConflict: function () {
1624
+ return trackedFieldDepthOnCacheMergeConflict;
1625
+ },
1626
+ setTrackedFieldDepthOnNotifyChange: function (trackedFieldDepthOnNotifyChangeParam) {
1627
+ trackedFieldDepthOnNotifyChange = trackedFieldDepthOnNotifyChangeParam;
1628
+ },
1629
+ getTrackedFieldDepthOnNotifyChange: function () {
1630
+ return trackedFieldDepthOnNotifyChange;
1631
+ },
1632
+ setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
1633
+ trackedFieldLeafNodeIdAndNameOnly = trackedFieldLeafNodeIdAndNameOnlyParam;
1634
+ },
1635
+ getTrackedFieldLeafNodeIdAndNameOnly: function () {
1636
+ return trackedFieldLeafNodeIdAndNameOnly;
1637
+ },
1638
+ // createRecord
1639
+ setDraftAwareCreateRecordAdapter: function (adapter) {
1640
+ draftAwareCreateRecordAdapter = adapter;
1641
+ },
1642
+ getDraftAwareCreateRecordAdapter: function () {
1643
+ return draftAwareCreateRecordAdapter;
1644
+ },
1645
+ // updateRecord
1646
+ setDraftAwareUpdateRecordAdapter: function (adapter) {
1647
+ draftAwareUpdateRecordAdapter = adapter;
1648
+ },
1649
+ getDraftAwareUpdateRecordAdapter: function () {
1650
+ return draftAwareUpdateRecordAdapter;
1651
+ },
1652
+ // deleteRecord
1653
+ setDraftAwareDeleteRecordAdapter: function (adapter) {
1654
+ draftAwareDeleteRecordAdapter = adapter;
1655
+ },
1656
+ getDraftAwareDeleteRecordAdapter: function () {
1657
+ return draftAwareDeleteRecordAdapter;
1658
+ },
1659
+ // createContentDocumentAndVersion
1660
+ setDraftAwareCreateContentDocumentAndVersionAdapter: function (adapter) {
1661
+ draftAwareCreateContentDocumentAndVersionAdapter = adapter;
1662
+ },
1663
+ getDraftAwareCreateContentDocumentAndVersionAdapter: function () {
1664
+ return draftAwareCreateContentDocumentAndVersionAdapter;
1665
+ },
1666
+ setRelatedListsPredictionsEnabled: function (f) {
1667
+ relatedListsPredictionsEnabled = f;
1668
+ },
1669
+ areRelatedListsPredictionsEnabled: function () {
1670
+ return relatedListsPredictionsEnabled === true;
1671
+ },
1672
+ // createContentVersion
1673
+ setDraftAwareCreateContentVersionAdapter: function (adapter) {
1674
+ draftAwareCreateContentVersionAdapter = adapter;
1675
+ },
1676
+ getDraftAwareCreateContentVersionAdapter: function () {
1677
+ return draftAwareCreateContentVersionAdapter;
1678
+ },
1679
+ ...configurationForOneStoreEnabledAdapters,
1680
+ };
1681
+ /**
1682
+ * Defines the configuration API and is exposed internally as well as externally.
1683
+ * Configuration for GraphQL adapters only.
1684
+ */
1685
+ const configurationForGraphQLAdapters = {
1686
+ setDraftAwareGraphQLAdapter: function (adapter) {
1687
+ draftAwareGraphQLAdapter = adapter;
1688
+ },
1689
+ getDraftAwareGraphQLAdapter: function () {
1690
+ return draftAwareGraphQLAdapter;
1691
+ },
1692
+ setEnvironmentAwareGraphQLBatchAdapter: function (adapter) {
1693
+ environmentAwareGraphQLBatchAdapter = adapter;
1694
+ },
1695
+ getEnvironmentAwareGraphQLBatchAdapter: function () {
1696
+ return environmentAwareGraphQLBatchAdapter;
1697
+ },
1698
+ };
1699
+ const registrations = new Set();
1700
+ /**
1701
+ * lds-adapter-uiapi is special. The non-SFDC bundle combines REST and GQL adapters,
1702
+ * yet for SFDC those are separate bundles. So non-SFDC bundle (./main.ts) registers
1703
+ * both REST and GQL configs. We want each SFDC bundle to register (we don't want one
1704
+ * SFDC bundle to assume the other is being loaded and therefore the other one will
1705
+ * take care of registration) but we don't want to double register either.
1706
+ *
1707
+ * So we make this function that memoizes if it's been called before and only
1708
+ * actually registers once.
1709
+ */
1710
+ function ensureRegisteredOnce(registration) {
1711
+ const { id } = registration;
1712
+ if (!registrations.has(id)) {
1713
+ register(registration);
1714
+ registrations.add(id);
1715
+ }
1716
+ }
1545
1717
 
1546
-
1547
- var DraftActionStatus;
1548
- (function (DraftActionStatus) {
1549
- DraftActionStatus["Pending"] = "pending";
1550
- DraftActionStatus["Uploading"] = "uploading";
1551
- DraftActionStatus["Error"] = "error";
1552
- DraftActionStatus["Completed"] = "completed";
1553
- })(DraftActionStatus || (DraftActionStatus = {}));
1554
- var ProcessActionResult;
1555
- (function (ProcessActionResult) {
1556
- // non-2xx network error, requires user intervention
1557
- ProcessActionResult["ACTION_ERRORED"] = "ERROR";
1558
- // upload succeeded
1559
- ProcessActionResult["ACTION_SUCCEEDED"] = "SUCCESS";
1560
- // queue is empty
1561
- ProcessActionResult["NO_ACTION_TO_PROCESS"] = "NO_ACTION_TO_PROCESS";
1562
- // network request is in flight
1563
- ProcessActionResult["ACTION_ALREADY_PROCESSING"] = "ACTION_ALREADY_PROCESSING";
1564
- // network call failed (offline)
1565
- ProcessActionResult["NETWORK_ERROR"] = "NETWORK_ERROR";
1566
- // queue is blocked on an error that requires user intervention
1567
- ProcessActionResult["BLOCKED_ON_ERROR"] = "BLOCKED_ON_ERROR";
1568
- //waiting for user to execute custom action
1569
- ProcessActionResult["CUSTOM_ACTION_WAITING"] = "CUSTOM_ACTION_WAITING";
1570
- })(ProcessActionResult || (ProcessActionResult = {}));
1571
- var DraftQueueState;
1572
- (function (DraftQueueState) {
1573
- /** Currently processing an item in the queue or queue is empty and waiting to process the next item. */
1574
- DraftQueueState["Started"] = "started";
1575
- /**
1576
- * The queue is stopped and will not attempt to upload any drafts until startDraftQueue() is called.
1577
- * This is the initial state when the DraftQueue gets instantiated.
1578
- */
1579
- DraftQueueState["Stopped"] = "stopped";
1580
- /**
1581
- * The queue is stopped due to a blocking error from the last upload attempt.
1582
- * The queue will not run again until startDraftQueue() is called.
1583
- */
1584
- DraftQueueState["Error"] = "error";
1585
- /**
1586
- * There was a network error and the queue will attempt to upload again shortly.
1587
- * To attempt to force an upload now call startDraftQueue().
1588
- */
1589
- DraftQueueState["Waiting"] = "waiting";
1590
- })(DraftQueueState || (DraftQueueState = {}));
1591
- var DraftQueueEventType;
1592
- (function (DraftQueueEventType) {
1593
- /**
1594
- * Triggered after an action had been added to the queue
1595
- */
1596
- DraftQueueEventType["ActionAdded"] = "added";
1718
+ // For use by callers within this module to instrument interesting things.
1719
+ let instrumentation = {
1597
1720
  /**
1598
- * Triggered when starting to upload and process an action
1721
+ * Called when a set of record conflicts has been fully resolved. The
1722
+ * parameter indicates the number of server requests that were needed
1723
+ * to fully resolve all the record conflicts.
1599
1724
  */
1600
- DraftQueueEventType["ActionUploading"] = "uploading";
1725
+ recordConflictsResolved: (_serverRequestCount) => { },
1601
1726
  /**
1602
- * Triggered once an action failed
1727
+ * Called during merging of incoming and existing FieldValues.
1728
+ * Called when the incoming FieldValue display value is null.
1729
+ *
1730
+ * Note: Temporary instrumentation to capture distribution and frequency, W-8990630
1731
+ * Flipped to counter metric due to W-9611107
1603
1732
  */
1604
- DraftQueueEventType["ActionFailed"] = "failed";
1733
+ nullDisplayValueConflict: (_fieldInfo) => { },
1605
1734
  /**
1606
- * Triggered after an action has been deleted from the queue
1735
+ * SFDC Throttling
1736
+ * getRecordNotifyChange and notifyRecordUpdateAvailable are both throttled
1607
1737
  */
1608
- DraftQueueEventType["ActionDeleted"] = "deleted";
1738
+ getRecordNotifyChangeAllowed: () => { },
1739
+ getRecordNotifyChangeDropped: () => { },
1740
+ notifyRecordUpdateAvailableAllowed: () => { },
1741
+ notifyRecordUpdateAvailableDropped: () => { },
1609
1742
  /**
1610
- * Triggered after an action has been completed and after it has been removed from the queue
1743
+ * RecordRepresentation merge
1744
+ * Called when records change apiName
1611
1745
  */
1612
- DraftQueueEventType["ActionCompleted"] = "completed";
1746
+ recordApiNameChanged: (_existingApiName, _incomingApiName) => { },
1747
+ recordTypeIdIsNull: (_apiName) => { },
1613
1748
  /**
1614
- * Triggered after an action has been updated by the updateAction API
1749
+ * RecordRepresentation merge
1750
+ * Called when either incoming or existing RecordRepresentation has a weakEtag=0
1615
1751
  */
1616
- DraftQueueEventType["ActionUpdated"] = "updated";
1752
+ weakEtagZero: (_incomingWeakEtagZero, _existingWeakEtagZero, _apiName) => { },
1617
1753
  /**
1618
- * Triggered after the Draft Queue state changes
1754
+ * getRecord notifyChangeFactory
1755
+ * Called when dispatchResourceRequest is resolved/rejected
1619
1756
  */
1620
- DraftQueueEventType["QueueStateChanged"] = "state";
1621
- })(DraftQueueEventType || (DraftQueueEventType = {}));
1622
- var QueueOperationType;
1623
- (function (QueueOperationType) {
1624
- QueueOperationType["Add"] = "add";
1625
- QueueOperationType["Delete"] = "delete";
1626
- QueueOperationType["Update"] = "update";
1627
- })(QueueOperationType || (QueueOperationType = {}));
1628
-
1629
- var CustomActionResultType;
1630
- (function (CustomActionResultType) {
1631
- CustomActionResultType["SUCCESS"] = "SUCCESS";
1632
- CustomActionResultType["FAILURE"] = "FAILURE";
1633
- })(CustomActionResultType || (CustomActionResultType = {}));
1634
- var CustomActionErrorType;
1635
- (function (CustomActionErrorType) {
1636
- CustomActionErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
1637
- CustomActionErrorType["CLIENT_ERROR"] = "CLIENT_ERROR";
1638
- })(CustomActionErrorType || (CustomActionErrorType = {}));
1757
+ getRecordNotifyChangeNetworkResult: (_uniqueWeakEtags, _error) => { },
1758
+ };
1759
+ /**
1760
+ * Allows external modules (typically a runtime environment) to set
1761
+ * instrumentation hooks for this module. Note that the hooks are
1762
+ * incremental - hooks not suppiled in newInstrumentation will retain
1763
+ * their previous values. The default instrumentation hooks are no-ops.
1764
+ *
1765
+ * @param newInstrumentation instrumentation hooks to be overridden
1766
+ */
1767
+ function instrument(newInstrumentation) {
1768
+ instrumentation = Object.assign(instrumentation, newInstrumentation);
1769
+ }
1770
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
1771
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
1772
+ return {
1773
+ name,
1774
+ required,
1775
+ resourceType,
1776
+ typeCheckShape,
1777
+ isArrayShape,
1778
+ coerceFn,
1779
+ };
1780
+ }
1781
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
1782
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
1783
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
1784
+ return {
1785
+ displayName,
1786
+ parameters: {
1787
+ required,
1788
+ optional,
1789
+ }
1790
+ };
1791
+ }
1792
+ const keyPrefix = 'UiApi';
1793
+
1794
+ const { assign: assign$1, create: create$1, freeze: freeze$1, isFrozen, keys: keys$1 } = Object;
1795
+ const { isArray } = Array;
1796
+ const { concat, filter, includes, push, reduce } = Array.prototype;
1797
+
1798
+ function isString(value) {
1799
+ return typeof value === 'string';
1800
+ }
1801
+ /**
1802
+ * @param value The array to dedupe
1803
+ * @returns An array without duplicates.
1804
+ */
1805
+ function dedupe(value) {
1806
+ const result = {};
1807
+ for (let i = 0, len = value.length; i < len; i += 1) {
1808
+ result[value[i]] = true;
1809
+ }
1810
+ return keys$1(result);
1811
+ }
1812
+
1813
+ function isObjectId(unknown) {
1814
+ if (typeof unknown !== 'object' || unknown === null) {
1815
+ return false;
1816
+ }
1817
+ return isString(unknown.objectApiName);
1818
+ }
1819
+
1820
+ /**
1821
+ * Returns the object API name.
1822
+ * @param value The value from which to get the object API name.
1823
+ * @returns The object API name.
1824
+ */
1825
+ function getObjectApiName$1(value) {
1826
+ // Note: tightening validation logic changes behavior from userland getting
1827
+ // a server-provided error to the adapter noop'ing. In 224 we decided to not
1828
+ // change the behavior.
1829
+ if (typeof value === 'string') {
1830
+ const trimmed = value.trim();
1831
+ if (trimmed.length > 0) {
1832
+ return trimmed;
1833
+ }
1834
+ }
1835
+ else if (isObjectId(value)) {
1836
+ return value.objectApiName.trim();
1837
+ }
1838
+ return undefined;
1839
+ }
1840
+
1841
+ function isFieldId(unknown) {
1842
+ if (typeof unknown !== 'object' || unknown === null) {
1843
+ return false;
1844
+ }
1845
+ const value = unknown;
1846
+ return isString(value.objectApiName) && isString(value.fieldApiName);
1847
+ }
1848
+
1849
+ /**
1850
+ * Returns the field API name, qualified with an object name if possible.
1851
+ * @param value The value from which to get the qualified field API name.
1852
+ * @param onlyQualifiedFieldNames - Whether or not this function should skip fieldApiName that do not include the delimiter '.'
1853
+ * @return The qualified field API name.
1854
+ */
1855
+ function getFieldApiName(value, onlyQualifiedFieldNames = false) {
1856
+ // Note: tightening validation logic changes behavior from userland getting
1857
+ // a server-provided error to the adapter noop'ing. In 224 we decided to not
1858
+ // change the behavior. In 250 we decided to add the 'onlyQualifiedFieldName' flag to tighten the logic
1859
+ // optionally to avoid issues with persisted invalid field names.
1860
+ if (isString(value)) {
1861
+ const trimmed = value.trim();
1862
+ if (trimmed.length > 0 && (onlyQualifiedFieldNames ? trimmed.indexOf('.') > -1 : true)) {
1863
+ return trimmed;
1864
+ }
1865
+ }
1866
+ else if (isFieldId(value)) {
1867
+ return value.objectApiName + '.' + value.fieldApiName;
1868
+ }
1869
+ return undefined;
1870
+ }
1639
1871
 
1640
1872
  /**
1641
- * Denotes what kind of operation a DraftQueueItem represents.
1873
+ * Returns the field API name.
1874
+ * @param value The value from which to get the field API name.
1875
+ * @param options Option bag. onlyQualifiedFieldNames is a boolean that allows this function to skip returning invalid FieldApiNames.
1876
+ * @returns The field API name.
1642
1877
  */
1643
- var DraftActionOperationType;
1644
- (function (DraftActionOperationType) {
1645
- DraftActionOperationType["Create"] = "create";
1646
- DraftActionOperationType["Update"] = "update";
1647
- DraftActionOperationType["Delete"] = "delete";
1648
- DraftActionOperationType["Custom"] = "custom";
1649
- })(DraftActionOperationType || (DraftActionOperationType = {}));
1650
- var DraftQueueOperationType;
1651
- (function (DraftQueueOperationType) {
1652
- DraftQueueOperationType["ItemAdded"] = "added";
1653
- DraftQueueOperationType["ItemUploading"] = "uploading";
1654
- DraftQueueOperationType["ItemDeleted"] = "deleted";
1655
- DraftQueueOperationType["ItemCompleted"] = "completed";
1656
- DraftQueueOperationType["ItemFailed"] = "failed";
1657
- DraftQueueOperationType["ItemUpdated"] = "updated";
1658
- DraftQueueOperationType["QueueStarted"] = "started";
1659
- DraftQueueOperationType["QueueStopped"] = "stopped";
1660
- })(DraftQueueOperationType || (DraftQueueOperationType = {}));
1878
+ function getFieldApiNamesArray(value, options = { onlyQualifiedFieldNames: false }) {
1879
+ const valueArray = isArray(value) ? value : [value];
1880
+ const array = [];
1881
+ for (let i = 0, len = valueArray.length; i < len; i += 1) {
1882
+ const item = valueArray[i];
1883
+ const apiName = getFieldApiName(item, options.onlyQualifiedFieldNames);
1884
+ if (apiName === undefined) {
1885
+ if (options.onlyQualifiedFieldNames) {
1886
+ continue; // Just skips invalid field names rather than failing to return an array at all
1887
+ }
1888
+ return undefined;
1889
+ }
1890
+ push.call(array, apiName);
1891
+ }
1892
+ if (array.length === 0) {
1893
+ return undefined;
1894
+ }
1895
+ return dedupe(array).sort();
1896
+ }
1897
+ const RepresentationType$Z = 'RecordRepresentation';
1898
+ function keyBuilder$3r(luvio, config) {
1899
+ return keyPrefix + '::' + RepresentationType$Z + ':' + config.recordId;
1900
+ }
1901
+ freeze$1({
1902
+ name: '',
1903
+ children: {},
1904
+ });
1905
+
1906
+ ObjectCreate$1(null);
1907
+
1908
+ ObjectCreate$1(null);
1909
+
1910
+ const adapterName$$ = 'getListUiByApiName';
1911
+ const getListUiByApiName_ConfigPropertyMetadata = [
1912
+ generateParamConfigMetadata('listViewApiName', true, 0 /* UrlParameter */, 0 /* String */),
1913
+ generateParamConfigMetadata('objectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1),
1914
+ generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1915
+ generateParamConfigMetadata('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1916
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
1917
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1918
+ generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1919
+ ];
1920
+ const getListUiByApiName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$$, getListUiByApiName_ConfigPropertyMetadata);
1921
+
1922
+ const adapterName$_ = 'getListUiByListViewId';
1923
+ const getListUiByListViewId_ConfigPropertyMetadata = [
1924
+ generateParamConfigMetadata('listViewId', true, 0 /* UrlParameter */, 0 /* String */),
1925
+ generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1926
+ generateParamConfigMetadata('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1927
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
1928
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1929
+ generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1930
+ ];
1931
+ const getListUiByListViewId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$_, getListUiByListViewId_ConfigPropertyMetadata);
1932
+
1933
+ const adapterName$Y = 'getMruListUi';
1934
+ const getMruListUi_ConfigPropertyMetadata = [
1935
+ generateParamConfigMetadata('objectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1),
1936
+ generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1937
+ generateParamConfigMetadata('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1938
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
1939
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1940
+ generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1941
+ ];
1942
+ const getMruListUi_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$Y, getMruListUi_ConfigPropertyMetadata);
1943
+ // make local copies of the adapter configs so we can ignore other getListUi config parameters to match
1944
+ // lds222 behavior
1945
+ ({
1946
+ ...getMruListUi_ConfigPropertyNames,
1947
+ parameters: {
1948
+ ...getMruListUi_ConfigPropertyNames.parameters,
1949
+ optional: [
1950
+ ...getMruListUi_ConfigPropertyNames.parameters.optional,
1951
+ 'listViewApiName',
1952
+ 'listViewId',
1953
+ ],
1954
+ },
1955
+ });
1956
+ // make local copies of the adapter configs so we can have them ignore each other's config parameters
1957
+ // to match lds222 behavior
1958
+ ({
1959
+ ...getListUiByApiName_ConfigPropertyNames,
1960
+ parameters: {
1961
+ ...getListUiByApiName_ConfigPropertyNames.parameters,
1962
+ optional: [...getListUiByApiName_ConfigPropertyNames.parameters.optional, 'listViewId'],
1963
+ },
1964
+ });
1965
+ ({
1966
+ ...getListUiByListViewId_ConfigPropertyNames,
1967
+ parameters: {
1968
+ ...getListUiByListViewId_ConfigPropertyNames.parameters,
1969
+ optional: [
1970
+ ...getListUiByListViewId_ConfigPropertyNames.parameters.optional,
1971
+ 'listViewApiName',
1972
+ 'objectApiName',
1973
+ ],
1974
+ },
1975
+ });
1976
+
1977
+ var DiscriminatorValues$5;
1978
+ (function (DiscriminatorValues) {
1979
+ DiscriminatorValues["EmptySpace"] = "EmptySpace";
1980
+ DiscriminatorValues["ReportChart"] = "ReportChart";
1981
+ DiscriminatorValues["VisualforcePage"] = "VisualforcePage";
1982
+ DiscriminatorValues["Canvas"] = "Canvas";
1983
+ DiscriminatorValues["Field"] = "Field";
1984
+ DiscriminatorValues["CustomLink"] = "CustomLink";
1985
+ })(DiscriminatorValues$5 || (DiscriminatorValues$5 = {}));
1986
+
1987
+ var LayoutMode;
1988
+ (function (LayoutMode) {
1989
+ LayoutMode["View"] = "View";
1990
+ LayoutMode["Edit"] = "Edit";
1991
+ LayoutMode["Create"] = "Create";
1992
+ })(LayoutMode || (LayoutMode = {}));
1993
+
1994
+ LayoutMode.View;
1995
+
1996
+ var FormFactor;
1997
+ (function (FormFactor) {
1998
+ FormFactor["Large"] = "Large";
1999
+ FormFactor["Medium"] = "Medium";
2000
+ FormFactor["Small"] = "Small";
2001
+ })(FormFactor || (FormFactor = {}));
2002
+
2003
+ ObjectCreate$1(null);
2004
+
2005
+ var LayoutType;
2006
+ (function (LayoutType) {
2007
+ LayoutType["Full"] = "Full";
2008
+ LayoutType["Compact"] = "Compact";
2009
+ })(LayoutType || (LayoutType = {}));
2010
+
2011
+ ObjectCreate$1(null);
2012
+
2013
+ ObjectCreate$1(null);
2014
+
2015
+ const VERSION$1S = "8d2032474fb4fabdf5cf4042be9042d9";
2016
+ const select$24 = function WorkStepPicklistValueAttributeRepresentationSelect() {
2017
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$20();
2018
+ return {
2019
+ kind: 'Fragment',
2020
+ version: VERSION$1S,
2021
+ private: [],
2022
+ selections: [
2023
+ ...AbstractPicklistValueAttributesRepresentationSelections,
2024
+ {
2025
+ name: 'sortOrder',
2026
+ kind: 'Scalar'
2027
+ },
2028
+ {
2029
+ name: 'statusCode',
2030
+ kind: 'Scalar'
2031
+ }
2032
+ ]
2033
+ };
2034
+ };
2035
+
2036
+ const VERSION$1R = "53893a219bc0888951863f2c44317cac";
2037
+ const select$23 = function LeadStatusPicklistValueAttributesRepresentationSelect() {
2038
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$20();
2039
+ return {
2040
+ kind: 'Fragment',
2041
+ version: VERSION$1R,
2042
+ private: [],
2043
+ selections: [
2044
+ ...AbstractPicklistValueAttributesRepresentationSelections,
2045
+ {
2046
+ name: 'converted',
2047
+ kind: 'Scalar'
2048
+ }
2049
+ ]
2050
+ };
2051
+ };
2052
+
2053
+ const VERSION$1Q = "4818ec07c499784571c1012ead048c88";
2054
+ const select$22 = function CaseStatusPicklistValueAttributesRepresentationSelect() {
2055
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$20();
2056
+ return {
2057
+ kind: 'Fragment',
2058
+ version: VERSION$1Q,
2059
+ private: [],
2060
+ selections: [
2061
+ ...AbstractPicklistValueAttributesRepresentationSelections,
2062
+ {
2063
+ name: 'closed',
2064
+ kind: 'Scalar'
2065
+ }
2066
+ ]
2067
+ };
2068
+ };
2069
+
2070
+ const VERSION$1P = "950a3a962acbd2b128f937d4c055a9d6";
2071
+ const select$21 = function OpportunityStagePicklistValueAttributesRepresentationSelect() {
2072
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$20();
2073
+ return {
2074
+ kind: 'Fragment',
2075
+ version: VERSION$1P,
2076
+ private: [],
2077
+ selections: [
2078
+ ...AbstractPicklistValueAttributesRepresentationSelections,
2079
+ {
2080
+ name: 'closed',
2081
+ kind: 'Scalar'
2082
+ },
2083
+ {
2084
+ name: 'defaultProbability',
2085
+ kind: 'Scalar'
2086
+ },
2087
+ {
2088
+ name: 'forecastCategoryName',
2089
+ kind: 'Scalar'
2090
+ },
2091
+ {
2092
+ name: 'won',
2093
+ kind: 'Scalar'
2094
+ }
2095
+ ]
2096
+ };
2097
+ };
2098
+
2099
+ var DiscriminatorValues$4;
2100
+ (function (DiscriminatorValues) {
2101
+ DiscriminatorValues["WorkStepStatus"] = "WorkStepStatus";
2102
+ DiscriminatorValues["LeadStatus"] = "LeadStatus";
2103
+ DiscriminatorValues["CaseStatus"] = "CaseStatus";
2104
+ DiscriminatorValues["OpportunityStage"] = "OpportunityStage";
2105
+ })(DiscriminatorValues$4 || (DiscriminatorValues$4 = {}));
2106
+ const VERSION$1O = "bd523b2343366edfc25a2dbee2c4e986";
2107
+ const selectChildren$2 = function AbstractPicklistValueAttributesRepresentationSelectChildren() {
2108
+ const workStepPicklistValueAttributeRepresentationSelections = select$24();
2109
+ const leadStatusPicklistValueAttributesRepresentationSelections = select$23();
2110
+ const caseStatusPicklistValueAttributesRepresentationSelections = select$22();
2111
+ const opportunityStagePicklistValueAttributesRepresentationSelections = select$21();
2112
+ return {
2113
+ kind: 'Fragment',
2114
+ union: true,
2115
+ discriminator: 'picklistAtrributesValueType',
2116
+ unionSelections: {
2117
+ [DiscriminatorValues$4.WorkStepStatus]: workStepPicklistValueAttributeRepresentationSelections,
2118
+ [DiscriminatorValues$4.LeadStatus]: leadStatusPicklistValueAttributesRepresentationSelections,
2119
+ [DiscriminatorValues$4.CaseStatus]: caseStatusPicklistValueAttributesRepresentationSelections,
2120
+ [DiscriminatorValues$4.OpportunityStage]: opportunityStagePicklistValueAttributesRepresentationSelections
2121
+ }
2122
+ };
2123
+ };
2124
+ const select$20 = function AbstractPicklistValueAttributesRepresentationSelect() {
2125
+ return {
2126
+ kind: 'Fragment',
2127
+ version: VERSION$1O,
2128
+ private: [],
2129
+ selections: [
2130
+ {
2131
+ name: 'picklistAtrributesValueType',
2132
+ kind: 'Scalar'
2133
+ }
2134
+ ]
2135
+ };
2136
+ };
2137
+
2138
+ const VERSION$1N = "9e2a16a80378487f557124c771201cf9";
2139
+ const select$1$ = function PicklistValueRepresentationSelect() {
2140
+ const AbstractPicklistValueAttributesRepresentation__unionSelections = selectChildren$2();
2141
+ return {
2142
+ kind: 'Fragment',
2143
+ version: VERSION$1N,
2144
+ private: [],
2145
+ selections: [
2146
+ {
2147
+ kind: 'Object',
2148
+ name: 'attributes',
2149
+ discriminator: AbstractPicklistValueAttributesRepresentation__unionSelections.discriminator,
2150
+ union: true,
2151
+ nullable: true,
2152
+ unionSelections: AbstractPicklistValueAttributesRepresentation__unionSelections.unionSelections
2153
+ },
2154
+ {
2155
+ name: 'label',
2156
+ kind: 'Scalar'
2157
+ },
2158
+ {
2159
+ name: 'validFor',
2160
+ kind: 'Scalar',
2161
+ plural: true
2162
+ },
2163
+ {
2164
+ name: 'value',
2165
+ kind: 'Scalar'
2166
+ }
2167
+ ]
2168
+ };
2169
+ };
2170
+ const VERSION$1M = "0a361a49370acb4c6a31721a2057649a";
2171
+ const select$1_ = function PicklistValuesRepresentationSelect() {
2172
+ const { selections: PicklistValueRepresentation__selections, opaque: PicklistValueRepresentation__opaque, } = select$1$();
2173
+ return {
2174
+ kind: 'Fragment',
2175
+ version: VERSION$1M,
2176
+ private: [
2177
+ 'eTag'
2178
+ ],
2179
+ selections: [
2180
+ {
2181
+ name: 'controllerValues',
2182
+ kind: 'Scalar',
2183
+ map: true
2184
+ },
2185
+ {
2186
+ name: 'defaultValue',
2187
+ kind: 'Object',
2188
+ nullable: true,
2189
+ selections: PicklistValueRepresentation__selections
2190
+ },
2191
+ {
2192
+ name: 'url',
2193
+ kind: 'Scalar'
2194
+ },
2195
+ {
2196
+ name: 'values',
2197
+ kind: 'Object',
2198
+ plural: true,
2199
+ selections: PicklistValueRepresentation__selections
2200
+ }
2201
+ ]
2202
+ };
2203
+ };
2204
+
2205
+ select$1_().selections;
2206
+
2207
+ var DiscriminatorValues$3;
2208
+ (function (DiscriminatorValues) {
2209
+ DiscriminatorValues["Photo"] = "Photo";
2210
+ DiscriminatorValues["Theme"] = "Theme";
2211
+ })(DiscriminatorValues$3 || (DiscriminatorValues$3 = {}));
2212
+
2213
+ ObjectCreate$1(null);
2214
+
2215
+ ObjectCreate$1(null);
2216
+
2217
+ ObjectCreate$1(null);
2218
+
2219
+ ObjectCreate$1(null);
2220
+
2221
+ var DiscriminatorValues$1;
2222
+ (function (DiscriminatorValues) {
2223
+ DiscriminatorValues["Text"] = "Text";
2224
+ DiscriminatorValues["Select"] = "Select";
2225
+ })(DiscriminatorValues$1 || (DiscriminatorValues$1 = {}));
2226
+
2227
+ var DiscriminatorValues;
2228
+ (function (DiscriminatorValues) {
2229
+ DiscriminatorValues["Field"] = "Field";
2230
+ DiscriminatorValues["DataCategory"] = "DataCategory";
2231
+ })(DiscriminatorValues || (DiscriminatorValues = {}));
2232
+
2233
+ const API_NAMESPACE = 'UiApi';
2234
+ const RECORD_REPRESENTATION_NAME = 'RecordRepresentation';
2235
+ const RECORD_VIEW_ENTITY_REPRESENTATION_NAME = 'RecordViewEntityRepresentation';
2236
+ const RECORD_ID_PREFIX = `${API_NAMESPACE}::${RECORD_REPRESENTATION_NAME}:`;
2237
+ const RECORD_VIEW_ENTITY_ID_PREFIX = `${API_NAMESPACE}::${RECORD_VIEW_ENTITY_REPRESENTATION_NAME}:Name:`;
2238
+ const RECORD_FIELDS_KEY_JUNCTION = '__fields__';
2239
+ function extractRecordIdFromStoreKey(key) {
2240
+ if (key === undefined ||
2241
+ (key.indexOf(RECORD_ID_PREFIX) === -1 && key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX) === -1)) {
2242
+ return undefined;
2243
+ }
2244
+ const parts = key.split(':');
2245
+ return parts[parts.length - 1].split('_')[0];
2246
+ }
2247
+ function isStoreKeyRecordViewEntity(key) {
2248
+ return (key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX) > -1 &&
2249
+ key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1);
2250
+ }
2251
+ // The rest of this is copy-pasted. Sorry.
2252
+ ObjectCreate$1(null);
2253
+ ensureRegisteredOnce({
2254
+ id: '@salesforce/lds-adapters-uiapi',
2255
+ configuration: {
2256
+ ...configurationForRestAdapters,
2257
+ ...configurationForGraphQLAdapters,
2258
+ ...configurationForOneStoreEnabledAdapters,
2259
+ },
2260
+ instrument,
2261
+ });
1661
2262
 
1662
2263
  /**
1663
2264
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -1668,9 +2269,23 @@ var DraftQueueOperationType;
1668
2269
 
1669
2270
  const { keys, values, create, assign, freeze, entries } = Object;
1670
2271
 
2272
+ function buildRecordFieldStoreKey(recordKey, fieldName) {
2273
+ return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION}${fieldName}`;
2274
+ }
2275
+ function isStoreKeyRecordId(key) {
2276
+ return key.indexOf(RECORD_ID_PREFIX) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1;
2277
+ }
1671
2278
  function createLink(key) {
1672
2279
  return { __ref: key };
1673
2280
  }
2281
+ function isStoreRecordError(storeRecord) {
2282
+ return storeRecord.__type === 'error';
2283
+ }
2284
+ function isEntryDurableRecordRepresentation(entry, key) {
2285
+ // Either a DurableRecordRepresentation or StoreRecordError can live at a record key
2286
+ return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity(key)) &&
2287
+ entry.data.__type === undefined);
2288
+ }
1674
2289
  /**
1675
2290
  * Records are stored in the durable store with scalar fields denormalized. This function takes that denoramlized
1676
2291
  * durable store record representation and normalizes it back out into the format the the luvio store expects it
@@ -1778,7 +2393,7 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
1778
2393
  if (originalKey.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX)) {
1779
2394
  return RECORD_VIEW_ENTITY_ID_PREFIX + recordId;
1780
2395
  }
1781
- return keyBuilderRecord(luvio, { recordId });
2396
+ return keyBuilder$3r(luvio, { recordId });
1782
2397
  }
1783
2398
  function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
1784
2399
  const getEntries = function (entries, segment) {
@@ -2085,4 +2700,4 @@ function ldsRuntimeBridge() {
2085
2700
  }
2086
2701
 
2087
2702
  export { ldsRuntimeBridge as default };
2088
- // version: 1.296.0-ad26368c0
2703
+ // version: 1.297.0-1fc775982
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-bridge",
3
- "version": "1.296.0",
3
+ "version": "1.297.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for bridge.app.",
6
6
  "main": "dist/ldsRuntimeBridge.js",
@@ -34,17 +34,16 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-bridge"
35
35
  },
36
36
  "dependencies": {
37
- "@salesforce/lds-adapters-uiapi-mobile": "^1.296.0",
38
- "@salesforce/lds-instrumentation": "^1.296.0",
37
+ "@salesforce/lds-durable-records": "^1.297.0",
38
+ "@salesforce/lds-instrumentation": "^1.297.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "250.7.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-drafts-adapters-uiapi": "^1.296.0",
44
- "@salesforce/lds-network-aura": "^1.296.0",
45
- "@salesforce/lds-runtime-aura": "^1.296.0",
46
- "@salesforce/lds-store-nimbus": "^1.296.0",
47
- "@salesforce/nimbus-plugin-lds": "^1.296.0",
43
+ "@salesforce/lds-network-aura": "^1.297.0",
44
+ "@salesforce/lds-runtime-aura": "^1.297.0",
45
+ "@salesforce/lds-store-nimbus": "^1.297.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.297.0",
48
47
  "babel-plugin-dynamic-import-node": "^2.3.3"
49
48
  },
50
49
  "luvioBundlesize": [