@salesforce/lds-worker-api 1.361.0 → 1.363.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.
@@ -4277,7 +4277,7 @@
4277
4277
  }
4278
4278
  callbacks.push(callback);
4279
4279
  }
4280
- // version: 1.361.0-6a70680f2b
4280
+ // version: 1.363.0-99132bb508
4281
4281
 
4282
4282
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4283
4283
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5225,7 +5225,7 @@
5225
5225
  const { apiFamily, name } = metadata;
5226
5226
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5227
5227
  }
5228
- // version: 1.361.0-6a70680f2b
5228
+ // version: 1.363.0-99132bb508
5229
5229
 
5230
5230
  /**
5231
5231
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -6870,7 +6870,7 @@
6870
6870
  return true;
6871
6871
  }
6872
6872
 
6873
- const VERSION$1i$2 = "195d918987a35f45e1aa4dce9a11d8c5";
6873
+ const VERSION$1i$2 = "2738fe8faf98ecd076d7c4df86fd5bf0";
6874
6874
  const RepresentationType$X = 'FieldValueRepresentation';
6875
6875
  function normalize$Q(input, existing, path, luvio, store, timestamp) {
6876
6876
  const input_value = input.value;
@@ -6900,10 +6900,10 @@
6900
6900
  kind: 'Scalar'
6901
6901
  },
6902
6902
  {
6903
+ kind: 'Object',
6903
6904
  name: 'value',
6904
- kind: 'Link',
6905
6905
  nullable: true,
6906
- fragment: select$1V()
6906
+ // Complex union deep
6907
6907
  }
6908
6908
  ]
6909
6909
  };
@@ -6916,12 +6916,32 @@
6916
6916
  }
6917
6917
  const existing_value = existing.value;
6918
6918
  const incoming_value = incoming.value;
6919
- if (!(existing_value === incoming_value
6920
- || (existing_value != null &&
6921
- incoming_value != null &&
6922
- existing_value.__ref != null &&
6923
- incoming_value.__ref != null &&
6924
- existing_value.__ref === incoming_value.__ref))) {
6919
+ if (!((() => {
6920
+ if (existing_value === null || incoming_value === null) {
6921
+ return existing_value === incoming_value;
6922
+ }
6923
+ if (Array.isArray(existing_value) && Array.isArray(incoming_value)) {
6924
+ const equals_value_items = equalsArray$1(existing_value, incoming_value, (existing_value_item, incoming_value_item) => {
6925
+ if (!(existing_value_item === incoming_value_item)) {
6926
+ return false;
6927
+ }
6928
+ });
6929
+ if (equals_value_items === false) {
6930
+ return false;
6931
+ }
6932
+ }
6933
+ else {
6934
+ if (!(existing_value === incoming_value
6935
+ || (existing_value != null &&
6936
+ incoming_value != null &&
6937
+ existing_value.__ref != null &&
6938
+ incoming_value.__ref != null &&
6939
+ existing_value.__ref === incoming_value.__ref))) {
6940
+ return false;
6941
+ }
6942
+ }
6943
+ return true;
6944
+ })())) {
6925
6945
  return false;
6926
6946
  }
6927
6947
  return true;
@@ -8983,6 +9003,11 @@
8983
9003
  kind: 'Scalar',
8984
9004
  name: 'value',
8985
9005
  };
9006
+ const ARRAY_VALUE_SELECTION = {
9007
+ kind: 'Scalar',
9008
+ name: 'value',
9009
+ plural: true,
9010
+ };
8986
9011
  const DISPLAY_VALUE_SELECTION$1 = {
8987
9012
  kind: 'Scalar',
8988
9013
  name: 'displayValue',
@@ -9068,6 +9093,10 @@
9068
9093
  },
9069
9094
  };
9070
9095
  }
9096
+ else if (Array.isArray(fieldValue)) {
9097
+ // this should change if we ever accept arrays of non-scalars
9098
+ fieldValueSelection = ARRAY_VALUE_SELECTION;
9099
+ }
9071
9100
  const fieldSelection = {
9072
9101
  kind: 'Link',
9073
9102
  name: fieldName,
@@ -9169,7 +9198,7 @@
9169
9198
  required: false,
9170
9199
  };
9171
9200
  function isSpanningRecord$3(fieldValue) {
9172
- return fieldValue !== null && typeof fieldValue === 'object';
9201
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
9173
9202
  }
9174
9203
  function createRecordSelection$1(fieldDefinition) {
9175
9204
  const sel = dynamicSelect$8$1({
@@ -9262,7 +9291,7 @@
9262
9291
  continue;
9263
9292
  }
9264
9293
  const { maxDepth, onlyFetchLeafNodeIdAndName } = config;
9265
- if (field.isScalar('value') === false) {
9294
+ if (field.isScalar('value') === false && !Array.isArray(field.data?.value)) {
9266
9295
  if (depth + 1 > maxDepth) {
9267
9296
  if (onlyFetchLeafNodeIdAndName === true) {
9268
9297
  addScalarFieldId$1(current);
@@ -9299,7 +9328,7 @@
9299
9328
  addScalarFieldName$1(current);
9300
9329
  continue;
9301
9330
  }
9302
- if (field.scalar('value') === null) {
9331
+ if (field.scalar('value') === null && !Array.isArray(field.data?.value)) {
9303
9332
  continue;
9304
9333
  }
9305
9334
  }
@@ -9439,7 +9468,7 @@
9439
9468
  const link = fieldValueRepresentation.link(fieldName);
9440
9469
  const resolved = link.follow();
9441
9470
  if (isGraphNode$1(resolved) &&
9442
- resolved.isScalar('value') &&
9471
+ (resolved.isScalar('value') || !Array.isArray(resolved.data?.value)) &&
9443
9472
  path.length > 0 && // TODO [W-14082782]: temporary fix
9444
9473
  !isFrozen$3(link.data)) {
9445
9474
  const linkState = link.linkData();
@@ -9483,7 +9512,7 @@
9483
9512
  return;
9484
9513
  }
9485
9514
  // if value is not a scalar, follow the link and mark it as missing
9486
- if (fieldValue.isScalar('value') === false) {
9515
+ if (fieldValue.isScalar('value') === false && !Array.isArray(fieldValue.data?.value)) {
9487
9516
  _markMissingPath$1(fieldValue
9488
9517
  .link('value')
9489
9518
  .follow(), path);
@@ -9604,7 +9633,7 @@
9604
9633
  .link(spanningFieldName);
9605
9634
  const field = fieldValueRep.follow();
9606
9635
  if (isGraphNode$1(field)) {
9607
- if (field.isScalar('value') === false) {
9636
+ if (field.isScalar('value') === false && !Array.isArray(field.data?.value)) {
9608
9637
  const record = field
9609
9638
  .link('value')
9610
9639
  .follow();
@@ -9846,7 +9875,7 @@
9846
9875
  function normalize$O(input, existing, path, luvio, store, timestamp, fieldsTrie, optionalFieldsTrie, recordConflictMap) {
9847
9876
  const input_value = input.value;
9848
9877
  const input_value_id = path.fullPath + '__value';
9849
- if (input_value !== null && typeof input_value === 'object') {
9878
+ if (input_value !== null && typeof input_value === 'object' && !Array.isArray(input_value)) {
9850
9879
  const ingest = createRecordIngest$1(fieldsTrie, optionalFieldsTrie, recordConflictMap);
9851
9880
  input.value = ingest(input_value, {
9852
9881
  fullPath: input_value_id,
@@ -34009,7 +34038,7 @@
34009
34038
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
34010
34039
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
34011
34040
  });
34012
- // version: 1.361.0-eb406138cb
34041
+ // version: 1.363.0-112332910d
34013
34042
 
34014
34043
  /**
34015
34044
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -45687,7 +45716,7 @@
45687
45716
  };
45688
45717
  }
45689
45718
  function isSpanningRecord$2(fieldValue) {
45690
- return fieldValue !== null && typeof fieldValue === 'object';
45719
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
45691
45720
  }
45692
45721
  function mergeRecordFields$2(first, second) {
45693
45722
  const { fields: targetFields } = first;
@@ -49590,7 +49619,9 @@
49590
49619
  const input_fields_length = field_values.length;
49591
49620
  for (let i = 0; i < input_fields_length; i++) {
49592
49621
  const field_value = input_fields[field_values[i]];
49593
- if (field_value.value !== null && typeof field_value.value === 'object') {
49622
+ if (field_value.value !== null &&
49623
+ typeof field_value.value === 'object' &&
49624
+ !Array.isArray(field_value.value)) {
49594
49625
  getTypeCacheKeys$1u$1(rootKeySet, luvio, field_value.value);
49595
49626
  }
49596
49627
  }
@@ -49791,7 +49822,7 @@
49791
49822
  required: false,
49792
49823
  };
49793
49824
  function isSpanningRecord$1(fieldValue) {
49794
- return fieldValue !== null && typeof fieldValue === 'object';
49825
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
49795
49826
  }
49796
49827
  function createRecordSelection(fieldDefinition) {
49797
49828
  const sel = dynamicSelect$8({
@@ -50584,7 +50615,7 @@
50584
50615
  current.children[key] = next;
50585
50616
  continue;
50586
50617
  }
50587
- if (fieldRep.isScalar('value') === false) {
50618
+ if (fieldRep.isScalar('value') === false && !Array.isArray(fieldRep.data?.value)) {
50588
50619
  const link = fieldRep.link('value');
50589
50620
  const spanningRep = link.follow();
50590
50621
  if (isExternalLookupFieldKey(spanningRep)) {
@@ -50725,7 +50756,7 @@
50725
50756
  }
50726
50757
  const resolved = fieldValueRepresentation.object(fieldName);
50727
50758
  if (isGraphNode(resolved) &&
50728
- resolved.isScalar('value') &&
50759
+ (resolved.isScalar('value') || Array.isArray(resolved.data?.value)) &&
50729
50760
  path.length > 0 && // TODO [W-14082782]: temporary fix
50730
50761
  !isFrozen$2(resolved.data)) {
50731
50762
  const stateFields = readFieldStateFromValueNode(resolved.data);
@@ -50763,7 +50794,7 @@
50763
50794
  writeMissingFieldToStore(fieldValueRepresentation, fieldName);
50764
50795
  return;
50765
50796
  }
50766
- if (fieldValueValue.isScalar('value') === true) {
50797
+ if (fieldValueValue.isScalar('value') === true || Array.isArray(fieldValueValue.data?.value)) {
50767
50798
  return;
50768
50799
  }
50769
50800
  const link = fieldValueValue.link('value');
@@ -84182,12 +84213,14 @@
84182
84213
  e: EARLY_END,
84183
84214
  }),
84184
84215
  hasNextPage: source.hasNextPage,
84216
+ hasPreviousPage: source.hasPreviousPage,
84185
84217
  };
84186
84218
  }
84187
84219
  return {
84188
84220
  startCursor: null,
84189
84221
  endCursor: null,
84190
84222
  hasNextPage: source.hasNextPage,
84223
+ hasPreviousPage: source.hasPreviousPage,
84191
84224
  };
84192
84225
  }
84193
84226
  let startIndex = source.records[0].index;
@@ -84206,6 +84239,7 @@
84206
84239
  startCursor: encodeV1Cursor(startCursor),
84207
84240
  endCursor: encodeV1Cursor(endCursor),
84208
84241
  hasNextPage: source.hasNextPage,
84242
+ hasPreviousPage: source.hasPreviousPage,
84209
84243
  };
84210
84244
  }
84211
84245
  function pageResultCountResolver(source) {
@@ -84460,6 +84494,7 @@
84460
84494
  return {
84461
84495
  records: [],
84462
84496
  hasNextPage: false,
84497
+ hasPreviousPage: false,
84463
84498
  earlyEnd: false,
84464
84499
  offset: 0,
84465
84500
  };
@@ -84511,6 +84546,7 @@
84511
84546
  const { sql, bindings } = buildQuery(queryConfig);
84512
84547
  const results = await query(sql, bindings);
84513
84548
  let hasNextPage = false;
84549
+ const hasPreviousPage = offset > 0;
84514
84550
  let earlyEnd = false;
84515
84551
  if (wantsHasNextPage) {
84516
84552
  if (results.rows.length > limit) {
@@ -84559,6 +84595,7 @@
84559
84595
  return {
84560
84596
  records,
84561
84597
  hasNextPage,
84598
+ hasPreviousPage,
84562
84599
  earlyEnd,
84563
84600
  offset,
84564
84601
  };
@@ -88404,7 +88441,7 @@
88404
88441
  return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
88405
88442
  }
88406
88443
  function isSpanningRecord(fieldValue) {
88407
- return fieldValue !== null && typeof fieldValue === 'object';
88444
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
88408
88445
  }
88409
88446
  function mergeRecordFields(first, second) {
88410
88447
  const { fields: targetFields } = first;
@@ -93207,7 +93244,7 @@
93207
93244
  id: '@salesforce/lds-network-adapter',
93208
93245
  instrument: instrument$2,
93209
93246
  });
93210
- // version: 1.361.0-6a70680f2b
93247
+ // version: 1.363.0-99132bb508
93211
93248
 
93212
93249
  const { create: create$2, keys: keys$2 } = Object;
93213
93250
  const { stringify, parse } = JSON;
@@ -98173,12 +98210,39 @@
98173
98210
  }
98174
98211
  }
98175
98212
 
98213
+ const RepresentationType$3 = 'RecordCollectionRepresentation';
98214
+ function getTypeCacheKeys$1b(rootKeySet, luvio, input, fullPathFactory) {
98215
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
98216
+ const rootKey = fullPathFactory();
98217
+ rootKeySet.set(rootKey, {
98218
+ namespace: keyPrefix$1,
98219
+ representationName: RepresentationType$3,
98220
+ mergeable: false
98221
+ });
98222
+ const input_records_length = input.records.length;
98223
+ for (let i = 0; i < input_records_length; i++) {
98224
+ getTypeCacheKeys$1a(rootKeySet, luvio, input.records[i]);
98225
+ }
98226
+ }
98227
+
98228
+ const VERSION$1h = "98c5b18512e48ca8d28727549507e4ba";
98229
+ const RepresentationType$2 = 'RecordRepresentation';
98230
+ function keyBuilder$18(luvio, config) {
98231
+ return keyPrefix$1 + '::' + RepresentationType$2 + ':' + config.recordId;
98232
+ }
98233
+ function keyBuilderFromType(luvio, object) {
98234
+ const keyParams = {
98235
+ recordId: object.id
98236
+ };
98237
+ return keyBuilder$18(luvio, keyParams);
98238
+ }
98239
+
98176
98240
  const { assign: assign$1, create: create$1, freeze: freeze$1, isFrozen: isFrozen$1, keys: keys$1 } = Object;
98177
98241
  const { isArray: isArray$2 } = Array;
98178
98242
  const { concat: concat$1, filter: filter$1, includes: includes$1, push: push$1, reduce: reduce$1 } = Array.prototype;
98179
98243
 
98180
98244
  // we override the generated so we can set "mergeable: true" on the root key
98181
- const getTypeCacheKeys$1b = (rootKeySet, luvio, input, _fullPathFactory) => {
98245
+ const getTypeCacheKeys$1a = (rootKeySet, luvio, input, _fullPathFactory) => {
98182
98246
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
98183
98247
  const rootKey = keyBuilderFromType(luvio, input);
98184
98248
  rootKeySet.set(rootKey, {
@@ -98191,7 +98255,7 @@
98191
98255
  const input_childRelationships_length = input_childRelationships_keys.length;
98192
98256
  for (let i = 0; i < input_childRelationships_length; i++) {
98193
98257
  const key = input_childRelationships_keys[i];
98194
- getTypeCacheKeys$1a(rootKeySet, luvio, input_childRelationships[key], () => rootKey + '__childRelationships' + '__' + key);
98258
+ getTypeCacheKeys$1b(rootKeySet, luvio, input_childRelationships[key], () => rootKey + '__childRelationships' + '__' + key);
98195
98259
  }
98196
98260
  const input_fields = input.fields;
98197
98261
  const input_fields_keys = keys$1(input_fields);
@@ -98203,34 +98267,7 @@
98203
98267
  return rootKeySet;
98204
98268
  };
98205
98269
 
98206
- const RepresentationType$3 = 'RecordCollectionRepresentation';
98207
- function getTypeCacheKeys$1a(rootKeySet, luvio, input, fullPathFactory) {
98208
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
98209
- const rootKey = fullPathFactory();
98210
- rootKeySet.set(rootKey, {
98211
- namespace: keyPrefix$1,
98212
- representationName: RepresentationType$3,
98213
- mergeable: false
98214
- });
98215
- const input_records_length = input.records.length;
98216
- for (let i = 0; i < input_records_length; i++) {
98217
- getTypeCacheKeys$1b(rootKeySet, luvio, input.records[i]);
98218
- }
98219
- }
98220
-
98221
- const VERSION$1h = "98c5b18512e48ca8d28727549507e4ba";
98222
- const RepresentationType$2 = 'RecordRepresentation';
98223
- function keyBuilder$18(luvio, config) {
98224
- return keyPrefix$1 + '::' + RepresentationType$2 + ':' + config.recordId;
98225
- }
98226
- function keyBuilderFromType(luvio, object) {
98227
- const keyParams = {
98228
- recordId: object.id
98229
- };
98230
- return keyBuilder$18(luvio, keyParams);
98231
- }
98232
-
98233
- const VERSION$1g = "195d918987a35f45e1aa4dce9a11d8c5";
98270
+ const VERSION$1g = "2738fe8faf98ecd076d7c4df86fd5bf0";
98234
98271
  const RepresentationType$1 = 'FieldValueRepresentation';
98235
98272
  function getTypeCacheKeys$19(rootKeySet, luvio, input, fullPathFactory) {
98236
98273
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
@@ -98241,7 +98278,7 @@
98241
98278
  mergeable: false
98242
98279
  });
98243
98280
  if (!Array.isArray(input.value) && input.value !== null && typeof input.value === 'object') {
98244
- getTypeCacheKeys$1b(rootKeySet, luvio, input.value);
98281
+ getTypeCacheKeys$1a(rootKeySet, luvio, input.value);
98245
98282
  }
98246
98283
  }
98247
98284
 
@@ -99384,7 +99421,9 @@
99384
99421
  reader.markSeenId(fieldDataRef);
99385
99422
  const { value: spanningFieldResult } = resolvedSpanningFieldValue;
99386
99423
  // Handle null values - graphql will return it at the field level, not return nested { value: null }
99387
- if (spanningFieldResult === null || typeof spanningFieldResult !== 'object') {
99424
+ if (spanningFieldResult === null ||
99425
+ typeof spanningFieldResult !== 'object' ||
99426
+ Array.isArray(spanningFieldResult)) {
99388
99427
  reader.assignScalar(key, sink, null);
99389
99428
  break;
99390
99429
  }
@@ -99718,7 +99757,7 @@
99718
99757
 
99719
99758
  function getMappedTypeCacheKeys(cache, astNode, state) {
99720
99759
  const convertedData = convertGraphQLToRaml(astNode, state);
99721
- getTypeCacheKeys$1b(cache, state.luvio, convertedData.recordRepresentation);
99760
+ getTypeCacheKeys$1a(cache, state.luvio, convertedData.recordRepresentation);
99722
99761
  }
99723
99762
 
99724
99763
  const name$11 = 'RecordRepresentation';
@@ -119088,7 +119127,7 @@
119088
119127
  configuration: { ...configurationForGraphQLAdapters$1 },
119089
119128
  instrument: instrument$1,
119090
119129
  });
119091
- // version: 1.361.0-eb406138cb
119130
+ // version: 1.363.0-112332910d
119092
119131
 
119093
119132
  // On core the unstable adapters are re-exported with different names,
119094
119133
  // we want to match them here.
@@ -119240,7 +119279,7 @@
119240
119279
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
119241
119280
  graphQLImperative = ldsAdapter;
119242
119281
  });
119243
- // version: 1.361.0-eb406138cb
119282
+ // version: 1.363.0-112332910d
119244
119283
 
119245
119284
  var gqlApi = /*#__PURE__*/Object.freeze({
119246
119285
  __proto__: null,
@@ -119260,24 +119299,31 @@
119260
119299
  }
119261
119300
  let lazyDMLAdapterMap = undefined;
119262
119301
  let lazyImperativeAdapterMap = undefined;
119302
+ function buildAdapterMaps(map) {
119303
+ const imperativeAdapterNames = keys$2(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
119304
+ const imperativeAdapterMap = {};
119305
+ for (const adapterName of imperativeAdapterNames) {
119306
+ const adapter = map[adapterName];
119307
+ imperativeAdapterMap[adapterName] = adapter;
119308
+ delete map[adapterName];
119309
+ // remove the corresponding wire adapter from the adapter map
119310
+ const wireAdapterName = extractWireAdapterName(adapterName);
119311
+ delete map[wireAdapterName];
119312
+ }
119313
+ return {
119314
+ dmlAdapterMap: map,
119315
+ imperativeAdapterMap,
119316
+ };
119317
+ }
119263
119318
  // this function builds the adapter maps lazily
119264
119319
  function getAdapterMaps() {
119265
119320
  if (lazyDMLAdapterMap === undefined || lazyImperativeAdapterMap === undefined) {
119266
119321
  // We should eventually be explicit about what we expose here instead of exporting everything from the modules,
119267
119322
  // this is our API contract to native callers and should be explicit
119268
119323
  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);
119269
- const imperativeAdapterNames = keys$2(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
119270
- const imperativeMap = {};
119271
- for (const adapterName of imperativeAdapterNames) {
119272
- const adapter = map[adapterName];
119273
- imperativeMap[adapterName] = adapter;
119274
- delete map[adapterName];
119275
- // remove the corresponding wire adapter from the adapter map
119276
- const wireAdapterName = extractWireAdapterName(adapterName);
119277
- delete map[wireAdapterName];
119278
- }
119279
- lazyDMLAdapterMap = map;
119280
- lazyImperativeAdapterMap = imperativeMap;
119324
+ const { dmlAdapterMap, imperativeAdapterMap } = buildAdapterMaps(map);
119325
+ lazyDMLAdapterMap = dmlAdapterMap;
119326
+ lazyImperativeAdapterMap = imperativeAdapterMap;
119281
119327
  }
119282
119328
  return { dmlAdapterMap: lazyDMLAdapterMap, imperativeAdapterMap: lazyImperativeAdapterMap };
119283
119329
  }
@@ -120032,7 +120078,7 @@
120032
120078
  function register(r) {
120033
120079
  callbacks$1.forEach((callback) => callback(r));
120034
120080
  }
120035
- // version: 1.361.0-6a70680f2b
120081
+ // version: 1.363.0-99132bb508
120036
120082
 
120037
120083
  /**
120038
120084
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -121105,6 +121151,95 @@
121105
121151
  }
121106
121152
  }
121107
121153
 
121154
+ const LUVIO_ADAPTER_FAMILY = /^force\/ldsAdapters/;
121155
+ async function importLuvioAdapterModule(specifier) {
121156
+ if (!LUVIO_ADAPTER_FAMILY.test(specifier)) {
121157
+ throw `${specifier} is not an allowed luvio adapter module`;
121158
+ }
121159
+ let module;
121160
+ try {
121161
+ module = await import(specifier);
121162
+ }
121163
+ catch {
121164
+ throw `module not found for specifier ${specifier}`;
121165
+ }
121166
+ return new LuvioAdapterModule(module);
121167
+ }
121168
+ class LuvioAdapterModule {
121169
+ constructor(module) {
121170
+ const map = Object.assign({}, module);
121171
+ const { dmlAdapterMap, imperativeAdapterMap } = buildAdapterMaps(map);
121172
+ this.imperativeAdapterMap = imperativeAdapterMap;
121173
+ this.dmlAdapterMap = dmlAdapterMap;
121174
+ }
121175
+ async invokeAdapter(adapterName, config, nativeAdapterRequestContext) {
121176
+ const imperativeAdapterIdentifier = `${adapterName}_imperative`;
121177
+ const imperativeAdapter = this.imperativeAdapterMap[imperativeAdapterIdentifier];
121178
+ if (imperativeAdapter === undefined) {
121179
+ const dmlAdapter = this.dmlAdapterMap[adapterName];
121180
+ if (dmlAdapter === undefined) {
121181
+ return {
121182
+ data: undefined,
121183
+ error: createNativeFetchErrorResponse(`adapter ${adapterName} not recognized`),
121184
+ };
121185
+ }
121186
+ return this.invokeDmlAdapter(dmlAdapter, config, nativeAdapterRequestContext);
121187
+ }
121188
+ return new Promise((resolve) => {
121189
+ try {
121190
+ imperativeAdapter.invoke(config, buildAdapterRequestContext(nativeAdapterRequestContext), (response) => {
121191
+ resolve(buildNativeCallbackValue(response));
121192
+ });
121193
+ }
121194
+ catch (error) {
121195
+ resolve(buildInvalidConfigError(error));
121196
+ }
121197
+ });
121198
+ }
121199
+ subscribeAdapter(adapterName, config, nativeAdapterRequestContext, callback) {
121200
+ const imperativeAdapterIdentifier = `${adapterName}_imperative`;
121201
+ const imperativeAdapter = this.imperativeAdapterMap[imperativeAdapterIdentifier];
121202
+ if (imperativeAdapter === undefined) {
121203
+ const dmlAdapter = this.dmlAdapterMap[adapterName];
121204
+ if (dmlAdapter === undefined) {
121205
+ const nativeValue = buildNativeCallbackValue({
121206
+ data: undefined,
121207
+ error: createNativeFetchErrorResponse(`adapter ${adapterName} not recognized`),
121208
+ });
121209
+ callback(nativeValue);
121210
+ return () => { };
121211
+ }
121212
+ const nativeValue = buildNativeCallbackValue({
121213
+ data: undefined,
121214
+ error: createNativeFetchErrorResponse(`${adapterName} is not a GET wire adapter and cannot be subscribed.`),
121215
+ });
121216
+ callback(nativeValue);
121217
+ return () => { };
121218
+ }
121219
+ try {
121220
+ return imperativeAdapter.subscribe(config, buildAdapterRequestContext(nativeAdapterRequestContext), callback);
121221
+ }
121222
+ catch (error) {
121223
+ callback(buildInvalidConfigError(error));
121224
+ return () => { };
121225
+ }
121226
+ }
121227
+ invokeDmlAdapter(adapter, config, nativeAdapterRequestContext) {
121228
+ return new Promise((resolve) => {
121229
+ try {
121230
+ adapter(config, buildAdapterRequestContext(nativeAdapterRequestContext)).then((data) => {
121231
+ resolve({ data, error: undefined });
121232
+ }, (error) => {
121233
+ resolve({ data: undefined, error });
121234
+ });
121235
+ }
121236
+ catch (err) {
121237
+ resolve(buildInvalidConfigError(err));
121238
+ }
121239
+ });
121240
+ }
121241
+ }
121242
+
121108
121243
  // LWR has a "setupLDS" bootstrap service/loader hook, we simulate this in
121109
121244
  // standalone bundle by mimicking what "setupLDS" does here and then exporting
121110
121245
  // everything from main.ts
@@ -121119,6 +121254,7 @@
121119
121254
  exports.executeAdapter = executeAdapter;
121120
121255
  exports.executeMutatingAdapter = executeMutatingAdapter;
121121
121256
  exports.getImperativeAdapterNames = getImperativeAdapterNames;
121257
+ exports.importLuvioAdapterModule = importLuvioAdapterModule;
121122
121258
  exports.invokeAdapter = invokeAdapter;
121123
121259
  exports.invokeAdapterWithDraftToMerge = invokeAdapterWithDraftToMerge;
121124
121260
  exports.invokeAdapterWithDraftToReplace = invokeAdapterWithDraftToReplace;
@@ -121131,4 +121267,4 @@
121131
121267
  exports.subscribeToAdapter = subscribeToAdapter;
121132
121268
 
121133
121269
  }));
121134
- // version: 1.361.0-6a70680f2b
121270
+ // version: 1.363.0-99132bb508
@@ -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, };