@composable-os/sdk 0.1.0-beta.10 → 0.1.0-beta.13

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.
Files changed (105) hide show
  1. package/dist/acknowledge.d.ts +38 -0
  2. package/dist/acknowledge.js +30 -0
  3. package/dist/agreements.d.ts +80 -0
  4. package/dist/agreements.js +109 -0
  5. package/dist/allowance.d.ts +47 -5
  6. package/dist/allowance.js +59 -4
  7. package/dist/automation-check.d.ts +6 -1
  8. package/dist/automation-check.js +93 -8
  9. package/dist/automation.d.ts +62 -4
  10. package/dist/automation.js +32 -9
  11. package/dist/behaviour.js +25 -6
  12. package/dist/calendar-entry.d.ts +97 -0
  13. package/dist/calendar-entry.js +180 -0
  14. package/dist/capacity.d.ts +69 -0
  15. package/dist/capacity.js +63 -2
  16. package/dist/checklists.d.ts +41 -0
  17. package/dist/checklists.js +75 -0
  18. package/dist/contract.d.ts +527 -26
  19. package/dist/contract.js +21 -3
  20. package/dist/discount.d.ts +135 -0
  21. package/dist/discount.js +281 -0
  22. package/dist/document.d.ts +2 -1
  23. package/dist/document.js +2 -1
  24. package/dist/field-types.d.ts +1 -1
  25. package/dist/field-types.js +5 -0
  26. package/dist/formula/compile.d.ts +15 -0
  27. package/dist/formula/compile.js +9 -0
  28. package/dist/index.d.ts +17 -0
  29. package/dist/index.js +17 -0
  30. package/dist/intake.d.ts +134 -0
  31. package/dist/intake.js +239 -0
  32. package/dist/journey-signals.d.ts +89 -0
  33. package/dist/journey-signals.js +151 -0
  34. package/dist/manifest.d.ts +1060 -60
  35. package/dist/manifest.js +1111 -61
  36. package/dist/mine.d.ts +45 -0
  37. package/dist/mine.js +119 -0
  38. package/dist/occupies.d.ts +64 -0
  39. package/dist/occupies.js +122 -0
  40. package/dist/questions.d.ts +179 -0
  41. package/dist/questions.js +514 -0
  42. package/dist/recurring.d.ts +33 -4
  43. package/dist/recurring.js +50 -3
  44. package/dist/restricted-fields.d.ts +15 -0
  45. package/dist/restricted-fields.js +97 -0
  46. package/dist/rich-text.d.ts +22 -0
  47. package/dist/rich-text.js +91 -0
  48. package/dist/routine-mail.d.ts +400 -0
  49. package/dist/routine-mail.js +955 -0
  50. package/dist/runtime.d.ts +5 -11
  51. package/dist/runtime.js +21 -11
  52. package/dist/screens.d.ts +3 -0
  53. package/dist/screens.js +74 -0
  54. package/dist/sellable.d.ts +231 -2
  55. package/dist/sellable.js +342 -1
  56. package/dist/slug.d.ts +2 -0
  57. package/dist/slug.js +6 -2
  58. package/dist/staffed.d.ts +178 -0
  59. package/dist/staffed.js +287 -0
  60. package/dist/states.d.ts +74 -4
  61. package/dist/states.js +154 -58
  62. package/dist/stock.d.ts +129 -0
  63. package/dist/stock.js +205 -0
  64. package/dist/team.d.ts +28 -0
  65. package/dist/team.js +52 -0
  66. package/dist/testing.d.ts +22 -1
  67. package/dist/testing.js +47 -5
  68. package/dist/worked-on.d.ts +42 -0
  69. package/dist/worked-on.js +79 -0
  70. package/package.json +9 -1
  71. package/src/acknowledge.ts +100 -0
  72. package/src/agreements.ts +185 -0
  73. package/src/allowance.ts +98 -8
  74. package/src/automation-check.ts +120 -9
  75. package/src/automation.ts +78 -10
  76. package/src/behaviour.ts +26 -6
  77. package/src/calendar-entry.ts +258 -0
  78. package/src/capacity.ts +103 -2
  79. package/src/checklists.ts +118 -0
  80. package/src/contract.ts +514 -27
  81. package/src/discount.ts +408 -0
  82. package/src/document.ts +4 -2
  83. package/src/field-types.ts +5 -0
  84. package/src/formula/compile.ts +10 -0
  85. package/src/index.ts +17 -0
  86. package/src/intake.ts +380 -0
  87. package/src/journey-signals.ts +215 -0
  88. package/src/manifest.ts +1313 -66
  89. package/src/mine.ts +161 -0
  90. package/src/occupies.ts +192 -0
  91. package/src/questions.ts +681 -0
  92. package/src/recurring.ts +90 -9
  93. package/src/restricted-fields.ts +129 -0
  94. package/src/rich-text.ts +112 -0
  95. package/src/routine-mail.ts +1272 -0
  96. package/src/runtime.ts +25 -12
  97. package/src/screens.ts +91 -0
  98. package/src/sellable.ts +595 -1
  99. package/src/slug.ts +7 -2
  100. package/src/staffed.ts +474 -0
  101. package/src/states.ts +220 -64
  102. package/src/stock.ts +332 -0
  103. package/src/team.ts +83 -0
  104. package/src/testing.ts +70 -6
  105. package/src/worked-on.ts +134 -0
