@salesforce/lds-runtime-mobile 1.377.0 → 1.378.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.
package/dist/main.js CHANGED
@@ -23,6 +23,7 @@ import { getInstrumentation, idleDetector } from 'o11y/client';
23
23
  import { Kind as Kind$2, visit as visit$2, isObjectType, defaultFieldResolver, buildSchema, parse as parse$8, extendSchema, isScalarType, execute, print as print$1 } from '@luvio/graphql-parser';
24
24
  import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
25
25
  import graphqQueryFieldLimit from '@salesforce/gate/lmr.graphqQueryFieldLimit';
26
+ import graphqlPartialEmitParity from '@salesforce/gate/lmr.graphqlPartialEmitParity';
26
27
  import caseSensitiveUserId from '@salesforce/user/Id';
27
28
  import { instrument as instrument$1 } from '@salesforce/lds-bindings';
28
29
  import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
@@ -43944,6 +43945,7 @@ function createContext(store, objectInfos, eventEmitter, settings, snapshot, map
43944
43945
  possibleStaleRecordMap: new Map(),
43945
43946
  draftFunctions,
43946
43947
  mappedCursors,
43948
+ missingFieldsMap: new Map(),
43947
43949
  };
43948
43950
  }
43949
43951
 
@@ -47545,8 +47547,17 @@ function addResolversToSchema(schema, polyFields) {
47545
47547
  field.resolve = connectionResolver;
47546
47548
  }
47547
47549
  else {
47548
- field.resolve = function recordFieldResolver({ recordRepresentation: record, }) {
47549
- return record.fields[field.name] || null;
47550
+ field.resolve = function recordFieldResolver({ recordRepresentation: record }, _args, { missingFieldsMap }) {
47551
+ const { id, fields } = record;
47552
+ const recordField = fields[field.name];
47553
+ // If the field is not present, add it to the missing fields map
47554
+ if (!recordField) {
47555
+ let missingFieldsSet = missingFieldsMap.get(id) ?? new Set();
47556
+ missingFieldsSet.add(field.name);
47557
+ missingFieldsMap.set(id, missingFieldsSet);
47558
+ return null;
47559
+ }
47560
+ return recordField;
47550
47561
  };
47551
47562
  }
47552
47563
  }
@@ -48137,6 +48148,7 @@ async function evaluate(config, observers, settings, objectInfos, store, snapsho
48137
48148
  result,
48138
48149
  seenRecordIds,
48139
48150
  possibleStaleRecordMap: contextValue.possibleStaleRecordMap,
48151
+ missingFieldsMap: contextValue.missingFieldsMap,
48140
48152
  };
48141
48153
  }
48142
48154
  finally {
@@ -50303,11 +50315,13 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
50303
50315
  let gqlResult;
50304
50316
  let seenRecordIds;
50305
50317
  let possibleStaleRecordMap;
50318
+ let missingFieldsMap;
50306
50319
  try {
50307
50320
  ({
50308
50321
  result: gqlResult,
50309
50322
  seenRecordIds,
50310
50323
  possibleStaleRecordMap,
50324
+ missingFieldsMap,
50311
50325
  } = await evaluate({
50312
50326
  ...config,
50313
50327
  //need to create another copy of the ast for future writes
@@ -50337,13 +50351,23 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
50337
50351
  const seenRecords = createSeenRecords(seenRecordIds, nonEvaluatedSnapshot);
50338
50352
  const recordId = generateUniqueRecordId();
50339
50353
  const rebuildWithLocalEval = async (originalSnapshot) => {
50340
- let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, } = await evaluate({
50354
+ let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, missingFieldsMap: rebuildMissingFieldsMap, } = await evaluate({
50341
50355
  ...config,
50342
50356
  query: injectedAST,
50343
50357
  }, observers, { userId }, objectInfoNeeded, store, originalSnapshot, graphqlSchemaCache, draftFunctions, mappedCursors);
50344
50358
  if (!rebuildResult.errors) {
50345
50359
  rebuildResult = removeSyntheticFields(rebuildResult, config.query);
50346
50360
  }
50361
+ // If the query includes any missing fields, we return an ErrorSnapshot
50362
+ // with a message that contains the missing fields for each record.
50363
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) &&
50364
+ rebuildMissingFieldsMap.size > 0) {
50365
+ const missingFieldsErrorSnapshot = createMissingFieldsErrorSnapshot(originalSnapshot, rebuildMissingFieldsMap);
50366
+ return {
50367
+ ...missingFieldsErrorSnapshot,
50368
+ rebuildWithLocalEval,
50369
+ };
50370
+ }
50347
50371
  let snapshotState = 'Fulfilled';
50348
50372
  if (possibleStaleRecordMap.size > 0) {
50349
50373
  initiateStaleRecordRefresh(luvio, possibleStaleRecordMap);
@@ -50378,6 +50402,10 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
50378
50402
  },
50379
50403
  };
50380
50404
  }
50405
+ // If the query includes any missing fields, we return an ErrorSnapshot
50406
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) && missingFieldsMap.size > 0) {
50407
+ return createMissingFieldsErrorSnapshot(nonEvaluatedSnapshot, missingFieldsMap);
50408
+ }
50381
50409
  // if the non-eval'ed snapshot was an error then we return a synthetic
