@onlyworlds/sdk 2.2.0 → 2.2.2

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.d.mts CHANGED
@@ -904,24 +904,6 @@ declare const ONLYWORLDS_VERSION: "00.30.00";
904
904
  * Compatible with Google Material Icons font
905
905
  */
906
906
  declare const ELEMENT_ICONS: Record<ElementType, string>;
907
- /**
908
- * Simple Unicode icons for element types
909
- * Minimalist symbols used as fallbacks
910
- */
911
- declare const ELEMENT_UNICODE_ICONS: Record<ElementType, string>;
912
- /**
913
- * Get Material Design icon for an element type
914
- * Returns the uniform monochrome icon used in OnlyWorlds frontend
915
- * @param elementType The element type
916
- * @returns Material icon name
917
- */
918
- declare function getElementIcon(elementType: ElementType): string;
919
- /**
920
- * Get Unicode icon for an element type
921
- * @param elementType The element type
922
- * @returns Unicode symbol string
923
- */
924
- declare function getElementUnicodeIcon(elementType: ElementType): string;
925
907
  /**
926
908
  * Field type definitions for OnlyWorlds elements
927
909
  */
@@ -1456,7 +1438,7 @@ declare const FIELD_SCHEMA: {
1456
1438
  };
1457
1439
  readonly triggers: {
1458
1440
  readonly type: "multi_link";
1459
- readonly target: "construct";
1441
+ readonly target: "event";
1460
1442
  };
1461
1443
  readonly characters: {
1462
1444
  readonly type: "multi_link";
@@ -3110,4 +3092,19 @@ declare class OnlyWorldsClient {
3110
3092
  static prepareRelations<T extends Record<string, any>>(data: T, elementType: string): any;
3111
3093
  }
3112
3094
 
3113
- 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_UNICODE_ICONS, type ElementId, type ElementIds, 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 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, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type RevokeAllSessionsResponse, type RevokeSessionResponse, type SectionInfo, type Species, type SpeciesInput, type Title, type TitleInput, type TokenConsumeParams, type TokenConsumeResponse, type TokenStatus, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds, getElementIcon, getElementLabel, getElementSections, getElementUnicodeIcon };
3095
+ /**
3096
+ * Get Material Design icon name for an element type
3097
+ * Accepts multiple formats: 'character', 'characters', 'Character', etc.
3098
+ *
3099
+ * @param type - Element type in any format (singular, plural, any case)
3100
+ * @returns Material icon name (e.g., 'person', 'castle', 'thunderstorm')
3101
+ *
3102
+ * @example
3103
+ * getElementIcon('character') // 'person'
3104
+ * getElementIcon('characters') // 'person'
3105
+ * getElementIcon('Character') // 'person'
3106
+ * getElementIcon('phenomena') // 'thunderstorm'
3107
+ */
3108
+ declare function getElementIcon(type: string): string;
3109
+
3110
+ 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, type ElementId, type ElementIds, 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 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, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type RevokeAllSessionsResponse, type RevokeSessionResponse, type SectionInfo, type Species, type SpeciesInput, type Title, type TitleInput, type TokenConsumeParams, type TokenConsumeResponse, type TokenStatus, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds, getElementIcon, getElementLabel, getElementSections };
package/dist/index.d.ts CHANGED
@@ -904,24 +904,6 @@ declare const ONLYWORLDS_VERSION: "00.30.00";
904
904
  * Compatible with Google Material Icons font
905
905
  */
906
906
  declare const ELEMENT_ICONS: Record<ElementType, string>;
907
- /**
908
- * Simple Unicode icons for element types
909
- * Minimalist symbols used as fallbacks
910
- */
911
- declare const ELEMENT_UNICODE_ICONS: Record<ElementType, string>;
912
- /**
913
- * Get Material Design icon for an element type
914
- * Returns the uniform monochrome icon used in OnlyWorlds frontend
915
- * @param elementType The element type
916
- * @returns Material icon name
917
- */
918
- declare function getElementIcon(elementType: ElementType): string;
919
- /**
920
- * Get Unicode icon for an element type
921
- * @param elementType The element type
922
- * @returns Unicode symbol string
923
- */
924
- declare function getElementUnicodeIcon(elementType: ElementType): string;
925
907
  /**
926
908
  * Field type definitions for OnlyWorlds elements
927
909
  */
@@ -1456,7 +1438,7 @@ declare const FIELD_SCHEMA: {
1456
1438
  };
1457
1439
  readonly triggers: {
1458
1440
  readonly type: "multi_link";
1459
- readonly target: "construct";
1441
+ readonly target: "event";
1460
1442
  };
