@salesforce/lds-runtime-mobile 1.205.0 → 1.206.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js
CHANGED
|
@@ -15934,7 +15934,7 @@ class RecordIngestor {
|
|
|
15934
15934
|
* @param syntheticRecords list of records to insert
|
|
15935
15935
|
* @returns list of ids that were written and list of ids that were not written due to already being present in the store
|
|
15936
15936
|
*/
|
|
15937
|
-
async insertRecords(syntheticRecords) {
|
|
15937
|
+
async insertRecords(syntheticRecords, overwrite = false) {
|
|
15938
15938
|
if (syntheticRecords.length === 0) {
|
|
15939
15939
|
return { written: [], conflicted: [], errors: [] };
|
|
15940
15940
|
}
|
|
@@ -15949,7 +15949,7 @@ class RecordIngestor {
|
|
|
15949
15949
|
metadataVersion: DURABLE_METADATA_VERSION,
|
|
15950
15950
|
version: RecordRepresentationVersion,
|
|
15951
15951
|
};
|
|
15952
|
-
return this.store.writeRecords(syntheticRecords.map((record) => ({ record, metadata })));
|
|
15952
|
+
return this.store.writeRecords(syntheticRecords.map((record) => ({ record, metadata })), overwrite);
|
|
15953
15953
|
}
|
|
15954
15954
|
}
|
|
15955
15955
|
|
|
@@ -16071,20 +16071,34 @@ class SqlitePrimingStore {
|
|
|
16071
16071
|
this.getLuvio = getLuvio;
|
|
16072
16072
|
this.store = store;
|
|
16073
16073
|
}
|
|
16074
|
-
async
|
|
16074
|
+
async readRecords(ids) {
|
|
16075
|
+
const sql = 'SELECT data, metadata FROM lds_data WHERE key IN (' +
|
|
16076
|
+
ids.map(() => '?').join(',') +
|
|
16077
|
+
')';
|
|
16078
|
+
const params = ids.map((id) => keyBuilderRecord(this.getLuvio(), { recordId: id }));
|
|
16079
|
+
const result = await this.store.query(sql, params);
|
|
16080
|
+
const records = [];
|
|
16081
|
+
for (const row of result.rows) {
|
|
16082
|
+
const record = JSON.parse(row[0]);
|
|
16083
|
+
const metadata = JSON.parse(row[1]);
|
|
16084
|
+
records.push({ record, metadata });
|
|
16085
|
+
}
|
|
16086
|
+
return records;
|
|
16087
|
+
}
|
|
16088
|
+
async writeRecords(records, overwrite) {
|
|
16075
16089
|
const batches = batchArray(records);
|
|
16076
16090
|
const writeResult = { written: [], conflicted: [], errors: [] };
|
|
16077
|
-
return (await Promise.all(batches.map((batch) => this.writeBatch(batch)))).reduce((acc, curr) => {
|
|
16091
|
+
return (await Promise.all(batches.map((batch) => this.writeBatch(batch, overwrite)))).reduce((acc, curr) => {
|
|
16078
16092
|
acc.written.push(...curr.written);
|
|
16079
16093
|
acc.conflicted.push(...curr.conflicted);
|
|
16080
16094
|
acc.errors.push(...curr.errors);
|
|
16081
16095
|
return acc;
|
|
16082
16096
|
}, writeResult);
|
|
16083
16097
|
}
|
|
16084
|
-
async writeBatch(records) {
|
|
16098
|
+
async writeBatch(records, overwrite) {
|
|
16085
16099
|
const idsToPrime = new Set();
|
|
16086
16100
|
const written = [];
|
|
16087
|
-
const statement =
|
|
16101
|
+
const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
|
|
16088
16102
|
.map((_) => `(?,?,?)`)
|
|
16089
16103
|
.join(',')} returning key;`;
|
|
16090
16104
|
const params = [];
|
|
@@ -16296,4 +16310,4 @@ register({
|
|
|
16296
16310
|
});
|
|
16297
16311
|
|
|
16298
16312
|
export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
16299
|
-
// version: 1.
|
|
16313
|
+
// version: 1.206.0-ff82152de
|
|
@@ -5,6 +5,7 @@ export declare class SqlitePrimingStore implements PrimingStore {
|
|
|
5
5
|
private readonly getLuvio;
|
|
6
6
|
private readonly store;
|
|
7
7
|
constructor(getLuvio: () => Luvio, store: SqliteStore);
|
|
8
|
-
|
|
8
|
+
readRecords(ids: string[]): Promise<RecordWithMetadata[]>;
|
|
9
|
+
writeRecords(records: RecordWithMetadata[], overwrite: boolean): Promise<WriteResult>;
|
|
9
10
|
private writeBatch;
|
|
10
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.206.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS runtime for mobile/hybrid environments.",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"path": "./dist/main.js",
|
|
60
60
|
"maxSize": {
|
|
61
61
|
"none": "700 kB",
|
|
62
|
-
"min": "
|
|
62
|
+
"min": "300 kB",
|
|
63
63
|
"compressed": "110 kB"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"path": "./sfdc/main.js",
|
|
68
68
|
"maxSize": {
|
|
69
69
|
"none": "700 kB",
|
|
70
|
-
"min": "
|
|
70
|
+
"min": "300 kB",
|
|
71
71
|
"compressed": "110 kB"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/sfdc/main.js
CHANGED
|
@@ -15934,7 +15934,7 @@ class RecordIngestor {
|
|
|
15934
15934
|
* @param syntheticRecords list of records to insert
|
|
15935
15935
|
* @returns list of ids that were written and list of ids that were not written due to already being present in the store
|
|
15936
15936
|
*/
|
|
15937
|
-
async insertRecords(syntheticRecords) {
|
|
15937
|
+
async insertRecords(syntheticRecords, overwrite = false) {
|
|
15938
15938
|
if (syntheticRecords.length === 0) {
|
|
15939
15939
|
return { written: [], conflicted: [], errors: [] };
|
|
15940
15940
|
}
|
|
@@ -15949,7 +15949,7 @@ class RecordIngestor {
|
|
|
15949
15949
|
metadataVersion: DURABLE_METADATA_VERSION,
|
|
15950
15950
|
version: RecordRepresentationVersion,
|
|
15951
15951
|
};
|
|
15952
|
-
return this.store.writeRecords(syntheticRecords.map((record) => ({ record, metadata })));
|
|
15952
|
+
return this.store.writeRecords(syntheticRecords.map((record) => ({ record, metadata })), overwrite);
|
|
15953
15953
|
}
|
|
15954
15954
|
}
|
|
15955
15955
|
|
|
@@ -16071,20 +16071,34 @@ class SqlitePrimingStore {
|
|
|
16071
16071
|
this.getLuvio = getLuvio;
|
|
16072
16072
|
this.store = store;
|
|
16073
16073
|
}
|
|
16074
|
-
async
|
|
16074
|
+
async readRecords(ids) {
|
|
16075
|
+
const sql = 'SELECT data, metadata FROM lds_data WHERE key IN (' +
|
|
16076
|
+
ids.map(() => '?').join(',') +
|
|
16077
|
+
')';
|
|
16078
|
+
const params = ids.map((id) => keyBuilderRecord(this.getLuvio(), { recordId: id }));
|
|
16079
|
+
const result = await this.store.query(sql, params);
|
|
16080
|
+
const records = [];
|
|
16081
|
+
for (const row of result.rows) {
|
|
16082
|
+
const record = JSON.parse(row[0]);
|
|
16083
|
+
const metadata = JSON.parse(row[1]);
|
|
16084
|
+
records.push({ record, metadata });
|
|
16085
|
+
}
|
|
16086
|
+
return records;
|
|
16087
|
+
}
|
|
16088
|
+
async writeRecords(records, overwrite) {
|
|
16075
16089
|
const batches = batchArray(records);
|
|
16076
16090
|
const writeResult = { written: [], conflicted: [], errors: [] };
|
|
16077
|
-
return (await Promise.all(batches.map((batch) => this.writeBatch(batch)))).reduce((acc, curr) => {
|
|
16091
|
+
return (await Promise.all(batches.map((batch) => this.writeBatch(batch, overwrite)))).reduce((acc, curr) => {
|
|
16078
16092
|
acc.written.push(...curr.written);
|
|
16079
16093
|
acc.conflicted.push(...curr.conflicted);
|
|
16080
16094
|
acc.errors.push(...curr.errors);
|
|
16081
16095
|
return acc;
|
|
16082
16096
|
}, writeResult);
|
|
16083
16097
|
}
|
|
16084
|
-
async writeBatch(records) {
|
|
16098
|
+
async writeBatch(records, overwrite) {
|
|
16085
16099
|
const idsToPrime = new Set();
|
|
16086
16100
|
const written = [];
|
|
16087
|
-
const statement =
|
|
16101
|
+
const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
|
|
16088
16102
|
.map((_) => `(?,?,?)`)
|
|
16089
16103
|
.join(',')} returning key;`;
|
|
16090
16104
|
const params = [];
|
|
@@ -16296,4 +16310,4 @@ register({
|
|
|
16296
16310
|
});
|
|
16297
16311
|
|
|
16298
16312
|
export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
16299
|
-
// version: 1.
|
|
16313
|
+
// version: 1.206.0-ff82152de
|
|
@@ -5,6 +5,7 @@ export declare class SqlitePrimingStore implements PrimingStore {
|
|
|
5
5
|
private readonly getLuvio;
|
|
6
6
|
private readonly store;
|
|
7
7
|
constructor(getLuvio: () => Luvio, store: SqliteStore);
|
|
8
|
-
|
|
8
|
+
readRecords(ids: string[]): Promise<RecordWithMetadata[]>;
|
|
9
|
+
writeRecords(records: RecordWithMetadata[], overwrite: boolean): Promise<WriteResult>;
|
|
9
10
|
private writeBatch;
|
|
10
11
|
}
|