@salesforce/lds-worker-api 1.393.0 → 1.394.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.
@@ -1371,4 +1371,4 @@ if (process.env.NODE_ENV !== 'production') {
1371
1371
  }
1372
1372
 
1373
1373
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1374
- // version: 1.393.0-fe4eaa97f2
1374
+ // version: 1.394.0-9f5a21c62e
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
4274
4274
  }
4275
4275
  callbacks.push(callback);
4276
4276
  }
4277
- // version: 1.393.0-fe4eaa97f2
4277
+ // version: 1.394.0-9f5a21c62e
4278
4278
 
4279
4279
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4280
4280
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5318,7 +5318,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5318
5318
  const { apiFamily, name } = metadata;
5319
5319
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5320
5320
  }
5321
- // version: 1.393.0-fe4eaa97f2
5321
+ // version: 1.394.0-9f5a21c62e
5322
5322
 
5323
5323
  /**
5324
5324
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -34154,7 +34154,7 @@ withDefaultLuvio((luvio) => {
34154
34154
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
34155
34155
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
34156
34156
  });
34157
- // version: 1.393.0-94e6d2aef3
34157
+ // version: 1.394.0-db58817a4e
34158
34158
 
34159
34159
  function requestIdleDetectedCallback(_callback) { }
34160
34160
  function declareNotifierTaskSingle(_name) {
@@ -94333,12 +94333,15 @@ class CacheControlCommand extends BaseCommand {
94333
94333
  this.services = services;
94334
94334
  this.keysUsed = /* @__PURE__ */ new Set();
94335
94335
  this.keysUpdated = void 0;
94336
- this.operationType = "query";
94336
+ this._isInternalExecution = false;
94337
94337
  this.lastResult = void 0;
94338
94338
  this.unsubscribeFromKeysImpl = () => void 0;
94339
94339
  this.subscriptions = [];
94340
94340
  this.instantiationTime = Date.now() / 1e3;
94341
94341
  }
94342
+ get isInternalExecution() {
94343
+ return this._isInternalExecution;
94344
+ }
94342
94345
  execute(overrides) {
94343
94346
  this.keysUpdated = void 0;
94344
94347
  this.unsubscribeFromKeys();
@@ -94383,9 +94386,6 @@ class CacheControlCommand extends BaseCommand {
94383
94386
  }
94384
94387
  return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
94385
94388
  }
94386
- if (this.subscriptions.length > 0) {
94387
- this.subscribeToKeysUsed();
94388
- }
94389
94389
  if (returnData === void 0) {
94390
94390
  if (networkData) {
94391
94391
  return buildSubscribableResult(
@@ -94400,6 +94400,9 @@ class CacheControlCommand extends BaseCommand {
94400
94400
  () => this.refresh()
94401
94401
  );
94402
94402
  }
94403
+ if (this.subscriptions.length > 0) {
94404
+ this.subscribeToKeysUsed();
94405
+ }
94403
94406
  return returnData;
94404
94407
  });
94405
94408
  }
@@ -94421,6 +94424,9 @@ class CacheControlCommand extends BaseCommand {
94421
94424
  }
94422
94425
  return resolvedPromiseLike$2(void 0);
94423
94426
  }
