@openrails/contentkit-ui 0.90.3 → 0.92.1

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/README.md CHANGED
@@ -78,7 +78,9 @@ operation. This does not change the operation's result or its authentication.
78
78
  `/media/upload`, `/codes`. A mount is a module's full base URL.
79
79
  - **`client.media`**: `upload`, `put` (upload, commit, wait), `commit`, `read`,
80
80
  `waitFor`, `editorView`, `getFrame`, `hlsBase(ref, dir)`, `discard`, and
81
- `xhrSetup` for players (`<MediaGallery xhrSetup={contentkit.media.xhrSetup} />`).
81
+ `hls` for players (`<VideoPlayer loader={contentkit.media.hls} />`): playlists
82
+ load through the client's fetch, so they carry what its calls carry (an
83
+ `authFetch` adds DPoP proofs); segments carry only cookies.
82
84
  Uploads hash in a Web Worker, send one checksum-bound PUT up to 64 MiB and
83
85
  resumable multipart above (`onState`/`resume`). The bucket must allow CORS
84
86
  `PUT` from the app's origin with `Content-Type` and `x-amz-checksum-sha256`.
@@ -341,7 +343,7 @@ the starting shape and edit.
341
343
 
342
344
  `<MediaGallery item={post} prefix="low-res/" renderLocked={unlock} />` reads
343
345
  through the client: the read (refreshed, reloaded after commits), HLS bases,
344
- playlist auth and the grant refresh. Passing `read`, `hlsBase`, `xhrSetup`
346
+ playlist auth and the grant refresh. Passing `read`, `hlsBase`, `loader`
345
347
  and `refresh` yourself still works. A locked read lists no files, so the
346
348
  lock is uncounted; its public teaser carries `renderLocked`, so the unlock is
347
349
  on the first slide;
@@ -388,7 +390,7 @@ fullscreen and a mini player.
388
390
  ```tsx
389
391
  <VideoPlayer
390
392
  base={contentkit.media.hlsBase(ref, "hls/")}
391
- xhrSetup={contentkit.media.xhrSetup}
393
+ loader={contentkit.media.hls}
392
394
  refresh={reload} expires={read.expires} // re-grant before the token expires
393
395
  width={video.w} height={video.h} duration={video.dur} poster={posterPreset}
394
396
  autoPlay startAt={resumePoint} // resume; never a muted autoplay
@@ -401,7 +403,7 @@ fullscreen and a mini player.
401
403
  renderDownloads={({ className, container }) => <Downloads className={className} container={container} />}
402
404
  menuItems={[{ label: "Version", value, options, onChange }, { label: "Report a problem", onSelect }]}
403
405
  />
404
- {handoff && <VideoMiniPlayer handoff={handoff} xhrSetup={contentkit.media.xhrSetup} onExpand={openWatchPage} onClose={() => setHandoff(null)} />}
406
+ {handoff && <VideoMiniPlayer handoff={handoff} loader={contentkit.media.hls} onExpand={openWatchPage} onClose={() => setHandoff(null)} />}
405
407
  ```
406
408
 
407
409
  - **Shortcuts:** Space/K play, ←/→ 5 s, J/L 10 s, ↑/↓ volume, M mute, C