1461
1443
  readonly characters: {
1462
1444
  readonly type: "multi_link";
@@ -3110,4 +3092,19 @@ declare class OnlyWorldsClient {
3110
3092
  static prepareRelations<T extends Record<string, any>>(data: T, elementType: string): any;
3111
3093
  }
3112
3094
 
3113
- 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_UNICODE_ICONS, type ElementId, type ElementIds, 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 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, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type RevokeAllSessionsResponse, type RevokeSessionResponse, type SectionInfo, type Species, type SpeciesInput, type Title, type TitleInput, type TokenConsumeParams, type TokenConsumeResponse, type TokenStatus, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds, getElementIcon, getElementLabel, getElementSections, getElementUnicodeIcon };
3095
+ /**
3096
+ * Get Material Design icon name for an element type
3097
+ * Accepts multiple formats: 'character', 'characters', 'Character', etc.
3098
+ *
3099
+ * @param type - Element type in any format (singular, plural, any case)
3100
+ * @returns Material icon name (e.g., 'person', 'castle', 'thunderstorm')
3101
+ *
3102
+ * @example
3103
+ * getElementIcon('character') // 'person'
3104
+ * getElementIcon('characters') // 'person'
3105
+ * getElementIcon('Character') // 'person'
3106
+ * getElementIcon('phenomena') // 'thunderstorm'
3107
+ */
3108
+ declare function getElementIcon(type: string): string;
3109
+
3110
+ 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, type ElementId, type ElementIds, 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 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, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type RevokeAllSessionsResponse, type RevokeSessionResponse, type SectionInfo, type Species, type SpeciesInput, type Title, type TitleInput, type TokenConsumeParams, type TokenConsumeResponse, type TokenStatus, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds, getElementIcon, getElementLabel, getElementSections };
package/dist/index.js CHANGED
@@ -23,7 +23,6 @@ __export(index_exports, {
23
23
  ELEMENT_ICONS: () => ELEMENT_ICONS,
24
24
  ELEMENT_LABELS: () => ELEMENT_LABELS,
25
25
  ELEMENT_SECTIONS: () => ELEMENT_SECTIONS,
26
- ELEMENT_UNICODE_ICONS: () => ELEMENT_UNICODE_ICONS,
27
26
  ElementType: () => ElementType,
28
27
  FIELD_SCHEMA: () => FIELD_SCHEMA,
29
28
  GameTier: () => GameTier,
@@ -34,8 +33,7 @@ __export(index_exports, {
34
33
  createElementIds: () => createElementIds,
35
34
  getElementIcon: () => getElementIcon,
36
35
  getElementLabel: () => getElementLabel,
37
- getElementSections: () => getElementSections,
38
- getElementUnicodeIcon: () => getElementUnicodeIcon
36
+ getElementSections: () => getElementSections
39
37
  });
40
38
  module.exports = __toCommonJS(index_exports);
41
39
 
@@ -223,36 +221,6 @@ var ELEMENT_ICONS = {
223
221
  ["trait" /* Trait */]: "flaky",
224
222
  ["zone" /* Zone */]: "architecture"
225
223
  };
226
- var ELEMENT_UNICODE_ICONS = {
227
- ["ability" /* Ability */]: "\u2728",
228
- ["character" /* Character */]: "\u{1F464}",
229
- ["collective" /* Collective */]: "\u{1F465}",
230
- ["construct" /* Construct */]: "\u2699\uFE0F",
231
- ["creature" /* Creature */]: "\u{1F43E}",
232
- ["event" /* Event */]: "\u{1F4C5}",
233
- ["family" /* Family */]: "\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}",
234
- ["institution" /* Institution */]: "\u{1F3DB}\uFE0F",
235
- ["language" /* Language */]: "\u{1F4AC}",
236
- ["law" /* Law */]: "\u2696\uFE0F",
237
- ["location" /* Location */]: "\u{1F3F0}",
238
- ["map" /* Map */]: "\u{1F5FA}\uFE0F",
239
- ["marker" /* Marker */]: "\u{1F4CD}",
240
- ["narrative" /* Narrative */]: "\u{1F4D6}",
241
- ["object" /* Object */]: "\u{1F4E6}",
242
- ["phenomenon" /* Phenomenon */]: "\u26A1",
243
- ["pin" /* Pin */]: "\u{1F4CC}",
244
- ["relation" /* Relation */]: "\u{1F517}",
245
- ["species" /* Species */]: "\u{1F9EC}",
246
- ["title" /* Title */]: "\u{1F451}",
247
- ["trait" /* Trait */]: "\u2744\uFE0F",
248
- ["zone" /* Zone */]: "\u{1F5FA}\uFE0F"
249
- };
250
- function getElementIcon(elementType) {
251
- return ELEMENT_ICONS[elementType];
252
- }
253
- function getElementUnicodeIcon(elementType) {
254
- return ELEMENT_UNICODE_ICONS[elementType];
255
- }
256
224
  var FIELD_SCHEMA = {
257
225
  ability: {
258
226
  // Base fields (shared by all elements)
@@ -429,7 +397,7 @@ var FIELD_SCHEMA = {
429
397
  consequences: { type: "text" },
430
398
  start_date: { type: "number" },
431
399
  end_date: { type: "number" },
432
- triggers: { type: "multi_link", target: "construct" },
400
+ triggers: { type: "multi_link", target: "event" },
433
401
  // Involves
434
402
  characters: { type: "multi_link", target: "character" },
435
403
  objects: { type: "multi_link", target: "object" },
@@ -1220,12 +1188,52 @@ var GameTier = /* @__PURE__ */ ((GameTier2) => {
1220
1188
  GameTier2["DELUXE"] = "deluxe";
1221
1189
  return GameTier2;
1222
1190
  })(GameTier || {});
1191
+
1192
+ // src/icon-utils.ts
1193
+ var PLURAL_TO_SINGULAR = {
1194
+ abilities: "ability" /* Ability */,
1195
+ characters: "character" /* Character */,
1196
+ collectives: "collective" /* Collective */,
1197
+ constructs: "construct" /* Construct */,
1198
+ creatures: "creature" /* Creature */,
1199
+ events: "event" /* Event */,
1200
+ families: "family" /* Family */,
1201
+ institutions: "institution" /* Institution */,
1202
+ languages: "language" /* Language */,
1203
+ laws: "law" /* Law */,
1204
+ locations: "location" /* Location */,
1205
+ maps: "map" /* Map */,
1206
+ markers: "marker" /* Marker */,
1207
+ narratives: "narrative" /* Narrative */,
1208
+ objects: "object" /* Object */,
1209
+ phenomena: "phenomenon" /* Phenomenon */,
1210
+ // irregular plural
1211
+ pins: "pin" /* Pin */,
1212
+ relations: "relation" /* Relation */,
1213
+ species: "species" /* Species */,
1214
+ // same singular/plural
1215
+ titles: "title" /* Title */,
1216
+ traits: "trait" /* Trait */,
1217
+ zones: "zone" /* Zone */
1218
+ };
1219
+ function getElementIcon(type) {
1220
+ const lower = type.toLowerCase();
1221
+ if (lower in PLURAL_TO_SINGULAR) {
1222
+ return ELEMENT_ICONS[PLURAL_TO_SINGULAR[lower]];
1223
+ }
1224
+ const singular = Object.values(ElementType).find(
1225
+ (et) => et.toLowerCase() === lower
1226
+ );
1227
+ if (singular) {
1228
+ return ELEMENT_ICONS[singular];
1229
+ }
1230
+ return "help_outline";
1231
+ }
1223
1232
  // Annotate the CommonJS export names for ESM import in node:
1224
1233
  0 && (module.exports = {
1225
1234
  ELEMENT_ICONS,
1226
1235
  ELEMENT_LABELS,
1227
1236
  ELEMENT_SECTIONS,
1228
- ELEMENT_UNICODE_ICONS,
1229
1237
  ElementType,
1230
1238
  FIELD_SCHEMA,
1231
1239
  GameTier,
@@ -1236,6 +1244,5 @@ var GameTier = /* @__PURE__ */ ((GameTier2) => {
1236
1244
  createElementIds,
1237
1245
  getElementIcon,
1238
1246
  getElementLabel,
1239
- getElementSections,
1240
- getElementUnicodeIcon
1247
+ getElementSections
1241
1248
  });
package/dist/index.mjs CHANGED
@@ -182,36 +182,6 @@ var ELEMENT_ICONS = {
182
182
  ["trait" /* Trait */]: "flaky",
183
183
  ["zone" /* Zone */]: "architecture"
184
184
  };
185
- var ELEMENT_UNICODE_ICONS = {
186
- ["ability" /* Ability */]: "\u2728",
187
- ["character" /* Character */]: "\u{1F464}",
188
- ["collective" /* Collective */]: "\u{1F465}",
189
- ["construct" /* Construct */]: "\u2699\uFE0F",
190
- ["creature" /* Creature */]: "\u{1F43E}",
191
- ["event" /* Event */]: "\u{1F4C5}",
192
- ["family" /* Family */]: "\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}",
193
- ["institution" /* Institution */]: "\u{1F3DB}\uFE0F",
194
- ["language" /* Language */]: "\u{1F4AC}",
195
- ["law" /* Law */]: "\u2696\uFE0F",
196
- ["location" /* Location */]: "\u{1F3F0}",
197
- ["map" /* Map */]: "\u{1F5FA}\uFE0F",
198
- ["marker" /* Marker */]: "\u{1F4CD}",
199
- ["narrative" /* Narrative */]: "\u{1F4D6}",
200
- ["object" /* Object */]: "\u{1F4E6}",
201
- ["phenomenon" /* Phenomenon */]: "\u26A1",
202
- ["pin" /* Pin */]: "\u{1F4CC}",
203
- ["relation" /* Relation */]: "\u{1F517}",
204
- ["species" /* Species */]: "\u{1F9EC}",
205
- ["title" /* Title */]: "\u{1F451}",
206
- ["trait" /* Trait */]: "\u2744\uFE0F",
207
- ["zone" /* Zone */]: "\u{1F5FA}\uFE0F"
208
- };
209
- function getElementIcon(elementType) {
210
- return ELEMENT_ICONS[elementType];
211
- }
212
- function getElementUnicodeIcon(elementType) {
213
- return ELEMENT_UNICODE_ICONS[elementType];
214
- }
215
185
  var FIELD_SCHEMA = {
216
186
  ability: {
217
187
  // Base fields (shared by all elements)
@@ -388,7 +358,7 @@ var FIELD_SCHEMA = {
388
358
  consequences: { type: "text" },
389
359
  start_date: { type: "number" },
390
360
  end_date: { type: "number" },
391
- triggers: { type: "multi_link", target: "construct" },
361
+ triggers: { type: "multi_link", target: "event" },
392
362
  // Involves
393
363
  characters: { type: "multi_link", target: "character" },
394
364
  objects: { type: "multi_link", target: "object" },
@@ -1179,11 +1149,51 @@ var GameTier = /* @__PURE__ */ ((GameTier2) => {
1179
1149
  GameTier2["DELUXE"] = "deluxe";
1180
1150
  return GameTier2;
1181
1151
  })(GameTier || {});
1152
+
1153
+ // src/icon-utils.ts
1154
+ var PLURAL_TO_SINGULAR = {
1155
+ abilities: "ability" /* Ability */,
1156
+ characters: "character" /* Character */,
1157
+ collectives: "collective" /* Collective */,
1158
+ constructs: "construct" /* Construct */,
1159
+ creatures: "creature" /* Creature */,
1160
+ events: "event" /* Event */,
1161
+ families: "family" /* Family */,
1162
+ institutions: "institution" /* Institution */,
1163
+ languages: "language" /* Language */,
1164
+ laws: "law" /* Law */,
1165
+ locations: "location" /* Location */,
1166
+ maps: "map" /* Map */,
1167
+ markers: "marker" /* Marker */,
1168
+ narratives: "narrative" /* Narrative */,
1169
+ objects: "object" /* Object */,
1170
+ phenomena: "phenomenon" /* Phenomenon */,
1171
+ // irregular plural
1172
+ pins: "pin" /* Pin */,
1173
+ relations: "relation" /* Relation */,
1174
+ species: "species" /* Species */,
1175
+ // same singular/plural
1176
+ titles: "title" /* Title */,
1177
+ traits: "trait" /* Trait */,
1178
+ zones: "zone" /* Zone */
1179
+ };
1180
+ function getElementIcon(type) {
1181
+ const lower = type.toLowerCase();
1182
+ if (lower in PLURAL_TO_SINGULAR) {
1183
+ return ELEMENT_ICONS[PLURAL_TO_SINGULAR[lower]];
1184
+ }
1185
+ const singular = Object.values(ElementType).find(
1186
+ (et) => et.toLowerCase() === lower
1187
+ );
1188
+ if (singular) {
1189
+ return ELEMENT_ICONS[singular];
1190
+ }
1191
+ return "help_outline";
1192
+ }
1182
1193
  export {
1183
1194
  ELEMENT_ICONS,
1184
1195
  ELEMENT_LABELS,
1185
1196
  ELEMENT_SECTIONS,
1186
- ELEMENT_UNICODE_ICONS,
1187
1197
  ElementType,
1188
1198
  FIELD_SCHEMA,
1189
1199
  GameTier,
@@ -1194,6 +1204,5 @@ export {
1194
1204
  createElementIds,
1195
1205
  getElementIcon,
1196
1206
  getElementLabel,
1197
- getElementSections,
1198
- getElementUnicodeIcon
1207
+ getElementSections
1199
1208
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
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",