Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ earlier history lives in git log only.

## [Unreleased]

## [4.186.0] - 2026-11-21

### Added

- **`house` on a proposal and on the queue's new-element row**, typed `OwProposalHouse | null` (`charter`, `skill` or `new_charter`): what part of the world's house rules the row would change. A world's Charter and the Objects it names are now changed only by the owner and co-builders, and anyone else proposes (`403` `keeper_only`); onlyworlds.com works the word out for the owner and co-builders and serves `null` to anyone else.

## [4.185.0] - 2026-11-21

### Added
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onlyworlds/sdk",
"version": "4.185.0",
"version": "4.186.0",
"description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type {
OwJoinPreview, OwJoinedMembership, OwAskAnswer, OwPaidBy, OwAllowance, OwAiUse, OwAiMeter, OwAiRefusal, OwFieldsRefusal,OwAiAskAnswer, OwAiSortAnswer, OwAiAskBody, OwAiSortBody, OwMe, OwFrontDoor, OwFrontDoorCharter, OwFrontDoorSkill, OwMySeat, OwReadingAids, OwServedReadingAids, OwReadingAidsCharter, OwReadingAidsGuide, OwReadingAidsDomain, OwReadingAidsHub, OwMember, OwMemberRole, OwWorldLink, OwCreatedWorldLink, OwSeat, OwSeatCreated, OwMemberLenses, OwAccountWorld, OwAccountToken, OwMintedAiToken, OwMintedKey, OwWorldKeyRow, OwWorldKeyMember, OwDraught, OwDraughtCompact, OwDraughtPolicy, OwDraughtComponent, OwDraughtItem, OwDraughtLens, OwWorldLenses, OwWorldLens, OwWorldLensReading, OwJoined, OwAgentJoined, OwPlayerJoined, OwSignedIn,
OwSortRef, OwSortNote, OwSortRow, OwSortMakeRow, OwSortAddToRow, OwSortLinkRow, OwSortAskRow, OwSortAnswer,
OwWriteDoor, OwChangeUpsert, OwChangeDelete, OwDeleteReason, OwHiddenRow, OwResyncReason,
OwProposal, OwProposalState, OwProposalList, OwProposed, OwProposalAccepted, OwProposalConflict, OwProposeInput, OwProposalQuery, OwWorldProposalQuery,
OwProposal, OwProposalState, OwProposalHouse, OwProposalList, OwProposed, OwProposalAccepted, OwProposalConflict, OwProposeInput, OwProposalQuery, OwWorldProposalQuery,
OwProposedNewElement, OwWorldProposalRow, OwWorldProposalList, OwReviewInput, OwReviewed,
OwCreateAccountWorldInput, OwCreatedAccountWorld,
} from './v2';
Expand Down
2 changes: 1 addition & 1 deletion src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type {
OwJoinPreview, OwJoinedMembership, OwAskAnswer, OwPaidBy, OwAllowance, OwAiUse, OwAiMeter, OwAiRefusal, OwFieldsRefusal,OwAiAskAnswer, OwAiSortAnswer, OwAiAskBody, OwAiSortBody, OwMe, OwFrontDoor, OwFrontDoorCharter, OwFrontDoorSkill, OwMySeat, OwReadingAids, OwServedReadingAids, OwReadingAidsCharter, OwReadingAidsGuide, OwReadingAidsDomain, OwReadingAidsHub, OwMember, OwMemberRole, OwWorldLink, OwCreatedWorldLink, OwSeat, OwSeatCreated, OwMemberLenses, OwAccountWorld, OwAccountToken, OwMintedAiToken, OwMintedKey, OwWorldKeyRow, OwWorldKeyMember, OwDraught, OwDraughtCompact, OwDraughtPolicy, OwDraughtComponent, OwDraughtItem, OwDraughtLens, OwWorldLenses, OwWorldLens, OwWorldLensReading, OwJoined, OwAgentJoined, OwPlayerJoined, OwSignedIn,
OwSortRef, OwSortNote, OwSortRow, OwSortMakeRow, OwSortAddToRow, OwSortLinkRow, OwSortAskRow, OwSortAnswer,
OwWriteDoor, OwChangeUpsert, OwChangeDelete, OwDeleteReason, OwHiddenRow, OwResyncReason,
OwProposal, OwProposalState, OwProposalList, OwProposed, OwProposalAccepted, OwProposalConflict, OwProposeInput, OwProposalQuery, OwWorldProposalQuery,
OwProposal, OwProposalState, OwProposalHouse, OwProposalList, OwProposed, OwProposalAccepted, OwProposalConflict, OwProposeInput, OwProposalQuery, OwWorldProposalQuery,
OwProposedNewElement, OwWorldProposalRow, OwWorldProposalList, OwReviewInput, OwReviewed,
OwCreateAccountWorldInput, OwCreatedAccountWorld,
} from './types';
Expand Down
13 changes: 13 additions & 0 deletions src/v2/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,15 @@ export interface OwLinkEdit {
/** A proposal's state: `lapsed` once `expires` has passed (it may still be accepted or declined). */
export type OwProposalState = 'open' | 'lapsed' | 'accepted' | 'declined';

/**
* What part of the world's house rules a queue row would change: `charter`, a Law that carries the
* Charter mark (`x_charter_of`); `skill`, an Object the text of such a Law names; `new_charter`, a
* Law an accept would make a Charter (on a proposal: it sets the mark, and the Law's supertype after
* it is `Charter`; on a new element's row: a new Law that carries the mark). The house rules are
* changed only by the world's owner and co-builders; anyone else proposes (403 `keeper_only`).
*/
export type OwProposalHouse = 'charter' | 'skill' | 'new_charter';

/**
* A proposed change to an element (the document's `Proposal`): a record kept beside
* the element, never in its body. The element does not change until the world's owner or a
Expand All @@ -424,6 +433,8 @@ export interface OwProposal {
element_type: string;
/** The element's id. */
element_id: string;
/** The part of the house rules this proposal would change, null for anything else. Read when the row is served, as the world stands then; worked out only for the world's owner and co-builders, null to any other reader. */
house: OwProposalHouse | null;
state: OwProposalState;
/**
* What the proposal changes, and only that: the proposed values of the fields (schema
Expand Down Expand Up @@ -484,6 +495,8 @@ export interface OwProposedNewElement {
element_type: string;
/** The element's id, as `id`. */
element_id: string;
/** `new_charter` when the new element is a Law that carries the Charter mark, `skill` when it is an Object a marked Law's text names, else null. Worked out only for the world's owner and co-builders, null to any other reader. */
house: OwProposalHouse | null;
/** open; lapsed once the mark's `expires` has passed (it may still be accepted or declined). Never accepted or declined: a settled mark leaves the queue. */
state: 'open' | 'lapsed';
/** The mark's own `by`, the writer's word for who proposed it: a claim, never a record of who wrote the element or the mark (show it as `OwProposedMark.by` says); null when it names nobody. */
Expand Down
19 changes: 11 additions & 8 deletions test/proposals.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ const API = 'https://www.onlyworlds.com/api/v2';
const EL = '018f0000-0000-7000-8000-0000000000e1';
const PID = '018f0000-0000-7000-8000-0000000000a1';

/** One row as the document's Proposal component gives it: all nineteen keys (kind and omitted). */
/** One row as the document's Proposal component gives it: all twenty keys (kind, omitted and house). */
const PROPOSAL = {
kind: 'proposal', id: PID, element_type: 'location', element_id: EL, state: 'open',
kind: 'proposal', id: PID, element_type: 'location', element_id: EL, house: null, state: 'open',
fields: { description: 'A harbour town.' }, omitted: [], base: { description: '' }, base_seq: 41,
evidence: 'Chapter 3 names the harbour.', expires: '2026-11-21T16:00:00Z',
by: '018f0000-0000-7000-8000-0000000000b1', via: 'api', client: 'sdk',
decided_by: null, decided_at: null, decline_reason: null,
created_at: '2026-10-22T16:00:00Z', updated_at: '2026-10-22T16:00:00Z',
};
const LIST = { data: [PROPOSAL], has_more: true, next_cursor: 'c2' };
/** A queue row for a new element written as proposed (the document's ProposedNewElement): all ten keys. */
/** A queue row for a new element written as proposed (the document's ProposedNewElement): all eleven keys. */
const NEW_EL = '018f0000-0000-7000-8000-0000000000e2';
const NEW_ELEMENT_ROW = {
kind: 'new_element', id: NEW_EL, element_type: 'character', element_id: NEW_EL, state: 'open',
kind: 'new_element', id: NEW_EL, element_type: 'character', element_id: NEW_EL, house: null, state: 'open',
by: '018f0000-0000-7000-8000-0000000000b1', evidence: 'Met her in chapter 4.', expires: '2026-11-22',
created_at: '2026-10-23T07:00:00Z', updated_at: '2026-10-23T07:00:00Z',
};
Expand Down Expand Up @@ -399,24 +399,27 @@ test('every proposal options object refuses an unknown key before sending', asyn

// -- the published types -----------------------------------------------------

test('the published types: OwProposal has the document\'s nineteen keys, the list and the 202 body theirs, the world its switch', () => {
test('the published types: OwProposal has the document\'s twenty keys, the list and the 202 body theirs, the world its switch', () => {
const all = readFileSync(new URL('../dist/index.d.ts', import.meta.url), 'utf8');
const block = (name) => {
const at = all.indexOf(`interface ${name} {`);
assert.ok(at >= 0, `${name} is declared`);
return all.slice(at, all.indexOf('\n}', at));
};
const keys = (src) => [...src.matchAll(/^\s{4}(\w+)\??:/gm)].map((m) => m[1]);
assert.deepEqual(keys(block('OwProposal')), ['kind', 'id', 'element_type', 'element_id', 'state', 'fields', 'omitted', 'base', 'base_seq', 'evidence',
assert.deepEqual(keys(block('OwProposal')), ['kind', 'id', 'element_type', 'element_id', 'house', 'state', 'fields', 'omitted', 'base', 'base_seq', 'evidence',
'expires', 'by', 'via', 'client', 'decided_by', 'decided_at', 'decline_reason', 'created_at', 'updated_at']);
assert.match(block('OwProposal'), /\bkind: 'proposal';/);
assert.match(block('OwProposal'), /\bomitted: string\[\];/);
assert.match(block('OwProposal'), /\bstate: OwProposalState;/);
// The queue's new-element row, its ten keys, and the queue a union told apart by kind
assert.deepEqual(keys(block('OwProposedNewElement')), ['kind', 'id', 'element_type', 'element_id', 'state', 'by', 'evidence',
assert.match(block('OwProposal'), /\bhouse: OwProposalHouse \| null;/);
assert.match(all, /type OwProposalHouse = 'charter' \| 'skill' \| 'new_charter';/);
// The queue's new-element row, its eleven keys, and the queue a union told apart by kind
assert.deepEqual(keys(block('OwProposedNewElement')), ['kind', 'id', 'element_type', 'element_id', 'house', 'state', 'by', 'evidence',
'expires', 'created_at', 'updated_at']);
assert.match(block('OwProposedNewElement'), /\bkind: 'new_element';/);
assert.match(block('OwProposedNewElement'), /\bstate: 'open' \| 'lapsed';/);
assert.match(block('OwProposedNewElement'), /\bhouse: OwProposalHouse \| null;/);
// The mark's evidence and expires are served as stored, any JSON value (a list, a number, an object)
assert.match(block('OwProposedNewElement'), /\bevidence: unknown;/);
assert.match(block('OwProposedNewElement'), /\bexpires: unknown;/);
Expand Down