@salesforce/lds-worker-api 1.382.0 → 1.384.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.
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
4274
4274
  }
4275
4275
  callbacks.push(callback);
4276
4276
  }
4277
- // version: 1.382.0-8ca71123b0
4277
+ // version: 1.384.0-cb845692ac
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.382.0-8ca71123b0
5321
+ // version: 1.384.0-cb845692ac
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.382.0-73d929ea11
34157
+ // version: 1.384.0-835fd13f44
34158
34158
 
34159
34159
  function requestIdleDetectedCallback(_callback) { }
34160
34160
  function declareNotifierTaskSingle(_name) {
@@ -81030,6 +81030,16 @@ function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRe
81030
81030
  ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
81031
81031
  ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
81032
81032
  }
81033
+ /** One Store Cache Purge */
81034
+ const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
81035
+ const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
81036
+ function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
81037
+ ldsMobileInstrumentation$2.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
81038
+ }
81039
+ function reportOneStoreCachePurgingError(error) {
81040
+ const errorMessage = normalizeError$1(error);
81041
+ ldsMobileInstrumentation$2.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
81042
+ }
81033
81043
 
81034
81044
  const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
81035
81045
  class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
@@ -94268,7 +94278,7 @@ class CacheControlRequestRunner {
94268
94278
  }
94269
94279
  requestFromNetwork() {
94270
94280
  const that = this;
94271
- return async function* () {
94281
+ return (async function* () {
94272
94282
  const result = await that.requestFromNetworkInternal();
94273
94283
  if (result.isErr()) {
94274
94284
  that.networkError = result;
@@ -94276,7 +94286,7 @@ class CacheControlRequestRunner {
94276
94286
  that.networkData = result;
94277
94287
  }
94278
94288
  yield result;
94279
- }();
94289
+ })();
94280
94290
  }
94281
94291
  writeToCache(cache, networkResult) {
94282
94292
  return this.writeToCacheInternal(cache, networkResult);
@@ -95881,7 +95891,7 @@ function buildServiceDescriptor$5(luvio) {
95881
95891
  },
95882
95892
  };
95883
95893
  }
95884
- // version: 1.382.0-73d929ea11
95894
+ // version: 1.384.0-835fd13f44
95885
95895
 
95886
95896
  /**
95887
95897
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -95907,7 +95917,7 @@ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvi
95907
95917
  },
95908
95918
  };
95909
95919
  }
95910
- // version: 1.382.0-73d929ea11
95920
+ // version: 1.384.0-835fd13f44
95911
95921
 
95912
95922
  /*!
95913
95923
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96752,7 +96762,7 @@ function hasMultilineItems(maybeArray) {
96752
96762
  * All rights reserved.
96753
96763
  * For full license text, see the LICENSE.txt file
96754
96764
  */
96755
- function findExecutableOperation$1(input) {
96765
+ function findExecutableOperation$2(input) {
96756
96766
  const operations = input.query.definitions.filter(
96757
96767
  (def) => def.kind === Kind$2.OPERATION_DEFINITION
96758
96768
  );
@@ -96775,7 +96785,7 @@ function findExecutableOperation$1(input) {
96775
96785
  return err$1$1(new Error("Multiple operations found in query, and no operation name provided"));
96776
96786
  }
96777
96787
  function buildGraphQLInputExtension$1(input) {
96778
- const operationResult = findExecutableOperation$1(input);
96788
+ const operationResult = findExecutableOperation$2(input);
96779
96789
  if (operationResult.isErr()) {
96780
96790
  return err$1$1(operationResult.error);
96781
96791
  }
@@ -96790,7 +96800,7 @@ function buildGraphQLInputExtension$1(input) {
96790
96800
  };
96791
96801
  return prev;
96792
96802
  }, {})) || {};
96793
- const fragments = input.query.definitions.filter((def) => def.kind === "FragmentDefinition").reduce((prev, fragment) => {
96803
+ const fragments = input.query.definitions.filter(isFragmentDefinition$1).reduce((prev, fragment) => {
96794
96804
  prev[fragment.name.value] = fragment;
96795
96805
  return prev;
96796
96806
  }, {});
@@ -96800,6 +96810,47 @@ function buildGraphQLInputExtension$1(input) {
96800
96810
  parentFieldSelection: void 0
96801
96811
  });
96802
96812
  }
96813
+ const TYPENAME_FIELD = {
96814
+ kind: Kind$2.FIELD,
96815
+ name: {
96816
+ kind: Kind$2.NAME,
96817
+ value: "__typename"
96818
+ }
96819
+ };
96820
+ function addTypenameToDocument(doc) {
96821
+ return visit(doc, {
96822
+ SelectionSet: {
96823
+ enter(node, _key, parent) {
96824
+ if (isOperationDefinition(parent)) {
96825
+ return;
96826
+ }
96827
+ const { selections } = node;
96828
+ if (!selections || selections.length === 0) {
96829
+ return;
96830
+ }
96831
+ const skip = selections.some((selection) => {
96832
+ return isField$1(selection) && (selection.name.value === "__typename" || selection.name.value.lastIndexOf("__", 0) === 0);
96833
+ });
96834
+ if (skip) {
96835
+ return;
96836
+ }
96837
+ return {
96838
+ ...node,
96839
+ selections: [...selections, TYPENAME_FIELD]
96840
+ };
96841
+ }
96842
+ }
96843
+ });
96844
+ }
96845
+ function isOperationDefinition(parent) {
96846
+ return !!parent && !Array.isArray(parent) && parent.kind === Kind$2.OPERATION_DEFINITION;
96847
+ }
96848
+ function isField$1(node) {
96849
+ return node.kind === Kind$2.FIELD;
96850
+ }
96851
+ function isFragmentDefinition$1(node) {
96852
+ return node.kind === Kind$2.FRAGMENT_DEFINITION;
96853
+ }
96803
96854
 
