@salesforce/lds-worker-api 1.434.0 → 1.435.1

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.434.0-d8deb0d4ea
4277
+ // version: 1.435.1-4492aa27df
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.434.0-d8deb0d4ea
5321
+ // version: 1.435.1-4492aa27df
5322
5322
 
5323
5323
  function isSupportedEntity(_objectApiName) {
5324
5324
  return true;
@@ -12932,17 +12932,15 @@ function getRelationshipName$1(objectInfo, fieldApiName) {
12932
12932
  return objectInfo.fields[fieldApiName].relationshipName;
12933
12933
  }
12934
12934
  function getNameField$1(objectInfo, fieldApiName) {
12935
- // eslint-disable-next-line @salesforce/lds/no-invalid-todo
12936
- // TODO - this logic is adopted from lds222. It searches
12937
- // ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
12938
- // 1. If any of the arrays are empty returns `Name`
12939
- // 2. If `Name` is found in any array position then returns it
12940
- // 3. If the field has more than 1 references(polymorphic), return `Name`
12941
- // 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
12942
- // Rationale for this is unclear and needs clarification.
12943
12935
  const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
12944
12936
  if (referenceToInfos.length !== 1) {
12945
- return FIELD_NAME$1;
12937
+ // For polymorphic fields, return "Name" only if at least one referenced entity has it.
12938
+ // If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
12939
+ // sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
12940
+ // We stay permissive for mixed cases (some have Name, some don't) — those are handled
12941
+ // server-side once W-22253765's companion fix lands in QueryValidatorImpl.
12942
+ const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME$1));
12943
+ return anyHaveName ? FIELD_NAME$1 : undefined;
12946
12944
  }
12947
12945
  const firstReferenceNameFields = referenceToInfos[0].nameFields;
12948
12946
  if (firstReferenceNameFields.length < 1) {
@@ -12977,8 +12975,11 @@ function getQualifiedFieldApiNamesFromLayout$1(layout, objectInfo) {
12977
12975
  // By default, include the "Id" field on spanning records that are on the layout.
12978
12976
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID$1}`);
12979
12977
  const nameField = getNameField$1(objectInfo, apiName);
12980
- // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
12981
- qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
12978
+ // W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
12979
+ // W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
12980
+ if (nameField !== undefined) {
12981
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
12982
+ }
12982
12983
  }
12983
12984
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
12984
12985
  }
@@ -13012,8 +13013,11 @@ function getMissingRecordLookupFields$1(record, objectInfo) {
13012
13013
  // Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
13013
13014
  const idFieldName = `${apiName}.${relationshipName}.Id`;
13014
13015
  lookupFields[idFieldName] = true;
13015
- const nameField = `${apiName}.${relationshipName}.${getNameField$1(objectInfo, fieldName)}`;
13016
- lookupFields[nameField] = true;
13016
+ const resolvedNameField = getNameField$1(objectInfo, fieldName);
13017
+ // W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
13018
+ if (resolvedNameField !== undefined) {
13019
+ lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
13020
+ }
13017
13021
  }
13018
13022
  return keys$9(lookupFields);
13019
13023
  }
@@ -32512,7 +32516,7 @@ withDefaultLuvio((luvio) => {
32512
32516
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
32513
32517
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
32514
32518
  });
32515
- // version: 1.434.0-6aa2dd15e3
32519
+ // version: 1.435.1-a9f05717b8
32516
32520
 
32517
32521
  var allowUpdatesForNonCachedRecords = {
32518
32522
  isOpen: function (e) {
@@ -44593,6 +44597,9 @@ function invalidSchemaResponseWithError$1(error) {
44593
44597
  return err$3([error]);
44594
44598
  }
44595
44599
  function validateJsonSchema$1(data, schema, path = "$", document = schema) {
44600
+ return validateJsonSchemaInternal$1(data, schema, path, document, /* @__PURE__ */ new Map());
44601
+ }
44602
+ function validateJsonSchemaInternal$1(data, schema, path, document, visited) {
44596
44603
  if (schema === true) return validSchemaResponse$1();
44597
44604
  if (schema === false)
44598
44605
  return invalidSchemaResponseWithError$1(
@@ -44601,22 +44608,22 @@ function validateJsonSchema$1(data, schema, path = "$", document = schema) {
44601
44608
  const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
44602
44609
  const errorCollector = new JsonSchemaErrorCollector$1();
44603
44610
  if ("anyOf" in schema) {
44604
- errorCollector.append(validateAnyOf$1(data, schema, path, document));
44611
+ errorCollector.append(validateAnyOf$1(data, schema, path, document, visited));
44605
44612
  } else if ("oneOf" in schema) {
44606
- errorCollector.append(validateOneOf$1(data, schema, path, document));
44613
+ errorCollector.append(validateOneOf$1(data, schema, path, document, visited));
44607
44614
  } else if ("allOf" in schema) {
44608
- errorCollector.append(validateAllOf$1(data, schema, path, document));
44615
+ errorCollector.append(validateAllOf$1(data, schema, path, document, visited));
44609
44616
  } else if ("not" in schema) {
44610
- errorCollector.append(validateNot$1(data, schema, path, document));
44617
+ errorCollector.append(validateNot$1(data, schema, path, document, visited));
44611
44618
  } else if ("$ref" in schema) {
44612
- errorCollector.append(validateRef$1(data, schema, path, document));
44619
+ errorCollector.append(validateRef$1(data, schema, path, document, visited));
44613
44620
  } else if ("type" in schema) {
44614
44621
  if (schema.type === "object") {
44615
44622
  if (dataType !== "object") {
44616
44623
  errorCollector.add(incorrectTypeError$1("object", dataType, path));
44617
44624
  } else {
44618
44625
  errorCollector.append(
44619
- validateObject$1(data, schema, path, document)
44626
+ validateObject$1(data, schema, path, document, visited)
44620
44627
  );
44621
44628
  }
44622
44629
  } else if (schema.type === "array") {
@@ -44624,7 +44631,7 @@ function validateJsonSchema$1(data, schema, path = "$", document = schema) {
44624
44631
  errorCollector.add(incorrectTypeError$1("array", dataType, path));
44625
44632
  } else {
44626
44633
  errorCollector.append(
44627
- validateArray$1(data, schema, path, document)
44634
+ validateArray$1(data, schema, path, document, visited)
44628
44635
  );
44629
44636
  }
44630
44637
  } else {
@@ -44641,16 +44648,17 @@ function validateJsonSchema$1(data, schema, path = "$", document = schema) {
44641
44648
  }
44642
44649
  return errorCollector.toValidationResponse();
44643
44650
  }
44644
- function validateAnyOf$1(data, schema, path, document) {
44651
+ function validateAnyOf$1(data, schema, path, document, visited) {
44645
44652
  let isValid = false;
44646
44653
  const errorCollector = new JsonSchemaErrorCollector$1();
44647
44654
  for (let i = 0, { length } = schema.anyOf; i < length; i++) {
44648
44655
  const element = schema.anyOf[i];
44649
- const validationResponse = validateJsonSchema$1(
44656
+ const validationResponse = validateJsonSchemaInternal$1(
44650
44657
  data,
44651
44658
  element,
44652
44659
  `${path}.anyOf[${i}]`,
44653
- document
44660
+ document,
44661
+ visited
44654
44662
  );
44655
44663
  if (validationResponse.isOk()) {
44656
44664
  isValid = true;
@@ -44667,13 +44675,22 @@ function validateAnyOf$1(data, schema, path, document) {
44667
44675
  }
44668
44676
  return validSchemaResponse$1();
44669
44677
  }
44670
- function validateOneOf$1(data, schema, path, document) {
44678
+ function validateOneOf$1(data, schema, path, document, visited) {
44679
+ if (schema.discriminator !== void 0) {
44680
+ return validateDiscriminatedOneOf$1(data, schema.discriminator, path, document, visited);
44681
+ }
44671
44682
  let validSubShemaPaths = [];
44672
44683
  const errorCollector = new JsonSchemaErrorCollector$1();
44673
44684
  for (let i = 0, { length } = schema.oneOf; i < length; i++) {
44674
44685
  const element = schema.oneOf[i];
44675
44686
  const oneOfPath = `${path}.oneOf[${i}]`;
44676
- const validationResponse = validateJsonSchema$1(data, element, oneOfPath, document);
44687
+ const validationResponse = validateJsonSchemaInternal$1(
44688
+ data,
44689
+ element,
44690
+ oneOfPath,
44691
+ document,
44692
+ visited
44693
+ );
44677
44694
  if (validationResponse.isOk()) {
44678
44695
  validSubShemaPaths.push(oneOfPath);
44679
44696
  } else {
@@ -44695,16 +44712,45 @@ function validateOneOf$1(data, schema, path, document) {
44695
44712
  }
44696
44713
  return validSchemaResponse$1();
44697
44714
  }
44698
- function validateAllOf$1(data, schema, path, document) {
44715
+ function validateDiscriminatedOneOf$1(data, discriminator, path, document, visited) {
44716
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
44717
+ return invalidSchemaResponseWithError$1(incorrectTypeError$1("object", typeof data, path));
44718
+ }
44719
+ const { propertyName, mapping } = discriminator;
44720
+ const discriminatorValue = data[propertyName];
44721
+ if (discriminatorValue === void 0) {
44722
+ return invalidSchemaResponseWithError$1(
44723
+ new MissingRequiredPropertyError$1(
44724
+ `Object at path '${path}' is missing required discriminator property '${propertyName}'.`
44725
+ )
44726
+ );
44727
+ }
44728
+ if (typeof discriminatorValue !== "string") {
44729
+ return invalidSchemaResponseWithError$1(
44730
+ incorrectTypeError$1("string", typeof discriminatorValue, `${path}.${propertyName}`)
44731
+ );
44732
+ }
44733
+ const targetRef = mapping[discriminatorValue];
44734
+ if (targetRef === void 0) {
44735
+ return invalidSchemaResponseWithError$1(
44736
+ new JsonSchemaViolationError$1(
44737
+ `Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
44738
+ )
44739
+ );
44740
+ }
44741
+ return validateJsonSchemaInternal$1(data, { $ref: targetRef }, path, document, visited);
44742
+ }
44743
+ function validateAllOf$1(data, schema, path, document, visited) {
44699
44744
  let isValid = true;
44700
44745
  const errorCollector = new JsonSchemaErrorCollector$1();
44701
44746
  for (let i = 0, { length } = schema.allOf; i < length; i++) {
44702
44747
  const element = schema.allOf[i];
44703
- const validationResponse = validateJsonSchema$1(
44748
+ const validationResponse = validateJsonSchemaInternal$1(
44704
44749
  data,
44705
44750
  element,
44706
44751
  `${path}.allOf[${i}]`,
44707
- document
44752
+ document,
44753
+ visited
44708
44754
  );
44709
44755
  if (!validationResponse.isOk()) {
44710
44756
  errorCollector.append(validationResponse);
@@ -44718,8 +44764,14 @@ function validateAllOf$1(data, schema, path, document) {
44718
44764
  }
44719
44765
  return errorCollector.toValidationResponse();
44720
44766
  }
44721
- function validateNot$1(data, schema, path, document) {
44722
- const validationResponse = validateJsonSchema$1(data, schema.not, path, document);
44767
+ function validateNot$1(data, schema, path, document, visited) {
44768
+ const validationResponse = validateJsonSchemaInternal$1(
44769
+ data,
44770
+ schema.not,
44771
+ path,
44772
+ document,
44773
+ visited
44774
+ );
44723
44775
  if (validationResponse.isOk()) {
44724
44776
  return invalidSchemaResponseWithError$1(
44725
44777
  new JsonSchemaViolationError$1(
@@ -44729,7 +44781,7 @@ function validateNot$1(data, schema, path, document) {
44729
44781
  }
44730
44782
  return validSchemaResponse$1();
44731
44783
  }
44732
- function validateObject$1(data, schema, path, document) {
44784
+ function validateObject$1(data, schema, path, document, visited) {
44733
44785
  const schemaKeys = Object.keys(schema.properties);
44734
44786
  const requiredKeys = new Set(schema.required);
44735
44787
  const schemaKeySet = new Set(schemaKeys);
@@ -44737,11 +44789,12 @@ function validateObject$1(data, schema, path, document) {
44737
44789
  Object.keys(data).forEach((key) => {
44738
44790
  if (!schemaKeySet.has(key)) {
44739
44791
  errorCollector.append(
44740
- validateJsonSchema$1(
44792
+ validateJsonSchemaInternal$1(
44741
44793
  data[key],
44742
44794
  schema.additionalProperties,
44743
44795
  `${path}.additionalProperties[${key}]`,
44744
- document
44796
+ document,
44797
+ visited
44745
44798
  )
44746
44799
  );
44747
44800
  }
@@ -44758,18 +44811,19 @@ function validateObject$1(data, schema, path, document) {
44758
44811
  }
44759
44812
  if (keyInData) {
44760
44813
  errorCollector.append(
44761
- validateJsonSchema$1(
44814
+ validateJsonSchemaInternal$1(
44762
44815
  data[key],
44763
44816
  schema.properties[key],
44764
44817
  `${path}.${key}`,
44765
- document
44818
+ document,
44819
+ visited
44766
44820
  )
44767
44821
  );
44768
44822
  }
44769
44823
  }
44770
44824
  return errorCollector.toValidationResponse();
44771
44825
  }
44772
- function validateArray$1(data, schema, path, document) {
44826
+ function validateArray$1(data, schema, path, document, visited) {
44773
44827
  if (schema.minItems !== void 0 && data.length < schema.minItems) {
44774
44828
  return invalidSchemaResponseWithError$1(
44775
44829
  new MinItemsViolationError$1(
@@ -44787,7 +44841,13 @@ function validateArray$1(data, schema, path, document) {
44787
44841
  const errorCollector = new JsonSchemaErrorCollector$1();
44788
44842
  data.forEach(
44789
44843
  (element, index) => errorCollector.append(
44790
- validateJsonSchema$1(element, schema.items, `${path}[${index}]`, document)
44844
+ validateJsonSchemaInternal$1(
44845
+ element,
44846
+ schema.items,
44847
+ `${path}[${index}]`,
44848
+ document,
44849
+ visited
44850
+ )
44791
44851
  )
44792
44852
  );
44793
44853
  return errorCollector.toValidationResponse();
@@ -44822,7 +44882,7 @@ function validateScalar$1(data, schema, path) {
44822
44882
  }
44823
44883
  return validSchemaResponse$1();
44824
44884
  }
44825
- function validateRef$1(data, schema, path, document) {
44885
+ function validateRef$1(data, schema, path, document, visited) {
44826
44886
  if (!schema.$ref.startsWith("#")) {
44827
44887
  return invalidSchemaResponseWithError$1(
44828
44888
  new InvalidRefError$1(
@@ -44830,11 +44890,23 @@ function validateRef$1(data, schema, path, document) {
44830
44890
  )
44831
44891
  );
44832
44892
  }
44893
+ let refsForData = visited.get(data);
44894
+ if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
44895
+ return validSchemaResponse$1();
44896
+ }
44897
+ if (refsForData === void 0) {
44898
+ refsForData = /* @__PURE__ */ new Set();
44899
+ visited.set(data, refsForData);
44900
+ }
44901
+ refsForData.add(schema.$ref);
44833
44902
  try {
44834
44903
  const schemaToValidate = findSchemaAtPath$1(document, schema.$ref);
44835
- return validateJsonSchema$1(data, schemaToValidate, path, document);
44904
+ return validateJsonSchemaInternal$1(data, schemaToValidate, path, document, visited);
44836
44905
  } catch (e) {
44837
44906
  return invalidSchemaResponseWithError$1(e);
44907
+ } finally {
44908
+ refsForData.delete(schema.$ref);
44909
+ if (refsForData.size === 0) visited.delete(data);
44838
44910
  }
44839
44911
  }
44840
44912
  function validateEnum$1(data, enumValue, path) {
@@ -46041,7 +46113,11 @@ function buildAndDispatchGetRecordAggregateUi(recordId, req, params) {
46041
46113
  queryParams: {},
46042
46114
  headers: {},
46043
46115
  };
46044
- return dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, aggregateUiResourceRequest, resourceRequestContext);
46116
+ // Re-enter the composed adapter (when registered) so routing and interceptors
46117
+ // apply to the synthesized aggregate-ui sub-request. Fall back to the base
46118
+ // adapter when unregistered (e.g. in lds-network-adapter unit tests).
46119
+ const subRequestAdapter = networkAdapter;
46120
+ return dispatchSplitRecordAggregateUiAction(recordId, subRequestAdapter, aggregateUiResourceRequest, resourceRequestContext);
46045
46121
  }
46046
46122
  const getRecordDispatcher = (req) => {
46047
46123
  const { resourceRequest, networkAdapter, resourceRequestContext } = req;
@@ -46097,7 +46173,6 @@ function matchRecordsHandlers(path, resourceRequest) {
46097
46173
  }
46098
46174
  return null;
46099
46175
  }
46100
-
46101
46176
  const defaultDispatcher = (req) => {
46102
46177
  const { networkAdapter, resourceRequest, resourceRequestContext } = req;
46103
46178
  return networkAdapter(resourceRequest, resourceRequestContext);
@@ -96565,7 +96640,7 @@ function buildServiceDescriptor$b(luvio) {
96565
96640
  },
96566
96641
  };
96567
96642
  }
96568
- // version: 1.434.0-6aa2dd15e3
96643
+ // version: 1.435.1-4492aa27df
96569
96644
 
96570
96645
  /**
96571
96646
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96591,7 +96666,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
96591
96666
  },
96592
96667
  };
96593
96668
  }
96594
- // version: 1.434.0-6aa2dd15e3
96669
+ // version: 1.435.1-4492aa27df
96595
96670
 
96596
96671
  /*!
96597
96672
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -97076,6 +97151,9 @@ function invalidSchemaResponseWithError(error) {
97076
97151
  return err$1([error]);
97077
97152
  }
97078
97153
  function validateJsonSchema(data, schema, path = "$", document = schema) {
97154
+ return validateJsonSchemaInternal(data, schema, path, document, /* @__PURE__ */ new Map());
97155
+ }
97156
+ function validateJsonSchemaInternal(data, schema, path, document, visited) {
97079
97157
  if (schema === true) return validSchemaResponse();
97080
97158
  if (schema === false)
97081
97159
  return invalidSchemaResponseWithError(
@@ -97084,22 +97162,22 @@ function validateJsonSchema(data, schema, path = "$", document = schema) {
97084
97162
  const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
97085
97163
  const errorCollector = new JsonSchemaErrorCollector();
97086
97164
  if ("anyOf" in schema) {
97087
- errorCollector.append(validateAnyOf(data, schema, path, document));
97165
+ errorCollector.append(validateAnyOf(data, schema, path, document, visited));
97088
97166
  } else if ("oneOf" in schema) {
97089
- errorCollector.append(validateOneOf(data, schema, path, document));
97167
+ errorCollector.append(validateOneOf(data, schema, path, document, visited));
97090
97168
  } else if ("allOf" in schema) {
97091
- errorCollector.append(validateAllOf(data, schema, path, document));
97169
+ errorCollector.append(validateAllOf(data, schema, path, document, visited));
97092
97170
  } else if ("not" in schema) {
97093
- errorCollector.append(validateNot(data, schema, path, document));
97171
+ errorCollector.append(validateNot(data, schema, path, document, visited));
97094
97172
  } else if ("$ref" in schema) {
97095
- errorCollector.append(validateRef(data, schema, path, document));
97173
+ errorCollector.append(validateRef(data, schema, path, document, visited));
97096
97174
  } else if ("type" in schema) {
97097
97175
  if (schema.type === "object") {
97098
97176
  if (dataType !== "object") {
97099
97177
  errorCollector.add(incorrectTypeError("object", dataType, path));
97100
97178
  } else {
97101
97179
  errorCollector.append(
97102
- validateObject(data, schema, path, document)
97180
+ validateObject(data, schema, path, document, visited)
97103
97181
  );
97104
97182
  }
97105
97183
  } else if (schema.type === "array") {
@@ -97107,7 +97185,7 @@ function validateJsonSchema(data, schema, path = "$", document = schema) {
97107
97185
  errorCollector.add(incorrectTypeError("array", dataType, path));
97108
97186
  } else {
97109
97187
  errorCollector.append(
97110
- validateArray(data, schema, path, document)
97188
+ validateArray(data, schema, path, document, visited)
97111
97189
  );
97112
97190
  }
97113
97191
  } else {
@@ -97124,16 +97202,17 @@ function validateJsonSchema(data, schema, path = "$", document = schema) {
97124
97202
  }
97125
97203
  return errorCollector.toValidationResponse();
97126
97204
  }
97127
- function validateAnyOf(data, schema, path, document) {
97205
+ function validateAnyOf(data, schema, path, document, visited) {
97128
97206
  let isValid = false;
97129
97207
  const errorCollector = new JsonSchemaErrorCollector();
97130
97208
  for (let i = 0, { length } = schema.anyOf; i < length; i++) {
97131
97209
  const element = schema.anyOf[i];
97132
- const validationResponse = validateJsonSchema(
97210
+ const validationResponse = validateJsonSchemaInternal(
97133
97211
  data,
97134
97212
  element,
97135
97213
  `${path}.anyOf[${i}]`,
97136
- document
97214
+ document,
97215
+ visited
97137
97216
  );
97138
97217
  if (validationResponse.isOk()) {
97139
97218
  isValid = true;
@@ -97150,13 +97229,22 @@ function validateAnyOf(data, schema, path, document) {
97150
97229
  }
97151
97230
  return validSchemaResponse();
97152
97231
  }
97153
- function validateOneOf(data, schema, path, document) {
97232
+ function validateOneOf(data, schema, path, document, visited) {
97233
+ if (schema.discriminator !== void 0) {
97234
+ return validateDiscriminatedOneOf(data, schema.discriminator, path, document, visited);
97235
+ }
97154
97236
  let validSubShemaPaths = [];
97155
97237
  const errorCollector = new JsonSchemaErrorCollector();
97156
97238
  for (let i = 0, { length } = schema.oneOf; i < length; i++) {
97157
97239
  const element = schema.oneOf[i];
97158
97240
  const oneOfPath = `${path}.oneOf[${i}]`;
97159
- const validationResponse = validateJsonSchema(data, element, oneOfPath, document);
97241
+ const validationResponse = validateJsonSchemaInternal(
97242
+ data,
97243
+ element,
97244
+ oneOfPath,
97245
+ document,
97246
+ visited
97247
+ );
97160
97248
  if (validationResponse.isOk()) {
97161
97249
  validSubShemaPaths.push(oneOfPath);
97162
97250
  } else {
@@ -97178,16 +97266,45 @@ function validateOneOf(data, schema, path, document) {
97178
97266
  }
97179
97267
  return validSchemaResponse();
97180
97268
  }
97181
- function validateAllOf(data, schema, path, document) {
97269
+ function validateDiscriminatedOneOf(data, discriminator, path, document, visited) {
97270
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
97271
+ return invalidSchemaResponseWithError(incorrectTypeError("object", typeof data, path));
97272
+ }
97273
+ const { propertyName, mapping } = discriminator;
97274
+ const discriminatorValue = data[propertyName];
97275
+ if (discriminatorValue === void 0) {
97276
+ return invalidSchemaResponseWithError(
97277
+ new MissingRequiredPropertyError(
97278
+ `Object at path '${path}' is missing required discriminator property '${propertyName}'.`
97279
+ )
97280
+ );
97281
+ }
97282
+ if (typeof discriminatorValue !== "string") {
97283
+ return invalidSchemaResponseWithError(
97284
+ incorrectTypeError("string", typeof discriminatorValue, `${path}.${propertyName}`)
97285
+ );
97286
+ }
97287
+ const targetRef = mapping[discriminatorValue];
97288
+ if (targetRef === void 0) {
97289
+ return invalidSchemaResponseWithError(
97290
+ new JsonSchemaViolationError(
97291
+ `Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
97292
+ )
97293
+ );
97294
+ }
97295
+ return validateJsonSchemaInternal(data, { $ref: targetRef }, path, document, visited);
97296
+ }
97297
+ function validateAllOf(data, schema, path, document, visited) {
97182
97298
  let isValid = true;
97183
97299
  const errorCollector = new JsonSchemaErrorCollector();
97184
97300
  for (let i = 0, { length } = schema.allOf; i < length; i++) {
97185
97301
  const element = schema.allOf[i];
97186
- const validationResponse = validateJsonSchema(
97302
+ const validationResponse = validateJsonSchemaInternal(
97187
97303
  data,
97188
97304
  element,
97189
97305
  `${path}.allOf[${i}]`,
97190
- document
97306
+ document,
97307
+ visited
97191
97308
  );
97192
97309
  if (!validationResponse.isOk()) {
97193
97310
  errorCollector.append(validationResponse);
@@ -97201,8 +97318,14 @@ function validateAllOf(data, schema, path, document) {
97201
97318
  }
97202
97319
  return errorCollector.toValidationResponse();
97203
97320
  }
97204
- function validateNot(data, schema, path, document) {
97205
- const validationResponse = validateJsonSchema(data, schema.not, path, document);
97321
+ function validateNot(data, schema, path, document, visited) {
97322
+ const validationResponse = validateJsonSchemaInternal(
97323
+ data,
97324
+ schema.not,
97325
+ path,
97326
+ document,
97327
+ visited
97328
+ );
97206
97329
  if (validationResponse.isOk()) {
97207
97330
  return invalidSchemaResponseWithError(
97208
97331
  new JsonSchemaViolationError(
@@ -97212,7 +97335,7 @@ function validateNot(data, schema, path, document) {
97212
97335
  }
97213
97336
  return validSchemaResponse();
97214
97337
  }
97215
- function validateObject(data, schema, path, document) {
97338
+ function validateObject(data, schema, path, document, visited) {
97216
97339
  const schemaKeys = Object.keys(schema.properties);
97217
97340
  const requiredKeys = new Set(schema.required);
97218
97341
  const schemaKeySet = new Set(schemaKeys);
@@ -97220,11 +97343,12 @@ function validateObject(data, schema, path, document) {
97220
97343
  Object.keys(data).forEach((key) => {
97221
97344
  if (!schemaKeySet.has(key)) {
97222
97345
  errorCollector.append(
97223
- validateJsonSchema(
97346
+ validateJsonSchemaInternal(
97224
97347
  data[key],
97225
97348
  schema.additionalProperties,
97226
97349
  `${path}.additionalProperties[${key}]`,
97227
- document
97350
+ document,
97351
+ visited
97228
97352
  )
97229
97353
  );
97230
97354
  }
@@ -97241,18 +97365,19 @@ function validateObject(data, schema, path, document) {
97241
97365
  }
97242
97366
  if (keyInData) {
97243
97367
  errorCollector.append(
97244
- validateJsonSchema(
97368
+ validateJsonSchemaInternal(
97245
97369
  data[key],
97246
97370
  schema.properties[key],
97247
97371
  `${path}.${key}`,
97248
- document
97372
+ document,
97373
+ visited
97249
97374
  )
97250
97375
  );
97251
97376
  }
97252
97377
  }
97253
97378
  return errorCollector.toValidationResponse();
97254
97379
  }
97255
- function validateArray(data, schema, path, document) {
97380
+ function validateArray(data, schema, path, document, visited) {
97256
97381
  if (schema.minItems !== void 0 && data.length < schema.minItems) {
97257
97382
  return invalidSchemaResponseWithError(
97258
97383
  new MinItemsViolationError(
@@ -97270,7 +97395,13 @@ function validateArray(data, schema, path, document) {
97270
97395
  const errorCollector = new JsonSchemaErrorCollector();
97271
97396
  data.forEach(
97272
97397
  (element, index) => errorCollector.append(
97273
- validateJsonSchema(element, schema.items, `${path}[${index}]`, document)
97398
+ validateJsonSchemaInternal(
97399
+ element,
97400
+ schema.items,
97401
+ `${path}[${index}]`,
97402
+ document,
97403
+ visited
97404
+ )
97274
97405
  )
97275
97406
  );
97276
97407
  return errorCollector.toValidationResponse();
@@ -97305,7 +97436,7 @@ function validateScalar(data, schema, path) {
97305
97436
  }
97306
97437
  return validSchemaResponse();
97307
97438
  }
97308
- function validateRef(data, schema, path, document) {
97439
+ function validateRef(data, schema, path, document, visited) {
97309
97440
  if (!schema.$ref.startsWith("#")) {
97310
97441
  return invalidSchemaResponseWithError(
97311
97442
  new InvalidRefError(
@@ -97313,11 +97444,23 @@ function validateRef(data, schema, path, document) {
97313
97444
  )
97314
97445
  );
97315
97446
  }
97447
+ let refsForData = visited.get(data);
97448
+ if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
97449
+ return validSchemaResponse();
97450
+ }
97451
+ if (refsForData === void 0) {
97452
+ refsForData = /* @__PURE__ */ new Set();
97453
+ visited.set(data, refsForData);
97454
+ }
97455
+ refsForData.add(schema.$ref);
97316
97456
  try {
97317
97457
  const schemaToValidate = findSchemaAtPath(document, schema.$ref);
97318
- return validateJsonSchema(data, schemaToValidate, path, document);
97458
+ return validateJsonSchemaInternal(data, schemaToValidate, path, document, visited);
97319
97459
  } catch (e) {
97320
97460
  return invalidSchemaResponseWithError(e);
97461
+ } finally {
97462
+ refsForData.delete(schema.$ref);
97463
+ if (refsForData.size === 0) visited.delete(data);
97321
97464
  }
97322
97465
  }
97323
97466
  function validateEnum(data, enumValue, path) {
@@ -99251,7 +99394,7 @@ register$1({
99251
99394
  id: '@salesforce/lds-network-adapter',
99252
99395
  instrument: instrument$2,
99253
99396
  });
99254
- // version: 1.434.0-d8deb0d4ea
99397
+ // version: 1.435.1-4492aa27df
99255
99398
 
99256
99399
  const { create: create$2, keys: keys$2 } = Object;
99257
99400
  const { stringify, parse } = JSON;
@@ -106397,6 +106540,7 @@ function buildCommandClass(baseClass) {
106397
106540
  };
106398
106541
  }
106399
106542
 
106543
+ const REFRESH_FAILED_MESSAGE = 'Failed to refresh GraphQL data';
106400
106544
  function validateNonQueryGraphQLConfig(config) {
106401
106545
  if (config !== null && typeof config === 'object') {
106402
106546
  if (hasOwnProperty$1.call(config, 'operationName') &&
@@ -106513,6 +106657,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
106513
106657
  let processScheduled = false;
106514
106658
  let processingInitialConfig = false;
106515
106659
  let unsubscribe;
106660
+ let currentResultRefresh;
106516
106661
  const statusAtom = atom('unconfigured');
106517
106662
  const errorsAtom = atom(undefined);
106518
106663
  const dataAtom = atom(undefined);
@@ -106522,7 +106667,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
106522
106667
  setAtom(errorsAtom, errors);
106523
106668
  setAtom(dataAtom, data);
106524
106669
  };
106525
- const refreshCallback = (refreshResult) => {
106670
+ const subscribeCallback = (refreshResult) => {
106526
106671
  if (refreshResult.isOk()) {
106527
106672
  resultCallback({
106528
106673
  ok: true,
@@ -106551,12 +106696,13 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
106551
106696
  .then((result) => {
106552
106697
  // handle the initial result
106553
106698
  if (result.isOk()) {
106699
+ currentResultRefresh = result.value.refresh.bind(result.value);
106554
106700
  resultCallback({
106555
106701
  ok: true,
106556
106702
  data: result.value.data.data,
106557
106703
  errors: undefined,
106558
106704
  });
106559
- unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(refreshCallback));
106705
+ unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(subscribeCallback));
106560
106706
  }
106561
106707
  else {
106562
106708
  const resp = toGraphQLResponseFromFailure(result.error.failure);
@@ -106569,6 +106715,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
106569
106715
  });
106570
106716
  };
106571
106717
  const queueConfigUpdate = (config) => {
106718
+ currentResultRefresh = undefined;
106572
106719
  try {
106573
106720
  const configIsGood = _checkConfig(config);
106574
106721
  queuedConfig = configIsGood ? config : undefined;
@@ -106595,6 +106742,23 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
106595
106742
  }
106596
106743
  };
106597
106744
  const setters = createSetters(allowedKeys, queueConfigUpdate);
106745
+ const refresh = () => {
106746
+ const status = statusAtom.value;
106747
+ if (status === 'unconfigured' || status === 'error' || status === 'loading') {
106748
+ return Promise.reject(new Error(REFRESH_FAILED_MESSAGE));
106749
+ }
106750
+ // status === 'loaded'
106751
+ return new Promise((resolve, reject) => {
106752
+ currentResultRefresh().then((res) => {
106753
+ if (res.isOk()) {
106754
+ resolve();
106755
+ }
106756
+ else {
106757
+ reject(new Error(REFRESH_FAILED_MESSAGE));
106758
+ }
106759
+ }, reject);
106760
+ });
106761
+ };
106598
106762
  if (initialConfig) {
106599
106763
  try {
106600
106764
  processingInitialConfig = true;
@@ -106608,6 +106772,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
106608
106772
  status: statusAtom,
106609
106773
  errors: errorsAtom,
106610
106774
  data: dataAtom,
106775
+ refresh,
106611
106776
  ...setters,
106612
106777
  };
106613
106778
  }, {
@@ -106883,7 +107048,7 @@ function registerCallback(cb) {
106883
107048
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
106884
107049
  }
106885
107050
  }
106886
- // version: 1.434.0-6aa2dd15e3
107051
+ // version: 1.435.1-a9f05717b8
106887
107052
 
106888
107053
  function createFragmentMap(documentNode) {
106889
107054
  const fragments = {};
@@ -136090,7 +136255,7 @@ register$1({
136090
136255
  configuration: { ...configurationForGraphQLAdapters$1 },
136091
136256
  instrument: instrument$1,
136092
136257
  });
136093
- // version: 1.434.0-6aa2dd15e3
136258
+ // version: 1.435.1-a9f05717b8
136094
136259
 
136095
136260
  // On core the unstable adapters are re-exported with different names,
136096
136261
  // we want to match them here.
@@ -136242,7 +136407,7 @@ withDefaultLuvio((luvio) => {
136242
136407
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
136243
136408
  graphQLImperative = ldsAdapter;
136244
136409
  });
136245
- // version: 1.434.0-6aa2dd15e3
136410
+ // version: 1.435.1-a9f05717b8
136246
136411
 
136247
136412
  var gqlApi = /*#__PURE__*/Object.freeze({
136248
136413
  __proto__: null,
@@ -137041,7 +137206,7 @@ const callbacks$1 = [];
137041
137206
  function register(r) {
137042
137207
  callbacks$1.forEach((callback) => callback(r));
137043
137208
  }
137044
- // version: 1.434.0-d8deb0d4ea
137209
+ // version: 1.435.1-4492aa27df
137045
137210
 
137046
137211
  /**
137047
137212
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -138330,4 +138495,4 @@ const { luvio } = getRuntime();
138330
138495
  setDefaultLuvio({ luvio });
138331
138496
 
138332
138497
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
138333
- // version: 1.434.0-d8deb0d4ea
138498
+ // version: 1.435.1-4492aa27df