@salesforce/lds-worker-api 1.428.0-dev1 → 1.428.0-dev10

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.428.0-dev1-c95a813572
4277
+ // version: 1.428.0-dev10-1e665d263f
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.428.0-dev1-c95a813572
5321
+ // version: 1.428.0-dev10-1e665d263f
5322
5322
 
5323
5323
  function isSupportedEntity(_objectApiName) {
5324
5324
  return true;
@@ -32610,7 +32610,7 @@ withDefaultLuvio((luvio) => {
32610
32610
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
32611
32611
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
32612
32612
  });
32613
- // version: 1.428.0-dev1-52205c6c54
32613
+ // version: 1.428.0-dev10-109bf232e1
32614
32614
 
32615
32615
  var allowUpdatesForNonCachedRecords = {
32616
32616
  isOpen: function (e) {
@@ -95112,6 +95112,7 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
95112
95112
  constructor(services) {
95113
95113
  super(services);
95114
95114
  this.services = services;
95115
+ this.additionalNullResponses = [];
95115
95116
  }
95116
95117
  fetch() {
95117
95118
  try {
@@ -95120,6 +95121,15 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
95120
95121
  return resolvedPromiseLike$2(err$1(toError(reason)));
95121
95122
  }
95122
95123
  }
95124
+ isSemanticNullResponse(response) {
95125
+ return this.additionalNullResponses.includes(response.status);
95126
+ }
95127
+ isProtocolNoBodyStatus(status) {
95128
+ return status === 204 || status === 205;
95129
+ }
95130
+ isUndeclaredNoBodyResponse(response) {
95131
+ return this.isProtocolNoBodyStatus(response.status) && !this.isSemanticNullResponse(response);
95132
+ }
95123
95133
  async coerceError(errorResponse) {
95124
95134
  return toError(errorResponse.statusText);
95125
95135
  }
@@ -95127,10 +95137,24 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
95127
95137
  return response.then(
95128
95138
  (response2) => {
95129
95139
  if (response2.ok) {
95130
- return response2.json().then(
95131
- (json) => ok$1(json),
95132
- (reason) => err$1(toError(reason))
95133
- ).finally(() => {
95140
+ let resultPromise;
95141
+ if (this.isSemanticNullResponse(response2)) {
95142
+ resultPromise = Promise.resolve(ok$1(null));
95143
+ } else if (this.isUndeclaredNoBodyResponse(response2)) {
95144
+ resultPromise = Promise.resolve(
95145
+ err$1(
95146
+ toError(
95147
+ `Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
95148
+ )
95149
+ )
95150
+ );
95151
+ } else {
95152
+ resultPromise = response2.json().then(
95153
+ (json) => ok$1(json),
95154
+ (reason) => err$1(toError(reason))
95155
+ );
95156
+ }
95157
+ return resultPromise.finally(() => {
95134
95158
  try {
95135
95159
  this.afterRequestHooks({ statusCode: response2.status });
95136
95160
  } catch {
@@ -95177,6 +95201,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
95177
95201
  constructor(services) {
95178
95202
  super(services);
95179
95203
  this.services = services;
95204
+ this.additionalNullResponses = [];
95180
95205
  }
95181
95206
  requestFromNetwork() {
95182
95207
  return this.fetch();
@@ -95188,6 +95213,15 @@ class HttpCacheControlCommand extends CacheControlCommand {
95188
95213
  return resolvedPromiseLike$2(err$1(toError(reason)));
95189
95214
  }
95190
95215
  }
95216
+ isSemanticNullResponse(response) {
95217
+ return this.additionalNullResponses.includes(response.status);
95218
+ }
95219
+ isProtocolNoBodyStatus(status) {
95220
+ return status === 204 || status === 205;
95221
+ }
95222
+ isUndeclaredNoBodyResponse(response) {
95223
+ return this.isProtocolNoBodyStatus(response.status) && !this.isSemanticNullResponse(response);
95224
+ }
95191
95225
  async coerceError(errorResponse) {
95192
95226
  return toError(errorResponse.statusText);
95193
95227
  }
@@ -95198,12 +95232,26 @@ class HttpCacheControlCommand extends CacheControlCommand {
95198
95232
  return response.then(
95199
95233
  (response2) => {
95200
95234
  if (response2.ok) {
95201
- return response2.json().then(
95202
- (json) => {
95203
- return this.processFetchReturnValue(json);
95204
- },
95205
- (reason) => err$1(toError(reason))
95206
- ).finally(() => {
95235
+ let resultPromise;
95236
+ if (this.isSemanticNullResponse(response2)) {
95237
+ resultPromise = Promise.resolve(ok$1(null));
95238
+ } else if (this.isUndeclaredNoBodyResponse(response2)) {
95239
+ resultPromise = Promise.resolve(
95240
+ err$1(
95241
+ toError(
95242
+ `Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
95243
+ )
95244
+ )
95245
+ );
95246
+ } else {
95247
+ resultPromise = response2.json().then(
95248
+ (json) => {
95249
+ return this.processFetchReturnValue(json);
95250
+ },
95251
+ (reason) => err$1(toError(reason))
95252
+ );
95253
+ }
95254
+ return resultPromise.finally(() => {
95207
95255
  try {
95208
95256
  this.afterRequestHooks({ statusCode: response2.status });
95209
95257
  } catch {
@@ -96191,7 +96239,7 @@ function buildServiceDescriptor$b(luvio) {
96191
96239
  },
96192
96240
  };
96193
96241
  }
96194
- // version: 1.428.0-dev1-52205c6c54
96242
+ // version: 1.428.0-dev10-109bf232e1
96195
96243
 
96196
96244
  /**
96197
96245
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96217,7 +96265,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
96217
96265
  },
96218
96266
  };
96219
96267
  }
96220
- // version: 1.428.0-dev1-52205c6c54
96268
+ // version: 1.428.0-dev10-109bf232e1
96221
96269
 
96222
96270
  /*!
96223
96271
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96702,6 +96750,9 @@ function invalidSchemaResponseWithError$1(error) {
96702
96750
  return err$1([error]);
96703
96751
  }
96704
96752
  function validateJsonSchema$1(data, schema, path = "$", document = schema) {
96753
+ return validateJsonSchemaInternal$1(data, schema, path, document, /* @__PURE__ */ new Map());
96754
+ }
96755
+ function validateJsonSchemaInternal$1(data, schema, path, document, visited) {
96705
96756
  if (schema === true) return validSchemaResponse$1();
96706
96757
  if (schema === false)
96707
96758
  return invalidSchemaResponseWithError$1(
@@ -96710,22 +96761,22 @@ function validateJsonSchema$1(data, schema, path = "$", document = schema) {
96710
96761
  const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
96711
96762
  const errorCollector = new JsonSchemaErrorCollector$1();
96712
96763
  if ("anyOf" in schema) {
96713
- errorCollector.append(validateAnyOf$1(data, schema, path, document));
96764
+ errorCollector.append(validateAnyOf$1(data, schema, path, document, visited));
96714
96765
  } else if ("oneOf" in schema) {
96715
- errorCollector.append(validateOneOf$1(data, schema, path, document));
96766
+ errorCollector.append(validateOneOf$1(data, schema, path, document, visited));
96716
96767
  } else if ("allOf" in schema) {
96717
- errorCollector.append(validateAllOf$1(data, schema, path, document));
96768
+ errorCollector.append(validateAllOf$1(data, schema, path, document, visited));
96718
96769
  } else if ("not" in schema) {
96719
- errorCollector.append(validateNot$1(data, schema, path, document));
96770
+ errorCollector.append(validateNot$1(data, schema, path, document, visited));
96720
96771
  } else if ("$ref" in schema) {
96721
- errorCollector.append(validateRef$1(data, schema, path, document));
96772
+ errorCollector.append(validateRef$1(data, schema, path, document, visited));
96722
96773
  } else if ("type" in schema) {
96723
96774
  if (schema.type === "object") {
96724
96775
  if (dataType !== "object") {
96725
96776
  errorCollector.add(incorrectTypeError$1("object", dataType, path));
96726
96777
  } else {
96727
96778
  errorCollector.append(
96728
- validateObject$1(data, schema, path, document)
96779
+ validateObject$1(data, schema, path, document, visited)
96729
96780
  );
96730
96781
  }
96731
96782
  } else if (schema.type === "array") {
@@ -96733,7 +96784,7 @@ function validateJsonSchema$1(data, schema, path = "$", document = schema) {
96733
96784
  errorCollector.add(incorrectTypeError$1("array", dataType, path));
96734
96785
  } else {
96735
96786
  errorCollector.append(
96736
- validateArray$1(data, schema, path, document)
96787
+ validateArray$1(data, schema, path, document, visited)
96737
96788
  );
96738
96789
  }
96739
96790
  } else {
@@ -96750,16 +96801,17 @@ function validateJsonSchema$1(data, schema, path = "$", document = schema) {
96750
96801
  }
96751
96802
  return errorCollector.toValidationResponse();
96752
96803
  }
96753
- function validateAnyOf$1(data, schema, path, document) {
96804
+ function validateAnyOf$1(data, schema, path, document, visited) {
96754
96805
  let isValid = false;
96755
96806
  const errorCollector = new JsonSchemaErrorCollector$1();
96756
96807
  for (let i = 0, { length } = schema.anyOf; i < length; i++) {
96757
96808
  const element = schema.anyOf[i];
96758
- const validationResponse = validateJsonSchema$1(
96809
+ const validationResponse = validateJsonSchemaInternal$1(
96759
96810
  data,
96760
96811
  element,
96761
96812
  `${path}.anyOf[${i}]`,
96762
- document
96813
+ document,
96814
+ visited
96763
96815
  );
96764
96816
  if (validationResponse.isOk()) {
96765
96817
  isValid = true;
@@ -96776,13 +96828,22 @@ function validateAnyOf$1(data, schema, path, document) {
96776
96828
  }
96777
96829
  return validSchemaResponse$1();
96778
96830
  }
96779
- function validateOneOf$1(data, schema, path, document) {
96831
+ function validateOneOf$1(data, schema, path, document, visited) {
96832
+ if (schema.discriminator !== void 0) {
96833
+ return validateDiscriminatedOneOf$1(data, schema.discriminator, path, document, visited);
96834
+ }
96780
96835
  let validSubShemaPaths = [];
96781
96836
  const errorCollector = new JsonSchemaErrorCollector$1();
96782
96837
  for (let i = 0, { length } = schema.oneOf; i < length; i++) {
96783
96838
  const element = schema.oneOf[i];
96784
96839
  const oneOfPath = `${path}.oneOf[${i}]`;
96785
- const validationResponse = validateJsonSchema$1(data, element, oneOfPath, document);
96840
+ const validationResponse = validateJsonSchemaInternal$1(
96841
+ data,
96842
+ element,
96843
+ oneOfPath,
96844
+ document,
96845
+ visited
96846
+ );
96786
96847
  if (validationResponse.isOk()) {
96787
96848
  validSubShemaPaths.push(oneOfPath);
96788
96849
  } else {
@@ -96804,16 +96865,45 @@ function validateOneOf$1(data, schema, path, document) {
96804
96865
  }
96805
96866
  return validSchemaResponse$1();
96806
96867
  }
96807
- function validateAllOf$1(data, schema, path, document) {
96868
+ function validateDiscriminatedOneOf$1(data, discriminator, path, document, visited) {
96869
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
96870
+ return invalidSchemaResponseWithError$1(incorrectTypeError$1("object", typeof data, path));
96871
+ }
96872
+ const { propertyName, mapping } = discriminator;
96873
+ const discriminatorValue = data[propertyName];
96874
+ if (discriminatorValue === void 0) {
96875
+ return invalidSchemaResponseWithError$1(
96876
+ new MissingRequiredPropertyError$1(
96877
+ `Object at path '${path}' is missing required discriminator property '${propertyName}'.`
96878
+ )
96879
+ );
96880
+ }
96881
+ if (typeof discriminatorValue !== "string") {
96882
+ return invalidSchemaResponseWithError$1(
96883
+ incorrectTypeError$1("string", typeof discriminatorValue, `${path}.${propertyName}`)
96884
+ );
96885
+ }
96886
+ const targetRef = mapping[discriminatorValue];
96887
+ if (targetRef === void 0) {
96888
+ return invalidSchemaResponseWithError$1(
96889
+ new JsonSchemaViolationError$1(
96890
+ `Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
96891
+ )
96892
+ );
96893
+ }
96894
+ return validateJsonSchemaInternal$1(data, { $ref: targetRef }, path, document, visited);
96895
+ }
96896
+ function validateAllOf$1(data, schema, path, document, visited) {
96808
96897
  let isValid = true;
96809
96898
  const errorCollector = new JsonSchemaErrorCollector$1();
96810
96899
  for (let i = 0, { length } = schema.allOf; i < length; i++) {
96811
96900
  const element = schema.allOf[i];
96812
- const validationResponse = validateJsonSchema$1(
96901
+ const validationResponse = validateJsonSchemaInternal$1(
96813
96902
  data,
96814
96903
  element,
96815
96904
  `${path}.allOf[${i}]`,
96816
- document
96905
+ document,
96906
+ visited
96817
96907
  );
96818
96908
  if (!validationResponse.isOk()) {
96819
96909
  errorCollector.append(validationResponse);
@@ -96827,8 +96917,14 @@ function validateAllOf$1(data, schema, path, document) {
96827
96917
  }
96828
96918
  return errorCollector.toValidationResponse();
96829
96919
  }
96830
- function validateNot$1(data, schema, path, document) {
96831
- const validationResponse = validateJsonSchema$1(data, schema.not, path, document);
96920
+ function validateNot$1(data, schema, path, document, visited) {
96921
+ const validationResponse = validateJsonSchemaInternal$1(
96922
+ data,
96923
+ schema.not,
96924
+ path,
96925
+ document,
96926
+ visited
96927
+ );
96832
96928
  if (validationResponse.isOk()) {
96833
96929
  return invalidSchemaResponseWithError$1(
96834
96930
  new JsonSchemaViolationError$1(
@@ -96838,7 +96934,7 @@ function validateNot$1(data, schema, path, document) {
96838
96934
  }
96839
96935
  return validSchemaResponse$1();
96840
96936
  }
96841
- function validateObject$1(data, schema, path, document) {
96937
+ function validateObject$1(data, schema, path, document, visited) {
96842
96938
  const schemaKeys = Object.keys(schema.properties);
96843
96939
  const requiredKeys = new Set(schema.required);
96844
96940
  const schemaKeySet = new Set(schemaKeys);
@@ -96846,11 +96942,12 @@ function validateObject$1(data, schema, path, document) {
96846
96942
  Object.keys(data).forEach((key) => {
96847
96943
  if (!schemaKeySet.has(key)) {
96848
96944
  errorCollector.append(
96849
- validateJsonSchema$1(
96945
+ validateJsonSchemaInternal$1(
96850
96946
  data[key],
96851
96947
  schema.additionalProperties,
96852
96948
  `${path}.additionalProperties[${key}]`,
96853
- document
96949
+ document,
96950
+ visited
96854
96951
  )
96855
96952
  );
96856
96953
  }
@@ -96867,18 +96964,19 @@ function validateObject$1(data, schema, path, document) {
96867
96964
  }
96868
96965
  if (keyInData) {
96869
96966
  errorCollector.append(
96870
- validateJsonSchema$1(
96967
+ validateJsonSchemaInternal$1(
96871
96968
  data[key],
96872
96969
  schema.properties[key],
96873
96970
  `${path}.${key}`,
96874
- document
96971
+ document,
96972
+ visited
96875
96973
  )
96876
96974
  );
96877
96975
  }
96878
96976
  }
96879
96977
  return errorCollector.toValidationResponse();
96880
96978
  }
96881
- function validateArray$1(data, schema, path, document) {
96979
+ function validateArray$1(data, schema, path, document, visited) {
96882
96980
  if (schema.minItems !== void 0 && data.length < schema.minItems) {
96883
96981
  return invalidSchemaResponseWithError$1(
96884
96982
  new MinItemsViolationError$1(
@@ -96896,7 +96994,13 @@ function validateArray$1(data, schema, path, document) {
96896
96994
  const errorCollector = new JsonSchemaErrorCollector$1();
96897
96995
  data.forEach(
96898
96996
  (element, index) => errorCollector.append(
96899
- validateJsonSchema$1(element, schema.items, `${path}[${index}]`, document)
96997
+ validateJsonSchemaInternal$1(
96998
+ element,
96999
+ schema.items,
97000
+ `${path}[${index}]`,
97001
+ document,
97002
+ visited
97003
+ )
96900
97004
  )
96901
97005
  );
96902
97006
  return errorCollector.toValidationResponse();
@@ -96931,7 +97035,7 @@ function validateScalar$1(data, schema, path) {
96931
97035
  }
96932
97036
  return validSchemaResponse$1();
96933
97037
  }
96934
- function validateRef$1(data, schema, path, document) {
97038
+ function validateRef$1(data, schema, path, document, visited) {
96935
97039
  if (!schema.$ref.startsWith("#")) {
96936
97040
  return invalidSchemaResponseWithError$1(
96937
97041
  new InvalidRefError$1(
@@ -96939,11 +97043,23 @@ function validateRef$1(data, schema, path, document) {
96939
97043
  )
96940
97044
  );
96941
97045
  }
97046
+ let refsForData = visited.get(data);
97047
+ if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
97048
+ return validSchemaResponse$1();
97049
+ }
97050
+ if (refsForData === void 0) {
97051
+ refsForData = /* @__PURE__ */ new Set();
97052
+ visited.set(data, refsForData);
97053
+ }
97054
+ refsForData.add(schema.$ref);
96942
97055
  try {
96943
97056
  const schemaToValidate = findSchemaAtPath$1(document, schema.$ref);
96944
- return validateJsonSchema$1(data, schemaToValidate, path, document);
97057
+ return validateJsonSchemaInternal$1(data, schemaToValidate, path, document, visited);
96945
97058
  } catch (e) {
96946
97059
  return invalidSchemaResponseWithError$1(e);
97060
+ } finally {
97061
+ refsForData.delete(schema.$ref);
97062
+ if (refsForData.size === 0) visited.delete(data);
96947
97063
  }
96948
97064
  }
96949
97065
  function validateEnum$1(data, enumValue, path) {
@@ -98874,7 +98990,7 @@ register$1({
98874
98990
  id: '@salesforce/lds-network-adapter',
98875
98991
  instrument: instrument$2,
98876
98992
  });
98877
- // version: 1.428.0-dev1-c95a813572
98993
+ // version: 1.428.0-dev10-1e665d263f
98878
98994
 
98879
98995
  const { create: create$2, keys: keys$2 } = Object;
98880
98996
  const { stringify, parse } = JSON;
@@ -98965,6 +99081,9 @@ function invalidSchemaResponseWithError(error) {
98965
99081
  return err$4([error]);
98966
99082
  }
98967
99083
  function validateJsonSchema(data, schema, path = "$", document = schema) {
99084
+ return validateJsonSchemaInternal(data, schema, path, document, /* @__PURE__ */ new Map());
99085
+ }
99086
+ function validateJsonSchemaInternal(data, schema, path, document, visited) {
98968
99087
  if (schema === true) return validSchemaResponse();
98969
99088
  if (schema === false)
98970
99089
  return invalidSchemaResponseWithError(
@@ -98973,22 +99092,22 @@ function validateJsonSchema(data, schema, path = "$", document = schema) {
98973
99092
  const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
98974
99093
  const errorCollector = new JsonSchemaErrorCollector();
98975
99094
  if ("anyOf" in schema) {
98976
- errorCollector.append(validateAnyOf(data, schema, path, document));
99095
+ errorCollector.append(validateAnyOf(data, schema, path, document, visited));
98977
99096
  } else if ("oneOf" in schema) {
98978
- errorCollector.append(validateOneOf(data, schema, path, document));
99097
+ errorCollector.append(validateOneOf(data, schema, path, document, visited));
98979
99098
  } else if ("allOf" in schema) {
98980
- errorCollector.append(validateAllOf(data, schema, path, document));
99099
+ errorCollector.append(validateAllOf(data, schema, path, document, visited));
98981
99100
  } else if ("not" in schema) {
98982
- errorCollector.append(validateNot(data, schema, path, document));
99101
+ errorCollector.append(validateNot(data, schema, path, document, visited));
98983
99102
  } else if ("$ref" in schema) {
98984
- errorCollector.append(validateRef(data, schema, path, document));
99103
+ errorCollector.append(validateRef(data, schema, path, document, visited));
98985
99104
  } else if ("type" in schema) {
98986
99105
  if (schema.type === "object") {
98987
99106
  if (dataType !== "object") {
98988
99107
  errorCollector.add(incorrectTypeError("object", dataType, path));
98989
99108
  } else {
98990
99109
  errorCollector.append(
98991
- validateObject(data, schema, path, document)
99110
+ validateObject(data, schema, path, document, visited)
98992
99111
  );
98993
99112
  }
98994
99113
  } else if (schema.type === "array") {
@@ -98996,7 +99115,7 @@ function validateJsonSchema(data, schema, path = "$", document = schema) {
98996
99115
  errorCollector.add(incorrectTypeError("array", dataType, path));
98997
99116
  } else {
98998
99117
  errorCollector.append(
98999
- validateArray(data, schema, path, document)
99118
+ validateArray(data, schema, path, document, visited)
99000
99119
  );
99001
99120
  }
99002
99121
  } else {
@@ -99013,16 +99132,17 @@ function validateJsonSchema(data, schema, path = "$", document = schema) {
99013
99132
  }
99014
99133
  return errorCollector.toValidationResponse();
99015
99134
  }
99016
- function validateAnyOf(data, schema, path, document) {
99135
+ function validateAnyOf(data, schema, path, document, visited) {
99017
99136
  let isValid = false;
99018
99137
  const errorCollector = new JsonSchemaErrorCollector();
99019
99138
  for (let i = 0, { length } = schema.anyOf; i < length; i++) {
99020
99139
  const element = schema.anyOf[i];
99021
- const validationResponse = validateJsonSchema(
99140
+ const validationResponse = validateJsonSchemaInternal(
99022
99141
  data,
99023
99142
  element,
99024
99143
  `${path}.anyOf[${i}]`,
99025
- document
99144
+ document,
99145
+ visited
99026
99146
  );
99027
99147
  if (validationResponse.isOk()) {
99028
99148
  isValid = true;
@@ -99039,13 +99159,22 @@ function validateAnyOf(data, schema, path, document) {
99039
99159
  }
99040
99160
  return validSchemaResponse();
99041
99161
  }
99042
- function validateOneOf(data, schema, path, document) {
99162
+ function validateOneOf(data, schema, path, document, visited) {
99163
+ if (schema.discriminator !== void 0) {
99164
+ return validateDiscriminatedOneOf(data, schema.discriminator, path, document, visited);
99165
+ }
99043
99166
  let validSubShemaPaths = [];
99044
99167
  const errorCollector = new JsonSchemaErrorCollector();
99045
99168
  for (let i = 0, { length } = schema.oneOf; i < length; i++) {
99046
99169
  const element = schema.oneOf[i];
99047
99170
  const oneOfPath = `${path}.oneOf[${i}]`;
99048
- const validationResponse = validateJsonSchema(data, element, oneOfPath, document);
99171
+ const validationResponse = validateJsonSchemaInternal(
99172
+ data,
99173
+ element,
99174
+ oneOfPath,
99175
+ document,
99176
+ visited
99177
+ );
99049
99178
  if (validationResponse.isOk()) {
99050
99179
  validSubShemaPaths.push(oneOfPath);
99051
99180
  } else {
@@ -99067,16 +99196,45 @@ function validateOneOf(data, schema, path, document) {
99067
99196
  }
99068
99197
  return validSchemaResponse();
99069
99198
  }
99070
- function validateAllOf(data, schema, path, document) {
99199
+ function validateDiscriminatedOneOf(data, discriminator, path, document, visited) {
99200
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
99201
+ return invalidSchemaResponseWithError(incorrectTypeError("object", typeof data, path));
99202
+ }
99203
+ const { propertyName, mapping } = discriminator;
99204
+ const discriminatorValue = data[propertyName];
99205
+ if (discriminatorValue === void 0) {
99206
+ return invalidSchemaResponseWithError(
99207
+ new MissingRequiredPropertyError(
99208
+ `Object at path '${path}' is missing required discriminator property '${propertyName}'.`
99209
+ )
99210
+ );
99211
+ }
99212
+ if (typeof discriminatorValue !== "string") {
99213
+ return invalidSchemaResponseWithError(
99214
+ incorrectTypeError("string", typeof discriminatorValue, `${path}.${propertyName}`)
99215
+ );
99216
+ }
99217
+ const targetRef = mapping[discriminatorValue];
99218
+ if (targetRef === void 0) {
99219
+ return invalidSchemaResponseWithError(
99220
+ new JsonSchemaViolationError(
99221
+ `Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
99222
+ )
99223
+ );
99224
+ }
99225
+ return validateJsonSchemaInternal(data, { $ref: targetRef }, path, document, visited);
99226
+ }
99227
+ function validateAllOf(data, schema, path, document, visited) {
99071
99228
  let isValid = true;
99072
99229
  const errorCollector = new JsonSchemaErrorCollector();
99073
99230
  for (let i = 0, { length } = schema.allOf; i < length; i++) {
99074
99231
  const element = schema.allOf[i];
99075
- const validationResponse = validateJsonSchema(
99232
+ const validationResponse = validateJsonSchemaInternal(
99076
99233
  data,
99077
99234
  element,
99078
99235
  `${path}.allOf[${i}]`,
99079
- document
99236
+ document,
99237
+ visited
99080
99238
  );
99081
99239
  if (!validationResponse.isOk()) {
99082
99240
  errorCollector.append(validationResponse);
@@ -99090,8 +99248,14 @@ function validateAllOf(data, schema, path, document) {
99090
99248
  }
99091
99249
  return errorCollector.toValidationResponse();
99092
99250
  }
99093
- function validateNot(data, schema, path, document) {
99094
- const validationResponse = validateJsonSchema(data, schema.not, path, document);
99251
+ function validateNot(data, schema, path, document, visited) {
99252
+ const validationResponse = validateJsonSchemaInternal(
99253
+ data,
99254
+ schema.not,
99255
+ path,
99256
+ document,
99257
+ visited
99258
+ );
99095
99259
  if (validationResponse.isOk()) {
99096
99260
  return invalidSchemaResponseWithError(
99097
99261
  new JsonSchemaViolationError(
@@ -99101,7 +99265,7 @@ function validateNot(data, schema, path, document) {
99101
99265
  }
99102
99266
  return validSchemaResponse();
99103
99267
  }
99104
- function validateObject(data, schema, path, document) {
99268
+ function validateObject(data, schema, path, document, visited) {
99105
99269
  const schemaKeys = Object.keys(schema.properties);
99106
99270
  const requiredKeys = new Set(schema.required);
99107
99271
  const schemaKeySet = new Set(schemaKeys);
@@ -99109,11 +99273,12 @@ function validateObject(data, schema, path, document) {
99109
99273
  Object.keys(data).forEach((key) => {
99110
99274
  if (!schemaKeySet.has(key)) {
99111
99275
  errorCollector.append(
99112
- validateJsonSchema(
99276
+ validateJsonSchemaInternal(
99113
99277
  data[key],
99114
99278
  schema.additionalProperties,
99115
99279
  `${path}.additionalProperties[${key}]`,
99116
- document
99280
+ document,
99281
+ visited
99117
99282
  )
99118
99283
  );
99119
99284
  }
@@ -99130,18 +99295,19 @@ function validateObject(data, schema, path, document) {
99130
99295
  }
99131
99296
  if (keyInData) {
99132
99297
  errorCollector.append(
99133
- validateJsonSchema(
99298
+ validateJsonSchemaInternal(
99134
99299
  data[key],
99135
99300
  schema.properties[key],
99136
99301
  `${path}.${key}`,
99137
- document
99302
+ document,
99303
+ visited
99138
99304
  )
99139
99305
  );
99140
99306
  }
99141
99307
  }
99142
99308
  return errorCollector.toValidationResponse();
99143
99309
  }
99144
- function validateArray(data, schema, path, document) {
99310
+ function validateArray(data, schema, path, document, visited) {
99145
99311
  if (schema.minItems !== void 0 && data.length < schema.minItems) {
99146
99312
  return invalidSchemaResponseWithError(
99147
99313
  new MinItemsViolationError(
@@ -99159,7 +99325,13 @@ function validateArray(data, schema, path, document) {
99159
99325
  const errorCollector = new JsonSchemaErrorCollector();
99160
99326
  data.forEach(
99161
99327
  (element, index) => errorCollector.append(
99162
- validateJsonSchema(element, schema.items, `${path}[${index}]`, document)
99328
+ validateJsonSchemaInternal(
99329
+ element,
99330
+ schema.items,
99331
+ `${path}[${index}]`,
99332
+ document,
99333
+ visited
99334
+ )
99163
99335
  )
99164
99336
  );
99165
99337
  return errorCollector.toValidationResponse();
@@ -99194,7 +99366,7 @@ function validateScalar(data, schema, path) {
99194
99366
  }
99195
99367
  return validSchemaResponse();
99196
99368
  }
99197
- function validateRef(data, schema, path, document) {
99369
+ function validateRef(data, schema, path, document, visited) {
99198
99370
  if (!schema.$ref.startsWith("#")) {
99199
99371
  return invalidSchemaResponseWithError(
99200
99372
  new InvalidRefError(
@@ -99202,11 +99374,23 @@ function validateRef(data, schema, path, document) {
99202
99374
  )
99203
99375
  );
99204
99376
  }
99377
+ let refsForData = visited.get(data);
99378
+ if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
99379
+ return validSchemaResponse();
99380
+ }
99381
+ if (refsForData === void 0) {
99382
+ refsForData = /* @__PURE__ */ new Set();
99383
+ visited.set(data, refsForData);
99384
+ }
99385
+ refsForData.add(schema.$ref);
99205
99386
  try {
99206
99387
  const schemaToValidate = findSchemaAtPath(document, schema.$ref);
99207
- return validateJsonSchema(data, schemaToValidate, path, document);
99388
+ return validateJsonSchemaInternal(data, schemaToValidate, path, document, visited);
99208
99389
  } catch (e) {
99209
99390
  return invalidSchemaResponseWithError(e);
99391
+ } finally {
99392
+ refsForData.delete(schema.$ref);
99393
+ if (refsForData.size === 0) visited.delete(data);
99210
99394
  }
99211
99395
  }
99212
99396
  function validateEnum(data, enumValue, path) {
@@ -106812,7 +106996,7 @@ getServices(serviceRequirements).then((services) => {
106812
106996
  _(config, CONFIG_SCHEMA);
106813
106997
  const baseCommand = new graphql_imperative_ctor(config, documentRootType, services);
106814
106998
  return applyDecorators(baseCommand, [services.fetchNetworkCommandBaseClass.availableDecorators.abortable], options);
106815
- }, false);
106999
+ }, true);
106816
107000
  graphql_imperative_legacy = services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
106817
107001
  const _ = assertIsValid;
106818
107002
  _(config, CONFIG_SCHEMA);
@@ -106865,7 +107049,7 @@ function registerCallback(cb) {
106865
107049
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
106866
107050
  }
106867
107051
  }
106868
- // version: 1.428.0-dev1-52205c6c54
107052
+ // version: 1.428.0-dev10-109bf232e1
106869
107053
 
106870
107054
  function createFragmentMap(documentNode) {
106871
107055
  const fragments = {};
@@ -136102,7 +136286,7 @@ register$1({
136102
136286
  configuration: { ...configurationForGraphQLAdapters$1 },
136103
136287
  instrument: instrument$1,
136104
136288
  });
136105
- // version: 1.428.0-dev1-52205c6c54
136289
+ // version: 1.428.0-dev10-109bf232e1
136106
136290
 
136107
136291
  // On core the unstable adapters are re-exported with different names,
136108
136292
  // we want to match them here.
@@ -136254,7 +136438,7 @@ withDefaultLuvio((luvio) => {
136254
136438
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
136255
136439
  graphQLImperative = ldsAdapter;
136256
136440
  });
136257
- // version: 1.428.0-dev1-52205c6c54
136441
+ // version: 1.428.0-dev10-109bf232e1
136258
136442
 
136259
136443
  var gqlApi = /*#__PURE__*/Object.freeze({
136260
136444
  __proto__: null,
@@ -137053,7 +137237,7 @@ const callbacks$1 = [];
137053
137237
  function register(r) {
137054
137238
  callbacks$1.forEach((callback) => callback(r));
137055
137239
  }
137056
- // version: 1.428.0-dev1-c95a813572
137240
+ // version: 1.428.0-dev10-1e665d263f
137057
137241
 
137058
137242
  /**
137059
137243
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -138369,4 +138553,4 @@ const { luvio } = getRuntime();
138369
138553
  setDefaultLuvio({ luvio });
138370
138554
 
138371
138555
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
138372
- // version: 1.428.0-dev1-c95a813572
138556
+ // version: 1.428.0-dev10-1e665d263f