96804
96855
  /*!
96805
96856
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96923,7 +96974,7 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
96923
96974
  if (augmentedQueryResult.isErr()) {
96924
96975
  throw augmentedQueryResult.error;
96925
96976
  }
96926
- return augmentedQueryResult.value;
96977
+ return addTypenameToDocument(augmentedQueryResult.value);
96927
96978
  }
96928
96979
  buildWriteInput(data) {
96929
96980
  const extensionResult = buildGraphQLInputExtension$1({
@@ -97017,7 +97068,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
97017
97068
  if (augmentedQueryResult.isErr()) {
97018
97069
  throw augmentedQueryResult.error;
97019
97070
  }
97020
- return augmentedQueryResult.value;
97071
+ return addTypenameToDocument(augmentedQueryResult.value);
97021
97072
  }
97022
97073
  buildWriteInput(data) {
97023
97074
  const extensionResult = buildGraphQLInputExtension$1({
@@ -97771,6 +97822,7 @@ class NimbusSqliteOneStoreCache {
97771
97822
  }
97772
97823
  }
97773
97824
 
97825
+ const PURGE_CACHE_DAYS = 30;
97774
97826
  // TODO[@W-18753648]: These services depend on WebApis that aren't available in the worker.
97775
97827
  // import { buildServiceDescriptor as buildNdJsonServiceDescriptor } from '@luvio/command-ndjson/v1';
97776
97828
  // import { buildServiceDescriptor as buildStreamingCommandServiceDescriptor } from '@luvio/command-streaming/v1';
@@ -97819,6 +97871,48 @@ function initializeOneStore(sqliteStore) {
97819
97871
  // buildSseCommandServiceDescriptor(),
97820
97872
  ];
97821
97873
  setServices(services);
97874
+ purgeDurableCacheByDays(PURGE_CACHE_DAYS, sqliteStore);
97875
+ }
97876
+ /**
97877
+ * Manually purges the OneStore cache by days.
97878
+ * Until we have real cache eviction in one store.
97879
+ *
97880
+ * @param days - The number of days to purge the cache by.
97881
+ * @param sqliteStore - The SqliteStorePlugin to purge the cache from.
97882
+ */
97883
+ async function purgeDurableCacheByDays(days, sqliteStore) {
97884
+ const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
97885
+ const cutoffTimestamp = Date.now() - days * MILLISECONDS_PER_DAY;
97886
+ try {
97887
+ // This has to be ran in a SELECT since the DELETE query may not support return on SQLite version in mobile
97888
+ const countQuery = `
97889
+ SELECT COUNT(*) FROM lds_one_store_data
97890
+ WHERE json_extract(metadata, '$.cacheControl.generatedTime') < ?
97891
+ `;
97892
+ const countResult = await queryAsync(sqliteStore, countQuery, [cutoffTimestamp]);
97893
+ const deleteCount = countResult.rows[0][0];
97894
+ if (deleteCount === 0) {
97895
+ reportOneStoreRecordsPurgedFromCache(0);
97896
+ return;
97897
+ }
97898
+ const deleteQuery = `
97899
+ DELETE FROM lds_one_store_data
97900
+ WHERE json_extract(metadata, '$.cacheControl.generatedTime') < ?
97901
+ `;
97902
+ await queryAsync(sqliteStore, deleteQuery, [cutoffTimestamp]);
97903
+ reportOneStoreRecordsPurgedFromCache(deleteCount);
97904
+ }
97905
+ catch (error) {
97906
+ reportOneStoreCachePurgingError(error);
97907
+ }
97908
+ }
97909
+ /**
97910
+ * Promisified wrapper for SqliteStorePlugin.query
97911
+ */
97912
+ function queryAsync(sqliteStore, sql, params) {
97913
+ return new Promise((resolve, reject) => {
97914
+ sqliteStore.query(sql, params, (result) => resolve(result), (error) => reject(error));
97915
+ });
97822
97916
  }
97823
97917
 
97824
97918
  // so eslint doesn't complain about nimbus
@@ -98023,7 +98117,7 @@ register$1({
98023
98117
  id: '@salesforce/lds-network-adapter',
98024
98118
  instrument: instrument$2,
98025
98119
  });
98026
- // version: 1.382.0-8ca71123b0
98120
+ // version: 1.384.0-cb845692ac
98027
98121
 
98028
98122
  const { create: create$3, keys: keys$3 } = Object;
98029
98123
  const { stringify: stringify$1, parse } = JSON;
@@ -98943,7 +99037,7 @@ function deepMerge$2(target, ...sources) {
98943
99037
  }
98944
99038
  return target;
98945
99039
  }
98946
- function findExecutableOperation(input) {
99040
+ function findExecutableOperation$1(input) {
98947
99041
  const operations = input.query.definitions.filter(
98948
99042
  (def) => def.kind === Kind.OPERATION_DEFINITION
98949
99043
  );
@@ -98966,7 +99060,7 @@ function findExecutableOperation(input) {
98966
99060
  return err$3(new Error("Multiple operations found in query, and no operation name provided"));
98967
99061
  }
98968
99062
  function buildGraphQLInputExtension(input) {
98969
- const operationResult = findExecutableOperation(input);
99063
+ const operationResult = findExecutableOperation$1(input);
98970
99064
  if (operationResult.isErr()) {
98971
99065
  return err$3(operationResult.error);
98972
99066
  }
@@ -98981,7 +99075,7 @@ function buildGraphQLInputExtension(input) {
98981
99075
  };
98982
99076
  return prev;
98983
99077
  }, {})) || {};
98984
- const fragments = input.query.definitions.filter((def) => def.kind === "FragmentDefinition").reduce((prev, fragment) => {
99078
+ const fragments = input.query.definitions.filter(isFragmentDefinition).reduce((prev, fragment) => {
98985
99079
  prev[fragment.name.value] = fragment;
98986
99080
  return prev;
98987
99081
  }, {});
@@ -98991,14 +99085,24 @@ function buildGraphQLInputExtension(input) {
98991
99085
  parentFieldSelection: void 0
98992
99086
  });
98993
99087
  }
