@onlyworlds/sdk 3.0.0 → 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +34 -0
- package/CHANGELOG.md +86 -0
- package/README.md +83 -248
- package/SCHEMA.md +630 -0
- package/dist/index.d.ts +464 -1414
- package/dist/index.js +770 -1024
- package/package.json +18 -6
- package/dist/index.d.mts +0 -3461
- package/dist/index.mjs +0 -1532
package/dist/index.d.ts
CHANGED
|
@@ -1,909 +1,428 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Branded type for element IDs - ensures type safety for relationships
|
|
11
|
-
* @template T The element type this ID references
|
|
12
|
-
*/
|
|
13
|
-
type ElementId<T extends ElementType$1> = string & Brand<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Branded type for arrays of element IDs
|
|
16
|
-
* @template T The element type these IDs reference
|
|
17
|
-
*/
|
|
18
|
-
type ElementIds<T extends ElementType$1> = ElementId<T>[];
|
|
19
|
-
/**
|
|
20
|
-
* Special type for IDs that can reference ANY element type
|
|
21
|
-
* Used in cases like Pin.element_type where the target can be any OnlyWorlds element
|
|
22
|
-
*/
|
|
23
|
-
type AnyElementId = ElementId<ElementType$1>;
|
|
24
|
-
/**
|
|
25
|
-
* Base fields shared by all OnlyWorlds elements
|
|
26
|
-
*/
|
|
27
|
-
interface BaseElement {
|
|
28
|
-
id?: string;
|
|
1
|
+
/** Every element carries these. The extension index signature admits namespaced
|
|
2
|
+
* pass-through fields (atlas_* / shadow_* / x_*) returned verbatim by the server. */
|
|
3
|
+
interface OwElementBase {
|
|
4
|
+
/** Element type slug (server-managed, read-only). */
|
|
5
|
+
type: string;
|
|
6
|
+
/** Unique identifier, uuidv7 format. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Name of the element. */
|
|
29
9
|
name: string;
|
|
10
|
+
/** Any kind of details about the element. */
|
|
30
11
|
description?: string;
|
|
31
|
-
|
|
12
|
+
/** The top level category to which the element belongs. */
|
|
32
13
|
supertype?: string;
|
|
14
|
+
/** The sub level category through which the element is further classified. */
|
|
33
15
|
subtype?: string;
|
|
34
|
-
|
|
35
|
-
created_at?: string;
|
|
36
|
-
updated_at?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* World element type
|
|
40
|
-
*/
|
|
41
|
-
interface World {
|
|
42
|
-
id?: string;
|
|
43
|
-
api_key: string;
|
|
44
|
-
name: string;
|
|
45
|
-
description?: string;
|
|
46
|
-
version?: string;
|
|
16
|
+
/** URL to an image representing the element. */
|
|
47
17
|
image_url?: string;
|
|
48
|
-
|
|
49
|
-
time_format_names?: any[];
|
|
50
|
-
time_basic_unit?: string;
|
|
51
|
-
time_range_min?: number;
|
|
52
|
-
time_range_max?: number;
|
|
53
|
-
time_current?: number;
|
|
54
|
-
user?: string;
|
|
18
|
+
/** Creation timestamp (server-managed, read-only). */
|
|
55
19
|
created_at?: string;
|
|
20
|
+
/** Last-update timestamp (server-managed, read-only). */
|
|
56
21
|
updated_at?: string;
|
|
22
|
+
/** Per-world change cursor, stamped on every write (server-managed, read-only). */
|
|
23
|
+
change_seq?: number;
|
|
24
|
+
/** Namespaced extension fields (atlas_* / shadow_* / x_*), returned verbatim. */
|
|
25
|
+
[ext: string]: unknown;
|
|
57
26
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*/
|
|
61
|
-
|
|
27
|
+
type ElementType = 'ability' | 'character' | 'collective' | 'construct' | 'creature' | 'event' | 'family' | 'institution' | 'language' | 'law' | 'location' | 'map' | 'marker' | 'narrative' | 'object' | 'phenomenon' | 'pin' | 'relation' | 'species' | 'title' | 'trait' | 'zone';
|
|
28
|
+
declare const ELEMENT_TYPES: ElementType[];
|
|
29
|
+
/** The four semantic families (colour carries the family; ELEMENT_ICONS carries the type). */
|
|
30
|
+
type ElementFamily = 'agents' | 'world' | 'abstract' | 'temporal';
|
|
31
|
+
/** Per-type semantic family. Source: keel's PRESENTATION-WRAPPER schema key `family:`
|
|
32
|
+
* (first-party rendering metadata, keel-only — NOT part of the council-governed
|
|
33
|
+
* OnlyWorlds standard; see keel/schema-pipeline.md "The wrapper layer"). */
|
|
34
|
+
declare const ELEMENT_FAMILIES: Record<ElementType, ElementFamily>;
|
|
35
|
+
/** Material Symbols icon name per type. Source: keel's PRESENTATION-WRAPPER key `icon:` (keel 56c124a). */
|
|
36
|
+
declare const ELEMENT_ICONS: Record<ElementType, string>;
|
|
37
|
+
/** Field grouping for display. DERIVED from the canonical schema's own document
|
|
38
|
+
* structure (top-level property groups, document order = display order). */
|
|
39
|
+
interface SectionInfo {
|
|
62
40
|
name: string;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
image_url?: string;
|
|
66
|
-
time_format_equivalents?: any[];
|
|
67
|
-
time_format_names?: any[];
|
|
68
|
-
time_basic_unit?: string;
|
|
69
|
-
time_range_min?: number;
|
|
70
|
-
time_range_max?: number;
|
|
71
|
-
time_current?: number;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Ability element type
|
|
75
|
-
* Fields organized by sections: Mechanics, World
|
|
76
|
-
*/
|
|
77
|
-
interface Ability extends BaseElement {
|
|
78
|
-
activation?: string;
|
|
79
|
-
duration?: number;
|
|
80
|
-
potency?: number;
|
|
81
|
-
range?: number;
|
|
82
|
-
effects?: ElementIds<ElementType$1.Phenomenon>;
|
|
83
|
-
challenges?: string;
|
|
84
|
-
talents?: ElementIds<ElementType$1.Trait>;
|
|
85
|
-
requisites?: ElementIds<ElementType$1.Construct>;
|
|
86
|
-
prevalence?: string;
|
|
87
|
-
tradition?: ElementId<ElementType$1.Construct>;
|
|
88
|
-
source?: ElementId<ElementType$1.Phenomenon>;
|
|
89
|
-
locus?: ElementId<ElementType$1.Location>;
|
|
90
|
-
instruments?: ElementIds<ElementType$1.Object>;
|
|
91
|
-
systems?: ElementIds<ElementType$1.Construct>;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Object element type
|
|
95
|
-
* Fields organized by sections: Form, Function, World
|
|
96
|
-
*/
|
|
97
|
-
interface Object$1 extends BaseElement {
|
|
98
|
-
aesthetics?: string;
|
|
99
|
-
weight?: number;
|
|
100
|
-
amount?: number;
|
|
101
|
-
parent_object?: ElementId<ElementType$1.Object>;
|
|
102
|
-
materials?: ElementIds<ElementType$1.Construct>;
|
|
103
|
-
technology?: ElementIds<ElementType$1.Construct>;
|
|
104
|
-
utility?: string;
|
|
105
|
-
effects?: ElementIds<ElementType$1.Phenomenon>;
|
|
106
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
107
|
-
consumes?: ElementIds<ElementType$1.Construct>;
|
|
108
|
-
origins?: string;
|
|
109
|
-
location?: ElementId<ElementType$1.Location>;
|
|
110
|
-
language?: ElementId<ElementType$1.Language>;
|
|
111
|
-
affinities?: ElementIds<ElementType$1.Trait>;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Character element type
|
|
115
|
-
* Fields organized by sections: Constitution, Origins, World, Personality, Social, TTRPG
|
|
116
|
-
*/
|
|
117
|
-
interface Character extends BaseElement {
|
|
118
|
-
physicality?: string;
|
|
119
|
-
mentality?: string;
|
|
120
|
-
height?: number;
|
|
121
|
-
weight?: number;
|
|
122
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
123
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
124
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
125
|
-
background?: string;
|
|
126
|
-
motivations?: string;
|
|
127
|
-
birth_date?: number;
|
|
128
|
-
birthplace?: ElementId<ElementType$1.Location>;
|
|
129
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
130
|
-
reputation?: string;
|
|
131
|
-
location?: ElementId<ElementType$1.Location>;
|
|
132
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
133
|
-
institutions?: ElementIds<ElementType$1.Institution>;
|
|
134
|
-
charisma?: number;
|
|
135
|
-
coercion?: number;
|
|
136
|
-
competence?: number;
|
|
137
|
-
compassion?: number;
|
|
138
|
-
creativity?: number;
|
|
139
|
-
courage?: number;
|
|
140
|
-
family?: ElementIds<ElementType$1.Family>;
|
|
141
|
-
friends?: ElementIds<ElementType$1.Character>;
|
|
142
|
-
rivals?: ElementIds<ElementType$1.Character>;
|
|
143
|
-
level?: number;
|
|
144
|
-
hit_points?: number;
|
|
145
|
-
STR?: number;
|
|
146
|
-
DEX?: number;
|
|
147
|
-
CON?: number;
|
|
148
|
-
INT?: number;
|
|
149
|
-
WIS?: number;
|
|
150
|
-
CHA?: number;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Collective element type
|
|
154
|
-
* Fields organized by sections: Formation, Dynamics, World
|
|
155
|
-
*/
|
|
156
|
-
interface Collective extends BaseElement {
|
|
157
|
-
composition?: string;
|
|
158
|
-
count?: number;
|
|
159
|
-
formation_date?: number;
|
|
160
|
-
operator?: ElementId<ElementType$1.Institution>;
|
|
161
|
-
equipment?: ElementIds<ElementType$1.Construct>;
|
|
162
|
-
activity?: string;
|
|
163
|
-
disposition?: string;
|
|
164
|
-
state?: string;
|
|
165
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
166
|
-
symbolism?: ElementIds<ElementType$1.Construct>;
|
|
167
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
168
|
-
characters?: ElementIds<ElementType$1.Character>;
|
|
169
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
170
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Construct element type
|
|
174
|
-
* Fields organized by sections: Nature, Involves
|
|
175
|
-
*/
|
|
176
|
-
interface Construct extends BaseElement {
|
|
177
|
-
rationale?: string;
|
|
178
|
-
history?: string;
|
|
179
|
-
status?: string;
|
|
180
|
-
reach?: string;
|
|
181
|
-
start_date?: number;
|
|
182
|
-
end_date?: number;
|
|
183
|
-
founder?: ElementId<ElementType$1.Character>;
|
|
184
|
-
custodian?: ElementId<ElementType$1.Institution>;
|
|
185
|
-
characters?: ElementIds<ElementType$1.Character>;
|
|
186
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
187
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
188
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
189
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
190
|
-
institutions?: ElementIds<ElementType$1.Institution>;
|
|
191
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
192
|
-
collectives?: ElementIds<ElementType$1.Collective>;
|
|
193
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
194
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
195
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
196
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
197
|
-
families?: ElementIds<ElementType$1.Family>;
|
|
198
|
-
relations?: ElementIds<ElementType$1.Relation>;
|
|
199
|
-
titles?: ElementIds<ElementType$1.Title>;
|
|
200
|
-
constructs?: ElementIds<ElementType$1.Construct>;
|
|
201
|
-
events?: ElementIds<ElementType$1.Event>;
|
|
202
|
-
narratives?: ElementIds<ElementType$1.Narrative>;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Creature element type
|
|
206
|
-
* Fields organized by sections: Biology, Behaviour, World, TTRPG
|
|
207
|
-
*/
|
|
208
|
-
interface Creature extends BaseElement {
|
|
209
|
-
appearance?: string;
|
|
210
|
-
weight?: number;
|
|
211
|
-
height?: number;
|
|
212
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
213
|
-
habits?: string;
|
|
214
|
-
demeanor?: string;
|
|
215
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
216
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
217
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
218
|
-
status?: string;
|
|
219
|
-
birth_date?: number;
|
|
220
|
-
location?: ElementId<ElementType$1.Location>;
|
|
221
|
-
zone?: ElementId<ElementType$1.Zone>;
|
|
222
|
-
challenge_rating?: number;
|
|
223
|
-
hit_points?: number;
|
|
224
|
-
armor_class?: number;
|
|
225
|
-
speed?: number;
|
|
226
|
-
actions?: ElementIds<ElementType$1.Ability>;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Event element type
|
|
230
|
-
* Fields organized by sections: Nature, Involves
|
|
231
|
-
*/
|
|
232
|
-
interface Event extends BaseElement {
|
|
233
|
-
history?: string;
|
|
234
|
-
challenges?: string;
|
|
235
|
-
consequences?: string;
|
|
236
|
-
start_date?: number;
|
|
237
|
-
end_date?: number;
|
|
238
|
-
triggers?: ElementIds<ElementType$1.Event>;
|
|
239
|
-
characters?: ElementIds<ElementType$1.Character>;
|
|
240
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
241
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
242
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
243
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
244
|
-
institutions?: ElementIds<ElementType$1.Institution>;
|
|
245
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
246
|
-
collectives?: ElementIds<ElementType$1.Collective>;
|
|
247
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
248
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
249
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
250
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
251
|
-
families?: ElementIds<ElementType$1.Family>;
|
|
252
|
-
relations?: ElementIds<ElementType$1.Relation>;
|
|
253
|
-
titles?: ElementIds<ElementType$1.Title>;
|
|
254
|
-
constructs?: ElementIds<ElementType$1.Construct>;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Family element type
|
|
258
|
-
* Fields organized by sections: Identity, World
|
|
259
|
-
*/
|
|
260
|
-
interface Family extends BaseElement {
|
|
261
|
-
spirit?: string;
|
|
262
|
-
history?: string;
|
|
263
|
-
traditions?: ElementIds<ElementType$1.Construct>;
|
|
264
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
265
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
266
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
267
|
-
ancestors?: ElementIds<ElementType$1.Character>;
|
|
268
|
-
reputation?: string;
|
|
269
|
-
estates?: ElementIds<ElementType$1.Location>;
|
|
270
|
-
governs?: ElementIds<ElementType$1.Institution>;
|
|
271
|
-
heirlooms?: ElementIds<ElementType$1.Object>;
|
|
272
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Institution element type
|
|
276
|
-
* Fields organized by sections: Foundation, Claims, World
|
|
277
|
-
*/
|
|
278
|
-
interface Institution extends BaseElement {
|
|
279
|
-
doctrine?: string;
|
|
280
|
-
founding_date?: number;
|
|
281
|
-
parent_institution?: ElementId<ElementType$1.Institution>;
|
|
282
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
283
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
284
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
285
|
-
status?: string;
|
|
286
|
-
allies?: ElementIds<ElementType$1.Institution>;
|
|
287
|
-
adversaries?: ElementIds<ElementType$1.Institution>;
|
|
288
|
-
constructs?: ElementIds<ElementType$1.Construct>;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Language element type
|
|
292
|
-
* Fields organized by sections: Structure, World
|
|
293
|
-
*/
|
|
294
|
-
interface Language extends BaseElement {
|
|
295
|
-
phonology?: string;
|
|
296
|
-
grammar?: string;
|
|
297
|
-
lexicon?: string;
|
|
298
|
-
writing?: string;
|
|
299
|
-
classification?: ElementId<ElementType$1.Construct>;
|
|
300
|
-
status?: string;
|
|
301
|
-
spread?: ElementIds<ElementType$1.Location>;
|
|
302
|
-
dialects?: ElementIds<ElementType$1.Language>;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Law element type
|
|
306
|
-
* Fields organized by sections: Code, World
|
|
307
|
-
*/
|
|
308
|
-
interface Law extends BaseElement {
|
|
309
|
-
declaration?: string;
|
|
310
|
-
purpose?: string;
|
|
311
|
-
date?: number;
|
|
312
|
-
parent_law?: ElementId<ElementType$1.Law>;
|
|
313
|
-
penalties?: ElementIds<ElementType$1.Construct>;
|
|
314
|
-
author?: ElementId<ElementType$1.Institution>;
|
|
315
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
316
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
317
|
-
prohibitions?: ElementIds<ElementType$1.Construct>;
|
|
318
|
-
adjudicators?: ElementIds<ElementType$1.Title>;
|
|
319
|
-
enforcers?: ElementIds<ElementType$1.Title>;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Location element type
|
|
323
|
-
* Fields organized by sections: Setting, Politics, World, Production, Commerce, Construction, Defense
|
|
324
|
-
*/
|
|
325
|
-
interface Location extends BaseElement {
|
|
326
|
-
form?: string;
|
|
327
|
-
function?: string;
|
|
328
|
-
founding_date?: number;
|
|
329
|
-
parent_location?: ElementId<ElementType$1.Location>;
|
|
330
|
-
populations?: ElementIds<ElementType$1.Collective>;
|
|
331
|
-
political_climate?: string;
|
|
332
|
-
primary_power?: ElementId<ElementType$1.Institution>;
|
|
333
|
-
governing_title?: ElementId<ElementType$1.Title>;
|
|
334
|
-
secondary_powers?: ElementIds<ElementType$1.Institution>;
|
|
335
|
-
zone?: ElementId<ElementType$1.Zone>;
|
|
336
|
-
rival?: ElementId<ElementType$1.Location>;
|
|
337
|
-
partner?: ElementId<ElementType$1.Location>;
|
|
338
|
-
customs?: string;
|
|
339
|
-
founders?: ElementIds<ElementType$1.Character>;
|
|
340
|
-
cults?: ElementIds<ElementType$1.Construct>;
|
|
341
|
-
delicacies?: ElementIds<ElementType$1.Species>;
|
|
342
|
-
extraction_methods?: ElementIds<ElementType$1.Construct>;
|
|
343
|
-
extraction_goods?: ElementIds<ElementType$1.Construct>;
|
|
344
|
-
industry_methods?: ElementIds<ElementType$1.Construct>;
|
|
345
|
-
industry_goods?: ElementIds<ElementType$1.Construct>;
|
|
346
|
-
infrastructure?: string;
|
|
347
|
-
extraction_markets?: ElementIds<ElementType$1.Location>;
|
|
348
|
-
industry_markets?: ElementIds<ElementType$1.Location>;
|
|
349
|
-
currencies?: ElementIds<ElementType$1.Construct>;
|
|
350
|
-
architecture?: string;
|
|
351
|
-
buildings?: ElementIds<ElementType$1.Object>;
|
|
352
|
-
building_methods?: ElementIds<ElementType$1.Construct>;
|
|
353
|
-
defensibility?: string;
|
|
354
|
-
elevation?: number;
|
|
355
|
-
fighters?: ElementIds<ElementType$1.Construct>;
|
|
356
|
-
defensive_objects?: ElementIds<ElementType$1.Object>;
|
|
41
|
+
order: number;
|
|
42
|
+
fields: string[];
|
|
357
43
|
}
|
|
44
|
+
declare const ELEMENT_SECTIONS: Record<ElementType, SectionInfo[]>;
|
|
45
|
+
|
|
358
46
|
/**
|
|
359
|
-
*
|
|
360
|
-
*
|
|
47
|
+
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
48
|
+
* wire-corrected against live staging fixtures 2026-07-18.
|
|
49
|
+
*
|
|
50
|
+
* OnlyWorlds v2 (keel) wire types -- the NON-generated, hand-owned wire shapes
|
|
51
|
+
* (envelopes, pages, bulk, changes, config). Per-type element field typing is
|
|
52
|
+
* generated (types.generated.ts). One-shape principle: a field reads the way it
|
|
53
|
+
* writes -- links are UUID arrays (or UUID/null), same name both directions.
|
|
54
|
+
* No `_ids` suffix in v2.
|
|
361
55
|
*/
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
56
|
+
|
|
57
|
+
/** An element as read from / written to the v2 API. Loose base + extension keys. */
|
|
58
|
+
type OwElement = OwElementBase;
|
|
59
|
+
/** Spatial types live under spatial/ in the OW Folder Format. */
|
|
60
|
+
declare const SPATIAL_TYPES: readonly ElementType[];
|
|
61
|
+
interface OwWorldMeta {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
updated_at?: string;
|
|
65
|
+
public_read?: boolean;
|
|
66
|
+
[field: string]: unknown;
|
|
373
67
|
}
|
|
374
|
-
/**
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
background?: string;
|
|
380
|
-
start_date?: number;
|
|
381
|
-
end_date?: number;
|
|
382
|
-
intensity?: number;
|
|
383
|
-
actor?: ElementId<ElementType$1.Character>;
|
|
384
|
-
events?: ElementIds<ElementType$1.Event>;
|
|
385
|
-
characters?: ElementIds<ElementType$1.Character>;
|
|
386
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
387
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
388
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
389
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
390
|
-
institutions?: ElementIds<ElementType$1.Institution>;
|
|
391
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
392
|
-
collectives?: ElementIds<ElementType$1.Collective>;
|
|
393
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
394
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
395
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
396
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
397
|
-
families?: ElementIds<ElementType$1.Family>;
|
|
398
|
-
titles?: ElementIds<ElementType$1.Title>;
|
|
399
|
-
constructs?: ElementIds<ElementType$1.Construct>;
|
|
400
|
-
narratives?: ElementIds<ElementType$1.Narrative>;
|
|
68
|
+
/** List envelope: cursor-paginated. */
|
|
69
|
+
interface OwPage<T = OwElement> {
|
|
70
|
+
data: T[];
|
|
71
|
+
has_more: boolean;
|
|
72
|
+
next_cursor: string | null;
|
|
401
73
|
}
|
|
74
|
+
/** /changes feed -- discriminated union on `op`. Apply in order -> convergence. */
|
|
75
|
+
type OwChange = {
|
|
76
|
+
op: 'upsert';
|
|
77
|
+
id: string;
|
|
78
|
+
type: string;
|
|
79
|
+
element: OwElement;
|
|
80
|
+
updated_at: string;
|
|
81
|
+
[k: string]: unknown;
|
|
82
|
+
} | {
|
|
83
|
+
op: 'delete';
|
|
84
|
+
id: string;
|
|
85
|
+
type: string;
|
|
86
|
+
deleted_at: string;
|
|
87
|
+
[k: string]: unknown;
|
|
88
|
+
};
|
|
402
89
|
/**
|
|
403
|
-
*
|
|
404
|
-
*
|
|
90
|
+
* /changes response. Wire shape verified in keel source (core/changes.py) and
|
|
91
|
+
* pinned here: {cursor, changes, has_more, head}.
|
|
405
92
|
*/
|
|
406
|
-
interface
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
aggression?: number;
|
|
418
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
419
|
-
role?: string;
|
|
420
|
-
parent_species?: ElementId<ElementType$1.Species>;
|
|
421
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
422
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
423
|
-
affinities?: ElementIds<ElementType$1.Phenomenon>;
|
|
93
|
+
interface OwChangesPage {
|
|
94
|
+
/** Opaque compound cursor -- persist verbatim, never parse, never expires. */
|
|
95
|
+
cursor: string;
|
|
96
|
+
changes: OwChange[];
|
|
97
|
+
has_more: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* World's current change_seq. If a persisted cursor is ever AHEAD of head,
|
|
100
|
+
* the server rewound (disaster restore) -- re-baseline from cursor zero
|
|
101
|
+
* instead of assuming caught-up.
|
|
102
|
+
*/
|
|
103
|
+
head: number;
|
|
424
104
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
*/
|
|
429
|
-
interface Zone extends BaseElement {
|
|
430
|
-
role?: string;
|
|
431
|
-
start_date?: number;
|
|
432
|
-
end_date?: number;
|
|
433
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
434
|
-
linked_zones?: ElementIds<ElementType$1.Zone>;
|
|
435
|
-
context?: string;
|
|
436
|
-
populations?: ElementIds<ElementType$1.Collective>;
|
|
437
|
-
titles?: ElementIds<ElementType$1.Title>;
|
|
438
|
-
principles?: ElementIds<ElementType$1.Construct>;
|
|
105
|
+
interface OwBulkItem {
|
|
106
|
+
type: ElementType | string;
|
|
107
|
+
element: OwElement | Record<string, unknown>;
|
|
439
108
|
}
|
|
440
109
|
/**
|
|
441
|
-
*
|
|
442
|
-
*
|
|
110
|
+
* One slot of a /bulk response. WIRE-CORRECTED (fixtures P2a/P2c): `status` is
|
|
111
|
+
* the NUMERIC HTTP status of that slot (201/400/...), success slots echo
|
|
112
|
+
* created_at/updated_at, error slots carry an OwErrorBody under `error`.
|
|
443
113
|
*/
|
|
444
|
-
interface
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
body?: ElementId<ElementType$1.Institution>;
|
|
451
|
-
superior_title?: ElementId<ElementType$1.Title>;
|
|
452
|
-
holders?: ElementIds<ElementType$1.Character>;
|
|
453
|
-
symbols?: ElementIds<ElementType$1.Object>;
|
|
454
|
-
status?: string;
|
|
455
|
-
history?: string;
|
|
456
|
-
characters?: ElementIds<ElementType$1.Character>;
|
|
457
|
-
institutions?: ElementIds<ElementType$1.Institution>;
|
|
458
|
-
families?: ElementIds<ElementType$1.Family>;
|
|
459
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
460
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
461
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
462
|
-
constructs?: ElementIds<ElementType$1.Construct>;
|
|
463
|
-
laws?: ElementIds<ElementType$1.Law>;
|
|
464
|
-
collectives?: ElementIds<ElementType$1.Collective>;
|
|
465
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
466
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
467
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
468
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
114
|
+
interface OwBulkItemResult {
|
|
115
|
+
status: number;
|
|
116
|
+
id?: string;
|
|
117
|
+
created_at?: string;
|
|
118
|
+
updated_at?: string;
|
|
119
|
+
error?: OwErrorBody;
|
|
469
120
|
}
|
|
470
|
-
/**
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
functional_effects?: string;
|
|
478
|
-
personality_effects?: string;
|
|
479
|
-
behaviour_effects?: string;
|
|
480
|
-
charisma?: number;
|
|
481
|
-
coercion?: number;
|
|
482
|
-
competence?: number;
|
|
483
|
-
compassion?: number;
|
|
484
|
-
creativity?: number;
|
|
485
|
-
courage?: number;
|
|
486
|
-
significance?: string;
|
|
487
|
-
anti_trait?: ElementId<ElementType$1.Trait>;
|
|
488
|
-
empowered_abilities?: ElementIds<ElementType$1.Ability>;
|
|
121
|
+
/** The wire error envelope carried in error slots and thrown errors. */
|
|
122
|
+
interface OwErrorBody {
|
|
123
|
+
type?: string;
|
|
124
|
+
code?: string;
|
|
125
|
+
message?: string;
|
|
126
|
+
param?: string | null;
|
|
127
|
+
doc_url?: string;
|
|
489
128
|
}
|
|
490
129
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
130
|
+
* /bulk response. WIRE-CORRECTED (fixtures P2a/P2c): the array key is `items`,
|
|
131
|
+
* not `results`. `wasReplay` is populated by the client from the (lowercase on
|
|
132
|
+
* the wire) Idempotent-Replay response header (fixture P2b) -- not a wire field.
|
|
493
133
|
*/
|
|
494
|
-
interface
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
parent_narrative?: ElementId<ElementType$1.Narrative>;
|
|
501
|
-
protagonist?: ElementId<ElementType$1.Character>;
|
|
502
|
-
antagonist?: ElementId<ElementType$1.Character>;
|
|
503
|
-
narrator?: ElementId<ElementType$1.Character>;
|
|
504
|
-
conservator?: ElementId<ElementType$1.Institution>;
|
|
505
|
-
events?: ElementIds<ElementType$1.Event>;
|
|
506
|
-
characters?: ElementIds<ElementType$1.Character>;
|
|
507
|
-
objects?: ElementIds<ElementType$1.Object>;
|
|
508
|
-
locations?: ElementIds<ElementType$1.Location>;
|
|
509
|
-
species?: ElementIds<ElementType$1.Species>;
|
|
510
|
-
creatures?: ElementIds<ElementType$1.Creature>;
|
|
511
|
-
institutions?: ElementIds<ElementType$1.Institution>;
|
|
512
|
-
traits?: ElementIds<ElementType$1.Trait>;
|
|
513
|
-
collectives?: ElementIds<ElementType$1.Collective>;
|
|
514
|
-
zones?: ElementIds<ElementType$1.Zone>;
|
|
515
|
-
abilities?: ElementIds<ElementType$1.Ability>;
|
|
516
|
-
phenomena?: ElementIds<ElementType$1.Phenomenon>;
|
|
517
|
-
languages?: ElementIds<ElementType$1.Language>;
|
|
518
|
-
families?: ElementIds<ElementType$1.Family>;
|
|
519
|
-
relations?: ElementIds<ElementType$1.Relation>;
|
|
520
|
-
titles?: ElementIds<ElementType$1.Title>;
|
|
521
|
-
constructs?: ElementIds<ElementType$1.Construct>;
|
|
522
|
-
laws?: ElementIds<ElementType$1.Law>;
|
|
134
|
+
interface OwBulkResponse {
|
|
135
|
+
errors: boolean;
|
|
136
|
+
items: OwBulkItemResult[];
|
|
137
|
+
/** Client-derived: true when the server replayed a prior Idempotency-Key. */
|
|
138
|
+
wasReplay?: boolean;
|
|
139
|
+
[k: string]: unknown;
|
|
523
140
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
*/
|
|
528
|
-
interface Map extends BaseElement {
|
|
529
|
-
background_color?: string;
|
|
530
|
-
hierarchy?: number;
|
|
531
|
-
width?: number;
|
|
532
|
-
height?: number;
|
|
533
|
-
depth?: number;
|
|
534
|
-
parent_map?: ElementId<ElementType$1.Map>;
|
|
535
|
-
location?: ElementId<ElementType$1.Location>;
|
|
141
|
+
interface OwLinkEdit {
|
|
142
|
+
add?: string[];
|
|
143
|
+
remove?: string[];
|
|
536
144
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
*/
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
145
|
+
interface ListParams {
|
|
146
|
+
limit?: number;
|
|
147
|
+
cursor?: string;
|
|
148
|
+
/** One-level stub expansion, e.g. ['friends', 'location']. */
|
|
149
|
+
expand?: string[];
|
|
150
|
+
/** Sparse include-set of field names. */
|
|
151
|
+
fields?: string[];
|
|
152
|
+
/**
|
|
153
|
+
* Blessed Django-style filters: __icontains, __in, __gte, __lte, __isnull,
|
|
154
|
+
* supertype/subtype equality. Unknown params 422 loudly server-side -- the
|
|
155
|
+
* client passes them through and lets the platform name the typo.
|
|
156
|
+
*/
|
|
157
|
+
filter?: Record<string, string | number | boolean>;
|
|
548
158
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
*/
|
|
553
|
-
interface Pin extends BaseElement {
|
|
554
|
-
map?: ElementId<ElementType$1.Map>;
|
|
555
|
-
element_type?: ElementType$1;
|
|
556
|
-
element_id?: AnyElementId;
|
|
159
|
+
interface OwClientConfig {
|
|
160
|
+
/** ow_w_ / ow_r_ / ow_a_ prefixed key, or grandfathered 10-digit legacy key. */
|
|
161
|
+
apiKey: string;
|
|
557
162
|
/**
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
163
|
+
* Optional. Required for writes when the world has a PIN, and for legacy-key
|
|
164
|
+
* reads of private worlds. Prefixed keys read PIN-less. String, not number --
|
|
165
|
+
* '0123' !== 123.
|
|
561
166
|
*/
|
|
562
|
-
|
|
167
|
+
apiPin?: string;
|
|
168
|
+
/** Default: https://www.onlyworlds.com/api/v2 */
|
|
169
|
+
baseUrl?: string;
|
|
563
170
|
/**
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
* or calculations should be rounded: Math.round(y)
|
|
171
|
+
* Page size for element lists. Default 100 (server default; max 1000).
|
|
172
|
+
* Deliberately visible in config: page size is a citizenship property.
|
|
567
173
|
*/
|
|
568
|
-
|
|
174
|
+
pageSize?: number;
|
|
569
175
|
/**
|
|
570
|
-
*
|
|
571
|
-
*
|
|
176
|
+
* Page size for /changes pulls. Default 100. Live precedents: Obsidian 100,
|
|
177
|
+
* Atlas 250, MCP 25. /changes is the platform's heaviest route -- be polite.
|
|
572
178
|
*/
|
|
573
|
-
|
|
179
|
+
changesPageSize?: number;
|
|
180
|
+
/** Injectable for tests / fake-keel harnesses. Defaults to globalThis.fetch. */
|
|
181
|
+
fetch?: typeof globalThis.fetch;
|
|
574
182
|
}
|
|
183
|
+
|
|
575
184
|
/**
|
|
576
|
-
*
|
|
577
|
-
*
|
|
185
|
+
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
186
|
+
* wire-corrected against live staging fixtures 2026-07-18.
|
|
187
|
+
*
|
|
188
|
+
* keel error envelope handling. The error contract is part of the contract:
|
|
189
|
+
* envelopes carry a machine `code` and a `doc_url` fragment anchored at
|
|
190
|
+
* onlyworlds.github.io/api/errors -- surface both, always. The live wire
|
|
191
|
+
* envelope also carries `type` and `param` (fixtures P4a/P2c); both are
|
|
192
|
+
* surfaced on the thrown error.
|
|
578
193
|
*/
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
interface CharacterInput extends Omit<Character, 'birthplace' | 'location' | 'species' | 'traits' | 'abilities' | 'languages' | 'objects' | 'institutions' | 'family' | 'friends' | 'rivals'> {
|
|
601
|
-
birthplace?: string;
|
|
602
|
-
location?: string;
|
|
603
|
-
species?: string[];
|
|
604
|
-
traits?: string[];
|
|
605
|
-
abilities?: string[];
|
|
606
|
-
languages?: string[];
|
|
607
|
-
objects?: string[];
|
|
608
|
-
institutions?: string[];
|
|
609
|
-
family?: string[];
|
|
610
|
-
friends?: string[];
|
|
611
|
-
rivals?: string[];
|
|
612
|
-
}
|
|
613
|
-
interface CollectiveInput extends Omit<Collective, 'operator' | 'equipment' | 'abilities' | 'symbolism' | 'species' | 'characters' | 'creatures' | 'phenomena'> {
|
|
614
|
-
operator?: string;
|
|
615
|
-
equipment?: string[];
|
|
616
|
-
abilities?: string[];
|
|
617
|
-
symbolism?: string[];
|
|
618
|
-
species?: string[];
|
|
619
|
-
characters?: string[];
|
|
620
|
-
creatures?: string[];
|
|
621
|
-
phenomena?: string[];
|
|
622
|
-
}
|
|
623
|
-
interface ConstructInput extends Omit<Construct, 'founder' | 'custodian' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'relations' | 'titles' | 'constructs' | 'events' | 'narratives'> {
|
|
624
|
-
founder?: string;
|
|
625
|
-
custodian?: string;
|
|
626
|
-
characters?: string[];
|
|
627
|
-
objects?: string[];
|
|
628
|
-
locations?: string[];
|
|
629
|
-
species?: string[];
|
|
630
|
-
creatures?: string[];
|
|
631
|
-
institutions?: string[];
|
|
632
|
-
traits?: string[];
|
|
633
|
-
collectives?: string[];
|
|
634
|
-
zones?: string[];
|
|
635
|
-
abilities?: string[];
|
|
636
|
-
phenomena?: string[];
|
|
637
|
-
languages?: string[];
|
|
638
|
-
families?: string[];
|
|
639
|
-
relations?: string[];
|
|
640
|
-
titles?: string[];
|
|
641
|
-
constructs?: string[];
|
|
642
|
-
events?: string[];
|
|
643
|
-
narratives?: string[];
|
|
644
|
-
}
|
|
645
|
-
interface CreatureInput extends Omit<Creature, 'location' | 'zone' | 'species' | 'traits' | 'abilities' | 'languages' | 'actions'> {
|
|
646
|
-
location?: string;
|
|
647
|
-
zone?: string;
|
|
648
|
-
species?: string[];
|
|
649
|
-
traits?: string[];
|
|
650
|
-
abilities?: string[];
|
|
651
|
-
languages?: string[];
|
|
652
|
-
actions?: string[];
|
|
653
|
-
}
|
|
654
|
-
interface EventInput extends Omit<Event, 'triggers' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'relations' | 'titles' | 'constructs'> {
|
|
655
|
-
triggers?: string[];
|
|
656
|
-
characters?: string[];
|
|
657
|
-
objects?: string[];
|
|
658
|
-
locations?: string[];
|
|
659
|
-
species?: string[];
|
|
660
|
-
creatures?: string[];
|
|
661
|
-
institutions?: string[];
|
|
662
|
-
traits?: string[];
|
|
663
|
-
collectives?: string[];
|
|
664
|
-
zones?: string[];
|
|
665
|
-
abilities?: string[];
|
|
666
|
-
phenomena?: string[];
|
|
667
|
-
languages?: string[];
|
|
668
|
-
families?: string[];
|
|
669
|
-
relations?: string[];
|
|
670
|
-
titles?: string[];
|
|
671
|
-
constructs?: string[];
|
|
672
|
-
}
|
|
673
|
-
interface FamilyInput extends Omit<Family, 'traditions' | 'traits' | 'abilities' | 'languages' | 'ancestors' | 'estates' | 'governs' | 'heirlooms' | 'creatures'> {
|
|
674
|
-
traditions?: string[];
|
|
675
|
-
traits?: string[];
|
|
676
|
-
abilities?: string[];
|
|
677
|
-
languages?: string[];
|
|
678
|
-
ancestors?: string[];
|
|
679
|
-
estates?: string[];
|
|
680
|
-
governs?: string[];
|
|
681
|
-
heirlooms?: string[];
|
|
682
|
-
creatures?: string[];
|
|
683
|
-
}
|
|
684
|
-
interface InstitutionInput extends Omit<Institution, 'parent_institution' | 'zones' | 'objects' | 'creatures' | 'allies' | 'adversaries' | 'constructs'> {
|
|
685
|
-
parent_institution?: string;
|
|
686
|
-
zones?: string[];
|
|
687
|
-
objects?: string[];
|
|
688
|
-
creatures?: string[];
|
|
689
|
-
allies?: string[];
|
|
690
|
-
adversaries?: string[];
|
|
691
|
-
constructs?: string[];
|
|
692
|
-
}
|
|
693
|
-
interface LanguageInput extends Omit<Language, 'classification' | 'spread' | 'dialects'> {
|
|
694
|
-
classification?: string;
|
|
695
|
-
spread?: string[];
|
|
696
|
-
dialects?: string[];
|
|
697
|
-
}
|
|
698
|
-
interface LawInput extends Omit<Law, 'parent_law' | 'author' | 'penalties' | 'locations' | 'zones' | 'prohibitions' | 'adjudicators' | 'enforcers'> {
|
|
699
|
-
parent_law?: string;
|
|
700
|
-
author?: string;
|
|
701
|
-
penalties?: string[];
|
|
702
|
-
locations?: string[];
|
|
703
|
-
zones?: string[];
|
|
704
|
-
prohibitions?: string[];
|
|
705
|
-
adjudicators?: string[];
|
|
706
|
-
enforcers?: string[];
|
|
707
|
-
}
|
|
708
|
-
interface LocationInput extends Omit<Location, 'parent_location' | 'primary_power' | 'governing_title' | 'zone' | 'rival' | 'partner' | 'populations' | 'secondary_powers' | 'founders' | 'cults' | 'delicacies' | 'extraction_methods' | 'extraction_goods' | 'industry_methods' | 'industry_goods' | 'extraction_markets' | 'industry_markets' | 'currencies' | 'buildings' | 'building_methods' | 'fighters' | 'defensive_objects'> {
|
|
709
|
-
parent_location?: string;
|
|
710
|
-
primary_power?: string;
|
|
711
|
-
governing_title?: string;
|
|
712
|
-
zone?: string;
|
|
713
|
-
rival?: string;
|
|
714
|
-
partner?: string;
|
|
715
|
-
populations?: string[];
|
|
716
|
-
secondary_powers?: string[];
|
|
717
|
-
founders?: string[];
|
|
718
|
-
cults?: string[];
|
|
719
|
-
delicacies?: string[];
|
|
720
|
-
extraction_methods?: string[];
|
|
721
|
-
extraction_goods?: string[];
|
|
722
|
-
industry_methods?: string[];
|
|
723
|
-
industry_goods?: string[];
|
|
724
|
-
extraction_markets?: string[];
|
|
725
|
-
industry_markets?: string[];
|
|
726
|
-
currencies?: string[];
|
|
727
|
-
buildings?: string[];
|
|
728
|
-
building_methods?: string[];
|
|
729
|
-
fighters?: string[];
|
|
730
|
-
defensive_objects?: string[];
|
|
731
|
-
}
|
|
732
|
-
interface PhenomenonInput extends Omit<Phenomenon, 'system' | 'catalysts' | 'empowerments' | 'triggers' | 'wielders' | 'environments'> {
|
|
733
|
-
system?: string;
|
|
734
|
-
catalysts?: string[];
|
|
735
|
-
empowerments?: string[];
|
|
736
|
-
triggers?: string[];
|
|
737
|
-
wielders?: string[];
|
|
738
|
-
environments?: string[];
|
|
739
|
-
}
|
|
740
|
-
interface RelationInput extends Omit<Relation, 'actor' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'titles' | 'constructs' | 'events' | 'narratives'> {
|
|
741
|
-
actor?: string;
|
|
742
|
-
characters?: string[];
|
|
743
|
-
objects?: string[];
|
|
744
|
-
locations?: string[];
|
|
745
|
-
species?: string[];
|
|
746
|
-
creatures?: string[];
|
|
747
|
-
institutions?: string[];
|
|
748
|
-
traits?: string[];
|
|
749
|
-
collectives?: string[];
|
|
750
|
-
zones?: string[];
|
|
751
|
-
abilities?: string[];
|
|
752
|
-
phenomena?: string[];
|
|
753
|
-
languages?: string[];
|
|
754
|
-
families?: string[];
|
|
755
|
-
titles?: string[];
|
|
756
|
-
constructs?: string[];
|
|
757
|
-
events?: string[];
|
|
758
|
-
narratives?: string[];
|
|
194
|
+
/** Auth codes are distinguishable by design; client recovery UX differs per code. */
|
|
195
|
+
type OwAuthErrorCode = 'invalid_credentials' | 'key_revoked' | 'world_gone';
|
|
196
|
+
declare class OwApiError extends Error {
|
|
197
|
+
readonly status: number;
|
|
198
|
+
/** Machine error code from the keel envelope, e.g. 'invalid_credentials'. */
|
|
199
|
+
readonly code: string | null;
|
|
200
|
+
/** Error family from the envelope, e.g. 'invalid_request', 'not_found'. */
|
|
201
|
+
readonly type: string | null;
|
|
202
|
+
/** Offending field/param named by the envelope (422/400), else null. */
|
|
203
|
+
readonly param: string | null;
|
|
204
|
+
/** Documentation link from the envelope -- show it to users/logs verbatim. */
|
|
205
|
+
readonly docUrl: string | null;
|
|
206
|
+
/** Raw parsed envelope (or body text when the body wasn't JSON). */
|
|
207
|
+
readonly detail: unknown;
|
|
208
|
+
constructor(status: number, code: string | null, message: string, docUrl: string | null, detail: unknown, type?: string | null, param?: string | null);
|
|
209
|
+
get isAuthError(): boolean;
|
|
210
|
+
/** 422s/400s name the offending param/field -- typos error loudly platform-wide. */
|
|
211
|
+
get isValidationError(): boolean;
|
|
212
|
+
/** Same Idempotency-Key replayed with a different payload. */
|
|
213
|
+
get isIdempotencyConflict(): boolean;
|
|
759
214
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
adaptations?: string[];
|
|
765
|
-
traits?: string[];
|
|
766
|
-
locations?: string[];
|
|
767
|
-
zones?: string[];
|
|
768
|
-
affinities?: string[];
|
|
769
|
-
}
|
|
770
|
-
interface ZoneInput extends Omit<Zone, 'phenomena' | 'linked_zones' | 'populations' | 'titles' | 'principles'> {
|
|
771
|
-
phenomena?: string[];
|
|
772
|
-
linked_zones?: string[];
|
|
773
|
-
populations?: string[];
|
|
774
|
-
titles?: string[];
|
|
775
|
-
principles?: string[];
|
|
776
|
-
}
|
|
777
|
-
interface TitleInput extends Omit<Title, 'issuer' | 'body' | 'superior_title' | 'holders' | 'symbols' | 'characters' | 'institutions' | 'families' | 'zones' | 'locations' | 'objects' | 'constructs' | 'laws' | 'collectives' | 'creatures' | 'phenomena' | 'species' | 'languages'> {
|
|
778
|
-
issuer?: string;
|
|
779
|
-
body?: string;
|
|
780
|
-
superior_title?: string;
|
|
781
|
-
holders?: string[];
|
|
782
|
-
symbols?: string[];
|
|
783
|
-
characters?: string[];
|
|
784
|
-
institutions?: string[];
|
|
785
|
-
families?: string[];
|
|
786
|
-
zones?: string[];
|
|
787
|
-
locations?: string[];
|
|
788
|
-
objects?: string[];
|
|
789
|
-
constructs?: string[];
|
|
790
|
-
laws?: string[];
|
|
791
|
-
collectives?: string[];
|
|
792
|
-
creatures?: string[];
|
|
793
|
-
phenomena?: string[];
|
|
794
|
-
species?: string[];
|
|
795
|
-
languages?: string[];
|
|
796
|
-
}
|
|
797
|
-
interface TraitInput extends Omit<Trait, 'anti_trait' | 'empowered_abilities'> {
|
|
798
|
-
anti_trait?: string;
|
|
799
|
-
empowered_abilities?: string[];
|
|
800
|
-
}
|
|
801
|
-
interface NarrativeInput extends Omit<Narrative, 'parent_narrative' | 'protagonist' | 'antagonist' | 'narrator' | 'conservator' | 'events' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'relations' | 'titles' | 'constructs' | 'laws'> {
|
|
802
|
-
parent_narrative?: string;
|
|
803
|
-
protagonist?: string;
|
|
804
|
-
antagonist?: string;
|
|
805
|
-
narrator?: string;
|
|
806
|
-
conservator?: string;
|
|
807
|
-
events?: string[];
|
|
808
|
-
characters?: string[];
|
|
809
|
-
objects?: string[];
|
|
810
|
-
locations?: string[];
|
|
811
|
-
species?: string[];
|
|
812
|
-
creatures?: string[];
|
|
813
|
-
institutions?: string[];
|
|
814
|
-
traits?: string[];
|
|
815
|
-
collectives?: string[];
|
|
816
|
-
zones?: string[];
|
|
817
|
-
abilities?: string[];
|
|
818
|
-
phenomena?: string[];
|
|
819
|
-
languages?: string[];
|
|
820
|
-
families?: string[];
|
|
821
|
-
relations?: string[];
|
|
822
|
-
titles?: string[];
|
|
823
|
-
constructs?: string[];
|
|
824
|
-
laws?: string[];
|
|
825
|
-
}
|
|
826
|
-
interface MapInput extends Omit<Map, 'parent_map' | 'location'> {
|
|
827
|
-
parent_map?: string;
|
|
828
|
-
location?: string;
|
|
829
|
-
}
|
|
830
|
-
interface MarkerInput extends Omit<Marker, 'map' | 'zone'> {
|
|
831
|
-
map?: string;
|
|
832
|
-
zone?: string;
|
|
833
|
-
}
|
|
834
|
-
interface PinInput extends Omit<Pin, 'map' | 'element_id'> {
|
|
835
|
-
map?: string;
|
|
836
|
-
element_id?: string;
|
|
837
|
-
}
|
|
838
|
-
/**
|
|
839
|
-
* All available element types in OnlyWorlds
|
|
840
|
-
*/
|
|
841
|
-
declare enum ElementType$1 {
|
|
842
|
-
Ability = "ability",
|
|
843
|
-
Character = "character",
|
|
844
|
-
Collective = "collective",
|
|
845
|
-
Construct = "construct",
|
|
846
|
-
Creature = "creature",
|
|
847
|
-
Event = "event",
|
|
848
|
-
Family = "family",
|
|
849
|
-
Institution = "institution",
|
|
850
|
-
Language = "language",
|
|
851
|
-
Law = "law",
|
|
852
|
-
Location = "location",
|
|
853
|
-
Map = "map",
|
|
854
|
-
Marker = "marker",
|
|
855
|
-
Narrative = "narrative",
|
|
856
|
-
Object = "object",
|
|
857
|
-
Phenomenon = "phenomenon",
|
|
858
|
-
Pin = "pin",
|
|
859
|
-
Relation = "relation",
|
|
860
|
-
Species = "species",
|
|
861
|
-
Title = "title",
|
|
862
|
-
Trait = "trait",
|
|
863
|
-
Zone = "zone"
|
|
215
|
+
/** Network-level failure (fetch rejected) -- no envelope to parse. */
|
|
216
|
+
declare class OwNetworkError extends Error {
|
|
217
|
+
readonly cause2: unknown;
|
|
218
|
+
constructor(message: string, cause: unknown);
|
|
864
219
|
}
|
|
220
|
+
/** Parse a wire envelope into OwApiError parts (exported for the error type-tests). */
|
|
221
|
+
declare function parseEnvelope(status: number, body: unknown): OwApiError;
|
|
222
|
+
/** Build an OwApiError from a non-2xx response, tolerating non-JSON bodies. */
|
|
223
|
+
declare function errorFromResponse(res: Response): Promise<OwApiError>;
|
|
224
|
+
|
|
865
225
|
/**
|
|
866
|
-
*
|
|
867
|
-
*
|
|
226
|
+
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
227
|
+
* wire-corrected against live staging fixtures 2026-07-18.
|
|
228
|
+
*
|
|
229
|
+
* OnlyWorlds key-kind detection. Prefixes make leaked keys grep-scannable
|
|
230
|
+
* (Stripe/GitHub precedent) -- and tell a client what auth shape to expect.
|
|
868
231
|
*/
|
|
869
|
-
|
|
232
|
+
type OwKeyKind =
|
|
233
|
+
/** ow_w_ -- world key, read + write. Writes need the world's PIN if it has one. */
|
|
234
|
+
'write'
|
|
235
|
+
/** ow_r_ -- world key, read-only, works bare (no PIN). The share-with-players primitive. */
|
|
236
|
+
| 'read'
|
|
237
|
+
/** ow_a_ -- account Bearer token for /account/* routes; can mint world keys. */
|
|
238
|
+
| 'account'
|
|
239
|
+
/** Grandfathered 10-digit key. Needs PIN to read private worlds. */
|
|
240
|
+
| 'legacy' | 'unknown';
|
|
241
|
+
/** Demo range 0000000000-0000000009: read-only aliases, safe as live read gates. */
|
|
242
|
+
declare function isDemoKey(key: string): boolean;
|
|
243
|
+
declare function detectKeyKind(key: string): OwKeyKind;
|
|
244
|
+
/** Can this key kind ever perform world writes? (PIN is a separate, per-world question.) */
|
|
245
|
+
declare function kindCanWrite(kind: OwKeyKind): boolean;
|
|
870
246
|
/**
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
247
|
+
* Should a credential UI ask for a PIN with this key?
|
|
248
|
+
* Prefixed keys read PIN-less; legacy keys may need it; writes on pinned
|
|
249
|
+
* worlds always need it. 'optional' means: show the field, don't require it.
|
|
874
250
|
*/
|
|
875
|
-
declare function
|
|
251
|
+
declare function pinExpectation(kind: OwKeyKind): 'never' | 'optional' | 'required-for-private-reads';
|
|
252
|
+
|
|
876
253
|
/**
|
|
877
|
-
*
|
|
878
|
-
*
|
|
254
|
+
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
255
|
+
* wire-corrected against live staging fixtures 2026-07-18.
|
|
256
|
+
*
|
|
257
|
+
* OwV2Client -- thin typed fetch client for the keel v2 API.
|
|
258
|
+
*
|
|
259
|
+
* Deliberately thin: no caching, no sync state, no retry policy -- those belong
|
|
260
|
+
* to callers (sync engines, tools, games). What IS encoded here is the wire
|
|
261
|
+
* contract and its safety rails: payload read-only-field stripping, opaque
|
|
262
|
+
* cursors, idempotency headers, doc_url-bearing errors, polite page sizes, and
|
|
263
|
+
* client-side UUID minting so idempotent retries are structurally safe.
|
|
879
264
|
*/
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
265
|
+
|
|
266
|
+
declare class OwV2Client {
|
|
267
|
+
readonly baseUrl: string;
|
|
268
|
+
readonly keyKind: OwKeyKind;
|
|
269
|
+
readonly pageSize: number;
|
|
270
|
+
readonly changesPageSize: number;
|
|
271
|
+
private readonly apiKey;
|
|
272
|
+
private readonly apiPin;
|
|
273
|
+
private readonly fetchImpl;
|
|
274
|
+
constructor(config: OwClientConfig);
|
|
275
|
+
/** GET /health -- unauthenticated liveness pulse. */
|
|
276
|
+
health(): Promise<unknown>;
|
|
277
|
+
/**
|
|
278
|
+
* GET /world -- world meta (name, calendar/time fields, public_read).
|
|
279
|
+
* GOTCHA (by server design): world-meta edits do NOT appear in /changes and
|
|
280
|
+
* do not bump change_seq. Poll getWorld().updated_at for meta freshness.
|
|
281
|
+
*/
|
|
282
|
+
getWorld(): Promise<OwWorldMeta>;
|
|
283
|
+
/** PATCH /world -- partial world-meta update. */
|
|
284
|
+
patchWorld(partial: Record<string, unknown>): Promise<OwWorldMeta>;
|
|
285
|
+
/** GET /{type}/ -- one cursor page. */
|
|
286
|
+
list(type: ElementType | string, params?: ListParams): Promise<OwPage>;
|
|
287
|
+
/** Cursor-walk every page of a type. Politeness: uses config pageSize. */
|
|
288
|
+
listAll(type: ElementType | string, params?: Omit<ListParams, 'cursor'>): AsyncGenerator<OwElement>;
|
|
289
|
+
/** GET /{type}/{id}/ -- optional one-level stub expansion / sparse fields. */
|
|
290
|
+
get(type: ElementType | string, id: string, opts?: Pick<ListParams, 'expand' | 'fields'>): Promise<OwElement>;
|
|
291
|
+
/**
|
|
292
|
+
* POST /{type}/ -- create. Mints an RFC-4122 UUID for element.id when the
|
|
293
|
+
* caller omits one (design ruling D29d) so a retry carrying the same
|
|
294
|
+
* Idempotency-Key is structurally safe. Callers MAY still supply their own id.
|
|
295
|
+
*/
|
|
296
|
+
create(type: ElementType | string, element: OwElement | Record<string, unknown>, opts?: {
|
|
297
|
+
idempotencyKey?: string;
|
|
298
|
+
}): Promise<OwElement>;
|
|
299
|
+
/** PUT /{type}/{id}/ -- upsert-by-client-id. The local-first write primitive. */
|
|
300
|
+
upsert(type: ElementType | string, id: string, element: OwElement | Record<string, unknown>): Promise<OwElement>;
|
|
301
|
+
/**
|
|
302
|
+
* PATCH /{type}/{id}/ -- partial update. DESTRUCTIVE on sent fields: arrays
|
|
303
|
+
* replace wholesale, omitted fields stay untouched. For link arrays prefer
|
|
304
|
+
* editLinks() -- atomic server-side merge, no read-before-write.
|
|
305
|
+
*/
|
|
306
|
+
patch(type: ElementType | string, id: string, partial: Record<string, unknown>): Promise<OwElement>;
|
|
307
|
+
/**
|
|
308
|
+
* DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
|
|
309
|
+
* tombstone AND scrubs the id from every other element's links in the same
|
|
310
|
+
* transaction -- no client-side unlink pass needed, ever.
|
|
311
|
+
*/
|
|
312
|
+
delete(type: ElementType | string, id: string): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
|
|
315
|
+
* Dedupes, tolerates already-present/already-absent ids. Returns the FULL
|
|
316
|
+
* updated element (fixture P5). Use this for all relationship editing; it
|
|
317
|
+
* retires the read-merge-PATCH dance.
|
|
318
|
+
*/
|
|
319
|
+
editLinks(type: ElementType | string, id: string, field: string, edit: OwLinkEdit): Promise<OwElement>;
|
|
320
|
+
/**
|
|
321
|
+
* POST /bulk -- up to ~1000 items. Partial success by default (HTTP 200
|
|
322
|
+
* always; inspect per-slot numeric `status` + top-level `errors` flag);
|
|
323
|
+
* atomic:true for all-or-nothing. Link validation runs against batch U
|
|
324
|
+
* database -- send in any order, cycles included; no client topo-sort.
|
|
325
|
+
* Success slots echo server-authoritative timestamps: set your sync baseline
|
|
326
|
+
* from this response alone. When an idempotencyKey is replayed, the returned
|
|
327
|
+
* response carries wasReplay:true (read from the Idempotent-Replay header).
|
|
328
|
+
*/
|
|
329
|
+
bulk(items: OwBulkItem[], opts?: {
|
|
330
|
+
atomic?: boolean;
|
|
331
|
+
idempotencyKey?: string;
|
|
332
|
+
}): Promise<OwBulkResponse>;
|
|
333
|
+
/**
|
|
334
|
+
* GET /changes -- one page of the world's ordered change feed.
|
|
335
|
+
* Cursor is OPAQUE and never expires: persist verbatim, never parse.
|
|
336
|
+
* Zero/absent cursor = full export (byte-aligned with the Folder Format).
|
|
337
|
+
* Rewind rule: if your persisted position is ahead of page.head, the server
|
|
338
|
+
* was restored -- re-baseline from cursor zero; do not assume caught-up.
|
|
339
|
+
* Citizenship: heaviest route on the platform; default page size is polite.
|
|
340
|
+
*/
|
|
341
|
+
changes(opts?: {
|
|
342
|
+
since?: string;
|
|
343
|
+
limit?: number;
|
|
344
|
+
}): Promise<OwChangesPage>;
|
|
345
|
+
/**
|
|
346
|
+
* Walk the feed from `since` (or from zero = full export) to the current
|
|
347
|
+
* tail, yielding ops in order. Returns the final cursor via the generator's
|
|
348
|
+
* return value; persist it for the next incremental pull.
|
|
349
|
+
*/
|
|
350
|
+
changesAll(since?: string): AsyncGenerator<OwChange, {
|
|
351
|
+
cursor: string;
|
|
352
|
+
head: number;
|
|
353
|
+
}>;
|
|
354
|
+
/**
|
|
355
|
+
* Raw authenticated request against this client's baseUrl. Public since 4.0
|
|
356
|
+
* so auxiliary resources can ride the same transport — it structurally
|
|
357
|
+
* satisfies `TokenTransport` (`new TokenResource(client)`). Prefer the typed
|
|
358
|
+
* methods for element CRUD; this is the escape hatch, and it does NOT apply
|
|
359
|
+
* sanitizePayload — callers own their body shape.
|
|
360
|
+
*/
|
|
361
|
+
request<T = unknown>(method: string, path: string, opts?: {
|
|
362
|
+
query?: string;
|
|
363
|
+
body?: unknown;
|
|
364
|
+
idempotencyKey?: string;
|
|
365
|
+
auth?: boolean;
|
|
366
|
+
allowEmpty?: boolean;
|
|
367
|
+
replayAware?: boolean;
|
|
368
|
+
}): Promise<T>;
|
|
884
369
|
}
|
|
370
|
+
|
|
885
371
|
/**
|
|
886
|
-
*
|
|
887
|
-
*
|
|
372
|
+
* Canonical element colour palette — four semantic families.
|
|
373
|
+
*
|
|
374
|
+
* Ruled by Captain 2026-07-22 after Skeld's measurement pass (Orrery
|
|
375
|
+
* `product/schema/element-palette-measurements.md`): 22 mutually-separable
|
|
376
|
+
* hues is structurally impossible; four families is the ceiling that passes
|
|
377
|
+
* all-pairs CVD separation in both modes. **Colour carries the FAMILY; the
|
|
378
|
+
* icon (`ELEMENT_ICONS`) carries the TYPE.** Dark-mode pairs land in the 6–8
|
|
379
|
+
* CVD floor band, so secondary encoding (icon + label) is REQUIRED alongside
|
|
380
|
+
* colour, not optional.
|
|
381
|
+
*
|
|
382
|
+
* The type→family map is GENERATED: `ELEMENT_FAMILIES` is emitted by
|
|
383
|
+
* `codegen/generate_types.py` from the `family:` key in keel's schema YAML
|
|
384
|
+
* (added 2026-07-23, keel c69366b) — a keel PRESENTATION-WRAPPER key
|
|
385
|
+
* (first-party rendering metadata, not part of the council-governed
|
|
386
|
+
* OnlyWorlds standard). It cannot drift from the schema; membership and hex
|
|
387
|
+
* invariants stay test-gated in `test/palette.test.mjs`.
|
|
388
|
+
*
|
|
389
|
+
* The hexes below are design constants, hand-authored beside the generated
|
|
390
|
+
* map. Do not change any value without re-running the CVD validation (every
|
|
391
|
+
* brighter World green collides with Temporal amber for protan viewers — the
|
|
392
|
+
* green is pinned BY the accessibility budget).
|
|
393
|
+
*
|
|
394
|
+
* Provenance: first proven live in atlas (`src/core/element-colors.ts`) and
|
|
395
|
+
* council (`src/cosmos/element-families.ts`) — both become re-exports of this
|
|
396
|
+
* module.
|
|
888
397
|
*/
|
|
889
|
-
|
|
398
|
+
|
|
890
399
|
/**
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
|
|
895
|
-
|
|
400
|
+
* Family → validated hex per surface mode. `light` assumes near-white
|
|
401
|
+
* surfaces, `dark` assumes near-black (measured against #0a0a0a).
|
|
402
|
+
* World green is identical in both modes and sits at its low-contrast end
|
|
403
|
+
* deliberately — see module header before "fixing" it.
|
|
404
|
+
*/
|
|
405
|
+
declare const FAMILY_COLORS: Record<ElementFamily, {
|
|
406
|
+
light: string;
|
|
407
|
+
dark: string;
|
|
408
|
+
}>;
|
|
409
|
+
/** Semantic family for an element type slug. */
|
|
410
|
+
declare function familyOf(type: ElementType): ElementFamily;
|
|
411
|
+
/**
|
|
412
|
+
* The convenience most callers want: canonical colour for an element type.
|
|
413
|
+
* Name matches the live atlas/council implementations so their SDK swap is a
|
|
414
|
+
* re-export, not a rename. Defaults to `dark` (both current consumers are
|
|
415
|
+
* dark-surface).
|
|
416
|
+
*/
|
|
417
|
+
declare function elementColor(type: ElementType, mode?: 'light' | 'dark'): string;
|
|
418
|
+
/** All four families, in ruling order (the order IS the CVD-safety mechanism of the source palette). */
|
|
419
|
+
declare const FAMILY_ORDER: readonly ElementFamily[];
|
|
420
|
+
|
|
896
421
|
/**
|
|
897
422
|
* Current OnlyWorlds version
|
|
898
423
|
* Synced with https://github.com/OnlyWorlds/OnlyWorlds/blob/main/VERSION
|
|
899
424
|
*/
|
|
900
425
|
declare const ONLYWORLDS_VERSION: "00.30.00";
|
|
901
|
-
/**
|
|
902
|
-
* Material Design icons for element types
|
|
903
|
-
* These are the uniform, monochrome icons used in the OnlyWorlds frontend
|
|
904
|
-
* Compatible with Google Material Icons font
|
|
905
|
-
*/
|
|
906
|
-
declare const ELEMENT_ICONS: Record<ElementType$1, string>;
|
|
907
426
|
/**
|
|
908
427
|
* Field type definitions for OnlyWorlds elements
|
|
909
428
|
*/
|
|
@@ -917,10 +436,7 @@ interface FieldInfo {
|
|
|
917
436
|
max?: number;
|
|
918
437
|
required?: boolean;
|
|
919
438
|
}
|
|
920
|
-
|
|
921
|
-
* Comprehensive field schema - provides complete metadata for all fields
|
|
922
|
-
* Maps element types to their field definitions including types and cardinality
|
|
923
|
-
*/
|
|
439
|
+
declare const ELEMENT_LABELS: Record<ElementType, string>;
|
|
924
440
|
declare const FIELD_SCHEMA: {
|
|
925
441
|
readonly ability: {
|
|
926
442
|
readonly name: {
|
|
@@ -947,13 +463,13 @@ declare const FIELD_SCHEMA: {
|
|
|
947
463
|
readonly type: "text";
|
|
948
464
|
};
|
|
949
465
|
readonly duration: {
|
|
950
|
-
readonly type: "
|
|
466
|
+
readonly type: "integer";
|
|
951
467
|
};
|
|
952
468
|
readonly potency: {
|
|
953
|
-
readonly type: "
|
|
469
|
+
readonly type: "integer";
|
|
954
470
|
};
|
|
955
471
|
readonly range: {
|
|
956
|
-
readonly type: "
|
|
472
|
+
readonly type: "integer";
|
|
957
473
|
};
|
|
958
474
|
readonly effects: {
|
|
959
475
|
readonly type: "multi_link";
|
|
@@ -1022,10 +538,10 @@ declare const FIELD_SCHEMA: {
|
|
|
1022
538
|
readonly type: "text";
|
|
1023
539
|
};
|
|
1024
540
|
readonly height: {
|
|
1025
|
-
readonly type: "
|
|
541
|
+
readonly type: "integer";
|
|
1026
542
|
};
|
|
1027
543
|
readonly weight: {
|
|
1028
|
-
readonly type: "
|
|
544
|
+
readonly type: "integer";
|
|
1029
545
|
};
|
|
1030
546
|
readonly species: {
|
|
1031
547
|
readonly type: "multi_link";
|
|
@@ -1046,7 +562,7 @@ declare const FIELD_SCHEMA: {
|
|
|
1046
562
|
readonly type: "text";
|
|
1047
563
|
};
|
|
1048
564
|
readonly birth_date: {
|
|
1049
|
-
readonly type: "
|
|
565
|
+
readonly type: "integer";
|
|
1050
566
|
};
|
|
1051
567
|
readonly birthplace: {
|
|
1052
568
|
readonly type: "single_link";
|
|
@@ -1072,22 +588,22 @@ declare const FIELD_SCHEMA: {
|
|
|
1072
588
|
readonly target: "institution";
|
|
1073
589
|
};
|
|
1074
590
|
readonly charisma: {
|
|
1075
|
-
readonly type: "
|
|
591
|
+
readonly type: "integer";
|
|
1076
592
|
};
|
|
1077
593
|
readonly coercion: {
|
|
1078
|
-
readonly type: "
|
|
594
|
+
readonly type: "integer";
|
|
1079
595
|
};
|
|
1080
596
|
readonly competence: {
|
|
1081
|
-
readonly type: "
|
|
597
|
+
readonly type: "integer";
|
|
1082
598
|
};
|
|
1083
599
|
readonly compassion: {
|
|
1084
|
-
readonly type: "
|
|
600
|
+
readonly type: "integer";
|
|
1085
601
|
};
|
|
1086
602
|
readonly creativity: {
|
|
1087
|
-
readonly type: "
|
|
603
|
+
readonly type: "integer";
|
|
1088
604
|
};
|
|
1089
605
|
readonly courage: {
|
|
1090
|
-
readonly type: "
|
|
606
|
+
readonly type: "integer";
|
|
1091
607
|
};
|
|
1092
608
|
readonly family: {
|
|
1093
609
|
readonly type: "multi_link";
|
|
@@ -1102,28 +618,28 @@ declare const FIELD_SCHEMA: {
|
|
|
1102
618
|
readonly target: "character";
|
|
1103
619
|
};
|
|
1104
620
|
readonly level: {
|
|
1105
|
-
readonly type: "
|
|
621
|
+
readonly type: "integer";
|
|
1106
622
|
};
|
|
1107
623
|
readonly hit_points: {
|
|
1108
|
-
readonly type: "
|
|
624
|
+
readonly type: "integer";
|
|
1109
625
|
};
|
|
1110
626
|
readonly STR: {
|
|
1111
|
-
readonly type: "
|
|
627
|
+
readonly type: "integer";
|
|
1112
628
|
};
|
|
1113
629
|
readonly DEX: {
|
|
1114
|
-
readonly type: "
|
|
630
|
+
readonly type: "integer";
|
|
1115
631
|
};
|
|
1116
632
|
readonly CON: {
|
|
1117
|
-
readonly type: "
|
|
633
|
+
readonly type: "integer";
|
|
1118
634
|
};
|
|
1119
635
|
readonly INT: {
|
|
1120
|
-
readonly type: "
|
|
636
|
+
readonly type: "integer";
|
|
1121
637
|
};
|
|
1122
638
|
readonly WIS: {
|
|
1123
|
-
readonly type: "
|
|
639
|
+
readonly type: "integer";
|
|
1124
640
|
};
|
|
1125
641
|
readonly CHA: {
|
|
1126
|
-
readonly type: "
|
|
642
|
+
readonly type: "integer";
|
|
1127
643
|
};
|
|
1128
644
|
};
|
|
1129
645
|
readonly collective: {
|
|
@@ -1151,10 +667,10 @@ declare const FIELD_SCHEMA: {
|
|
|
1151
667
|
readonly type: "text";
|
|
1152
668
|
};
|
|
1153
669
|
readonly count: {
|
|
1154
|
-
readonly type: "
|
|
670
|
+
readonly type: "integer";
|
|
1155
671
|
};
|
|
1156
672
|
readonly formation_date: {
|
|
1157
|
-
readonly type: "
|
|
673
|
+
readonly type: "integer";
|
|
1158
674
|
};
|
|
1159
675
|
readonly operator: {
|
|
1160
676
|
readonly type: "single_link";
|
|
@@ -1232,10 +748,10 @@ declare const FIELD_SCHEMA: {
|
|
|
1232
748
|
readonly type: "text";
|
|
1233
749
|
};
|
|
1234
750
|
readonly start_date: {
|
|
1235
|
-
readonly type: "
|
|
751
|
+
readonly type: "integer";
|
|
1236
752
|
};
|
|
1237
753
|
readonly end_date: {
|
|
1238
|
-
readonly type: "
|
|
754
|
+
readonly type: "integer";
|
|
1239
755
|
};
|
|
1240
756
|
readonly founder: {
|
|
1241
757
|
readonly type: "single_link";
|
|
@@ -1343,10 +859,10 @@ declare const FIELD_SCHEMA: {
|
|
|
1343
859
|
readonly type: "text";
|
|
1344
860
|
};
|
|
1345
861
|
readonly weight: {
|
|
1346
|
-
readonly type: "
|
|
862
|
+
readonly type: "integer";
|
|
1347
863
|
};
|
|
1348
864
|
readonly height: {
|
|
1349
|
-
readonly type: "
|
|
865
|
+
readonly type: "integer";
|
|
1350
866
|
};
|
|
1351
867
|
readonly species: {
|
|
1352
868
|
readonly type: "multi_link";
|
|
@@ -1374,7 +890,7 @@ declare const FIELD_SCHEMA: {
|
|
|
1374
890
|
readonly type: "text";
|
|
1375
891
|
};
|
|
1376
892
|
readonly birth_date: {
|
|
1377
|
-
readonly type: "
|
|
893
|
+
readonly type: "integer";
|
|
1378
894
|
};
|
|
1379
895
|
readonly location: {
|
|
1380
896
|
readonly type: "single_link";
|
|
@@ -1385,16 +901,16 @@ declare const FIELD_SCHEMA: {
|
|
|
1385
901
|
readonly target: "zone";
|
|
1386
902
|
};
|
|
1387
903
|
readonly challenge_rating: {
|
|
1388
|
-
readonly type: "
|
|
904
|
+
readonly type: "integer";
|
|
1389
905
|
};
|
|
1390
906
|
readonly hit_points: {
|
|
1391
|
-
readonly type: "
|
|
907
|
+
readonly type: "integer";
|
|
1392
908
|
};
|
|
1393
909
|
readonly armor_class: {
|
|
1394
|
-
readonly type: "
|
|
910
|
+
readonly type: "integer";
|
|
1395
911
|
};
|
|
1396
912
|
readonly speed: {
|
|
1397
|
-
readonly type: "
|
|
913
|
+
readonly type: "integer";
|
|
1398
914
|
};
|
|
1399
915
|
readonly actions: {
|
|
1400
916
|
readonly type: "multi_link";
|
|
@@ -1432,10 +948,10 @@ declare const FIELD_SCHEMA: {
|
|
|
1432
948
|
readonly type: "text";
|
|
1433
949
|
};
|
|
1434
950
|
readonly start_date: {
|
|
1435
|
-
readonly type: "
|
|
951
|
+
readonly type: "integer";
|
|
1436
952
|
};
|
|
1437
953
|
readonly end_date: {
|
|
1438
|
-
readonly type: "
|
|
954
|
+
readonly type: "integer";
|
|
1439
955
|
};
|
|
1440
956
|
readonly triggers: {
|
|
1441
957
|
readonly type: "multi_link";
|
|
@@ -1598,7 +1114,7 @@ declare const FIELD_SCHEMA: {
|
|
|
1598
1114
|
readonly type: "text";
|
|
1599
1115
|
};
|
|
1600
1116
|
readonly founding_date: {
|
|
1601
|
-
readonly type: "
|
|
1117
|
+
readonly type: "integer";
|
|
1602
1118
|
};
|
|
1603
1119
|
readonly parent_institution: {
|
|
1604
1120
|
readonly type: "single_link";
|
|
@@ -1709,7 +1225,7 @@ declare const FIELD_SCHEMA: {
|
|
|
1709
1225
|
readonly type: "text";
|
|
1710
1226
|
};
|
|
1711
1227
|
readonly date: {
|
|
1712
|
-
readonly type: "
|
|
1228
|
+
readonly type: "integer";
|
|
1713
1229
|
};
|
|
1714
1230
|
readonly parent_law: {
|
|
1715
1231
|
readonly type: "single_link";
|
|
@@ -1772,7 +1288,7 @@ declare const FIELD_SCHEMA: {
|
|
|
1772
1288
|
readonly type: "text";
|
|
1773
1289
|
};
|
|
1774
1290
|
readonly founding_date: {
|
|
1775
|
-
readonly type: "
|
|
1291
|
+
readonly type: "integer";
|
|
1776
1292
|
};
|
|
1777
1293
|
readonly parent_location: {
|
|
1778
1294
|
readonly type: "single_link";
|
|
@@ -1870,7 +1386,7 @@ declare const FIELD_SCHEMA: {
|
|
|
1870
1386
|
readonly type: "text";
|
|
1871
1387
|
};
|
|
1872
1388
|
readonly elevation: {
|
|
1873
|
-
readonly type: "
|
|
1389
|
+
readonly type: "integer";
|
|
1874
1390
|
};
|
|
1875
1391
|
readonly fighters: {
|
|
1876
1392
|
readonly type: "multi_link";
|
|
@@ -1906,16 +1422,16 @@ declare const FIELD_SCHEMA: {
|
|
|
1906
1422
|
readonly type: "text";
|
|
1907
1423
|
};
|
|
1908
1424
|
readonly hierarchy: {
|
|
1909
|
-
readonly type: "
|
|
1425
|
+
readonly type: "integer";
|
|
1910
1426
|
};
|
|
1911
1427
|
readonly width: {
|
|
1912
|
-
readonly type: "
|
|
1428
|
+
readonly type: "integer";
|
|
1913
1429
|
};
|
|
1914
1430
|
readonly height: {
|
|
1915
|
-
readonly type: "
|
|
1431
|
+
readonly type: "integer";
|
|
1916
1432
|
};
|
|
1917
1433
|
readonly depth: {
|
|
1918
|
-
readonly type: "
|
|
1434
|
+
readonly type: "integer";
|
|
1919
1435
|
};
|
|
1920
1436
|
readonly parent_map: {
|
|
1921
1437
|
readonly type: "single_link";
|
|
@@ -1958,18 +1474,18 @@ declare const FIELD_SCHEMA: {
|
|
|
1958
1474
|
readonly required: true;
|
|
1959
1475
|
};
|
|
1960
1476
|
readonly x: {
|
|
1961
|
-
readonly type: "
|
|
1477
|
+
readonly type: "integer";
|
|
1962
1478
|
readonly required: true;
|
|
1963
1479
|
};
|
|
1964
1480
|
readonly y: {
|
|
1965
|
-
readonly type: "
|
|
1481
|
+
readonly type: "integer";
|
|
1966
1482
|
readonly required: true;
|
|
1967
1483
|
};
|
|
1968
1484
|
readonly z: {
|
|
1969
|
-
readonly type: "
|
|
1485
|
+
readonly type: "integer";
|
|
1970
1486
|
};
|
|
1971
1487
|
readonly order: {
|
|
1972
|
-
readonly type: "
|
|
1488
|
+
readonly type: "integer";
|
|
1973
1489
|
readonly required: true;
|
|
1974
1490
|
};
|
|
1975
1491
|
};
|
|
@@ -2001,13 +1517,13 @@ declare const FIELD_SCHEMA: {
|
|
|
2001
1517
|
readonly type: "text";
|
|
2002
1518
|
};
|
|
2003
1519
|
readonly start_date: {
|
|
2004
|
-
readonly type: "
|
|
1520
|
+
readonly type: "integer";
|
|
2005
1521
|
};
|
|
2006
1522
|
readonly end_date: {
|
|
2007
|
-
readonly type: "
|
|
1523
|
+
readonly type: "integer";
|
|
2008
1524
|
};
|
|
2009
1525
|
readonly order: {
|
|
2010
|
-
readonly type: "
|
|
1526
|
+
readonly type: "integer";
|
|
2011
1527
|
};
|
|
2012
1528
|
readonly parent_narrative: {
|
|
2013
1529
|
readonly type: "single_link";
|
|
@@ -2127,10 +1643,10 @@ declare const FIELD_SCHEMA: {
|
|
|
2127
1643
|
readonly type: "text";
|
|
2128
1644
|
};
|
|
2129
1645
|
readonly weight: {
|
|
2130
|
-
readonly type: "
|
|
1646
|
+
readonly type: "integer";
|
|
2131
1647
|
};
|
|
2132
1648
|
readonly amount: {
|
|
2133
|
-
readonly type: "
|
|
1649
|
+
readonly type: "integer";
|
|
2134
1650
|
};
|
|
2135
1651
|
readonly parent_object: {
|
|
2136
1652
|
readonly type: "single_link";
|
|
@@ -2203,7 +1719,7 @@ declare const FIELD_SCHEMA: {
|
|
|
2203
1719
|
readonly type: "text";
|
|
2204
1720
|
};
|
|
2205
1721
|
readonly duration: {
|
|
2206
|
-
readonly type: "
|
|
1722
|
+
readonly type: "integer";
|
|
2207
1723
|
};
|
|
2208
1724
|
readonly catalysts: {
|
|
2209
1725
|
readonly type: "multi_link";
|
|
@@ -2269,15 +1785,15 @@ declare const FIELD_SCHEMA: {
|
|
|
2269
1785
|
readonly required: true;
|
|
2270
1786
|
};
|
|
2271
1787
|
readonly x: {
|
|
2272
|
-
readonly type: "
|
|
1788
|
+
readonly type: "integer";
|
|
2273
1789
|
readonly required: true;
|
|
2274
1790
|
};
|
|
2275
1791
|
readonly y: {
|
|
2276
|
-
readonly type: "
|
|
1792
|
+
readonly type: "integer";
|
|
2277
1793
|
readonly required: true;
|
|
2278
1794
|
};
|
|
2279
1795
|
readonly z: {
|
|
2280
|
-
readonly type: "
|
|
1796
|
+
readonly type: "integer";
|
|
2281
1797
|
};
|
|
2282
1798
|
};
|
|
2283
1799
|
readonly relation: {
|
|
@@ -2305,13 +1821,13 @@ declare const FIELD_SCHEMA: {
|
|
|
2305
1821
|
readonly type: "text";
|
|
2306
1822
|
};
|
|
2307
1823
|
readonly start_date: {
|
|
2308
|
-
readonly type: "
|
|
1824
|
+
readonly type: "integer";
|
|
2309
1825
|
};
|
|
2310
1826
|
readonly end_date: {
|
|
2311
|
-
readonly type: "
|
|
1827
|
+
readonly type: "integer";
|
|
2312
1828
|
};
|
|
2313
1829
|
readonly intensity: {
|
|
2314
|
-
readonly type: "
|
|
1830
|
+
readonly type: "integer";
|
|
2315
1831
|
};
|
|
2316
1832
|
readonly actor: {
|
|
2317
1833
|
readonly type: "single_link";
|
|
@@ -2415,10 +1931,10 @@ declare const FIELD_SCHEMA: {
|
|
|
2415
1931
|
readonly type: "text";
|
|
2416
1932
|
};
|
|
2417
1933
|
readonly life_span: {
|
|
2418
|
-
readonly type: "
|
|
1934
|
+
readonly type: "integer";
|
|
2419
1935
|
};
|
|
2420
1936
|
readonly weight: {
|
|
2421
|
-
readonly type: "
|
|
1937
|
+
readonly type: "integer";
|
|
2422
1938
|
};
|
|
2423
1939
|
readonly nourishment: {
|
|
2424
1940
|
readonly type: "multi_link";
|
|
@@ -2445,7 +1961,7 @@ declare const FIELD_SCHEMA: {
|
|
|
2445
1961
|
readonly type: "text";
|
|
2446
1962
|
};
|
|
2447
1963
|
readonly aggression: {
|
|
2448
|
-
readonly type: "
|
|
1964
|
+
readonly type: "integer";
|
|
2449
1965
|
};
|
|
2450
1966
|
readonly traits: {
|
|
2451
1967
|
readonly type: "multi_link";
|
|
@@ -2499,10 +2015,10 @@ declare const FIELD_SCHEMA: {
|
|
|
2499
2015
|
readonly type: "text";
|
|
2500
2016
|
};
|
|
2501
2017
|
readonly grant_date: {
|
|
2502
|
-
readonly type: "
|
|
2018
|
+
readonly type: "integer";
|
|
2503
2019
|
};
|
|
2504
2020
|
readonly revoke_date: {
|
|
2505
|
-
readonly type: "
|
|
2021
|
+
readonly type: "integer";
|
|
2506
2022
|
};
|
|
2507
2023
|
readonly issuer: {
|
|
2508
2024
|
readonly type: "single_link";
|
|
@@ -2620,22 +2136,22 @@ declare const FIELD_SCHEMA: {
|
|
|
2620
2136
|
readonly type: "text";
|
|
2621
2137
|
};
|
|
2622
2138
|
readonly charisma: {
|
|
2623
|
-
readonly type: "
|
|
2139
|
+
readonly type: "integer";
|
|
2624
2140
|
};
|
|
2625
2141
|
readonly coercion: {
|
|
2626
|
-
readonly type: "
|
|
2142
|
+
readonly type: "integer";
|
|
2627
2143
|
};
|
|
2628
2144
|
readonly competence: {
|
|
2629
|
-
readonly type: "
|
|
2145
|
+
readonly type: "integer";
|
|
2630
2146
|
};
|
|
2631
2147
|
readonly compassion: {
|
|
2632
|
-
readonly type: "
|
|
2148
|
+
readonly type: "integer";
|
|
2633
2149
|
};
|
|
2634
2150
|
readonly creativity: {
|
|
2635
|
-
readonly type: "
|
|
2151
|
+
readonly type: "integer";
|
|
2636
2152
|
};
|
|
2637
2153
|
readonly courage: {
|
|
2638
|
-
readonly type: "
|
|
2154
|
+
readonly type: "integer";
|
|
2639
2155
|
};
|
|
2640
2156
|
readonly significance: {
|
|
2641
2157
|
readonly type: "text";
|
|
@@ -2674,10 +2190,10 @@ declare const FIELD_SCHEMA: {
|
|
|
2674
2190
|
readonly type: "text";
|
|
2675
2191
|
};
|
|
2676
2192
|
readonly start_date: {
|
|
2677
|
-
readonly type: "
|
|
2193
|
+
readonly type: "integer";
|
|
2678
2194
|
};
|
|
2679
2195
|
readonly end_date: {
|
|
2680
|
-
readonly type: "
|
|
2196
|
+
readonly type: "integer";
|
|
2681
2197
|
};
|
|
2682
2198
|
readonly phenomena: {
|
|
2683
2199
|
readonly type: "multi_link";
|
|
@@ -2705,23 +2221,15 @@ declare const FIELD_SCHEMA: {
|
|
|
2705
2221
|
};
|
|
2706
2222
|
};
|
|
2707
2223
|
/**
|
|
2708
|
-
*
|
|
2709
|
-
*
|
|
2710
|
-
*
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
/**
|
|
2714
|
-
* Creates typed element IDs array from string array
|
|
2715
|
-
* @param ids The string IDs to brand
|
|
2716
|
-
* @returns Branded ElementIds array
|
|
2717
|
-
*/
|
|
2718
|
-
declare function createElementIds<T extends ElementType$1>(ids: string[]): ElementIds<T>;
|
|
2719
|
-
/**
|
|
2720
|
-
* Creates an AnyElementId that can reference any element type
|
|
2721
|
-
* @param id The string ID to brand
|
|
2722
|
-
* @returns AnyElementId
|
|
2224
|
+
* Get Material Design icon name for an element type
|
|
2225
|
+
* Accepts multiple formats: 'character', 'characters', 'Character', etc.
|
|
2226
|
+
*
|
|
2227
|
+
* @param type - Element type in any format (singular, plural, any case)
|
|
2228
|
+
* @returns Material icon name (e.g., 'person', 'castle', 'thunderstorm')
|
|
2723
2229
|
*/
|
|
2724
|
-
declare function
|
|
2230
|
+
declare function getElementIcon(type: string): string;
|
|
2231
|
+
/** Plural display label for an element type (e.g. phenomenon → "Phenomena"). */
|
|
2232
|
+
declare function getElementLabel(elementType: ElementType): string;
|
|
2725
2233
|
|
|
2726
2234
|
/**
|
|
2727
2235
|
* OnlyWorlds Token Management API Types
|
|
@@ -2843,6 +2351,17 @@ declare enum GameTier {
|
|
|
2843
2351
|
* Provides access to the OnlyWorlds token rating system API.
|
|
2844
2352
|
* Based on the working implementation in base-tool/src/llm/token-service.ts
|
|
2845
2353
|
*/
|
|
2354
|
+
/**
|
|
2355
|
+
* Minimal transport the token resource needs — structurally satisfied by
|
|
2356
|
+
* `OwV2Client` (its `request()` is public since 4.0): `new TokenResource(client)`.
|
|
2357
|
+
* Wire ruling (Skeld 2026-07-23): keel keeps the /tokens/* economy long-term
|
|
2358
|
+
* (Tangle ratings write it, Council voting reads it) — port, don't delete.
|
|
2359
|
+
*/
|
|
2360
|
+
interface TokenTransport {
|
|
2361
|
+
request<T>(method: string, path: string, opts?: {
|
|
2362
|
+
body?: unknown;
|
|
2363
|
+
}): Promise<T>;
|
|
2364
|
+
}
|
|
2846
2365
|
|
|
2847
2366
|
/**
|
|
2848
2367
|
* Token Management Resource
|
|
@@ -2870,7 +2389,7 @@ declare enum GameTier {
|
|
|
2870
2389
|
*/
|
|
2871
2390
|
declare class TokenResource {
|
|
2872
2391
|
private client;
|
|
2873
|
-
constructor(client:
|
|
2392
|
+
constructor(client: TokenTransport);
|
|
2874
2393
|
/**
|
|
2875
2394
|
* Get current token status for authenticated user
|
|
2876
2395
|
*
|
|
@@ -2989,473 +2508,4 @@ declare class TokenResource {
|
|
|
2989
2508
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
2990
2509
|
}
|
|
2991
2510
|
|
|
2992
|
-
|
|
2993
|
-
apiKey: string;
|
|
2994
|
-
apiPin: string;
|
|
2995
|
-
baseUrl?: string;
|
|
2996
|
-
}
|
|
2997
|
-
interface ListOptions {
|
|
2998
|
-
limit?: number;
|
|
2999
|
-
offset?: number;
|
|
3000
|
-
ordering?: string;
|
|
3001
|
-
search?: string;
|
|
3002
|
-
[key: string]: any;
|
|
3003
|
-
}
|
|
3004
|
-
interface ApiResponse<T> {
|
|
3005
|
-
count: number;
|
|
3006
|
-
next: string | null;
|
|
3007
|
-
previous: string | null;
|
|
3008
|
-
results: T[];
|
|
3009
|
-
}
|
|
3010
|
-
/**
|
|
3011
|
-
* Base resource class for CRUD operations
|
|
3012
|
-
*/
|
|
3013
|
-
declare class Resource<T, TInput> {
|
|
3014
|
-
private client;
|
|
3015
|
-
private elementType;
|
|
3016
|
-
constructor(client: OnlyWorldsClient, elementType: string);
|
|
3017
|
-
list(options?: ListOptions): Promise<ApiResponse<T>>;
|
|
3018
|
-
get(id: string): Promise<T>;
|
|
3019
|
-
create(data: TInput): Promise<T>;
|
|
3020
|
-
update(id: string, data: Partial<TInput>): Promise<T>;
|
|
3021
|
-
delete(id: string): Promise<void>;
|
|
3022
|
-
/**
|
|
3023
|
-
* Round Pin coordinates to integers (API requirement)
|
|
3024
|
-
* @private
|
|
3025
|
-
*/
|
|
3026
|
-
private roundPinCoordinates;
|
|
3027
|
-
}
|
|
3028
|
-
/**
|
|
3029
|
-
* Special resource class for World endpoint
|
|
3030
|
-
* The /world/ endpoint returns a single World object directly (not paginated)
|
|
3031
|
-
* because API keys are world-scoped (one key = one world)
|
|
3032
|
-
*/
|
|
3033
|
-
declare class WorldResource {
|
|
3034
|
-
private client;
|
|
3035
|
-
constructor(client: OnlyWorldsClient);
|
|
3036
|
-
/**
|
|
3037
|
-
* Get the world associated with the current API key
|
|
3038
|
-
* Returns the world directly (not wrapped in pagination)
|
|
3039
|
-
*/
|
|
3040
|
-
get(): Promise<World>;
|
|
3041
|
-
/**
|
|
3042
|
-
* Update the current world
|
|
3043
|
-
*/
|
|
3044
|
-
update(data: Partial<WorldInput>): Promise<World>;
|
|
3045
|
-
}
|
|
3046
|
-
/**
|
|
3047
|
-
* Main OnlyWorlds API client
|
|
3048
|
-
*/
|
|
3049
|
-
declare class OnlyWorldsClient {
|
|
3050
|
-
private baseUrl;
|
|
3051
|
-
private headers;
|
|
3052
|
-
worlds: WorldResource;
|
|
3053
|
-
tokens: TokenResource;
|
|
3054
|
-
abilities: Resource<Ability, AbilityInput>;
|
|
3055
|
-
characters: Resource<Character, CharacterInput>;
|
|
3056
|
-
collectives: Resource<Collective, CollectiveInput>;
|
|
3057
|
-
constructs: Resource<Construct, ConstructInput>;
|
|
3058
|
-
creatures: Resource<Creature, CreatureInput>;
|
|
3059
|
-
events: Resource<Event, EventInput>;
|
|
3060
|
-
families: Resource<Family, FamilyInput>;
|
|
3061
|
-
institutions: Resource<Institution, InstitutionInput>;
|
|
3062
|
-
languages: Resource<Language, LanguageInput>;
|
|
3063
|
-
laws: Resource<Law, LawInput>;
|
|
3064
|
-
locations: Resource<Location, LocationInput>;
|
|
3065
|
-
maps: Resource<Map, MapInput>;
|
|
3066
|
-
markers: Resource<Marker, MarkerInput>;
|
|
3067
|
-
narratives: Resource<Narrative, NarrativeInput>;
|
|
3068
|
-
objects: Resource<Object$1, ObjectInput>;
|
|
3069
|
-
phenomena: Resource<Phenomenon, PhenomenonInput>;
|
|
3070
|
-
pins: Resource<Pin, PinInput>;
|
|
3071
|
-
relations: Resource<Relation, RelationInput>;
|
|
3072
|
-
species: Resource<Species, SpeciesInput>;
|
|
3073
|
-
titles: Resource<Title, TitleInput>;
|
|
3074
|
-
traits: Resource<Trait, TraitInput>;
|
|
3075
|
-
zones: Resource<Zone, ZoneInput>;
|
|
3076
|
-
constructor(config: OnlyWorldsConfig);
|
|
3077
|
-
/**
|
|
3078
|
-
* Make a request to the OnlyWorlds API
|
|
3079
|
-
*/
|
|
3080
|
-
request<T>(method: string, path: string, options?: {
|
|
3081
|
-
params?: Record<string, any>;
|
|
3082
|
-
body?: any;
|
|
3083
|
-
}): Promise<T>;
|
|
3084
|
-
/**
|
|
3085
|
-
* Helper to convert nested objects to _id/_ids format (legacy method)
|
|
3086
|
-
* @deprecated Use prepareRelations instead - it's called automatically in create/update
|
|
3087
|
-
*/
|
|
3088
|
-
static prepareInput<T extends Record<string, any>>(data: T): any;
|
|
3089
|
-
/**
|
|
3090
|
-
* Convert relation fields to API format (_id/_ids suffix)
|
|
3091
|
-
*
|
|
3092
|
-
* The OnlyWorlds API expects:
|
|
3093
|
-
* - single_link fields: fieldname_id (e.g., birthplace_id)
|
|
3094
|
-
* - multi_link fields: fieldname_ids (e.g., species_ids)
|
|
3095
|
-
*
|
|
3096
|
-
* This method auto-converts based on FIELD_SCHEMA:
|
|
3097
|
-
* - { species: ["id1", "id2"] } → { species_ids: ["id1", "id2"] }
|
|
3098
|
-
* - { birthplace: "location-id" } → { birthplace_id: "location-id" }
|
|
3099
|
-
* - { species: [{id: "id1", name: "X"}] } → { species_ids: ["id1"] }
|
|
3100
|
-
*
|
|
3101
|
-
* Called automatically by create() and update() methods.
|
|
3102
|
-
*/
|
|
3103
|
-
static prepareRelations<T extends Record<string, any>>(data: T, elementType: string): any;
|
|
3104
|
-
}
|
|
3105
|
-
|
|
3106
|
-
/**
|
|
3107
|
-
* Get Material Design icon name for an element type
|
|
3108
|
-
* Accepts multiple formats: 'character', 'characters', 'Character', etc.
|
|
3109
|
-
*
|
|
3110
|
-
* @param type - Element type in any format (singular, plural, any case)
|
|
3111
|
-
* @returns Material icon name (e.g., 'person', 'castle', 'thunderstorm')
|
|
3112
|
-
*
|
|
3113
|
-
* @example
|
|
3114
|
-
* getElementIcon('character') // 'person'
|
|
3115
|
-
* getElementIcon('characters') // 'person'
|
|
3116
|
-
* getElementIcon('Character') // 'person'
|
|
3117
|
-
* getElementIcon('phenomena') // 'thunderstorm'
|
|
3118
|
-
*/
|
|
3119
|
-
declare function getElementIcon(type: string): string;
|
|
3120
|
-
|
|
3121
|
-
/** Every element carries these. The extension index signature admits namespaced
|
|
3122
|
-
* pass-through fields (atlas_* / shadow_* / x_*) returned verbatim by the server. */
|
|
3123
|
-
interface OwElementBase {
|
|
3124
|
-
/** Element type slug (server-managed, read-only). */
|
|
3125
|
-
type: string;
|
|
3126
|
-
/** Unique identifier, uuidv7 format. */
|
|
3127
|
-
id: string;
|
|
3128
|
-
/** Name of the element. */
|
|
3129
|
-
name: string;
|
|
3130
|
-
/** Any kind of details about the element. */
|
|
3131
|
-
description?: string;
|
|
3132
|
-
/** The top level category to which the element belongs. */
|
|
3133
|
-
supertype?: string;
|
|
3134
|
-
/** The sub level category through which the element is further classified. */
|
|
3135
|
-
subtype?: string;
|
|
3136
|
-
/** URL to an image representing the element. */
|
|
3137
|
-
image_url?: string;
|
|
3138
|
-
/** Creation timestamp (server-managed, read-only). */
|
|
3139
|
-
created_at?: string;
|
|
3140
|
-
/** Last-update timestamp (server-managed, read-only). */
|
|
3141
|
-
updated_at?: string;
|
|
3142
|
-
/** Per-world change cursor, stamped on every write (server-managed, read-only). */
|
|
3143
|
-
change_seq?: number;
|
|
3144
|
-
/** Namespaced extension fields (atlas_* / shadow_* / x_*), returned verbatim. */
|
|
3145
|
-
[ext: string]: unknown;
|
|
3146
|
-
}
|
|
3147
|
-
type ElementType = 'ability' | 'character' | 'collective' | 'construct' | 'creature' | 'event' | 'family' | 'institution' | 'language' | 'law' | 'location' | 'map' | 'marker' | 'narrative' | 'object' | 'phenomenon' | 'pin' | 'relation' | 'species' | 'title' | 'trait' | 'zone';
|
|
3148
|
-
declare const ELEMENT_TYPES: ElementType[];
|
|
3149
|
-
|
|
3150
|
-
/**
|
|
3151
|
-
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
3152
|
-
* wire-corrected against live staging fixtures 2026-07-18.
|
|
3153
|
-
*
|
|
3154
|
-
* OnlyWorlds v2 (keel) wire types -- the NON-generated, hand-owned wire shapes
|
|
3155
|
-
* (envelopes, pages, bulk, changes, config). Per-type element field typing is
|
|
3156
|
-
* generated (types.generated.ts). One-shape principle: a field reads the way it
|
|
3157
|
-
* writes -- links are UUID arrays (or UUID/null), same name both directions.
|
|
3158
|
-
* No `_ids` suffix in v2.
|
|
3159
|
-
*/
|
|
3160
|
-
|
|
3161
|
-
/** An element as read from / written to the v2 API. Loose base + extension keys. */
|
|
3162
|
-
type OwElement = OwElementBase;
|
|
3163
|
-
/** Spatial types live under spatial/ in the OW Folder Format. */
|
|
3164
|
-
declare const SPATIAL_TYPES: readonly ElementType[];
|
|
3165
|
-
interface OwWorldMeta {
|
|
3166
|
-
id: string;
|
|
3167
|
-
name: string;
|
|
3168
|
-
updated_at?: string;
|
|
3169
|
-
public_read?: boolean;
|
|
3170
|
-
[field: string]: unknown;
|
|
3171
|
-
}
|
|
3172
|
-
/** List envelope: cursor-paginated. */
|
|
3173
|
-
interface OwPage<T = OwElement> {
|
|
3174
|
-
data: T[];
|
|
3175
|
-
has_more: boolean;
|
|
3176
|
-
next_cursor: string | null;
|
|
3177
|
-
}
|
|
3178
|
-
/** /changes feed -- discriminated union on `op`. Apply in order -> convergence. */
|
|
3179
|
-
type OwChange = {
|
|
3180
|
-
op: 'upsert';
|
|
3181
|
-
id: string;
|
|
3182
|
-
type: string;
|
|
3183
|
-
element: OwElement;
|
|
3184
|
-
updated_at: string;
|
|
3185
|
-
[k: string]: unknown;
|
|
3186
|
-
} | {
|
|
3187
|
-
op: 'delete';
|
|
3188
|
-
id: string;
|
|
3189
|
-
type: string;
|
|
3190
|
-
deleted_at: string;
|
|
3191
|
-
[k: string]: unknown;
|
|
3192
|
-
};
|
|
3193
|
-
/**
|
|
3194
|
-
* /changes response. Wire shape verified in keel source (core/changes.py) and
|
|
3195
|
-
* pinned here: {cursor, changes, has_more, head}.
|
|
3196
|
-
*/
|
|
3197
|
-
interface OwChangesPage {
|
|
3198
|
-
/** Opaque compound cursor -- persist verbatim, never parse, never expires. */
|
|
3199
|
-
cursor: string;
|
|
3200
|
-
changes: OwChange[];
|
|
3201
|
-
has_more: boolean;
|
|
3202
|
-
/**
|
|
3203
|
-
* World's current change_seq. If a persisted cursor is ever AHEAD of head,
|
|
3204
|
-
* the server rewound (disaster restore) -- re-baseline from cursor zero
|
|
3205
|
-
* instead of assuming caught-up.
|
|
3206
|
-
*/
|
|
3207
|
-
head: number;
|
|
3208
|
-
}
|
|
3209
|
-
interface OwBulkItem {
|
|
3210
|
-
type: ElementType | string;
|
|
3211
|
-
element: OwElement | Record<string, unknown>;
|
|
3212
|
-
}
|
|
3213
|
-
/**
|
|
3214
|
-
* One slot of a /bulk response. WIRE-CORRECTED (fixtures P2a/P2c): `status` is
|
|
3215
|
-
* the NUMERIC HTTP status of that slot (201/400/...), success slots echo
|
|
3216
|
-
* created_at/updated_at, error slots carry an OwErrorBody under `error`.
|
|
3217
|
-
*/
|
|
3218
|
-
interface OwBulkItemResult {
|
|
3219
|
-
status: number;
|
|
3220
|
-
id?: string;
|
|
3221
|
-
created_at?: string;
|
|
3222
|
-
updated_at?: string;
|
|
3223
|
-
error?: OwErrorBody;
|
|
3224
|
-
}
|
|
3225
|
-
/** The wire error envelope carried in error slots and thrown errors. */
|
|
3226
|
-
interface OwErrorBody {
|
|
3227
|
-
type?: string;
|
|
3228
|
-
code?: string;
|
|
3229
|
-
message?: string;
|
|
3230
|
-
param?: string | null;
|
|
3231
|
-
doc_url?: string;
|
|
3232
|
-
}
|
|
3233
|
-
/**
|
|
3234
|
-
* /bulk response. WIRE-CORRECTED (fixtures P2a/P2c): the array key is `items`,
|
|
3235
|
-
* not `results`. `wasReplay` is populated by the client from the (lowercase on
|
|
3236
|
-
* the wire) Idempotent-Replay response header (fixture P2b) -- not a wire field.
|
|
3237
|
-
*/
|
|
3238
|
-
interface OwBulkResponse {
|
|
3239
|
-
errors: boolean;
|
|
3240
|
-
items: OwBulkItemResult[];
|
|
3241
|
-
/** Client-derived: true when the server replayed a prior Idempotency-Key. */
|
|
3242
|
-
wasReplay?: boolean;
|
|
3243
|
-
[k: string]: unknown;
|
|
3244
|
-
}
|
|
3245
|
-
interface OwLinkEdit {
|
|
3246
|
-
add?: string[];
|
|
3247
|
-
remove?: string[];
|
|
3248
|
-
}
|
|
3249
|
-
interface ListParams {
|
|
3250
|
-
limit?: number;
|
|
3251
|
-
cursor?: string;
|
|
3252
|
-
/** One-level stub expansion, e.g. ['friends', 'location']. */
|
|
3253
|
-
expand?: string[];
|
|
3254
|
-
/** Sparse include-set of field names. */
|
|
3255
|
-
fields?: string[];
|
|
3256
|
-
/**
|
|
3257
|
-
* Blessed Django-style filters: __icontains, __in, __gte, __lte, __isnull,
|
|
3258
|
-
* supertype/subtype equality. Unknown params 422 loudly server-side -- the
|
|
3259
|
-
* client passes them through and lets the platform name the typo.
|
|
3260
|
-
*/
|
|
3261
|
-
filter?: Record<string, string | number | boolean>;
|
|
3262
|
-
}
|
|
3263
|
-
interface OwClientConfig {
|
|
3264
|
-
/** ow_w_ / ow_r_ / ow_a_ prefixed key, or grandfathered 10-digit legacy key. */
|
|
3265
|
-
apiKey: string;
|
|
3266
|
-
/**
|
|
3267
|
-
* Optional. Required for writes when the world has a PIN, and for legacy-key
|
|
3268
|
-
* reads of private worlds. Prefixed keys read PIN-less. String, not number --
|
|
3269
|
-
* '0123' !== 123.
|
|
3270
|
-
*/
|
|
3271
|
-
apiPin?: string;
|
|
3272
|
-
/** Default: https://www.onlyworlds.com/api/v2 */
|
|
3273
|
-
baseUrl?: string;
|
|
3274
|
-
/**
|
|
3275
|
-
* Page size for element lists. Default 100 (server default; max 1000).
|
|
3276
|
-
* Deliberately visible in config: page size is a citizenship property.
|
|
3277
|
-
*/
|
|
3278
|
-
pageSize?: number;
|
|
3279
|
-
/**
|
|
3280
|
-
* Page size for /changes pulls. Default 100. Live precedents: Obsidian 100,
|
|
3281
|
-
* Atlas 250, MCP 25. /changes is the platform's heaviest route -- be polite.
|
|
3282
|
-
*/
|
|
3283
|
-
changesPageSize?: number;
|
|
3284
|
-
/** Injectable for tests / fake-keel harnesses. Defaults to globalThis.fetch. */
|
|
3285
|
-
fetch?: typeof globalThis.fetch;
|
|
3286
|
-
}
|
|
3287
|
-
|
|
3288
|
-
/**
|
|
3289
|
-
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
3290
|
-
* wire-corrected against live staging fixtures 2026-07-18.
|
|
3291
|
-
*
|
|
3292
|
-
* keel error envelope handling. The error contract is part of the contract:
|
|
3293
|
-
* envelopes carry a machine `code` and a `doc_url` fragment anchored at
|
|
3294
|
-
* onlyworlds.github.io/api/errors -- surface both, always. The live wire
|
|
3295
|
-
* envelope also carries `type` and `param` (fixtures P4a/P2c); both are
|
|
3296
|
-
* surfaced on the thrown error.
|
|
3297
|
-
*/
|
|
3298
|
-
/** Auth codes are distinguishable by design; client recovery UX differs per code. */
|
|
3299
|
-
type OwAuthErrorCode = 'invalid_credentials' | 'key_revoked' | 'world_gone';
|
|
3300
|
-
declare class OwApiError extends Error {
|
|
3301
|
-
readonly status: number;
|
|
3302
|
-
/** Machine error code from the keel envelope, e.g. 'invalid_credentials'. */
|
|
3303
|
-
readonly code: string | null;
|
|
3304
|
-
/** Error family from the envelope, e.g. 'invalid_request', 'not_found'. */
|
|
3305
|
-
readonly type: string | null;
|
|
3306
|
-
/** Offending field/param named by the envelope (422/400), else null. */
|
|
3307
|
-
readonly param: string | null;
|
|
3308
|
-
/** Documentation link from the envelope -- show it to users/logs verbatim. */
|
|
3309
|
-
readonly docUrl: string | null;
|
|
3310
|
-
/** Raw parsed envelope (or body text when the body wasn't JSON). */
|
|
3311
|
-
readonly detail: unknown;
|
|
3312
|
-
constructor(status: number, code: string | null, message: string, docUrl: string | null, detail: unknown, type?: string | null, param?: string | null);
|
|
3313
|
-
get isAuthError(): boolean;
|
|
3314
|
-
/** 422s/400s name the offending param/field -- typos error loudly platform-wide. */
|
|
3315
|
-
get isValidationError(): boolean;
|
|
3316
|
-
/** Same Idempotency-Key replayed with a different payload. */
|
|
3317
|
-
get isIdempotencyConflict(): boolean;
|
|
3318
|
-
}
|
|
3319
|
-
/** Network-level failure (fetch rejected) -- no envelope to parse. */
|
|
3320
|
-
declare class OwNetworkError extends Error {
|
|
3321
|
-
readonly cause2: unknown;
|
|
3322
|
-
constructor(message: string, cause: unknown);
|
|
3323
|
-
}
|
|
3324
|
-
/** Parse a wire envelope into OwApiError parts (exported for the error type-tests). */
|
|
3325
|
-
declare function parseEnvelope(status: number, body: unknown): OwApiError;
|
|
3326
|
-
/** Build an OwApiError from a non-2xx response, tolerating non-JSON bodies. */
|
|
3327
|
-
declare function errorFromResponse(res: Response): Promise<OwApiError>;
|
|
3328
|
-
|
|
3329
|
-
/**
|
|
3330
|
-
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
3331
|
-
* wire-corrected against live staging fixtures 2026-07-18.
|
|
3332
|
-
*
|
|
3333
|
-
* OnlyWorlds key-kind detection. Prefixes make leaked keys grep-scannable
|
|
3334
|
-
* (Stripe/GitHub precedent) -- and tell a client what auth shape to expect.
|
|
3335
|
-
*/
|
|
3336
|
-
type OwKeyKind =
|
|
3337
|
-
/** ow_w_ -- world key, read + write. Writes need the world's PIN if it has one. */
|
|
3338
|
-
'write'
|
|
3339
|
-
/** ow_r_ -- world key, read-only, works bare (no PIN). The share-with-players primitive. */
|
|
3340
|
-
| 'read'
|
|
3341
|
-
/** ow_a_ -- account Bearer token for /account/* routes; can mint world keys. */
|
|
3342
|
-
| 'account'
|
|
3343
|
-
/** Grandfathered 10-digit key. Needs PIN to read private worlds. */
|
|
3344
|
-
| 'legacy' | 'unknown';
|
|
3345
|
-
/** Demo range 0000000000-0000000009: read-only aliases, safe as live read gates. */
|
|
3346
|
-
declare function isDemoKey(key: string): boolean;
|
|
3347
|
-
declare function detectKeyKind(key: string): OwKeyKind;
|
|
3348
|
-
/** Can this key kind ever perform world writes? (PIN is a separate, per-world question.) */
|
|
3349
|
-
declare function kindCanWrite(kind: OwKeyKind): boolean;
|
|
3350
|
-
/**
|
|
3351
|
-
* Should a credential UI ask for a PIN with this key?
|
|
3352
|
-
* Prefixed keys read PIN-less; legacy keys may need it; writes on pinned
|
|
3353
|
-
* worlds always need it. 'optional' means: show the field, don't require it.
|
|
3354
|
-
*/
|
|
3355
|
-
declare function pinExpectation(kind: OwKeyKind): 'never' | 'optional' | 'required-for-private-reads';
|
|
3356
|
-
|
|
3357
|
-
/**
|
|
3358
|
-
* keel v2 engine absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
3359
|
-
* wire-corrected against live staging fixtures 2026-07-18.
|
|
3360
|
-
*
|
|
3361
|
-
* OwV2Client -- thin typed fetch client for the keel v2 API.
|
|
3362
|
-
*
|
|
3363
|
-
* Deliberately thin: no caching, no sync state, no retry policy -- those belong
|
|
3364
|
-
* to callers (sync engines, tools, games). What IS encoded here is the wire
|
|
3365
|
-
* contract and its safety rails: payload read-only-field stripping, opaque
|
|
3366
|
-
* cursors, idempotency headers, doc_url-bearing errors, polite page sizes, and
|
|
3367
|
-
* client-side UUID minting so idempotent retries are structurally safe.
|
|
3368
|
-
*/
|
|
3369
|
-
|
|
3370
|
-
declare class OwV2Client {
|
|
3371
|
-
readonly baseUrl: string;
|
|
3372
|
-
readonly keyKind: OwKeyKind;
|
|
3373
|
-
readonly pageSize: number;
|
|
3374
|
-
readonly changesPageSize: number;
|
|
3375
|
-
private readonly apiKey;
|
|
3376
|
-
private readonly apiPin;
|
|
3377
|
-
private readonly fetchImpl;
|
|
3378
|
-
constructor(config: OwClientConfig);
|
|
3379
|
-
/** GET /health -- unauthenticated liveness pulse. */
|
|
3380
|
-
health(): Promise<unknown>;
|
|
3381
|
-
/**
|
|
3382
|
-
* GET /world -- world meta (name, calendar/time fields, public_read).
|
|
3383
|
-
* GOTCHA (by server design): world-meta edits do NOT appear in /changes and
|
|
3384
|
-
* do not bump change_seq. Poll getWorld().updated_at for meta freshness.
|
|
3385
|
-
*/
|
|
3386
|
-
getWorld(): Promise<OwWorldMeta>;
|
|
3387
|
-
/** PATCH /world -- partial world-meta update. */
|
|
3388
|
-
patchWorld(partial: Record<string, unknown>): Promise<OwWorldMeta>;
|
|
3389
|
-
/** GET /{type}/ -- one cursor page. */
|
|
3390
|
-
list(type: ElementType | string, params?: ListParams): Promise<OwPage>;
|
|
3391
|
-
/** Cursor-walk every page of a type. Politeness: uses config pageSize. */
|
|
3392
|
-
listAll(type: ElementType | string, params?: Omit<ListParams, 'cursor'>): AsyncGenerator<OwElement>;
|
|
3393
|
-
/** GET /{type}/{id}/ -- optional one-level stub expansion / sparse fields. */
|
|
3394
|
-
get(type: ElementType | string, id: string, opts?: Pick<ListParams, 'expand' | 'fields'>): Promise<OwElement>;
|
|
3395
|
-
/**
|
|
3396
|
-
* POST /{type}/ -- create. Mints an RFC-4122 UUID for element.id when the
|
|
3397
|
-
* caller omits one (design ruling D29d) so a retry carrying the same
|
|
3398
|
-
* Idempotency-Key is structurally safe. Callers MAY still supply their own id.
|
|
3399
|
-
*/
|
|
3400
|
-
create(type: ElementType | string, element: OwElement | Record<string, unknown>, opts?: {
|
|
3401
|
-
idempotencyKey?: string;
|
|
3402
|
-
}): Promise<OwElement>;
|
|
3403
|
-
/** PUT /{type}/{id}/ -- upsert-by-client-id. The local-first write primitive. */
|
|
3404
|
-
upsert(type: ElementType | string, id: string, element: OwElement | Record<string, unknown>): Promise<OwElement>;
|
|
3405
|
-
/**
|
|
3406
|
-
* PATCH /{type}/{id}/ -- partial update. DESTRUCTIVE on sent fields: arrays
|
|
3407
|
-
* replace wholesale, omitted fields stay untouched. For link arrays prefer
|
|
3408
|
-
* editLinks() -- atomic server-side merge, no read-before-write.
|
|
3409
|
-
*/
|
|
3410
|
-
patch(type: ElementType | string, id: string, partial: Record<string, unknown>): Promise<OwElement>;
|
|
3411
|
-
/**
|
|
3412
|
-
* DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
|
|
3413
|
-
* tombstone AND scrubs the id from every other element's links in the same
|
|
3414
|
-
* transaction -- no client-side unlink pass needed, ever.
|
|
3415
|
-
*/
|
|
3416
|
-
delete(type: ElementType | string, id: string): Promise<void>;
|
|
3417
|
-
/**
|
|
3418
|
-
* POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
|
|
3419
|
-
* Dedupes, tolerates already-present/already-absent ids. Returns the FULL
|
|
3420
|
-
* updated element (fixture P5). Use this for all relationship editing; it
|
|
3421
|
-
* retires the read-merge-PATCH dance.
|
|
3422
|
-
*/
|
|
3423
|
-
editLinks(type: ElementType | string, id: string, field: string, edit: OwLinkEdit): Promise<OwElement>;
|
|
3424
|
-
/**
|
|
3425
|
-
* POST /bulk -- up to ~1000 items. Partial success by default (HTTP 200
|
|
3426
|
-
* always; inspect per-slot numeric `status` + top-level `errors` flag);
|
|
3427
|
-
* atomic:true for all-or-nothing. Link validation runs against batch U
|
|
3428
|
-
* database -- send in any order, cycles included; no client topo-sort.
|
|
3429
|
-
* Success slots echo server-authoritative timestamps: set your sync baseline
|
|
3430
|
-
* from this response alone. When an idempotencyKey is replayed, the returned
|
|
3431
|
-
* response carries wasReplay:true (read from the Idempotent-Replay header).
|
|
3432
|
-
*/
|
|
3433
|
-
bulk(items: OwBulkItem[], opts?: {
|
|
3434
|
-
atomic?: boolean;
|
|
3435
|
-
idempotencyKey?: string;
|
|
3436
|
-
}): Promise<OwBulkResponse>;
|
|
3437
|
-
/**
|
|
3438
|
-
* GET /changes -- one page of the world's ordered change feed.
|
|
3439
|
-
* Cursor is OPAQUE and never expires: persist verbatim, never parse.
|
|
3440
|
-
* Zero/absent cursor = full export (byte-aligned with the Folder Format).
|
|
3441
|
-
* Rewind rule: if your persisted position is ahead of page.head, the server
|
|
3442
|
-
* was restored -- re-baseline from cursor zero; do not assume caught-up.
|
|
3443
|
-
* Citizenship: heaviest route on the platform; default page size is polite.
|
|
3444
|
-
*/
|
|
3445
|
-
changes(opts?: {
|
|
3446
|
-
since?: string;
|
|
3447
|
-
limit?: number;
|
|
3448
|
-
}): Promise<OwChangesPage>;
|
|
3449
|
-
/**
|
|
3450
|
-
* Walk the feed from `since` (or from zero = full export) to the current
|
|
3451
|
-
* tail, yielding ops in order. Returns the final cursor via the generator's
|
|
3452
|
-
* return value; persist it for the next incremental pull.
|
|
3453
|
-
*/
|
|
3454
|
-
changesAll(since?: string): AsyncGenerator<OwChange, {
|
|
3455
|
-
cursor: string;
|
|
3456
|
-
head: number;
|
|
3457
|
-
}>;
|
|
3458
|
-
private request;
|
|
3459
|
-
}
|
|
3460
|
-
|
|
3461
|
-
export { type Ability, type AbilityInput, type AccessKeyResponse, type AnyElementId, type ApiResponse, type BaseElement, type Character, type CharacterInput, type Collective, type CollectiveInput, type Construct, type ConstructInput, type Creature, type CreatureInput, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementId, type ElementIds, ElementType$1 as ElementType, type EncryptionInfo, type Event, type EventInput, FIELD_SCHEMA, type Family, type FamilyInput, type FieldInfo, type FieldType, GameTier, type Institution, type InstitutionInput, type Language, type LanguageInput, type Law, type LawInput, type ListOptions, type ListParams, type Location, type LocationInput, type Map, type MapInput, type Marker, type MarkerInput, type Narrative, type NarrativeInput, ONLYWORLDS_VERSION, type Object$1 as Object, type ObjectInput, OnlyWorldsClient, type OnlyWorldsConfig, OwApiError, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwChange, type OwChangesPage, type OwClientConfig, type OwElement, type OwElementBase, type OwErrorBody, type OwKeyKind, type OwLinkEdit, OwNetworkError, type OwPage, OwV2Client, type OwWorldMeta, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type Species, type SpeciesInput, type Title, type TitleInput, type TokenConsumeParams, type TokenConsumeResponse, type TokenStatus, type Trait, type TraitInput, type ElementType as V2ElementType, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds, detectKeyKind, errorFromResponse, getElementIcon, getElementLabel, getElementSections, isDemoKey, kindCanWrite, parseEnvelope, pinExpectation };
|
|
2511
|
+
export { type AccessKeyResponse, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, FAMILY_COLORS, FAMILY_ORDER, FIELD_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, OwApiError, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwChange, type OwChangesPage, type OwClientConfig, type OwElement, type OwElementBase, type OwErrorBody, type OwKeyKind, type OwLinkEdit, OwNetworkError, type OwPage, OwV2Client, type OwWorldMeta, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, detectKeyKind, elementColor, errorFromResponse, familyOf, getElementIcon, getElementLabel, isDemoKey, kindCanWrite, parseEnvelope, pinExpectation };
|