94427
+ get operationType() {
94428
+ return "query";
94429
+ }
94424
94430
  subscribeToKeysUsed() {
94425
94431
  this.unsubscribeFromKeys();
94426
94432
  const { pubSub } = this.services;
@@ -94503,7 +94509,7 @@ class CacheControlCommand extends BaseCommand {
94503
94509
  */
94504
94510
  buildSubscribe() {
94505
94511
  return (consumerCallback) => {
94506
- if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
94512
+ if (this.subscriptions.length === 0 && this.operationType === "query") {
94507
94513
  this.subscribeToKeysUsed();
94508
94514
  }
94509
94515
  this.subscriptions.push(consumerCallback);
@@ -94516,7 +94522,9 @@ class CacheControlCommand extends BaseCommand {
94516
94522
  };
94517
94523
  }
94518
94524
  rerun(overrides) {
94525
+ this._isInternalExecution = true;
94519
94526
  return this.execute(overrides).then((result) => {
94527
+ this._isInternalExecution = false;
94520
94528
  if (result.isErr()) {
94521
94529
  this.lastResult = { type: "error", error: result.error.failure };
94522
94530
  this.invokeConsumerCallbacks(err$2(result.error.failure));
@@ -94889,7 +94897,66 @@ class NetworkCommand extends BaseCommand {
94889
94897
  async afterRequestHooks(_options) {
94890
94898
  }
94891
94899
  }
94892
- class FetchNetworkCommand extends NetworkCommand {
94900
+ function isAbortableCommand(command) {
94901
+ return "isAbortableCommand" in command && command.isAbortableCommand === true;
94902
+ }
94903
+ function hasFetchParams(command) {
94904
+ return command && typeof command === "object" && "fetchParams" in command;
94905
+ }
94906
+ function createAbortableDecorator(command, options) {
94907
+ if (!(options == null ? void 0 : options.signal) || !((options == null ? void 0 : options.signal) instanceof AbortSignal)) {
94908
+ return command;
94909
+ }
94910
+ const { signal } = options;
94911
+ if (isAbortableCommand(command)) {
94912
+ return command;
94913
+ }
94914
+ if (!hasFetchParams(command)) {
94915
+ return command;
94916
+ }
94917
+ try {
94918
+ return new Proxy(command, {
94919
+ get(target, prop, receiver) {
94920
+ if (prop === "isAbortableCommand") {
94921
+ return true;
94922
+ }
94923
+ if (prop === "signal") {
94924
+ return signal;
94925
+ }
94926
+ if (prop === "fetchParams") {
94927
+ const originalFetchParams = target[prop];
94928
+ const isInternal = target.isInternalExecution === true;
94929
+ if (typeof originalFetchParams === "function") {
94930
+ return function(...args) {
94931
+ const originalReturnValue = originalFetchParams.apply(this, args);
94932
+ if (!isInternal) {
94933
+ const [url, init = {}] = originalReturnValue;
94934
+ return [url, { signal, ...init }];
94935
+ }
94936
+ return originalReturnValue;
94937
+ };
94938
+ } else {
94939
+ if (!isInternal && originalFetchParams && Array.isArray(originalFetchParams)) {
94940
+ const [url, init = {}] = originalFetchParams;
94941
+ return [url, { signal, ...init }];
94942
+ }
94943
+ return originalFetchParams;
94944
+ }
94945
+ }
94946
+ return Reflect.get(target, prop, receiver);
94947
+ },
94948
+ has(target, prop) {
94949
+ if (prop === "isAbortableCommand" || prop === "signal") {
94950
+ return true;
94951
+ }
94952
+ return Reflect.has(target, prop);
94953
+ }
94954
+ });
94955
+ } catch (error) {
94956
+ return command;
94957
+ }
94958
+ }
94959
+ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
94893
94960
  constructor(services) {
94894
94961
  super(services);
94895
94962
  this.services = services;
@@ -94927,7 +94994,11 @@ class FetchNetworkCommand extends NetworkCommand {
94927
94994
  (reason) => err$1$1(toError(reason))
94928
94995
  );
94929
94996
  }
94930
- }
94997
+ };
94998
+ _FetchNetworkCommand.availableDecorators = {
94999
+ abortable: createAbortableDecorator
95000
+ };
95001
+ let FetchNetworkCommand = _FetchNetworkCommand;
94931
95002
  function buildServiceDescriptor$d() {
94932
95003
  return {
94933
95004
  type: "fetchNetworkCommandBaseClass",
@@ -95493,11 +95564,11 @@ class CacheController {
95493
95564
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
95494
95565
  }
95495
95566
  }
95496
- function buildServiceDescriptor$a(cache, cacheInclusionPolicy) {
95567
+ function buildServiceDescriptor$a(cache, cacheInclusionPolicy, instrumentation) {
95497
95568
  return {
95498
95569
  type: "cacheController",
95499
95570
  version: "1.0",
95500
- service: new CacheController({ cache, cacheInclusionPolicy })
95571
+ service: new CacheController({ cache, cacheInclusionPolicy, instrumentation })
95501
95572
  };
95502
95573
  }
95503
95574
 
@@ -95993,7 +96064,7 @@ function buildServiceDescriptor$5(luvio) {
95993
96064
  },
95994
96065
  };
95995
96066
  }
95996
- // version: 1.393.0-94e6d2aef3
96067
+ // version: 1.394.0-db58817a4e
95997
96068
 
95998
96069
  /**
95999
96070
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96019,7 +96090,7 @@ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvi
96019
96090
  },
96020
96091
  };
96021
96092
  }
96022
- // version: 1.393.0-94e6d2aef3
96093
+ // version: 1.394.0-db58817a4e
96023
96094
 
96024
96095
  /*!
96025
96096
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96966,6 +97037,17 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
96966
97037
  this.documentRootType = documentRootType;
96967
97038
  this.services = services;
96968
97039
  }
97040
+ get operationType() {
97041
+ const operationResult = findExecutableOperation$2(this.config);
97042
+ if (operationResult.isErr()) {
97043
+ return "mutation";
97044
+ }
97045
+ const operationType = operationResult.value.operation.toString();
97046
+ if (operationType === "mutation" || operationType === "query") {
97047
+ return operationType;
97048
+ }
97049
+ return "mutation";
97050
+ }
96969
97051
  buildResultType() {
96970
97052
  return this.documentRootType;
96971
97053
  }
@@ -97090,6 +97172,9 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
97090
97172
  }
97091
97173
  // Any changes to this method should most likely be duplicated in the https command as well
97092
97174
  handleCacheControllerResult(result, requestRunner) {
97175
+ if (this.operationType === "mutation") {
97176
+ return super.handleCacheControllerResult(result, requestRunner);
97177
+ }
97093
97178
  const { networkError, returnData } = requestRunner;
97094
97179
  return this.publishUpdatedKeys().then(() => {
97095
97180
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -97125,6 +97210,17 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
97125
97210
  buildResultType() {
97126
97211
  return this.documentRootType;
97127
97212
  }
97213
+ get operationType() {
97214
+ const operationResult = findExecutableOperation$2(this.config);
97215
+ if (operationResult.isErr()) {
97216
+ return "mutation";
97217
+ }
97218
+ const operationType = operationResult.value.operation.toString();
97219
+ if (operationType === "mutation" || operationType === "query") {
97220
+ return operationType;
97221
+ }
97222
+ return "mutation";
97223
+ }
97128
97224
  buildQuery() {
97129
97225
  const extensionResult = buildGraphQLInputExtension$1(this.config);
97130
97226
  if (extensionResult.isErr()) {
@@ -97194,6 +97290,9 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
97194
97290
  }
97195
97291
  // Any changes to this method should most likely be duplicated in the aura command as well
97196
97292
  handleCacheControllerResult(result, requestRunner) {
97293
+ if (this.operationType === "mutation") {
97294
+ return super.handleCacheControllerResult(result, requestRunner);
97295
+ }
97197
97296
  const { networkError, returnData } = requestRunner;
97198
97297
  return this.publishUpdatedKeys().then(() => {
97199
97298
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -97947,7 +98046,7 @@ function initializeOneStore(sqliteStore) {
97947
98046
  buildServiceDescriptor$g(),
97948
98047
  buildServiceDescriptor$f(),
97949
98048
  buildServiceDescriptor$e(),
97950
- buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
98049
+ buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service, instrumentationServiceDescriptor.service),
97951
98050
  buildServiceDescriptor$d(),
97952
98051
  buildServiceDescriptor$h(),
97953
98052
  buildServiceDescriptor$c(),
@@ -98210,7 +98309,7 @@ register$1({
98210
98309
  id: '@salesforce/lds-network-adapter',
98211
98310
  instrument: instrument$2,
98212
98311
  });
98213
- // version: 1.393.0-fe4eaa97f2
98312
+ // version: 1.394.0-9f5a21c62e
98214
98313
 
98215
98314
  const { create: create$3, keys: keys$3 } = Object;
98216
98315
  const { stringify: stringify$1, parse } = JSON;
@@ -100358,8 +100457,16 @@ class BaseUnionRepository {
100358
100457
  }
100359
100458
  return { selections: augmentedSelections, fragments: augmentedFragments };
100360
100459
  }
100361
- getTypeDiscriminator(data, _selections) {
100362
- return data.__typename;
100460
+ getTypeDiscriminator(data, selections) {
100461
+ var _a;
100462
+ const typenameSelection = selections.find(
100463
+ (selection) => selection.kind === Kind.FIELD && selection.name.value === "__typename"
100464
+ );
100465
+ if (typenameSelection) {
100466
+ return data[((_a = typenameSelection.alias) == null ? void 0 : _a.value) || typenameSelection.name.value];
100467
+ } else {
100468
+ return data.__typename;
100469
+ }
100363
100470
  }
100364
100471
  verifyUnionFields(selections) {
100365
100472
  let selectionErr;
@@ -101030,7 +101137,7 @@ function handleEmit(res, callback) {
101030
101137
  }
101031
101138
  callback(consumerEmittedData);
101032
101139
  }
101033
- // version: 1.393.0-94e6d2aef3
101140
+ // version: 1.394.0-db58817a4e
101034
101141
 
101035
101142
  class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
101036
101143
  constructor(services, typeRegistry) {
@@ -103948,7 +104055,7 @@ function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename)
103948
104055
  };
103949
104056
  }
103950
104057
  function getFieldCategoryFromData(data) {
103951
- return data.__genericTypename || data.__typename;
104058
+ return data.__fieldCategory || data.__typename;
103952
104059
  }
103953
104060
 
103954
104061
  /**
@@ -104168,7 +104275,7 @@ class CompoundFieldRepository extends CompoundFieldRepository$1 {
104168
104275
  if (!input) {
104169
104276
  return undefined;
104170
104277
  }
104171
- // If data is present, we're in the normalize path, which means __genericTypename && __typename are present
104278
+ // If data is present, we're in the normalize path, which means __fieldCategory && __typename are present
104172
104279
  if (input.data) {
104173
104280
  const dataFieldName = this.getDataInstanceFieldName(selection);
104174
104281
  return this.fields[this.getFieldCategoryFromData(input.data[dataFieldName])];
@@ -104188,7 +104295,7 @@ class CompoundFieldRepository extends CompoundFieldRepository$1 {
104188
104295
  return selection.alias?.value ?? selection.name.value;
104189
104296
  }
104190
104297
  getFieldCategoryFromData(data) {
104191
- return data.__genericTypename || data.__typename;
104298
+ return data.__fieldCategory || data.__typename;
104192
104299
  }
104193
104300
  isBaseFieldSelection(selection) {
104194
104301
  return super.getFieldDef(undefined, selection) !== undefined;
@@ -104554,18 +104661,6 @@ class RecordUpdatePayloadRepository extends RecordUpdatePayloadRepository$1 {
104554
104661
  }
104555
104662
 
104556
104663
  class RecordDeletePayloadRepository extends RecordDeletePayloadRepository$1 {
104557
- constructor(services, typeRegistry) {
104558
- super(services, typeRegistry);
104559
- this.services = services;
104560
- this.typeRegistry = typeRegistry;
104561
- this._graphqlRepositoryOverride = undefined;
104562
- }
104563
- get graphqlRepository() {
104564
- if (!this._graphqlRepositoryOverride) {
104565
- this._graphqlRepositoryOverride = new RecordRepresentationBaseRepository(this.namespace, this.typeName, this.implementedInterfaces, this.fields, 'Id', this.services);
104566
- }
104567
- return this._graphqlRepositoryOverride;
104568
- }
104569
104664
  satisfiesFragmentTypeCondition(input, fragment) {
104570
104665
  return genericSatisfiesFragmentTypeCondition((input, frag) => this.graphqlRepository.satisfiesFragmentTypeCondition(input, frag), input, fragment, this.typeName);
104571
104666
  }
@@ -104806,6 +104901,36 @@ function deepMerge$1(data, extensions) {
104806
104901
  };
104807
104902
  }
104808
104903
 
104904
+ /*
104905
+ This is a map of the required fields all types in the schema that we need extra data from implicitly. We use this because
104906
+ the Salesforce GraphQL schema is not known at compile time, and this mechanism allows us to describe to the Server what
104907
+ our data requirements for caching and data consistency are.
104908
+ */
104909
+ const requiredTypeFields = {
104910
+ // Record-related types
104911
+ RecordRepresentation: ['Id', 'WeakEtag', '__fieldCategory'],
104912
+ RecordConnection: ['__fieldCategory'],
104913
+ RecordAggregateConnection: ['__fieldCategory'],
104914
+ RecordAggregate: ['__fieldCategory'],
104915
+ RecordAggregateEdge: ['__fieldCategory'],
104916
+ RecordEdge: ['__fieldCategory'],
104917
+ RecordResult: ['__fieldCategory'],
104918
+ // Mutation payload types
104919
+ RecordCreatePayload: ['__fieldCategory'],
104920
+ RecordUpdatePayload: ['__fieldCategory'],
104921
+ RecordDeletePayload: ['__fieldCategory'],
104922
+ // Setup-related types
104923
+ Setup__EntityRepresentation: ['Id', '__fieldCategory'],
104924
+ Setup__SetupConnection: ['__fieldCategory'],
104925
+ Setup__SetupAggregateConnection: ['__fieldCategory'],
104926
+ Setup__SetupAggregateEdge: ['__fieldCategory'],
104927
+ Setup__SetupEdge: ['__fieldCategory'],
104928
+ Setup__SetupRecordAggregate: ['__fieldCategory'],
104929
+ Setup__SetupRecordResult: ['__fieldCategory'],
104930
+ // Other types
104931
+ CompoundField: ['__fieldCategory'],
104932
+ };
104933
+
104809
104934
  function buildCommandClass(baseClass) {
104810
104935
  return class extends baseClass {
104811
104936
  constructor(config, documentRootType, services) {
@@ -104816,7 +104941,7 @@ function buildCommandClass(baseClass) {
104816
104941
  this.endpoint = 'RecordUiController.executeGraphQL';
104817
104942
  }
104818
104943
  get url() {
104819
- return '/graphql';
104944
+ return '/services/data/v66.0/graphql';
104820
104945
  }
104821
104946
  get cacheControlStrategyConfig() {
104822
104947
  return {
@@ -104836,7 +104961,7 @@ function buildCommandClass(baseClass) {
104836
104961
  [this.auraBodyWrapperName]: {
104837
104962
  ...body,
104838
104963
  extensions: {
104839
- ldsRequiredFields: true,
104964
+ requiredTypeFields,
104840
104965
  },
104841
104966
  },
104842
104967
  };
@@ -104847,7 +104972,7 @@ function buildCommandClass(baseClass) {
104847
104972
  const modifiedBody = {
104848
104973
  ...body,
104849
104974
  extensions: {
104850
- ldsRequiredFields: true,
104975
+ requiredTypeFields,
104851
104976
  },
104852
104977
  };
104853
104978
  return [
@@ -105185,7 +105310,7 @@ function registerCallback(cb) {
105185
105310
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, useOneStoreGraphQL);
105186
105311
  }
105187
105312
  }
105188
- // version: 1.393.0-94e6d2aef3
105313
+ // version: 1.394.0-db58817a4e
105189
105314
 
105190
105315
  function createFragmentMap(documentNode) {
105191
105316
  const fragments = {};
@@ -131899,7 +132024,7 @@ register$1({
131899
132024
  configuration: { ...configurationForGraphQLAdapters$1 },
131900
132025
  instrument: instrument$1,
131901
132026
  });
131902
- // version: 1.393.0-94e6d2aef3
132027
+ // version: 1.394.0-db58817a4e
131903
132028
 
131904
132029
  // On core the unstable adapters are re-exported with different names,
131905
132030
  // we want to match them here.
@@ -132051,7 +132176,7 @@ withDefaultLuvio((luvio) => {
132051
132176
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
132052
132177
  graphQLImperative = ldsAdapter;
132053
132178
  });
132054
- // version: 1.393.0-94e6d2aef3
132179
+ // version: 1.394.0-db58817a4e
132055
132180
 
132056
132181
  var gqlApi = /*#__PURE__*/Object.freeze({
132057
132182
  __proto__: null,
@@ -132850,7 +132975,7 @@ const callbacks$1 = [];
132850
132975
  function register(r) {
132851
132976
  callbacks$1.forEach((callback) => callback(r));
132852
132977
  }
132853
- // version: 1.393.0-fe4eaa97f2
132978
+ // version: 1.394.0-9f5a21c62e
132854
132979
 
132855
132980
  /**
132856
132981
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -134166,4 +134291,4 @@ const { luvio } = getRuntime();
134166
134291
  setDefaultLuvio({ luvio });
134167
134292
 
134168
134293
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
134169
- // version: 1.393.0-fe4eaa97f2
134294
+ // version: 1.394.0-9f5a21c62e
@@ -4280,7 +4280,7 @@
4280
4280
  }
4281
4281
  callbacks.push(callback);
4282
4282
  }
4283
- // version: 1.393.0-fe4eaa97f2
4283
+ // version: 1.394.0-9f5a21c62e
4284
4284
 
4285
4285
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4286
4286
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5324,7 +5324,7 @@
5324
5324
  const { apiFamily, name } = metadata;
5325
5325
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5326
5326
  }
5327
- // version: 1.393.0-fe4eaa97f2
5327
+ // version: 1.394.0-9f5a21c62e
5328
5328
 
5329
5329
  /**
5330
5330
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -34160,7 +34160,7 @@
34160
34160
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
34161
34161
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
34162
34162
  });
34163
- // version: 1.393.0-94e6d2aef3
34163
+ // version: 1.394.0-db58817a4e
34164
34164
 
34165
34165
  function requestIdleDetectedCallback(_callback) { }
34166
34166
  function declareNotifierTaskSingle(_name) {
@@ -94339,12 +94339,15 @@
94339
94339
  this.services = services;
94340
94340
  this.keysUsed = /* @__PURE__ */ new Set();
94341
94341
  this.keysUpdated = void 0;
94342
- this.operationType = "query";
94342
+ this._isInternalExecution = false;
94343
94343
  this.lastResult = void 0;
94344
94344
  this.unsubscribeFromKeysImpl = () => void 0;
94345
94345
  this.subscriptions = [];
94346
94346
  this.instantiationTime = Date.now() / 1e3;
94347
94347
  }
94348
+ get isInternalExecution() {
94349
+ return this._isInternalExecution;
94350
+ }
94348
94351
  execute(overrides) {
94349
94352
  this.keysUpdated = void 0;
94350
94353
  this.unsubscribeFromKeys();
@@ -94389,9 +94392,6 @@
94389
94392
  }
94390
94393
  return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
94391
94394
  }
94392
- if (this.subscriptions.length > 0) {
94393
- this.subscribeToKeysUsed();
94394
- }
94395
94395
  if (returnData === void 0) {
94396
94396
  if (networkData) {
94397
94397
  return buildSubscribableResult(
@@ -94406,6 +94406,9 @@
94406
94406
  () => this.refresh()
94407
94407
  );
94408
94408
  }
94409
+ if (this.subscriptions.length > 0) {
94410
+ this.subscribeToKeysUsed();
94411
+ }
94409
94412
  return returnData;
94410
94413
  });
94411
94414
  }
@@ -94427,6 +94430,9 @@
94427
94430
  }
94428
94431
  return resolvedPromiseLike$2(void 0);
94429
94432
  }
94433
+ get operationType() {
94434
+ return "query";
94435
+ }
94430
94436
  subscribeToKeysUsed() {
94431
94437
  this.unsubscribeFromKeys();
94432
94438
  const { pubSub } = this.services;
@@ -94509,7 +94515,7 @@
94509
94515
  */
94510
94516
  buildSubscribe() {
94511
94517
  return (consumerCallback) => {
94512
- if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
94518
+ if (this.subscriptions.length === 0 && this.operationType === "query") {
94513
94519
  this.subscribeToKeysUsed();
94514
94520
  }
94515
94521
  this.subscriptions.push(consumerCallback);
@@ -94522,7 +94528,9 @@
94522
94528
  };
94523
94529
  }
94524
94530
  rerun(overrides) {
94531
+ this._isInternalExecution = true;
94525
94532
  return this.execute(overrides).then((result) => {
94533
+ this._isInternalExecution = false;
94526
94534
  if (result.isErr()) {
94527
94535
  this.lastResult = { type: "error", error: result.error.failure };
94528
94536
  this.invokeConsumerCallbacks(err$2(result.error.failure));
@@ -94895,7 +94903,66 @@
94895
94903
  async afterRequestHooks(_options) {
94896
94904
  }
94897
94905
  }
94898
- class FetchNetworkCommand extends NetworkCommand {
94906
+ function isAbortableCommand(command) {
94907
+ return "isAbortableCommand" in command && command.isAbortableCommand === true;
94908
+ }
94909
+ function hasFetchParams(command) {
94910
+ return command && typeof command === "object" && "fetchParams" in command;
94911
+ }
94912
+ function createAbortableDecorator(command, options) {
94913
+ if (!(options == null ? void 0 : options.signal) || !((options == null ? void 0 : options.signal) instanceof AbortSignal)) {
94914
+ return command;
94915
+ }
94916
+ const { signal } = options;
94917
+ if (isAbortableCommand(command)) {
94918
+ return command;
94919
+ }
94920
+ if (!hasFetchParams(command)) {
94921
+ return command;
94922
+ }
94923
+ try {
94924
+ return new Proxy(command, {
94925
+ get(target, prop, receiver) {
94926
+ if (prop === "isAbortableCommand") {
94927
+ return true;
94928
+ }
94929
+ if (prop === "signal") {
94930
+ return signal;
94931
+ }
94932
+ if (prop === "fetchParams") {
94933
+ const originalFetchParams = target[prop];
94934
+ const isInternal = target.isInternalExecution === true;
94935
+ if (typeof originalFetchParams === "function") {
94936
+ return function(...args) {
94937
+ const originalReturnValue = originalFetchParams.apply(this, args);
94938
+ if (!isInternal) {
94939
+ const [url, init = {}] = originalReturnValue;
94940
+ return [url, { signal, ...init }];
94941
+ }
94942
+ return originalReturnValue;
94943
+ };
94944
+ } else {
94945
+ if (!isInternal && originalFetchParams && Array.isArray(originalFetchParams)) {
94946
+ const [url, init = {}] = originalFetchParams;
94947
+ return [url, { signal, ...init }];
94948
+ }
94949
+ return originalFetchParams;
94950
+ }
94951
+ }
94952
+ return Reflect.get(target, prop, receiver);
94953
+ },
94954
+ has(target, prop) {
94955
+ if (prop === "isAbortableCommand" || prop === "signal") {
94956
+ return true;
94957
+ }
94958
+ return Reflect.has(target, prop);
94959
+ }
94960
+ });
94961
+ } catch (error) {
94962
+ return command;
94963
+ }
94964
+ }
94965
+ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
94899
94966
  constructor(services) {
94900
94967
  super(services);
94901
94968
  this.services = services;
@@ -94933,7 +95000,11 @@
94933
95000
  (reason) => err$1$1(toError(reason))
94934
95001
  );
94935
95002
  }
94936
- }
95003
+ };
95004
+ _FetchNetworkCommand.availableDecorators = {
95005
+ abortable: createAbortableDecorator
95006
+ };
95007
+ let FetchNetworkCommand = _FetchNetworkCommand;
94937
95008
  function buildServiceDescriptor$d() {
94938
95009
  return {
94939
95010
  type: "fetchNetworkCommandBaseClass",
@@ -95499,11 +95570,11 @@
95499
95570
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
95500
95571
  }
95501
95572
  }
95502
- function buildServiceDescriptor$a(cache, cacheInclusionPolicy) {
95573
+ function buildServiceDescriptor$a(cache, cacheInclusionPolicy, instrumentation) {
95503
95574
  return {
95504
95575
  type: "cacheController",
95505
95576
  version: "1.0",
95506
- service: new CacheController({ cache, cacheInclusionPolicy })
95577
+ service: new CacheController({ cache, cacheInclusionPolicy, instrumentation })
95507
95578
  };
95508
95579
  }
95509
95580
 
@@ -95999,7 +96070,7 @@
95999
96070
  },
96000
96071
  };
96001
96072
  }
96002
- // version: 1.393.0-94e6d2aef3
96073
+ // version: 1.394.0-db58817a4e
96003
96074
 
96004
96075
  /**
96005
96076
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96025,7 +96096,7 @@
96025
96096
  },
96026
96097
  };
96027
96098
  }
96028
- // version: 1.393.0-94e6d2aef3
96099
+ // version: 1.394.0-db58817a4e
96029
96100
 
96030
96101
  /*!
96031
96102
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96972,6 +97043,17 @@
96972
97043
  this.documentRootType = documentRootType;
96973
97044
  this.services = services;
96974
97045
  }
97046
+ get operationType() {
97047
+ const operationResult = findExecutableOperation$2(this.config);
97048
+ if (operationResult.isErr()) {
97049
+ return "mutation";
97050
+ }
97051
+ const operationType = operationResult.value.operation.toString();
97052
+ if (operationType === "mutation" || operationType === "query") {
97053
+ return operationType;
97054
+ }
97055
+ return "mutation";
97056
+ }
96975
97057
  buildResultType() {
96976
97058
  return this.documentRootType;
96977
97059
  }
@@ -97096,6 +97178,9 @@
97096
97178
  }
97097
97179
  // Any changes to this method should most likely be duplicated in the https command as well
97098
97180
  handleCacheControllerResult(result, requestRunner) {
97181
+ if (this.operationType === "mutation") {
97182
+ return super.handleCacheControllerResult(result, requestRunner);
97183
+ }
97099
97184
  const { networkError, returnData } = requestRunner;
97100
97185
  return this.publishUpdatedKeys().then(() => {
97101
97186
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -97131,6 +97216,17 @@
97131
97216
  buildResultType() {
97132
97217
  return this.documentRootType;
97133
97218
  }
97219
+ get operationType() {
97220
+ const operationResult = findExecutableOperation$2(this.config);
97221
+ if (operationResult.isErr()) {
97222
+ return "mutation";
97223
+ }
97224
+ const operationType = operationResult.value.operation.toString();
97225
+ if (operationType === "mutation" || operationType === "query") {
97226
+ return operationType;
97227
+ }
97228
+ return "mutation";
97229
+ }
97134
97230
  buildQuery() {
97135
97231
  const extensionResult = buildGraphQLInputExtension$1(this.config);
97136
97232
  if (extensionResult.isErr()) {
@@ -97200,6 +97296,9 @@
97200
97296
  }
97201
97297
  // Any changes to this method should most likely be duplicated in the aura command as well
97202
97298
  handleCacheControllerResult(result, requestRunner) {
97299
+ if (this.operationType === "mutation") {
97300
+ return super.handleCacheControllerResult(result, requestRunner);
97301
+ }
97203
97302
  const { networkError, returnData } = requestRunner;
97204
97303
  return this.publishUpdatedKeys().then(() => {
97205
97304
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -97953,7 +98052,7 @@
97953
98052
  buildServiceDescriptor$g(),
97954
98053
  buildServiceDescriptor$f(),
97955
98054
  buildServiceDescriptor$e(),
97956
- buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
98055
+ buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service, instrumentationServiceDescriptor.service),
97957
98056
  buildServiceDescriptor$d(),
97958
98057
  buildServiceDescriptor$h(),
97959
98058
  buildServiceDescriptor$c(),
@@ -98216,7 +98315,7 @@
98216
98315
  id: '@salesforce/lds-network-adapter',
98217
98316
  instrument: instrument$2,
98218
98317
  });
98219
- // version: 1.393.0-fe4eaa97f2
98318
+ // version: 1.394.0-9f5a21c62e
98220
98319
 
98221
98320
  const { create: create$3, keys: keys$3 } = Object;
98222
98321
  const { stringify: stringify$1, parse } = JSON;
@@ -100364,8 +100463,16 @@
100364
100463
  }
100365
100464
  return { selections: augmentedSelections, fragments: augmentedFragments };
100366
100465
  }
100367
- getTypeDiscriminator(data, _selections) {
100368
- return data.__typename;
100466
+ getTypeDiscriminator(data, selections) {
100467
+ var _a;
100468
+ const typenameSelection = selections.find(
100469
+ (selection) => selection.kind === Kind.FIELD && selection.name.value === "__typename"
100470
+ );
100471
+ if (typenameSelection) {
100472
+ return data[((_a = typenameSelection.alias) == null ? void 0 : _a.value) || typenameSelection.name.value];
100473
+ } else {
100474
+ return data.__typename;
100475
+ }
100369
100476
  }
100370
100477
  verifyUnionFields(selections) {
100371
100478
  let selectionErr;
@@ -101036,7 +101143,7 @@
101036
101143
  }
101037
101144
  callback(consumerEmittedData);
101038
101145
  }
101039
- // version: 1.393.0-94e6d2aef3
101146
+ // version: 1.394.0-db58817a4e
101040
101147
 
101041
101148
  class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
101042
101149
  constructor(services, typeRegistry) {
@@ -103954,7 +104061,7 @@
103954
104061
  };
103955
104062
  }
103956
104063
  function getFieldCategoryFromData(data) {
103957
- return data.__genericTypename || data.__typename;
104064
+ return data.__fieldCategory || data.__typename;
103958
104065
  }
103959
104066
 
103960
104067
  /**
@@ -104174,7 +104281,7 @@
104174
104281
  if (!input) {
104175
104282
  return undefined;
104176
104283
  }
104177
- // If data is present, we're in the normalize path, which means __genericTypename && __typename are present
104284
+ // If data is present, we're in the normalize path, which means __fieldCategory && __typename are present
104178
104285
  if (input.data) {
104179
104286
  const dataFieldName = this.getDataInstanceFieldName(selection);
104180
104287
  return this.fields[this.getFieldCategoryFromData(input.data[dataFieldName])];
@@ -104194,7 +104301,7 @@
104194
104301
  return selection.alias?.value ?? selection.name.value;
104195
104302
  }
104196
104303
  getFieldCategoryFromData(data) {
104197
- return data.__genericTypename || data.__typename;
104304
+ return data.__fieldCategory || data.__typename;
104198
104305
  }
104199
104306
  isBaseFieldSelection(selection) {
104200
104307
  return super.getFieldDef(undefined, selection) !== undefined;
@@ -104560,18 +104667,6 @@
104560
104667
  }
104561
104668
 
104562
104669
  class RecordDeletePayloadRepository extends RecordDeletePayloadRepository$1 {
104563
- constructor(services, typeRegistry) {
104564
- super(services, typeRegistry);
104565
- this.services = services;
104566
- this.typeRegistry = typeRegistry;
104567
- this._graphqlRepositoryOverride = undefined;
104568
- }
104569
- get graphqlRepository() {
104570
- if (!this._graphqlRepositoryOverride) {
104571
- this._graphqlRepositoryOverride = new RecordRepresentationBaseRepository(this.namespace, this.typeName, this.implementedInterfaces, this.fields, 'Id', this.services);
104572
- }
104573
- return this._graphqlRepositoryOverride;
104574
- }
104575
104670
  satisfiesFragmentTypeCondition(input, fragment) {
104576
104671
  return genericSatisfiesFragmentTypeCondition((input, frag) => this.graphqlRepository.satisfiesFragmentTypeCondition(input, frag), input, fragment, this.typeName);
104577
104672
  }
@@ -104812,6 +104907,36 @@
104812
104907
  };
104813
104908
  }
104814
104909
 
104910
+ /*
104911
+ This is a map of the required fields all types in the schema that we need extra data from implicitly. We use this because
104912
+ the Salesforce GraphQL schema is not known at compile time, and this mechanism allows us to describe to the Server what
104913
+ our data requirements for caching and data consistency are.
104914
+ */
104915
+ const requiredTypeFields = {
104916
+ // Record-related types
104917
+ RecordRepresentation: ['Id', 'WeakEtag', '__fieldCategory'],
104918
+ RecordConnection: ['__fieldCategory'],
104919
+ RecordAggregateConnection: ['__fieldCategory'],
104920
+ RecordAggregate: ['__fieldCategory'],
104921
+ RecordAggregateEdge: ['__fieldCategory'],
104922
+ RecordEdge: ['__fieldCategory'],
104923
+ RecordResult: ['__fieldCategory'],
104924
+ // Mutation payload types
104925
+ RecordCreatePayload: ['__fieldCategory'],
104926
+ RecordUpdatePayload: ['__fieldCategory'],
104927
+ RecordDeletePayload: ['__fieldCategory'],
104928
+ // Setup-related types
104929
+ Setup__EntityRepresentation: ['Id', '__fieldCategory'],
104930
+ Setup__SetupConnection: ['__fieldCategory'],
104931
+ Setup__SetupAggregateConnection: ['__fieldCategory'],
104932
+ Setup__SetupAggregateEdge: ['__fieldCategory'],
104933
+ Setup__SetupEdge: ['__fieldCategory'],
104934
+ Setup__SetupRecordAggregate: ['__fieldCategory'],
104935
+ Setup__SetupRecordResult: ['__fieldCategory'],
104936
+ // Other types
104937
+ CompoundField: ['__fieldCategory'],
104938
+ };
104939
+
104815
104940
  function buildCommandClass(baseClass) {
104816
104941
  return class extends baseClass {
104817
104942
  constructor(config, documentRootType, services) {
@@ -104822,7 +104947,7 @@
104822
104947
  this.endpoint = 'RecordUiController.executeGraphQL';
104823
104948
  }
104824
104949
  get url() {
104825
- return '/graphql';
104950
+ return '/services/data/v66.0/graphql';
104826
104951
  }
104827
104952
  get cacheControlStrategyConfig() {
104828
104953
  return {
@@ -104842,7 +104967,7 @@
104842
104967
  [this.auraBodyWrapperName]: {
104843
104968
  ...body,
104844
104969
  extensions: {
104845
- ldsRequiredFields: true,
104970
+ requiredTypeFields,
104846
104971
  },
104847
104972
  },
104848
104973
  };
@@ -104853,7 +104978,7 @@
104853
104978
  const modifiedBody = {
104854
104979
  ...body,
104855
104980
  extensions: {
104856
- ldsRequiredFields: true,
104981
+ requiredTypeFields,
104857
104982
  },
104858
104983
  };
104859
104984
  return [
@@ -105191,7 +105316,7 @@
105191
105316
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, useOneStoreGraphQL);
105192
105317
  }
105193
105318
  }
105194
- // version: 1.393.0-94e6d2aef3
105319
+ // version: 1.394.0-db58817a4e
105195
105320
 
105196
105321
  function createFragmentMap(documentNode) {
105197
105322
  const fragments = {};
@@ -131905,7 +132030,7 @@
131905
132030
  configuration: { ...configurationForGraphQLAdapters$1 },
131906
132031
  instrument: instrument$1,
131907
132032
  });
131908
- // version: 1.393.0-94e6d2aef3
132033
+ // version: 1.394.0-db58817a4e
131909
132034
 
131910
132035
  // On core the unstable adapters are re-exported with different names,
131911
132036
  // we want to match them here.
@@ -132057,7 +132182,7 @@
132057
132182
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
132058
132183
  graphQLImperative = ldsAdapter;
132059
132184
  });
132060
- // version: 1.393.0-94e6d2aef3
132185
+ // version: 1.394.0-db58817a4e
132061
132186
 
132062
132187
  var gqlApi = /*#__PURE__*/Object.freeze({
132063
132188
  __proto__: null,
@@ -132856,7 +132981,7 @@
132856
132981
  function register(r) {
132857
132982
  callbacks$1.forEach((callback) => callback(r));
132858
132983
  }
132859
- // version: 1.393.0-fe4eaa97f2
132984
+ // version: 1.394.0-9f5a21c62e
132860
132985
 
132861
132986
  /**
132862
132987
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -134193,4 +134318,4 @@
134193
134318
  exports.subscribeToAdapter = subscribeToAdapter;
134194
134319
 
134195
134320
  }));
134196
- // version: 1.393.0-fe4eaa97f2
134321
+ // version: 1.394.0-9f5a21c62e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.393.0",
3
+ "version": "1.394.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.393.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.393.0",
40
- "@salesforce/lds-default-luvio": "^1.393.0",
41
- "@salesforce/lds-drafts": "^1.393.0",
42
- "@salesforce/lds-graphql-parser": "^1.393.0",
43
- "@salesforce/lds-luvio-engine": "^1.393.0",
44
- "@salesforce/lds-runtime-mobile": "^1.393.0",
45
- "@salesforce/nimbus-plugin-lds": "^1.393.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.394.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.394.0",
40
+ "@salesforce/lds-default-luvio": "^1.394.0",
41
+ "@salesforce/lds-drafts": "^1.394.0",
42
+ "@salesforce/lds-graphql-parser": "^1.394.0",
43
+ "@salesforce/lds-luvio-engine": "^1.394.0",
44
+ "@salesforce/lds-runtime-mobile": "^1.394.0",
45
+ "@salesforce/nimbus-plugin-lds": "^1.394.0",
46
46
  "ajv": "^8.11.0",
47
47
  "glob": "^7.1.5",
48
48
  "nimbus-types": "^2.0.0-alpha1",