@salesforce/lds-worker-api 1.171.0 → 1.172.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.
@@ -770,4 +770,4 @@ if (process.env.NODE_ENV !== 'production') {
770
770
  }
771
771
 
772
772
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
773
- // version: 1.171.0-2b2365b14
773
+ // version: 1.172.0-54479eea8
@@ -3799,7 +3799,7 @@ function withDefaultLuvio(callback) {
3799
3799
  }
3800
3800
  callbacks.push(callback);
3801
3801
  }
3802
- // version: 1.171.0-2b2365b14
3802
+ // version: 1.172.0-54479eea8
3803
3803
 
3804
3804
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3805
3805
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15232,7 +15232,7 @@ function parseAndVisit(source) {
15232
15232
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15233
15233
  return luvioDocumentNode;
15234
15234
  }
15235
- // version: 1.171.0-2b2365b14
15235
+ // version: 1.172.0-54479eea8
15236
15236
 
15237
15237
  function unwrap(data) {
15238
15238
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16145,7 +16145,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16145
16145
  const { apiFamily, name } = metadata;
16146
16146
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16147
16147
  }
16148
- // version: 1.171.0-2b2365b14
16148
+ // version: 1.172.0-54479eea8
16149
16149
 
16150
16150
  /**
16151
16151
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44106,7 +44106,7 @@ withDefaultLuvio((luvio) => {
44106
44106
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44107
44107
  });
44108
44108
  });
44109
- // version: 1.171.0-c5e524eba
44109
+ // version: 1.172.0-59ee1151c
44110
44110
 
44111
44111
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44112
44112
 
@@ -49163,9 +49163,14 @@ function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromC
49163
49163
  if (options.forDeleteAdapter === true) {
49164
49164
  // delete adapters attempt to evict the record on successful network response,
49165
49165
  // since draft-aware delete adapters do soft-delete (record stays in cache
49166
- // with a "drafts.deleted" property) we want storeEvict to just be a no-op
49167
- const storeEvict = function (_key) {
49168
- // no-op
49166
+ // with a "drafts.deleted" property) we just want to let the environment know so it can
49167
+ // decrement its ref count for the record
49168
+ const storeEvict = function (key) {
49169
+ const softEvict = luvio.environment.softEvict;
49170
+ if (softEvict === undefined) {
49171
+ throw Error('DraftAwareEnvironment not configured correctly');
49172
+ }
49173
+ softEvict(key);
49169
49174
  };
49170
49175
  return create$4(luvio, {
49171
49176
  dispatchResourceRequest: { value: dispatchResourceRequest },
@@ -50605,29 +50610,46 @@ function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueu
50605
50610
  };
50606
50611
  const storePublish = function (key, data) {
50607
50612
  const draftMetadataForKey = draftMetadata[key];
50613
+ let handled = false;
50608
50614
  for (const handler of handlers) {
50609
50615
  if (handler.canHandlePublish(key)) {
50616
+ handled = true;
50610
50617
  handler.applyDraftsToIncomingData(key, data, draftMetadataForKey && draftMetadataForKey.metadata, env.storePublish);
50611
- return;
50618
+ // deletes the draft metadata once it is published and has 0 ref.
50619
+ if (draftMetadataForKey &&
50620
+ draftMetadataForKey.metadata &&
50621
+ draftMetadataForKey.refCount === 0) {
50622
+ delete draftMetadata[key];
50623
+ }
50624
+ break;
50612
50625
  }
50613
50626
  }
50627
+ decrementRefCount(key);
50628
+ // no handler could handle it so publish
50629
+ if (!handled) {
50630
+ env.storePublish(key, data);
50631
+ }
50632
+ };
50633
+ const decrementRefCount = function (key) {
50634
+ const draftMetadataForKey = draftMetadata[key];
50614
50635
  if (draftMetadataForKey !== undefined) {
50615
- // WARNING: this code depends on the fact that RecordRepresentation
50616
- // fields get published before the root record.
50636
+ // metadata is needed for a once-draft record to create ref link for spanning fields.
50617
50637
  if (draftMetadataForKey.refCount === 1) {
50618
- delete draftMetadata[key];
50619
- }
50620
- else {
50621
- draftMetadataForKey.refCount--;
50638
+ draftMetadata[key].metadata.recordOperations = [];
50622
50639
  }
50640
+ draftMetadataForKey.refCount--;
50623
50641
  }
50624
- // no handler could handle it so publish
50625
- env.storePublish(key, data);
50642
+ };
50643
+ // when a record is soft deleted it won't be published so won't decrement the ref count
50644
+ // this is a backdoor to decrement the ref count
50645
+ const softEvict = function (key) {
50646
+ decrementRefCount(key);
50626
50647
  };
50627
50648
  // note the makeEnvironmentUiApiRecordDraftAware will eventually go away once the adapters become draft aware
50628
50649
  return create$4(env, {
50629
50650
  storePublish: { value: storePublish },
50630
50651
  handleSuccessResponse: { value: handleSuccessResponse },
50652
+ softEvict: { value: softEvict },
50631
50653
  });
50632
50654
  }
50633
50655
 
@@ -55364,23 +55386,35 @@ function recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations)
55364
55386
  // update last modified date to draft action time and
55365
55387
  // last modified to user id
55366
55388
  const lastModifiedDate = new Date(draftOperation.timestamp).toISOString();
55367
- record.lastModifiedById = userId;
55368
- record.lastModifiedDate = lastModifiedDate;
55369
- record.fields[DEFAULT_FIELD_LAST_MODIFIED_BY_ID] = { value: userId, displayValue: null };
55370
- record.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE] = {
55371
- value: lastModifiedDate,
55372
- displayValue: lastModifiedDate,
55373
- };
55389
+ const internalTrackableFields = {};
55390
+ if (record.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE] === undefined && record.lastModifiedDate) {
55391
+ internalTrackableFields[DEFAULT_FIELD_LAST_MODIFIED_DATE] = {
55392
+ value: record.lastModifiedDate,
55393
+ displayValue: formatDisplayValue(record.lastModifiedDate, 'DateTime'),
55394
+ };
55395
+ }
55396
+ if (record.fields[DEFAULT_FIELD_LAST_MODIFIED_BY_ID] === undefined && record.lastModifiedById) {
55397
+ internalTrackableFields[DEFAULT_FIELD_LAST_MODIFIED_BY_ID] = {
55398
+ value: record.lastModifiedById,
55399
+ displayValue: null,
55400
+ };
55401
+ }
55374
55402
  if (draftActionType === 'delete') {
55375
55403
  if (recordOperations.length > 0) {
55376
55404
  throw Error('cannot contain drafts after a terminal delete');
55377
55405
  }
55378
55406
  record.drafts.deleted = true;
55379
- return record;
55380
55407
  }
55381
- const fields = draftOperation.fields;
55408
+ // 'lastModifiedById' and 'lastModifiedDate' are modified in 'delete' and 'update' action
55409
+ const fields = draftActionType === 'delete' ? {} : draftOperation.fields;
55382
55410
  const apiName = draftOperation.apiName;
55383
- const draftFields = buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, fields, objectInfos, referencedRecords, formatDisplayValue);
55411
+ // automaticlly add 'lastModifiedById' and 'lastModifiedByDate' and use an internal draft field copy since it is mutable
55412
+ const internalFields = {
55413
+ ...fields,
55414
+ LastModifiedById: userId,
55415
+ LastModifiedDate: lastModifiedDate,
55416
+ };
55417
+ const draftFields = buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, internalFields, objectInfos, referencedRecords, formatDisplayValue);
55384
55418
  const fieldNames = keys$2$1(draftFields);
55385
55419
  for (let i = 0, len = fieldNames.length; i < len; i++) {
55386
55420
  const fieldName = fieldNames[i];
@@ -55397,7 +55431,11 @@ function recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations)
55397
55431
  };
55398
55432
  }
55399
55433
  else {
55400
- record.drafts.serverValues[fieldName] = record.fields[fieldName];
55434
+ if (record.fields[fieldName] !== undefined ||
55435
+ internalTrackableFields[fieldName] !== undefined) {
55436
+ record.drafts.serverValues[fieldName] = (record.fields[fieldName] ||
55437
+ internalTrackableFields[fieldName]);
55438
+ }
55401
55439
  }
55402
55440
  }
55403
55441
  // a change to the record type is reflected in the fields and the root,
@@ -55410,9 +55448,18 @@ function recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations)
55410
55448
  record.recordTypeInfo = objectInfo.recordTypeInfos[updatedRecordTypeId];
55411
55449
  }
55412
55450
  }
55451
+ if (fieldName === DEFAULT_FIELD_LAST_MODIFIED_BY_ID) {
55452
+ record.lastModifiedById = userId;
55453
+ }
55454
+ if (fieldName === DEFAULT_FIELD_LAST_MODIFIED_DATE) {
55455
+ record.lastModifiedDate = lastModifiedDate;
55456
+ }
55457
+ // extra fields might be added into records, which is necessary for the spanning field link generation when record is ingested.
55413
55458
  record.fields[fieldName] = draftFields[fieldName];
55414
55459
  }
55415
- record.drafts.edited = true;
55460
+ if (draftActionType === 'update') {
55461
+ record.drafts.edited = true;
55462
+ }
55416
55463
  return recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations);
55417
55464
  }
55418
55465
  /**
@@ -55455,21 +55502,18 @@ function removeDrafts(record, luvio, objectInfo) {
55455
55502
  updatedFields[fieldName] = field;
55456
55503
  }
55457
55504
  }
55458
- // W-11677795 we don't currently persist lastModified* top level properties, these need to be persisted
55459
- // to restore them when a draft is removed. To work around this for now, we have to change the last modified
55460
- // time slightly to trigger a change in the record so it gets republished after a draft is removed
55461
- const serverLastModifiedById = record.lastModifiedById;
55462
- let serverLastModifiedDate;
55463
- if (record.lastModifiedDate === null) {
55464
- serverLastModifiedDate = null;
55505
+ // restore lastModifiedById
55506
+ const serverLastModifiedByIdFieldValue = drafts.serverValues[DEFAULT_FIELD_LAST_MODIFIED_BY_ID];
55507
+ if (serverLastModifiedByIdFieldValue !== undefined) {
55508
+ record.lastModifiedById = serverLastModifiedByIdFieldValue.value;
55465
55509
  }
55466
- else {
55467
- serverLastModifiedDate = new Date(Date.parse(record.lastModifiedDate) - 1).toISOString();
55510
+ // restore lastModifiedDate
55511
+ const serverLastModifiedDateFieldValue = drafts.serverValues[DEFAULT_FIELD_LAST_MODIFIED_DATE];
55512
+ if (serverLastModifiedDateFieldValue !== undefined) {
55513
+ record.lastModifiedDate = serverLastModifiedDateFieldValue.value;
55468
55514
  }
55469
55515
  return {
55470
55516
  ...record,
55471
- lastModifiedById: serverLastModifiedById,
55472
- lastModifiedDate: serverLastModifiedDate,
55473
55517
  drafts: undefined,
55474
55518
  fields: updatedFields,
55475
55519
  };
@@ -55908,6 +55952,8 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
55908
55952
  ...recordWithSpanningRefLinks,
55909
55953
  ...data,
55910
55954
  fields: { ...data.fields },
55955
+ lastModifiedDate: recordWithDrafts.lastModifiedDate,
55956
+ lastModifiedById: recordWithDrafts.lastModifiedById,
55911
55957
  };
55912
55958
  for (const fieldName of keys$2$1(recordWithSpanningRefLinks.fields)) {
55913
55959
  const fieldKey = buildRecordFieldStoreKey(key, fieldName);
@@ -60209,7 +60255,7 @@ register({
60209
60255
  id: '@salesforce/lds-network-adapter',
60210
60256
  instrument: instrument$1,
60211
60257
  });
60212
- // version: 1.171.0-2b2365b14
60258
+ // version: 1.172.0-54479eea8
60213
60259
 
60214
60260
  const { create: create$2, keys: keys$2 } = Object;
60215
60261
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77552,7 +77598,7 @@ register({
77552
77598
  configuration: { ...configurationForGraphQLAdapters },
77553
77599
  instrument,
77554
77600
  });
77555
- // version: 1.171.0-c5e524eba
77601
+ // version: 1.172.0-59ee1151c
77556
77602
 
77557
77603
  // On core the unstable adapters are re-exported with different names,
77558
77604
 
@@ -79799,7 +79845,7 @@ withDefaultLuvio((luvio) => {
79799
79845
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79800
79846
  graphQLImperative = ldsAdapter;
79801
79847
  });
79802
- // version: 1.171.0-c5e524eba
79848
+ // version: 1.172.0-59ee1151c
79803
79849
 
79804
79850
  var gqlApi = /*#__PURE__*/Object.freeze({
79805
79851
  __proto__: null,
@@ -80488,4 +80534,4 @@ const { luvio } = getRuntime();
80488
80534
  setDefaultLuvio({ luvio });
80489
80535
 
80490
80536
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
80491
- // version: 1.171.0-2b2365b14
80537
+ // version: 1.172.0-54479eea8
@@ -3805,7 +3805,7 @@
3805
3805
  }
3806
3806
  callbacks.push(callback);
3807
3807
  }
