@openrails/contentkit-ui 0.104.0-rc.2 → 0.104.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.
Files changed (36) hide show
  1. package/dist/client/contents.d.ts +2 -0
  2. package/dist/client/contents.js +68 -58
  3. package/dist/client/contents.js.map +1 -1
  4. package/dist/client/generated/error-codes.d.ts +1 -1
  5. package/dist/client/generated/error-codes.js +4 -0
  6. package/dist/client/generated/error-codes.js.map +1 -1
  7. package/dist/client/generated/routes.d.ts +2 -2
  8. package/dist/client/generated/routes.js +7 -2
  9. package/dist/client/generated/routes.js.map +1 -1
  10. package/dist/components/admin/reader-content-editor.js +1 -1
  11. package/dist/components/admin/reader-content-editor.js.map +1 -1
  12. package/dist/components/social/poll.js +57 -48
  13. package/dist/components/social/poll.js.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/locales/de.js +1 -0
  16. package/dist/locales/de.js.map +1 -1
  17. package/dist/locales/en.d.ts +1 -0
  18. package/dist/locales/en.js +1 -0
  19. package/dist/locales/en.js.map +1 -1
  20. package/dist/locales/es.js +1 -0
  21. package/dist/locales/es.js.map +1 -1
  22. package/dist/locales/ja.js +1 -0
  23. package/dist/locales/ja.js.map +1 -1
  24. package/dist/locales/ko.js +1 -0
  25. package/dist/locales/ko.js.map +1 -1
  26. package/dist/locales/zh.js +1 -0
  27. package/dist/locales/zh.js.map +1 -1
  28. package/dist/react/contents.js +1 -1
  29. package/dist/react/contents.js.map +1 -1
  30. package/dist/react/use-engagement.js +32 -31
  31. package/dist/react/use-engagement.js.map +1 -1
  32. package/dist/react/versions.d.ts +3 -1
  33. package/dist/react/versions.js +62 -60
  34. package/dist/react/versions.js.map +1 -1
  35. package/dist/styles.css +1 -1
  36. package/package.json +1 -1
