@salesforce/lds-default-luvio 1.93.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/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.
@@ -0,0 +1,132 @@
1
+ /* *******************************************************************************************
2
+ * ATTENTION!
3
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
4
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
5
+ * Any changes made to this file in p4 will be automatically overwritten.
6
+ * *******************************************************************************************
7
+ */
8
+ /* proxy-compat-disable */
9
+ import { Luvio, Environment, InMemoryStore } from '@luvio/engine';
10
+
11
+ /*
12
+ * Copyright (c) 2022, Salesforce, Inc.,
13
+ * All rights reserved.
14
+ * For full license text, see the LICENSE.txt file
15
+ */
16
+ /**
17
+ * Callbacks to be invoked when registrations happen,
18
+ */
19
+ const callbacks$1 = [];
20
+ /**
21
+ * Registrations that have already occurred.
22
+ *
23
+ * Note that Registrations are maintained as a list rather than a map to allow
24
+ * the same id to be registered multiple times with potentially different
25
+ * data.
26
+ */
27
+ const registrations = [];
28
+ /**
29
+ * Invokes callback for each Registration, both past & future. That is, callback
30
+ * will be invoked exactly as many times as register() is called.
31
+ *
32
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
33
+ * multiple Registrations with the same id is determined by the caller(s) of
34
+ * register().
35
+ */
36
+ function forEachRegistration(callback) {
37
+ callbacks$1.push(callback);
38
+ registrations.forEach((r) => callback(r));
39
+ }
40
+ /**
41
+ * Invokes callback when the specified id is registered.
42
+ *
43
+ * Note that callback may be invoked:
44
+ *
45
+ * - multiple times if multiple calls to register() specify the id
46
+ * - never if the specified id is never registered
47
+ */
48
+ function withRegistration(id, callback) {
49
+ forEachRegistration((r) => {
50
+ if (r.id === id) {
51
+ callback(r);
52
+ }
53
+ });
54
+ }
55
+ /**
56
+ * Register an id and associated data.
57
+ *
58
+ * Callers of register() should make types available that include:
59
+ *
60
+ * - the id they will register
61
+ * - definitions for any additional properties on their Registration objects
62
+ *
63
+ * For example:
64
+ *
65
+ * export type MyRegistration = {
66
+ * id: 'myRegistrationId',
67
+ *
68
+ * // some value that others might need
69
+ * myValue: string,
70
+ *
71
+ * // some function that others might want to call
72
+ * myFunction: () => void,
73
+ * };
74
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
75
+ *
76
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
77
+ * uniqueness of id values.
78
+ *
79
+ * The same id can be registered multiple times with different Registration
80
+ * objects.
81
+ */
82
+ function register(r) {
83
+ registrations.push(r);
84
+ callbacks$1.forEach((callback) => callback(r));
85
+ }
86
+
87
+ /*
88
+ * Copyright (c) 2022, Salesforce, Inc.,
89
+ * All rights reserved.
90
+ * For full license text, see the LICENSE.txt file
91
+ */
92
+ // most recently set default Luvio instance
93
+ let defaultLuvio;
94
+ // callbacks to be invoked when default luvio instance is set/changed
95
+ let callbacks = [];
96
+ /**
97
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
98
+ * is overwritten.
99
+ */
100
+ function setDefaultLuvio(params) {
101
+ const newLuvio = 'luvio' in params
102
+ ? params.luvio
103
+ : 'environment' in params
104
+ ? new Luvio(params.environment)
105
+ : 'networkAdapter' in params
106
+ ? new Luvio(new Environment(params.store || new InMemoryStore(), params.networkAdapter))
107
+ : undefined;
108
+ if (newLuvio === undefined) {
109
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
110
+ throw new Error('unable to construct default Luvio instance from supplied parameters');
111
+ }
112
+ defaultLuvio = newLuvio;
113
+ // inform observers
114
+ for (let i = 0; i < callbacks.length; ++i) {
115
+ callbacks[i](defaultLuvio);
116
+ }
117
+ }
118
+ /**
119
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
120
+ * callback may be invoked multiple times if the default Luvio changes.
121
+ *
122
+ * @param callback callback to be invoked with default Luvio instance
123
+ */
124
+ function withDefaultLuvio(callback) {
125
+ if (defaultLuvio) {
126
+ callback(defaultLuvio);
127
+ }
128
+ callbacks.push(callback);
129
+ }
130
+
131
+ export { forEachRegistration, register, setDefaultLuvio, withDefaultLuvio, withRegistration };
132
+ // version: 1.93.0-17fd6a260
@@ -0,0 +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 declare 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 declare 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';
@@ -0,0 +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 declare type Registration = {
7
+ id: string;
8
+ };
9
+ /**
10
+ * Callback used to inform interested parties that something has been registered.
11
+ */
12
+ export declare 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;
@@ -0,0 +1,2 @@
1
+ export * from './main';
2
+ export { Environment, GraphNode, HttpStatusCode, InMemoryStore, Luvio, Reader, StoreResolveResultState, adapterToNetworkPriority, buildStaleWhileRevalidateImplementation, coerceAdapterRequestContext, createCustomAdapterEventEmitter, emitAdapterEvent, } from '@luvio/engine';
@@ -0,0 +1,144 @@
1
+ /* *******************************************************************************************
2
+ * ATTENTION!
3
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
4
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
5
+ * Any changes made to this file in p4 will be automatically overwritten.
6
+ * *******************************************************************************************
7
+ */
8
+ /* proxy-compat-disable */
9
+ (function (global, factory) {
10
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
11
+ typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
12
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["lds-default-luvio"] = {}, global.luvioEngine));
13
+ })(this, (function (exports, engine) { 'use strict';
14
+
15
+ /*
16
+ * Copyright (c) 2022, Salesforce, Inc.,
17
+ * All rights reserved.
18
+ * For full license text, see the LICENSE.txt file
19
+ */
20
+ /**
21
+ * Callbacks to be invoked when registrations happen,
22
+ */
23
+ const callbacks$1 = [];
24
+ /**
25
+ * Registrations that have already occurred.
26
+ *
27
+ * Note that Registrations are maintained as a list rather than a map to allow
28
+ * the same id to be registered multiple times with potentially different
29
+ * data.
30
+ */
31
+ const registrations = [];
32
+ /**
33
+ * Invokes callback for each Registration, both past & future. That is, callback
34
+ * will be invoked exactly as many times as register() is called.
35
+ *
36
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
37
+ * multiple Registrations with the same id is determined by the caller(s) of
38
+ * register().
39
+ */
40
+ function forEachRegistration(callback) {
41
+ callbacks$1.push(callback);
42
+ registrations.forEach((r) => callback(r));
43
+ }
44
+ /**
45
+ * Invokes callback when the specified id is registered.
46
+ *
47
+ * Note that callback may be invoked:
48
+ *
49
+ * - multiple times if multiple calls to register() specify the id
50
+ * - never if the specified id is never registered
51
+ */
52
+ function withRegistration(id, callback) {
53
+ forEachRegistration((r) => {
54
+ if (r.id === id) {
55
+ callback(r);
56
+ }
57
+ });
58
+ }
59
+ /**
60
+ * Register an id and associated data.
61
+ *
62
+ * Callers of register() should make types available that include:
63
+ *
64
+ * - the id they will register
65
+ * - definitions for any additional properties on their Registration objects
66
+ *
67
+ * For example:
68
+ *
69
+ * export type MyRegistration = {
70
+ * id: 'myRegistrationId',
71
+ *
72
+ * // some value that others might need
73
+ * myValue: string,
74
+ *
75
+ * // some function that others might want to call
76
+ * myFunction: () => void,
77
+ * };
78
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
79
+ *
80
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
81
+ * uniqueness of id values.
82
+ *
83
+ * The same id can be registered multiple times with different Registration
84
+ * objects.
85
+ */
86
+ function register(r) {
87
+ registrations.push(r);
88
+ callbacks$1.forEach((callback) => callback(r));
89
+ }
90
+
91
+ /*
92
+ * Copyright (c) 2022, Salesforce, Inc.,
93
+ * All rights reserved.
94
+ * For full license text, see the LICENSE.txt file
95
+ */
96
+ // most recently set default Luvio instance
97
+ let defaultLuvio;
98
+ // callbacks to be invoked when default luvio instance is set/changed
99
+ let callbacks = [];
100
+ /**
101
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
102
+ * is overwritten.
103
+ */
104
+ function setDefaultLuvio(params) {
105
+ const newLuvio = 'luvio' in params
106
+ ? params.luvio
107
+ : 'environment' in params
108
+ ? new engine.Luvio(params.environment)
109
+ : 'networkAdapter' in params
110
+ ? new engine.Luvio(new engine.Environment(params.store || new engine.InMemoryStore(), params.networkAdapter))
111
+ : undefined;
112
+ if (newLuvio === undefined) {
113
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
114
+ throw new Error('unable to construct default Luvio instance from supplied parameters');
115
+ }
116
+ defaultLuvio = newLuvio;
117
+ // inform observers
118
+ for (let i = 0; i < callbacks.length; ++i) {
119
+ callbacks[i](defaultLuvio);
120
+ }
121
+ }
122
+ /**
123
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
124
+ * callback may be invoked multiple times if the default Luvio changes.
125
+ *
126
+ * @param callback callback to be invoked with default Luvio instance
127
+ */
128
+ function withDefaultLuvio(callback) {
129
+ if (defaultLuvio) {
130
+ callback(defaultLuvio);
131
+ }
132
+ callbacks.push(callback);
133
+ }
134
+
135
+ exports.forEachRegistration = forEachRegistration;
136
+ exports.register = register;
137
+ exports.setDefaultLuvio = setDefaultLuvio;
138
+ exports.withDefaultLuvio = withDefaultLuvio;
139
+ exports.withRegistration = withRegistration;
140
+
141
+ Object.defineProperty(exports, '__esModule', { value: true });
142
+
143
+ }));
144
+ // version: 1.93.0-17fd6a260
@@ -0,0 +1,144 @@
1
+ /* *******************************************************************************************
2
+ * ATTENTION!
3
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
4
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
5
+ * Any changes made to this file in p4 will be automatically overwritten.
6
+ * *******************************************************************************************
7
+ */
8
+ /* proxy-compat-disable */
9
+ (function (global, factory) {
10
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
11
+ typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
12
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["lds-default-luvio"] = {}, global.luvioEngine));
13
+ })(this, (function (exports, engine) { 'use strict';
14
+
15
+ /*
16
+ * Copyright (c) 2022, Salesforce, Inc.,
17
+ * All rights reserved.
18
+ * For full license text, see the LICENSE.txt file
19
+ */
20
+ /**
21
+ * Callbacks to be invoked when registrations happen,
22
+ */
23
+ var callbacks$1 = [];
24
+ /**
25
+ * Registrations that have already occurred.
26
+ *
27
+ * Note that Registrations are maintained as a list rather than a map to allow
28
+ * the same id to be registered multiple times with potentially different
29
+ * data.
30
+ */
31
+ var registrations = [];
32
+ /**
33
+ * Invokes callback for each Registration, both past & future. That is, callback
34
+ * will be invoked exactly as many times as register() is called.
35
+ *
36
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
37
+ * multiple Registrations with the same id is determined by the caller(s) of
38
+ * register().
39
+ */
40
+ function forEachRegistration(callback) {
41
+ callbacks$1.push(callback);
42
+ registrations.forEach(function (r) { return callback(r); });
43
+ }
44
+ /**
45
+ * Invokes callback when the specified id is registered.
46
+ *
47
+ * Note that callback may be invoked:
48
+ *
49
+ * - multiple times if multiple calls to register() specify the id
50
+ * - never if the specified id is never registered
51
+ */
52
+ function withRegistration(id, callback) {
53
+ forEachRegistration(function (r) {
54
+ if (r.id === id) {
55
+ callback(r);
56
+ }
57
+ });
58
+ }
59
+ /**
60
+ * Register an id and associated data.
61
+ *
62
+ * Callers of register() should make types available that include:
63
+ *
64
+ * - the id they will register
65
+ * - definitions for any additional properties on their Registration objects
66
+ *
67
+ * For example:
68
+ *
69
+ * export type MyRegistration = {
70
+ * id: 'myRegistrationId',
71
+ *
72
+ * // some value that others might need
73
+ * myValue: string,
74
+ *
75
+ * // some function that others might want to call
76
+ * myFunction: () => void,
77
+ * };
78
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
79
+ *
80
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
81
+ * uniqueness of id values.
82
+ *
83
+ * The same id can be registered multiple times with different Registration
84
+ * objects.
85
+ */
86
+ function register(r) {
87
+ registrations.push(r);
88
+ callbacks$1.forEach(function (callback) { return callback(r); });
89
+ }
90
+
91
+ /*
92
+ * Copyright (c) 2022, Salesforce, Inc.,
93
+ * All rights reserved.
94
+ * For full license text, see the LICENSE.txt file
95
+ */
96
+ // most recently set default Luvio instance
97
+ var defaultLuvio;
98
+ // callbacks to be invoked when default luvio instance is set/changed
99
+ var callbacks = [];
100
+ /**
101
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
102
+ * is overwritten.
103
+ */
104
+ function setDefaultLuvio(params) {
105
+ var newLuvio = 'luvio' in params
106
+ ? params.luvio
107
+ : 'environment' in params
108
+ ? new engine.Luvio(params.environment)
109
+ : 'networkAdapter' in params
110
+ ? new engine.Luvio(new engine.Environment(params.store || new engine.InMemoryStore(), params.networkAdapter))
111
+ : undefined;
112
+ if (newLuvio === undefined) {
113
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
114
+ throw new Error('unable to construct default Luvio instance from supplied parameters');
115
+ }
116
+ defaultLuvio = newLuvio;
117
+ // inform observers
118
+ for (var i = 0; i < callbacks.length; ++i) {
119
+ callbacks[i](defaultLuvio);
120
+ }
121
+ }
122
+ /**
123
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
124
+ * callback may be invoked multiple times if the default Luvio changes.
125
+ *
126
+ * @param callback callback to be invoked with default Luvio instance
127
+ */
128
+ function withDefaultLuvio(callback) {
129
+ if (defaultLuvio) {
130
+ callback(defaultLuvio);
131
+ }
132
+ callbacks.push(callback);
133
+ }
134
+
135
+ exports.forEachRegistration = forEachRegistration;
136
+ exports.register = register;
137
+ exports.setDefaultLuvio = setDefaultLuvio;
138
+ exports.withDefaultLuvio = withDefaultLuvio;
139
+ exports.withRegistration = withRegistration;
140
+
141
+ Object.defineProperty(exports, '__esModule', { value: true });
142
+
143
+ }));
144
+ // version: 1.93.0-17fd6a260
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@salesforce/lds-default-luvio",
3
+ "version": "1.93.0",
4
+ "description": "rendezvous point for producers & consumers of the default luvio instance",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "bugs": "This software is provided as-is with no support provided.",
7
+ "main": "dist/umd/es2018/main.js",
8
+ "module": "dist/es/es2018/main.js",
9
+ "types": "dist/types/src/main.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "LICENSE.txt",
13
+ "sfdc"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/es/es2018/main.js",
18
+ "require": "./dist/umd/es2018/main.js",
19
+ "types": "./dist/types/src/main.d.ts"
20
+ },
21
+ "./sfdc": {
22
+ "types": "./sfdc/ldsEngine.d.ts",
23
+ "import": "./sfdc/ldsEngine.js",
24
+ "default": "./sfdc/ldsEngine.js"
25
+ },
26
+ "./sfdcNoAura": {
27
+ "types": "./sfdc/ldsEngineNoAura.d.ts",
28
+ "import": "./sfdc/ldsEngineNoAura.js",
29
+ "default": "./sfdc/ldsEngineNoAura.js"
30
+ }
31
+ },
32
+ "sfdc": {
33
+ "srcOverride": "sfdc/ldsEngine.js",
34
+ "path": "forcelds/ldsEngine/",
35
+ "publishedFileName": "ldsEngine.js"
36
+ },
37
+ "scripts": {
38
+ "prepare": "yarn build",
39
+ "build": "rollup --config rollup.config.js",
40
+ "clean": "rm -rf dist sfdc",
41
+ "test:unit": "jest",
42
+ "test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
43
+ "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-default-luvio"
44
+ },
45
+ "dependencies": {
46
+ "@luvio/engine": "0.128.0"
47
+ },
48
+ "nx": {
49
+ "targets": {
50
+ "build": {
51
+ "outputs": [
52
+ "packages/lds-default-luvio/dist",
53
+ "packages/lds-default-luvio/sfdc",
54
+ "packages/lds-default-luvio/src/generated"
55
+ ]
56
+ }
57
+ },
58
+ "implicitDependencies": [
59
+ "lds-luvio-engine"
60
+ ]
61
+ }
62
+ }
@@ -0,0 +1 @@
1
+ export * from './sfdc';
@@ -0,0 +1,174 @@
1
+ /* *******************************************************************************************
2
+ * ATTENTION!
3
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
4
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
5
+ * Any changes made to this file in p4 will be automatically overwritten.
6
+ * *******************************************************************************************
7
+ */
8
+ /* proxy-compat-disable */
9
+ import { Luvio, Environment, InMemoryStore } from 'force/luvioEngine';
10
+ export { Environment, GraphNode, HttpStatusCode, InMemoryStore, Luvio, Reader, StoreResolveResultState, adapterToNetworkPriority, buildStaleWhileRevalidateImplementation, coerceAdapterRequestContext, createCustomAdapterEventEmitter, emitAdapterEvent } from 'force/luvioEngine';
11
+ import networkAdapter from 'force/ldsNetwork';
12
+
13
+ /*
14
+ * Copyright (c) 2022, Salesforce, Inc.,
15
+ * All rights reserved.
16
+ * For full license text, see the LICENSE.txt file
17
+ */
18
+ /**
19
+ * Callbacks to be invoked when registrations happen,
20
+ */
21
+ const callbacks$1 = [];
22
+ /**
23
+ * Registrations that have already occurred.
24
+ *
25
+ * Note that Registrations are maintained as a list rather than a map to allow
26
+ * the same id to be registered multiple times with potentially different
27
+ * data.
28
+ */
29
+ const registrations = [];
30
+ /**
31
+ * Invokes callback for each Registration, both past & future. That is, callback
32
+ * will be invoked exactly as many times as register() is called.
33
+ *
34
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
35
+ * multiple Registrations with the same id is determined by the caller(s) of
36
+ * register().
37
+ */
38
+ function forEachRegistration(callback) {
39
+ callbacks$1.push(callback);
40
+ registrations.forEach((r) => callback(r));
41
+ }
42
+ /**
43
+ * Invokes callback when the specified id is registered.
44
+ *
45
+ * Note that callback may be invoked:
46
+ *
47
+ * - multiple times if multiple calls to register() specify the id
48
+ * - never if the specified id is never registered
49
+ */
50
+ function withRegistration(id, callback) {
51
+ forEachRegistration((r) => {
52
+ if (r.id === id) {
53
+ callback(r);
54
+ }
55
+ });
56
+ }
57
+ /**
58
+ * Register an id and associated data.
59
+ *
60
+ * Callers of register() should make types available that include:
61
+ *
62
+ * - the id they will register
63
+ * - definitions for any additional properties on their Registration objects
64
+ *
65
+ * For example:
66
+ *
67
+ * export type MyRegistration = {
68
+ * id: 'myRegistrationId',
69
+ *
70
+ * // some value that others might need
71
+ * myValue: string,
72
+ *
73
+ * // some function that others might want to call
74
+ * myFunction: () => void,
75
+ * };
76
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
77
+ *
78
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
79
+ * uniqueness of id values.
80
+ *
81
+ * The same id can be registered multiple times with different Registration
82
+ * objects.
83
+ */
84
+ function register(r) {
85
+ registrations.push(r);
86
+ callbacks$1.forEach((callback) => callback(r));
87
+ }
88
+
89
+ /*
90
+ * Copyright (c) 2022, Salesforce, Inc.,
91
+ * All rights reserved.
92
+ * For full license text, see the LICENSE.txt file
93
+ */
94
+ // most recently set default Luvio instance
95
+ let defaultLuvio;
96
+ // callbacks to be invoked when default luvio instance is set/changed
97
+ let callbacks = [];
98
+ /**
99
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
100
+ * is overwritten.
101
+ */
102
+ function setDefaultLuvio(params) {
103
+ const newLuvio = 'luvio' in params
104
+ ? params.luvio
105
+ : 'environment' in params
106
+ ? new Luvio(params.environment)
107
+ : 'networkAdapter' in params
108
+ ? new Luvio(new Environment(params.store || new InMemoryStore(), params.networkAdapter))
109
+ : undefined;
110
+ if (newLuvio === undefined) {
111
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
112
+ throw new Error('unable to construct default Luvio instance from supplied parameters');
113
+ }
114
+ defaultLuvio = newLuvio;
115
+ // inform observers
116
+ for (let i = 0; i < callbacks.length; ++i) {
117
+ callbacks[i](defaultLuvio);
118
+ }
119
+ }
120
+ /**
121
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
122
+ * callback may be invoked multiple times if the default Luvio changes.
123
+ *
124
+ * @param callback callback to be invoked with default Luvio instance
125
+ */
126
+ function withDefaultLuvio(callback) {
127
+ if (defaultLuvio) {
128
+ callback(defaultLuvio);
129
+ }
130
+ callbacks.push(callback);
131
+ }
132
+
133
+ /*
134
+ * Copyright (c) 2022, Salesforce, Inc.,
135
+ * All rights reserved.
136
+ * For full license text, see the LICENSE.txt file
137
+ */
138
+ // The code in lds-runtime-aura (force/ldsEngineCreator) depends on Aura module
139
+ // services to invoke its LDS initialization logic. Unfortunately, Aura component
140
+ // tests do not support module services and have no analogous function. The net
141
+ // result is that LDS is never initialized in the iframe that loads the Aura
142
+ // component test & any attempts to create an LWC component that uses an LDS
143
+ // adapter fail because the wire adapter constructors are undefined (W-9233247).
144
+ //
145
+ // The code below is the least offensive workaround we could come up with. When
146
+ // this code (force/ldsEngine) is loaded via static imports in an Aura component
147
+ // test iframe, it will perform a minimal initialization of LDS that allows
148
+ // the test to run and access data on the server. The instrumentation and
149
+ // configuration initialization steps from lds-runtime-aura are skipped to
150
+ // keep the logic simpler & faster.
151
+ //
152
+ // For future reference, here are the values we see from getApp():
153
+ //
154
+ // - for a regular .app, the name of the app, e.g. "one:one"
155
+ // - for the top-level iframe of a .app loaded in JSTEST mode, "aurajstest:jstest"
156
+ // - for the top-level iframe of a .cmp loaded in JSTEST mode, undefined
157
+ // - for a test iframe of a .cmp or .app test loaded via
158
+ // /auratest/test.app?testName=..&aura.mode=AUTOJSTEST, undefined
159
+ // - for a test iframe loaded via /aura?... (no clue where/how these are
160
+ // generated), undefined
161
+ if (typeof $A !== 'undefined' &&
162
+ $A.getContext().getMode().indexOf('AUTOJSTEST') > -1 &&
163
+ $A.getContext().getApp() === undefined) {
164
+ const storeOptions = {
165
+ scheduler: () => { },
166
+ };
167
+ const store = new InMemoryStore(storeOptions);
168
+ const environment = new Environment(store, networkAdapter);
169
+ const luvio = new Luvio(environment);
170
+ setDefaultLuvio({ luvio });
171
+ }
172
+
173
+ export { forEachRegistration, register, setDefaultLuvio, withDefaultLuvio, withRegistration };
174
+ // version: 1.93.0-17fd6a260
@@ -0,0 +1 @@
1
+ export * from './main';
@@ -0,0 +1,132 @@
1
+ /* *******************************************************************************************
2
+ * ATTENTION!
3
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
4
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
5
+ * Any changes made to this file in p4 will be automatically overwritten.
6
+ * *******************************************************************************************
7
+ */
8
+ /* proxy-compat-disable */
9
+ import { Luvio, Environment, InMemoryStore } from 'force/luvioEngine';
10
+
11
+ /*
12
+ * Copyright (c) 2022, Salesforce, Inc.,
13
+ * All rights reserved.
14
+ * For full license text, see the LICENSE.txt file
15
+ */
16
+ /**
17
+ * Callbacks to be invoked when registrations happen,
18
+ */
19
+ const callbacks$1 = [];
20
+ /**
21
+ * Registrations that have already occurred.
22
+ *
23
+ * Note that Registrations are maintained as a list rather than a map to allow
24
+ * the same id to be registered multiple times with potentially different
25
+ * data.
26
+ */
27
+ const registrations = [];
28
+ /**
29
+ * Invokes callback for each Registration, both past & future. That is, callback
30
+ * will be invoked exactly as many times as register() is called.
31
+ *
32
+ * Note that Registration ids are not guaranteed to be unique. The meaning of
33
+ * multiple Registrations with the same id is determined by the caller(s) of
34
+ * register().
35
+ */
36
+ function forEachRegistration(callback) {
37
+ callbacks$1.push(callback);
38
+ registrations.forEach((r) => callback(r));
39
+ }
40
+ /**
41
+ * Invokes callback when the specified id is registered.
42
+ *
43
+ * Note that callback may be invoked:
44
+ *
45
+ * - multiple times if multiple calls to register() specify the id
46
+ * - never if the specified id is never registered
47
+ */
48
+ function withRegistration(id, callback) {
49
+ forEachRegistration((r) => {
50
+ if (r.id === id) {
51
+ callback(r);
52
+ }
53
+ });
54
+ }
55
+ /**
56
+ * Register an id and associated data.
57
+ *
58
+ * Callers of register() should make types available that include:
59
+ *
60
+ * - the id they will register
61
+ * - definitions for any additional properties on their Registration objects
62
+ *
63
+ * For example:
64
+ *
65
+ * export type MyRegistration = {
66
+ * id: 'myRegistrationId',
67
+ *
68
+ * // some value that others might need
69
+ * myValue: string,
70
+ *
71
+ * // some function that others might want to call
72
+ * myFunction: () => void,
73
+ * };
74
+ * register({ id: 'myRegistrationId', myValue: 'foo', myFunction: () => {} } as MyRegistration);
75
+ *
76
+ * The registry itself does not dictate the format of ids nor attempt to coordinate
77
+ * uniqueness of id values.
78
+ *
79
+ * The same id can be registered multiple times with different Registration
80
+ * objects.
81
+ */
82
+ function register(r) {
83
+ registrations.push(r);
84
+ callbacks$1.forEach((callback) => callback(r));
85
+ }
86
+
87
+ /*
88
+ * Copyright (c) 2022, Salesforce, Inc.,
89
+ * All rights reserved.
90
+ * For full license text, see the LICENSE.txt file
91
+ */
92
+ // most recently set default Luvio instance
93
+ let defaultLuvio;
94
+ // callbacks to be invoked when default luvio instance is set/changed
95
+ let callbacks = [];
96
+ /**
97
+ * Constructs/sets the default Luvio instance. Any previously-set default luvio instance
98
+ * is overwritten.
99
+ */
100
+ function setDefaultLuvio(params) {
101
+ const newLuvio = 'luvio' in params
102
+ ? params.luvio
103
+ : 'environment' in params
104
+ ? new Luvio(params.environment)
105
+ : 'networkAdapter' in params
106
+ ? new Luvio(new Environment(params.store || new InMemoryStore(), params.networkAdapter))
107
+ : undefined;
108
+ if (newLuvio === undefined) {
109
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
110
+ throw new Error('unable to construct default Luvio instance from supplied parameters');
111
+ }
112
+ defaultLuvio = newLuvio;
113
+ // inform observers
114
+ for (let i = 0; i < callbacks.length; ++i) {
115
+ callbacks[i](defaultLuvio);
116
+ }
117
+ }
118
+ /**
119
+ * Registers a callback to be invoked with the default Luvio instance. Note that the
120
+ * callback may be invoked multiple times if the default Luvio changes.
121
+ *
122
+ * @param callback callback to be invoked with default Luvio instance
123
+ */
124
+ function withDefaultLuvio(callback) {
125
+ if (defaultLuvio) {
126
+ callback(defaultLuvio);
127
+ }
128
+ callbacks.push(callback);
129
+ }
130
+
131
+ export { forEachRegistration, register, setDefaultLuvio, withDefaultLuvio, withRegistration };
132
+ // version: 1.93.0-17fd6a260
package/sfdc/main.d.ts ADDED
@@ -0,0 +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 declare 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 declare 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';
@@ -0,0 +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 declare type Registration = {
7
+ id: string;
8
+ };
9
+ /**
10
+ * Callback used to inform interested parties that something has been registered.
11
+ */
12
+ export declare 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;
package/sfdc/sfdc.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './main';
2
+ export { Environment, GraphNode, HttpStatusCode, InMemoryStore, Luvio, Reader, StoreResolveResultState, adapterToNetworkPriority, buildStaleWhileRevalidateImplementation, coerceAdapterRequestContext, createCustomAdapterEventEmitter, emitAdapterEvent, } from '@luvio/engine';