@salesforce/lds-worker-api 1.434.0 → 1.435.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.
@@ -4280,7 +4280,7 @@
4280
4280
  }
4281
4281
  callbacks.push(callback);
4282
4282
  }
4283
- // version: 1.434.0-d8deb0d4ea
4283
+ // version: 1.435.0-5818ce3c48
4284
4284
 
4285
4285
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4286
4286
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5324,7 +5324,7 @@
5324
5324
  const { apiFamily, name } = metadata;
5325
5325
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5326
5326
  }
5327
- // version: 1.434.0-d8deb0d4ea
5327
+ // version: 1.435.0-5818ce3c48
5328
5328
 
5329
5329
  function isSupportedEntity(_objectApiName) {
5330
5330
  return true;
@@ -12938,17 +12938,15 @@
12938
12938
  return objectInfo.fields[fieldApiName].relationshipName;
12939
12939
  }
12940
12940
  function getNameField$1(objectInfo, fieldApiName) {
12941
- // eslint-disable-next-line @salesforce/lds/no-invalid-todo
12942
- // TODO - this logic is adopted from lds222. It searches
12943
- // ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
12944
- // 1. If any of the arrays are empty returns `Name`
12945
- // 2. If `Name` is found in any array position then returns it
12946
- // 3. If the field has more than 1 references(polymorphic), return `Name`
12947
- // 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
12948
- // Rationale for this is unclear and needs clarification.
12949
12941
  const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
12950
12942
  if (referenceToInfos.length !== 1) {
12951
- return FIELD_NAME$1;
12943
+ // For polymorphic fields, return "Name" only if at least one referenced entity has it.
12944
+ // If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
12945
+ // sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
12946
+ // We stay permissive for mixed cases (some have Name, some don't) — those are handled
12947
+ // server-side once W-22253765's companion fix lands in QueryValidatorImpl.
12948
+ const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME$1));
12949
+ return anyHaveName ? FIELD_NAME$1 : undefined;
12952
12950
  }
12953
12951
  const firstReferenceNameFields = referenceToInfos[0].nameFields;
12954
12952
  if (firstReferenceNameFields.length < 1) {
@@ -12983,8 +12981,11 @@
12983
12981
  // By default, include the "Id" field on spanning records that are on the layout.
12984
12982
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID$1}`);
12985
12983
  const nameField = getNameField$1(objectInfo, apiName);
12986
- // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
12987
- qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
12984
+ // W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
12985
+ // W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
12986
+ if (nameField !== undefined) {
12987
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
12988
+ }
12988
12989
  }
12989
12990
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
12990
12991
  }
@@ -13018,8 +13019,11 @@
13018
13019
  // Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
13019
13020
  const idFieldName = `${apiName}.${relationshipName}.Id`;
13020
13021
  lookupFields[idFieldName] = true;
13021
- const nameField = `${apiName}.${relationshipName}.${getNameField$1(objectInfo, fieldName)}`;
13022
- lookupFields[nameField] = true;
13022
+ const resolvedNameField = getNameField$1(objectInfo, fieldName);
13023
+ // W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
13024
+ if (resolvedNameField !== undefined) {
13025
+ lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
13026
+ }
13023
13027
  }
13024
13028
  return keys$9(lookupFields);
13025
13029
  }
@@ -32518,7 +32522,7 @@
32518
32522
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
32519
32523
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
32520
32524
  });
32521
- // version: 1.434.0-6aa2dd15e3
32525
+ // version: 1.435.0-615ebb9bbd
32522
32526
 
32523
32527
  var allowUpdatesForNonCachedRecords = {
32524
32528
  isOpen: function (e) {
@@ -44599,6 +44603,9 @@
44599
44603
  return err$3([error]);
44600
44604
  }
44601
44605
  function validateJsonSchema$1(data, schema, path = "$", document = schema) {
44606
+ return validateJsonSchemaInternal$1(data, schema, path, document, /* @__PURE__ */ new Map());
44607
+ }
44608
+ function validateJsonSchemaInternal$1(data, schema, path, document, visited) {
44602
44609
  if (schema === true) return validSchemaResponse$1();
44603
44610
  if (schema === false)
44604
44611
  return invalidSchemaResponseWithError$1(
@@ -44607,22 +44614,22 @@
44607
44614
  const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
44608
44615
  const errorCollector = new JsonSchemaErrorCollector$1();
44609
44616
  if ("anyOf" in schema) {
44610
- errorCollector.append(validateAnyOf$1(data, schema, path, document));
44617
+ errorCollector.append(validateAnyOf$1(data, schema, path, document, visited));
44611
44618
  } else if ("oneOf" in schema) {
44612
- errorCollector.append(validateOneOf$1(data, schema, path, document));
44619
+ errorCollector.append(validateOneOf$1(data, schema, path, document, visited));
44613
44620
  } else if ("allOf" in schema) {
44614
- errorCollector.append(validateAllOf$1(data, schema, path, document));
44621
+ errorCollector.append(validateAllOf$1(data, schema, path, document, visited));
44615
44622
  } else if ("not" in schema) {
44616
- errorCollector.append(validateNot$1(data, schema, path, document));
44623
+ errorCollector.append(validateNot$1(data, schema, path, document, visited));
44617
44624
  } else if ("$ref" in schema) {
44618
- errorCollector.append(validateRef$1(data, schema, path, document));
44625
+ errorCollector.append(validateRef$1(data, schema, path, document, visited));
44619
44626
  } else if ("type" in schema) {
44620
44627
  if (schema.type === "object") {
44621
44628
  if (dataType !== "object") {
44622
44629
  errorCollector.add(incorrectTypeError$1("object", dataType, path));
44623
44630
  } else {
44624
44631
  errorCollector.append(
44625
- validateObject$1(data, schema, path, document)
44632
+ validateObject$1(data, schema, path, document, visited)
44626
44633
  );
44627
44634
  }
44628
44635
  } else if (schema.type === "array") {
@@ -44630,7 +44637,7 @@
44630
44637
  errorCollector.add(incorrectTypeError$1("array", dataType, path));
44631
44638
  } else {
44632
44639
  errorCollector.append(
44633
- validateArray$1(data, schema, path, document)
44640
+ validateArray$1(data, schema, path, document, visited)
44634
44641
  );
44635
44642
  }
44636
44643
  } else {
@@ -44647,16 +44654,17 @@
44647
44654
  }
44648
44655
  return errorCollector.toValidationResponse();
44649
44656
  }
44650
- function validateAnyOf$1(data, schema, path, document) {
44657
+ function validateAnyOf$1(data, schema, path, document, visited) {
44651
44658
  let isValid = false;
44652
44659
  const errorCollector = new JsonSchemaErrorCollector$1();
44653
44660
  for (let i = 0, { length } = schema.anyOf; i < length; i++) {
44654
44661
  const element = schema.anyOf[i];
44655
- const validationResponse = validateJsonSchema$1(
44662
+ const validationResponse = validateJsonSchemaInternal$1(
44656
44663
  data,
44657
44664
  element,
44658
44665
  `${path}.anyOf[${i}]`,
44659
- document
44666
+ document,
44667
+ visited
44660
44668
  );
44661
44669
  if (validationResponse.isOk()) {
44662
44670
  isValid = true;
@@ -44673,13 +44681,22 @@
44673
44681
  }
44674
44682
  return validSchemaResponse$1();
44675
44683
  }
44676
- function validateOneOf$1(data, schema, path, document) {
44684
+ function validateOneOf$1(data, schema, path, document, visited) {
44685
+ if (schema.discriminator !== void 0) {
44686
+ return validateDiscriminatedOneOf$1(data, schema.discriminator, path, document, visited);
44687
+ }
44677
44688
  let validSubShemaPaths = [];
44678
44689
  const errorCollector = new JsonSchemaErrorCollector$1();
44679
44690
  for (let i = 0, { length } = schema.oneOf; i < length; i++) {
44680
44691
  const element = schema.oneOf[i];
44681
44692
  const oneOfPath = `${path}.oneOf[${i}]`;
44682
- const validationResponse = validateJsonSchema$1(data, element, oneOfPath, document);
44693
+ const validationResponse = validateJsonSchemaInternal$1(
44694
+ data,
44695
+ element,
44696
+ oneOfPath,
44697
+ document,
44698
+ visited
44699
+ );
44683
44700
  if (validationResponse.isOk()) {
44684
44701
  validSubShemaPaths.push(oneOfPath);
44685
44702
  } else {
@@ -44701,16 +44718,45 @@
44701
44718
  }
44702
44719
  return validSchemaResponse$1();
44703
44720
  }
44704
- function validateAllOf$1(data, schema, path, document) {
44721
+ function validateDiscriminatedOneOf$1(data, discriminator, path, document, visited) {
44722
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
44723
+ return invalidSchemaResponseWithError$1(incorrectTypeError$1("object", typeof data, path));
44724
+ }
44725
+ const { propertyName, mapping } = discriminator;
44726
+ const discriminatorValue = data[propertyName];
44727
+ if (discriminatorValue === void 0) {
44728
+ return invalidSchemaResponseWithError$1(
44729
+ new MissingRequiredPropertyError$1(
44730
+ `Object at path '${path}' is missing required discriminator property '${propertyName}'.`
44731
+ )
44732
+ );
44733
+ }
44734
+ if (typeof discriminatorValue !== "string") {
44735
+ return invalidSchemaResponseWithError$1(
44736
+ incorrectTypeError$1("string", typeof discriminatorValue, `${path}.${propertyName}`)
44737
+ );
44738
+ }
44739
+ const targetRef = mapping[discriminatorValue];
44740
+ if (targetRef === void 0) {
44741
+ return invalidSchemaResponseWithError$1(
44742
+ new JsonSchemaViolationError$1(
44743
+ `Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
44744
+ )
44745
+ );
44746
+ }
44747
+ return validateJsonSchemaInternal$1(data, { $ref: targetRef }, path, document, visited);
44748
+ }
44749
+ function validateAllOf$1(data, schema, path, document, visited) {
44705
44750
  let isValid = true;
44706
44751
  const errorCollector = new JsonSchemaErrorCollector$1();
44707
44752
  for (let i = 0, { length } = schema.allOf; i < length; i++) {
44708
44753
  const element = schema.allOf[i];
44709
- const validationResponse = validateJsonSchema$1(
44754
+ const validationResponse = validateJsonSchemaInternal$1(
44710
44755
  data,
44711
44756
  element,
44712
44757
  `${path}.allOf[${i}]`,
44713
- document
44758
+ document,
44759
+ visited
44714
44760
  );
44715
44761
  if (!validationResponse.isOk()) {
44716
44762
  errorCollector.append(validationResponse);
@@ -44724,8 +44770,14 @@
44724
44770
  }
44725
44771
  return errorCollector.toValidationResponse();
44726
44772
  }
44727
- function validateNot$1(data, schema, path, document) {
44728
- const validationResponse = validateJsonSchema$1(data, schema.not, path, document);
44773
+ function validateNot$1(data, schema, path, document, visited) {
44774
+ const validationResponse = validateJsonSchemaInternal$1(
44775
+ data,
44776
+ schema.not,
44777
+ path,
44778
+ document,
44779
+ visited
44780
+ );
44729
44781
  if (validationResponse.isOk()) {
44730
44782
  return invalidSchemaResponseWithError$1(
44731
44783
  new JsonSchemaViolationError$1(
@@ -44735,7 +44787,7 @@
44735
44787
  }
44736
44788
  return validSchemaResponse$1();
44737
44789
  }
44738
- function validateObject$1(data, schema, path, document) {
44790
+ function validateObject$1(data, schema, path, document, visited) {
44739
44791
  const schemaKeys = Object.keys(schema.properties);
44740
44792
  const requiredKeys = new Set(schema.required);
44741
44793
  const schemaKeySet = new Set(schemaKeys);
@@ -44743,11 +44795,12 @@
44743
44795
  Object.keys(data).forEach((key) => {
44744
44796
  if (!schemaKeySet.has(key)) {
44745
44797
  errorCollector.append(
44746
- validateJsonSchema$1(
44798
+ validateJsonSchemaInternal$1(
44747
44799
  data[key],
44748
44800
  schema.additionalProperties,
44749
44801
  `${path}.additionalProperties[${key}]`,
44750
- document
44802
+ document,
44803
+ visited
44751
44804
  )
44752
44805
  );
44753
44806
  }
@@ -44764,18 +44817,19 @@
44764
44817
  }
44765
44818
  if (keyInData) {
44766
44819
  errorCollector.append(
44767
- validateJsonSchema$1(
44820
+ validateJsonSchemaInternal$1(
44768
44821
  data[key],
44769
44822
  schema.properties[key],
44770
44823
  `${path}.${key}`,
44771
- document
44824
+ document,
44825
+ visited
44772
44826
  )
44773
44827
  );
44774
44828
  }
44775
44829
  }
44776
44830
  return errorCollector.toValidationResponse();
44777
44831
  }
44778
- function validateArray$1(data, schema, path, document) {
44832
+ function validateArray$1(data, schema, path, document, visited) {
44779
44833
  if (schema.minItems !== void 0 && data.length < schema.minItems) {
44780
44834
  return invalidSchemaResponseWithError$1(
44781
44835
  new MinItemsViolationError$1(
@@ -44793,7 +44847,13 @@
44793
44847
  const errorCollector = new JsonSchemaErrorCollector$1();
44794
44848
  data.forEach(
44795
44849
  (element, index) => errorCollector.append(
44796
- validateJsonSchema$1(element, schema.items, `${path}[${index}]`, document)
44850
+ validateJsonSchemaInternal$1(
44851
+ element,
44852
+ schema.items,
44853
+ `${path}[${index}]`,
44854
+ document,
44855
+ visited
44856
+ )
44797
44857
  )
44798
44858
  );
44799
44859
  return errorCollector.toValidationResponse();
@@ -44828,7 +44888,7 @@
44828
44888
  }
44829
44889
  return validSchemaResponse$1();
44830
44890
  }
44831
- function validateRef$1(data, schema, path, document) {
44891
+ function validateRef$1(data, schema, path, document, visited) {
44832
44892
  if (!schema.$ref.startsWith("#")) {
44833
44893
  return invalidSchemaResponseWithError$1(
44834
44894
  new InvalidRefError$1(
@@ -44836,11 +44896,23 @@
44836
44896
  )
44837
44897
  );
44838
44898
  }
44899
+ let refsForData = visited.get(data);
44900
+ if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
44901
+ return validSchemaResponse$1();
44902
+ }
44903
+ if (refsForData === void 0) {
44904
+ refsForData = /* @__PURE__ */ new Set();
44905
+ visited.set(data, refsForData);
44906
+ }
44907
+ refsForData.add(schema.$ref);
44839
44908
  try {
44840
44909
  const schemaToValidate = findSchemaAtPath$1(document, schema.$ref);
44841
- return validateJsonSchema$1(data, schemaToValidate, path, document);
44910
+ return validateJsonSchemaInternal$1(data, schemaToValidate, path, document, visited);
44842
44911
  } catch (e) {
44843
44912
  return invalidSchemaResponseWithError$1(e);
44913
+ } finally {
44914
+ refsForData.delete(schema.$ref);
44915
+ if (refsForData.size === 0) visited.delete(data);
44844
44916
  }
44845
44917
  }
44846
44918
  function validateEnum$1(data, enumValue, path) {
@@ -46047,7 +46119,11 @@
46047
46119
  queryParams: {},
46048
46120
  headers: {},
46049
46121
  };
46050
- return dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, aggregateUiResourceRequest, resourceRequestContext);
46122
+ // Re-enter the composed adapter (when registered) so routing and interceptors
46123
+ // apply to the synthesized aggregate-ui sub-request. Fall back to the base
46124
+ // adapter when unregistered (e.g. in lds-network-adapter unit tests).
46125
+ const subRequestAdapter = networkAdapter;
46126
+ return dispatchSplitRecordAggregateUiAction(recordId, subRequestAdapter, aggregateUiResourceRequest, resourceRequestContext);
46051
46127
  }
46052
46128
  const getRecordDispatcher = (req) => {
46053
46129
  const { resourceRequest, networkAdapter, resourceRequestContext } = req;
@@ -46103,7 +46179,6 @@
46103
46179
  }
46104
46180
  return null;
46105
46181
  }
46106
-
46107
46182
  const defaultDispatcher = (req) => {
46108
46183
  const { networkAdapter, resourceRequest, resourceRequestContext } = req;
46109
46184
  return networkAdapter(resourceRequest, resourceRequestContext);
@@ -96571,7 +96646,7 @@
96571
96646
  },
96572
96647
  };
96573
96648
  }
96574
- // version: 1.434.0-6aa2dd15e3
96649
+ // version: 1.435.0-5818ce3c48
96575
96650
 
96576
96651
  /**
96577
96652
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96597,7 +96672,7 @@
96597
96672
  },
96598
96673
  };
96599
96674
  }
96600
- // version: 1.434.0-6aa2dd15e3
96675
+ // version: 1.435.0-5818ce3c48
96601
96676
 
96602
96677
  /*!
96603
96678
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -97082,6 +97157,9 @@
97082
97157
  return err$1([error]);
97083
97158
  }
97084
97159
  function validateJsonSchema(data, schema, path = "$", document = schema) {
97160
+ return validateJsonSchemaInternal(data, schema, path, document, /* @__PURE__ */ new Map());
97161
+ }
97162
+ function validateJsonSchemaInternal(data, schema, path, document, visited) {
97085
97163
  if (schema === true) return validSchemaResponse();
97086
97164
  if (schema === false)
97087
97165
  return invalidSchemaResponseWithError(
@@ -97090,22 +97168,22 @@
97090
97168
  const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
97091
97169
  const errorCollector = new JsonSchemaErrorCollector();
97092
97170
  if ("anyOf" in schema) {
97093
- errorCollector.append(validateAnyOf(data, schema, path, document));
97171
+ errorCollector.append(validateAnyOf(data, schema, path, document, visited));
97094
97172
  } else if ("oneOf" in schema) {
97095
- errorCollector.append(validateOneOf(data, schema, path, document));
97173
+ errorCollector.append(validateOneOf(data, schema, path, document, visited));
97096
97174
  } else if ("allOf" in schema) {
97097
- errorCollector.append(validateAllOf(data, schema, path, document));
97175
+ errorCollector.append(validateAllOf(data, schema, path, document, visited));
97098
97176
  } else if ("not" in schema) {
97099
- errorCollector.append(validateNot(data, schema, path, document));
97177
+ errorCollector.append(validateNot(data, schema, path, document, visited));
97100
97178
  } else if ("$ref" in schema) {
97101
- errorCollector.append(validateRef(data, schema, path, document));
97179
+ errorCollector.append(validateRef(data, schema, path, document, visited));
97102
97180
  } else if ("type" in schema) {
97103
97181
  if (schema.type === "object") {
97104
97182
  if (dataType !== "object") {
97105
97183
  errorCollector.add(incorrectTypeError("object", dataType, path));
97106
97184
  } else {
97107
97185
  errorCollector.append(
97108
- validateObject(data, schema, path, document)
97186
+ validateObject(data, schema, path, document, visited)
97109
97187
  );
97110
97188
  }
97111
97189
  } else if (schema.type === "array") {
@@ -97113,7 +97191,7 @@
97113
97191
  errorCollector.add(incorrectTypeError("array", dataType, path));
97114
97192
  } else {
97115
97193
  errorCollector.append(
97116
- validateArray(data, schema, path, document)
97194
+ validateArray(data, schema, path, document, visited)
97117
97195
  );
97118
97196
  }
97119
97197
  } else {
@@ -97130,16 +97208,17 @@
97130
97208
  }
97131
97209
  return errorCollector.toValidationResponse();
97132
97210
  }
97133
- function validateAnyOf(data, schema, path, document) {
97211
+ function validateAnyOf(data, schema, path, document, visited) {
97134
97212
  let isValid = false;
97135
97213
  const errorCollector = new JsonSchemaErrorCollector();
97136
97214
  for (let i = 0, { length } = schema.anyOf; i < length; i++) {
97137
97215
  const element = schema.anyOf[i];
97138
- const validationResponse = validateJsonSchema(
97216
+ const validationResponse = validateJsonSchemaInternal(
97139
97217
  data,
97140
97218
  element,
97141
97219
  `${path}.anyOf[${i}]`,
97142
- document
97220
+ document,
97221
+ visited
97143
97222
  );
97144
97223
  if (validationResponse.isOk()) {
97145
97224
  isValid = true;
@@ -97156,13 +97235,22 @@
97156
97235
  }
97157
97236
  return validSchemaResponse();
97158
97237
  }
97159
- function validateOneOf(data, schema, path, document) {
97238
+ function validateOneOf(data, schema, path, document, visited) {
97239
+ if (schema.discriminator !== void 0) {
97240
+ return validateDiscriminatedOneOf(data, schema.discriminator, path, document, visited);
97241
+ }
97160
97242
  let validSubShemaPaths = [];
97161
97243
  const errorCollector = new JsonSchemaErrorCollector();
97162
97244
  for (let i = 0, { length } = schema.oneOf; i < length; i++) {
97163
97245
  const element = schema.oneOf[i];
97164
97246
  const oneOfPath = `${path}.oneOf[${i}]`;
97165
- const validationResponse = validateJsonSchema(data, element, oneOfPath, document);
97247
+ const validationResponse = validateJsonSchemaInternal(
97248
+ data,
97249
+ element,
97250
+ oneOfPath,
97251
+ document,
97252
+ visited
97253
+ );
97166
97254
  if (validationResponse.isOk()) {
97167
97255
  validSubShemaPaths.push(oneOfPath);
97168
97256
  } else {
@@ -97184,16 +97272,45 @@
97184
97272
  }
97185
97273
  return validSchemaResponse();
97186
97274
  }
97187
- function validateAllOf(data, schema, path, document) {
97275
+ function validateDiscriminatedOneOf(data, discriminator, path, document, visited) {
97276
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
97277
+ return invalidSchemaResponseWithError(incorrectTypeError("object", typeof data, path));
97278
+ }
97279
+ const { propertyName, mapping } = discriminator;
97280
+ const discriminatorValue = data[propertyName];
97281
+ if (discriminatorValue === void 0) {
97282
+ return invalidSchemaResponseWithError(
97283
+ new MissingRequiredPropertyError(
97284
+ `Object at path '${path}' is missing required discriminator property '${propertyName}'.`
97285
+ )
97286
+ );
97287
+ }
97288
+ if (typeof discriminatorValue !== "string") {
97289
+ return invalidSchemaResponseWithError(
97290
+ incorrectTypeError("string", typeof discriminatorValue, `${path}.${propertyName}`)
97291
+ );
97292
+ }
97293
+ const targetRef = mapping[discriminatorValue];
97294
+ if (targetRef === void 0) {
97295
+ return invalidSchemaResponseWithError(
97296
+ new JsonSchemaViolationError(
97297
+ `Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
97298
+ )
97299
+ );
97300
+ }
97301
+ return validateJsonSchemaInternal(data, { $ref: targetRef }, path, document, visited);
97302
+ }
97303
+ function validateAllOf(data, schema, path, document, visited) {
97188
97304
  let isValid = true;
97189
97305
  const errorCollector = new JsonSchemaErrorCollector();
97190
97306
  for (let i = 0, { length } = schema.allOf; i < length; i++) {
97191
97307
  const element = schema.allOf[i];
97192
- const validationResponse = validateJsonSchema(
97308
+ const validationResponse = validateJsonSchemaInternal(
97193
97309
  data,
97194
97310
  element,
97195
97311
  `${path}.allOf[${i}]`,
97196
- document
97312
+ document,
97313
+ visited
97197
97314
  );
97198
97315
  if (!validationResponse.isOk()) {
97199
97316
  errorCollector.append(validationResponse);
@@ -97207,8 +97324,14 @@
97207
97324
  }
97208
97325
  return errorCollector.toValidationResponse();
97209
97326
  }
97210
- function validateNot(data, schema, path, document) {
97211
- const validationResponse = validateJsonSchema(data, schema.not, path, document);
97327
+ function validateNot(data, schema, path, document, visited) {
97328
+ const validationResponse = validateJsonSchemaInternal(
97329
+ data,
97330
+ schema.not,
97331
+ path,
97332
+ document,
97333
+ visited
97334
+ );
97212
97335
  if (validationResponse.isOk()) {
97213
97336
  return invalidSchemaResponseWithError(
97214
97337
  new JsonSchemaViolationError(
@@ -97218,7 +97341,7 @@
97218
97341
  }
97219
97342
  return validSchemaResponse();
97220
97343
  }
97221
- function validateObject(data, schema, path, document) {
97344
+ function validateObject(data, schema, path, document, visited) {
97222
97345
  const schemaKeys = Object.keys(schema.properties);
97223
97346
  const requiredKeys = new Set(schema.required);
97224
97347
  const schemaKeySet = new Set(schemaKeys);
@@ -97226,11 +97349,12 @@
97226
97349
  Object.keys(data).forEach((key) => {
97227
97350
  if (!schemaKeySet.has(key)) {
97228
97351
  errorCollector.append(
97229
- validateJsonSchema(
97352
+ validateJsonSchemaInternal(
97230
97353
  data[key],
97231
97354
  schema.additionalProperties,
97232
97355
  `${path}.additionalProperties[${key}]`,
97233
- document
97356
+ document,
97357
+ visited
97234
97358
  )
97235
97359
  );
97236
97360
  }
@@ -97247,18 +97371,19 @@
97247
97371
  }
97248
97372
  if (keyInData) {
97249
97373
  errorCollector.append(
97250
- validateJsonSchema(
97374
+ validateJsonSchemaInternal(
97251
97375
  data[key],
97252
97376
  schema.properties[key],
97253
97377
  `${path}.${key}`,
97254
- document
97378
+ document,
97379
+ visited
97255
97380
  )
97256
97381
  );
97257
97382
  }
97258
97383
  }
97259
97384
  return errorCollector.toValidationResponse();
97260
97385
  }
97261
- function validateArray(data, schema, path, document) {
97386
+ function validateArray(data, schema, path, document, visited) {
97262
97387
  if (schema.minItems !== void 0 && data.length < schema.minItems) {
97263
97388
  return invalidSchemaResponseWithError(
97264
97389
  new MinItemsViolationError(
@@ -97276,7 +97401,13 @@
97276
97401
  const errorCollector = new JsonSchemaErrorCollector();
97277
97402
  data.forEach(
97278
97403
  (element, index) => errorCollector.append(
97279
- validateJsonSchema(element, schema.items, `${path}[${index}]`, document)
97404
+ validateJsonSchemaInternal(
97405
+ element,
97406
+ schema.items,
97407
+ `${path}[${index}]`,
97408
+ document,
97409
+ visited
97410
+ )
97280
97411
  )
97281
97412
  );
97282
97413
  return errorCollector.toValidationResponse();
@@ -97311,7 +97442,7 @@
97311
97442
  }
97312
97443
  return validSchemaResponse();
97313
97444
  }
97314
- function validateRef(data, schema, path, document) {
97445
+ function validateRef(data, schema, path, document, visited) {
97315
97446
  if (!schema.$ref.startsWith("#")) {
97316
97447
  return invalidSchemaResponseWithError(
97317
97448
  new InvalidRefError(
@@ -97319,11 +97450,23 @@
97319
97450
  )
97320
97451
  );
97321
97452
  }
97453
+ let refsForData = visited.get(data);
97454
+ if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
97455
+ return validSchemaResponse();
97456
+ }
97457
+ if (refsForData === void 0) {
97458
+ refsForData = /* @__PURE__ */ new Set();
97459
+ visited.set(data, refsForData);
97460
+ }
97461
+ refsForData.add(schema.$ref);
97322
97462
  try {
97323
97463
  const schemaToValidate = findSchemaAtPath(document, schema.$ref);
97324
- return validateJsonSchema(data, schemaToValidate, path, document);
97464
+ return validateJsonSchemaInternal(data, schemaToValidate, path, document, visited);
97325
97465
  } catch (e) {
97326
97466
  return invalidSchemaResponseWithError(e);
97467
+ } finally {
97468
+ refsForData.delete(schema.$ref);
97469
+ if (refsForData.size === 0) visited.delete(data);
97327
97470
  }
97328
97471
  }
97329
97472
  function validateEnum(data, enumValue, path) {
@@ -99257,7 +99400,7 @@
99257
99400
  id: '@salesforce/lds-network-adapter',
99258
99401
  instrument: instrument$2,
99259
99402
  });
99260
- // version: 1.434.0-d8deb0d4ea
99403
+ // version: 1.435.0-5818ce3c48
99261
99404
 
99262
99405
  const { create: create$2, keys: keys$2 } = Object;
99263
99406
  const { stringify, parse } = JSON;
@@ -106403,6 +106546,7 @@
106403
106546
  };
106404
106547
  }
106405
106548
 
106549
+ const REFRESH_FAILED_MESSAGE = 'Failed to refresh GraphQL data';
106406
106550
  function validateNonQueryGraphQLConfig(config) {
106407
106551
  if (config !== null && typeof config === 'object') {
106408
106552
  if (hasOwnProperty$1.call(config, 'operationName') &&
@@ -106519,6 +106663,7 @@
106519
106663
  let processScheduled = false;
106520
106664
  let processingInitialConfig = false;
106521
106665
  let unsubscribe;
106666
+ let currentResultRefresh;
106522
106667
  const statusAtom = atom('unconfigured');
106523
106668
  const errorsAtom = atom(undefined);
106524
106669
  const dataAtom = atom(undefined);
@@ -106528,7 +106673,7 @@
106528
106673
  setAtom(errorsAtom, errors);
106529
106674
  setAtom(dataAtom, data);
106530
106675
  };
106531
- const refreshCallback = (refreshResult) => {
106676
+ const subscribeCallback = (refreshResult) => {
106532
106677
  if (refreshResult.isOk()) {
106533
106678
  resultCallback({
106534
106679
  ok: true,
@@ -106557,12 +106702,13 @@
106557
106702
  .then((result) => {
106558
106703
  // handle the initial result
106559
106704
  if (result.isOk()) {
106705
+ currentResultRefresh = result.value.refresh.bind(result.value);
106560
106706
  resultCallback({
106561
106707
  ok: true,
106562
106708
  data: result.value.data.data,
106563
106709
  errors: undefined,
106564
106710
  });
106565
- unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(refreshCallback));
106711
+ unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(subscribeCallback));
106566
106712
  }
106567
106713
  else {
106568
106714
  const resp = toGraphQLResponseFromFailure(result.error.failure);
@@ -106575,6 +106721,7 @@
106575
106721
  });
106576
106722
  };
106577
106723
  const queueConfigUpdate = (config) => {
106724
+ currentResultRefresh = undefined;
106578
106725
  try {
106579
106726
  const configIsGood = _checkConfig(config);
106580
106727
  queuedConfig = configIsGood ? config : undefined;
@@ -106601,6 +106748,23 @@
106601
106748
  }
106602
106749
  };
106603
106750
  const setters = createSetters(allowedKeys, queueConfigUpdate);
106751
+ const refresh = () => {
106752
+ const status = statusAtom.value;
106753
+ if (status === 'unconfigured' || status === 'error' || status === 'loading') {
106754
+ return Promise.reject(new Error(REFRESH_FAILED_MESSAGE));
106755
+ }
106756
+ // status === 'loaded'
106757
+ return new Promise((resolve, reject) => {
106758
+ currentResultRefresh().then((res) => {
106759
+ if (res.isOk()) {
106760
+ resolve();
106761
+ }
106762
+ else {
106763
+ reject(new Error(REFRESH_FAILED_MESSAGE));
106764
+ }
106765
+ }, reject);
106766
+ });
106767
+ };
106604
106768
  if (initialConfig) {
106605
106769
  try {
106606
106770
  processingInitialConfig = true;
@@ -106614,6 +106778,7 @@
106614
106778
  status: statusAtom,
106615
106779
  errors: errorsAtom,
106616
106780
  data: dataAtom,
106781
+ refresh,
106617
106782
  ...setters,
106618
106783
  };
106619
106784
  }, {
@@ -106889,7 +107054,7 @@
106889
107054
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
106890
107055
  }
106891
107056
  }
106892
- // version: 1.434.0-6aa2dd15e3
107057
+ // version: 1.435.0-615ebb9bbd
106893
107058
 
106894
107059
  function createFragmentMap(documentNode) {
106895
107060
  const fragments = {};
@@ -136096,7 +136261,7 @@
136096
136261
  configuration: { ...configurationForGraphQLAdapters$1 },
136097
136262
  instrument: instrument$1,
136098
136263
  });
136099
- // version: 1.434.0-6aa2dd15e3
136264
+ // version: 1.435.0-615ebb9bbd
136100
136265
 
136101
136266
  // On core the unstable adapters are re-exported with different names,
136102
136267
  // we want to match them here.
@@ -136248,7 +136413,7 @@
136248
136413
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
136249
136414
  graphQLImperative = ldsAdapter;
136250
136415
  });
136251
- // version: 1.434.0-6aa2dd15e3
136416
+ // version: 1.435.0-615ebb9bbd
136252
136417
 
136253
136418
  var gqlApi = /*#__PURE__*/Object.freeze({
136254
136419
  __proto__: null,
@@ -137047,7 +137212,7 @@
137047
137212
  function register(r) {
137048
137213
  callbacks$1.forEach((callback) => callback(r));
137049
137214
  }
137050
- // version: 1.434.0-d8deb0d4ea
137215
+ // version: 1.435.0-5818ce3c48
137051
137216
 
137052
137217
  /**
137053
137218
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -138357,4 +138522,4 @@
138357
138522
  exports.subscribeToAdapter = subscribeToAdapter;
138358
138523
 
138359
138524
  }));
138360
- // version: 1.434.0-d8deb0d4ea
138525
+ // version: 1.435.0-5818ce3c48