@owlmeans/state 0.1.18-rc.8 → 0.1.18
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/README.md +173 -68
- package/agent-meta/manifest.json +3 -3
- package/agent-meta/skills/state/SKILL.md +137 -58
- package/build/consts.local.d.ts +10 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +10 -0
- package/build/consts.local.js.map +1 -0
- package/build/errors.d.ts +12 -5
- package/build/errors.d.ts.map +1 -1
- package/build/errors.js +16 -13
- package/build/errors.js.map +1 -1
- package/build/helper.d.ts +16 -0
- package/build/helper.d.ts.map +1 -0
- package/build/helper.js +14 -0
- package/build/helper.js.map +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/resource.d.ts +12 -5
- package/build/resource.d.ts.map +1 -1
- package/build/resource.js +317 -207
- package/build/resource.js.map +1 -1
- package/build/types.d.ts +91 -50
- package/build/types.d.ts.map +1 -1
- package/build/types.local.d.ts +15 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/build/utils/criteria.d.ts.map +1 -1
- package/build/utils/criteria.js.map +1 -1
- package/build/utils/model.d.ts +10 -2
- package/build/utils/model.d.ts.map +1 -1
- package/build/utils/model.js +26 -22
- package/build/utils/model.js.map +1 -1
- package/build/utils/types.d.ts +15 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -0
- package/build/utils/types.js.map +1 -0
- package/package.json +4 -4
- package/src/consts.local.ts +11 -0
- package/src/errors.ts +16 -13
- package/src/helper.ts +17 -0
- package/src/index.ts +3 -2
- package/src/resource.ts +359 -241
- package/src/types.local.ts +16 -0
- package/src/types.ts +98 -55
- package/src/utils/model.ts +35 -28
- package/src/utils/types.ts +15 -0
- package/tests/resource.spec.ts +347 -90
- package/build/.gitkeep +0 -0
- package/src/consts.ts +0 -3
- package/src/utils/criteria.ts +0 -252
- package/src/utils/index.ts +0 -3
- package/tests/criteria.spec.ts +0 -121
package/build/resource.js
CHANGED
|
@@ -1,263 +1,373 @@
|
|
|
1
1
|
import { appendContextual } from '@owlmeans/context';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { DEFAULT_ALIAS, DEFAULT_ID } from './consts';
|
|
5
|
-
import { StateListenerError } from './errors.js';
|
|
2
|
+
import { RecordExists, recordQueryHelper, UnknownRecordError, UnsupportedArgumentError } from '@owlmeans/resource';
|
|
3
|
+
import { StateConfigError } from './errors.js';
|
|
6
4
|
import { createStateModel } from './utils/model.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
5
|
+
import { CHANGES, SOLE, STATE } from './consts.local.js';
|
|
6
|
+
/** Milliseconds until a subscription expires: a number is seconds from now, a Date the instant. */
|
|
7
|
+
const expiresIn = (ttl) => ttl instanceof Date ? ttl.getTime() - Date.now() : ttl * 1000;
|
|
8
|
+
export const createStateResource = (alias = STATE, cfg) => {
|
|
9
|
+
const config = { ...cfg };
|
|
10
|
+
const idField = (config.id ?? 'id');
|
|
11
|
+
const single = config.single === true;
|
|
12
|
+
const store = new Map();
|
|
13
|
+
/** One registry per kind of subscriber: a key, a query, and the change stream. */
|
|
14
|
+
const watchers = new Map();
|
|
15
|
+
const queries = new Set();
|
|
16
|
+
const subscribers = new Set();
|
|
17
|
+
/**
|
|
18
|
+
* The model handed out for a key, kept until the record behind it is replaced. React compares
|
|
19
|
+
* snapshots by reference, so rebuilding a model on every unrelated write would re-render every
|
|
20
|
+
* screen bound to the store.
|
|
21
|
+
*/
|
|
22
|
+
const models = new Map();
|
|
23
|
+
const records = () => [...store.values()];
|
|
24
|
+
/**
|
|
25
|
+
* The key a record is filed under.
|
|
26
|
+
*
|
|
27
|
+
* @throws {StateConfigError} `NoId` — nothing here mints ids, so a record without one is
|
|
28
|
+
* misfiled rather than new.
|
|
29
|
+
*/
|
|
30
|
+
const keyOf = (record) => {
|
|
31
|
+
if (single) {
|
|
32
|
+
return SOLE;
|
|
33
|
+
}
|
|
34
|
+
const id = record[idField];
|
|
35
|
+
if (typeof id !== 'string' || id === '') {
|
|
36
|
+
throw new StateConfigError(StateConfigError.NoId);
|
|
37
|
+
}
|
|
38
|
+
return id;
|
|
19
39
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The key an id addresses.
|
|
42
|
+
*
|
|
43
|
+
* @throws {StateConfigError} `NonSingle` — an absent id on a resource that holds many records.
|
|
44
|
+
*/
|
|
45
|
+
const keyFor = (id) => {
|
|
46
|
+
if (id == null) {
|
|
47
|
+
if (!single) {
|
|
48
|
+
throw new StateConfigError(StateConfigError.NonSingle);
|
|
26
49
|
}
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
return SOLE;
|
|
51
|
+
}
|
|
52
|
+
return single ? SOLE : id;
|
|
53
|
+
};
|
|
54
|
+
/** The key a record already in the store is filed under — its id is known to be there. */
|
|
55
|
+
const storedKey = (record) => single ? SOLE : record[idField];
|
|
56
|
+
/**
|
|
57
|
+
* A read by id. On a single resource the one record answers only to its own id, so asking for
|
|
58
|
+
* a different one is a miss rather than the sole record under a wrong name.
|
|
59
|
+
*/
|
|
60
|
+
const read = (id) => {
|
|
61
|
+
const record = store.get(keyFor(id));
|
|
62
|
+
if (record == null) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const own = record[idField];
|
|
66
|
+
if (single && own != null && own !== id) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return record;
|
|
70
|
+
};
|
|
71
|
+
const first = (idOrWhere, opts) => typeof idOrWhere === 'string' ? read(idOrWhere) : recordQueryHelper.firstMatch(records(), idOrWhere, opts);
|
|
72
|
+
/** The store keeps no expiring records, so a ttl would be silently dropped. */
|
|
73
|
+
const refuseTtl = (opts) => {
|
|
74
|
+
if (opts?.ttl != null) {
|
|
75
|
+
throw new UnsupportedArgumentError('ttl');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const modelFor = (key) => {
|
|
79
|
+
const record = store.get(key);
|
|
80
|
+
const cached = models.get(key);
|
|
81
|
+
if (cached != null && cached.from === record) {
|
|
82
|
+
return cached.model;
|
|
83
|
+
}
|
|
84
|
+
const id = record?.[idField] ?? (key === SOLE ? undefined : key);
|
|
85
|
+
const model = createStateModel({
|
|
86
|
+
id,
|
|
87
|
+
record,
|
|
88
|
+
default: config.default,
|
|
89
|
+
write: async (value) => {
|
|
90
|
+
const next = { ...value };
|
|
91
|
+
if (!single) {
|
|
92
|
+
next[idField] = key;
|
|
37
93
|
}
|
|
94
|
+
return write(key, next);
|
|
95
|
+
},
|
|
96
|
+
drop: async () => {
|
|
97
|
+
const removed = store.get(key);
|
|
98
|
+
if (removed == null) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
store.delete(key);
|
|
102
|
+
notify('remove', [[key, removed]]);
|
|
38
103
|
}
|
|
39
104
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
delete systemToListeners[key];
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
});
|
|
105
|
+
models.set(key, { from: record, model });
|
|
106
|
+
return model;
|
|
47
107
|
};
|
|
48
|
-
const _queryModels = (query) => filterRecords(Object.values(store), query).map(record => createStateModel(record, resource));
|
|
49
108
|
/**
|
|
50
|
-
*
|
|
109
|
+
* The model for "nothing is addressed yet" — one instance, reused.
|
|
51
110
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
111
|
+
* It must be the SAME reference every time: a React subscriber compares snapshots by identity,
|
|
112
|
+
* and a freshly built model would read as a change on every render and loop. Writing through it
|
|
113
|
+
* is refused rather than silently dropped, because a caller that writes without an id has lost
|
|
114
|
+
* track of which record it meant.
|
|
55
115
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
116
|
+
let blank;
|
|
117
|
+
const emptyModel = () => blank ??= createStateModel({
|
|
118
|
+
id: undefined,
|
|
119
|
+
record: undefined,
|
|
120
|
+
default: config.default,
|
|
121
|
+
write: async () => { throw new StateConfigError(StateConfigError.NoId); },
|
|
122
|
+
drop: async () => { throw new StateConfigError(StateConfigError.NoId); }
|
|
123
|
+
});
|
|
124
|
+
const queryModels = (watch) => recordQueryHelper.sortRecords(recordQueryHelper.filterRecords(records(), watch.where), watch.opts?.sort)
|
|
125
|
+
.map(record => modelFor(storedKey(record)));
|
|
126
|
+
const same = (left, right) => left.length === right.length && left.every((model, index) => model === right[index]);
|
|
127
|
+
/** Deliver on one channel. Returns what the handlers gave back, for a caller that awaits. */
|
|
128
|
+
const deliver = (event, channel) => {
|
|
129
|
+
const delivered = [];
|
|
130
|
+
for (const subscription of [...subscribers]) {
|
|
131
|
+
if (subscription.channel !== channel) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (subscription.once) {
|
|
135
|
+
subscribers.delete(subscription);
|
|
136
|
+
if (subscription.timer != null) {
|
|
137
|
+
clearTimeout(subscription.timer);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
delivered.push(subscription.handler(event));
|
|
59
141
|
}
|
|
142
|
+
return delivered;
|
|
60
143
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Tell everyone what changed. Key watchers hear only about their own record; every live query
|
|
146
|
+
* is re-evaluated, because a write can move a record into a set it was not in and deciding
|
|
147
|
+
* whether it did is the same work as re-running the query.
|
|
148
|
+
*/
|
|
149
|
+
const notify = (type, changed) => {
|
|
150
|
+
if (changed.length < 1) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
for (const [key] of changed) {
|
|
154
|
+
const listeners = watchers.get(key);
|
|
155
|
+
if (listeners == null) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const model = modelFor(key);
|
|
159
|
+
for (const listener of [...listeners]) {
|
|
160
|
+
listener(model);
|
|
161
|
+
}
|
|
64
162
|
}
|
|
65
|
-
for (const
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
systemToListeners[key](ids.map(id => createStateModel(store[id], resource)), key);
|
|
163
|
+
for (const watch of [...queries]) {
|
|
164
|
+
const current = queryModels(watch);
|
|
165
|
+
if (same(watch.last, current)) {
|
|
166
|
+
continue;
|
|
70
167
|
}
|
|
168
|
+
watch.last = current;
|
|
169
|
+
watch.listener(current);
|
|
71
170
|
}
|
|
171
|
+
deliver({ type, records: changed.map(([, record]) => record) }, CHANGES);
|
|
172
|
+
/**
|
|
173
|
+
* A key nobody watches and nothing is stored under has no model worth keeping — otherwise the
|
|
174
|
+
* cache grows with every record the store ever held. A watched key keeps its entry, so an
|
|
175
|
+
* empty model stays the same object and a screen bound to a deleted record does not re-render
|
|
176
|
+
* on every unrelated write.
|
|
177
|
+
*/
|
|
178
|
+
for (const [key] of changed) {
|
|
179
|
+
if (!store.has(key) && !watchers.has(key)) {
|
|
180
|
+
models.delete(key);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const write = (key, record) => {
|
|
185
|
+
const value = { ...record };
|
|
186
|
+
store.set(key, value);
|
|
187
|
+
notify('set', [[key, value]]);
|
|
188
|
+
return value;
|
|
72
189
|
};
|
|
73
190
|
const resource = appendContextual(alias, {
|
|
74
|
-
|
|
75
|
-
|
|
191
|
+
config,
|
|
192
|
+
get: async (idOrWhere, opts) => {
|
|
193
|
+
const record = first(idOrWhere, opts);
|
|
76
194
|
if (record == null) {
|
|
77
|
-
throw new UnknownRecordError(
|
|
195
|
+
throw new UnknownRecordError(typeof idOrWhere === 'string' ? idOrWhere : 'criteria');
|
|
78
196
|
}
|
|
79
197
|
return record;
|
|
80
198
|
},
|
|
81
|
-
load: async (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
throw new UnsupportedArgumentError(`${location}:get:opts`);
|
|
199
|
+
load: async (idOrWhere, opts) => first(idOrWhere, opts),
|
|
200
|
+
/** Unpaged unless a size is asked for: a screen reading the store expects all of it. */
|
|
201
|
+
list: async (where, opts) => {
|
|
202
|
+
if (opts?.page != null && opts.size == null) {
|
|
203
|
+
throw new UnsupportedArgumentError('page-without-size');
|
|
87
204
|
}
|
|
88
|
-
|
|
89
|
-
if (record == null) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return record;
|
|
93
|
-
},
|
|
94
|
-
/**
|
|
95
|
-
* The `Resource` list contract, criteria and pager included.
|
|
96
|
-
*
|
|
97
|
-
* The default page size is 0 — meaning UNPAGED — rather than the ten a server resource
|
|
98
|
-
* defaults to. Every existing caller of a state resource writes `list()` and expects the
|
|
99
|
-
* whole store back; silently returning the first ten would be a truncation nothing reports.
|
|
100
|
-
* Pagination happens when a pager is actually asked for.
|
|
101
|
-
*/
|
|
102
|
-
list: async (criteria, opts) => {
|
|
103
|
-
const options = prepareListOptions(0, criteria, opts);
|
|
104
|
-
const matched = sortRecords(filterRecords(Object.values(store), options.criteria), options.pager?.sort);
|
|
105
|
-
const size = options.pager?.size ?? 0;
|
|
106
|
-
const page = options.pager?.page ?? 0;
|
|
107
|
-
const items = size > 0 ? matched.slice(page * size, page * size + size) : matched;
|
|
108
|
-
const result = {
|
|
109
|
-
items,
|
|
110
|
-
pager: { ...options.pager, total: matched.length }
|
|
111
|
-
};
|
|
112
|
-
return result;
|
|
113
|
-
},
|
|
114
|
-
all: async () => Object.values(store),
|
|
115
|
-
match: async (criteria) => filterRecords(Object.values(store), criteria),
|
|
116
|
-
save: async (record, opts) => {
|
|
117
|
-
const id = record.id ?? DEFAULT_ID;
|
|
118
|
-
if (store[id] != null) {
|
|
119
|
-
return resource.update(record, opts);
|
|
120
|
-
}
|
|
121
|
-
return resource.create(record, opts);
|
|
205
|
+
return recordQueryHelper.applyQuery(records(), where, opts);
|
|
122
206
|
},
|
|
207
|
+
count: async (where) => recordQueryHelper.filterRecords(records(), where).length,
|
|
123
208
|
create: async (record, opts) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
throw new RecordExists(record.id);
|
|
209
|
+
refuseTtl(opts);
|
|
210
|
+
const key = keyOf(record);
|
|
211
|
+
if (store.has(key)) {
|
|
212
|
+
throw new RecordExists(key === SOLE ? alias : key);
|
|
129
213
|
}
|
|
130
|
-
|
|
131
|
-
throw new UnsupportedArgumentError(`${location}:create:opts`);
|
|
132
|
-
}
|
|
133
|
-
store[record.id] = record;
|
|
134
|
-
_notifyListeners(store[record.id]);
|
|
135
|
-
_notifyGlobalListeners([store[record.id]]);
|
|
136
|
-
_notifyQueryListeners();
|
|
137
|
-
return record;
|
|
214
|
+
return write(key, record);
|
|
138
215
|
},
|
|
216
|
+
/** Replaces the stored record rather than merging into it, as the contract says. */
|
|
139
217
|
update: async (record, opts) => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
record.id = DEFAULT_ID;
|
|
218
|
+
refuseTtl(opts);
|
|
219
|
+
const key = keyOf(record);
|
|
220
|
+
if (!store.has(key)) {
|
|
221
|
+
throw new UnknownRecordError(key === SOLE ? alias : key);
|
|
145
222
|
}
|
|
146
|
-
|
|
147
|
-
if (reference == null) {
|
|
148
|
-
throw new UnknownRecordError(record.id);
|
|
149
|
-
}
|
|
150
|
-
Object.assign(reference, record);
|
|
151
|
-
_notifyListeners(reference);
|
|
152
|
-
_notifyGlobalListeners([reference]);
|
|
153
|
-
_notifyQueryListeners();
|
|
154
|
-
return reference;
|
|
223
|
+
return write(key, record);
|
|
155
224
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const record =
|
|
225
|
+
save: async (record, opts) => {
|
|
226
|
+
refuseTtl(opts);
|
|
227
|
+
return write(keyOf(record), record);
|
|
228
|
+
},
|
|
229
|
+
delete: async (id) => {
|
|
230
|
+
const record = read(id);
|
|
162
231
|
if (record == null) {
|
|
163
232
|
return null;
|
|
164
233
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
delete store[_id];
|
|
169
|
-
_notifyListeners(record);
|
|
170
|
-
_notifyGlobalListeners([record]);
|
|
171
|
-
_notifyQueryListeners();
|
|
234
|
+
const key = keyFor(id);
|
|
235
|
+
store.delete(key);
|
|
236
|
+
notify('remove', [[key, record]]);
|
|
172
237
|
return record;
|
|
173
238
|
},
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
if (_id == null) {
|
|
177
|
-
throw new MisshapedRecord('id');
|
|
178
|
-
}
|
|
179
|
-
const record = await resource.delete(_id, opts);
|
|
239
|
+
take: async (id) => {
|
|
240
|
+
const record = await resource.delete(id);
|
|
180
241
|
if (record == null) {
|
|
181
|
-
throw new UnknownRecordError(
|
|
242
|
+
throw new UnknownRecordError(id);
|
|
182
243
|
}
|
|
183
244
|
return record;
|
|
184
245
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* on top of one: it creates no placeholder record, and its answer is a set that changes
|
|
189
|
-
* membership rather than a fixed list of records that change content. `id` wins when both
|
|
190
|
-
* are given, so an existing caller that happens to pass a query keeps its behaviour.
|
|
191
|
-
*/
|
|
192
|
-
if (params.query != null && params.id == null) {
|
|
193
|
-
const subscription = { query: params.query, listener: params.listener };
|
|
194
|
-
const models = _queryModels(params.query);
|
|
195
|
-
if (params._systemId != null) {
|
|
196
|
-
const key = `${params._systemId}:query:${JSON.stringify(params.query)}`;
|
|
197
|
-
if (systemToQueries[key] != null) {
|
|
198
|
-
return [_usubscribe(params), models];
|
|
199
|
-
}
|
|
200
|
-
subscription.systemId = key;
|
|
201
|
-
systemToQueries[key] = subscription;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
if (listenerToQuery.has(params.listener)) {
|
|
205
|
-
throw new StateListenerError('subscribed');
|
|
206
|
-
}
|
|
207
|
-
listenerToQuery.set(params.listener, subscription);
|
|
208
|
-
}
|
|
209
|
-
return [_usubscribe(params), models];
|
|
246
|
+
purge: async (where) => {
|
|
247
|
+
if (where == null || Object.keys(where).length < 1) {
|
|
248
|
+
throw new UnsupportedArgumentError('purge:empty-criteria');
|
|
210
249
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
store[id] = { ...params.default, id };
|
|
216
|
-
}
|
|
217
|
-
return createStateModel(store[id], resource);
|
|
218
|
-
});
|
|
219
|
-
if (params._systemId != null) {
|
|
220
|
-
const key = `${params._systemId}:${ids.join(",")}`;
|
|
221
|
-
if (systemToListeners[key] != null) {
|
|
222
|
-
return [_usubscribe(params), records];
|
|
223
|
-
}
|
|
224
|
-
systemToListeners[key] = params.listener;
|
|
250
|
+
const removed = recordQueryHelper.filterRecords(records(), where)
|
|
251
|
+
.map((record) => [storedKey(record), record]);
|
|
252
|
+
for (const [key] of removed) {
|
|
253
|
+
store.delete(key);
|
|
225
254
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
255
|
+
notify('remove', removed);
|
|
256
|
+
return removed.length;
|
|
257
|
+
},
|
|
258
|
+
/**
|
|
259
|
+
* The store is rewritten before anything is told about it, so a subscriber never sees the
|
|
260
|
+
* half-applied set. On a `single` resource every record lands in the one slot, which means a
|
|
261
|
+
* list of several collapses to the last of them.
|
|
262
|
+
*/
|
|
263
|
+
replace: async (list) => {
|
|
264
|
+
const written = list.map((record) => [keyOf(record), { ...record }]);
|
|
265
|
+
const keys = new Set(written.map(([key]) => key));
|
|
266
|
+
const dropped = [...store.entries()].filter(([key]) => !keys.has(key));
|
|
267
|
+
for (const [key] of dropped) {
|
|
268
|
+
store.delete(key);
|
|
237
269
|
}
|
|
238
|
-
|
|
270
|
+
for (const [key, record] of written) {
|
|
271
|
+
store.set(key, record);
|
|
272
|
+
}
|
|
273
|
+
notify('remove', dropped);
|
|
274
|
+
notify('set', written);
|
|
275
|
+
},
|
|
276
|
+
clear: async () => {
|
|
277
|
+
const dropped = [...store.entries()];
|
|
278
|
+
store.clear();
|
|
279
|
+
notify('remove', dropped);
|
|
239
280
|
},
|
|
240
|
-
|
|
241
|
-
|
|
281
|
+
watch: (id, listener) => {
|
|
282
|
+
/**
|
|
283
|
+
* Watching before there is anything to watch is a RENDERING state, not a mistake.
|
|
284
|
+
*
|
|
285
|
+
* A screen binds to `useStoreModel(project.record.id)` while the project is still loading,
|
|
286
|
+
* so the id is legitimately absent for the first renders. Treating that as the
|
|
287
|
+
* configuration error it would be on `load()` or `save()` crashes the component tree over
|
|
288
|
+
* data that is simply not here yet. So an absent id on a listed resource watches nothing
|
|
289
|
+
* and reports an empty model; the error stays where it means something — a direct read or
|
|
290
|
+
* write with no id, which cannot be anything but a mistake.
|
|
291
|
+
*/
|
|
292
|
+
if (id == null && !single) {
|
|
293
|
+
listener(emptyModel());
|
|
294
|
+
return () => { };
|
|
295
|
+
}
|
|
296
|
+
const key = keyFor(id);
|
|
297
|
+
let listeners = watchers.get(key);
|
|
298
|
+
if (listeners == null) {
|
|
299
|
+
listeners = new Set();
|
|
300
|
+
watchers.set(key, listeners);
|
|
301
|
+
}
|
|
302
|
+
const bound = listeners;
|
|
303
|
+
bound.add(listener);
|
|
304
|
+
/**
|
|
305
|
+
* Seeded before `watch` returns, and seeded with nothing when the store holds nothing: an
|
|
306
|
+
* id subscription creates NO record, so a screen bound to an unknown id gets an empty
|
|
307
|
+
* model rather than putting a blank row into every list reading the same store.
|
|
308
|
+
*/
|
|
309
|
+
listener(modelFor(key));
|
|
310
|
+
/**
|
|
311
|
+
* The cached model outlives the subscription on purpose. A React subscriber takes its first
|
|
312
|
+
* snapshot by watching and stopping again, and a rebuilt model would read as a changed value
|
|
313
|
+
* the moment it subscribes for real. Keys the store no longer holds are dropped on the next
|
|
314
|
+
* change to them instead.
|
|
315
|
+
*/
|
|
242
316
|
return () => {
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
317
|
+
bound.delete(listener);
|
|
318
|
+
if (bound.size < 1) {
|
|
319
|
+
watchers.delete(key);
|
|
246
320
|
}
|
|
247
321
|
};
|
|
248
322
|
},
|
|
249
|
-
|
|
250
|
-
|
|
323
|
+
query: (where, listener, opts) => {
|
|
324
|
+
const watch = { where, opts, listener, last: [] };
|
|
325
|
+
queries.add(watch);
|
|
326
|
+
watch.last = queryModels(watch);
|
|
327
|
+
listener(watch.last);
|
|
328
|
+
return () => { queries.delete(watch); };
|
|
329
|
+
},
|
|
330
|
+
/**
|
|
331
|
+
* Writes announce themselves on the default channel, so publishing is for what the store
|
|
332
|
+
* cannot know it did — a change that arrived from elsewhere, or a channel of a caller's own.
|
|
333
|
+
*/
|
|
334
|
+
publish: async (value, channel) => {
|
|
335
|
+
await Promise.all(deliver(value, channel ?? CHANGES));
|
|
336
|
+
},
|
|
337
|
+
subscribe: async (handler, opts) => {
|
|
338
|
+
const subscription = {
|
|
339
|
+
handler, channel: opts?.channel ?? CHANGES, once: opts?.once === true
|
|
340
|
+
};
|
|
341
|
+
subscribers.add(subscription);
|
|
342
|
+
const stop = async () => {
|
|
343
|
+
subscribers.delete(subscription);
|
|
344
|
+
if (subscription.timer != null) {
|
|
345
|
+
clearTimeout(subscription.timer);
|
|
346
|
+
subscription.timer = undefined;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
if (opts?.ttl != null) {
|
|
350
|
+
subscription.timer = setTimeout(() => void stop(), expiresIn(opts.ttl));
|
|
351
|
+
}
|
|
352
|
+
return stop;
|
|
251
353
|
}
|
|
252
354
|
});
|
|
253
355
|
return resource;
|
|
254
356
|
};
|
|
255
|
-
|
|
256
|
-
|
|
357
|
+
/**
|
|
358
|
+
* Register a state resource on the context and expose `getStateResource`.
|
|
359
|
+
*
|
|
360
|
+
* Idempotent: appending the same alias twice keeps the resource that is already there, so a
|
|
361
|
+
* setup that runs more than once does not drop what the store has collected. The first alias
|
|
362
|
+
* appended is the one `getStateResource()` answers with when it is called without one.
|
|
363
|
+
*/
|
|
364
|
+
export const appendStateResource = (ctx, alias = STATE, cfg) => {
|
|
257
365
|
const _ctx = ctx;
|
|
258
|
-
_ctx.
|
|
366
|
+
if (!_ctx.hasResource(alias)) {
|
|
367
|
+
_ctx.registerResource(createStateResource(alias, cfg));
|
|
368
|
+
}
|
|
259
369
|
if (_ctx.getStateResource == null) {
|
|
260
|
-
_ctx.getStateResource =
|
|
370
|
+
_ctx.getStateResource = ((_alias) => ctx.resource(_alias ?? alias));
|
|
261
371
|
}
|
|
262
372
|
return _ctx;
|
|
263
373
|
};
|
package/build/resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAChH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAGvD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,W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