@lwc/wire-service 8.28.2 → 9.0.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
@@ -23,7 +23,7 @@
23
23
  function isUndefined(obj) {
24
24
  return obj === undefined;
25
25
  }
26
- /** version: 8.28.2 */
26
+ /** version: 9.0.0 */
27
27
 
28
28
  /*
29
29
  * Copyright (c) 2024, Salesforce, Inc.
@@ -202,5 +202,5 @@ class LegacyWireAdapterBridge {
202
202
  }
203
203
 
204
204
  export { ValueChangedEvent, register, registerWireService };
205
- /** version: 8.28.2 */
205
+ /** version: 9.0.0 */
206
206
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/wire-service",
7
- "version": "8.28.2",
7
+ "version": "9.0.0",
8
8
  "description": "@wire service",
9
9
  "keywords": [
10
10
  "lwc"
@@ -19,13 +19,17 @@
19
19
  "url": "https://github.com/salesforce/lwc/issues"
20
20
  },
21
21
  "license": "MIT",
22
+ "type": "module",
22
23
  "publishConfig": {
23
24
  "access": "public"
24
25
  },
26
+ "engines": {
27
+ "node": ">=16.6.0"
28
+ },
25
29
  "volta": {
26
30
  "extends": "../../../package.json"
27
31
  },
28
- "main": "dist/index.cjs.js",
32
+ "main": "dist/index.js",
29
33
  "module": "dist/index.js",
30
34
  "types": "dist/index.d.ts",
31
35
  "files": [
@@ -46,8 +50,8 @@
46
50
  }
47
51
  },
48
52
  "devDependencies": {
49
- "@lwc/engine-core": "8.28.2",
50
- "@lwc/shared": "8.28.2"
53
+ "@lwc/engine-core": "9.0.0",
54
+ "@lwc/shared": "9.0.0"
51
55
  },
