@ember-data/tracking 5.4.0-alpha.32 → 5.4.0-alpha.33

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-data/tracking",
3
3
  "description": "Tracking Primitives for controlling change notification of Tracked properties when working with EmberData",
4
- "version": "5.4.0-alpha.32",
4
+ "version": "5.4.0-alpha.33",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "author": "Chris Thoburn <runspired@users.noreply.github.com>",
@@ -27,7 +27,7 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@ember-data/private-build-infra": "5.4.0-alpha.32",
30
+ "@ember-data/private-build-infra": "5.4.0-alpha.33",
31
31
  "@embroider/macros": "^1.13.5",
32
32
  "ember-cached-decorator-polyfill": "^1.0.2",
33
33
  "ember-cli-babel": "^8.2.0",
@@ -63,7 +63,7 @@
63
63
  "@glimmer/validator": "^0.88.1",
64
64
  "@rollup/plugin-babel": "^6.0.4",
65
65
  "@rollup/plugin-node-resolve": "^15.2.3",
66
- "@warp-drive/internal-config": "5.4.0-alpha.32",
66
+ "@warp-drive/internal-config": "5.4.0-alpha.33",
67
67
  "ember-source": "~5.6.0",
68
68
  "rollup": "^4.9.6",
69
69
  "typescript": "^5.3.3",
