@salesforce/lds-worker-api 1.331.0 → 1.332.0-dev2

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.
@@ -597,9 +597,7 @@ function removeDraftNodeActionId(targetDraftId, responseValue) {
597
597
  ...responseValue.data.drafts,
598
598
  draftActionIds: responseValue.data.drafts.draftActionIds.filter((x) => x !== targetDraftId),
599
599
  };
600
- return Object.assign(responseValue, {
601
- data: { drafts: recordDraftsNode },
602
- });
600
+ return { ...responseValue, data: { ...responseValue.data, drafts: recordDraftsNode } };
603
601
  }
604
602
  function convertErrorIntoNativeFetchError(error, defaultMessage) {
605
603
  let message = defaultMessage;
@@ -1121,4 +1119,4 @@ if (process.env.NODE_ENV !== 'production') {
1121
1119
  }
1122
1120
 
1123
1121
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1124
- // version: 1.331.0-fec0cd0317
1122
+ // version: 1.332.0-dev2-fcd88ea533
@@ -4265,7 +4265,7 @@ function withDefaultLuvio(callback) {
4265
4265
  }
4266
4266
  callbacks.push(callback);
4267
4267
  }
4268
- // version: 1.331.0-fec0cd0317
4268
+ // version: 1.332.0-dev2-fcd88ea533
4269
4269
 
4270
4270
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4271
4271
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5213,7 +5213,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5213
5213
  const { apiFamily, name } = metadata;
5214
5214
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5215
5215
  }
5216
- // version: 1.331.0-fec0cd0317
5216
+ // version: 1.332.0-dev2-fcd88ea533
5217
5217
 
5218
5218
  /**
5219
5219
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -33850,7 +33850,7 @@ withDefaultLuvio((luvio) => {
33850
33850
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33851
33851
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33852
33852
  });
33853
- // version: 1.331.0-e9c482e8ab
33853
+ // version: 1.332.0-dev2-db38b645f2
33854
33854
 
33855
33855
  /**
33856
33856
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -80255,12 +80255,16 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
80255
80255
  /* global __nimbus */
80256
80256
  function chunkToBase64(chunk) {
80257
80257
  const bytes = new Uint8Array(chunk);
80258
- const binary = String.fromCharCode.apply(null, bytes);
80258
+ const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
80259
+ let binary = '';
80260
+ for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
80261
+ binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
80262
+ }
80259
80263
  return btoa(binary);
80260
80264
  }
80261
80265
  async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
80262
80266
  const uri = await binaryStore.createStream(mimeType);
80263
- const CHUNK_SIZE = 64 * 1024; // 64KB
80267
+ const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
80264
80268
  const fileSize = file.size;
80265
80269
  let offset = 0;
80266
80270
  try {
@@ -81802,10 +81806,13 @@ function sanitizePredicateIDValue(value, draftFunction) {
81802
81806
  }
81803
81807
  }
81804
81808
  function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