52
56
  "lwc": {
53
57
  "modules": [
package/dist/index.cjs.js DELETED
@@ -1,212 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 Salesforce, Inc.
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- /**
9
- * Copyright (c) 2026 Salesforce, Inc.
10
- */
11
- /*
12
- * Copyright (c) 2018, salesforce.com, inc.
13
- * All rights reserved.
14
- * SPDX-License-Identifier: MIT
15
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
16
- */
17
- /**
18
- *
19
- * @param value
20
- * @param msg
21
- */
22
- /**
23
- * Determines whether the argument is `undefined`.
24
- * @param obj Value to test
25
- * @returns `true` if the value is `undefined`.
26
- */
27
- function isUndefined(obj) {
28
- return obj === undefined;
29
- }
30
- /** version: 8.28.2 */
31
-
32
- /*
33
- * Copyright (c) 2024, Salesforce, Inc.
34
- * All rights reserved.
35
- * SPDX-License-Identifier: MIT
36
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
37
- */
38
- const ValueChangedEventType = 'ValueChangedEvent';
39
- /**
40
- * Event fired by wire adapters to emit a new value.
41
- */
42
- class ValueChangedEvent {
43
- constructor(value) {
44
- this.type = ValueChangedEventType;
45
- this.value = value;
46
- }
47
- }
48
-
49
- /*
50
- * Copyright (c) 2018, salesforce.com, inc.
51
- * All rights reserved.
52
- * SPDX-License-Identifier: MIT
53
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
54
- */
55
- const { freeze, defineProperty, isExtensible } = Object;
56
- // This value needs to be in sync with wiring.ts from @lwc/engine-core
57
- const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
58
- const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
59
- /**
60
- * Registers a wire adapter factory for Lightning Platform.
61
- * @param adapterId Adapter ID object
62
- * @param adapterEventTargetCallback Adapter factory function
63
- * @throws when parameters are not valid
64
- * @deprecated
65
- */
66
- function register(adapterId, adapterEventTargetCallback) {
67
- if (adapterId == null || !isExtensible(adapterId)) {
68
- throw new TypeError('adapter id must be extensible');
69
- }
70
- if (typeof adapterEventTargetCallback !== 'function') {
71
- throw new TypeError('adapter factory must be a callable');
72
- }
73
- if ('adapter' in adapterId) {
74
- throw new TypeError('adapter id is already associated to an adapter factory');
75
- }
76
- const AdapterClass = class extends LegacyWireAdapterBridge {
77
- constructor(dataCallback) {
78
- super(dataCallback);
79
- adapterEventTargetCallback(this.eventTarget);
80
- }
81
- };
82
- freeze(AdapterClass);
83
- freeze(AdapterClass.prototype);
84
- defineProperty(adapterId, 'adapter', {
85
- writable: false,
86
- configurable: false,
87
- value: AdapterClass,
88
- });
89
- }
90
- /**
91
- * Registers the wire service. noop
92
- * @deprecated
93
- */
94
- function registerWireService() { }
95
- const { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;
96
- // wire event target life cycle connectedCallback hook event type
97
- const CONNECT = 'connect';
98
- // wire event target life cycle disconnectedCallback hook event type
99
- const DISCONNECT = 'disconnect';
100
- // wire event target life cycle config changed hook event type
101
- const CONFIG = 'config';
102
- function removeListener(listeners, toRemove) {
103
- const idx = ArrayIndexOf.call(listeners, toRemove);
104
- if (idx > -1) {
105
- ArraySplice.call(listeners, idx, 1);
106
- }
107
- }
108
- function isEmptyConfig(config) {
109
- return Object.keys(config).length === 0;
110
- }
111
- function isValidConfig(config, params) {
112
- // The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
113
- return params.length === 0 || params.some((param) => !isUndefined(config[param]));
114
- }
115
- function isDifferentConfig(newConfig, oldConfig, params) {
116
- return params.some((param) => newConfig[param] !== oldConfig[param]);
117
- }
118
- class LegacyWireAdapterBridge {
119
- constructor(callback) {
120
- this.connecting = [];
121
- this.disconnecting = [];
122
- this.configuring = [];
123
- this.isFirstUpdate = true;
124
- this.callback = callback;
125
- this.wiredElementHost = callback[DeprecatedWiredElementHost];
126
- this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
127
- this.eventTarget = {
128
- addEventListener: (type, listener) => {
129
- switch (type) {
130
- case CONNECT: {
131
- this.connecting.push(listener);
132
- break;
133
- }
134
- case DISCONNECT: {
135
- this.disconnecting.push(listener);
136
- break;
137
- }
138
- case CONFIG: {
139
- this.configuring.push(listener);
140
- if (this.currentConfig !== undefined) {
141
- listener.call(undefined, this.currentConfig);
142
- }
143
- break;
144
- }
145
- default:
146
- throw new Error(`Invalid event type ${type}.`);
147
- }
148
- },
149
- removeEventListener: (type, listener) => {
150
- switch (type) {
151
- case CONNECT: {
152
- removeListener(this.connecting, listener);
153
- break;
154
- }
155
- case DISCONNECT: {
156
- removeListener(this.disconnecting, listener);
157
- break;
158
- }
159
- case CONFIG: {
160
- removeListener(this.configuring, listener);
161
- break;
162
- }
163
- default:
164
- throw new Error(`Invalid event type ${type}.`);
165
- }
166
- },
167
- dispatchEvent: (evt) => {
168
- if (evt instanceof ValueChangedEvent) {
169
- const value = evt.value;
170
- this.callback(value);
171
- }
172
- else if (evt.type === 'wirecontextevent') {
173
- // TODO [#1357]: remove this branch
174
- return this.wiredElementHost.dispatchEvent(evt);
175
- }
176
- else {
177
- throw new Error(`Invalid event type ${evt.type}.`);
178
- }
179
- return false; // canceling signal since we don't want this to propagate
180
- },
181
- };
182
- }
183
- update(config) {
184
- if (this.isFirstUpdate) {
185
- // this is a special case for legacy wire adapters: when all the config params are undefined,
186
- // the config on the wire adapter should not be called until one of them changes.
187
- this.isFirstUpdate = false;
188
- if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
189
- return;
190
- }
191
- }
192
- if (isUndefined(this.currentConfig) ||
193
- isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
194
- this.currentConfig = config;
195
- forEach.call(this.configuring, (listener) => {
196
- listener.call(undefined, config);
197
- });
198
- }
199
- }
200
- connect() {
201
- forEach.call(this.connecting, (listener) => listener.call(undefined));
202
- }
203
- disconnect() {
204
- forEach.call(this.disconnecting, (listener) => listener.call(undefined));
205
- }
206
- }
207
-
208
- exports.ValueChangedEvent = ValueChangedEvent;
209
- exports.register = register;
210
- exports.registerWireService = registerWireService;
211
- /** version: 8.28.2 */
212
- //# sourceMappingURL=index.cjs.js.map