@openrails/contentkit-ui 0.79.0 → 0.81.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/README.md +82 -54
- package/dist/client/beacons.d.ts +53 -0
- package/dist/client/beacons.js +72 -0
- package/dist/client/beacons.js.map +1 -0
- package/dist/client/catalog.d.ts +2 -2
- package/dist/client/catalog.js +1 -1
- package/dist/client/catalog.js.map +1 -1
- package/dist/client/client.d.ts +24 -11
- package/dist/client/client.js +37 -29
- package/dist/client/client.js.map +1 -1
- package/dist/client/content/comments.d.ts +12 -8
- package/dist/client/content/comments.js +33 -20
- package/dist/client/content/comments.js.map +1 -1
- package/dist/client/content/favorites.d.ts +24 -9
- package/dist/client/content/favorites.js +21 -22
- package/dist/client/content/favorites.js.map +1 -1
- package/dist/client/content/moderation.d.ts +1 -1
- package/dist/client/content/moderation.js.map +1 -1
- package/dist/client/content/reactions.d.ts +11 -6
- package/dist/client/content/reactions.js +23 -18
- package/dist/client/content/reactions.js.map +1 -1
- package/dist/client/content/types.d.ts +40 -21
- package/dist/client/content/types.js +5 -2
- package/dist/client/content/types.js.map +1 -1
- package/dist/client/contents.d.ts +55 -0
- package/dist/client/contents.js +144 -0
- package/dist/client/contents.js.map +1 -0
- package/dist/client/discovery.d.ts +126 -0
- package/dist/client/discovery.js +125 -0
- package/dist/client/discovery.js.map +1 -0
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/error-codes.js +12 -0
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.d.ts +1244 -370
- package/dist/client/generated/routes.js +1870 -554
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +960 -134
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/group-fields.d.ts +25 -0
- package/dist/client/group-fields.js +63 -0
- package/dist/client/group-fields.js.map +1 -0
- package/dist/client/groups.d.ts +58 -0
- package/dist/client/groups.js +119 -0
- package/dist/client/groups.js.map +1 -0
- package/dist/client/http.d.ts +24 -12
- package/dist/client/http.js +20 -24
- package/dist/client/http.js.map +1 -1
- package/dist/client/index.d.ts +11 -6
- package/dist/client/media/api.d.ts +1 -1
- package/dist/client/media/api.js +4 -2
- package/dist/client/media/api.js.map +1 -1
- package/dist/client/media/client.d.ts +8 -9
- package/dist/client/media/client.js +58 -71
- package/dist/client/media/client.js.map +1 -1
- package/dist/client/media/ref.d.ts +30 -0
- package/dist/client/media/ref.js +10 -3
- package/dist/client/media/ref.js.map +1 -1
- package/dist/client/offers.d.ts +41 -0
- package/dist/client/offers.js +66 -0
- package/dist/client/offers.js.map +1 -0
- package/dist/client/route.d.ts +2 -0
- package/dist/client/route.js +2 -1
- package/dist/client/route.js.map +1 -1
- package/dist/client/versions.d.ts +20 -0
- package/dist/client/versions.js +53 -0
- package/dist/client/versions.js.map +1 -0
- package/dist/client.js +35 -30
- package/dist/components/admin/content-manager.d.ts +80 -0
- package/dist/components/admin/content-manager.js +591 -0
- package/dist/components/admin/content-manager.js.map +1 -0
- package/dist/components/admin/group-manager.d.ts +24 -0
- package/dist/components/admin/group-manager.js +244 -0
- package/dist/components/admin/group-manager.js.map +1 -0
- package/dist/components/admin/media-item-panel.js +1 -1
- package/dist/components/admin/media-item-panel.js.map +1 -1
- package/dist/components/content/card.d.ts +44 -0
- package/dist/components/content/card.js +285 -0
- package/dist/components/content/card.js.map +1 -0
- package/dist/components/content/editors.d.ts +40 -0
- package/dist/components/content/editors.js +764 -0
- package/dist/components/content/editors.js.map +1 -0
- package/dist/components/content/filters.d.ts +28 -0
- package/dist/components/content/filters.js +134 -0
- package/dist/components/content/filters.js.map +1 -0
- package/dist/components/content/grid.d.ts +62 -0
- package/dist/components/content/grid.js +233 -0
- package/dist/components/content/grid.js.map +1 -0
- package/dist/components/content/index.d.ts +8 -0
- package/dist/components/content/listing.d.ts +20 -0
- package/dist/components/content/listing.js +150 -0
- package/dist/components/content/listing.js.map +1 -0
- package/dist/components/content/offer-fields.d.ts +8 -0
- package/dist/components/content/offer-fields.js +127 -0
- package/dist/components/content/offer-fields.js.map +1 -0
- package/dist/components/content/paywall.d.ts +53 -0
- package/dist/components/content/paywall.js +221 -0
- package/dist/components/content/paywall.js.map +1 -0
- package/dist/components/content/search.d.ts +27 -0
- package/dist/components/content/search.js +164 -0
- package/dist/components/content/search.js.map +1 -0
- package/dist/components/groups/banner.d.ts +51 -0
- package/dist/components/groups/banner.js +194 -0
- package/dist/components/groups/banner.js.map +1 -0
- package/dist/components/groups/directory.d.ts +37 -0
- package/dist/components/groups/directory.js +117 -0
- package/dist/components/groups/directory.js.map +1 -0
- package/dist/components/groups/editor.d.ts +44 -0
- package/dist/components/groups/editor.js +860 -0
- package/dist/components/groups/editor.js.map +1 -0
- package/dist/components/groups/fields.d.ts +13 -0
- package/dist/components/groups/fields.js +68 -0
- package/dist/components/groups/fields.js.map +1 -0
- package/dist/components/groups/header.d.ts +25 -0
- package/dist/components/groups/header.js +131 -0
- package/dist/components/groups/header.js.map +1 -0
- package/dist/components/groups/index.d.ts +6 -0
- package/dist/components/groups/memberships.d.ts +55 -0
- package/dist/components/groups/memberships.js +527 -0
- package/dist/components/groups/memberships.js.map +1 -0
- package/dist/components/groups/parts.d.ts +49 -0
- package/dist/components/groups/parts.js +172 -0
- package/dist/components/groups/parts.js.map +1 -0
- package/dist/components/media-folder-editor.js +153 -152
- package/dist/components/media-folder-editor.js.map +1 -1
- package/dist/components/social/comments.d.ts +7 -5
- package/dist/components/social/comments.js +6 -2
- package/dist/components/social/comments.js.map +1 -1
- package/dist/components/social/engagement.d.ts +4 -3
- package/dist/components/social/engagement.js.map +1 -1
- package/dist/components/social/moderation.d.ts +1 -1
- package/dist/components/social/moderation.js +3 -3
- package/dist/components/social/moderation.js.map +1 -1
- package/dist/editor/rich-text-editor.d.ts +4 -4
- package/dist/editor/rich-text-editor.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +23 -9
- package/dist/locales/admin/de.js +5 -66
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +5 -66
- package/dist/locales/admin/en.js +19 -80
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +5 -66
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +5 -66
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +5 -66
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +5 -66
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/content/de.d.ts +2 -0
- package/dist/locales/content/de.js +98 -0
- package/dist/locales/content/de.js.map +1 -0
- package/dist/locales/content/en.d.ts +93 -0
- package/dist/locales/content/en.js +98 -0
- package/dist/locales/content/en.js.map +1 -0
- package/dist/locales/content/es.d.ts +2 -0
- package/dist/locales/content/es.js +98 -0
- package/dist/locales/content/es.js.map +1 -0
- package/dist/locales/content/ja.d.ts +2 -0
- package/dist/locales/content/ja.js +98 -0
- package/dist/locales/content/ja.js.map +1 -0
- package/dist/locales/content/ko.d.ts +2 -0
- package/dist/locales/content/ko.js +98 -0
- package/dist/locales/content/ko.js.map +1 -0
- package/dist/locales/content/zh.d.ts +2 -0
- package/dist/locales/content/zh.js +98 -0
- package/dist/locales/content/zh.js.map +1 -0
- package/dist/locales/de.js +11 -2
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/discovery/de.d.ts +2 -0
- package/dist/locales/discovery/de.js +68 -0
- package/dist/locales/discovery/de.js.map +1 -0
- package/dist/locales/discovery/en.d.ts +63 -0
- package/dist/locales/discovery/en.js +68 -0
- package/dist/locales/discovery/en.js.map +1 -0
- package/dist/locales/discovery/es.d.ts +2 -0
- package/dist/locales/discovery/es.js +68 -0
- package/dist/locales/discovery/es.js.map +1 -0
- package/dist/locales/discovery/ja.d.ts +2 -0
- package/dist/locales/discovery/ja.js +68 -0
- package/dist/locales/discovery/ja.js.map +1 -0
- package/dist/locales/discovery/ko.d.ts +2 -0
- package/dist/locales/discovery/ko.js +68 -0
- package/dist/locales/discovery/ko.js.map +1 -0
- package/dist/locales/discovery/zh.d.ts +2 -0
- package/dist/locales/discovery/zh.js +68 -0
- package/dist/locales/discovery/zh.js.map +1 -0
- package/dist/locales/en.d.ts +288 -67
- package/dist/locales/en.js +11 -2
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +11 -2
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/groups/de.d.ts +2 -0
- package/dist/locales/groups/de.js +133 -0
- package/dist/locales/groups/de.js.map +1 -0
- package/dist/locales/groups/en.d.ts +128 -0
- package/dist/locales/groups/en.js +133 -0
- package/dist/locales/groups/en.js.map +1 -0
- package/dist/locales/groups/es.d.ts +2 -0
- package/dist/locales/groups/es.js +133 -0
- package/dist/locales/groups/es.js.map +1 -0
- package/dist/locales/groups/ja.d.ts +2 -0
- package/dist/locales/groups/ja.js +133 -0
- package/dist/locales/groups/ja.js.map +1 -0
- package/dist/locales/groups/ko.d.ts +2 -0
- package/dist/locales/groups/ko.js +133 -0
- package/dist/locales/groups/ko.js.map +1 -0
- package/dist/locales/groups/zh.d.ts +2 -0
- package/dist/locales/groups/zh.js +133 -0
- package/dist/locales/groups/zh.js.map +1 -0
- package/dist/locales/ja.js +11 -2
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +11 -2
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/social/de.js +2 -1
- package/dist/locales/social/de.js.map +1 -1
- package/dist/locales/social/en.d.ts +2 -1
- package/dist/locales/social/en.js +2 -1
- package/dist/locales/social/en.js.map +1 -1
- package/dist/locales/social/es.js +2 -1
- package/dist/locales/social/es.js.map +1 -1
- package/dist/locales/social/ja.js +2 -1
- package/dist/locales/social/ja.js.map +1 -1
- package/dist/locales/social/ko.js +2 -1
- package/dist/locales/social/ko.js.map +1 -1
- package/dist/locales/social/zh.js +2 -1
- package/dist/locales/social/zh.js.map +1 -1
- package/dist/locales/zh.js +11 -2
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/admin.d.ts +1 -1
- package/dist/react/admin.js +8 -6
- package/dist/react/admin.js.map +1 -1
- package/dist/react/comments.d.ts +9 -7
- package/dist/react/comments.js +42 -27
- package/dist/react/comments.js.map +1 -1
- package/dist/react/contents.d.ts +57 -0
- package/dist/react/contents.js +214 -0
- package/dist/react/contents.js.map +1 -0
- package/dist/react/context.d.ts +1 -1
- package/dist/react/context.js.map +1 -1
- package/dist/react/crop.js +45 -44
- package/dist/react/crop.js.map +1 -1
- package/dist/react/detail.d.ts +30 -0
- package/dist/react/detail.js +42 -0
- package/dist/react/detail.js.map +1 -0
- package/dist/react/discovery.d.ts +138 -0
- package/dist/react/discovery.js +299 -0
- package/dist/react/discovery.js.map +1 -0
- package/dist/react/engagement.d.ts +5 -5
- package/dist/react/engagement.js +55 -41
- package/dist/react/engagement.js.map +1 -1
- package/dist/react/folder.js +54 -53
- package/dist/react/folder.js.map +1 -1
- package/dist/react/groups.d.ts +115 -0
- package/dist/react/groups.js +229 -0
- package/dist/react/groups.js.map +1 -0
- package/dist/react/index.d.ts +5 -1
- package/dist/react/public.d.ts +6 -5
- package/dist/react/public.js +19 -22
- package/dist/react/public.js.map +1 -1
- package/dist/react/read.js +105 -106
- package/dist/react/read.js.map +1 -1
- package/dist/react/resources.d.ts +2 -2
- package/dist/react/resources.js +69 -40
- package/dist/react/resources.js.map +1 -1
- package/dist/react/store.js +41 -39
- package/dist/react/store.js.map +1 -1
- package/dist/react/upload.js +54 -53
- package/dist/react/upload.js.map +1 -1
- package/dist/react/use-resource.d.ts +2 -1
- package/dist/react/use-resource.js +1 -0
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react/versions.d.ts +57 -0
- package/dist/react/versions.js +94 -0
- package/dist/react/versions.js.map +1 -0
- package/dist/react/video.js +87 -86
- package/dist/react/video.js.map +1 -1
- package/dist/react.js +9 -5
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/client/content/posts.d.ts +0 -52
- package/dist/client/content/posts.js +0 -84
- package/dist/client/content/posts.js.map +0 -1
- package/dist/client/taxonomy.d.ts +0 -34
- package/dist/client/taxonomy.js +0 -84
- package/dist/client/taxonomy.js.map +0 -1
- package/dist/components/admin/post-manager.d.ts +0 -45
- package/dist/components/admin/post-manager.js +0 -602
- package/dist/components/admin/post-manager.js.map +0 -1
- package/dist/components/admin/taxonomy-manager.d.ts +0 -54
- package/dist/components/admin/taxonomy-manager.js +0 -976
- package/dist/components/admin/taxonomy-manager.js.map +0 -1
- package/dist/react/posts.d.ts +0 -61
- package/dist/react/posts.js +0 -183
- package/dist/react/posts.js.map +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { AdminComment, Comment, CommentInput, CommentStanding, FeedItem, ReactionCounts
|
|
1
|
+
import { AdminComment, Comment, CommentInput, CommentStanding, FeedItem, ReactionCounts } from '../generated/wire.js';
|
|
2
2
|
import { Http } from '../http.js';
|
|
3
3
|
import { PageQuery } from '../route.js';
|
|
4
|
-
import { Reaction, Sort } from './types.js';
|
|
4
|
+
import { Reaction, Sort, Target } from './types.js';
|
|
5
5
|
export interface CommentQuery extends PageQuery {
|
|
6
6
|
sort?: Sort;
|
|
7
|
+
/** Only this language's thread. */
|
|
8
|
+
language?: string;
|
|
7
9
|
}
|
|
8
10
|
export interface AdminCommentQuery extends PageQuery {
|
|
9
11
|
/** Only comments on this content kind. */
|
|
@@ -15,12 +17,12 @@ export interface AdminCommentQuery extends PageQuery {
|
|
|
15
17
|
export declare class CommentsClient {
|
|
16
18
|
private readonly http;
|
|
17
19
|
constructor(http: Http);
|
|
18
|
-
/** The
|
|
19
|
-
list(
|
|
20
|
+
/** The target's top-level comments with reply counts; the caller also gets its own held and rejected ones. */
|
|
21
|
+
list(t: Target, q?: CommentQuery, signal?: AbortSignal): Promise<Comment[]>;
|
|
20
22
|
/** A top-level comment's replies, oldest first. */
|
|
21
23
|
replies(id: string, q?: PageQuery, signal?: AbortSignal): Promise<Comment[]>;
|
|
22
|
-
/** Comments on the
|
|
23
|
-
create(
|
|
24
|
+
/** Comments on the target in a language's thread, or replies to a top-level comment (reply_to_id); anonymous callers give anon_name. */
|
|
25
|
+
create(t: Target, input: CommentInput): Promise<Comment>;
|
|
24
26
|
/** Replaces the body: its author, or a moderator. */
|
|
25
27
|
edit(id: string, body: string): Promise<Comment>;
|
|
26
28
|
/** Leaves a tombstone: its author, or a moderator. */
|
|
@@ -28,9 +30,11 @@ export declare class CommentsClient {
|
|
|
28
30
|
/** Sets the caller's reaction to a comment. */
|
|
29
31
|
react(id: string, value: Reaction): Promise<ReactionCounts>;
|
|
30
32
|
/** Whether the caller may comment on the item, the ban that stops it, and what it may do to others' comments. */
|
|
31
|
-
standing(
|
|
33
|
+
standing(t: Target, signal?: AbortSignal): Promise<CommentStanding>;
|
|
32
34
|
/** The newest published comments across the site, with their items; a page may under-fill. */
|
|
33
|
-
latest(q?: PageQuery
|
|
35
|
+
latest(q?: PageQuery & {
|
|
36
|
+
language?: string;
|
|
37
|
+
}, signal?: AbortSignal): Promise<FeedItem[]>;
|
|
34
38
|
/** Every comment, newest first, deleted, held and rejected ones with their bodies (root:comments:moderate). */
|
|
35
39
|
adminList(q?: AdminCommentQuery, signal?: AbortSignal): Promise<AdminComment[]>;
|
|
36
40
|
/** Restores a deleted comment (root:comments:moderate). */
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { call as e } from "../route.js";
|
|
2
2
|
import { reactionVerb as t } from "./types.js";
|
|
3
3
|
//#region src/client/content/comments.ts
|
|
4
|
-
var n =
|
|
5
|
-
kind: e.kind,
|
|
6
|
-
id: e.id
|
|
7
|
-
}), r = class {
|
|
4
|
+
var n = class {
|
|
8
5
|
http;
|
|
9
6
|
constructor(e) {
|
|
10
7
|
this.http = e;
|
|
11
8
|
}
|
|
12
|
-
list(t,
|
|
13
|
-
|
|
14
|
-
params:
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
list(t, n = {}, r) {
|
|
10
|
+
let i = {
|
|
11
|
+
params: { id: t.id },
|
|
12
|
+
signal: r
|
|
13
|
+
};
|
|
14
|
+
return t.type === "groups" ? e(this.http, "GET", "/groups/{id}/comments", {
|
|
15
|
+
...i,
|
|
16
|
+
query: n
|
|
17
|
+
}) : e(this.http, "GET", "/contents/{id}/comments", {
|
|
18
|
+
...i,
|
|
19
|
+
query: {
|
|
20
|
+
...n,
|
|
21
|
+
version: t.version
|
|
22
|
+
}
|
|
17
23
|
});
|
|
18
24
|
}
|
|
19
25
|
replies(t, n = {}, r) {
|
|
@@ -23,14 +29,17 @@ var n = (e) => ({
|
|
|
23
29
|
signal: r
|
|
24
30
|
});
|
|
25
31
|
}
|
|
26
|
-
async create(t,
|
|
27
|
-
let
|
|
28
|
-
params:
|
|
29
|
-
body:
|
|
32
|
+
async create(t, n) {
|
|
33
|
+
let r = this.http.captureChanges(), i = {
|
|
34
|
+
params: { id: t.id },
|
|
35
|
+
body: n
|
|
36
|
+
}, a = t.type === "groups" ? await e(this.http, "POST", "/groups/{id}/comments", i) : await e(this.http, "POST", "/contents/{id}/comments", {
|
|
37
|
+
...i,
|
|
38
|
+
query: { version: t.version }
|
|
30
39
|
});
|
|
31
|
-
return
|
|
40
|
+
return r({
|
|
32
41
|
type: "comment.created",
|
|
33
|
-
|
|
42
|
+
target: t,
|
|
34
43
|
comment: a
|
|
35
44
|
}), a;
|
|
36
45
|
}
|
|
@@ -59,10 +68,14 @@ var n = (e) => ({
|
|
|
59
68
|
counts: o
|
|
60
69
|
}), o;
|
|
61
70
|
}
|
|
62
|
-
standing(t,
|
|
63
|
-
|
|
64
|
-
params:
|
|
65
|
-
signal:
|
|
71
|
+
standing(t, n) {
|
|
72
|
+
let r = {
|
|
73
|
+
params: { id: t.id },
|
|
74
|
+
signal: n
|
|
75
|
+
};
|
|
76
|
+
return t.type === "groups" ? e(this.http, "GET", "/groups/{id}/can-comment", r) : e(this.http, "GET", "/contents/{id}/can-comment", {
|
|
77
|
+
...r,
|
|
78
|
+
query: { version: t.version }
|
|
66
79
|
});
|
|
67
80
|
}
|
|
68
81
|
latest(t = {}, n) {
|
|
@@ -90,6 +103,6 @@ var n = (e) => ({
|
|
|
90
103
|
}
|
|
91
104
|
};
|
|
92
105
|
//#endregion
|
|
93
|
-
export {
|
|
106
|
+
export { n as CommentsClient };
|
|
94
107
|
|
|
95
108
|
//# sourceMappingURL=comments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comments.js","names":[],"sources":["../../../src/client/content/comments.ts"],"sourcesContent":["import type { AdminComment, Comment, CommentInput, CommentStanding, FeedItem, ReactionCounts
|
|
1
|
+
{"version":3,"file":"comments.js","names":[],"sources":["../../../src/client/content/comments.ts"],"sourcesContent":["import type { AdminComment, Comment, CommentInput, CommentStanding, FeedItem, ReactionCounts } from \"../generated/wire.js\";\nimport type { Http } from \"../http.js\";\nimport { call, type PageQuery } from \"../route.js\";\nimport { reactionVerb, type Reaction, type Sort, type Target } from \"./types.js\";\n\nexport interface CommentQuery extends PageQuery {\n sort?: Sort;\n /** Only this language's thread. */\n language?: string;\n}\n\nexport interface AdminCommentQuery extends PageQuery {\n /** Only comments on this content kind. */\n contentKind?: string;\n /** Only comments by this user id. */\n author?: string;\n}\n\n/** Comments on an item: threads, replies, edits, tombstones, reactions, standing, the latest feed and moderation. */\nexport class CommentsClient {\n constructor(private readonly http: Http) {}\n\n /** The target's top-level comments with reply counts; the caller also gets its own held and rejected ones. */\n list(t: Target, q: CommentQuery = {}, signal?: AbortSignal): Promise<Comment[]> {\n const o = { params: { id: t.id }, signal };\n return t.type === \"groups\"\n ? call(this.http, \"GET\", \"/groups/{id}/comments\", { ...o, query: q })\n : call(this.http, \"GET\", \"/contents/{id}/comments\", { ...o, query: { ...q, version: t.version } });\n }\n /** A top-level comment's replies, oldest first. */\n replies(id: string, q: PageQuery = {}, signal?: AbortSignal): Promise<Comment[]> {\n return call(this.http, \"GET\", \"/comments/{cid}/replies\", { params: { cid: id }, query: q, signal });\n }\n /** Comments on the target in a language's thread, or replies to a top-level comment (reply_to_id); anonymous callers give anon_name. */\n async create(t: Target, input: CommentInput): Promise<Comment> {\n const emit = this.http.captureChanges();\n const o = { params: { id: t.id }, body: input };\n const comment: Comment =\n t.type === \"groups\" ? await call(this.http, \"POST\", \"/groups/{id}/comments\", o) : await call(this.http, \"POST\", \"/contents/{id}/comments\", { ...o, query: { version: t.version } });\n emit({ type: \"comment.created\", target: t, comment });\n return comment;\n }\n /** Replaces the body: its author, or a moderator. */\n async edit(id: string, body: string): Promise<Comment> {\n const emit = this.http.captureChanges();\n const comment: Comment = await call(this.http, \"PATCH\", \"/comments/{cid}\", { params: { cid: id }, body: { body } });\n emit({ type: \"comment.updated\", comment });\n return comment;\n }\n /** Leaves a tombstone: its author, or a moderator. */\n async delete(id: string): Promise<void> {\n const emit = this.http.captureChanges();\n await call(this.http, \"DELETE\", \"/comments/{cid}\", { params: { cid: id } });\n emit({ type: \"comment.deleted\", id });\n }\n /** Sets the caller's reaction to a comment. */\n async react(id: string, value: Reaction): Promise<ReactionCounts> {\n const emit = this.http.captureChanges();\n const params = { cid: id };\n const counts: ReactionCounts =\n value === 0 ? await call(this.http, \"DELETE\", \"/comments/{cid}/reaction\", { params }) : await call(this.http, \"POST\", `/comments/{cid}/${reactionVerb(value)}` as const, { params });\n emit({ type: \"comment.reacted\", id, counts });\n return counts;\n }\n /** Whether the caller may comment on the item, the ban that stops it, and what it may do to others' comments. */\n standing(t: Target, signal?: AbortSignal): Promise<CommentStanding> {\n const o = { params: { id: t.id }, signal };\n return t.type === \"groups\"\n ? call(this.http, \"GET\", \"/groups/{id}/can-comment\", o)\n : call(this.http, \"GET\", \"/contents/{id}/can-comment\", { ...o, query: { version: t.version } });\n }\n /** The newest published comments across the site, with their items; a page may under-fill. */\n latest(q: PageQuery & { language?: string } = {}, signal?: AbortSignal): Promise<FeedItem[]> {\n return call(this.http, \"GET\", \"/comments/latest\", { query: q, signal });\n }\n /** Every comment, newest first, deleted, held and rejected ones with their bodies (root:comments:moderate). */\n adminList(q: AdminCommentQuery = {}, signal?: AbortSignal): Promise<AdminComment[]> {\n const { contentKind, ...rest } = q;\n return call(this.http, \"GET\", \"/comments/admin\", { query: { ...rest, content_kind: contentKind }, signal });\n }\n /** Restores a deleted comment (root:comments:moderate). */\n async restore(id: string): Promise<void> {\n const emit = this.http.captureChanges();\n await call(this.http, \"POST\", \"/comments/{cid}/restore\", { params: { cid: id } });\n emit({ type: \"comment.restored\", id });\n }\n}\n"],"mappings":";;;AAmBA,IAAa,IAAb,MAA4B;CACG;CAA7B,YAAY,GAA6B;EAAZ,KAAA,OAAA;CAAa;CAG1C,KAAK,GAAW,IAAkB,CAAC,GAAG,GAA0C;EAC9E,IAAM,IAAI;GAAE,QAAQ,EAAE,IAAI,EAAE,GAAG;GAAG;EAAO;EACzC,OAAO,EAAE,SAAS,WACd,EAAK,KAAK,MAAM,OAAO,yBAAyB;GAAE,GAAG;GAAG,OAAO;EAAE,CAAC,IAClE,EAAK,KAAK,MAAM,OAAO,2BAA2B;GAAE,GAAG;GAAG,OAAO;IAAE,GAAG;IAAG,SAAS,EAAE;GAAQ;EAAE,CAAC;CACrG;CAEA,QAAQ,GAAY,IAAe,CAAC,GAAG,GAA0C;EAC/E,OAAO,EAAK,KAAK,MAAM,OAAO,2BAA2B;GAAE,QAAQ,EAAE,KAAK,EAAG;GAAG,OAAO;GAAG;EAAO,CAAC;CACpG;CAEA,MAAM,OAAO,GAAW,GAAuC;EAC7D,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAI;GAAE,QAAQ,EAAE,IAAI,EAAE,GAAG;GAAG,MAAM;EAAM,GACxC,IACJ,EAAE,SAAS,WAAW,MAAM,EAAK,KAAK,MAAM,QAAQ,yBAAyB,CAAC,IAAI,MAAM,EAAK,KAAK,MAAM,QAAQ,2BAA2B;GAAE,GAAG;GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ;EAAE,CAAC;EAEpL,OADA,EAAK;GAAE,MAAM;GAAmB,QAAQ;GAAG;EAAQ,CAAC,GAC7C;CACT;CAEA,MAAM,KAAK,GAAY,GAAgC;EACrD,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAmB,MAAM,EAAK,KAAK,MAAM,SAAS,mBAAmB;GAAE,QAAQ,EAAE,KAAK,EAAG;GAAG,MAAM,EAAE,QAAK;EAAE,CAAC;EAElH,OADA,EAAK;GAAE,MAAM;GAAmB;EAAQ,CAAC,GAClC;CACT;CAEA,MAAM,OAAO,GAA2B;EACtC,IAAM,IAAO,KAAK,KAAK,eAAe;EAEtC,AADA,MAAM,EAAK,KAAK,MAAM,UAAU,mBAAmB,EAAE,QAAQ,EAAE,KAAK,EAAG,EAAE,CAAC,GAC1E,EAAK;GAAE,MAAM;GAAmB;EAAG,CAAC;CACtC;CAEA,MAAM,MAAM,GAAY,GAA0C;EAChE,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAS,EAAE,KAAK,EAAG,GACnB,IACJ,MAAU,IAAI,MAAM,EAAK,KAAK,MAAM,UAAU,4BAA4B,EAAE,UAAO,CAAC,IAAI,MAAM,EAAK,KAAK,MAAM,QAAQ,mBAAmB,EAAa,CAAK,KAAc,EAAE,UAAO,CAAC;EAErL,OADA,EAAK;GAAE,MAAM;GAAmB;GAAI;EAAO,CAAC,GACrC;CACT;CAEA,SAAS,GAAW,GAAgD;EAClE,IAAM,IAAI;GAAE,QAAQ,EAAE,IAAI,EAAE,GAAG;GAAG;EAAO;EACzC,OAAO,EAAE,SAAS,WACd,EAAK,KAAK,MAAM,OAAO,4BAA4B,CAAC,IACpD,EAAK,KAAK,MAAM,OAAO,8BAA8B;GAAE,GAAG;GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ;EAAE,CAAC;CAClG;CAEA,OAAO,IAAuC,CAAC,GAAG,GAA2C;EAC3F,OAAO,EAAK,KAAK,MAAM,OAAO,oBAAoB;GAAE,OAAO;GAAG;EAAO,CAAC;CACxE;CAEA,UAAU,IAAuB,CAAC,GAAG,GAA+C;EAClF,IAAM,EAAE,gBAAa,GAAG,MAAS;EACjC,OAAO,EAAK,KAAK,MAAM,OAAO,mBAAmB;GAAE,OAAO;IAAE,GAAG;IAAM,cAAc;GAAY;GAAG;EAAO,CAAC;CAC5G;CAEA,MAAM,QAAQ,GAA2B;EACvC,IAAM,IAAO,KAAK,KAAK,eAAe;EAEtC,AADA,MAAM,EAAK,KAAK,MAAM,QAAQ,2BAA2B,EAAE,QAAQ,EAAE,KAAK,EAAG,EAAE,CAAC,GAChF,EAAK;GAAE,MAAM;GAAoB;EAAG,CAAC;CACvC;AACF"}
|
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FavoriteState, InteractionPage } from '../generated/wire.js';
|
|
2
2
|
import { Http } from '../http.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { AccessMode } from '../discovery.js';
|
|
4
|
+
import { Target } from './types.js';
|
|
5
|
+
/** A page of the caller's favorites or reactions. */
|
|
6
|
+
export interface MineQuery {
|
|
7
|
+
/** contents (the default) or groups. */
|
|
8
|
+
target?: "contents" | "groups";
|
|
9
|
+
/** One content kind or group kind. */
|
|
10
|
+
kind?: string;
|
|
11
|
+
/** The group kinds each card names; every kind with a page by default. */
|
|
12
|
+
card_groups?: readonly string[];
|
|
13
|
+
cursor?: string;
|
|
14
|
+
limit?: number;
|
|
15
|
+
language?: string;
|
|
16
|
+
display_language?: string;
|
|
17
|
+
mode?: AccessMode;
|
|
18
|
+
}
|
|
19
|
+
/** Favorites: the target's count for everyone, the signed-in caller's own. */
|
|
5
20
|
export declare class FavoritesClient {
|
|
6
21
|
private readonly http;
|
|
7
22
|
constructor(http: Http);
|
|
8
|
-
/** The
|
|
9
|
-
get(
|
|
10
|
-
/** Favorites or unfavorites the
|
|
11
|
-
set(
|
|
12
|
-
/** The caller's favorites,
|
|
13
|
-
|
|
23
|
+
/** The target's favorite count and whether the caller favorited it (never, signed out). */
|
|
24
|
+
get(t: Target, signal?: AbortSignal): Promise<FavoriteState>;
|
|
25
|
+
/** Favorites or unfavorites the target (signed in); repeating is a no-op. Resolves with the new state and count. */
|
|
26
|
+
set(t: Target, favorited: boolean): Promise<FavoriteState>;
|
|
27
|
+
/** The caller's favorites, most recent first: content cards or groups. */
|
|
28
|
+
mine(q?: MineQuery, signal?: AbortSignal): Promise<InteractionPage>;
|
|
14
29
|
}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
import { call as e } from "../route.js";
|
|
2
|
+
import { query as t } from "../discovery.js";
|
|
2
3
|
//#region src/client/content/favorites.ts
|
|
3
|
-
var
|
|
4
|
+
var n = class {
|
|
4
5
|
http;
|
|
5
6
|
constructor(e) {
|
|
6
7
|
this.http = e;
|
|
7
8
|
}
|
|
8
9
|
get(t, n) {
|
|
9
|
-
|
|
10
|
-
params: {
|
|
11
|
-
kind: t.kind,
|
|
12
|
-
id: t.id
|
|
13
|
-
},
|
|
10
|
+
let r = {
|
|
11
|
+
params: { id: t.id },
|
|
14
12
|
signal: n
|
|
13
|
+
};
|
|
14
|
+
return t.type === "groups" ? e(this.http, "GET", "/groups/{id}/favorite", r) : e(this.http, "GET", "/contents/{id}/favorite", {
|
|
15
|
+
...r,
|
|
16
|
+
query: { version: t.version }
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
19
|
async set(t, n) {
|
|
18
|
-
let r = this.http.captureChanges(), i =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
20
|
+
let r = this.http.captureChanges(), i = n ? "POST" : "DELETE", a = { params: { id: t.id } }, o = t.type === "groups" ? await e(this.http, i, "/groups/{id}/favorite", a) : await e(this.http, i, "/contents/{id}/favorite", {
|
|
21
|
+
...a,
|
|
22
|
+
query: { version: t.version }
|
|
23
|
+
});
|
|
22
24
|
return r({
|
|
23
25
|
type: "favorite.changed",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
favorited: i.favorited,
|
|
29
|
-
count: i.count
|
|
30
|
-
}), i;
|
|
26
|
+
target: t,
|
|
27
|
+
favorited: o.favorited,
|
|
28
|
+
count: o.count
|
|
29
|
+
}), o;
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
return e(this.http, "GET", "/favorites", {
|
|
34
|
-
query: t,
|
|
35
|
-
signal:
|
|
31
|
+
mine(n = {}, r) {
|
|
32
|
+
return e(this.http, "GET", "/me/favorites", {
|
|
33
|
+
query: t(n),
|
|
34
|
+
signal: r
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
//#endregion
|
|
40
|
-
export {
|
|
39
|
+
export { n as FavoritesClient };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=favorites.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorites.js","names":[],"sources":["../../../src/client/content/favorites.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"favorites.js","names":[],"sources":["../../../src/client/content/favorites.ts"],"sourcesContent":["import type { FavoriteState, InteractionPage } from \"../generated/wire.js\";\nimport type { Http } from \"../http.js\";\nimport { query, type AccessMode } from \"../discovery.js\";\nimport { call } from \"../route.js\";\nimport type { Target } from \"./types.js\";\n\n/** A page of the caller's favorites or reactions. */\nexport interface MineQuery {\n /** contents (the default) or groups. */\n target?: \"contents\" | \"groups\";\n /** One content kind or group kind. */\n kind?: string;\n /** The group kinds each card names; every kind with a page by default. */\n card_groups?: readonly string[];\n cursor?: string;\n limit?: number;\n language?: string;\n display_language?: string;\n mode?: AccessMode;\n}\n\n/** Favorites: the target's count for everyone, the signed-in caller's own. */\nexport class FavoritesClient {\n constructor(private readonly http: Http) {}\n\n /** The target's favorite count and whether the caller favorited it (never, signed out). */\n get(t: Target, signal?: AbortSignal): Promise<FavoriteState> {\n const o = { params: { id: t.id }, signal };\n return t.type === \"groups\" ? call(this.http, \"GET\", \"/groups/{id}/favorite\", o) : call(this.http, \"GET\", \"/contents/{id}/favorite\", { ...o, query: { version: t.version } });\n }\n /** Favorites or unfavorites the target (signed in); repeating is a no-op. Resolves with the new state and count. */\n async set(t: Target, favorited: boolean): Promise<FavoriteState> {\n const emit = this.http.captureChanges();\n const method = favorited ? \"POST\" : \"DELETE\";\n const o = { params: { id: t.id } };\n const state: FavoriteState =\n t.type === \"groups\" ? await call(this.http, method, \"/groups/{id}/favorite\", o) : await call(this.http, method, \"/contents/{id}/favorite\", { ...o, query: { version: t.version } });\n emit({ type: \"favorite.changed\", target: t, favorited: state.favorited, count: state.count });\n return state;\n }\n /** The caller's favorites, most recent first: content cards or groups. */\n mine(q: MineQuery = {}, signal?: AbortSignal): Promise<InteractionPage> {\n return call(this.http, \"GET\", \"/me/favorites\", { query: query(q) as never, signal });\n }\n}\n"],"mappings":";;;AAsBA,IAAa,IAAb,MAA6B;CACE;CAA7B,YAAY,GAA6B;EAAZ,KAAA,OAAA;CAAa;CAG1C,IAAI,GAAW,GAA8C;EAC3D,IAAM,IAAI;GAAE,QAAQ,EAAE,IAAI,EAAE,GAAG;GAAG;EAAO;EACzC,OAAO,EAAE,SAAS,WAAW,EAAK,KAAK,MAAM,OAAO,yBAAyB,CAAC,IAAI,EAAK,KAAK,MAAM,OAAO,2BAA2B;GAAE,GAAG;GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ;EAAE,CAAC;CAC7K;CAEA,MAAM,IAAI,GAAW,GAA4C;EAC/D,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAS,IAAY,SAAS,UAC9B,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAC3B,IACJ,EAAE,SAAS,WAAW,MAAM,EAAK,KAAK,MAAM,GAAQ,yBAAyB,CAAC,IAAI,MAAM,EAAK,KAAK,MAAM,GAAQ,2BAA2B;GAAE,GAAG;GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ;EAAE,CAAC;EAEpL,OADA,EAAK;GAAE,MAAM;GAAoB,QAAQ;GAAG,WAAW,EAAM;GAAW,OAAO,EAAM;EAAM,CAAC,GACrF;CACT;CAEA,KAAK,IAAe,CAAC,GAAG,GAAgD;EACtE,OAAO,EAAK,KAAK,MAAM,OAAO,iBAAiB;GAAE,OAAO,EAAM,CAAC;GAAY;EAAO,CAAC;CACrF;AACF"}
|
|
@@ -7,7 +7,7 @@ export interface HeldQuery {
|
|
|
7
7
|
cursor?: string;
|
|
8
8
|
limit?: number;
|
|
9
9
|
}
|
|
10
|
-
/** The review queue of held comments and
|
|
10
|
+
/** The review queue of held comments and content (ModerationReview). */
|
|
11
11
|
export declare class ModerationClient {
|
|
12
12
|
private readonly http;
|
|
13
13
|
constructor(http: Http);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderation.js","names":[],"sources":["../../../src/client/content/moderation.ts"],"sourcesContent":["import type { HeldItem, HeldPage, ReviewOutcome } from \"../generated/wire.js\";\nimport type { Http } from \"../http.js\";\nimport { call } from \"../route.js\";\nimport type { Decision, HeldKind } from \"./types.js\";\n\nexport interface HeldQuery {\n kind: HeldKind;\n /** The previous page's next. */\n cursor?: string;\n limit?: number;\n}\n\n/** The review queue of held comments and
|
|
1
|
+
{"version":3,"file":"moderation.js","names":[],"sources":["../../../src/client/content/moderation.ts"],"sourcesContent":["import type { HeldItem, HeldPage, ReviewOutcome } from \"../generated/wire.js\";\nimport type { Http } from \"../http.js\";\nimport { call } from \"../route.js\";\nimport type { Decision, HeldKind } from \"./types.js\";\n\nexport interface HeldQuery {\n kind: HeldKind;\n /** The previous page's next. */\n cursor?: string;\n limit?: number;\n}\n\n/** The review queue of held comments and content (ModerationReview). */\nexport class ModerationClient {\n constructor(private readonly http: Http) {}\n\n /** Held items awaiting review, oldest first. */\n held(q: HeldQuery, signal?: AbortSignal): Promise<HeldPage> {\n return call(this.http, \"GET\", \"/moderation/held\", { query: { ...q }, signal });\n }\n /** Approves (publishes) or rejects a held item at the revision the queue listed; conflict when it was edited since. */\n async resolve(item: Pick<HeldItem, \"kind\" | \"id\" | \"revision\">, decision: Decision, reason?: string): Promise<ReviewOutcome> {\n const emit = this.http.captureChanges();\n const kind = item.kind as HeldKind;\n const out: ReviewOutcome = await call(this.http, \"POST\", \"/moderation/{kind}/{id}/resolve\", {\n params: { kind, id: item.id },\n body: { decision, revision: item.revision, ...(reason ? { reason } : {}) },\n });\n emit({ type: \"moderation.resolved\", kind, id: item.id, decision });\n return out;\n }\n}\n"],"mappings":";;AAaA,IAAa,IAAb,MAA8B;CACC;CAA7B,YAAY,GAA6B;EAAZ,KAAA,OAAA;CAAa;CAG1C,KAAK,GAAc,GAAyC;EAC1D,OAAO,EAAK,KAAK,MAAM,OAAO,oBAAoB;GAAE,OAAO,EAAE,GAAG,EAAE;GAAG;EAAO,CAAC;CAC/E;CAEA,MAAM,QAAQ,GAAkD,GAAoB,GAAyC;EAC3H,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAO,EAAK,MACZ,IAAqB,MAAM,EAAK,KAAK,MAAM,QAAQ,mCAAmC;GAC1F,QAAQ;IAAE;IAAM,IAAI,EAAK;GAAG;GAC5B,MAAM;IAAE;IAAU,UAAU,EAAK;IAAU,GAAI,IAAS,EAAE,UAAO,IAAI,CAAC;GAAG;EAC3E,CAAC;EAED,OADA,EAAK;GAAE,MAAM;GAAuB;GAAM,IAAI,EAAK;GAAI;EAAS,CAAC,GAC1D;CACT;AACF"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InteractionPage, ReactionCounts } from '../generated/wire.js';
|
|
2
2
|
import { Http } from '../http.js';
|
|
3
|
-
import { Reaction } from './types.js';
|
|
4
|
-
|
|
3
|
+
import { Reaction, Target } from './types.js';
|
|
4
|
+
import { MineQuery } from './favorites.js';
|
|
5
|
+
/** Likes and dislikes of a content item, a version or a group. */
|
|
5
6
|
export declare class ReactionsClient {
|
|
6
7
|
private readonly http;
|
|
7
8
|
constructor(http: Http);
|
|
8
|
-
/** The
|
|
9
|
-
get(
|
|
9
|
+
/** The target's counts and the caller's own reaction. */
|
|
10
|
+
get(t: Target, signal?: AbortSignal): Promise<ReactionCounts>;
|
|
10
11
|
/** Sets the caller's reaction (0 clears it); resolves with the new counts. */
|
|
11
|
-
set(
|
|
12
|
+
set(t: Target, value: Reaction): Promise<ReactionCounts>;
|
|
13
|
+
/** What the signed-in caller liked or disliked, most recent first: content cards or groups (tag preferences). */
|
|
14
|
+
mine(q?: MineQuery & {
|
|
15
|
+
value?: "like" | "dislike";
|
|
16
|
+
}, signal?: AbortSignal): Promise<InteractionPage>;
|
|
12
17
|
}
|
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
import { call as e } from "../route.js";
|
|
2
2
|
import { reactionVerb as t } from "./types.js";
|
|
3
|
+
import { query as n } from "../discovery.js";
|
|
3
4
|
//#region src/client/content/reactions.ts
|
|
4
|
-
var
|
|
5
|
+
var r = class {
|
|
5
6
|
http;
|
|
6
7
|
constructor(e) {
|
|
7
8
|
this.http = e;
|
|
8
9
|
}
|
|
9
10
|
get(t, n) {
|
|
10
|
-
|
|
11
|
-
params: {
|
|
12
|
-
kind: t.kind,
|
|
13
|
-
id: t.id
|
|
14
|
-
},
|
|
11
|
+
let r = {
|
|
12
|
+
params: { id: t.id },
|
|
15
13
|
signal: n
|
|
14
|
+
};
|
|
15
|
+
return t.type === "groups" ? e(this.http, "GET", "/groups/{id}/reaction", r) : e(this.http, "GET", "/contents/{id}/reaction", {
|
|
16
|
+
...r,
|
|
17
|
+
query: { version: t.version }
|
|
16
18
|
});
|
|
17
19
|
}
|
|
18
20
|
async set(n, r) {
|
|
19
|
-
let i = this.http.captureChanges(), a = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
return i({
|
|
21
|
+
let i = this.http.captureChanges(), a = { params: { id: n.id } }, o = {
|
|
22
|
+
...a,
|
|
23
|
+
query: { version: n.version }
|
|
24
|
+
}, s;
|
|
25
|
+
return s = n.type === "groups" ? r === 0 ? await e(this.http, "DELETE", "/groups/{id}/reaction", a) : await e(this.http, "POST", `/groups/{id}/${t(r)}`, a) : r === 0 ? await e(this.http, "DELETE", "/contents/{id}/reaction", o) : await e(this.http, "POST", `/contents/{id}/${t(r)}`, o), i({
|
|
24
26
|
type: "reaction.changed",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
target: n,
|
|
28
|
+
counts: s
|
|
29
|
+
}), s;
|
|
30
|
+
}
|
|
31
|
+
mine(t = {}, r) {
|
|
32
|
+
return e(this.http, "GET", "/me/reactions", {
|
|
33
|
+
query: n(t),
|
|
34
|
+
signal: r
|
|
35
|
+
});
|
|
31
36
|
}
|
|
32
37
|
};
|
|
33
38
|
//#endregion
|
|
34
|
-
export {
|
|
39
|
+
export { r as ReactionsClient };
|
|
35
40
|
|
|
36
41
|
//# sourceMappingURL=reactions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactions.js","names":[],"sources":["../../../src/client/content/reactions.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"reactions.js","names":[],"sources":["../../../src/client/content/reactions.ts"],"sourcesContent":["import type { InteractionPage, ReactionCounts } from \"../generated/wire.js\";\nimport type { Http } from \"../http.js\";\nimport { query } from \"../discovery.js\";\nimport { call } from \"../route.js\";\nimport { reactionVerb, type Reaction, type Target } from \"./types.js\";\nimport type { MineQuery } from \"./favorites.js\";\n\n/** Likes and dislikes of a content item, a version or a group. */\nexport class ReactionsClient {\n constructor(private readonly http: Http) {}\n\n /** The target's counts and the caller's own reaction. */\n get(t: Target, signal?: AbortSignal): Promise<ReactionCounts> {\n const o = { params: { id: t.id }, signal };\n return t.type === \"groups\" ? call(this.http, \"GET\", \"/groups/{id}/reaction\", o) : call(this.http, \"GET\", \"/contents/{id}/reaction\", { ...o, query: { version: t.version } });\n }\n /** Sets the caller's reaction (0 clears it); resolves with the new counts. */\n async set(t: Target, value: Reaction): Promise<ReactionCounts> {\n const emit = this.http.captureChanges();\n const o = { params: { id: t.id } };\n const c = { ...o, query: { version: t.version } };\n let counts: ReactionCounts;\n if (t.type === \"groups\") {\n counts = value === 0 ? await call(this.http, \"DELETE\", \"/groups/{id}/reaction\", o) : await call(this.http, \"POST\", `/groups/{id}/${reactionVerb(value)}` as const, o);\n } else {\n counts = value === 0 ? await call(this.http, \"DELETE\", \"/contents/{id}/reaction\", c) : await call(this.http, \"POST\", `/contents/{id}/${reactionVerb(value)}` as const, c);\n }\n emit({ type: \"reaction.changed\", target: t, counts });\n return counts;\n }\n /** What the signed-in caller liked or disliked, most recent first: content cards or groups (tag preferences). */\n mine(q: MineQuery & { value?: \"like\" | \"dislike\" } = {}, signal?: AbortSignal): Promise<InteractionPage> {\n return call(this.http, \"GET\", \"/me/reactions\", { query: query(q) as never, signal });\n }\n}\n"],"mappings":";;;;AAQA,IAAa,IAAb,MAA6B;CACE;CAA7B,YAAY,GAA6B;EAAZ,KAAA,OAAA;CAAa;CAG1C,IAAI,GAAW,GAA+C;EAC5D,IAAM,IAAI;GAAE,QAAQ,EAAE,IAAI,EAAE,GAAG;GAAG;EAAO;EACzC,OAAO,EAAE,SAAS,WAAW,EAAK,KAAK,MAAM,OAAO,yBAAyB,CAAC,IAAI,EAAK,KAAK,MAAM,OAAO,2BAA2B;GAAE,GAAG;GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ;EAAE,CAAC;CAC7K;CAEA,MAAM,IAAI,GAAW,GAA0C;EAC7D,IAAM,IAAO,KAAK,KAAK,eAAe,GAChC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAC3B,IAAI;GAAE,GAAG;GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ;EAAE,GAC5C;EAOJ,OANA,AAGE,IAHE,EAAE,SAAS,WACJ,MAAU,IAAI,MAAM,EAAK,KAAK,MAAM,UAAU,yBAAyB,CAAC,IAAI,MAAM,EAAK,KAAK,MAAM,QAAQ,gBAAgB,EAAa,CAAK,KAAc,CAAC,IAE3J,MAAU,IAAI,MAAM,EAAK,KAAK,MAAM,UAAU,2BAA2B,CAAC,IAAI,MAAM,EAAK,KAAK,MAAM,QAAQ,kBAAkB,EAAa,CAAK,KAAc,CAAC,GAE1K,EAAK;GAAE,MAAM;GAAoB,QAAQ;GAAG;EAAO,CAAC,GAC7C;CACT;CAEA,KAAK,IAAgD,CAAC,GAAG,GAAgD;EACvG,OAAO,EAAK,KAAK,MAAM,OAAO,iBAAiB;GAAE,OAAO,EAAM,CAAC;GAAY;EAAO,CAAC;CACrF;AACF"}
|
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
import { CommentBan, CommentStanding, Comment,
|
|
1
|
+
import { CommentBan, CommentStanding, Comment, Content, Poll, ReactionCounts, ResolveInput } from '../generated/wire.js';
|
|
2
|
+
/** What an interaction targets: a content item (optionally one of its versions) or a group. */
|
|
3
|
+
export interface Target {
|
|
4
|
+
type: "contents" | "groups";
|
|
5
|
+
id: string;
|
|
6
|
+
/** One version of a content item. */
|
|
7
|
+
version?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The same target. */
|
|
10
|
+
export declare function sameTarget(a?: Target, b?: Target): boolean;
|
|
2
11
|
/** A reaction: like 1, dislike -1, none 0. */
|
|
3
12
|
export type Reaction = -1 | 0 | 1;
|
|
4
13
|
/** The route verb that sets a like or dislike; clearing is DELETE …/reaction. */
|
|
5
14
|
export declare function reactionVerb(value: -1 | 1): "like" | "dislike";
|
|
6
|
-
/** Comment
|
|
15
|
+
/** Comment order: newest (the default), likes (most liked) or best (Wilson lower bound). */
|
|
7
16
|
export type Sort = "newest" | "likes" | "best";
|
|
8
17
|
/** A ban route family: "owner" bans from the caller's own content, "global" from the whole site. */
|
|
9
18
|
export type BanScope = CommentStanding["ban_scopes"][number];
|
|
10
|
-
/** What the review queue holds. */
|
|
11
|
-
export type HeldKind = "comment" | "
|
|
19
|
+
/** What the review queue holds: comments and content items. */
|
|
20
|
+
export type HeldKind = "comment" | "content";
|
|
12
21
|
/** A reviewer's decision on a held item. */
|
|
13
22
|
export type Decision = Exclude<ResolveInput["decision"], "review">;
|
|
14
23
|
/** A content-module mutation made through the client. */
|
|
15
|
-
export type ContentChange =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
post: Post;
|
|
24
|
+
export type ContentChange =
|
|
25
|
+
/** Created or edited: the item as the server now answers it. */
|
|
26
|
+
{
|
|
27
|
+
type: "content.saved";
|
|
28
|
+
content: Content;
|
|
21
29
|
}
|
|
22
|
-
/**
|
|
30
|
+
/** A version changed: refetch the item. */
|
|
23
31
|
| {
|
|
24
|
-
type: "
|
|
32
|
+
type: "content.changed";
|
|
25
33
|
id: string;
|
|
26
34
|
} | {
|
|
27
|
-
type: "
|
|
35
|
+
type: "content.deleted";
|
|
28
36
|
id: string;
|
|
29
|
-
} | {
|
|
30
|
-
type: "post.restored";
|
|
31
|
-
post: Post;
|
|
32
37
|
}
|
|
33
|
-
/**
|
|
38
|
+
/** target is the commented item. */
|
|
34
39
|
| {
|
|
35
40
|
type: "comment.created";
|
|
36
|
-
|
|
41
|
+
target: Target;
|
|
37
42
|
comment: Comment;
|
|
38
43
|
} | {
|
|
39
44
|
type: "comment.updated";
|
|
@@ -50,11 +55,11 @@ export type ContentChange = {
|
|
|
50
55
|
counts: ReactionCounts;
|
|
51
56
|
} | {
|
|
52
57
|
type: "reaction.changed";
|
|
53
|
-
|
|
58
|
+
target: Target;
|
|
54
59
|
counts: ReactionCounts;
|
|
55
60
|
} | {
|
|
56
61
|
type: "favorite.changed";
|
|
57
|
-
|
|
62
|
+
target: Target;
|
|
58
63
|
favorited: boolean;
|
|
59
64
|
count: number;
|
|
60
65
|
}
|
|
@@ -87,5 +92,19 @@ export type ContentChange = {
|
|
|
87
92
|
id: string;
|
|
88
93
|
decision: Decision;
|
|
89
94
|
} | {
|
|
90
|
-
type: "
|
|
95
|
+
type: "groups.changed";
|
|
96
|
+
}
|
|
97
|
+
/** The reader's content filters changed: every list reads again. */
|
|
98
|
+
| {
|
|
99
|
+
type: "contentFilters.changed";
|
|
100
|
+
} | {
|
|
101
|
+
type: "history.changed";
|
|
102
|
+
}
|
|
103
|
+
/** A search ran or recent searches were cleared. */
|
|
104
|
+
| {
|
|
105
|
+
type: "searches.changed";
|
|
106
|
+
}
|
|
107
|
+
/** The reader's keys changed (a join, a purchase the host reports): reads of access re-run. */
|
|
108
|
+
| {
|
|
109
|
+
type: "access.changed";
|
|
91
110
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
//#region src/client/content/types.ts
|
|
2
|
-
function e(e) {
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return !!e && !!t && e.type === t.type && e.id === t.id && (e.version ?? "") === (t.version ?? "");
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
3
6
|
return e === 1 ? "like" : "dislike";
|
|
4
7
|
}
|
|
5
8
|
//#endregion
|
|
6
|
-
export {
|
|
9
|
+
export { t as reactionVerb, e as sameTarget };
|
|
7
10
|
|
|
8
11
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/client/content/types.ts"],"sourcesContent":["import type { CommentBan, CommentStanding, Comment,
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/client/content/types.ts"],"sourcesContent":["import type { CommentBan, CommentStanding, Comment, Content, Poll, ReactionCounts, ResolveInput } from \"../generated/wire.js\";\n\n/** What an interaction targets: a content item (optionally one of its versions) or a group. */\nexport interface Target {\n type: \"contents\" | \"groups\";\n id: string;\n /** One version of a content item. */\n version?: string;\n}\n\n/** The same target. */\nexport function sameTarget(a?: Target, b?: Target): boolean {\n return !!a && !!b && a.type === b.type && a.id === b.id && (a.version ?? \"\") === (b.version ?? \"\");\n}\n\n/** A reaction: like 1, dislike -1, none 0. */\nexport type Reaction = -1 | 0 | 1;\n\n/** The route verb that sets a like or dislike; clearing is DELETE …/reaction. */\nexport function reactionVerb(value: -1 | 1): \"like\" | \"dislike\" {\n return value === 1 ? \"like\" : \"dislike\";\n}\n\n/** Comment order: newest (the default), likes (most liked) or best (Wilson lower bound). */\nexport type Sort = \"newest\" | \"likes\" | \"best\";\n\n/** A ban route family: \"owner\" bans from the caller's own content, \"global\" from the whole site. */\nexport type BanScope = CommentStanding[\"ban_scopes\"][number];\n\n/** What the review queue holds: comments and content items. */\nexport type HeldKind = \"comment\" | \"content\";\n\n/** A reviewer's decision on a held item. */\nexport type Decision = Exclude<ResolveInput[\"decision\"], \"review\">;\n\n/** A content-module mutation made through the client. */\nexport type ContentChange =\n /** Created or edited: the item as the server now answers it. */\n | { type: \"content.saved\"; content: Content }\n /** A version changed: refetch the item. */\n | { type: \"content.changed\"; id: string }\n | { type: \"content.deleted\"; id: string }\n /** target is the commented item. */\n | { type: \"comment.created\"; target: Target; comment: Comment }\n | { type: \"comment.updated\"; comment: Comment }\n | { type: \"comment.deleted\"; id: string }\n | { type: \"comment.restored\"; id: string }\n | { type: \"comment.reacted\"; id: string; counts: ReactionCounts }\n | { type: \"reaction.changed\"; target: Target; counts: ReactionCounts }\n | { type: \"favorite.changed\"; target: Target; favorited: boolean; count: number }\n /** Created, updated, voted or answered: the poll as the server now answers it. */\n | { type: \"poll.created\"; poll: Poll }\n | { type: \"poll.updated\"; poll: Poll }\n /** An option or image changed: refetch the poll. */\n | { type: \"poll.changed\"; id: string }\n | { type: \"poll.deleted\"; id: string }\n | { type: \"ban.saved\"; scope: BanScope; ban: CommentBan }\n | { type: \"ban.lifted\"; scope: BanScope; user: string }\n | { type: \"moderation.resolved\"; kind: HeldKind; id: string; decision: Decision }\n | { type: \"groups.changed\" }\n /** The reader's content filters changed: every list reads again. */\n | { type: \"contentFilters.changed\" }\n | { type: \"history.changed\" }\n /** A search ran or recent searches were cleared. */\n | { type: \"searches.changed\" }\n /** The reader's keys changed (a join, a purchase the host reports): reads of access re-run. */\n | { type: \"access.changed\" };\n"],"mappings":";AAWA,SAAgB,EAAW,GAAY,GAAqB;CAC1D,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,SAAS,EAAE,WAAW;AACjG;AAMA,SAAgB,EAAa,GAAmC;CAC9D,OAAO,MAAU,IAAI,SAAS;AAChC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CatalogText, Content, ContentInput, ContentPatch, Creator, InlineImage, Segment, Version, VersionInput } from './generated/wire.js';
|
|
2
|
+
import { Http } from './http.js';
|
|
3
|
+
import { RouteQuery } from './route.js';
|
|
4
|
+
/** The URL scheme of an image reference in a content body. */
|
|
5
|
+
export declare const IMAGE_SCHEME = "contentkit:";
|
|
6
|
+
/**
|
|
7
|
+
* The reference a body stores for one of its images, by name
|
|
8
|
+
* ("contentkit:i-{uuid}"), where the image's URL would go: reads resolve it to
|
|
9
|
+
* the image's current public file (`Content.images`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const imageRef: (name: string) => string;
|
|
12
|
+
/** A content kind's body kind: the media folder of a content item's body images ({kind}.body, id), opened with the item. */
|
|
13
|
+
export declare const BODY_SUFFIX = ".body";
|
|
14
|
+
/** Matches every image reference; the name is group 1. */
|
|
15
|
+
export declare const imageRefs: () => RegExp;
|
|
16
|
+
/** GET /manage/contents filters, as the route names them. */
|
|
17
|
+
export type ManageQuery = RouteQuery<"GET", "/manage/contents">;
|
|
18
|
+
/**
|
|
19
|
+
* Content items: a viewer's reads, and the writes of their creators, their
|
|
20
|
+
* owner group's editors and root:content:write holders.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ContentsClient {
|
|
23
|
+
private readonly http;
|
|
24
|
+
constructor(http: Http);
|
|
25
|
+
/** The item as the caller sees it; text in language, else the site's first, else any. */
|
|
26
|
+
get(id: string, language?: string, signal?: AbortSignal): Promise<Content>;
|
|
27
|
+
version(id: string, vid: string, language?: string, signal?: AbortSignal): Promise<Version>;
|
|
28
|
+
/** Items the caller manages, newest first: all for root:content:write holders, else theirs or an owner group's. */
|
|
29
|
+
manage(q?: ManageQuery, signal?: AbortSignal): Promise<Content[]>;
|
|
30
|
+
/** Creates a draft. */
|
|
31
|
+
create(input: ContentInput): Promise<Content>;
|
|
32
|
+
update(id: string, patch: ContentPatch): Promise<Content>;
|
|
33
|
+
/** Sets the text in one language; moderation "held" when the moderator holds the edit. */
|
|
34
|
+
putText(id: string, language: string, text: CatalogText): Promise<Content>;
|
|
35
|
+
deleteText(id: string, language: string): Promise<Content>;
|
|
36
|
+
setCreators(id: string, creators: Creator[]): Promise<Content>;
|
|
37
|
+
/** Publishes now, or schedules for at; moderation "held" when the moderator holds it. */
|
|
38
|
+
publish(id: string, at?: string): Promise<Content>;
|
|
39
|
+
unpublish(id: string): Promise<Content>;
|
|
40
|
+
remove(id: string): Promise<void>;
|
|
41
|
+
restore(id: string): Promise<Content>;
|
|
42
|
+
/** Sets the cover to an inline image name ("i-{uuid}") of the item's folder; null clears it. */
|
|
43
|
+
setCover(id: string, image: string | null): Promise<Content>;
|
|
44
|
+
/** An inline image of the item's folder: the reference to store in a body and a URL that shows it to the editor now (null while none exists). */
|
|
45
|
+
inlineImage(id: string, image: string, signal?: AbortSignal): Promise<InlineImage>;
|
|
46
|
+
addVersion(id: string, input: VersionInput): Promise<Version>;
|
|
47
|
+
updateVersion(id: string, vid: string, input: VersionInput): Promise<Version>;
|
|
48
|
+
removeVersion(id: string, vid: string): Promise<void>;
|
|
49
|
+
/** Orders the versions: ids lists each version that is not deleted, first first. */
|
|
50
|
+
orderVersions(id: string, ids: string[]): Promise<Content>;
|
|
51
|
+
/** Replaces a version's segments (chapters). */
|
|
52
|
+
setSegments(id: string, vid: string, segments: Segment[]): Promise<Version>;
|
|
53
|
+
private write;
|
|
54
|
+
private writeVersion;
|
|
55
|
+
}
|