@@ -1,186 +1,188 @@
1
- /// <reference types="ember-source/types" />
2
- /// <reference types="ember-source/types" />
3
- import { tagForProperty } from '@ember/-internals/metal';
4
- /**
5
- * This package provides primitives that allow powerful low-level
6
- * adjustments to change tracking notification behaviors.
7
- *
8
- * Typically you want to use these primitives when you want to divorce
9
- * property accesses on EmberData provided objects from the current
10
- * tracking context. Typically this sort of thing occurs when serializing
11
- * tracked data to send in a request: the data itself is often ancillary
12
- * to the thing which triggered the request in the first place and you
13
- * would not want to re-trigger the request for any update to the data.
14
- *
15
- * @module @ember-data/tracking
16
- * @main @ember-data/tracking
17
- */
18
- type OpaqueFn = (...args: unknown[]) => unknown;
19
- type Tag = {
20
- ref: null;
21
- t: boolean;
22
- };
23
- /**
24
- * If there is a current transaction, ensures that the relevant tag (and any
25
- * array computed chains symbols, if applicable) will be consumed during the
26
- * transaction.
27
- *
28
- * If there is no current transaction, will consume the tag(s) immediately.
29
- *
30
- * @internal
31
- * @param obj
32
- */
33
- export declare function subscribe(obj: Tag | Signal): void;
34
- export declare function addToTransaction(obj: Tag | Signal): void;
35
- export declare function addTransactionCB(method: OpaqueFn): void;
36
- /**
37
- * Run `method` without subscribing to any tracked properties
38
- * controlled by EmberData.
39
- *
40
- * This should rarely be used except by libraries that really
41
- * know what they are doing. It is most useful for wrapping
42
- * certain kinds of fetch/query logic from within a `Resource`
43
- * `hook` or other similar pattern.
44
- *
45
- * @function untracked
46
- * @public
47
- * @static
48
- * @for @ember-data/tracking
49
- * @param method
50
- * @return result of invoking method
51
- */
52
- export declare function untracked<T extends OpaqueFn>(method: T): ReturnType<T>;
53
- /**
54
- * Run the method, subscribing to any tracked properties
55
- * managed by EmberData that were accessed or written during
56
- * the method's execution as per-normal but while allowing
57
- * interleaving of reads and writes.
58
- *
59
- * This is useful when for instance you want to perform
60
- * a mutation based on existing state that must be read first.
61
- *
62
- * @function transact
63
- * @public
64
- * @static
65
- * @for @ember-data/tracking
66
- * @param method
67
- * @return result of invoking method
68
- */
69
- export declare function transact<T extends OpaqueFn>(method: T): ReturnType<T>;
70
- /**
71
- * A helpful utility for creating a new function that
72
- * always runs in a transaction. E.G. this "memoizes"
73
- * calling `transact(fn)`, currying args as necessary.
74
- *
75
- * @method memoTransact
76
- * @public
77
- * @static
78
- * @for @ember-data/tracking
79
- * @param method
80
- * @return a function that will invoke method in a transaction with any provided args and return its result
81
- */
82
- export declare function memoTransact<T extends OpaqueFn>(method: T): (...args: unknown[]) => ReturnType<T>;
83
- export declare const Signals: unique symbol;
84
- /**
85
- * use to add a signal property to the prototype of something.
86
- *
87
- * First arg is the thing to define on
88
- * Second arg is the property name
89
- * Third agg is the initial value of the property if any.
90
- *
91
- * for instance
92
- *
93
- * ```ts
94
- * class Model {}
95
- * defineSignal(Model.prototype, 'isLoading', false);
96
- * ```
97
- *
98
- * This is sort of like using a stage-3 decorator but works today
99
- * while we are still on legacy decorators.
100
- *
101
- * e.g. it is equivalent to
102
- *
103
- * ```ts
104
- * class Model {
105
- * @signal accessor isLoading = false;
106
- * }
107
- * ```
108
- *
109
- * @internal
110
- */
111
- export declare function defineSignal<T extends object>(obj: T, key: string, v?: unknown): void;
112
- export interface Signal {
113
- /**
114
- * Key on the associated object
115
- * @internal
116
- */
117
- key: string;
118
- _debug_base?: string;
119
- /**
120
- * Whether this signal is part of an active transaction.
121
- * @internal
122
- */
123
- t: boolean;
124
- /**
125
- * Whether to "bust" the lastValue cache
126
- * @internal
127
- */
128
- shouldReset: boolean;
129
- /**
130
- * The framework specific "signal" e.g. glimmer "tracked"
131
- * or starbeam "cell" to consume/invalidate when appropriate.
132
- *
133
- * @internal
134
- */
135
- tag: ReturnType<typeof tagForProperty>;
136
- /**
137
- * In classic ember, arrays must entangle a `[]` symbol
138
- * in addition to any other tag in order for array chains to work.
139
- *
140
- * Note, this symbol MUST be the one that ember itself generates
141
- *
142
- * @internal
143
- */
144
- '[]': ReturnType<typeof tagForProperty> | null;
145
- /**
146
- * In classic ember, arrays must entangle a `@length` symbol
147
- * in addition to any other tag in order for array chains to work.
148
- *
149
- * Note, this symbol MUST be the one that ember itself generates
150
- *
151
- * @internal
152
- */
153
- '@length': ReturnType<typeof tagForProperty> | null;
154
- /**
155
- * The lastValue computed for this signal when
156
- * a signal is also used for storage.
157
- * @internal
158
- */
159
- lastValue: unknown;
160
- }
161
- export declare function createArrayTags<T extends object>(obj: T, signal: Signal): void;
162
- /**
163
- * Create a signal for the key/object pairing.
164
- *
165
- * @internal
166
- * @param obj Object we're creating the signal on
167
- * @param key Key to create the signal for
168
- * @return the signal
169
- */
170
- export declare function createSignal<T extends object>(obj: T, key: string): Signal;
171
- /**
172
- * Create a signal for the key/object pairing and subscribes to the signal.
173
- *
174
- * Use when you need to ensure a signal exists and is subscribed to.
175
- *
176
- * @internal
177
- * @param signals Map of signals
178
- * @param obj Object we're creating the signal on
179
- * @param key Key to create the signal for
180
- * @return the signal
181
- */
182
- export declare function entangleSignal<T extends object>(signals: Map<string, Signal>, obj: T, key: string): Signal;
183
- export declare function getSignal<T extends object>(obj: T, key: string, initialState: boolean): Signal;
184
- export declare function peekSignal<T extends object>(obj: T, key: string): Signal | undefined;
185
- export {};
186
- //# sourceMappingURL=-private.d.ts.map
1
+ declare module '@ember-data/tracking/-private' {
2
+ /// <reference types="ember-source/types" />
3
+ /// <reference types="ember-source/types" />
4
+ import { tagForProperty } from '@ember/-internals/metal';
5
+ /**
6
+ * This package provides primitives that allow powerful low-level
7
+ * adjustments to change tracking notification behaviors.
8
+ *
9
+ * Typically you want to use these primitives when you want to divorce
10
+ * property accesses on EmberData provided objects from the current
11
+ * tracking context. Typically this sort of thing occurs when serializing
12
+ * tracked data to send in a request: the data itself is often ancillary
13
+ * to the thing which triggered the request in the first place and you
14
+ * would not want to re-trigger the request for any update to the data.
15
+ *
16
+ * @module @ember-data/tracking
17
+ * @main @ember-data/tracking
18
+ */
19
+ type OpaqueFn = (...args: unknown[]) => unknown;
20
+ type Tag = {
21
+ ref: null;
22
+ t: boolean;
23
+ };
24
+ /**
25
+ * If there is a current transaction, ensures that the relevant tag (and any
26
+ * array computed chains symbols, if applicable) will be consumed during the
27
+ * transaction.
28
+ *
29
+ * If there is no current transaction, will consume the tag(s) immediately.
30
+ *
31
+ * @internal
32
+ * @param obj
33
+ */
34
+ export declare function subscribe(obj: Tag | Signal): void;
35
+ export declare function addToTransaction(obj: Tag | Signal): void;
36
+ export declare function addTransactionCB(method: OpaqueFn): void;
37
+ /**
38
+ * Run `method` without subscribing to any tracked properties
39
+ * controlled by EmberData.
40
+ *
41
+ * This should rarely be used except by libraries that really
42
+ * know what they are doing. It is most useful for wrapping
43
+ * certain kinds of fetch/query logic from within a `Resource`
44
+ * `hook` or other similar pattern.
45
+ *
46
+ * @function untracked
47
+ * @public
48
+ * @static
49
+ * @for @ember-data/tracking
50
+ * @param method
51
+ * @return result of invoking method
52
+ */
53
+ export declare function untracked<T extends OpaqueFn>(method: T): ReturnType<T>;
54
+ /**
55
+ * Run the method, subscribing to any tracked properties
56
+ * managed by EmberData that were accessed or written during
57
+ * the method's execution as per-normal but while allowing
58
+ * interleaving of reads and writes.
59
+ *
60
+ * This is useful when for instance you want to perform
61
+ * a mutation based on existing state that must be read first.
62
+ *
63
+ * @function transact
64
+ * @public
65
+ * @static
66
+ * @for @ember-data/tracking
67
+ * @param method
68
+ * @return result of invoking method
69
+ */
70
+ export declare function transact<T extends OpaqueFn>(method: T): ReturnType<T>;
71
+ /**
72
+ * A helpful utility for creating a new function that
73
+ * always runs in a transaction. E.G. this "memoizes"
74
+ * calling `transact(fn)`, currying args as necessary.
75
+ *
76
+ * @method memoTransact
77
+ * @public
78
+ * @static
79
+ * @for @ember-data/tracking
80
+ * @param method
81
+ * @return a function that will invoke method in a transaction with any provided args and return its result
82
+ */
83
+ export declare function memoTransact<T extends OpaqueFn>(method: T): (...args: unknown[]) => ReturnType<T>;
84
+ export declare const Signals: unique symbol;
85
+ /**
86
+ * use to add a signal property to the prototype of something.
87
+ *
88
+ * First arg is the thing to define on
89
+ * Second arg is the property name
90
+ * Third agg is the initial value of the property if any.
91
+ *
92
+ * for instance
93
+ *
94
+ * ```ts
95
+ * class Model {}
96
+ * defineSignal(Model.prototype, 'isLoading', false);
97
+ * ```
98
+ *
99
+ * This is sort of like using a stage-3 decorator but works today
100
+ * while we are still on legacy decorators.
101
+ *
102
+ * e.g. it is equivalent to
103
+ *
104
+ * ```ts
105
+ * class Model {
106
+ * @signal accessor isLoading = false;
107
+ * }
108
+ * ```
109
+ *
110
+ * @internal
111
+ */
112
+ export declare function defineSignal<T extends object>(obj: T, key: string, v?: unknown): void;
113
+ export interface Signal {
114
+ /**
115
+ * Key on the associated object
116
+ * @internal
117
+ */
118
+ key: string;
119
+ _debug_base?: string;
120
+ /**
121
+ * Whether this signal is part of an active transaction.
122
+ * @internal
123
+ */
124
+ t: boolean;
125
+ /**
126
+ * Whether to "bust" the lastValue cache
127
+ * @internal
128
+ */
129
+ shouldReset: boolean;
130
+ /**
131
+ * The framework specific "signal" e.g. glimmer "tracked"
132
+ * or starbeam "cell" to consume/invalidate when appropriate.
133
+ *
134
+ * @internal
135
+ */
136
+ tag: ReturnType<typeof tagForProperty>;
137
+ /**
138
+ * In classic ember, arrays must entangle a `[]` symbol
139
+ * in addition to any other tag in order for array chains to work.
140
+ *
141
+ * Note, this symbol MUST be the one that ember itself generates
142
+ *
143
+ * @internal
144
+ */
145
+ '[]': ReturnType<typeof tagForProperty> | null;
146
+ /**
147
+ * In classic ember, arrays must entangle a `@length` symbol
148
+ * in addition to any other tag in order for array chains to work.
149
+ *
150
+ * Note, this symbol MUST be the one that ember itself generates
151
+ *
152
+ * @internal
153
+ */
154
+ '@length': ReturnType<typeof tagForProperty> | null;
155
+ /**
156
+ * The lastValue computed for this signal when
157
+ * a signal is also used for storage.
158
+ * @internal
159
+ */
160
+ lastValue: unknown;
161
+ }
162
+ export declare function createArrayTags<T extends object>(obj: T, signal: Signal): void;
163
+ /**
164
+ * Create a signal for the key/object pairing.
165
+ *
166
+ * @internal
167
+ * @param obj Object we're creating the signal on
168
+ * @param key Key to create the signal for
169
+ * @return the signal
170
+ */
171
+ export declare function createSignal<T extends object>(obj: T, key: string): Signal;
172
+ /**
173
+ * Create a signal for the key/object pairing and subscribes to the signal.
174
+ *
175
+ * Use when you need to ensure a signal exists and is subscribed to.
176
+ *
177
+ * @internal
178
+ * @param signals Map of signals
179
+ * @param obj Object we're creating the signal on
180
+ * @param key Key to create the signal for
181
+ * @return the signal
182
+ */
183
+ export declare function entangleSignal<T extends object>(signals: Map<string, Signal>, obj: T, key: string): Signal;
184
+ export declare function getSignal<T extends object>(obj: T, key: string, initialState: boolean): Signal;
185
+ export declare function peekSignal<T extends object>(obj: T, key: string): Signal | undefined;
186
+ export {};
187
+ //# sourceMappingURL=-private.d.ts.map
188
+ }
@@ -1,8 +1,11 @@
1
- /// <reference types="ember-source/types" />
2
- /// <reference types="ember-source/types" />
3
- import { createCache, getValue } from '@glimmer/tracking/primitives/cache';
4
- export { transact, memoTransact, untracked } from './-private';
5
- export { dependentKeyCompat as compat } from '@ember/object/compat';
6
- export declare function cached<T extends object, K extends keyof T & string>(target: T, key: K, descriptor: PropertyDescriptor): void;
7
- export { createCache, getValue };
8
- //# sourceMappingURL=index.d.ts.map
1
+ /// <reference path="./-private.d.ts" />
2
+ declare module '@ember-data/tracking' {
3
+ /// <reference types="ember-source/types" />
4
+ /// <reference types="ember-source/types" />
5
+ import { createCache, getValue } from '@glimmer/tracking/primitives/cache';
6
+ export { transact, memoTransact, untracked } from '@ember-data/tracking/-private';
7
+ export { dependentKeyCompat as compat } from '@ember/object/compat';
8
+ export declare function cached<T extends object, K extends keyof T & string>(target: T, key: K, descriptor: PropertyDescriptor): void;
9
+ export { createCache, getValue };
10
+ //# sourceMappingURL=index.d.ts.map
11
+ }