@salesforce/lds-worker-api 1.298.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.
@@ -1071,4 +1071,4 @@ if (process.env.NODE_ENV !== 'production') {
1071
1071
  }
1072
1072
 
1073
1073
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1074
- // version: 1.298.0-3a2eedddc
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.298.0-3a2eedddc
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.298.0-3a2eedddc
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.298.0-3a2eedddc
16644
+ // version: 1.299.0-83936bf1de
16645
16645
 
16646
16646
  /**
16647
16647
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44250,7 +44250,7 @@ withDefaultLuvio((luvio) => {
44250
44250
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44251
44251
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44252
44252
  });
44253
- // version: 1.298.0-6f15dc1ec
44253
+ // version: 1.299.0-161c48605a
44254
44254
 
44255
44255
  var ldsIdempotencyWriteDisabled = {
44256
44256
  isOpen: function (e) {
@@ -56840,7 +56840,7 @@ function createNewRecordQuery(schema, objectInfo, objectInfoMap) {
56840
56840
  const { apiName, childRelationships, fields: fieldsRepresentation } = objectInfo;
56841
56841
  typedScalars.add(`${apiName}_Filter`);
56842
56842
  typedScalars.add(`${apiName}_OrderBy`);
56843
- const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfoMap, parentRelationshipFields, 'Missing');
56843
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfo, objectInfoMap, parentRelationshipFields, 'Missing');
56844
56844
  // handles child relationship
56845
56845
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields);
56846
56846
  typedScalars = new Set([...typedScalars, ...spanningConnectionTypedScalars]);
@@ -56903,7 +56903,7 @@ function extendExistingRecordType(schema, type, objectInfo, objectInfoMap) {
56903
56903
  return (existingFields.includes(field.apiName) === false ||
56904
56904
  (field.relationshipName !== null && field.referenceToInfos.length > 0));
56905
56905
  });
56906
- const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56906
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfo, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56907
56907
  const { apiName, childRelationships } = objectInfo;
56908
56908
  // handles child relationship
56909
56909
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields, existingFields);
@@ -56978,12 +56978,12 @@ function makeSpanningRecordConnections(schema, childRelationships, objectInfoMap
56978
56978
  * @param recordTypeInSchema
56979
56979
  * @returns
56980
56980
  */