3808
- // version: 1.171.0-2b2365b14
3808
+ // version: 1.172.0-54479eea8
3809
3809
 
3810
3810
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3811
3811
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15238,7 +15238,7 @@
15238
15238
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15239
15239
  return luvioDocumentNode;
15240
15240
  }
15241
- // version: 1.171.0-2b2365b14
15241
+ // version: 1.172.0-54479eea8
15242
15242
 
15243
15243
  function unwrap(data) {
15244
15244
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16151,7 +16151,7 @@
16151
16151
  const { apiFamily, name } = metadata;
16152
16152
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16153
16153
  }
16154
- // version: 1.171.0-2b2365b14
16154
+ // version: 1.172.0-54479eea8
16155
16155
 
16156
16156
  /**
16157
16157
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44112,7 +44112,7 @@
44112
44112
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44113
44113
  });
44114
44114
  });
44115
- // version: 1.171.0-c5e524eba
44115
+ // version: 1.172.0-59ee1151c
44116
44116
 
44117
44117
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44118
44118
 
@@ -49169,9 +49169,14 @@
49169
49169
  if (options.forDeleteAdapter === true) {
49170
49170
  // delete adapters attempt to evict the record on successful network response,
49171
49171
  // since draft-aware delete adapters do soft-delete (record stays in cache
49172
- // with a "drafts.deleted" property) we want storeEvict to just be a no-op
49173
- const storeEvict = function (_key) {
49174
- // no-op
49172
+ // with a "drafts.deleted" property) we just want to let the environment know so it can
49173
+ // decrement its ref count for the record
49174
+ const storeEvict = function (key) {
49175
+ const softEvict = luvio.environment.softEvict;
49176
+ if (softEvict === undefined) {
49177
+ throw Error('DraftAwareEnvironment not configured correctly');
49178
+ }
49179
+ softEvict(key);
49175
49180
  };
49176
49181
  return create$4(luvio, {
49177
49182
  dispatchResourceRequest: { value: dispatchResourceRequest },
@@ -50611,29 +50616,46 @@
50611
50616
  };
50612
50617
  const storePublish = function (key, data) {
50613
50618
  const draftMetadataForKey = draftMetadata[key];
50619
+ let handled = false;
50614
50620
  for (const handler of handlers) {
50615
50621
  if (handler.canHandlePublish(key)) {
50622
+ handled = true;
50616
50623
  handler.applyDraftsToIncomingData(key, data, draftMetadataForKey && draftMetadataForKey.metadata, env.storePublish);
50617
- return;
50624
+ // deletes the draft metadata once it is published and has 0 ref.
50625
+ if (draftMetadataForKey &&
50626
+ draftMetadataForKey.metadata &&
50627
+ draftMetadataForKey.refCount === 0) {
50628
+ delete draftMetadata[key];
50629
+ }
50630
+ break;
50618
50631
  }
50619
50632
  }
50633
+ decrementRefCount(key);
50634
+ // no handler could handle it so publish
50635
+ if (!handled) {
50636
+ env.storePublish(key, data);
50637
+ }
50638
+ };
50639
+ const decrementRefCount = function (key) {
50640
+ const draftMetadataForKey = draftMetadata[key];
50620
50641
  if (draftMetadataForKey !== undefined) {
50621
- // WARNING: this code depends on the fact that RecordRepresentation
50622
- // fields get published before the root record.
50642
+ // metadata is needed for a once-draft record to create ref link for spanning fields.
50623
50643
  if (draftMetadataForKey.refCount === 1) {
50624
- delete draftMetadata[key];
50625
- }
50626
- else {
50627
- draftMetadataForKey.refCount--;
50644
+ draftMetadata[key].metadata.recordOperations = [];
50628
50645
  }
50646
+ draftMetadataForKey.refCount--;
50629
50647
  }
50630
- // no handler could handle it so publish
50631
- env.storePublish(key, data);
50648
+ };
50649
+ // when a record is soft deleted it won't be published so won't decrement the ref count
50650
+ // this is a backdoor to decrement the ref count
50651
+ const softEvict = function (key) {
50652
+ decrementRefCount(key);
50632
50653
  };
50633
50654
  // note the makeEnvironmentUiApiRecordDraftAware will eventually go away once the adapters become draft aware
50634
50655
  return create$4(env, {
50635
50656
  storePublish: { value: storePublish },
50636
50657
  handleSuccessResponse: { value: handleSuccessResponse },
50658
+ softEvict: { value: softEvict },
50637
50659
  });
50638
50660
  }
50639
50661
 
@@ -55370,23 +55392,35 @@
55370
55392
  // update last modified date to draft action time and
55371
55393
  // last modified to user id
55372
55394
  const lastModifiedDate = new Date(draftOperation.timestamp).toISOString();
55373
- record.lastModifiedById = userId;
55374
- record.lastModifiedDate = lastModifiedDate;
55375
- record.fields[DEFAULT_FIELD_LAST_MODIFIED_BY_ID] = { value: userId, displayValue: null };
55376
- record.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE] = {
55377
- value: lastModifiedDate,
55378
- displayValue: lastModifiedDate,
55379
- };
55395
+ const internalTrackableFields = {};
55396
+ if (record.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE] === undefined && record.lastModifiedDate) {
55397
+ internalTrackableFields[DEFAULT_FIELD_LAST_MODIFIED_DATE] = {
55398
+ value: record.lastModifiedDate,
55399
+ displayValue: formatDisplayValue(record.lastModifiedDate, 'DateTime'),
55400
+ };
55401
+ }
55402
+ if (record.fields[DEFAULT_FIELD_LAST_MODIFIED_BY_ID] === undefined && record.lastModifiedById) {
55403
+ internalTrackableFields[DEFAULT_FIELD_LAST_MODIFIED_BY_ID] = {
55404
+ value: record.lastModifiedById,
55405
+ displayValue: null,
55406
+ };
55407
+ }
55380
55408
  if (draftActionType === 'delete') {
55381
55409
  if (recordOperations.length > 0) {
55382
55410
  throw Error('cannot contain drafts after a terminal delete');
55383
55411
  }
55384
55412
  record.drafts.deleted = true;
55385
- return record;
55386
55413
  }
55387
- const fields = draftOperation.fields;
55414
+ // 'lastModifiedById' and 'lastModifiedDate' are modified in 'delete' and 'update' action
55415
+ const fields = draftActionType === 'delete' ? {} : draftOperation.fields;
55388
55416
  const apiName = draftOperation.apiName;
55389
- const draftFields = buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, fields, objectInfos, referencedRecords, formatDisplayValue);
55417
+ // automaticlly add 'lastModifiedById' and 'lastModifiedByDate' and use an internal draft field copy since it is mutable
55418
+ const internalFields = {
55419
+ ...fields,
55420
+ LastModifiedById: userId,
55421
+ LastModifiedDate: lastModifiedDate,
55422
+ };
55423
+ const draftFields = buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, internalFields, objectInfos, referencedRecords, formatDisplayValue);
55390
55424
  const fieldNames = keys$2$1(draftFields);
55391
55425
  for (let i = 0, len = fieldNames.length; i < len; i++) {
55392
55426
  const fieldName = fieldNames[i];
@@ -55403,7 +55437,11 @@
55403
55437
  };
55404
55438
  }
55405
55439
  else {
55406
- record.drafts.serverValues[fieldName] = record.fields[fieldName];
55440
+ if (record.fields[fieldName] !== undefined ||
55441
+ internalTrackableFields[fieldName] !== undefined) {
55442
+ record.drafts.serverValues[fieldName] = (record.fields[fieldName] ||
55443
+ internalTrackableFields[fieldName]);
55444
+ }
55407
55445
  }
55408
55446
  }
55409
55447
  // a change to the record type is reflected in the fields and the root,
@@ -55416,9 +55454,18 @@
55416
55454
  record.recordTypeInfo = objectInfo.recordTypeInfos[updatedRecordTypeId];
55417
55455
  }
55418
55456
  }
55457
+ if (fieldName === DEFAULT_FIELD_LAST_MODIFIED_BY_ID) {
55458
+ record.lastModifiedById = userId;
55459
+ }
55460
+ if (fieldName === DEFAULT_FIELD_LAST_MODIFIED_DATE) {
55461
+ record.lastModifiedDate = lastModifiedDate;
55462
+ }
55463
+ // extra fields might be added into records, which is necessary for the spanning field link generation when record is ingested.
55419
55464
  record.fields[fieldName] = draftFields[fieldName];
55420
55465
  }
55421
- record.drafts.edited = true;
55466
+ if (draftActionType === 'update') {
55467
+ record.drafts.edited = true;
55468
+ }
55422
55469
  return recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations);
55423
55470
  }
55424
55471
  /**
@@ -55461,21 +55508,18 @@
55461
55508
  updatedFields[fieldName] = field;
55462
55509
  }
55463
55510
  }
55464
- // W-11677795 we don't currently persist lastModified* top level properties, these need to be persisted
55465
- // to restore them when a draft is removed. To work around this for now, we have to change the last modified
55466
- // time slightly to trigger a change in the record so it gets republished after a draft is removed
55467
- const serverLastModifiedById = record.lastModifiedById;
55468
- let serverLastModifiedDate;
55469
- if (record.lastModifiedDate === null) {
55470
- serverLastModifiedDate = null;
55511
+ // restore lastModifiedById
55512
+ const serverLastModifiedByIdFieldValue = drafts.serverValues[DEFAULT_FIELD_LAST_MODIFIED_BY_ID];
55513
+ if (serverLastModifiedByIdFieldValue !== undefined) {
55514
+ record.lastModifiedById = serverLastModifiedByIdFieldValue.value;
55471
55515
  }
55472
- else {
55473
- serverLastModifiedDate = new Date(Date.parse(record.lastModifiedDate) - 1).toISOString();
55516
+ // restore lastModifiedDate
55517
+ const serverLastModifiedDateFieldValue = drafts.serverValues[DEFAULT_FIELD_LAST_MODIFIED_DATE];
55518
+ if (serverLastModifiedDateFieldValue !== undefined) {
55519
+ record.lastModifiedDate = serverLastModifiedDateFieldValue.value;
55474
55520
  }
55475
55521
  return {
55476
55522
  ...record,
55477
- lastModifiedById: serverLastModifiedById,
55478
- lastModifiedDate: serverLastModifiedDate,
55479
55523
  drafts: undefined,
55480
55524
  fields: updatedFields,
55481
55525
  };
@@ -55914,6 +55958,8 @@
55914
55958
  ...recordWithSpanningRefLinks,
55915
55959
  ...data,
55916
55960
  fields: { ...data.fields },
55961
+ lastModifiedDate: recordWithDrafts.lastModifiedDate,
55962
+ lastModifiedById: recordWithDrafts.lastModifiedById,
55917
55963
  };
55918
55964
  for (const fieldName of keys$2$1(recordWithSpanningRefLinks.fields)) {
55919
55965
  const fieldKey = buildRecordFieldStoreKey(key, fieldName);
@@ -60215,7 +60261,7 @@
60215
60261
  id: '@salesforce/lds-network-adapter',
60216
60262
  instrument: instrument$1,
60217
60263
  });
60218
- // version: 1.171.0-2b2365b14
60264
+ // version: 1.172.0-54479eea8
60219
60265
 
60220
60266
  const { create: create$2, keys: keys$2 } = Object;
60221
60267
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77558,7 +77604,7 @@
77558
77604
  configuration: { ...configurationForGraphQLAdapters },
77559
77605
  instrument,
77560
77606
  });
77561
- // version: 1.171.0-c5e524eba
77607
+ // version: 1.172.0-59ee1151c
77562
77608
 
77563
77609
  // On core the unstable adapters are re-exported with different names,
77564
77610
 
@@ -79805,7 +79851,7 @@
79805
79851
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79806
79852
  graphQLImperative = ldsAdapter;
79807
79853
  });
79808
- // version: 1.171.0-c5e524eba
79854
+ // version: 1.172.0-59ee1151c
79809
79855
 
79810
79856
  var gqlApi = /*#__PURE__*/Object.freeze({
79811
79857
  __proto__: null,
@@ -80511,4 +80557,4 @@
80511
80557
  Object.defineProperty(exports, '__esModule', { value: true });
80512
80558
 
80513
80559
  }));
80514
- // version: 1.171.0-2b2365b14
80560
+ // version: 1.172.0-54479eea8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.171.0",
3
+ "version": "1.172.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",