@onlyworlds/sdk 4.32.0 → 4.33.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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.33.0] - 2026-10-19
9
+
10
+ ### Added
11
+ - `FILE_EXTENSIONS` (every extension a file on an element may end in, to its kind: keel's list, `.yml` and
12
+ `.markdown` included) and `fileKindOf(name)` (the kind, or `undefined`), so a file picker's accept list reads
13
+ the SDK's instead of a copy (Atlas, h20 #7841).
14
+
8
15
  ## [4.32.0] - 2026-10-19
9
16
 
10
17
  ### Added
package/dist/index.d.ts CHANGED
@@ -3259,6 +3259,18 @@ declare class OwV2Client {
3259
3259
  ifMatch?: number;
3260
3260
  }): Promise<T>;
3261
3261
  }
3262
+ /**
3263
+ * Every extension a file on an element may end in, to the kind it gives: keel's NAME_EXTS
3264
+ * (files/service.py), `.yml` and `.markdown` included. A file picker's accept list is
3265
+ * `Object.keys(FILE_EXTENSIONS).map((e) => '.' + e)`.
3266
+ */
3267
+ declare const FILE_EXTENSIONS: Readonly<Record<string, OwFileKind>>;
3268
+ /**
3269
+ * The kind a file name's extension gives, read as keel reads it: the last path part, then
3270
+ * what follows its last dot, which must have something before it. `undefined` when there is
3271
+ * none or keel takes no file with it (uploadFile then refuses before any request).
3272
+ */
3273
+ declare function fileKindOf(name: string): OwFileKind | undefined;
3262
3274
 
3263
3275
  /**
3264
3276
  * Canonical element colour palette — four semantic families.
@@ -4203,4 +4215,4 @@ declare class TokenResource {
4203
4215
  getEncryptionInfo(): Promise<EncryptionInfo>;
4204
4216
  }
4205
4217
 
4206
- export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreatedWorldLink, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSeat, type OwSeatCreated, OwSignInError, type OwSignInReason, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWriteDoor, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isAgentDoor, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
4218
+ export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreatedWorldLink, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSeat, type OwSeatCreated, OwSignInError, type OwSignInReason, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWriteDoor, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isAgentDoor, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -635,7 +635,7 @@ var OwV2Client = class {
635
635
  if (typeof name !== "string" || name.trim() === "") {
636
636
  throw new TypeError("createFileTicket needs the file's name, with its extension");
637
637
  }
638
- const kind = req.kind ?? fileKindOf(name);
638
+ const kind = req.kind ?? requireFileKind(name);
639
639
  const body = { name, kind, size };
640
640
  if (req.label !== void 0) body.label = req.label;
641
641
  return this.request("POST", `/${type}/${encodeURIComponent(id)}/files`, { body });
@@ -1148,7 +1148,7 @@ function mintUuid(now = Date.now()) {
1148
1148
  for (let i = 0; i < 256; i++) hex.push((i + 256).toString(16).slice(1));
1149
1149
  return hex[bytes[0]] + hex[bytes[1]] + hex[bytes[2]] + hex[bytes[3]] + "-" + hex[bytes[4]] + hex[bytes[5]] + "-" + hex[bytes[6]] + hex[bytes[7]] + "-" + hex[bytes[8]] + hex[bytes[9]] + "-" + hex[bytes[10]] + hex[bytes[11]] + hex[bytes[12]] + hex[bytes[13]] + hex[bytes[14]] + hex[bytes[15]];
1150
1150
  }
1151
- var FILE_NAME_EXTS = {
1151
+ var FILE_EXTENSIONS = Object.freeze({
1152
1152
  pdf: "pdf",
1153
1153
  txt: "txt",
1154
1154
  md: "md",
@@ -1159,14 +1159,18 @@ var FILE_NAME_EXTS = {
1159
1159
  yml: "yaml",
1160
1160
  toml: "toml",
1161
1161
  zip: "zip"
1162
- };
1162
+ });
1163
1163
  function fileKindOf(name) {
1164
1164
  const base = name.split(/[\\/]/).pop() ?? "";
1165
1165
  const dot = base.lastIndexOf(".");
1166
1166
  const ext = dot > 0 ? base.slice(dot + 1).trim().toLowerCase() : "";
1167
- const kind = Object.prototype.hasOwnProperty.call(FILE_NAME_EXTS, ext) ? FILE_NAME_EXTS[ext] : void 0;
1167
+ return Object.prototype.hasOwnProperty.call(FILE_EXTENSIONS, ext) ? FILE_EXTENSIONS[ext] : void 0;
1168
+ }
1169
+ function requireFileKind(name) {
1170
+ const kind = fileKindOf(name);
1168
1171
  if (!kind) {
1169
- const allowed = Object.keys(FILE_NAME_EXTS).map((e) => `.${e}`).join(" ");
1172
+ const base = name.split(/[\\/]/).pop() ?? "";
1173
+ const allowed = Object.keys(FILE_EXTENSIONS).map((e) => `.${e}`).join(" ");
1170
1174
  throw new TypeError(`Cannot tell the kind of "${base}" from its name: a file on an element must end in one of ${allowed} (or pass opts.kind)`);
1171
1175
  }
1172
1176
  return kind;
@@ -3405,6 +3409,7 @@ export {
3405
3409
  FAMILY_COLORS,
3406
3410
  FAMILY_ORDER,
3407
3411
  FIELD_SCHEMA,
3412
+ FILE_EXTENSIONS,
3408
3413
  GameTier,
3409
3414
  ONLYWORLDS_VERSION,
3410
3415
  OwApiError,
@@ -3431,6 +3436,7 @@ export {
3431
3436
  eraForStep,
3432
3437
  errorFromResponse,
3433
3438
  familyOf,
3439
+ fileKindOf,
3434
3440
  floorDiv,
3435
3441
  floorMod,
3436
3442
  formatDuration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.32.0",
3
+ "version": "4.33.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {