@fedify/fedify 2.5.0-dev.2761 → 2.5.0-dev.2811
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 +0 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/{context-CuLvR1Os.d.ts → context-CgIOZfHW.d.ts} +1 -1
- package/dist/{context-apq0IBg2.d.cts → context-ZtE85CT_.d.cts} +1 -1
- package/dist/federation/mod.cjs +2 -1
- package/dist/federation/mod.d.cts +4 -4
- package/dist/federation/mod.d.ts +4 -4
- package/dist/federation/mod.js +125 -54
- package/dist/{federation-Crl2bEOt.cjs → federation-9C0m80Xz.cjs} +132 -55
- package/dist/{http-CmUqKRJ_.cjs → http-Cak77CRX.cjs} +1 -1
- package/dist/{http-BwM17Us1.js → http-b_w1Y2LA.js} +1 -1
- package/dist/kv-B0eIwj06.d.cts +238 -0
- package/dist/kv-B0eIwj06.d.ts +238 -0
- package/dist/{kv-cache-DY4GKFQn.cjs → kv-cache-HIfNaJfF.cjs} +1 -1
- package/dist/{kv-cache-3-aoT6Xh.js → kv-cache-kzVOBade.js} +1 -1
- package/dist/{middleware-BB5nvqs9.js → middleware-Ig66lOfi.js} +3 -3
- package/dist/{mod-BkTi19dI.d.ts → mod-BD6xjFNY.d.ts} +1 -1
- package/dist/{mod-DB2NOzQF.d.cts → mod-Bl1EEZMj.d.cts} +1 -1
- package/dist/{mod-CMtF0VVy.d.ts → mod-SgCN1wPF.d.ts} +1 -1
- package/dist/{mod-D2Z9MiCm.d.cts → mod-rDDnkuR8.d.cts} +1 -1
- package/dist/mod.cjs +5 -4
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +6 -6
- package/dist/otel/mod.d.cts +1 -1
- package/dist/otel/mod.d.ts +1 -1
- package/dist/{portable-collection-CmcoEx8A.cjs → portable-collection-CcUfl-7X.cjs} +1 -1
- package/dist/{portable-collection-m_9zLEIk.js → portable-collection-DKg1whg_.js} +1 -1
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/skills/fedify/SKILL.md +105 -5
- package/dist/kv-B2mzK5tl.d.cts +0 -112
- package/dist/kv-B2mzK5tl.d.ts +0 -112
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
//#region src/federation/kv.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A key for a key–value store. An array of one or more strings.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.5.0
|
|
7
|
+
*/
|
|
8
|
+
type KvKey = readonly [string] | readonly [string, ...string[]];
|
|
9
|
+
/**
|
|
10
|
+
* Additional options for setting a value in a key–value store.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.5.0
|
|
13
|
+
*/
|
|
14
|
+
interface KvStoreSetOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The time-to-live (TTL) for the value.
|
|
17
|
+
*/
|
|
18
|
+
ttl?: Temporal.Duration;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An entry returned by the {@link KvStore.list} method.
|
|
22
|
+
*
|
|
23
|
+
* @since 1.10.0
|
|
24
|
+
*/
|
|
25
|
+
interface KvStoreListEntry {
|
|
26
|
+
/**
|
|
27
|
+
* The key of the entry.
|
|
28
|
+
*/
|
|
29
|
+
readonly key: KvKey;
|
|
30
|
+
/**
|
|
31
|
+
* The value of the entry.
|
|
32
|
+
*/
|
|
33
|
+
readonly value: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A write in an atomic batch. `undefined` is not a storable value.
|
|
37
|
+
* @since 2.5.0
|
|
38
|
+
*/
|
|
39
|
+
interface KvStoreSetEntry {
|
|
40
|
+
/** The key to write. */
|
|
41
|
+
readonly key: KvKey;
|
|
42
|
+
/** The value to store, including `null`, but not `undefined`. */
|
|
43
|
+
readonly value: unknown;
|
|
44
|
+
/** The TTL for this entry; omitting it clears any previous TTL. */
|
|
45
|
+
readonly options?: KvStoreSetOptions;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A comparison and mutation in an atomic conditional batch.
|
|
49
|
+
* @since 2.5.0
|
|
50
|
+
*/
|
|
51
|
+
interface KvStoreCasEntry {
|
|
52
|
+
/** The key to compare and change. */
|
|
53
|
+
readonly key: KvKey;
|
|
54
|
+
/** The expected value; `undefined` checks for absence or logical expiry. */
|
|
55
|
+
readonly expectedValue: unknown;
|
|
56
|
+
/** The replacement value; `undefined` deletes the entry. */
|
|
57
|
+
readonly newValue: unknown;
|
|
58
|
+
/** The replacement TTL. A deletion must not specify a TTL. */
|
|
59
|
+
readonly options?: KvStoreSetOptions;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* An abstract interface for a key–value store.
|
|
63
|
+
*
|
|
64
|
+
* @since 0.5.0
|
|
65
|
+
*/
|
|
66
|
+
interface KvStore {
|
|
67
|
+
/**
|
|
68
|
+
* Gets the value for the given key.
|
|
69
|
+
* @param key The key to get the value for.
|
|
70
|
+
* @returns The value for the key, including `null` if stored, or `undefined`
|
|
71
|
+
* if the key does not exist.
|
|
72
|
+
* @template T The type of the value to get.
|
|
73
|
+
*/
|
|
74
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the value for the given key.
|
|
77
|
+
* @param key The key to set the value for.
|
|
78
|
+
* @param value The value to set. `null` is a storable value.
|
|
79
|
+
* @param options Additional options for setting the value.
|
|
80
|
+
*/
|
|
81
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Deletes the value for the given key.
|
|
84
|
+
* @param key The key to delete.
|
|
85
|
+
*/
|
|
86
|
+
delete(key: KvKey): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Compare-and-swap (CAS) operation for the key–value store.
|
|
89
|
+
* @param key The key to perform the CAS operation on.
|
|
90
|
+
* @param expectedValue The expected value for the key.
|
|
91
|
+
* @param newValue The new value to set if the expected value matches.
|
|
92
|
+
* @param options Additional options for setting the value.
|
|
93
|
+
* @return `true` if the CAS operation was successful, `false` otherwise.
|
|
94
|
+
* @since 1.8.0
|
|
95
|
+
*/
|
|
96
|
+
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Reads an input-ordered snapshot of the given keys. Missing or expired
|
|
99
|
+
* entries are `undefined`; stored `null` remains `null`. Repeated keys
|
|
100
|
+
* repeat the same snapshot value. Empty input returns an empty array.
|
|
101
|
+
* This does not provide a snapshot of {@link KvStore.list}.
|
|
102
|
+
* @see {@link AtomicKvStore} for the atomic operation contract.
|
|
103
|
+
* @since 2.5.0
|
|
104
|
+
*/
|
|
105
|
+
getMany?<T = unknown>(keys: readonly KvKey[]): Promise<(T | undefined)[]>;
|
|
106
|
+
/**
|
|
107
|
+
* Writes all entries atomically, with a separate TTL for each entry.
|
|
108
|
+
* Duplicate keys and `undefined` values reject before any write. Empty
|
|
109
|
+
* input is a no-op. An operation must never be split to fit a batch limit.
|
|
110
|
+
* @see {@link AtomicKvStore} for supported scope and error semantics.
|
|
111
|
+
* @since 2.5.0
|
|
112
|
+
*/
|
|
113
|
+
setMany?(entries: readonly KvStoreSetEntry[]): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Deletes all given keys atomically. Duplicate keys reject before any
|
|
116
|
+
* deletion. Empty input is a no-op; absent keys are ignored.
|
|
117
|
+
* @see {@link AtomicKvStore} for supported scope and error semantics.
|
|
118
|
+
* @since 2.5.0
|
|
119
|
+
*/
|
|
120
|
+
deleteMany?(keys: readonly KvKey[]): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Compares every expected value against one pre-mutation state and applies
|
|
123
|
+
* all replacements/deletions atomically only if every comparison matches.
|
|
124
|
+
* `undefined` means absence when expected, and deletion when new. Duplicate
|
|
125
|
+
* keys and a TTL on deletion reject before any mutation, even on mismatch.
|
|
126
|
+
* Empty input returns `true`. `false` means only a comparison mismatch,
|
|
127
|
+
* leaving all values and their TTLs unchanged.
|
|
128
|
+
* @see {@link AtomicKvStore} for comparison, scope, and failure semantics.
|
|
129
|
+
* @since 2.5.0
|
|
130
|
+
*/
|
|
131
|
+
casMany?(entries: readonly KvStoreCasEntry[]): Promise<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* Lists all entries in the store that match the given prefix.
|
|
134
|
+
* If no prefix is given, all entries are returned.
|
|
135
|
+
* @param prefix The prefix to filter keys by. If not specified, all entries
|
|
136
|
+
* are returned.
|
|
137
|
+
* @returns An async iterable of entries matching the prefix.
|
|
138
|
+
* @since 1.10.0
|
|
139
|
+
* @since 2.0.0 This method is now required instead of optional.
|
|
140
|
+
*/
|
|
141
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A store providing atomic snapshots and conditional multi-key mutations.
|
|
145
|
+
*
|
|
146
|
+
* Every operation is atomic within the adapter's documented backing-store
|
|
147
|
+
* scope. Adapters must document supported values/codecs, comparison, TTL
|
|
148
|
+
* precision, key scope, and size limits. Single and multi-key CAS use the
|
|
149
|
+
* same comparison rules. Invalid input, unsupported scope, exceeded limits,
|
|
150
|
+
* and backend failures reject; a batch must never be silently split.
|
|
151
|
+
* Batch arrays must not be sparse: a missing element makes the batch invalid.
|
|
152
|
+
* Empty arrays are valid.
|
|
153
|
+
*
|
|
154
|
+
* Logical expiry counts as absence. `undefined` is not stored; use deletion
|
|
155
|
+
* instead. CAS deletion rejects a non-null TTL. Replacing a value without a
|
|
156
|
+
* TTL clears its previous expiry. Each operation uses one expiry cutoff.
|
|
157
|
+
*
|
|
158
|
+
* This contract does not imply durability, a transaction across calls, or
|
|
159
|
+
* exactly-once external effects. A lost response can leave commit status
|
|
160
|
+
* unknown. To detect ABA changes, include a non-reused version in the value.
|
|
161
|
+
* After a mismatch, re-read and re-evaluate the application rule before retry.
|
|
162
|
+
*
|
|
163
|
+
* @since 2.5.0
|
|
164
|
+
*/
|
|
165
|
+
interface AtomicKvStore extends KvStore {
|
|
166
|
+
/**
|
|
167
|
+
* Stores a value. `undefined` rejects; use {@link KvStore.delete} instead.
|
|
168
|
+
* @param key The key to write.
|
|
169
|
+
* @param value The value to store, including `null`, but not `undefined`.
|
|
170
|
+
* @param options The TTL; omitting it clears the previous expiry.
|
|
171
|
+
*/
|
|
172
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Compares and replaces one value using the same rules as
|
|
175
|
+
* {@link AtomicKvStore.casMany}. `undefined` means absence/deletion;
|
|
176
|
+
* a non-null TTL on deletion rejects, including on mismatch.
|
|
177
|
+
*/
|
|
178
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
179
|
+
/** {@inheritDoc KvStore.getMany} */
|
|
180
|
+
getMany<T = unknown>(keys: readonly KvKey[]): Promise<(T | undefined)[]>;
|
|
181
|
+
/** {@inheritDoc KvStore.setMany} */
|
|
182
|
+
setMany(entries: readonly KvStoreSetEntry[]): Promise<void>;
|
|
183
|
+
/** {@inheritDoc KvStore.deleteMany} */
|
|
184
|
+
deleteMany(keys: readonly KvKey[]): Promise<void>;
|
|
185
|
+
/** {@inheritDoc KvStore.casMany} */
|
|
186
|
+
casMany(entries: readonly KvStoreCasEntry[]): Promise<boolean>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Checks that all five atomic methods are functions. This checks capabilities
|
|
190
|
+
* only, not their correctness, supported scope, or persistence.
|
|
191
|
+
* @param store The store to check.
|
|
192
|
+
* @returns Whether the store exposes the required atomic methods.
|
|
193
|
+
* @since 2.5.0
|
|
194
|
+
*/
|
|
195
|
+
declare function isAtomicKvStore(store: KvStore): store is AtomicKvStore;
|
|
196
|
+
/**
|
|
197
|
+
* A key–value store that stores values in memory.
|
|
198
|
+
* Do not use this in production as it does not persist values.
|
|
199
|
+
*
|
|
200
|
+
* All keys within one instance share an atomic scope, with no fixed batch
|
|
201
|
+
* size limit other than available memory/runtime resources. Values use
|
|
202
|
+
* {@link https://es-toolkit.dev/reference/predicate/isEqual.html | structural
|
|
203
|
+
* equality} for CAS, including object member order independence. TTLs are
|
|
204
|
+
* normalized to hours without losing subhour precision; calendar durations
|
|
205
|
+
* requiring a reference date reject. Non-positive TTLs expire immediately.
|
|
206
|
+
*
|
|
207
|
+
* Values are retained and returned by reference for compatibility. Treat
|
|
208
|
+
* inputs and returned objects as immutable, passive data: accessors, proxies,
|
|
209
|
+
* or other behavior that reenters the store during an operation are unsupported.
|
|
210
|
+
* Mutating an object, including one shared across several keys, changes the
|
|
211
|
+
* stored state outside the atomic API and invalidates snapshot guarantees.
|
|
212
|
+
* Persistent adapters usually serialize values, so this differs from them.
|
|
213
|
+
*
|
|
214
|
+
* @since 0.5.0
|
|
215
|
+
*/
|
|
216
|
+
declare class MemoryKvStore implements AtomicKvStore {
|
|
217
|
+
#private;
|
|
218
|
+
/** {@inheritDoc KvStore.get} */
|
|
219
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
220
|
+
/** {@inheritDoc AtomicKvStore.set} */
|
|
221
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
222
|
+
/** {@inheritDoc KvStore.delete} */
|
|
223
|
+
delete(key: KvKey): Promise<void>;
|
|
224
|
+
/** {@inheritDoc AtomicKvStore.cas} */
|
|
225
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
226
|
+
/** {@inheritDoc AtomicKvStore.getMany} */
|
|
227
|
+
getMany<T = unknown>(keys: readonly KvKey[]): Promise<(T | undefined)[]>;
|
|
228
|
+
/** {@inheritDoc AtomicKvStore.setMany} */
|
|
229
|
+
setMany(entries: readonly KvStoreSetEntry[]): Promise<void>;
|
|
230
|
+
/** {@inheritDoc AtomicKvStore.deleteMany} */
|
|
231
|
+
deleteMany(keys: readonly KvKey[]): Promise<void>;
|
|
232
|
+
/** {@inheritDoc AtomicKvStore.casMany} */
|
|
233
|
+
casMany(entries: readonly KvStoreCasEntry[]): Promise<boolean>;
|
|
234
|
+
/** {@inheritDoc KvStore.list} */
|
|
235
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
export { KvStoreListEntry as a, MemoryKvStore as c, KvStoreCasEntry as i, isAtomicKvStore as l, KvKey as n, KvStoreSetEntry as o, KvStore as r, KvStoreSetOptions as s, AtomicKvStore as t };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
//#region src/federation/kv.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A key for a key–value store. An array of one or more strings.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.5.0
|
|
7
|
+
*/
|
|
8
|
+
type KvKey = readonly [string] | readonly [string, ...string[]];
|
|
9
|
+
/**
|
|
10
|
+
* Additional options for setting a value in a key–value store.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.5.0
|
|
13
|
+
*/
|
|
14
|
+
interface KvStoreSetOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The time-to-live (TTL) for the value.
|
|
17
|
+
*/
|
|
18
|
+
ttl?: Temporal.Duration;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An entry returned by the {@link KvStore.list} method.
|
|
22
|
+
*
|
|
23
|
+
* @since 1.10.0
|
|
24
|
+
*/
|
|
25
|
+
interface KvStoreListEntry {
|
|
26
|
+
/**
|
|
27
|
+
* The key of the entry.
|
|
28
|
+
*/
|
|
29
|
+
readonly key: KvKey;
|
|
30
|
+
/**
|
|
31
|
+
* The value of the entry.
|
|
32
|
+
*/
|
|
33
|
+
readonly value: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A write in an atomic batch. `undefined` is not a storable value.
|
|
37
|
+
* @since 2.5.0
|
|
38
|
+
*/
|
|
39
|
+
interface KvStoreSetEntry {
|
|
40
|
+
/** The key to write. */
|
|
41
|
+
readonly key: KvKey;
|
|
42
|
+
/** The value to store, including `null`, but not `undefined`. */
|
|
43
|
+
readonly value: unknown;
|
|
44
|
+
/** The TTL for this entry; omitting it clears any previous TTL. */
|
|
45
|
+
readonly options?: KvStoreSetOptions;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A comparison and mutation in an atomic conditional batch.
|
|
49
|
+
* @since 2.5.0
|
|
50
|
+
*/
|
|
51
|
+
interface KvStoreCasEntry {
|
|
52
|
+
/** The key to compare and change. */
|
|
53
|
+
readonly key: KvKey;
|
|
54
|
+
/** The expected value; `undefined` checks for absence or logical expiry. */
|
|
55
|
+
readonly expectedValue: unknown;
|
|
56
|
+
/** The replacement value; `undefined` deletes the entry. */
|
|
57
|
+
readonly newValue: unknown;
|
|
58
|
+
/** The replacement TTL. A deletion must not specify a TTL. */
|
|
59
|
+
readonly options?: KvStoreSetOptions;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* An abstract interface for a key–value store.
|
|
63
|
+
*
|
|
64
|
+
* @since 0.5.0
|
|
65
|
+
*/
|
|
66
|
+
interface KvStore {
|
|
67
|
+
/**
|
|
68
|
+
* Gets the value for the given key.
|
|
69
|
+
* @param key The key to get the value for.
|
|
70
|
+
* @returns The value for the key, including `null` if stored, or `undefined`
|
|
71
|
+
* if the key does not exist.
|
|
72
|
+
* @template T The type of the value to get.
|
|
73
|
+
*/
|
|
74
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the value for the given key.
|
|
77
|
+
* @param key The key to set the value for.
|
|
78
|
+
* @param value The value to set. `null` is a storable value.
|
|
79
|
+
* @param options Additional options for setting the value.
|
|
80
|
+
*/
|
|
81
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Deletes the value for the given key.
|
|
84
|
+
* @param key The key to delete.
|
|
85
|
+
*/
|
|
86
|
+
delete(key: KvKey): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Compare-and-swap (CAS) operation for the key–value store.
|
|
89
|
+
* @param key The key to perform the CAS operation on.
|
|
90
|
+
* @param expectedValue The expected value for the key.
|
|
91
|
+
* @param newValue The new value to set if the expected value matches.
|
|
92
|
+
* @param options Additional options for setting the value.
|
|
93
|
+
* @return `true` if the CAS operation was successful, `false` otherwise.
|
|
94
|
+
* @since 1.8.0
|
|
95
|
+
*/
|
|
96
|
+
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Reads an input-ordered snapshot of the given keys. Missing or expired
|
|
99
|
+
* entries are `undefined`; stored `null` remains `null`. Repeated keys
|
|
100
|
+
* repeat the same snapshot value. Empty input returns an empty array.
|
|
101
|
+
* This does not provide a snapshot of {@link KvStore.list}.
|
|
102
|
+
* @see {@link AtomicKvStore} for the atomic operation contract.
|
|
103
|
+
* @since 2.5.0
|
|
104
|
+
*/
|
|
105
|
+
getMany?<T = unknown>(keys: readonly KvKey[]): Promise<(T | undefined)[]>;
|
|
106
|
+
/**
|
|
107
|
+
* Writes all entries atomically, with a separate TTL for each entry.
|
|
108
|
+
* Duplicate keys and `undefined` values reject before any write. Empty
|
|
109
|
+
* input is a no-op. An operation must never be split to fit a batch limit.
|
|
110
|
+
* @see {@link AtomicKvStore} for supported scope and error semantics.
|
|
111
|
+
* @since 2.5.0
|
|
112
|
+
*/
|
|
113
|
+
setMany?(entries: readonly KvStoreSetEntry[]): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Deletes all given keys atomically. Duplicate keys reject before any
|
|
116
|
+
* deletion. Empty input is a no-op; absent keys are ignored.
|
|
117
|
+
* @see {@link AtomicKvStore} for supported scope and error semantics.
|
|
118
|
+
* @since 2.5.0
|
|
119
|
+
*/
|
|
120
|
+
deleteMany?(keys: readonly KvKey[]): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Compares every expected value against one pre-mutation state and applies
|
|
123
|
+
* all replacements/deletions atomically only if every comparison matches.
|
|
124
|
+
* `undefined` means absence when expected, and deletion when new. Duplicate
|
|
125
|
+
* keys and a TTL on deletion reject before any mutation, even on mismatch.
|
|
126
|
+
* Empty input returns `true`. `false` means only a comparison mismatch,
|
|
127
|
+
* leaving all values and their TTLs unchanged.
|
|
128
|
+
* @see {@link AtomicKvStore} for comparison, scope, and failure semantics.
|
|
129
|
+
* @since 2.5.0
|
|
130
|
+
*/
|
|
131
|
+
casMany?(entries: readonly KvStoreCasEntry[]): Promise<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* Lists all entries in the store that match the given prefix.
|
|
134
|
+
* If no prefix is given, all entries are returned.
|
|
135
|
+
* @param prefix The prefix to filter keys by. If not specified, all entries
|
|
136
|
+
* are returned.
|
|
137
|
+
* @returns An async iterable of entries matching the prefix.
|
|
138
|
+
* @since 1.10.0
|
|
139
|
+
* @since 2.0.0 This method is now required instead of optional.
|
|
140
|
+
*/
|
|
141
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A store providing atomic snapshots and conditional multi-key mutations.
|
|
145
|
+
*
|
|
146
|
+
* Every operation is atomic within the adapter's documented backing-store
|
|
147
|
+
* scope. Adapters must document supported values/codecs, comparison, TTL
|
|
148
|
+
* precision, key scope, and size limits. Single and multi-key CAS use the
|
|
149
|
+
* same comparison rules. Invalid input, unsupported scope, exceeded limits,
|
|
150
|
+
* and backend failures reject; a batch must never be silently split.
|
|
151
|
+
* Batch arrays must not be sparse: a missing element makes the batch invalid.
|
|
152
|
+
* Empty arrays are valid.
|
|
153
|
+
*
|
|
154
|
+
* Logical expiry counts as absence. `undefined` is not stored; use deletion
|
|
155
|
+
* instead. CAS deletion rejects a non-null TTL. Replacing a value without a
|
|
156
|
+
* TTL clears its previous expiry. Each operation uses one expiry cutoff.
|
|
157
|
+
*
|
|
158
|
+
* This contract does not imply durability, a transaction across calls, or
|
|
159
|
+
* exactly-once external effects. A lost response can leave commit status
|
|
160
|
+
* unknown. To detect ABA changes, include a non-reused version in the value.
|
|
161
|
+
* After a mismatch, re-read and re-evaluate the application rule before retry.
|
|
162
|
+
*
|
|
163
|
+
* @since 2.5.0
|
|
164
|
+
*/
|
|
165
|
+
interface AtomicKvStore extends KvStore {
|
|
166
|
+
/**
|
|
167
|
+
* Stores a value. `undefined` rejects; use {@link KvStore.delete} instead.
|
|
168
|
+
* @param key The key to write.
|
|
169
|
+
* @param value The value to store, including `null`, but not `undefined`.
|
|
170
|
+
* @param options The TTL; omitting it clears the previous expiry.
|
|
171
|
+
*/
|
|
172
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Compares and replaces one value using the same rules as
|
|
175
|
+
* {@link AtomicKvStore.casMany}. `undefined` means absence/deletion;
|
|
176
|
+
* a non-null TTL on deletion rejects, including on mismatch.
|
|
177
|
+
*/
|
|
178
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
179
|
+
/** {@inheritDoc KvStore.getMany} */
|
|
180
|
+
getMany<T = unknown>(keys: readonly KvKey[]): Promise<(T | undefined)[]>;
|
|
181
|
+
/** {@inheritDoc KvStore.setMany} */
|
|
182
|
+
setMany(entries: readonly KvStoreSetEntry[]): Promise<void>;
|
|
183
|
+
/** {@inheritDoc KvStore.deleteMany} */
|
|
184
|
+
deleteMany(keys: readonly KvKey[]): Promise<void>;
|
|
185
|
+
/** {@inheritDoc KvStore.casMany} */
|
|
186
|
+
casMany(entries: readonly KvStoreCasEntry[]): Promise<boolean>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Checks that all five atomic methods are functions. This checks capabilities
|
|
190
|
+
* only, not their correctness, supported scope, or persistence.
|
|
191
|
+
* @param store The store to check.
|
|
192
|
+
* @returns Whether the store exposes the required atomic methods.
|
|
193
|
+
* @since 2.5.0
|
|
194
|
+
*/
|
|
195
|
+
declare function isAtomicKvStore(store: KvStore): store is AtomicKvStore;
|
|
196
|
+
/**
|
|
197
|
+
* A key–value store that stores values in memory.
|
|
198
|
+
* Do not use this in production as it does not persist values.
|
|
199
|
+
*
|
|
200
|
+
* All keys within one instance share an atomic scope, with no fixed batch
|
|
201
|
+
* size limit other than available memory/runtime resources. Values use
|
|
202
|
+
* {@link https://es-toolkit.dev/reference/predicate/isEqual.html | structural
|
|
203
|
+
* equality} for CAS, including object member order independence. TTLs are
|
|
204
|
+
* normalized to hours without losing subhour precision; calendar durations
|
|
205
|
+
* requiring a reference date reject. Non-positive TTLs expire immediately.
|
|
206
|
+
*
|
|
207
|
+
* Values are retained and returned by reference for compatibility. Treat
|
|
208
|
+
* inputs and returned objects as immutable, passive data: accessors, proxies,
|
|
209
|
+
* or other behavior that reenters the store during an operation are unsupported.
|
|
210
|
+
* Mutating an object, including one shared across several keys, changes the
|
|
211
|
+
* stored state outside the atomic API and invalidates snapshot guarantees.
|
|
212
|
+
* Persistent adapters usually serialize values, so this differs from them.
|
|
213
|
+
*
|
|
214
|
+
* @since 0.5.0
|
|
215
|
+
*/
|
|
216
|
+
declare class MemoryKvStore implements AtomicKvStore {
|
|
217
|
+
#private;
|
|
218
|
+
/** {@inheritDoc KvStore.get} */
|
|
219
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
220
|
+
/** {@inheritDoc AtomicKvStore.set} */
|
|
221
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
222
|
+
/** {@inheritDoc KvStore.delete} */
|
|
223
|
+
delete(key: KvKey): Promise<void>;
|
|
224
|
+
/** {@inheritDoc AtomicKvStore.cas} */
|
|
225
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
226
|
+
/** {@inheritDoc AtomicKvStore.getMany} */
|
|
227
|
+
getMany<T = unknown>(keys: readonly KvKey[]): Promise<(T | undefined)[]>;
|
|
228
|
+
/** {@inheritDoc AtomicKvStore.setMany} */
|
|
229
|
+
setMany(entries: readonly KvStoreSetEntry[]): Promise<void>;
|
|
230
|
+
/** {@inheritDoc AtomicKvStore.deleteMany} */
|
|
231
|
+
deleteMany(keys: readonly KvKey[]): Promise<void>;
|
|
232
|
+
/** {@inheritDoc AtomicKvStore.casMany} */
|
|
233
|
+
casMany(entries: readonly KvStoreCasEntry[]): Promise<boolean>;
|
|
234
|
+
/** {@inheritDoc KvStore.list} */
|
|
235
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
export { KvStoreListEntry as a, MemoryKvStore as c, KvStoreCasEntry as i, isAtomicKvStore as l, KvKey as n, KvStoreSetEntry as o, KvStore as r, KvStoreSetOptions as s, AtomicKvStore as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const require_http = require("./http-
|
|
2
|
+
const require_http = require("./http-Cak77CRX.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
5
5
|
let es_toolkit = require("es-toolkit");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { X as validateCryptoKey, dt as recordDocumentCache, t as doubleKnockScoped } from "./http-
|
|
3
|
+
import { X as validateCryptoKey, dt as recordDocumentCache, t as doubleKnockScoped } from "./http-b_w1Y2LA.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, resolveDocumentLoaderTimeout, withDocumentLoaderTimeout } from "@fedify/vocab-runtime";
|
|
6
6
|
import { curry } from "es-toolkit";
|
|
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
|
|
5
|
-
import { $ as getVerifiedKeyOwnerEvidence, A as compactJsonLd, At as getRawCanonicalPortableId, B as verifyCompactJsonLdDetailed, C as verifyPortableObjectProofWithRoot, Ct as observeAttempt, D as InvalidContextReferenceError, Dt as getCanonicalPortableId, E as normalizeOutgoingActivityJsonLd, Et as getAuthenticationOrigin, F as hasSignatureLike, Ft as isPortableUri, I as isClearlyMalformedContextReference, It as isSameObjectId, L as isInvalidUrlTypeError, M as detachSignature, Mt as isCompatibleKeyId, N as getNormalizationContextLoader, Nt as isPortableId, O as assertSafeJsonLd, Ot as getGatewayKeyBase, P as hasSignature, Pt as isPortableKeyId, Q as MAX_PORTABLE_KEY_TTL, R as markEffectiveContextLoader, Rt as name, S as verifyPortableObjectProofPolicy, Tt as verificationObservation, U as wrapContextLoaderForJsonLd, W as exportJwk, X as validateCryptoKey, Y as importJwk, _ as signObject, _t as registerQueueDepthGauge, at as isAbortError, b as verifyObjectDetailed, c as verifyRequestDetailed, ct as recordCollectionPageItems, d as InvalidPortableObjectIdError, f as classifyFep2277CoreType, ft as recordFanoutRecipients, g as preparePortableObjectProofPolicy, gt as recordWebFingerHandle, h as hasProofLike, ht as recordOutboxEnqueue, i as selectRequestSignature, it as instrumentDocumentLoader, jt as hasPortableActor, kt as getPortableDid, lt as recordCollectionRequest, m as getProofSigner, mt as recordOutboxActivity, n as listRequestSignatures, nt as getFederationMetrics, o as validateMaxSignatures, ot as recordCircuitBreakerStateChange, pt as recordInboxActivity, r as parseRfc9421SignatureInput, rt as getRemoteHost, s as verifyRequest, st as recordCollectionDispatchDuration, t as doubleKnockScoped, tt as getDurationMs, ut as recordCollectionTotalItems, v as verifyMapLocalProof, vt as preloadedOnlyDocumentLoader, w as verifyPreparedPortableObjectProofPolicy, wt as snapshotKey, x as verifyPortableObjectProof, y as verifyObject, yt as formatAcceptSignature, z as signJsonLd, zt as version } from "./http-
|
|
5
|
+
import { $ as getVerifiedKeyOwnerEvidence, A as compactJsonLd, At as getRawCanonicalPortableId, B as verifyCompactJsonLdDetailed, C as verifyPortableObjectProofWithRoot, Ct as observeAttempt, D as InvalidContextReferenceError, Dt as getCanonicalPortableId, E as normalizeOutgoingActivityJsonLd, Et as getAuthenticationOrigin, F as hasSignatureLike, Ft as isPortableUri, I as isClearlyMalformedContextReference, It as isSameObjectId, L as isInvalidUrlTypeError, M as detachSignature, Mt as isCompatibleKeyId, N as getNormalizationContextLoader, Nt as isPortableId, O as assertSafeJsonLd, Ot as getGatewayKeyBase, P as hasSignature, Pt as isPortableKeyId, Q as MAX_PORTABLE_KEY_TTL, R as markEffectiveContextLoader, Rt as name, S as verifyPortableObjectProofPolicy, Tt as verificationObservation, U as wrapContextLoaderForJsonLd, W as exportJwk, X as validateCryptoKey, Y as importJwk, _ as signObject, _t as registerQueueDepthGauge, at as isAbortError, b as verifyObjectDetailed, c as verifyRequestDetailed, ct as recordCollectionPageItems, d as InvalidPortableObjectIdError, f as classifyFep2277CoreType, ft as recordFanoutRecipients, g as preparePortableObjectProofPolicy, gt as recordWebFingerHandle, h as hasProofLike, ht as recordOutboxEnqueue, i as selectRequestSignature, it as instrumentDocumentLoader, jt as hasPortableActor, kt as getPortableDid, lt as recordCollectionRequest, m as getProofSigner, mt as recordOutboxActivity, n as listRequestSignatures, nt as getFederationMetrics, o as validateMaxSignatures, ot as recordCircuitBreakerStateChange, pt as recordInboxActivity, r as parseRfc9421SignatureInput, rt as getRemoteHost, s as verifyRequest, st as recordCollectionDispatchDuration, t as doubleKnockScoped, tt as getDurationMs, ut as recordCollectionTotalItems, v as verifyMapLocalProof, vt as preloadedOnlyDocumentLoader, w as verifyPreparedPortableObjectProofPolicy, wt as snapshotKey, x as verifyPortableObjectProof, y as verifyObject, yt as formatAcceptSignature, z as signJsonLd, zt as version } from "./http-b_w1Y2LA.js";
|
|
6
6
|
import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-DUjZb4i6.js";
|
|
7
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
7
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-DKg1whg_.js";
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-kzVOBade.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { FetchError, UrlError, canonicalizePortableUri, decodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, isGatewayUrl, parseDigestMultibase, parseHashlink, parseIri, preloadedContexts, resolveDocumentLoaderTimeout, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
11
11
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { bt as ActorDispatcher, p as RequestContext, qt as WebFingerLinksDispatcher, xt as ActorHandleMapper, yt as ActorAliasMapper } from "./context-
|
|
2
|
+
import { bt as ActorDispatcher, p as RequestContext, qt as WebFingerLinksDispatcher, xt as ActorHandleMapper, yt as ActorAliasMapper } from "./context-CgIOZfHW.js";
|
|
3
3
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
4
4
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { bt as ActorDispatcher, p as RequestContext, qt as WebFingerLinksDispatcher, xt as ActorHandleMapper, yt as ActorAliasMapper } from "./context-
|
|
2
|
+
import { bt as ActorDispatcher, p as RequestContext, qt as WebFingerLinksDispatcher, xt as ActorHandleMapper, yt as ActorAliasMapper } from "./context-ZtE85CT_.cjs";
|
|
3
3
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { b as HttpMessageSignaturesSpecDeterminer } from "./key-BZw-YiK5.js";
|
|
3
|
-
import { n as
|
|
3
|
+
import { n as KvKey, r as KvStore } from "./kv-B0eIwj06.js";
|
|
4
4
|
import { t as DocumentFetchKind } from "./metrics-DVKYY6K1.js";
|
|
5
5
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
6
6
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { b as HttpMessageSignaturesSpecDeterminer } from "./key-D5fbQkKM.cjs";
|
|
3
|
-
import { n as
|
|
3
|
+
import { n as KvKey, r as KvStore } from "./kv-B0eIwj06.cjs";
|
|
4
4
|
import { t as DocumentFetchKind } from "./metrics-DVKYY6K1.cjs";
|
|
5
5
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
6
6
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
package/dist/mod.cjs
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("./rolldown-runtime-Dmm3t92W.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-BalCrSsr.cjs");
|
|
5
5
|
require("./compat/mod.cjs");
|
|
6
|
-
const require_federation = require("./federation-
|
|
7
|
-
const require_http = require("./http-
|
|
6
|
+
const require_federation = require("./federation-9C0m80Xz.cjs");
|
|
7
|
+
const require_http = require("./http-Cak77CRX.cjs");
|
|
8
8
|
const require_types = require("./types-hKCCjii0.cjs");
|
|
9
|
-
const require_portable_collection = require("./portable-collection-
|
|
10
|
-
const require_kv_cache = require("./kv-cache-
|
|
9
|
+
const require_portable_collection = require("./portable-collection-CcUfl-7X.cjs");
|
|
10
|
+
const require_kv_cache = require("./kv-cache-HIfNaJfF.cjs");
|
|
11
11
|
require("./nodeinfo/mod.cjs");
|
|
12
12
|
require("./runtime/mod.cjs");
|
|
13
13
|
require("./sig/mod.cjs");
|
|
@@ -47,6 +47,7 @@ exports.hasProofLike = require_http.hasProofLike;
|
|
|
47
47
|
exports.hasSignatureLike = require_http.hasSignatureLike;
|
|
48
48
|
exports.importJwk = require_http.importJwk;
|
|
49
49
|
exports.isActorAuthenticated = require_federation.isActorAuthenticated;
|
|
50
|
+
exports.isAtomicKvStore = require_federation.isAtomicKvStore;
|
|
50
51
|
exports.kvCache = require_kv_cache.kvCache;
|
|
51
52
|
exports.nodeInfoToJson = require_types.nodeInfoToJson;
|
|
52
53
|
exports.normalizeCircuitBreakerOptions = require_federation.normalizeCircuitBreakerOptions;
|