@onlyworlds/sdk 4.112.0 → 4.114.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 +1 -1
- package/CHANGELOG.md +25 -1
- package/README.md +30 -0
- package/SCHEMA.md +1 -1
- package/dist/chunk-7E4HPNBS.js +1346 -0
- package/dist/index.d.ts +17 -9
- package/dist/index.js +1546 -2806
- package/dist/waymark.css +364 -0
- package/dist/waymark.d.ts +100 -0
- package/dist/waymark.js +468 -0
- package/package.json +14 -5
|
@@ -0,0 +1,1346 @@
|
|
|
1
|
+
// src/options.ts
|
|
2
|
+
function unknownKey(opts, keys) {
|
|
3
|
+
if (!opts || typeof opts !== "object") return void 0;
|
|
4
|
+
for (const k of Object.keys(opts)) if (!keys.includes(k)) return k;
|
|
5
|
+
return void 0;
|
|
6
|
+
}
|
|
7
|
+
function refuseUnknownOptions(fn, opts, keys, after = "") {
|
|
8
|
+
const k = unknownKey(opts, keys);
|
|
9
|
+
if (k !== void 0) {
|
|
10
|
+
throw new TypeError(`${fn}: unknown option '${k}'. The keys are ${keys.join(", ")}.${after ? ` ${after}` : ""}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/v2/types.generated.ts
|
|
15
|
+
var ELEMENT_TYPES = ["ability", "character", "collective", "construct", "creature", "event", "family", "institution", "language", "law", "location", "map", "marker", "narrative", "object", "phenomenon", "pin", "relation", "species", "title", "trait", "zone"];
|
|
16
|
+
var ONLYWORLDS_VERSION = "00.33.00";
|
|
17
|
+
var ELEMENT_GROUPS = {
|
|
18
|
+
ability: "amber",
|
|
19
|
+
character: "blue",
|
|
20
|
+
collective: "blue",
|
|
21
|
+
construct: "pink",
|
|
22
|
+
creature: "blue",
|
|
23
|
+
event: "amber",
|
|
24
|
+
family: "blue",
|
|
25
|
+
institution: "blue",
|
|
26
|
+
language: "pink",
|
|
27
|
+
law: "pink",
|
|
28
|
+
location: "green",
|
|
29
|
+
map: "green",
|
|
30
|
+
marker: "green",
|
|
31
|
+
narrative: "amber",
|
|
32
|
+
object: "green",
|
|
33
|
+
phenomenon: "amber",
|
|
34
|
+
pin: "green",
|
|
35
|
+
relation: "amber",
|
|
36
|
+
species: "blue",
|
|
37
|
+
title: "pink",
|
|
38
|
+
trait: "pink",
|
|
39
|
+
zone: "green"
|
|
40
|
+
};
|
|
41
|
+
var GROUP_ORDER = ["blue", "green", "pink", "amber"];
|
|
42
|
+
var GROUP_COLORS = {
|
|
43
|
+
blue: { light: "#2a78d6", dark: "#3987e5" },
|
|
44
|
+
green: { light: "#008300", dark: "#008300" },
|
|
45
|
+
pink: { light: "#e87ba4", dark: "#d55181" },
|
|
46
|
+
amber: { light: "#eda100", dark: "#c98500" }
|
|
47
|
+
};
|
|
48
|
+
var ELEMENT_ICONS = {
|
|
49
|
+
ability: "auto_fix_normal",
|
|
50
|
+
character: "person",
|
|
51
|
+
collective: "groups_3",
|
|
52
|
+
construct: "api",
|
|
53
|
+
creature: "bug_report",
|
|
54
|
+
event: "saved_search",
|
|
55
|
+
family: "supervisor_account",
|
|
56
|
+
institution: "account_balance",
|
|
57
|
+
language: "edit_road",
|
|
58
|
+
law: "gpp_bad",
|
|
59
|
+
location: "castle",
|
|
60
|
+
map: "map",
|
|
61
|
+
marker: "polyline",
|
|
62
|
+
narrative: "menu_book",
|
|
63
|
+
object: "webhook",
|
|
64
|
+
phenomenon: "thunderstorm",
|
|
65
|
+
pin: "push_pin",
|
|
66
|
+
relation: "link",
|
|
67
|
+
species: "crib",
|
|
68
|
+
title: "military_tech",
|
|
69
|
+
trait: "flaky",
|
|
70
|
+
zone: "pentagon"
|
|
71
|
+
};
|
|
72
|
+
var PUBLIC_FIELDS = {
|
|
73
|
+
ability: [],
|
|
74
|
+
character: ["physicality", "height", "weight", "species", "reputation"],
|
|
75
|
+
collective: [],
|
|
76
|
+
construct: [],
|
|
77
|
+
creature: [],
|
|
78
|
+
event: [],
|
|
79
|
+
family: [],
|
|
80
|
+
institution: [],
|
|
81
|
+
language: [],
|
|
82
|
+
law: [],
|
|
83
|
+
location: [],
|
|
84
|
+
map: [],
|
|
85
|
+
marker: [],
|
|
86
|
+
narrative: [],
|
|
87
|
+
object: [],
|
|
88
|
+
phenomenon: [],
|
|
89
|
+
pin: [],
|
|
90
|
+
relation: [],
|
|
91
|
+
species: [],
|
|
92
|
+
title: [],
|
|
93
|
+
trait: [],
|
|
94
|
+
zone: []
|
|
95
|
+
};
|
|
96
|
+
var ELEMENT_SECTIONS = {
|
|
97
|
+
ability: [
|
|
98
|
+
{ name: "Mechanics", order: 1, fields: ["activation", "duration", "potency", "range", "effects", "challenges", "talents", "requisites"] },
|
|
99
|
+
{ name: "World", order: 2, fields: ["prevalence", "tradition", "source", "locus", "instruments", "systems"] }
|
|
100
|
+
],
|
|
101
|
+
character: [
|
|
102
|
+
{ name: "Constitution", order: 1, fields: ["physicality", "mentality", "height", "weight", "species", "traits", "abilities"] },
|
|
103
|
+
{ name: "Origins", order: 2, fields: ["background", "motivations", "birth_date", "birthplace", "languages"] },
|
|
104
|
+
{ name: "World", order: 3, fields: ["reputation", "location", "objects", "institutions"] },
|
|
105
|
+
{ name: "Personality", order: 4, fields: ["charisma", "coercion", "competence", "compassion", "creativity", "courage"] },
|
|
106
|
+
{ name: "Social", order: 5, fields: ["family", "friends", "rivals"] },
|
|
107
|
+
{ name: "TTRPG", order: 6, fields: ["level", "hit_points", "STR", "DEX", "CON", "INT", "WIS", "CHA"] }
|
|
108
|
+
],
|
|
109
|
+
collective: [
|
|
110
|
+
{ name: "Formation", order: 1, fields: ["composition", "count", "formation_date", "operator", "equipment"] },
|
|
111
|
+
{ name: "Dynamics", order: 2, fields: ["activity", "disposition", "state", "abilities", "symbolism"] },
|
|
112
|
+
{ name: "World", order: 3, fields: ["species", "characters", "creatures", "phenomena"] }
|
|
113
|
+
],
|
|
114
|
+
construct: [
|
|
115
|
+
{ name: "Nature", order: 1, fields: ["rationale", "history", "status", "reach", "start_date", "end_date", "founder", "custodian"] },
|
|
116
|
+
{ name: "Involves", order: 2, fields: ["characters", "objects", "locations", "species", "creatures", "institutions", "traits", "collectives", "zones", "abilities", "phenomena", "languages", "families", "relations", "titles", "constructs", "events", "narratives"] }
|
|
117
|
+
],
|
|
118
|
+
creature: [
|
|
119
|
+
{ name: "Biology", order: 1, fields: ["appearance", "weight", "height", "species"] },
|
|
120
|
+
{ name: "Behavior", order: 2, fields: ["habits", "demeanor", "traits", "abilities", "languages"] },
|
|
121
|
+
{ name: "World", order: 3, fields: ["status", "birth_date", "location", "zone"] },
|
|
122
|
+
{ name: "TTRPG", order: 4, fields: ["challenge_rating", "hit_points", "armor_class", "speed", "actions"] }
|
|
123
|
+
],
|
|
124
|
+
event: [
|
|
125
|
+
{ name: "Nature", order: 1, fields: ["history", "challenges", "consequences", "start_date", "end_date", "triggers"] },
|
|
126
|
+
{ name: "Involves", order: 2, fields: ["characters", "objects", "locations", "species", "creatures", "institutions", "traits", "collectives", "zones", "abilities", "phenomena", "languages", "families", "relations", "titles", "constructs"] }
|
|
127
|
+
],
|
|
128
|
+
family: [
|
|
129
|
+
{ name: "Identity", order: 1, fields: ["spirit", "history", "traditions", "traits", "abilities", "languages", "ancestors"] },
|
|
130
|
+
{ name: "World", order: 2, fields: ["reputation", "estates", "governs", "heirlooms", "creatures"] }
|
|
131
|
+
],
|
|
132
|
+
institution: [
|
|
133
|
+
{ name: "Foundation", order: 1, fields: ["doctrine", "founding_date", "parent_institution"] },
|
|
134
|
+
{ name: "Claims", order: 2, fields: ["zones", "objects", "creatures"] },
|
|
135
|
+
{ name: "World", order: 3, fields: ["status", "allies", "adversaries", "constructs"] }
|
|
136
|
+
],
|
|
137
|
+
language: [
|
|
138
|
+
{ name: "Structure", order: 1, fields: ["phonology", "grammar", "lexicon", "writing", "classification"] },
|
|
139
|
+
{ name: "World", order: 2, fields: ["status", "spread", "dialects"] }
|
|
140
|
+
],
|
|
141
|
+
law: [
|
|
142
|
+
{ name: "Code", order: 1, fields: ["declaration", "purpose", "date", "parent_law", "penalties"] },
|
|
143
|
+
{ name: "World", order: 2, fields: ["author", "locations", "zones", "prohibitions", "adjudicators", "enforcers"] }
|
|
144
|
+
],
|
|
145
|
+
location: [
|
|
146
|
+
{ name: "Setting", order: 1, fields: ["form", "function", "founding_date", "parent_location", "populations"] },
|
|
147
|
+
{ name: "Politics", order: 2, fields: ["political_climate", "primary_power", "governing_title", "secondary_powers", "zone", "rival", "partner"] },
|
|
148
|
+
{ name: "World", order: 3, fields: ["customs", "founders", "cults", "delicacies"] },
|
|
149
|
+
{ name: "Production", order: 4, fields: ["extraction_methods", "extraction_goods", "industry_methods", "industry_goods"] },
|
|
150
|
+
{ name: "Commerce", order: 5, fields: ["infrastructure", "extraction_markets", "industry_markets", "currencies"] },
|
|
151
|
+
{ name: "Construction", order: 6, fields: ["architecture", "buildings", "building_methods"] },
|
|
152
|
+
{ name: "Defense", order: 7, fields: ["defensibility", "elevation", "fighters", "defensive_objects"] }
|
|
153
|
+
],
|
|
154
|
+
map: [
|
|
155
|
+
{ name: "Details", order: 1, fields: ["background_color", "hierarchy", "width", "height", "depth", "parent_map", "location"] }
|
|
156
|
+
],
|
|
157
|
+
marker: [
|
|
158
|
+
{ name: "Details", order: 1, fields: ["map", "zone", "x", "y", "z", "order"] }
|
|
159
|
+
],
|
|
160
|
+
narrative: [
|
|
161
|
+
{ name: "Context", order: 1, fields: ["story", "consequences", "start_date", "end_date", "order", "parent_narrative", "protagonist", "antagonist", "narrator", "conservator"] },
|
|
162
|
+
{ name: "Involves", order: 2, fields: ["events", "characters", "objects", "locations", "species", "creatures", "institutions", "traits", "collectives", "zones", "abilities", "phenomena", "languages", "families", "relations", "titles", "constructs", "laws"] }
|
|
163
|
+
],
|
|
164
|
+
object: [
|
|
165
|
+
{ name: "Form", order: 1, fields: ["aesthetics", "weight", "amount", "parent_object", "materials", "technology"] },
|
|
166
|
+
{ name: "Function", order: 2, fields: ["utility", "effects", "abilities", "consumes"] },
|
|
167
|
+
{ name: "World", order: 3, fields: ["origins", "location", "language", "affinities"] }
|
|
168
|
+
],
|
|
169
|
+
phenomenon: [
|
|
170
|
+
{ name: "Mechanics", order: 1, fields: ["expression", "effects", "duration", "catalysts", "empowerments"] },
|
|
171
|
+
{ name: "World", order: 2, fields: ["mythology", "system", "triggers", "wielders", "environments"] }
|
|
172
|
+
],
|
|
173
|
+
pin: [
|
|
174
|
+
{ name: "Details", order: 1, fields: ["map", "element", "x", "y", "z"] }
|
|
175
|
+
],
|
|
176
|
+
relation: [
|
|
177
|
+
{ name: "Nature", order: 1, fields: ["background", "start_date", "end_date", "intensity", "actor", "events"] },
|
|
178
|
+
{ name: "Involves", order: 2, fields: ["characters", "objects", "locations", "species", "creatures", "institutions", "traits", "collectives", "zones", "abilities", "phenomena", "languages", "families", "titles", "constructs", "narratives"] }
|
|
179
|
+
],
|
|
180
|
+
species: [
|
|
181
|
+
{ name: "Biology", order: 1, fields: ["appearance", "life_span", "weight", "nourishment", "reproduction", "adaptations"] },
|
|
182
|
+
{ name: "Psychology", order: 2, fields: ["instincts", "sociality", "temperament", "communication", "aggression", "traits"] },
|
|
183
|
+
{ name: "World", order: 3, fields: ["role", "parent_species", "locations", "zones", "affinities"] }
|
|
184
|
+
],
|
|
185
|
+
title: [
|
|
186
|
+
{ name: "Mandate", order: 1, fields: ["authority", "eligibility", "grant_date", "revoke_date", "issuer", "body", "superior_title", "holders", "symbols"] },
|
|
187
|
+
{ name: "World", order: 2, fields: ["status", "history", "characters", "institutions", "families", "zones", "locations", "objects", "constructs", "laws", "collectives", "creatures", "phenomena", "species", "languages"] }
|
|
188
|
+
],
|
|
189
|
+
trait: [
|
|
190
|
+
{ name: "Qualitative", order: 1, fields: ["social_effects", "physical_effects", "functional_effects", "personality_effects", "behaviour_effects"] },
|
|
191
|
+
{ name: "Quantitative", order: 2, fields: ["charisma", "coercion", "competence", "compassion", "creativity", "courage"] },
|
|
192
|
+
{ name: "World", order: 3, fields: ["significance", "anti_trait", "empowered_abilities"] }
|
|
193
|
+
],
|
|
194
|
+
zone: [
|
|
195
|
+
{ name: "Scope", order: 1, fields: ["role", "shape", "start_date", "end_date", "phenomena", "linked_zones"] },
|
|
196
|
+
{ name: "World", order: 2, fields: ["context", "populations", "titles", "principles"] }
|
|
197
|
+
]
|
|
198
|
+
};
|
|
199
|
+
var ROOM_PAIRS = [
|
|
200
|
+
{ type: "narrative", supertype: "Message" },
|
|
201
|
+
{ type: "narrative", supertype: "Board" },
|
|
202
|
+
{ type: "relation", supertype: "Work item" },
|
|
203
|
+
{ type: "construct", supertype: "Spec" },
|
|
204
|
+
{ type: "relation", supertype: "Heart" },
|
|
205
|
+
{ type: "relation", supertype: "Take" },
|
|
206
|
+
{ type: "relation", supertype: "Vote" },
|
|
207
|
+
{ type: "event", supertype: "Sitting" },
|
|
208
|
+
{ type: "character", supertype: "Member" }
|
|
209
|
+
];
|
|
210
|
+
var ROOM_MARK = "x_room_of";
|
|
211
|
+
var READING_AID_PAIRS = [
|
|
212
|
+
{ type: "law", supertype: "charter" },
|
|
213
|
+
{ type: "construct", supertype: "guide" },
|
|
214
|
+
{ type: "construct", supertype: "domain" }
|
|
215
|
+
];
|
|
216
|
+
var READING_AID_MARK = "x_charter_of";
|
|
217
|
+
var CHARTER_PAIRS = [
|
|
218
|
+
{ type: "law", supertype: "Charter", aid: "charter" },
|
|
219
|
+
{ type: "construct", supertype: "Guide", aid: "guide" },
|
|
220
|
+
{ type: "construct", supertype: "Domain", aid: "domain" }
|
|
221
|
+
];
|
|
222
|
+
var REVIEW_PROPOSED_LABEL = "proposed, not yet reviewed";
|
|
223
|
+
var MESSAGE_PAIR = { type: "narrative", supertype: "Message" };
|
|
224
|
+
var MESSAGE_READ_MARK = {
|
|
225
|
+
type: "relation",
|
|
226
|
+
supertype: "Read",
|
|
227
|
+
readerField: "actor",
|
|
228
|
+
messagesField: "narratives"
|
|
229
|
+
};
|
|
230
|
+
var NOTE_PAIR = { type: "narrative", supertype: "Note" };
|
|
231
|
+
var FIELD_SCHEMA = {
|
|
232
|
+
ability: {
|
|
233
|
+
// Base fields (shared by all elements)
|
|
234
|
+
name: { type: "text", required: true },
|
|
235
|
+
description: { type: "text", required: false },
|
|
236
|
+
supertype: { type: "text", required: false },
|
|
237
|
+
subtype: { type: "text", required: false },
|
|
238
|
+
image_url: { type: "text", required: false },
|
|
239
|
+
// Mechanics
|
|
240
|
+
activation: { type: "text" },
|
|
241
|
+
duration: { type: "integer" },
|
|
242
|
+
potency: { type: "integer" },
|
|
243
|
+
range: { type: "integer" },
|
|
244
|
+
effects: { type: "multi_link", target: "phenomenon" },
|
|
245
|
+
challenges: { type: "text" },
|
|
246
|
+
talents: { type: "multi_link", target: "trait" },
|
|
247
|
+
requisites: { type: "multi_link", target: "construct" },
|
|
248
|
+
// World
|
|
249
|
+
prevalence: { type: "text" },
|
|
250
|
+
tradition: { type: "single_link", target: "construct" },
|
|
251
|
+
source: { type: "single_link", target: "phenomenon" },
|
|
252
|
+
locus: { type: "single_link", target: "location" },
|
|
253
|
+
instruments: { type: "multi_link", target: "object" },
|
|
254
|
+
systems: { type: "multi_link", target: "construct" }
|
|
255
|
+
},
|
|
256
|
+
character: {
|
|
257
|
+
// Base fields (shared by all elements)
|
|
258
|
+
name: { type: "text", required: true },
|
|
259
|
+
description: { type: "text", required: false },
|
|
260
|
+
supertype: { type: "text", required: false },
|
|
261
|
+
subtype: { type: "text", required: false },
|
|
262
|
+
image_url: { type: "text", required: false },
|
|
263
|
+
// Constitution
|
|
264
|
+
physicality: { type: "text" },
|
|
265
|
+
mentality: { type: "text" },
|
|
266
|
+
height: { type: "integer" },
|
|
267
|
+
weight: { type: "integer" },
|
|
268
|
+
species: { type: "multi_link", target: "species" },
|
|
269
|
+
traits: { type: "multi_link", target: "trait" },
|
|
270
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
271
|
+
// Origins
|
|
272
|
+
background: { type: "text" },
|
|
273
|
+
motivations: { type: "text" },
|
|
274
|
+
birth_date: { type: "integer" },
|
|
275
|
+
birthplace: { type: "single_link", target: "location" },
|
|
276
|
+
languages: { type: "multi_link", target: "language" },
|
|
277
|
+
// World
|
|
278
|
+
reputation: { type: "text" },
|
|
279
|
+
location: { type: "single_link", target: "location" },
|
|
280
|
+
objects: { type: "multi_link", target: "object" },
|
|
281
|
+
institutions: { type: "multi_link", target: "institution" },
|
|
282
|
+
// Personality
|
|
283
|
+
charisma: { type: "integer" },
|
|
284
|
+
coercion: { type: "integer" },
|
|
285
|
+
competence: { type: "integer" },
|
|
286
|
+
compassion: { type: "integer" },
|
|
287
|
+
creativity: { type: "integer" },
|
|
288
|
+
courage: { type: "integer" },
|
|
289
|
+
// Social
|
|
290
|
+
family: { type: "multi_link", target: "family" },
|
|
291
|
+
friends: { type: "multi_link", target: "character" },
|
|
292
|
+
rivals: { type: "multi_link", target: "character" },
|
|
293
|
+
// TTRPG
|
|
294
|
+
level: { type: "integer" },
|
|
295
|
+
hit_points: { type: "integer" },
|
|
296
|
+
STR: { type: "integer" },
|
|
297
|
+
DEX: { type: "integer" },
|
|
298
|
+
CON: { type: "integer" },
|
|
299
|
+
INT: { type: "integer" },
|
|
300
|
+
WIS: { type: "integer" },
|
|
301
|
+
CHA: { type: "integer" }
|
|
302
|
+
},
|
|
303
|
+
collective: {
|
|
304
|
+
// Base fields (shared by all elements)
|
|
305
|
+
name: { type: "text", required: true },
|
|
306
|
+
description: { type: "text", required: false },
|
|
307
|
+
supertype: { type: "text", required: false },
|
|
308
|
+
subtype: { type: "text", required: false },
|
|
309
|
+
image_url: { type: "text", required: false },
|
|
310
|
+
// Formation
|
|
311
|
+
composition: { type: "text" },
|
|
312
|
+
count: { type: "integer" },
|
|
313
|
+
formation_date: { type: "integer" },
|
|
314
|
+
operator: { type: "single_link", target: "institution" },
|
|
315
|
+
equipment: { type: "multi_link", target: "object" },
|
|
316
|
+
// Dynamics
|
|
317
|
+
activity: { type: "text" },
|
|
318
|
+
disposition: { type: "text" },
|
|
319
|
+
state: { type: "text" },
|
|
320
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
321
|
+
symbolism: { type: "multi_link", target: "construct" },
|
|
322
|
+
// World
|
|
323
|
+
species: { type: "multi_link", target: "species" },
|
|
324
|
+
characters: { type: "multi_link", target: "character" },
|
|
325
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
326
|
+
phenomena: { type: "multi_link", target: "phenomenon" }
|
|
327
|
+
},
|
|
328
|
+
construct: {
|
|
329
|
+
// Base fields (shared by all elements)
|
|
330
|
+
name: { type: "text", required: true },
|
|
331
|
+
description: { type: "text", required: false },
|
|
332
|
+
supertype: { type: "text", required: false },
|
|
333
|
+
subtype: { type: "text", required: false },
|
|
334
|
+
image_url: { type: "text", required: false },
|
|
335
|
+
// Nature
|
|
336
|
+
rationale: { type: "text" },
|
|
337
|
+
history: { type: "text" },
|
|
338
|
+
status: { type: "text" },
|
|
339
|
+
reach: { type: "text" },
|
|
340
|
+
start_date: { type: "integer" },
|
|
341
|
+
end_date: { type: "integer" },
|
|
342
|
+
founder: { type: "single_link", target: "character" },
|
|
343
|
+
custodian: { type: "single_link", target: "institution" },
|
|
344
|
+
// Involves
|
|
345
|
+
characters: { type: "multi_link", target: "character" },
|
|
346
|
+
objects: { type: "multi_link", target: "object" },
|
|
347
|
+
locations: { type: "multi_link", target: "location" },
|
|
348
|
+
species: { type: "multi_link", target: "species" },
|
|
349
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
350
|
+
institutions: { type: "multi_link", target: "institution" },
|
|
351
|
+
traits: { type: "multi_link", target: "trait" },
|
|
352
|
+
collectives: { type: "multi_link", target: "collective" },
|
|
353
|
+
zones: { type: "multi_link", target: "zone" },
|
|
354
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
355
|
+
phenomena: { type: "multi_link", target: "phenomenon" },
|
|
356
|
+
languages: { type: "multi_link", target: "language" },
|
|
357
|
+
families: { type: "multi_link", target: "family" },
|
|
358
|
+
relations: { type: "multi_link", target: "relation" },
|
|
359
|
+
titles: { type: "multi_link", target: "title" },
|
|
360
|
+
constructs: { type: "multi_link", target: "construct" },
|
|
361
|
+
events: { type: "multi_link", target: "event" },
|
|
362
|
+
narratives: { type: "multi_link", target: "narrative" }
|
|
363
|
+
},
|
|
364
|
+
creature: {
|
|
365
|
+
// Base fields (shared by all elements)
|
|
366
|
+
name: { type: "text", required: true },
|
|
367
|
+
description: { type: "text", required: false },
|
|
368
|
+
supertype: { type: "text", required: false },
|
|
369
|
+
subtype: { type: "text", required: false },
|
|
370
|
+
image_url: { type: "text", required: false },
|
|
371
|
+
// Biology
|
|
372
|
+
appearance: { type: "text" },
|
|
373
|
+
weight: { type: "integer" },
|
|
374
|
+
height: { type: "integer" },
|
|
375
|
+
species: { type: "multi_link", target: "species" },
|
|
376
|
+
// Behavior
|
|
377
|
+
habits: { type: "text" },
|
|
378
|
+
demeanor: { type: "text" },
|
|
379
|
+
traits: { type: "multi_link", target: "trait" },
|
|
380
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
381
|
+
languages: { type: "multi_link", target: "language" },
|
|
382
|
+
// World
|
|
383
|
+
status: { type: "text" },
|
|
384
|
+
birth_date: { type: "integer" },
|
|
385
|
+
location: { type: "single_link", target: "location" },
|
|
386
|
+
zone: { type: "single_link", target: "zone" },
|
|
387
|
+
// TTRPG
|
|
388
|
+
challenge_rating: { type: "integer" },
|
|
389
|
+
hit_points: { type: "integer" },
|
|
390
|
+
armor_class: { type: "integer" },
|
|
391
|
+
speed: { type: "integer" },
|
|
392
|
+
actions: { type: "multi_link", target: "ability" }
|
|
393
|
+
},
|
|
394
|
+
event: {
|
|
395
|
+
// Base fields (shared by all elements)
|
|
396
|
+
name: { type: "text", required: true },
|
|
397
|
+
description: { type: "text", required: false },
|
|
398
|
+
supertype: { type: "text", required: false },
|
|
399
|
+
subtype: { type: "text", required: false },
|
|
400
|
+
image_url: { type: "text", required: false },
|
|
401
|
+
// Nature
|
|
402
|
+
history: { type: "text" },
|
|
403
|
+
challenges: { type: "text" },
|
|
404
|
+
consequences: { type: "text" },
|
|
405
|
+
start_date: { type: "integer" },
|
|
406
|
+
end_date: { type: "integer" },
|
|
407
|
+
triggers: { type: "multi_link", target: "event" },
|
|
408
|
+
// Involves
|
|
409
|
+
characters: { type: "multi_link", target: "character" },
|
|
410
|
+
objects: { type: "multi_link", target: "object" },
|
|
411
|
+
locations: { type: "multi_link", target: "location" },
|
|
412
|
+
species: { type: "multi_link", target: "species" },
|
|
413
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
414
|
+
institutions: { type: "multi_link", target: "institution" },
|
|
415
|
+
traits: { type: "multi_link", target: "trait" },
|
|
416
|
+
collectives: { type: "multi_link", target: "collective" },
|
|
417
|
+
zones: { type: "multi_link", target: "zone" },
|
|
418
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
419
|
+
phenomena: { type: "multi_link", target: "phenomenon" },
|
|
420
|
+
languages: { type: "multi_link", target: "language" },
|
|
421
|
+
families: { type: "multi_link", target: "family" },
|
|
422
|
+
relations: { type: "multi_link", target: "relation" },
|
|
423
|
+
titles: { type: "multi_link", target: "title" },
|
|
424
|
+
constructs: { type: "multi_link", target: "construct" }
|
|
425
|
+
},
|
|
426
|
+
family: {
|
|
427
|
+
// Base fields (shared by all elements)
|
|
428
|
+
name: { type: "text", required: true },
|
|
429
|
+
description: { type: "text", required: false },
|
|
430
|
+
supertype: { type: "text", required: false },
|
|
431
|
+
subtype: { type: "text", required: false },
|
|
432
|
+
image_url: { type: "text", required: false },
|
|
433
|
+
// Identity
|
|
434
|
+
spirit: { type: "text" },
|
|
435
|
+
history: { type: "text" },
|
|
436
|
+
traditions: { type: "multi_link", target: "construct" },
|
|
437
|
+
traits: { type: "multi_link", target: "trait" },
|
|
438
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
439
|
+
languages: { type: "multi_link", target: "language" },
|
|
440
|
+
ancestors: { type: "multi_link", target: "character" },
|
|
441
|
+
// World
|
|
442
|
+
reputation: { type: "text" },
|
|
443
|
+
estates: { type: "multi_link", target: "location" },
|
|
444
|
+
governs: { type: "multi_link", target: "institution" },
|
|
445
|
+
heirlooms: { type: "multi_link", target: "object" },
|
|
446
|
+
creatures: { type: "multi_link", target: "creature" }
|
|
447
|
+
},
|
|
448
|
+
institution: {
|
|
449
|
+
// Base fields (shared by all elements)
|
|
450
|
+
name: { type: "text", required: true },
|
|
451
|
+
description: { type: "text", required: false },
|
|
452
|
+
supertype: { type: "text", required: false },
|
|
453
|
+
subtype: { type: "text", required: false },
|
|
454
|
+
image_url: { type: "text", required: false },
|
|
455
|
+
// Foundation
|
|
456
|
+
doctrine: { type: "text" },
|
|
457
|
+
founding_date: { type: "integer" },
|
|
458
|
+
parent_institution: { type: "single_link", target: "institution" },
|
|
459
|
+
// Claims
|
|
460
|
+
zones: { type: "multi_link", target: "zone" },
|
|
461
|
+
objects: { type: "multi_link", target: "object" },
|
|
462
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
463
|
+
// World
|
|
464
|
+
status: { type: "text" },
|
|
465
|
+
allies: { type: "multi_link", target: "institution" },
|
|
466
|
+
adversaries: { type: "multi_link", target: "institution" },
|
|
467
|
+
constructs: { type: "multi_link", target: "construct" }
|
|
468
|
+
},
|
|
469
|
+
language: {
|
|
470
|
+
// Base fields (shared by all elements)
|
|
471
|
+
name: { type: "text", required: true },
|
|
472
|
+
description: { type: "text", required: false },
|
|
473
|
+
supertype: { type: "text", required: false },
|
|
474
|
+
subtype: { type: "text", required: false },
|
|
475
|
+
image_url: { type: "text", required: false },
|
|
476
|
+
// Structure
|
|
477
|
+
phonology: { type: "text" },
|
|
478
|
+
grammar: { type: "text" },
|
|
479
|
+
lexicon: { type: "text" },
|
|
480
|
+
writing: { type: "text" },
|
|
481
|
+
classification: { type: "single_link", target: "construct" },
|
|
482
|
+
// World
|
|
483
|
+
status: { type: "text" },
|
|
484
|
+
spread: { type: "multi_link", target: "location" },
|
|
485
|
+
dialects: { type: "multi_link", target: "language" }
|
|
486
|
+
},
|
|
487
|
+
law: {
|
|
488
|
+
// Base fields (shared by all elements)
|
|
489
|
+
name: { type: "text", required: true },
|
|
490
|
+
description: { type: "text", required: false },
|
|
491
|
+
supertype: { type: "text", required: false },
|
|
492
|
+
subtype: { type: "text", required: false },
|
|
493
|
+
image_url: { type: "text", required: false },
|
|
494
|
+
// Code
|
|
495
|
+
declaration: { type: "text" },
|
|
496
|
+
purpose: { type: "text" },
|
|
497
|
+
date: { type: "integer" },
|
|
498
|
+
parent_law: { type: "single_link", target: "law" },
|
|
499
|
+
penalties: { type: "multi_link", target: "construct" },
|
|
500
|
+
// World
|
|
501
|
+
author: { type: "single_link", target: "institution" },
|
|
502
|
+
locations: { type: "multi_link", target: "location" },
|
|
503
|
+
zones: { type: "multi_link", target: "zone" },
|
|
504
|
+
prohibitions: { type: "multi_link", target: "construct" },
|
|
505
|
+
adjudicators: { type: "multi_link", target: "title" },
|
|
506
|
+
enforcers: { type: "multi_link", target: "title" }
|
|
507
|
+
},
|
|
508
|
+
location: {
|
|
509
|
+
// Base fields (shared by all elements)
|
|
510
|
+
name: { type: "text", required: true },
|
|
511
|
+
description: { type: "text", required: false },
|
|
512
|
+
supertype: { type: "text", required: false },
|
|
513
|
+
subtype: { type: "text", required: false },
|
|
514
|
+
image_url: { type: "text", required: false },
|
|
515
|
+
// Setting
|
|
516
|
+
form: { type: "text" },
|
|
517
|
+
function: { type: "text" },
|
|
518
|
+
founding_date: { type: "integer" },
|
|
519
|
+
parent_location: { type: "single_link", target: "location" },
|
|
520
|
+
populations: { type: "multi_link", target: "collective" },
|
|
521
|
+
// Politics
|
|
522
|
+
political_climate: { type: "text" },
|
|
523
|
+
primary_power: { type: "single_link", target: "institution" },
|
|
524
|
+
governing_title: { type: "single_link", target: "title" },
|
|
525
|
+
secondary_powers: { type: "multi_link", target: "institution" },
|
|
526
|
+
zone: { type: "single_link", target: "zone" },
|
|
527
|
+
rival: { type: "single_link", target: "location" },
|
|
528
|
+
partner: { type: "single_link", target: "location" },
|
|
529
|
+
// World
|
|
530
|
+
customs: { type: "text" },
|
|
531
|
+
founders: { type: "multi_link", target: "character" },
|
|
532
|
+
cults: { type: "multi_link", target: "construct" },
|
|
533
|
+
delicacies: { type: "multi_link", target: "species" },
|
|
534
|
+
// Production
|
|
535
|
+
extraction_methods: { type: "multi_link", target: "construct" },
|
|
536
|
+
extraction_goods: { type: "multi_link", target: "construct" },
|
|
537
|
+
industry_methods: { type: "multi_link", target: "construct" },
|
|
538
|
+
industry_goods: { type: "multi_link", target: "construct" },
|
|
539
|
+
// Commerce
|
|
540
|
+
infrastructure: { type: "text" },
|
|
541
|
+
extraction_markets: { type: "multi_link", target: "location" },
|
|
542
|
+
industry_markets: { type: "multi_link", target: "location" },
|
|
543
|
+
currencies: { type: "multi_link", target: "construct" },
|
|
544
|
+
// Construction
|
|
545
|
+
architecture: { type: "text" },
|
|
546
|
+
buildings: { type: "multi_link", target: "object" },
|
|
547
|
+
building_methods: { type: "multi_link", target: "construct" },
|
|
548
|
+
// Defense
|
|
549
|
+
defensibility: { type: "text" },
|
|
550
|
+
elevation: { type: "integer" },
|
|
551
|
+
fighters: { type: "multi_link", target: "construct" },
|
|
552
|
+
defensive_objects: { type: "multi_link", target: "object" }
|
|
553
|
+
},
|
|
554
|
+
map: {
|
|
555
|
+
// Base fields (shared by all elements)
|
|
556
|
+
name: { type: "text", required: true },
|
|
557
|
+
description: { type: "text", required: false },
|
|
558
|
+
supertype: { type: "text", required: false },
|
|
559
|
+
subtype: { type: "text", required: false },
|
|
560
|
+
image_url: { type: "text", required: false },
|
|
561
|
+
// Details
|
|
562
|
+
background_color: { type: "text" },
|
|
563
|
+
hierarchy: { type: "integer" },
|
|
564
|
+
width: { type: "integer" },
|
|
565
|
+
height: { type: "integer" },
|
|
566
|
+
depth: { type: "integer" },
|
|
567
|
+
parent_map: { type: "single_link", target: "map" },
|
|
568
|
+
location: { type: "single_link", target: "location" }
|
|
569
|
+
},
|
|
570
|
+
marker: {
|
|
571
|
+
// Base fields (shared by all elements)
|
|
572
|
+
name: { type: "text", required: true },
|
|
573
|
+
description: { type: "text", required: false },
|
|
574
|
+
supertype: { type: "text", required: false },
|
|
575
|
+
subtype: { type: "text", required: false },
|
|
576
|
+
image_url: { type: "text", required: false },
|
|
577
|
+
// Details
|
|
578
|
+
map: { type: "single_link", target: "map" },
|
|
579
|
+
zone: { type: "single_link", target: "zone" },
|
|
580
|
+
x: { type: "integer" },
|
|
581
|
+
y: { type: "integer" },
|
|
582
|
+
z: { type: "integer" },
|
|
583
|
+
order: { type: "integer" }
|
|
584
|
+
},
|
|
585
|
+
narrative: {
|
|
586
|
+
// Base fields (shared by all elements)
|
|
587
|
+
name: { type: "text", required: true },
|
|
588
|
+
description: { type: "text", required: false },
|
|
589
|
+
supertype: { type: "text", required: false },
|
|
590
|
+
subtype: { type: "text", required: false },
|
|
591
|
+
image_url: { type: "text", required: false },
|
|
592
|
+
// Context
|
|
593
|
+
story: { type: "text" },
|
|
594
|
+
consequences: { type: "text" },
|
|
595
|
+
start_date: { type: "integer" },
|
|
596
|
+
end_date: { type: "integer" },
|
|
597
|
+
order: { type: "integer" },
|
|
598
|
+
parent_narrative: { type: "single_link", target: "narrative" },
|
|
599
|
+
protagonist: { type: "single_link", target: "character" },
|
|
600
|
+
antagonist: { type: "single_link", target: "character" },
|
|
601
|
+
narrator: { type: "single_link", target: "character" },
|
|
602
|
+
conservator: { type: "single_link", target: "institution" },
|
|
603
|
+
// Involves
|
|
604
|
+
events: { type: "multi_link", target: "event" },
|
|
605
|
+
characters: { type: "multi_link", target: "character" },
|
|
606
|
+
objects: { type: "multi_link", target: "object" },
|
|
607
|
+
locations: { type: "multi_link", target: "location" },
|
|
608
|
+
species: { type: "multi_link", target: "species" },
|
|
609
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
610
|
+
institutions: { type: "multi_link", target: "institution" },
|
|
611
|
+
traits: { type: "multi_link", target: "trait" },
|
|
612
|
+
collectives: { type: "multi_link", target: "collective" },
|
|
613
|
+
zones: { type: "multi_link", target: "zone" },
|
|
614
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
615
|
+
phenomena: { type: "multi_link", target: "phenomenon" },
|
|
616
|
+
languages: { type: "multi_link", target: "language" },
|
|
617
|
+
families: { type: "multi_link", target: "family" },
|
|
618
|
+
relations: { type: "multi_link", target: "relation" },
|
|
619
|
+
titles: { type: "multi_link", target: "title" },
|
|
620
|
+
constructs: { type: "multi_link", target: "construct" },
|
|
621
|
+
laws: { type: "multi_link", target: "law" }
|
|
622
|
+
},
|
|
623
|
+
object: {
|
|
624
|
+
// Base fields (shared by all elements)
|
|
625
|
+
name: { type: "text", required: true },
|
|
626
|
+
description: { type: "text", required: false },
|
|
627
|
+
supertype: { type: "text", required: false },
|
|
628
|
+
subtype: { type: "text", required: false },
|
|
629
|
+
image_url: { type: "text", required: false },
|
|
630
|
+
// Form
|
|
631
|
+
aesthetics: { type: "text" },
|
|
632
|
+
weight: { type: "integer" },
|
|
633
|
+
amount: { type: "integer" },
|
|
634
|
+
parent_object: { type: "single_link", target: "object" },
|
|
635
|
+
materials: { type: "multi_link", target: "construct" },
|
|
636
|
+
technology: { type: "multi_link", target: "construct" },
|
|
637
|
+
// Function
|
|
638
|
+
utility: { type: "text" },
|
|
639
|
+
effects: { type: "multi_link", target: "phenomenon" },
|
|
640
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
641
|
+
consumes: { type: "multi_link", target: "construct" },
|
|
642
|
+
// World
|
|
643
|
+
origins: { type: "text" },
|
|
644
|
+
location: { type: "single_link", target: "location" },
|
|
645
|
+
language: { type: "single_link", target: "language" },
|
|
646
|
+
affinities: { type: "multi_link", target: "trait" }
|
|
647
|
+
},
|
|
648
|
+
phenomenon: {
|
|
649
|
+
// Base fields (shared by all elements)
|
|
650
|
+
name: { type: "text", required: true },
|
|
651
|
+
description: { type: "text", required: false },
|
|
652
|
+
supertype: { type: "text", required: false },
|
|
653
|
+
subtype: { type: "text", required: false },
|
|
654
|
+
image_url: { type: "text", required: false },
|
|
655
|
+
// Mechanics
|
|
656
|
+
expression: { type: "text" },
|
|
657
|
+
effects: { type: "text" },
|
|
658
|
+
duration: { type: "integer" },
|
|
659
|
+
catalysts: { type: "multi_link", target: "object" },
|
|
660
|
+
empowerments: { type: "multi_link", target: "ability" },
|
|
661
|
+
// World
|
|
662
|
+
mythology: { type: "text" },
|
|
663
|
+
system: { type: "single_link", target: "phenomenon" },
|
|
664
|
+
triggers: { type: "multi_link", target: "construct" },
|
|
665
|
+
wielders: { type: "multi_link", target: "character" },
|
|
666
|
+
environments: { type: "multi_link", target: "location" }
|
|
667
|
+
},
|
|
668
|
+
pin: {
|
|
669
|
+
// Base fields (shared by all elements)
|
|
670
|
+
name: { type: "text", required: true },
|
|
671
|
+
description: { type: "text", required: false },
|
|
672
|
+
supertype: { type: "text", required: false },
|
|
673
|
+
subtype: { type: "text", required: false },
|
|
674
|
+
image_url: { type: "text", required: false },
|
|
675
|
+
// Details
|
|
676
|
+
map: { type: "single_link", target: "map" },
|
|
677
|
+
element_type: { type: "text" },
|
|
678
|
+
element_id: { type: "single_link", target: "any" },
|
|
679
|
+
x: { type: "integer" },
|
|
680
|
+
y: { type: "integer" },
|
|
681
|
+
z: { type: "integer" }
|
|
682
|
+
},
|
|
683
|
+
relation: {
|
|
684
|
+
// Base fields (shared by all elements)
|
|
685
|
+
name: { type: "text", required: true },
|
|
686
|
+
description: { type: "text", required: false },
|
|
687
|
+
supertype: { type: "text", required: false },
|
|
688
|
+
subtype: { type: "text", required: false },
|
|
689
|
+
image_url: { type: "text", required: false },
|
|
690
|
+
// Nature
|
|
691
|
+
background: { type: "text" },
|
|
692
|
+
start_date: { type: "integer" },
|
|
693
|
+
end_date: { type: "integer" },
|
|
694
|
+
intensity: { type: "integer" },
|
|
695
|
+
actor: { type: "single_link", target: "character" },
|
|
696
|
+
events: { type: "multi_link", target: "event" },
|
|
697
|
+
// Involves
|
|
698
|
+
characters: { type: "multi_link", target: "character" },
|
|
699
|
+
objects: { type: "multi_link", target: "object" },
|
|
700
|
+
locations: { type: "multi_link", target: "location" },
|
|
701
|
+
species: { type: "multi_link", target: "species" },
|
|
702
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
703
|
+
institutions: { type: "multi_link", target: "institution" },
|
|
704
|
+
traits: { type: "multi_link", target: "trait" },
|
|
705
|
+
collectives: { type: "multi_link", target: "collective" },
|
|
706
|
+
zones: { type: "multi_link", target: "zone" },
|
|
707
|
+
abilities: { type: "multi_link", target: "ability" },
|
|
708
|
+
phenomena: { type: "multi_link", target: "phenomenon" },
|
|
709
|
+
languages: { type: "multi_link", target: "language" },
|
|
710
|
+
families: { type: "multi_link", target: "family" },
|
|
711
|
+
titles: { type: "multi_link", target: "title" },
|
|
712
|
+
constructs: { type: "multi_link", target: "construct" },
|
|
713
|
+
narratives: { type: "multi_link", target: "narrative" }
|
|
714
|
+
},
|
|
715
|
+
species: {
|
|
716
|
+
// Base fields (shared by all elements)
|
|
717
|
+
name: { type: "text", required: true },
|
|
718
|
+
description: { type: "text", required: false },
|
|
719
|
+
supertype: { type: "text", required: false },
|
|
720
|
+
subtype: { type: "text", required: false },
|
|
721
|
+
image_url: { type: "text", required: false },
|
|
722
|
+
// Biology
|
|
723
|
+
appearance: { type: "text" },
|
|
724
|
+
life_span: { type: "integer" },
|
|
725
|
+
weight: { type: "integer" },
|
|
726
|
+
nourishment: { type: "multi_link", target: "species" },
|
|
727
|
+
reproduction: { type: "multi_link", target: "construct" },
|
|
728
|
+
adaptations: { type: "multi_link", target: "ability" },
|
|
729
|
+
// Psychology
|
|
730
|
+
instincts: { type: "text" },
|
|
731
|
+
sociality: { type: "text" },
|
|
732
|
+
temperament: { type: "text" },
|
|
733
|
+
communication: { type: "text" },
|
|
734
|
+
aggression: { type: "integer" },
|
|
735
|
+
traits: { type: "multi_link", target: "trait" },
|
|
736
|
+
// World
|
|
737
|
+
role: { type: "text" },
|
|
738
|
+
parent_species: { type: "single_link", target: "species" },
|
|
739
|
+
locations: { type: "multi_link", target: "location" },
|
|
740
|
+
zones: { type: "multi_link", target: "zone" },
|
|
741
|
+
affinities: { type: "multi_link", target: "phenomenon" }
|
|
742
|
+
},
|
|
743
|
+
title: {
|
|
744
|
+
// Base fields (shared by all elements)
|
|
745
|
+
name: { type: "text", required: true },
|
|
746
|
+
description: { type: "text", required: false },
|
|
747
|
+
supertype: { type: "text", required: false },
|
|
748
|
+
subtype: { type: "text", required: false },
|
|
749
|
+
image_url: { type: "text", required: false },
|
|
750
|
+
// Mandate
|
|
751
|
+
authority: { type: "text" },
|
|
752
|
+
eligibility: { type: "text" },
|
|
753
|
+
grant_date: { type: "integer" },
|
|
754
|
+
revoke_date: { type: "integer" },
|
|
755
|
+
issuer: { type: "single_link", target: "institution" },
|
|
756
|
+
body: { type: "single_link", target: "institution" },
|
|
757
|
+
superior_title: { type: "single_link", target: "title" },
|
|
758
|
+
holders: { type: "multi_link", target: "character" },
|
|
759
|
+
symbols: { type: "multi_link", target: "object" },
|
|
760
|
+
// World
|
|
761
|
+
status: { type: "text" },
|
|
762
|
+
history: { type: "text" },
|
|
763
|
+
characters: { type: "multi_link", target: "character" },
|
|
764
|
+
institutions: { type: "multi_link", target: "institution" },
|
|
765
|
+
families: { type: "multi_link", target: "family" },
|
|
766
|
+
zones: { type: "multi_link", target: "zone" },
|
|
767
|
+
locations: { type: "multi_link", target: "location" },
|
|
768
|
+
objects: { type: "multi_link", target: "object" },
|
|
769
|
+
constructs: { type: "multi_link", target: "construct" },
|
|
770
|
+
laws: { type: "multi_link", target: "law" },
|
|
771
|
+
collectives: { type: "multi_link", target: "collective" },
|
|
772
|
+
creatures: { type: "multi_link", target: "creature" },
|
|
773
|
+
phenomena: { type: "multi_link", target: "phenomenon" },
|
|
774
|
+
species: { type: "multi_link", target: "species" },
|
|
775
|
+
languages: { type: "multi_link", target: "language" }
|
|
776
|
+
},
|
|
777
|
+
trait: {
|
|
778
|
+
// Base fields (shared by all elements)
|
|
779
|
+
name: { type: "text", required: true },
|
|
780
|
+
description: { type: "text", required: false },
|
|
781
|
+
supertype: { type: "text", required: false },
|
|
782
|
+
subtype: { type: "text", required: false },
|
|
783
|
+
image_url: { type: "text", required: false },
|
|
784
|
+
// Qualitative
|
|
785
|
+
social_effects: { type: "text" },
|
|
786
|
+
physical_effects: { type: "text" },
|
|
787
|
+
functional_effects: { type: "text" },
|
|
788
|
+
personality_effects: { type: "text" },
|
|
789
|
+
behaviour_effects: { type: "text" },
|
|
790
|
+
// Quantitative
|
|
791
|
+
charisma: { type: "integer" },
|
|
792
|
+
coercion: { type: "integer" },
|
|
793
|
+
competence: { type: "integer" },
|
|
794
|
+
compassion: { type: "integer" },
|
|
795
|
+
creativity: { type: "integer" },
|
|
796
|
+
courage: { type: "integer" },
|
|
797
|
+
// World
|
|
798
|
+
significance: { type: "text" },
|
|
799
|
+
anti_trait: { type: "single_link", target: "trait" },
|
|
800
|
+
empowered_abilities: { type: "multi_link", target: "ability" }
|
|
801
|
+
},
|
|
802
|
+
zone: {
|
|
803
|
+
// Base fields (shared by all elements)
|
|
804
|
+
name: { type: "text", required: true },
|
|
805
|
+
description: { type: "text", required: false },
|
|
806
|
+
supertype: { type: "text", required: false },
|
|
807
|
+
subtype: { type: "text", required: false },
|
|
808
|
+
image_url: { type: "text", required: false },
|
|
809
|
+
// Scope
|
|
810
|
+
role: { type: "text" },
|
|
811
|
+
shape: { type: "text" },
|
|
812
|
+
start_date: { type: "integer" },
|
|
813
|
+
end_date: { type: "integer" },
|
|
814
|
+
phenomena: { type: "multi_link", target: "phenomenon" },
|
|
815
|
+
linked_zones: { type: "multi_link", target: "zone" },
|
|
816
|
+
// World
|
|
817
|
+
context: { type: "text" },
|
|
818
|
+
populations: { type: "multi_link", target: "collective" },
|
|
819
|
+
titles: { type: "multi_link", target: "title" },
|
|
820
|
+
principles: { type: "multi_link", target: "construct" }
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// src/v2/types.ts
|
|
825
|
+
var SPATIAL_TYPES = ["map", "pin", "marker", "zone"];
|
|
826
|
+
var AGENT_DOORS = ["seat", "mcp", "declared"];
|
|
827
|
+
function isAgentDoor(door) {
|
|
828
|
+
return door != null && AGENT_DOORS.includes(door);
|
|
829
|
+
}
|
|
830
|
+
function isKnownOf(element) {
|
|
831
|
+
return element != null && element.known_of === true;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// src/case-fold.ts
|
|
835
|
+
var FOLD_RUNS = "1t.q..w,51...lj,5c.n..w,60.7..w,74.o.2.1,8i.3.2.1,8p.8.2.1,96.n.2.1,ag...-3d,ah.3.2.1,an...-7g,ap...5u,aq.2.2.1,au...5q,av...1,ax.2..5p,az...1,b2...27,b3...5m,b4...5n,b5...1,b7...5p,b8...5r,ba...5v,bb...5t,bc...1,bg...5v,bh...5x,bj...5y,bk.3.2.1,bq...62,br...1,bt...62,bw...1,by...62,bz...1,c1.2..61,c3.2.2.1,c7...63,c8...1,cc...1,ck...2,cl...1,cn...2,co...1,cq...2,cr.9.2.1,da.9.2.1,dt...2,du.2.2.1,dy...-2p,dz...-1k,e0.k.2.1,f4...-3m,f6.9.2.1,fu...8bv,fv...1,fx...-4j,fy...8bs,g1...1,g3...-5f,g4...1x,g5...1z,g6.5.2.1,n9...38,og.2.2.1,om...1,ov...38,p2...12,p4.3..11,p8...1s,pa.2..1r,pd.h..w,pv.9..w,qq...1,r3...8,r4...-u,r5...-p,r9...-f,ra...-m,rc.c.2.1,s0...-1i,s1...-1c,s4...-1o,s5...-1s,s7...1,s9...-7,sa...1,sd.3..-3m,sg.g..28,sw.w..w,v4.h.2.1,wa.r.2.1,xs...f,xt.7.2.1,y8.1c.2.1,10x.12..1c,3a8.12..5ls,3bb...5ls,3bh...5ls,3y0.6..-8,5mo...-4su,5mp...-4st,5mq...-4sk,5mr.2..-4si,5mt...-4sj,5mu...-4sc,5mv...-4ro,5mw...r7n,5n4.17..-2bk,5od.3..-2bk,5xc.23.2.1,61n...-1m,61q...-5vj,61s.1c.2.1,64o.8..-8,654.6..-8,65k.8..-8,660.8..-8,66g.6..-8,66x.4.2.-8,67c.8..-8,688.8..-8,68o.8..-8,694.8..-8,69k.2..-8,69m.2..-22,69o...-9,69q...-5j9,6a0.4..-2e,6a4...-9,6ab...-5kz,6ag.2..-8,6ai.2..-2s,6ar...-5kj,6aw.2..-8,6ay.2..-34,6b0...-7,6bc.2..-3k,6be.2..-3i,6bg...-9,6jq...-5st,6ju...-6gv,6jv...-6di,6k2...s,6lc.g..g,6mb...1,792.q..q,8ow.1c..1c,8rk...1,8rm...-8af,8rn...-2xy,8ro...-89z,8rr.3.2.1,8rx...-8bg,8ry...-8al,8rz...-8bj,8s0...-8bi,8s2...1,8s5...1,8se.2..-8cf,8sg.1e.2.1,8vf.2.2.1,8vm...1,wu8.n.2.1,ww0.e.2.1,x0i.7.2.1,x0y.v.2.1,x2x.2.2.1,x31...-r9g,x32.5.2.1,x3f...1,x3h...-wmg,x3k.2.2.1,x3q.a.2.1,x4a...-wn8,x4b...-wnj,x4c...-wnf,x4d...-wn5,x4e...-wn8,x4g...-wlu,x4h...-wmi,x4i...-wlx,x4j...ps,x4k.8.2.1,x50...-1c,x51...-wn7,x52...-raw,x53.2.2.1,x5c...1,x5i.2.2.1,x6d...1,xv4.28..-tzk,1dl1...1,1ee9.q..w,1fcw.14..14,1fhs.10..14,1fn4.b..13,1fng.f..13,1fnw.7..13,1fo4.2..13,1h1c.1f..1s,1jfk.w..w,20cg.w..w,2olc.y..y";
|
|
836
|
+
var foldTable = null;
|
|
837
|
+
function simpleCaseFold(text) {
|
|
838
|
+
if (!foldTable) {
|
|
839
|
+
foldTable = /* @__PURE__ */ new Map();
|
|
840
|
+
for (const run of FOLD_RUNS.split(",")) {
|
|
841
|
+
const [start, count, stride, delta] = run.split(".");
|
|
842
|
+
const s = parseInt(start, 36);
|
|
843
|
+
const n = count ? parseInt(count, 36) : 1;
|
|
844
|
+
const step = stride ? parseInt(stride, 36) : 1;
|
|
845
|
+
const d = parseInt(delta, 36);
|
|
846
|
+
for (let k = 0; k < n; k++) foldTable.set(s + k * step, s + k * step + d);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
let out = "";
|
|
850
|
+
for (const c of text) {
|
|
851
|
+
const to = foldTable.get(c.codePointAt(0));
|
|
852
|
+
out += to === void 0 ? c : String.fromCodePoint(to);
|
|
853
|
+
}
|
|
854
|
+
return out;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// src/room.ts
|
|
858
|
+
var WHITE_SPACE = /* @__PURE__ */ new Set([
|
|
859
|
+
9,
|
|
860
|
+
10,
|
|
861
|
+
11,
|
|
862
|
+
12,
|
|
863
|
+
13,
|
|
864
|
+
32,
|
|
865
|
+
133,
|
|
866
|
+
160,
|
|
867
|
+
5760,
|
|
868
|
+
8192,
|
|
869
|
+
8193,
|
|
870
|
+
8194,
|
|
871
|
+
8195,
|
|
872
|
+
8196,
|
|
873
|
+
8197,
|
|
874
|
+
8198,
|
|
875
|
+
8199,
|
|
876
|
+
8200,
|
|
877
|
+
8201,
|
|
878
|
+
8202,
|
|
879
|
+
8232,
|
|
880
|
+
8233,
|
|
881
|
+
8239,
|
|
882
|
+
8287,
|
|
883
|
+
12288
|
|
884
|
+
]);
|
|
885
|
+
function trimWhiteSpace(text) {
|
|
886
|
+
let start = 0;
|
|
887
|
+
let end = text.length;
|
|
888
|
+
while (start < end && WHITE_SPACE.has(text.charCodeAt(start))) start++;
|
|
889
|
+
while (end > start && WHITE_SPACE.has(text.charCodeAt(end - 1))) end--;
|
|
890
|
+
return text.slice(start, end);
|
|
891
|
+
}
|
|
892
|
+
var fold = (text) => simpleCaseFold(trimWhiteSpace(text));
|
|
893
|
+
function hasMark(el, field) {
|
|
894
|
+
const mark = Object.prototype.hasOwnProperty.call(el, field) ? el[field] : void 0;
|
|
895
|
+
if (mark === void 0 || mark === null) return false;
|
|
896
|
+
return typeof mark !== "string" || trimWhiteSpace(mark) !== "";
|
|
897
|
+
}
|
|
898
|
+
function isRoomElement(el) {
|
|
899
|
+
if (el == null || typeof el !== "object" || typeof el.type !== "string" || typeof el.supertype !== "string") return false;
|
|
900
|
+
if (!hasMark(el, ROOM_MARK)) return false;
|
|
901
|
+
const type = fold(el.type);
|
|
902
|
+
const supertype = fold(el.supertype);
|
|
903
|
+
return ROOM_PAIRS.some((p) => fold(p.type) === type && fold(p.supertype) === supertype);
|
|
904
|
+
}
|
|
905
|
+
var READING_AID_KEYS = new Set(READING_AID_PAIRS.map((p) => `${fold(p.type)}/${fold(p.supertype)}`));
|
|
906
|
+
function readingAidKey(element) {
|
|
907
|
+
if (element === null || typeof element !== "object" || Array.isArray(element)) return null;
|
|
908
|
+
const el = element;
|
|
909
|
+
if (typeof el.type !== "string" || typeof el.supertype !== "string") return null;
|
|
910
|
+
const key = `${fold(el.type)}/${fold(el.supertype)}`;
|
|
911
|
+
if (!READING_AID_KEYS.has(key)) return null;
|
|
912
|
+
return hasMark(el, READING_AID_MARK) ? key : null;
|
|
913
|
+
}
|
|
914
|
+
function isCharterElement(element) {
|
|
915
|
+
return readingAidKey(element) !== null;
|
|
916
|
+
}
|
|
917
|
+
var AID_BY_KEY = new Map(
|
|
918
|
+
CHARTER_PAIRS.map((p) => [`${fold(p.type)}/${fold(p.supertype)}`, p.aid])
|
|
919
|
+
);
|
|
920
|
+
function readingAidOf(element) {
|
|
921
|
+
if (element === null || typeof element !== "object" || Array.isArray(element)) return null;
|
|
922
|
+
const el = element;
|
|
923
|
+
if (typeof el.type !== "string" || typeof el.supertype !== "string") return null;
|
|
924
|
+
return AID_BY_KEY.get(`${fold(el.type)}/${fold(el.supertype)}`) ?? null;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/names.ts
|
|
928
|
+
var SLUGS = new Set(ELEMENT_TYPES);
|
|
929
|
+
var OPTION_KEYS = ["supertype", "many"];
|
|
930
|
+
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
931
|
+
function word(pair, many) {
|
|
932
|
+
if (!isObject(pair) || typeof pair.one !== "string") return null;
|
|
933
|
+
const one = trimWhiteSpace(pair.one);
|
|
934
|
+
if (one === "") return null;
|
|
935
|
+
if (!many) return one;
|
|
936
|
+
const plural = typeof pair.many === "string" ? trimWhiteSpace(pair.many) : "";
|
|
937
|
+
return plural === "" ? one : plural;
|
|
938
|
+
}
|
|
939
|
+
function typeWord(world, type, opts = {}) {
|
|
940
|
+
refuseUnknownOptions("typeWord", opts, OPTION_KEYS);
|
|
941
|
+
const map = world?.x_names;
|
|
942
|
+
if (!isObject(map) || map.version !== 1) return null;
|
|
943
|
+
const { types, supertypes } = map;
|
|
944
|
+
if (types !== void 0 && !isObject(types)) return null;
|
|
945
|
+
if (supertypes !== void 0) {
|
|
946
|
+
if (!isObject(supertypes)) return null;
|
|
947
|
+
for (const inner of Object.values(supertypes)) if (!isObject(inner)) return null;
|
|
948
|
+
}
|
|
949
|
+
if (!SLUGS.has(type)) return null;
|
|
950
|
+
const many = opts.many === true;
|
|
951
|
+
const supertype = typeof opts.supertype === "string" ? fold(opts.supertype) : "";
|
|
952
|
+
if (supertype !== "" && isObject(supertypes) && isObject(supertypes[type])) {
|
|
953
|
+
for (const [key, pair] of Object.entries(supertypes[type])) {
|
|
954
|
+
if (fold(key) !== supertype) continue;
|
|
955
|
+
const w = word(pair, many);
|
|
956
|
+
if (w !== null) return w;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return isObject(types) ? word(types[type], many) : null;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// src/address.ts
|
|
963
|
+
var MESSAGES = {
|
|
964
|
+
not_an_address: "not an address: it starts with neither https://www.onlyworlds.com/w/ nor ow://",
|
|
965
|
+
uppercase: "an address is written in lowercase: the prefix or the type word is in another case",
|
|
966
|
+
segments: "the wrong number of path segments, or an empty one: a type needs an id and an id a type",
|
|
967
|
+
bad_world: "the world is not an id (or, in the site's address only, a slug)",
|
|
968
|
+
unknown_type: "the type word is not one of the 22",
|
|
969
|
+
bad_id: "the element id is not a UUID in the hyphenated 8-4-4-4-12 form",
|
|
970
|
+
bad_moment: "the moment is not a whole step in decimal within the 32-bit range",
|
|
971
|
+
bad_lens: "the lens is not one lowercase lens key holding an id",
|
|
972
|
+
no_world: "this address needs a world",
|
|
973
|
+
bad_form: "the form is neither human nor text"
|
|
974
|
+
};
|
|
975
|
+
var OwAddressError = class extends Error {
|
|
976
|
+
constructor(reason, message = MESSAGES[reason]) {
|
|
977
|
+
super(message);
|
|
978
|
+
this.name = "OwAddressError";
|
|
979
|
+
this.reason = reason;
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
var refuse = (reason) => {
|
|
983
|
+
throw new OwAddressError(reason);
|
|
984
|
+
};
|
|
985
|
+
var HUMAN_PREFIX = "https://www.onlyworlds.com/w/";
|
|
986
|
+
var TEXT_PREFIX = "ow://";
|
|
987
|
+
var TYPES = new Set(ELEMENT_TYPES);
|
|
988
|
+
var UUID = /^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/;
|
|
989
|
+
var SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
990
|
+
var STEP = /^(?:0|-?[1-9][0-9]*)$/;
|
|
991
|
+
var STEP_MIN = -2147483648;
|
|
992
|
+
var STEP_MAX = 2147483647;
|
|
993
|
+
var ADDRESS_KEYS = ["form", "world", "type", "id", "lens", "moment", "worldIsSlug", "canonical"];
|
|
994
|
+
var asciiLower = (s) => s.replace(/[A-Z]/g, (c) => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
995
|
+
var isUuid = (s) => UUID.test(s);
|
|
996
|
+
var isSlug = (s) => s.length >= 3 && s.length <= 40 && SLUG.test(s);
|
|
997
|
+
function checkType(word2) {
|
|
998
|
+
if (TYPES.has(word2)) return word2;
|
|
999
|
+
return refuse(TYPES.has(asciiLower(word2)) ? "uppercase" : "unknown_type");
|
|
1000
|
+
}
|
|
1001
|
+
function write(form, world, type, id, moment, lens) {
|
|
1002
|
+
const parts = [];
|
|
1003
|
+
if (world !== null) parts.push(world);
|
|
1004
|
+
if (type !== null && id !== null) parts.push(type, id);
|
|
1005
|
+
let out = (form === "human" ? HUMAN_PREFIX : TEXT_PREFIX) + parts.join("/");
|
|
1006
|
+
if (moment !== null) out += `@${moment}`;
|
|
1007
|
+
if (lens !== null) out += `?lens=${lens}`;
|
|
1008
|
+
return out;
|
|
1009
|
+
}
|
|
1010
|
+
var given = (v) => v !== void 0 && v !== null;
|
|
1011
|
+
function elementAddress(address) {
|
|
1012
|
+
if (address === null || typeof address !== "object" || Array.isArray(address)) {
|
|
1013
|
+
throw new TypeError("elementAddress: the address is an object ({ form, world, type, id, lens, moment })");
|
|
1014
|
+
}
|
|
1015
|
+
refuseUnknownOptions("elementAddress", address, ADDRESS_KEYS);
|
|
1016
|
+
const a = address;
|
|
1017
|
+
const form = a.form;
|
|
1018
|
+
if (form !== "human" && form !== "text") return refuse("bad_form");
|
|
1019
|
+
const hasType = given(a.type);
|
|
1020
|
+
const hasId = given(a.id);
|
|
1021
|
+
if (hasType !== hasId) return refuse("segments");
|
|
1022
|
+
const hasWorld = given(a.world);
|
|
1023
|
+
if (!hasWorld && (form === "human" || !hasType)) return refuse("no_world");
|
|
1024
|
+
let world = null;
|
|
1025
|
+
if (hasWorld) {
|
|
1026
|
+
if (typeof a.world !== "string" || !isUuid(a.world)) return refuse("bad_world");
|
|
1027
|
+
world = a.world.toLowerCase();
|
|
1028
|
+
}
|
|
1029
|
+
let type = null;
|
|
1030
|
+
let id = null;
|
|
1031
|
+
if (hasType) {
|
|
1032
|
+
type = typeof a.type === "string" ? checkType(a.type) : refuse("unknown_type");
|
|
1033
|
+
if (typeof a.id !== "string" || !isUuid(a.id)) return refuse("bad_id");
|
|
1034
|
+
id = a.id.toLowerCase();
|
|
1035
|
+
}
|
|
1036
|
+
let moment = null;
|
|
1037
|
+
if (given(a.moment)) {
|
|
1038
|
+
const m = a.moment;
|
|
1039
|
+
if (typeof m !== "number" || !Number.isInteger(m) || m < STEP_MIN || m > STEP_MAX) return refuse("bad_moment");
|
|
1040
|
+
moment = m === 0 ? 0 : m;
|
|
1041
|
+
}
|
|
1042
|
+
let lens = null;
|
|
1043
|
+
if (given(a.lens)) {
|
|
1044
|
+
if (typeof a.lens !== "string" || !isUuid(a.lens)) return refuse("bad_lens");
|
|
1045
|
+
lens = a.lens.toLowerCase();
|
|
1046
|
+
}
|
|
1047
|
+
return write(form, world, type, id, moment, lens);
|
|
1048
|
+
}
|
|
1049
|
+
function readLens(query) {
|
|
1050
|
+
let lens = null;
|
|
1051
|
+
let seen = false;
|
|
1052
|
+
for (const part of query.split("&")) {
|
|
1053
|
+
const eq = part.indexOf("=");
|
|
1054
|
+
const key = eq === -1 ? part : part.slice(0, eq);
|
|
1055
|
+
if (asciiLower(key) !== "lens") continue;
|
|
1056
|
+
if (key !== "lens" || seen) return refuse("bad_lens");
|
|
1057
|
+
seen = true;
|
|
1058
|
+
const value = eq === -1 ? "" : part.slice(eq + 1);
|
|
1059
|
+
if (!isUuid(value)) return refuse("bad_lens");
|
|
1060
|
+
lens = value.toLowerCase();
|
|
1061
|
+
}
|
|
1062
|
+
return lens;
|
|
1063
|
+
}
|
|
1064
|
+
function parseOwLink(text) {
|
|
1065
|
+
if (typeof text !== "string") return refuse("not_an_address");
|
|
1066
|
+
const s = trimWhiteSpace(text);
|
|
1067
|
+
let form;
|
|
1068
|
+
let rest;
|
|
1069
|
+
if (s.startsWith(HUMAN_PREFIX)) {
|
|
1070
|
+
form = "human";
|
|
1071
|
+
rest = s.slice(HUMAN_PREFIX.length);
|
|
1072
|
+
} else if (s.startsWith(TEXT_PREFIX)) {
|
|
1073
|
+
form = "text";
|
|
1074
|
+
rest = s.slice(TEXT_PREFIX.length);
|
|
1075
|
+
} else {
|
|
1076
|
+
const lowered = asciiLower(s);
|
|
1077
|
+
return refuse(lowered.startsWith(HUMAN_PREFIX) || lowered.startsWith(TEXT_PREFIX) ? "uppercase" : "not_an_address");
|
|
1078
|
+
}
|
|
1079
|
+
const hash = rest.indexOf("#");
|
|
1080
|
+
if (hash !== -1) rest = rest.slice(0, hash);
|
|
1081
|
+
const q = rest.indexOf("?");
|
|
1082
|
+
const query = q === -1 ? null : rest.slice(q + 1);
|
|
1083
|
+
const segments = (q === -1 ? rest : rest.slice(0, q)).split("/");
|
|
1084
|
+
const last = segments[segments.length - 1];
|
|
1085
|
+
const at = last.indexOf("@");
|
|
1086
|
+
const step = at === -1 ? null : last.slice(at + 1);
|
|
1087
|
+
if (at !== -1) segments[segments.length - 1] = last.slice(0, at);
|
|
1088
|
+
const n = segments.length;
|
|
1089
|
+
if (form === "human" ? n !== 1 && n !== 3 : n < 1 || n > 3) return refuse("segments");
|
|
1090
|
+
if (segments.some((seg) => seg === "")) return refuse("segments");
|
|
1091
|
+
if (n === 1 && TYPES.has(segments[0])) return refuse("segments");
|
|
1092
|
+
let world = null;
|
|
1093
|
+
let worldIsSlug = false;
|
|
1094
|
+
if (n !== 2) {
|
|
1095
|
+
const w = segments[0];
|
|
1096
|
+
if (isUuid(w)) world = w.toLowerCase();
|
|
1097
|
+
else if (form === "human" && isSlug(w) && !TYPES.has(w)) {
|
|
1098
|
+
world = w;
|
|
1099
|
+
worldIsSlug = true;
|
|
1100
|
+
} else return refuse("bad_world");
|
|
1101
|
+
}
|
|
1102
|
+
let type = null;
|
|
1103
|
+
let id = null;
|
|
1104
|
+
if (n !== 1) {
|
|
1105
|
+
type = checkType(segments[n - 2]);
|
|
1106
|
+
if (!isUuid(segments[n - 1])) return refuse("bad_id");
|
|
1107
|
+
id = segments[n - 1].toLowerCase();
|
|
1108
|
+
}
|
|
1109
|
+
let moment = null;
|
|
1110
|
+
if (step !== null) {
|
|
1111
|
+
if (!STEP.test(step) || step.length > 11) return refuse("bad_moment");
|
|
1112
|
+
const m = Number(step);
|
|
1113
|
+
if (m < STEP_MIN || m > STEP_MAX) return refuse("bad_moment");
|
|
1114
|
+
moment = m;
|
|
1115
|
+
}
|
|
1116
|
+
const lens = query === null ? null : readLens(query);
|
|
1117
|
+
const canonical = !worldIsSlug && text === write(form, world, type, id, moment, lens);
|
|
1118
|
+
return { form, world, worldIsSlug, type, id, lens, moment, canonical };
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// src/openers.ts
|
|
1122
|
+
var SURFACE_KEYS = ["tool", "audience", "signedIn", "browser", "phone"];
|
|
1123
|
+
var NEEDS = ["account", "device", null];
|
|
1124
|
+
var PLACEHOLDER = /\{(world|type|id)\}/g;
|
|
1125
|
+
var fail = (what) => {
|
|
1126
|
+
throw new TypeError(`openersFor: ${what}`);
|
|
1127
|
+
};
|
|
1128
|
+
function templateOf(row, key, v) {
|
|
1129
|
+
if (v === void 0 || v === null) return null;
|
|
1130
|
+
return typeof v === "string" ? v : fail(`tool ${row}: open.${key} is a link template or null`);
|
|
1131
|
+
}
|
|
1132
|
+
function openersFor(tools, kind, address, surface) {
|
|
1133
|
+
if (!Array.isArray(tools)) fail("tools is the tools list's rows, an array");
|
|
1134
|
+
if (kind !== "world" && kind !== "element") fail(`kind is 'world' or 'element'; got ${JSON.stringify(kind)}`);
|
|
1135
|
+
if (address === null || typeof address !== "object" || Array.isArray(address)) {
|
|
1136
|
+
fail("the address is an object ({ form, world, type, id }), as parseOwLink reads it");
|
|
1137
|
+
}
|
|
1138
|
+
refuseUnknownOptions("openersFor", address, ADDRESS_KEYS);
|
|
1139
|
+
const a = address;
|
|
1140
|
+
elementAddress({ ...a, form: a.form ?? "human" });
|
|
1141
|
+
const page = elementAddress({ form: "human", world: a.world, type: a.type, id: a.id });
|
|
1142
|
+
const world = a.world.toLowerCase();
|
|
1143
|
+
const hasElement = a.type !== void 0 && a.type !== null;
|
|
1144
|
+
if (kind === "element" && !hasElement) fail("an element's openers need an address with its type and id");
|
|
1145
|
+
const type = hasElement ? a.type : "";
|
|
1146
|
+
const id = hasElement ? a.id.toLowerCase() : "";
|
|
1147
|
+
if (surface === null || typeof surface !== "object" || Array.isArray(surface)) fail("the surface is an object ({ audience, ... })");
|
|
1148
|
+
refuseUnknownOptions("openersFor", surface, SURFACE_KEYS);
|
|
1149
|
+
const { tool = null, audience, signedIn = null, browser = true, phone = false } = surface;
|
|
1150
|
+
if (audience !== "member" && audience !== "public") fail(`surface.audience is 'member' or 'public'; got ${JSON.stringify(audience)}`);
|
|
1151
|
+
if (tool !== null && typeof tool !== "string") fail("surface.tool is a client name or null");
|
|
1152
|
+
if (signedIn !== null && typeof signedIn !== "boolean") fail("surface.signedIn is true, false or null");
|
|
1153
|
+
if (typeof browser !== "boolean") fail("surface.browser is a boolean");
|
|
1154
|
+
if (typeof phone !== "boolean") fail("surface.phone is a boolean");
|
|
1155
|
+
const values = { world, type, id };
|
|
1156
|
+
const fill = (template) => template.replace(PLACEHOLDER, (_, n) => values[n]);
|
|
1157
|
+
const rows = [
|
|
1158
|
+
{ id: "onlyworlds", name: "onlyworlds.com", href: kind === "element" ? page : elementAddress({ form: "human", world }), state: null }
|
|
1159
|
+
];
|
|
1160
|
+
for (const r of tools) {
|
|
1161
|
+
if (r === null || typeof r !== "object" || typeof r.id !== "string" || typeof r.name !== "string") {
|
|
1162
|
+
fail("each tools row is an object with an id and a name");
|
|
1163
|
+
}
|
|
1164
|
+
const open = r.open;
|
|
1165
|
+
if (open === null || open === void 0) continue;
|
|
1166
|
+
if (typeof open !== "object" || Array.isArray(open)) fail(`tool ${r.id}: open is an object or null`);
|
|
1167
|
+
const o = open;
|
|
1168
|
+
const worldDoor = templateOf(r.id, "world", o.world);
|
|
1169
|
+
const elementDoor = templateOf(r.id, "element", o.element);
|
|
1170
|
+
const needs = o.needs === void 0 ? null : o.needs;
|
|
1171
|
+
if (!NEEDS.includes(needs)) fail(`tool ${r.id}: open.needs is 'account', 'device' or null; got ${JSON.stringify(needs)}`);
|
|
1172
|
+
if (r.rung !== "listed") continue;
|
|
1173
|
+
if (audience === "public" && needs !== null) continue;
|
|
1174
|
+
const template = kind === "element" ? elementDoor ?? worldDoor : worldDoor;
|
|
1175
|
+
if (template === null) continue;
|
|
1176
|
+
let state = null;
|
|
1177
|
+
if (tool !== null && r.client === tool) state = "You are here";
|
|
1178
|
+
else if (needs === "account" && !browser) state = "Opens in your browser";
|
|
1179
|
+
else if (needs === "account" && signedIn === false) state = `Sign in to ${r.name} first`;
|
|
1180
|
+
else if (needs === "device" && phone) state = "Needs the world on this phone";
|
|
1181
|
+
else if (kind === "element" && elementDoor === null) state = "Opens the world";
|
|
1182
|
+
rows.push({ id: r.id, name: r.name, href: fill(template), state });
|
|
1183
|
+
}
|
|
1184
|
+
return rows;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// src/tools.generated.ts
|
|
1188
|
+
var TOOLS = [
|
|
1189
|
+
{
|
|
1190
|
+
"id": "atlas",
|
|
1191
|
+
"name": "Atlas",
|
|
1192
|
+
"url": "https://atlas.onlyworlds.com",
|
|
1193
|
+
"client": "atlas",
|
|
1194
|
+
"rung": "listed",
|
|
1195
|
+
"open": {
|
|
1196
|
+
"world": "https://atlas.onlyworlds.com/#/open/{world}",
|
|
1197
|
+
"element": "https://atlas.onlyworlds.com/#/open/{world}/element/{id}",
|
|
1198
|
+
"needs": "account"
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"id": "lantern",
|
|
1203
|
+
"name": "Lantern",
|
|
1204
|
+
"url": "https://lantern.onlyworlds.com",
|
|
1205
|
+
"client": "lantern",
|
|
1206
|
+
"rung": "listed",
|
|
1207
|
+
"open": {
|
|
1208
|
+
"world": "https://lantern.onlyworlds.com/#/open/{world}",
|
|
1209
|
+
"element": "https://lantern.onlyworlds.com/#/open/{world}/element/{id}",
|
|
1210
|
+
"needs": "account"
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
];
|
|
1214
|
+
|
|
1215
|
+
// src/doors.ts
|
|
1216
|
+
var TIME = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]+))?(Z|([+-])([0-9]{2}):([0-9]{2}))$/;
|
|
1217
|
+
var MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
1218
|
+
var fail2 = (what) => {
|
|
1219
|
+
throw new TypeError(`doorsOf: ${what}`);
|
|
1220
|
+
};
|
|
1221
|
+
function daysFromCivil(year, month, day) {
|
|
1222
|
+
const y = month <= 2 ? year - 1 : year;
|
|
1223
|
+
const era = Math.floor(y / 400);
|
|
1224
|
+
const yoe = y - era * 400;
|
|
1225
|
+
const doy = Math.floor((153 * (month > 2 ? month - 3 : month + 9) + 2) / 5) + day - 1;
|
|
1226
|
+
const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;
|
|
1227
|
+
return era * 146097 + doe - 719468;
|
|
1228
|
+
}
|
|
1229
|
+
function instantOf(value) {
|
|
1230
|
+
if (typeof value !== "string") return null;
|
|
1231
|
+
const m = TIME.exec(value);
|
|
1232
|
+
if (m === null) return null;
|
|
1233
|
+
const [year, month, day, hour, minute, second] = m.slice(1, 7).map(Number);
|
|
1234
|
+
if (month < 1 || month > 12) return null;
|
|
1235
|
+
const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
1236
|
+
if (day < 1 || day > (month === 2 && leap ? 29 : MONTH_DAYS[month - 1])) return null;
|
|
1237
|
+
if (hour > 23 || minute > 59 || second > 59) return null;
|
|
1238
|
+
let offset = 0;
|
|
1239
|
+
if (m[8] !== "Z") {
|
|
1240
|
+
const oh = Number(m[10]);
|
|
1241
|
+
const om = Number(m[11]);
|
|
1242
|
+
if (oh > 23 || om > 59) return null;
|
|
1243
|
+
offset = (m[9] === "-" ? -1 : 1) * (oh * 3600 + om * 60);
|
|
1244
|
+
}
|
|
1245
|
+
const seconds = daysFromCivil(year, month, day) * 86400 + hour * 3600 + minute * 60 + second - offset;
|
|
1246
|
+
return { seconds, fraction: (m[7] ?? "").replace(/0+$/, "") };
|
|
1247
|
+
}
|
|
1248
|
+
function compareInstants(a, b) {
|
|
1249
|
+
if (a.seconds !== b.seconds) return a.seconds < b.seconds ? -1 : 1;
|
|
1250
|
+
const width = Math.max(a.fraction.length, b.fraction.length);
|
|
1251
|
+
const fa = a.fraction.padEnd(width, "0");
|
|
1252
|
+
const fb = b.fraction.padEnd(width, "0");
|
|
1253
|
+
return fa === fb ? 0 : fa < fb ? -1 : 1;
|
|
1254
|
+
}
|
|
1255
|
+
function compareCodePoints(a, b) {
|
|
1256
|
+
const ca = Array.from(a, (c) => c.codePointAt(0));
|
|
1257
|
+
const cb = Array.from(b, (c) => c.codePointAt(0));
|
|
1258
|
+
for (let i = 0; i < Math.min(ca.length, cb.length); i++) {
|
|
1259
|
+
if (ca[i] !== cb[i]) return ca[i] < cb[i] ? -1 : 1;
|
|
1260
|
+
}
|
|
1261
|
+
return ca.length - cb.length;
|
|
1262
|
+
}
|
|
1263
|
+
var nonEmpty = (v) => typeof v === "string" && v.length > 0;
|
|
1264
|
+
function doorsOf(element, tools = TOOLS) {
|
|
1265
|
+
if (element === null || typeof element !== "object" || Array.isArray(element)) fail2("the element is an object, as the API serves it");
|
|
1266
|
+
if (!Array.isArray(tools)) fail2("tools is the tools list's rows, an array");
|
|
1267
|
+
const e = element;
|
|
1268
|
+
const toolOf = (door) => {
|
|
1269
|
+
const row = tools.find((r) => r !== null && typeof r === "object" && r.client === door);
|
|
1270
|
+
return row === void 0 ? null : { id: row.id, name: row.name };
|
|
1271
|
+
};
|
|
1272
|
+
const found = [];
|
|
1273
|
+
const doors = e.doors;
|
|
1274
|
+
if (doors !== null && typeof doors === "object" && !Array.isArray(doors)) {
|
|
1275
|
+
for (const [door, at] of Object.entries(doors)) {
|
|
1276
|
+
const instant = instantOf(at);
|
|
1277
|
+
if (door.length > 0 && instant !== null) found.push({ door, at, instant });
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
const updated = instantOf(e.updated_at);
|
|
1281
|
+
if (found.length === 0) {
|
|
1282
|
+
const door = nonEmpty(e.changed_client) ? e.changed_client : nonEmpty(e.changed_via) ? e.changed_via : null;
|
|
1283
|
+
if (door === null || updated === null) return [];
|
|
1284
|
+
return [{ door, at: e.updated_at, tool: toolOf(door), last: true, from: "last-write" }];
|
|
1285
|
+
}
|
|
1286
|
+
found.sort((a, b) => compareInstants(b.instant, a.instant) || compareCodePoints(a.door, b.door));
|
|
1287
|
+
let lastSeen = false;
|
|
1288
|
+
return found.map(({ door, at, instant }) => {
|
|
1289
|
+
const last = !lastSeen && updated !== null && compareInstants(instant, updated) === 0;
|
|
1290
|
+
if (last) lastSeen = true;
|
|
1291
|
+
return { door, at, tool: toolOf(door), last, from: "doors" };
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
function doorWhere(door) {
|
|
1295
|
+
if (door === null || typeof door !== "object" || Array.isArray(door)) throw new TypeError("doorWhere: the door is an entry of doorsOf, an object");
|
|
1296
|
+
if (typeof door.door !== "string") throw new TypeError("doorWhere: the entry's door is a string");
|
|
1297
|
+
const tool = door.tool;
|
|
1298
|
+
if (tool != null) {
|
|
1299
|
+
if (typeof tool !== "object" || typeof tool.name !== "string") throw new TypeError("doorWhere: the entry's tool is null or { id, name }");
|
|
1300
|
+
return `in ${tool.name}`;
|
|
1301
|
+
}
|
|
1302
|
+
if (door.door === "site") return "on onlyworlds.com";
|
|
1303
|
+
if (isAgentDoor(door.door)) return "with an AI";
|
|
1304
|
+
if (door.door === "server") return "by OnlyWorlds";
|
|
1305
|
+
return "in code";
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
export {
|
|
1309
|
+
unknownKey,
|
|
1310
|
+
refuseUnknownOptions,
|
|
1311
|
+
ELEMENT_TYPES,
|
|
1312
|
+
ONLYWORLDS_VERSION,
|
|
1313
|
+
ELEMENT_GROUPS,
|
|
1314
|
+
GROUP_ORDER,
|
|
1315
|
+
GROUP_COLORS,
|
|
1316
|
+
ELEMENT_ICONS,
|
|
1317
|
+
PUBLIC_FIELDS,
|
|
1318
|
+
ELEMENT_SECTIONS,
|
|
1319
|
+
ROOM_PAIRS,
|
|
1320
|
+
CHARTER_PAIRS,
|
|
1321
|
+
REVIEW_PROPOSED_LABEL,
|
|
1322
|
+
MESSAGE_PAIR,
|
|
1323
|
+
MESSAGE_READ_MARK,
|
|
1324
|
+
NOTE_PAIR,
|
|
1325
|
+
FIELD_SCHEMA,
|
|
1326
|
+
SPATIAL_TYPES,
|
|
1327
|
+
AGENT_DOORS,
|
|
1328
|
+
isAgentDoor,
|
|
1329
|
+
isKnownOf,
|
|
1330
|
+
simpleCaseFold,
|
|
1331
|
+
trimWhiteSpace,
|
|
1332
|
+
fold,
|
|
1333
|
+
isRoomElement,
|
|
1334
|
+
READING_AID_KEYS,
|
|
1335
|
+
readingAidKey,
|
|
1336
|
+
isCharterElement,
|
|
1337
|
+
readingAidOf,
|
|
1338
|
+
typeWord,
|
|
1339
|
+
OwAddressError,
|
|
1340
|
+
elementAddress,
|
|
1341
|
+
parseOwLink,
|
|
1342
|
+
openersFor,
|
|
1343
|
+
TOOLS,
|
|
1344
|
+
doorsOf,
|
|
1345
|
+
doorWhere
|
|
1346
|
+
};
|