@onlyworlds/sdk 1.0.0 → 1.2.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/dist/index.js CHANGED
@@ -21,7 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ElementType: () => ElementType,
24
- OnlyWorldsClient: () => OnlyWorldsClient
24
+ FIELD_MAPPINGS: () => FIELD_MAPPINGS,
25
+ OnlyWorldsClient: () => OnlyWorldsClient,
26
+ createAnyElementId: () => createAnyElementId,
27
+ createElementId: () => createElementId,
28
+ createElementIds: () => createElementIds
25
29
  });
26
30
  module.exports = __toCommonJS(index_exports);
27
31
 
@@ -55,6 +59,7 @@ var OnlyWorldsClient = class {
55
59
  "API-Key": config.apiKey,
56
60
  "API-Pin": config.apiPin
57
61
  };
62
+ this.worlds = new Resource(this, "world");
58
63
  this.abilities = new Resource(this, "ability");
59
64
  this.characters = new Resource(this, "character");
60
65
  this.collectives = new Resource(this, "collective");
@@ -121,9 +126,10 @@ var OnlyWorldsClient = class {
121
126
  }
122
127
  /**
123
128
  * Get all worlds accessible with current credentials
129
+ * @deprecated Use client.worlds.list() instead for consistent API
124
130
  */
125
131
  async getWorlds() {
126
- return this.request("GET", "/worlds/");
132
+ return this.request("GET", "/world/");
127
133
  }
128
134
  /**
129
135
  * Helper to convert nested objects to _id/_ids format
@@ -169,8 +175,282 @@ var ElementType = /* @__PURE__ */ ((ElementType2) => {
169
175
  ElementType2["Zone"] = "zone";
170
176
  return ElementType2;
171
177
  })(ElementType || {});
