@salesforce/lds-store-nimbus 0.1.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/LICENSE.txt +82 -0
- package/dist/index.js +488 -0
- package/dist/types/NimbusSqliteStore.d.ts +30 -0
- package/dist/types/__mocks__/o11y/activity.d.ts +11 -0
- package/dist/types/__mocks__/o11y/client.d.ts +5 -0
- package/dist/types/__mocks__/o11y/idleDetector.d.ts +18 -0
- package/dist/types/__mocks__/o11y/instrumentation.d.ts +16 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/tables/AbstractKeyValueDataTable.d.ts +16 -0
- package/dist/types/tables/LdsDataTable.d.ts +17 -0
- package/dist/types/tables/LdsDataTableBase.d.ts +10 -0
- package/dist/types/tables/LdsInternalDataTable.d.ts +19 -0
- package/dist/types/tables/index.d.ts +3 -0
- package/dist/types/tables/utils.d.ts +2 -0
- package/dist/types/utils/language.d.ts +34 -0
- package/package.json +45 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Terms of Use
|
|
2
|
+
|
|
3
|
+
Copyright 2022 Salesforce, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
These Terms of Use govern the download, installation, and/or use of this
|
|
6
|
+
software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
|
|
7
|
+
last updated on April 15, 2022, and constitute a legally binding
|
|
8
|
+
agreement between you and Salesforce. If you do not agree to these Terms of
|
|
9
|
+
Use, do not install or use the Software.
|
|
10
|
+
|
|
11
|
+
Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
|
|
12
|
+
copyright license to reproduce, prepare derivative works of, publicly
|
|
13
|
+
display, publicly perform, sublicense, and distribute the Software and
|
|
14
|
+
derivative works subject to these Terms. These Terms shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
Subject to the limited rights expressly granted hereunder, Salesforce
|
|
18
|
+
reserves all rights, title, and interest in and to all intellectual
|
|
19
|
+
property subsisting in the Software. No rights are granted to you hereunder
|
|
20
|
+
other than as expressly set forth herein. Users residing in countries on
|
|
21
|
+
the United States Office of Foreign Assets Control sanction list, or which
|
|
22
|
+
are otherwise subject to a US export embargo, may not use the Software.
|
|
23
|
+
|
|
24
|
+
Implementation of the Software may require development work, for which you
|
|
25
|
+
are responsible. The Software may contain bugs, errors and
|
|
26
|
+
incompatibilities and is made available on an AS IS basis without support,
|
|
27
|
+
updates, or service level commitments.
|
|
28
|
+
|
|
29
|
+
Salesforce reserves the right at any time to modify, suspend, or
|
|
30
|
+
discontinue, the Software (or any part thereof) with or without notice. You
|
|
31
|
+
agree that Salesforce shall not be liable to you or to any third party for
|
|
32
|
+
any modification, suspension, or discontinuance.
|
|
33
|
+
|
|
34
|
+
You agree to defend Salesforce against any claim, demand, suit or
|
|
35
|
+
proceeding made or brought against Salesforce by a third party arising out
|
|
36
|
+
of or accruing from (a) your use of the Software, and (b) any application
|
|
37
|
+
you develop with the Software that infringes any copyright, trademark,
|
|
38
|
+
trade secret, trade dress, patent, or other intellectual property right of
|
|
39
|
+
any person or defames any person or violates their rights of publicity or
|
|
40
|
+
privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
|
|
41
|
+
from any damages, attorney fees, and costs finally awarded against
|
|
42
|
+
Salesforce as a result of, or for any amounts paid by Salesforce under a
|
|
43
|
+
settlement approved by you in writing of, a Claim Against Salesforce,
|
|
44
|
+
provided Salesforce (x) promptly gives you written notice of the Claim
|
|
45
|
+
Against Salesforce, (y) gives you sole control of the defense and
|
|
46
|
+
settlement of the Claim Against Salesforce (except that you may not settle
|
|
47
|
+
any Claim Against Salesforce unless it unconditionally releases Salesforce
|
|
48
|
+
of all liability), and (z) gives you all reasonable assistance, at your
|
|
49
|
+
expense.
|
|
50
|
+
|
|
51
|
+
WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
|
|
52
|
+
SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
|
|
54
|
+
INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
|
55
|
+
PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
|
|
56
|
+
OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
|
|
57
|
+
CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
|
|
58
|
+
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
59
|
+
|
|
60
|
+
These Terms of Use shall be governed exclusively by the internal laws of
|
|
61
|
+
the State of California, without regard to its conflicts of laws
|
|
62
|
+
rules. Each party hereby consents to the exclusive jurisdiction of the
|
|
63
|
+
state and federal courts located in San Francisco County, California to
|
|
64
|
+
adjudicate any dispute arising out of or relating to these Terms of Use and
|
|
65
|
+
the download, installation, and/or use of the Software. Except as expressly
|
|
66
|
+
stated herein, these Terms of Use constitute the entire agreement between
|
|
67
|
+
the parties, and supersede all prior and contemporaneous agreements,
|
|
68
|
+
proposals, or representations, written or oral, concerning their subject
|
|
69
|
+
matter. No modification, amendment, or waiver of any provision of these
|
|
70
|
+
Terms of Use shall be effective unless it is by an update to these Terms of
|
|
71
|
+
Use that Salesforce makes available, or is in writing and signed by the
|
|
72
|
+
party against whom the modification, amendment, or waiver is to be
|
|
73
|
+
asserted.
|
|
74
|
+
|
|
75
|
+
Data Privacy: Salesforce may collect, process, and store device,
|
|
76
|
+
system, and other information related to your use of the Software. This
|
|
77
|
+
information includes, but is not limited to, IP address, user metrics, and
|
|
78
|
+
other data ("Usage Data"). Salesforce may use Usage Data for analytics,
|
|
79
|
+
product development, and marketing purposes. You acknowledge that files
|
|
80
|
+
generated in conjunction with the Software may contain sensitive or
|
|
81
|
+
confidential data, and you are solely responsible for anonymizing and
|
|
82
|
+
protecting such data.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { DefaultDurableSegment } from '@luvio/environments';
|
|
2
|
+
import { idleDetector, getInstrumentation } from 'o11y/client';
|
|
3
|
+
|
|
4
|
+
const { keys, create, assign, entries, values } = Object;
|
|
5
|
+
const { stringify, parse } = JSON;
|
|
6
|
+
|
|
7
|
+
function selectColumnsFromTableWhereKeyIn(columnNames, table, keyColumnName, whereIn) {
|
|
8
|
+
const paramList = whereIn.map(() => '?').join(',');
|
|
9
|
+
return `SELECT ${columnNames.join(',')} FROM ${table} WHERE ${keyColumnName} IN (${paramList})`;
|
|
10
|
+
}
|
|
11
|
+
function selectColumnsFromTableWhereKeyInNamespaced(columnNames, table, keyColumnName, whereIn, namespaceColumnName) {
|
|
12
|
+
const paramList = whereIn.map(() => '?').join(',');
|
|
13
|
+
return `SELECT ${columnNames.join(',')} FROM ${table} WHERE ${namespaceColumnName} = ? AND ${keyColumnName} IN (${paramList})`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// These const values must be in sync with the latest
|
|
17
|
+
// @salesforce/nimbus-plugin-lds/sql schema file
|
|
18
|
+
const TABLE_NAME$1 = 'lds_data';
|
|
19
|
+
const COLUMN_NAME_KEY$2 = 'key';
|
|
20
|
+
const COLUMN_NAME_DATA$2 = 'data';
|
|
21
|
+
const COLUMN_NAME_METADATA$1 = 'metadata';
|
|
22
|
+
class LdsDataTable {
|
|
23
|
+
constructor(plugin) {
|
|
24
|
+
this.tableName = TABLE_NAME$1;
|
|
25
|
+
this.columnNames = [COLUMN_NAME_KEY$2, COLUMN_NAME_DATA$2, COLUMN_NAME_METADATA$1];
|
|
26
|
+
this.conflictColumnNames = [COLUMN_NAME_KEY$2];
|
|
27
|
+
this.getAllQuery = `SELECT ${this.columnNames.join(',')} FROM ${this.tableName}`;
|
|
28
|
+
this.plugin = plugin;
|
|
29
|
+
}
|
|
30
|
+
getByKeys(keys) {
|
|
31
|
+
const getQuery = selectColumnsFromTableWhereKeyIn(this.columnNames, this.tableName, COLUMN_NAME_KEY$2, keys);
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
this.plugin.query(getQuery, keys, (x) => {
|
|
34
|
+
resolve(this.mapToDurableEntries(x));
|
|
35
|
+
}, reject);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
getMetadataByKeys(keys) {
|
|
39
|
+
const query = selectColumnsFromTableWhereKeyIn([COLUMN_NAME_KEY$2, COLUMN_NAME_METADATA$1], this.tableName, COLUMN_NAME_KEY$2, keys);
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
this.plugin.query(query, keys, (results) => {
|
|
42
|
+
resolve(results.rows.reduce((entries, row) => {
|
|
43
|
+
const [key, stringifiedMetadata] = row;
|
|
44
|
+
if (stringifiedMetadata !== undefined) {
|
|
45
|
+
entries[key] = {
|
|
46
|
+
metadata: parse(stringifiedMetadata),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return entries;
|
|
50
|
+
}, {}));
|
|
51
|
+
}, reject);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
getAll() {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
this.plugin.query(this.getAllQuery, [], (x) => {
|
|
57
|
+
resolve(this.mapToDurableEntries(x));
|
|
58
|
+
}, reject);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
entriesToUpsertOperations(entries, segment) {
|
|
62
|
+
return {
|
|
63
|
+
type: 'upsert',
|
|
64
|
+
table: this.tableName,
|
|
65
|
+
keyColumn: COLUMN_NAME_KEY$2,
|
|
66
|
+
context: {
|
|
67
|
+
segment,
|
|
68
|
+
},
|
|
69
|
+
conflictColumns: this.conflictColumnNames,
|
|
70
|
+
columns: this.columnNames,
|
|
71
|
+
rows: keys(entries).reduce((rows, key) => {
|
|
72
|
+
const entry = entries[key];
|
|
73
|
+
const { data, metadata } = entry;
|
|
74
|
+
const row = [key, stringify(data), metadata ? stringify(metadata) : null];
|
|
75
|
+
rows.push(row);
|
|
76
|
+
return rows;
|
|
77
|
+
}, []),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
metadataToUpdateOperations(entries, segment) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'update',
|
|
83
|
+
table: this.tableName,
|
|
84
|
+
keyColumn: COLUMN_NAME_KEY$2,
|
|
85
|
+
context: {
|
|
86
|
+
segment,
|
|
87
|
+
type: 'setMetadata',
|
|
88
|
+
},
|
|
89
|
+
columns: [COLUMN_NAME_METADATA$1],
|
|
90
|
+
values: keys(entries).reduce((values, key) => {
|
|
91
|
+
const { metadata } = entries[key];
|
|
92
|
+
const row = [metadata ? stringify(metadata) : null];
|
|
93
|
+
values[key] = row;
|
|
94
|
+
return values;
|
|
95
|
+
}, {}),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
mapToDurableEntries(sqliteResult) {
|
|
99
|
+
return sqliteResult.rows.reduce((entries, row) => {
|
|
100
|
+
const [key, stringifiedData, stringifiedMetadata] = row;
|
|
101
|
+
const durableStoreEntry = {
|
|
102
|
+
data: parse(stringifiedData),
|
|
103
|
+
};
|
|
104
|
+
if (stringifiedMetadata !== null) {
|
|
105
|
+
durableStoreEntry.metadata = parse(stringifiedMetadata);
|
|
106
|
+
}
|
|
107
|
+
entries[key] = durableStoreEntry;
|
|
108
|
+
return entries;
|
|
109
|
+
}, {});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// These const values must be in sync with the latest
|
|
114
|
+
// @salesforce/nimbus-plugin-lds/sql schema file
|
|
115
|
+
const TABLE_NAME = 'lds_internal';
|
|
116
|
+
const COLUMN_NAME_KEY$1 = 'key';
|
|
117
|
+
const COLUMN_NAME_DATA$1 = 'data';
|
|
118
|
+
const COLUMN_NAME_METADATA = 'metadata';
|
|
119
|
+
const COLUMN_NAME_NAMESPACE = 'namespace';
|
|
120
|
+
class LdsInternalDataTable {
|
|
121
|
+
constructor(plugin) {
|
|
122
|
+
this.tableName = TABLE_NAME;
|
|
123
|
+
this.columnNames = [
|
|
124
|
+
COLUMN_NAME_KEY$1,
|
|
125
|
+
COLUMN_NAME_DATA$1,
|
|
126
|
+
COLUMN_NAME_METADATA,
|
|
127
|
+
COLUMN_NAME_NAMESPACE,
|
|
128
|
+
];
|
|
129
|
+
this.conflictColumnNames = [COLUMN_NAME_KEY$1, COLUMN_NAME_NAMESPACE];
|
|
130
|
+
this.getAllQuery = `SELECT ${this.columnNames.join(',')} FROM ${this.tableName} WHERE ${COLUMN_NAME_NAMESPACE} = ?`;
|
|
131
|
+
this.plugin = plugin;
|
|
132
|
+
}
|
|
133
|
+
getByKeys(keys, namespace) {
|
|
134
|
+
if (namespace === undefined) {
|
|
135
|
+
throw Error('LdsInternalDataTable requires namespace');
|
|
136
|
+
}
|
|
137
|
+
const getQuery = selectColumnsFromTableWhereKeyInNamespaced(this.columnNames, this.tableName, COLUMN_NAME_KEY$1, keys, COLUMN_NAME_NAMESPACE);
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
this.plugin.query(getQuery, [namespace].concat(keys), (x) => {
|
|
140
|
+
resolve(this.mapToDurableEntries(x));
|
|
141
|
+
}, reject);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
getMetadataByKeys(keys, namespace) {
|
|
145
|
+
if (namespace === undefined) {
|
|
146
|
+
throw Error('LdsInternalDataTable requires namespace');
|
|
147
|
+
}
|
|
148
|
+
const query = selectColumnsFromTableWhereKeyInNamespaced([COLUMN_NAME_KEY$1, COLUMN_NAME_METADATA], this.tableName, COLUMN_NAME_KEY$1, keys, COLUMN_NAME_NAMESPACE);
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
this.plugin.query(query, [namespace].concat(keys), (results) => {
|
|
151
|
+
resolve(results.rows.reduce((entries, row) => {
|
|
152
|
+
const [key, stringifiedMetadata] = row;
|
|
153
|
+
if (stringifiedMetadata !== undefined) {
|
|
154
|
+
entries[key] = {
|
|
155
|
+
metadata: parse(stringifiedMetadata),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return entries;
|
|
159
|
+
}, {}));
|
|
160
|
+
}, reject);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
getAll(namespace) {
|
|
164
|
+
return new Promise((resolve, reject) => {
|
|
165
|
+
this.plugin.query(this.getAllQuery, [namespace], (x) => {
|
|
166
|
+
resolve(this.mapToDurableEntries(x));
|
|
167
|
+
}, reject);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
entriesToUpsertOperations(entries, segment) {
|
|
171
|
+
return {
|
|
172
|
+
type: 'upsert',
|
|
173
|
+
table: this.tableName,
|
|
174
|
+
keyColumn: COLUMN_NAME_KEY$1,
|
|
175
|
+
context: {
|
|
176
|
+
segment,
|
|
177
|
+
},
|
|
178
|
+
conflictColumns: this.conflictColumnNames,
|
|
179
|
+
columns: this.columnNames,
|
|
180
|
+
rows: keys(entries).reduce((rows, key) => {
|
|
181
|
+
const entry = entries[key];
|
|
182
|
+
const { data, metadata } = entry;
|
|
183
|
+
const row = [key, stringify(data)];
|
|
184
|
+
if (metadata) {
|
|
185
|
+
row.push(stringify(metadata));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
row.push(null);
|
|
189
|
+
}
|
|
190
|
+
row.push(segment);
|
|
191
|
+
rows.push(row);
|
|
192
|
+
return rows;
|
|
193
|
+
}, []),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
metadataToUpdateOperations(entries, segment) {
|
|
197
|
+
return {
|
|
198
|
+
type: 'update',
|
|
199
|
+
table: this.tableName,
|
|
200
|
+
keyColumn: COLUMN_NAME_KEY$1,
|
|
201
|
+
context: {
|
|
202
|
+
segment,
|
|
203
|
+
type: 'setMetadata',
|
|
204
|
+
},
|
|
205
|
+
columns: [COLUMN_NAME_METADATA],
|
|
206
|
+
values: keys(entries).reduce((values, key) => {
|
|
207
|
+
const { metadata } = entries[key];
|
|
208
|
+
const row = [metadata ? stringify(metadata) : null];
|
|
209
|
+
values[key] = row;
|
|
210
|
+
return values;
|
|
211
|
+
}, {}),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
metadataToUpdateSQLQueries(entries, segment) {
|
|
215
|
+
return keys(entries).reduce((accu, key) => {
|
|
216
|
+
const { metadata } = entries[key];
|
|
217
|
+
if (metadata !== undefined) {
|
|
218
|
+
accu.push({
|
|
219
|
+
sql: `UPDATE ${this.tableName} SET ${COLUMN_NAME_METADATA} = ? WHERE (${COLUMN_NAME_KEY$1} IS ? AND ${COLUMN_NAME_NAMESPACE} IS ?)`,
|
|
220
|
+
params: [stringify(metadata), key, segment],
|
|
221
|
+
change: {
|
|
222
|
+
ids: [key],
|
|
223
|
+
segment,
|
|
224
|
+
type: 'setMetadata',
|
|
225
|
+
isExternalChange: false,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return accu;
|
|
230
|
+
}, []);
|
|
231
|
+
}
|
|
232
|
+
mapToDurableEntries(sqliteResult) {
|
|
233
|
+
return sqliteResult.rows.reduce((entries, row) => {
|
|
234
|
+
const [key, stringifiedData, stringifiedMetadata] = row;
|
|
235
|
+
const durableStoreEntry = {
|
|
236
|
+
data: parse(stringifiedData),
|
|
237
|
+
};
|
|
238
|
+
if (stringifiedMetadata !== null) {
|
|
239
|
+
durableStoreEntry.metadata = parse(stringifiedMetadata);
|
|
240
|
+
}
|
|
241
|
+
entries[key] = durableStoreEntry;
|
|
242
|
+
return entries;
|
|
243
|
+
}, {});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const tasker = idleDetector.declareNotifierTaskMulti('NimbusSqliteStore');
|
|
248
|
+
const instrumentation = getInstrumentation('lds-mobile');
|
|
249
|
+
const GRAPHQL_QUERY_ROOT_KEY = 'UiApi::uiapi::Query[uiapi]__uiapi__query';
|
|
250
|
+
const GRAPHQL_QUERY_ROOT_METRIC_NAME = 'gql-query-root-object-size';
|
|
251
|
+
class NimbusSqliteStore {
|
|
252
|
+
constructor(plugin, additionalTableMap = {}) {
|
|
253
|
+
this.plugin = plugin;
|
|
254
|
+
this.internalDataTable = new LdsInternalDataTable(plugin);
|
|
255
|
+
this.dataTableMap = {
|
|
256
|
+
...additionalTableMap,
|
|
257
|
+
[DefaultDurableSegment]: new LdsDataTable(plugin),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
isEvalSupported() {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
query(sql, params) {
|
|
264
|
+
tasker.add();
|
|
265
|
+
return new Promise((resolve, reject) => {
|
|
266
|
+
this.plugin.query(sql, params, (result) => {
|
|
267
|
+
resolve(result);
|
|
268
|
+
}, (error) => {
|
|
269
|
+
reject(error);
|
|
270
|
+
});
|
|
271
|
+
}).finally(() => tasker.done());
|
|
272
|
+
}
|
|
273
|
+
batchQuery(queries) {
|
|
274
|
+
const promises = queries.map((q) => this.query(q.sql, q.params));
|
|
275
|
+
tasker.add();
|
|
276
|
+
return Promise.all(promises).finally(() => tasker.done());
|
|
277
|
+
}
|
|
278
|
+
async getEntries(entryIds, segment) {
|
|
279
|
+
tasker.add();
|
|
280
|
+
return this.getTable(segment)
|
|
281
|
+
.getByKeys(entryIds, segment)
|
|
282
|
+
.finally(() => tasker.done());
|
|
283
|
+
}
|
|
284
|
+
async getMetadata(entryIds, segment) {
|
|
285
|
+
tasker.add();
|
|
286
|
+
return this.getTable(segment)
|
|
287
|
+
.getMetadataByKeys(entryIds, segment)
|
|
288
|
+
.finally(() => tasker.done());
|
|
289
|
+
}
|
|
290
|
+
getAllEntries(segment) {
|
|
291
|
+
tasker.add();
|
|
292
|
+
return this.getTable(segment)
|
|
293
|
+
.getAll(segment)
|
|
294
|
+
.finally(() => tasker.done());
|
|
295
|
+
}
|
|
296
|
+
setEntries(entries, segment) {
|
|
297
|
+
if (keys(entries).length === 0) {
|
|
298
|
+
return Promise.resolve();
|
|
299
|
+
}
|
|
300
|
+
const table = this.getTable(segment);
|
|
301
|
+
const upsertOperation = table.entriesToUpsertOperations(entries, segment);
|
|
302
|
+
if (entries[GRAPHQL_QUERY_ROOT_KEY]) {
|
|
303
|
+
this.trackGraphQLQueryRootSize(upsertOperation);
|
|
304
|
+
}
|
|
305
|
+
return this.batchOperationAsPromise([upsertOperation]);
|
|
306
|
+
}
|
|
307
|
+
setMetadata(entries, segment) {
|
|
308
|
+
if (keys(entries).length === 0) {
|
|
309
|
+
return Promise.resolve();
|
|
310
|
+
}
|
|
311
|
+
const table = this.getTable(segment);
|
|
312
|
+
let operation = table.metadataToUpdateOperations(entries, segment);
|
|
313
|
+
return this.batchOperationAsPromise([operation]);
|
|
314
|
+
}
|
|
315
|
+
batchOperations(operations) {
|
|
316
|
+
const sqliteOperations = operations.reduce((acc, cur) => {
|
|
317
|
+
if (cur.type === 'setEntries') {
|
|
318
|
+
if (keys(cur.entries).length > 0) {
|
|
319
|
+
const table = this.getTable(cur.segment);
|
|
320
|
+
const upsertOperation = table.entriesToUpsertOperations(cur.entries, cur.segment);
|
|
321
|
+
if (cur.entries[GRAPHQL_QUERY_ROOT_KEY]) {
|
|
322
|
+
this.trackGraphQLQueryRootSize(upsertOperation);
|
|
323
|
+
}
|
|
324
|
+
acc.push(upsertOperation);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else if (cur.type === 'setMetadata') {
|
|
328
|
+
if (keys(cur.entries).length > 0) {
|
|
329
|
+
const table = this.getTable(cur.segment);
|
|
330
|
+
acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
if (cur.ids.length > 0) {
|
|
335
|
+
acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return acc;
|
|
339
|
+
}, []);
|
|
340
|
+
return sqliteOperations.length === 0
|
|
341
|
+
? Promise.resolve()
|
|
342
|
+
: this.batchOperationAsPromise(sqliteOperations);
|
|
343
|
+
}
|
|
344
|
+
evictEntries(entryIds, segment) {
|
|
345
|
+
return entryIds.length === 0
|
|
346
|
+
? Promise.resolve()
|
|
347
|
+
: this.batchOperationAsPromise([this.idsToDeleteOperation(entryIds, segment)]);
|
|
348
|
+
}
|
|
349
|
+
registerOnChangedListener(listener) {
|
|
350
|
+
let unsubscribeId = undefined;
|
|
351
|
+
this.plugin
|
|
352
|
+
.registerOnChangedListener(async (changes) => {
|
|
353
|
+
const durableChanges = changes.map((c) => {
|
|
354
|
+
let type = c.type === 'upsert' ? 'setEntries' : 'evictEntries';
|
|
355
|
+
// if our context contains a type then set that as our main level type
|
|
356
|
+
// allows us in the future of updates to specify the segment change happening
|
|
357
|
+
// example being update call on metadata only or updating data
|
|
358
|
+
if ((c.type === 'update' || c.type === 'upsert') &&
|
|
359
|
+
c.context.type !== undefined) {
|
|
360
|
+
type = c.context.type;
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
type,
|
|
364
|
+
ids: c.keys,
|
|
365
|
+
isExternalChange: false,
|
|
366
|
+
segment: c.context.segment,
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
await listener(durableChanges);
|
|
370
|
+
})
|
|
371
|
+
.then((unsub) => {
|
|
372
|
+
unsubscribeId = unsub;
|
|
373
|
+
});
|
|
374
|
+
return () => {
|
|
375
|
+
if (unsubscribeId) {
|
|
376
|
+
return this.plugin.unsubscribeOnChangedListener(unsubscribeId);
|
|
377
|
+
}
|
|
378
|
+
return Promise.resolve();
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
getTable(segment) {
|
|
382
|
+
return this.dataTableMap[segment] ?? this.internalDataTable;
|
|
383
|
+
}
|
|
384
|
+
idsToDeleteOperation(entryIds, segment) {
|
|
385
|
+
const table = this.getTable(segment);
|
|
386
|
+
return {
|
|
387
|
+
type: 'delete',
|
|
388
|
+
table: table.tableName,
|
|
389
|
+
keyColumn: 'key',
|
|
390
|
+
context: {
|
|
391
|
+
segment,
|
|
392
|
+
},
|
|
393
|
+
ids: entryIds,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
batchOperationAsPromise(sqliteOperations) {
|
|
397
|
+
tasker.add();
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
this.plugin.batchOperations(sqliteOperations, (error) => {
|
|
400
|
+
if (error && error !== null) {
|
|
401
|
+
reject(error);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
resolve();
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}).finally(() => tasker.done());
|
|
408
|
+
}
|
|
409
|
+
trackGraphQLQueryRootSize(upsertOperation) {
|
|
410
|
+
try {
|
|
411
|
+
if (upsertOperation.type !== 'upsert') {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const row = upsertOperation.rows.find((r) => r[0] === GRAPHQL_QUERY_ROOT_KEY);
|
|
415
|
+
if (!(row && row[1] && typeof row[1] === 'string')) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
instrumentation.trackValue(GRAPHQL_QUERY_ROOT_METRIC_NAME, row[1].length);
|
|
419
|
+
}
|
|
420
|
+
catch { }
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// These const values must be in sync with the latest
|
|
425
|
+
// @salesforce/nimbus-plugin-lds/sql schema file
|
|
426
|
+
const COLUMN_NAME_KEY = 'key';
|
|
427
|
+
const COLUMN_NAME_DATA = 'data';
|
|
428
|
+
class AbstractKeyValueDataTable {
|
|
429
|
+
constructor(plugin, tableName) {
|
|
430
|
+
this.columnNames = [COLUMN_NAME_KEY, COLUMN_NAME_DATA];
|
|
431
|
+
this.conflictColumnNames = [COLUMN_NAME_KEY];
|
|
432
|
+
this.plugin = plugin;
|
|
433
|
+
this.tableName = tableName;
|
|
434
|
+
}
|
|
435
|
+
getByKeys(keys) {
|
|
436
|
+
return new Promise((resolve, reject) => {
|
|
437
|
+
const getQuery = selectColumnsFromTableWhereKeyIn(this.columnNames, this.tableName, COLUMN_NAME_KEY, keys);
|
|
438
|
+
this.plugin.query(getQuery, keys, (x) => {
|
|
439
|
+
resolve(this.mapToDurableEntries(x));
|
|
440
|
+
}, reject);
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
getMetadataByKeys(_keys) {
|
|
444
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
445
|
+
throw new Error(`There is no metadata in the ${this.tableName} table.`);
|
|
446
|
+
}
|
|
447
|
+
getAll() {
|
|
448
|
+
const getAllQuery = `SELECT ${this.columnNames.join(',')} FROM ${this.tableName}`;
|
|
449
|
+
return new Promise((resolve, reject) => {
|
|
450
|
+
this.plugin.query(getAllQuery, [], (x) => {
|
|
451
|
+
resolve(this.mapToDurableEntries(x));
|
|
452
|
+
}, reject);
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
entriesToUpsertOperations(entries, segment) {
|
|
456
|
+
return {
|
|
457
|
+
type: 'upsert',
|
|
458
|
+
table: this.tableName,
|
|
459
|
+
keyColumn: COLUMN_NAME_KEY,
|
|
460
|
+
context: {
|
|
461
|
+
segment,
|
|
462
|
+
},
|
|
463
|
+
conflictColumns: this.conflictColumnNames,
|
|
464
|
+
columns: this.columnNames,
|
|
465
|
+
rows: keys(entries).reduce((rows, key) => {
|
|
466
|
+
const entry = entries[key];
|
|
467
|
+
rows.push([key, stringify(entry.data)]);
|
|
468
|
+
return rows;
|
|
469
|
+
}, []),
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
metadataToUpdateOperations(_entries, _segment) {
|
|
473
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
474
|
+
throw new Error(`There is no metadata in the ${this.tableName} table.`);
|
|
475
|
+
}
|
|
476
|
+
mapToDurableEntries(sqliteResult) {
|
|
477
|
+
return sqliteResult.rows.reduce((entries, row) => {
|
|
478
|
+
const [key, stringifiedData] = row;
|
|
479
|
+
const durableStoreEntry = {
|
|
480
|
+
data: parse(stringifiedData),
|
|
481
|
+
};
|
|
482
|
+
entries[key] = durableStoreEntry;
|
|
483
|
+
return entries;
|
|
484
|
+
}, {});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export { AbstractKeyValueDataTable, NimbusSqliteStore };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SqliteResult, SqliteStore, SqliteType } from '@salesforce/lds-store-sql';
|
|
2
|
+
import { type SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
3
|
+
import type { DurableStore, DurableStoreChange, DurableStoreEntries, DurableStoreMetadataEntries, DurableStoreOperation, OnDurableStoreChangedListener } from '@luvio/environments';
|
|
4
|
+
import type { LdsDataTableBase } from './tables';
|
|
5
|
+
export type SQLQuery = {
|
|
6
|
+
sql: string;
|
|
7
|
+
params: SqliteType[];
|
|
8
|
+
change: DurableStoreChange;
|
|
9
|
+
};
|
|
10
|
+
export declare class NimbusSqliteStore implements SqliteStore, DurableStore {
|
|
11
|
+
private plugin;
|
|
12
|
+
private readonly dataTableMap;
|
|
13
|
+
private readonly internalDataTable;
|
|
14
|
+
constructor(plugin: SqliteStorePlugin, additionalTableMap?: Record<string, LdsDataTableBase>);
|
|
15
|
+
isEvalSupported(): boolean;
|
|
16
|
+
query(sql: string, params: SqliteType[]): Promise<SqliteResult>;
|
|
17
|
+
batchQuery(queries: SQLQuery[]): Promise<SqliteResult[]>;
|
|
18
|
+
getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
19
|
+
getMetadata(entryIds: string[], segment: string): Promise<DurableStoreMetadataEntries | undefined>;
|
|
20
|
+
getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
21
|
+
setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
|
|
22
|
+
setMetadata(entries: DurableStoreMetadataEntries, segment: string): Promise<void>;
|
|
23
|
+
batchOperations<T>(operations: DurableStoreOperation<T>[]): Promise<void>;
|
|
24
|
+
evictEntries(entryIds: string[], segment: string): Promise<void>;
|
|
25
|
+
registerOnChangedListener(listener: OnDurableStoreChangedListener): () => Promise<void>;
|
|
26
|
+
private getTable;
|
|
27
|
+
private idsToDeleteOperation;
|
|
28
|
+
private batchOperationAsPromise;
|
|
29
|
+
private trackGraphQLQueryRootSize;
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function stop(_userSchemaOrText?: any | string, _userData?: any): void;
|
|
2
|
+
declare function error(_error: Error, _userSchemaOrText?: any | string, _userData?: any): void;
|
|
3
|
+
declare function discard(): void;
|
|
4
|
+
declare function terminate(): void;
|
|
5
|
+
export declare const activity: {
|
|
6
|
+
stop: typeof stop;
|
|
7
|
+
error: typeof error;
|
|
8
|
+
discard: typeof discard;
|
|
9
|
+
terminate: typeof terminate;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { instrumentation } from './instrumentation';
|
|
2
|
+
export { activity } from './activity';
|
|
3
|
+
export { instrumentation } from './instrumentation';
|
|
4
|
+
export { idleDetector } from './idleDetector';
|
|
5
|
+
export declare function getInstrumentation(_name: string): typeof instrumentation;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare function requestIdleDetectedCallback(_callback: any): void;
|
|
2
|
+
declare function declareNotifierTaskSingle(_name: string): {
|
|
3
|
+
isBusy: boolean;
|
|
4
|
+
done: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare function declareNotifierTaskMulti(_name: string, _existingBusyCount?: number): {
|
|
7
|
+
isBusy: boolean;
|
|
8
|
+
add: () => void;
|
|
9
|
+
done: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare function declarePollableTaskMulti(_name: string, _isBusyChecker: any): void;
|
|
12
|
+
export declare const idleDetector: {
|
|
13
|
+
requestIdleDetectedCallback: typeof requestIdleDetectedCallback;
|
|
14
|
+
declareNotifierTaskSingle: typeof declareNotifierTaskSingle;
|
|
15
|
+
declareNotifierTaskMulti: typeof declareNotifierTaskMulti;
|
|
16
|
+
declarePollableTaskMulti: typeof declarePollableTaskMulti;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare function log(_schema: any, _data?: any): void;
|
|
2
|
+
declare function error(_err: Error, _userSchemaOrText?: string, _data?: any): void;
|
|
3
|
+
declare function startActivity(_name: string): any;
|
|
4
|
+
declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
|
|
5
|
+
declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
|
|
6
|
+
declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
|
|
7
|
+
export declare const instrumentation: {
|
|
8
|
+
log: typeof log;
|
|
9
|
+
error: typeof error;
|
|
10
|
+
startActivity: typeof startActivity;
|
|
11
|
+
incrementCounter: typeof incrementCounter;
|
|
12
|
+
trackValue: typeof trackValue;
|
|
13
|
+
bucketValue: typeof bucketValue;
|
|
14
|
+
};
|
|
15
|
+
export declare const METRIC_KEYS: {};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SqliteOperation, SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { DurableStoreEntries, DurableStoreMetadataEntries } from '@luvio/environments';
|
|
3
|
+
import type { LdsDataTableBase } from '../tables/LdsDataTableBase';
|
|
4
|
+
export declare abstract class AbstractKeyValueDataTable implements LdsDataTableBase {
|
|
5
|
+
readonly tableName: SqliteOperation['table'];
|
|
6
|
+
readonly plugin: SqliteStorePlugin;
|
|
7
|
+
private columnNames;
|
|
8
|
+
private conflictColumnNames;
|
|
9
|
+
constructor(plugin: SqliteStorePlugin, tableName: SqliteOperation['table']);
|
|
10
|
+
getByKeys<T>(keys: string[]): Promise<DurableStoreEntries<T>>;
|
|
11
|
+
getMetadataByKeys(_keys: string[]): Promise<DurableStoreMetadataEntries | undefined>;
|
|
12
|
+
getAll<T>(): Promise<DurableStoreEntries<T>>;
|
|
13
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
14
|
+
metadataToUpdateOperations(_entries: DurableStoreMetadataEntries, _segment: string): SqliteOperation;
|
|
15
|
+
private mapToDurableEntries;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SqliteOperation, SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { DurableStoreEntries, DurableStoreMetadataEntries } from '@luvio/environments';
|
|
3
|
+
import type { LdsDataTableBase } from '../tables/LdsDataTableBase';
|
|
4
|
+
export declare class LdsDataTable implements LdsDataTableBase {
|
|
5
|
+
readonly tableName = "lds_data";
|
|
6
|
+
readonly plugin: SqliteStorePlugin;
|
|
7
|
+
private columnNames;
|
|
8
|
+
private conflictColumnNames;
|
|
9
|
+
private getAllQuery;
|
|
10
|
+
constructor(plugin: SqliteStorePlugin);
|
|
11
|
+
getByKeys<T>(keys: string[]): Promise<DurableStoreEntries<T>>;
|
|
12
|
+
getMetadataByKeys(keys: string[]): Promise<DurableStoreMetadataEntries | undefined>;
|
|
13
|
+
getAll<T>(): Promise<DurableStoreEntries<T>>;
|
|
14
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
15
|
+
metadataToUpdateOperations(entries: DurableStoreMetadataEntries, segment: string): SqliteOperation;
|
|
16
|
+
private mapToDurableEntries;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DurableStoreEntries, DurableStoreMetadataEntries } from '@luvio/environments';
|
|
2
|
+
import type { SqliteOperation } from '@salesforce/nimbus-plugin-lds';
|
|
3
|
+
export interface LdsDataTableBase {
|
|
4
|
+
tableName: SqliteOperation['table'];
|
|
5
|
+
getByKeys<T>(keys: string[], segment?: string): Promise<DurableStoreEntries<T>>;
|
|
6
|
+
getMetadataByKeys(keys: string[], segment?: string): Promise<DurableStoreMetadataEntries | undefined>;
|
|
7
|
+
getAll<T>(segment?: string): Promise<DurableStoreEntries<T>>;
|
|
8
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
9
|
+
metadataToUpdateOperations(entries: DurableStoreMetadataEntries, segment: string): SqliteOperation;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SqliteOperation, SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { DurableStoreEntries, DurableStoreMetadataEntries } from '@luvio/environments';
|
|
3
|
+
import type { LdsDataTableBase } from '../tables';
|
|
4
|
+
import type { SQLQuery } from '../NimbusSqliteStore';
|
|
5
|
+
export declare class LdsInternalDataTable implements LdsDataTableBase {
|
|
6
|
+
readonly tableName = "lds_internal";
|
|
7
|
+
readonly plugin: SqliteStorePlugin;
|
|
8
|
+
private columnNames;
|
|
9
|
+
private conflictColumnNames;
|
|
10
|
+
private getAllQuery;
|
|
11
|
+
constructor(plugin: SqliteStorePlugin);
|
|
12
|
+
getByKeys<T>(keys: string[], namespace: string): Promise<DurableStoreEntries<T>>;
|
|
13
|
+
getMetadataByKeys(keys: string[], namespace: string): Promise<DurableStoreMetadataEntries | undefined>;
|
|
14
|
+
getAll<T>(namespace: string): Promise<DurableStoreEntries<T>>;
|
|
15
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
16
|
+
metadataToUpdateOperations(entries: DurableStoreMetadataEntries, segment: string): SqliteOperation;
|
|
17
|
+
metadataToUpdateSQLQueries(entries: DurableStoreMetadataEntries, segment: string): SQLQuery[];
|
|
18
|
+
private mapToDurableEntries;
|
|
19
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function selectColumnsFromTableWhereKeyIn(columnNames: string[], table: string, keyColumnName: string, whereIn: string[]): string;
|
|
2
|
+
export declare function selectColumnsFromTableWhereKeyInNamespaced(columnNames: string[], table: string, keyColumnName: string, whereIn: string[], namespaceColumnName: string): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const keys: {
|
|
2
|
+
(o: object): string[];
|
|
3
|
+
(o: {}): string[];
|
|
4
|
+
}, create: {
|
|
5
|
+
(o: object | null): any;
|
|
6
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
7
|
+
}, assign: {
|
|
8
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
|
9
|
+
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
10
|
+
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
11
|
+
(target: object, ...sources: any[]): any;
|
|
12
|
+
}, entries: {
|
|
13
|
+
<T>(o: {
|
|
14
|
+
[s: string]: T;
|
|
15
|
+
} | ArrayLike<T>): [string, T][];
|
|
16
|
+
(o: {}): [string, any][];
|
|
17
|
+
}, values: {
|
|
18
|
+
<T>(o: {
|
|
19
|
+
[s: string]: T;
|
|
20
|
+
} | ArrayLike<T>): T[];
|
|
21
|
+
(o: {}): any[];
|
|
22
|
+
};
|
|
23
|
+
declare const stringify: {
|
|
24
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
25
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
26
|
+
}, parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
|
|
27
|
+
declare const push: (...items: any[]) => number, join: (separator?: string | undefined) => string, slice: (start?: number | undefined, end?: number | undefined) => any[];
|
|
28
|
+
declare const isArray: (arg: any) => arg is any[], from: {
|
|
29
|
+
<T>(arrayLike: ArrayLike<T>): T[];
|
|
30
|
+
<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
31
|
+
<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
32
|
+
<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
33
|
+
};
|
|
34
|
+
export { keys as ObjectKeys, create as ObjectCreate, assign as ObjectAssign, entries as ObjectEntries, values as ObjectValues, push as ArrayPrototypePush, join as ArrayPrototypeJoin, slice as ArrayPrototypeSlice, isArray as ArrayIsArray, from as ArrayFrom, stringify as JSONStringify, parse as JSONParse, };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-store-nimbus",
|
|
3
|
+
"version": "0.1.0-dev1",
|
|
4
|
+
"description": "A nimbus-plugin-based implementation of the Luvio DurableStore and SqliteStore.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/types/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepare": "yarn build",
|
|
21
|
+
"clean": "rm -rf dist",
|
|
22
|
+
"build": "rollup --bundleConfigAsCjs --config rollup.config.js",
|
|
23
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
|
|
24
|
+
"test:unit": "NODE_ENV=production jest",
|
|
25
|
+
"test:size": "luvioBundlesize"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"o11y": "250.7.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@luvio/environments": "0.158.7",
|
|
32
|
+
"@salesforce/lds-store-sql": "^0.1.0-dev1",
|
|
33
|
+
"@salesforce/nimbus-plugin-lds": "^0.1.0-dev1"
|
|
34
|
+
},
|
|
35
|
+
"luvioBundlesize": [
|
|
36
|
+
{
|
|
37
|
+
"path": "./dist/index.js",
|
|
38
|
+
"maxSize": {
|
|
39
|
+
"none": "19 kB",
|
|
40
|
+
"min": "9 kB",
|
|
41
|
+
"compressed": "3 kB"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|