@salesforce/lds-adapters-uiapi 1.290.0 → 1.291.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.
@@ -1,5 +1,5 @@
1
1
  import type { Luvio, Snapshot } from '@luvio/engine';
2
- import type { RecordRepresentation } from '../../generated/types/RecordRepresentation';
2
+ import { type RecordRepresentation } from '../../generated/types/RecordRepresentation';
3
3
  import type { UpdateRecordConfig } from '../../generated/adapters/updateRecord';
4
4
  export interface ClientOptions {
5
5
  ifUnmodifiedSince?: string;
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import { register } from '@salesforce/lds-default-luvio';
8
- import { serializeStructuredKey, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$1b, createResourceParams as createResourceParams$15, StoreKeyMap, StoreKeySet, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$W, resolveLink, coerceAdapterRequestContext, Wildcard } from '@luvio/engine';
8
+ import { serializeStructuredKey, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$1b, createResourceParams as createResourceParams$15, StoreKeyMap, StoreKeySet, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$W, resolveLink, HttpStatusCode, coerceAdapterRequestContext, Wildcard } from '@luvio/engine';
9
9
  import { print, visit, parse as parse$1 } from '@luvio/graphql-parser';
10
10
  import { getRequestedFieldsForType, buildFieldState, buildQueryTypeStringKey, serializeFieldArguments, createFragmentMap, mergeSelectionSets, deepMerge, getOperationFromDocument } from '@luvio/graphql';
11
11
 
@@ -54626,7 +54626,14 @@ const createRecord_ConfigPropertyMetadata = [
54626
54626
  const createResourceParams$4 = /*#__PURE__*/ createResourceParams$15(createRecord_ConfigPropertyMetadata);
54627
54627
 
54628
54628
  function onResponseSuccess(luvio, response, recordIngest, conflictMap) {
54629
- const { body } = response;
54629
+ const { body, status } = response;
54630
+ if (status === HttpStatusCode.NoContent) {
54631
+ const syntheticSnapshot = {
54632
+ state: 'Fulfilled',
54633
+ data: {},
54634
+ };
54635
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
54636
+ }
54630
54637
  const selections = buildSelectionFromRecord(body);
54631
54638
  const key = keyBuilder$3n(luvio, {
54632
54639
  recordId: body.id,
@@ -54861,11 +54868,23 @@ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
54861
54868
  return config;
54862
54869
  }
54863
54870
 
54871
+ const ISO8601_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z$/;
54864
54872
  function getHeaders(clientOptions) {
54865
54873
  const headers = {};
54866
54874
  if (untrustedIsObject(clientOptions)) {
54867
54875
  if (typeof clientOptions.ifUnmodifiedSince === 'string') {
54868
54876
  headers.ifUnmodifiedSince = clientOptions.ifUnmodifiedSince;
54877
+ // HTTP standard format date is expected by UI-API
54878
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since
54879
+ // A component built for Connect API must use If-Unmodified-Since
54880
+ // dates formatted as ISO 8601, which does not match the HTTP spec.
54881
+ // For compatibility, convert the date to match the standard.
54882
+ if (headers.ifUnmodifiedSince.match(ISO8601_DATE_REGEX)) {
54883
+ const utcString = new Date(headers.ifUnmodifiedSince).toUTCString();
54884
+ if (utcString !== 'Invalid Date') {
54885
+ headers.ifUnmodifiedSince = utcString;
54886
+ }
54887
+ }
54869
54888
  }
54870
54889
  }
54871
54890
  return headers;
@@ -54884,6 +54903,14 @@ function buildNetworkSnapshot$2(luvio, config, clientOptions) {
54884
54903
  const recordIngest = createRecordIngest(fieldTrie, optionalFieldTrie, conflictMap);
54885
54904
  return luvio.dispatchResourceRequest(request).then((response) => {
54886
54905
  return luvio.handleSuccessResponse(() => {
54906
+ if (response.status === HttpStatusCode.NoContent) {
54907
+ const syntheticSnapshot = {
54908
+ state: 'Fulfilled',
54909
+ data: {},
54910
+ };
54911
+ luvio.storeEvict(keyBuilder$3n(luvio, { recordId }));
54912
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
54913
+ }
54887
54914
  const snapshot = ingestRecordResponse(luvio, response, recordId, recordIngest, conflictMap);
54888
54915
  return luvio.storeBroadcast().then(() => snapshot);
54889
54916
  }, () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi",
3
- "version": "1.290.0",
3
+ "version": "1.291.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters for record related UI API endpoints",
6
6
  "main": "dist/es/es2018/uiapi-records-service.js",
@@ -68,14 +68,14 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "@salesforce/lds-bindings": "^1.290.0",
72
- "@salesforce/lds-default-luvio": "^1.290.0"
71
+ "@salesforce/lds-bindings": "^1.291.0",
72
+ "@salesforce/lds-default-luvio": "^1.291.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@databases/sqlite": "^3.0.0",
76
- "@salesforce/lds-compiler-plugins": "^1.290.0",
77
- "@salesforce/lds-jest": "^1.290.0",
78
- "@salesforce/lds-store-binary": "^1.290.0"
76
+ "@salesforce/lds-compiler-plugins": "^1.291.0",
77
+ "@salesforce/lds-jest": "^1.291.0",
78
+ "@salesforce/lds-store-binary": "^1.291.0"
79
79
  },
80
80
  "luvioBundlesize": [
81
81
  {
@@ -19744,4 +19744,4 @@ register({
19744
19744
  });
19745
19745
 
19746
19746
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
19747
- // version: 1.290.0-e2ccd0161
19747
+ // version: 1.291.0-79b8ea231
package/sfdc/index.js CHANGED
@@ -14,7 +14,7 @@
14
14
  /* proxy-compat-disable */
15
15
  import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createInfiniteScrollingWireAdapterConstructor, createImperativeAdapter, bindWireRefresh, refresh as refresh$2 } from 'force/ldsBindings';
16
16
  import { register, withDefaultLuvio } from 'force/ldsEngine';
17
- import { serializeStructuredKey, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$18, createResourceParams as createResourceParams$12, StoreKeyMap, StoreKeySet, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$R, coerceAdapterRequestContext, Wildcard } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$18, createResourceParams as createResourceParams$12, StoreKeyMap, StoreKeySet, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$R, HttpStatusCode, coerceAdapterRequestContext, Wildcard } from 'force/luvioEngine';
18
18
  export { createRecordInputFilteredByEditedFields, generateRecordInputForCreate, generateRecordInputForUpdate, getFieldDisplayValue, getFieldValue, getRecordInput } from './uiapi-static-functions';
19
19
 
20
20
  /**
@@ -35612,7 +35612,14 @@ const createRecord_ConfigPropertyMetadata = [
35612
35612
  const createResourceParams$4 = /*#__PURE__*/ createResourceParams$12(createRecord_ConfigPropertyMetadata);
35613
35613
 
35614
35614
  function onResponseSuccess(luvio, response, recordIngest, conflictMap) {
35615
- const { body } = response;
35615
+ const { body, status } = response;
35616
+ if (status === HttpStatusCode.NoContent) {
35617
+ const syntheticSnapshot = {
35618
+ state: 'Fulfilled',
35619
+ data: {},
35620
+ };
35621
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
35622
+ }
35616
35623
  const selections = buildSelectionFromRecord(body);
35617
35624
  const key = keyBuilder$26(luvio, {
35618
35625
  recordId: body.id,
@@ -35847,11 +35854,23 @@ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
35847
35854
  return config;
35848
35855
  }
35849
35856
 
35857
+ const ISO8601_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z$/;
35850
35858
  function getHeaders(clientOptions) {
35851
35859
  const headers = {};
35852
35860
  if (untrustedIsObject(clientOptions)) {
35853
35861
  if (typeof clientOptions.ifUnmodifiedSince === 'string') {
35854
35862
  headers.ifUnmodifiedSince = clientOptions.ifUnmodifiedSince;
35863
+ // HTTP standard format date is expected by UI-API
35864
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since
35865
+ // A component built for Connect API must use If-Unmodified-Since
35866
+ // dates formatted as ISO 8601, which does not match the HTTP spec.
35867
+ // For compatibility, convert the date to match the standard.
35868
+ if (headers.ifUnmodifiedSince.match(ISO8601_DATE_REGEX)) {
35869
+ const utcString = new Date(headers.ifUnmodifiedSince).toUTCString();
35870
+ if (utcString !== 'Invalid Date') {
35871
+ headers.ifUnmodifiedSince = utcString;
35872
+ }
35873
+ }
35855
35874
  }
35856
35875
  }
35857
35876
  return headers;
@@ -35870,6 +35889,14 @@ function buildNetworkSnapshot$2(luvio, config, clientOptions) {
35870
35889
  const recordIngest = createRecordIngest(fieldTrie, optionalFieldTrie, conflictMap);
35871
35890
  return luvio.dispatchResourceRequest(request).then((response) => {
35872
35891
  return luvio.handleSuccessResponse(() => {
35892
+ if (response.status === HttpStatusCode.NoContent) {
35893
+ const syntheticSnapshot = {
35894
+ state: 'Fulfilled',
35895
+ data: {},
35896
+ };
35897
+ luvio.storeEvict(keyBuilder$26(luvio, { recordId }));
35898
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
35899
+ }
35873
35900
  const snapshot = ingestRecordResponse(luvio, response, recordId, recordIngest, conflictMap);
35874
35901
  return luvio.storeBroadcast().then(() => snapshot);
35875
35902
  }, () => {
@@ -37004,4 +37031,4 @@ withDefaultLuvio((luvio) => {
37004
37031
  });
37005
37032
 
37006
37033
  export { API_NAMESPACE, InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$I as ObjectInfoDirectoryEntryRepresentationType, RepresentationType$N as ObjectInfoRepresentationType, RECORD_FIELDS_KEY_JUNCTION, RECORD_ID_PREFIX, RECORD_REPRESENTATION_NAME, RECORD_VIEW_ENTITY_ID_PREFIX, RECORD_VIEW_ENTITY_REPRESENTATION_NAME, RepresentationType$U as RecordRepresentationRepresentationType, TTL$y as RecordRepresentationTTL, RepresentationType$U as RecordRepresentationType, VERSION$1a as RecordRepresentationVersion, keyPrefix as UiApiNamespace, buildRecordRepKeyFromId, getFieldApiNamesArray as coerceFieldIdArray, getObjectApiName$1 as coerceObjectId, getObjectApiNamesArray as coerceObjectIdArray, configurationForRestAdapters as configuration, createContentDocumentAndVersion, createContentVersion, createIngestRecordWithFields, createLDSAdapterWithPrediction, createListInfo, createRecord, createRelatedListAdapterWithPrediction, deleteListInfo, deleteRecord, executeBatchRecordOperations, extractRecordIdFromStoreKey, getActionOverrides, getActionOverrides_imperative, getAllApps, getAllApps_imperative, getAppDetails, getAppDetails_imperative, getDuplicateConfiguration, getDuplicateConfiguration_imperative, getDuplicates, getDuplicates_imperative, getFlexipageFormulaOverrides, getFlexipageFormulaOverrides_imperative, getGlobalActions, getGlobalActions_imperative, getKeywordSearchResults, getKeywordSearchResults_imperative, getLayout, getLayoutUserState, getLayoutUserState_imperative, getLayout_imperative, getListInfoByName, getListInfoByName_imperative, getListInfosByName, getListInfosByName_imperative, getListInfosByObjectName, getListInfosByObjectName_imperative, getListObjectInfo, getListObjectInfo_imperative, getListPreferences, getListPreferences_imperative, getListRecordsByName, getListRecordsByName_imperative, getListUi, getListUi_imperative, getLookupActions, getLookupActions_imperative, getLookupMetadata, getLookupMetadata_imperative, getLookupRecords, getLookupRecords_imperative, getNavItems, getNavItems_imperative, getObjectCreateActions, getObjectCreateActions_imperative, getObjectInfo, getObjectInfoAdapterFactory, getObjectInfoDirectoryAdapterFactory, getObjectInfo_imperative, getObjectInfos, getObjectInfosAdapterFactory, getObjectInfos_imperative, getPathLayout, getPathLayout_imperative, getPicklistValues, getPicklistValuesByRecordType, getPicklistValuesByRecordType_imperative, getPicklistValues_imperative, getQuickActionDefaults, getQuickActionDefaults_imperative, getQuickActionLayout, getQuickActionLayout_imperative, getRecord, getRecordActions, getRecordActionsAdapterFactory, getRecordActions_imperative, factory$f as getRecordAdapterFactory, getRecordAvatars, getRecordAvatarsAdapterFactory, getRecordAvatars_imperative, getRecordCreateDefaults, getRecordCreateDefaults_imperative, getRecordEditActions, getRecordEditActions_imperative, getRecordId18, getRecordNotifyChange, getRecordTemplateClone, getRecordTemplateClone_imperative, getRecordTemplateCreate, getRecordTemplateCreate_imperative, getRecordUi, getRecordUi_imperative, getRecord_imperative, getRecords, getRecordsAdapterFactory, getRecords_imperative, getRelatedListActions, getRelatedListActions_imperative, getRelatedListCount, getRelatedListCount_imperative, getRelatedListInfo, getRelatedListInfoBatch, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoBatch_imperative, getRelatedListInfo_imperative, getRelatedListPreferences, getRelatedListPreferencesBatch, getRelatedListPreferencesBatch_imperative, getRelatedListPreferences_imperative, getRelatedListRecordActions, getRelatedListRecordActions_imperative, getRelatedListRecords, getRelatedListRecordsAdapterFactory, getRelatedListRecordsBatch, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsBatch_imperative, getRelatedListRecords_imperative, getRelatedListsActions, getRelatedListsActionsAdapterFactory, getRelatedListsActions_imperative, getRelatedListsCount, getRelatedListsCount_imperative, getRelatedListsInfo, getRelatedListsInfo_imperative, getResponseCacheKeys as getResponseCacheKeysContentDocumentCompositeRepresentation, getSearchFilterMetadata, getSearchFilterMetadata_imperative, getSearchFilterOptions, getSearchFilterOptions_imperative, getSearchResults, getSearchResults_imperative, getTypeCacheKeys$W as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$G as ingestObjectInfo, ingest$A as ingestQuickActionExecutionRepresentation, ingest$N as ingestRecord, instrument, isStoreKeyRecordViewEntity, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$C as keyBuilderFromTypeRecordRepresentation, keyBuilder$1V as keyBuilderObjectInfo, keyBuilder$1O as keyBuilderQuickActionExecutionRepresentation, keyBuilder$26 as keyBuilderRecord, notifyAllListInfoSummaryUpdateAvailable, notifyAllListRecordUpdateAvailable, notifyListInfoSummaryUpdateAvailable, notifyListInfoUpdateAvailable, notifyListRecordCollectionUpdateAvailable, notifyListViewSummaryUpdateAvailable, notifyQuickActionDefaultsUpdateAvailable, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, registerPrefetcher, updateLayoutUserState, updateListInfoByName, updateListPreferences, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
37007
- // version: 1.290.0-e2ccd0161
37034
+ // version: 1.291.0-79b8ea231