@camox/api-contract 0.68.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/drafts.d.ts CHANGED
@@ -69,6 +69,54 @@ export type LookPlaceholderHeight = (typeof LOOK_PLACEHOLDER_HEIGHTS)[number];
69
69
  * `[data-camox-viewport-block="unplaced"]`.
70
70
  */
71
71
  export declare const UNPLACED_BLOCK_ID = "unplaced";
72
+ /**
73
+ * The attributes the website's artifact frames carry: the artifact field's name, and the id of the
74
+ * Repeatable Item holding it, when an item's. With the block's `data-camox-viewport-block`, they
75
+ * find one artifact's frame (`lookArtifactSelector`).
76
+ */
77
+ export declare const ARTIFACT_FIELD_ATTRIBUTE = "data-camox-artifact";
78
+ export declare const ARTIFACT_ITEM_ATTRIBUTE = "data-camox-item";
79
+ /** The CSS selector of the frame of an artifact field of a block, or of one of its items. */
80
+ export declare const lookArtifactSelector: ({ block, item, field }: {
81
+ block: string;
82
+ item?: string;
83
+ field: string;
84
+ }) => string;
85
+ /** An artifact's Timeline, as its runtime declares it: Marks by name, at times in ms. */
86
+ export type LookTimeline = {
87
+ duration: number;
88
+ loop: boolean;
89
+ marks: Record<string, number>;
90
+ /** The Mark whose frame stands for the artifact, or null. */
91
+ poster: string | null;
92
+ };
93
+ /**
94
+ * One finding of an artifact's guardrail report, about motion that escapes its Timeline or will
95
+ * look broken: a Web Animation the runtime didn't make (a CSS animation, a CSS transition that no
96
+ * visitor triggered, one the source made itself), a live timer, a Track the runtime skipped
97
+ * because it can't play it, Tracks on one element and property that overlap, or a loop cut,
98
+ * where a looping Timeline's last frame differs from its first.
99
+ */
100
+ export type LookGuardrailFinding = {
101
+ kind: "animation" | "timer" | "track" | "overlap" | "loop-cut";
102
+ /** What's wrong and what to do instead, for the Artifact Agent. */
103
+ text: string;
104
+ };
105
+ /**
106
+ * What the look document's artifact frames hold under `LOOK_ARTIFACT_CAPTURE`, for the browser
107
+ * `look` drives: the artifact's Timeline, null when it declares none; seeking it to `t` ms,
108
+ * resolved once the frame at that time painted, with the error `render` threw, if it did; and its
109
+ * guardrail report, empty when nothing escapes its Timeline. Frames of an SDK older than
110
+ * Timelines hold nothing there.
111
+ */
112
+ export type LookArtifactCapture = {
113
+ timeline(): Promise<LookTimeline | null>;
114
+ seek(t: number): Promise<{
115
+ error?: string;
116
+ }>;
117
+ guardrail(): Promise<LookGuardrailFinding[]>;
118
+ };
119
+ export declare const LOOK_ARTIFACT_CAPTURE = "camoxCapture";
72
120
  /**
73
121
  * Request header asking the API to create the draft named by `DRAFT_HEADER` if it doesn't
74
122
  * exist yet. Its value is `"1"`.
package/dist/drafts.js CHANGED
@@ -69,6 +69,16 @@ const LOOK_PLACEHOLDER_HEIGHTS = ["short", "tall"];
69
69
  */
70
70
  const UNPLACED_BLOCK_ID = "unplaced";
71
71
  /**
72
+ * The attributes the website's artifact frames carry: the artifact field's name, and the id of the
73
+ * Repeatable Item holding it, when an item's. With the block's `data-camox-viewport-block`, they
74
+ * find one artifact's frame (`lookArtifactSelector`).
75
+ */
76
+ const ARTIFACT_FIELD_ATTRIBUTE = "data-camox-artifact";
77
+ const ARTIFACT_ITEM_ATTRIBUTE = "data-camox-item";
78
+ /** The CSS selector of the frame of an artifact field of a block, or of one of its items. */
79
+ const lookArtifactSelector = ({ block, item, field }) => `[data-camox-viewport-block="${block}"] iframe[${ARTIFACT_FIELD_ATTRIBUTE}="${field}"]` + (item ? `[${ARTIFACT_ITEM_ATTRIBUTE}="${item}"]` : `:not([${ARTIFACT_ITEM_ATTRIBUTE}])`);
80
+ const LOOK_ARTIFACT_CAPTURE = "camoxCapture";
81
+ /**
72
82
  * Request header asking the API to create the draft named by `DRAFT_HEADER` if it doesn't
73
83
  * exist yet. Its value is `"1"`.
74
84
  */
