@salesforce/lds-worker-api 1.297.0 → 1.299.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.
@@ -15,6 +15,7 @@ import { parseAndVisit, gql } from 'force/ldsGraphqlParser';
15
15
  import * as lightningAppsApi from 'lightning/uiAppsApi';
16
16
  import * as unstableLightningAppsApi from 'lightning/unstable_uiAppsApi';
17
17
  import * as lightningLayoutApi from 'lightning/uiLayoutApi';
18
+ import * as lightningLayoutUserStateApi from 'lightning/uiLayoutUserStateApi';
18
19
  import * as unstableLightningLayoutApi from 'lightning/unstable_uiLayoutApi';
19
20
  import * as lightningListApi from 'lightning/uiListApi';
20
21
  import * as unstableLightningListApi from 'lightning/unstable_uiListApi';
@@ -60,7 +61,7 @@ function getAdapterMaps() {
60
61
  if (lazyDMLAdapterMap === undefined || lazyImperativeAdapterMap === undefined) {
61
62
  // We should eventually be explicit about what we expose here instead of exporting everything from the modules,
62
63
  // this is our API contract to native callers and should be explicit
63
- const map = Object.assign({}, gqlApi, lightningAppsApi, lightningLayoutApi, lightningListApi, lightningLookupsApi, lightningObjectApi, lightningRecordActionsApi, lightningRecordApi, lightningRecordAvatarApi, lightningRelatedListApi, lightningGraphQLApi, unstableLightningAppsApi, unstableLightningLayoutApi, unstableLightningListApi, unstableLightningLookupsApi, unstableLightningObjectApi, unstableLightningRecordActionsApi, unstableLightningRecordApi, unstableLightningRecordAvatarApi, unstableLightningRelatedListApi);
64
+ const map = Object.assign({}, gqlApi, lightningAppsApi, lightningLayoutApi, lightningLayoutUserStateApi, lightningListApi, lightningLookupsApi, lightningObjectApi, lightningRecordActionsApi, lightningRecordApi, lightningRecordAvatarApi, lightningRelatedListApi, lightningGraphQLApi, unstableLightningAppsApi, unstableLightningLayoutApi, unstableLightningListApi, unstableLightningLookupsApi, unstableLightningObjectApi, unstableLightningRecordActionsApi, unstableLightningRecordApi, unstableLightningRecordAvatarApi, unstableLightningRelatedListApi);
64
65
  const imperativeAdapterNames = keys(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
65
66
  const imperativeMap = {};
66
67
  for (const adapterName of imperativeAdapterNames) {
@@ -1070,4 +1071,4 @@ if (process.env.NODE_ENV !== 'production') {
1070
1071
  }
1071
1072
 
1072
1073
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1073
- // version: 1.297.0-1fc775982
1074
+ // version: 1.299.0-83936bf1de
@@ -4204,7 +4204,7 @@ function withDefaultLuvio(callback) {
4204
4204
  }
4205
4205
  callbacks.push(callback);
4206
4206
  }
4207
- // version: 1.297.0-1fc775982
4207
+ // version: 1.299.0-83936bf1de
4208
4208
 
4209
4209
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4210
4210
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15712,7 +15712,7 @@ function gql(literals, ...subs) {
15712
15712
  }
15713
15713
  return superResult;
15714
15714
  }
15715
- // version: 1.297.0-1fc775982
15715
+ // version: 1.299.0-83936bf1de
15716
15716
 
15717
15717
  function unwrap(data) {
15718
15718
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16641,7 +16641,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16641
16641
  const { apiFamily, name } = metadata;
16642
16642
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16643
16643
  }
16644
- // version: 1.297.0-1fc775982
16644
+ // version: 1.299.0-83936bf1de
16645
16645
 
16646
16646
  /**
16647
16647
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -43198,11 +43198,23 @@ function validateAdapterConfig$2$1(untrustedConfig, configPropertyNames) {
43198
43198
  return config;
43199
43199
  }
43200
43200
 
43201
+ const ISO8601_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z$/;
43201
43202
  function getHeaders(clientOptions) {
43202
43203
  const headers = {};
43203
43204
  if (untrustedIsObject$2(clientOptions)) {
43204
43205
  if (typeof clientOptions.ifUnmodifiedSince === 'string') {
43205
43206
  headers.ifUnmodifiedSince = clientOptions.ifUnmodifiedSince;
43207
+ // HTTP standard format date is expected by UI-API
43208
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since
43209
+ // A component built for Connect API must use If-Unmodified-Since
43210
+ // dates formatted as ISO 8601, which does not match the HTTP spec.
43211
+ // For compatibility, convert the date to match the standard.
43212
+ if (headers.ifUnmodifiedSince.match(ISO8601_DATE_REGEX)) {
43213
+ const utcString = new Date(headers.ifUnmodifiedSince).toUTCString();
43214
+ if (utcString !== 'Invalid Date') {
43215
+ headers.ifUnmodifiedSince = utcString;
43216
+ }
43217
+ }
43206
43218
  }
43207
43219
  }
43208
43220
  return headers;
@@ -44238,7 +44250,7 @@ withDefaultLuvio((luvio) => {
44238
44250
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44239
44251
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44240
44252
  });
44241
- // version: 1.297.0-e0cfbd880
44253
+ // version: 1.299.0-161c48605a
44242
44254
 
44243
44255
  var ldsIdempotencyWriteDisabled = {
44244
44256
  isOpen: function (e) {
@@ -56828,7 +56840,7 @@ function createNewRecordQuery(schema, objectInfo, objectInfoMap) {
56828
56840
  const { apiName, childRelationships, fields: fieldsRepresentation } = objectInfo;
56829
56841
  typedScalars.add(`${apiName}_Filter`);
56830
56842
  typedScalars.add(`${apiName}_OrderBy`);
56831
- const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfoMap, parentRelationshipFields, 'Missing');
56843
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfo, objectInfoMap, parentRelationshipFields, 'Missing');
56832
56844
  // handles child relationship
56833
56845
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields);
56834
56846
  typedScalars = new Set([...typedScalars, ...spanningConnectionTypedScalars]);
@@ -56891,7 +56903,7 @@ function extendExistingRecordType(schema, type, objectInfo, objectInfoMap) {
56891
56903
  return (existingFields.includes(field.apiName) === false ||
56892
56904
  (field.relationshipName !== null && field.referenceToInfos.length > 0));
56893
56905
  });
56894
- const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56906
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfo, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56895
56907
  const { apiName, childRelationships } = objectInfo;
56896
56908
  // handles child relationship
56897
56909
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields, existingFields);
@@ -56966,12 +56978,12 @@ function makeSpanningRecordConnections(schema, childRelationships, objectInfoMap
56966
56978
  * @param recordTypeInSchema
56967
56979
  * @returns
56968
56980
  */
56969
- function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56981
+ function makeRecordField(fieldRepresentations, objectInfo, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56970
56982
  const polymorphicFieldTypeNames = new Set();
56971
56983
  let fields = ``;
56972
56984
  for (const field of values$1(fieldRepresentations)) {
56973
56985
  if (!fieldsStaticallyAdded.includes(field.apiName) && recordTypeInSchema === 'Missing') {
56974
- fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
56986
+ fields += `${field.apiName}: ${graphqlTypeForField(field, objectInfo)}\n`;
56975
56987
  }
56976
56988
  //handles parent relationship
56977
56989
  if (field.relationshipName === null) {
@@ -57010,49 +57022,90 @@ function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRela
57010
57022
  * @param apiName
57011
57023
  * @returns
57012
57024
  */
57013
- function dataTypeToType(objectInfoDataType, apiName) {
57014
- if (apiName && apiName === 'Id') {
57015
- return `ID!`;
57025
+ function graphqlTypeForField(field, objectInfo) {
57026
+ if (field.apiName === 'Id') {
57027
+ return 'ID!';
57016
57028
  }
57017
- switch (objectInfoDataType) {
57018
- case 'String':
57019
- case 'Phone':
57020
- case 'Email':
57021
- case 'TextArea':
57022
- return 'StringValue';
57023
- case 'Reference':
57024
- return 'IDValue';
57025
- case 'Double':
57026
- return 'DoubleValue';
57029
+ switch (field.dataType) {
57030
+ case 'Base64':
57031
+ return 'Base64Value';
57027
57032
  case 'Boolean':
57028
57033
  return 'BooleanValue';
57034
+ case 'Currency':
57035
+ return 'CurrencyValue';
57029
57036
  case 'Date':
57030
57037
  return 'DateValue';
57031
- case 'Time':
57032
- return 'TimeValue';
57033
57038
  case 'DateTime':
57034
57039
  return 'DateTimeValue';
57035
- case 'Base64':
57036
- return 'Base64Value';
57037
- case 'Currency':
57038
- return 'CurrencyValue';
57039
- case 'Url':
57040
- return 'UrlValue';
57041
- case 'Picklist':
57042
- return 'PicklistValue';
57040
+ case 'Double': {
57041
+ return getLatLongType(field, objectInfo) || 'DoubleValue';
57042
+ }
57043
+ case 'Email':
57044
+ return 'EmailValue';
57045
+ case 'EncryptedString':
57046
+ return 'EncryptedStringValue';
57047
+ case 'Int':
57048
+ return 'IntValue';
57049
+ // NB: JSON field type should never happen, but maybe in setup entities?
57050
+ case 'Json':
57051
+ case 'JSON':
57052
+ return 'JSONValue';
57053
+ case 'Long':
57054
+ return 'LongValue';
57043
57055
  case 'MultiPicklist':
57044
57056
  return 'MultiPicklistValue';
57045
57057
  case 'Percent':
57046
57058
  return 'PercentValue';
57047
- case 'Int':
57048
- return 'IntValue';
57049
- case 'EncryptedString':
57050
- return 'EncryptedStringValue';
57059
+ case 'Phone':
57060
+ return 'PhoneNumberValue';
57061
+ case 'Picklist':
57062
+ return 'PicklistValue';
57063
+ case 'Reference':
57064
+ return 'IDValue';
57065
+ case 'String':
57066
+ return 'StringValue';
57067
+ case 'TextArea':
57068
+ return getTextAreaType(field);
57069
+ case 'Time':
57070
+ return 'TimeValue';
57071
+ case 'Url':
57072
+ return 'UrlValue';
57051
57073
  // ! do the rest of the custom types
57052
57074
  default:
57053
57075
  return 'String';
57054
57076
  }
57055
57077
  }
57078
+ // Match server behavior for Latitude/Longitude fields:
57079
+ function getLatLongType(field, objectInfo) {
57080
+ const compoundFieldName = field.compoundFieldName;
57081
+ if (!compoundFieldName)
57082
+ return;
57083
+ const compoundField = objectInfo.fields[compoundFieldName];
57084
+ if (!compoundField)
57085
+ return;
57086
+ if (compoundField.dataType !== 'Address' && compoundField.dataType !== 'Location') {
57087
+ return;
57088
+ }
57089
+ // NB: the following means custom location fields will map to `DoubleValue` because
57090
+ // the fields will have the suffix `__s`. This is technically incorrect but matches
57091
+ // the server behavior as of the 252 release.
57092
+ if (field.apiName.endsWith('Latitude')) {
57093
+ return 'LatitudeValue';
57094
+ }
57095
+ if (field.apiName.endsWith('Longitude')) {
57096
+ return 'LongitudeValue';
57097
+ }
57098
+ }
57099
+ // Match server behavior for text area types:
57100
+ function getTextAreaType(field) {
57101
+ if (field.extraTypeInfo === 'RichTextArea') {
57102
+ return 'RichTextAreaValue';
57103
+ }
57104
+ else if (field.length > 255) {
57105
+ return 'LongTextAreaValue';
57106
+ }
57107
+ return 'TextAreaValue';
57108
+ }
57056
57109
 
57057
57110
  async function evaluate(config, observers, settings, objectInfos, store, snapshot, cache, draftFunctions) {
57058
57111
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE, observers);
@@ -61887,6 +61940,7 @@ class RecordLoaderGraphQL {
61887
61940
  let rep;
61888
61941
  try {
61889
61942
  rep = await this.callGraphQL(batch, abortController);
61943
+ return this.generateFetchResult(rep, batch);
61890
61944
  }
61891
61945
  catch (e) {
61892
61946
  return {
@@ -61896,12 +61950,15 @@ class RecordLoaderGraphQL {
61896
61950
  missingIds: batch.ids,
61897
61951
  };
61898
61952
  }
61899
- return this.generateFetchResult(rep, batch);
61900
61953
  }
61901
61954
  async batchFetchRecordData(batchs, abortController) {
61902
- let reps;
61903
61955
  try {
61904
- reps = await this.callBatchGraphQL(batchs, abortController);
61956
+ const reps = await this.callBatchGraphQL(batchs, abortController);
61957
+ const recordFetchResults = [];
61958
+ for (let i = 0; i < reps.length; i++) {
61959
+ recordFetchResults.push(this.generateFetchResult(reps[i], batchs[i]));
61960
+ }
61961
+ return recordFetchResults;
61905
61962
  }
61906
61963
  catch (e) {
61907
61964
  const missingIds = batchs
@@ -61916,11 +61973,6 @@ class RecordLoaderGraphQL {
61916
61973
  },
61917
61974
  ];
61918
61975
  }
61919
- const recordFetchResults = [];
61920
- for (let i = 0; i < reps.length; i++) {
61921
- recordFetchResults.push(this.generateFetchResult(reps[i], batchs[i]));
61922
- }
61923
- return recordFetchResults;
61924
61976
  }
61925
61977
  generateFetchResult(repResult, batchInput) {
61926
61978
  const { data, errors } = repResult;
@@ -62122,19 +62174,26 @@ class NimbusPrimingNetworkAdapter {
62122
62174
  priority: 'background',
62123
62175
  observabilityContext: {},
62124
62176
  }, abortController, (response) => {
62125
- const { body } = response;
62126
- if (body) {
62127
- const { results } = JSON.parse(body);
62128
- if (results) {
62129
- const gqlResults = results.map((compositeGqlResult) => compositeGqlResult.result);
62130
- resolve(gqlResults);
62177
+ if (response.status < 200 || response.status > 299) {
62178
+ reject(new Error(response.body || 'Network error'));
62179
+ return;
62180
+ }
62181
+ try {
62182
+ const { body } = response;
62183
+ if (body) {
62184
+ const { results } = JSON.parse(body);
62185
+ if (results) {
62186
+ const gqlResults = results.map((compositeGqlResult) => compositeGqlResult.result);
62187
+ resolve(gqlResults);
62188
+ return;
62189
+ }
62131
62190
  }
62132
62191
  else {
62133
62192
  reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62134
62193
  }
62135
62194
  }
62136
- else {
62137
- reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62195
+ catch (error) {
62196
+ reject(error);
62138
62197
  }
62139
62198
  }, (error) => {
62140
62199
  reject(error);
@@ -62155,12 +62214,21 @@ class NimbusPrimingNetworkAdapter {
62155
62214
  priority: 'background',
62156
62215
  observabilityContext: {},
62157
62216
  }, abortController, (response) => {
62158
- const { body } = response;
62159
- if (body) {
62160
- resolve(JSON.parse(body));
62217
+ if (response.status < 200 || response.status > 299) {
62218
+ reject(new Error(response.body || 'Network error'));
62219
+ return;
62161
62220
  }
62162
- else {
62163
- reject(new Error(`No body returned from ${endPointPath} endpoint`));
62221
+ try {
62222
+ const { body } = response;
62223
+ if (body) {
62224
+ resolve(JSON.parse(body));
62225
+ }
62226
+ else {
62227
+ reject(new Error(`No body returned from ${endPointPath} endpoint`));
62228
+ }
62229
+ }
62230
+ catch (error) {
62231
+ reject(error);
62164
62232
  }
62165
62233
  }, (error) => {
62166
62234
  reject(error);
@@ -62178,12 +62246,21 @@ class NimbusPrimingNetworkAdapter {
62178
62246
  priority: 'background',
62179
62247
  observabilityContext: {},
62180
62248
  }, abortController, (response) => {
62181
- const { body } = response;
62182
- if (body) {
62183
- resolve(JSON.parse(body).objects);
62249
+ if (response.status < 200 || response.status > 299) {
62250
+ reject(new Error(response.body || 'Network error'));
62251
+ return;
62184
62252
  }
62185
- else {
62186
- reject(new Error(`No body returned from ${endPointPath} endpoint`));
62253
+ try {
62254
+ const { body } = response;
62255
+ if (body) {
62256
+ resolve(JSON.parse(body).objects);
62257
+ }
62258
+ else {
62259
+ reject(new Error(`No body returned from ${endPointPath} endpoint`));
62260
+ }
62261
+ }
62262
+ catch (error) {
62263
+ reject(error);
62187
62264
  }
62188
62265
  }, (error) => {
62189
62266
  reject(error);
@@ -62205,19 +62282,28 @@ class NimbusPrimingNetworkAdapter {
62205
62282
  priority: 'background',
62206
62283
  observabilityContext: {},
62207
62284
  }, abortController, (response) => {
62208
- const { body } = response;
62209
- if (body) {
62210
- const results = JSON.parse(body).results;
62211
- results.forEach((result) => {
62212
- // only populate the map if the status code is 200, caller needs to check for missing keys
62213
- if (result.statusCode === 200) {
62214
- map.set(result.result.apiName, result.result);
62215
- }
62216
- });
62217
- resolve(map);
62285
+ if (response.status < 200 || response.status > 299) {
62286
+ reject(new Error(response.body || 'Network error'));
62287
+ return;
62218
62288
  }
62219
- else {
62220
- reject(new Error(`No body returned from ${endPointPath} endpoint`));
62289
+ try {
62290
+ const { body } = response;
62291
+ if (body) {
62292
+ const results = JSON.parse(body).results;
62293
+ results.forEach((result) => {
62294
+ // only populate the map if the status code is 200, caller needs to check for missing keys
62295
+ if (result.statusCode === 200) {
62296
+ map.set(result.result.apiName, result.result);
62297
+ }
62298
+ });
62299
+ resolve(map);
62300
+ }
62301
+ else {
62302
+ reject(new Error(`No body returned from ${endPointPath} endpoint`));
62303
+ }
62304
+ }
62305
+ catch (error) {
62306
+ reject(error);
62221
62307
  }
62222
62308
  }, (error) => {
62223
62309
  reject(error);
@@ -62648,7 +62734,7 @@ register$1({
62648
62734
  id: '@salesforce/lds-network-adapter',
62649
62735
  instrument: instrument$2,
62650
62736
  });
62651
- // version: 1.297.0-1fc775982
62737
+ // version: 1.299.0-83936bf1de
62652
62738
 
62653
62739
  const { create: create$3, keys: keys$3 } = Object;
62654
62740
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82717,7 +82803,7 @@ register$1({
82717
82803
  configuration: { ...configurationForGraphQLAdapters$1 },
82718
82804
  instrument: instrument$1,
82719
82805
  });
82720
- // version: 1.297.0-e0cfbd880
82806
+ // version: 1.299.0-161c48605a
82721
82807
 
82722
82808
  // On core the unstable adapters are re-exported with different names,
82723
82809
  // we want to match them here.
@@ -84973,7 +85059,7 @@ withDefaultLuvio((luvio) => {
84973
85059
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84974
85060
  graphQLImperative = ldsAdapter;
84975
85061
  });
84976
- // version: 1.297.0-e0cfbd880
85062
+ // version: 1.299.0-161c48605a
84977
85063
 
84978
85064
  var gqlApi = /*#__PURE__*/Object.freeze({
84979
85065
  __proto__: null,
@@ -84998,7 +85084,7 @@ function getAdapterMaps() {
84998
85084
  if (lazyDMLAdapterMap === undefined || lazyImperativeAdapterMap === undefined) {
84999
85085
  // We should eventually be explicit about what we expose here instead of exporting everything from the modules,
85000
85086
  // this is our API contract to native callers and should be explicit
85001
- const map = Object.assign({}, gqlApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi);
85087
+ 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);
85002
85088
  const imperativeAdapterNames = keys$3(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
85003
85089
  const imperativeMap = {};
85004
85090
  for (const adapterName of imperativeAdapterNames) {
@@ -85708,7 +85794,7 @@ const callbacks$1 = [];
85708
85794
  function register(r) {
85709
85795
  callbacks$1.forEach((callback) => callback(r));
85710
85796
  }
85711
- // version: 1.297.0-1fc775982
85797
+ // version: 1.299.0-83936bf1de
85712
85798
 
85713
85799
  /**
85714
85800
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90670,4 +90756,4 @@ const { luvio } = getRuntime();
90670
90756
  setDefaultLuvio({ luvio });
90671
90757
 
90672
90758
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
90673
- // version: 1.297.0-1fc775982
90759
+ // version: 1.299.0-83936bf1de
@@ -4210,7 +4210,7 @@
4210
4210
  }
4211
4211
  callbacks.push(callback);
4212
4212
  }
4213
- // version: 1.297.0-1fc775982
4213
+ // version: 1.299.0-83936bf1de
4214
4214
 
4215
4215
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4216
4216
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15718,7 +15718,7 @@
15718
15718
  }
15719
15719
  return superResult;
15720
15720
  }
15721
- // version: 1.297.0-1fc775982
15721
+ // version: 1.299.0-83936bf1de
15722
15722
 
15723
15723
  function unwrap(data) {
15724
15724
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16647,7 +16647,7 @@
16647
16647
  const { apiFamily, name } = metadata;
16648
16648
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16649
16649
  }
16650
- // version: 1.297.0-1fc775982
16650
+ // version: 1.299.0-83936bf1de
16651
16651
 
16652
16652
  /**
16653
16653
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -43204,11 +43204,23 @@
43204
43204
  return config;
43205
43205
  }
43206
43206
 
43207
+ const ISO8601_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z$/;
43207
43208
  function getHeaders(clientOptions) {
43208
43209
  const headers = {};
43209
43210
  if (untrustedIsObject$2(clientOptions)) {
43210
43211
  if (typeof clientOptions.ifUnmodifiedSince === 'string') {
43211
43212
  headers.ifUnmodifiedSince = clientOptions.ifUnmodifiedSince;
43213
+ // HTTP standard format date is expected by UI-API
43214
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since
43215
+ // A component built for Connect API must use If-Unmodified-Since
43216
+ // dates formatted as ISO 8601, which does not match the HTTP spec.
43217
+ // For compatibility, convert the date to match the standard.
43218
+ if (headers.ifUnmodifiedSince.match(ISO8601_DATE_REGEX)) {
43219
+ const utcString = new Date(headers.ifUnmodifiedSince).toUTCString();
43220
+ if (utcString !== 'Invalid Date') {
43221
+ headers.ifUnmodifiedSince = utcString;
43222
+ }
43223
+ }
43212
43224
  }
43213
43225
  }
43214
43226
  return headers;
@@ -44244,7 +44256,7 @@
44244
44256
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44245
44257
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44246
44258
  });
44247
- // version: 1.297.0-e0cfbd880
44259
+ // version: 1.299.0-161c48605a
44248
44260
 
44249
44261
  var ldsIdempotencyWriteDisabled = {
44250
44262
  isOpen: function (e) {
@@ -56834,7 +56846,7 @@
56834
56846
  const { apiName, childRelationships, fields: fieldsRepresentation } = objectInfo;
56835
56847
  typedScalars.add(`${apiName}_Filter`);
56836
56848
  typedScalars.add(`${apiName}_OrderBy`);
56837
- const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfoMap, parentRelationshipFields, 'Missing');
56849
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfo, objectInfoMap, parentRelationshipFields, 'Missing');
56838
56850
  // handles child relationship
56839
56851
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields);
56840
56852
  typedScalars = new Set([...typedScalars, ...spanningConnectionTypedScalars]);
@@ -56897,7 +56909,7 @@
56897
56909
  return (existingFields.includes(field.apiName) === false ||
56898
56910
  (field.relationshipName !== null && field.referenceToInfos.length > 0));
56899
56911
  });
56900
- const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56912
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfo, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56901
56913
  const { apiName, childRelationships } = objectInfo;
56902
56914
  // handles child relationship
56903
56915
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields, existingFields);
@@ -56972,12 +56984,12 @@
56972
56984
  * @param recordTypeInSchema
56973
56985
  * @returns
56974
56986
  */
56975
- function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56987
+ function makeRecordField(fieldRepresentations, objectInfo, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56976
56988
  const polymorphicFieldTypeNames = new Set();
56977
56989
  let fields = ``;
56978
56990
  for (const field of values$1(fieldRepresentations)) {
56979
56991
  if (!fieldsStaticallyAdded.includes(field.apiName) && recordTypeInSchema === 'Missing') {
56980
- fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
56992
+ fields += `${field.apiName}: ${graphqlTypeForField(field, objectInfo)}\n`;
56981
56993
  }
56982
56994
  //handles parent relationship
56983
56995
  if (field.relationshipName === null) {
@@ -57016,49 +57028,90 @@
57016
57028
  * @param apiName
57017
57029
  * @returns
57018
57030
  */
57019
- function dataTypeToType(objectInfoDataType, apiName) {
57020
- if (apiName && apiName === 'Id') {
57021
- return `ID!`;
57031
+ function graphqlTypeForField(field, objectInfo) {
57032
+ if (field.apiName === 'Id') {
57033
+ return 'ID!';
57022
57034
  }
57023
- switch (objectInfoDataType) {
57024
- case 'String':
57025
- case 'Phone':
57026
- case 'Email':
57027
- case 'TextArea':
57028
- return 'StringValue';
57029
- case 'Reference':
57030
- return 'IDValue';
57031
- case 'Double':
57032
- return 'DoubleValue';
57035
+ switch (field.dataType) {
57036
+ case 'Base64':
57037
+ return 'Base64Value';
57033
57038
  case 'Boolean':
57034
57039
  return 'BooleanValue';
57040
+ case 'Currency':
57041
+ return 'CurrencyValue';
57035
57042
  case 'Date':
57036
57043
  return 'DateValue';
57037
- case 'Time':
57038
- return 'TimeValue';
57039
57044
  case 'DateTime':
57040
57045
  return 'DateTimeValue';
57041
- case 'Base64':
57042
- return 'Base64Value';
57043
- case 'Currency':
57044
- return 'CurrencyValue';
57045
- case 'Url':
57046
- return 'UrlValue';
57047
- case 'Picklist':
57048
- return 'PicklistValue';
57046
+ case 'Double': {
57047
+ return getLatLongType(field, objectInfo) || 'DoubleValue';
57048
+ }
57049
+ case 'Email':
57050
+ return 'EmailValue';
57051
+ case 'EncryptedString':
57052
+ return 'EncryptedStringValue';
57053
+ case 'Int':
57054
+ return 'IntValue';
57055
+ // NB: JSON field type should never happen, but maybe in setup entities?
57056
+ case 'Json':
57057
+ case 'JSON':
57058
+ return 'JSONValue';
57059
+ case 'Long':
57060
+ return 'LongValue';
57049
57061
  case 'MultiPicklist':
57050
57062
  return 'MultiPicklistValue';
57051
57063
  case 'Percent':
57052
57064
  return 'PercentValue';
57053
- case 'Int':
57054
- return 'IntValue';
57055
- case 'EncryptedString':
57056
- return 'EncryptedStringValue';
57065
+ case 'Phone':
57066
+ return 'PhoneNumberValue';
57067
+ case 'Picklist':
57068
+ return 'PicklistValue';
57069
+ case 'Reference':
57070
+ return 'IDValue';
57071
+ case 'String':
57072
+ return 'StringValue';
57073
+ case 'TextArea':
57074
+ return getTextAreaType(field);
57075
+ case 'Time':
57076
+ return 'TimeValue';
57077
+ case 'Url':
57078
+ return 'UrlValue';
57057
57079
  // ! do the rest of the custom types
57058
57080
  default:
57059
57081
  return 'String';
57060
57082
  }
57061
57083
  }
57084
+ // Match server behavior for Latitude/Longitude fields:
57085
+ function getLatLongType(field, objectInfo) {
57086
+ const compoundFieldName = field.compoundFieldName;
57087
+ if (!compoundFieldName)
57088
+ return;
57089
+ const compoundField = objectInfo.fields[compoundFieldName];
57090
+ if (!compoundField)
57091
+ return;
57092
+ if (compoundField.dataType !== 'Address' && compoundField.dataType !== 'Location') {
57093
+ return;
57094
+ }
57095
+ // NB: the following means custom location fields will map to `DoubleValue` because
57096
+ // the fields will have the suffix `__s`. This is technically incorrect but matches
57097
+ // the server behavior as of the 252 release.
57098
+ if (field.apiName.endsWith('Latitude')) {
57099
+ return 'LatitudeValue';
57100
+ }
57101
+ if (field.apiName.endsWith('Longitude')) {
57102
+ return 'LongitudeValue';
57103
+ }
57104
+ }
57105
+ // Match server behavior for text area types:
57106
+ function getTextAreaType(field) {
57107
+ if (field.extraTypeInfo === 'RichTextArea') {
57108
+ return 'RichTextAreaValue';
57109
+ }
57110
+ else if (field.length > 255) {
57111
+ return 'LongTextAreaValue';
57112
+ }
57113
+ return 'TextAreaValue';
57114
+ }
57062
57115
 
57063
57116
  async function evaluate(config, observers, settings, objectInfos, store, snapshot, cache, draftFunctions) {
57064
57117
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE, observers);
@@ -61893,6 +61946,7 @@
61893
61946
  let rep;
61894
61947
  try {
61895
61948
  rep = await this.callGraphQL(batch, abortController);
61949
+ return this.generateFetchResult(rep, batch);
61896
61950
  }
61897
61951
  catch (e) {
61898
61952
  return {
@@ -61902,12 +61956,15 @@
61902
61956
  missingIds: batch.ids,
61903
61957
  };
61904
61958
  }
61905
- return this.generateFetchResult(rep, batch);
61906
61959
  }
61907
61960
  async batchFetchRecordData(batchs, abortController) {
61908
- let reps;
61909
61961
  try {
61910
- reps = await this.callBatchGraphQL(batchs, abortController);
61962
+ const reps = await this.callBatchGraphQL(batchs, abortController);
61963
+ const recordFetchResults = [];
61964
+ for (let i = 0; i < reps.length; i++) {
61965
+ recordFetchResults.push(this.generateFetchResult(reps[i], batchs[i]));
61966
+ }
61967
+ return recordFetchResults;
61911
61968
  }
61912
61969
  catch (e) {
61913
61970
  const missingIds = batchs
@@ -61922,11 +61979,6 @@
61922
61979
  },
61923
61980
  ];
61924
61981
  }
61925
- const recordFetchResults = [];
61926
- for (let i = 0; i < reps.length; i++) {
61927
- recordFetchResults.push(this.generateFetchResult(reps[i], batchs[i]));
61928
- }
61929
- return recordFetchResults;
61930
61982
  }
61931
61983
  generateFetchResult(repResult, batchInput) {
61932
61984
  const { data, errors } = repResult;
@@ -62128,19 +62180,26 @@
62128
62180
  priority: 'background',
62129
62181
  observabilityContext: {},
62130
62182
  }, abortController, (response) => {
62131
- const { body } = response;
62132
- if (body) {
62133
- const { results } = JSON.parse(body);
62134
- if (results) {
62135
- const gqlResults = results.map((compositeGqlResult) => compositeGqlResult.result);
62136
- resolve(gqlResults);
62183
+ if (response.status < 200 || response.status > 299) {
62184
+ reject(new Error(response.body || 'Network error'));
62185
+ return;
62186
+ }
62187
+ try {
62188
+ const { body } = response;
62189
+ if (body) {
62190
+ const { results } = JSON.parse(body);
62191
+ if (results) {
62192
+ const gqlResults = results.map((compositeGqlResult) => compositeGqlResult.result);
62193
+ resolve(gqlResults);
62194
+ return;
62195
+ }
62137
62196
  }
62138
62197
  else {
62139
62198
  reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62140
62199
  }
62141
62200
  }
62142
- else {
62143
- reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62201
+ catch (error) {
62202
+ reject(error);
62144
62203
  }
62145
62204
  }, (error) => {
62146
62205
  reject(error);
@@ -62161,12 +62220,21 @@
62161
62220
  priority: 'background',
62162
62221
  observabilityContext: {},
62163
62222
  }, abortController, (response) => {
62164
- const { body } = response;
62165
- if (body) {
62166
- resolve(JSON.parse(body));
62223
+ if (response.status < 200 || response.status > 299) {
62224
+ reject(new Error(response.body || 'Network error'));
62225
+ return;
62167
62226
  }
62168
- else {
62169
- reject(new Error(`No body returned from ${endPointPath} endpoint`));
62227
+ try {
62228
+ const { body } = response;
62229
+ if (body) {
62230
+ resolve(JSON.parse(body));
62231
+ }
62232
+ else {
62233
+ reject(new Error(`No body returned from ${endPointPath} endpoint`));
62234
+ }
62235
+ }
62236
+ catch (error) {
62237
+ reject(error);
62170
62238
  }
62171
62239
  }, (error) => {
62172
62240
  reject(error);
@@ -62184,12 +62252,21 @@
62184
62252
  priority: 'background',
62185
62253
  observabilityContext: {},
62186
62254
  }, abortController, (response) => {
62187
- const { body } = response;
62188
- if (body) {
62189
- resolve(JSON.parse(body).objects);
62255
+ if (response.status < 200 || response.status > 299) {
62256
+ reject(new Error(response.body || 'Network error'));
62257
+ return;
62190
62258
  }
62191
- else {
62192
- reject(new Error(`No body returned from ${endPointPath} endpoint`));
62259
+ try {
62260
+ const { body } = response;
62261
+ if (body) {
62262
+ resolve(JSON.parse(body).objects);
62263
+ }
62264
+ else {
62265
+ reject(new Error(`No body returned from ${endPointPath} endpoint`));
62266
+ }
62267
+ }
62268
+ catch (error) {
62269
+ reject(error);
62193
62270
  }
62194
62271
  }, (error) => {
62195
62272
  reject(error);
@@ -62211,19 +62288,28 @@
62211
62288
  priority: 'background',
62212
62289
  observabilityContext: {},
62213
62290
  }, abortController, (response) => {
62214
- const { body } = response;
62215
- if (body) {
62216
- const results = JSON.parse(body).results;
62217
- results.forEach((result) => {
62218
- // only populate the map if the status code is 200, caller needs to check for missing keys
62219
- if (result.statusCode === 200) {
62220
- map.set(result.result.apiName, result.result);
62221
- }
62222
- });
62223
- resolve(map);
62291
+ if (response.status < 200 || response.status > 299) {
62292
+ reject(new Error(response.body || 'Network error'));
62293
+ return;
62224
62294
  }
62225
- else {
62226
- reject(new Error(`No body returned from ${endPointPath} endpoint`));
62295
+ try {
62296
+ const { body } = response;
62297
+ if (body) {
62298
+ const results = JSON.parse(body).results;
62299
+ results.forEach((result) => {
62300
+ // only populate the map if the status code is 200, caller needs to check for missing keys
62301
+ if (result.statusCode === 200) {
62302
+ map.set(result.result.apiName, result.result);
62303
+ }
62304
+ });
62305
+ resolve(map);
62306
+ }
62307
+ else {
62308
+ reject(new Error(`No body returned from ${endPointPath} endpoint`));
62309
+ }
62310
+ }
62311
+ catch (error) {
62312
+ reject(error);
62227
62313
  }
62228
62314
  }, (error) => {
62229
62315
  reject(error);
@@ -62654,7 +62740,7 @@
62654
62740
  id: '@salesforce/lds-network-adapter',
62655
62741
  instrument: instrument$2,
62656
62742
  });
62657
- // version: 1.297.0-1fc775982
62743
+ // version: 1.299.0-83936bf1de
62658
62744
 
62659
62745
  const { create: create$3, keys: keys$3 } = Object;
62660
62746
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82723,7 +82809,7 @@
82723
82809
  configuration: { ...configurationForGraphQLAdapters$1 },
82724
82810
  instrument: instrument$1,
82725
82811
  });
82726
- // version: 1.297.0-e0cfbd880
82812
+ // version: 1.299.0-161c48605a
82727
82813
 
82728
82814
  // On core the unstable adapters are re-exported with different names,
82729
82815
  // we want to match them here.
@@ -84979,7 +85065,7 @@
84979
85065
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84980
85066
  graphQLImperative = ldsAdapter;
84981
85067
  });
84982
- // version: 1.297.0-e0cfbd880
85068
+ // version: 1.299.0-161c48605a
84983
85069
 
84984
85070
  var gqlApi = /*#__PURE__*/Object.freeze({
84985
85071
  __proto__: null,
@@ -85004,7 +85090,7 @@
85004
85090
  if (lazyDMLAdapterMap === undefined || lazyImperativeAdapterMap === undefined) {
85005
85091
  // We should eventually be explicit about what we expose here instead of exporting everything from the modules,
85006
85092
  // this is our API contract to native callers and should be explicit
85007
- const map = Object.assign({}, gqlApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi, unstableLightningRelatedListApi);
85093
+ 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);
85008
85094
  const imperativeAdapterNames = keys$3(map).filter((name) => name.endsWith(IMPERATIVE_ADAPTER_SUFFIX));
85009
85095
  const imperativeMap = {};
85010
85096
  for (const adapterName of imperativeAdapterNames) {
@@ -85714,7 +85800,7 @@
85714
85800
  function register(r) {
85715
85801
  callbacks$1.forEach((callback) => callback(r));
85716
85802
  }
85717
- // version: 1.297.0-1fc775982
85803
+ // version: 1.299.0-83936bf1de
85718
85804
 
85719
85805
  /**
85720
85806
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90695,4 +90781,4 @@
90695
90781
  exports.subscribeToAdapter = subscribeToAdapter;
90696
90782
 
90697
90783
  }));
90698
- // version: 1.297.0-1fc775982
90784
+ // version: 1.299.0-83936bf1de
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.297.0",
3
+ "version": "1.299.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,15 +35,15 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.297.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.297.0",
40
- "@salesforce/lds-default-luvio": "^1.297.0",
41
- "@salesforce/lds-drafts": "^1.297.0",
42
- "@salesforce/lds-graphql-parser": "^1.297.0",
43
- "@salesforce/lds-luvio-engine": "^1.297.0",
44
- "@salesforce/lds-priming": "^1.297.0",
45
- "@salesforce/lds-runtime-mobile": "^1.297.0",
46
- "@salesforce/nimbus-plugin-lds": "^1.297.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.299.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.299.0",
40
+ "@salesforce/lds-default-luvio": "^1.299.0",
41
+ "@salesforce/lds-drafts": "^1.299.0",
42
+ "@salesforce/lds-graphql-parser": "^1.299.0",
43
+ "@salesforce/lds-luvio-engine": "^1.299.0",
44
+ "@salesforce/lds-priming": "^1.299.0",
45
+ "@salesforce/lds-runtime-mobile": "^1.299.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.299.0",
47
47
  "ajv": "^8.11.0",
48
48
  "glob": "^7.1.5",
49
49
  "nimbus-types": "^2.0.0-alpha1",