@@ -42,6 +42,8 @@ export declare class ContentsClient {
42
42
  setCreators(id: string, creators: Creator[]): Promise<Content>;
43
43
  /** Publishes now, or schedules for at; moderation "held" when the moderator holds it. */
44
44
  publish(id: string, at?: string): Promise<Content>;
45
+ /** publish, retrying while the server answers not_ready (files finishing their publication) for up to waitMs. */
46
+ publishWhenReady(id: string, at?: string, waitMs?: number): Promise<Content>;
45
47
  unpublish(id: string): Promise<Content>;
46
48
  remove(id: string): Promise<void>;
47
49
  restore(id: string): Promise<Content>;
@@ -1,101 +1,111 @@
1
- import { call as e } from "./route.js";
1
+ import { toContentKitError as e } from "./errors.js";
2
+ import { call as t } from "./route.js";
2
3
  //#region src/client/contents.ts
3
- var t = "contentkit:", n = (e) => t + e, r = () => /contentkit:(i-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/g, i = class {
4
+ var n = "contentkit:", r = (e) => n + e, i = () => /contentkit:(i-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/g, a = class {
4
5
  http;
5
6
  constructor(e) {
6
7
  this.http = e;
7
8
  }
8
- get(t, n, r) {
9
- return e(this.http, "GET", "/contents/{id}", {
10
- params: { id: t },
9
+ get(e, n, r) {
10
+ return t(this.http, "GET", "/contents/{id}", {
11
+ params: { id: e },
11
12
  query: { language: n },
12
13
  signal: r
13
14
  });
14
15
  }
15
- version(t, n, r, i) {
16
- return e(this.http, "GET", "/contents/{id}/versions/{vid}", {
16
+ version(e, n, r, i) {
17
+ return t(this.http, "GET", "/contents/{id}/versions/{vid}", {
17
18
  params: {
18
- id: t,
19
+ id: e,
19
20
  vid: n
20
21
  },
21
22
  query: { language: r },
22
23
  signal: i
23
24
  });
24
25
  }
25
- manage(t = {}, n) {
26
- let { kind: r, ...i } = t;
27
- return r ? e(this.http, "GET", "/manage/{kind}", {
26
+ manage(e = {}, n) {
27
+ let { kind: r, ...i } = e;
28
+ return r ? t(this.http, "GET", "/manage/{kind}", {
28
29
  params: { kind: r },
29
30
  query: i,
30
31
  signal: n
31
- }) : e(this.http, "GET", "/manage", {
32
+ }) : t(this.http, "GET", "/manage", {
32
33
  query: i,
33
34
  signal: n
34
35
  });
35
36
  }
36
- manageCount(t, n) {
37
- let { kind: r, ...i } = t;
38
- return e(this.http, "GET", "/manage/{kind}/count", {
37
+ manageCount(e, n) {
38
+ let { kind: r, ...i } = e;
39
+ return t(this.http, "GET", "/manage/{kind}/count", {
39
40
  params: { kind: r },
40
41
  query: i,
41
42
  signal: n
42
43
  });
43
44
  }
44
- create(t) {
45
- return this.write(e(this.http, "POST", "/contents", { body: t }));
45
+ create(e) {
46
+ return this.write(t(this.http, "POST", "/contents", { body: e }));
46
47
  }
47
- update(t, n) {
48
- return this.write(e(this.http, "PATCH", "/contents/{id}", {
49
- params: { id: t },
48
+ update(e, n) {
49
+ return this.write(t(this.http, "PATCH", "/contents/{id}", {
50
+ params: { id: e },
50
51
  body: n
51
52
  }));
52
53
  }
53
- putText(t, n, r) {
54
- return this.write(e(this.http, "PUT", "/contents/{id}/text/{language}", {
54
+ putText(e, n, r) {
55
+ return this.write(t(this.http, "PUT", "/contents/{id}/text/{language}", {
55
56
  params: {
56
- id: t,
57
+ id: e,
57
58
  language: n
58
59
  },
59
60
  body: r
60
61
  }));
61
62
  }
62
- deleteText(t, n) {
63
- return this.write(e(this.http, "DELETE", "/contents/{id}/text/{language}", { params: {
64
- id: t,
63
+ deleteText(e, n) {
64
+ return this.write(t(this.http, "DELETE", "/contents/{id}/text/{language}", { params: {
65
+ id: e,
65
66
  language: n
66
67
  } }));
67
68
  }
68
- setCreators(t, n) {
69
- return this.write(e(this.http, "PUT", "/contents/{id}/creators", {
70
- params: { id: t },
69
+ setCreators(e, n) {
70
+ return this.write(t(this.http, "PUT", "/contents/{id}/creators", {
71
+ params: { id: e },
71
72
  body: { creators: n }
72
73
  }));
73
74
  }
74
- publish(t, n) {
75
- return this.write(e(this.http, "POST", "/contents/{id}/publish", {
76
- params: { id: t },
75
+ publish(e, n) {
76
+ return this.write(t(this.http, "POST", "/contents/{id}/publish", {
77
+ params: { id: e },
77
78
  body: { publish_at: n }
78
79
  }));
79
80
  }
80
- unpublish(t) {
81
- return this.write(e(this.http, "POST", "/contents/{id}/unpublish", { params: { id: t } }));
81
+ async publishWhenReady(t, n, r = 3e4) {
82
+ let i = Date.now() + r;
83
+ for (let r = 1e3;; r = Math.min(r * 2, 5e3)) try {
84
+ return await this.publish(t, n);
85
+ } catch (t) {
86
+ if (e(t).code !== "not_ready" || Date.now() + r > i) throw t;
87
+ await new Promise((e) => setTimeout(e, r));
88
+ }
82
89
  }
83
- async remove(t) {
90
+ unpublish(e) {
91
+ return this.write(t(this.http, "POST", "/contents/{id}/unpublish", { params: { id: e } }));
92
+ }
93
+ async remove(e) {
84
94
  let n = this.http.captureChanges();
85
- await e(this.http, "DELETE", "/contents/{id}", { params: { id: t } }), n({
95
+ await t(this.http, "DELETE", "/contents/{id}", { params: { id: e } }), n({
86
96
  type: "content.deleted",
87
- id: t
97
+ id: e
88
98
  });
89
99
  }
90
- restore(t) {
91
- return this.write(e(this.http, "POST", "/contents/{id}/restore", { params: { id: t } }));
100
+ restore(e) {
101
+ return this.write(t(this.http, "POST", "/contents/{id}/restore", { params: { id: e } }));
92
102
  }
93
103
  setCover(e, t, n) {
94
104
  return this.updateVersion(e, t, { cover: n ?? "" });
95
105
  }
96
- inlineImage(t, n, r, i) {
97
- return e(this.http, "POST", "/contents/{id}/images", {
98
- params: { id: t },
106
+ inlineImage(e, n, r, i) {
107
+ return t(this.http, "POST", "/contents/{id}/images", {
108
+ params: { id: e },
99
109
  body: {
100
110
  image: r,
101
111
  version: n
@@ -103,37 +113,37 @@ var t = "contentkit:", n = (e) => t + e, r = () => /contentkit:(i-[0-9a-f]{8}-[0
103
113
  signal: i
104
114
  });
105
115
  }
106
- addVersion(t, n) {
107
- return this.writeVersion(t, e(this.http, "POST", "/contents/{id}/versions", {
108
- params: { id: t },
116
+ addVersion(e, n) {
117
+ return this.writeVersion(e, t(this.http, "POST", "/contents/{id}/versions", {
118
+ params: { id: e },
109
119
  body: n
110
120
  }));
111
121
  }
112
- updateVersion(t, n, r) {
113
- return this.writeVersion(t, e(this.http, "PATCH", "/contents/{id}/versions/{vid}", {
122
+ updateVersion(e, n, r) {
123
+ return this.writeVersion(e, t(this.http, "PATCH", "/contents/{id}/versions/{vid}", {
114
124
  params: {
115
- id: t,
125
+ id: e,
116
126
  vid: n
117
127
  },
118
128
  body: r
119
129
  }));
120
130
  }
121
- async removeVersion(t, n) {
122
- await this.writeVersion(t, e(this.http, "DELETE", "/contents/{id}/versions/{vid}", { params: {
123
- id: t,
131
+ async removeVersion(e, n) {
132
+ await this.writeVersion(e, t(this.http, "DELETE", "/contents/{id}/versions/{vid}", { params: {
133
+ id: e,
124
134
  vid: n
125
135
  } }));
126
136
  }
127
- orderVersions(t, n) {
128
- return this.write(e(this.http, "PUT", "/contents/{id}/versions/order", {
129
- params: { id: t },
137
+ orderVersions(e, n) {
138
+ return this.write(t(this.http, "PUT", "/contents/{id}/versions/order", {
139
+ params: { id: e },
130
140
  body: { ids: n }
131
141
  }));
132
142
  }
133
- setSegments(t, n, r) {
134
- return this.writeVersion(t, e(this.http, "PUT", "/contents/{id}/versions/{vid}/segments", {
143
+ setSegments(e, n, r) {
144
+ return this.writeVersion(e, t(this.http, "PUT", "/contents/{id}/versions/{vid}/segments", {
135
145
  params: {
136
- id: t,
146
+ id: e,
137
147
  vid: n
138
148
  },
139
149
  body: { segments: r }
@@ -155,6 +165,6 @@ var t = "contentkit:", n = (e) => t + e, r = () => /contentkit:(i-[0-9a-f]{8}-[0
155
165
  }
156
166
  };
157
167
  //#endregion
158
- export { i as ContentsClient, t as IMAGE_SCHEME, n as imageRef, r as imageRefs };
168
+ export { a as ContentsClient, n as IMAGE_SCHEME, r as imageRef, i as imageRefs };
159
169
 
160
170
  //# sourceMappingURL=contents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contents.js","names":[],"sources":["../../src/client/contents.ts"],"sourcesContent":["import type {\n CatalogText,\n Content,\n ContentInput,\n ContentPatch,\n Creator,\n InlineImage,\n ManageCount,\n Segment,\n Version,\n VersionInput,\n} from \"./generated/wire.js\";\nimport type { Http } from \"./http.js\";\nimport { call, type RouteQuery } from \"./route.js\";\n\n/** The URL scheme of an image reference in a content body. */\nexport const IMAGE_SCHEME = \"contentkit:\";\n\n/**\n * The reference a body stores for one of its images, by name\n * (\"contentkit:i-{uuid}\"), where the image's URL would go: reads resolve it to\n * the image's current public file (`Content.images`).\n */\nexport const imageRef = (name: string) => IMAGE_SCHEME + name;\n\n/** Matches every image reference; the name is group 1. */\nexport const imageRefs = () => /contentkit:(i-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/g;\n\n/** Management filters; kind selects /manage/{kind}, otherwise /manage. */\nexport type ManageQuery = RouteQuery<\"GET\", \"/manage\"> & { kind?: string };\n\n/** The /manage/{kind} filters a count takes. */\nexport type ManageCountQuery = RouteQuery<\"GET\", \"/manage/{kind}/count\"> & { kind: string };\n\n/**\n * Content items: a viewer's reads, and the writes of their creators, their\n * owner group's editors and root:content:write holders.\n */\nexport class ContentsClient {\n constructor(private readonly http: Http) {}\n\n /** The item as the caller sees it; text in language, else the site's first, else any. */\n get(id: string, language?: string, signal?: AbortSignal): Promise<Content> {\n return call(this.http, \"GET\", \"/contents/{id}\", { params: { id }, query: { language }, signal });\n }\n version(id: string, vid: string, language?: string, signal?: AbortSignal): Promise<Version> {\n return call(this.http, \"GET\", \"/contents/{id}/versions/{vid}\", { params: { id, vid }, query: { language }, signal });\n }\n /** Items the caller manages, newest first: all for root:content:write holders, else theirs or an owner group's. */\n manage(q: ManageQuery = {}, signal?: AbortSignal): Promise<Content[]> {\n const { kind, ...query } = q;\n return kind\n ? call(this.http, \"GET\", \"/manage/{kind}\", { params: { kind }, query, signal })\n : call(this.http, \"GET\", \"/manage\", { query, signal });\n }\n /** How many items of a kind the caller manages under these filters: exact up to 10,000, then truncated. */\n manageCount(q: ManageCountQuery, signal?: AbortSignal): Promise<ManageCount> {\n const { kind, ...query } = q;\n return call(this.http, \"GET\", \"/manage/{kind}/count\", { params: { kind }, query, signal });\n }\n /** Creates a draft. */\n create(input: ContentInput): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents\", { body: input }));\n }\n update(id: string, patch: ContentPatch): Promise<Content> {\n return this.write(call(this.http, \"PATCH\", \"/contents/{id}\", { params: { id }, body: patch }));\n }\n /** Sets the text in one language; moderation \"held\" when the moderator holds the edit. */\n putText(id: string, language: string, text: CatalogText): Promise<Content> {\n return this.write(call(this.http, \"PUT\", \"/contents/{id}/text/{language}\", { params: { id, language }, body: text }));\n }\n deleteText(id: string, language: string): Promise<Content> {\n return this.write(call(this.http, \"DELETE\", \"/contents/{id}/text/{language}\", { params: { id, language } }));\n }\n setCreators(id: string, creators: Creator[]): Promise<Content> {\n return this.write(call(this.http, \"PUT\", \"/contents/{id}/creators\", { params: { id }, body: { creators } }));\n }\n /** Publishes now, or schedules for at; moderation \"held\" when the moderator holds it. */\n publish(id: string, at?: string): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents/{id}/publish\", { params: { id }, body: { publish_at: at } }));\n }\n unpublish(id: string): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents/{id}/unpublish\", { params: { id } }));\n }\n async remove(id: string): Promise<void> {\n const emit = this.http.captureChanges();\n await call(this.http, \"DELETE\", \"/contents/{id}\", { params: { id } });\n emit({ type: \"content.deleted\", id });\n }\n restore(id: string): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents/{id}/restore\", { params: { id } }));\n }\n /** Selects a version's cover by the name (\"i-{uuid}\") of one of its cover uploads; null returns to its first. */\n setCover(id: string, vid: string, image: string | null): Promise<Version> {\n return this.updateVersion(id, vid, { cover: image ?? \"\" });\n }\n /**\n * A body image uploaded to version vid (its private files), copied into\n * every other version: the reference to store in the body and a URL that shows\n * it to the editor now (null while none exists).\n */\n inlineImage(id: string, vid: string, image: string, signal?: AbortSignal): Promise<InlineImage> {\n return call(this.http, \"POST\", \"/contents/{id}/images\", { params: { id }, body: { image, version: vid }, signal });\n }\n addVersion(id: string, input: VersionInput): Promise<Version> {\n return this.writeVersion(id, call(this.http, \"POST\", \"/contents/{id}/versions\", { params: { id }, body: input }));\n }\n updateVersion(id: string, vid: string, input: VersionInput): Promise<Version> {\n return this.writeVersion(id, call(this.http, \"PATCH\", \"/contents/{id}/versions/{vid}\", { params: { id, vid }, body: input }));\n }\n async removeVersion(id: string, vid: string): Promise<void> {\n await this.writeVersion(id, call(this.http, \"DELETE\", \"/contents/{id}/versions/{vid}\", { params: { id, vid } }));\n }\n /** Orders the versions: ids lists each version that is not deleted, first first. */\n orderVersions(id: string, ids: string[]): Promise<Content> {\n return this.write(call(this.http, \"PUT\", \"/contents/{id}/versions/order\", { params: { id }, body: { ids } }));\n }\n /** Replaces a version's segments (chapters). */\n setSegments(id: string, vid: string, segments: Segment[]): Promise<Version> {\n return this.writeVersion(id, call(this.http, \"PUT\", \"/contents/{id}/versions/{vid}/segments\", { params: { id, vid }, body: { segments } }));\n }\n\n private async write(p: Promise<Content>): Promise<Content> {\n const emit = this.http.captureChanges();\n const content = await p;\n emit({ type: \"content.saved\", content });\n return content;\n }\n\n private async writeVersion<T>(id: string, p: Promise<T>): Promise<T> {\n const emit = this.http.captureChanges();\n const out = await p;\n emit({ type: \"content.changed\", id });\n return out;\n }\n}\n"],"mappings":";;AAgBA,IAAa,IAAe,eAOf,KAAY,MAAiB,IAAe,GAG5C,UAAkB,gFAYlB,IAAb,MAA4B;CACG;CAA7B,YAAY,GAA6B;EAAZ,KAAA,OAAA;CAAa;CAG1C,IAAI,GAAY,GAAmB,GAAwC;EACzE,OAAO,EAAK,KAAK,MAAM,OAAO,kBAAkB;GAAE,QAAQ,EAAE,MAAG;GAAG,OAAO,EAAE,YAAS;GAAG;EAAO,CAAC;CACjG;CACA,QAAQ,GAAY,GAAa,GAAmB,GAAwC;EAC1F,OAAO,EAAK,KAAK,MAAM,OAAO,iCAAiC;GAAE,QAAQ;IAAE;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AiC,EAAE,QAAQ;GAAE;GAAI;EAAI,EAAE,CAAC,CAAC;CACjH;CAEA,cAAc,GAAY,GAAiC;EACzD,OAAO,KAAK,MAAM,EAAK,KAAK,MAAM,OAAO,iCAAiC;GAAE,QAAQ,EAAE,MAAG;GAAG,MAAM,EAAE,OAAI;EAAE,CAAC,CAAC;CAC9G;CAEA,YAAY,GAAY,GAAa,GAAuC;EAC1E,OAAO,KAAK,aAAa,GAAI,EAAK,KAAK,MAAM,OAAO,0CAA0C;GAAE,QAAQ;IAAE;IAAI;GAAI;GAAG,MAAM,EAAE,YAAS;EAAE,CAAC,CAAC;CAC5I;CAEA,MAAc,MAAM,GAAuC;EACzD,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAU,MAAM;EAEtB,OADA,EAAK;GAAE,MAAM;GAAiB;EAAQ,CAAC,GAChC;CACT;CAEA,MAAc,aAAgB,GAAY,GAA2B;EACnE,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAM,MAAM;EAElB,OADA,EAAK;GAAE,MAAM;GAAmB;EAAG,CAAC,GAC7B;CACT;AACF"}
1
+ {"version":3,"file":"contents.js","names":[],"sources":["../../src/client/contents.ts"],"sourcesContent":["import type {\n CatalogText,\n Content,\n ContentInput,\n ContentPatch,\n Creator,\n InlineImage,\n ManageCount,\n Segment,\n Version,\n VersionInput,\n} from \"./generated/wire.js\";\nimport { toContentKitError } from \"./errors.js\";\nimport type { Http } from \"./http.js\";\nimport { call, type RouteQuery } from \"./route.js\";\n\n/** The URL scheme of an image reference in a content body. */\nexport const IMAGE_SCHEME = \"contentkit:\";\n\n/**\n * The reference a body stores for one of its images, by name\n * (\"contentkit:i-{uuid}\"), where the image's URL would go: reads resolve it to\n * the image's current public file (`Content.images`).\n */\nexport const imageRef = (name: string) => IMAGE_SCHEME + name;\n\n/** Matches every image reference; the name is group 1. */\nexport const imageRefs = () => /contentkit:(i-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/g;\n\n/** Management filters; kind selects /manage/{kind}, otherwise /manage. */\nexport type ManageQuery = RouteQuery<\"GET\", \"/manage\"> & { kind?: string };\n\n/** The /manage/{kind} filters a count takes. */\nexport type ManageCountQuery = RouteQuery<\"GET\", \"/manage/{kind}/count\"> & { kind: string };\n\n/**\n * Content items: a viewer's reads, and the writes of their creators, their\n * owner group's editors and root:content:write holders.\n */\nexport class ContentsClient {\n constructor(private readonly http: Http) {}\n\n /** The item as the caller sees it; text in language, else the site's first, else any. */\n get(id: string, language?: string, signal?: AbortSignal): Promise<Content> {\n return call(this.http, \"GET\", \"/contents/{id}\", { params: { id }, query: { language }, signal });\n }\n version(id: string, vid: string, language?: string, signal?: AbortSignal): Promise<Version> {\n return call(this.http, \"GET\", \"/contents/{id}/versions/{vid}\", { params: { id, vid }, query: { language }, signal });\n }\n /** Items the caller manages, newest first: all for root:content:write holders, else theirs or an owner group's. */\n manage(q: ManageQuery = {}, signal?: AbortSignal): Promise<Content[]> {\n const { kind, ...query } = q;\n return kind\n ? call(this.http, \"GET\", \"/manage/{kind}\", { params: { kind }, query, signal })\n : call(this.http, \"GET\", \"/manage\", { query, signal });\n }\n /** How many items of a kind the caller manages under these filters: exact up to 10,000, then truncated. */\n manageCount(q: ManageCountQuery, signal?: AbortSignal): Promise<ManageCount> {\n const { kind, ...query } = q;\n return call(this.http, \"GET\", \"/manage/{kind}/count\", { params: { kind }, query, signal });\n }\n /** Creates a draft. */\n create(input: ContentInput): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents\", { body: input }));\n }\n update(id: string, patch: ContentPatch): Promise<Content> {\n return this.write(call(this.http, \"PATCH\", \"/contents/{id}\", { params: { id }, body: patch }));\n }\n /** Sets the text in one language; moderation \"held\" when the moderator holds the edit. */\n putText(id: string, language: string, text: CatalogText): Promise<Content> {\n return this.write(call(this.http, \"PUT\", \"/contents/{id}/text/{language}\", { params: { id, language }, body: text }));\n }\n deleteText(id: string, language: string): Promise<Content> {\n return this.write(call(this.http, \"DELETE\", \"/contents/{id}/text/{language}\", { params: { id, language } }));\n }\n setCreators(id: string, creators: Creator[]): Promise<Content> {\n return this.write(call(this.http, \"PUT\", \"/contents/{id}/creators\", { params: { id }, body: { creators } }));\n }\n /** Publishes now, or schedules for at; moderation \"held\" when the moderator holds it. */\n publish(id: string, at?: string): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents/{id}/publish\", { params: { id }, body: { publish_at: at } }));\n }\n /** publish, retrying while the server answers not_ready (files finishing their publication) for up to waitMs. */\n async publishWhenReady(id: string, at?: string, waitMs = 30_000): Promise<Content> {\n const deadline = Date.now() + waitMs;\n for (let delay = 1000; ; delay = Math.min(delay * 2, 5000)) {\n try {\n return await this.publish(id, at);\n } catch (e) {\n if (toContentKitError(e).code !== \"not_ready\" || Date.now() + delay > deadline) throw e;\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n }\n unpublish(id: string): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents/{id}/unpublish\", { params: { id } }));\n }\n async remove(id: string): Promise<void> {\n const emit = this.http.captureChanges();\n await call(this.http, \"DELETE\", \"/contents/{id}\", { params: { id } });\n emit({ type: \"content.deleted\", id });\n }\n restore(id: string): Promise<Content> {\n return this.write(call(this.http, \"POST\", \"/contents/{id}/restore\", { params: { id } }));\n }\n /** Selects a version's cover by the name (\"i-{uuid}\") of one of its cover uploads; null returns to its first. */\n setCover(id: string, vid: string, image: string | null): Promise<Version> {\n return this.updateVersion(id, vid, { cover: image ?? \"\" });\n }\n /**\n * A body image uploaded to version vid (its private files), copied into\n * every other version: the reference to store in the body and a URL that shows\n * it to the editor now (null while none exists).\n */\n inlineImage(id: string, vid: string, image: string, signal?: AbortSignal): Promise<InlineImage> {\n return call(this.http, \"POST\", \"/contents/{id}/images\", { params: { id }, body: { image, version: vid }, signal });\n }\n addVersion(id: string, input: VersionInput): Promise<Version> {\n return this.writeVersion(id, call(this.http, \"POST\", \"/contents/{id}/versions\", { params: { id }, body: input }));\n }\n updateVersion(id: string, vid: string, input: VersionInput): Promise<Version> {\n return this.writeVersion(id, call(this.http, \"PATCH\", \"/contents/{id}/versions/{vid}\", { params: { id, vid }, body: input }));\n }\n async removeVersion(id: string, vid: string): Promise<void> {\n await this.writeVersion(id, call(this.http, \"DELETE\", \"/contents/{id}/versions/{vid}\", { params: { id, vid } }));\n }\n /** Orders the versions: ids lists each version that is not deleted, first first. */\n orderVersions(id: string, ids: string[]): Promise<Content> {\n return this.write(call(this.http, \"PUT\", \"/contents/{id}/versions/order\", { params: { id }, body: { ids } }));\n }\n /** Replaces a version's segments (chapters). */\n setSegments(id: string, vid: string, segments: Segment[]): Promise<Version> {\n return this.writeVersion(id, call(this.http, \"PUT\", \"/contents/{id}/versions/{vid}/segments\", { params: { id, vid }, body: { segments } }));\n }\n\n private async write(p: Promise<Content>): Promise<Content> {\n const emit = this.http.captureChanges();\n const content = await p;\n emit({ type: \"content.saved\", content });\n return content;\n }\n\n private async writeVersion<T>(id: string, p: Promise<T>): Promise<T> {\n const emit = this.http.captureChanges();\n const out = await p;\n emit({ type: \"content.changed\", id });\n return out;\n }\n}\n"],"mappings":";;;AAiBA,IAAa,IAAe,eAOf,KAAY,MAAiB,IAAe,GAG5C,UAAkB,gFAYlB,IAAb,MAA4B;CACG;CAA7B,YAAY,GAA6B;EAAZ,KAAA,OAAA;CAAa;CAG1C,IAAI,GAAY,GAAmB,GAAwC;EACzE,OAAO,EAAK,KAAK,MAAM,OAAO,kBAAkB;GAAE,QAAQ,EAAE,MAAG;GAAG,OAAO,EAAE,YAAS;GAAG;EAAO,CAAC;CACjG;CACA,QAAQ,GAAY,GAAa,GAAmB,GAAwC;EAC1F,OAAO,EAAK,KAAK,MAAM,OAAO,iCAAiC;GAAE,QAAQ;IAAE;IAAI;GAAI;GAAG,OAAO,EAAE,YAAS;GAAG;EAAO,CAAC;CACrH;CAEA,OAAO,IAAiB,CAAC,GAAG,GAA0C;EACpE,IAAM,EAAE,SA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AC;CAClH;CACA,cAAc,GAAY,GAAa,GAAuC;EAC5E,OAAO,KAAK,aAAa,GAAI,EAAK,KAAK,MAAM,SAAS,iCAAiC;GAAE,QAAQ;IAAE;IAAI;GAAI;GAAG,MAAM;EAAM,CAAC,CAAC;CAC9H;CACA,MAAM,cAAc,GAAY,GAA4B;EAC1D,MAAM,KAAK,aAAa,GAAI,EAAK,KAAK,MAAM,UAAU,iCAAiC,EAAE,QAAQ;GAAE;GAAI;EAAI,EAAE,CAAC,CAAC;CACjH;CAEA,cAAc,GAAY,GAAiC;EACzD,OAAO,KAAK,MAAM,EAAK,KAAK,MAAM,OAAO,iCAAiC;GAAE,QAAQ,EAAE,MAAG;GAAG,MAAM,EAAE,OAAI;EAAE,CAAC,CAAC;CAC9G;CAEA,YAAY,GAAY,GAAa,GAAuC;EAC1E,OAAO,KAAK,aAAa,GAAI,EAAK,KAAK,MAAM,OAAO,0CAA0C;GAAE,QAAQ;IAAE;IAAI;GAAI;GAAG,MAAM,EAAE,YAAS;EAAE,CAAC,CAAC;CAC5I;CAEA,MAAc,MAAM,GAAuC;EACzD,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAU,MAAM;EAEtB,OADA,EAAK;GAAE,MAAM;GAAiB;EAAQ,CAAC,GAChC;CACT;CAEA,MAAc,aAAgB,GAAY,GAA2B;EACnE,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAM,MAAM;EAElB,OADA,EAAK;GAAE,MAAM;GAAmB;EAAG,CAAC,GAC7B;CACT;AACF"}
@@ -1,4 +1,4 @@
1
- export type ErrorCode = "ambiguous_entity" | "animation_not_allowed" | "animation_too_long" | "animation_unsupported" | "checksum_mismatch" | "comment_banned" | "comment_too_long" | "comments_closed" | "comments_locked" | "conflict" | "content_changed" | "download_unavailable" | "forbidden" | "gone" | "image_too_large" | "image_too_small" | "image_unreadable" | "incomplete" | "internal_error" | "invalid_archive" | "invalid_request" | "limit_reached" | "moderation_rejected" | "no_download" | "not_configured" | "not_found" | "not_joinable" | "not_uploaded" | "operation_busy" | "operation_conflict" | "quota_exceeded" | "rate_limited" | "source_conflict" | "tenant_mismatch" | "too_large" | "too_many_files" | "type_not_allowed" | "unauthorized" | "unavailable" | "unknown_entity" | "upgrade_required" | "video_aspect_unsupported" | "video_over_budget" | "video_too_large" | "video_too_long";
1
+ export type ErrorCode = "ambiguous_entity" | "animation_not_allowed" | "animation_too_long" | "animation_unsupported" | "checksum_mismatch" | "comment_banned" | "comment_too_long" | "comments_closed" | "comments_locked" | "conflict" | "content_changed" | "download_unavailable" | "forbidden" | "gone" | "image_too_large" | "image_too_small" | "image_unreadable" | "incomplete" | "internal_error" | "invalid_archive" | "invalid_request" | "limit_reached" | "moderation_rejected" | "no_download" | "not_configured" | "not_found" | "not_joinable" | "not_ready" | "not_uploaded" | "operation_busy" | "operation_conflict" | "quota_exceeded" | "rate_limited" | "source_conflict" | "tenant_mismatch" | "too_large" | "too_many_files" | "type_not_allowed" | "unauthorized" | "unavailable" | "unknown_entity" | "upgrade_required" | "video_aspect_unsupported" | "video_over_budget" | "video_too_large" | "video_too_long";
2
2
  export declare const CONTENTKIT_ERROR_CODES: Readonly<Record<ErrorCode, {
3
3
  status: number;
4
4
  meaning: string;
@@ -108,6 +108,10 @@ var e = {
108
108
  status: 409,
109
109
  meaning: "The group has no free offer to join: it sells its membership, or nothing."
110
110
  },
111
+ not_ready: {
112
+ status: 409,
113
+ meaning: "A version that would go live still has files processing or a publication not yet current; `error` says what. Retry once processing finishes."
114
+ },
111
115
  not_uploaded: {
112
116
  status: 409,
113
117
  meaning: "A commit names an upload that has not landed; `blobs` lists the ones to upload again."
@@ -1 +1 @@
1
- {"version":3,"file":"error-codes.js","names":[],"sources":["../../../src/client/generated/error-codes.ts"],"sourcesContent":["// Generated by `go generate ./internal/contract` from ContentKit's error-code registry. Do not edit.\n\nexport type ErrorCode =\n | \"ambiguous_entity\"\n | \"animation_not_allowed\"\n | \"animation_too_long\"\n | \"animation_unsupported\"\n | \"checksum_mismatch\"\n | \"comment_banned\"\n | \"comment_too_long\"\n | \"comments_closed\"\n | \"comments_locked\"\n | \"conflict\"\n | \"content_changed\"\n | \"download_unavailable\"\n | \"forbidden\"\n | \"gone\"\n | \"image_too_large\"\n | \"image_too_small\"\n | \"image_unreadable\"\n | \"incomplete\"\n | \"internal_error\"\n | \"invalid_archive\"\n | \"invalid_request\"\n | \"limit_reached\"\n | \"moderation_rejected\"\n | \"no_download\"\n | \"not_configured\"\n | \"not_found\"\n | \"not_joinable\"\n | \"not_uploaded\"\n | \"operation_busy\"\n | \"operation_conflict\"\n | \"quota_exceeded\"\n | \"rate_limited\"\n | \"source_conflict\"\n | \"tenant_mismatch\"\n | \"too_large\"\n | \"too_many_files\"\n | \"type_not_allowed\"\n | \"unauthorized\"\n | \"unavailable\"\n | \"unknown_entity\"\n | \"upgrade_required\"\n | \"video_aspect_unsupported\"\n | \"video_over_budget\"\n | \"video_too_large\"\n | \"video_too_long\"\n;\n\n// Each code's HTTP status and meaning. A message on the wire is for people;\n// classify by code.\nexport const CONTENTKIT_ERROR_CODES: Readonly<Record<ErrorCode, { status: number; meaning: string }>> = {\n ambiguous_entity: { status: 409, meaning: \"More than one entity matches the localized name or alias and scope; supply its ID.\" },\n animation_not_allowed: { status: 422, meaning: \"An animated image where the upload path refuses animation.\" },\n animation_too_long: { status: 422, meaning: \"The animation has more frames or seconds than the processor allows.\" },\n animation_unsupported: { status: 415, meaning: \"An AVIF or HEIF image sequence, which is decoded as one frame.\" },\n checksum_mismatch: { status: 422, meaning: \"The stored bytes differ from the declared SHA-256.\" },\n comment_banned: { status: 403, meaning: \"The actor is banned from commenting on this target; `ban` says the scope, the reason and when it ends.\" },\n comment_too_long: { status: 422, meaning: \"The comment is longer than the site allows; `details.max` is the limit in characters.\" },\n comments_closed: { status: 403, meaning: \"The target's comments are closed or hidden: existing ones may show, new ones and edits are refused.\" },\n comments_locked: { status: 403, meaning: \"The actor can't open the content (or the comment's version), so its comments take no writes from them; reads withhold them.\" },\n conflict: { status: 409, meaning: \"A concurrent change, a path or slug already taken, or an operation id already used for another commit.\" },\n content_changed: { status: 409, meaning: \"A publishing operation's content or version was edited after submission.\" },\n download_unavailable: { status: 403, meaning: \"The host's download policy refuses this download now: `reason` is its code, `available_at` when it opens if a matter of time. Nothing was charged.\" },\n forbidden: { status: 403, meaning: \"The actor may not do this.\" },\n gone: { status: 410, meaning: \"The content was removed.\" },\n image_too_large: { status: 413, meaning: \"The image has more pixels or frames than the processor decodes.\" },\n image_too_small: { status: 422, meaning: \"The edited image is narrower than its public preset's minimum width.\" },\n image_unreadable: { status: 422, meaning: \"The file is not a decodable image of its declared type.\" },\n incomplete: { status: 409, meaning: \"A multipart upload is missing parts.\" },\n internal_error: { status: 500, meaning: \"A server fault; the cause is in the server log.\" },\n invalid_archive: { status: 422, meaning: \"The publishing archive cannot produce the required supported pages.\" },\n invalid_request: { status: 400, meaning: \"The request is malformed: its body, a query parameter or a path value.\" },\n limit_reached: { status: 409, meaning: \"The owner already has as many groups of the kind as the site allows (max_per_owner).\" },\n moderation_rejected: { status: 422, meaning: \"The moderator refused the text; `error` says why.\" },\n no_download: { status: 409, meaning: \"The version has no file its kind's download serves: nothing uploaded, or its upload failed or was dropped.\" },\n not_configured: { status: 501, meaning: \"The capability needs a port the host did not configure; retrying does not help.\" },\n not_found: { status: 404, meaning: \"Nothing by that name, or nothing the actor may see.\" },\n not_joinable: { status: 409, meaning: \"The group has no free offer to join: it sells its membership, or nothing.\" },\n not_uploaded: { status: 409, meaning: \"A commit names an upload that has not landed; `blobs` lists the ones to upload again.\" },\n operation_busy: { status: 409, meaning: \"The publishing operation is preparing an upload or completing another request; retry.\" },\n operation_conflict: { status: 409, meaning: \"A publishing operation ID already names different immutable input.\" },\n quota_exceeded: { status: 413, meaning: \"The uploader's storage quota is used up.\" },\n rate_limited: { status: 429, meaning: \"Too many requests; retry after `retry_after` seconds (also the Retry-After header).\" },\n source_conflict: { status: 409, meaning: \"The external source already belongs to another publishing operation in this app.\" },\n tenant_mismatch: { status: 500, meaning: \"A host port answered with another tenant's data: a configuration fault.\" },\n too_large: { status: 413, meaning: \"The file is larger than its upload path allows; `details` has `size` and `max_bytes`.\" },\n too_many_files: { status: 409, meaning: \"The commit would put more files in an upload path, or the item, than allowed; `details.max` is the limit.\" },\n type_not_allowed: { status: 415, meaning: \"The file type is not allowed in the upload path; `details.allowed` lists the types.\" },\n unauthorized: { status: 401, meaning: \"The request needs a valid credential: it has none where the route needs one, or one that is expired, revoked or invalid. WWW-Authenticate says which.\" },\n unavailable: { status: 503, meaning: \"The host's auth, media storage or signal plane cannot be reached, or a commit's recovery is pending; retry.\" },\n unknown_entity: { status: 400, meaning: \"A publishing entity reference does not resolve in this app and entity creation is disabled.\" },\n upgrade_required: { status: 503, meaning: \"The media item was stored before v0.68 and is served once the host's media upgrade (contentkit_media_upgrade) has converted it.\" },\n video_aspect_unsupported: { status: 422, meaning: \"The video's display aspect is outside what its upload path accepts; `details` has `min_aspect` and `max_aspect` (width/height).\" },\n video_over_budget: { status: 422, meaning: \"The planned encode costs more than its upload path allows, or the source averages under a frame a second.\" },\n video_too_large: { status: 422, meaning: \"The video's frames are larger than its upload path allows.\" },\n video_too_long: { status: 422, meaning: \"The video or audio runs longer than its upload path allows.\" },\n};\n"],"mappings":";AAoDA,IAAa,IAA2F;CACtG,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAAqF;CAC/H,uBAAuB;EAAE,QAAQ;EAAK,SAAS;CAA6D;CAC5G,oBAAoB;EAAE,QAAQ;EAAK,SAAS;CAAsE;CAClH,uBAAuB;EAAE,QAAQ;EAAK,SAAS;CAAiE;CAChH,mBAAmB;EAAE,QAAQ;EAAK,SAAS;CAAqD;CAChG,gBAAgB;EAAE,QAAQ;EAAK,SAAS;CAAyG;CACjJ,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAAwF;CAClI,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAAsG;CAC/I,iBAAiB;EAAE,QAAQ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C3H,gBAAgB;EAAE,QAAQ;EAAK,SAAS;CAA4G;CACpJ,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAAsF;CAChI,cAAc;EAAE,QAAQ;EAAK,SAAS;CAAwJ;CAC9L,aAAa;EAAE,QAAQ;EAAK,SAAS;CAA8G;CACnJ,gBAAgB;EAAE,QAAQ;EAAK,SAAS;CAA8F;CACtI,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAAkI;CAC5K,0BAA0B;EAAE,QAAQ;EAAK,SAAS;CAAkI;CACpL,mBAAmB;EAAE,QAAQ;EAAK,SAAS;CAA4G;CACvJ,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAA6D;CACtG,gBAAgB;EAAE,QAAQ;EAAK,SAAS;CAA8D;AACxG"}
1
+ {"version":3,"file":"error-codes.js","names":[],"sources":["../../../src/client/generated/error-codes.ts"],"sourcesContent":["// Generated by `go generate ./internal/contract` from ContentKit's error-code registry. Do not edit.\n\nexport type ErrorCode =\n | \"ambiguous_entity\"\n | \"animation_not_allowed\"\n | \"animation_too_long\"\n | \"animation_unsupported\"\n | \"checksum_mismatch\"\n | \"comment_banned\"\n | \"comment_too_long\"\n | \"comments_closed\"\n | \"comments_locked\"\n | \"conflict\"\n | \"content_changed\"\n | \"download_unavailable\"\n | \"forbidden\"\n | \"gone\"\n | \"image_too_large\"\n | \"image_too_small\"\n | \"image_unreadable\"\n | \"incomplete\"\n | \"internal_error\"\n | \"invalid_archive\"\n | \"invalid_request\"\n | \"limit_reached\"\n | \"moderation_rejected\"\n | \"no_download\"\n | \"not_configured\"\n | \"not_found\"\n | \"not_joinable\"\n | \"not_ready\"\n | \"not_uploaded\"\n | \"operation_busy\"\n | \"operation_conflict\"\n | \"quota_exceeded\"\n | \"rate_limited\"\n | \"source_conflict\"\n | \"tenant_mismatch\"\n | \"too_large\"\n | \"too_many_files\"\n | \"type_not_allowed\"\n | \"unauthorized\"\n | \"unavailable\"\n | \"unknown_entity\"\n | \"upgrade_required\"\n | \"video_aspect_unsupported\"\n | \"video_over_budget\"\n | \"video_too_large\"\n | \"video_too_long\"\n;\n\n// Each code's HTTP status and meaning. A message on the wire is for people;\n// classify by code.\nexport const CONTENTKIT_ERROR_CODES: Readonly<Record<ErrorCode, { status: number; meaning: string }>> = {\n ambiguous_entity: { status: 409, meaning: \"More than one entity matches the localized name or alias and scope; supply its ID.\" },\n animation_not_allowed: { status: 422, meaning: \"An animated image where the upload path refuses animation.\" },\n animation_too_long: { status: 422, meaning: \"The animation has more frames or seconds than the processor allows.\" },\n animation_unsupported: { status: 415, meaning: \"An AVIF or HEIF image sequence, which is decoded as one frame.\" },\n checksum_mismatch: { status: 422, meaning: \"The stored bytes differ from the declared SHA-256.\" },\n comment_banned: { status: 403, meaning: \"The actor is banned from commenting on this target; `ban` says the scope, the reason and when it ends.\" },\n comment_too_long: { status: 422, meaning: \"The comment is longer than the site allows; `details.max` is the limit in characters.\" },\n comments_closed: { status: 403, meaning: \"The target's comments are closed or hidden: existing ones may show, new ones and edits are refused.\" },\n comments_locked: { status: 403, meaning: \"The actor can't open the content (or the comment's version), so its comments take no writes from them; reads withhold them.\" },\n conflict: { status: 409, meaning: \"A concurrent change, a path or slug already taken, or an operation id already used for another commit.\" },\n content_changed: { status: 409, meaning: \"A publishing operation's content or version was edited after submission.\" },\n download_unavailable: { status: 403, meaning: \"The host's download policy refuses this download now: `reason` is its code, `available_at` when it opens if a matter of time. Nothing was charged.\" },\n forbidden: { status: 403, meaning: \"The actor may not do this.\" },\n gone: { status: 410, meaning: \"The content was removed.\" },\n image_too_large: { status: 413, meaning: \"The image has more pixels or frames than the processor decodes.\" },\n image_too_small: { status: 422, meaning: \"The edited image is narrower than its public preset's minimum width.\" },\n image_unreadable: { status: 422, meaning: \"The file is not a decodable image of its declared type.\" },\n incomplete: { status: 409, meaning: \"A multipart upload is missing parts.\" },\n internal_error: { status: 500, meaning: \"A server fault; the cause is in the server log.\" },\n invalid_archive: { status: 422, meaning: \"The publishing archive cannot produce the required supported pages.\" },\n invalid_request: { status: 400, meaning: \"The request is malformed: its body, a query parameter or a path value.\" },\n limit_reached: { status: 409, meaning: \"The owner already has as many groups of the kind as the site allows (max_per_owner).\" },\n moderation_rejected: { status: 422, meaning: \"The moderator refused the text; `error` says why.\" },\n no_download: { status: 409, meaning: \"The version has no file its kind's download serves: nothing uploaded, or its upload failed or was dropped.\" },\n not_configured: { status: 501, meaning: \"The capability needs a port the host did not configure; retrying does not help.\" },\n not_found: { status: 404, meaning: \"Nothing by that name, or nothing the actor may see.\" },\n not_joinable: { status: 409, meaning: \"The group has no free offer to join: it sells its membership, or nothing.\" },\n not_ready: { status: 409, meaning: \"A version that would go live still has files processing or a publication not yet current; `error` says what. Retry once processing finishes.\" },\n not_uploaded: { status: 409, meaning: \"A commit names an upload that has not landed; `blobs` lists the ones to upload again.\" },\n operation_busy: { status: 409, meaning: \"The publishing operation is preparing an upload or completing another request; retry.\" },\n operation_conflict: { status: 409, meaning: \"A publishing operation ID already names different immutable input.\" },\n quota_exceeded: { status: 413, meaning: \"The uploader's storage quota is used up.\" },\n rate_limited: { status: 429, meaning: \"Too many requests; retry after `retry_after` seconds (also the Retry-After header).\" },\n source_conflict: { status: 409, meaning: \"The external source already belongs to another publishing operation in this app.\" },\n tenant_mismatch: { status: 500, meaning: \"A host port answered with another tenant's data: a configuration fault.\" },\n too_large: { status: 413, meaning: \"The file is larger than its upload path allows; `details` has `size` and `max_bytes`.\" },\n too_many_files: { status: 409, meaning: \"The commit would put more files in an upload path, or the item, than allowed; `details.max` is the limit.\" },\n type_not_allowed: { status: 415, meaning: \"The file type is not allowed in the upload path; `details.allowed` lists the types.\" },\n unauthorized: { status: 401, meaning: \"The request needs a valid credential: it has none where the route needs one, or one that is expired, revoked or invalid. WWW-Authenticate says which.\" },\n unavailable: { status: 503, meaning: \"The host's auth, media storage or signal plane cannot be reached, or a commit's recovery is pending; retry.\" },\n unknown_entity: { status: 400, meaning: \"A publishing entity reference does not resolve in this app and entity creation is disabled.\" },\n upgrade_required: { status: 503, meaning: \"The media item was stored before v0.68 and is served once the host's media upgrade (contentkit_media_upgrade) has converted it.\" },\n video_aspect_unsupported: { status: 422, meaning: \"The video's display aspect is outside what its upload path accepts; `details` has `min_aspect` and `max_aspect` (width/height).\" },\n video_over_budget: { status: 422, meaning: \"The planned encode costs more than its upload path allows, or the source averages under a frame a second.\" },\n video_too_large: { status: 422, meaning: \"The video's frames are larger than its upload path allows.\" },\n video_too_long: { status: 422, meaning: \"The video or audio runs longer than its upload path allows.\" },\n};\n"],"mappings":";AAqDA,IAAa,IAA2F;CACtG,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAAqF;CAC/H,uBAAuB;EAAE,QAAQ;EAAK,SAAS;CAA6D;CAC5G,oBAAoB;EAAE,QAAQ;EAAK,SAAS;CAAsE;CAClH,uBAAuB;EAAE,QAAQ;EAAK,SAAS;CAAiE;CAChH,mBAAmB;EAAE,QAAQ;EAAK,SAAS;CAAqD;CAChG,gBAAgB;EAAE,QAAQ;EAAK,SAAS;CAAyG;CACjJ,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAAwF;CAClI,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAAsG;CAC/I,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAA8H;CACvK,UAAU;EAAE,QAAQ;EAAK,SAAS;CAAyG;CAC3I,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAA2E;CACpH,sBAAsB;EAAE,QAAQ;EAAK,SAAS;CAAqJ;CACnM,WAAW;EAAE,QAAQ;EAAK,SAAS;CAA6B;CAChE,MAAM;EAAE,QAAQ;EAAK,SAAS;CAA2B;CACzD,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAAkE;CAC3G,iBAAiB;EAAE,QAAQ;EAAK,SAAS;CAAuE;CAChH,kBAAkB;EAAE,QAAQ;EAAK,SAAS;CAA0D;CACpG,YAAY;EAAE,QAAQ;EAAK,SAAS;CAAuC;CAC3E,gBAAgB;EAAE,QAAQ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D;CACtG,gBAAgB;EAAE,QAAQ;EAAK,SAAS;CAA8D;AACxG"}
@@ -1002,7 +1002,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
1002
1002
  readonly 200: "Content";
1003
1003
  readonly 202: "Content";
1004
1004
  };
1005
- readonly errors: readonly ["conflict", "forbidden", "not_found", "moderation_rejected"];
1005
+ readonly errors: readonly ["conflict", "forbidden", "not_found", "moderation_rejected", "not_ready"];
1006
1006
  readonly errorSets: readonly ["module:contents", "auth", "request"];
1007
1007
  }, {
1008
1008
  readonly method: "POST";
@@ -1107,7 +1107,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
1107
1107
  readonly responses: {
1108
1108
  readonly 200: "Version";
1109
1109
  };
1110
- readonly errors: readonly ["forbidden", "not_found"];
1110
+ readonly errors: readonly ["forbidden", "not_found", "not_ready"];
1111
1111
  readonly errorSets: readonly ["module:contents", "auth", "request"];
1112
1112
  }, {
1113
1113
  readonly method: "DELETE";
@@ -1409,7 +1409,8 @@ var e = {
1409
1409
  "conflict",
1410
1410
  "forbidden",
1411
1411
  "not_found",
1412
- "moderation_rejected"
1412
+ "moderation_rejected",
1413
+ "not_ready"
1413
1414
  ],
1414
1415
  errorSets: [
1415
1416
  "module:contents",
@@ -1558,7 +1559,11 @@ var e = {
1558
1559
  query: [],
1559
1560
  request: "VersionInput",
1560
1561
  responses: { 200: "Version" },
1561
- errors: ["forbidden", "not_found"],
1562
+ errors: [
1563
+ "forbidden",
1564
+ "not_found",
1565
+ "not_ready"
1566
+ ],
1562
1567
  errorSets: [
1563
1568
  "module:contents",
1564
1569
  "auth",