@salesforce/lds-store-nimbus 1.335.0 → 1.337.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/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { DefaultDurableSegment } from '@luvio/environments';
2
+ import { idleDetector } from 'o11y/client';
2
3
 
3
4
  const { keys, create, assign, entries, values } = Object;
4
5
  const { stringify, parse } = JSON;
@@ -243,6 +244,7 @@ class LdsInternalDataTable {
243
244
  }
244
245
  }
245
246
 
247
+ const tasker = idleDetector.declareNotifierTaskMulti('NimbusSqliteStore');
246
248
  class NimbusSqliteStore {
247
249
  constructor(plugin, additionalTableMap = {}) {
248
250
  this.plugin = plugin;
@@ -256,26 +258,37 @@ class NimbusSqliteStore {
256
258
  return true;
257
259
  }
258
260
  query(sql, params) {
261
+ tasker.add();
259
262
  return new Promise((resolve, reject) => {
260
263
  this.plugin.query(sql, params, (result) => {
261
264
  resolve(result);
262
265
  }, (error) => {
263
266
  reject(error);
264
267
  });
265
- });
268
+ }).finally(() => tasker.done());
266
269
  }
267
270
  batchQuery(queries) {
268
271
  const promises = queries.map((q) => this.query(q.sql, q.params));
269
- return Promise.all(promises);
272
+ tasker.add();
273
+ return Promise.all(promises).finally(() => tasker.done());
270
274
  }
271
275
  async getEntries(entryIds, segment) {
272
- return this.getTable(segment).getByKeys(entryIds, segment);
276
+ tasker.add();
277
+ return this.getTable(segment)
278
+ .getByKeys(entryIds, segment)
279
+ .finally(() => tasker.done());
273
280
  }
274
281
  async getMetadata(entryIds, segment) {
275
- return this.getTable(segment).getMetadataByKeys(entryIds, segment);
282
+ tasker.add();
283
+ return this.getTable(segment)
284
+ .getMetadataByKeys(entryIds, segment)
285
+ .finally(() => tasker.done());
276
286
  }
277
287
  getAllEntries(segment) {
278
- return this.getTable(segment).getAll(segment);
288
+ tasker.add();
289
+ return this.getTable(segment)
290
+ .getAll(segment)
291
+ .finally(() => tasker.done());
279
292
  }
280
293
  setEntries(entries, segment) {
281
294
  if (keys(entries).length === 0) {
@@ -371,6 +384,7 @@ class NimbusSqliteStore {
371
384
  };
372
385
  }
373
386
  batchOperationAsPromise(sqliteOperations) {
387
+ tasker.add();
374
388
  return new Promise((resolve, reject) => {
375
389
  this.plugin.batchOperations(sqliteOperations, (error) => {
376
390
  if (error && error !== null) {
@@ -380,7 +394,7 @@ class NimbusSqliteStore {
380
394
  resolve();
381
395
  }
382
396
  });
383
- });
397
+ }).finally(() => tasker.done());
384
398
  }
385
399
  }
386
400
 
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-store-nimbus",
3
- "version": "1.335.0",
3
+ "version": "1.337.0",
4
4
  "description": "A nimbus-plugin-based implementation of the Luvio DurableStore and SqliteStore.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "types": "dist/types/index.d.ts",
@@ -24,10 +24,13 @@
24
24
  "test:unit": "NODE_ENV=production jest",
25
25
  "test:size": "luvioBundlesize"
26
26
  },
27
+ "dependencies": {
28
+ "o11y": "250.7.0"
29
+ },
27
30
  "devDependencies": {
28
31
  "@luvio/environments": "0.156.5",
29
- "@salesforce/lds-store-sql": "^1.335.0",
30
- "@salesforce/nimbus-plugin-lds": "^1.335.0"
32
+ "@salesforce/lds-store-sql": "^1.337.0",
33
+ "@salesforce/nimbus-plugin-lds": "^1.337.0"
31
34
  },
32
35
  "luvioBundlesize": [
33
36
  {