@salesforce/lds-runtime-mobile 1.331.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 +220 -76
- package/dist/types/graphql/scopeParser.d.ts +2 -2
- package/package.json +14 -14
- package/sfdc/main.js +220 -76
- package/sfdc/types/graphql/scopeParser.d.ts +2 -2
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
|
|
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 =
|
|
42879
|
+
const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
|
|
42876
42880
|
const fileSize = file.size;
|
|
42877
42881
|
let offset = 0;
|
|
42878
42882
|
try {
|
|
@@ -44418,10 +44422,13 @@ function sanitizePredicateIDValue(value, draftFunction) {
|
|
|
44418
44422
|
}
|
|
44419
44423
|
}
|
|
44420
44424
|
function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
|
|
44421
|
-
if (
|
|
44425
|
+
if (value === undefined || (isArray$1(value) && value.length === 0)) {
|
|
44422
44426
|
// eslint-disable-next-line
|
|
44423
44427
|
throw new Error(`No value specified for MultiPickList filter`);
|
|
44424
44428
|
}
|
|
44429
|
+
if (value === null) {
|
|
44430
|
+
return createSinglePredicate(null, operator, fieldInfo, alias);
|
|
44431
|
+
}
|
|
44425
44432
|
// generate single prodicate for = and !=
|
|
44426
44433
|
if (operator === '=' || operator === '!=') {
|
|
44427
44434
|
// The raw value could be ';;a; b;;', clean it up to 'a;b'
|
|
@@ -44441,6 +44448,9 @@ function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
|
|
|
44441
44448
|
type: PredicateType.compound,
|
|
44442
44449
|
operator: operator === 'LIKE' ? 'or' : 'and',
|
|
44443
44450
|
children: valueArray.map((v) => {
|
|
44451
|
+
if (v === null) {
|
|
44452
|
+
return createSinglePredicate(v, operator, fieldInfo, alias);
|
|
44453
|
+
}
|
|
44444
44454
|
const splittedValue = v
|
|
44445
44455
|
.split(MultiPickListValueSeparator)
|
|
44446
44456
|
.map((v) => v.trim())
|
|
@@ -44503,7 +44513,7 @@ function multiPicklistToSql(operator, value) {
|
|
|
44503
44513
|
// match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
|
|
44504
44514
|
// To make sure the match is safe for includes/excludes. the value is prefix and
|
|
44505
44515
|
// suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
|
|
44506
|
-
if (operator === 'LIKE' || operator === 'NOT LIKE') {
|
|
44516
|
+
if (value !== null && (operator === 'LIKE' || operator === 'NOT LIKE')) {
|
|
44507
44517
|
return `%${MultiPickListValueSeparator}${value}${MultiPickListValueSeparator}%`;
|
|
44508
44518
|
}
|
|
44509
44519
|
else {
|
|
@@ -44670,14 +44680,7 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
|
|
|
44670
44680
|
// SQLite is case sensitive by default, SOQL is case in-sensitive by default
|
|
44671
44681
|
// For pick list includes or excludeds, prefix and suffix the field value with ';' to guarantee the query accuracy.
|
|
44672
44682
|
if (dataType === 'MultiPicklist' && (operator === 'LIKE' || operator === 'NOT LIKE')) {
|
|
44673
|
-
|
|
44674
|
-
// calling the COALESCE function with the extracted value and empty string will make it an empty string
|
|
44675
|
-
// instead of NULL in the function return and can be compared
|
|
44676
|
-
const coalesce = (sql) => {
|
|
44677
|
-
return `COALESCE(${sql}, '')`;
|
|
44678
|
-
};
|
|
44679
|
-
const extract = `json_extract("${alias}".data, '${leftPath}')`;
|
|
44680
|
-
sql = `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
|
|
44683
|
+
sql = buildMultiPicklistSQL(predicate, valueBinding, questionSql);
|
|
44681
44684
|
}
|
|
44682
44685
|
else {
|
|
44683
44686
|
sql = `json_extract("${alias}".data, '${leftPath}') ${operator} ${questionSql}${isCaseSensitive === true ? '' : ` COLLATE NOCASE`}`;
|
|
@@ -44687,6 +44690,22 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
|
|
|
44687
44690
|
}
|
|
44688
44691
|
return { sql, binding };
|
|
44689
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
|
+
}
|
|
44690
44709
|
// for one value, return { sql: '?', bindings:'xxx'}. for multiple value, return { sql: '(?, ?, ?)', binding: ['xxx','yyy','zzz'] }
|
|
44691
44710
|
function handleExtractedPredicateValue(boundValue, checkForNull) {
|
|
44692
44711
|
let questionSql = '?';
|
|
@@ -45643,65 +45662,100 @@ function pathForKey(key) {
|
|
|
45643
45662
|
}
|
|
45644
45663
|
}
|
|
45645
45664
|
|
|
45646
|
-
function scopeToJoins(scope = '', settings) {
|
|
45647
|
-
if (scope
|
|
45648
|
-
return [
|
|
45649
|
-
|
|
45650
|
-
|
|
45651
|
-
|
|
45652
|
-
|
|
45653
|
-
|
|
45654
|
-
|
|
45655
|
-
|
|
45656
|
-
|
|
45657
|
-
|
|
45658
|
-
|
|
45659
|
-
|
|
45660
|
-
|
|
45661
|
-
|
|
45662
|
-
|
|
45663
|
-
|
|
45664
|
-
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
|
|
45668
|
-
|
|
45669
|
-
|
|
45670
|
-
|
|
45671
|
-
|
|
45672
|
-
|
|
45673
|
-
|
|
45674
|
-
|
|
45675
|
-
|
|
45676
|
-
|
|
45677
|
-
|
|
45678
|
-
|
|
45679
|
-
|
|
45680
|
-
|
|
45681
|
-
|
|
45682
|
-
|
|
45683
|
-
|
|
45684
|
-
|
|
45685
|
-
|
|
45686
|
-
|
|
45687
|
-
|
|
45688
|
-
|
|
45689
|
-
|
|
45690
|
-
|
|
45691
|
-
|
|
45692
|
-
|
|
45693
|
-
|
|
45694
|
-
|
|
45695
|
-
|
|
45696
|
-
|
|
45697
|
-
|
|
45698
|
-
|
|
45699
|
-
|
|
45700
|
-
|
|
45701
|
-
|
|
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 [];
|
|
45702
45756
|
}
|
|
45703
|
-
function scopeToPredicates(scope = '', settings) {
|
|
45704
|
-
if (scope !== 'MINE')
|
|
45757
|
+
function scopeToPredicates(scope = '', fieldName, settings) {
|
|
45758
|
+
if (scope !== 'MINE' || fieldName === 'ResourceAbsence')
|
|
45705
45759
|
return [];
|
|
45706
45760
|
return [
|
|
45707
45761
|
{
|
|
@@ -46732,10 +46786,10 @@ async function connectionResolver(obj, args, context, info) {
|
|
|
46732
46786
|
// Alias starts as entity's ApiName
|
|
46733
46787
|
const predicates = [
|
|
46734
46788
|
...filterToPredicates(args.where, alias, alias, context.objectInfos, joins, draftFunctions),
|
|
46735
|
-
...scopeToPredicates(args.scope, context.settings),
|
|
46789
|
+
...scopeToPredicates(args.scope, info.fieldName, context.settings),
|
|
46736
46790
|
...childRelationshipToPredicates(childRelationshipFieldName, parentRecord ? parentRecord.id : undefined),
|
|
46737
46791
|
];
|
|
46738
|
-
const scopeJoins = scopeToJoins(args.scope, context.settings);
|
|
46792
|
+
const scopeJoins = scopeToJoins(args.scope, info.fieldName, context.settings);
|
|
46739
46793
|
joins.push(...scopeJoins);
|
|
46740
46794
|
// Limit defaults to 10 records if unspecified
|
|
46741
46795
|
let limit = 10;
|
|
@@ -47863,9 +47917,11 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
47863
47917
|
.filter(nodeIsNamed('node'))[0];
|
|
47864
47918
|
switch (node.name.value) {
|
|
47865
47919
|
case 'scope':
|
|
47866
|
-
// Hanle 'MINE' field
|
|
47867
47920
|
if (isScopeArgumentNodeWithType(node, 'MINE', variables)) {
|
|
47868
|
-
if (
|
|
47921
|
+
if (recordQueryApiName === 'ResourceAbsence') {
|
|
47922
|
+
inlineFragmentSelections[ancestorPath].push(...mineResourceAbsenceSelections);
|
|
47923
|
+
}
|
|
47924
|
+
else if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
|
|
47869
47925
|
// 'typeConditon' is added when the 'InlineFragmentNode' is appended at the write pass
|
|
47870
47926
|
inlineFragmentSelections[ancestorPath].push(...mineFragmentSelections);
|
|
47871
47927
|
}
|
|
@@ -49016,6 +49072,93 @@ let mineFragmentSelections = [
|
|
|
49016
49072
|
},
|
|
49017
49073
|
},
|
|
49018
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
|
+
];
|
|
49019
49162
|
const assignedToMeFragmentSelections = [
|
|
49020
49163
|
{
|
|
49021
49164
|
kind: 'Field',
|
|
@@ -55104,7 +55247,8 @@ class DurableRecordStore {
|
|
|
55104
55247
|
}
|
|
55105
55248
|
async exists(key) {
|
|
55106
55249
|
const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
|
|
55107
|
-
|
|
55250
|
+
const exists = result.rows[0][0];
|
|
55251
|
+
return exists == true;
|
|
55108
55252
|
}
|
|
55109
55253
|
async getRecord(key) {
|
|
55110
55254
|
const canonicalKey = this.getLuvio().storeGetCanonicalKey(key);
|
|
@@ -55338,4 +55482,4 @@ register({
|
|
|
55338
55482
|
});
|
|
55339
55483
|
|
|
55340
55484
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
55341
|
-
// version: 1.
|
|
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.
|
|
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.
|
|
36
|
-
"@salesforce/lds-bindings": "^1.
|
|
37
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
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.
|
|
43
|
-
"@salesforce/lds-drafts": "^1.
|
|
44
|
-
"@salesforce/lds-durable-records": "^1.
|
|
45
|
-
"@salesforce/lds-network-adapter": "^1.
|
|
46
|
-
"@salesforce/lds-network-nimbus": "^1.
|
|
47
|
-
"@salesforce/lds-store-binary": "^1.
|
|
48
|
-
"@salesforce/lds-store-nimbus": "^1.
|
|
49
|
-
"@salesforce/lds-store-sql": "^1.
|
|
50
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
51
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
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
|
|
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 =
|
|
42879
|
+
const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
|
|
42876
42880
|
const fileSize = file.size;
|
|
42877
42881
|
let offset = 0;
|
|
42878
42882
|
try {
|
|
@@ -44418,10 +44422,13 @@ function sanitizePredicateIDValue(value, draftFunction) {
|
|
|
44418
44422
|
}
|
|
44419
44423
|
}
|
|
44420
44424
|
function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
|
|
44421
|
-
if (
|
|
44425
|
+
if (value === undefined || (isArray$1(value) && value.length === 0)) {
|
|
44422
44426
|
// eslint-disable-next-line
|
|
44423
44427
|
throw new Error(`No value specified for MultiPickList filter`);
|
|
44424
44428
|
}
|
|
44429
|
+
if (value === null) {
|
|
44430
|
+
return createSinglePredicate(null, operator, fieldInfo, alias);
|
|
44431
|
+
}
|
|
44425
44432
|
// generate single prodicate for = and !=
|
|
44426
44433
|
if (operator === '=' || operator === '!=') {
|
|
44427
44434
|
// The raw value could be ';;a; b;;', clean it up to 'a;b'
|
|
@@ -44441,6 +44448,9 @@ function createMultiPicklistPredicate(value, operator, fieldInfo, alias) {
|
|
|
44441
44448
|
type: PredicateType.compound,
|
|
44442
44449
|
operator: operator === 'LIKE' ? 'or' : 'and',
|
|
44443
44450
|
children: valueArray.map((v) => {
|
|
44451
|
+
if (v === null) {
|
|
44452
|
+
return createSinglePredicate(v, operator, fieldInfo, alias);
|
|
44453
|
+
}
|
|
44444
44454
|
const splittedValue = v
|
|
44445
44455
|
.split(MultiPickListValueSeparator)
|
|
44446
44456
|
.map((v) => v.trim())
|
|
@@ -44503,7 +44513,7 @@ function multiPicklistToSql(operator, value) {
|
|
|
44503
44513
|
// match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
|
|
44504
44514
|
// To make sure the match is safe for includes/excludes. the value is prefix and
|
|
44505
44515
|
// suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
|
|
44506
|
-
if (operator === 'LIKE' || operator === 'NOT LIKE') {
|
|
44516
|
+
if (value !== null && (operator === 'LIKE' || operator === 'NOT LIKE')) {
|
|
44507
44517
|
return `%${MultiPickListValueSeparator}${value}${MultiPickListValueSeparator}%`;
|
|
44508
44518
|
}
|
|
44509
44519
|
else {
|
|
@@ -44670,14 +44680,7 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
|
|
|
44670
44680
|
// SQLite is case sensitive by default, SOQL is case in-sensitive by default
|
|
44671
44681
|
// For pick list includes or excludeds, prefix and suffix the field value with ';' to guarantee the query accuracy.
|
|
44672
44682
|
if (dataType === 'MultiPicklist' && (operator === 'LIKE' || operator === 'NOT LIKE')) {
|
|
44673
|
-
|
|
44674
|
-
// calling the COALESCE function with the extracted value and empty string will make it an empty string
|
|
44675
|
-
// instead of NULL in the function return and can be compared
|
|
44676
|
-
const coalesce = (sql) => {
|
|
44677
|
-
return `COALESCE(${sql}, '')`;
|
|
44678
|
-
};
|
|
44679
|
-
const extract = `json_extract("${alias}".data, '${leftPath}')`;
|
|
44680
|
-
sql = `'${MultiPickListValueSeparator}' || ${operator === 'NOT LIKE' ? coalesce(extract) : extract} || '${MultiPickListValueSeparator}' ${operator} ${questionSql} COLLATE NOCASE`;
|
|
44683
|
+
sql = buildMultiPicklistSQL(predicate, valueBinding, questionSql);
|
|
44681
44684
|
}
|
|
44682
44685
|
else {
|
|
44683
44686
|
sql = `json_extract("${alias}".data, '${leftPath}') ${operator} ${questionSql}${isCaseSensitive === true ? '' : ` COLLATE NOCASE`}`;
|
|
@@ -44687,6 +44690,22 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
|
|
|
44687
44690
|
}
|
|
44688
44691
|
return { sql, binding };
|
|
44689
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
|
+
}
|
|
44690
44709
|
// for one value, return { sql: '?', bindings:'xxx'}. for multiple value, return { sql: '(?, ?, ?)', binding: ['xxx','yyy','zzz'] }
|
|
44691
44710
|
function handleExtractedPredicateValue(boundValue, checkForNull) {
|
|
44692
44711
|
let questionSql = '?';
|
|
@@ -45643,65 +45662,100 @@ function pathForKey(key) {
|
|
|
45643
45662
|
}
|
|
45644
45663
|
}
|
|
45645
45664
|
|
|
45646
|
-
function scopeToJoins(scope = '', settings) {
|
|
45647
|
-
if (scope
|
|
45648
|
-
return [
|
|
45649
|
-
|
|
45650
|
-
|
|
45651
|
-
|
|
45652
|
-
|
|
45653
|
-
|
|
45654
|
-
|
|
45655
|
-
|
|
45656
|
-
|
|
45657
|
-
|
|
45658
|
-
|
|
45659
|
-
|
|
45660
|
-
|
|
45661
|
-
|
|
45662
|
-
|
|
45663
|
-
|
|
45664
|
-
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
|
|
45668
|
-
|
|
45669
|
-
|
|
45670
|
-
|
|
45671
|
-
|
|
45672
|
-
|
|
45673
|
-
|
|
45674
|
-
|
|
45675
|
-
|
|
45676
|
-
|
|
45677
|
-
|
|
45678
|
-
|
|
45679
|
-
|
|
45680
|
-
|
|
45681
|
-
|
|
45682
|
-
|
|
45683
|
-
|
|
45684
|
-
|
|
45685
|
-
|
|
45686
|
-
|
|
45687
|
-
|
|
45688
|
-
|
|
45689
|
-
|
|
45690
|
-
|
|
45691
|
-
|
|
45692
|
-
|
|
45693
|
-
|
|
45694
|
-
|
|
45695
|
-
|
|
45696
|
-
|
|
45697
|
-
|
|
45698
|
-
|
|
45699
|
-
|
|
45700
|
-
|
|
45701
|
-
|
|
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 [];
|
|
45702
45756
|
}
|
|
45703
|
-
function scopeToPredicates(scope = '', settings) {
|
|
45704
|
-
if (scope !== 'MINE')
|
|
45757
|
+
function scopeToPredicates(scope = '', fieldName, settings) {
|
|
45758
|
+
if (scope !== 'MINE' || fieldName === 'ResourceAbsence')
|
|
45705
45759
|
return [];
|
|
45706
45760
|
return [
|
|
45707
45761
|
{
|
|
@@ -46732,10 +46786,10 @@ async function connectionResolver(obj, args, context, info) {
|
|
|
46732
46786
|
// Alias starts as entity's ApiName
|
|
46733
46787
|
const predicates = [
|
|
46734
46788
|
...filterToPredicates(args.where, alias, alias, context.objectInfos, joins, draftFunctions),
|
|
46735
|
-
...scopeToPredicates(args.scope, context.settings),
|
|
46789
|
+
...scopeToPredicates(args.scope, info.fieldName, context.settings),
|
|
46736
46790
|
...childRelationshipToPredicates(childRelationshipFieldName, parentRecord ? parentRecord.id : undefined),
|
|
46737
46791
|
];
|
|
46738
|
-
const scopeJoins = scopeToJoins(args.scope, context.settings);
|
|
46792
|
+
const scopeJoins = scopeToJoins(args.scope, info.fieldName, context.settings);
|
|
46739
46793
|
joins.push(...scopeJoins);
|
|
46740
46794
|
// Limit defaults to 10 records if unspecified
|
|
46741
46795
|
let limit = 10;
|
|
@@ -47863,9 +47917,11 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
47863
47917
|
.filter(nodeIsNamed('node'))[0];
|
|
47864
47918
|
switch (node.name.value) {
|
|
47865
47919
|
case 'scope':
|
|
47866
|
-
// Hanle 'MINE' field
|
|
47867
47920
|
if (isScopeArgumentNodeWithType(node, 'MINE', variables)) {
|
|
47868
|
-
if (
|
|
47921
|
+
if (recordQueryApiName === 'ResourceAbsence') {
|
|
47922
|
+
inlineFragmentSelections[ancestorPath].push(...mineResourceAbsenceSelections);
|
|
47923
|
+
}
|
|
47924
|
+
else if (isMineScopeAvailable(ancestorPath, pathToObjectApiNamesMap, objectInfos)) {
|
|
47869
47925
|
// 'typeConditon' is added when the 'InlineFragmentNode' is appended at the write pass
|
|
47870
47926
|
inlineFragmentSelections[ancestorPath].push(...mineFragmentSelections);
|
|
47871
47927
|
}
|
|
@@ -49016,6 +49072,93 @@ let mineFragmentSelections = [
|
|
|
49016
49072
|
},
|
|
49017
49073
|
},
|
|
49018
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
|
+
];
|
|
49019
49162
|
const assignedToMeFragmentSelections = [
|
|
49020
49163
|
{
|
|
49021
49164
|
kind: 'Field',
|
|
@@ -55104,7 +55247,8 @@ class DurableRecordStore {
|
|
|
55104
55247
|
}
|
|
55105
55248
|
async exists(key) {
|
|
55106
55249
|
const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
|
|
55107
|
-
|
|
55250
|
+
const exists = result.rows[0][0];
|
|
55251
|
+
return exists == true;
|
|
55108
55252
|
}
|
|
55109
55253
|
async getRecord(key) {
|
|
55110
55254
|
const canonicalKey = this.getLuvio().storeGetCanonicalKey(key);
|
|
@@ -55338,4 +55482,4 @@ register({
|
|
|
55338
55482
|
});
|
|
55339
55483
|
|
|
55340
55484
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
55341
|
-
// version: 1.
|
|
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[];
|