50382
50410
  // Fulfilled snapshot (this only happens in this code path if
50383
50411
  // the error is network error or 504), otherwise we spread over
@@ -50434,6 +50462,30 @@ function makeGetRecordsConfig(keyMap) {
50434
50462
  records,
50435
50463
  };
50436
50464
  }
50465
+ /**
50466
+ * Creates an ErrorSnapshot with a message that contains the missing fields for each record.
50467
+ * @param originalSnapshot The original snapshot that is being rebuilt.
50468
+ * @param missingFieldsMap A map of record ids to the fields that are missing.
50469
+ * @returns An ErrorSnapshot with a message that contains the missing fields for each record.
50470
+ */
50471
+ function createMissingFieldsErrorSnapshot(originalSnapshot, missingFieldsMap) {
50472
+ const message = Array.from(missingFieldsMap)
50473
+ .map(([id, fields]) => `Missing fields for record ${id}: ${Array.from(fields).join(', ')}`)
50474
+ .join('; ');
50475
+ return {
50476
+ ...originalSnapshot,
50477
+ data: undefined,
50478
+ state: 'Error',
50479
+ error: {
50480
+ errorType: 'adapterError',
50481
+ error: [
50482
+ {
50483
+ message,
50484
+ },
50485
+ ],
50486
+ },
50487
+ };
50488
+ }
50437
50489
 