@@ -27,7 +27,7 @@ export interface ContentKitClientOptions extends HttpOptions {
27
27
  * over one shared transport (mounts, auth, language, errors, change events).
28
28
  */
29
29
  export interface ContentKitClient {
30
- /** Uploads, multipart, commits, reads, frames, HLS bases, hls.js `xhrSetup` and inline images. */
30
+ /** Uploads, multipart, commits, reads, frames, HLS bases, the HLS loader and inline images. */
31
31
  readonly media: MediaClient;
32
32
  /** Content items: reads, and writes for their creators, owner-group editors and staff. */
33
33
  readonly contents: ContentsClient;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":[],"sources":["../../src/client/client.ts"],"sourcesContent":["import { CatalogClient } from \"./catalog.js\";\nimport { CodesClient } from \"./codes.js\";\nimport { ContentsClient } from \"./contents.js\";\nimport { BansClient } from \"./content/bans.js\";\nimport { CommentsClient } from \"./content/comments.js\";\nimport { FavoritesClient } from \"./content/favorites.js\";\nimport { ModerationClient } from \"./content/moderation.js\";\nimport { PollsClient } from \"./content/polls.js\";\nimport { ReactionsClient } from \"./content/reactions.js\";\nimport type { Batch, Config, ContentModel, RefBody, Result } from \"./generated/wire.js\";\nimport { DiscoveryClient } from \"./discovery.js\";\nimport { GroupsClient } from \"./groups.js\";\nimport { OffersClient } from \"./offers.js\";\nimport { StatsClient } from \"./stats.js\";\nimport { VersionsClient } from \"./versions.js\";\nimport { Http, type ContentKitChange, type ContentKitModule, type HttpOptions } from \"./http.js\";\nimport { MediaClient, type ContentFolders, type MediaOptions } from \"./media/client.js\";\nimport { call } from \"./route.js\";\nimport { NotificationsClient } from \"./notifications.js\";\n\nexport interface ContentKitClientOptions extends HttpOptions {\n /** Upload tuning (transport, part concurrency, retries). */\n media?: MediaOptions;\n /** The media kind of poll folders, when the host renamed it (content.Media). */\n folders?: ContentFolders;\n}\n\n/**\n * One ContentKit deployment as the browser sees it. Each module is a property\n * over one shared transport (mounts, auth, language, errors, change events).\n */\nexport interface ContentKitClient {\n /** Uploads, multipart, commits, reads, frames, HLS bases, hls.js `xhrSetup` and inline images. */\n readonly media: MediaClient;\n /** Content items: reads, and writes for their creators, owner-group editors and staff. */\n readonly contents: ContentsClient;\n /** The catalog's totals by kind, language and audience. */\n readonly catalog: CatalogClient;\n /** Threads, replies, edits, tombstones, reactions, standing, the latest feed, moderation. */\n readonly comments: CommentsClient;\n /** Likes and dislikes of an item. */\n readonly reactions: ReactionsClient;\n /** The signed-in caller's favorites. */\n readonly favorites: FavoritesClient;\n /** Polls: votes, free-text answers and the staff editor. */\n readonly polls: PollsClient;\n /** Comment bans, owner and global. */\n readonly bans: BansClient;\n /** The review queue of held comments and content. */\n readonly moderation: ModerationClient;\n /** Groups: listings, pages, staff writes and memberships. */\n readonly groups: GroupsClient;\n /** Lists, search, typeahead, rails, release dates, content filters, history, signals and exposures. */\n readonly discovery: DiscoveryClient;\n /** Content versions: reader plans, reader metadata, forks and downloads. */\n readonly versions: VersionsClient;\n /** Offers on contents, versions and groups; group joins; the reader's library. */\n readonly offers: OffersClient;\n /** Content-code lookup. */\n readonly codes: CodesClient;\n /** Staff activity and rankings; the signed-in reader's own statistics. */\n readonly stats: StatsClient;\n /** The signed-in person's native and imported notifications. */\n readonly notifications: NotificationsClient;\n\n /** What the content module allows: which interactions signed-out visitors may make. */\n config(signal?: AbortSignal): Promise<Config>;\n /** The site's content model: languages, tiers, kinds, group kinds and content filters. */\n kinds(signal?: AbortSignal): Promise<ContentModel>;\n /** Staff bulk import (root:import:write): groups, contents, memberships, offers and aliases, idempotent per source. */\n import(batch: Batch): Promise<Result>;\n /** A module's base URL as configured (no trailing slash). */\n url(module: ContentKitModule, ref?: RefBody): string;\n /** Cache context only, not authentication. The React provider keeps this in sync. */\n setReadScope(scope: string): void;\n /** Every successful mutation; a null scope means its data predates a context change. */\n subscribe(listener: (change: ContentKitChange, scope: string | null) => void): () => void;\n}\n\nexport function createContentKitClient(options: ContentKitClientOptions): ContentKitClient {\n const { media: mediaOptions, folders, ...http } = options;\n const h = new Http(http);\n const media = new MediaClient(h, mediaOptions, folders);\n return {\n media,\n contents: new ContentsClient(h),\n catalog: new CatalogClient(h),\n comments: new CommentsClient(h),\n reactions: new ReactionsClient(h),\n favorites: new FavoritesClient(h),\n polls: new PollsClient(h, media),\n bans: new BansClient(h),\n moderation: new ModerationClient(h),\n groups: new GroupsClient(h, media),\n discovery: new DiscoveryClient(h),\n versions: new VersionsClient(h),\n offers: new OffersClient(h),\n codes: new CodesClient(h),\n stats: new StatsClient(h),\n notifications: new NotificationsClient(h),\n config: (signal) => call(h, \"GET\", \"/config\", { signal }),\n kinds: (signal) => call(h, \"GET\", \"/kinds\", { signal }),\n import: (batch) => call(h, \"POST\", \"/import\", { body: batch }),\n url: (module, ref) => h.mount(module, ref),\n setReadScope: (scope) => h.setReadScope(scope),\n subscribe: (listener) => h.subscribe(listener),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,EAAuB,GAAoD;CACzF,IAAM,EAAE,OAAO,GAAc,YAAS,GAAG,MAAS,GAC5C,IAAI,IAAI,EAAK,CAAI,GACjB,IAAQ,IAAI,EAAY,GAAG,GAAc,CAAO;CACtD,OAAO;EACL;EACA,UAAU,IAAI,EAAe,CAAC;EAC9B,SAAS,IAAI,EAAc,CAAC;EAC5B,UAAU,IAAI,EAAe,CAAC;EAC9B,WAAW,IAAI,EAAgB,CAAC;EAChC,WAAW,IAAI,EAAgB,CAAC;EAChC,OAAO,IAAI,EAAY,GAAG,CAAK;EAC/B,MAAM,IAAI,EAAW,CAAC;EACtB,YAAY,IAAI,EAAiB,CAAC;EAClC,QAAQ,IAAI,EAAa,GAAG,CAAK;EACjC,WAAW,IAAI,EAAgB,CAAC;EAChC,UAAU,IAAI,EAAe,CAAC;EAC9B,QAAQ,IAAI,EAAa,CAAC;EAC1B,OAAO,IAAI,EAAY,CAAC;EACxB,OAAO,IAAI,EAAY,CAAC;EACxB,eAAe,IAAI,EAAoB,CAAC;EACxC,SAAS,MAAW,EAAK,GAAG,OAAO,WAAW,EAAE,UAAO,CAAC;EACxD,QAAQ,MAAW,EAAK,GAAG,OAAO,UAAU,EAAE,UAAO,CAAC;EACtD,SAAS,MAAU,EAAK,GAAG,QAAQ,WAAW,EAAE,MAAM,EAAM,CAAC;EAC7D,MAAM,GAAQ,MAAQ,EAAE,MAAM,GAAQ,CAAG;EACzC,eAAe,MAAU,EAAE,aAAa,CAAK;EAC7C,YAAY,MAAa,EAAE,UAAU,CAAQ;CAC/C;AACF"}
1
+ {"version":3,"file":"client.js","names":[],"sources":["../../src/client/client.ts"],"sourcesContent":["import { CatalogClient } from \"./catalog.js\";\nimport { CodesClient } from \"./codes.js\";\nimport { ContentsClient } from \"./contents.js\";\nimport { BansClient } from \"./content/bans.js\";\nimport { CommentsClient } from \"./content/comments.js\";\nimport { FavoritesClient } from \"./content/favorites.js\";\nimport { ModerationClient } from \"./content/moderation.js\";\nimport { PollsClient } from \"./content/polls.js\";\nimport { ReactionsClient } from \"./content/reactions.js\";\nimport type { Batch, Config, ContentModel, RefBody, Result } from \"./generated/wire.js\";\nimport { DiscoveryClient } from \"./discovery.js\";\nimport { GroupsClient } from \"./groups.js\";\nimport { OffersClient } from \"./offers.js\";\nimport { StatsClient } from \"./stats.js\";\nimport { VersionsClient } from \"./versions.js\";\nimport { Http, type ContentKitChange, type ContentKitModule, type HttpOptions } from \"./http.js\";\nimport { MediaClient, type ContentFolders, type MediaOptions } from \"./media/client.js\";\nimport { call } from \"./route.js\";\nimport { NotificationsClient } from \"./notifications.js\";\n\nexport interface ContentKitClientOptions extends HttpOptions {\n /** Upload tuning (transport, part concurrency, retries). */\n media?: MediaOptions;\n /** The media kind of poll folders, when the host renamed it (content.Media). */\n folders?: ContentFolders;\n}\n\n/**\n * One ContentKit deployment as the browser sees it. Each module is a property\n * over one shared transport (mounts, auth, language, errors, change events).\n */\nexport interface ContentKitClient {\n /** Uploads, multipart, commits, reads, frames, HLS bases, the HLS loader and inline images. */\n readonly media: MediaClient;\n /** Content items: reads, and writes for their creators, owner-group editors and staff. */\n readonly contents: ContentsClient;\n /** The catalog's totals by kind, language and audience. */\n readonly catalog: CatalogClient;\n /** Threads, replies, edits, tombstones, reactions, standing, the latest feed, moderation. */\n readonly comments: CommentsClient;\n /** Likes and dislikes of an item. */\n readonly reactions: ReactionsClient;\n /** The signed-in caller's favorites. */\n readonly favorites: FavoritesClient;\n /** Polls: votes, free-text answers and the staff editor. */\n readonly polls: PollsClient;\n /** Comment bans, owner and global. */\n readonly bans: BansClient;\n /** The review queue of held comments and content. */\n readonly moderation: ModerationClient;\n /** Groups: listings, pages, staff writes and memberships. */\n readonly groups: GroupsClient;\n /** Lists, search, typeahead, rails, release dates, content filters, history, signals and exposures. */\n readonly discovery: DiscoveryClient;\n /** Content versions: reader plans, reader metadata, forks and downloads. */\n readonly versions: VersionsClient;\n /** Offers on contents, versions and groups; group joins; the reader's library. */\n readonly offers: OffersClient;\n /** Content-code lookup. */\n readonly codes: CodesClient;\n /** Staff activity and rankings; the signed-in reader's own statistics. */\n readonly stats: StatsClient;\n /** The signed-in person's native and imported notifications. */\n readonly notifications: NotificationsClient;\n\n /** What the content module allows: which interactions signed-out visitors may make. */\n config(signal?: AbortSignal): Promise<Config>;\n /** The site's content model: languages, tiers, kinds, group kinds and content filters. */\n kinds(signal?: AbortSignal): Promise<ContentModel>;\n /** Staff bulk import (root:import:write): groups, contents, memberships, offers and aliases, idempotent per source. */\n import(batch: Batch): Promise<Result>;\n /** A module's base URL as configured (no trailing slash). */\n url(module: ContentKitModule, ref?: RefBody): string;\n /** Cache context only, not authentication. The React provider keeps this in sync. */\n setReadScope(scope: string): void;\n /** Every successful mutation; a null scope means its data predates a context change. */\n subscribe(listener: (change: ContentKitChange, scope: string | null) => void): () => void;\n}\n\nexport function createContentKitClient(options: ContentKitClientOptions): ContentKitClient {\n const { media: mediaOptions, folders, ...http } = options;\n const h = new Http(http);\n const media = new MediaClient(h, mediaOptions, folders);\n return {\n media,\n contents: new ContentsClient(h),\n catalog: new CatalogClient(h),\n comments: new CommentsClient(h),\n reactions: new ReactionsClient(h),\n favorites: new FavoritesClient(h),\n polls: new PollsClient(h, media),\n bans: new BansClient(h),\n moderation: new ModerationClient(h),\n groups: new GroupsClient(h, media),\n discovery: new DiscoveryClient(h),\n versions: new VersionsClient(h),\n offers: new OffersClient(h),\n codes: new CodesClient(h),\n stats: new StatsClient(h),\n notifications: new NotificationsClient(h),\n config: (signal) => call(h, \"GET\", \"/config\", { signal }),\n kinds: (signal) => call(h, \"GET\", \"/kinds\", { signal }),\n import: (batch) => call(h, \"POST\", \"/import\", { body: batch }),\n url: (module, ref) => h.mount(module, ref),\n setReadScope: (scope) => h.setReadScope(scope),\n subscribe: (listener) => h.subscribe(listener),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,EAAuB,GAAoD;CACzF,IAAM,EAAE,OAAO,GAAc,YAAS,GAAG,MAAS,GAC5C,IAAI,IAAI,EAAK,CAAI,GACjB,IAAQ,IAAI,EAAY,GAAG,GAAc,CAAO;CACtD,OAAO;EACL;EACA,UAAU,IAAI,EAAe,CAAC;EAC9B,SAAS,IAAI,EAAc,CAAC;EAC5B,UAAU,IAAI,EAAe,CAAC;EAC9B,WAAW,IAAI,EAAgB,CAAC;EAChC,WAAW,IAAI,EAAgB,CAAC;EAChC,OAAO,IAAI,EAAY,GAAG,CAAK;EAC/B,MAAM,IAAI,EAAW,CAAC;EACtB,YAAY,IAAI,EAAiB,CAAC;EAClC,QAAQ,IAAI,EAAa,GAAG,CAAK;EACjC,WAAW,IAAI,EAAgB,CAAC;EAChC,UAAU,IAAI,EAAe,CAAC;EAC9B,QAAQ,IAAI,EAAa,CAAC;EAC1B,OAAO,IAAI,EAAY,CAAC;EACxB,OAAO,IAAI,EAAY,CAAC;EACxB,eAAe,IAAI,EAAoB,CAAC;EACxC,SAAS,MAAW,EAAK,GAAG,OAAO,WAAW,EAAE,UAAO,CAAC;EACxD,QAAQ,MAAW,EAAK,GAAG,OAAO,UAAU,EAAE,UAAO,CAAC;EACtD,SAAS,MAAU,EAAK,GAAG,QAAQ,WAAW,EAAE,MAAM,EAAM,CAAC;EAC7D,MAAM,GAAQ,MAAQ,EAAE,MAAM,GAAQ,CAAG;EACzC,eAAe,MAAU,EAAE,aAAa,CAAK;EAC7C,YAAY,MAAa,EAAE,UAAU,CAAQ;CAC/C;AACF"}
@@ -4,7 +4,7 @@ export type ContentKitRoute = {
4
4
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
5
5
  module: ContentKitModule;
6
6
  path: string;
7
- auth: "open" | "public" | "user" | "staff" | "editor";
7
+ auth: "open" | "public" | "user" | "person" | "staff" | "editor";
8
8
  permission: string | null;
9
9
  query: readonly string[];
10
10
  request: string | null;
@@ -214,7 +214,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
214
214
  readonly method: "POST";
215
215
  readonly module: "content";
216
216
  readonly path: "/comments/{cid}/hold";
217
- readonly auth: "user";
217
+ readonly auth: "person";
218
218
  readonly permission: null;
219
219
  readonly query: readonly [];
220
220
  readonly request: null;
@@ -227,7 +227,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
227
227
  readonly method: "POST";
228
228
  readonly module: "content";
229
229
  readonly path: "/comments/{cid}/release";
230
- readonly auth: "user";
230
+ readonly auth: "person";
231
231
  readonly permission: null;
232
232
  readonly query: readonly [];
233
233
  readonly request: null;
@@ -682,7 +682,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
682
682
  readonly method: "GET";
683
683
  readonly module: "content";
684
684
  readonly path: "/groups/{id}/held-comments";
685
- readonly auth: "user";
685
+ readonly auth: "person";
686
686
  readonly permission: null;
687
687
  readonly query: readonly ["cursor", "limit"];
688
688
  readonly request: null;
@@ -695,7 +695,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
695
695
  readonly method: "GET";
696
696
  readonly module: "content";
697
697
  readonly path: "/groups/{id}/comment-bans";
698
- readonly auth: "user";
698
+ readonly auth: "person";
699
699
  readonly permission: null;
700
700
  readonly query: readonly ["limit", "offset"];
701
701
  readonly request: null;
@@ -708,7 +708,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
708
708
  readonly method: "PUT";
709
709
  readonly module: "content";
710
710
  readonly path: "/groups/{id}/comment-bans/{user}";
711
- readonly auth: "user";
711
+ readonly auth: "person";
712
712
  readonly permission: null;
713
713
  readonly query: readonly [];
714
714
  readonly request: "BanInput";
@@ -721,7 +721,7 @@ export declare const CONTENTKIT_ROUTES: readonly [{
721
721
  readonly method: "DELETE";
722
722
  readonly module: "content";
723
723
  readonly path: "/groups/{id}/comment-bans/{user}";
724
- readonly auth: "user";
724
+ readonly auth: "person";
725
725
  readonly permission: null;
726
726
  readonly query: readonly [];
727
727
  readonly request: null;
@@ -328,7 +328,7 @@ var e = {
328
328
  method: "POST",
329
329
  module: "content",
330
330
  path: "/comments/{cid}/hold",
331
- auth: "user",
331
+ auth: "person",
332
332
  permission: null,
333
333
  query: [],
334
334
  request: null,
@@ -348,7 +348,7 @@ var e = {
348
348
  method: "POST",
349
349
  module: "content",
350
350
  path: "/comments/{cid}/release",
351
- auth: "user",
351
+ auth: "person",
352
352
  permission: null,
353
353
  query: [],
354
354
  request: null,
@@ -987,7 +987,7 @@ var e = {
987
987
  method: "GET",
988
988
  module: "content",
989
989
  path: "/groups/{id}/held-comments",
990
- auth: "user",
990
+ auth: "person",
991
991
  permission: null,
992
992
  query: ["cursor", "limit"],
993
993
  request: null,
@@ -1003,7 +1003,7 @@ var e = {
1003
1003
  method: "GET",
1004
1004
  module: "content",
1005
1005
  path: "/groups/{id}/comment-bans",
1006
- auth: "user",
1006
+ auth: "person",
1007
1007
  permission: null,
1008
1008
  query: ["limit", "offset"],
1009
1009
  request: null,
@@ -1019,7 +1019,7 @@ var e = {
1019
1019
  method: "PUT",
1020
1020
  module: "content",
1021
1021
  path: "/groups/{id}/comment-bans/{user}",
1022
- auth: "user",
1022
+ auth: "person",
1023
1023
  permission: null,
1024
1024
  query: [],
1025
1025
  request: "BanInput",
@@ -1035,7 +1035,7 @@ var e = {
1035
1035
  method: "DELETE",
1036
1036
  module: "content",
1037
1037
  path: "/groups/{id}/comment-bans/{user}",
1038
- auth: "user",
1038
+ auth: "person",
1039
1039
  permission: null,
1040
1040
  query: [],
1041
1041
  request: null,