package/dist/runtime.d.ts CHANGED
@@ -20,6 +20,10 @@ export interface RawHostModules {
20
20
  extract: HostFn;
21
21
  classify: HostFn;
22
22
  };
23
+ /** `codemode:routine-mail` (ADR 0590). */
24
+ "routine-mail"?: {
25
+ send: HostFn;
26
+ };
23
27
  /** `codemode:<gatekeeper>` modules, by gatekeeper name. */
24
28
  [gatekeeper: string]: Record<string, HostFn> | undefined;
25
29
  }
@@ -45,17 +49,7 @@ export type RunResponse = {
45
49
  };
46
50
  };
47
51
  /** What `codemode:ops`'s `call` returns. */
48
- export type OpsReply = {
49
- ok: true;
50
- value: unknown;
51
- } | {
52
- ok: false;
53
- error: {
54
- code: string;
55
- message: string;
56
- details?: unknown;
57
- };
58
- };
52
+ export type OpsReply = RunResponse;
59
53
  /** Thrown by `ctx.ops.call` when the operation fails; `code` is the pipeline's error code. */
60
54
  export declare class OpsCallError extends Error {
61
55
  readonly code: string;
package/dist/runtime.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // `ctx` built from those modules; a module the extension did not declare is absent, and using it
4
4
  // throws.
5
5
  import { durationMs, notificationInput, } from "./automation.js";
6
+ import { DEFAULT_WAIT_TIMEOUT, NOTIFY_OPERATION } from "./automation-check.js";
6
7
  import { toManifest } from "./manifest.js";
7
8
  /** Thrown by `ctx.ops.call` when the operation fails; `code` is the pipeline's error code. */
8
9
  export class OpsCallError extends Error {
@@ -15,6 +16,13 @@ export class OpsCallError extends Error {
15
16
  this.details = details;
16
17
  }
17
18
  }
19
+ // The host answers with an envelope so error codes survive the isolate boundary.
20
+ function unwrap(reply) {
21
+ const r = reply;
22
+ if (r.ok)
23
+ return r.value;
24
+ throw new OpsCallError(r.error.code, r.error.message, r.error.details);
25
+ }
18
26
  function missing(name) {
19
27
  throw new Error(`Host module "${name}" is not declared. Add "${name}" to permissions.modules in defineExtension.`);
20
28
  }
@@ -32,11 +40,7 @@ export function buildContext(extension, raw, pending = [], caller) {
32
40
  const ops = raw.ops
33
41
  ? {
34
42
  call: async (operation, input) => {
35
- // The host answers with an envelope so error codes survive the isolate boundary.
36
- const reply = (await raw.ops?.call(operation, input ?? {}));
37
- if (reply.ok)
38
- return reply.value;
39
- throw new OpsCallError(reply.error.code, reply.error.message, reply.error.details);
43
+ return unwrap(await raw.ops?.call(operation, input ?? {}));
40
44
  },
41
45
  }
42
46
  : absent("ops");
@@ -67,6 +71,14 @@ export function buildContext(extension, raw, pending = [], caller) {
67
71
  classify: (text, labels) => raw.ai?.classify(text, labels),
68
72
  }
69
73
  : absent("ai");
74
+ const routine = raw["routine-mail"];
75
+ const routineMail = routine?.send
76
+ ? {
77
+ send: async (input) => {
78
+ return unwrap(await routine.send?.(input));
79
+ },
80
+ }
81
+ : absent("routine-mail");
70
82
  const gatekeeper = (name) => {
71
83
  const mod = raw[name];
72
84
  if (!mod?.call)
@@ -74,10 +86,7 @@ export function buildContext(extension, raw, pending = [], caller) {
74
86
  return {
75
87
  connections: () => mod.connections?.(),
76
88
  call: async (connectionId, resource, method, ...args) => {
77
- const reply = (await mod.call?.(connectionId, resource, method, args));
78
- if (reply.ok)
79
- return reply.value;
80
- throw new OpsCallError(reply.error.code, reply.error.message, reply.error.details);
89
+ return unwrap(await mod.call?.(connectionId, resource, method, args));
81
90
  },
82
91
  types: (connectionId, resource) => mod.types?.(connectionId, resource),
83
92
  };
@@ -89,6 +98,7 @@ export function buildContext(extension, raw, pending = [], caller) {
89
98
  log,
90
99
  ai,
91
100
  gatekeeper: gatekeeper,
101
+ routineMail,
92
102
  ...(caller ? { caller: Object.freeze({ ...caller }) } : {}),
93
103
  };
94
104
  }
@@ -176,7 +186,7 @@ export function buildAutomationContext(extension, raw, event, pending = [], curr
176
186
  const n = (counts.get(step) ?? 0) + 1;
177
187
  counts.set(step, n);
178
188
  const input = notificationInput(event, to, message, `${step}:${n}`);
179
- const out = (await base.ops.call("notification.send", input));
189
+ const out = (await base.ops.call(NOTIFY_OPERATION, input));
180
190
  return { sent: typeof out?.sent === "number" ? out.sent : 0 };
181
191
  },
182
192
  };
@@ -280,7 +290,7 @@ export async function runAutomation(extension, request, raw) {
280
290
  const r = replayed(name, "waitForEvent");
281
291
  if (r)
282
292
  return r.value ?? null;
283
- const timeoutMs = durationMs(declaredWait.timeout ?? "7 days");
293
+ const timeoutMs = durationMs(declaredWait.timeout ?? DEFAULT_WAIT_TIMEOUT);
284
294
  if (test) {
285
295
  testSteps.push({ name, kind: "waitForEvent", skippedMs: timeoutMs });
286
296
  return null;
@@ -0,0 +1,3 @@
1
+ import type { ExtensionManifest } from "./manifest.ts";
2
+ /** The gate fingerprint of a manifest's screens, or null when it declares none. */
3
+ export declare function screenGateFingerprint(m: Partial<ExtensionManifest>): string | null;
@@ -0,0 +1,74 @@
1
+ /** JSON with object keys sorted, so the same manifest gives the same string. */
2
+ function canonical(value) {
3
+ if (Array.isArray(value))
4
+ return `[${value.map(canonical).join(",")}]`;
5
+ if (value && typeof value === "object") {
6
+ const entries = Object.entries(value)
7
+ .filter(([, v]) => v !== undefined)
8
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
9
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(",")}}`;
10
+ }
11
+ return JSON.stringify(value ?? null);
12
+ }
13
+ const sorted = (list) => [...(list ?? [])].sort();
14
+ /** The gate fingerprint of a manifest's screens, or null when it declares none. */
15
+ export function screenGateFingerprint(m) {
16
+ const screens = m.screens ?? {};
17
+ if (!Object.keys(screens).length)
18
+ return null;
19
+ const toolNames = new Set(Object.values(screens).flatMap((s) => s.opens ?? []));
20
+ const tools = Object.fromEntries([...toolNames].sort().map((name) => {
21
+ const tool = m.tools?.[name];
22
+ return [
23
+ name,
24
+ tool
25
+ ? {
26
+ risk: tool.risk,
27
+ audiences: sorted(tool.audiences ?? ["staff"]),
28
+ permission: sorted(tool.permission === undefined
29
+ ? []
30
+ : typeof tool.permission === "string"
31
+ ? [tool.permission]
32
+ : tool.permission),
33
+ humanOnly: tool.humanOnly === true,
34
+ grantLiftsRoleLimits: tool.grantLiftsRoleLimits === true,
35
+ // ADR 0652: only when set, so a pack declaring neither keeps its fingerprint.
36
+ ...(tool.anyStaff ? { anyStaff: true } : {}),
37
+ ...(tool.corePermission ? { corePermission: tool.corePermission } : {}),
38
+ }
39
+ : null,
40
+ ];
41
+ }));
42
+ return canonical({
43
+ id: m.id,
44
+ screens: Object.fromEntries(Object.entries(screens).map(([key, s]) => [
45
+ key,
46
+ {
47
+ label: s.label,
48
+ block: s.block,
49
+ export: s.export,
50
+ nav: s.nav ? { group: s.nav.group, order: s.nav.order ?? null } : null,
51
+ opens: [...(s.opens ?? [])],
52
+ writes: [...(s.writes ?? [])],
53
+ record: s.record ? { object: s.record.object, as: s.record.as } : null,
54
+ },
55
+ ])),
56
+ tools,
57
+ restricted: sorted(m.restricted),
58
+ grantable: sorted(m.grantable),
59
+ roles: Object.fromEntries(Object.entries(m.roles ?? {})
60
+ .sort(([a], [b]) => (a < b ? -1 : 1))
61
+ .map(([name, r]) => [
62
+ name,
63
+ {
64
+ permissions: sorted(r.permissions),
65
+ read: sorted(r.read),
66
+ today: r.today ?? null,
67
+ // Left out when absent, so a role without it keeps its fingerprint (ADR 0889).
68
+ looksAfter: r.looksAfter,
69
+ // Left out when absent too (ADR 0755).
70
+ mine: r.mine,
71
+ },
72
+ ])),
73
+ });
74
+ }
@@ -98,6 +98,163 @@ export interface SellableSpec {
98
98
  * "sign_in"`). Such a line holds one, and an order at most one such line. Not on a plan.
99
99
  */
100
100
  onePerPerson?: string;
101
+ /**
102
+ * A paid line moves a record that already exists (stage 31a step 8, ADR 0560), see MovesSpec.
103
+ * A record of such an object is bought once, when it is made: `order.startHeld` makes it in
104
+ * `held` and starts its order in one batch. It is never put on `order.start`. Not with
105
+ * `grants`, `deposit`, `recurring`, `onePerPerson`, `maxPerOrder` or `saleWindow`.
106
+ */
107
+ moves?: MovesSpec;
108
+ /**
109
+ * What kind of sale this is in the finance reports, and when its money is earned (stage 52,
110
+ * ADR 0792), see FinanceSpec. Left out: category `other`, earned `at_sale`.
111
+ */
112
+ finance?: FinanceSpec;
113
+ /**
114
+ * The records are goods (stage 37, ADR 0682): things handed over or sent (a variant of an item
115
+ * in a shop), see GoodsSpec. An order with goods needs a delivery (`delivery`), and each goods
116
+ * line must be sold in the order's channel. Not with `deposit`, `recurring`, `moves` or
117
+ * `delivery`.
118
+ */
119
+ goods?: GoodsSpec;
120
+ /**
121
+ * The records are ways of getting goods to the buyer (stage 37, ADR 0682): a delivery option,
122
+ * see DeliverySpec. Never a line of `lines`: the buyer chooses one in `order.start`'s and
123
+ * `order.quote`'s `delivery`, and the host prices it (ADR 0685). Not with `goods`, `deposit`,
124
+ * `recurring`, `moves`, `onePerPerson` or `maxPerOrder` (one per order), nor beside `stock`.
125
+ */
126
+ delivery?: DeliverySpec;
127
+ }
128
+ /** Where goods are sold (stage 37 decision 3, ADR 0682): a select field holds one of these. */
129
+ export declare const SOLD_IN: readonly ["online", "in_person", "both"];
130
+ export type SoldIn = (typeof SOLD_IN)[number];
131
+ /** How a delivery option gets goods to the buyer (ADR 0682). */
132
+ export declare const DELIVERY_KINDS: readonly ["post", "collect", "here"];
133
+ export type DeliveryKind = (typeof DELIVERY_KINDS)[number];
134
+ /**
135
+ * Goods (ADR 0682). Every order with goods has a channel the host works out, never the caller's:
136
+ * a `post` or `collect` delivery is `online`, a `here` delivery ("take it now") is `in_person`.
137
+ *
138
+ * - `soldIn`: where a record is sold: a select field whose values are among `online`,
139
+ * `in_person` and `both`, of this object or through up to two relations (`item.whereSold`: a
140
+ * variant is sold where its item is). Left out or empty: both. A line not sold in the order's
141
+ * channel is refused (`rule: "not_sold_here"`), on every path.
142
+ */
143
+ export interface GoodsSpec {
144
+ soldIn?: string;
145
+ }
146
+ /**
147
+ * A delivery option (ADR 0682, priced by ADR 0685). A record is one way of getting an order's
148
+ * goods to the buyer; its object is sellable, so it has a price (which may be 0), a tax code and
149
+ * what a paid line grants (a shipment to pack, for `post` and `collect`; nothing is granted for a
150
+ * `here` record).
151
+ *
152
+ * - `kind`: a select field whose values are among `post` (an address is needed, in one of the
153
+ * option's countries), `collect` (at a place the record says; no address) and `here` (take it
154
+ * now, in person; no address).
155
+ * - `freeOver`: a currency or number field: when the goods on the order cost at least this
156
+ * (before the delivery), the delivery costs nothing. Empty: never free.
157
+ * - `countries`: a text field: the two-letter country codes (ISO 3166-1) a `post` record posts
158
+ * to, separated by commas or spaces; or `*`, everywhere no other post option of the object
159
+ * names. Empty: it posts nowhere yet.
160
+ * - `active`: a boolean field: a record with it off cannot be chosen.
161
+ */
162
+ export interface DeliverySpec {
163
+ kind: string;
164
+ freeOver?: string;
165
+ countries?: string;
166
+ active?: string;
167
+ }
168
+ /** How a sale's money is earned (ADR 0792), as the Unearned report reads it. */
169
+ export declare const EARNED: readonly ["at_sale", "over_period", "per_use", "at_date"];
170
+ export type Earned = (typeof EARNED)[number];
171
+ /**
172
+ * What kind of sale a sellable object is in the finance reports (stage 52, ADR 0792). It only
173
+ * labels the object's own sales: it prices nothing, grants nothing and moves no money. Which way
174
+ * the books treat a sale is the business's accountant's call; this says what the reports show.
175
+ *
176
+ * - `category`: the kind of sale its lines are counted under in Sales, Tax, Refunds and the book
177
+ * entries' `sales:<key>` and `refunds:<key>` headings. `key` is stable (lower case, digits and
178
+ * `_`); `label` is what the reports call it until an admin renames it. Two objects with the same
179
+ * key are one category, so this extension gives them one label.
180
+ * - `earned`: when the money is earned, for the Unearned report (cash is counted when it moved,
181
+ * whatever this says):
182
+ * - `at_sale`: when it is paid (a course, goods);
183
+ * - `over_period`: day by day over the order's period, from its start to its end (a plan's
184
+ * paid period); only on a plan (`recurring`);
185
+ * - `per_use`: as the uses of what a paid line grants are spent, the rest when it expires (a
186
+ * class pass); only when `grants` grants an object that holds uses (`allowance.holds`);
187
+ * - `at_date`: on the date in `at` (an event's start).
188
+ * - `at`: with `at_date`, a date or datetime field of this object, or `<relation>.<field>` through
189
+ * up to two relations (`event.startsAt`, `class.startsAt`).
190
+ *
191
+ * A line whose object issues stored value or a voucher (stage 34) is held for customers, not a
192
+ * sale, whatever it declares.
193
+ */
194
+ export interface FinanceSpec {
195
+ category?: {
196
+ key: string;
197
+ label: string;
198
+ };
199
+ earned?: Earned;
200
+ at?: string;
201
+ }
202
+ /** What `sellable.finance` comes to when it, or a part of it, is left out (ADR 0792). */
203
+ export declare const FINANCE_DEFAULTS: {
204
+ readonly category: {
205
+ readonly key: "other";
206
+ readonly label: "Other";
207
+ };
208
+ readonly earned: "at_sale";
209
+ };
210
+ /** A sellable object's finance declaration with its defaults filled (ADR 0792). */
211
+ export declare function sellableFinance(finance: FinanceSpec | undefined): {
212
+ category: {
213
+ key: string;
214
+ label: string;
215
+ };
216
+ earned: Earned;
217
+ at?: string;
218
+ };
219
+ /**
220
+ * What an order does to the record it was started for (ADR 0560): a drop-in booking held while
221
+ * its order is unpaid. The host makes every move, as the host, in the batch that moves the order.
222
+ *
223
+ * - `held`: the state `order.startHeld` makes the record in (`states.create.in` lets the host,
224
+ * and only the host, create it there). A capacity claimant holds its place in it.
225
+ * - `paid`: the order is paid: the record moves `held` -> `paid`.
226
+ * - `expired`: the order expired or was cancelled unpaid: `held` -> `expired`, a final state.
227
+ * A record that leaves `held` any other way (a class the gym cancels) cancels its unpaid order.
228
+ * - `refund`: states that give the money back. A record whose order is paid entering one of them
229
+ * queues the order's refund for a person with `orders:refund` to approve (never an AI).
230
+ * - `price`: where the price of one is read when the record is made: a number field through up
231
+ * to two relations (`class.classType.dropInPrice`), else the extension's number setting. The
232
+ * host writes it into the read-only `price` field, and the order's line is priced from it.
233
+ * - `title`: the order line's title, a text field through up to two relations (`class.title`).
234
+ * - `order`: a read-only text field the host writes the order's id into.
235
+ * - `guest`: a buyer who is not signed in is matched to no Person before payment: their record is
236
+ * held with its customer field empty (so it is no one's, blocks no one's own, and tells the
237
+ * buyer nothing about who has that address), and is given its Person when the payment is
238
+ * verified, by the rule a guest's order uses. The customer field must not be `required`; the
239
+ * host keeps it set in every state but `held`. Without it, a guest cannot buy the object.
240
+ * - `holdCap`: a number setting of the extension: the percent of the claimed record's places that
241
+ * unpaid guest holds may take at once (at least one). Over it a guest is told to try again soon.
242
+ */
243
+ export interface MovesSpec {
244
+ held: string;
245
+ paid: string;
246
+ expired: string;
247
+ refund?: readonly string[];
248
+ price?: {
249
+ field?: string;
250
+ setting?: string;
251
+ };
252
+ title?: string;
253
+ order?: string;
254
+ guest?: boolean;
255
+ holdCap?: {
256
+ setting: string;
257
+ };
101
258
  }
102
259
  /**
103
260
  * How a plan recurs (ADR 0485). The payment provider charges every `interval` on its own schedule;
@@ -131,7 +288,34 @@ export interface RecurringSpec {
131
288
  * `sellable.recurring`, and its `grants` is what the subscription gives while it runs.
132
289
  */
133
290
  grants?: RecurringGrantSpec;
291
+ /**
292
+ * Whether staff may pause a subscription to the plan (stage 32b, decision 10, ADR 0531), and
293
+ * for how long: `minDays` and `maxDays` name number fields of the plan holding the shortest and
294
+ * longest pause the company allows (empty: 1 day, and 366 days, the most the host asks the
295
+ * provider for). Left out, a subscription to the plan is never paused. Only staff pause, with
296
+ * `subscriptions:manage`, as a person; while paused nothing is charged, granted or spent.
297
+ */
298
+ pause?: {
299
+ minDays?: string;
300
+ maxDays?: string;
301
+ };
302
+ /**
303
+ * A cooling-off period (stage 44 step 7, decision 11, ADR 0647): `setting` names a number setting
304
+ * of this extension holding whole days (0: off), which a person changes (`personApproves`),
305
+ * between 0 and `MAX_COOLING_OFF_DAYS`. A new member (a subscription started here without a
306
+ * continuation offer) may end their subscription within that many days of the provider-confirmed
307
+ * start, counted in the business's time zone to the end of the last day, for a full refund of
308
+ * what they paid; each refund waits for a person with `orders:refund` (ADR 0429). Once per
309
+ * holder. The days in force when a subscription started are kept with it: a setting shortened
310
+ * later never shortens that member's window. What any law requires is the business's to
311
+ * confirm; the platform only holds the number.
312
+ */
313
+ coolingOff?: {
314
+ setting: string;
315
+ };
134
316
  }
317
+ /** The longest cooling-off period the host keeps (days); a longer setting reads as this. */
318
+ export declare const MAX_COOLING_OFF_DAYS = 90;
135
319
  /** Where a field of what a subscription grants gets its value (see RecurringSpec.grants). */
136
320
  export type RecurringGrantSource = "item" | `item.${string}` | "subscription" | "subscription.holder" | "subscription.payer";
137
321
  /** The host's subscription states a grant follows (ADR 0485). */
@@ -184,14 +368,14 @@ export declare const sellableManifestSchema: z.ZodObject<{
184
368
  grants: z.ZodOptional<z.ZodObject<{
185
369
  object: z.ZodString;
186
370
  set: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
187
- item: "item";
371
+ code: "code";
188
372
  order: "order";
373
+ item: "item";
189
374
  "order.person": "order.person";
190
375
  "order.email": "order.email";
191
376
  line: "line";
192
377
  "line.title": "line.title";
193
378
  "line.unitPrice": "line.unitPrice";
194
- code: "code";
195
379
  }>, z.ZodString]>>;
196
380
  void: z.ZodString;
197
381
  valid: z.ZodOptional<z.ZodObject<{
@@ -201,6 +385,22 @@ export declare const sellableManifestSchema: z.ZodObject<{
201
385
  }, z.core.$strict>>;
202
386
  }, z.core.$strict>>;
203
387
  onePerPerson: z.ZodOptional<z.ZodString>;
388
+ moves: z.ZodOptional<z.ZodObject<{
389
+ held: z.ZodString;
390
+ paid: z.ZodString;
391
+ expired: z.ZodString;
392
+ refund: z.ZodOptional<z.ZodArray<z.ZodString>>;
393
+ price: z.ZodOptional<z.ZodObject<{
394
+ field: z.ZodOptional<z.ZodString>;
395
+ setting: z.ZodOptional<z.ZodString>;
396
+ }, z.core.$strict>>;
397
+ title: z.ZodOptional<z.ZodString>;
398
+ order: z.ZodOptional<z.ZodString>;
399
+ guest: z.ZodOptional<z.ZodBoolean>;
400
+ holdCap: z.ZodOptional<z.ZodObject<{
401
+ setting: z.ZodString;
402
+ }, z.core.$strict>>;
403
+ }, z.core.$strict>>;
204
404
  tax: z.ZodOptional<z.ZodObject<{
205
405
  code: z.ZodString;
206
406
  place: z.ZodOptional<z.ZodObject<{
@@ -219,6 +419,13 @@ export declare const sellableManifestSchema: z.ZodObject<{
219
419
  year: "year";
220
420
  }>;
221
421
  trialDays: z.ZodOptional<z.ZodString>;
422
+ pause: z.ZodOptional<z.ZodObject<{
423
+ minDays: z.ZodOptional<z.ZodString>;
424
+ maxDays: z.ZodOptional<z.ZodString>;
425
+ }, z.core.$strict>>;
426
+ coolingOff: z.ZodOptional<z.ZodObject<{
427
+ setting: z.ZodString;
428
+ }, z.core.$strict>>;
222
429
  grants: z.ZodOptional<z.ZodObject<{
223
430
  object: z.ZodString;
224
431
  set: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
@@ -239,6 +446,28 @@ export declare const sellableManifestSchema: z.ZodObject<{
239
446
  }, z.core.$strict>;
240
447
  }, z.core.$strict>>;
241
448
  }, z.core.$strict>>;
449
+ finance: z.ZodOptional<z.ZodObject<{
450
+ category: z.ZodOptional<z.ZodObject<{
451
+ key: z.ZodString;
452
+ label: z.ZodString;
453
+ }, z.core.$strict>>;
454
+ earned: z.ZodOptional<z.ZodEnum<{
455
+ at_sale: "at_sale";
456
+ over_period: "over_period";
457
+ per_use: "per_use";
458
+ at_date: "at_date";
459
+ }>>;
460
+ at: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strict>>;
462
+ goods: z.ZodOptional<z.ZodObject<{
463
+ soldIn: z.ZodOptional<z.ZodString>;
464
+ }, z.core.$strict>>;
465
+ delivery: z.ZodOptional<z.ZodObject<{
466
+ kind: z.ZodString;
467
+ freeOver: z.ZodOptional<z.ZodString>;
468
+ countries: z.ZodOptional<z.ZodString>;
469
+ active: z.ZodOptional<z.ZodString>;
470
+ }, z.core.$strict>>;
242
471
  }, z.core.$strict>;
243
472
  export type SellableManifest = z.infer<typeof sellableManifestSchema>;
244
473
  /** Reports problems with `objects.<name>.sellable` through `contract`. */