@@ -236,4 +246,4 @@ function isContentWrite(path) {
236
246
  }
237
247
 
238
248
  //#endregion
239
- export { CAMOX_ACTOR, CAMOX_NAME, CHECKS_RUNNING_ERROR, CONFLICTS_CHANGED_ERROR, DRAFT_CREATE_HEADER, DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, DRAFT_SEARCH_PARAM, FINDINGS_OPEN_ERROR, LIVE_READ_ONLY_ERROR, LOCALE_HEADER, LOOK_BLOCKS_PARAM, LOOK_BLOCK_DEFINITION_PARAM, LOOK_CONTENT_PARAM, LOOK_DOCUMENT_PATH, LOOK_LAYOUT_DEFINITION_PARAM, LOOK_LOCALE_PARAM, LOOK_PATH_PARAM, LOOK_PLACEHOLDER_HEIGHTS, LOOK_PLACEHOLDER_PARAM, LOOK_SETTINGS_PARAM, LOOK_TOKEN_COOKIE, LOOK_TOKEN_HEADER, NOT_PUBLISHED_CODES, PUBLISHING_DRAFT_HEADER, PUBLISHING_DRAFT_VAR, PUBLISH_ABORT_REASONS, PUBLISH_BLOCKED_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR, UNPLACED_BLOCK_ID, isContentWrite };
249
+ export { ARTIFACT_FIELD_ATTRIBUTE, ARTIFACT_ITEM_ATTRIBUTE, CAMOX_ACTOR, CAMOX_NAME, CHECKS_RUNNING_ERROR, CONFLICTS_CHANGED_ERROR, DRAFT_CREATE_HEADER, DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, DRAFT_SEARCH_PARAM, FINDINGS_OPEN_ERROR, LIVE_READ_ONLY_ERROR, LOCALE_HEADER, LOOK_ARTIFACT_CAPTURE, LOOK_BLOCKS_PARAM, LOOK_BLOCK_DEFINITION_PARAM, LOOK_CONTENT_PARAM, LOOK_DOCUMENT_PATH, LOOK_LAYOUT_DEFINITION_PARAM, LOOK_LOCALE_PARAM, LOOK_PATH_PARAM, LOOK_PLACEHOLDER_HEIGHTS, LOOK_PLACEHOLDER_PARAM, LOOK_SETTINGS_PARAM, LOOK_TOKEN_COOKIE, LOOK_TOKEN_HEADER, NOT_PUBLISHED_CODES, PUBLISHING_DRAFT_HEADER, PUBLISHING_DRAFT_VAR, PUBLISH_ABORT_REASONS, PUBLISH_BLOCKED_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR, UNPLACED_BLOCK_ID, isContentWrite, lookArtifactSelector };
package/dist/router.d.ts CHANGED
@@ -2279,8 +2279,8 @@ declare const schema: {
2279
2279
  }, {}, {
2280
2280
  length: number | undefined;
2281
2281
  }>;
2282
- overviewHeadline: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2283
- name: "overview_headline";
2282
+ openingRequest: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2283
+ name: "opening_request";
2284
2284
  tableName: "drafts";
2285
2285
  dataType: "string";
2286
2286
  columnType: "SQLiteText";
@@ -2298,8 +2298,8 @@ declare const schema: {
2298
2298
  }, {}, {
2299
2299
  length: number | undefined;
2300
2300
  }>;
2301
- overviewName: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2302
- name: "overview_name";
2301
+ overviewHeadline: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2302
+ name: "overview_headline";
2303
2303
  tableName: "drafts";
2304
2304
  dataType: "string";
2305
2305
  columnType: "SQLiteText";
@@ -10324,7 +10324,10 @@ type DraftSummary = {
10324
10324
  createdAt: number;
10325
10325
  /** When the draft last stored a change, or null while it stores nothing. */
10326
10326
  lastChangedAt: number | null;
10327
- /** How many entities the draft changes: the length of its publish preview's changes. */
10327
+ /**
10328
+ * How many changes the draft has: the entities its publish preview lists, and its code as one
10329
+ * more once the agent changed it, as publishing ships it.
10330
+ */
10328
10331
  changeCount: number;
10329
10332
  /** The tags of the locales the draft has pending translations into (ADR 0015). */
10330
10333
  translatingLocales: string[];
@@ -10376,12 +10379,10 @@ type Overview =
10376
10379
  } |
