@composable-os/sdk 0.1.0-beta.7 → 0.1.0-beta.9

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.
@@ -1,10 +1,13 @@
1
1
  import type { z } from "zod";
2
+ import type { AllowanceSpec } from "./allowance.ts";
2
3
  import type { AutomationSpec } from "./automation.ts";
3
- import type { CapacitySpec } from "./capacity.ts";
4
+ import type { CapacitySpec, ClaimsSpec } from "./capacity.ts";
4
5
  import type { DocumentPathSpec, DocumentSchema } from "./document.ts";
5
6
  import type { FieldTypeName } from "./field-types.ts";
7
+ import type { RecurringScheduleSpec } from "./recurring.ts";
6
8
  import type { SellableSpec } from "./sellable.ts";
7
9
  import type { StatesSpec } from "./states.ts";
10
+ import type { UniqueSpec } from "./unique.ts";
8
11
  /** The contract version this SDK writes. The host accepts this and the previous version. */
9
12
  export declare const CONTRACT_VERSION = 1;
10
13
  /** Contract versions a host built with this SDK runs (current and previous, ADR 0005). */
@@ -123,6 +126,14 @@ export type FieldSpec = (FieldBase & {
123
126
  * view when a client crops it. Published content's pictures are served to the public.
124
127
  */
125
128
  type: "image";
129
+ }) | (Omit<FieldBase, "default" | "defaultSetting" | "track"> & {
130
+ /**
131
+ * A video from the media library (stage 42, ADR 0475): `{ media, poster? }`, a video held in
132
+ * Cloudflare Stream (a ready one, checked on write) and a picture to show before it plays.
133
+ * Every video needs a token the host signs to play (`media.play`); the id alone plays
134
+ * nothing.
135
+ */
136
+ type: "video";
126
137
  }) | (Omit<FieldBase, "required"> & {
127
138
  type: "formula";
128
139
  /** An expression over fields of the same record. See the SDK README for the grammar. */
@@ -172,8 +183,28 @@ export interface ObjectSpec {
172
183
  capacity?: CapacitySpec;
173
184
  /** Something that can be bought, and what a paid line grants (see SellableSpec, ADR 0435). */
174
185
  sellable?: SellableSpec;
186
+ /**
187
+ * Uses a record holds (a pass, a membership), or a record that spends one (a booking): see
188
+ * AllowanceSpec, ADRs 0493 and 0494. The host counts and refuses a spend past the limit.
189
+ */
190
+ allowance?: AllowanceSpec;
175
191
  /** A fixed state machine (see StatesSpec, ADR 0425). An object has stages or states, not both. */
176
192
  states?: StatesSpec;
193
+ /**
194
+ * A capacity claimant (see ClaimsSpec, ADR 0501): the record's own states hold, take and give
195
+ * back one place on the record its relation `on` points to (a booking on its class).
196
+ */
197
+ claims?: ClaimsSpec;
198
+ /**
199
+ * Uniqueness among live records in some states (see UniqueSpec, ADR 0502): one active booking
200
+ * per Person per class. Refused by the database for every actor.
201
+ */
202
+ unique?: readonly UniqueSpec[];
203
+ /**
204
+ * A weekly schedule that generates dated records of another object (see RecurringScheduleSpec,
205
+ * ADR 0500): a timetable's series and its classes.
206
+ */
207
+ recurring?: RecurringScheduleSpec;
177
208
  /**
178
209
  * The record's owner: a `user` field of this object (ADR 0246, stage 14). Assignment rules set
179
210
  * it when a record is created without one, and stage 14's visibility policies read it.
@@ -217,6 +248,15 @@ export interface ObjectSpec {
217
248
  * may declare it.
218
249
  */
219
250
  customerVia?: CustomerViaSpec;
251
+ /**
252
+ * Who holds access to a record (stage 42, ADR 0477): a customer for whom one of `sources` is
253
+ * live (an enrolment of theirs pointing at it, or at a bundle that lists it). The parts of a
254
+ * document field this object's schema marks `holders` are read only by a holder; everyone
255
+ * else who may read the record reads it without them. The host asks one question for every
256
+ * read and for `media.play`; a block, a hook or a client app is only told the answer. Only
257
+ * shipped extensions and an org's own may declare it.
258
+ */
259
+ access?: AccessSpec;
220
260
  /**
221
261
  * A working copy staff edit and published versions (ADR 0446): `content` names the fields a
222
262
  * version keeps. `record.publish` snapshots them as the next version (a person with the
@@ -565,6 +605,45 @@ export interface CustomerViaSpec {
565
605
  /** Fields of this object its customer may read. */
566
606
  read: readonly string[];
567
607
  }
608
+ /** Who holds access to a record: see `ObjectSpec.access` (ADR 0477). */
609
+ export interface AccessSpec {
610
+ /** Where access comes from. Any one live source is enough. */
611
+ sources: readonly AccessSourceSpec[];
612
+ }
613
+ /**
614
+ * One source of access. A record source (`via`) is a record of another of this extension's
615
+ * objects that declares a customer: the caller's own, in one of `states`, before its `until`,
616
+ * pointing at the record through `field` (an enrolment's `course`) or, with `through`, at a
617
+ * record whose field `through` lists it (an enrolment's `bundle`, whose `courses` name the
618
+ * course). A source of another `kind` is one the host provides (a subscription, stage 32).
619
+ */
620
+ export type AccessSourceSpec = {
621
+ /** `<extension>.<object>`: an object of this extension that declares a customer. */
622
+ via: string;
623
+ /** A relation of `via` to one record of this object, or of the object `through` is on. */
624
+ field: string;
625
+ /**
626
+ * A field of the record `field` points to that lists this object's records: a many
627
+ * relation, or a document whose refs name them. Read from its published version when the
628
+ * public reads it.
629
+ */
630
+ through?: string;
631
+ /** The states of `via` (its `states` behaviour) in which it gives access. */
632
+ states?: readonly string[];
633
+ /** A date or datetime field of `via`: access ends then. Empty is no end. */
634
+ until?: string;
635
+ kind?: undefined;
636
+ } | {
637
+ /**
638
+ * A kind of source the host provides. `subscription` (stage 32a, ADR 0488): the caller
639
+ * holds a running subscription to a plan of `options.plans` (`<extension>.<object>`, an
640
+ * object of this extension whose `sellable` declares `recurring`), and `options.covers`
641
+ * is `"all"`: every live record. Access follows the subscription's holder.
642
+ */
643
+ kind: string;
644
+ options?: Readonly<Record<string, string | number | boolean | readonly string[]>>;
645
+ via?: undefined;
646
+ };
568
647
  /** What every signed-in customer may read: see `ObjectSpec.signedIn` (ADR 0447). */
569
648
  export interface SignedInSpec {
570
649
  read: readonly string[];
@@ -593,6 +672,12 @@ export interface CustomerSpec {
593
672
  field: string;
594
673
  read: readonly string[];
595
674
  write: readonly string[];
675
+ /**
676
+ * Relations whose record the customer must hold access to for any write of theirs (stage 42,
677
+ * ADR 0478): a lesson's progress is written only while its course is theirs. Checked by the host
678
+ * on create and on every update, against the record the row points to.
679
+ */
680
+ requireAccess?: readonly string[];
596
681
  }
597
682
  /** A tool shown as a button on a record page. */
598
683
  export interface RecordActionSpec {
@@ -671,6 +756,12 @@ export interface ExtensionSpec {
671
756
  contractVersion: number;
672
757
  label?: string;
673
758
  description?: string;
759
+ /**
760
+ * Extensions this one needs installed first, by id (stage 42, ADR 0478): Courses requires
761
+ * Programs. The host refuses to install it while one is missing, and installs shipped ones in
762
+ * that order.
763
+ */
764
+ requires?: readonly string[];
674
765
  permissions?: PermissionsSpec;
675
766
  objects?: Record<string, ObjectSpec>;
676
767
  /** Fields added to other objects, keyed by target object (`organisation`, `other.object`). */
@@ -33,7 +33,25 @@ export interface DocumentObjectNode extends NodeBase {
33
33
  private?: true | {
34
34
  unless: string;
35
35
  };
36
+ /**
37
+ * For holders only (stage 42, ADR 0477): removed when someone outside the org who does not
38
+ * hold access to the record reads the document. `true` or `{ unless }` removes the whole object,
39
+ * as `private` does; `{ keys, unless? }` removes only those keys of it (a lesson's video and
40
+ * notes, while its title stays). `unless` names a boolean key of this object that keeps it (a
41
+ * free preview).
42
+ */
43
+ holders?: DocumentHolders;
36
44
  }
45
+ /** What of an object node is for holders only: see `DocumentObjectNode.holders`. */
46
+ export type DocumentHolders = true | {
47
+ unless: string;
48
+ keys?: undefined;
49
+ } | {
50
+ keys: readonly string[];
51
+ unless?: string;
52
+ };
53
+ /** The kinds of media item (stage 42, ADR 0475). */
54
+ export type DocumentMediaKind = "image" | "video" | "file";
37
55
  export interface DocumentArrayNode extends NodeBase {
38
56
  type: "array";
39
57
  of: DocumentNode;
@@ -41,6 +59,12 @@ export interface DocumentArrayNode extends NodeBase {
41
59
  min?: number;
42
60
  /** A key of the listed objects whose values must differ (labels, level numbers). */
43
61
  unique?: string;
62
+ /**
63
+ * With `unique`: the key's values must differ across every list this node holds in the
64
+ * document, not only within one (stage 42: a lesson's key across all sections, since progress
65
+ * is kept by it).
66
+ */
67
+ uniqueAcross?: boolean;
44
68
  }
45
69
  export interface DocumentTextNode extends NodeBase {
46
70
  type: "text";
@@ -83,6 +107,11 @@ export interface DocumentChoiceNode extends NodeBase {
83
107
  export interface DocumentRefNode extends NodeBase {
84
108
  type: "ref";
85
109
  to: string;
110
+ /**
111
+ * For a ref to `media` (stage 42, ADR 0475): the kind of item it takes, checked by the host on
112
+ * write; a video must also be ready. Left out, any live item.
113
+ */
114
+ media?: DocumentMediaKind;
86
115
  }
87
116
  /** One of several object shapes, told apart by the value of `tag`. */
88
117
  export interface DocumentUnionNode extends NodeBase {
@@ -150,16 +179,33 @@ export declare function validateDocument(schema: DocumentSchema, value: unknown,
150
179
  }): DocumentResult;
151
180
  /** "weeks.0.sessions.2: Required", for messages. */
152
181
  export declare function formatDocumentIssue(issue: DocumentIssue): string;
153
- /** Every `ref` in a valid value: the object it names, the id, and where it is. */
154
- export declare function documentRefs(schema: DocumentSchema, value: unknown): {
182
+ /** One `ref` of a value: the object it names, the id, where it is, and a media ref's kind. */
183
+ export interface DocumentRef {
155
184
  to: string;
156
185
  id: string;
157
186
  path: (string | number)[];
158
- }[];
187
+ media?: DocumentMediaKind;
188
+ }
189
+ /** Every `ref` in a valid value: the object it names, the id, and where it is. */
190
+ export declare function documentRefs(schema: DocumentSchema, value: unknown): DocumentRef[];
191
+ /** Who outside the org may read a part of a document (ADR 0477). */
192
+ export type DocumentReach = "all" | "holders" | "private";
193
+ /**
194
+ * The media items a value names, each with who outside the org reads the part it is in: `all`
195
+ * (anyone who may read the field), `holders` (only a reader who holds access to the record) or
196
+ * `private` (no one outside the org). Read from `redactDocument` itself, so it is exactly what the
197
+ * seam shows. An item named in several parts has the widest reach of them.
198
+ */
199
+ export declare function documentMediaReach(schema: DocumentSchema, value: unknown, mediaObject?: string): Map<string, DocumentReach>;
159
200
  /**
160
201
  * The document as someone outside the org may read it: every `private` object removed (from a
161
- * list, its entry; from an object, its key), unless its `unless` key is true. A value that does
162
- * not fit the schema is returned as null: an outsider is never shown what was not checked.
202
+ * list, its entry; from an object, its key), unless its `unless` key is true. Unless `holder` is
203
+ * true (the reader holds access to the record, ADR 0477), every `holders` object is removed the
204
+ * same way and every `holders` key of an object dropped, unless its `unless` key is true. A value
205
+ * that does not fit the schema is returned as null: an outsider is never shown what was not
206
+ * checked.
163
207
  */
164
- export declare function redactDocument(schema: DocumentSchema, value: unknown): unknown;
208
+ export declare function redactDocument(schema: DocumentSchema, value: unknown, options?: {
209
+ holder?: boolean;
210
+ }): unknown;
165
211
  export {};
package/dist/document.js CHANGED
@@ -23,6 +23,11 @@
23
23
  // An object node may be `private`: removed from what a customer or the public reads
24
24
  // (`redactDocument`), unless its `unless` key is true (a coach's note marked as shown to
25
25
  // members). The host does that at the visibility seam; staff read the whole document.
26
+ //
27
+ // An object node may also be for `holders` (stage 42, ADR 0477): removed, or some of its keys
28
+ // removed, from what an outsider reads unless they hold access to the record (the seam's one
29
+ // question, visibility/access.ts) or its `unless` key is true (a lesson marked as a free
30
+ // preview). A `ref` to `media` may name the kind of item it takes (`media: "video"`).
26
31
  /** The most a document may be, in bytes of its JSON, whatever a field declares. */
27
32
  export const DOCUMENT_MAX_BYTES = 524_288;
28
33
  /** A field that declares no `maxBytes`. */
@@ -141,12 +146,15 @@ export function checkDocumentSchema(schema, knownObjects) {
141
146
  };
142
147
  switch (value.type) {
143
148
  case "object": {
144
- expect("fields", "private");
149
+ expect("fields", "private", "holders");
145
150
  object(path, value, depth);
146
151
  break;
147
152
  }
148
153
  case "array": {
149
- expect("of", "max", "min", "unique");
154
+ expect("of", "max", "min", "unique", "uniqueAcross");
155
+ if (value.uniqueAcross !== undefined && (value.uniqueAcross !== true || !value.unique)) {
156
+ add(`${path}.uniqueAcross`, "uniqueAcross is true, beside unique");
157
+ }
150
158
  const max = num("max", { int: true, min: 1, max: DOCUMENT_MAX_LIST });
151
159
  if (value.max === undefined)
152
160
  add(`${path}.max`, "A list declares its most entries (max)");
@@ -223,13 +231,20 @@ export function checkDocumentSchema(schema, knownObjects) {
223
231
  break;
224
232
  }
225
233
  case "ref": {
226
- expect("to");
234
+ expect("to", "media");
227
235
  if (typeof value.to !== "string" || !OBJECT_RE.test(value.to)) {
228
236
  add(`${path}.to`, "A ref names an object: `<extension>.<object>` or a core object");
229
237
  }
230
238
  else if (knownObjects && !knownObjects.has(value.to)) {
231
239
  add(`${path}.to`, `Unknown object "${value.to}"`);
232
240
  }
241
+ if (value.media !== undefined) {
242
+ if (value.to !== "media")
243
+ add(`${path}.media`, "media is for a ref to media");
244
+ else if (!["image", "video", "file"].includes(String(value.media))) {
245
+ add(`${path}.media`, "media is image, video or file");
246
+ }
247
+ }
233
248
  break;
234
249
  }
235
250
  case "union": {
@@ -295,6 +310,27 @@ export function checkDocumentSchema(schema, knownObjects) {
295
310
  add(`${path}.private`, "private is true, or { unless: <a boolean key of this object> }");
296
311
  }
297
312
  }
313
+ const holders = value.holders;
314
+ if (holders !== undefined && holders !== true) {
315
+ const fields = value.fields;
316
+ const shape = isObject(holders) ? holders : null;
317
+ const unless = shape?.unless;
318
+ const keys = shape?.keys;
319
+ const flag = typeof unless === "string" ? fields[unless] : undefined;
320
+ const badUnless = unless !== undefined && (!isObject(flag) || flag.type !== "boolean");
321
+ const badKeys = keys !== undefined &&
322
+ (!Array.isArray(keys) ||
323
+ !keys.length ||
324
+ keys.some((k) => typeof k !== "string" || !Object.hasOwn(fields, k) || k === unless));
325
+ const extra = shape ? Object.keys(shape).filter((k) => k !== "unless" && k !== "keys") : [];
326
+ if (!shape ||
327
+ (unless === undefined && keys === undefined) ||
328
+ badUnless ||
329
+ badKeys ||
330
+ extra.length) {
331
+ add(`${path}.holders`, "holders is true, { unless: <a boolean key> } or { keys: [<keys of this object>], unless? }");
332
+ }
333
+ }
298
334
  };
299
335
  const resolve = (value, seen = new Set()) => {
300
336
  if (!isObject(value))
@@ -333,6 +369,10 @@ export function documentPathNode(schema, spec) {
333
369
  const at = useOf(schema, current);
334
370
  if (at?.type !== "object")
335
371
  return `"${spec.path}" passes through something that is not an object`;
372
+ // A column of the view is read whole: a part for holders only cannot be one (ADR 0477).
373
+ if (at.holders && (at.holders === true || !at.holders.keys || at.holders.keys.includes(key))) {
374
+ return `"${spec.path}" is in a part for holders only, which a column cannot keep from others`;
375
+ }
336
376
  current = at.fields[key];
337
377
  if (!current)
338
378
  return `"${spec.path}" is not in the schema (no "${key}")`;
@@ -391,6 +431,7 @@ export function validateDocument(schema, value, options = {}) {
391
431
  };
392
432
  }
393
433
  const issues = [];
434
+ const acrossLists = new Map();
394
435
  const fault = (path, message) => {
395
436
  if (issues.length < DOCUMENT_MAX_ISSUES)
396
437
  issues.push({ path: [...path], message });
@@ -441,16 +482,28 @@ export function validateDocument(schema, value, options = {}) {
441
482
  fault(path, `At least ${node.min} ${node.min === 1 ? "entry" : "entries"}`);
442
483
  }
443
484
  const seen = new Map();
485
+ // Across every list of this node in the document: the first place each key was used.
486
+ let across = node.uniqueAcross ? acrossLists.get(node) : undefined;
487
+ if (node.uniqueAcross && !across) {
488
+ across = new Map();
489
+ acrossLists.set(node, across);
490
+ }
444
491
  v.slice(0, node.max).forEach((item, i) => {
445
492
  walk(node.of, item, [...path, i], depth + 1);
446
493
  if (node.unique && isObject(item) && item[node.unique] !== undefined) {
447
494
  const key = JSON.stringify(item[node.unique]);
448
495
  const first = seen.get(key);
496
+ const elsewhere = across?.get(key);
449
497
  if (first !== undefined) {
450
498
  fault([...path, i, node.unique], `${JSON.stringify(item[node.unique])} is there twice (also entry ${first})`);
451
499
  }
452
- else
500
+ else if (elsewhere !== undefined) {
501
+ fault([...path, i, node.unique], `${JSON.stringify(item[node.unique])} is used already (at ${elsewhere})`);
502
+ }
503
+ else {
453
504
  seen.set(key, i);
505
+ across?.set(key, [...path, i].join("."));
506
+ }
454
507
  }
455
508
  });
456
509
  return;
@@ -546,22 +599,46 @@ export function validateDocument(schema, value, options = {}) {
546
599
  export function formatDocumentIssue(issue) {
547
600
  return issue.path.length ? `${issue.path.join(".")}: ${issue.message}` : issue.message;
548
601
  }
549
- // --- Reading a value -----------------------------------------------------------------------------
550
602
  /** Every `ref` in a valid value: the object it names, the id, and where it is. */
551
603
  export function documentRefs(schema, value) {
552
604
  const refs = [];
553
605
  visit(schema, value, (node, v, path) => {
554
- if (node.type === "ref" && typeof v === "string")
555
- refs.push({ to: node.to, id: v, path });
606
+ if (node.type === "ref" && typeof v === "string") {
607
+ refs.push({ to: node.to, id: v, path, ...(node.media ? { media: node.media } : {}) });
608
+ }
556
609
  });
557
610
  return refs;
558
611
  }
612
+ /**
613
+ * The media items a value names, each with who outside the org reads the part it is in: `all`
614
+ * (anyone who may read the field), `holders` (only a reader who holds access to the record) or
615
+ * `private` (no one outside the org). Read from `redactDocument` itself, so it is exactly what the
616
+ * seam shows. An item named in several parts has the widest reach of them.
617
+ */
618
+ export function documentMediaReach(schema, value, mediaObject = "media") {
619
+ const ids = (v) => new Set(v === null || v === undefined
620
+ ? []
621
+ : documentRefs(schema, v)
622
+ .filter((r) => r.to === mediaObject)
623
+ .map((r) => r.id));
624
+ const everyone = ids(redactDocument(schema, value, { holder: false }));
625
+ const holders = ids(redactDocument(schema, value, { holder: true }));
626
+ const reach = new Map();
627
+ for (const id of ids(value)) {
628
+ reach.set(id, everyone.has(id) ? "all" : holders.has(id) ? "holders" : "private");
629
+ }
630
+ return reach;
631
+ }
559
632
  /**
560
633
  * The document as someone outside the org may read it: every `private` object removed (from a
561
- * list, its entry; from an object, its key), unless its `unless` key is true. A value that does
562
- * not fit the schema is returned as null: an outsider is never shown what was not checked.
634
+ * list, its entry; from an object, its key), unless its `unless` key is true. Unless `holder` is
635
+ * true (the reader holds access to the record, ADR 0477), every `holders` object is removed the
636
+ * same way and every `holders` key of an object dropped, unless its `unless` key is true. A value
637
+ * that does not fit the schema is returned as null: an outsider is never shown what was not
638
+ * checked.
563
639
  */
564
- export function redactDocument(schema, value) {
640
+ export function redactDocument(schema, value, options = {}) {
641
+ const holder = options.holder === true;
565
642
  if (value === null || value === undefined)
566
643
  return value ?? null;
567
644
  const strip = (node, v, depth) => {
@@ -581,11 +658,24 @@ export function redactDocument(schema, value) {
581
658
  if (!unless || v[unless] !== true)
582
659
  return { keep: false, value: null };
583
660
  }
661
+ // Holders' parts (ADR 0477): for a reader without access, the object or its listed keys.
662
+ let dropped = null;
663
+ const h = shape.holders;
664
+ if (h && !holder) {
665
+ const unless = h === true ? undefined : h.unless;
666
+ const open = unless !== undefined && v[unless] === true;
667
+ if (!open) {
668
+ const keys = h === true ? undefined : h.keys;
669
+ if (!keys)
670
+ return { keep: false, value: null };
671
+ dropped = new Set(keys);
672
+ }
673
+ }
584
674
  const out = {};
585
675
  if (at.type === "union")
586
676
  out[at.tag] = v[at.tag];
587
677
  for (const [key, child] of Object.entries(shape.fields)) {
588
- if (!Object.hasOwn(v, key))
678
+ if (!Object.hasOwn(v, key) || dropped?.has(key))
589
679
  continue;
590
680
  const kept = strip(child, v[key], depth + 1);
591
681
  if (kept.keep)
@@ -1,5 +1,5 @@
1
1
  import type { FormulaType } from "./formula/ast.ts";
2
- export declare const FIELD_TYPES: readonly ["text", "longText", "number", "currency", "percent", "date", "datetime", "boolean", "select", "multiSelect", "relation", "user", "email", "phone", "url", "formula", "document", "timezone", "richText", "slug", "image"];
2
+ export declare const FIELD_TYPES: readonly ["text", "longText", "number", "currency", "percent", "date", "datetime", "boolean", "select", "multiSelect", "relation", "user", "email", "phone", "url", "formula", "document", "timezone", "richText", "slug", "image", "video"];
3
3
  export type FieldTypeName = (typeof FIELD_TYPES)[number];
4
4
  /** What a formula sees when it reads a field of this type (null: not readable from formulas). */
5
5
  export declare function formulaTypeOf(type: FieldTypeName, many?: boolean): Exclude<FormulaType, "null"> | null;
@@ -27,6 +27,9 @@ export const FIELD_TYPES = [
27
27
  "slug",
28
28
  // A picture from the media library, with alt text and a focal point (stage 28, ADR 0444).
29
29
  "image",
30
+ // A video from the media library, held in Cloudflare Stream, played only with a token the host
31
+ // signs (stage 42, ADR 0475).
32
+ "video",
30
33
  ];
31
34
  /** What a formula sees when it reads a field of this type (null: not readable from formulas). */
32
35
  export function formulaTypeOf(type, many = false) {
@@ -58,6 +61,7 @@ export function formulaTypeOf(type, many = false) {
58
61
  case "document":
59
62
  case "richText":
60
63
  case "image":
64
+ case "video":
61
65
  return null;
62
66
  }
63
67
  }
@@ -87,6 +91,7 @@ export const LOSSLESS_TYPE_CHANGES = {
87
91
  richText: [],
88
92
  slug: ["text", "longText"],
89
93
  image: [],
94
+ video: [],
90
95
  };
91
96
  export function isLosslessChange(from, to) {
92
97
  return from === to || LOSSLESS_TYPE_CHANGES[from].includes(to);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { z } from "zod";
2
+ export * from "./allowance.ts";
2
3
  export * from "./automation.ts";
3
4
  export * from "./automation-check.ts";
4
5
  export * from "./capacity.ts";
@@ -8,6 +9,7 @@ export * from "./field-types.ts";
8
9
  export * from "./manifest.ts";
9
10
  export * from "./media.ts";
10
11
  export * from "./permissions.ts";
12
+ export * from "./recurring.ts";
11
13
  export * from "./renamed.ts";
12
14
  export * from "./rich-text.ts";
13
15
  export * from "./rich-text-fixture.ts";
@@ -15,3 +17,4 @@ export { type AutomationRunValue, AutomationStepError, buildAutomationContext, b
15
17
  export * from "./sellable.ts";
16
18
  export * from "./slug.ts";
17
19
  export * from "./states.ts";
20
+ export * from "./unique.ts";
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // import { defineExtension, defineTool, z } from "@composable-os/sdk";
4
4
  // export default defineExtension({ id: "example", version: "1.0.0", contractVersion: 1, ... });
5
5
  export { z } from "zod";
6
+ export * from "./allowance.js";
6
7
  export * from "./automation.js";
7
8
  export * from "./automation-check.js";
8
9
  export * from "./capacity.js";
@@ -12,6 +13,7 @@ export * from "./field-types.js";
12
13
  export * from "./manifest.js";
13
14
  export * from "./media.js";
14
15
  export * from "./permissions.js";
16
+ export * from "./recurring.js";
15
17
  export * from "./renamed.js";
16
18
  export * from "./rich-text.js";
17
19
  export * from "./rich-text-fixture.js";
@@ -19,3 +21,4 @@ export { AutomationStepError, buildAutomationContext, buildContext, OpsCallError
19
21
  export * from "./sellable.js";
20
22
  export * from "./slug.js";
21
23
  export * from "./states.js";
24
+ export * from "./unique.js";