178
+ var FIELD_MAPPINGS = {
179
+ ability: {
180
+ tradition: "construct",
181
+ source: "phenomenon",
182
+ locus: "location",
183
+ effects: "phenomenon",
184
+ talents: "trait",
185
+ requisites: "construct",
186
+ instruments: "object",
187
+ systems: "construct"
188
+ },
189
+ character: {
190
+ birthplace: "location",
191
+ location: "location",
192
+ species: "species",
193
+ traits: "trait",
194
+ abilities: "ability",
195
+ languages: "language",
196
+ objects: "object",
197
+ institutions: "institution",
198
+ family: "family",
199
+ friends: "character",
200
+ rivals: "character"
201
+ },
202
+ collective: {
203
+ operator: "institution",
204
+ equipment: "construct",
205
+ abilities: "ability",
206
+ symbolism: "construct",
207
+ species: "species",
208
+ characters: "character",
209
+ creatures: "creature",
210
+ phenomena: "phenomenon"
211
+ },
212
+ construct: {
213
+ founder: "character",
214
+ custodian: "institution",
215
+ characters: "character",
216
+ objects: "object",
217
+ locations: "location",
218
+ species: "species",
219
+ creatures: "creature",
220
+ institutions: "institution",
221
+ traits: "trait",
222
+ collectives: "collective",
223
+ zones: "zone",
224
+ abilities: "ability",
225
+ phenomena: "phenomenon",
226
+ languages: "language",
227
+ families: "family",
228
+ relations: "relation",
229
+ titles: "title",
230
+ constructs: "construct",
231
+ events: "event",
232
+ narratives: "narrative"
233
+ },
234
+ creature: {
235
+ location: "location",
236
+ zone: "zone",
237
+ species: "species",
238
+ traits: "trait",
239
+ abilities: "ability",
240
+ languages: "language",
241
+ actions: "ability"
242
+ },
243
+ event: {
244
+ triggers: "event",
245
+ characters: "character",
246
+ objects: "object",
247
+ locations: "location",
248
+ species: "species",
249
+ creatures: "creature",
250
+ institutions: "institution",
251
+ traits: "trait",
252
+ collectives: "collective",
253
+ zones: "zone",
254
+ abilities: "ability",
255
+ phenomena: "phenomenon",
256
+ languages: "language",
257
+ families: "family",
258
+ relations: "relation",
259
+ titles: "title",
260
+ constructs: "construct"
261
+ },
262
+ family: {
263
+ traditions: "construct",
264
+ traits: "trait",
265
+ abilities: "ability",
266
+ languages: "language",
267
+ ancestors: "character",
268
+ estates: "location",
269
+ governs: "institution",
270
+ heirlooms: "object",
271
+ creatures: "creature"
272
+ },
273
+ institution: {
274
+ parent_institution: "institution",
275
+ zones: "zone",
276
+ objects: "object",
277
+ creatures: "creature",
278
+ allies: "institution",
279
+ adversaries: "institution",
280
+ constructs: "construct"
281
+ },
282
+ language: {
283
+ classification: "construct",
284
+ spread: "location",
285
+ dialects: "language"
286
+ },
287
+ law: {
288
+ parent_law: "law",
289
+ author: "institution",
290
+ penalties: "construct",
291
+ locations: "location",
292
+ zones: "zone",
293
+ prohibitions: "construct",
294
+ adjudicators: "title",
295
+ enforcers: "title"
296
+ },
297
+ location: {
298
+ parent_location: "location",
299
+ primary_power: "institution",
300
+ governing_title: "title",
301
+ zone: "zone",
302
+ rival: "location",
303
+ partner: "location",
304
+ populations: "collective",
305
+ secondary_powers: "institution",
306
+ founders: "character",
307
+ cults: "construct",
308
+ delicacies: "species",
309
+ extraction_methods: "construct",
310
+ extraction_goods: "construct",
311
+ industry_methods: "construct",
312
+ industry_goods: "construct",
313
+ extraction_markets: "location",
314
+ industry_markets: "location",
315
+ currencies: "construct",
316
+ buildings: "object",
317
+ building_methods: "construct",
318
+ fighters: "construct",
319
+ defensive_objects: "object"
320
+ },
321
+ map: {
322
+ parent_map: "map",
323
+ location: "location"
324
+ },
325
+ marker: {
326
+ map: "map",
327
+ zone: "zone"
328
+ },
329
+ narrative: {
330
+ parent_narrative: "narrative",
331
+ protagonist: "character",
332
+ antagonist: "character",
333
+ narrator: "character",
334
+ conservator: "institution",
335
+ events: "event",
336
+ characters: "character",
337
+ objects: "object",
338
+ locations: "location",
339
+ species: "species",
340
+ creatures: "creature",
341
+ institutions: "institution",
342
+ traits: "trait",
343
+ collectives: "collective",
344
+ zones: "zone",
345
+ abilities: "ability",
346
+ phenomena: "phenomenon",
347
+ languages: "language",
348
+ families: "family",
349
+ relations: "relation",
350
+ titles: "title",
351
+ constructs: "construct",
352
+ laws: "law"
353
+ },
354
+ object: {
355
+ parent_object: "object",
356
+ location: "location",
357
+ language: "language",
358
+ materials: "construct",
359
+ technology: "construct",
360
+ effects: "phenomenon",
361
+ abilities: "ability",
362
+ consumes: "construct",
363
+ affinities: "trait"
364
+ },
365
+ phenomenon: {
366
+ system: "phenomenon",
367
+ catalysts: "object",
368
+ empowerments: "ability",
369
+ triggers: "construct",
370
+ wielders: "character",
371
+ environments: "location"
372
+ },
373
+ pin: {
374
+ map: "map",
375
+ element_id: "any_element"
376
+ },
377
+ relation: {
378
+ actor: "character",
379
+ characters: "character",
380
+ objects: "object",
381
+ locations: "location",
382
+ species: "species",
383
+ creatures: "creature",
384
+ institutions: "institution",
385
+ traits: "trait",
386
+ collectives: "collective",
387
+ zones: "zone",
388
+ abilities: "ability",
389
+ phenomena: "phenomenon",
390
+ languages: "language",
391
+ families: "family",
392
+ titles: "title",
393
+ constructs: "construct",
394
+ events: "event",
395
+ narratives: "narrative"
396
+ },
397
+ species: {
398
+ parent_species: "species",
399
+ nourishment: "species",
400
+ reproduction: "construct",
401
+ adaptations: "ability",
402
+ traits: "trait",
403
+ locations: "location",
404
+ zones: "zone",
405
+ affinities: "phenomenon"
406
+ },
407
+ title: {
408
+ issuer: "institution",
409
+ body: "institution",
410
+ superior_title: "title",
411
+ holders: "character",
412
+ symbols: "object",
413
+ characters: "character",
414
+ institutions: "institution",
415
+ families: "family",
416
+ zones: "zone",
417
+ locations: "location",
418
+ objects: "object",
419
+ constructs: "construct",
420
+ laws: "law",
421
+ collectives: "collective",
422
+ creatures: "creature",
423
+ phenomena: "phenomenon",
424
+ species: "species",
425
+ languages: "language"
426
+ },
427
+ trait: {
428
+ anti_trait: "trait",
429
+ empowered_abilities: "ability"
430
+ },
431
+ zone: {
432
+ phenomena: "phenomenon",
433
+ linked_zones: "zone",
434
+ populations: "collective",
435
+ titles: "title",
436
+ principles: "construct"
437
+ }
438
+ };
439
+ function createElementId(id) {
440
+ return id;
441
+ }
442
+ function createElementIds(ids) {
443
+ return ids;
444
+ }
445
+ function createAnyElementId(id) {
446
+ return id;
447
+ }
172
448
  // Annotate the CommonJS export names for ESM import in node:
173
449
  0 && (module.exports = {
174
450
  ElementType,
175
- OnlyWorldsClient
451
+ FIELD_MAPPINGS,
452
+ OnlyWorldsClient,
453
+ createAnyElementId,
454
+ createElementId,
455
+ createElementIds
176
456
  });
package/dist/index.mjs CHANGED
@@ -28,6 +28,7 @@ var OnlyWorldsClient = class {
28
28
  "API-Key": config.apiKey,
29
29
  "API-Pin": config.apiPin
30
30
  };
31
+ this.worlds = new Resource(this, "world");
31
32
  this.abilities = new Resource(this, "ability");
32
33
  this.characters = new Resource(this, "character");
33
34
  this.collectives = new Resource(this, "collective");
@@ -94,9 +95,10 @@ var OnlyWorldsClient = class {
94
95
  }
95
96
  /**
96
97
  * Get all worlds accessible with current credentials
98
+ * @deprecated Use client.worlds.list() instead for consistent API
97
99
  */
98
100
  async getWorlds() {
99
- return this.request("GET", "/worlds/");
101
+ return this.request("GET", "/world/");
100
102
  }
101
103
  /**
102
104
  * Helper to convert nested objects to _id/_ids format
@@ -142,7 +144,281 @@ var ElementType = /* @__PURE__ */ ((ElementType2) => {
142
144
  ElementType2["Zone"] = "zone";
143
145
  return ElementType2;
144
146
  })(ElementType || {});
147
+ var FIELD_MAPPINGS = {
148
+ ability: {
149
+ tradition: "construct",
150
+ source: "phenomenon",
151
+ locus: "location",
152
+ effects: "phenomenon",
153
+ talents: "trait",
154
+ requisites: "construct",
155
+ instruments: "object",
156
+ systems: "construct"
157
+ },
158
+ character: {
159
+ birthplace: "location",
160
+ location: "location",
161
+ species: "species",
162
+ traits: "trait",
163
+ abilities: "ability",
164
+ languages: "language",
165
+ objects: "object",
166
+ institutions: "institution",
167
+ family: "family",
168
+ friends: "character",
169
+ rivals: "character"
170
+ },
171
+ collective: {
172
+ operator: "institution",
173
+ equipment: "construct",
174
+ abilities: "ability",
175
+ symbolism: "construct",
176
+ species: "species",
177
+ characters: "character",
178
+ creatures: "creature",
179
+ phenomena: "phenomenon"
180
+ },
181
+ construct: {
182
+ founder: "character",
183
+ custodian: "institution",
184
+ characters: "character",
185
+ objects: "object",
186
+ locations: "location",
187
+ species: "species",
188
+ creatures: "creature",
189
+ institutions: "institution",
190
+ traits: "trait",
191
+ collectives: "collective",
192
+ zones: "zone",
193
+ abilities: "ability",
194
+ phenomena: "phenomenon",
195
+ languages: "language",
196
+ families: "family",
197
+ relations: "relation",
198
+ titles: "title",
199
+ constructs: "construct",
200
+ events: "event",
201
+ narratives: "narrative"
202
+ },
203
+ creature: {
204
+ location: "location",
205
+ zone: "zone",
206
+ species: "species",
207
+ traits: "trait",
208
+ abilities: "ability",
209
+ languages: "language",
210
+ actions: "ability"
211
+ },
212
+ event: {
213
+ triggers: "event",
214
+ characters: "character",
215
+ objects: "object",
216
+ locations: "location",
217
+ species: "species",
218
+ creatures: "creature",
219
+ institutions: "institution",
220
+ traits: "trait",
221
+ collectives: "collective",
222
+ zones: "zone",
223
+ abilities: "ability",
224
+ phenomena: "phenomenon",
225
+ languages: "language",
226
+ families: "family",
227
+ relations: "relation",
228
+ titles: "title",
229
+ constructs: "construct"
230
+ },
231
+ family: {
232
+ traditions: "construct",
233
+ traits: "trait",
234
+ abilities: "ability",
235
+ languages: "language",
236
+ ancestors: "character",
237
+ estates: "location",
238
+ governs: "institution",
239
+ heirlooms: "object",
240
+ creatures: "creature"
241
+ },
242
+ institution: {
243
+ parent_institution: "institution",
244
+ zones: "zone",
245
+ objects: "object",
246
+ creatures: "creature",
247
+ allies: "institution",
248
+ adversaries: "institution",
249
+ constructs: "construct"
250
+ },
251
+ language: {
252
+ classification: "construct",
253
+ spread: "location",
254
+ dialects: "language"
255
+ },
256
+ law: {
257
+ parent_law: "law",
258
+ author: "institution",
259
+ penalties: "construct",
260
+ locations: "location",
261
+ zones: "zone",
262
+ prohibitions: "construct",
263
+ adjudicators: "title",
264
+ enforcers: "title"
265
+ },
266
+ location: {
267
+ parent_location: "location",
268
+ primary_power: "institution",
269
+ governing_title: "title",
270
+ zone: "zone",
271
+ rival: "location",
272
+ partner: "location",
273
+ populations: "collective",
274
+ secondary_powers: "institution",
275
+ founders: "character",
276
+ cults: "construct",
277
+ delicacies: "species",
278
+ extraction_methods: "construct",
279
+ extraction_goods: "construct",
280
+ industry_methods: "construct",
281
+ industry_goods: "construct",
282
+ extraction_markets: "location",
283
+ industry_markets: "location",
284
+ currencies: "construct",
285
+ buildings: "object",
286
+ building_methods: "construct",
287
+ fighters: "construct",
288
+ defensive_objects: "object"
289
+ },
290
+ map: {
291
+ parent_map: "map",
292
+ location: "location"
293
+ },
294
+ marker: {
295
+ map: "map",
296
+ zone: "zone"
297
+ },
298
+ narrative: {
299
+ parent_narrative: "narrative",
300
+ protagonist: "character",
301
+ antagonist: "character",
302
+ narrator: "character",
303
+ conservator: "institution",
304
+ events: "event",
305
+ characters: "character",
306
+ objects: "object",
307
+ locations: "location",
308
+ species: "species",
309
+ creatures: "creature",
310
+ institutions: "institution",
311
+ traits: "trait",
312
+ collectives: "collective",
313
+ zones: "zone",
314
+ abilities: "ability",
315
+ phenomena: "phenomenon",
316
+ languages: "language",
317
+ families: "family",
318
+ relations: "relation",
319
+ titles: "title",
320
+ constructs: "construct",
321
+ laws: "law"
322
+ },
323
+ object: {
324
+ parent_object: "object",
325
+ location: "location",
326
+ language: "language",
327
+ materials: "construct",
328
+ technology: "construct",
329
+ effects: "phenomenon",
330
+ abilities: "ability",
331
+ consumes: "construct",
332
+ affinities: "trait"
333
+ },
334
+ phenomenon: {
335
+ system: "phenomenon",
336
+ catalysts: "object",
337
+ empowerments: "ability",
338
+ triggers: "construct",
339
+ wielders: "character",
340
+ environments: "location"
341
+ },
342
+ pin: {
343
+ map: "map",
344
+ element_id: "any_element"
345
+ },
346
+ relation: {
347
+ actor: "character",
348
+ characters: "character",
349
+ objects: "object",
350
+ locations: "location",
351
+ species: "species",
352
+ creatures: "creature",
353
+ institutions: "institution",
354
+ traits: "trait",
355
+ collectives: "collective",
356
+ zones: "zone",
357
+ abilities: "ability",
358
+ phenomena: "phenomenon",
359
+ languages: "language",
360
+ families: "family",
361
+ titles: "title",
362
+ constructs: "construct",
363
+ events: "event",
364
+ narratives: "narrative"
365
+ },
366
+ species: {
367
+ parent_species: "species",
368
+ nourishment: "species",
369
+ reproduction: "construct",
370
+ adaptations: "ability",
371
+ traits: "trait",
372
+ locations: "location",
373
+ zones: "zone",
374
+ affinities: "phenomenon"
375
+ },
376
+ title: {
377
+ issuer: "institution",
378
+ body: "institution",
379
+ superior_title: "title",
380
+ holders: "character",
381
+ symbols: "object",
382
+ characters: "character",
383
+ institutions: "institution",
384
+ families: "family",
385
+ zones: "zone",
386
+ locations: "location",
387
+ objects: "object",
388
+ constructs: "construct",
389
+ laws: "law",
390
+ collectives: "collective",
391
+ creatures: "creature",
392
+ phenomena: "phenomenon",
393
+ species: "species",
394
+ languages: "language"
395
+ },
396
+ trait: {
397
+ anti_trait: "trait",
398
+ empowered_abilities: "ability"
399
+ },
400
+ zone: {
401
+ phenomena: "phenomenon",
402
+ linked_zones: "zone",
403
+ populations: "collective",
404
+ titles: "title",
405
+ principles: "construct"
406
+ }
407
+ };
408
+ function createElementId(id) {
409
+ return id;
410
+ }
411
+ function createElementIds(ids) {
412
+ return ids;
413
+ }
414
+ function createAnyElementId(id) {
415
+ return id;
416
+ }
145
417
  export {
146
418
  ElementType,
147
- OnlyWorldsClient
419
+ FIELD_MAPPINGS,
420
+ OnlyWorldsClient,
421
+ createAnyElementId,
422
+ createElementId,
423
+ createElementIds
148
424
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "repository": {
30
30
  "type": "git",
31
- "url": "https://github.com/onlyworlds/sdk"
31
+ "url": "git+https://github.com/onlyworlds/sdk.git"
32
32
  },
33
33
  "devDependencies": {
34
34
  "tsup": "^8.0.1",
@@ -40,4 +40,4 @@
40
40
  "engines": {
41
41
  "node": ">=18.0.0"
42
42
  }
43
- }
43
+ }