50438
50490
  function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy) {
50439
50491
  return async function environmentAwareGraphQLBatchAdapter(config, requestContext = {}) {
@@ -55949,7 +56001,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
55949
56001
  async afterRequestHooks(_options) {
55950
56002
  }
55951
56003
  };
55952
- function buildServiceDescriptor$g() {
56004
+ function buildServiceDescriptor$h() {
55953
56005
  return {
55954
56006
  type: "networkCommandBaseClass",
55955
56007
  version: "1.0",
@@ -56051,7 +56103,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
56051
56103
  return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
56052
56104
  }
56053
56105
  }
56054
- function buildServiceDescriptor$f() {
56106
+ function buildServiceDescriptor$g() {
56055
56107
  return {
56056
56108
  type: "auraNetworkCommandBaseClass",
56057
56109
  version: "1.0",
@@ -56551,7 +56603,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand$1 {
56551
56603
  return resolvedPromiseLike$3(void 0);
56552
56604
  }
56553
56605
  }
56554
- function buildServiceDescriptor$e() {
56606
+ function buildServiceDescriptor$f() {
56555
56607
  return {
56556
56608
  type: "auraNormalizedCacheControlCommand",
56557
56609
  version: "1.0",
@@ -56697,7 +56749,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
56697
56749
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify(this.auraParams)}}`;
56698
56750
  }
56699
56751
  }
56700
- function buildServiceDescriptor$d() {
56752
+ function buildServiceDescriptor$e() {
56701
56753
  return {
56702
56754
  type: "auraResourceCacheControlCommand",
56703
56755
  version: "1.0",
@@ -56804,7 +56856,7 @@ class FetchNetworkCommand extends NetworkCommand {
56804
56856
  );
56805
56857
  }
56806
56858
  }
56807
- function buildServiceDescriptor$c() {
56859
+ function buildServiceDescriptor$d() {
56808
56860
  return {
56809
56861
  type: "fetchNetworkCommandBaseClass",
56810
56862
  version: "1.0",
@@ -56893,7 +56945,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
56893
56945
  return resolvedPromiseLike$3(void 0);
56894
56946
  }
56895
56947
  }
56896
- function buildServiceDescriptor$b() {
56948
+ function buildServiceDescriptor$c() {
56897
56949
  return {
56898
56950
  type: "httpNormalizedCacheControlCommand",
56899
56951
  version: "1.0",
@@ -57146,7 +57198,7 @@ let DefaultCache$1 = class DefaultCache {
57146
57198
  return new FixedTimeWritableCache$1(this, generatedTime);
57147
57199
  }
57148
57200
  };
57149
- function buildServiceDescriptor$a() {
57201
+ function buildServiceDescriptor$b() {
57150
57202
  return {
57151
57203
  type: "cache",
57152
57204
  version: "1.0",
@@ -57314,7 +57366,7 @@ class CacheController {
57314
57366
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
57315
57367
  }
57316
57368
  }
57317
- function buildServiceDescriptor$9(cache, cacheInclusionPolicy) {
57369
+ function buildServiceDescriptor$a(cache, cacheInclusionPolicy) {
57318
57370
  return {
57319
57371
  type: "cacheController",
57320
57372
  version: "1.0",
@@ -57360,7 +57412,7 @@ function buildInstrumentCommand(services) {
57360
57412
  };
57361
57413
  };
57362
57414
  }
57363
- function buildServiceDescriptor$8(instrumentation) {
57415
+ function buildServiceDescriptor$9(instrumentation) {
57364
57416
  return {
57365
57417
  type: "instrumentCommand",
57366
57418
  version: "1.0",
@@ -57630,7 +57682,7 @@ class O11yInstrumentation {
57630
57682
  this.metrics = new O11yOTelMetricsAPI(this.services);
57631
57683
  }
57632
57684
  }
57633
- function buildServiceDescriptor$7(logger) {
57685
+ function buildServiceDescriptor$8(logger) {
57634
57686
  return {
57635
57687
  type: "instrumentation",
57636
57688
  version: "1.0",
@@ -57740,7 +57792,7 @@ class DefaultPubSubService {
57740
57792
  return matchingSubscriptions;
57741
57793
  }
57742
57794
  }
57743
- function buildServiceDescriptor$6() {
57795
+ function buildServiceDescriptor$7() {
57744
57796
  return {
57745
57797
  type: "pubSub",
57746
57798
  version: "1.0",
@@ -57764,7 +57816,7 @@ class FeatureFlagsService {
57764
57816
  return this.flags.get(flagName) || defaultValue;
57765
57817
  }
57766
57818
  }
57767
- function buildServiceDescriptor$5() {
57819
+ function buildServiceDescriptor$6() {
57768
57820
  return {
57769
57821
  version: "1.0",
57770
57822
  service: new FeatureFlagsService(),
@@ -57805,7 +57857,7 @@ function buildServiceDescriptor$5() {
57805
57857
  * };
57806
57858
  * ```
57807
57859
  */
57808
- function buildServiceDescriptor$4(luvio) {
57860
+ function buildServiceDescriptor$5(luvio) {
57809
57861
  return {
57810
57862
  type: 'luvio',
57811
57863
  version: '1.0',
@@ -57814,7 +57866,33 @@ function buildServiceDescriptor$4(luvio) {
57814
57866
  },
57815
57867
  };
57816
57868
  }
57817
- // version: 1.377.0-b0d5c49e07
57869
+ // version: 1.378.0-63d7c07562
57870
+
57871
+ /**
57872
+ * Copyright (c) 2022, Salesforce, Inc.,
57873
+ * All rights reserved.
57874
+ * For full license text, see the LICENSE.txt file
57875
+ */
57876
+
57877
+ /*
57878
+ * ATTENTION!
57879
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
57880
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
57881
+ * Any changes made to this file in p4 will be automatically overwritten.
57882
+ * *******************************************************************************************
57883
+ */
57884
+ /* proxy-compat-disable */
57885
+ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvioRecord) {
57886
+ return {
57887
+ type: 'luvioUiapiRecords',
57888
+ version: '1.0',
57889
+ service: {
57890
+ notifyRecordUpdateAvailable,
57891
+ getNormalizedLuvioRecord,
57892
+ },
57893
+ };
57894
+ }
57895
+ // version: 1.378.0-63d7c07562
57818
57896
 
57819
57897
  /*!
57820
57898
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -59693,10 +59771,10 @@ function initializeOneStore(sqliteStore) {
59693
59771
  globalThis.performance = { now: () => Date.now() };
59694
59772
  }
59695
59773
  const loggerService = new ConsoleLogger('ERROR');
59696
- const cacheServiceDescriptor = buildServiceDescriptor$a();
59697
- const instrumentationServiceDescriptor = buildServiceDescriptor$7(loggerService);
59774
+ const cacheServiceDescriptor = buildServiceDescriptor$b();
59775
+ const instrumentationServiceDescriptor = buildServiceDescriptor$8(loggerService);
59698
59776
  const nimbusSqliteOneStoreCacheServiceDescriptor = buildNimbusDurableCacheInclusionPolicyService(cacheServiceDescriptor.service, new NimbusSqliteOneStoreCache(sqliteStore));
59699
- const featureFlagsServiceDescriptor = buildServiceDescriptor$5();
59777
+ const featureFlagsServiceDescriptor = buildServiceDescriptor$6();
59700
59778
  const featureFlagsService = featureFlagsServiceDescriptor.service;
59701
59779
  // This disables the OneStore GraphQL in this runtime
59702
59780
  // We made the decision to continue using the Luvio based version in Mobile
@@ -59706,21 +59784,22 @@ function initializeOneStore(sqliteStore) {
59706
59784
  const services = [
59707
59785
  instrumentationServiceDescriptor,
59708
59786
  buildNimbusFetchServiceDescriptor(),
59709
- buildServiceDescriptor$8(instrumentationServiceDescriptor.service),
59787
+ buildServiceDescriptor$9(instrumentationServiceDescriptor.service),
59710
59788
  // NOTE: These do not directly depend on Aura, and are necessary for HTTP fallback support.
59789
+ buildServiceDescriptor$g(),
59711
59790
  buildServiceDescriptor$f(),
59712
59791
  buildServiceDescriptor$e(),
59792
+ buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
59713
59793
  buildServiceDescriptor$d(),
59714
- buildServiceDescriptor$9(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
59794
+ buildServiceDescriptor$h(),
59715
59795
  buildServiceDescriptor$c(),
59716
- buildServiceDescriptor$g(),
59717
- buildServiceDescriptor$b(),
59718
- buildServiceDescriptor$6(),
59796
+ buildServiceDescriptor$7(),
59719
59797
  buildServiceDescriptor$3(),
59720
59798
  buildServiceDescriptor$2(),
59721
59799
  featureFlagsServiceDescriptor,
59722
59800
  // Luvio service won't be used since we set the useOneStoreGraphQL flag to false
59723
- buildServiceDescriptor$4({}),
59801
+ buildServiceDescriptor$5({}),
59802
+ buildServiceDescriptor$4({}, {}),
59724
59803
  // TODO[@W-18753648]: See note above.
59725
59804
  // buildStreamingCommandServiceDescriptor(),
59726
59805
  // buildNdJsonServiceDescriptor(),
@@ -59934,4 +60013,4 @@ register({
59934
60013
  });
59935
60014
 
59936
60015
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, registerReportObserver, reportGraphqlQueryParseError };
59937
- // version: 1.377.0-3c95caf11c
60016
+ // version: 1.378.0-0ab3d40d29
@@ -15,5 +15,6 @@ export type ResolverContext = {
15
15
  possibleStaleRecordMap: Map<string, string[]>;
16
16
  draftFunctions?: DraftFunctions;
17
17
  mappedCursors: Map<string, string>;
18
+ missingFieldsMap: Map<string, Set<string>>;
18
19
  };
19
20
  export declare function createContext(store: SqliteStore, objectInfos: ObjectInfoMap, eventEmitter: (eventData: unknown) => void, settings: LocalEvaluationRuntimeSettings, snapshot: AvailableSnapshot<GraphQLRepresentation>, mappedCursors?: Map<string, string>, draftFunctions?: DraftFunctions): ResolverContext;
@@ -7,6 +7,7 @@ type LocalEvaluationResult = {
7
7
  result: GraphQLRepresentation;
8
8
  seenRecordIds: string[];
9
9
  possibleStaleRecordMap: Map<string, string[]>;
10
+ missingFieldsMap: Map<string, Set<string>>;
10
11
  };
11
12
  export declare function evaluate(config: GraphQLConfig, observers: LuvioAdapterEventObserver[], settings: LocalEvaluationRuntimeSettings, objectInfos: ObjectInfoMap, store: SqliteStore, snapshot: AvailableSnapshot<GraphQLRepresentation>, cache: CachedGraphQLSchema, draftFunctions?: DraftFunctions, mappedCursors?: Map<string, string>): Promise<LocalEvaluationResult>;
12
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.377.0",
3
+ "version": "1.378.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,40 +32,42 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@luvio/service-provisioner": "5.54.0",
36
- "@salesforce/lds-adapters-uiapi": "^1.377.0",
37
- "@salesforce/lds-bindings": "^1.377.0",
38
- "@salesforce/lds-instrumentation": "^1.377.0",
35
+ "@luvio/service-provisioner": "5.55.1",
36
+ "@salesforce/lds-adapters-uiapi": "^1.378.0",
37
+ "@salesforce/lds-bindings": "^1.378.0",
38
+ "@salesforce/lds-instrumentation": "^1.378.0",
39
+ "@salesforce/lds-luvio-service": "^1.378.0",
40
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.378.0",
39
41
  "@salesforce/user": "0.0.21",
40
42
  "o11y": "250.7.0",
41
43
  "o11y_schema": "256.126.0"
42
44
  },
43
45
  "devDependencies": {
44
- "@luvio/command-aura-network": "5.54.0",
45
- "@luvio/command-aura-normalized-cache-control": "5.54.0",
46
- "@luvio/command-aura-resource-cache-control": "5.54.0",
47
- "@luvio/command-fetch-network": "5.54.0",
48
- "@luvio/command-http-normalized-cache-control": "5.54.0",
49
- "@luvio/command-network": "5.54.0",
50
- "@luvio/service-cache": "5.54.0",
51
- "@luvio/service-cache-control": "5.54.0",
52
- "@luvio/service-cache-inclusion-policy": "5.54.0",
53
- "@luvio/service-fetch-network": "5.54.0",
54
- "@luvio/service-instrument-command": "5.54.0",
55
- "@luvio/service-instrumentation": "5.54.0",
56
- "@luvio/service-pubsub": "5.54.0",
57
- "@luvio/service-store": "5.54.0",
58
- "@luvio/utils": "5.54.0",
59
- "@salesforce/lds-adapters-graphql": "^1.377.0",
60
- "@salesforce/lds-drafts": "^1.377.0",
61
- "@salesforce/lds-durable-records": "^1.377.0",
62
- "@salesforce/lds-network-adapter": "^1.377.0",
63
- "@salesforce/lds-network-nimbus": "^1.377.0",
64
- "@salesforce/lds-store-binary": "^1.377.0",
65
- "@salesforce/lds-store-nimbus": "^1.377.0",
66
- "@salesforce/lds-store-sql": "^1.377.0",
67
- "@salesforce/lds-utils-adapters": "^1.377.0",
68
- "@salesforce/nimbus-plugin-lds": "^1.377.0",
46
+ "@luvio/command-aura-network": "5.55.1",
47
+ "@luvio/command-aura-normalized-cache-control": "5.55.1",
48
+ "@luvio/command-aura-resource-cache-control": "5.55.1",
49
+ "@luvio/command-fetch-network": "5.55.1",
50
+ "@luvio/command-http-normalized-cache-control": "5.55.1",
51
+ "@luvio/command-network": "5.55.1",
52
+ "@luvio/service-cache": "5.55.1",
53
+ "@luvio/service-cache-control": "5.55.1",
54
+ "@luvio/service-cache-inclusion-policy": "5.55.1",
55
+ "@luvio/service-fetch-network": "5.55.1",
56
+ "@luvio/service-instrument-command": "5.55.1",
57
+ "@luvio/service-instrumentation": "5.55.1",
58
+ "@luvio/service-pubsub": "5.55.1",
59
+ "@luvio/service-store": "5.55.1",
60
+ "@luvio/utils": "5.55.1",
61
+ "@salesforce/lds-adapters-graphql": "^1.378.0",
62
+ "@salesforce/lds-drafts": "^1.378.0",
63
+ "@salesforce/lds-durable-records": "^1.378.0",
64
+ "@salesforce/lds-network-adapter": "^1.378.0",
65
+ "@salesforce/lds-network-nimbus": "^1.378.0",
66
+ "@salesforce/lds-store-binary": "^1.378.0",
67
+ "@salesforce/lds-store-nimbus": "^1.378.0",
68
+ "@salesforce/lds-store-sql": "^1.378.0",
69
+ "@salesforce/lds-utils-adapters": "^1.378.0",
70
+ "@salesforce/nimbus-plugin-lds": "^1.378.0",
69
71
  "babel-plugin-dynamic-import-node": "^2.3.3",
70
72
  "wait-for-expect": "^3.0.2"
71
73
  },
package/sfdc/main.js CHANGED
@@ -23,6 +23,7 @@ import { getInstrumentation, idleDetector } from 'o11y/client';
23
23
  import { Kind as Kind$2, visit as visit$2, isObjectType, defaultFieldResolver, buildSchema, parse as parse$8, extendSchema, isScalarType, execute, print as print$1 } from 'force/ldsGraphqlParser';
24
24
  import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
25
25
  import graphqQueryFieldLimit from '@salesforce/gate/lmr.graphqQueryFieldLimit';
26
+ import graphqlPartialEmitParity from '@salesforce/gate/lmr.graphqlPartialEmitParity';
26
27
  import caseSensitiveUserId from '@salesforce/user/Id';
27
28
  import { instrument as instrument$1 } from 'force/ldsBindings';
28
29
  import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
@@ -43944,6 +43945,7 @@ function createContext(store, objectInfos, eventEmitter, settings, snapshot, map
43944
43945
  possibleStaleRecordMap: new Map(),
43945
43946
  draftFunctions,
43946
43947
  mappedCursors,
43948
+ missingFieldsMap: new Map(),
43947
43949
  };
43948
43950
  }
43949
43951
 
@@ -47545,8 +47547,17 @@ function addResolversToSchema(schema, polyFields) {
47545
47547
  field.resolve = connectionResolver;
47546
47548
  }
47547
47549
  else {
47548
- field.resolve = function recordFieldResolver({ recordRepresentation: record, }) {
47549
- return record.fields[field.name] || null;
47550
+ field.resolve = function recordFieldResolver({ recordRepresentation: record }, _args, { missingFieldsMap }) {
47551
+ const { id, fields } = record;
47552
+ const recordField = fields[field.name];
47553
+ // If the field is not present, add it to the missing fields map
47554
+ if (!recordField) {
47555
+ let missingFieldsSet = missingFieldsMap.get(id) ?? new Set();
47556
+ missingFieldsSet.add(field.name);
47557
+ missingFieldsMap.set(id, missingFieldsSet);
47558
+ return null;
47559
+ }
47560
+ return recordField;
47550
47561
  };
47551
47562
  }
47552
47563
  }
@@ -48137,6 +48148,7 @@ async function evaluate(config, observers, settings, objectInfos, store, snapsho
48137
48148
  result,
48138
48149
  seenRecordIds,
48139
48150
  possibleStaleRecordMap: contextValue.possibleStaleRecordMap,
48151
+ missingFieldsMap: contextValue.missingFieldsMap,
48140
48152
  };
48141
48153
  }
48142
48154
  finally {
@@ -50303,11 +50315,13 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
50303
50315
  let gqlResult;
50304
50316
  let seenRecordIds;
50305
50317
  let possibleStaleRecordMap;
50318
+ let missingFieldsMap;
50306
50319
  try {
50307
50320
  ({
50308
50321
  result: gqlResult,
50309
50322
  seenRecordIds,
50310
50323
  possibleStaleRecordMap,
50324
+ missingFieldsMap,
50311
50325
  } = await evaluate({
50312
50326
  ...config,
50313
50327
  //need to create another copy of the ast for future writes
@@ -50337,13 +50351,23 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
50337
50351
  const seenRecords = createSeenRecords(seenRecordIds, nonEvaluatedSnapshot);
50338
50352
  const recordId = generateUniqueRecordId();
50339
50353
  const rebuildWithLocalEval = async (originalSnapshot) => {
50340
- let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, } = await evaluate({
50354
+ let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, missingFieldsMap: rebuildMissingFieldsMap, } = await evaluate({
50341
50355
  ...config,
50342
50356
  query: injectedAST,
50343
50357
  }, observers, { userId }, objectInfoNeeded, store, originalSnapshot, graphqlSchemaCache, draftFunctions, mappedCursors);
50344
50358
  if (!rebuildResult.errors) {
50345
50359
  rebuildResult = removeSyntheticFields(rebuildResult, config.query);
50346
50360
  }
50361
+ // If the query includes any missing fields, we return an ErrorSnapshot
50362
+ // with a message that contains the missing fields for each record.
50363
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) &&
50364
+ rebuildMissingFieldsMap.size > 0) {
50365
+ const missingFieldsErrorSnapshot = createMissingFieldsErrorSnapshot(originalSnapshot, rebuildMissingFieldsMap);
50366
+ return {
50367
+ ...missingFieldsErrorSnapshot,
50368
+ rebuildWithLocalEval,
50369
+ };
50370
+ }
50347
50371
  let snapshotState = 'Fulfilled';
50348
50372
  if (possibleStaleRecordMap.size > 0) {
50349
50373
  initiateStaleRecordRefresh(luvio, possibleStaleRecordMap);
@@ -50378,6 +50402,10 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
50378
50402
  },
50379
50403
  };
50380
50404
  }
50405
+ // If the query includes any missing fields, we return an ErrorSnapshot
50406
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) && missingFieldsMap.size > 0) {
50407
+ return createMissingFieldsErrorSnapshot(nonEvaluatedSnapshot, missingFieldsMap);
50408
+ }
50381
50409
  // if the non-eval'ed snapshot was an error then we return a synthetic
50382
50410
  // Fulfilled snapshot (this only happens in this code path if
50383
50411
  // the error is network error or 504), otherwise we spread over
@@ -50434,6 +50462,30 @@ function makeGetRecordsConfig(keyMap) {
50434
50462
  records,
50435
50463
  };
50436
50464
  }
50465
+ /**
50466
+ * Creates an ErrorSnapshot with a message that contains the missing fields for each record.
50467
+ * @param originalSnapshot The original snapshot that is being rebuilt.
50468
+ * @param missingFieldsMap A map of record ids to the fields that are missing.
50469
+ * @returns An ErrorSnapshot with a message that contains the missing fields for each record.
50470
+ */
50471
+ function createMissingFieldsErrorSnapshot(originalSnapshot, missingFieldsMap) {
50472
+ const message = Array.from(missingFieldsMap)
50473
+ .map(([id, fields]) => `Missing fields for record ${id}: ${Array.from(fields).join(', ')}`)
50474
+ .join('; ');
50475
+ return {
50476
+ ...originalSnapshot,
50477
+ data: undefined,
50478
+ state: 'Error',
50479
+ error: {
50480
+ errorType: 'adapterError',
50481
+ error: [
50482
+ {
50483
+ message,
50484
+ },
50485
+ ],
50486
+ },
50487
+ };
50488
+ }
50437
50489
 
50438
50490
  function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy) {
50439
50491
  return async function environmentAwareGraphQLBatchAdapter(config, requestContext = {}) {
@@ -55949,7 +56001,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
55949
56001
  async afterRequestHooks(_options) {
55950
56002
  }
55951
56003
  };
55952
- function buildServiceDescriptor$g() {
56004
+ function buildServiceDescriptor$h() {
55953
56005
  return {
55954
56006
  type: "networkCommandBaseClass",
55955
56007
  version: "1.0",
@@ -56051,7 +56103,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
56051
56103
  return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
56052
56104
  }
56053
56105
  }
56054
- function buildServiceDescriptor$f() {
56106
+ function buildServiceDescriptor$g() {
56055
56107
  return {
56056
56108
  type: "auraNetworkCommandBaseClass",
56057
56109
  version: "1.0",
@@ -56551,7 +56603,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand$1 {
56551
56603
  return resolvedPromiseLike$3(void 0);
56552
56604
  }
56553
56605
  }
56554
- function buildServiceDescriptor$e() {
56606
+ function buildServiceDescriptor$f() {
56555
56607
  return {
56556
56608
  type: "auraNormalizedCacheControlCommand",
56557
56609
  version: "1.0",
@@ -56697,7 +56749,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
56697
56749
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify(this.auraParams)}}`;
56698
56750
  }
56699
56751
  }
56700
- function buildServiceDescriptor$d() {
56752
+ function buildServiceDescriptor$e() {
56701
56753
  return {
56702
56754
  type: "auraResourceCacheControlCommand",
56703
56755
  version: "1.0",
@@ -56804,7 +56856,7 @@ class FetchNetworkCommand extends NetworkCommand {
56804
56856
  );
56805
56857
  }
56806
56858
  }
56807
- function buildServiceDescriptor$c() {
56859
+ function buildServiceDescriptor$d() {
56808
56860
  return {
56809
56861
  type: "fetchNetworkCommandBaseClass",
56810
56862
  version: "1.0",
@@ -56893,7 +56945,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
56893
56945
  return resolvedPromiseLike$3(void 0);
56894
56946
  }
56895
56947
  }
56896
- function buildServiceDescriptor$b() {
56948
+ function buildServiceDescriptor$c() {
56897
56949
  return {
56898
56950
  type: "httpNormalizedCacheControlCommand",
56899
56951
  version: "1.0",
@@ -57146,7 +57198,7 @@ let DefaultCache$1 = class DefaultCache {
57146
57198
  return new FixedTimeWritableCache$1(this, generatedTime);
57147
57199
  }
57148
57200
  };
57149
- function buildServiceDescriptor$a() {
57201
+ function buildServiceDescriptor$b() {
57150
57202
  return {
57151
57203
  type: "cache",
57152
57204
  version: "1.0",
@@ -57314,7 +57366,7 @@ class CacheController {
57314
57366
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
57315
57367
  }
57316
57368
  }
57317
- function buildServiceDescriptor$9(cache, cacheInclusionPolicy) {
57369
+ function buildServiceDescriptor$a(cache, cacheInclusionPolicy) {
57318
57370
  return {
57319
57371
  type: "cacheController",
57320
57372
  version: "1.0",
@@ -57360,7 +57412,7 @@ function buildInstrumentCommand(services) {
57360
57412
  };
57361
57413
  };
57362
57414
  }
57363
- function buildServiceDescriptor$8(instrumentation) {
57415
+ function buildServiceDescriptor$9(instrumentation) {
57364
57416
  return {
57365
57417
  type: "instrumentCommand",
57366
57418
  version: "1.0",
@@ -57630,7 +57682,7 @@ class O11yInstrumentation {
57630
57682
  this.metrics = new O11yOTelMetricsAPI(this.services);
57631
57683
  }
57632
57684
  }
57633
- function buildServiceDescriptor$7(logger) {
57685
+ function buildServiceDescriptor$8(logger) {
57634
57686
  return {
57635
57687
  type: "instrumentation",
57636
57688
  version: "1.0",
@@ -57740,7 +57792,7 @@ class DefaultPubSubService {
57740
57792
  return matchingSubscriptions;
57741
57793
  }
57742
57794
  }
57743
- function buildServiceDescriptor$6() {
57795
+ function buildServiceDescriptor$7() {
57744
57796
  return {
57745
57797
  type: "pubSub",
57746
57798
  version: "1.0",
@@ -57764,7 +57816,7 @@ class FeatureFlagsService {
57764
57816
  return this.flags.get(flagName) || defaultValue;
57765
57817
  }
57766
57818
  }
57767
- function buildServiceDescriptor$5() {
57819
+ function buildServiceDescriptor$6() {
57768
57820
  return {
57769
57821
  version: "1.0",
57770
57822
  service: new FeatureFlagsService(),
@@ -57805,7 +57857,7 @@ function buildServiceDescriptor$5() {
57805
57857
  * };
57806
57858
  * ```
57807
57859
  */
57808
- function buildServiceDescriptor$4(luvio) {
57860
+ function buildServiceDescriptor$5(luvio) {
57809
57861
  return {
57810
57862
  type: 'luvio',
57811
57863
  version: '1.0',
@@ -57814,7 +57866,33 @@ function buildServiceDescriptor$4(luvio) {
57814
57866
  },
57815
57867
  };
57816
57868
  }
57817
- // version: 1.377.0-b0d5c49e07
57869
+ // version: 1.378.0-63d7c07562
57870
+
57871
+ /**
57872
+ * Copyright (c) 2022, Salesforce, Inc.,
57873
+ * All rights reserved.
57874
+ * For full license text, see the LICENSE.txt file
57875
+ */
57876
+
57877
+ /*
57878
+ * ATTENTION!
57879
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
57880
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
57881
+ * Any changes made to this file in p4 will be automatically overwritten.
57882
+ * *******************************************************************************************
57883
+ */
57884
+ /* proxy-compat-disable */
57885
+ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvioRecord) {
57886
+ return {
57887
+ type: 'luvioUiapiRecords',
57888
+ version: '1.0',
57889
+ service: {
57890
+ notifyRecordUpdateAvailable,
57891
+ getNormalizedLuvioRecord,
57892
+ },
57893
+ };
57894
+ }
57895
+ // version: 1.378.0-63d7c07562
57818
57896
 
57819
57897
  /*!
57820
57898
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -59693,10 +59771,10 @@ function initializeOneStore(sqliteStore) {
59693
59771
  globalThis.performance = { now: () => Date.now() };
59694
59772
  }
59695
59773
  const loggerService = new ConsoleLogger('ERROR');
59696
- const cacheServiceDescriptor = buildServiceDescriptor$a();
59697
- const instrumentationServiceDescriptor = buildServiceDescriptor$7(loggerService);
59774
+ const cacheServiceDescriptor = buildServiceDescriptor$b();
59775
+ const instrumentationServiceDescriptor = buildServiceDescriptor$8(loggerService);
59698
59776
  const nimbusSqliteOneStoreCacheServiceDescriptor = buildNimbusDurableCacheInclusionPolicyService(cacheServiceDescriptor.service, new NimbusSqliteOneStoreCache(sqliteStore));
59699
- const featureFlagsServiceDescriptor = buildServiceDescriptor$5();
59777
+ const featureFlagsServiceDescriptor = buildServiceDescriptor$6();
59700
59778
  const featureFlagsService = featureFlagsServiceDescriptor.service;
59701
59779
  // This disables the OneStore GraphQL in this runtime
59702
59780
  // We made the decision to continue using the Luvio based version in Mobile
@@ -59706,21 +59784,22 @@ function initializeOneStore(sqliteStore) {
59706
59784
  const services = [
59707
59785
  instrumentationServiceDescriptor,
59708
59786
  buildNimbusFetchServiceDescriptor(),
59709
- buildServiceDescriptor$8(instrumentationServiceDescriptor.service),
59787
+ buildServiceDescriptor$9(instrumentationServiceDescriptor.service),
59710
59788
  // NOTE: These do not directly depend on Aura, and are necessary for HTTP fallback support.
59789
+ buildServiceDescriptor$g(),
59711
59790
  buildServiceDescriptor$f(),
59712
59791
  buildServiceDescriptor$e(),
59792
+ buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
59713
59793
  buildServiceDescriptor$d(),
59714
- buildServiceDescriptor$9(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
59794
+ buildServiceDescriptor$h(),
59715
59795
  buildServiceDescriptor$c(),
59716
- buildServiceDescriptor$g(),
59717
- buildServiceDescriptor$b(),
59718
- buildServiceDescriptor$6(),
59796
+ buildServiceDescriptor$7(),
59719
59797
  buildServiceDescriptor$3(),
59720
59798
  buildServiceDescriptor$2(),
59721
59799
  featureFlagsServiceDescriptor,
59722
59800
  // Luvio service won't be used since we set the useOneStoreGraphQL flag to false
59723
- buildServiceDescriptor$4({}),
59801
+ buildServiceDescriptor$5({}),
59802
+ buildServiceDescriptor$4({}, {}),
59724
59803
  // TODO[@W-18753648]: See note above.
59725
59804
  // buildStreamingCommandServiceDescriptor(),
59726
59805
  // buildNdJsonServiceDescriptor(),
@@ -59934,4 +60013,4 @@ register({
59934
60013
  });
59935
60014
 
59936
60015
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, registerReportObserver, reportGraphqlQueryParseError };
59937
- // version: 1.377.0-3c95caf11c
60016
+ // version: 1.378.0-0ab3d40d29
@@ -15,5 +15,6 @@ export type ResolverContext = {
15
15
  possibleStaleRecordMap: Map<string, string[]>;
16
16
  draftFunctions?: DraftFunctions;
17
17
  mappedCursors: Map<string, string>;
18
+ missingFieldsMap: Map<string, Set<string>>;
18
19
  };
19
20
  export declare function createContext(store: SqliteStore, objectInfos: ObjectInfoMap, eventEmitter: (eventData: unknown) => void, settings: LocalEvaluationRuntimeSettings, snapshot: AvailableSnapshot<GraphQLRepresentation>, mappedCursors?: Map<string, string>, draftFunctions?: DraftFunctions): ResolverContext;
@@ -7,6 +7,7 @@ type LocalEvaluationResult = {
7
7
  result: GraphQLRepresentation;
8
8
  seenRecordIds: string[];
9
9
  possibleStaleRecordMap: Map<string, string[]>;
10
+ missingFieldsMap: Map<string, Set<string>>;
10
11
  };
11
12
  export declare function evaluate(config: GraphQLConfig, observers: LuvioAdapterEventObserver[], settings: LocalEvaluationRuntimeSettings, objectInfos: ObjectInfoMap, store: SqliteStore, snapshot: AvailableSnapshot<GraphQLRepresentation>, cache: CachedGraphQLSchema, draftFunctions?: DraftFunctions, mappedCursors?: Map<string, string>): Promise<LocalEvaluationResult>;
12
13
  export {};