@salesforce/lds-runtime-mobile 1.293.0 → 1.294.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.
Files changed (3) hide show
  1. package/dist/main.js +113 -49
  2. package/package.json +16 -16
  3. package/sfdc/main.js +113 -49
package/dist/main.js CHANGED
@@ -8384,6 +8384,7 @@ function buildQuery(config) {
8384
8384
  ${predicates.sql}
8385
8385
  ${orderBy.sql}
8386
8386
  LIMIT ?
8387
+ OFFSET ?
8387
8388
  `
8388
8389
  .split('\n')
8389
8390
  .map((line) => line.trim())
@@ -8396,6 +8397,7 @@ function buildQuery(config) {
8396
8397
  ...predicates.bindings,
8397
8398
  // limit binding
8398
8399
  config.limit || 10,
8400
+ config.offset || 0,
8399
8401
  ];
8400
8402
  return { sql: sql.trim(), bindings };
8401
8403
  }
@@ -9113,32 +9115,6 @@ async function readIngestionTimestampForKey(key, query) {
9113
9115
  return ingestionTimestamp;
9114
9116
  }
9115
9117
 
9116
- // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
9117
- // base64 character set, plus padding character (=)
9118
- const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
9119
- function btoaPolyfill(input) {
9120
- let bitmap, a, b, c;
9121
- let result = '', i = 0;
9122
- const rest = input.length % 3; // To determine the final padding
9123
- for (; i < input.length;) {
9124
- if ((a = input.charCodeAt(i++)) > 255 ||
9125
- (b = input.charCodeAt(i++)) > 255 ||
9126
- (c = input.charCodeAt(i++)) > 255) {
9127
- throw new TypeError('Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. ' +
9128
- input);
9129
- }
9130
- bitmap = (a << 16) | (b << 8) | c;
9131
- result +=
9132
- b64.charAt((bitmap >> 18) & 63) +
9133
- b64.charAt((bitmap >> 12) & 63) +
9134
- b64.charAt((bitmap >> 6) & 63) +
9135
- b64.charAt(bitmap & 63);
9136
- }
9137
- // If there's need of padding, replace the last 'A's with equal signs
9138
- return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
9139
- }
9140
- const base64encode = typeof btoa === 'function' ? btoa : btoaPolyfill;
9141
-
9142
9118
  function findSpanningField(name) {
9143
9119
  return (field) => {
9144
9120
  return (field.apiName === name ||
@@ -9285,13 +9261,101 @@ function scopeToPredicates(scope = '', settings) {
9285
9261
  ];
9286
9262
  }
9287
9263
 
9264
+ // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
9265
+ // base64 character set, plus padding character (=)
9266
+ const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
9267
+ const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
9268
+ function btoaPolyfill(input) {
9269
+ let bitmap, a, b, c;
9270
+ let result = '', i = 0;
9271
+ const rest = input.length % 3; // To determine the final padding
9272
+ for (; i < input.length;) {
9273
+ if ((a = input.charCodeAt(i++)) > 255 ||
9274
+ (b = input.charCodeAt(i++)) > 255 ||
9275
+ (c = input.charCodeAt(i++)) > 255) {
9276
+ throw new TypeError('Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. ' +
9277
+ input);
9278
+ }
9279
+ bitmap = (a << 16) | (b << 8) | c;
9280
+ result +=
9281
+ b64.charAt((bitmap >> 18) & 63) +
9282
+ b64.charAt((bitmap >> 12) & 63) +
9283
+ b64.charAt((bitmap >> 6) & 63) +
9284
+ b64.charAt(bitmap & 63);
9285
+ }
9286
+ // If there's need of padding, replace the last 'A's with equal signs
9287
+ return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
9288
+ }
9289
+ function atobPolyfill(data) {
9290
+ // atob can work with strings with whitespaces, even inside the encoded part,
9291
+ // but only \t, \n, \f, \r and ' ', which can be stripped.
9292
+ let string = String(data).replace(/[\t\n\f\r ]+/g, '');
9293
+ if (!b64re.test(string))
9294
+ throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
9295
+ // Adding the padding if missing, for semplicity
9296
+ string += '=='.slice(2 - (string.length & 3));
9297
+ var bitmap, result = '', r1, r2, i = 0;
9298
+ for (; i < string.length;) {
9299
+ bitmap =
9300
+ (b64.indexOf(string.charAt(i++)) << 18) |
9301
+ (b64.indexOf(string.charAt(i++)) << 12) |
9302
+ ((r1 = b64.indexOf(string.charAt(i++))) << 6) |
9303
+ (r2 = b64.indexOf(string.charAt(i++)));
9304
+ result +=
9305
+ r1 === 64
9306
+ ? String.fromCharCode((bitmap >> 16) & 255)
9307
+ : r2 === 64
9308
+ ? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
9309
+ : String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
9310
+ }
9311
+ return result;
9312
+ }
9313
+ const base64encode = typeof btoa === 'function' ? btoa : btoaPolyfill;
9314
+ const base64decode = typeof atob === 'function' ? atob : atobPolyfill;
9315
+
9316
+ function cursorResolver(source) {
9317
+ return encodeV1Cursor(source.index);
9318
+ }
9319
+ function pageInfoResolver(source) {
9320
+ if (source.length === 0) {
9321
+ return {
9322
+ startCursor: null,
9323
+ endCursor: null,
9324
+ };
9325
+ }
9326
+ let startIndex = source[0].index;
9327
+ let endIndex = source[source.length - 1].index;
9328
+ return {
9329
+ startCursor: encodeV1Cursor(startIndex),
9330
+ endCursor: encodeV1Cursor(endIndex),
9331
+ };
9332
+ }
9333
+ function pageResultCountResolver(source) {
9334
+ return source.length;
9335
+ }
9336
+ function encodeV1Cursor(index) {
9337
+ return base64encode(`v1:${index}`);
9338
+ }
9339
+ const cursorRegex = /^v1:(?<index>\d+)$/;
9340
+ function decodeV1Cursor(base64cursor) {
9341
+ const cursor = base64decode(base64cursor);
9342
+ if (!cursor) {
9343
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
9344
+ throw new Error('Unable to parse cursor');
9345
+ }
9346
+ const found = cursor.match(cursorRegex);
9347
+ if (!found || !found.groups) {
9348
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
9349
+ throw new Error('Unable to parse cursor');
9350
+ }
9351
+ return Number(found.groups.index);
9352
+ }
9353
+
9288
9354
  /*
9289
9355
  resolves connections...
9290
9356
  */
9291
9357
  async function connectionResolver(obj, args, context, info) {
9292
- let { recordRepresentation: parentRecord, ingestionTimestamp } = obj;
9293
- if (!ingestionTimestamp)
9294
- ingestionTimestamp = 0;
9358
+ let { recordRepresentation: parentRecord, ingestionTimestamp = 0 } = obj;
9295
9359
  if (!parentRecord && excludeStaleRecordsGate.isOpen({ fallback: false })) {
9296
9360
  // at our record query we fetch each ingestion time stamp and pass it down to each lower resolver to query against
9297
9361
  ingestionTimestamp = await fetchIngestionTimeStampFromDatabase(info.fieldName, info, args, context.query);
@@ -9320,6 +9384,10 @@ async function connectionResolver(obj, args, context, info) {
9320
9384
  ];
9321
9385
  const scopeJoins = scopeToJoins(args.scope, context.settings);
9322
9386
  joins.push(...scopeJoins);
9387
+ let offset = 0;
9388
+ if (args.after) {
9389
+ offset = decodeV1Cursor(args.after) + 1;
9390
+ }
9323
9391
  // Alias starts as entity's ApiName
9324
9392
  const queryConfig = {
9325
9393
  alias,
@@ -9327,18 +9395,20 @@ async function connectionResolver(obj, args, context, info) {
9327
9395
  predicates,
9328
9396
  orderBy: orderByToPredicate(args.orderBy, alias, alias, context.objectInfos),
9329
9397
  limit: args.first,
9398
+ offset: offset,
9330
9399
  ingestionTimestamp,
9331
9400
  };
9332
9401
  const { sql, bindings } = buildQuery(queryConfig);
9333
9402
  const results = await query(sql, bindings);
9334
9403
  //map each sql result with the ingestion timestamp to pass it down a level
9335
9404
  return results.rows
9336
- .map((row) => row[0])
9337
- .map((record, index) => {
9405
+ .map((row) => parse$4(row[0]))
9406
+ .map((recordRepresentation, index) => {
9407
+ context.seenRecordIds.add(recordRepresentation.id);
9338
9408
  return {
9339
- record,
9409
+ recordRepresentation,
9340
9410
  ingestionTimestamp,
9341
- index,
9411
+ index: index + offset,
9342
9412
  };
9343
9413
  });
9344
9414
  }
@@ -9502,10 +9572,10 @@ function addResolversToSchema(schema, polyFields) {
9502
9572
  field.resolve = passThroughResolver;
9503
9573
  break;
9504
9574
  case 'pageInfo':
9505
- field.resolve = function (_value, _args, _context, _info) {
9506
- // TODO [W-12390939]: implement resolver for PageInfo
9507
- return {};
9508
- };
9575
+ field.resolve = pageInfoResolver;
9576
+ break;
9577
+ case 'pageResultCount':
9578
+ field.resolve = pageResultCountResolver;
9509
9579
  break;
9510
9580
  default:
9511
9581
  field.resolve = defaultFieldResolver;
@@ -9528,17 +9598,10 @@ function addResolversToSchema(schema, polyFields) {
9528
9598
  // }
9529
9599
  for (const field of fields) {
9530
9600
  if (field.name === 'node') {
9531
- field.resolve = function nodeResolver(obj, _args, { seenRecordIds }) {
9532
- const { record, ingestionTimestamp } = obj;
9533
- const recordRepresentation = parse$4(record);
9534
- seenRecordIds.add(recordRepresentation.id);
9535
- return { recordRepresentation, ingestionTimestamp };
9536
- };
9601
+ field.resolve = passThroughResolver;
9537
9602
  }
9538
9603
  else if (field.name === 'cursor') {
9539
- field.resolve = function ({ index }) {
9540
- return base64encode(`v1:${index}`);
9541
- };
9604
+ field.resolve = cursorResolver;
9542
9605
  }
9543
9606
  }
9544
9607
  }
@@ -9897,7 +9960,7 @@ function createNewRecordQuery(schema, objectInfo, objectInfoMap) {
9897
9960
  // handles child relationship
9898
9961
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields);
9899
9962
  typedScalars = new Set([...typedScalars, ...spanningConnectionTypedScalars]);
9900
- const recordQueries = `${apiName}(first: Int, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9963
+ const recordQueries = `${apiName}(first: Int, after: String, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9901
9964
  const isServiceAppointment = apiName === 'ServiceAppointment';
9902
9965
  const recordConnections = /* GraphQL */ `
9903
9966
  ${isServiceAppointment ? `scalar ${apiName.toUpperCase()}_SCOPE` : ''}
@@ -9919,6 +9982,7 @@ function createNewRecordQuery(schema, objectInfo, objectInfoMap) {
9919
9982
  edges: [${apiName}Edge]
9920
9983
  pageInfo: PageInfo!
9921
9984
  totalCount: Int!
9985
+ pageResultCount: Int!
9922
9986
  }
9923
9987
 
9924
9988
  type ${apiName}Edge {
@@ -10000,7 +10064,7 @@ function makeSpanningRecordConnections(schema, childRelationships, objectInfoMap
10000
10064
  }
10001
10065
  if (objectInfoMap[childObjectApiName] !== undefined &&
10002
10066
  !existingParentRelationships.has(relationshipName)) {
10003
- spanningRecordConnections += `${relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
10067
+ spanningRecordConnections += `${relationshipName}(first: Int, after: String, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
10004
10068
  // if the record type has already been extended then these additional scalars have already been added
10005
10069
  // to add them again would throw an error
10006
10070
  const filterScalarType = schema.getType(`${childObjectApiName}_Filter`);
@@ -18360,4 +18424,4 @@ register({
18360
18424
  });
18361
18425
 
18362
18426
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18363
- // version: 1.293.0-5fab18553
18427
+ // version: 1.294.0-06a44f23f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.293.0",
3
+ "version": "1.294.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,25 +32,25 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@salesforce/lds-adapters-uiapi": "^1.293.0",
36
- "@salesforce/lds-bindings": "^1.293.0",
37
- "@salesforce/lds-instrumentation": "^1.293.0",
38
- "@salesforce/lds-priming": "^1.293.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.294.0",
36
+ "@salesforce/lds-bindings": "^1.294.0",
37
+ "@salesforce/lds-instrumentation": "^1.294.0",
38
+ "@salesforce/lds-priming": "^1.294.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "250.7.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.293.0",
44
- "@salesforce/lds-drafts": "^1.293.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.293.0",
46
- "@salesforce/lds-graphql-eval": "^1.293.0",
47
- "@salesforce/lds-network-adapter": "^1.293.0",
48
- "@salesforce/lds-network-nimbus": "^1.293.0",
49
- "@salesforce/lds-store-binary": "^1.293.0",
50
- "@salesforce/lds-store-nimbus": "^1.293.0",
51
- "@salesforce/lds-store-sql": "^1.293.0",
52
- "@salesforce/lds-utils-adapters": "^1.293.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.293.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.294.0",
44
+ "@salesforce/lds-drafts": "^1.294.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.294.0",
46
+ "@salesforce/lds-graphql-eval": "^1.294.0",
47
+ "@salesforce/lds-network-adapter": "^1.294.0",
48
+ "@salesforce/lds-network-nimbus": "^1.294.0",
49
+ "@salesforce/lds-store-binary": "^1.294.0",
50
+ "@salesforce/lds-store-nimbus": "^1.294.0",
51
+ "@salesforce/lds-store-sql": "^1.294.0",
52
+ "@salesforce/lds-utils-adapters": "^1.294.0",
53
+ "@salesforce/nimbus-plugin-lds": "^1.294.0",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
package/sfdc/main.js CHANGED
@@ -8384,6 +8384,7 @@ function buildQuery(config) {
8384
8384
  ${predicates.sql}
8385
8385
  ${orderBy.sql}
8386
8386
  LIMIT ?
8387
+ OFFSET ?
8387
8388
  `
8388
8389
  .split('\n')
8389
8390
  .map((line) => line.trim())
@@ -8396,6 +8397,7 @@ function buildQuery(config) {
8396
8397
  ...predicates.bindings,
8397
8398
  // limit binding
8398
8399
  config.limit || 10,
8400
+ config.offset || 0,
8399
8401
  ];
8400
8402
  return { sql: sql.trim(), bindings };
8401
8403
  }
@@ -9113,32 +9115,6 @@ async function readIngestionTimestampForKey(key, query) {
9113
9115
  return ingestionTimestamp;
9114
9116
  }
9115
9117
 
9116
- // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
9117
- // base64 character set, plus padding character (=)
9118
- const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
9119
- function btoaPolyfill(input) {
9120
- let bitmap, a, b, c;
9121
- let result = '', i = 0;
9122
- const rest = input.length % 3; // To determine the final padding
9123
- for (; i < input.length;) {
9124
- if ((a = input.charCodeAt(i++)) > 255 ||
9125
- (b = input.charCodeAt(i++)) > 255 ||
9126
- (c = input.charCodeAt(i++)) > 255) {
9127
- throw new TypeError('Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. ' +
9128
- input);
9129
- }
9130
- bitmap = (a << 16) | (b << 8) | c;
9131
- result +=
9132
- b64.charAt((bitmap >> 18) & 63) +
9133
- b64.charAt((bitmap >> 12) & 63) +
9134
- b64.charAt((bitmap >> 6) & 63) +
9135
- b64.charAt(bitmap & 63);
9136
- }
9137
- // If there's need of padding, replace the last 'A's with equal signs
9138
- return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
9139
- }
9140
- const base64encode = typeof btoa === 'function' ? btoa : btoaPolyfill;
9141
-
9142
9118
  function findSpanningField(name) {
9143
9119
  return (field) => {
9144
9120
  return (field.apiName === name ||
@@ -9285,13 +9261,101 @@ function scopeToPredicates(scope = '', settings) {
9285
9261
  ];
9286
9262
  }
9287
9263
 
9264
+ // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
9265
+ // base64 character set, plus padding character (=)
9266
+ const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
9267
+ const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
9268
+ function btoaPolyfill(input) {
9269
+ let bitmap, a, b, c;
9270
+ let result = '', i = 0;
9271
+ const rest = input.length % 3; // To determine the final padding
9272
+ for (; i < input.length;) {
9273
+ if ((a = input.charCodeAt(i++)) > 255 ||
9274
+ (b = input.charCodeAt(i++)) > 255 ||
9275
+ (c = input.charCodeAt(i++)) > 255) {
9276
+ throw new TypeError('Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. ' +
9277
+ input);
9278
+ }
9279
+ bitmap = (a << 16) | (b << 8) | c;
9280
+ result +=
9281
+ b64.charAt((bitmap >> 18) & 63) +
9282
+ b64.charAt((bitmap >> 12) & 63) +
9283
+ b64.charAt((bitmap >> 6) & 63) +
9284
+ b64.charAt(bitmap & 63);
9285
+ }
9286
+ // If there's need of padding, replace the last 'A's with equal signs
9287
+ return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
9288
+ }
9289
+ function atobPolyfill(data) {
9290
+ // atob can work with strings with whitespaces, even inside the encoded part,
9291
+ // but only \t, \n, \f, \r and ' ', which can be stripped.
9292
+ let string = String(data).replace(/[\t\n\f\r ]+/g, '');
9293
+ if (!b64re.test(string))
9294
+ throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
9295
+ // Adding the padding if missing, for semplicity
9296
+ string += '=='.slice(2 - (string.length & 3));
9297
+ var bitmap, result = '', r1, r2, i = 0;
9298
+ for (; i < string.length;) {
9299
+ bitmap =
9300
+ (b64.indexOf(string.charAt(i++)) << 18) |
9301
+ (b64.indexOf(string.charAt(i++)) << 12) |
9302
+ ((r1 = b64.indexOf(string.charAt(i++))) << 6) |
9303
+ (r2 = b64.indexOf(string.charAt(i++)));
9304
+ result +=
9305
+ r1 === 64
9306
+ ? String.fromCharCode((bitmap >> 16) & 255)
9307
+ : r2 === 64
9308
+ ? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
9309
+ : String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
9310
+ }
9311
+ return result;
9312
+ }
9313
+ const base64encode = typeof btoa === 'function' ? btoa : btoaPolyfill;
9314
+ const base64decode = typeof atob === 'function' ? atob : atobPolyfill;
9315
+
9316
+ function cursorResolver(source) {
9317
+ return encodeV1Cursor(source.index);
9318
+ }
9319
+ function pageInfoResolver(source) {
9320
+ if (source.length === 0) {
9321
+ return {
9322
+ startCursor: null,
9323
+ endCursor: null,
9324
+ };
9325
+ }
9326
+ let startIndex = source[0].index;
9327
+ let endIndex = source[source.length - 1].index;
9328
+ return {
9329
+ startCursor: encodeV1Cursor(startIndex),
9330
+ endCursor: encodeV1Cursor(endIndex),
9331
+ };
9332
+ }
9333
+ function pageResultCountResolver(source) {
9334
+ return source.length;
9335
+ }
9336
+ function encodeV1Cursor(index) {
9337
+ return base64encode(`v1:${index}`);
9338
+ }
9339
+ const cursorRegex = /^v1:(?<index>\d+)$/;
9340
+ function decodeV1Cursor(base64cursor) {
9341
+ const cursor = base64decode(base64cursor);
9342
+ if (!cursor) {
9343
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
9344
+ throw new Error('Unable to parse cursor');
9345
+ }
9346
+ const found = cursor.match(cursorRegex);
9347
+ if (!found || !found.groups) {
9348
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
9349
+ throw new Error('Unable to parse cursor');
9350
+ }
9351
+ return Number(found.groups.index);
9352
+ }
9353
+
9288
9354
  /*
9289
9355
  resolves connections...
9290
9356
  */
9291
9357
  async function connectionResolver(obj, args, context, info) {
9292
- let { recordRepresentation: parentRecord, ingestionTimestamp } = obj;
9293
- if (!ingestionTimestamp)
9294
- ingestionTimestamp = 0;
9358
+ let { recordRepresentation: parentRecord, ingestionTimestamp = 0 } = obj;
9295
9359
  if (!parentRecord && excludeStaleRecordsGate.isOpen({ fallback: false })) {
9296
9360
  // at our record query we fetch each ingestion time stamp and pass it down to each lower resolver to query against
9297
9361
  ingestionTimestamp = await fetchIngestionTimeStampFromDatabase(info.fieldName, info, args, context.query);
@@ -9320,6 +9384,10 @@ async function connectionResolver(obj, args, context, info) {
9320
9384
  ];
9321
9385
  const scopeJoins = scopeToJoins(args.scope, context.settings);
9322
9386
  joins.push(...scopeJoins);
9387
+ let offset = 0;
9388
+ if (args.after) {
9389
+ offset = decodeV1Cursor(args.after) + 1;
9390
+ }
9323
9391
  // Alias starts as entity's ApiName
9324
9392
  const queryConfig = {
9325
9393
  alias,
@@ -9327,18 +9395,20 @@ async function connectionResolver(obj, args, context, info) {
9327
9395
  predicates,
9328
9396
  orderBy: orderByToPredicate(args.orderBy, alias, alias, context.objectInfos),
9329
9397
  limit: args.first,
9398
+ offset: offset,
9330
9399
  ingestionTimestamp,
9331
9400
  };
9332
9401
  const { sql, bindings } = buildQuery(queryConfig);
9333
9402
  const results = await query(sql, bindings);
9334
9403
  //map each sql result with the ingestion timestamp to pass it down a level
9335
9404
  return results.rows
9336
- .map((row) => row[0])
9337
- .map((record, index) => {
9405
+ .map((row) => parse$4(row[0]))
9406
+ .map((recordRepresentation, index) => {
9407
+ context.seenRecordIds.add(recordRepresentation.id);
9338
9408
  return {
9339
- record,
9409
+ recordRepresentation,
9340
9410
  ingestionTimestamp,
9341
- index,
9411
+ index: index + offset,
9342
9412
  };
9343
9413
  });
9344
9414
  }
@@ -9502,10 +9572,10 @@ function addResolversToSchema(schema, polyFields) {
9502
9572
  field.resolve = passThroughResolver;
9503
9573
  break;
9504
9574
  case 'pageInfo':
9505
- field.resolve = function (_value, _args, _context, _info) {
9506
- // TODO [W-12390939]: implement resolver for PageInfo
9507
- return {};
9508
- };
9575
+ field.resolve = pageInfoResolver;
9576
+ break;
9577
+ case 'pageResultCount':
9578
+ field.resolve = pageResultCountResolver;
9509
9579
  break;
9510
9580
  default:
9511
9581
  field.resolve = defaultFieldResolver;
@@ -9528,17 +9598,10 @@ function addResolversToSchema(schema, polyFields) {
9528
9598
  // }
9529
9599
  for (const field of fields) {
9530
9600
  if (field.name === 'node') {
9531
- field.resolve = function nodeResolver(obj, _args, { seenRecordIds }) {
9532
- const { record, ingestionTimestamp } = obj;
9533
- const recordRepresentation = parse$4(record);
9534
- seenRecordIds.add(recordRepresentation.id);
9535
- return { recordRepresentation, ingestionTimestamp };
9536
- };
9601
+ field.resolve = passThroughResolver;
9537
9602
  }
9538
9603
  else if (field.name === 'cursor') {
9539
- field.resolve = function ({ index }) {
9540
- return base64encode(`v1:${index}`);
9541
- };
9604
+ field.resolve = cursorResolver;
9542
9605
  }
9543
9606
  }
9544
9607
  }
@@ -9897,7 +9960,7 @@ function createNewRecordQuery(schema, objectInfo, objectInfoMap) {
9897
9960
  // handles child relationship
9898
9961
  const { spanningRecordConnections, typedScalars: spanningConnectionTypedScalars } = makeSpanningRecordConnections(schema, childRelationships, objectInfoMap, parentRelationshipFields);
9899
9962
  typedScalars = new Set([...typedScalars, ...spanningConnectionTypedScalars]);
9900
- const recordQueries = `${apiName}(first: Int, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9963
+ const recordQueries = `${apiName}(first: Int, after: String, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9901
9964
  const isServiceAppointment = apiName === 'ServiceAppointment';
9902
9965
  const recordConnections = /* GraphQL */ `
9903
9966
  ${isServiceAppointment ? `scalar ${apiName.toUpperCase()}_SCOPE` : ''}
@@ -9919,6 +9982,7 @@ function createNewRecordQuery(schema, objectInfo, objectInfoMap) {
9919
9982
  edges: [${apiName}Edge]
9920
9983
  pageInfo: PageInfo!
9921
9984
  totalCount: Int!
9985
+ pageResultCount: Int!
9922
9986
  }
9923
9987
 
9924
9988
  type ${apiName}Edge {
@@ -10000,7 +10064,7 @@ function makeSpanningRecordConnections(schema, childRelationships, objectInfoMap
10000
10064
  }
10001
10065
  if (objectInfoMap[childObjectApiName] !== undefined &&
10002
10066
  !existingParentRelationships.has(relationshipName)) {
10003
- spanningRecordConnections += `${relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
10067
+ spanningRecordConnections += `${relationshipName}(first: Int, after: String, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
10004
10068
  // if the record type has already been extended then these additional scalars have already been added
10005
10069
  // to add them again would throw an error
10006
10070
  const filterScalarType = schema.getType(`${childObjectApiName}_Filter`);
@@ -18360,4 +18424,4 @@ register({
18360
18424
  });
18361
18425
 
18362
18426
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18363
- // version: 1.293.0-5fab18553
18427
+ // version: 1.294.0-06a44f23f