@salesforce/lds-worker-api 1.379.0 → 1.380.0-dev1

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.
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
4274
4274
  }
4275
4275
  callbacks.push(callback);
4276
4276
  }
4277
- // version: 1.379.0-fc97fd9203
4277
+ // version: 1.380.0-dev1-4b44b915b4
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.379.0-fc97fd9203
5321
+ // version: 1.380.0-dev1-4b44b915b4
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.379.0-a57c798add
34157
+ // version: 1.380.0-dev1-b7c5fad9db
34158
34158
 
34159
34159
  function requestIdleDetectedCallback(_callback) { }
34160
34160
  function declareNotifierTaskSingle(_name) {
@@ -45793,7 +45793,7 @@ let Ok$4 = class Ok {
45793
45793
  return !this.isOk();
45794
45794
  }
45795
45795
  };
45796
- let Err$4 = class Err {
45796
+ let Err$3 = class Err {
45797
45797
  constructor(error) {
45798
45798
  this.error = error;
45799
45799
  }
@@ -45805,7 +45805,7 @@ let Err$4 = class Err {
45805
45805
  }
45806
45806
  };
45807
45807
  const ok$4 = (value) => new Ok$4(value);
45808
- const err$4 = (err2) => new Err$4(err2);
45808
+ const err$3 = (err2) => new Err$3(err2);
45809
45809
  function resolvedPromiseLike$5(result) {
45810
45810
  if (isPromiseLike$5(result)) {
45811
45811
  return result.then((nextResult) => nextResult);
@@ -46036,7 +46036,7 @@ class IdentifiableTypeRepository {
46036
46036
  const existingNormalizedData = (_a = cache.get(key)) == null ? void 0 : _a.value;
46037
46037
  const normalized = this.normalizeData(cache, { ...input, existingNormalizedData });
46038
46038
  if (normalized.isErr()) {
46039
- return err$4(normalized.error);
46039
+ return err$3(normalized.error);
46040
46040
  }
46041
46041
  cache.set(key, {
46042
46042
  value: normalized.value,
@@ -46049,7 +46049,7 @@ class IdentifiableTypeRepository {
46049
46049
  }
46050
46050
  validateEntry(entry) {
46051
46051
  if (!isCacheEntryForType(entry, this)) {
46052
- return err$4([
46052
+ return err$3([
46053
46053
  {
46054
46054
  type: "incorrectType",
46055
46055
  expectedType: this.typeName,
@@ -46075,12 +46075,12 @@ class IdentifiableTypeRepository {
46075
46075
  if (cacheEntry) {
46076
46076
  const validationResult = this.validateEntry(cacheEntry);
46077
46077
  if (validationResult.isErr()) {
46078
- return err$4([...validationResult.error]);
46078
+ return err$3([...validationResult.error]);
46079
46079
  }
46080
46080
  const normalizedData = cacheEntry.value;
46081
46081
  return this.denormalizeData(cache, { ...input, normalizedData });
46082
46082
  }
46083
- return err$4([this.buildMissingDataError()]);
46083
+ return err$3([this.buildMissingDataError()]);
46084
46084
  }
46085
46085
  equals(x, y) {
46086
46086
  return deepEquals$2(x, y);
@@ -46103,7 +46103,7 @@ function extractReadWriteData(result, errorCollector) {
46103
46103
  }
46104
46104
  function buildReadWriteResult(data, errors) {
46105
46105
  if (errors.length > 0) {
46106
- return err$4(errors);
46106
+ return err$3(errors);
46107
46107
  }
46108
46108
  return ok$4(data);
46109
46109
  }
@@ -94148,7 +94148,7 @@ let Ok$3 = class Ok {
94148
94148
  return !this.isOk();
94149
94149
  }
94150
94150
  };
94151
- let Err$3 = class Err {
94151
+ let Err$2 = class Err {
94152
94152
  constructor(error) {
94153
94153
  this.error = error;
94154
94154
  }
@@ -94160,7 +94160,7 @@ let Err$3 = class Err {
94160
94160
  }
94161
94161
  };
94162
94162
  const ok$3 = (value) => new Ok$3(value);
94163
- const err$3 = (err2) => new Err$3(err2);
94163
+ const err$2 = (err2) => new Err$2(err2);
94164
94164
  function resolvedPromiseLike$2(result) {
94165
94165
  if (isPromiseLike$2(result)) {
94166
94166
  return result.then((nextResult) => nextResult);
@@ -94260,7 +94260,7 @@ class CacheControlRequestRunner {
94260
94260
  const resultPromise = this.readFromCacheInternal(cache);
94261
94261
  return resultPromise.then((result) => {
94262
94262
  if (result.isErr()) {
94263
- return err$3(result.error);
94263
+ return err$2(result.error);
94264
94264
  }
94265
94265
  this.returnData = result;
94266
94266
  return ok$3(void 0);
@@ -94319,7 +94319,7 @@ class CacheControlCommand extends BaseCommand {
94319
94319
  if (networkData) {
94320
94320
  return this.constructSubscribableResult(networkData.value);
94321
94321
  }
94322
- return err$3(result.error);
94322
+ return err$2(result.error);
94323
94323
  }
94324
94324
  if (this.subscriptions.length > 0) {
94325
94325
  this.subscribeToKeysUsed();
@@ -94328,7 +94328,7 @@ class CacheControlCommand extends BaseCommand {
94328
94328
  if (networkData) {
94329
94329
  return this.constructSubscribableResult(networkData.value);
94330
94330
  }
94331
- return err$3(new Error("Cache miss after fetching from network"));
94331
+ return err$2(new Error("Cache miss after fetching from network"));
94332
94332
  }
94333
94333
  if (returnData.isOk() && this.lastEmittedData === void 0) {
94334
94334
  this.lastEmittedData = returnData.value.data;
@@ -94391,7 +94391,7 @@ class CacheControlCommand extends BaseCommand {
94391
94391
  refresh() {
94392
94392
  return this.rerun({ cacheControlConfig: { type: "no-cache" } }).then((result) => {
94393
94393
  if (result.isErr()) {
94394
- return err$3(result.error);
94394
+ return err$2(result.error);
94395
94395
  }
94396
94396
  return ok$3(void 0);
94397
94397
  });
@@ -94409,7 +94409,7 @@ class CacheControlCommand extends BaseCommand {
94409
94409
  const result = this.readFromCache(recordableCache);
94410
94410
  return result.then((readResult) => {
94411
94411
  if (readResult.isErr()) {
94412
- return err$3(readResult.error);
94412
+ return err$2(readResult.error);
94413
94413
  } else {
94414
94414
  const data = readResult.value;
94415
94415
  this.keysUsed = recordableCache.keysRead;
@@ -95881,7 +95881,7 @@ function buildServiceDescriptor$5(luvio) {
95881
95881
  },
95882
95882
  };
95883
95883
  }
95884
- // version: 1.379.0-a57c798add
95884
+ // version: 1.380.0-dev1-b7c5fad9db
95885
95885
 
95886
95886
  /**
95887
95887
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -95907,7 +95907,7 @@ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvi
95907
95907
  },
95908
95908
  };
95909
95909
  }
95910
- // version: 1.379.0-a57c798add
95910
+ // version: 1.380.0-dev1-b7c5fad9db
95911
95911
 
95912
95912
  /*!
95913
95913
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -98023,7 +98023,7 @@ register$1({
98023
98023
  id: '@salesforce/lds-network-adapter',
98024
98024
  instrument: instrument$2,
98025
98025
  });
98026
- // version: 1.379.0-fc97fd9203
98026
+ // version: 1.380.0-dev1-4b44b915b4
98027
98027
 
98028
98028
  const { create: create$3, keys: keys$3 } = Object;
98029
98029
  const { stringify: stringify$1, parse } = JSON;
@@ -98052,7 +98052,7 @@ let Ok$2 = class Ok {
98052
98052
  return !this.isOk();
98053
98053
  }
98054
98054
  };
98055
- let Err$2 = class Err {
98055
+ let Err$1 = class Err {
98056
98056
  constructor(error) {
98057
98057
  this.error = error;
98058
98058
  }
@@ -98064,7 +98064,7 @@ let Err$2 = class Err {
98064
98064
  }
98065
98065
  };
98066
98066
  const ok$2 = (value) => new Ok$2(value);
98067
- const err$2 = (err2) => new Err$2(err2);
98067
+ const err$1 = (err2) => new Err$1(err2);
98068
98068
  function deepEquals(x, y) {
98069
98069
  if (x === void 0) {
98070
98070
  return y === void 0;
@@ -98139,7 +98139,7 @@ class JsonSchemaErrorCollector {
98139
98139
  this.errors.unshift(error);
98140
98140
  }
98141
98141
  toValidationResponse() {
98142
- return !this.hasErrors() ? ok$2(true) : err$2(this.errors);
98142
+ return !this.hasErrors() ? ok$2(true) : err$1(this.errors);
98143
98143
  }
98144
98144
  }
98145
98145
  function createThrowableError(errors) {
@@ -98178,7 +98178,7 @@ function validSchemaResponse() {
98178
98178
  return ok$2(true);
98179
98179
  }
98180
98180
  function invalidSchemaResponseWithError(error) {
98181
- return err$2([error]);
98181
+ return err$1([error]);
98182
98182
  }
98183
98183
  function validateJsonSchema(data, schema, path = "$", document = schema) {
98184
98184
  if (schema === true) return validSchemaResponse();
@@ -98877,7 +98877,7 @@ function extractValue(valueNode, variableDefinitions, expectedType) {
98877
98877
  function extractVariableValue(variableName, variableDefinitions) {
98878
98878
  const variable = variableDefinitions[variableName];
98879
98879
  if (!variable) {
98880
- return err$4(
98880
+ return err$3(
98881
98881
  new Error(`Variable '${variableName}' was used in the query but was not defined`)
98882
98882
  );
98883
98883
  }
@@ -98897,7 +98897,7 @@ function validateExpectedType(value, expectedType) {
98897
98897
  if (expectedType.nullable) {
98898
98898
  return ok$4(value);
98899
98899
  } else {
98900
- return err$4(new Error(`Expected ${expectedType.type}, but got null`));
98900
+ return err$3(new Error(`Expected ${expectedType.type}, but got null`));
98901
98901
  }
98902
98902
  }
98903
98903
  const actualType = typeof value;
@@ -98905,7 +98905,7 @@ function validateExpectedType(value, expectedType) {
98905
98905
  return ok$4(value);
98906
98906
  }
98907
98907
  const expectedTypeString = expectedType.nullable ? `${expectedType.type} | null` : expectedType.type;
98908
- return err$4(
98908
+ return err$3(
98909
98909
  new Error(`Expected ${expectedTypeString}, but got ${actualType}: ${JSON.stringify(value)}`)
98910
98910
  );
98911
98911
  }
@@ -98948,7 +98948,7 @@ function findExecutableOperation(input) {
98948
98948
  (def) => def.kind === Kind.OPERATION_DEFINITION
98949
98949
  );
98950
98950
  if (operations.length === 0) {
98951
- return err$4(new Error("No operations found in query"));
98951
+ return err$3(new Error("No operations found in query"));
98952
98952
  }
98953
98953
  if (operations.length === 1 && !input.operationName) {
98954
98954
  return ok$4(operations[0]);
@@ -98961,14 +98961,14 @@ function findExecutableOperation(input) {
98961
98961
  if (specifiedOperation) {
98962
98962
  return ok$4(specifiedOperation);
98963
98963
  }
98964
- return err$4(new Error(`Operation "${input.operationName}" not found in query`));
98964
+ return err$3(new Error(`Operation "${input.operationName}" not found in query`));
98965
98965
  }
98966
- return err$4(new Error("Multiple operations found in query, and no operation name provided"));
98966
+ return err$3(new Error("Multiple operations found in query, and no operation name provided"));
98967
98967
  }
98968
98968
  function buildGraphQLInputExtension(input) {
98969
98969
  const operationResult = findExecutableOperation(input);
98970
98970
  if (operationResult.isErr()) {
98971
- return err$4(operationResult.error);
98971
+ return err$3(operationResult.error);
98972
98972
  }
98973
98973
  const operation = operationResult.value;
98974
98974
  const selections = operation.selectionSet.selections;
@@ -99049,7 +99049,7 @@ function buildFieldKey(canonicalFieldName, fieldArguments, variables) {
99049
99049
  for (const arg of fieldArguments) {
99050
99050
  const result = extractValue(arg.value, variables);
99051
99051
  if (result.isErr()) {
99052
- return err$4(
99052
+ return err$3(
99053
99053
  new Error(
99054
99054
  `Failed to extract argument '${arg.name.value}' for field '${canonicalFieldName}': ${result.error.message}`
99055
99055
  )
@@ -99063,11 +99063,11 @@ function extractIfArgument(directive, variables, directiveName) {
99063
99063
  var _a;
99064
99064
  const ifArg = (_a = directive.arguments) == null ? void 0 : _a.find((arg) => arg.name.value === "if");
99065
99065
  if (!ifArg) {
99066
- return err$4(new Error(`@${directiveName} directive requires an 'if' argument`));
99066
+ return err$3(new Error(`@${directiveName} directive requires an 'if' argument`));
99067
99067
  }
99068
99068
  const result = extractValue(ifArg.value, variables, { type: "boolean", nullable: false });
99069
99069
  if (result.isErr()) {
99070
- return err$4(result.error);
99070
+ return err$3(result.error);
99071
99071
  }
99072
99072
  return ok$4(result.value);
99073
99073
  }
@@ -99107,7 +99107,7 @@ class BaseScalarFieldDef {
99107
99107
  }
99108
99108
  if (input.data === null) {
99109
99109
  if (!this.nullable) {
99110
- return err$4([
99110
+ return err$3([
99111
99111
  {
99112
99112
  type: "unknown",
99113
99113
  error: new Error(
@@ -99150,7 +99150,7 @@ class BaseArrayFieldDef {
99150
99150
  }
99151
99151
  if (input.data === null) {
99152
99152
  if (!this.nullable) {
99153
- return err$4([
99153
+ return err$3([
99154
99154
  {
99155
99155
  type: "unknown",
99156
99156
  error: new Error(
@@ -99162,7 +99162,7 @@ class BaseArrayFieldDef {
99162
99162
  return ok$4({ type: "data", data: input.data });
99163
99163
  }
99164
99164
  if (!Array.isArray(input.data)) {
99165
- return err$4([
99165
+ return err$3([
99166
99166
  {
99167
99167
  type: "unknown",
99168
99168
  error: new Error(
@@ -99190,7 +99190,7 @@ class BaseArrayFieldDef {
99190
99190
  }
99191
99191
  });
99192
99192
  if (arrayNormalizationErrors.length > 0) {
99193
- return err$4(arrayNormalizationErrors);
99193
+ return err$3(arrayNormalizationErrors);
99194
99194
  }
99195
99195
  return ok$4({ type: "data", data: normalizedArray });
99196
99196
  }
@@ -99201,7 +99201,7 @@ class BaseArrayFieldDef {
99201
99201
  }
99202
99202
  if (normalizedData.data === null) {
99203
99203
  if (!this.nullable) {
99204
- return err$4([
99204
+ return err$3([
99205
99205
  {
99206
99206
  type: "unknown",
99207
99207
  error: new Error(
@@ -99213,7 +99213,7 @@ class BaseArrayFieldDef {
99213
99213
  return ok$4({ type: "data", data: null });
99214
99214
  }
99215
99215
  if (!Array.isArray(normalizedData.data)) {
99216
- return err$4([
99216
+ return err$3([
99217
99217
  {
99218
99218
  type: "unknown",
99219
99219
  error: new Error(
@@ -99238,7 +99238,7 @@ class BaseArrayFieldDef {
99238
99238
  }
99239
99239
  });
99240
99240
  if (arrayDenormalizationErrors.length > 0) {
99241
- return err$4(arrayDenormalizationErrors);
99241
+ return err$3(arrayDenormalizationErrors);
99242
99242
  }
99243
99243
  return ok$4(denormalizedArray);
99244
99244
  }
@@ -99257,7 +99257,7 @@ class BaseObjectFieldDef {
99257
99257
  write(cache, input) {
99258
99258
  var _a;
99259
99259
  if (!input.selection.selectionSet) {
99260
- return err$4([
99260
+ return err$3([
99261
99261
  {
99262
99262
  type: "unknown",
99263
99263
  error: new Error(
@@ -99271,7 +99271,7 @@ class BaseObjectFieldDef {
99271
99271
  }
99272
99272
  if (input.data === null) {
99273
99273
  if (!this.nullable) {
99274
- return err$4([
99274
+ return err$3([
99275
99275
  {
99276
99276
  type: "unknown",
99277
99277
  error: new Error(
@@ -99298,7 +99298,7 @@ class BaseObjectFieldDef {
99298
99298
  read(cache, input) {
99299
99299
  var _a;
99300
99300
  if (!input.selection.selectionSet) {
99301
- return err$4([
99301
+ return err$3([
99302
99302
  {
99303
99303
  type: "unknown",
99304
99304
  error: new Error(
@@ -99313,7 +99313,7 @@ class BaseObjectFieldDef {
99313
99313
  }
99314
99314
  if (normalizedData.data === null) {
99315
99315
  if (!this.nullable) {
99316
- return err$4([
99316
+ return err$3([
99317
99317
  {
99318
99318
  type: "unknown",
99319
99319
  error: new Error(
@@ -99604,7 +99604,7 @@ class BaseGraphQLTypeRepository {
99604
99604
  var _a;
99605
99605
  const fieldDef = this.getFieldDef(input, selection);
99606
99606
  if (!fieldDef) {
99607
- return err$4(
99607
+ return err$3(
99608
99608
  new Error(
99609
99609
  `Unknown field "${selection.name.value}" on type "${this.typeName}". Expected one of fields ${Object.keys(this.fields)}.`
99610
99610
  )
@@ -99615,7 +99615,7 @@ class BaseGraphQLTypeRepository {
99615
99615
  input.request.definitions.variables
99616
99616
  );
99617
99617
  if (cacheFieldKeyResult.isErr()) {
99618
- return err$4(cacheFieldKeyResult.error);
99618
+ return err$3(cacheFieldKeyResult.error);
99619
99619
  }
99620
99620
  const cacheFieldKey = cacheFieldKeyResult.value;
99621
99621
  return ok$4((_a = input.existingNormalizedData || input.normalizedData) == null ? void 0 : _a[cacheFieldKey]);
@@ -99797,7 +99797,7 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
99797
99797
  const key = this.buildKey(this.buildKeyParams(input));
99798
99798
  const normalized = this.normalizeData(cache, input);
99799
99799
  if (normalized.isErr()) {
99800
- return err$4(normalized.error);
99800
+ return err$3(normalized.error);
99801
99801
  }
99802
99802
  const existing = cache.get(key);
99803
99803
  if (!deepEquals$2(existing == null ? void 0 : existing.value, normalized.value)) {
@@ -99886,7 +99886,7 @@ class GraphQLDocumentRootTypeRepository extends IdentifiableGraphQLTypeRepositor
99886
99886
  var _a;
99887
99887
  const operationResult = findExecutableOperation(input);
99888
99888
  if (operationResult.isErr()) {
99889
- return err$4(operationResult.error);
99889
+ return err$3(operationResult.error);
99890
99890
  }
99891
99891
  const operation = operationResult.value;
99892
99892
  const fragmentDefinitions = input.query.definitions.filter(
@@ -99944,7 +99944,7 @@ class BaseUnionRepository {
99944
99944
  }
99945
99945
  write(cache, input) {
99946
99946
  if (typeof input.data !== "object") {
99947
- return err$4([
99947
+ return err$3([
99948
99948
  {
99949
99949
  type: "unknown",
99950
99950
  error: new Error(`Got a non-object value for ${this.typeName} field"`)
@@ -99954,7 +99954,7 @@ class BaseUnionRepository {
99954
99954
  const discriminator = this.getTypeDiscriminator(input.data, input.selections);
99955
99955
  const concreteTypeRepository = this.possibleTypes[discriminator];
99956
99956
  if (!concreteTypeRepository) {
99957
- return err$4([
99957
+ return err$3([
99958
99958
  {
99959
99959
  type: "unknown",
99960
99960
  error: new Error(
@@ -99965,7 +99965,7 @@ class BaseUnionRepository {
99965
99965
  }
99966
99966
  const selectionErr = this.verifyUnionFields(input.selections);
99967
99967
  if (selectionErr) {
99968
- return err$4(selectionErr);
99968
+ return err$3(selectionErr);
99969
99969
  }
99970
99970
  const normalizeInput = {
99971
99971
  ...input,
@@ -99984,7 +99984,7 @@ class BaseUnionRepository {
99984
99984
  read(cache, input) {
99985
99985
  const unionRep = input.normalizedData;
99986
99986
  if (typeof unionRep.data !== "object" || unionRep.data === null) {
99987
- return err$4([
99987
+ return err$3([
99988
99988
  {
99989
99989
  type: "unknown",
99990
99990
  error: new Error(`Got a non-object value for ${this.typeName} field.`)
@@ -99994,7 +99994,7 @@ class BaseUnionRepository {
99994
99994
  const discriminator = unionRep.discriminator;
99995
99995
  const concreteRepository = this.possibleTypes[discriminator];
99996
99996
  if (!concreteRepository) {
99997
- return err$4([
99997
+ return err$3([
99998
99998
  {
99999
99999
  type: "unknown",
100000
100000
  error: new Error(
@@ -100005,7 +100005,7 @@ class BaseUnionRepository {
100005
100005
  }
100006
100006
  const selectionErr = this.verifyUnionFields(input.selections);
100007
100007
  if (selectionErr) {
100008
- return err$4(selectionErr);
100008
+ return err$3(selectionErr);
100009
100009
  }
100010
100010
  const denormalizeInput = {
100011
100011
  ...input,
@@ -100142,19 +100142,7 @@ let Ok$1 = class Ok {
100142
100142
  return !this.isOk();
100143
100143
  }
100144
100144
  };
100145
- let Err$1 = class Err {
100146
- constructor(error) {
100147
- this.error = error;
100148
- }
100149
- isOk() {
100150
- return false;
100151
- }
100152
- isErr() {
100153
- return !this.isOk();
100154
- }
100155
- };
100156
100145
  const ok$1 = (value) => new Ok$1(value);
100157
- const err$1 = (err2) => new Err$1(err2);
100158
100146
  function isSubscribableResult(x) {
100159
100147
  if (typeof x !== "object" || x === null) {
100160
100148
  return false;
@@ -100287,41 +100275,50 @@ class CommandWireAdapterConstructor {
100287
100275
  if (result === void 0) {
100288
100276
  this.callback({ data: void 0, error: void 0 });
100289
100277
  } else {
100290
- if (result.isErr()) {
100291
- this.callback({
100292
- data: void 0,
100293
- error: result.error
100294
- });
100295
- return;
100296
- }
100297
- if (isSubscribableResult(result)) {
100298
- deepFreeze(result.value.data);
100299
- if (this.exposeRefresh) {
100300
- this.callback({
100301
- data: result.value.data,
100302
- error: void 0,
100303
- refresh: () => {
100304
- return result.value.refresh().then((res) => {
100305
- if (res.isOk()) {
100306
- return ok$1(void 0);
100307
- }
100308
- throw res.error;
100309
- });
100278
+ const consumerEmittedRefresh = () => {
100279
+ if (!this.refresh) {
100280
+ return Promise.resolve();
100281
+ }
100282
+ return new Promise((resolve, reject) => {
100283
+ if (!this.refresh) {
100284
+ resolve();
100285
+ return;
100286
+ }
100287
+ this.refresh().then((res) => {
100288
+ if (res.isOk()) {
100289
+ resolve();
100290
+ } else {
100291
+ reject(
100292
+ new Error(
100293
+ "Internal error in Lightning Data Service adapter occurred: Failed to refresh data"
100294
+ )
100295
+ );
100310
100296
  }
100311
100297
  });
100298
+ });
100299
+ };
100300
+ let consumerEmittedData = {
100301
+ data: void 0,
100302
+ error: void 0
100303
+ };
100304
+ if (this.exposeRefresh && this.refresh) {
100305
+ consumerEmittedData.refresh = consumerEmittedRefresh;
100306
+ }
100307
+ if (result.isErr()) {
100308
+ consumerEmittedData.error = result.error;
100309
+ } else {
100310
+ if (isSubscribableResult(result)) {
100311
+ deepFreeze(result.value.data);
100312
+ consumerEmittedData.data = result.value.data;
100312
100313
  } else {
100313
- this.callback({ data: result.value.data, error: void 0 });
100314
+ deepFreeze(result.value);
100315
+ consumerEmittedData.data = result.value;
100314
100316
  }
100315
- return;
100316
100317
  }
100317
- deepFreeze(result.value);
100318
- this.callback({
100319
- data: result.value,
100320
- error: void 0
100321
- });
100318
+ this.callback(consumerEmittedData);
100322
100319
  }
100323
100320
  } catch (e) {
100324
- emitError(this.callback, e);
100321
+ this.handleExecutionThrow(e);
100325
100322
  }
100326
100323
  }
100327
100324
  invokeAdapter() {
@@ -100331,11 +100328,11 @@ class CommandWireAdapterConstructor {
100331
100328
  if (this.configSchema) {
100332
100329
  try {
100333
100330
  assertIsValid(this.config, this.configSchema);
100334
- } catch (err2) {
100335
- if (isIncompleteConfigError(err2)) {
100331
+ } catch (err) {
100332
+ if (isIncompleteConfigError(err)) {
100336
100333
  return;
100337
100334
  }
100338
- throw err2;
100335
+ throw err;
100339
100336
  }
100340
100337
  }
100341
100338
  const initialConfig = this.config;
@@ -100345,10 +100342,10 @@ class CommandWireAdapterConstructor {
100345
100342
  if (!this.connected || this.config !== initialConfig) {
100346
100343
  return;
100347
100344
  }
100348
- this.emit(result);
100345
+ this.refresh = void 0;
100349
100346
  if (result.isOk()) {
100350
- const value = result.value;
100351
- if (typeof value === "object" && value !== null && "subscribe" in value) {
100347
+ if (isSubscribableResult(result)) {
100348
+ const value = result.value;
100352
100349
  this.unsubscriber = value.subscribe((updatedResult) => {
100353
100350
  if (!this.connected || this.config !== initialConfig) {
100354
100351
  this.unsubscribe();
@@ -100356,10 +100353,15 @@ class CommandWireAdapterConstructor {
100356
100353
  }
100357
100354
  this.emit(updatedResult);
100358
100355
  });
100356
+ this.refresh = value.refresh;
100357
+ this.emit(ok$1(value.data));
100358
+ } else {
100359
+ this.emit(result);
100359
100360
  }
100360
100361
  } else {
100361
100362
  this.unsubscriber = () => {
100362
100363
  };
100364
+ this.emit(result);
100363
100365
  }
100364
100366
  });
100365
100367
  } catch (e) {
@@ -100376,87 +100378,76 @@ class CommandWireAdapterConstructor {
100376
100378
  }
100377
100379
  }
100378
100380
  }
100379
- function isIncompleteConfigError(err2) {
100380
- return err2 instanceof MissingRequiredPropertyError || err2 instanceof JsonSchemaViolationError && err2.validationErrors.find(
100381
+ function isIncompleteConfigError(err) {
100382
+ return err instanceof MissingRequiredPropertyError || err instanceof JsonSchemaViolationError && err.validationErrors.find(
100381
100383
  (validationError) => validationError instanceof MissingRequiredPropertyError
100382
100384
  ) !== void 0;
100383
100385
  }
100384
- function emitGraphQLResult(callback, result) {
100385
- if (result.isErr()) {
100386
- logError(result.error);
100387
- if (isUserVisibleError(result.error)) {
100388
- callback({
100389
- data: result.error.data.data,
100390
- errors: result.error.data.errors
100391
- });
100392
- return;
100393
- }
100394
- callback({
100395
- data: void 0,
100396
- errors: [{ message: "Internal error in GraphQL adapter occurred", locations: [] }]
100397
- });
100398
- return;
100399
- }
100400
- if ("subscribe" in result.value) {
100401
- callback(formatGraphQLData(result.value.data));
100402
- return;
100403
- }
100404
- callback(formatGraphQLData(result.value));
100405
- }
100406
- function resolveAst(ast) {
100407
- const result = astResolver(ast);
100408
- if (result === void 0) {
100409
- throw new Error("Could not resolve AST. Did you parse the query with gql?");
100410
- }
100411
- return result;
100412
- }
100413
- function formatGraphQLData(data) {
100414
- if (data.errors === void 0 || data.errors.length === 0) {
100415
- return {
100416
- data: data.data,
100417
- errors: void 0
100418
- };
100419
- }
100420
- return {
100421
- data: data.data,
100422
- errors: data.errors
100423
- };
100424
- }
100425
100386
  class GraphQLCommandWireAdapterConstructor extends CommandWireAdapterConstructor {
100426
100387
  emit(result) {
100427
100388
  try {
100428
100389
  if (result === void 0) {
100429
100390
  this.callback({ data: void 0, errors: void 0 });
100430
100391
  } else {
100431
- if (result.isErr()) {
100432
- emitGraphQLResult(this.callback, result);
100433
- return;
100434
- }
100435
- const userEmittedData = {
100436
- ...result.value.data
100437
- };
100438
- if (this.exposeRefresh) {
100439
- userEmittedData.refresh = () => {
100440
- return result.value.refresh().then((res) => {
100392
+ const consumerEmittedRefresh = () => {
100393
+ if (!this.refresh) {
100394
+ return Promise.resolve();
100395
+ }
100396
+ return new Promise((resolve, reject) => {
100397
+ if (!this.refresh) {
100398
+ resolve();
100399
+ return;
100400
+ }
100401
+ this.refresh().then((res) => {
100441
100402
  if (res.isOk()) {
100442
- return;
100403
+ resolve();
100404
+ } else {
100405
+ reject(
100406
+ new Error(
100407
+ "Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data"
100408
+ )
100409
+ );
100443
100410
  }
100444
- throw new Error(
100445
- "Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data"
100446
- );
100447
100411
  });
100448
- };
100412
+ });
100413
+ };
100414
+ let consumerEmittedData = {
100415
+ data: void 0,
100416
+ errors: void 0
100417
+ };
100418
+ if (this.exposeRefresh && this.refresh) {
100419
+ consumerEmittedData.refresh = consumerEmittedRefresh;
100449
100420
  }
100450
- deepFreeze(userEmittedData);
100451
- this.callback(userEmittedData);
100452
- return;
100421
+ if (result.isErr()) {
100422
+ logError(result.error);
100423
+ if (isUserVisibleError(result.error)) {
100424
+ consumerEmittedData.data = result.error.data.data;
100425
+ consumerEmittedData.errors = result.error.data.errors;
100426
+ } else {
100427
+ consumerEmittedData.errors = [
100428
+ {
100429
+ message: "Internal error in GraphQL adapter occurred",
100430
+ locations: []
100431
+ }
100432
+ ];
100433
+ }
100434
+ } else {
100435
+ consumerEmittedData.data = result.value.data;
100436
+ }
100437
+ deepFreeze(consumerEmittedData);
100438
+ this.callback(consumerEmittedData);
100453
100439
  }
100454
100440
  } catch (e) {
100455
- emitGraphQLResult(this.callback, err$1(e));
100441
+ logError(e);
100442
+ this.handleExecutionThrow(e);
100456
100443
  }
100457
100444
  }
100458
100445
  handleExecutionThrow(e) {
100459
- emitGraphQLResult(this.callback, err$1(e));
100446
+ logError(e);
100447
+ this.callback({
100448
+ data: void 0,
100449
+ errors: [{ message: "Internal error in GraphQL adapter occurred", locations: [] }]
100450
+ });
100460
100451
  }
100461
100452
  update(config, _context) {
100462
100453
  this.unsubscribe();
@@ -100473,12 +100464,31 @@ function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100473
100464
  try {
100474
100465
  const overrides = requestContextIsCachePolicy(requestContext) ? { cacheControlConfig: { type: "no-cache" } } : {};
100475
100466
  const result = await command.execute(overrides);
100467
+ const consumerEmittedData = {
100468
+ data: void 0,
100469
+ errors: void 0
100470
+ };
100476
100471
  if (result.isOk()) {
100477
100472
  deepFreeze(result.value);
100473
+ consumerEmittedData.data = result.value.data.data;
100474
+ } else {
100475
+ if (isUserVisibleError(result.error)) {
100476
+ consumerEmittedData.data = result.error.data.data;
100477
+ consumerEmittedData.errors = result.error.data.errors;
100478
+ } else {
100479
+ logError(result.error);
100480
+ consumerEmittedData.errors = [
100481
+ { message: "Internal error in GraphQL adapter occurred", locations: [] }
100482
+ ];
100483
+ }
100478
100484
  }
100479
- emitGraphQLResult(callback, result);
100485
+ callback(consumerEmittedData);
100480
100486
  } catch (error) {
100481
- emitGraphQLResult(callback, err$1(error));
100487
+ logError(error);
100488
+ callback({
100489
+ data: void 0,
100490
+ errors: [{ message: "Internal error in GraphQL adapter occurred", locations: [] }]
100491
+ });
100482
100492
  }
100483
100493
  };
100484
100494
  const subscribe = (config, requestContext, callback) => {
@@ -100487,14 +100497,51 @@ function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100487
100497
  };
100488
100498
  const overrides = requestContextIsCachePolicy(requestContext) ? { cacheControlConfig: { type: "no-cache" } } : {};
100489
100499
  command.execute(overrides).then((result) => {
100490
- if (!result.isOk()) {
100491
- emitGraphQLResult(callback, result);
100492
- return;
100500
+ const consumerEmittedData = {
100501
+ data: void 0,
100502
+ errors: void 0
100503
+ };
100504
+ if (result.isOk()) {
100505
+ deepFreeze(result.value);
100506
+ consumerEmittedData.data = result.value.data.data;
100507
+ unsubscribe = result.value.subscribe((res) => {
100508
+ const consumerEmittedData2 = {
100509
+ data: void 0,
100510
+ errors: void 0
100511
+ };
100512
+ if (res.isOk()) {
100513
+ consumerEmittedData2.data = res.value.data;
100514
+ } else {
100515
+ if (isUserVisibleError(res.error)) {
100516
+ consumerEmittedData2.data = res.error.data.data;
100517
+ consumerEmittedData2.errors = res.error.data.errors;
100518
+ } else {
100519
+ logError(res.error);
100520
+ consumerEmittedData2.errors = [
100521
+ {
100522
+ message: "Internal error in GraphQL adapter occurred",
100523
+ locations: []
100524
+ }
100525
+ ];
100526
+ }
100527
+ }
100528
+ callback(consumerEmittedData2);
100529
+ });
100530
+ } else {
100531
+ if (isUserVisibleError(result.error)) {
100532
+ consumerEmittedData.data = result.error.data.data;
100533
+ consumerEmittedData.errors = result.error.data.errors;
100534
+ } else {
100535
+ logError(result.error);
100536
+ consumerEmittedData.errors = [
100537
+ {
100538
+ message: "Internal error in GraphQL adapter occurred",
100539
+ locations: []
100540
+ }
100541
+ ];
100542
+ }
100493
100543
  }
100494
- unsubscribe = result.value.subscribe((res) => {
100495
- emitGraphQLResult(callback, res);
100496
- });
100497
- emitGraphQLResult(callback, result);
100544
+ callback(consumerEmittedData);
100498
100545
  });
100499
100546
  return () => {
100500
100547
  unsubscribe();
@@ -100505,7 +100552,14 @@ function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100505
100552
  function requestContextIsCachePolicy(requestContext) {
100506
100553
  return typeof requestContext === "object" && requestContext !== null && "cachePolicy" in requestContext && typeof requestContext.cachePolicy === "object" && requestContext.cachePolicy !== null && "type" in requestContext.cachePolicy && requestContext.cachePolicy.type === "no-cache";
100507
100554
  }
100508
- // version: 1.379.0-a57c798add
100555
+ function resolveAst(ast) {
100556
+ const result = astResolver(ast);
100557
+ if (result === void 0) {
100558
+ throw new Error("Could not resolve AST. Did you parse the query with gql?");
100559
+ }
100560
+ return result;
100561
+ }
100562
+ // version: 1.380.0-dev1-b7c5fad9db
100509
100563
 
100510
100564
  class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
100511
100565
  constructor(services, typeRegistry) {
@@ -103570,14 +103624,10 @@ class RecordQueryAggregateRepository extends RecordQueryAggregateRepository$1 {
103570
103624
  // we'll match the luvio behavior of returning the blob
103571
103625
  const blobTypeDef = {
103572
103626
  read: (_cache, input) => {
103573
- return ok({
103574
- data: input.normalizedData,
103575
- });
103627
+ return ok(input.normalizedData);
103576
103628
  },
103577
103629
  write: (_cache, input) => {
103578
- return ok({
103579
- data: input.data,
103580
- });
103630
+ return ok(input.data);
103581
103631
  },
103582
103632
  buildFieldKey: (selection, variables) => buildFieldKey(selection.name.value, selection.arguments, variables),
103583
103633
  augmentSelections: (input) => input,
@@ -104233,7 +104283,9 @@ function buildCommandClass(baseClass) {
104233
104283
  try {
104234
104284
  const luvioService = this.services.luvio;
104235
104285
  const luvioInstance = luvioService.luvio;
104236
- // Subscribe to changes using the stored snapshot
104286
+ if (this.unsubscribeFromLuvioSnapshot) {
104287
+ this.unsubscribeFromLuvioSnapshot();
104288
+ }
104237
104289
  this.unsubscribeFromLuvioSnapshot = luvioInstance.storeSubscribe(this.latestLuvioSnapshot, (_) => {
104238
104290
  // If any records used change at the top level, refresh all the data
104239
104291
  if (this.usedRecordsChanged()) {
@@ -104364,7 +104416,7 @@ function registerCallback(cb) {
104364
104416
  cb(graphql$1, graphql_imperative$1, useOneStoreGraphQL);
104365
104417
  }
104366
104418
  }
104367
- // version: 1.379.0-a57c798add
104419
+ // version: 1.380.0-dev1-b7c5fad9db
104368
104420
 
104369
104421
  function createFragmentMap(documentNode) {
104370
104422
  const fragments = {};
@@ -130859,7 +130911,7 @@ function refreshGraphQL(data) {
130859
130911
  }
130860
130912
  return refresh$3(data, 'refreshUiApi');
130861
130913
  }
130862
- // version: 1.379.0-a57c798add
130914
+ // version: 1.380.0-dev1-b7c5fad9db
130863
130915
 
130864
130916
  // On core the unstable adapters are re-exported with different names,
130865
130917
  // we want to match them here.
@@ -131011,7 +131063,7 @@ withDefaultLuvio((luvio) => {
131011
131063
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
131012
131064
  graphQLImperative = ldsAdapter;
131013
131065
  });
131014
- // version: 1.379.0-a57c798add
131066
+ // version: 1.380.0-dev1-b7c5fad9db
131015
131067
 
131016
131068
  var gqlApi = /*#__PURE__*/Object.freeze({
131017
131069
  __proto__: null,
@@ -131810,7 +131862,7 @@ const callbacks$1 = [];
131810
131862
  function register(r) {
131811
131863
  callbacks$1.forEach((callback) => callback(r));
131812
131864
  }
131813
- // version: 1.379.0-fc97fd9203
131865
+ // version: 1.380.0-dev1-4b44b915b4
131814
131866
 
131815
131867
  /**
131816
131868
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -133126,4 +133178,4 @@ const { luvio } = getRuntime();
133126
133178
  setDefaultLuvio({ luvio });
133127
133179
 
133128
133180
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
133129
- // version: 1.379.0-fc97fd9203
133181
+ // version: 1.380.0-dev1-4b44b915b4