@fungi.computer/agar 0.0.0-stage → 0.0.1
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 +21 -0
- package/README.md +766 -2
- package/dist/agent-message-meta.d.ts +74 -0
- package/dist/agent-message-meta.js +63 -0
- package/dist/agents.d.ts +170 -0
- package/dist/agents.js +218 -0
- package/dist/app-build-contract.d.ts +43 -0
- package/dist/app-build-contract.js +24 -0
- package/dist/apps.d.ts +66 -0
- package/dist/apps.js +47 -0
- package/dist/backend-declaration.d.ts +6 -0
- package/dist/backend-declaration.js +65 -0
- package/dist/backend-definition.d.ts +88 -0
- package/dist/backend-definition.js +158 -0
- package/dist/backend-refusal.d.ts +10 -0
- package/dist/backend-refusal.js +10 -0
- package/dist/backend.d.ts +30 -0
- package/dist/backend.js +28 -0
- package/dist/capabilities.d.ts +30 -0
- package/dist/capabilities.js +50 -0
- package/dist/channels.d.ts +142 -0
- package/dist/channels.js +97 -0
- package/dist/commands.d.ts +33 -0
- package/dist/commands.js +46 -0
- package/dist/computer-contracts.d.ts +73 -0
- package/dist/computer-contracts.js +57 -0
- package/dist/computer.d.ts +294 -0
- package/dist/computer.js +319 -0
- package/dist/connect.d.ts +11 -0
- package/dist/connect.js +211 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.js +106 -0
- package/dist/failure.d.ts +2 -0
- package/dist/failure.js +9 -0
- package/dist/files.d.ts +25 -0
- package/dist/files.js +84 -0
- package/dist/game-servers.d.ts +530 -0
- package/dist/game-servers.js +244 -0
- package/dist/gills.d.ts +43 -0
- package/dist/gills.js +174 -0
- package/dist/git-commit.d.ts +143 -0
- package/dist/git-commit.js +251 -0
- package/dist/git-rpc.d.ts +310 -0
- package/dist/git-rpc.js +166 -0
- package/dist/git-steps.d.ts +579 -0
- package/dist/git-steps.js +804 -0
- package/dist/git-wire.d.ts +33 -0
- package/dist/git-wire.js +240 -0
- package/dist/git.d.ts +322 -0
- package/dist/git.js +98 -0
- package/dist/host.d.ts +97 -0
- package/dist/host.js +732 -0
- package/dist/inbox.d.ts +99 -0
- package/dist/inbox.js +184 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +15 -0
- package/dist/inference.d.ts +17 -0
- package/dist/inference.js +115 -0
- package/dist/internal/app-error.d.ts +8 -0
- package/dist/internal/app-error.js +36 -0
- package/dist/internal/app-session.d.ts +8 -0
- package/dist/internal/app-session.js +551 -0
- package/dist/internal/back-inputs.d.ts +22 -0
- package/dist/internal/back-inputs.js +93 -0
- package/dist/internal/browser-bridge.d.ts +30 -0
- package/dist/internal/browser-bridge.js +203 -0
- package/dist/internal/capabilities.d.ts +13 -0
- package/dist/internal/capabilities.js +138 -0
- package/dist/internal/commands.d.ts +9 -0
- package/dist/internal/commands.js +257 -0
- package/dist/internal/disconnect-host.d.ts +7 -0
- package/dist/internal/disconnect-host.js +19 -0
- package/dist/internal/git-edit-tree.d.ts +6 -0
- package/dist/internal/git-edit-tree.js +46 -0
- package/dist/internal/memory-fs.d.ts +39 -0
- package/dist/internal/memory-fs.js +154 -0
- package/dist/internal/protocol.d.ts +116 -0
- package/dist/internal/protocol.js +6 -0
- package/dist/internal/query-feed.d.ts +23 -0
- package/dist/internal/query-feed.js +111 -0
- package/dist/internal/result.d.ts +22 -0
- package/dist/internal/result.js +61 -0
- package/dist/internal/rpc-contract.d.ts +24 -0
- package/dist/internal/rpc-contract.js +78 -0
- package/dist/internal/schemas.d.ts +307 -0
- package/dist/internal/schemas.js +524 -0
- package/dist/internal/store.d.ts +8 -0
- package/dist/internal/store.js +30 -0
- package/dist/internal/terminal-gate.d.ts +17 -0
- package/dist/internal/terminal-gate.js +94 -0
- package/dist/lifecycle.d.ts +44 -0
- package/dist/lifecycle.js +1 -0
- package/dist/marketplace.d.ts +159 -0
- package/dist/marketplace.js +102 -0
- package/dist/media-json.d.ts +181 -0
- package/dist/media-json.js +204 -0
- package/dist/media-library.d.ts +11 -0
- package/dist/media-library.js +15 -0
- package/dist/media-request-id.d.ts +7 -0
- package/dist/media-request-id.js +16 -0
- package/dist/media.d.ts +354 -0
- package/dist/media.js +654 -0
- package/dist/method-refusal.d.ts +64 -0
- package/dist/method-refusal.js +48 -0
- package/dist/pending.d.ts +10 -0
- package/dist/pending.js +10 -0
- package/dist/query.d.ts +76 -0
- package/dist/query.js +195 -0
- package/dist/react-mount.d.ts +23 -0
- package/dist/react-mount.js +108 -0
- package/dist/react.d.ts +41 -0
- package/dist/react.js +111 -0
- package/dist/read-copy.d.ts +103 -0
- package/dist/read-copy.js +195 -0
- package/dist/roles/files.d.ts +295 -0
- package/dist/roles/files.js +184 -0
- package/dist/root.d.ts +21 -0
- package/dist/root.js +1 -0
- package/dist/rpc.d.ts +1 -0
- package/dist/rpc.js +1 -0
- package/dist/status.d.ts +17 -0
- package/dist/status.js +50 -0
- package/dist/storage-wire.d.ts +167 -0
- package/dist/storage-wire.js +115 -0
- package/dist/storage.d.ts +72 -0
- package/dist/storage.js +143 -0
- package/dist/store.d.ts +11 -0
- package/dist/store.js +1 -0
- package/dist/test-kit/git.d.ts +31 -0
- package/dist/test-kit/git.js +174 -0
- package/dist/ui.d.ts +169 -0
- package/dist/ui.js +10 -0
- package/dist/window.d.ts +41 -0
- package/dist/window.js +15 -0
- package/dist/world.d.ts +16 -0
- package/dist/world.js +17 -0
- package/docs/api/README.md +28 -0
- package/docs/api/app-build-contract.md +113 -0
- package/docs/api/backend-declaration.md +62 -0
- package/docs/api/backend-definition.md +215 -0
- package/docs/api/backend.md +269 -0
- package/docs/api/errors.md +169 -0
- package/docs/api/files.md +91 -0
- package/docs/api/gills.md +164 -0
- package/docs/api/git-commit.md +279 -0
- package/docs/api/git-rpc.md +243 -0
- package/docs/api/git-steps.md +1010 -0
- package/docs/api/git-wire.md +197 -0
- package/docs/api/git.md +579 -0
- package/docs/api/index.md +2880 -0
- package/docs/api/media-json.md +507 -0
- package/docs/api/media-request-id.md +32 -0
- package/docs/api/modules.md +32 -0
- package/docs/api/query.md +253 -0
- package/docs/api/react.md +216 -0
- package/docs/api/read-copy.md +204 -0
- package/docs/api/rpc.md +128 -0
- package/docs/api/storage.md +620 -0
- package/package.json +197 -3
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/agar**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/agar](modules.md) / storage
|
|
8
|
+
|
|
9
|
+
# storage
|
|
10
|
+
|
|
11
|
+
## Classes
|
|
12
|
+
|
|
13
|
+
### AppStorageError
|
|
14
|
+
|
|
15
|
+
Thrown by the storage client when a read, write, reset, or watch is rejected by
|
|
16
|
+
the host; `code` identifies why.
|
|
17
|
+
|
|
18
|
+
#### Extends
|
|
19
|
+
|
|
20
|
+
- `Error`
|
|
21
|
+
|
|
22
|
+
#### Constructors
|
|
23
|
+
|
|
24
|
+
##### Constructor
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
new AppStorageError(code, options?): AppStorageError;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
###### Parameters
|
|
31
|
+
|
|
32
|
+
| Parameter | Type |
|
|
33
|
+
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `code` | \| `"unavailable"` \| `"invalid"` \| `"conflict"` \| `"too_large"` \| `"undeclared_key"` \| `"scope_not_declared"` \| `"owner_required"` \| `"quota_exceeded"` |
|
|
35
|
+
| `options?` | `ErrorOptions` |
|
|
36
|
+
|
|
37
|
+
###### Returns
|
|
38
|
+
|
|
39
|
+
[`AppStorageError`](#appstorageerror)
|
|
40
|
+
|
|
41
|
+
###### Overrides
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
Error.constructor;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Properties
|
|
48
|
+
|
|
49
|
+
##### code
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
readonly code:
|
|
53
|
+
| "unavailable"
|
|
54
|
+
| "invalid"
|
|
55
|
+
| "conflict"
|
|
56
|
+
| "too_large"
|
|
57
|
+
| "undeclared_key"
|
|
58
|
+
| "scope_not_declared"
|
|
59
|
+
| "owner_required"
|
|
60
|
+
| "quota_exceeded";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Type Aliases
|
|
64
|
+
|
|
65
|
+
### ResolvedAppStorage
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
type ResolvedAppStorage = typeof resolvedAppStorageSchema.Type;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The resolved value for a storage key, as returned by `read`: the merged value,
|
|
72
|
+
which layer it came from, the raw team/member layers, and whether this App may
|
|
73
|
+
write to the team layer.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### AppStorageWrite
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
type AppStorageWrite = typeof appStorageWriteSchema.Type;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
A validated write request for one storage key.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### AppStorageReset
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
type AppStorageReset = typeof appStorageResetSchema.Type;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
A validated reset request for one storage key.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### AppStorageEvent
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
type AppStorageEvent = typeof appStorageEventSchema.Type;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
A change-event payload identifying which App, key, scope, and resulting revision
|
|
104
|
+
changed.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### AppStorageResult
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
type AppStorageResult<A> =
|
|
112
|
+
| Readonly<{
|
|
113
|
+
kind: "accepted";
|
|
114
|
+
value: A;
|
|
115
|
+
}>
|
|
116
|
+
| Readonly<{
|
|
117
|
+
kind: "rejected";
|
|
118
|
+
code: AppStorageError["code"];
|
|
119
|
+
}>;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The wire-level outcome of a storage operation: either an accepted value or a
|
|
123
|
+
rejection carrying an [AppStorageError](#appstorageerror) code.
|
|
124
|
+
|
|
125
|
+
#### Type Parameters
|
|
126
|
+
|
|
127
|
+
| Type Parameter |
|
|
128
|
+
| -------------- |
|
|
129
|
+
| `A` |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### AppStorageWatch
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
type AppStorageWatch = ReadonlyStore<ResolvedAppStorage> & Disposable & object;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
A live subscription to one storage key's resolved value: read the current value,
|
|
140
|
+
subscribe to changes, and close when done watching.
|
|
141
|
+
|
|
142
|
+
#### Type Declaration
|
|
143
|
+
|
|
144
|
+
| Name | Type | Description |
|
|
145
|
+
| --------- | ------------ | ------------------------------------------------------------ |
|
|
146
|
+
| `close()` | () => `void` | Stop watching and release the underlying event subscription. |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### AppStorage
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
type AppStorage = Readonly<{
|
|
154
|
+
read: Promise<{
|
|
155
|
+
value: Json;
|
|
156
|
+
source: "none" | "member" | "team";
|
|
157
|
+
team: {
|
|
158
|
+
value: Json;
|
|
159
|
+
revision: number;
|
|
160
|
+
} | null;
|
|
161
|
+
member: {
|
|
162
|
+
value: Json;
|
|
163
|
+
revision: number;
|
|
164
|
+
} | null;
|
|
165
|
+
canWriteTeam: boolean;
|
|
166
|
+
}>;
|
|
167
|
+
write: Promise<{
|
|
168
|
+
revision: number;
|
|
169
|
+
}>;
|
|
170
|
+
reset: Promise<{
|
|
171
|
+
revision: number;
|
|
172
|
+
}>;
|
|
173
|
+
watch: Promise<AppStorageWatch>;
|
|
174
|
+
}>;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This App's storage client, scoped to its declared member/team data.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### AppStorageEventHandle
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
type AppStorageEventHandle = Disposable & object;
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
A live object capability backing one key's change-event stream, adapted to Fetch
|
|
188
|
+
so it can drive an `EventSource`.
|
|
189
|
+
|
|
190
|
+
#### Type Declaration
|
|
191
|
+
|
|
192
|
+
| Name | Type | Description |
|
|
193
|
+
| --------- | -------------------------------------- | --------------------------------------------------------------- |
|
|
194
|
+
| `fetch()` | (`request`) => `Promise`\<`Response`\> | Forward one `EventSource` request to the host's event stream. |
|
|
195
|
+
| `close()` | () => `Promise`\<`void`\> | Release the change-event stream's underlying object capability. |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### AppStorageWire
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
type AppStorageWire = object;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
The raw wire contract this capability negotiates with the host, before
|
|
206
|
+
client-side input validation and error unwrapping.
|
|
207
|
+
|
|
208
|
+
#### Methods
|
|
209
|
+
|
|
210
|
+
##### read()
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
read(key): Promise<AppStorageResult<{
|
|
214
|
+
value: Json;
|
|
215
|
+
source: "none" | "member" | "team";
|
|
216
|
+
team: | {
|
|
217
|
+
value: Json;
|
|
218
|
+
revision: number;
|
|
219
|
+
}
|
|
220
|
+
| null;
|
|
221
|
+
member: | {
|
|
222
|
+
value: Json;
|
|
223
|
+
revision: number;
|
|
224
|
+
}
|
|
225
|
+
| null;
|
|
226
|
+
canWriteTeam: boolean;
|
|
227
|
+
}>>;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Read a key's resolved value over the wire; resolves with an accepted value or a
|
|
231
|
+
rejection code.
|
|
232
|
+
|
|
233
|
+
###### Parameters
|
|
234
|
+
|
|
235
|
+
| Parameter | Type |
|
|
236
|
+
| --------- | -------- |
|
|
237
|
+
| `key` | `string` |
|
|
238
|
+
|
|
239
|
+
###### Returns
|
|
240
|
+
|
|
241
|
+
`Promise`\<[`AppStorageResult`](#appstorageresult)\<\{ `value`: `Json`;
|
|
242
|
+
`source`: `"none"` \| `"member"` \| `"team"`; `team`: \| \{ `value`: `Json`;
|
|
243
|
+
`revision`: `number`; \} \| `null`; `member`: \| \{ `value`: `Json`; `revision`:
|
|
244
|
+
`number`; \} \| `null`; `canWriteTeam`: `boolean`; \}\>\>
|
|
245
|
+
|
|
246
|
+
##### write()
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
write(input): Promise<AppStorageResult<{
|
|
250
|
+
revision: number;
|
|
251
|
+
}>>;
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Write a key's value over the wire; resolves with the accepted revision or a
|
|
255
|
+
rejection code.
|
|
256
|
+
|
|
257
|
+
###### Parameters
|
|
258
|
+
|
|
259
|
+
| Parameter | Type |
|
|
260
|
+
| --------------- | ------------------------------------------------------------------------------------------------------- |
|
|
261
|
+
| `input` | \{ `key`: `string`; `scope`: `"member"` \| `"team"`; `basedOn`: `number` \| `null`; `value`: `Json`; \} |
|
|
262
|
+
| `input.key` | `string` |
|
|
263
|
+
| `input.scope` | `"member"` \| `"team"` |
|
|
264
|
+
| `input.basedOn` | `number` \| `null` |
|
|
265
|
+
| `input.value` | `Json` |
|
|
266
|
+
|
|
267
|
+
###### Returns
|
|
268
|
+
|
|
269
|
+
`Promise`\<[`AppStorageResult`](#appstorageresult)\<\{ `revision`: `number`;
|
|
270
|
+
\}\>\>
|
|
271
|
+
|
|
272
|
+
##### reset()
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
reset(input): Promise<AppStorageResult<{
|
|
276
|
+
revision: number;
|
|
277
|
+
}>>;
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Reset a key's value over the wire; resolves with the accepted revision or a
|
|
281
|
+
rejection code.
|
|
282
|
+
|
|
283
|
+
###### Parameters
|
|
284
|
+
|
|
285
|
+
| Parameter | Type |
|
|
286
|
+
| --------------- | -------------------------------------------------------------------------------------- |
|
|
287
|
+
| `input` | \{ `key`: `string`; `scope`: `"member"` \| `"team"`; `basedOn`: `number` \| `null`; \} |
|
|
288
|
+
| `input.key` | `string` |
|
|
289
|
+
| `input.scope` | `"member"` \| `"team"` |
|
|
290
|
+
| `input.basedOn` | `number` \| `null` |
|
|
291
|
+
|
|
292
|
+
###### Returns
|
|
293
|
+
|
|
294
|
+
`Promise`\<[`AppStorageResult`](#appstorageresult)\<\{ `revision`: `number`;
|
|
295
|
+
\}\>\>
|
|
296
|
+
|
|
297
|
+
##### openEvents()
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
openEvents(key): Promise<AppStorageEventHandle>;
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Open the change-event stream for a key, as a Fetch-adapted handle.
|
|
304
|
+
|
|
305
|
+
###### Parameters
|
|
306
|
+
|
|
307
|
+
| Parameter | Type |
|
|
308
|
+
| --------- | -------- |
|
|
309
|
+
| `key` | `string` |
|
|
310
|
+
|
|
311
|
+
###### Returns
|
|
312
|
+
|
|
313
|
+
`Promise`\<[`AppStorageEventHandle`](#appstorageeventhandle)\>
|
|
314
|
+
|
|
315
|
+
## Variables
|
|
316
|
+
|
|
317
|
+
### appStorageErrorCodes
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
const appStorageErrorCodes: readonly [
|
|
321
|
+
"invalid",
|
|
322
|
+
"undeclared_key",
|
|
323
|
+
"scope_not_declared",
|
|
324
|
+
"owner_required",
|
|
325
|
+
"too_large",
|
|
326
|
+
"quota_exceeded",
|
|
327
|
+
"conflict",
|
|
328
|
+
"unavailable",
|
|
329
|
+
];
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Storage error codes the host and client agree on: invalid input, an undeclared
|
|
333
|
+
key, a scope this App never declared, a member-only action tried without a
|
|
334
|
+
member, a value or quota that is too large, a write conflict, or a transient
|
|
335
|
+
host failure.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
### appStorageErrorCodeSchema
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
const appStorageErrorCodeSchema: Literals<
|
|
343
|
+
readonly [
|
|
344
|
+
"invalid",
|
|
345
|
+
"undeclared_key",
|
|
346
|
+
"scope_not_declared",
|
|
347
|
+
"owner_required",
|
|
348
|
+
"too_large",
|
|
349
|
+
"quota_exceeded",
|
|
350
|
+
"conflict",
|
|
351
|
+
"unavailable",
|
|
352
|
+
]
|
|
353
|
+
>;
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Validates that a value is one of the known storage error codes.
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
### resolvedAppStorageSchema
|
|
361
|
+
|
|
362
|
+
```ts
|
|
363
|
+
const resolvedAppStorageSchema: Struct<{
|
|
364
|
+
value: Codec<Json, Json, never, never>;
|
|
365
|
+
source: Literals<readonly ["member", "team", "none"]>;
|
|
366
|
+
team: NullOr<
|
|
367
|
+
Struct<{
|
|
368
|
+
value: Codec<Json, Json, never, never>;
|
|
369
|
+
revision: Int;
|
|
370
|
+
}>
|
|
371
|
+
>;
|
|
372
|
+
member: NullOr<
|
|
373
|
+
Struct<{
|
|
374
|
+
value: Codec<Json, Json, never, never>;
|
|
375
|
+
revision: Int;
|
|
376
|
+
}>
|
|
377
|
+
>;
|
|
378
|
+
canWriteTeam: Boolean;
|
|
379
|
+
}>;
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Validates the resolved shape of a storage key: its merged value, which layer it
|
|
383
|
+
came from, the raw team and member layers it was merged from, and whether this
|
|
384
|
+
App may write to the team layer.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### appStorageWriteSchema
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
const appStorageWriteSchema: Struct<{
|
|
392
|
+
key: String;
|
|
393
|
+
scope: Literals<readonly ["team", "member"]>;
|
|
394
|
+
basedOn: NullOr<Int>;
|
|
395
|
+
value: Codec<Json, Json, never, never>;
|
|
396
|
+
}>;
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Validates a write request: the key, scope, value to store, and the revision it's
|
|
400
|
+
conditioned on (`null` to write unconditionally).
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
### appStorageResetSchema
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const appStorageResetSchema: Struct<{
|
|
408
|
+
key: String;
|
|
409
|
+
scope: Literals<readonly ["team", "member"]>;
|
|
410
|
+
basedOn: NullOr<Int>;
|
|
411
|
+
}>;
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Validates a reset request: the key, scope, and the revision it's conditioned on
|
|
415
|
+
(`null` to reset unconditionally).
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
### appStorageRevisionSchema
|
|
420
|
+
|
|
421
|
+
```ts
|
|
422
|
+
const appStorageRevisionSchema: Struct<{
|
|
423
|
+
revision: Int;
|
|
424
|
+
}>;
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Validates a bare revision number returned after a write or reset.
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
### appStorageEventSchema
|
|
432
|
+
|
|
433
|
+
```ts
|
|
434
|
+
const appStorageEventSchema: Struct<{
|
|
435
|
+
appId: String;
|
|
436
|
+
key: String;
|
|
437
|
+
scope: Literals<readonly ["team", "member"]>;
|
|
438
|
+
revision: Int;
|
|
439
|
+
}>;
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Validates a change-event payload pushed when a storage key's value changes,
|
|
443
|
+
naming the App, key, scope, and resulting revision.
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
### appStorageReadResultSchema
|
|
448
|
+
|
|
449
|
+
```ts
|
|
450
|
+
const appStorageReadResultSchema: Union<
|
|
451
|
+
readonly [
|
|
452
|
+
Struct<{
|
|
453
|
+
kind: Literal<"accepted">;
|
|
454
|
+
value: Struct<{
|
|
455
|
+
value: Codec<Json, Json, never, never>;
|
|
456
|
+
source: Literals<readonly ["member", "team", "none"]>;
|
|
457
|
+
team: NullOr<
|
|
458
|
+
Struct<{
|
|
459
|
+
value: Codec<Json, Json, never, never>;
|
|
460
|
+
revision: Int;
|
|
461
|
+
}>
|
|
462
|
+
>;
|
|
463
|
+
member: NullOr<
|
|
464
|
+
Struct<{
|
|
465
|
+
value: Codec<Json, Json, never, never>;
|
|
466
|
+
revision: Int;
|
|
467
|
+
}>
|
|
468
|
+
>;
|
|
469
|
+
canWriteTeam: Boolean;
|
|
470
|
+
}>;
|
|
471
|
+
}>,
|
|
472
|
+
Struct<{
|
|
473
|
+
kind: Literal<"rejected">;
|
|
474
|
+
code: Literals<
|
|
475
|
+
readonly [
|
|
476
|
+
"invalid",
|
|
477
|
+
"undeclared_key",
|
|
478
|
+
"scope_not_declared",
|
|
479
|
+
"owner_required",
|
|
480
|
+
"too_large",
|
|
481
|
+
"quota_exceeded",
|
|
482
|
+
"conflict",
|
|
483
|
+
"unavailable",
|
|
484
|
+
]
|
|
485
|
+
>;
|
|
486
|
+
}>,
|
|
487
|
+
]
|
|
488
|
+
>;
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Validates the wire result of a read: either an accepted resolved value or a
|
|
492
|
+
rejection code.
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
### appStorageMutationResultSchema
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
const appStorageMutationResultSchema: Union<
|
|
500
|
+
readonly [
|
|
501
|
+
Struct<{
|
|
502
|
+
kind: Literal<"accepted">;
|
|
503
|
+
value: Struct<{
|
|
504
|
+
revision: Int;
|
|
505
|
+
}>;
|
|
506
|
+
}>,
|
|
507
|
+
Struct<{
|
|
508
|
+
kind: Literal<"rejected">;
|
|
509
|
+
code: Literals<
|
|
510
|
+
readonly [
|
|
511
|
+
"invalid",
|
|
512
|
+
"undeclared_key",
|
|
513
|
+
"scope_not_declared",
|
|
514
|
+
"owner_required",
|
|
515
|
+
"too_large",
|
|
516
|
+
"quota_exceeded",
|
|
517
|
+
"conflict",
|
|
518
|
+
"unavailable",
|
|
519
|
+
]
|
|
520
|
+
>;
|
|
521
|
+
}>,
|
|
522
|
+
]
|
|
523
|
+
>;
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
Validates the wire result of a write or reset: either an accepted revision or a
|
|
527
|
+
rejection code.
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
### appStorageBrokerReadResultSchema
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
const appStorageBrokerReadResultSchema: Union<readonly [Union<readonly [Struct<{
|
|
535
|
+
kind: Literal<"accepted">;
|
|
536
|
+
value: Struct<{
|
|
537
|
+
value: Codec<Json, Json, never, never>;
|
|
538
|
+
source: Literals<readonly ["member", "team", "none"]>;
|
|
539
|
+
team: NullOr<Struct<{
|
|
540
|
+
value: ...;
|
|
541
|
+
revision: ...;
|
|
542
|
+
}>>;
|
|
543
|
+
member: NullOr<Struct<{
|
|
544
|
+
value: ...;
|
|
545
|
+
revision: ...;
|
|
546
|
+
}>>;
|
|
547
|
+
canWriteTeam: Boolean;
|
|
548
|
+
}>;
|
|
549
|
+
}>, Struct<{
|
|
550
|
+
kind: Literal<"rejected">;
|
|
551
|
+
code: Literals<readonly ["invalid", "undeclared_key", "scope_not_declared", "owner_required", "too_large", "quota_exceeded", "conflict", "unavailable"]>;
|
|
552
|
+
}>]>, Struct<{
|
|
553
|
+
error: String;
|
|
554
|
+
}>]>;
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
The read result at a host broker, retaining its existing admission/failure
|
|
558
|
+
reply.
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
### appStorageBrokerMutationResultSchema
|
|
563
|
+
|
|
564
|
+
```ts
|
|
565
|
+
const appStorageBrokerMutationResultSchema: Union<
|
|
566
|
+
readonly [
|
|
567
|
+
Union<
|
|
568
|
+
readonly [
|
|
569
|
+
Struct<{
|
|
570
|
+
kind: Literal<"accepted">;
|
|
571
|
+
value: Struct<{
|
|
572
|
+
revision: Int;
|
|
573
|
+
}>;
|
|
574
|
+
}>,
|
|
575
|
+
Struct<{
|
|
576
|
+
kind: Literal<"rejected">;
|
|
577
|
+
code: Literals<
|
|
578
|
+
readonly [
|
|
579
|
+
"invalid",
|
|
580
|
+
"undeclared_key",
|
|
581
|
+
"scope_not_declared",
|
|
582
|
+
"owner_required",
|
|
583
|
+
"too_large",
|
|
584
|
+
"quota_exceeded",
|
|
585
|
+
"conflict",
|
|
586
|
+
"unavailable",
|
|
587
|
+
]
|
|
588
|
+
>;
|
|
589
|
+
}>,
|
|
590
|
+
]
|
|
591
|
+
>,
|
|
592
|
+
Struct<{
|
|
593
|
+
error: String;
|
|
594
|
+
}>,
|
|
595
|
+
]
|
|
596
|
+
>;
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
The shared write/reset result at a host broker, including its existing failure
|
|
600
|
+
reply.
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
### appStorage
|
|
605
|
+
|
|
606
|
+
```ts
|
|
607
|
+
const appStorage: CapabilityContract<AppStorage>;
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
This App's own declared data. The host seals App and member identities.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
### appStorageKeyNameSchema
|
|
615
|
+
|
|
616
|
+
```ts
|
|
617
|
+
const appStorageKeyNameSchema: Schema.String;
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
Maintained grammar for one bounded key in an App's private storage.
|