@composable-os/cli 0.0.0-stage → 0.1.0-beta.11
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/LICENSE +109 -0
- package/README.md +24 -2
- package/dist/accounts-UHYLCLEY.js +45 -0
- package/dist/blocks-5IFU25J6.js +233 -0
- package/dist/chunk-2ABSVMGB.js +13 -0
- package/dist/chunk-2IVEVPMY.js +669 -0
- package/dist/chunk-2TWV3SVB.js +349 -0
- package/dist/chunk-2XC5JLBO.js +1931 -0
- package/dist/chunk-324WJXNP.js +320 -0
- package/dist/chunk-5KSXSK7Y.js +47 -0
- package/dist/chunk-6ELZRNUU.js +116 -0
- package/dist/chunk-6UWRT4VM.js +220 -0
- package/dist/chunk-6WGFA2IV.js +643 -0
- package/dist/chunk-6XTU2MTP.js +11278 -0
- package/dist/chunk-7CQGMVDO.js +63 -0
- package/dist/chunk-7D4GKZOX.js +615 -0
- package/dist/chunk-7OGCMQXG.js +284 -0
- package/dist/chunk-DHS2CV2M.js +139 -0
- package/dist/chunk-DU6OIFOU.js +2358 -0
- package/dist/chunk-E4WCYTCT.js +347 -0
- package/dist/chunk-E64SG24J.js +88 -0
- package/dist/chunk-FJIZGS5Q.js +698 -0
- package/dist/chunk-GYTEW66E.js +50 -0
- package/dist/chunk-HDIOVFAZ.js +544 -0
- package/dist/chunk-K34UKWEI.js +298 -0
- package/dist/chunk-KGHA67HG.js +765 -0
- package/dist/chunk-LAAL4YGR.js +365 -0
- package/dist/chunk-LO6WGU5Y.js +26189 -0
- package/dist/chunk-MBIKVRAC.js +1425 -0
- package/dist/chunk-P6UWZ6QQ.js +426 -0
- package/dist/chunk-PDD2ETVF.js +1302 -0
- package/dist/chunk-UB4I2QKR.js +31575 -0
- package/dist/chunk-WHKJGF36.js +2418 -0
- package/dist/chunk-XIDLW3EP.js +15471 -0
- package/dist/chunk-YFTLIEWU.js +504 -0
- package/dist/chunk-YNUZRTPH.js +182 -0
- package/dist/chunk-ZAWES2UD.js +9364 -0
- package/dist/chunk-ZZFWMVJO.js +704 -0
- package/dist/cli-5UNY5G5L.js +136 -0
- package/dist/cli-UYZMVQMR.js +24534 -0
- package/dist/cli.js +25 -0
- package/dist/client-repo-SE4EKG6W.js +55 -0
- package/dist/create.js +25 -0
- package/dist/fields-FTWWMD7N.js +50 -0
- package/dist/grants-LOW6TSWD.js +32 -0
- package/dist/invoke-6KVT6WJI.js +41 -0
- package/dist/moves-E2HKYCTK.js +41 -0
- package/dist/order-U4KZLLSJ.js +19 -0
- package/dist/person-UHLVBVLR.js +67 -0
- package/dist/plan-on-sale-TJPFCNL7.js +26 -0
- package/dist/platform/migrations/0001_init.sql +59 -0
- package/dist/platform/migrations/0002_users_settings.sql +34 -0
- package/dist/platform/migrations/0003_people_organisations.sql +225 -0
- package/dist/platform/migrations/0004_activities_tasks.sql +88 -0
- package/dist/platform/migrations/0005_views_audit.sql +79 -0
- package/dist/platform/migrations/0006_search.sql +223 -0
- package/dist/platform/migrations/0007_crm_views.sql +141 -0
- package/dist/platform/migrations/0008_audit_redaction.sql +116 -0
- package/dist/platform/migrations/0010_approval_queue.sql +90 -0
- package/dist/platform/migrations/0011_connected_apps.sql +36 -0
- package/dist/platform/migrations/0020_extensions.sql +373 -0
- package/dist/platform/migrations/0030_extension_proposals.sql +29 -0
- package/dist/platform/migrations/0050_live_row_indexes.sql +32 -0
- package/dist/platform/migrations/0060_audit_read_counts.sql +31 -0
- package/dist/platform/migrations/0061_audit_retention.sql +95 -0
- package/dist/platform/migrations/0062_run_history_retention.sql +6 -0
- package/dist/platform/migrations/0063_pending_action_compaction.sql +18 -0
- package/dist/platform/migrations/0064_drop_rate_limit.sql +6 -0
- package/dist/platform/migrations/0065_storage_stats.sql +13 -0
- package/dist/platform/migrations/0070_drop_proposals_ext_idx.sql +9 -0
- package/dist/platform/migrations/0080_views_dashboards.sql +46 -0
- package/dist/platform/migrations/0100_stage_history.sql +54 -0
- package/dist/platform/migrations/0110_integrations.sql +103 -0
- package/dist/platform/migrations/0111_email_calendar_sync.sql +137 -0
- package/dist/platform/migrations/0112_sync_item_occurred_at.sql +8 -0
- package/dist/platform/migrations/0130_automations.sql +113 -0
- package/dist/platform/migrations/0131_notifications.sql +29 -0
- package/dist/platform/migrations/0132_automation_runtime.sql +14 -0
- package/dist/platform/migrations/0150_ai_summaries_embeddings.sql +48 -0
- package/dist/platform/migrations/0160_releases.sql +41 -0
- package/dist/platform/migrations/0161_setup_wizard.sql +30 -0
- package/dist/platform/migrations/0170_automation_connections.sql +32 -0
- package/dist/platform/migrations/0171_automation_outbox.sql +23 -0
- package/dist/platform/migrations/0172_notification_delivery.sql +46 -0
- package/dist/platform/migrations/0200_assistant_conversations.sql +25 -0
- package/dist/platform/migrations/0205_policy_adjudicator.sql +61 -0
- package/dist/platform/migrations/0210_daily_digest.sql +33 -0
- package/dist/platform/migrations/0220_entitlements.sql +13 -0
- package/dist/platform/migrations/0221_support_grants.sql +33 -0
- package/dist/platform/migrations/0250_judge.sql +11 -0
- package/dist/platform/migrations/0251_adjudication_judgement.sql +8 -0
- package/dist/platform/migrations/0252_judge_usage.sql +14 -0
- package/dist/platform/migrations/0255_summary_checks.sql +9 -0
- package/dist/platform/migrations/0256_outbound_check.sql +9 -0
- package/dist/platform/migrations/0260_ai_usage.sql +20 -0
- package/dist/platform/migrations/0270_assistant_conversation_refs.sql +29 -0
- package/dist/platform/migrations/0310_assignment_rules.sql +54 -0
- package/dist/platform/migrations/0320_duplicates.sql +41 -0
- package/dist/platform/migrations/0330_erase_completeness.sql +54 -0
- package/dist/platform/migrations/0350_assistant_thread.sql +38 -0
- package/dist/platform/migrations/0351_assistant_model_roles.sql +26 -0
- package/dist/platform/migrations/0352_assistant_memory.sql +74 -0
- package/dist/platform/migrations/0358_ai_cache_observation.sql +24 -0
- package/dist/platform/migrations/0359_ai_compaction_decision.sql +25 -0
- package/dist/platform/migrations/0360_ai_cache_estimate.sql +35 -0
- package/dist/platform/migrations/0361_voice_preferences.sql +27 -0
- package/dist/platform/migrations/0362_voice_usage.sql +17 -0
- package/dist/platform/migrations/0365_routines.sql +38 -0
- package/dist/platform/migrations/0370_approval_execution.sql +20 -0
- package/dist/platform/migrations/0371_agent_jobs.sql +65 -0
- package/dist/platform/migrations/0380_rec_views.sql +94 -0
- package/dist/platform/migrations/0400_customer_audit_actor.sql +142 -0
- package/dist/platform/migrations/0401_customer_accounts.sql +61 -0
- package/dist/platform/migrations/0402_erase_requests.sql +34 -0
- package/dist/platform/migrations/0410_idempotency_keys.sql +45 -0
- package/dist/platform/migrations/0411_device_sessions.sql +33 -0
- package/dist/platform/migrations/0420_transition_history.sql +100 -0
- package/dist/platform/migrations/0421_orders.sql +134 -0
- package/dist/platform/migrations/0422_order_payments.sql +109 -0
- package/dist/platform/migrations/0440_capacity.sql +100 -0
- package/dist/platform/migrations/0441_capacity_views.sql +40 -0
- package/dist/platform/migrations/0450_order_grants.sql +21 -0
- package/dist/platform/migrations/0451_pack_roles.sql +18 -0
- package/dist/platform/migrations/0460_content.sql +59 -0
- package/dist/platform/migrations/0461_media.sql +52 -0
- package/dist/platform/migrations/0470_publish_versions.sql +36 -0
- package/dist/platform/migrations/0471_permission_grants.sql +18 -0
- package/dist/platform/migrations/0490_staff_invites.sql +40 -0
- package/dist/platform/migrations/0491_sign_in_mail_kind.sql +10 -0
- package/dist/platform/migrations/0492_email_confirmation_and_sign_in_confirm.sql +30 -0
- package/dist/platform/migrations/0500_published_media_field.sql +25 -0
- package/dist/platform/migrations/0501_import_keys.sql +23 -0
- package/dist/platform/migrations/0510_video_and_file_media.sql +109 -0
- package/dist/platform/migrations/0516_order_tax.sql +63 -0
- package/dist/platform/migrations/0520_publish_requests.sql +20 -0
- package/dist/platform/migrations/0530_subscriptions.sql +173 -0
- package/dist/platform/migrations/0531_subscription_trials.sql +56 -0
- package/dist/platform/migrations/0532_subscription_offers.sql +80 -0
- package/dist/platform/migrations/0533_allowances.sql +262 -0
- package/dist/platform/migrations/0560_recurring.sql +75 -0
- package/dist/platform/migrations/0580_subscription_grants.sql +21 -0
- package/dist/platform/migrations/0581_once_per_person.sql +34 -0
- package/dist/platform/migrations/0600_tool_actions_ran_at_queue.sql +22 -0
- package/dist/platform/migrations/0610_waitlists.sql +54 -0
- package/dist/platform/migrations/0630_subscription_changes.sql +122 -0
- package/dist/platform/migrations/0650_person_links.sql +90 -0
- package/dist/platform/migrations/0670_unmoved_guard.sql +52 -0
- package/dist/platform/migrations/0690_sellable_refund_due.sql +98 -0
- package/dist/platform/sdk/allowance.ts +522 -0
- package/dist/platform/sdk/automation-check.ts +534 -0
- package/dist/platform/sdk/automation.ts +743 -0
- package/dist/platform/sdk/behaviour.ts +215 -0
- package/dist/platform/sdk/capacity.ts +303 -0
- package/dist/platform/sdk/contract.ts +909 -0
- package/dist/platform/sdk/document.ts +935 -0
- package/dist/platform/sdk/field-types.ts +111 -0
- package/dist/platform/sdk/formula/ast.ts +72 -0
- package/dist/platform/sdk/formula/compile.ts +454 -0
- package/dist/platform/sdk/formula/index.ts +4 -0
- package/dist/platform/sdk/formula/parser.ts +417 -0
- package/dist/platform/sdk/index.ts +36 -0
- package/dist/platform/sdk/manifest.ts +1785 -0
- package/dist/platform/sdk/media.ts +108 -0
- package/dist/platform/sdk/permissions.ts +60 -0
- package/dist/platform/sdk/recurring.ts +321 -0
- package/dist/platform/sdk/renamed.ts +63 -0
- package/dist/platform/sdk/rich-text-fixture.ts +68 -0
- package/dist/platform/sdk/rich-text.ts +221 -0
- package/dist/platform/sdk/runtime.ts +410 -0
- package/dist/platform/sdk/sellable.ts +1138 -0
- package/dist/platform/sdk/slug.ts +25 -0
- package/dist/platform/sdk/states.ts +598 -0
- package/dist/platform/sdk/testing.ts +847 -0
- package/dist/platform/sdk/unique.ts +81 -0
- package/dist/products-2H5DR232.js +11 -0
- package/dist/run-7P4RQALH.js +648 -0
- package/dist/run-PO3W5BFA.js +508 -0
- package/dist/run-ZCGFMEZF.js +309 -0
- package/dist/src-CRO35DYY.js +46 -0
- package/dist/src-I3IJ4NKC.js +354 -0
- package/dist/token-MOJUA2U6.js +70 -0
- package/dist/token-util-TENRN4V7.js +6 -0
- package/dist/visibility-TVXZ67FD.js +41 -0
- package/package.json +33 -4
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// What a picture of the media library may be (stage 28, ADR 0444), as data and pure functions so
|
|
2
|
+
// the host and `cos content import` check one rule: the type is the file's first bytes, never its
|
|
3
|
+
// name or a client's word; only raster images the host recognises (JPEG, PNG, GIF, WebP, AVIF);
|
|
4
|
+
// no SVG, which can carry script; at most 10 MB.
|
|
5
|
+
|
|
6
|
+
/** The types the media library takes. */
|
|
7
|
+
export const MEDIA_TYPES = [
|
|
8
|
+
"image/jpeg",
|
|
9
|
+
"image/png",
|
|
10
|
+
"image/gif",
|
|
11
|
+
"image/webp",
|
|
12
|
+
"image/avif",
|
|
13
|
+
] as const;
|
|
14
|
+
export type MediaType = (typeof MEDIA_TYPES)[number];
|
|
15
|
+
|
|
16
|
+
/** The most an upload may be, in bytes. */
|
|
17
|
+
export const MEDIA_MAX_BYTES = 10 * 1024 * 1024;
|
|
18
|
+
|
|
19
|
+
const starts = (bytes: Uint8Array, at: number, ...values: number[]) =>
|
|
20
|
+
values.every((v, i) => bytes[at + i] === v);
|
|
21
|
+
const ascii = (bytes: Uint8Array, at: number, text: string) =>
|
|
22
|
+
[...text].every((c, i) => bytes[at + i] === c.charCodeAt(0));
|
|
23
|
+
|
|
24
|
+
/** The type the bytes are, or null when they are not a picture the library takes. */
|
|
25
|
+
export function sniffMediaType(bytes: Uint8Array): MediaType | null {
|
|
26
|
+
if (starts(bytes, 0, 0xff, 0xd8, 0xff)) return "image/jpeg";
|
|
27
|
+
if (starts(bytes, 0, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a)) return "image/png";
|
|
28
|
+
if (ascii(bytes, 0, "GIF87a") || ascii(bytes, 0, "GIF89a")) return "image/gif";
|
|
29
|
+
if (ascii(bytes, 0, "RIFF") && ascii(bytes, 8, "WEBP")) return "image/webp";
|
|
30
|
+
if (ascii(bytes, 4, "ftyp") && (ascii(bytes, 8, "avif") || ascii(bytes, 8, "avis"))) {
|
|
31
|
+
return "image/avif";
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Why `bytes` cannot be uploaded, or null when they can. */
|
|
37
|
+
export function mediaProblem(bytes: Uint8Array): string | null {
|
|
38
|
+
if (bytes.byteLength === 0) return "The file is empty";
|
|
39
|
+
if (bytes.byteLength > MEDIA_MAX_BYTES) {
|
|
40
|
+
return `The file is ${bytes.byteLength} bytes; a picture is at most ${MEDIA_MAX_BYTES}`;
|
|
41
|
+
}
|
|
42
|
+
if (!sniffMediaType(bytes)) {
|
|
43
|
+
return "This is not a picture the library takes: JPEG, PNG, GIF, WebP or AVIF";
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// --- Files and videos (stage 42, ADR 0475) ------------------------------------------------------
|
|
49
|
+
//
|
|
50
|
+
// A `file` item is a download (a PDF only, at first), kept in R2 like a picture and served by the
|
|
51
|
+
// same rule. Its type is read from its bytes too. A `video` item is held in Cloudflare Stream on
|
|
52
|
+
// the deployment's own account: the file goes from the staff browser straight to Stream, so the
|
|
53
|
+
// host only checks the size a person says it is, and Stream refuses what is not a video.
|
|
54
|
+
|
|
55
|
+
/** The kinds of item the media library holds. */
|
|
56
|
+
export const MEDIA_KINDS = ["image", "video", "file"] as const;
|
|
57
|
+
export type MediaKind = (typeof MEDIA_KINDS)[number];
|
|
58
|
+
|
|
59
|
+
/** The types a `file` item may be. */
|
|
60
|
+
export const MEDIA_FILE_TYPES = ["application/pdf"] as const;
|
|
61
|
+
export type MediaFileType = (typeof MEDIA_FILE_TYPES)[number];
|
|
62
|
+
|
|
63
|
+
/** The `type` the library records for a video (its bytes are Stream's, never the host's). */
|
|
64
|
+
export const MEDIA_VIDEO_TYPE = "video/stream" as const;
|
|
65
|
+
|
|
66
|
+
/** The most a downloadable file may be, in bytes. */
|
|
67
|
+
export const MEDIA_FILE_MAX_BYTES = 50 * 1024 * 1024;
|
|
68
|
+
|
|
69
|
+
/** The most a video may be, in bytes: under Stream's 30 GB. */
|
|
70
|
+
export const MEDIA_VIDEO_MAX_BYTES = 30 * 1000 * 1000 * 1000 - 1;
|
|
71
|
+
|
|
72
|
+
/** The longest a video may be, in seconds (Stream refuses an upload longer than it was told). */
|
|
73
|
+
export const MEDIA_VIDEO_MAX_SECONDS = 6 * 60 * 60;
|
|
74
|
+
|
|
75
|
+
/** The most a caption file may be (Stream's limit): WebVTT only. */
|
|
76
|
+
export const MEDIA_CAPTION_MAX_BYTES = 10 * 1024 * 1024;
|
|
77
|
+
|
|
78
|
+
/** The type a downloadable file's bytes are, or null when the library does not take it. */
|
|
79
|
+
export function sniffFileType(bytes: Uint8Array): MediaFileType | null {
|
|
80
|
+
return ascii(bytes, 0, "%PDF-") ? "application/pdf" : null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The kind and type an uploaded file is, from its bytes: a picture or a download. */
|
|
84
|
+
export function sniffUpload(
|
|
85
|
+
bytes: Uint8Array,
|
|
86
|
+
): { kind: "image"; type: MediaType } | { kind: "file"; type: MediaFileType } | null {
|
|
87
|
+
const image = sniffMediaType(bytes);
|
|
88
|
+
if (image) return { kind: "image", type: image };
|
|
89
|
+
const file = sniffFileType(bytes);
|
|
90
|
+
return file ? { kind: "file", type: file } : null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The most an upload of this kind may be. */
|
|
94
|
+
export function maxBytesOf(kind: "image" | "file"): number {
|
|
95
|
+
return kind === "file" ? MEDIA_FILE_MAX_BYTES : MEDIA_MAX_BYTES;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Whether `bytes` are a WebVTT file (its header, after an optional byte order mark). */
|
|
99
|
+
export function isWebVtt(bytes: Uint8Array): boolean {
|
|
100
|
+
const at = bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf ? 3 : 0;
|
|
101
|
+
if (!ascii(bytes, at, "WEBVTT")) return false;
|
|
102
|
+
const next = bytes[at + 6];
|
|
103
|
+
// "WEBVTT" alone on its line, or followed by a space or a tab and a header.
|
|
104
|
+
return next === undefined || next === 0x0a || next === 0x0d || next === 0x20 || next === 0x09;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** A caption's language: a BCP 47 tag as Stream takes it (`en`, `pt-BR`). */
|
|
108
|
+
export const CAPTION_LANGUAGE_RE = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,2}$/;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Declared permissions (ADR 0025): what an extension may call through `codemode:ops`. The host
|
|
2
|
+
// enforces this in the invocation pipeline; the testing harness uses the same rules.
|
|
3
|
+
import type { PermissionsManifest } from "./manifest.ts";
|
|
4
|
+
import { FORBIDDEN_OPERATION_PREFIXES } from "./manifest.ts";
|
|
5
|
+
|
|
6
|
+
export interface GrantRequest {
|
|
7
|
+
/** Operation name, e.g. `organisation.get`, `record.create`. */
|
|
8
|
+
operation: string;
|
|
9
|
+
/** The operation's risk class. */
|
|
10
|
+
risk: string;
|
|
11
|
+
/** The object the call reads or writes, when the operation is about one (else null). */
|
|
12
|
+
object: string | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GrantDecision = { ok: true } | { ok: false; reason: string };
|
|
16
|
+
|
|
17
|
+
/** Decides whether extension `id` with `permissions` may make `request`. */
|
|
18
|
+
export function checkGrant(
|
|
19
|
+
id: string,
|
|
20
|
+
permissions: PermissionsManifest,
|
|
21
|
+
request: GrantRequest,
|
|
22
|
+
): GrantDecision {
|
|
23
|
+
const { operation, risk, object } = request;
|
|
24
|
+
if (FORBIDDEN_OPERATION_PREFIXES.some((prefix) => operation.startsWith(prefix))) {
|
|
25
|
+
return { ok: false, reason: `Extensions cannot call ${operation}` };
|
|
26
|
+
}
|
|
27
|
+
if (operation.startsWith(`x.${id}.`)) {
|
|
28
|
+
return { ok: false, reason: "An extension cannot call its own tools through codemode:ops" };
|
|
29
|
+
}
|
|
30
|
+
if (permissions.operations.includes(operation)) return { ok: true };
|
|
31
|
+
if (operation.startsWith("x.")) {
|
|
32
|
+
return { ok: false, reason: `${operation} is not in permissions.operations` };
|
|
33
|
+
}
|
|
34
|
+
if (!object) {
|
|
35
|
+
return {
|
|
36
|
+
ok: false,
|
|
37
|
+
reason: `${operation} is not in permissions.operations of extension ${id}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (object.startsWith(`${id}.`)) return { ok: true };
|
|
41
|
+
if (risk === "read") {
|
|
42
|
+
if (permissions.read.includes(object) || permissions.write.includes(object))
|
|
43
|
+
return { ok: true };
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
reason: `Extension ${id} may not read ${object} (add it to permissions.read)`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (risk === "write" || risk === "bulk-write") {
|
|
50
|
+
if (permissions.write.includes(object)) return { ok: true };
|
|
51
|
+
return {
|
|
52
|
+
ok: false,
|
|
53
|
+
reason: `Extension ${id} may not write ${object} (add it to permissions.write)`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
reason: `${operation} is ${risk}; list it in permissions.operations to allow it`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
// The `recurring` behaviour (stage 31, ADR 0500): a record (a series: one line of a timetable)
|
|
2
|
+
// declares a weekly rule in local wall-clock time, and the host makes the dated records it
|
|
3
|
+
// generates (its classes) ahead of time. Its declaration, its manifest schema and its contract
|
|
4
|
+
// checks live here; the host's side is packages/core/src/recurring/.
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import type { ExtensionManifest, FieldManifest, ObjectManifest } from "./manifest.ts";
|
|
7
|
+
|
|
8
|
+
/** The weekday values a rule's `weekdays` field must use (ISO order, Monday first). */
|
|
9
|
+
export const WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] as const;
|
|
10
|
+
export type Weekday = (typeof WEEKDAYS)[number];
|
|
11
|
+
|
|
12
|
+
/** How far ahead the host makes records when a series does not say (days). */
|
|
13
|
+
export const RECURRING_HORIZON_DAYS = 56;
|
|
14
|
+
/** The most days ahead a series may ask for. */
|
|
15
|
+
export const RECURRING_HORIZON_MAX = 366;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A weekly schedule that generates dated records (ADR 0500). The rule is kept in local
|
|
19
|
+
* wall-clock time in the series' zone: 06:00 is 06:00 on both sides of a clock change. A local
|
|
20
|
+
* time that does not exist on a change day (02:30 when clocks go forward) moves forward by the
|
|
21
|
+
* gap; one that happens twice is the first of the two.
|
|
22
|
+
*
|
|
23
|
+
* - `generates` is another of this extension's objects, and `link` its relation field (one
|
|
24
|
+
* record, read-only) back to this object: the host sets it.
|
|
25
|
+
* - `rule` names this object's fields: `weekdays` (a multiSelect whose option values are
|
|
26
|
+
* `mon`…`sun`), `time` (a text field, `HH:MM`), `length` (a number field, minutes), `from` and
|
|
27
|
+
* `until` (date fields; `until` empty for ongoing) and `zone` (a timezone field; empty is the
|
|
28
|
+
* organisation's zone).
|
|
29
|
+
* - `into` names the generated object's fields the host fills: `starts` (datetime), `ends`
|
|
30
|
+
* (datetime, starts plus the length), `zone` (timezone) and `changed` (a read-only boolean the
|
|
31
|
+
* host sets when someone other than the host edits the record).
|
|
32
|
+
* - `copy` maps generated fields to this object's fields copied onto each record (`{ coach:
|
|
33
|
+
* "coach" }`).
|
|
34
|
+
* - `cancel` is the generated object's state the host moves a record to when a closure covers it
|
|
35
|
+
* or the series ends while places are claimed on it. The generated object declares `states`
|
|
36
|
+
* with a `host` move into it.
|
|
37
|
+
* - `ended` (optional) is this object's select field and the values that mean the series has
|
|
38
|
+
* ended: nothing more is made, and its future records go.
|
|
39
|
+
* - `closures` (optional) is another of this extension's objects whose records are date ranges
|
|
40
|
+
* (`from`, `until`, both date fields, inclusive) in which nothing is made and records already
|
|
41
|
+
* made are cancelled.
|
|
42
|
+
* - `horizonDays` (default 56): how far ahead records are made.
|
|
43
|
+
* - `horizonAtLeast` (optional): another of this extension's objects and a number field of it in
|
|
44
|
+
* days (a class type's booking window): the horizon is never less than the largest value any
|
|
45
|
+
* live record of it holds, so a class can be booked as soon as its window opens.
|
|
46
|
+
*
|
|
47
|
+
* Made records are never made twice (the host keys each on the series and its local date). A
|
|
48
|
+
* record edited by staff (its time, copied fields or state) is never overwritten or made again;
|
|
49
|
+
* a change of the series applies to the future records nobody edited.
|
|
50
|
+
*/
|
|
51
|
+
export interface RecurringScheduleSpec {
|
|
52
|
+
generates: string;
|
|
53
|
+
link: string;
|
|
54
|
+
rule: {
|
|
55
|
+
weekdays: string;
|
|
56
|
+
time: string;
|
|
57
|
+
length?: string;
|
|
58
|
+
from: string;
|
|
59
|
+
until?: string;
|
|
60
|
+
zone?: string;
|
|
61
|
+
};
|
|
62
|
+
into: { starts: string; ends?: string; zone?: string; changed?: string };
|
|
63
|
+
copy?: Readonly<Record<string, string>>;
|
|
64
|
+
cancel: string;
|
|
65
|
+
ended?: { field: string; in: readonly string[] };
|
|
66
|
+
closures?: { object: string; from: string; until: string };
|
|
67
|
+
horizonDays?: number;
|
|
68
|
+
horizonAtLeast?: { object: string; field: string };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const fieldName = z.string().max(40);
|
|
72
|
+
|
|
73
|
+
export const recurringManifestSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
generates: fieldName,
|
|
76
|
+
link: fieldName,
|
|
77
|
+
rule: z
|
|
78
|
+
.object({
|
|
79
|
+
weekdays: fieldName,
|
|
80
|
+
time: fieldName,
|
|
81
|
+
length: fieldName.optional(),
|
|
82
|
+
from: fieldName,
|
|
83
|
+
until: fieldName.optional(),
|
|
84
|
+
zone: fieldName.optional(),
|
|
85
|
+
})
|
|
86
|
+
.strict(),
|
|
87
|
+
into: z
|
|
88
|
+
.object({
|
|
89
|
+
starts: fieldName,
|
|
90
|
+
ends: fieldName.optional(),
|
|
91
|
+
zone: fieldName.optional(),
|
|
92
|
+
changed: fieldName.optional(),
|
|
93
|
+
})
|
|
94
|
+
.strict(),
|
|
95
|
+
copy: z
|
|
96
|
+
.record(fieldName, fieldName)
|
|
97
|
+
.refine((copy) => Object.keys(copy).length <= 20, "At most 20 copied fields")
|
|
98
|
+
.optional(),
|
|
99
|
+
cancel: z.string().min(1).max(100),
|
|
100
|
+
ended: z
|
|
101
|
+
.object({ field: fieldName, in: z.array(z.string().min(1).max(100)).min(1).max(20) })
|
|
102
|
+
.strict()
|
|
103
|
+
.optional(),
|
|
104
|
+
closures: z
|
|
105
|
+
.object({ object: fieldName, from: fieldName, until: fieldName })
|
|
106
|
+
.strict()
|
|
107
|
+
.optional(),
|
|
108
|
+
horizonDays: z.number().int().min(1).max(RECURRING_HORIZON_MAX).optional(),
|
|
109
|
+
horizonAtLeast: z.object({ object: fieldName, field: fieldName }).strict().optional(),
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
export type RecurringScheduleManifest = z.infer<typeof recurringManifestSchema>;
|
|
113
|
+
|
|
114
|
+
/** Reports problems with `objects.<name>.recurring` through `contract`. */
|
|
115
|
+
export function checkObjectRecurring(
|
|
116
|
+
m: ExtensionManifest,
|
|
117
|
+
name: string,
|
|
118
|
+
object: ObjectManifest,
|
|
119
|
+
contract: (path: string, message: string) => void,
|
|
120
|
+
): void {
|
|
121
|
+
const recurring = object.recurring;
|
|
122
|
+
if (!recurring) return;
|
|
123
|
+
const path = `objects.${name}.recurring`;
|
|
124
|
+
const own = (o: ObjectManifest, local: string): FieldManifest | undefined =>
|
|
125
|
+
Object.hasOwn(o.fields, local) ? o.fields[local] : undefined;
|
|
126
|
+
const expect = (
|
|
127
|
+
o: ObjectManifest,
|
|
128
|
+
oName: string,
|
|
129
|
+
at: string,
|
|
130
|
+
local: string | undefined,
|
|
131
|
+
types: readonly string[],
|
|
132
|
+
what: string,
|
|
133
|
+
): FieldManifest | undefined => {
|
|
134
|
+
if (local === undefined) return undefined;
|
|
135
|
+
const field = own(o, local);
|
|
136
|
+
if (!field || !types.includes(field.type) || field.many) {
|
|
137
|
+
contract(at, `"${local}" must be ${what} of ${oName}`);
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
return field;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const rule = recurring.rule;
|
|
144
|
+
const weekdays = expect(
|
|
145
|
+
object,
|
|
146
|
+
name,
|
|
147
|
+
`${path}.rule.weekdays`,
|
|
148
|
+
rule.weekdays,
|
|
149
|
+
["multiSelect"],
|
|
150
|
+
"a multiSelect field",
|
|
151
|
+
);
|
|
152
|
+
if (weekdays) {
|
|
153
|
+
const values = (weekdays.options ?? []).map((o) => o.value);
|
|
154
|
+
const wrong = values.filter((v) => !(WEEKDAYS as readonly string[]).includes(v));
|
|
155
|
+
if (wrong.length || !values.length) {
|
|
156
|
+
contract(
|
|
157
|
+
`${path}.rule.weekdays`,
|
|
158
|
+
`"${rule.weekdays}"'s options must be weekdays (${WEEKDAYS.join(", ")})`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
if (weekdays.editableOptions) {
|
|
162
|
+
contract(`${path}.rule.weekdays`, "The weekdays field cannot have editableOptions");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
expect(object, name, `${path}.rule.time`, rule.time, ["text"], "a text field (HH:MM)");
|
|
166
|
+
expect(object, name, `${path}.rule.length`, rule.length, ["number"], "a number field (minutes)");
|
|
167
|
+
expect(object, name, `${path}.rule.from`, rule.from, ["date"], "a date field");
|
|
168
|
+
expect(object, name, `${path}.rule.until`, rule.until, ["date"], "a date field");
|
|
169
|
+
expect(object, name, `${path}.rule.zone`, rule.zone, ["timezone"], "a timezone field");
|
|
170
|
+
if (recurring.ended) {
|
|
171
|
+
const field = expect(
|
|
172
|
+
object,
|
|
173
|
+
name,
|
|
174
|
+
`${path}.ended.field`,
|
|
175
|
+
recurring.ended.field,
|
|
176
|
+
["select"],
|
|
177
|
+
"a select field",
|
|
178
|
+
);
|
|
179
|
+
const values = new Set((field?.options ?? []).map((o) => o.value));
|
|
180
|
+
for (const value of recurring.ended.in) {
|
|
181
|
+
if (field && !values.has(value)) {
|
|
182
|
+
contract(`${path}.ended.in`, `"${value}" is not an option of ${recurring.ended.field}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const generatedName = recurring.generates;
|
|
188
|
+
const generated = Object.hasOwn(m.objects, generatedName) ? m.objects[generatedName] : undefined;
|
|
189
|
+
if (!generated || generatedName === name) {
|
|
190
|
+
contract(`${path}.generates`, `"${generatedName}" must be another of this extension's objects`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const link = own(generated, recurring.link);
|
|
194
|
+
if (link?.type !== "relation" || link.many || link.to !== `${m.id}.${name}`) {
|
|
195
|
+
contract(
|
|
196
|
+
`${path}.link`,
|
|
197
|
+
`"${recurring.link}" must be a relation field of ${generatedName} to ${m.id}.${name}`,
|
|
198
|
+
);
|
|
199
|
+
} else if (!link.readOnly) {
|
|
200
|
+
contract(`${path}.link`, `"${recurring.link}" must be read-only: the host sets it`);
|
|
201
|
+
}
|
|
202
|
+
expect(
|
|
203
|
+
generated,
|
|
204
|
+
generatedName,
|
|
205
|
+
`${path}.into.starts`,
|
|
206
|
+
recurring.into.starts,
|
|
207
|
+
["datetime"],
|
|
208
|
+
"a datetime field",
|
|
209
|
+
);
|
|
210
|
+
expect(
|
|
211
|
+
generated,
|
|
212
|
+
generatedName,
|
|
213
|
+
`${path}.into.ends`,
|
|
214
|
+
recurring.into.ends,
|
|
215
|
+
["datetime"],
|
|
216
|
+
"a datetime field",
|
|
217
|
+
);
|
|
218
|
+
expect(
|
|
219
|
+
generated,
|
|
220
|
+
generatedName,
|
|
221
|
+
`${path}.into.zone`,
|
|
222
|
+
recurring.into.zone,
|
|
223
|
+
["timezone"],
|
|
224
|
+
"a timezone field",
|
|
225
|
+
);
|
|
226
|
+
const changed = expect(
|
|
227
|
+
generated,
|
|
228
|
+
generatedName,
|
|
229
|
+
`${path}.into.changed`,
|
|
230
|
+
recurring.into.changed,
|
|
231
|
+
["boolean"],
|
|
232
|
+
"a boolean field",
|
|
233
|
+
);
|
|
234
|
+
if (changed && !changed.readOnly) {
|
|
235
|
+
contract(
|
|
236
|
+
`${path}.into.changed`,
|
|
237
|
+
`"${recurring.into.changed}" must be read-only: the host sets it`,
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
const into = new Set<string>(Object.values(recurring.into));
|
|
241
|
+
// The state is the host's to move and staff's to change; a series never copies one in.
|
|
242
|
+
if (generated.states) into.add(generated.states.field);
|
|
243
|
+
for (const [target, source] of Object.entries(recurring.copy ?? {})) {
|
|
244
|
+
const to = own(generated, target);
|
|
245
|
+
const from = own(object, source);
|
|
246
|
+
if (!to || to.type === "formula" || into.has(target) || target === recurring.link) {
|
|
247
|
+
contract(
|
|
248
|
+
`${path}.copy.${target}`,
|
|
249
|
+
`"${target}" must be a field of ${generatedName} the host does not already fill`,
|
|
250
|
+
);
|
|
251
|
+
} else if (
|
|
252
|
+
!from ||
|
|
253
|
+
from.type !== to.type ||
|
|
254
|
+
Boolean(from.many) !== Boolean(to.many) ||
|
|
255
|
+
from.to !== to.to
|
|
256
|
+
) {
|
|
257
|
+
contract(
|
|
258
|
+
`${path}.copy.${target}`,
|
|
259
|
+
`"${source}" must be a field of ${name} of the same type as ${generatedName}.${target}`,
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const states = generated.states;
|
|
264
|
+
if (!states) {
|
|
265
|
+
contract(
|
|
266
|
+
`${path}.cancel`,
|
|
267
|
+
`${generatedName} must declare states, with a host move into "${recurring.cancel}"`,
|
|
268
|
+
);
|
|
269
|
+
} else {
|
|
270
|
+
const field = own(generated, states.field);
|
|
271
|
+
if (!(field?.options ?? []).some((o) => o.value === recurring.cancel)) {
|
|
272
|
+
contract(`${path}.cancel`, `"${recurring.cancel}" is not a state of ${generatedName}`);
|
|
273
|
+
} else if (
|
|
274
|
+
!states.moves.some((move) => move.to === recurring.cancel && move.by.includes("host"))
|
|
275
|
+
) {
|
|
276
|
+
contract(
|
|
277
|
+
`${path}.cancel`,
|
|
278
|
+
`${generatedName} needs a move into "${recurring.cancel}" that the host may make`,
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (recurring.horizonAtLeast) {
|
|
283
|
+
const h = recurring.horizonAtLeast;
|
|
284
|
+
// One of this extension's objects, or another extension's object with a number field this
|
|
285
|
+
// extension adds to it (a class type of Programs' carrying Bookings' window, ADR 0505).
|
|
286
|
+
const added = h.object.includes(".") ? m.fields?.[h.object] : undefined;
|
|
287
|
+
const target = added
|
|
288
|
+
? ({ fields: added } as unknown as ObjectManifest)
|
|
289
|
+
: Object.hasOwn(m.objects, h.object)
|
|
290
|
+
? m.objects[h.object]
|
|
291
|
+
: undefined;
|
|
292
|
+
if (!target) {
|
|
293
|
+
contract(
|
|
294
|
+
`${path}.horizonAtLeast.object`,
|
|
295
|
+
`"${h.object}" must be one of this extension's objects, or an object this extension adds fields to`,
|
|
296
|
+
);
|
|
297
|
+
} else {
|
|
298
|
+
expect(
|
|
299
|
+
target,
|
|
300
|
+
h.object,
|
|
301
|
+
`${path}.horizonAtLeast.field`,
|
|
302
|
+
h.field,
|
|
303
|
+
["number"],
|
|
304
|
+
"a number field (days)",
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (recurring.closures) {
|
|
309
|
+
const c = recurring.closures;
|
|
310
|
+
const closure = Object.hasOwn(m.objects, c.object) ? m.objects[c.object] : undefined;
|
|
311
|
+
if (!closure || c.object === name || c.object === generatedName) {
|
|
312
|
+
contract(
|
|
313
|
+
`${path}.closures.object`,
|
|
314
|
+
`"${c.object}" must be another of this extension's objects`,
|
|
315
|
+
);
|
|
316
|
+
} else {
|
|
317
|
+
expect(closure, c.object, `${path}.closures.from`, c.from, ["date"], "a date field");
|
|
318
|
+
expect(closure, c.object, `${path}.closures.until`, c.until, ["date"], "a date field");
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// The names the extension contract had before stage 20 (ADR 0400), when it still said `crm`.
|
|
2
|
+
//
|
|
3
|
+
// None of them is accepted: no release was installed under them, so there is nothing to keep
|
|
4
|
+
// working. They are listed so that code written against the old contract is refused with a
|
|
5
|
+
// message that names the new form, by the extension build, Code Mode, the manifest check and
|
|
6
|
+
// query.sql. This file is the only place the old names are written.
|
|
7
|
+
|
|
8
|
+
const OLD_PREFIX = "crm";
|
|
9
|
+
|
|
10
|
+
/** The host module extension code calls operations through, and what it was called. */
|
|
11
|
+
export const OPS_MODULE = "ops";
|
|
12
|
+
export const OLD_OPS_MODULE = OLD_PREFIX;
|
|
13
|
+
|
|
14
|
+
/** The module specifier Code Mode scripts import, and what it was. */
|
|
15
|
+
export const OPS_SPECIFIER = `codemode:${OPS_MODULE}`;
|
|
16
|
+
export const OLD_OPS_SPECIFIER = `codemode:${OLD_OPS_MODULE}`;
|
|
17
|
+
|
|
18
|
+
/** The prefix of every read view, and what it was. */
|
|
19
|
+
export const VIEW_PREFIX = "rec_";
|
|
20
|
+
export const OLD_VIEW_PREFIX = `${OLD_PREFIX}_`;
|
|
21
|
+
|
|
22
|
+
/** The core views, which were named in the plural: old suffix → new suffix. */
|
|
23
|
+
const RENAMED_CORE_VIEWS: Readonly<Record<string, string>> = {
|
|
24
|
+
people: "person",
|
|
25
|
+
organisations: "organisation",
|
|
26
|
+
affiliations: "affiliation",
|
|
27
|
+
activities: "activity",
|
|
28
|
+
activity_links: "activity_link",
|
|
29
|
+
tasks: "task",
|
|
30
|
+
task_links: "task_link",
|
|
31
|
+
record_tags: "record_tag",
|
|
32
|
+
users: "user",
|
|
33
|
+
stage_history: "stage_history",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* What a view named under the old contract is called now: `rec_person` for the old people view,
|
|
38
|
+
* `rec_x_deals_deal` for an extension object's. Null when `name` is not an old view name.
|
|
39
|
+
*/
|
|
40
|
+
export function renamedView(name: string): string | null {
|
|
41
|
+
const lower = name.toLowerCase();
|
|
42
|
+
if (!lower.startsWith(OLD_VIEW_PREFIX)) return null;
|
|
43
|
+
const suffix = lower.slice(OLD_VIEW_PREFIX.length);
|
|
44
|
+
if (suffix.startsWith("x_")) return `${VIEW_PREFIX}${suffix}`;
|
|
45
|
+
const core = RENAMED_CORE_VIEWS[suffix];
|
|
46
|
+
return core ? `${VIEW_PREFIX}${core}` : null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Why a use of an old contract name is refused, naming the new form. Null for any other name. */
|
|
50
|
+
export function renamedMessage(name: string): string | null {
|
|
51
|
+
if (name === OLD_OPS_SPECIFIER) {
|
|
52
|
+
return `"${OLD_OPS_SPECIFIER}" was renamed: import { ${OPS_MODULE} } from "${OPS_SPECIFIER}" and call ${OPS_MODULE}.call(…)`;
|
|
53
|
+
}
|
|
54
|
+
if (name === OLD_OPS_MODULE) {
|
|
55
|
+
return `The "${OLD_OPS_MODULE}" module was renamed "${OPS_MODULE}": declare "${OPS_MODULE}" in permissions.modules and call ctx.${OPS_MODULE}`;
|
|
56
|
+
}
|
|
57
|
+
const view = renamedView(name);
|
|
58
|
+
if (view) return `${name} was renamed ${view}; query the ${VIEW_PREFIX}* views`;
|
|
59
|
+
if (name.toLowerCase().startsWith(OLD_VIEW_PREFIX)) {
|
|
60
|
+
return `${name} is not a view: the ${OLD_VIEW_PREFIX}* views were renamed ${VIEW_PREFIX}*`;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// One rich text document with every block type and every mark (stage 28, ADR 0440): what the
|
|
2
|
+
// host's tests store and what both renderers (web and native, stage 28 step 6) must draw in full.
|
|
3
|
+
// The picture names a media item by an id of the right shape; the host refuses one that is not a
|
|
4
|
+
// live media item, so a test that stores this replaces it (or leaves the image out).
|
|
5
|
+
/** A media id in the fixture; replace it with a real one before storing. */
|
|
6
|
+
export const RICH_TEXT_FIXTURE_MEDIA = "med_01FIXTURE0000000000000000";
|
|
7
|
+
|
|
8
|
+
export const RICH_TEXT_FIXTURE = {
|
|
9
|
+
blocks: [
|
|
10
|
+
{ type: "heading", level: 2, content: [{ type: "text", text: "Summer at the hall" }] },
|
|
11
|
+
{
|
|
12
|
+
type: "paragraph",
|
|
13
|
+
content: [
|
|
14
|
+
{ type: "text", text: "Doors open at " },
|
|
15
|
+
{ type: "text", text: "seven", bold: true },
|
|
16
|
+
{ type: "text", text: ", the bar a little " },
|
|
17
|
+
{ type: "text", text: "earlier", italic: true },
|
|
18
|
+
{ type: "text", text: ". Bring " },
|
|
19
|
+
{ type: "text", text: "ID", code: true },
|
|
20
|
+
{ type: "break" },
|
|
21
|
+
{ type: "text", text: "Tickets are on the ", bold: true, italic: true },
|
|
22
|
+
{ type: "text", text: "events page", href: "/events" },
|
|
23
|
+
{ type: "text", text: " or by " },
|
|
24
|
+
{ type: "text", text: "email", href: "mailto:hello@example.com" },
|
|
25
|
+
{ type: "text", text: "." },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "list",
|
|
30
|
+
style: "bullet",
|
|
31
|
+
items: [
|
|
32
|
+
{ content: [{ type: "text", text: "Friday: open mic" }] },
|
|
33
|
+
{
|
|
34
|
+
content: [{ type: "text", text: "Saturday: two bands" }],
|
|
35
|
+
list: {
|
|
36
|
+
style: "ordered",
|
|
37
|
+
items: [
|
|
38
|
+
{ content: [{ type: "text", text: "The first" }] },
|
|
39
|
+
{ content: [{ type: "text", text: "The second" }] },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: "quote",
|
|
47
|
+
content: [{ type: "text", text: "Best night of the year." }],
|
|
48
|
+
attribution: "A regular",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "image",
|
|
52
|
+
media: RICH_TEXT_FIXTURE_MEDIA,
|
|
53
|
+
alt: "The hall from the stage, full",
|
|
54
|
+
caption: [
|
|
55
|
+
{ type: "text", text: "Last summer, " },
|
|
56
|
+
{ type: "text", text: "sold out", bold: true },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{ type: "divider" },
|
|
60
|
+
{ type: "embed", url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", caption: "The trailer" },
|
|
61
|
+
{
|
|
62
|
+
type: "callout",
|
|
63
|
+
tone: "warning",
|
|
64
|
+
content: [{ type: "text", text: "Under 18s with an adult only." }],
|
|
65
|
+
},
|
|
66
|
+
{ type: "button", label: "Get tickets", href: "https://tickets.example.com/summer" },
|
|
67
|
+
],
|
|
68
|
+
} as const;
|