10377
10380
  /**
10378
10381
  * Written. A `stale` one describes an older version of the draft's changes: it's still shown
10379
- * while a new one is written. `name` is the short name AI suggests keeping the draft under,
10380
- * null for an overview written before overviews had one.
10382
+ * while a new one is written.
10381
10383
  */
10382
10384
  {
10383
10385
  status: "ready";
10384
- name: string | null;
10385
10386
  headline: string;
10386
10387
  bullets: string[];
10387
10388
  stale: boolean;
@@ -18126,7 +18127,6 @@ declare const router: {
18126
18127
  };
18127
18128
  }>, import("zod").ZodObject<{
18128
18129
  projectId: import("zod").ZodNumber;
18129
- name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
18130
18130
  }, import("zod/v4/core").$strip>, import("@orpc/server").Schema<DraftSummary, DraftSummary>, Record<never, never>, Record<never, never>>;
18131
18131
  get: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<import("@orpc/server").MergedInitialContext<import("@orpc/server").MergedInitialContext<BaseContext & Record<never, never>, BaseContext, BaseContext>, import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>>, import("@orpc/server").MergedCurrentContext<import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, {
18132
18132
  draft: DraftRequest | null;
@@ -18179,58 +18179,6 @@ declare const router: {
18179
18179
  }>, import("zod").ZodObject<{
18180
18180
  projectId: import("zod").ZodNumber;
18181
18181
  }, import("zod/v4/core").$strip>, import("@orpc/server").Schema<DraftSummary, DraftSummary>, Record<never, never>, Record<never, never>>;
18182
- rename: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<import("@orpc/server").MergedInitialContext<import("@orpc/server").MergedInitialContext<BaseContext & Record<never, never>, BaseContext, BaseContext>, import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>>, import("@orpc/server").MergedCurrentContext<import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, {
18183
- draft: DraftRequest | null;
18184
- locale: string | undefined;
18185
- publishingDraft: string | undefined;
18186
- look: LookGrant | undefined;
18187
- }>, import("@orpc/server").MergedCurrentContext<import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, {
18188
- draft: DraftRequest | null;
18189
- locale: string | undefined;
18190
- publishingDraft: string | undefined;
18191
- look: LookGrant | undefined;
18192
- }>>, import("@orpc/server").MergedCurrentContext<import("@orpc/server").MergedCurrentContext<import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, {
18193
- draft: DraftRequest | null;
18194
- locale: string | undefined;
18195
- publishingDraft: string | undefined;
18196
- look: LookGrant | undefined;
18197
- }>, {
18198
- db: Database;
18199
- env: Bindings;
18200
- headers: Headers;
18201
- client: string;
18202
- telemetryDisabled: boolean;
18203
- waitUntil: (promise: Promise<unknown>) => void;
18204
- apiOrigin?: string;
18205
- draft: DraftRequest | null;
18206
- locale: string | undefined;
18207
- publishingDraft: string | undefined;
18208
- look: LookGrant | undefined;
18209
- user: {
18210
- id: string;
18211
- createdAt: Date;
18212
- updatedAt: Date;
18213
- email: string;
18214
- emailVerified: boolean;
18215
- name: string;
18216
- image?: string | null | undefined;
18217
- };
18218
- session: {
18219
- id: string;
18220
- createdAt: Date;
18221
- updatedAt: Date;
18222
- userId: string;
18223
- expiresAt: Date;
18224
- token: string;
18225
- ipAddress?: string | null | undefined;
18226
- userAgent?: string | null | undefined;
18227
- activeOrganizationId?: string | null | undefined;
18228
- studio?: boolean | null | undefined;
18229
- };
18230
- }>, import("zod").ZodObject<{
18231
- projectId: import("zod").ZodNumber;
18232
- name: import("zod").ZodNullable<import("zod").ZodString>;
18233
- }, import("zod/v4/core").$strip>, import("@orpc/server").Schema<DraftSummary, DraftSummary>, Record<never, never>, Record<never, never>>;
18234
18182
  previewPublish: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<import("@orpc/server").MergedInitialContext<import("@orpc/server").MergedInitialContext<BaseContext & Record<never, never>, BaseContext, BaseContext>, import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>>, import("@orpc/server").MergedCurrentContext<import("@orpc/server").MergedCurrentContext<BaseContext, Record<never, never>>, {
18235
18183
  draft: DraftRequest | null;
18236
18184
  locale: string | undefined;
@@ -18314,7 +18262,6 @@ declare const router: {
18314
18262
  status: "pending";
18315
18263
  } | {
18316
18264
  status: "ready";
18317
- name: string | null;
18318
18265
  headline: string;
18319
18266
  bullets: string[];
18320
18267
  stale: boolean;
@@ -18357,7 +18304,6 @@ declare const router: {
18357
18304
  status: "pending";
18358
18305
  } | {
18359
18306
  status: "ready";
18360
- name: string | null;
18361
18307
  headline: string;
18362
18308
  bullets: string[];
18363
18309
  stale: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camox/api-contract",
3
- "version": "0.68.0",
3
+ "version": "0.71.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "src",
package/src/drafts.ts CHANGED
@@ -80,6 +80,64 @@ export type LookPlaceholderHeight = (typeof LOOK_PLACEHOLDER_HEIGHTS)[number];
80
80
  */
81
81
  export const UNPLACED_BLOCK_ID = "unplaced";
82
82
 
83
+ /**
84
+ * The attributes the website's artifact frames carry: the artifact field's name, and the id of the
85
+ * Repeatable Item holding it, when an item's. With the block's `data-camox-viewport-block`, they
86
+ * find one artifact's frame (`lookArtifactSelector`).
87
+ */
88
+ export const ARTIFACT_FIELD_ATTRIBUTE = "data-camox-artifact";
89
+ export const ARTIFACT_ITEM_ATTRIBUTE = "data-camox-item";
90
+
91
+ /** The CSS selector of the frame of an artifact field of a block, or of one of its items. */
92
+ export const lookArtifactSelector = ({
93
+ block,
94
+ item,
95
+ field,
96
+ }: {
97
+ block: string;
98
+ item?: string;
99
+ field: string;
100
+ }) =>
101
+ `[data-camox-viewport-block="${block}"] iframe[${ARTIFACT_FIELD_ATTRIBUTE}="${field}"]` +
102
+ (item ? `[${ARTIFACT_ITEM_ATTRIBUTE}="${item}"]` : `:not([${ARTIFACT_ITEM_ATTRIBUTE}])`);
103
+
104
+ /** An artifact's Timeline, as its runtime declares it: Marks by name, at times in ms. */
105
+ export type LookTimeline = {
106
+ duration: number;
107
+ loop: boolean;
108
+ marks: Record<string, number>;
109
+ /** The Mark whose frame stands for the artifact, or null. */
110
+ poster: string | null;
111
+ };
112
+
113
+ /**
114
+ * One finding of an artifact's guardrail report, about motion that escapes its Timeline or will
115
+ * look broken: a Web Animation the runtime didn't make (a CSS animation, a CSS transition that no
116
+ * visitor triggered, one the source made itself), a live timer, a Track the runtime skipped
117
+ * because it can't play it, Tracks on one element and property that overlap, or a loop cut,
118
+ * where a looping Timeline's last frame differs from its first.
119
+ */
120
+ export type LookGuardrailFinding = {
121
+ kind: "animation" | "timer" | "track" | "overlap" | "loop-cut";
122
+ /** What's wrong and what to do instead, for the Artifact Agent. */
123
+ text: string;
124
+ };
125
+
126
+ /**
127
+ * What the look document's artifact frames hold under `LOOK_ARTIFACT_CAPTURE`, for the browser
128
+ * `look` drives: the artifact's Timeline, null when it declares none; seeking it to `t` ms,
129
+ * resolved once the frame at that time painted, with the error `render` threw, if it did; and its
130
+ * guardrail report, empty when nothing escapes its Timeline. Frames of an SDK older than
131
+ * Timelines hold nothing there.
132
+ */
133
+ export type LookArtifactCapture = {
134
+ timeline(): Promise<LookTimeline | null>;
135
+ seek(t: number): Promise<{ error?: string }>;
136
+ guardrail(): Promise<LookGuardrailFinding[]>;
137
+ };
138
+
139
+ export const LOOK_ARTIFACT_CAPTURE = "camoxCapture";
140
+
83
141
  /**
84
142
  * Request header asking the API to create the draft named by `DRAFT_HEADER` if it doesn't
85
143
  * exist yet. Its value is `"1"`.