@salesforce/lds-default-luvio 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.
@@ -14,125 +14,125 @@
14
14
  /* proxy-compat-disable */
15
15
  import { Luvio, Environment, InMemoryStore } from '@luvio/engine';
16
16
 
17
- /*
18
- * Copyright (c) 2022, Salesforce, Inc.,
19
- * All rights reserved.
20
- * For full license text, see the LICENSE.txt file
21
- */
22
- /**
23
- * Callbacks to be invoked when registrations happen,
24
- */
25
- const callbacks$1 = [];
26
- /**
27
- * Registrations that have already occurred.
28
- *
29
- * Note that Registrations are maintained as a list rather than a map to allow
30
- * the same id to be registered multiple times with potentially different
31
- * data.
32
- */
33
- const registrations = [];
34
- /**
35
- * Invokes callback for each Registration, both past & future. That is, callback
36
- * will be invoked exactly as many times as register() is called.
37
- *
38
- * Note that Registration ids are not guaranteed to be unique. The meaning of
39
- * multiple Registrations with the same id is determined by the caller(s) of
40
- * register().
41
- */
42
- function forEachRegistration(callback) {
43
- callbacks$1.push(callback);
44
- registrations.forEach((r) => callback(r));
45
- }
46
- /**
47
- * Invokes callback when the specified id is registered.
48
- *
49
- * Note that callback may be invoked:
50
- *
51
- * - multiple times if multiple calls to register() specify the id
52
- * - never if the specified id is never registered
53
- */
54
- function withRegistration(id, callback) {
55
- forEachRegistration((r) => {
56
- if (r.id === id) {
57
- callback(r);
58
- }
59
- });
60
- }
61
- /**
62
- * Register an id and associated data.
63
- *
64
- * Callers of register() should make types available that include:
65
- *
66
- * - the id they will register
67
- * - definitions for any additional properties on their Registration objects
68
- *
69
- * For example:
70
- *
71
- * export type MyRegistration = {
72
- * id: 'myRegistrationId',
73
- *
74
- * // some value that others might need
75
- * myValue: string,
76
- *
77
- * // some function that others might want to call
78
- * myFunction: () => void,
79
- * };
80
- * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
81
- *
82
- * The registry itself does not dictate the format of ids nor attempt to coordinate
83
- * uniqueness of id values.
84
- *
85
- * The same id can be registered multiple times with different Registration
86
- * objects.
87
- */
88
- function register(r) {
89
- registrations.push(r);
90
- callbacks$1.forEach((callback) => callback(r));
17
+ /*
18
+ * Copyright (c) 2022, Salesforce, Inc.,
19
+ * All rights reserved.
20
+ * For full license text, see the LICENSE.txt file
21
+ */
22
+ /**
23
+ * Callbacks to be invoked when registrations happen,
24
+ */
25
+ const callbacks$1 = [];
26
+ /**
27
+ * Registrations that have already occurred.
28
+ *
29
+ * Note that Registrations are maintained as a list rather than a map to allow
30
+ * the same id to be registered multiple times with potentially different
31
+ * data.
32
+ */
33
+ const registrations = [];
34
+ /**
35
+ * Invokes callback for each Registration, both past & future. That is, callback
36
+ * will be invoked exactly as many times as register() is called.
37
+ *
38
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
39
+ * multiple Registrations with the same id is determined by the caller(s) of
40
+ * register().
41
+ */
42
+ function forEachRegistration(callback) {
43
+ callbacks$1.push(callback);
44
+ registrations.forEach((r) => callback(r));
45
+ }
46
+ /**
47
+ * Invokes callback when the specified id is registered.
48
+ *
49
+ * Note that callback may be invoked:
50
+ *
51
+ * - multiple times if multiple calls to register() specify the id
52
+ * - never if the specified id is never registered
53
+ */
54
+ function withRegistration(id, callback) {
55
+ forEachRegistration((r) => {
56
+ if (r.id === id) {
57
+ callback(r);
58
+ }
59
+ });
60
+ }
61
+ /**
62
+ * Register an id and associated data.
63
+ *
64
+ * Callers of register() should make types available that include:
65
+ *
66
+ * - the id they will register
67
+ * - definitions for any additional properties on their Registration objects
68
+ *
69
+ * For example:
70
+ *
71
+ * export type MyRegistration = {
72
+ * id: 'myRegistrationId',
73
+ *
74
+ * // some value that others might need
75
+ * myValue: string,
76
+ *
77
+ * // some function that others might want to call
78
+ * myFunction: () => void,
79
+ * };
80
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
81
+ *
82
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
83
+ * uniqueness of id values.
84
+ *
85
+ * The same id can be registered multiple times with different Registration
86
+ * objects.
87
+ */
88
+ function register(r) {
89
+ registrations.push(r);
90
+ callbacks$1.forEach((callback) => callback(r));
91
91
  }
92
92
 
93
- /*
94
- * Copyright (c) 2022, Salesforce, Inc.,
95
- * All rights reserved.
96
- * For full license text, see the LICENSE.txt file
97
- */
98
- // most recently set default Luvio instance
99
- let defaultLuvio;
100
- // callbacks to be invoked when default luvio instance is set/changed
101
- let callbacks = [];
102
- /**
103
- * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
104
- * is overwritten.
105
- */
106
- function setDefaultLuvio(params) {
107
- const newLuvio = 'luvio' in params
108
- ? params.luvio
109
- : 'environment' in params
110
- ? new Luvio(params.environment)
111
- : 'networkAdapter' in params
112
- ? new Luvio(new Environment(params.store || new InMemoryStore(), params.networkAdapter))
113
- : undefined;
114
- if (newLuvio === undefined) {
115
- // eslint-disable-next-line @salesforce/lds/no-error-in-production
116
- throw new Error('unable to construct default Luvio instance from supplied parameters');
117
- }
118
- defaultLuvio = newLuvio;
119
- // inform observers
120
- for (let i = 0; i < callbacks.length; ++i) {
121
- callbacks[i](defaultLuvio);
122
- }
123
- }
124
- /**
125
- * Registers a callback to be invoked with the default Luvio instance. Note that the
126
- * callback may be invoked multiple times if the default Luvio changes.
127
- *
128
- * @param callback callback to be invoked with default Luvio instance
129
- */
130
- function withDefaultLuvio(callback) {
131
- if (defaultLuvio) {
132
- callback(defaultLuvio);
133
- }
134
- callbacks.push(callback);
93
+ /*
94
+ * Copyright (c) 2022, Salesforce, Inc.,
95
+ * All rights reserved.
96
+ * For full license text, see the LICENSE.txt file
97
+ */
98
+ // most recently set default Luvio instance
99
+ let defaultLuvio;
100
+ // callbacks to be invoked when default luvio instance is set/changed
101
+ let callbacks = [];
102
+ /**
103
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
104
+ * is overwritten.
105
+ */
106
+ function setDefaultLuvio(params) {
107
+ const newLuvio = 'luvio' in params
108
+ ? params.luvio
109
+ : 'environment' in params
110
+ ? new Luvio(params.environment)
111
+ : 'networkAdapter' in params
112
+ ? new Luvio(new Environment(params.store || new InMemoryStore(), params.networkAdapter))
113
+ : undefined;
114
+ if (newLuvio === undefined) {
115
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
116
+ throw new Error('unable to construct default Luvio instance from supplied parameters');
117
+ }
118
+ defaultLuvio = newLuvio;
119
+ // inform observers
120
+ for (let i = 0; i < callbacks.length; ++i) {
121
+ callbacks[i](defaultLuvio);
122
+ }
123
+ }
124
+ /**
125
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
126
+ * callback may be invoked multiple times if the default Luvio changes.
127
+ *
128
+ * @param callback callback to be invoked with default Luvio instance
129
+ */
130
+ function withDefaultLuvio(callback) {
131
+ if (defaultLuvio) {
132
+ callback(defaultLuvio);
133
+ }
134
+ callbacks.push(callback);
135
135
  }
136
136
 
137
137
  export { forEachRegistration, register, setDefaultLuvio, withDefaultLuvio, withRegistration };
138
- // version: 1.124.2-a5418d550
138
+ // version: 1.124.3-cf2dbb2fa
@@ -1,30 +1,30 @@
1
- import type { NetworkAdapter } from '@luvio/engine';
2
- import { Environment, Luvio, InMemoryStore } from '@luvio/engine';
3
- /**
4
- * Parameters accepted by setDefaultLuvio.
5
- */
6
- export type SetDefaultLuvioParameters = {
7
- luvio: Luvio;
8
- } | {
9
- environment: Environment;
10
- } | {
11
- store?: InMemoryStore;
12
- networkAdapter: NetworkAdapter;
13
- };
14
- /**
15
- * Callback used to inform interested parties that a new default Luvio has been set.
16
- */
17
- export type Callback = (luvio: Luvio) => void;
18
- /**
19
- * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
20
- * is overwritten.
21
- */
22
- export declare function setDefaultLuvio(params: SetDefaultLuvioParameters): void;
23
- /**
24
- * Registers a callback to be invoked with the default Luvio instance. Note that the
25
- * callback may be invoked multiple times if the default Luvio changes.
26
- *
27
- * @param callback callback to be invoked with default Luvio instance
28
- */
29
- export declare function withDefaultLuvio(callback: Callback): void;
30
- export * from './registry';
1
+ import type { NetworkAdapter } from '@luvio/engine';
2
+ import { Environment, Luvio, InMemoryStore } from '@luvio/engine';
3
+ /**
4
+ * Parameters accepted by setDefaultLuvio.
5
+ */
6
+ export type SetDefaultLuvioParameters = {
7
+ luvio: Luvio;
8
+ } | {
9
+ environment: Environment;
10
+ } | {
11
+ store?: InMemoryStore;
12
+ networkAdapter: NetworkAdapter;
13
+ };
14
+ /**
15
+ * Callback used to inform interested parties that a new default Luvio has been set.
16
+ */
17
+ export type Callback = (luvio: Luvio) => void;
18
+ /**
19
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
20
+ * is overwritten.
21
+ */
22
+ export declare function setDefaultLuvio(params: SetDefaultLuvioParameters): void;
23
+ /**
24
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
25
+ * callback may be invoked multiple times if the default Luvio changes.
26
+ *
27
+ * @param callback callback to be invoked with default Luvio instance
28
+ */
29
+ export declare function withDefaultLuvio(callback: Callback): void;
30
+ export * from './registry';
@@ -1,58 +1,58 @@
1
- /**
2
- * Registration information. Actual Registration objects will typically contain
3
- * additional fields. Id values and additional fields in the Registration should
4
- * be specified in types exported by the code that calls register().
5
- */
6
- export type Registration = {
7
- id: string;
8
- };
9
- /**
10
- * Callback used to inform interested parties that something has been registered.
11
- */
12
- export type RegistrationCallback<R = Registration> = (registration: R) => void;
13
- /**
14
- * Invokes callback for each Registration, both past & future. That is, callback
15
- * will be invoked exactly as many times as register() is called.
16
- *
17
- * Note that Registration ids are not guaranteed to be unique. The meaning of
18
- * multiple Registrations with the same id is determined by the caller(s) of
19
- * register().
20
- */
21
- export declare function forEachRegistration(callback: RegistrationCallback): void;
22
- /**
23
- * Invokes callback when the specified id is registered.
24
- *
25
- * Note that callback may be invoked:
26
- *
27
- * - multiple times if multiple calls to register() specify the id
28
- * - never if the specified id is never registered
29
- */
30
- export declare function withRegistration<R extends Registration>(id: R['id'], callback: RegistrationCallback<R>): void;
31
- /**
32
- * Register an id and associated data.
33
- *
34
- * Callers of register() should make types available that include:
35
- *
36
- * - the id they will register
37
- * - definitions for any additional properties on their Registration objects
38
- *
39
- * For example:
40
- *
41
- * export type MyRegistration = {
42
- * id: 'myRegistrationId',
43
- *
44
- * // some value that others might need
45
- * myValue: string,
46
- *
47
- * // some function that others might want to call
48
- * myFunction: () => void,
49
- * };
50
- * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
51
- *
52
- * The registry itself does not dictate the format of ids nor attempt to coordinate
53
- * uniqueness of id values.
54
- *
55
- * The same id can be registered multiple times with different Registration
56
- * objects.
57
- */
58
- export declare function register<R extends Registration = Registration>(r: R): void;
1
+ /**
2
+ * Registration information. Actual Registration objects will typically contain
3
+ * additional fields. Id values and additional fields in the Registration should
4
+ * be specified in types exported by the code that calls register().
5
+ */
6
+ export type Registration = {
7
+ id: string;
8
+ };
9
+ /**
10
+ * Callback used to inform interested parties that something has been registered.
11
+ */
12
+ export type RegistrationCallback<R = Registration> = (registration: R) => void;
13
+ /**
14
+ * Invokes callback for each Registration, both past & future. That is, callback
15
+ * will be invoked exactly as many times as register() is called.
16
+ *
17
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
18
+ * multiple Registrations with the same id is determined by the caller(s) of
19
+ * register().
20
+ */
21
+ export declare function forEachRegistration(callback: RegistrationCallback): void;
22
+ /**
23
+ * Invokes callback when the specified id is registered.
24
+ *
25
+ * Note that callback may be invoked:
26
+ *
27
+ * - multiple times if multiple calls to register() specify the id
28
+ * - never if the specified id is never registered
29
+ */
30
+ export declare function withRegistration<R extends Registration>(id: R['id'], callback: RegistrationCallback<R>): void;
31
+ /**
32
+ * Register an id and associated data.
33
+ *
34
+ * Callers of register() should make types available that include:
35
+ *
36
+ * - the id they will register
37
+ * - definitions for any additional properties on their Registration objects
38
+ *
39
+ * For example:
40
+ *
41
+ * export type MyRegistration = {
42
+ * id: 'myRegistrationId',
43
+ *
44
+ * // some value that others might need
45
+ * myValue: string,
46
+ *
47
+ * // some function that others might want to call
48
+ * myFunction: () => void,
49
+ * };
50
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
51
+ *
52
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
53
+ * uniqueness of id values.
54
+ *
55
+ * The same id can be registered multiple times with different Registration
56
+ * objects.
57
+ */
58
+ export declare function register<R extends Registration = Registration>(r: R): void;
@@ -1,2 +1,2 @@
1
- export * from './main';
2
- export { Environment, GraphNode, HttpStatusCode, InMemoryStore, Luvio, Reader, StoreResolveResultState, adapterToNetworkPriority, buildStaleWhileRevalidateImplementation, coerceAdapterRequestContext, createCustomAdapterEventEmitter, emitAdapterEvent, } from '@luvio/engine';
1
+ export * from './main';
2
+ export { Environment, GraphNode, HttpStatusCode, InMemoryStore, Luvio, Reader, StoreResolveResultState, adapterToNetworkPriority, buildStaleWhileRevalidateImplementation, coerceAdapterRequestContext, createCustomAdapterEventEmitter, emitAdapterEvent, } from '@luvio/engine';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@salesforce/lds-default-luvio",
3
- "version": "1.124.2",
3
+ "version": "1.124.3",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "rendezvous point for producers & consumers of the default luvio instance",
6
6
  "bugs": "This software is provided as-is with no support provided.",
7
- "main": "dist/umd/es2018/main.js",
7
+ "main": "dist/es/es2018/main.js",
8
8
  "module": "dist/es/es2018/main.js",
9
- "types": "dist/types/src/main.d.ts",
9
+ "types": "dist/es/es2018/types/src/main.d.ts",
10
10
  "files": [
11
11
  "dist",
12
12
  "LICENSE.txt",
@@ -15,8 +15,8 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": "./dist/es/es2018/main.js",
18
- "require": "./dist/umd/es2018/main.js",
19
- "types": "./dist/types/src/main.d.ts"
18
+ "require": "./dist/es/es2018/main.js",
19
+ "types": "./dist/es/es2018/types/src/main.d.ts"
20
20
  },
21
21
  "./sfdc": {
22
22
  "types": "./sfdc/ldsEngine.d.ts",
@@ -1 +1 @@
1
- export * from './sfdc';
1
+ export * from './types/sfdc';