@salesforce/lds-runtime-mobile 1.330.0 → 1.332.0-dev1

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
@@ -42867,12 +42867,16 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
42867
42867
  /* global __nimbus */
42868
42868
  function chunkToBase64(chunk) {
42869
42869
  const bytes = new Uint8Array(chunk);
42870
- const binary = String.fromCharCode.apply(null, bytes);
42870
+ const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
42871
+ let binary = '';
42872
+ for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
42873
+ binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
42874
+ }
42871
42875
  return btoa(binary);
42872
42876
  }
42873
42877
  async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
42874
42878
  const uri = await binaryStore.createStream(mimeType);
42875
- const CHUNK_SIZE = 64 * 1024; // 64KB
42879
+ const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
42876
42880
  const fileSize = file.size;
42877
42881
  let offset = 0;
42878
42882
  try {
@@ -42946,7 +42950,7 @@ function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore,
42946
42950
  });
42947
42951
  const resourceRequest = buildResourceRequest(config);
42948
42952
  if (actionHandler.hasIdempotencySupport()) {
42949
- resourceRequest.headers['Idempotency-Key'] = uuidv4();
42953
+ resourceRequest.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
42950
42954
  }
42951
42955
  const action = await actionHandler.enqueue(resourceRequest).catch(async (error) => {
42952
42956
  eventEmitter({
@@ -43324,7 +43328,7 @@ function createRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
43324
43328
  return async function createRecordDraftAdapter(config, createResourceRequest) {
43325
43329
  const request = createResourceRequest(config);
43326
43330
  if (actionHandler.hasIdempotencySupport()) {
43327
- request.headers['Idempotency-Key'] = uuidv4();
43331
+ request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
43328
43332
  }
43329
43333
  request.queryParams = request.queryParams || {};
43330
43334
  request.queryParams['includeFieldsInBody'] = true;
@@ -43352,7 +43356,7 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
43352
43356
  return async function createRecordDraftAdapter(config, createResourceRequest) {
43353
43357
  const request = createResourceRequest(config);
43354
43358
  if (actionHandler.hasIdempotencySupport()) {
43355
- request.headers['Idempotency-Key'] = uuidv4();
43359
+ request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
43356
43360
  }
43357
43361
  request.queryParams = request.queryParams || {};
43358
43362
  request.queryParams['includeFieldsInBody'] = true;
@@ -43378,7 +43382,13 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
43378
43382
  */
43379
43383
  function deleteRecordDraftAdapterFactory(actionHandler) {
43380
43384
  return async function deleteRecordDraftAdapter(config, buildResourceRequest) {
43381
- await actionHandler.enqueue(buildResourceRequest(config));
43385
+ const request = buildResourceRequest(config);
43386
+ if (actionHandler.hasIdempotencySupport()) {
43387
+ request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
43388
+ }
43389
+ await actionHandler.enqueue(request).catch((err) => {
43390
+ throw transformErrorToDraftSynthesisError(err);
43391
+ });
43382
43392
  };
43383
43393
  }
43384
43394
 
@@ -44412,10 +44422,13 @@ function sanitizePredicateIDValue(value, draftFunction) {
44412
44422
  }
44413
44423
  }
44414
44424
  function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
44415
- if (!value || (isArray$1(value) && value.length === 0)) {
44425
+ if (value === undefined || (isArray$1(value) && value.length === 0)) {
44416
44426
  // eslint-disable-next-line
44417
44427
  throw new Error(`No value specified for MultiPickList filter`);
44418
44428
  }
44429
+ if (value === null) {
44430
+ return createSinglePredicate(null, operator, fieldInfo, alias);
44431
+ }
44419
44432
  // generate single prodicate for = and !=
44420
44433
  if (operator === '=' || operator === '!=') {
44421
44434
  // The raw value could be ';;a; b;;', clean it up to 'a;b'
@@ -44435,6 +44448,9 @@ function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
44435
44448
  type: PredicateType.compound,
44436
44449
  operator: operator === 'LIKE' ? 'or' : 'and',
44437
44450
  children: valueArray.map((v) => {
44451
+ if (v === null) {
44452
+ return createSinglePredicate(v, operator, fieldInfo, alias);
44453
+ }
44438
44454
  const splittedValue = v
44439
44455
  .split(MultiPickListValueSeparator)
44440
44456
  .map((v) => v.trim())
@@ -44497,7 +44513,7 @@ function multiPicklistToSql(operator, value) {
44497
44513
  // match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
44498
44514
  // To make sure the match is safe for includes/excludes. the value is prefix and
44499
44515
  // suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
44500
- if (operator === 'LIKE' || operator === 'NOT LIKE') {
44516
+ if (value !== null && (operator === 'LIKE' || operator === 'NOT LIKE')) {
44501
44517
  return `%${MultiPickListValueSeparator}${value}${MultiPickListValueSeparator}%`;
44502
44518
  }
44503
44519
  else {
@@ -44664,14 +44680,7 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
44664
44680
  // SQLite is case sensitive by default, SOQL is case in-sensitive by default
44665
44681
  // For pick list includes or excludeds, prefix and suffix the field value with ';' to guarantee the query accuracy.
44666
44682
  if (dataType === 'MultiPicklist' && (operator === 'LIKE' || operator === 'NOT LIKE')) {
44667
- // to include nulls in NOT LIKE operators we need to still return a value for NULL
44668
- // calling the COALESCE function with the extracted value and empty string will make it an empty string
44669
- // instead of NULL in the function return and can be compared
44670
- const coalesce = (sql) => {
44671
- return `COALESCE(${sql}, '')`;
44672
- };
44673
- const extract = `json_extract("${alias}".data, '${leftPath}')`;
44674
- sql = `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
44683
+ sql = buildMultiPicklistSQL(predicate, valueBinding, questionSql);
44675
44684
  }
44676
44685
  else {
44677
44686
  sql = `json_extract("${alias}".data, '${leftPath}') ${operator} ${questionSql}${isCaseSensitive === true ? '' : ` COLLATE NOCASE`}`;
@@ -44681,6 +44690,22 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
44681
44690
  }
44682
44691
  return { sql, binding };
44683
44692
  }
44693
+ function buildMultiPicklistSQL(predicate, value, questionSql) {
44694
+ const { alias, leftPath, operator } = predicate;
44695
+ if (value.length === 1 && value.includes(null)) {
44696
+ return `json_extract("${alias}".data, '${leftPath}') ${operator === 'LIKE' ? 'IS' : 'IS NOT'} ${questionSql}`;
44697
+ }
44698
+ else {
44699
+ // to include nulls in NOT LIKE operators we need to still return a value for NULL
44700
+ // calling the COALESCE function with the extracted value and empty string will make it an empty string
44701
+ // instead of NULL in the function return and can be compared
44702
+ const coalesce = (sql) => {
44703
+ return `COALESCE(${sql}, '')`;
44704
+ };
44705
+ const extract = `json_extract("${alias}".data, '${leftPath}')`;
44706
+ return `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
44707
+ }
44708
+ }
44684
44709
  // for one value, return { sql: '?', bindings:'xxx'}. for multiple value, return { sql: '(?, ?, ?)', binding: ['xxx','yyy','zzz'] }
44685
44710
  function handleExtractedPredicateValue(boundValue, checkForNull) {
44686
44711
  let questionSql = '?';
@@ -45637,65 +45662,100 @@ function pathForKey(key) {
45637
45662
  }
45638
45663
  }
45639
45664
 
45640
- function scopeToJoins(scope = '', settings) {
45641
- if (scope !== 'ASSIGNEDTOME')
45642
- return [];
45643
- return [
45644
- {
45645
- alias: 'ServiceAppointment_AssignedResource',
45646
- type: 'INNER',
45647
- to: 'ServiceAppointment',
45648
- conditions: [
45649
- {
45650
- type: PredicateType.single,
45651
- alias: 'ServiceAppointment_AssignedResource',
45652
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45653
- operator: '=',
45654
- value: 'AssignedResource',
45655
- dataType: 'String',
45656
- isCaseSensitive: true,
45657
- },
45658
- {
45659
- leftPath: '$.id',
45660
- rightPath: '$.fields.ServiceAppointmentId.value',
45661
- },
45662
- ],
45663
- apiName: 'AssignedResource',
45664
- },
45665
- {
45666
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45667
- type: 'INNER',
45668
- to: 'ServiceAppointment_AssignedResource',
45669
- conditions: [
45670
- {
45671
- type: PredicateType.single,
45672
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45673
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45674
- operator: '=',
45675
- value: 'ServiceResource',
45676
- dataType: 'String',
45677
- isCaseSensitive: true,
45678
- },
45679
- {
45680
- leftPath: '$.fields.ServiceResourceId.value',
45681
- rightPath: '$.id',
45682
- },
45683
- {
45684
- type: PredicateType.single,
45685
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45686
- leftPath: '$.fields.RelatedRecordId.value',
45687
- operator: '=',
45688
- value: settings.userId,
45689
- dataType: 'String',
45690
- isCaseSensitive: true,
45691
- },
45692
- ],
45693
- apiName: 'ServiceResource',
45694
- },
45695
- ];
45665
+ function scopeToJoins(scope = '', fieldName, settings) {
45666
+ if (scope === 'ASSIGNEDTOME') {
45667
+ return [
45668
+ {
45669
+ alias: 'ServiceAppointment_AssignedResource',
45670
+ type: 'INNER',
45671
+ to: 'ServiceAppointment',
45672
+ conditions: [
45673
+ {
45674
+ type: PredicateType.single,
45675
+ alias: 'ServiceAppointment_AssignedResource',
45676
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45677
+ operator: '=',
45678
+ value: 'AssignedResource',
45679
+ dataType: 'String',
45680
+ isCaseSensitive: true,
45681
+ },
45682
+ {
45683
+ leftPath: '$.id',
45684
+ rightPath: '$.fields.ServiceAppointmentId.value',
45685
+ },
45686
+ ],
45687
+ apiName: 'AssignedResource',
45688
+ },
45689
+ {
45690
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45691
+ type: 'INNER',
45692
+ to: 'ServiceAppointment_AssignedResource',
45693
+ conditions: [
45694
+ {
45695
+ type: PredicateType.single,
45696
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45697
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45698
+ operator: '=',
45699
+ value: 'ServiceResource',
45700
+ dataType: 'String',
45701
+ isCaseSensitive: true,
45702
+ },
45703
+ {
45704
+ leftPath: '$.fields.ServiceResourceId.value',
45705
+ rightPath: '$.id',
45706
+ },
45707
+ {
45708
+ type: PredicateType.single,
45709
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45710
+ leftPath: '$.fields.RelatedRecordId.value',
45711
+ operator: '=',
45712
+ value: settings.userId,
45713
+ dataType: 'String',
45714
+ isCaseSensitive: true,
45715
+ },
45716
+ ],
45717
+ apiName: 'ServiceResource',
45718
+ },
45719
+ ];
45720
+ }
45721
+ else if (scope === 'MINE' && fieldName === 'ResourceAbsence') {
45722
+ return [
45723
+ {
45724
+ alias: 'ResourceAbsence_Resource',
45725
+ type: 'INNER',
45726
+ to: 'ResourceAbsence',
45727
+ conditions: [
45728
+ {
45729
+ type: PredicateType.single,
45730
+ alias: 'ResourceAbsence_Resource',
45731
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45732
+ operator: '=',
45733
+ value: 'ServiceResource',
45734
+ dataType: 'String',
45735
+ isCaseSensitive: true,
45736
+ },
45737
+ {
45738
+ leftPath: '$.fields.ResourceId.value',
45739
+ rightPath: '$.id',
45740
+ },
45741
+ {
45742
+ type: PredicateType.single,
45743
+ alias: 'ResourceAbsence_Resource',
45744
+ leftPath: '$.fields.OwnerId.value',
45745
+ operator: '=',
45746
+ value: settings.userId,
45747
+ dataType: 'String',
45748
+ isCaseSensitive: true,
45749
+ },
45750
+ ],
45751
+ apiName: 'Resource',
45752
+ },
45753
+ ];
45754
+ }
45755
+ return [];
45696
45756
  }
45697
- function scopeToPredicates(scope = '', settings) {
45698
- if (scope !== 'MINE')
45757
+ function scopeToPredicates(scope = '', fieldName, settings) {
45758
+ if (scope !== 'MINE' || fieldName === 'ResourceAbsence')
45699
45759
  return [];
45700
45760
  return [
45701
45761
  {
@@ -46726,10 +46786,10 @@ async function connectionResolver(obj, args, context, info) {
46726
46786
  // Alias starts as entity's ApiName
46727
46787
  const predicates = [
46728
46788
  ...filterToPredicates(args.where, alias, alias, context.objectInfos, joins, draftFunctions),
46729
- ...scopeToPredicates(args.scope, context.settings),
46789
+ ...scopeToPredicates(args.scope, info.fieldName, context.settings),
46730
46790
  ...childRelationshipToPredicates(childRelationshipFieldName, parentRecord ? parentRecord.id : undefined),
46731
46791
  ];
46732
- const scopeJoins = scopeToJoins(args.scope, context.settings);
46792
+ const scopeJoins = scopeToJoins(args.scope, info.fieldName, context.settings);
46733
46793
  joins.push(...scopeJoins);
46734
46794
  // Limit defaults to 10 records if unspecified
46735
46795
  let limit = 10;
@@ -47857,9 +47917,11 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
47857
47917
  .filter(nodeIsNamed('node'))[0];
47858
47918
  switch (node.name.value) {
47859
47919
  case 'scope':
47860
- // Hanle 'MINE' field
47861
47920
  if (isScopeArgumentNodeWithType(node, 'MINE', variables)) {
47862
- if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
47921
+ if (recordQueryApiName === 'ResourceAbsence') {
47922
+ inlineFragmentSelections[ancestorPath].push(...mineResourceAbsenceSelections);
47923
+ }
47924
+ else if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
47863
47925
  // 'typeConditon' is added when the 'InlineFragmentNode' is appended at the write pass
47864
47926
  inlineFragmentSelections[ancestorPath].push(...mineFragmentSelections);
47865
47927
  }
@@ -49010,6 +49072,93 @@ let mineFragmentSelections = [
49010
49072
  },
49011
49073
  },
49012
49074
  ];
49075
+ const mineResourceAbsenceSelections = [
49076
+ {
49077
+ kind: 'Field',
49078
+ name: {
49079
+ kind: 'Name',
49080
+ value: 'ResourceId',
49081
+ },
49082
+ arguments: [],
49083
+ directives: [],
49084
+ selectionSet: {
49085
+ kind: 'SelectionSet',
49086
+ selections: [
49087
+ {
49088
+ kind: 'Field',
49089
+ name: {
49090
+ kind: 'Name',
49091
+ value: 'value',
49092
+ },
49093
+ arguments: [],
49094
+ directives: [],
49095
+ },
49096
+ ],
49097
+ },
49098
+ },
49099
+ {
49100
+ kind: 'Field',
49101
+ name: {
49102
+ kind: 'Name',
49103
+ value: 'Resource',
49104
+ },
49105
+ arguments: [],
49106
+ directives: [
49107
+ {
49108
+ kind: 'Directive',
49109
+ name: {
49110
+ kind: 'Name',
49111
+ value: 'category',
49112
+ },
49113
+ arguments: [
49114
+ {
49115
+ kind: 'Argument',
49116
+ name: {
49117
+ kind: 'Name',
49118
+ value: 'name',
49119
+ },
49120
+ value: {
49121
+ kind: 'StringValue',
49122
+ value: PARENT_RELATIONSHIP,
49123
+ block: false,
49124
+ },
49125
+ },
49126
+ ],
49127
+ },
49128
+ ],
49129
+ selectionSet: {
49130
+ kind: 'SelectionSet',
49131
+ selections: [
49132
+ {
49133
+ kind: 'Field',
49134
+ name: {
49135
+ kind: 'Name',
49136
+ value: 'Id',
49137
+ },
49138
+ },
49139
+ {
49140
+ kind: 'Field',
49141
+ name: {
49142
+ kind: 'Name',
49143
+ value: 'OwnerId',
49144
+ },
49145
+ selectionSet: {
49146
+ kind: 'SelectionSet',
49147
+ selections: [
49148
+ {
49149
+ kind: 'Field',
49150
+ name: {
49151
+ kind: 'Name',
49152
+ value: 'value',
49153
+ },
49154
+ },
49155
+ ],
49156
+ },
49157
+ },
49158
+ ],
49159
+ },
49160
+ },
49161
+ ];
49013
49162
  const assignedToMeFragmentSelections = [
49014
49163
  {
49015
49164
  kind: 'Field',
@@ -55098,7 +55247,8 @@ class DurableRecordStore {
55098
55247
  }
55099
55248
  async exists(key) {
55100
55249
  const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
55101
- return result.rows[0][0] === 1;
55250
+ const exists = result.rows[0][0];
55251
+ return exists == true;
55102
55252
  }
55103
55253
  async getRecord(key) {
55104
55254
  const canonicalKey = this.getLuvio().storeGetCanonicalKey(key);
@@ -55332,4 +55482,4 @@ register({
55332
55482
  });
55333
55483
 
55334
55484
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
55335
- // version: 1.330.0-29e6947dcf
55485
+ // version: 1.332.0-dev1-5d903f6f8e
@@ -1,4 +1,4 @@
1
1
  import type { Join, PredicateValue } from './query';
2
2
  import type { LocalEvaluationRuntimeSettings } from './types';
3
- export declare function scopeToJoins(scope: string | undefined, settings: LocalEvaluationRuntimeSettings): Join[];
4
- export declare function scopeToPredicates(scope: string | undefined, settings: LocalEvaluationRuntimeSettings): PredicateValue[];
3
+ export declare function scopeToJoins(scope: string | undefined, fieldName: string, settings: LocalEvaluationRuntimeSettings): Join[];
4
+ export declare function scopeToPredicates(scope: string | undefined, fieldName: string, settings: LocalEvaluationRuntimeSettings): PredicateValue[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.330.0",
3
+ "version": "1.332.0-dev1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,23 +32,23 @@
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.330.0",
36
- "@salesforce/lds-bindings": "^1.330.0",
37
- "@salesforce/lds-instrumentation": "^1.330.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.332.0-dev1",
36
+ "@salesforce/lds-bindings": "^1.332.0-dev1",
37
+ "@salesforce/lds-instrumentation": "^1.332.0-dev1",
38
38
  "@salesforce/user": "0.0.21",
39
39
  "o11y": "250.7.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@salesforce/lds-adapters-graphql": "^1.330.0",
43
- "@salesforce/lds-drafts": "^1.330.0",
44
- "@salesforce/lds-durable-records": "^1.330.0",
45
- "@salesforce/lds-network-adapter": "^1.330.0",
46
- "@salesforce/lds-network-nimbus": "^1.330.0",
47
- "@salesforce/lds-store-binary": "^1.330.0",
48
- "@salesforce/lds-store-nimbus": "^1.330.0",
49
- "@salesforce/lds-store-sql": "^1.330.0",
50
- "@salesforce/lds-utils-adapters": "^1.330.0",
51
- "@salesforce/nimbus-plugin-lds": "^1.330.0",
42
+ "@salesforce/lds-adapters-graphql": "^1.332.0-dev1",
43
+ "@salesforce/lds-drafts": "^1.332.0-dev1",
44
+ "@salesforce/lds-durable-records": "^1.332.0-dev1",
45
+ "@salesforce/lds-network-adapter": "^1.332.0-dev1",
46
+ "@salesforce/lds-network-nimbus": "^1.332.0-dev1",
47
+ "@salesforce/lds-store-binary": "^1.332.0-dev1",
48
+ "@salesforce/lds-store-nimbus": "^1.332.0-dev1",
49
+ "@salesforce/lds-store-sql": "^1.332.0-dev1",
50
+ "@salesforce/lds-utils-adapters": "^1.332.0-dev1",
51
+ "@salesforce/nimbus-plugin-lds": "^1.332.0-dev1",
52
52
  "babel-plugin-dynamic-import-node": "^2.3.3",
53
53
  "wait-for-expect": "^3.0.2"
54
54
  },
package/sfdc/main.js CHANGED
@@ -42867,12 +42867,16 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
42867
42867
  /* global __nimbus */
42868
42868
  function chunkToBase64(chunk) {
42869
42869
  const bytes = new Uint8Array(chunk);
42870
- const binary = String.fromCharCode.apply(null, bytes);
42870
+ const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
42871
+ let binary = '';
42872
+ for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
42873
+ binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
42874
+ }
42871
42875
  return btoa(binary);
42872
42876
  }
42873
42877
  async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
42874
42878
  const uri = await binaryStore.createStream(mimeType);
42875
- const CHUNK_SIZE = 64 * 1024; // 64KB
42879
+ const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
42876
42880
  const fileSize = file.size;
42877
42881
  let offset = 0;
42878
42882
  try {
@@ -42946,7 +42950,7 @@ function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore,
42946
42950
  });
42947
42951
  const resourceRequest = buildResourceRequest(config);
42948
42952
  if (actionHandler.hasIdempotencySupport()) {
42949
- resourceRequest.headers['Idempotency-Key'] = uuidv4();
42953
+ resourceRequest.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
42950
42954
  }
42951
42955
  const action = await actionHandler.enqueue(resourceRequest).catch(async (error) => {
42952
42956
  eventEmitter({
@@ -43324,7 +43328,7 @@ function createRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
43324
43328
  return async function createRecordDraftAdapter(config, createResourceRequest) {
43325
43329
  const request = createResourceRequest(config);
43326
43330
  if (actionHandler.hasIdempotencySupport()) {
43327
- request.headers['Idempotency-Key'] = uuidv4();
43331
+ request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
43328
43332
  }
43329
43333
  request.queryParams = request.queryParams || {};
43330
43334
  request.queryParams['includeFieldsInBody'] = true;
@@ -43352,7 +43356,7 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
43352
43356
  return async function createRecordDraftAdapter(config, createResourceRequest) {
43353
43357
  const request = createResourceRequest(config);
43354
43358
  if (actionHandler.hasIdempotencySupport()) {
43355
- request.headers['Idempotency-Key'] = uuidv4();
43359
+ request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
43356
43360
  }
43357
43361
  request.queryParams = request.queryParams || {};
43358
43362
  request.queryParams['includeFieldsInBody'] = true;
@@ -43378,7 +43382,13 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
43378
43382
  */
43379
43383
  function deleteRecordDraftAdapterFactory(actionHandler) {
43380
43384
  return async function deleteRecordDraftAdapter(config, buildResourceRequest) {
43381
- await actionHandler.enqueue(buildResourceRequest(config));
43385
+ const request = buildResourceRequest(config);
43386
+ if (actionHandler.hasIdempotencySupport()) {
43387
+ request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
43388
+ }
43389
+ await actionHandler.enqueue(request).catch((err) => {
43390
+ throw transformErrorToDraftSynthesisError(err);
43391
+ });
43382
43392
  };
43383
43393
  }
43384
43394
 
@@ -44412,10 +44422,13 @@ function sanitizePredicateIDValue(value, draftFunction) {
44412
44422
  }
44413
44423
  }
44414
44424
  function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
44415
- if (!value || (isArray$1(value) && value.length === 0)) {
44425
+ if (value === undefined || (isArray$1(value) && value.length === 0)) {
44416
44426
  // eslint-disable-next-line
44417
44427
  throw new Error(`No value specified for MultiPickList filter`);
44418
44428
  }
44429
+ if (value === null) {
44430
+ return createSinglePredicate(null, operator, fieldInfo, alias);
44431
+ }
44419
44432
  // generate single prodicate for = and !=
44420
44433
  if (operator === '=' || operator === '!=') {
44421
44434
  // The raw value could be ';;a; b;;', clean it up to 'a;b'
@@ -44435,6 +44448,9 @@ function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
44435
44448
  type: PredicateType.compound,
44436
44449
  operator: operator === 'LIKE' ? 'or' : 'and',
44437
44450
  children: valueArray.map((v) => {
44451
+ if (v === null) {
44452
+ return createSinglePredicate(v, operator, fieldInfo, alias);
44453
+ }
44438
44454
  const splittedValue = v
44439
44455
  .split(MultiPickListValueSeparator)
44440
44456
  .map((v) => v.trim())
@@ -44497,7 +44513,7 @@ function multiPicklistToSql(operator, value) {
44497
44513
  // match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
44498
44514
  // To make sure the match is safe for includes/excludes. the value is prefix and
44499
44515
  // suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
44500
- if (operator === 'LIKE' || operator === 'NOT LIKE') {
44516
+ if (value !== null && (operator === 'LIKE' || operator === 'NOT LIKE')) {
44501
44517
  return `%${MultiPickListValueSeparator}${value}${MultiPickListValueSeparator}%`;
44502
44518
  }
44503
44519
  else {
@@ -44664,14 +44680,7 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
44664
44680
  // SQLite is case sensitive by default, SOQL is case in-sensitive by default
44665
44681
  // For pick list includes or excludeds, prefix and suffix the field value with ';' to guarantee the query accuracy.
44666
44682
  if (dataType === 'MultiPicklist' && (operator === 'LIKE' || operator === 'NOT LIKE')) {
44667
- // to include nulls in NOT LIKE operators we need to still return a value for NULL
44668
- // calling the COALESCE function with the extracted value and empty string will make it an empty string
44669
- // instead of NULL in the function return and can be compared
44670
- const coalesce = (sql) => {
44671
- return `COALESCE(${sql}, '')`;
44672
- };
44673
- const extract = `json_extract("${alias}".data, '${leftPath}')`;
44674
- sql = `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
44683
+ sql = buildMultiPicklistSQL(predicate, valueBinding, questionSql);
44675
44684
  }
44676
44685
  else {
44677
44686
  sql = `json_extract("${alias}".data, '${leftPath}') ${operator} ${questionSql}${isCaseSensitive === true ? '' : ` COLLATE NOCASE`}`;
@@ -44681,6 +44690,22 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
44681
44690
  }
44682
44691
  return { sql, binding };
44683
44692
  }
44693
+ function buildMultiPicklistSQL(predicate, value, questionSql) {
44694
+ const { alias, leftPath, operator } = predicate;
44695
+ if (value.length === 1 && value.includes(null)) {
44696
+ return `json_extract("${alias}".data, '${leftPath}') ${operator === 'LIKE' ? 'IS' : 'IS NOT'} ${questionSql}`;
44697
+ }
44698
+ else {
44699
+ // to include nulls in NOT LIKE operators we need to still return a value for NULL
44700
+ // calling the COALESCE function with the extracted value and empty string will make it an empty string
44701
+ // instead of NULL in the function return and can be compared
44702
+ const coalesce = (sql) => {
44703
+ return `COALESCE(${sql}, '')`;
44704
+ };
44705
+ const extract = `json_extract("${alias}".data, '${leftPath}')`;
44706
+ return `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
44707
+ }
44708
+ }
44684
44709
  // for one value, return { sql: '?', bindings:'xxx'}. for multiple value, return { sql: '(?, ?, ?)', binding: ['xxx','yyy','zzz'] }
44685
44710
  function handleExtractedPredicateValue(boundValue, checkForNull) {
44686
44711
  let questionSql = '?';
@@ -45637,65 +45662,100 @@ function pathForKey(key) {
45637
45662
  }
45638
45663
  }
45639
45664
 
45640
- function scopeToJoins(scope = '', settings) {
45641
- if (scope !== 'ASSIGNEDTOME')
45642
- return [];
45643
- return [
45644
- {
45645
- alias: 'ServiceAppointment_AssignedResource',
45646
- type: 'INNER',
45647
- to: 'ServiceAppointment',
45648
- conditions: [
45649
- {
45650
- type: PredicateType.single,
45651
- alias: 'ServiceAppointment_AssignedResource',
45652
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45653
- operator: '=',
45654
- value: 'AssignedResource',
45655
- dataType: 'String',
45656
- isCaseSensitive: true,
45657
- },
45658
- {
45659
- leftPath: '$.id',
45660
- rightPath: '$.fields.ServiceAppointmentId.value',
45661
- },
45662
- ],
45663
- apiName: 'AssignedResource',
45664
- },
45665
- {
45666
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45667
- type: 'INNER',
45668
- to: 'ServiceAppointment_AssignedResource',
45669
- conditions: [
45670
- {
45671
- type: PredicateType.single,
45672
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45673
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45674
- operator: '=',
45675
- value: 'ServiceResource',
45676
- dataType: 'String',
45677
- isCaseSensitive: true,
45678
- },
45679
- {
45680
- leftPath: '$.fields.ServiceResourceId.value',
45681
- rightPath: '$.id',
45682
- },
45683
- {
45684
- type: PredicateType.single,
45685
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45686
- leftPath: '$.fields.RelatedRecordId.value',
45687
- operator: '=',
45688
- value: settings.userId,
45689
- dataType: 'String',
45690
- isCaseSensitive: true,
45691
- },
45692
- ],
45693
- apiName: 'ServiceResource',
45694
- },
45695
- ];
45665
+ function scopeToJoins(scope = '', fieldName, settings) {
45666
+ if (scope === 'ASSIGNEDTOME') {
45667
+ return [
45668
+ {
45669
+ alias: 'ServiceAppointment_AssignedResource',
45670
+ type: 'INNER',
45671
+ to: 'ServiceAppointment',
45672
+ conditions: [
45673
+ {
45674
+ type: PredicateType.single,
45675
+ alias: 'ServiceAppointment_AssignedResource',
45676
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45677
+ operator: '=',
45678
+ value: 'AssignedResource',
45679
+ dataType: 'String',
45680
+ isCaseSensitive: true,
45681
+ },
45682
+ {
45683
+ leftPath: '$.id',
45684
+ rightPath: '$.fields.ServiceAppointmentId.value',
45685
+ },
45686
+ ],
45687
+ apiName: 'AssignedResource',
45688
+ },
45689
+ {
45690
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45691
+ type: 'INNER',
45692
+ to: 'ServiceAppointment_AssignedResource',
45693
+ conditions: [
45694
+ {
45695
+ type: PredicateType.single,
45696
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45697
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45698
+ operator: '=',
45699
+ value: 'ServiceResource',
45700
+ dataType: 'String',
45701
+ isCaseSensitive: true,
45702
+ },
45703
+ {
45704
+ leftPath: '$.fields.ServiceResourceId.value',
45705
+ rightPath: '$.id',
45706
+ },
45707
+ {
45708
+ type: PredicateType.single,
45709
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
45710
+ leftPath: '$.fields.RelatedRecordId.value',
45711
+ operator: '=',
45712
+ value: settings.userId,
45713
+ dataType: 'String',
45714
+ isCaseSensitive: true,
45715
+ },
45716
+ ],
45717
+ apiName: 'ServiceResource',
45718
+ },
45719
+ ];
45720
+ }
45721
+ else if (scope === 'MINE' && fieldName === 'ResourceAbsence') {
45722
+ return [
45723
+ {
45724
+ alias: 'ResourceAbsence_Resource',
45725
+ type: 'INNER',
45726
+ to: 'ResourceAbsence',
45727
+ conditions: [
45728
+ {
45729
+ type: PredicateType.single,
45730
+ alias: 'ResourceAbsence_Resource',
45731
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
45732
+ operator: '=',
45733
+ value: 'ServiceResource',
45734
+ dataType: 'String',
45735
+ isCaseSensitive: true,
45736
+ },
45737
+ {
45738
+ leftPath: '$.fields.ResourceId.value',
45739
+ rightPath: '$.id',
45740
+ },
45741
+ {
45742
+ type: PredicateType.single,
45743
+ alias: 'ResourceAbsence_Resource',
45744
+ leftPath: '$.fields.OwnerId.value',
45745
+ operator: '=',
45746
+ value: settings.userId,
45747
+ dataType: 'String',
45748
+ isCaseSensitive: true,
45749
+ },
45750
+ ],
45751
+ apiName: 'Resource',
45752
+ },
45753
+ ];
45754
+ }
45755
+ return [];
45696
45756
  }
45697
- function scopeToPredicates(scope = '', settings) {
45698
- if (scope !== 'MINE')
45757
+ function scopeToPredicates(scope = '', fieldName, settings) {
45758
+ if (scope !== 'MINE' || fieldName === 'ResourceAbsence')
45699
45759
  return [];
45700
45760
  return [
45701
45761
  {
@@ -46726,10 +46786,10 @@ async function connectionResolver(obj, args, context, info) {
46726
46786
  // Alias starts as entity's ApiName
46727
46787
  const predicates = [
46728
46788
  ...filterToPredicates(args.where, alias, alias, context.objectInfos, joins, draftFunctions),
46729
- ...scopeToPredicates(args.scope, context.settings),
46789
+ ...scopeToPredicates(args.scope, info.fieldName, context.settings),
46730
46790
  ...childRelationshipToPredicates(childRelationshipFieldName, parentRecord ? parentRecord.id : undefined),
46731
46791
  ];
46732
- const scopeJoins = scopeToJoins(args.scope, context.settings);
46792
+ const scopeJoins = scopeToJoins(args.scope, info.fieldName, context.settings);
46733
46793
  joins.push(...scopeJoins);
46734
46794
  // Limit defaults to 10 records if unspecified
46735
46795
  let limit = 10;
@@ -47857,9 +47917,11 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
47857
47917
  .filter(nodeIsNamed('node'))[0];
47858
47918
  switch (node.name.value) {
47859
47919
  case 'scope':
47860
- // Hanle 'MINE' field
47861
47920
  if (isScopeArgumentNodeWithType(node, 'MINE', variables)) {
47862
- if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
47921
+ if (recordQueryApiName === 'ResourceAbsence') {
47922
+ inlineFragmentSelections[ancestorPath].push(...mineResourceAbsenceSelections);
47923
+ }
47924
+ else if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
47863
47925
  // 'typeConditon' is added when the 'InlineFragmentNode' is appended at the write pass
47864
47926
  inlineFragmentSelections[ancestorPath].push(...mineFragmentSelections);
47865
47927
  }
@@ -49010,6 +49072,93 @@ let mineFragmentSelections = [
49010
49072
  },
49011
49073
  },
49012
49074
  ];
49075
+ const mineResourceAbsenceSelections = [
49076
+ {
49077
+ kind: 'Field',
49078
+ name: {
49079
+ kind: 'Name',
49080
+ value: 'ResourceId',
49081
+ },
49082
+ arguments: [],
49083
+ directives: [],
49084
+ selectionSet: {
49085
+ kind: 'SelectionSet',
49086
+ selections: [
49087
+ {
49088
+ kind: 'Field',
49089
+ name: {
49090
+ kind: 'Name',
49091
+ value: 'value',
49092
+ },
49093
+ arguments: [],
49094
+ directives: [],
49095
+ },
49096
+ ],
49097
+ },
49098
+ },
49099
+ {
49100
+ kind: 'Field',
49101
+ name: {
49102
+ kind: 'Name',
49103
+ value: 'Resource',
49104
+ },
49105
+ arguments: [],
49106
+ directives: [
49107
+ {
49108
+ kind: 'Directive',
49109
+ name: {
49110
+ kind: 'Name',
49111
+ value: 'category',
49112
+ },
49113
+ arguments: [
49114
+ {
49115
+ kind: 'Argument',
49116
+ name: {
49117
+ kind: 'Name',
49118
+ value: 'name',
49119
+ },
49120
+ value: {
49121
+ kind: 'StringValue',
49122
+ value: PARENT_RELATIONSHIP,
49123
+ block: false,
49124
+ },
49125
+ },
49126
+ ],
49127
+ },
49128
+ ],
49129
+ selectionSet: {
49130
+ kind: 'SelectionSet',
49131
+ selections: [
49132
+ {
49133
+ kind: 'Field',
49134
+ name: {
49135
+ kind: 'Name',
49136
+ value: 'Id',
49137
+ },
49138
+ },
49139
+ {
49140
+ kind: 'Field',
49141
+ name: {
49142
+ kind: 'Name',
49143
+ value: 'OwnerId',
49144
+ },
49145
+ selectionSet: {
49146
+ kind: 'SelectionSet',
49147
+ selections: [
49148
+ {
49149
+ kind: 'Field',
49150
+ name: {
49151
+ kind: 'Name',
49152
+ value: 'value',
49153
+ },
49154
+ },
49155
+ ],
49156
+ },
49157
+ },
49158
+ ],
49159
+ },
49160
+ },
49161
+ ];
49013
49162
  const assignedToMeFragmentSelections = [
49014
49163
  {
49015
49164
  kind: 'Field',
@@ -55098,7 +55247,8 @@ class DurableRecordStore {
55098
55247
  }
55099
55248
  async exists(key) {
55100
55249
  const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
55101
- return result.rows[0][0] === 1;
55250
+ const exists = result.rows[0][0];
55251
+ return exists == true;
55102
55252
  }
55103
55253
  async getRecord(key) {
55104
55254
  const canonicalKey = this.getLuvio().storeGetCanonicalKey(key);
@@ -55332,4 +55482,4 @@ register({
55332
55482
  });
55333
55483
 
55334
55484
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
55335
- // version: 1.330.0-29e6947dcf
55485
+ // version: 1.332.0-dev1-5d903f6f8e
@@ -1,4 +1,4 @@
1
1
  import type { Join, PredicateValue } from './query';
2
2
  import type { LocalEvaluationRuntimeSettings } from './types';
3
- export declare function scopeToJoins(scope: string | undefined, settings: LocalEvaluationRuntimeSettings): Join[];
4
- export declare function scopeToPredicates(scope: string | undefined, settings: LocalEvaluationRuntimeSettings): PredicateValue[];
3
+ export declare function scopeToJoins(scope: string | undefined, fieldName: string, settings: LocalEvaluationRuntimeSettings): Join[];
4
+ export declare function scopeToPredicates(scope: string | undefined, fieldName: string, settings: LocalEvaluationRuntimeSettings): PredicateValue[];