98994
- function buildUniqueAugmentedFieldSelection(newSelection, selections, fragments) {
99088
+ function buildAugmentedFieldSelection(newSelection, selections, fragments) {
98995
99089
  var _a;
99090
+ if (selectionExists(newSelection, selections)) {
99091
+ return void 0;
99092
+ }
98996
99093
  const baseAlias = ((_a = newSelection.alias) == null ? void 0 : _a.value) || newSelection.name.value;
98997
99094
  const baseInjectedAlias = `framework_augmented_${baseAlias}`;
98998
- const fieldName = getUniqueSelectionName(baseInjectedAlias, selections, fragments);
98999
- if (fieldName === newSelection.name.value) {
99000
- return newSelection;
99095
+ const baseAliasedSelection = {
99096
+ ...newSelection,
99097
+ alias: {
99098
+ kind: Kind.NAME,
99099
+ value: baseInjectedAlias
99100
+ }
99101
+ };
99102
+ if (selectionExists(baseAliasedSelection, selections)) {
99103
+ return void 0;
99001
99104
  }
99105
+ const fieldName = getUniqueSelectionName(baseInjectedAlias, selections, fragments);
99002
99106
  return {
99003
99107
  ...newSelection,
99004
99108
  alias: {
@@ -99007,6 +99111,94 @@ function buildUniqueAugmentedFieldSelection(newSelection, selections, fragments)
99007
99111
  }
99008
99112
  };
99009
99113
  }
99114
+ function selectionExists(selection, selections) {
99115
+ return selections.some((s) => selectionEquals(selection, s));
99116
+ }
99117
+ function selectionEquals(a, b) {
99118
+ var _a, _b, _c, _d, _e, _f;
99119
+ if (a.kind !== b.kind) {
99120
+ return false;
99121
+ }
99122
+ if (a.kind === Kind.FIELD) {
99123
+ const bField = b;
99124
+ return !!(a.name.value === bField.name.value) && !!(((_a = a.alias) == null ? void 0 : _a.value) === ((_b = bField.alias) == null ? void 0 : _b.value)) && argumentsEqual(a.arguments, bField.arguments) && selectionSetsEqual((_c = a.selectionSet) == null ? void 0 : _c.selections, (_d = bField.selectionSet) == null ? void 0 : _d.selections) && directivesEqual(a.directives, bField.directives);
99125
+ }
99126
+ if (a.kind === Kind.FRAGMENT_SPREAD) {
99127
+ const bFragmentSpread = b;
99128
+ return a.name.value === bFragmentSpread.name.value && directivesEqual(a.directives, bFragmentSpread.directives);
99129
+ }
99130
+ const bInlineFragment = b;
99131
+ return a.typeCondition === bInlineFragment.typeCondition && directivesEqual(a.directives, bInlineFragment.directives) && selectionSetsEqual((_e = a.selectionSet) == null ? void 0 : _e.selections, (_f = bInlineFragment.selectionSet) == null ? void 0 : _f.selections);
99132
+ }
99133
+ function argumentValueEquals(a, b) {
99134
+ if (a.kind !== b.kind) {
99135
+ return false;
99136
+ }
99137
+ switch (a.kind) {
99138
+ case Kind.STRING:
99139
+ case Kind.INT:
99140
+ case Kind.FLOAT:
99141
+ case Kind.BOOLEAN:
99142
+ case Kind.ENUM:
99143
+ return a.value === b.value;
99144
+ case Kind.NULL:
99145
+ return true;
99146
+ case Kind.VARIABLE:
99147
+ return a.name.value === b.name.value;
99148
+ case Kind.LIST:
99149
+ const bList = b;
99150
+ if (a.values.length !== bList.values.length) {
99151
+ return false;
99152
+ }
99153
+ return a.values.every((val, index) => argumentValueEquals(val, bList.values[index]));
99154
+ case Kind.OBJECT:
99155
+ const bObject = b;
99156
+ if (a.fields.length !== bObject.fields.length) {
99157
+ return false;
99158
+ }
99159
+ return a.fields.every((field, index) => {
99160
+ const bField = bObject.fields[index];
99161
+ return field.name.value === bField.name.value && argumentValueEquals(field.value, bField.value);
99162
+ });
99163
+ default:
99164
+ return false;
99165
+ }
99166
+ }
99167
+ function directivesEqual(a, b) {
99168
+ if (a === void 0 && b === void 0) {
99169
+ return true;
99170
+ }
99171
+ if (a === void 0 || b === void 0) {
99172
+ return ((a == null ? void 0 : a.length) || 0) === ((b == null ? void 0 : b.length) || 0);
99173
+ }
99174
+ if (a.length !== b.length) {
99175
+ return false;
99176
+ }
99177
+ return a.every((directive, index) => {
99178
+ const bDirective = b[index];
99179
+ return directive.name.value === bDirective.name.value && argumentsEqual(directive.arguments, bDirective.arguments);
99180
+ });
99181
+ }
99182
+ function argumentsEqual(a, b) {
99183
+ if (a === void 0 && b === void 0) {
99184
+ return true;
99185
+ }
99186
+ if (a === void 0 || b === void 0) {
99187
+ return ((a == null ? void 0 : a.length) || 0) === ((b == null ? void 0 : b.length) || 0);
99188
+ }
99189
+ if (a.length !== b.length) {
99190
+ return false;
99191
+ }
99192
+ return a.every((arg, index) => {
99193
+ const bArg = b[index];
99194
+ return arg.name.value === bArg.name.value && argumentValueEquals(arg.value, bArg.value);
99195
+ });
99196
+ }
99197
+ function selectionSetsEqual(a, b) {
99198
+ return a === void 0 || b === void 0 || !!(a.length === b.length) && !!a.every((selection, index) => {
99199
+ return selectionEquals(selection, b[index]);
99200
+ });
99201
+ }
99010
99202
  function getUniqueSelectionName(fieldName, selections, fragments) {
99011
99203
  const fieldNames = collectFieldNames(selections, fragments);
99012
99204
  if (!fieldNames.includes(fieldName)) {
@@ -99022,14 +99214,14 @@ function collectFieldNames(selections, fragments) {
99022
99214
  var _a;
99023
99215
  const fieldNames = /* @__PURE__ */ new Set();
99024
99216
  for (const selection of selections) {
99025
- if (selection.kind === Kind.FIELD) {
99217
+ if (isField(selection)) {
99026
99218
  fieldNames.add(((_a = selection.alias) == null ? void 0 : _a.value) || selection.name.value);
99027
- } else if (selection.kind === Kind.INLINE_FRAGMENT) {
99219
+ } else if (isInlineFragment(selection)) {
99028
99220
  collectFieldNames(
99029
99221
  selection.selectionSet.selections,
99030
99222
  fragments
99031
99223
  ).forEach((name) => fieldNames.add(name));
99032
- } else if (selection.kind === Kind.FRAGMENT_SPREAD) {
99224
+ } else if (isFragmentSpread(selection)) {
99033
99225
  const fragment = fragments[selection.name.value];
99034
99226
  if (fragment) {
99035
99227
  collectFieldNames(
@@ -99059,6 +99251,25 @@ function buildFieldKey(canonicalFieldName, fieldArguments, variables) {
99059
99251
  }
99060
99252
  return ok$4(`${canonicalFieldName}::${stableJSONStringify$3({ args: formattedArguments })}`);
99061
99253
  }
99254
+ ({
99255
+ kind: Kind.FIELD,
99256
+ name: {
99257
+ kind: Kind.NAME,
99258
+ value: "__typename"
99259
+ }
99260
+ });
99261
+ function isField(node) {
99262
+ return node.kind === Kind.FIELD;
99263
+ }
99264
+ function isFragmentSpread(node) {
99265
+ return node.kind === Kind.FRAGMENT_SPREAD;
99266
+ }
99267
+ function isInlineFragment(node) {
99268
+ return node.kind === Kind.INLINE_FRAGMENT;
99269
+ }
99270
+ function isFragmentDefinition(node) {
99271
+ return node.kind === Kind.FRAGMENT_DEFINITION;
99272
+ }
99062
99273
  function extractIfArgument(directive, variables, directiveName) {
99063
99274
  var _a;
99064
99275
  const ifArg = (_a = directive.arguments) == null ? void 0 : _a.find((arg) => arg.name.value === "if");
@@ -99342,11 +99553,11 @@ class BaseGraphQLTypeRepository {
99342
99553
  const augmentedSelections = [];
99343
99554
  let augmentedFragments = { ...input.fragments };
99344
99555
  for (const selection of input.selections) {
99345
- if (selection.kind === Kind.FIELD) {
99556
+ if (isField(selection)) {
99346
99557
  const result = this.augmentFieldSelection(selection, augmentedFragments);
99347
99558
  augmentedSelections.push(...result.selections);
99348
99559
  augmentedFragments = result.fragments;
99349
- } else if (selection.kind === Kind.INLINE_FRAGMENT) {
99560
+ } else if (isInlineFragment(selection)) {
99350
99561
  const augmentedFragmentSelections = this.augmentInlineFragmentSelection(
99351
99562
  selection,
99352
99563
  augmentedFragments
@@ -99362,19 +99573,20 @@ class BaseGraphQLTypeRepository {
99362
99573
  augmentedFragments = augmentedFragmentSelections.fragments;
99363
99574
  }
99364
99575
  }
99365
- augmentedSelections.push(
99366
- buildUniqueAugmentedFieldSelection(
99367
- {
99368
- kind: Kind.FIELD,
99369
- name: {
99370
- kind: Kind.NAME,
99371
- value: "__typename"
99372
- }
99373
- },
99374
- [...augmentedSelections, ...input.selections],
99375
- augmentedFragments
99376
- )
99576
+ const newTypenameSelection = buildAugmentedFieldSelection(
99577
+ {
99578
+ kind: Kind.FIELD,
99579
+ name: {
99580
+ kind: Kind.NAME,
99581
+ value: "__typename"
99582
+ }
99583
+ },
99584
+ [...augmentedSelections, ...input.selections],
99585
+ augmentedFragments
99377
99586
  );
99587
+ if (newTypenameSelection) {
99588
+ augmentedSelections.push(newTypenameSelection);
99589
+ }
99378
99590
  return { selections: augmentedSelections, fragments: augmentedFragments };
99379
99591
  }
99380
99592
  augmentFieldSelection(selection, fragments) {
@@ -99437,21 +99649,21 @@ class BaseGraphQLTypeRepository {
99437
99649
  fragment
99438
99650
  );
99439
99651
  if (satisfiedFragmentTypeConditionResult.isErr() || !satisfiedFragmentTypeConditionResult.value) {
99440
- return { selections: [], fragments };
99652
+ return { selections: [selection], fragments };
99441
99653
  }
99442
- const augmentedFragmentSelections = this.augmentSelections({
99654
+ const augmentedFragment = this.augmentSelections({
99443
99655
  selections: ((_a = fragment.selectionSet) == null ? void 0 : _a.selections) || [],
99444
99656
  fragments
99445
99657
  });
99446
99658
  return {
99447
99659
  selections: [selection],
99448
99660
  fragments: {
99449
- ...fragments,
99661
+ ...augmentedFragment.fragments,
99450
99662
  [fragment.name.value]: {
99451
99663
  ...fragment,
99452
99664
  selectionSet: {
99453
99665
  kind: Kind.SELECTION_SET,
99454
- selections: augmentedFragmentSelections.selections
99666
+ selections: augmentedFragment.selections
99455
99667
  }
99456
99668
  }
99457
99669
  }
@@ -99461,14 +99673,14 @@ class BaseGraphQLTypeRepository {
99461
99673
  const normalized = {};
99462
99674
  const errors = [];
99463
99675
  for (const selection of input.selections) {
99464
- if (selection.kind === Kind.FIELD) {
99676
+ if (isField(selection)) {
99465
99677
  deepMerge$2(
99466
99678
  normalized,
99467
99679
  this.normalizeFieldSelection(cache, input, selection, errors)
99468
99680
  );
99469
99681
  } else {
99470
99682
  let fragment;
99471
- if (selection.kind === Kind.INLINE_FRAGMENT) {
99683
+ if (isInlineFragment(selection)) {
99472
99684
  fragment = selection;
99473
99685
  } else {
99474
99686
  const fragmentDefinition = input.request.definitions.fragments[selection.name.value];
@@ -99573,14 +99785,14 @@ class BaseGraphQLTypeRepository {
99573
99785
  const errors = [];
99574
99786
  const denormalized = {};
99575
99787
  for (const selection of input.selections) {
99576
- if (selection.kind === Kind.FIELD) {
99788
+ if (isField(selection)) {
99577
99789
  deepMerge$2(
99578
99790
  denormalized,
99579
99791
  this.denormalizeFieldSelection(cache, input, selection, errors)
99580
99792
  );
99581
99793
  } else {
99582
99794
  let fragment;
99583
- if (selection.kind === Kind.INLINE_FRAGMENT) {
99795
+ if (isInlineFragment(selection)) {
99584
99796
  fragment = selection;
99585
99797
  } else {
99586
99798
  const fragmentDefinition = input.request.definitions.fragments[selection.name.value];
@@ -99770,19 +99982,20 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
99770
99982
  const result = super.augmentSelections(input);
99771
99983
  const augmentedSelections = result.selections;
99772
99984
  let augmentedFragments = result.fragments;
99773
- augmentedSelections.push(
99774
- buildUniqueAugmentedFieldSelection(
99775
- {
99776
- kind: Kind.FIELD,
99777
- name: {
99778
- kind: Kind.NAME,
99779
- value: this.idField
99780
- }
99781
- },
99782
- [...augmentedSelections, ...input.selections],
99783
- augmentedFragments
99784
- )
99985
+ const newSelection = buildAugmentedFieldSelection(
99986
+ {
99987
+ kind: Kind.FIELD,
99988
+ name: {
99989
+ kind: Kind.NAME,
99990
+ value: this.idField
99991
+ }
99992
+ },
99993
+ [...augmentedSelections, ...input.selections],
99994
+ augmentedFragments
99785
99995
  );
99996
+ if (newSelection) {
99997
+ augmentedSelections.push(newSelection);
99998
+ }
99786
99999
  return { selections: augmentedSelections, fragments: augmentedFragments };
99787
100000
  }
99788
100001
  };
@@ -99838,6 +100051,19 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
99838
100051
  buildFieldKey(selection, variables) {
99839
100052
  return this.graphqlRepository.buildFieldKey(selection, variables);
99840
100053
  }
100054
+ buildKeyParams(input) {
100055
+ var _a;
100056
+ const idField = input.selections.find(
100057
+ (selection) => selection.kind === Kind.FIELD && selection.name.value === this.idField
100058
+ );
100059
+ if (!idField) {
100060
+ throw new Error(`Id field ${this.idField} not found in selections`);
100061
+ }
100062
+ const idFieldDataProperty = ((_a = idField.alias) == null ? void 0 : _a.value) || idField.name.value;
100063
+ return {
100064
+ [this.idField]: input.data[idFieldDataProperty]
100065
+ };
100066
+ }
99841
100067
  }
99842
100068
  class GraphQLDocumentRootTypeRepository extends IdentifiableGraphQLTypeRepository {
99843
100069
  constructor() {
@@ -99884,7 +100110,7 @@ class GraphQLDocumentRootTypeRepository extends IdentifiableGraphQLTypeRepositor
99884
100110
  }
99885
100111
  buildAugmentedQuery(input) {
99886
100112
  var _a;
99887
- const operationResult = findExecutableOperation(input);
100113
+ const operationResult = findExecutableOperation$1(input);
99888
100114
  if (operationResult.isErr()) {
99889
100115
  return err$3(operationResult.error);
99890
100116
  }
@@ -100029,13 +100255,14 @@ class BaseUnionRepository {
100029
100255
  );
100030
100256
  augmentedSelections.push(...result.selections);
100031
100257
  augmentedFragments = result.fragments;
100032
- augmentedSelections.push(
100033
- buildUniqueAugmentedFieldSelection(
100034
- { kind: Kind.FIELD, name: { kind: Kind.NAME, value: "__typename" } },
100035
- augmentedSelections,
100036
- input.fragments
100037
- )
100258
+ const newSelection = buildAugmentedFieldSelection(
100259
+ { kind: Kind.FIELD, name: { kind: Kind.NAME, value: "__typename" } },
100260
+ augmentedSelections,
100261
+ input.fragments
100038
100262
  );
100263
+ if (newSelection) {
100264
+ augmentedSelections.push(newSelection);
100265
+ }
100039
100266
  return { selections: augmentedSelections, fragments: augmentedFragments };
100040
100267
  }
100041
100268
  getTypeDiscriminator(data, _selections) {
@@ -100383,6 +100610,56 @@ function isIncompleteConfigError(err) {
100383
100610
  (validationError) => validationError instanceof MissingRequiredPropertyError
100384
100611
  ) !== void 0;
100385
100612
  }
100613
+ function findExecutableOperation(document, operationName) {
100614
+ const operations = document.definitions.filter(
100615
+ (def) => def.kind === Kind$1.OPERATION_DEFINITION
100616
+ );
100617
+ if (operations.length === 0) {
100618
+ return void 0;
100619
+ }
100620
+ if (operations.length === 1 && !operationName) {
100621
+ return operations[0];
100622
+ }
100623
+ if (operationName) {
100624
+ return operations.find((op) => {
100625
+ var _a;
100626
+ return ((_a = op.name) == null ? void 0 : _a.value) === operationName;
100627
+ });
100628
+ }
100629
+ return void 0;
100630
+ }
100631
+ function validateGraphQLOperations(config, options) {
100632
+ const executableOperation = findExecutableOperation(config.query, config.operationName);
100633
+ if (executableOperation) {
100634
+ const operationType = executableOperation.operation;
100635
+ if (!options.acceptedOperations.includes(operationType)) {
100636
+ const operationTypeCapitalized = operationType.charAt(0).toUpperCase() + operationType.slice(1);
100637
+ throw new Error(
100638
+ `${operationTypeCapitalized} operations are not supported in this context`
100639
+ );
100640
+ }
100641
+ }
100642
+ }
100643
+ function resolveAst(ast) {
100644
+ if (ast === null) {
100645
+ return;
100646
+ }
100647
+ const result = astResolver(ast);
100648
+ if (result === void 0) {
100649
+ throw new Error("Could not resolve AST. Did you parse the query with gql?");
100650
+ }
100651
+ return result;
100652
+ }
100653
+ function wrapConfigAndVerify(config) {
100654
+ if (config == null ? void 0 : config.query) {
100655
+ config = { ...config, query: resolveAst(config.query) };
100656
+ if (config.query === void 0) {
100657
+ throw new Error("Internal error in GraphQL adapter occurred: Unable to resolve query");
100658
+ }
100659
+ validateGraphQLOperations(config, { acceptedOperations: ["query"] });
100660
+ }
100661
+ return config;
100662
+ }
100386
100663
  class GraphQLCommandWireAdapterConstructor extends CommandWireAdapterConstructor {
100387
100664
  emit(result) {
100388
100665
  try {
@@ -100451,15 +100728,110 @@ class GraphQLCommandWireAdapterConstructor extends CommandWireAdapterConstructor
100451
100728
  }
100452
100729
  update(config, _context) {
100453
100730
  this.unsubscribe();
100731
+ const resolvedQuery = resolveAst(config.query);
100732
+ if (resolvedQuery) {
100733
+ validateGraphQLOperations(
100734
+ { query: resolvedQuery, operationName: config == null ? void 0 : config.operationName },
100735
+ { acceptedOperations: ["query"] }
100736
+ );
100737
+ }
100454
100738
  this.config = {
100455
100739
  ...sanitize(config),
100456
- query: config.query
100740
+ query: resolvedQuery
100457
100741
  };
100458
100742
  this.invokeAdapter();
100459
100743
  }
100460
100744
  }
100745
+ function buildAsyncGraphQLImperativeInvoker(getCommand, exposeRefresh = false) {
100746
+ return async (...params) => {
100747
+ try {
100748
+ if (params.length) {
100749
+ params[0] = wrapConfigAndVerify(params[0]);
100750
+ }
100751
+ const command = getCommand({ params, assertIsValid });
100752
+ const result = await command.execute();
100753
+ const consumerEmittedData = {
100754
+ data: void 0,
100755
+ errors: void 0
100756
+ };
100757
+ if (result.isOk()) {
100758
+ deepFreeze(result.value);
100759
+ consumerEmittedData.data = result.value.data.data;
100760
+ consumerEmittedData.subscribe = (cb) => {
100761
+ result.value.subscribe((res) => {
100762
+ const consumerEmittedData2 = {
100763
+ data: void 0,
100764
+ errors: void 0
100765
+ };
100766
+ if (res.isOk()) {
100767
+ consumerEmittedData2.data = res.value.data;
100768
+ } else {
100769
+ if (isUserVisibleError(res.error)) {
100770
+ consumerEmittedData2.data = res.error.data.data;
100771
+ consumerEmittedData2.errors = res.error.data.errors;
100772
+ } else {
100773
+ logError(res.error);
100774
+ consumerEmittedData2.errors = [
100775
+ {
100776
+ message: "Internal error in GraphQL adapter occurred",
100777
+ locations: []
100778
+ }
100779
+ ];
100780
+ }
100781
+ }
100782
+ cb(consumerEmittedData2);
100783
+ });
100784
+ };
100785
+ if (exposeRefresh) {
100786
+ consumerEmittedData.refresh = () => {
100787
+ return new Promise((resolve, reject) => {
100788
+ try {
100789
+ result.value.refresh().then((res) => {
100790
+ if (res.isOk()) {
100791
+ resolve();
100792
+ } else {
100793
+ reject(
100794
+ new Error(
100795
+ "Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data"
100796
+ )
100797
+ );
100798
+ }
100799
+ });
100800
+ } catch (error) {
100801
+ logError(error);
100802
+ reject(
100803
+ new Error(
100804
+ "Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data"
100805
+ )
100806
+ );
100807
+ }
100808
+ });
100809
+ };
100810
+ }
100811
+ } else {
100812
+ if (isUserVisibleError(result.error)) {
100813
+ consumerEmittedData.data = result.error.data.data;
100814
+ consumerEmittedData.errors = result.error.data.errors;
100815
+ } else {
100816
+ logError(result.error);
100817
+ consumerEmittedData.errors = [
100818
+ { message: "Internal error in GraphQL adapter occurred", locations: [] }
100819
+ ];
100820
+ }
100821
+ }
100822
+ return consumerEmittedData;
100823
+ } catch (error) {
100824
+ logError(error);
100825
+ return {
100826
+ data: void 0,
100827
+ errors: [{ message: "Internal error in GraphQL adapter occurred", locations: [] }]
100828
+ };
100829
+ }
100830
+ };
100831
+ }
100461
100832
  function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100462
100833
  const invoke = async (config, requestContext, callback) => {
100834
+ config = wrapConfigAndVerify(config);
100463
100835
  const command = getCommand({ config, assertIsValid });
100464
100836
  try {
100465
100837
  const overrides = requestContextIsCachePolicy(requestContext) ? { cacheControlConfig: { type: "no-cache" } } : {};
@@ -100492,6 +100864,7 @@ function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100492
100864
  }
100493
100865
  };
100494
100866
  const subscribe = (config, requestContext, callback) => {
100867
+ config = wrapConfigAndVerify(config);
100495
100868
  const command = getCommand({ config, assertIsValid });
100496
100869
  let unsubscribe = () => {
100497
100870
  };
@@ -100552,14 +100925,7 @@ function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100552
100925
  function requestContextIsCachePolicy(requestContext) {
100553
100926
  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";
100554
100927
  }
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.382.0-73d929ea11
100928
+ // version: 1.384.0-835fd13f44
100563
100929
 
100564
100930
  class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
100565
100931
  constructor(services, typeRegistry) {
@@ -100624,6 +100990,7 @@ class Analytics__AnalyticsRepresentationRepository extends IdentifiableGraphQLTy
100624
100990
  this.namespace = "oas";
100625
100991
  this.typeName = "Analytics__AnalyticsRepresentation";
100626
100992
  this.implementedInterfaces = ["Analytics__AnalyticsRepresentationInterface"];
100993
+ this.idField = "Id";
100627
100994
  }
100628
100995
  get fields() {
100629
100996
  return {
@@ -100642,9 +101009,6 @@ class Analytics__AnalyticsRepresentationRepository extends IdentifiableGraphQLTy
100642
101009
  Dataspaces: new BaseArrayFieldDef(new BaseObjectFieldDef(this.typeRegistry.Analytics__DataspaceRepresentation, true), true),
100643
101010
  };
100644
101011
  }
100645
- buildKeyParams(input) {
100646
- return { Id: input.data.Id };
100647
- }
100648
101012
  get cacheControl() {
100649
101013
  return { type: "max-age", maxAge: 60 };
100650
101014
  }
@@ -100715,6 +101079,7 @@ class Analytics__AnalyticsWorkspaceRepository extends IdentifiableGraphQLTypeRep
100715
101079
  this.namespace = "oas";
100716
101080
  this.typeName = "Analytics__AnalyticsWorkspace";
100717
101081
  this.implementedInterfaces = [];
101082
+ this.idField = "Id";
100718
101083
  }
100719
101084
  get fields() {
100720
101085
  return {
@@ -100729,9 +101094,6 @@ class Analytics__AnalyticsWorkspaceRepository extends IdentifiableGraphQLTypeRep
100729
101094
  ApiName: new BaseScalarFieldDef(false),
100730
101095
  };
100731
101096
  }
100732
- buildKeyParams(input) {
100733
- return { Id: input.data.Id };
100734
- }
100735
101097
  get cacheControl() {
100736
101098
  return { type: "max-age", maxAge: 60 };
100737
101099
  }
@@ -100745,6 +101107,7 @@ class Analytics__DataspaceRepresentationRepository extends IdentifiableGraphQLTy
100745
101107
  this.namespace = "oas";
100746
101108
  this.typeName = "Analytics__DataspaceRepresentation";
100747
101109
  this.implementedInterfaces = [];
101110
+ this.idField = "Id";
100748
101111
  }
100749
101112
  get fields() {
100750
101113
  return {
@@ -100755,9 +101118,6 @@ class Analytics__DataspaceRepresentationRepository extends IdentifiableGraphQLTy
100755
101118
  DeveloperName: new BaseScalarFieldDef(true),
100756
101119
  };
100757
101120
  }
100758
- buildKeyParams(input) {
100759
- return { Id: input.data.Id };
100760
- }
100761
101121
  get cacheControl() {
100762
101122
  return { type: "max-age", maxAge: 60 };
100763
101123
  }
@@ -101935,6 +102295,7 @@ let RecordRepresentationRepository$1 = class RecordRepresentationRepository exte
101935
102295
  this.namespace = "oas";
101936
102296
  this.typeName = "RecordRepresentation";
101937
102297
  this.implementedInterfaces = ["Record"];
102298
+ this.idField = "Id";
101938
102299
  }
101939
102300
  get fields() {
101940
102301
  return {
@@ -101978,9 +102339,6 @@ let RecordRepresentationRepository$1 = class RecordRepresentationRepository exte
101978
102339
  AnyType: new BaseObjectFieldDef(this.typeRegistry.AnyType, true),
101979
102340
  };
101980
102341
  }
101981
- buildKeyParams(input) {
101982
- return { Id: input.data.Id };
101983
- }
101984
102342
  get cacheControl() {
101985
102343
  return { type: "max-age", maxAge: 60 };
101986
102344
  }
@@ -102110,6 +102468,7 @@ class Setup__EntityRepresentationRepository extends IdentifiableGraphQLTypeRepos
102110
102468
  this.namespace = "oas";
102111
102469
  this.typeName = "Setup__EntityRepresentation";
102112
102470
  this.implementedInterfaces = [];
102471
+ this.idField = "Id";
102113
102472
  }
102114
102473
  get fields() {
102115
102474
  return {
@@ -102148,9 +102507,6 @@ class Setup__EntityRepresentationRepository extends IdentifiableGraphQLTypeRepos
102148
102507
  AnyType: new BaseObjectFieldDef(this.typeRegistry.AnyType, true),
102149
102508
  };
102150
102509
  }
102151
- buildKeyParams(input) {
102152
- return { Id: input.data.Id };
102153
- }
102154
102510
  get cacheControl() {
102155
102511
  return { type: "max-age", maxAge: 60 };
102156
102512
  }
@@ -102325,6 +102681,7 @@ class Setup__ListViewRowRepository extends IdentifiableGraphQLTypeRepository {
102325
102681
  this.namespace = "oas";
102326
102682
  this.typeName = "Setup__ListViewRow";
102327
102683
  this.implementedInterfaces = [];
102684
+ this.idField = "id";
102328
102685
  }
102329
102686
  get fields() {
102330
102687
  return {
@@ -102333,9 +102690,6 @@ class Setup__ListViewRowRepository extends IdentifiableGraphQLTypeRepository {
102333
102690
  columns: new BaseArrayFieldDef(new BaseObjectFieldDef(this.typeRegistry.Setup__ListScalarField, true), false),
102334
102691
  };
102335
102692
  }
102336
- buildKeyParams(input) {
102337
- return { id: input.data.id };
102338
- }
102339
102693
  get cacheControl() {
102340
102694
  return { type: "max-age", maxAge: 60 };
102341
102695
  }
@@ -103371,6 +103725,61 @@ function getFieldCategoryFromData(data) {
103371
103725
  return data.__genericTypename || data.__typename;
103372
103726
  }
103373
103727
 
103728
+ /**
103729
+ * Finds the typename field name from GraphQL selections, looking for __typename or aliased fields.
103730
+ *
103731
+ * @param input - The normalize/denormalize data input containing selections
103732
+ * @returns The field name to use for typename lookup, or '__typename' as fallback
103733
+ */
103734
+ function findTypenameFieldFromSelections(input) {
103735
+ // For normalize inputs, check if selections exist and find __typename field
103736
+ if (input && 'selections' in input && Array.isArray(input.selections)) {
103737
+ const typenameSelection = input.selections.find((selection) => selection.kind === 'Field' && selection.name?.value === '__typename');
103738
+ if (typenameSelection) {
103739
+ // If there's an alias, use the alias name, otherwise use the field name
103740
+ return typenameSelection.alias?.value || typenameSelection.name.value;
103741
+ }
103742
+ }
103743
+ // Fallback to standard __typename field name
103744
+ return '__typename';
103745
+ }
103746
+ /**
103747
+ * Checks if the input data satisfies a fragment type condition by comparing the typename
103748
+ * from the input data with the fragment's conditional type name.
103749
+ *
103750
+ * @param input - The normalize/denormalize data input containing the typename
103751
+ * @param fragment - The fragment containing the type condition
103752
+ * @returns Result<boolean, Error> - true if the type condition is satisfied
103753
+ */
103754
+ function dataSatisfiesFragmentTypeCondition(input, fragment) {
103755
+ const conditionalTypeName = fragment?.typeCondition?.name.value;
103756
+ const typename = input?.data?.[findTypenameFieldFromSelections(input)] ||
103757
+ input?.normalizedData?.__typename?.data;
103758
+ if (conditionalTypeName && typename === conditionalTypeName) {
103759
+ return ok(true);
103760
+ }
103761
+ return ok(false);
103762
+ }
103763
+ /**
103764
+ * Generic implementation of satisfiesFragmentTypeCondition for repositories.
103765
+ * Combines the base class type condition check with custom typename validation.
103766
+ *
103767
+ * @param superSatisfiesFragmentTypeCondition - The super class method to call first
103768
+ * @param input - The normalize/denormalize data input
103769
+ * @param fragment - The fragment containing the type condition
103770
+ * @param typeName - The repository type name for error messages
103771
+ * @returns Result<boolean, Error> - true if the fragment type condition is satisfied
103772
+ */
103773
+ function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment, typeName) {
103774
+ // First try the base class implementation
103775
+ const result = superSatisfiesFragmentTypeCondition(input, fragment);
103776
+ if (result.isErr() || result.value) {
103777
+ return result;
103778
+ }
103779
+ // Then try our custom typename checking
103780
+ return dataSatisfiesFragmentTypeCondition(input, fragment);
103781
+ }
103782
+
103374
103783
  class RecordRepresentationBaseRepository extends BaseGraphQLTypeRepository {
103375
103784
  constructor(namespace, typeName, implementedInterfaces, fields, idField, services) {
103376
103785
  super();
@@ -103397,15 +103806,8 @@ class RecordRepresentationBaseRepository extends BaseGraphQLTypeRepository {
103397
103806
  getFieldDef(_input, selection) {
103398
103807
  return buildGenericTypeFieldDef(selection, this.fields, this.staticFieldNames, this.typeName);
103399
103808
  }
103400
- satisfiesFragmentTypeCondition(_input, fragment) {
103401
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103402
- if (result.isErr()) {
103403
- return result;
103404
- }
103405
- if (result.value) {
103406
- return result;
103407
- }
103408
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
103809
+ satisfiesFragmentTypeCondition(input, fragment) {
103810
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), input, fragment, this.typeName);
103409
103811
  }
103410
103812
  }
103411
103813
 
@@ -103414,7 +103816,7 @@ class RecordRepresentationRepository extends RecordRepresentationRepository$1 {
103414
103816
  super(services, typeRegistry);
103415
103817
  this.services = services;
103416
103818
  this.typeRegistry = typeRegistry;
103417
- this.namespace = 'oas';
103819
+ this.namespace = 'uiapi';
103418
103820
  this.typeName = 'RecordRepresentation';
103419
103821
  this.implementedInterfaces = ['Record'];
103420
103822
  this._graphqlRepositoryOverride = undefined;
@@ -103566,14 +103968,7 @@ class CompoundFieldRepository extends CompoundFieldRepository$1 {
103566
103968
  return super.getFieldDef(undefined, selection) !== undefined;
103567
103969
  }
103568
103970
  satisfiesFragmentTypeCondition(_input, fragment) {
103569
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103570
- if (result.isErr()) {
103571
- return result;
103572
- }
103573
- if (result.value) {
103574
- return result;
103575
- }
103576
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
103971
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103577
103972
  }
103578
103973
  }
103579
103974
 
@@ -103597,14 +103992,7 @@ class RecordAggregateRepository extends RecordAggregateRepository$1 {
103597
103992
  return buildGenericTypeFieldDef(selection, this.fields, this.staticFieldNames, this.typeName);
103598
103993
  }
103599
103994
  satisfiesFragmentTypeCondition(_input, fragment) {
103600
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103601
- if (result.isErr()) {
103602
- return result;
103603
- }
103604
- if (result.value) {
103605
- return result;
103606
- }
103607
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
103995
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103608
103996
  }
103609
103997
  }
103610
103998
 
@@ -103640,7 +104028,7 @@ class SetupEntityRepresentationRepository extends UnidentifiableGraphQLTypeRepos
103640
104028
  super(services);
103641
104029
  this.services = services;
103642
104030
  this.typeRegistry = typeRegistry;
103643
- this.namespace = 'oas';
104031
+ this.namespace = 'uiapi';
103644
104032
  this.typeName = 'Setup__EntityRepresentation';
103645
104033
  this.implementedInterfaces = [];
103646
104034
  }
@@ -103690,14 +104078,7 @@ class SetupEntityRepresentationRepository extends UnidentifiableGraphQLTypeRepos
103690
104078
  return blobTypeDef;
103691
104079
  }
103692
104080
  satisfiesFragmentTypeCondition(input, fragment) {
103693
- const result = super.satisfiesFragmentTypeCondition(input, fragment);
103694
- if (result.isErr()) {
103695
- return result;
103696
- }
103697
- if (result.value) {
103698
- return result;
103699
- }
103700
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104081
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), input, fragment, this.typeName);
103701
104082
  }
103702
104083
  }
103703
104084
 
@@ -103737,14 +104118,7 @@ class SetupRecordAggregateRepository extends Setup__SetupRecordAggregateReposito
103737
104118
  return blobTypeDef;
103738
104119
  }
103739
104120
  satisfiesFragmentTypeCondition(_input, fragment) {
103740
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103741
- if (result.isErr()) {
103742
- return result;
103743
- }
103744
- if (result.value) {
103745
- return result;
103746
- }
103747
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104121
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103748
104122
  }
103749
104123
  }
103750
104124
 
@@ -103763,7 +104137,7 @@ class SetupRepository extends IdentifiableGraphQLTypeRepository {
103763
104137
  constructor(services, typeRegistry) {
103764
104138
  super(services);
103765
104139
  this.typeRegistry = typeRegistry;
103766
- this.namespace = 'oas';
104140
+ this.namespace = 'uiapi';
103767
104141
  this.typeName = 'Setup__Setup';
103768
104142
  this.implementedInterfaces = [];
103769
104143
  this.cacheControl = {
@@ -103784,14 +104158,7 @@ class SetupRepository extends IdentifiableGraphQLTypeRepository {
103784
104158
 
103785
104159
  class SetupEdgeRepository extends Setup__SetupEdgeRepository {
103786
104160
  satisfiesFragmentTypeCondition(_input, fragment) {
103787
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103788
- if (result.isErr()) {
103789
- return result;
103790
- }
103791
- if (result.value) {
103792
- return result;
103793
- }
103794
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104161
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103795
104162
  }
103796
104163
  }
103797
104164
 
@@ -103805,118 +104172,55 @@ class PolymorphicAggregateParentRelationshipRepository extends PolymorphicAggreg
103805
104172
 
103806
104173
  class RecordAggregateConnectionRepository extends RecordAggregateConnectionRepository$1 {
103807
104174
  satisfiesFragmentTypeCondition(_input, fragment) {
103808
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103809
- if (result.isErr()) {
103810
- return result;
103811
- }
103812
- if (result.value) {
103813
- return result;
103814
- }
103815
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104175
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103816
104176
  }
103817
104177
  }
103818
104178
 
103819
104179
  class RecordAggregateEdgeRepository extends RecordAggregateEdgeRepository$1 {
103820
104180
  satisfiesFragmentTypeCondition(_input, fragment) {
103821
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103822
- if (result.isErr()) {
103823
- return result;
103824
- }
103825
- if (result.value) {
103826
- return result;
103827
- }
103828
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104181
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103829
104182
  }
103830
104183
  }
103831
104184
 
103832
104185
  class RecordConnectionRepository extends RecordConnectionRepository$1 {
103833
104186
  satisfiesFragmentTypeCondition(_input, fragment) {
103834
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103835
- if (result.isErr()) {
103836
- return result;
103837
- }
103838
- if (result.value) {
103839
- return result;
103840
- }
103841
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104187
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103842
104188
  }
103843
104189
  }
103844
104190
 
103845
104191
  class RecordEdgeRepository extends RecordEdgeRepository$1 {
103846
104192
  satisfiesFragmentTypeCondition(_input, fragment) {
103847
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103848
- if (result.isErr()) {
103849
- return result;
103850
- }
103851
- if (result.value) {
103852
- return result;
103853
- }
103854
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104193
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103855
104194
  }
103856
104195
  }
103857
104196
 
103858
104197
  class RecordResultRepository extends RecordResultRepository$1 {
103859
104198
  satisfiesFragmentTypeCondition(_input, fragment) {
103860
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103861
- if (result.isErr()) {
103862
- return result;
103863
- }
103864
- if (result.value) {
103865
- return result;
103866
- }
103867
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104199
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103868
104200
  }
103869
104201
  }
103870
104202
 
103871
104203
  class SetupRecordResultRepository extends Setup__SetupRecordResultRepository {
103872
104204
  satisfiesFragmentTypeCondition(_input, fragment) {
103873
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103874
- if (result.isErr()) {
103875
- return result;
103876
- }
103877
- if (result.value) {
103878
- return result;
103879
- }
103880
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104205
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103881
104206
  }
103882
104207
  }
103883
104208
 
103884
104209
  class SetupAggregateConnectionRepository extends Setup__SetupAggregateConnectionRepository {
103885
104210
  satisfiesFragmentTypeCondition(_input, fragment) {
103886
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103887
- if (result.isErr()) {
103888
- return result;
103889
- }
103890
- if (result.value) {
103891
- return result;
103892
- }
103893
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104211
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103894
104212
  }
103895
104213
  }
103896
104214
 
103897
104215
  class SetupAggregateEdgeRepository extends Setup__SetupAggregateEdgeRepository {
103898
104216
  satisfiesFragmentTypeCondition(_input, fragment) {
103899
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103900
- if (result.isErr()) {
103901
- return result;
103902
- }
103903
- if (result.value) {
103904
- return result;
103905
- }
103906
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104217
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103907
104218
  }
103908
104219
  }
103909
104220
 
103910
104221
  class SetupConnectionRepository extends Setup__SetupConnectionRepository {
103911
104222
  satisfiesFragmentTypeCondition(_input, fragment) {
103912
- const result = super.satisfiesFragmentTypeCondition(_input, fragment);
103913
- if (result.isErr()) {
103914
- return result;
103915
- }
103916
- if (result.value) {
103917
- return result;
103918
- }
103919
- return err(new Error(`${this.typeName}: unsupported fragment type condition: ${fragment.typeCondition?.name.value}`));
104223
+ return genericSatisfiesFragmentTypeCondition(super.satisfiesFragmentTypeCondition.bind(this), _input, fragment, this.typeName);
103920
104224
  }
103921
104225
  }
103922
104226
 
@@ -104335,6 +104639,7 @@ function buildCommandClass(baseClass) {
104335
104639
 
104336
104640
  let graphql$1;
104337
104641
  let graphql_imperative$1;
104642
+ let graphql_imperative_legacy;
104338
104643
  let useOneStoreGraphQL = false;
104339
104644
  const serviceRequirements = {
104340
104645
  instrumentCommand: {
@@ -104394,18 +104699,24 @@ getServices(serviceRequirements).then((services) => {
104394
104699
  this.exposeRefresh = true;
104395
104700
  }
104396
104701
  getCommand() {
104397
- return new graphql_ctor({ ...this.config, query: resolveAst(this.config.query) }, documentRootType, services);
104702
+ return new graphql_ctor(this.config, documentRootType, services);
104398
104703
  }
104399
104704
  };
104400
104705
  const graphql_imperative_ctor = services.instrumentCommand(buildCommandClass(services.auraGraphQLNormalizedCacheControlCommand), 'graphql_imperative');
104401
- graphql_imperative$1 = buildAsyncGraphQLImperativeLegacyInvoker(({ config, assertIsValid }) => {
104706
+ graphql_imperative$1 = buildAsyncGraphQLImperativeInvoker(({ params, assertIsValid }) => {
104707
+ const config = params[0];
104708
+ const _ = assertIsValid;
104709
+ _(config, CONFIG_SCHEMA);
104710
+ return new graphql_imperative_ctor(config, documentRootType, services);
104711
+ }, true);
104712
+ graphql_imperative_legacy = buildAsyncGraphQLImperativeLegacyInvoker(({ config, assertIsValid }) => {
104402
104713
  const _ = assertIsValid;
104403
104714
  _(config, CONFIG_SCHEMA);
104404
- return new graphql_imperative_ctor({ ...config, query: resolveAst(config.query) }, documentRootType, services);
104715
+ return new graphql_imperative_ctor(config, documentRootType, services);
104405
104716
  });
104406
104717
  useOneStoreGraphQL = services.featureFlags?.get('useOneStoreGraphQL') ?? false;
104407
104718
  if (provisionedCallback) {
104408
- provisionedCallback(graphql$1, graphql_imperative$1, useOneStoreGraphQL);
104719
+ provisionedCallback(graphql$1, graphql_imperative$1, graphql_imperative_legacy, useOneStoreGraphQL);
104409
104720
  }
104410
104721
  }, (_err) => { });
104411
104722
  function registerCallback(cb) {
@@ -104413,10 +104724,10 @@ function registerCallback(cb) {
104413
104724
  provisionedCallback = cb;
104414
104725
  }
104415
104726
  else {
104416
- cb(graphql$1, graphql_imperative$1, useOneStoreGraphQL);
104727
+ cb(graphql$1, graphql_imperative$1, graphql_imperative_legacy, useOneStoreGraphQL);
104417
104728
  }
104418
104729
  }
104419
- // version: 1.382.0-73d929ea11
104730
+ // version: 1.384.0-835fd13f44
104420
104731
 
104421
104732
  function createFragmentMap(documentNode) {
104422
104733
  const fragments = {};
@@ -130368,11 +130679,15 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
130368
130679
  return cacheSnapshot;
130369
130680
  }
130370
130681
 
130682
+ // Wire Adapters
130371
130683
  let graphql;
130372
130684
  let graphqlBatch;
130373
130685
  // Imperative GET Adapters
130374
130686
  let graphql_imperative;
130375
130687
  let graphqlBatch_imperative;
130688
+ let refreshGraphQL = (data) => {
130689
+ return refresh$3(data, 'refreshUiApi');
130690
+ };
130376
130691
  // Adapter Metadata
130377
130692
  const graphqlMetadata = { apiFamily: keyPrefix$1, name: 'graphql', ttl: 900000 };
130378
130693
  const graphqlBatchMetadata = { apiFamily: keyPrefix$1, name: 'graphqlBatch' };
@@ -130394,10 +130709,16 @@ withDefaultLuvio((luvio) => {
130394
130709
  ({ graphql, graphqlBatch, graphql_imperative, graphqlBatch_imperative } = bindExportsTo(luvio));
130395
130710
  // We register the callback here rather than above withDefaultLuvio because we want environments
130396
130711
  // that don't have onestore bootstrapped with the required services to default to the luvio versions of the adapters
130397
- registerCallback((oneStoreGraphql, oneStoreGraphql_imperative, useOneStoreGraphQL) => {
130712
+ registerCallback((oneStoreGraphql, oneStoreGraphql_imperative, oneStoreGraphql_imperative_legacy, useOneStoreGraphQL) => {
130398
130713
  if (useOneStoreGraphQL) {
130399
130714
  graphql = oneStoreGraphql;
130400
- graphql_imperative = oneStoreGraphql_imperative;
130715
+ graphql_imperative = oneStoreGraphql_imperative_legacy;
130716
+ refreshGraphQL = (data) => {
130717
+ if (typeof data?.refresh === 'function') {
130718
+ return data.refresh();
130719
+ }
130720
+ throw new Error('Component attempted to refresh a GraphQL result that is not refreshable');
130721
+ };
130401
130722
  }
130402
130723
  });
130403
130724
  });
@@ -130904,14 +131225,7 @@ register$1({
130904
131225
  configuration: { ...configurationForGraphQLAdapters$1 },
130905
131226
  instrument: instrument$1,
130906
131227
  });
130907
- function refreshGraphQL(data) {
130908
- // If OneStore data, call its refresh instead
130909
- if (typeof data?.refresh === 'function') {
130910
- return data.refresh();
130911
- }
130912
- return refresh$3(data, 'refreshUiApi');
130913
- }
130914
- // version: 1.382.0-73d929ea11
131228
+ // version: 1.384.0-835fd13f44
130915
131229
 
130916
131230
  // On core the unstable adapters are re-exported with different names,
130917
131231
  // we want to match them here.
@@ -130923,7 +131237,7 @@ var unstableLightningRelatedListApi = /*#__PURE__*/Object.freeze({
130923
131237
  gql: gql,
130924
131238
  get graphql () { return graphql; },
130925
131239
  get graphqlBatch () { return graphqlBatch; },
130926
- refreshGraphQL: refreshGraphQL,
131240
+ get refreshGraphQL () { return refreshGraphQL; },
130927
131241
  get unstable_getActionOverrides_imperative () { return unstable_getActionOverrides_imperative; },
130928
131242
  get unstable_getFlexipageFormulaOverrides_imperative () { return unstable_getFlexipageFormulaOverrides_imperative; },
130929
131243
  get unstable_getGlobalActions_imperative () { return unstable_getGlobalActions_imperative; },
@@ -131063,7 +131377,7 @@ withDefaultLuvio((luvio) => {
131063
131377
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
131064
131378
  graphQLImperative = ldsAdapter;
131065
131379
  });
131066
- // version: 1.382.0-73d929ea11
131380
+ // version: 1.384.0-835fd13f44
131067
131381
 
131068
131382
  var gqlApi = /*#__PURE__*/Object.freeze({
131069
131383
  __proto__: null,
@@ -131862,7 +132176,7 @@ const callbacks$1 = [];
131862
132176
  function register(r) {
131863
132177
  callbacks$1.forEach((callback) => callback(r));
131864
132178
  }
131865
- // version: 1.382.0-8ca71123b0
132179
+ // version: 1.384.0-cb845692ac
131866
132180
 
131867
132181
  /**
131868
132182
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -133178,4 +133492,4 @@ const { luvio } = getRuntime();
133178
133492
  setDefaultLuvio({ luvio });
133179
133493
 
133180
133494
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
133181
- // version: 1.382.0-8ca71123b0
133495
+ // version: 1.384.0-cb845692ac