@salesforce/nimbus-plugin-lds 1.124.2 → 1.124.3

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.
@@ -1,89 +1,89 @@
1
- declare module 'nimbus-types' {
2
- interface NimbusPlugins {
3
- LdsNetworkAdapter: NetworkAdapter;
4
- }
5
- }
6
- /**
7
- * ObservabilityContext helps us trace the path of a request
8
- * through the Native and JS layers
9
- */
10
- export interface ObservabilityContext {
11
- /**
12
- * Uniquely identify a root activity like Priming, Navigation etc
13
- * Multiple adapter calls can be tied to one root activity
14
- *
15
- * Optional
16
- */
17
- rootId?: string;
18
- /**
19
- * Should we transmit the activity from the client side
20
- *
21
- * Required if rootId is provided.
22
- */
23
- isRootActivitySampled?: boolean;
24
- /**
25
- * Uniquely identifies each adapter call
26
- *
27
- * Optional
28
- */
29
- traceId?: string;
30
- }
31
- /**
32
- * A `NetworkError` represents a type of transient request error and an associated message
33
- * if one is available.
34
- */
35
- export interface NetworkError {
36
- type: 'timeout' | 'unspecified';
37
- message: string | null;
38
- }
39
- /**
40
- * A `NetworkAdapter` is capable of handling `Request`s and generating `Response`s.
41
- */
42
- export interface NetworkAdapter {
43
- /**
44
- * Send the request, returning a token that can be used to cancel the request.
45
- *
46
- * @param request the request to handle
47
- * @param onResponse called when a Response is received
48
- * @param onError called when there is an error handling the `Request`. The `error`
49
- * is a NetworkError describing what caused the error.
50
- * @returns {Promise<string>} A promise resolving to a token for this request
51
- */
52
- sendRequest(request: Request, onResponse: (response: Response) => void, onError: (error: NetworkError) => void): Promise<string>;
53
- /**
54
- * Attempt to cancel a request associated with the specified token.
55
- *
56
- * @param token a token returned from `sendRequest`
57
- * @returns {void}
58
- */
59
- cancelRequest(token: string): void;
60
- }
61
- /**
62
- * An HTTP request
63
- */
64
- export interface Request {
65
- method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';
66
- priority: 'background' | 'normal' | 'high';
67
- path: string;
68
- headers: {
69
- [key: string]: string;
70
- };
71
- queryParams: {
72
- [key: string]: string;
73
- };
74
- body: string | null;
75
- observabilityContext: ObservabilityContext | null;
76
- }
77
- /**
78
- * An HTTP response
79
- */
80
- export interface Response {
81
- status: number;
82
- headers: {
83
- [key: string]: string;
84
- };
85
- /**
86
- * A string-encoded object or null.
87
- */
88
- body: string | null;
89
- }
1
+ declare module 'nimbus-types' {
2
+ interface NimbusPlugins {
3
+ LdsNetworkAdapter: NetworkAdapter;
4
+ }
5
+ }
6
+ /**
7
+ * ObservabilityContext helps us trace the path of a request
8
+ * through the Native and JS layers
9
+ */
10
+ export interface ObservabilityContext {
11
+ /**
12
+ * Uniquely identify a root activity like Priming, Navigation etc
13
+ * Multiple adapter calls can be tied to one root activity
14
+ *
15
+ * Optional
16
+ */
17
+ rootId?: string;
18
+ /**
19
+ * Should we transmit the activity from the client side
20
+ *
21
+ * Required if rootId is provided.
22
+ */
23
+ isRootActivitySampled?: boolean;
24
+ /**
25
+ * Uniquely identifies each adapter call
26
+ *
27
+ * Optional
28
+ */
29
+ traceId?: string;
30
+ }
31
+ /**
32
+ * A `NetworkError` represents a type of transient request error and an associated message
33
+ * if one is available.
34
+ */
35
+ export interface NetworkError {
36
+ type: 'timeout' | 'unspecified';
37
+ message: string | null;
38
+ }
39
+ /**
40
+ * A `NetworkAdapter` is capable of handling `Request`s and generating `Response`s.
41
+ */
42
+ export interface NetworkAdapter {
43
+ /**
44
+ * Send the request, returning a token that can be used to cancel the request.
45
+ *
46
+ * @param request the request to handle
47
+ * @param onResponse called when a Response is received
48
+ * @param onError called when there is an error handling the `Request`. The `error`
49
+ * is a NetworkError describing what caused the error.
50
+ * @returns {Promise<string>} A promise resolving to a token for this request
51
+ */
52
+ sendRequest(request: Request, onResponse: (response: Response) => void, onError: (error: NetworkError) => void): Promise<string>;
53
+ /**
54
+ * Attempt to cancel a request associated with the specified token.
55
+ *
56
+ * @param token a token returned from `sendRequest`
57
+ * @returns {void}
58
+ */
59
+ cancelRequest(token: string): void;
60
+ }
61
+ /**
62
+ * An HTTP request
63
+ */
64
+ export interface Request {
65
+ method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';
66
+ priority: 'background' | 'normal' | 'high';
67
+ path: string;
68
+ headers: {
69
+ [key: string]: string;
70
+ };
71
+ queryParams: {
72
+ [key: string]: string;
73
+ };
74
+ body: string | null;
75
+ observabilityContext: ObservabilityContext | null;
76
+ }
77
+ /**
78
+ * An HTTP response
79
+ */
80
+ export interface Response {
81
+ status: number;
82
+ headers: {
83
+ [key: string]: string;
84
+ };
85
+ /**
86
+ * A string-encoded object or null.
87
+ */
88
+ body: string | null;
89
+ }
@@ -1,152 +1,152 @@
1
- declare module 'nimbus-types' {
2
- interface NimbusPlugins {
3
- LdsSqliteStore: SqliteStorePlugin;
4
- }
5
- }
6
- import type { SqliteResult, SqliteType } from '@salesforce/lds-store-sql';
7
- /**
8
- * A plugin interface that is backed by a sqlite database and
9
- * used by a `SqliteStore`.
10
- */
11
- export interface SqliteStorePlugin {
12
- /**
13
- * @see SqliteStore.query
14
- */
15
- query(sql: string, params: SqliteType[], onResult: (result: SqliteResult) => void, onError: (message: string) => void): Promise<void>;
16
- /**
17
- * Perform a set of operations on the underlying database.
18
- */
19
- batchOperations(operations: SqliteOperation[], onCompletion: (error: string | null) => void): Promise<void>;
20
- /**
21
- * Setup a listener to be notified of changes to the Durable Store
22
- *
23
- * @param listener callback taking an array of store changes
24
- * @returns {Promise<string>} a generated id of the listener to unsubscribe with
25
- */
26
- registerOnChangedListener(listener: (changes: SqliteStoreChange[]) => void): Promise<string>;
27
- /**
28
- *
29
- * @param id the identifier given from registerOnChangedListener
30
- */
31
- unsubscribeOnChangedListener(id: string): Promise<void>;
32
- }
33
- /**
34
- * An operation to perform on the database.
35
- */
36
- interface SqliteOperationBase {
37
- table: 'lds_data' | 'lds_internal' | 'lds_env_drafts' | 'lds_env_draft_id_map';
38
- keyColumn: string;
39
- context: SqliteOperationContext;
40
- }
41
- /**
42
- * An upsert attempts to insert rows into the database. If
43
- * there is a primary key or unique constraint violation it
44
- * can attempt to update the existing rows.
45
- *
46
- * ex:
47
- * ```javascript
48
- * let operation = {
49
- * type: "upsert",
50
- * table: "luvio_internal",
51
- * columns: ["key", "namespace", "data", "metadata"],
52
- * keyColumn: "key",
53
- * conflictColumns: ["key", "namespace"],
54
- * rows: [
55
- * ["001002003004005001", "ADAPTER_CONTEXT", "{'a': 1, 'b': 2}", "{}"],
56
- * ["001002003004005002", "ADAPTER_CONTEXT", "{'a': 3, 'b': 5}", "{}"]
57
- * ],
58
- * context: {
59
- * segment: "ADAPTER_CONTEXT"
60
- * }
61
- * }
62
- * ```
63
- *
64
- * ```sql
65
- * insert into luvio_internal (key, namespace, data, metadata)
66
- * values (?, ?, ?, ?)
67
- * on conflict (key, namespace) do
68
- * update set value = excluded.value, metada = excluded.metadata
69
- * ```
70
- */
71
- interface SqliteUpsert extends SqliteOperationBase {
72
- type: 'upsert';
73
- conflictColumns: string[];
74
- columns: string[];
75
- rows: SqliteType[][];
76
- }
77
- /**
78
- * Delete rows from the database.
79
- *
80
- * ex:
81
- * ```javascript
82
- * let operation = {
83
- * type: "delete",
84
- * table: "luvio_data",
85
- * keyColumn: "key",
86
- * ids: ["001002003004005001", "001002003004005002"],
87
- * context: {
88
- * segment: "DEFAULT"
89
- * }
90
- * }
91
- * ```
92
- *
93
- * ```sql
94
- * delete from luvio_data where key in ("001002003004005001", "001002003004005002")
95
- * ```
96
- */
97
- interface SqliteDelete extends SqliteOperationBase {
98
- type: 'delete';
99
- ids: string[];
100
- }
101
- export type SqliteOperation = SqliteDelete | SqliteUpsert;
102
- export declare function isUpsertOperation(operation: SqliteOperation): operation is SqliteUpsert;
103
- /**
104
- * Operations can pass any context object along with the operation.
105
- * This context is opaque to the plugin and will be included in any
106
- * change notifications generated from the operation.
107
- */
108
- export type SqliteOperationContext = {
109
- [s: string]: SqliteType;
110
- };
111
- /**
112
- * A change from the underlying sqlite database triggered by executing a set of operations.
113
- *
114
- * Example:
115
- *
116
- * The following operation:
117
- *
118
- * ```javascript
119
- * let operation = {
120
- * type: "delete",
121
- * table: "luvio_data",
122
- * keyColumn: "key",
123
- * ids: ["001", "002"],
124
- * context: {
125
- * segment: "DEFAULT"
126
- * }
127
- * }
128
- * ```
129
- *
130
- * should trigger the following change:
131
- * ```javascript
132
- * {
133
- * type: "delete",
134
- * table: "luvio_data",
135
- * keys: ["001", "002"],
136
- * context: {
137
- * segment: "DEFAULT"
138
- * }
139
- * }
140
- * ```
141
- */
142
- export interface SqliteStoreChange {
143
- type: SqliteOperation['type'];
144
- table: string;
145
- keys: SqliteType[];
146
- context: SqliteOperationContext;
147
- }
148
- export declare const sortedSchemaMigrations: Array<{
149
- version: number;
150
- sql: string;
151
- }>;
152
- export {};
1
+ declare module 'nimbus-types' {
2
+ interface NimbusPlugins {
3
+ LdsSqliteStore: SqliteStorePlugin;
4
+ }
5
+ }
6
+ import type { SqliteResult, SqliteType } from '@salesforce/lds-store-sql';
7
+ /**
8
+ * A plugin interface that is backed by a sqlite database and
9
+ * used by a `SqliteStore`.
10
+ */
11
+ export interface SqliteStorePlugin {
12
+ /**
13
+ * @see SqliteStore.query
14
+ */
15
+ query(sql: string, params: SqliteType[], onResult: (result: SqliteResult) => void, onError: (message: string) => void): Promise<void>;
16
+ /**
17
+ * Perform a set of operations on the underlying database.
18
+ */
19
+ batchOperations(operations: SqliteOperation[], onCompletion: (error: string | null) => void): Promise<void>;
20
+ /**
21
+ * Setup a listener to be notified of changes to the Durable Store
22
+ *
23
+ * @param listener callback taking an array of store changes
24
+ * @returns {Promise<string>} a generated id of the listener to unsubscribe with
25
+ */
26
+ registerOnChangedListener(listener: (changes: SqliteStoreChange[]) => void): Promise<string>;
27
+ /**
28
+ *
29
+ * @param id the identifier given from registerOnChangedListener
30
+ */
31
+ unsubscribeOnChangedListener(id: string): Promise<void>;
32
+ }
33
+ /**
34
+ * An operation to perform on the database.
35
+ */
36
+ interface SqliteOperationBase {
37
+ table: 'lds_data' | 'lds_internal' | 'lds_env_drafts' | 'lds_env_draft_id_map';
38
+ keyColumn: string;
39
+ context: SqliteOperationContext;
40
+ }
41
+ /**
42
+ * An upsert attempts to insert rows into the database. If
43
+ * there is a primary key or unique constraint violation it
44
+ * can attempt to update the existing rows.
45
+ *
46
+ * ex:
47
+ * ```javascript
48
+ * let operation = {
49
+ * type: "upsert",
50
+ * table: "luvio_internal",
51
+ * columns: ["key", "namespace", "data", "metadata"],
52
+ * keyColumn: "key",
53
+ * conflictColumns: ["key", "namespace"],
54
+ * rows: [
55
+ * ["001002003004005001", "ADAPTER_CONTEXT", "{'a': 1, 'b': 2}", "{}"],
56
+ * ["001002003004005002", "ADAPTER_CONTEXT", "{'a': 3, 'b': 5}", "{}"]
57
+ * ],
58
+ * context: {
59
+ * segment: "ADAPTER_CONTEXT"
60
+ * }
61
+ * }
62
+ * ```
63
+ *
64
+ * ```sql
65
+ * insert into luvio_internal (key, namespace, data, metadata)
66
+ * values (?, ?, ?, ?)
67
+ * on conflict (key, namespace) do
68
+ * update set value = excluded.value, metada = excluded.metadata
69
+ * ```
70
+ */
71
+ interface SqliteUpsert extends SqliteOperationBase {
72
+ type: 'upsert';
73
+ conflictColumns: string[];
74
+ columns: string[];
75
+ rows: SqliteType[][];
76
+ }
77
+ /**
78
+ * Delete rows from the database.
79
+ *
80
+ * ex:
81
+ * ```javascript
82
+ * let operation = {
83
+ * type: "delete",
84
+ * table: "luvio_data",
85
+ * keyColumn: "key",
86
+ * ids: ["001002003004005001", "001002003004005002"],
87
+ * context: {
88
+ * segment: "DEFAULT"
89
+ * }
90
+ * }
91
+ * ```
92
+ *
93
+ * ```sql
94
+ * delete from luvio_data where key in ("001002003004005001", "001002003004005002")
95
+ * ```
96
+ */
97
+ interface SqliteDelete extends SqliteOperationBase {
98
+ type: 'delete';
99
+ ids: string[];
100
+ }
101
+ export type SqliteOperation = SqliteDelete | SqliteUpsert;
102
+ export declare function isUpsertOperation(operation: SqliteOperation): operation is SqliteUpsert;
103
+ /**
104
+ * Operations can pass any context object along with the operation.
105
+ * This context is opaque to the plugin and will be included in any
106
+ * change notifications generated from the operation.
107
+ */
108
+ export type SqliteOperationContext = {
109
+ [s: string]: SqliteType;
110
+ };
111
+ /**
112
+ * A change from the underlying sqlite database triggered by executing a set of operations.
113
+ *
114
+ * Example:
115
+ *
116
+ * The following operation:
117
+ *
118
+ * ```javascript
119
+ * let operation = {
120
+ * type: "delete",
121
+ * table: "luvio_data",
122
+ * keyColumn: "key",
123
+ * ids: ["001", "002"],
124
+ * context: {
125
+ * segment: "DEFAULT"
126
+ * }
127
+ * }
128
+ * ```
129
+ *
130
+ * should trigger the following change:
131
+ * ```javascript
132
+ * {
133
+ * type: "delete",
134
+ * table: "luvio_data",
135
+ * keys: ["001", "002"],
136
+ * context: {
137
+ * segment: "DEFAULT"
138
+ * }
139
+ * }
140
+ * ```
141
+ */
142
+ export interface SqliteStoreChange {
143
+ type: SqliteOperation['type'];
144
+ table: string;
145
+ keys: SqliteType[];
146
+ context: SqliteOperationContext;
147
+ }
148
+ export declare const sortedSchemaMigrations: Array<{
149
+ version: number;
150
+ sql: string;
151
+ }>;
152
+ export {};
@@ -1,10 +1,10 @@
1
- import type * as NimbusTypes from 'nimbus-types';
2
- export type { NimbusTypes };
3
- export type { NetworkAdapter, Request, Response, NetworkError, ObservabilityContext, } from './NetworkAdapter';
4
- export type { DraftQueue } from './DraftQueue';
5
- export type { SqliteStorePlugin, SqliteOperation } from './SqliteStorePlugin';
6
- export type { BinaryStorePlugin } from './BinaryStorePlugin';
7
- export type { InspectorPlugin } from './InspectorPlugin';
8
- export { sortedSchemaMigrations, isUpsertOperation } from './SqliteStorePlugin';
9
- export { JsSqliteStorePlugin } from './JsSqliteStorePlugin/JsSqliteStorePlugin';
10
- export { JsSqliteStoreWebWorkerPlugin } from './JsSqliteStorePlugin/JsWorkerSqliteStorePlugin';
1
+ import type * as NimbusTypes from 'nimbus-types';
2
+ export type { NimbusTypes };
3
+ export type { NetworkAdapter, Request, Response, NetworkError, ObservabilityContext, } from './NetworkAdapter';
4
+ export type { DraftQueue } from './DraftQueue';
5
+ export type { SqliteStorePlugin, SqliteOperation } from './SqliteStorePlugin';
6
+ export type { BinaryStorePlugin } from './BinaryStorePlugin';
7
+ export type { InspectorPlugin } from './InspectorPlugin';
8
+ export { sortedSchemaMigrations, isUpsertOperation } from './SqliteStorePlugin';
9
+ export { JsSqliteStorePlugin } from './JsSqliteStorePlugin/JsSqliteStorePlugin';
10
+ export { JsSqliteStoreWebWorkerPlugin } from './JsSqliteStorePlugin/JsWorkerSqliteStorePlugin';
@@ -1,10 +1,10 @@
1
- import type { NetworkAdapter, NetworkError, Request, Response } from '../NetworkAdapter';
2
- export declare class MockNimbusNetworkAdapter implements NetworkAdapter {
3
- private mockResponses;
4
- sentRequests: Request[];
5
- setMockResponse(mockResponse: Response): void;
6
- setMockResponses(mockResponses: Response[]): void;
7
- sendRequest(request: Request, onResponse: (response: Response) => void, onError: (error: NetworkError) => void): Promise<string>;
8
- cancelRequest(_token: string): void;
9
- setAsGlobalNimbusPlugin(): void;
10
- }
1
+ import type { NetworkAdapter, NetworkError, Request, Response } from '../NetworkAdapter';
2
+ export declare class MockNimbusNetworkAdapter implements NetworkAdapter {
3
+ private mockResponses;
4
+ sentRequests: Request[];
5
+ setMockResponse(mockResponse: Response): void;
6
+ setMockResponses(mockResponses: Response[]): void;
7
+ sendRequest(request: Request, onResponse: (response: Response) => void, onError: (error: NetworkError) => void): Promise<string>;
8
+ cancelRequest(_token: string): void;
9
+ setAsGlobalNimbusPlugin(): void;
10
+ }
@@ -1 +1 @@
1
- export { MockNimbusNetworkAdapter } from './MockNimbusNetworkAdapter';
1
+ export { MockNimbusNetworkAdapter } from './MockNimbusNetworkAdapter';
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@salesforce/nimbus-plugin-lds",
3
- "version": "1.124.2",
3
+ "version": "1.124.3",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Nimbus plugins for LDS on Mobile native integrations: durable store, networking, and draft queue.",
6
- "types": "dist/index.d.ts",
6
+ "types": "dist/types/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "files": [
@@ -12,12 +12,12 @@
12
12
  ],
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/index.d.ts",
15
+ "types": "./dist/types/index.d.ts",
16
16
  "import": "./dist/index.js",
17
17
  "default": "./dist/index.js"
18
18
  },
19
19
  "./mocks": {
20
- "types": "./dist/mocks/index.d.ts",
20
+ "types": "./dist/types/index.d.ts",
21
21
  "import": "./dist/mocks/index.js",
22
22
  "default": "./dist/mocks/index.js"
23
23
  }