56981
- function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56981
+ function makeRecordField(fieldRepresentations, objectInfo, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56982
56982
  const polymorphicFieldTypeNames = new Set();
56983
56983
  let fields = ``;
56984
56984
  for (const field of values$1(fieldRepresentations)) {
56985
56985
  if (!fieldsStaticallyAdded.includes(field.apiName) && recordTypeInSchema === 'Missing') {
56986
- fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
56986
+ fields += `${field.apiName}: ${graphqlTypeForField(field, objectInfo)}\n`;
56987
56987
  }
56988
56988
  //handles parent relationship
56989
56989
  if (field.relationshipName === null) {
@@ -57022,49 +57022,90 @@ function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRela
57022
57022
  * @param apiName
57023
57023
  * @returns
57024
57024
  */
57025
- function dataTypeToType(objectInfoDataType, apiName) {
57026
- if (apiName && apiName === 'Id') {
57027
- return `ID!`;
57025
+ function graphqlTypeForField(field, objectInfo) {
57026
+ if (field.apiName === 'Id') {
57027
+ return 'ID!';
57028
57028
  }
57029
- switch (objectInfoDataType) {
57030
- case 'String':
57031
- case 'Phone':
57032
- case 'Email':
57033
- case 'TextArea':
57034
- return 'StringValue';
57035
- case 'Reference':
57036
- return 'IDValue';
57037
- case 'Double':
57038
- return 'DoubleValue';
57029
+ switch (field.dataType) {
57030
+ case 'Base64':
57031
+ return 'Base64Value';
57039
57032
  case 'Boolean':
57040
57033
  return 'BooleanValue';
57034
+ case 'Currency':
57035
+ return 'CurrencyValue';
57041
57036
  case 'Date':
57042
57037
  return 'DateValue';
57043
- case 'Time':
57044
- return 'TimeValue';
57045
57038
  case 'DateTime':
57046
57039
  return 'DateTimeValue';
57047
- case 'Base64':
57048
- return 'Base64Value';
57049
- case 'Currency':
57050
- return 'CurrencyValue';
57051
- case 'Url':
57052
- return 'UrlValue';
57053
- case 'Picklist':
57054
- 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';
57055
57055
  case 'MultiPicklist':
57056
57056
  return 'MultiPicklistValue';
57057
57057
  case 'Percent':
57058
57058
  return 'PercentValue';
57059
- case 'Int':
57060
- return 'IntValue';
57061
- case 'EncryptedString':
57062
- 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';
57063
57073
  // ! do the rest of the custom types
57064
57074
  default:
57065
57075
  return 'String';
57066
57076
  }
57067
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
+ }
57068
57109
 
57069
57110
  async function evaluate(config, observers, settings, objectInfos, store, snapshot, cache, draftFunctions) {
57070
57111
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE, observers);
@@ -61899,6 +61940,7 @@ class RecordLoaderGraphQL {
61899
61940
  let rep;
61900
61941
  try {
61901
61942
  rep = await this.callGraphQL(batch, abortController);
61943
+ return this.generateFetchResult(rep, batch);
61902
61944
  }
61903
61945
  catch (e) {
61904
61946
  return {
@@ -61908,12 +61950,15 @@ class RecordLoaderGraphQL {
61908
61950
  missingIds: batch.ids,
61909
61951
  };
61910
61952
  }
61911
- return this.generateFetchResult(rep, batch);
61912
61953
  }
61913
61954
  async batchFetchRecordData(batchs, abortController) {
61914
- let reps;
61915
61955
  try {
61916
- 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;
61917
61962
  }
61918
61963
  catch (e) {
61919
61964
  const missingIds = batchs
@@ -61928,11 +61973,6 @@ class RecordLoaderGraphQL {
61928
61973
  },
61929
61974
  ];
61930
61975
  }
61931
- const recordFetchResults = [];
61932
- for (let i = 0; i < reps.length; i++) {
61933
- recordFetchResults.push(this.generateFetchResult(reps[i], batchs[i]));
61934
- }
61935
- return recordFetchResults;
61936
61976
  }
61937
61977
  generateFetchResult(repResult, batchInput) {
61938
61978
  const { data, errors } = repResult;
@@ -62134,19 +62174,26 @@ class NimbusPrimingNetworkAdapter {
62134
62174
  priority: 'background',
62135
62175
  observabilityContext: {},
62136
62176
  }, abortController, (response) => {
62137
- const { body } = response;
62138
- if (body) {
62139
- const { results } = JSON.parse(body);
62140
- if (results) {
62141
- const gqlResults = results.map((compositeGqlResult) => compositeGqlResult.result);
62142
- 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
+ }
62143
62190
  }
62144
62191
  else {
62145
62192
  reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62146
62193
  }
62147
62194
  }
62148
- else {
62149
- reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62195
+ catch (error) {
62196
+ reject(error);
62150
62197
  }
62151
62198
  }, (error) => {
62152
62199
  reject(error);
@@ -62167,12 +62214,21 @@ class NimbusPrimingNetworkAdapter {
62167
62214
  priority: 'background',
62168
62215
  observabilityContext: {},
62169
62216
  }, abortController, (response) => {
62170
- const { body } = response;
62171
- if (body) {
62172
- resolve(JSON.parse(body));
62217
+ if (response.status < 200 || response.status > 299) {
62218
+ reject(new Error(response.body || 'Network error'));
62219
+ return;
62173
62220
  }
62174
- else {
62175
- 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);
62176
62232
  }
62177
62233
  }, (error) => {
62178
62234
  reject(error);
@@ -62190,12 +62246,21 @@ class NimbusPrimingNetworkAdapter {
62190
62246
  priority: 'background',
62191
62247
  observabilityContext: {},
62192
62248
  }, abortController, (response) => {
62193
- const { body } = response;
62194
- if (body) {
62195
- resolve(JSON.parse(body).objects);
62249
+ if (response.status < 200 || response.status > 299) {
62250
+ reject(new Error(response.body || 'Network error'));
62251
+ return;
62196
62252
  }
62197
- else {
62198
- 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);
62199
62264
  }
62200
62265
  }, (error) => {
62201
62266
  reject(error);
@@ -62217,19 +62282,28 @@ class NimbusPrimingNetworkAdapter {
62217
62282
  priority: 'background',
62218
62283
  observabilityContext: {},
62219
62284
  }, abortController, (response) => {
62220
- const { body } = response;
62221
- if (body) {
62222
- const results = JSON.parse(body).results;
62223
- results.forEach((result) => {
62224
- // only populate the map if the status code is 200, caller needs to check for missing keys
62225
- if (result.statusCode === 200) {
62226
- map.set(result.result.apiName, result.result);
62227
- }
62228
- });
62229
- resolve(map);
62285
+ if (response.status < 200 || response.status > 299) {
62286
+ reject(new Error(response.body || 'Network error'));
62287
+ return;
62230
62288
  }
62231
- else {
62232
- 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);
62233
62307
  }
62234
62308
  }, (error) => {
62235
62309
  reject(error);
@@ -62660,7 +62734,7 @@ register$1({
62660
62734
  id: '@salesforce/lds-network-adapter',
62661
62735
  instrument: instrument$2,
62662
62736
  });
62663
- // version: 1.298.0-3a2eedddc
62737
+ // version: 1.299.0-83936bf1de
62664
62738
 
62665
62739
  const { create: create$3, keys: keys$3 } = Object;
62666
62740
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82729,7 +82803,7 @@ register$1({
82729
82803
  configuration: { ...configurationForGraphQLAdapters$1 },
82730
82804
  instrument: instrument$1,
82731
82805
  });
82732
- // version: 1.298.0-6f15dc1ec
82806
+ // version: 1.299.0-161c48605a
82733
82807
 
82734
82808
  // On core the unstable adapters are re-exported with different names,
82735
82809
  // we want to match them here.
@@ -84985,7 +85059,7 @@ withDefaultLuvio((luvio) => {
84985
85059
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84986
85060
  graphQLImperative = ldsAdapter;
84987
85061
  });
84988
- // version: 1.298.0-6f15dc1ec
85062
+ // version: 1.299.0-161c48605a
84989
85063
 
84990
85064
  var gqlApi = /*#__PURE__*/Object.freeze({
84991
85065
  __proto__: null,
@@ -85720,7 +85794,7 @@ const callbacks$1 = [];
85720
85794
  function register(r) {
85721
85795
  callbacks$1.forEach((callback) => callback(r));
85722
85796
  }
85723
- // version: 1.298.0-3a2eedddc
85797
+ // version: 1.299.0-83936bf1de
85724
85798
 
85725
85799
  /**
85726
85800
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90682,4 +90756,4 @@ const { luvio } = getRuntime();
90682
90756
  setDefaultLuvio({ luvio });
90683
90757
 
90684
90758
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
90685
- // version: 1.298.0-3a2eedddc
90759
+ // version: 1.299.0-83936bf1de
@@ -4210,7 +4210,7 @@
4210
4210
  }
4211
4211
  callbacks.push(callback);
4212
4212
  }
4213
- // version: 1.298.0-3a2eedddc
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.298.0-3a2eedddc
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.298.0-3a2eedddc
16650
+ // version: 1.299.0-83936bf1de
16651
16651
 
16652
16652
  /**
16653
16653
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44256,7 +44256,7 @@
44256
44256
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44257
44257
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44258
44258
  });
44259
- // version: 1.298.0-6f15dc1ec
44259
+ // version: 1.299.0-161c48605a
44260
44260
 
44261
44261
  var ldsIdempotencyWriteDisabled = {
44262
44262
  isOpen: function (e) {
@@ -56846,7 +56846,7 @@
56846
56846
  const { apiName, childRelationships, fields: fieldsRepresentation } = objectInfo;
56847
56847
  typedScalars.add(`${apiName}_Filter`);
56848
56848
  typedScalars.add(`${apiName}_OrderBy`);
56849
- const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfoMap, parentRelationshipFields, 'Missing');
56849
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(values$1(fieldsRepresentation), objectInfo, objectInfoMap, parentRelationshipFields, 'Missing');
56850
56850
  // handles child relationship
56851
56851
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields);
56852
56852
  typedScalars = new Set([...typedScalars, ...spanningConnectionTypedScalars]);
@@ -56909,7 +56909,7 @@
56909
56909
  return (existingFields.includes(field.apiName) === false ||
56910
56910
  (field.relationshipName !== null && field.referenceToInfos.length > 0));
56911
56911
  });
56912
- const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56912
+ const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfo, objectInfoMap, parentRelationshipFields, 'Cached', existingFields);
56913
56913
  const { apiName, childRelationships } = objectInfo;
56914
56914
  // handles child relationship
56915
56915
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields, existingFields);
@@ -56984,12 +56984,12 @@
56984
56984
  * @param recordTypeInSchema
56985
56985
  * @returns
56986
56986
  */
56987
- function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56987
+ function makeRecordField(fieldRepresentations, objectInfo, objectInfoMap, existingParentRelationships, recordTypeInSchema, existingFields = []) {
56988
56988
  const polymorphicFieldTypeNames = new Set();
56989
56989
  let fields = ``;
56990
56990
  for (const field of values$1(fieldRepresentations)) {
56991
56991
  if (!fieldsStaticallyAdded.includes(field.apiName) && recordTypeInSchema === 'Missing') {
56992
- fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
56992
+ fields += `${field.apiName}: ${graphqlTypeForField(field, objectInfo)}\n`;
56993
56993
  }
56994
56994
  //handles parent relationship
56995
56995
  if (field.relationshipName === null) {
@@ -57028,49 +57028,90 @@
57028
57028
  * @param apiName
57029
57029
  * @returns
57030
57030
  */
57031
- function dataTypeToType(objectInfoDataType, apiName) {
57032
- if (apiName && apiName === 'Id') {
57033
- return `ID!`;
57031
+ function graphqlTypeForField(field, objectInfo) {
57032
+ if (field.apiName === 'Id') {
57033
+ return 'ID!';
57034
57034
  }
57035
- switch (objectInfoDataType) {
57036
- case 'String':
57037
- case 'Phone':
57038
- case 'Email':
57039
- case 'TextArea':
57040
- return 'StringValue';
57041
- case 'Reference':
57042
- return 'IDValue';
57043
- case 'Double':
57044
- return 'DoubleValue';
57035
+ switch (field.dataType) {
57036
+ case 'Base64':
57037
+ return 'Base64Value';
57045
57038
  case 'Boolean':
57046
57039
  return 'BooleanValue';
57040
+ case 'Currency':
57041
+ return 'CurrencyValue';
57047
57042
  case 'Date':
57048
57043
  return 'DateValue';
57049
- case 'Time':
57050
- return 'TimeValue';
57051
57044
  case 'DateTime':
57052
57045
  return 'DateTimeValue';
57053
- case 'Base64':
57054
- return 'Base64Value';
57055
- case 'Currency':
57056
- return 'CurrencyValue';
57057
- case 'Url':
57058
- return 'UrlValue';
57059
- case 'Picklist':
57060
- 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';
57061
57061
  case 'MultiPicklist':
57062
57062
  return 'MultiPicklistValue';
57063
57063
  case 'Percent':
57064
57064
  return 'PercentValue';
57065
- case 'Int':
57066
- return 'IntValue';
57067
- case 'EncryptedString':
57068
- 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';
57069
57079
  // ! do the rest of the custom types
57070
57080
  default:
57071
57081
  return 'String';
57072
57082
  }
57073
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
+ }
57074
57115
 
57075
57116
  async function evaluate(config, observers, settings, objectInfos, store, snapshot, cache, draftFunctions) {
57076
57117
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE, observers);
@@ -61905,6 +61946,7 @@
61905
61946
  let rep;
61906
61947
  try {
61907
61948
  rep = await this.callGraphQL(batch, abortController);
61949
+ return this.generateFetchResult(rep, batch);
61908
61950
  }
61909
61951
  catch (e) {
61910
61952
  return {
@@ -61914,12 +61956,15 @@
61914
61956
  missingIds: batch.ids,
61915
61957
  };
61916
61958
  }
61917
- return this.generateFetchResult(rep, batch);
61918
61959
  }
61919
61960
  async batchFetchRecordData(batchs, abortController) {
61920
- let reps;
61921
61961
  try {
61922
- 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;
61923
61968
  }
61924
61969
  catch (e) {
61925
61970
  const missingIds = batchs
@@ -61934,11 +61979,6 @@
61934
61979
  },
61935
61980
  ];
61936
61981
  }
61937
- const recordFetchResults = [];
61938
- for (let i = 0; i < reps.length; i++) {
61939
- recordFetchResults.push(this.generateFetchResult(reps[i], batchs[i]));
61940
- }
61941
- return recordFetchResults;
61942
61982
  }
61943
61983
  generateFetchResult(repResult, batchInput) {
61944
61984
  const { data, errors } = repResult;
@@ -62140,19 +62180,26 @@
62140
62180
  priority: 'background',
62141
62181
  observabilityContext: {},
62142
62182
  }, abortController, (response) => {
62143
- const { body } = response;
62144
- if (body) {
62145
- const { results } = JSON.parse(body);
62146
- if (results) {
62147
- const gqlResults = results.map((compositeGqlResult) => compositeGqlResult.result);
62148
- 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
+ }
62149
62196
  }
62150
62197
  else {
62151
62198
  reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62152
62199
  }
62153
62200
  }
62154
- else {
62155
- reject(new Error(`No body returned from ${batchEndPointPath} endpoint`));
62201
+ catch (error) {
62202
+ reject(error);
62156
62203
  }
62157
62204
  }, (error) => {
62158
62205
  reject(error);
@@ -62173,12 +62220,21 @@
62173
62220
  priority: 'background',
62174
62221
  observabilityContext: {},
62175
62222
  }, abortController, (response) => {
62176
- const { body } = response;
62177
- if (body) {
62178
- resolve(JSON.parse(body));
62223
+ if (response.status < 200 || response.status > 299) {
62224
+ reject(new Error(response.body || 'Network error'));
62225
+ return;
62179
62226
  }
62180
- else {
62181
- 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);
62182
62238
  }
62183
62239
  }, (error) => {
62184
62240
  reject(error);
@@ -62196,12 +62252,21 @@
62196
62252
  priority: 'background',
62197
62253
  observabilityContext: {},
62198
62254
  }, abortController, (response) => {
62199
- const { body } = response;
62200
- if (body) {
62201
- resolve(JSON.parse(body).objects);
62255
+ if (response.status < 200 || response.status > 299) {
62256
+ reject(new Error(response.body || 'Network error'));
62257
+ return;
62202
62258
  }
62203
- else {
62204
- 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);
62205
62270
  }
62206
62271
  }, (error) => {
62207
62272
  reject(error);
@@ -62223,19 +62288,28 @@
62223
62288
  priority: 'background',
62224
62289
  observabilityContext: {},
62225
62290
  }, abortController, (response) => {
62226
- const { body } = response;
62227
- if (body) {
62228
- const results = JSON.parse(body).results;
62229
- results.forEach((result) => {
62230
- // only populate the map if the status code is 200, caller needs to check for missing keys
62231
- if (result.statusCode === 200) {
62232
- map.set(result.result.apiName, result.result);
62233
- }
62234
- });
62235
- resolve(map);
62291
+ if (response.status < 200 || response.status > 299) {
62292
+ reject(new Error(response.body || 'Network error'));
62293
+ return;
62236
62294
  }
62237
- else {
62238
- 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);
62239
62313
  }
62240
62314
  }, (error) => {
62241
62315
  reject(error);
@@ -62666,7 +62740,7 @@
62666
62740
  id: '@salesforce/lds-network-adapter',
62667
62741
  instrument: instrument$2,
62668
62742
  });
62669
- // version: 1.298.0-3a2eedddc
62743
+ // version: 1.299.0-83936bf1de
62670
62744
 
62671
62745
  const { create: create$3, keys: keys$3 } = Object;
62672
62746
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82735,7 +82809,7 @@
82735
82809
  configuration: { ...configurationForGraphQLAdapters$1 },
82736
82810
  instrument: instrument$1,
82737
82811
  });
82738
- // version: 1.298.0-6f15dc1ec
82812
+ // version: 1.299.0-161c48605a
82739
82813
 
82740
82814
  // On core the unstable adapters are re-exported with different names,
82741
82815
  // we want to match them here.
@@ -84991,7 +85065,7 @@
84991
85065
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84992
85066
  graphQLImperative = ldsAdapter;
84993
85067
  });
84994
- // version: 1.298.0-6f15dc1ec
85068
+ // version: 1.299.0-161c48605a
84995
85069
 
84996
85070
  var gqlApi = /*#__PURE__*/Object.freeze({
84997
85071
  __proto__: null,
@@ -85726,7 +85800,7 @@
85726
85800
  function register(r) {
85727
85801
  callbacks$1.forEach((callback) => callback(r));
85728
85802
  }
85729
- // version: 1.298.0-3a2eedddc
85803
+ // version: 1.299.0-83936bf1de
85730
85804
 
85731
85805
  /**
85732
85806
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90707,4 +90781,4 @@
90707
90781
  exports.subscribeToAdapter = subscribeToAdapter;
90708
90782
 
90709
90783
  }));
90710
- // version: 1.298.0-3a2eedddc
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.298.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.298.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.298.0",
40
- "@salesforce/lds-default-luvio": "^1.298.0",
41
- "@salesforce/lds-drafts": "^1.298.0",
42
- "@salesforce/lds-graphql-parser": "^1.298.0",
43
- "@salesforce/lds-luvio-engine": "^1.298.0",
44
- "@salesforce/lds-priming": "^1.298.0",
45
- "@salesforce/lds-runtime-mobile": "^1.298.0",
46
- "@salesforce/nimbus-plugin-lds": "^1.298.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",