81805
- if (!value || (isArray$1$1(value) && value.length === 0)) {
81809
+ if (value === undefined || (isArray$1$1(value) && value.length === 0)) {
81806
81810
  // eslint-disable-next-line
81807
81811
  throw new Error(`No value specified for MultiPickList filter`);
81808
81812
  }
81813
+ if (value === null) {
81814
+ return createSinglePredicate(null, operator, fieldInfo, alias);
81815
+ }
81809
81816
  // generate single prodicate for = and !=
81810
81817
  if (operator === '=' || operator === '!=') {
81811
81818
  // The raw value could be ';;a; b;;', clean it up to 'a;b'
@@ -81825,6 +81832,9 @@ function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
81825
81832
  type: PredicateType.compound,
81826
81833
  operator: operator === 'LIKE' ? 'or' : 'and',
81827
81834
  children: valueArray.map((v) => {
81835
+ if (v === null) {
81836
+ return createSinglePredicate(v, operator, fieldInfo, alias);
81837
+ }
81828
81838
  const splittedValue = v
81829
81839
  .split(MultiPickListValueSeparator)
81830
81840
  .map((v) => v.trim())
@@ -81887,7 +81897,7 @@ function multiPicklistToSql(operator, value) {
81887
81897
  // match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
81888
81898
  // To make sure the match is safe for includes/excludes. the value is prefix and
81889
81899
  // suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
81890
- if (operator === 'LIKE' || operator === 'NOT LIKE') {
81900
+ if (value !== null && (operator === 'LIKE' || operator === 'NOT LIKE')) {
81891
81901
  return `%${MultiPickListValueSeparator}${value}${MultiPickListValueSeparator}%`;
81892
81902
  }
81893
81903
  else {
@@ -82054,14 +82064,7 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
82054
82064
  // SQLite is case sensitive by default, SOQL is case in-sensitive by default
82055
82065
  // For pick list includes or excludeds, prefix and suffix the field value with ';' to guarantee the query accuracy.
82056
82066
  if (dataType === 'MultiPicklist' && (operator === 'LIKE' || operator === 'NOT LIKE')) {
82057
- // to include nulls in NOT LIKE operators we need to still return a value for NULL
82058
- // calling the COALESCE function with the extracted value and empty string will make it an empty string
82059
- // instead of NULL in the function return and can be compared
82060
- const coalesce = (sql) => {
82061
- return `COALESCE(${sql}, '')`;
82062
- };
82063
- const extract = `json_extract("${alias}".data, '${leftPath}')`;
82064
- sql = `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
82067
+ sql = buildMultiPicklistSQL(predicate, valueBinding, questionSql);
82065
82068
  }
82066
82069
  else {
82067
82070
  sql = `json_extract("${alias}".data, '${leftPath}') ${operator} ${questionSql}${isCaseSensitive === true ? '' : ` COLLATE NOCASE`}`;
@@ -82071,6 +82074,22 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
82071
82074
  }
82072
82075
  return { sql, binding };
82073
82076
  }
82077
+ function buildMultiPicklistSQL(predicate, value, questionSql) {
82078
+ const { alias, leftPath, operator } = predicate;
82079
+ if (value.length === 1 && value.includes(null)) {
82080
+ return `json_extract("${alias}".data, '${leftPath}') ${operator === 'LIKE' ? 'IS' : 'IS NOT'} ${questionSql}`;
82081
+ }
82082
+ else {
82083
+ // to include nulls in NOT LIKE operators we need to still return a value for NULL
82084
+ // calling the COALESCE function with the extracted value and empty string will make it an empty string
82085
+ // instead of NULL in the function return and can be compared
82086
+ const coalesce = (sql) => {
82087
+ return `COALESCE(${sql}, '')`;
82088
+ };
82089
+ const extract = `json_extract("${alias}".data, '${leftPath}')`;
82090
+ return `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
82091
+ }
82092
+ }
82074
82093
  // for one value, return { sql: '?', bindings:'xxx'}. for multiple value, return { sql: '(?, ?, ?)', binding: ['xxx','yyy','zzz'] }
82075
82094
  function handleExtractedPredicateValue(boundValue, checkForNull) {
82076
82095
  let questionSql = '?';
@@ -83027,65 +83046,100 @@ function pathForKey(key) {
83027
83046
  }
83028
83047
  }
83029
83048
 
83030
- function scopeToJoins(scope = '', settings) {
83031
- if (scope !== 'ASSIGNEDTOME')
83032
- return [];
83033
- return [
83034
- {
83035
- alias: 'ServiceAppointment_AssignedResource',
83036
- type: 'INNER',
83037
- to: 'ServiceAppointment',
83038
- conditions: [
83039
- {
83040
- type: PredicateType.single,
83041
- alias: 'ServiceAppointment_AssignedResource',
83042
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83043
- operator: '=',
83044
- value: 'AssignedResource',
83045
- dataType: 'String',
83046
- isCaseSensitive: true,
83047
- },
83048
- {
83049
- leftPath: '$.id',
83050
- rightPath: '$.fields.ServiceAppointmentId.value',
83051
- },
83052
- ],
83053
- apiName: 'AssignedResource',
83054
- },
83055
- {
83056
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83057
- type: 'INNER',
83058
- to: 'ServiceAppointment_AssignedResource',
83059
- conditions: [
83060
- {
83061
- type: PredicateType.single,
83062
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83063
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83064
- operator: '=',
83065
- value: 'ServiceResource',
83066
- dataType: 'String',
83067
- isCaseSensitive: true,
83068
- },
83069
- {
83070
- leftPath: '$.fields.ServiceResourceId.value',
83071
- rightPath: '$.id',
83072
- },
83073
- {
83074
- type: PredicateType.single,
83075
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83076
- leftPath: '$.fields.RelatedRecordId.value',
83077
- operator: '=',
83078
- value: settings.userId,
83079
- dataType: 'String',
83080
- isCaseSensitive: true,
83081
- },
83082
- ],
83083
- apiName: 'ServiceResource',
83084
- },
83085
- ];
83049
+ function scopeToJoins(scope = '', fieldName, settings) {
83050
+ if (scope === 'ASSIGNEDTOME') {
83051
+ return [
83052
+ {
83053
+ alias: 'ServiceAppointment_AssignedResource',
83054
+ type: 'INNER',
83055
+ to: 'ServiceAppointment',
83056
+ conditions: [
83057
+ {
83058
+ type: PredicateType.single,
83059
+ alias: 'ServiceAppointment_AssignedResource',
83060
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83061
+ operator: '=',
83062
+ value: 'AssignedResource',
83063
+ dataType: 'String',
83064
+ isCaseSensitive: true,
83065
+ },
83066
+ {
83067
+ leftPath: '$.id',
83068
+ rightPath: '$.fields.ServiceAppointmentId.value',
83069
+ },
83070
+ ],
83071
+ apiName: 'AssignedResource',
83072
+ },
83073
+ {
83074
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83075
+ type: 'INNER',
83076
+ to: 'ServiceAppointment_AssignedResource',
83077
+ conditions: [
83078
+ {
83079
+ type: PredicateType.single,
83080
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83081
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83082
+ operator: '=',
83083
+ value: 'ServiceResource',
83084
+ dataType: 'String',
83085
+ isCaseSensitive: true,
83086
+ },
83087
+ {
83088
+ leftPath: '$.fields.ServiceResourceId.value',
83089
+ rightPath: '$.id',
83090
+ },
83091
+ {
83092
+ type: PredicateType.single,
83093
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83094
+ leftPath: '$.fields.RelatedRecordId.value',
83095
+ operator: '=',
83096
+ value: settings.userId,
83097
+ dataType: 'String',
83098
+ isCaseSensitive: true,
83099
+ },
83100
+ ],
83101
+ apiName: 'ServiceResource',
83102
+ },
83103
+ ];
83104
+ }
83105
+ else if (scope === 'MINE' && fieldName === 'ResourceAbsence') {
83106
+ return [
83107
+ {
83108
+ alias: 'ResourceAbsence_Resource',
83109
+ type: 'INNER',
83110
+ to: 'ResourceAbsence',
83111
+ conditions: [
83112
+ {
83113
+ type: PredicateType.single,
83114
+ alias: 'ResourceAbsence_Resource',
83115
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83116
+ operator: '=',
83117
+ value: 'ServiceResource',
83118
+ dataType: 'String',
83119
+ isCaseSensitive: true,
83120
+ },
83121
+ {
83122
+ leftPath: '$.fields.ResourceId.value',
83123
+ rightPath: '$.id',
83124
+ },
83125
+ {
83126
+ type: PredicateType.single,
83127
+ alias: 'ResourceAbsence_Resource',
83128
+ leftPath: '$.fields.OwnerId.value',
83129
+ operator: '=',
83130
+ value: settings.userId,
83131
+ dataType: 'String',
83132
+ isCaseSensitive: true,
83133
+ },
83134
+ ],
83135
+ apiName: 'Resource',
83136
+ },
83137
+ ];
83138
+ }
83139
+ return [];
83086
83140
  }
83087
- function scopeToPredicates(scope = '', settings) {
83088
- if (scope !== 'MINE')
83141
+ function scopeToPredicates(scope = '', fieldName, settings) {
83142
+ if (scope !== 'MINE' || fieldName === 'ResourceAbsence')
83089
83143
  return [];
83090
83144
  return [
83091
83145
  {
@@ -84116,10 +84170,10 @@ async function connectionResolver(obj, args, context, info) {
84116
84170
  // Alias starts as entity's ApiName
84117
84171
  const predicates = [
84118
84172
  ...filterToPredicates(args.where, alias, alias, context.objectInfos, joins, draftFunctions),
84119
- ...scopeToPredicates(args.scope, context.settings),
84173
+ ...scopeToPredicates(args.scope, info.fieldName, context.settings),
84120
84174
  ...childRelationshipToPredicates(childRelationshipFieldName, parentRecord ? parentRecord.id : undefined),
84121
84175
  ];
84122
- const scopeJoins = scopeToJoins(args.scope, context.settings);
84176
+ const scopeJoins = scopeToJoins(args.scope, info.fieldName, context.settings);
84123
84177
  joins.push(...scopeJoins);
84124
84178
  // Limit defaults to 10 records if unspecified
84125
84179
  let limit = 10;
@@ -85247,9 +85301,11 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
85247
85301
  .filter(nodeIsNamed('node'))[0];
85248
85302
  switch (node.name.value) {
85249
85303
  case 'scope':
85250
- // Hanle 'MINE' field
85251
85304
  if (isScopeArgumentNodeWithType(node, 'MINE', variables)) {
85252
- if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
85305
+ if (recordQueryApiName === 'ResourceAbsence') {
85306
+ inlineFragmentSelections[ancestorPath].push(...mineResourceAbsenceSelections);
85307
+ }
85308
+ else if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
85253
85309
  // 'typeConditon' is added when the 'InlineFragmentNode' is appended at the write pass
85254
85310
  inlineFragmentSelections[ancestorPath].push(...mineFragmentSelections);
85255
85311
  }
@@ -86400,6 +86456,93 @@ let mineFragmentSelections = [
86400
86456
  },
86401
86457
  },
86402
86458
  ];
86459
+ const mineResourceAbsenceSelections = [
86460
+ {
86461
+ kind: 'Field',
86462
+ name: {
86463
+ kind: 'Name',
86464
+ value: 'ResourceId',
86465
+ },
86466
+ arguments: [],
86467
+ directives: [],
86468
+ selectionSet: {
86469
+ kind: 'SelectionSet',
86470
+ selections: [
86471
+ {
86472
+ kind: 'Field',
86473
+ name: {
86474
+ kind: 'Name',
86475
+ value: 'value',
86476
+ },
86477
+ arguments: [],
86478
+ directives: [],
86479
+ },
86480
+ ],
86481
+ },
86482
+ },
86483
+ {
86484
+ kind: 'Field',
86485
+ name: {
86486
+ kind: 'Name',
86487
+ value: 'Resource',
86488
+ },
86489
+ arguments: [],
86490
+ directives: [
86491
+ {
86492
+ kind: 'Directive',
86493
+ name: {
86494
+ kind: 'Name',
86495
+ value: 'category',
86496
+ },
86497
+ arguments: [
86498
+ {
86499
+ kind: 'Argument',
86500
+ name: {
86501
+ kind: 'Name',
86502
+ value: 'name',
86503
+ },
86504
+ value: {
86505
+ kind: 'StringValue',
86506
+ value: PARENT_RELATIONSHIP,
86507
+ block: false,
86508
+ },
86509
+ },
86510
+ ],
86511
+ },
86512
+ ],
86513
+ selectionSet: {
86514
+ kind: 'SelectionSet',
86515
+ selections: [
86516
+ {
86517
+ kind: 'Field',
86518
+ name: {
86519
+ kind: 'Name',
86520
+ value: 'Id',
86521
+ },
86522
+ },
86523
+ {
86524
+ kind: 'Field',
86525
+ name: {
86526
+ kind: 'Name',
86527
+ value: 'OwnerId',
86528
+ },
86529
+ selectionSet: {
86530
+ kind: 'SelectionSet',
86531
+ selections: [
86532
+ {
86533
+ kind: 'Field',
86534
+ name: {
86535
+ kind: 'Name',
86536
+ value: 'value',
86537
+ },
86538
+ },
86539
+ ],
86540
+ },
86541
+ },
86542
+ ],
86543
+ },
86544
+ },
86545
+ ];
86403
86546
  const assignedToMeFragmentSelections = [
86404
86547
  {
86405
86548
  kind: 'Field',
@@ -92454,7 +92597,8 @@ class DurableRecordStore {
92454
92597
  }
92455
92598
  async exists(key) {
92456
92599
  const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
92457
- return result.rows[0][0] === 1;
92600
+ const exists = result.rows[0][0];
92601
+ return exists == true;
92458
92602
  }
92459
92603
  async getRecord(key) {
92460
92604
  const canonicalKey = this.getLuvio().storeGetCanonicalKey(key);
@@ -92685,7 +92829,7 @@ register$1({
92685
92829
  id: '@salesforce/lds-network-adapter',
92686
92830
  instrument: instrument$2,
92687
92831
  });
92688
- // version: 1.331.0-fec0cd0317
92832
+ // version: 1.332.0-dev2-fcd88ea533
92689
92833
 
92690
92834
  const { create: create$2, keys: keys$2 } = Object;
92691
92835
  const { stringify, parse } = JSON;
@@ -115252,7 +115396,7 @@ register$1({
115252
115396
  configuration: { ...configurationForGraphQLAdapters$1 },
115253
115397
  instrument: instrument$1,
115254
115398
  });
115255
- // version: 1.331.0-e9c482e8ab
115399
+ // version: 1.332.0-dev2-db38b645f2
115256
115400
 
115257
115401
  // On core the unstable adapters are re-exported with different names,
115258
115402
  // we want to match them here.
@@ -115404,7 +115548,7 @@ withDefaultLuvio((luvio) => {
115404
115548
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
115405
115549
  graphQLImperative = ldsAdapter;
115406
115550
  });
115407
- // version: 1.331.0-e9c482e8ab
115551
+ // version: 1.332.0-dev2-db38b645f2
115408
115552
 
115409
115553
  var gqlApi = /*#__PURE__*/Object.freeze({
115410
115554
  __proto__: null,
@@ -115965,9 +116109,7 @@ function removeDraftNodeActionId(targetDraftId, responseValue) {
115965
116109
  ...responseValue.data.drafts,
115966
116110
  draftActionIds: responseValue.data.drafts.draftActionIds.filter((x) => x !== targetDraftId),
115967
116111
  };
115968
- return Object.assign(responseValue, {
115969
- data: { drafts: recordDraftsNode },
115970
- });
116112
+ return { ...responseValue, data: { ...responseValue.data, drafts: recordDraftsNode } };
115971
116113
  }
115972
116114
  function convertErrorIntoNativeFetchError(error, defaultMessage) {
115973
116115
  let message = defaultMessage;
@@ -116189,7 +116331,7 @@ const callbacks$1 = [];
116189
116331
  function register(r) {
116190
116332
  callbacks$1.forEach((callback) => callback(r));
116191
116333
  }
116192
- // version: 1.331.0-fec0cd0317
116334
+ // version: 1.332.0-dev2-fcd88ea533
116193
116335
 
116194
116336
  /**
116195
116337
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -117252,4 +117394,4 @@ const { luvio } = getRuntime();
117252
117394
  setDefaultLuvio({ luvio });
117253
117395
 
117254
117396
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
117255
- // version: 1.331.0-fec0cd0317
117397
+ // version: 1.332.0-dev2-fcd88ea533
@@ -4271,7 +4271,7 @@
4271
4271
  }
4272
4272
  callbacks.push(callback);
4273
4273
  }
4274
- // version: 1.331.0-fec0cd0317
4274
+ // version: 1.332.0-dev2-fcd88ea533
4275
4275
 
4276
4276
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4277
4277
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5219,7 +5219,7 @@
5219
5219
  const { apiFamily, name } = metadata;
5220
5220
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5221
5221
  }
5222
- // version: 1.331.0-fec0cd0317
5222
+ // version: 1.332.0-dev2-fcd88ea533
5223
5223
 
5224
5224
  /**
5225
5225
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -33856,7 +33856,7 @@
33856
33856
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33857
33857
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33858
33858
  });
33859
- // version: 1.331.0-e9c482e8ab
33859
+ // version: 1.332.0-dev2-db38b645f2
33860
33860
 
33861
33861
  /**
33862
33862
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -80261,12 +80261,16 @@
80261
80261
  /* global __nimbus */
80262
80262
  function chunkToBase64(chunk) {
80263
80263
  const bytes = new Uint8Array(chunk);
80264
- const binary = String.fromCharCode.apply(null, bytes);
80264
+ const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
80265
+ let binary = '';
80266
+ for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
80267
+ binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
80268
+ }
80265
80269
  return btoa(binary);
80266
80270
  }
80267
80271
  async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
80268
80272
  const uri = await binaryStore.createStream(mimeType);
80269
- const CHUNK_SIZE = 64 * 1024; // 64KB
80273
+ const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
80270
80274
  const fileSize = file.size;
80271
80275
  let offset = 0;
80272
80276
  try {
@@ -81808,10 +81812,13 @@
81808
81812
  }
81809
81813
  }
81810
81814
  function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
81811
- if (!value || (isArray$1$1(value) && value.length === 0)) {
81815
+ if (value === undefined || (isArray$1$1(value) && value.length === 0)) {
81812
81816
  // eslint-disable-next-line
81813
81817
  throw new Error(`No value specified for MultiPickList filter`);
81814
81818
  }
81819
+ if (value === null) {
81820
+ return createSinglePredicate(null, operator, fieldInfo, alias);
81821
+ }
81815
81822
  // generate single prodicate for = and !=
81816
81823
  if (operator === '=' || operator === '!=') {
81817
81824
  // The raw value could be ';;a; b;;', clean it up to 'a;b'
@@ -81831,6 +81838,9 @@
81831
81838
  type: PredicateType.compound,
81832
81839
  operator: operator === 'LIKE' ? 'or' : 'and',
81833
81840
  children: valueArray.map((v) => {
81841
+ if (v === null) {
81842
+ return createSinglePredicate(v, operator, fieldInfo, alias);
81843
+ }
81834
81844
  const splittedValue = v
81835
81845
  .split(MultiPickListValueSeparator)
81836
81846
  .map((v) => v.trim())
@@ -81893,7 +81903,7 @@
81893
81903
  // match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
81894
81904
  // To make sure the match is safe for includes/excludes. the value is prefix and
81895
81905
  // suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
81896
- if (operator === 'LIKE' || operator === 'NOT LIKE') {
81906
+ if (value !== null && (operator === 'LIKE' || operator === 'NOT LIKE')) {
81897
81907
  return `%${MultiPickListValueSeparator}${value}${MultiPickListValueSeparator}%`;
81898
81908
  }
81899
81909
  else {
@@ -82060,14 +82070,7 @@
82060
82070
  // SQLite is case sensitive by default, SOQL is case in-sensitive by default
82061
82071
  // For pick list includes or excludeds, prefix and suffix the field value with ';' to guarantee the query accuracy.
82062
82072
  if (dataType === 'MultiPicklist' && (operator === 'LIKE' || operator === 'NOT LIKE')) {
82063
- // to include nulls in NOT LIKE operators we need to still return a value for NULL
82064
- // calling the COALESCE function with the extracted value and empty string will make it an empty string
82065
- // instead of NULL in the function return and can be compared
82066
- const coalesce = (sql) => {
82067
- return `COALESCE(${sql}, '')`;
82068
- };
82069
- const extract = `json_extract("${alias}".data, '${leftPath}')`;
82070
- sql = `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
82073
+ sql = buildMultiPicklistSQL(predicate, valueBinding, questionSql);
82071
82074
  }
82072
82075
  else {
82073
82076
  sql = `json_extract("${alias}".data, '${leftPath}') ${operator} ${questionSql}${isCaseSensitive === true ? '' : ` COLLATE NOCASE`}`;
@@ -82077,6 +82080,22 @@
82077
82080
  }
82078
82081
  return { sql, binding };
82079
82082
  }
82083
+ function buildMultiPicklistSQL(predicate, value, questionSql) {
82084
+ const { alias, leftPath, operator } = predicate;
82085
+ if (value.length === 1 && value.includes(null)) {
82086
+ return `json_extract("${alias}".data, '${leftPath}') ${operator === 'LIKE' ? 'IS' : 'IS NOT'} ${questionSql}`;
82087
+ }
82088
+ else {
82089
+ // to include nulls in NOT LIKE operators we need to still return a value for NULL
82090
+ // calling the COALESCE function with the extracted value and empty string will make it an empty string
82091
+ // instead of NULL in the function return and can be compared
82092
+ const coalesce = (sql) => {
82093
+ return `COALESCE(${sql}, '')`;
82094
+ };
82095
+ const extract = `json_extract("${alias}".data, '${leftPath}')`;
82096
+ return `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
82097
+ }
82098
+ }
82080
82099
  // for one value, return { sql: '?', bindings:'xxx'}. for multiple value, return { sql: '(?, ?, ?)', binding: ['xxx','yyy','zzz'] }
82081
82100
  function handleExtractedPredicateValue(boundValue, checkForNull) {
82082
82101
  let questionSql = '?';
@@ -83033,65 +83052,100 @@
83033
83052
  }
83034
83053
  }
83035
83054
 
83036
- function scopeToJoins(scope = '', settings) {
83037
- if (scope !== 'ASSIGNEDTOME')
83038
- return [];
83039
- return [
83040
- {
83041
- alias: 'ServiceAppointment_AssignedResource',
83042
- type: 'INNER',
83043
- to: 'ServiceAppointment',
83044
- conditions: [
83045
- {
83046
- type: PredicateType.single,
83047
- alias: 'ServiceAppointment_AssignedResource',
83048
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83049
- operator: '=',
83050
- value: 'AssignedResource',
83051
- dataType: 'String',
83052
- isCaseSensitive: true,
83053
- },
83054
- {
83055
- leftPath: '$.id',
83056
- rightPath: '$.fields.ServiceAppointmentId.value',
83057
- },
83058
- ],
83059
- apiName: 'AssignedResource',
83060
- },
83061
- {
83062
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83063
- type: 'INNER',
83064
- to: 'ServiceAppointment_AssignedResource',
83065
- conditions: [
83066
- {
83067
- type: PredicateType.single,
83068
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83069
- leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83070
- operator: '=',
83071
- value: 'ServiceResource',
83072
- dataType: 'String',
83073
- isCaseSensitive: true,
83074
- },
83075
- {
83076
- leftPath: '$.fields.ServiceResourceId.value',
83077
- rightPath: '$.id',
83078
- },
83079
- {
83080
- type: PredicateType.single,
83081
- alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83082
- leftPath: '$.fields.RelatedRecordId.value',
83083
- operator: '=',
83084
- value: settings.userId,
83085
- dataType: 'String',
83086
- isCaseSensitive: true,
83087
- },
83088
- ],
83089
- apiName: 'ServiceResource',
83090
- },
83091
- ];
83055
+ function scopeToJoins(scope = '', fieldName, settings) {
83056
+ if (scope === 'ASSIGNEDTOME') {
83057
+ return [
83058
+ {
83059
+ alias: 'ServiceAppointment_AssignedResource',
83060
+ type: 'INNER',
83061
+ to: 'ServiceAppointment',
83062
+ conditions: [
83063
+ {
83064
+ type: PredicateType.single,
83065
+ alias: 'ServiceAppointment_AssignedResource',
83066
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83067
+ operator: '=',
83068
+ value: 'AssignedResource',
83069
+ dataType: 'String',
83070
+ isCaseSensitive: true,
83071
+ },
83072
+ {
83073
+ leftPath: '$.id',
83074
+ rightPath: '$.fields.ServiceAppointmentId.value',
83075
+ },
83076
+ ],
83077
+ apiName: 'AssignedResource',
83078
+ },
83079
+ {
83080
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83081
+ type: 'INNER',
83082
+ to: 'ServiceAppointment_AssignedResource',
83083
+ conditions: [
83084
+ {
83085
+ type: PredicateType.single,
83086
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83087
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83088
+ operator: '=',
83089
+ value: 'ServiceResource',
83090
+ dataType: 'String',
83091
+ isCaseSensitive: true,
83092
+ },
83093
+ {
83094
+ leftPath: '$.fields.ServiceResourceId.value',
83095
+ rightPath: '$.id',
83096
+ },
83097
+ {
83098
+ type: PredicateType.single,
83099
+ alias: 'ServiceAppointment_AssignedResource_ServiceResource',
83100
+ leftPath: '$.fields.RelatedRecordId.value',
83101
+ operator: '=',
83102
+ value: settings.userId,
83103
+ dataType: 'String',
83104
+ isCaseSensitive: true,
83105
+ },
83106
+ ],
83107
+ apiName: 'ServiceResource',
83108
+ },
83109
+ ];
83110
+ }
83111
+ else if (scope === 'MINE' && fieldName === 'ResourceAbsence') {
83112
+ return [
83113
+ {
83114
+ alias: 'ResourceAbsence_Resource',
83115
+ type: 'INNER',
83116
+ to: 'ResourceAbsence',
83117
+ conditions: [
83118
+ {
83119
+ type: PredicateType.single,
83120
+ alias: 'ResourceAbsence_Resource',
83121
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
83122
+ operator: '=',
83123
+ value: 'ServiceResource',
83124
+ dataType: 'String',
83125
+ isCaseSensitive: true,
83126
+ },
83127
+ {
83128
+ leftPath: '$.fields.ResourceId.value',
83129
+ rightPath: '$.id',
83130
+ },
83131
+ {
83132
+ type: PredicateType.single,
83133
+ alias: 'ResourceAbsence_Resource',
83134
+ leftPath: '$.fields.OwnerId.value',
83135
+ operator: '=',
83136
+ value: settings.userId,
83137
+ dataType: 'String',
83138
+ isCaseSensitive: true,
83139
+ },
83140
+ ],
83141
+ apiName: 'Resource',
83142
+ },
83143
+ ];
83144
+ }
83145
+ return [];
83092
83146
  }
83093
- function scopeToPredicates(scope = '', settings) {
83094
- if (scope !== 'MINE')
83147
+ function scopeToPredicates(scope = '', fieldName, settings) {
83148
+ if (scope !== 'MINE' || fieldName === 'ResourceAbsence')
83095
83149
  return [];
83096
83150
  return [
83097
83151
  {
@@ -84122,10 +84176,10 @@
84122
84176
  // Alias starts as entity's ApiName
84123
84177
  const predicates = [
84124
84178
  ...filterToPredicates(args.where, alias, alias, context.objectInfos, joins, draftFunctions),
84125
- ...scopeToPredicates(args.scope, context.settings),
84179
+ ...scopeToPredicates(args.scope, info.fieldName, context.settings),
84126
84180
  ...childRelationshipToPredicates(childRelationshipFieldName, parentRecord ? parentRecord.id : undefined),
84127
84181
  ];
84128
- const scopeJoins = scopeToJoins(args.scope, context.settings);
84182
+ const scopeJoins = scopeToJoins(args.scope, info.fieldName, context.settings);
84129
84183
  joins.push(...scopeJoins);
84130
84184
  // Limit defaults to 10 records if unspecified
84131
84185
  let limit = 10;
@@ -85253,9 +85307,11 @@
85253
85307
  .filter(nodeIsNamed('node'))[0];
85254
85308
  switch (node.name.value) {
85255
85309
  case 'scope':
85256
- // Hanle 'MINE' field
85257
85310
  if (isScopeArgumentNodeWithType(node, 'MINE', variables)) {
85258
- if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
85311
+ if (recordQueryApiName === 'ResourceAbsence') {
85312
+ inlineFragmentSelections[ancestorPath].push(...mineResourceAbsenceSelections);
85313
+ }
85314
+ else if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
85259
85315
  // 'typeConditon' is added when the 'InlineFragmentNode' is appended at the write pass
85260
85316
  inlineFragmentSelections[ancestorPath].push(...mineFragmentSelections);
85261
85317
  }
@@ -86406,6 +86462,93 @@
86406
86462
  },
86407
86463
  },
86408
86464
  ];
86465
+ const mineResourceAbsenceSelections = [
86466
+ {
86467
+ kind: 'Field',
86468
+ name: {
86469
+ kind: 'Name',
86470
+ value: 'ResourceId',
86471
+ },
86472
+ arguments: [],
86473
+ directives: [],
86474
+ selectionSet: {
86475
+ kind: 'SelectionSet',
86476
+ selections: [
86477
+ {
86478
+ kind: 'Field',
86479
+ name: {
86480
+ kind: 'Name',
86481
+ value: 'value',
86482
+ },
86483
+ arguments: [],
86484
+ directives: [],
86485
+ },
86486
+ ],
86487
+ },
86488
+ },
86489
+ {
86490
+ kind: 'Field',
86491
+ name: {
86492
+ kind: 'Name',
86493
+ value: 'Resource',
86494
+ },
86495
+ arguments: [],
86496
+ directives: [
86497
+ {
86498
+ kind: 'Directive',
86499
+ name: {
86500
+ kind: 'Name',
86501
+ value: 'category',
86502
+ },
86503
+ arguments: [
86504
+ {
86505
+ kind: 'Argument',
86506
+ name: {
86507
+ kind: 'Name',
86508
+ value: 'name',
86509
+ },
86510
+ value: {
86511
+ kind: 'StringValue',
86512
+ value: PARENT_RELATIONSHIP,
86513
+ block: false,
86514
+ },
86515
+ },
86516
+ ],
86517
+ },
86518
+ ],
86519
+ selectionSet: {
86520
+ kind: 'SelectionSet',
86521
+ selections: [
86522
+ {
86523
+ kind: 'Field',
86524
+ name: {
86525
+ kind: 'Name',
86526
+ value: 'Id',
86527
+ },
86528
+ },
86529
+ {
86530
+ kind: 'Field',
86531
+ name: {
86532
+ kind: 'Name',
86533
+ value: 'OwnerId',
86534
+ },
86535
+ selectionSet: {
86536
+ kind: 'SelectionSet',
86537
+ selections: [
86538
+ {
86539
+ kind: 'Field',
86540
+ name: {
86541
+ kind: 'Name',
86542
+ value: 'value',
86543
+ },
86544
+ },
86545
+ ],
86546
+ },
86547
+ },
86548
+ ],
86549
+ },
86550
+ },
86551
+ ];
86409
86552
  const assignedToMeFragmentSelections = [
86410
86553
  {
86411
86554
  kind: 'Field',
@@ -92460,7 +92603,8 @@
92460
92603
  }
92461
92604
  async exists(key) {
92462
92605
  const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
92463
- return result.rows[0][0] === 1;
92606
+ const exists = result.rows[0][0];
92607
+ return exists == true;
92464
92608
  }
92465
92609
  async getRecord(key) {
92466
92610
  const canonicalKey = this.getLuvio().storeGetCanonicalKey(key);
@@ -92691,7 +92835,7 @@
92691
92835
  id: '@salesforce/lds-network-adapter',
92692
92836
  instrument: instrument$2,
92693
92837
  });
92694
- // version: 1.331.0-fec0cd0317
92838
+ // version: 1.332.0-dev2-fcd88ea533
92695
92839
 
92696
92840
  const { create: create$2, keys: keys$2 } = Object;
92697
92841
  const { stringify, parse } = JSON;
@@ -115258,7 +115402,7 @@
115258
115402
  configuration: { ...configurationForGraphQLAdapters$1 },
115259
115403
  instrument: instrument$1,
115260
115404
  });
115261
- // version: 1.331.0-e9c482e8ab
115405
+ // version: 1.332.0-dev2-db38b645f2
115262
115406
 
115263
115407
  // On core the unstable adapters are re-exported with different names,
115264
115408
  // we want to match them here.
@@ -115410,7 +115554,7 @@
115410
115554
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
115411
115555
  graphQLImperative = ldsAdapter;
115412
115556
  });
115413
- // version: 1.331.0-e9c482e8ab
115557
+ // version: 1.332.0-dev2-db38b645f2
115414
115558
 
115415
115559
  var gqlApi = /*#__PURE__*/Object.freeze({
115416
115560
  __proto__: null,
@@ -115971,9 +116115,7 @@
115971
116115
  ...responseValue.data.drafts,
115972
116116
  draftActionIds: responseValue.data.drafts.draftActionIds.filter((x) => x !== targetDraftId),
115973
116117
  };
115974
- return Object.assign(responseValue, {
115975
- data: { drafts: recordDraftsNode },
115976
- });
116118
+ return { ...responseValue, data: { ...responseValue.data, drafts: recordDraftsNode } };
115977
116119
  }
115978
116120
  function convertErrorIntoNativeFetchError(error, defaultMessage) {
115979
116121
  let message = defaultMessage;
@@ -116195,7 +116337,7 @@
116195
116337
  function register(r) {
116196
116338
  callbacks$1.forEach((callback) => callback(r));
116197
116339
  }
116198
- // version: 1.331.0-fec0cd0317
116340
+ // version: 1.332.0-dev2-fcd88ea533
116199
116341
 
116200
116342
  /**
116201
116343
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -117277,4 +117419,4 @@
117277
117419
  exports.subscribeToAdapter = subscribeToAdapter;
117278
117420
 
117279
117421
  }));
117280
- // version: 1.331.0-fec0cd0317
117422
+ // version: 1.332.0-dev2-fcd88ea533
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.331.0",
3
+ "version": "1.332.0-dev2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.331.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.331.0",
40
- "@salesforce/lds-default-luvio": "^1.331.0",
41
- "@salesforce/lds-drafts": "^1.331.0",
42
- "@salesforce/lds-graphql-parser": "^1.331.0",
43
- "@salesforce/lds-luvio-engine": "^1.331.0",
44
- "@salesforce/lds-runtime-mobile": "^1.331.0",
45
- "@salesforce/nimbus-plugin-lds": "^1.331.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.332.0-dev2",
39
+ "@salesforce/lds-adapters-uiapi": "^1.332.0-dev2",
40
+ "@salesforce/lds-default-luvio": "^1.332.0-dev2",
41
+ "@salesforce/lds-drafts": "^1.332.0-dev2",
42
+ "@salesforce/lds-graphql-parser": "^1.332.0-dev2",
43
+ "@salesforce/lds-luvio-engine": "^1.332.0-dev2",
44
+ "@salesforce/lds-runtime-mobile": "^1.332.0-dev2",
45
+ "@salesforce/nimbus-plugin-lds": "^1.332.0-dev2",
46
46
  "ajv": "^8.11.0",
47
47
  "glob": "^7.1.5",
48
48
  "nimbus-types": "^2.0.0-alpha1",