@salesforce/lds-worker-api 1.361.0 → 1.362.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.
@@ -4271,7 +4271,7 @@ function withDefaultLuvio(callback) {
4271
4271
  }
4272
4272
  callbacks.push(callback);
4273
4273
  }
4274
- // version: 1.361.0-6a70680f2b
4274
+ // version: 1.362.0-5d2767de00
4275
4275
 
4276
4276
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4277
4277
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5219,7 +5219,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5219
5219
  const { apiFamily, name } = metadata;
5220
5220
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5221
5221
  }
5222
- // version: 1.361.0-6a70680f2b
5222
+ // version: 1.362.0-5d2767de00
5223
5223
 
5224
5224
  /**
5225
5225
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -6864,7 +6864,7 @@ function equals$18(existing, incoming) {
6864
6864
  return true;
6865
6865
  }
6866
6866
 
6867
- const VERSION$1i$2 = "195d918987a35f45e1aa4dce9a11d8c5";
6867
+ const VERSION$1i$2 = "2738fe8faf98ecd076d7c4df86fd5bf0";
6868
6868
  const RepresentationType$X = 'FieldValueRepresentation';
6869
6869
  function normalize$Q(input, existing, path, luvio, store, timestamp) {
6870
6870
  const input_value = input.value;
@@ -6894,10 +6894,10 @@ const select$1X = function FieldValueRepresentationSelect() {
6894
6894
  kind: 'Scalar'
6895
6895
  },
6896
6896
  {
6897
+ kind: 'Object',
6897
6898
  name: 'value',
6898
- kind: 'Link',
6899
6899
  nullable: true,
6900
- fragment: select$1V()
6900
+ // Complex union deep
6901
6901
  }
6902
6902
  ]
6903
6903
  };
@@ -6910,12 +6910,32 @@ function equals$17(existing, incoming) {
6910
6910
  }
6911
6911
  const existing_value = existing.value;
6912
6912
  const incoming_value = incoming.value;
6913
- if (!(existing_value === incoming_value
6914
- || (existing_value != null &&
6915
- incoming_value != null &&
6916
- existing_value.__ref != null &&
6917
- incoming_value.__ref != null &&
6918
- existing_value.__ref === incoming_value.__ref))) {
6913
+ if (!((() => {
6914
+ if (existing_value === null || incoming_value === null) {
6915
+ return existing_value === incoming_value;
6916
+ }
6917
+ if (Array.isArray(existing_value) && Array.isArray(incoming_value)) {
6918
+ const equals_value_items = equalsArray$1(existing_value, incoming_value, (existing_value_item, incoming_value_item) => {
6919
+ if (!(existing_value_item === incoming_value_item)) {
6920
+ return false;
6921
+ }
6922
+ });
6923
+ if (equals_value_items === false) {
6924
+ return false;
6925
+ }
6926
+ }
6927
+ else {
6928
+ if (!(existing_value === incoming_value
6929
+ || (existing_value != null &&
6930
+ incoming_value != null &&
6931
+ existing_value.__ref != null &&
6932
+ incoming_value.__ref != null &&
6933
+ existing_value.__ref === incoming_value.__ref))) {
6934
+ return false;
6935
+ }
6936
+ }
6937
+ return true;
6938
+ })())) {
6919
6939
  return false;
6920
6940
  }
6921
6941
  return true;
@@ -8977,6 +8997,11 @@ const SCALAR_VALUE_SELECTION$1 = {
8977
8997
  kind: 'Scalar',
8978
8998
  name: 'value',
8979
8999
  };
9000
+ const ARRAY_VALUE_SELECTION = {
9001
+ kind: 'Scalar',
9002
+ name: 'value',
9003
+ plural: true,
9004
+ };
8980
9005
  const DISPLAY_VALUE_SELECTION$1 = {
8981
9006
  kind: 'Scalar',
8982
9007
  name: 'displayValue',
@@ -9062,6 +9087,10 @@ function createPathSelectionFromValue$1(fields) {
9062
9087
  },
9063
9088
  };
9064
9089
  }
9090
+ else if (Array.isArray(fieldValue)) {
9091
+ // this should change if we ever accept arrays of non-scalars
9092
+ fieldValueSelection = ARRAY_VALUE_SELECTION;
9093
+ }
9065
9094
  const fieldSelection = {
9066
9095
  kind: 'Link',
9067
9096
  name: fieldName,
@@ -9163,7 +9192,7 @@ const DRAFTS_SELECTION$1 = {
9163
9192
  required: false,
9164
9193
  };
9165
9194
  function isSpanningRecord$3(fieldValue) {
9166
- return fieldValue !== null && typeof fieldValue === 'object';
9195
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
9167
9196
  }
9168
9197
  function createRecordSelection$1(fieldDefinition) {
9169
9198
  const sel = dynamicSelect$8$1({
@@ -9256,7 +9285,7 @@ function extractTrackedFieldsToTrie$1(recordId, node, root, config, visitedRecor
9256
9285
  continue;
9257
9286
  }
9258
9287
  const { maxDepth, onlyFetchLeafNodeIdAndName } = config;
9259
- if (field.isScalar('value') === false) {
9288
+ if (field.isScalar('value') === false && !Array.isArray(field.data?.value)) {
9260
9289
  if (depth + 1 > maxDepth) {
9261
9290
  if (onlyFetchLeafNodeIdAndName === true) {
9262
9291
  addScalarFieldId$1(current);
@@ -9293,7 +9322,7 @@ function extractTrackedFieldsToTrie$1(recordId, node, root, config, visitedRecor
9293
9322
  addScalarFieldName$1(current);
9294
9323
  continue;
9295
9324
  }
9296
- if (field.scalar('value') === null) {
9325
+ if (field.scalar('value') === null && !Array.isArray(field.data?.value)) {
9297
9326
  continue;
9298
9327
  }
9299
9328
  }
@@ -9433,7 +9462,7 @@ function markNulledOutPath$1(record, path) {
9433
9462
  const link = fieldValueRepresentation.link(fieldName);
9434
9463
  const resolved = link.follow();
9435
9464
  if (isGraphNode$1(resolved) &&
9436
- resolved.isScalar('value') &&
9465
+ (resolved.isScalar('value') || !Array.isArray(resolved.data?.value)) &&
9437
9466
  path.length > 0 && // TODO [W-14082782]: temporary fix
9438
9467
  !isFrozen$3(link.data)) {
9439
9468
  const linkState = link.linkData();
@@ -9477,7 +9506,7 @@ function _markMissingPath$1(record, path) {
9477
9506
  return;
9478
9507
  }
9479
9508
  // if value is not a scalar, follow the link and mark it as missing
9480
- if (fieldValue.isScalar('value') === false) {
9509
+ if (fieldValue.isScalar('value') === false && !Array.isArray(fieldValue.data?.value)) {
9481
9510
  _markMissingPath$1(fieldValue
9482
9511
  .link('value')
9483
9512
  .follow(), path);
@@ -9598,7 +9627,7 @@ function mergePendingFields$1(newRecord, oldRecord, existingNode) {
9598
9627
  .link(spanningFieldName);
9599
9628
  const field = fieldValueRep.follow();
9600
9629
  if (isGraphNode$1(field)) {
9601
- if (field.isScalar('value') === false) {
9630
+ if (field.isScalar('value') === false && !Array.isArray(field.data?.value)) {
9602
9631
  const record = field
9603
9632
  .link('value')
9604
9633
  .follow();
@@ -9840,7 +9869,7 @@ function fixDisplayValue(existing, incoming, path) {
9840
9869
  function normalize$O(input, existing, path, luvio, store, timestamp, fieldsTrie, optionalFieldsTrie, recordConflictMap) {
9841
9870
  const input_value = input.value;
9842
9871
  const input_value_id = path.fullPath + '__value';
9843
- if (input_value !== null && typeof input_value === 'object') {
9872
+ if (input_value !== null && typeof input_value === 'object' && !Array.isArray(input_value)) {
9844
9873
  const ingest = createRecordIngest$1(fieldsTrie, optionalFieldsTrie, recordConflictMap);
9845
9874
  input.value = ingest(input_value, {
9846
9875
  fullPath: input_value_id,
@@ -34003,7 +34032,7 @@ withDefaultLuvio((luvio) => {
34003
34032
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
34004
34033
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
34005
34034
  });
34006
- // version: 1.361.0-eb406138cb
34035
+ // version: 1.362.0-d2e818ae61
34007
34036
 
34008
34037
  /**
34009
34038
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -45681,7 +45710,7 @@ function createErrorResponse(status, body) {
45681
45710
  };
45682
45711
  }
45683
45712
  function isSpanningRecord$2(fieldValue) {
45684
- return fieldValue !== null && typeof fieldValue === 'object';
45713
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
45685
45714
  }
45686
45715
  function mergeRecordFields$2(first, second) {
45687
45716
  const { fields: targetFields } = first;
@@ -49584,7 +49613,9 @@ const getTypeCacheKeys$1u$1 = (rootKeySet, luvio, input, _fullPathFactory) => {
49584
49613
  const input_fields_length = field_values.length;
49585
49614
  for (let i = 0; i < input_fields_length; i++) {
49586
49615
  const field_value = input_fields[field_values[i]];
49587
- if (field_value.value !== null && typeof field_value.value === 'object') {
49616
+ if (field_value.value !== null &&
49617
+ typeof field_value.value === 'object' &&
49618
+ !Array.isArray(field_value.value)) {
49588
49619
  getTypeCacheKeys$1u$1(rootKeySet, luvio, field_value.value);
49589
49620
  }
49590
49621
  }
@@ -49785,7 +49816,7 @@ const DRAFTS_SELECTION = {
49785
49816
  required: false,
49786
49817
  };
49787
49818
  function isSpanningRecord$1(fieldValue) {
49788
- return fieldValue !== null && typeof fieldValue === 'object';
49819
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
49789
49820
  }
49790
49821
  function createRecordSelection(fieldDefinition) {
49791
49822
  const sel = dynamicSelect$8({
@@ -50578,7 +50609,7 @@ function extractTrackedFieldsToTrie(recordId, node, root) {
50578
50609
  current.children[key] = next;
50579
50610
  continue;
50580
50611
  }
50581
- if (fieldRep.isScalar('value') === false) {
50612
+ if (fieldRep.isScalar('value') === false && !Array.isArray(fieldRep.data?.value)) {
50582
50613
  const link = fieldRep.link('value');
50583
50614
  const spanningRep = link.follow();
50584
50615
  if (isExternalLookupFieldKey(spanningRep)) {
@@ -50719,7 +50750,7 @@ function markNulledOutPath(record, path) {
50719
50750
  }
50720
50751
  const resolved = fieldValueRepresentation.object(fieldName);
50721
50752
  if (isGraphNode(resolved) &&
50722
- resolved.isScalar('value') &&
50753
+ (resolved.isScalar('value') || Array.isArray(resolved.data?.value)) &&
50723
50754
  path.length > 0 && // TODO [W-14082782]: temporary fix
50724
50755
  !isFrozen$2(resolved.data)) {
50725
50756
  const stateFields = readFieldStateFromValueNode(resolved.data);
@@ -50757,7 +50788,7 @@ function _markMissingPath(record, path) {
50757
50788
  writeMissingFieldToStore(fieldValueRepresentation, fieldName);
50758
50789
  return;
50759
50790
  }
50760
- if (fieldValueValue.isScalar('value') === true) {
50791
+ if (fieldValueValue.isScalar('value') === true || Array.isArray(fieldValueValue.data?.value)) {
50761
50792
  return;
50762
50793
  }
50763
50794
  const link = fieldValueValue.link('value');
@@ -84176,12 +84207,14 @@ function pageInfoResolver(source) {
84176
84207
  e: EARLY_END,
84177
84208
  }),
84178
84209
  hasNextPage: source.hasNextPage,
84210
+ hasPreviousPage: source.hasPreviousPage,
84179
84211
  };
84180
84212
  }
84181
84213
  return {
84182
84214
  startCursor: null,
84183
84215
  endCursor: null,
84184
84216
  hasNextPage: source.hasNextPage,
84217
+ hasPreviousPage: source.hasPreviousPage,
84185
84218
  };
84186
84219
  }
84187
84220
  let startIndex = source.records[0].index;
@@ -84200,6 +84233,7 @@ function pageInfoResolver(source) {
84200
84233
  startCursor: encodeV1Cursor(startCursor),
84201
84234
  endCursor: encodeV1Cursor(endCursor),
84202
84235
  hasNextPage: source.hasNextPage,
84236
+ hasPreviousPage: source.hasPreviousPage,
84203
84237
  };
84204
84238
  }
84205
84239
  function pageResultCountResolver(source) {
@@ -84454,6 +84488,7 @@ async function connectionResolver(obj, args, context, info) {
84454
84488
  return {
84455
84489
  records: [],
84456
84490
  hasNextPage: false,
84491
+ hasPreviousPage: false,
84457
84492
  earlyEnd: false,
84458
84493
  offset: 0,
84459
84494
  };
@@ -84505,6 +84540,7 @@ async function connectionResolver(obj, args, context, info) {
84505
84540
  const { sql, bindings } = buildQuery(queryConfig);
84506
84541
  const results = await query(sql, bindings);
84507
84542
  let hasNextPage = false;
84543
+ const hasPreviousPage = offset > 0;
84508
84544
  let earlyEnd = false;
84509
84545
  if (wantsHasNextPage) {
84510
84546
  if (results.rows.length > limit) {
@@ -84553,6 +84589,7 @@ async function connectionResolver(obj, args, context, info) {
84553
84589
  return {
84554
84590
  records,
84555
84591
  hasNextPage,
84592
+ hasPreviousPage,
84556
84593
  earlyEnd,
84557
84594
  offset,
84558
84595
  };
@@ -88398,7 +88435,7 @@ function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLeng
88398
88435
  return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
88399
88436
  }
88400
88437
  function isSpanningRecord(fieldValue) {
88401
- return fieldValue !== null && typeof fieldValue === 'object';
88438
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
88402
88439
  }
88403
88440
  function mergeRecordFields(first, second) {
88404
88441
  const { fields: targetFields } = first;
@@ -93201,7 +93238,7 @@ register$1({
93201
93238
  id: '@salesforce/lds-network-adapter',
93202
93239
  instrument: instrument$2,
93203
93240
  });
93204
- // version: 1.361.0-6a70680f2b
93241
+ // version: 1.362.0-5d2767de00
93205
93242
 
93206
93243
  const { create: create$2, keys: keys$2 } = Object;
93207
93244
  const { stringify, parse } = JSON;
@@ -98167,12 +98204,39 @@ function getFieldType$1l(field) {
98167
98204
  }
98168
98205
  }
98169
98206
 
98207
+ const RepresentationType$3 = 'RecordCollectionRepresentation';
98208
+ function getTypeCacheKeys$1b(rootKeySet, luvio, input, fullPathFactory) {
98209
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
98210
+ const rootKey = fullPathFactory();
98211
+ rootKeySet.set(rootKey, {
98212
+ namespace: keyPrefix$1,
98213
+ representationName: RepresentationType$3,
98214
+ mergeable: false
98215
+ });
98216
+ const input_records_length = input.records.length;
98217
+ for (let i = 0; i < input_records_length; i++) {
98218
+ getTypeCacheKeys$1a(rootKeySet, luvio, input.records[i]);
98219
+ }
98220
+ }
98221
+
98222
+ const VERSION$1h = "98c5b18512e48ca8d28727549507e4ba";
98223
+ const RepresentationType$2 = 'RecordRepresentation';
98224
+ function keyBuilder$18(luvio, config) {
98225
+ return keyPrefix$1 + '::' + RepresentationType$2 + ':' + config.recordId;
98226
+ }
98227
+ function keyBuilderFromType(luvio, object) {
98228
+ const keyParams = {
98229
+ recordId: object.id
98230
+ };
98231
+ return keyBuilder$18(luvio, keyParams);
98232
+ }
98233
+
98170
98234
  const { assign: assign$1, create: create$1, freeze: freeze$1, isFrozen: isFrozen$1, keys: keys$1 } = Object;
98171
98235
  const { isArray: isArray$2 } = Array;
98172
98236
  const { concat: concat$1, filter: filter$1, includes: includes$1, push: push$1, reduce: reduce$1 } = Array.prototype;
98173
98237
 
98174
98238
  // we override the generated so we can set "mergeable: true" on the root key
98175
- const getTypeCacheKeys$1b = (rootKeySet, luvio, input, _fullPathFactory) => {
98239
+ const getTypeCacheKeys$1a = (rootKeySet, luvio, input, _fullPathFactory) => {
98176
98240
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
98177
98241
  const rootKey = keyBuilderFromType(luvio, input);
98178
98242
  rootKeySet.set(rootKey, {
@@ -98185,7 +98249,7 @@ const getTypeCacheKeys$1b = (rootKeySet, luvio, input, _fullPathFactory) => {
98185
98249
  const input_childRelationships_length = input_childRelationships_keys.length;
98186
98250
  for (let i = 0; i < input_childRelationships_length; i++) {
98187
98251
  const key = input_childRelationships_keys[i];
98188
- getTypeCacheKeys$1a(rootKeySet, luvio, input_childRelationships[key], () => rootKey + '__childRelationships' + '__' + key);
98252
+ getTypeCacheKeys$1b(rootKeySet, luvio, input_childRelationships[key], () => rootKey + '__childRelationships' + '__' + key);
98189
98253
  }
98190
98254
  const input_fields = input.fields;
98191
98255
  const input_fields_keys = keys$1(input_fields);
@@ -98197,34 +98261,7 @@ const getTypeCacheKeys$1b = (rootKeySet, luvio, input, _fullPathFactory) => {
98197
98261
  return rootKeySet;
98198
98262
  };
98199
98263
 
98200
- const RepresentationType$3 = 'RecordCollectionRepresentation';
98201
- function getTypeCacheKeys$1a(rootKeySet, luvio, input, fullPathFactory) {
98202
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
98203
- const rootKey = fullPathFactory();
98204
- rootKeySet.set(rootKey, {
98205
- namespace: keyPrefix$1,
98206
- representationName: RepresentationType$3,
98207
- mergeable: false
98208
- });
98209
- const input_records_length = input.records.length;
98210
- for (let i = 0; i < input_records_length; i++) {
98211
- getTypeCacheKeys$1b(rootKeySet, luvio, input.records[i]);
98212
- }
98213
- }
98214
-
98215
- const VERSION$1h = "98c5b18512e48ca8d28727549507e4ba";
98216
- const RepresentationType$2 = 'RecordRepresentation';
98217
- function keyBuilder$18(luvio, config) {
98218
- return keyPrefix$1 + '::' + RepresentationType$2 + ':' + config.recordId;
98219
- }
98220
- function keyBuilderFromType(luvio, object) {
98221
- const keyParams = {
98222
- recordId: object.id
98223
- };
98224
- return keyBuilder$18(luvio, keyParams);
98225
- }
98226
-
98227
- const VERSION$1g = "195d918987a35f45e1aa4dce9a11d8c5";
98264
+ const VERSION$1g = "2738fe8faf98ecd076d7c4df86fd5bf0";
98228
98265
  const RepresentationType$1 = 'FieldValueRepresentation';
98229
98266
  function getTypeCacheKeys$19(rootKeySet, luvio, input, fullPathFactory) {
98230
98267
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
@@ -98235,7 +98272,7 @@ function getTypeCacheKeys$19(rootKeySet, luvio, input, fullPathFactory) {
98235
98272
  mergeable: false
98236
98273
  });
98237
98274
  if (!Array.isArray(input.value) && input.value !== null && typeof input.value === 'object') {
98238
- getTypeCacheKeys$1b(rootKeySet, luvio, input.value);
98275
+ getTypeCacheKeys$1a(rootKeySet, luvio, input.value);
98239
98276
  }
98240
98277
  }
98241
98278
 
@@ -99378,7 +99415,9 @@ function selectType$13(typename, sel, fieldData, reader, key, sink, variables, f
99378
99415
  reader.markSeenId(fieldDataRef);
99379
99416
  const { value: spanningFieldResult } = resolvedSpanningFieldValue;
99380
99417
  // Handle null values - graphql will return it at the field level, not return nested { value: null }
99381
- if (spanningFieldResult === null || typeof spanningFieldResult !== 'object') {
99418
+ if (spanningFieldResult === null ||
99419
+ typeof spanningFieldResult !== 'object' ||
99420
+ Array.isArray(spanningFieldResult)) {
99382
99421
  reader.assignScalar(key, sink, null);
99383
99422
  break;
99384
99423
  }
@@ -99712,7 +99751,7 @@ function getTypeCacheKeys$15(cacheKeySink, astNode, state) {
99712
99751
 
99713
99752
  function getMappedTypeCacheKeys(cache, astNode, state) {
99714
99753
  const convertedData = convertGraphQLToRaml(astNode, state);
99715
- getTypeCacheKeys$1b(cache, state.luvio, convertedData.recordRepresentation);
99754
+ getTypeCacheKeys$1a(cache, state.luvio, convertedData.recordRepresentation);
99716
99755
  }
99717
99756
 
99718
99757
  const name$11 = 'RecordRepresentation';
@@ -119082,7 +119121,7 @@ register$1({
119082
119121
  configuration: { ...configurationForGraphQLAdapters$1 },
119083
119122
  instrument: instrument$1,
119084
119123
  });
119085
- // version: 1.361.0-eb406138cb
119124
+ // version: 1.362.0-d2e818ae61
119086
119125
 
119087
119126
  // On core the unstable adapters are re-exported with different names,
119088
119127
  // we want to match them here.
@@ -119234,7 +119273,7 @@ withDefaultLuvio((luvio) => {
119234
119273
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
119235
119274
  graphQLImperative = ldsAdapter;
119236
119275
  });
119237
- // version: 1.361.0-eb406138cb
119276
+ // version: 1.362.0-d2e818ae61
119238
119277
 
119239
119278
  var gqlApi = /*#__PURE__*/Object.freeze({
119240
119279
  __proto__: null,
@@ -119254,24 +119293,31 @@ function extractWireAdapterName(adapterName) {
119254
119293
  }
119255
119294
  let lazyDMLAdapterMap = undefined;
119256
119295
  let lazyImperativeAdapterMap = undefined;
119296
+ function buildAdapterMaps(map) {
119297
+ const imperativeAdapterNames = keys$2(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
119298
+ const imperativeAdapterMap = {};
119299
+ for (const adapterName of imperativeAdapterNames) {
119300
+ const adapter = map[adapterName];
119301
+ imperativeAdapterMap[adapterName] = adapter;
119302
+ delete map[adapterName];
119303
+ // remove the corresponding wire adapter from the adapter map
119304
+ const wireAdapterName = extractWireAdapterName(adapterName);
119305
+ delete map[wireAdapterName];
119306
+ }
119307
+ return {
119308
+ dmlAdapterMap: map,
119309
+ imperativeAdapterMap,
119310
+ };
119311
+ }
119257
119312
  // this function builds the adapter maps lazily
119258
119313
  function getAdapterMaps() {
119259
119314
  if (lazyDMLAdapterMap === undefined || lazyImperativeAdapterMap === undefined) {
119260
119315
  // We should eventually be explicit about what we expose here instead of exporting everything from the modules,
119261
119316
  // this is our API contract to native callers and should be explicit
119262
119317
  const map = Object.assign({}, gqlApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi);
119263
- const imperativeAdapterNames = keys$2(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
119264
- const imperativeMap = {};
119265
- for (const adapterName of imperativeAdapterNames) {
119266
- const adapter = map[adapterName];
119267
- imperativeMap[adapterName] = adapter;
119268
- delete map[adapterName];
119269
- // remove the corresponding wire adapter from the adapter map
119270
- const wireAdapterName = extractWireAdapterName(adapterName);
119271
- delete map[wireAdapterName];
119272
- }
119273
- lazyDMLAdapterMap = map;
119274
- lazyImperativeAdapterMap = imperativeMap;
119318
+ const { dmlAdapterMap, imperativeAdapterMap } = buildAdapterMaps(map);
119319
+ lazyDMLAdapterMap = dmlAdapterMap;
119320
+ lazyImperativeAdapterMap = imperativeAdapterMap;
119275
119321
  }
119276
119322
  return { dmlAdapterMap: lazyDMLAdapterMap, imperativeAdapterMap: lazyImperativeAdapterMap };
119277
119323
  }
@@ -120026,7 +120072,7 @@ const callbacks$1 = [];
120026
120072
  function register(r) {
120027
120073
  callbacks$1.forEach((callback) => callback(r));
120028
120074
  }
120029
- // version: 1.361.0-6a70680f2b
120075
+ // version: 1.362.0-5d2767de00
120030
120076
 
120031
120077
  /**
120032
120078
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -121099,11 +121145,100 @@ function handleInstrumentation(activity, stat, progress) {
121099
121145
  }
121100
121146
  }
121101
121147
 
121148
+ const LUVIO_ADAPTER_FAMILY = /^force\/ldsAdapters/;
121149
+ async function importLuvioAdapterModule(specifier) {
121150
+ if (!LUVIO_ADAPTER_FAMILY.test(specifier)) {
121151
+ throw `${specifier} is not an allowed luvio adapter module`;
121152
+ }
121153
+ let module;
121154
+ try {
121155
+ module = await import(specifier);
121156
+ }
121157
+ catch {
121158
+ throw `module not found for specifier ${specifier}`;
121159
+ }
121160
+ return new LuvioAdapterModule(module);
121161
+ }
121162
+ class LuvioAdapterModule {
121163
+ constructor(module) {
121164
+ const map = Object.assign({}, module);
121165
+ const { dmlAdapterMap, imperativeAdapterMap } = buildAdapterMaps(map);
121166
+ this.imperativeAdapterMap = imperativeAdapterMap;
121167
+ this.dmlAdapterMap = dmlAdapterMap;
121168
+ }
121169
+ async invokeAdapter(adapterName, config, nativeAdapterRequestContext) {
121170
+ const imperativeAdapterIdentifier = `${adapterName}_imperative`;
121171
+ const imperativeAdapter = this.imperativeAdapterMap[imperativeAdapterIdentifier];
121172
+ if (imperativeAdapter === undefined) {
121173
+ const dmlAdapter = this.dmlAdapterMap[adapterName];
121174
+ if (dmlAdapter === undefined) {
121175
+ return {
121176
+ data: undefined,
121177
+ error: createNativeFetchErrorResponse(`adapter ${adapterName} not recognized`),
121178
+ };
121179
+ }
121180
+ return this.invokeDmlAdapter(dmlAdapter, config, nativeAdapterRequestContext);
121181
+ }
121182
+ return new Promise((resolve) => {
121183
+ try {
121184
+ imperativeAdapter.invoke(config, buildAdapterRequestContext(nativeAdapterRequestContext), (response) => {
121185
+ resolve(buildNativeCallbackValue(response));
121186
+ });
121187
+ }
121188
+ catch (error) {
121189
+ resolve(buildInvalidConfigError(error));
121190
+ }
121191
+ });
121192
+ }
121193
+ subscribeAdapter(adapterName, config, nativeAdapterRequestContext, callback) {
121194
+ const imperativeAdapterIdentifier = `${adapterName}_imperative`;
121195
+ const imperativeAdapter = this.imperativeAdapterMap[imperativeAdapterIdentifier];
121196
+ if (imperativeAdapter === undefined) {
121197
+ const dmlAdapter = this.dmlAdapterMap[adapterName];
121198
+ if (dmlAdapter === undefined) {
121199
+ const nativeValue = buildNativeCallbackValue({
121200
+ data: undefined,
121201
+ error: createNativeFetchErrorResponse(`adapter ${adapterName} not recognized`),
121202
+ });
121203
+ callback(nativeValue);
121204
+ return () => { };
121205
+ }
121206
+ const nativeValue = buildNativeCallbackValue({
121207
+ data: undefined,
121208
+ error: createNativeFetchErrorResponse(`${adapterName} is not a GET wire adapter and cannot be subscribed.`),
121209
+ });
121210
+ callback(nativeValue);
121211
+ return () => { };
121212
+ }
121213
+ try {
121214
+ return imperativeAdapter.subscribe(config, buildAdapterRequestContext(nativeAdapterRequestContext), callback);
121215
+ }
121216
+ catch (error) {
121217
+ callback(buildInvalidConfigError(error));
121218
+ return () => { };
121219
+ }
121220
+ }
121221
+ invokeDmlAdapter(adapter, config, nativeAdapterRequestContext) {
121222
+ return new Promise((resolve) => {
121223
+ try {
121224
+ adapter(config, buildAdapterRequestContext(nativeAdapterRequestContext)).then((data) => {
121225
+ resolve({ data, error: undefined });
121226
+ }, (error) => {
121227
+ resolve({ data: undefined, error });
121228
+ });
121229
+ }
121230
+ catch (err) {
121231
+ resolve(buildInvalidConfigError(err));
121232
+ }
121233
+ });
121234
+ }
121235
+ }
121236
+
121102
121237
  // LWR has a "setupLDS" bootstrap service/loader hook, we simulate this in
121103
121238
  // standalone bundle by mimicking what "setupLDS" does here and then exporting
121104
121239
  // everything from main.ts
121105
121240
  const { luvio } = getRuntime();
121106
121241
  setDefaultLuvio({ luvio });
121107
121242
 
121108
- export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
121109
- // version: 1.361.0-6a70680f2b
121243
+ export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
121244
+ // version: 1.362.0-5d2767de00
@@ -0,0 +1,13 @@
1
+ import type { Unsubscribe } from '@luvio/engine';
2
+ import { NativeAdapterRequestContext, type NativeCallbackValue, type NativeOnSnapshot } from './executeAdapter';
3
+ import { type ImperativeAdapterMapValue, type AdapterMapValue } from './lightningAdapterApi';
4
+ export declare function importLuvioAdapterModule(specifier: string): Promise<LuvioAdapterModule>;
5
+ declare class LuvioAdapterModule {
6
+ imperativeAdapterMap: Record<string, ImperativeAdapterMapValue>;
7
+ dmlAdapterMap: Record<string, AdapterMapValue>;
8
+ constructor(module: any);
9
+ invokeAdapter<Config>(adapterName: string, config: Config, nativeAdapterRequestContext?: NativeAdapterRequestContext): Promise<NativeCallbackValue>;
10
+ subscribeAdapter<Config>(adapterName: string, config: Config, nativeAdapterRequestContext: NativeAdapterRequestContext, callback: NativeOnSnapshot): Unsubscribe;
11
+ private invokeDmlAdapter;
12
+ }
13
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { AdapterRequestContext, CachePolicy, LuvioAdapterEventObserver } from '@luvio/engine';
2
+ import type { DataCallbackTuple } from '@salesforce/lds-bindings';
2
3
  import type { DraftQueueItemMetadata } from '@salesforce/lds-drafts';
3
4
  import type { NativeErrorResponse } from './responses';
4
5
  import type { ObservabilityContext } from '@salesforce/lds-runtime-mobile';
@@ -21,12 +22,12 @@ export type NativeCallbackErrors = {
21
22
  };
22
23
  export type NativeOnSnapshot = (value: NativeCallbackValue) => void;
23
24
  export type NativeOnResponse = (value: NativeCallbackValue) => void;
24
- type Unsubscribe = () => void;
25
+ export type Unsubscribe = () => void;
25
26
  type NativeCachePolicy = CachePolicy;
26
27
  type NativeAdapterRequestPriority = 'high' | 'normal' | 'background';
27
28
  type NativeObservabilityContext = ObservabilityContext;
28
29
  type NativeLuvioEventObserver = LuvioAdapterEventObserver;
29
- interface NativeAdapterRequestContext {
30
+ export interface NativeAdapterRequestContext {
30
31
  cachePolicy?: NativeCachePolicy;
31
32
  priority?: NativeAdapterRequestPriority;
32
33
  observabilityContext?: NativeObservabilityContext;
@@ -38,6 +39,8 @@ interface NativeAdapterRequestContext {
38
39
  * @returns Coerced luvio request context
39
40
  */
40
41
  export declare function buildAdapterRequestContext(nativeRequestContext: NativeAdapterRequestContext | undefined): AdapterRequestContext | undefined;
42
+ export declare function buildInvalidConfigError(error: unknown): NativeCallbackError;
43
+ export declare function buildNativeCallbackValue(adapterCallbackValue: DataCallbackTuple<unknown>): NativeCallbackValue;
41
44
  /**
42
45
  * Executes the adapter with the given adapterId and config. Will call onSnapshot
43
46
  * callback with data or error. Returns an unsubscribe function that should
@@ -3,8 +3,12 @@ import type { Adapter } from '@luvio/engine';
3
3
  import * as gqlApi from 'force/ldsAdaptersGraphql';
4
4
  export declare const IMPERATIVE_ADAPTER_SUFFIX = "_imperative";
5
5
  export declare const UNSTABLE_ADAPTER_PREFIX = "unstable_";
6
- type AdapterMapValue = Adapter<unknown, unknown> | ImperativeAdapter<unknown, unknown> | undefined;
7
- type ImperativeAdapterMapValue = ImperativeAdapter<unknown, unknown> | undefined;
6
+ export type AdapterMapValue = Adapter<unknown, unknown> | ImperativeAdapter<unknown, unknown> | undefined;
7
+ export type ImperativeAdapterMapValue = ImperativeAdapter<unknown, unknown> | undefined;
8
+ export declare function buildAdapterMaps(map: Record<string, AdapterMapValue>): {
9
+ dmlAdapterMap: Record<string, AdapterMapValue>;
10
+ imperativeAdapterMap: Record<string, ImperativeAdapterMapValue>;
11
+ };
8
12
  declare function getDMLAdapterFromName(name: string): AdapterMapValue;
9
13
  declare function getImperativeAdapterFromName(name: string): ImperativeAdapterMapValue;
10
14
  declare function getImperativeAdapterNames(): string[];
@@ -6,4 +6,5 @@ import { setUiApiRecordTTL, setMetadataTTL } from './ttl';
6
6
  import { registerReportObserver } from '@salesforce/lds-runtime-mobile';
7
7
  import { createPrimingSession } from './primingApi';
8
8
  import { evictCacheRecordsByIds, evictExpiredCacheEntries, stopEviction } from './cachePurging';
9
- export { subscribeToAdapter, invokeAdapter, invokeAdapterWithMetadata, invokeAdapterWithDraftToReplace, invokeAdapterWithDraftToMerge, executeAdapter, executeMutatingAdapter, nimbusDraftQueue, draftQueue, draftManager, setUiApiRecordTTL, setMetadataTTL, registerReportObserver, getImperativeAdapterNames, createPrimingSession, evictCacheRecordsByIds, evictExpiredCacheEntries, stopEviction, };
9
+ import { importLuvioAdapterModule } from './customLuvioAdapter';
10
+ export { subscribeToAdapter, invokeAdapter, invokeAdapterWithMetadata, invokeAdapterWithDraftToReplace, invokeAdapterWithDraftToMerge, executeAdapter, executeMutatingAdapter, nimbusDraftQueue, draftQueue, draftManager, setUiApiRecordTTL, setMetadataTTL, registerReportObserver, getImperativeAdapterNames, createPrimingSession, evictCacheRecordsByIds, evictExpiredCacheEntries, stopEviction, importLuvioAdapterModule, };