@internetarchive/elements 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/elements/ia-button/ia-button.d.ts +31 -0
- package/dist/src/elements/ia-button/ia-button.d.ts.map +1 -1
- package/dist/src/elements/ia-button/ia-button.js +96 -7
- package/dist/src/elements/ia-button/ia-button.js.map +1 -1
- package/dist/src/elements/ia-userlist-settings/ia-userlist-settings.d.ts +70 -0
- package/dist/src/elements/ia-userlist-settings/ia-userlist-settings.d.ts.map +1 -0
- package/dist/src/elements/ia-userlist-settings/ia-userlist-settings.js +314 -0
- package/dist/src/elements/ia-userlist-settings/ia-userlist-settings.js.map +1 -0
- package/dist/src/elements/ia-userlist-settings/mocks/mock-userlist-service.d.ts +37 -0
- package/dist/src/elements/ia-userlist-settings/mocks/mock-userlist-service.d.ts.map +1 -0
- package/dist/src/elements/ia-userlist-settings/mocks/mock-userlist-service.js +71 -0
- package/dist/src/elements/ia-userlist-settings/mocks/mock-userlist-service.js.map +1 -0
- package/dist/src/elements/ia-userlist-settings/models.d.ts +10 -0
- package/dist/src/elements/ia-userlist-settings/models.d.ts.map +1 -0
- package/dist/src/elements/ia-userlist-settings/models.js +2 -0
- package/dist/src/elements/ia-userlist-settings/models.js.map +1 -0
- package/dist/src/elements/modal-manager/ia-modal-manager-template.d.ts.map +1 -1
- package/dist/src/elements/modal-manager/ia-modal-manager-template.js +6 -4
- package/dist/src/elements/modal-manager/ia-modal-manager-template.js.map +1 -1
- package/dist/src/services/userlist-service/index.d.ts +5 -0
- package/dist/src/services/userlist-service/index.d.ts.map +1 -0
- package/dist/src/services/userlist-service/index.js +3 -0
- package/dist/src/services/userlist-service/index.js.map +1 -0
- package/dist/src/services/userlist-service/mocks/sample-lists-backend.d.ts +29 -0
- package/dist/src/services/userlist-service/mocks/sample-lists-backend.d.ts.map +1 -0
- package/dist/src/services/userlist-service/mocks/sample-lists-backend.js +173 -0
- package/dist/src/services/userlist-service/mocks/sample-lists-backend.js.map +1 -0
- package/dist/src/services/userlist-service/models.d.ts +51 -0
- package/dist/src/services/userlist-service/models.d.ts.map +1 -0
- package/dist/src/services/userlist-service/models.js +2 -0
- package/dist/src/services/userlist-service/models.js.map +1 -0
- package/dist/src/services/userlist-service/userlist-error.d.ts +18 -0
- package/dist/src/services/userlist-service/userlist-error.d.ts.map +1 -0
- package/dist/src/services/userlist-service/userlist-error.js +18 -0
- package/dist/src/services/userlist-service/userlist-error.js.map +1 -0
- package/dist/src/services/userlist-service/userlist-service-interface.d.ts +94 -0
- package/dist/src/services/userlist-service/userlist-service-interface.d.ts.map +1 -0
- package/dist/src/services/userlist-service/userlist-service-interface.js +2 -0
- package/dist/src/services/userlist-service/userlist-service-interface.js.map +1 -0
- package/dist/src/services/userlist-service/userlist-service.d.ts +60 -0
- package/dist/src/services/userlist-service/userlist-service.d.ts.map +1 -0
- package/dist/src/services/userlist-service/userlist-service.js +122 -0
- package/dist/src/services/userlist-service/userlist-service.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ApiFetchOptions } from '../../fetch-handler/fetch-options.js';
|
|
2
|
+
/** The user the sample data treats as signed in. */
|
|
3
|
+
export declare const SIGNED_IN_USER = "@brewster";
|
|
4
|
+
/**
|
|
5
|
+
* Stands in for archive.org's `/services/users/…/lists` endpoints, holding the
|
|
6
|
+
* signed-in user's lists in memory so writes show up in later reads. Each
|
|
7
|
+
* answer has the shape the real backend sends: `{ success: true, value }`, or
|
|
8
|
+
* `{ success: false, error: <HTTP status text>, value: <message> }`, with the
|
|
9
|
+
* same messages, limits and quirks. Notes each request. It never touches the
|
|
10
|
+
* network.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SampleListsBackend {
|
|
13
|
+
last?: string;
|
|
14
|
+
private latestListId;
|
|
15
|
+
private lists;
|
|
16
|
+
fetchApiResponse<T>(url: string, options?: ApiFetchOptions): Promise<T>;
|
|
17
|
+
private answer;
|
|
18
|
+
/** Every list, flagged with whether it holds the item, and as which member. */
|
|
19
|
+
private listsContaining;
|
|
20
|
+
private create;
|
|
21
|
+
private edit;
|
|
22
|
+
private addMember;
|
|
23
|
+
/** Removes all of the given members, or none if any of them is missing. */
|
|
24
|
+
private removeMembers;
|
|
25
|
+
private ok;
|
|
26
|
+
private notFound;
|
|
27
|
+
private badRequest;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=sample-lists-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample-lists-backend.d.ts","sourceRoot":"","sources":["../../../../../src/services/userlist-service/mocks/sample-lists-backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,oDAAoD;AACpD,eAAO,MAAM,cAAc,cAAc,CAAC;AAwC1C;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,YAAY,CAAK;IAEzB,OAAO,CAAC,KAAK,CAsBX;IAEI,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe;IAWhE,OAAO,CAAC,MAAM;IA0Cd,+EAA+E;IAC/E,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,MAAM;IAgBd,OAAO,CAAC,IAAI;IAoBZ,OAAO,CAAC,SAAS;IAiBjB,2EAA2E;IAC3E,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,EAAE;IAIV,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/** The user the sample data treats as signed in. */
|
|
2
|
+
export const SIGNED_IN_USER = '@brewster';
|
|
3
|
+
/** A timestamp the way the backend writes one, to the second. */
|
|
4
|
+
const timestamp = (date = new Date()) => date.toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
5
|
+
const CREATED = '2025-01-02T00:00:00Z';
|
|
6
|
+
// The backend's own messages and limits, from petabox's
|
|
7
|
+
// `Users\ListsService` and `Users\ListsMdApi`.
|
|
8
|
+
const INVALID_USER = 'provided user does not exists or not authorized to execute request.';
|
|
9
|
+
const LIST_NOT_FOUND = 'List not found!';
|
|
10
|
+
const LIST_MEMBER_NOT_FOUND = 'List member not found!';
|
|
11
|
+
const LIST_LIMIT = 100;
|
|
12
|
+
const LIST_LIMIT_MSG = 'You have exceeded the maximum number of lists.';
|
|
13
|
+
const MEMBER_LIMIT = 1000;
|
|
14
|
+
const MEMBER_LIMIT_MSG = 'You have exceeded the maximum number of members in this list.';
|
|
15
|
+
/**
|
|
16
|
+
* Stands in for archive.org's `/services/users/…/lists` endpoints, holding the
|
|
17
|
+
* signed-in user's lists in memory so writes show up in later reads. Each
|
|
18
|
+
* answer has the shape the real backend sends: `{ success: true, value }`, or
|
|
19
|
+
* `{ success: false, error: <HTTP status text>, value: <message> }`, with the
|
|
20
|
+
* same messages, limits and quirks. Notes each request. It never touches the
|
|
21
|
+
* network.
|
|
22
|
+
*/
|
|
23
|
+
export class SampleListsBackend {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.latestListId = 2;
|
|
26
|
+
this.lists = [
|
|
27
|
+
{
|
|
28
|
+
list_name: 'Favorite books',
|
|
29
|
+
description: 'Books worth reading twice',
|
|
30
|
+
is_private: false,
|
|
31
|
+
id: 1,
|
|
32
|
+
date_created: CREATED,
|
|
33
|
+
date_updated: CREATED,
|
|
34
|
+
members: [
|
|
35
|
+
{ identifier: 'goody', member_id: 1, date_added: CREATED },
|
|
36
|
+
{ identifier: 'alice', member_id: 2, date_added: CREATED },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
list_name: 'To watch',
|
|
41
|
+
description: '',
|
|
42
|
+
is_private: true,
|
|
43
|
+
id: 2,
|
|
44
|
+
date_created: CREATED,
|
|
45
|
+
date_updated: CREATED,
|
|
46
|
+
members: [],
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
async fetchApiResponse(url, options) {
|
|
51
|
+
const method = options?.method ?? 'GET';
|
|
52
|
+
const body = typeof options?.body === 'string' ? JSON.parse(options.body) : {};
|
|
53
|
+
this.last = `${method} ${url}${typeof options?.body === 'string' ? `\n${options.body}` : ''}`;
|
|
54
|
+
// A copy, so a later write can't change an answer already shown.
|
|
55
|
+
return structuredClone(this.answer(method, new URL(url), body));
|
|
56
|
+
}
|
|
57
|
+
answer(method, url, body) {
|
|
58
|
+
const [, user, listId, onMembers, memberId] = url.pathname.match(/^\/services\/users\/([^/]+)\/lists(?:\/([^/]+))?(\/members)?(?:\/([^/]+))?$/) ?? [];
|
|
59
|
+
// `me` stands for whoever is signed in. Any other user only exists here
|
|
60
|
+
// if it's the signed-in one, and only they may write to their lists.
|
|
61
|
+
if (user !== 'me' && user !== SIGNED_IN_USER) {
|
|
62
|
+
return this.notFound(INVALID_USER);
|
|
63
|
+
}
|
|
64
|
+
const list = listId
|
|
65
|
+
? this.lists.find((l) => String(l.id) === listId)
|
|
66
|
+
: undefined;
|
|
67
|
+
if (listId && !list)
|
|
68
|
+
return this.notFound(LIST_NOT_FOUND);
|
|
69
|
+
switch (method) {
|
|
70
|
+
case 'GET': {
|
|
71
|
+
const item = url.searchParams.get('item');
|
|
72
|
+
if (list)
|
|
73
|
+
return this.ok(list);
|
|
74
|
+
if (item)
|
|
75
|
+
return this.ok(this.listsContaining(item));
|
|
76
|
+
return this.ok(this.lists);
|
|
77
|
+
}
|
|
78
|
+
case 'POST':
|
|
79
|
+
return list
|
|
80
|
+
? this.addMember(list, body)
|
|
81
|
+
: this.create(body);
|
|
82
|
+
case 'PATCH':
|
|
83
|
+
if (!list)
|
|
84
|
+
return this.notFound(LIST_NOT_FOUND);
|
|
85
|
+
return onMembers
|
|
86
|
+
? this.removeMembers(list, body.remove)
|
|
87
|
+
: this.edit(list, body);
|
|
88
|
+
case 'DELETE':
|
|
89
|
+
if (!list)
|
|
90
|
+
return this.notFound(LIST_NOT_FOUND);
|
|
91
|
+
if (memberId)
|
|
92
|
+
return this.removeMembers(list, [memberId]);
|
|
93
|
+
this.lists = this.lists.filter((l) => l !== list);
|
|
94
|
+
// The backend answers with the lists that are left, not `true`.
|
|
95
|
+
return this.ok(this.lists);
|
|
96
|
+
default:
|
|
97
|
+
return this.notFound('invalid set of arguments.');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Every list, flagged with whether it holds the item, and as which member. */
|
|
101
|
+
listsContaining(identifier) {
|
|
102
|
+
return this.lists.map((list) => {
|
|
103
|
+
const member = list.members.find((m) => m.identifier === identifier);
|
|
104
|
+
return member
|
|
105
|
+
? { ...list, item_is_member: true, member_id: member.member_id }
|
|
106
|
+
: { ...list, item_is_member: false };
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
create(options) {
|
|
110
|
+
if (this.lists.length >= LIST_LIMIT)
|
|
111
|
+
return this.badRequest(LIST_LIMIT_MSG);
|
|
112
|
+
const now = timestamp();
|
|
113
|
+
const list = {
|
|
114
|
+
list_name: options.list_name ?? '',
|
|
115
|
+
description: options.description ?? null,
|
|
116
|
+
is_private: options.is_private ?? null,
|
|
117
|
+
id: ++this.latestListId,
|
|
118
|
+
date_created: now,
|
|
119
|
+
date_updated: now,
|
|
120
|
+
members: [],
|
|
121
|
+
};
|
|
122
|
+
this.lists.push(list);
|
|
123
|
+
return this.ok(list);
|
|
124
|
+
}
|
|
125
|
+
edit(list, body) {
|
|
126
|
+
const changes = Object.fromEntries(['list_name', 'description', 'is_private']
|
|
127
|
+
.filter((field) => body[field] !== undefined && body[field] !== null)
|
|
128
|
+
.map((field) => [field, body[field]]));
|
|
129
|
+
// Like the backend, answer with the list as it was plus the changes: the
|
|
130
|
+
// stored `date_updated` moves on, but the one in the answer doesn't.
|
|
131
|
+
const answer = { ...list, ...changes };
|
|
132
|
+
// It also moves only when a value really differs from the stored one.
|
|
133
|
+
if (Object.entries(changes).some(([field, value]) => list[field] !== value)) {
|
|
134
|
+
Object.assign(list, changes, { date_updated: timestamp() });
|
|
135
|
+
}
|
|
136
|
+
return this.ok(answer);
|
|
137
|
+
}
|
|
138
|
+
addMember(list, options) {
|
|
139
|
+
if (list.members.length >= MEMBER_LIMIT) {
|
|
140
|
+
return this.badRequest(MEMBER_LIMIT_MSG);
|
|
141
|
+
}
|
|
142
|
+
const member = {
|
|
143
|
+
identifier: String(options.identifier),
|
|
144
|
+
...(options.file ? { file: String(options.file) } : {}),
|
|
145
|
+
...(options.search_term
|
|
146
|
+
? { search_term: String(options.search_term) }
|
|
147
|
+
: {}),
|
|
148
|
+
member_id: Math.max(0, ...list.members.map((m) => m.member_id)) + 1,
|
|
149
|
+
date_added: timestamp(),
|
|
150
|
+
};
|
|
151
|
+
list.members.push(member);
|
|
152
|
+
return this.ok(member);
|
|
153
|
+
}
|
|
154
|
+
/** Removes all of the given members, or none if any of them is missing. */
|
|
155
|
+
removeMembers(list, ids) {
|
|
156
|
+
const remove = new Set(ids.map(String));
|
|
157
|
+
const found = list.members.filter((m) => remove.has(String(m.member_id)));
|
|
158
|
+
if (found.length < remove.size)
|
|
159
|
+
return this.notFound(LIST_MEMBER_NOT_FOUND);
|
|
160
|
+
list.members = list.members.filter((m) => !found.includes(m));
|
|
161
|
+
return this.ok(list);
|
|
162
|
+
}
|
|
163
|
+
ok(value) {
|
|
164
|
+
return { success: true, value };
|
|
165
|
+
}
|
|
166
|
+
notFound(message) {
|
|
167
|
+
return { success: false, error: 'Not Found', value: message };
|
|
168
|
+
}
|
|
169
|
+
badRequest(message) {
|
|
170
|
+
return { success: false, error: 'Bad Request', value: message };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=sample-lists-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample-lists-backend.js","sourceRoot":"","sources":["../../../../../src/services/userlist-service/mocks/sample-lists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,CAAC;IAClC,CAAC;IAEO,QAAQ,CAAC,OAAe;QAC9B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAChE,CAAC;IAEO,UAAU,CAAC,OAAe;QAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAClE,CAAC;CACF","sourcesContent":["import type { ApiFetchOptions } from '../../fetch-handler/fetch-options';\n\n/** The user the sample data treats as signed in. */\nexport const SIGNED_IN_USER = '@brewster';\n\n/** A timestamp the way the backend writes one, to the second. */\nconst timestamp = (date = new Date()) =>\n date.toISOString().replace(/\\.\\d{3}Z$/, 'Z');\n\nconst CREATED = '2025-01-02T00:00:00Z';\n\n/** A list member as the backend stores and sends it. */\ntype SampleMember = {\n identifier: string;\n member_id: number;\n date_added: string;\n file?: string;\n search_term?: string;\n};\n\n/** A list as the backend stores and sends it. */\ntype SampleList = {\n list_name: string;\n description: string | null;\n is_private: boolean | null;\n id: number;\n date_created: string;\n date_updated: string;\n members: SampleMember[];\n};\n\n// The backend's own messages and limits, from petabox's\n// `Users\\ListsService` and `Users\\ListsMdApi`.\nconst INVALID_USER =\n 'provided user does not exists or not authorized to execute request.';\nconst LIST_NOT_FOUND = 'List not found!';\nconst LIST_MEMBER_NOT_FOUND = 'List member not found!';\nconst LIST_LIMIT = 100;\nconst LIST_LIMIT_MSG = 'You have exceeded the maximum number of lists.';\nconst MEMBER_LIMIT = 1000;\nconst MEMBER_LIMIT_MSG =\n 'You have exceeded the maximum number of members in this list.';\n\n/**\n * Stands in for archive.org's `/services/users/…/lists` endpoints, holding the\n * signed-in user's lists in memory so writes show up in later reads. Each\n * answer has the shape the real backend sends: `{ success: true, value }`, or\n * `{ success: false, error: <HTTP status text>, value: <message> }`, with the\n * same messages, limits and quirks. Notes each request. It never touches the\n * network.\n */\nexport class SampleListsBackend {\n last?: string;\n\n private latestListId = 2;\n\n private lists: SampleList[] = [\n {\n list_name: 'Favorite books',\n description: 'Books worth reading twice',\n is_private: false,\n id: 1,\n date_created: CREATED,\n date_updated: CREATED,\n members: [\n { identifier: 'goody', member_id: 1, date_added: CREATED },\n { identifier: 'alice', member_id: 2, date_added: CREATED },\n ],\n },\n {\n list_name: 'To watch',\n description: '',\n is_private: true,\n id: 2,\n date_created: CREATED,\n date_updated: CREATED,\n members: [],\n },\n ];\n\n async fetchApiResponse<T>(url: string, options?: ApiFetchOptions) {\n const method = options?.method ?? 'GET';\n const body =\n typeof options?.body === 'string' ? JSON.parse(options.body) : {};\n this.last = `${method} ${url}${\n typeof options?.body === 'string' ? `\\n${options.body}` : ''\n }`;\n // A copy, so a later write can't change an answer already shown.\n return structuredClone(this.answer(method, new URL(url), body)) as T;\n }\n\n private answer(method: string, url: URL, body: Record<string, unknown>) {\n const [, user, listId, onMembers, memberId] =\n url.pathname.match(\n /^\\/services\\/users\\/([^/]+)\\/lists(?:\\/([^/]+))?(\\/members)?(?:\\/([^/]+))?$/,\n ) ?? [];\n // `me` stands for whoever is signed in. Any other user only exists here\n // if it's the signed-in one, and only they may write to their lists.\n if (user !== 'me' && user !== SIGNED_IN_USER) {\n return this.notFound(INVALID_USER);\n }\n const list = listId\n ? this.lists.find((l) => String(l.id) === listId)\n : undefined;\n if (listId && !list) return this.notFound(LIST_NOT_FOUND);\n\n switch (method) {\n case 'GET': {\n const item = url.searchParams.get('item');\n if (list) return this.ok(list);\n if (item) return this.ok(this.listsContaining(item));\n return this.ok(this.lists);\n }\n case 'POST':\n return list\n ? this.addMember(list, body)\n : this.create(body as Partial<SampleList>);\n case 'PATCH':\n if (!list) return this.notFound(LIST_NOT_FOUND);\n return onMembers\n ? this.removeMembers(list, body.remove as (string | number)[])\n : this.edit(list, body);\n case 'DELETE':\n if (!list) return this.notFound(LIST_NOT_FOUND);\n if (memberId) return this.removeMembers(list, [memberId]);\n this.lists = this.lists.filter((l) => l !== list);\n // The backend answers with the lists that are left, not `true`.\n return this.ok(this.lists);\n default:\n return this.notFound('invalid set of arguments.');\n }\n }\n\n /** Every list, flagged with whether it holds the item, and as which member. */\n private listsContaining(identifier: string) {\n return this.lists.map((list) => {\n const member = list.members.find((m) => m.identifier === identifier);\n return member\n ? { ...list, item_is_member: true, member_id: member.member_id }\n : { ...list, item_is_member: false };\n });\n }\n\n private create(options: Partial<SampleList>) {\n if (this.lists.length >= LIST_LIMIT) return this.badRequest(LIST_LIMIT_MSG);\n const now = timestamp();\n const list: SampleList = {\n list_name: options.list_name ?? '',\n description: options.description ?? null,\n is_private: options.is_private ?? null,\n id: ++this.latestListId,\n date_created: now,\n date_updated: now,\n members: [],\n };\n this.lists.push(list);\n return this.ok(list);\n }\n\n private edit(list: SampleList, body: Record<string, unknown>) {\n const changes = Object.fromEntries(\n (['list_name', 'description', 'is_private'] as const)\n .filter((field) => body[field] !== undefined && body[field] !== null)\n .map((field) => [field, body[field]]),\n );\n // Like the backend, answer with the list as it was plus the changes: the\n // stored `date_updated` moves on, but the one in the answer doesn't.\n const answer = { ...list, ...changes };\n // It also moves only when a value really differs from the stored one.\n if (\n Object.entries(changes).some(\n ([field, value]) => list[field as keyof SampleList] !== value,\n )\n ) {\n Object.assign(list, changes, { date_updated: timestamp() });\n }\n return this.ok(answer);\n }\n\n private addMember(list: SampleList, options: Record<string, unknown>) {\n if (list.members.length >= MEMBER_LIMIT) {\n return this.badRequest(MEMBER_LIMIT_MSG);\n }\n const member: SampleMember = {\n identifier: String(options.identifier),\n ...(options.file ? { file: String(options.file) } : {}),\n ...(options.search_term\n ? { search_term: String(options.search_term) }\n : {}),\n member_id: Math.max(0, ...list.members.map((m) => m.member_id)) + 1,\n date_added: timestamp(),\n };\n list.members.push(member);\n return this.ok(member);\n }\n\n /** Removes all of the given members, or none if any of them is missing. */\n private removeMembers(list: SampleList, ids: (string | number)[]) {\n const remove = new Set(ids.map(String));\n const found = list.members.filter((m) => remove.has(String(m.member_id)));\n if (found.length < remove.size) return this.notFound(LIST_MEMBER_NOT_FOUND);\n list.members = list.members.filter((m) => !found.includes(m));\n return this.ok(list);\n }\n\n private ok(value: unknown) {\n return { success: true, value };\n }\n\n private notFound(message: string) {\n return { success: false, error: 'Not Found', value: message };\n }\n\n private badRequest(message: string) {\n return { success: false, error: 'Bad Request', value: message };\n }\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type UserListMember = {
|
|
2
|
+
/** The id of this list member, unique within the current list */
|
|
3
|
+
member_id: string;
|
|
4
|
+
/** The identifier of the Archive item that this member represents */
|
|
5
|
+
identifier: string;
|
|
6
|
+
/** The timestamp when this member was added to the list */
|
|
7
|
+
date_added: Date;
|
|
8
|
+
/** (Optional) A subfile path within the item that this member represents */
|
|
9
|
+
file?: string;
|
|
10
|
+
/** (Optional) The search term within the item that this member represents */
|
|
11
|
+
search_term?: string;
|
|
12
|
+
};
|
|
13
|
+
export type UserList = {
|
|
14
|
+
/** The id of this list, unique among the current user's lists */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The user-generated title for the list */
|
|
17
|
+
list_name: string;
|
|
18
|
+
/** The user-generated description for the list */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Whether the list is marked private */
|
|
21
|
+
is_private: boolean;
|
|
22
|
+
/** The timestamp when this list was first created */
|
|
23
|
+
date_created: Date;
|
|
24
|
+
/** The timestamp when this list was last updated */
|
|
25
|
+
date_updated: Date;
|
|
26
|
+
/** The total number of members in this list */
|
|
27
|
+
count: number;
|
|
28
|
+
/** The array of members within this list (not always present) */
|
|
29
|
+
members?: UserListMember[];
|
|
30
|
+
/** Whether this list contains the queried item (only present on item-specific requests) */
|
|
31
|
+
item_is_member?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/** Options that can be specified when creating or editing a list */
|
|
34
|
+
export type UserListOptions = {
|
|
35
|
+
/** The title to apply to the list */
|
|
36
|
+
list_name: string;
|
|
37
|
+
/** The description to apply to the list */
|
|
38
|
+
description: string;
|
|
39
|
+
/** Whether the list should be marked private */
|
|
40
|
+
is_private: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Options that can be specified when adding a member to a list */
|
|
43
|
+
export type UserListMemberOptions = {
|
|
44
|
+
/** The identifier of the Archive item that the new member should represent */
|
|
45
|
+
identifier: string;
|
|
46
|
+
/** (Optional) A subfile path within the item that the new member should represent */
|
|
47
|
+
file?: string;
|
|
48
|
+
/** (Optional) A search term within the item that the new member should represent */
|
|
49
|
+
search_term?: string;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../src/services/userlist-service/models.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,UAAU,EAAE,IAAI,CAAC;IACjB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,qDAAqD;IACrD,YAAY,EAAE,IAAI,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,IAAI,CAAC;IACnB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,2FAA2F;IAC3F,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,eAAe,GAAG;IAC5B,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,qBAAqB,GAAG;IAClC,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/services/userlist-service/models.ts"],"names":[],"mappings":"","sourcesContent":["export type UserListMember = {\n /** The id of this list member, unique within the current list */\n member_id: string;\n /** The identifier of the Archive item that this member represents */\n identifier: string;\n /** The timestamp when this member was added to the list */\n date_added: Date;\n /** (Optional) A subfile path within the item that this member represents */\n file?: string;\n /** (Optional) The search term within the item that this member represents */\n search_term?: string;\n};\n\nexport type UserList = {\n /** The id of this list, unique among the current user's lists */\n id: string;\n /** The user-generated title for the list */\n list_name: string;\n /** The user-generated description for the list */\n description: string;\n /** Whether the list is marked private */\n is_private: boolean;\n /** The timestamp when this list was first created */\n date_created: Date;\n /** The timestamp when this list was last updated */\n date_updated: Date;\n /** The total number of members in this list */\n count: number;\n /** The array of members within this list (not always present) */\n members?: UserListMember[];\n /** Whether this list contains the queried item (only present on item-specific requests) */\n item_is_member?: boolean;\n};\n\n/** Options that can be specified when creating or editing a list */\nexport type UserListOptions = {\n /** The title to apply to the list */\n list_name: string;\n /** The description to apply to the list */\n description: string;\n /** Whether the list should be marked private */\n is_private: boolean;\n};\n\n/** Options that can be specified when adding a member to a list */\nexport type UserListMemberOptions = {\n /** The identifier of the Archive item that the new member should represent */\n identifier: string;\n /** (Optional) A subfile path within the item that the new member should represent */\n file?: string;\n /** (Optional) A search term within the item that the new member should represent */\n search_term?: string;\n};\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Reasons the service can produce an error */
|
|
2
|
+
export declare const UserListErrorReason: {
|
|
3
|
+
readonly NETWORK: "failed to connect to user lists backend service";
|
|
4
|
+
readonly BAD_RESPONSE: "malformed response from backend";
|
|
5
|
+
readonly USER_NOT_FOUND: "user with the given id was not found";
|
|
6
|
+
readonly LIST_NOT_FOUND: "user list with the given id was not found";
|
|
7
|
+
readonly LIST_MEMBER_NOT_FOUND: "user list member with the given id was not found";
|
|
8
|
+
readonly ITEM_NOT_TOUND: "item with the given id was not found";
|
|
9
|
+
};
|
|
10
|
+
export type UserListErrorReason = (typeof UserListErrorReason)[keyof typeof UserListErrorReason];
|
|
11
|
+
/** Typed error for userlist service results */
|
|
12
|
+
export declare class UserListError extends Error {
|
|
13
|
+
reason: UserListErrorReason;
|
|
14
|
+
constructor(reason: UserListErrorReason, message?: string, options?: {
|
|
15
|
+
cause?: unknown;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=userlist-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userlist-error.d.ts","sourceRoot":"","sources":["../../../../src/services/userlist-service/userlist-error.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,eAAO,MAAM,mBAAmB;;;;;;;CAOtB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,+CAA+C;AAC/C,qBAAa,aAAc,SAAQ,KAAK;IAEtC,MAAM,EAAE,mBAAmB,CAAC;gBAG1B,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAMhC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Reasons the service can produce an error */
|
|
2
|
+
export const UserListErrorReason = {
|
|
3
|
+
NETWORK: 'failed to connect to user lists backend service',
|
|
4
|
+
BAD_RESPONSE: 'malformed response from backend',
|
|
5
|
+
USER_NOT_FOUND: 'user with the given id was not found',
|
|
6
|
+
LIST_NOT_FOUND: 'user list with the given id was not found',
|
|
7
|
+
LIST_MEMBER_NOT_FOUND: 'user list member with the given id was not found',
|
|
8
|
+
ITEM_NOT_TOUND: 'item with the given id was not found',
|
|
9
|
+
};
|
|
10
|
+
/** Typed error for userlist service results */
|
|
11
|
+
export class UserListError extends Error {
|
|
12
|
+
constructor(reason, message, options) {
|
|
13
|
+
// @ts-expect-error (to permit the second argument, which is well-supported but tsc dislikes for some reason)
|
|
14
|
+
super(message, options);
|
|
15
|
+
this.reason = reason;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=userlist-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userlist-error.js","sourceRoot":"","sources":["../../../../src/services/userlist-service/userlist-error.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,iDAAiD;IAC1D,YAAY,EAAE,iCAAiC;IAC/C,cAAc,EAAE,sCAAsC;IACtD,cAAc,EAAE,2CAA2C;IAC3D,qBAAqB,EAAE,kDAAkD;IACzE,cAAc,EAAE,sCAAsC;CAC9C,CAAC;AAKX,+CAA+C;AAC/C,MAAM,OAAO,aAAc,SAAQ,KAAK;IAItC,YACE,MAA2B,EAC3B,OAAgB,EAChB,OAA6B;QAE7B,6GAA6G;QAC7G,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF","sourcesContent":["/** Reasons the service can produce an error */\nexport const UserListErrorReason = {\n NETWORK: 'failed to connect to user lists backend service',\n BAD_RESPONSE: 'malformed response from backend',\n USER_NOT_FOUND: 'user with the given id was not found',\n LIST_NOT_FOUND: 'user list with the given id was not found',\n LIST_MEMBER_NOT_FOUND: 'user list member with the given id was not found',\n ITEM_NOT_TOUND: 'item with the given id was not found',\n} as const;\n\nexport type UserListErrorReason =\n (typeof UserListErrorReason)[keyof typeof UserListErrorReason];\n\n/** Typed error for userlist service results */\nexport class UserListError extends Error {\n // Note that `reason` is an additional property of this subclass, not recognized by the Error superclass.\n reason: UserListErrorReason;\n\n constructor(\n reason: UserListErrorReason,\n message?: string,\n options?: { cause?: unknown },\n ) {\n // @ts-expect-error (to permit the second argument, which is well-supported but tsc dislikes for some reason)\n super(message, options);\n this.reason = reason;\n }\n}\n"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Result } from '../result-type/result-type.js';
|
|
2
|
+
import type { SearchResult } from '../search-service/models/hit-types/hit.js';
|
|
3
|
+
import type { UserListError } from './userlist-error.js';
|
|
4
|
+
import type { UserList, UserListMember, UserListMemberOptions, UserListOptions } from './models.js';
|
|
5
|
+
export interface UserListServiceInterface {
|
|
6
|
+
/**
|
|
7
|
+
* Fetches the full set of the given user's lists from the backend service.
|
|
8
|
+
* The result does not include the members array for each list; only the list metadata.
|
|
9
|
+
*
|
|
10
|
+
* If fetching lists for the currently logged-in user, their user id will automatically
|
|
11
|
+
* be replaced by `me` in the endpoint URL.
|
|
12
|
+
*
|
|
13
|
+
* @param userId The ID of the user to fetch lists for (e.g., `@brewster`)
|
|
14
|
+
*/
|
|
15
|
+
fetchListsForUser(userId: string): Promise<Result<UserList[], UserListError>>;
|
|
16
|
+
/**
|
|
17
|
+
* Fetches a specific user list, including the list metadata and the array of list
|
|
18
|
+
* members. Note that the list members returned include only the basic information
|
|
19
|
+
* kept in the userlist store, not the full item metadata.
|
|
20
|
+
* For that, use `fetchListMemberSearchResults`.
|
|
21
|
+
*
|
|
22
|
+
* @param userId The ID of the user whose list should be fetched
|
|
23
|
+
* @param listId The ID of the list to fetch (with respect to the given user)
|
|
24
|
+
*/
|
|
25
|
+
fetchList(userId: string, listId: string): Promise<Result<UserList, UserListError>>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetches the full set of the current user's lists from the backend service,
|
|
28
|
+
* each equipped with an additional flag specifying whether the given item is
|
|
29
|
+
* included in that list.
|
|
30
|
+
*
|
|
31
|
+
* @param itemId The ID of the archive item to query lists for
|
|
32
|
+
*/
|
|
33
|
+
fetchOwnListsContainingItem(itemId: string): Promise<Result<UserList[], UserListError>>;
|
|
34
|
+
/**
|
|
35
|
+
* Fetches an array of UserListMembers representing all of the members of the
|
|
36
|
+
* given user list.
|
|
37
|
+
*
|
|
38
|
+
* @param userId The ID of the user whose list members should be fetched
|
|
39
|
+
* @param listId The ID of the list to fetch (with respect to the given user)
|
|
40
|
+
*/
|
|
41
|
+
fetchListMembers(userId: string, listId: string): Promise<Result<UserListMember[], UserListError>>;
|
|
42
|
+
/**
|
|
43
|
+
* Fetches an array of SearchResults representing all of the members of the
|
|
44
|
+
* given user list, prepared for rendering on tiles.
|
|
45
|
+
*
|
|
46
|
+
* @param userId The ID of the user whose list members should be fetched
|
|
47
|
+
* @param listId The ID of the list to fetch (with respect to the given user)
|
|
48
|
+
*/
|
|
49
|
+
fetchListMemberSearchResults(userId: string, listId: string): Promise<Result<SearchResult[], Error>>;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new User List with the given options.
|
|
52
|
+
* @param options Details about the new list to create (e.g., name, description, privacy)
|
|
53
|
+
* @returns A Result object containing the newly-created UserList if successful,
|
|
54
|
+
* or an error otherwise.
|
|
55
|
+
*/
|
|
56
|
+
createList(options: UserListOptions): Promise<Result<UserList, UserListError>>;
|
|
57
|
+
/**
|
|
58
|
+
* Updates the given properties of an existing User List.
|
|
59
|
+
* @param listId The id of the list to update
|
|
60
|
+
* @param options An object containing the new property values to apply to the list
|
|
61
|
+
* @returns A Result object containing the newly-updated UserList if successful,
|
|
62
|
+
* or an error otherwise.
|
|
63
|
+
*/
|
|
64
|
+
updateList(listId: string, options: Partial<UserListOptions>): Promise<Result<UserList, UserListError>>;
|
|
65
|
+
/**
|
|
66
|
+
* Deletes the given User List entirely.
|
|
67
|
+
* @param listId The id of the list to delete.
|
|
68
|
+
* @returns A boolean indicator of success; if true, the list was removed successfully.
|
|
69
|
+
*/
|
|
70
|
+
deleteList(listId: string): Promise<Result<boolean, UserListError>>;
|
|
71
|
+
/**
|
|
72
|
+
* Adds a new member to an existing User List.
|
|
73
|
+
* @param listId The id of the list to which the member should be added.
|
|
74
|
+
* @param options Details about the member to add (e.g., item identifier, subfile, search term)
|
|
75
|
+
* @returns A Result object containing the newly-added UserListMember if successful,
|
|
76
|
+
* or an error otherwise.
|
|
77
|
+
*/
|
|
78
|
+
addMemberToList(listId: string, options: UserListMemberOptions): Promise<Result<UserListMember, UserListError>>;
|
|
79
|
+
/**
|
|
80
|
+
* Removes the given member from the given User List.
|
|
81
|
+
* @param listId The id of the list to remove a member from.
|
|
82
|
+
* @param memberId The id of the member within the specified list that should be removed.
|
|
83
|
+
* @returns A Result object containing the updated UserList if successful, or an error otherwise.
|
|
84
|
+
*/
|
|
85
|
+
removeMemberFromList(listId: string, memberId: string): Promise<Result<UserList, UserListError>>;
|
|
86
|
+
/**
|
|
87
|
+
* Removes all of the given members from the given User List.
|
|
88
|
+
* @param listId The id of the list to remove a member from.
|
|
89
|
+
* @param memberIds An array of member IDs within the specified list that should be removed.
|
|
90
|
+
* @returns A Result object containing the updated UserList if successful, or an error otherwise.
|
|
91
|
+
*/
|
|
92
|
+
removeBulkMembersFromList(listId: string, memberIds: string[]): Promise<Result<UserList, UserListError>>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=userlist-service-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userlist-service-interface.d.ts","sourceRoot":"","sources":["../../../../src/services/userlist-service/userlist-service-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4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E5C;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAEpE;;;;;;OAMG;IACH,eAAe,CACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC;IAElD;;;;;OAKG;IACH,oBAAoB,CAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,yBAAyB,CACvB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userlist-service-interface.js","sourceRoot":"","sources":["../../../../src/services/userlist-service/userlist-service-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { Result } from '../result-type/result-type';\nimport type { SearchResult } from '../search-service/models/hit-types/hit';\nimport type { UserListError } from './userlist-error';\nimport type {\n UserList,\n UserListMember,\n UserListMemberOptions,\n UserListOptions,\n} from './models';\n\nexport interface UserListServiceInterface {\n /**\n * Fetches the full set of the given user's lists from the backend service.\n * The result does not include the members array for each list; only the list metadata.\n *\n * If fetching lists for the currently logged-in user, their user id will automatically\n * be replaced by `me` in the endpoint URL.\n *\n * @param userId The ID of the user to fetch lists for (e.g., `@brewster`)\n */\n fetchListsForUser(userId: string): Promise<Result<UserList[], UserListError>>;\n\n /**\n * Fetches a specific user list, including the list metadata and the array of list\n * members. Note that the list members returned include only the basic information\n * kept in the userlist store, not the full item metadata.\n * For that, use `fetchListMemberSearchResults`.\n *\n * @param userId The ID of the user whose list should be fetched\n * @param listId The ID of the list to fetch (with respect to the given user)\n */\n fetchList(\n userId: string,\n listId: string,\n ): Promise<Result<UserList, UserListError>>;\n\n /**\n * Fetches the full set of the current user's lists from the backend service,\n * each equipped with an additional flag specifying whether the given item is\n * included in that list.\n *\n * @param itemId The ID of the archive item to query lists for\n */\n fetchOwnListsContainingItem(\n itemId: string,\n ): Promise<Result<UserList[], UserListError>>;\n\n /**\n * Fetches an array of UserListMembers representing all of the members of the\n * given user list.\n *\n * @param userId The ID of the user whose list members should be fetched\n * @param listId The ID of the list to fetch (with respect to the given user)\n */\n fetchListMembers(\n userId: string,\n listId: string,\n ): Promise<Result<UserListMember[], UserListError>>;\n\n /**\n * Fetches an array of SearchResults representing all of the members of the\n * given user list, prepared for rendering on tiles.\n *\n * @param userId The ID of the user whose list members should be fetched\n * @param listId The ID of the list to fetch (with respect to the given user)\n */\n fetchListMemberSearchResults(\n userId: string,\n listId: string,\n ): Promise<Result<SearchResult[], Error>>;\n\n /**\n * Creates a new User List with the given options.\n * @param options Details about the new list to create (e.g., name, description, privacy)\n * @returns A Result object containing the newly-created UserList if successful,\n * or an error otherwise.\n */\n createList(\n options: UserListOptions,\n ): Promise<Result<UserList, UserListError>>;\n\n /**\n * Updates the given properties of an existing User List.\n * @param listId The id of the list to update\n * @param options An object containing the new property values to apply to the list\n * @returns A Result object containing the newly-updated UserList if successful,\n * or an error otherwise.\n */\n updateList(\n listId: string,\n options: Partial<UserListOptions>,\n ): Promise<Result<UserList, UserListError>>;\n\n /**\n * Deletes the given User List entirely.\n * @param listId The id of the list to delete.\n * @returns A boolean indicator of success; if true, the list was removed successfully.\n */\n deleteList(listId: string): Promise<Result<boolean, UserListError>>;\n\n /**\n * Adds a new member to an existing User List.\n * @param listId The id of the list to which the member should be added.\n * @param options Details about the member to add (e.g., item identifier, subfile, search term)\n * @returns A Result object containing the newly-added UserListMember if successful,\n * or an error otherwise.\n */\n addMemberToList(\n listId: string,\n options: UserListMemberOptions,\n ): Promise<Result<UserListMember, UserListError>>;\n\n /**\n * Removes the given member from the given User List.\n * @param listId The id of the list to remove a member from.\n * @param memberId The id of the member within the specified list that should be removed.\n * @returns A Result object containing the updated UserList if successful, or an error otherwise.\n */\n removeMemberFromList(\n listId: string,\n memberId: string,\n ): Promise<Result<UserList, UserListError>>;\n\n /**\n * Removes all of the given members from the given User List.\n * @param listId The id of the list to remove a member from.\n * @param memberIds An array of member IDs within the specified list that should be removed.\n * @returns A Result object containing the updated UserList if successful, or an error otherwise.\n */\n removeBulkMembersFromList(\n listId: string,\n memberIds: string[],\n ): Promise<Result<UserList, UserListError>>;\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Result } from '../result-type/result-type.js';
|
|
2
|
+
import type { SearchResult } from '../search-service/models/hit-types/hit.js';
|
|
3
|
+
import type { SearchServiceInterface } from '../search-service/search-service-interface.js';
|
|
4
|
+
import type { UserServiceInterface } from '../user-service/user-service.js';
|
|
5
|
+
import type { UserListServiceInterface } from './userlist-service-interface.js';
|
|
6
|
+
import type { UserList, UserListMember, UserListMemberOptions, UserListOptions } from './models.js';
|
|
7
|
+
import { UserListError } from './userlist-error.js';
|
|
8
|
+
/** Required shape of the fetch handler provided to the service */
|
|
9
|
+
interface FetchHandlerInterface {
|
|
10
|
+
fetchApiResponse<T>(url: string, options?: {
|
|
11
|
+
includeCredentials?: boolean;
|
|
12
|
+
method?: string;
|
|
13
|
+
body?: BodyInit;
|
|
14
|
+
headers?: HeadersInit;
|
|
15
|
+
}): Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
/** Options accepted by the userlist service constructor */
|
|
18
|
+
type UserListServiceConstructorOptions = {
|
|
19
|
+
fetchHandler: FetchHandlerInterface;
|
|
20
|
+
searchService: SearchServiceInterface;
|
|
21
|
+
userService: UserServiceInterface;
|
|
22
|
+
baseUrl?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Service for reading and editing users' lists */
|
|
25
|
+
export declare class UserListService implements UserListServiceInterface {
|
|
26
|
+
private static readonly DEFAULT_BASE_URL;
|
|
27
|
+
private fetchHandler;
|
|
28
|
+
private searchService;
|
|
29
|
+
private userService;
|
|
30
|
+
private baseUrl;
|
|
31
|
+
constructor({ fetchHandler, searchService, userService, baseUrl, }: UserListServiceConstructorOptions);
|
|
32
|
+
private fetchEndpoint;
|
|
33
|
+
/** @inheritdoc */
|
|
34
|
+
fetchListsForUser(userId: string): Promise<Result<UserList[], UserListError>>;
|
|
35
|
+
/** @inheritdoc */
|
|
36
|
+
fetchList(userId: string, listId: string): Promise<Result<UserList, UserListError>>;
|
|
37
|
+
/** @inheritdoc */
|
|
38
|
+
fetchOwnListsContainingItem(itemId: string): Promise<Result<UserList[], UserListError>>;
|
|
39
|
+
fetchListMembers(userId: string, listId: string): Promise<Result<UserListMember[], UserListError>>;
|
|
40
|
+
/** @inheritdoc */
|
|
41
|
+
fetchListMemberSearchResults(userId: string, listId: string): Promise<Result<SearchResult[], Error>>;
|
|
42
|
+
/** @inheritdoc */
|
|
43
|
+
createList(options: UserListOptions): Promise<Result<UserList, UserListError>>;
|
|
44
|
+
/** @inheritdoc */
|
|
45
|
+
updateList(listId: string, options: Partial<UserListOptions>): Promise<Result<UserList, UserListError>>;
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
deleteList(listId: string): Promise<Result<boolean, UserListError>>;
|
|
48
|
+
/** @inheritdoc */
|
|
49
|
+
addMemberToList(listId: string, options: UserListMemberOptions): Promise<Result<UserListMember, UserListError>>;
|
|
50
|
+
/** @inheritdoc */
|
|
51
|
+
removeMemberFromList(listId: string, memberId: string): Promise<Result<UserList, UserListError>>;
|
|
52
|
+
/** @inheritdoc */
|
|
53
|
+
removeBulkMembersFromList(listId: string, memberIds: string[]): Promise<Result<UserList, UserListError>>;
|
|
54
|
+
/** Construct a UserListError with the given reason and underlying error cause */
|
|
55
|
+
private static getErrorResult;
|
|
56
|
+
/** Extracts a suitable error message from the given input, if possible */
|
|
57
|
+
private static getErrorMessage;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=userlist-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userlist-service.d.ts","sourceRoot":"","sources":["../../../../src/services/userlist-service/userlist-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,qBAAqB,EACrB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAuB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtE,kEAAkE;AAClE,UAAU,qBAAqB;IAC7B,gBAAgB,CAAC,CAAC,EAChB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QACR,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,OAAO,CAAC,EAAE,WAAW,CAAC;KACvB,GACA,OAAO,CAAC,CAAC,CAAC,CAAC;CACf;AAOD,2DAA2D;AAC3D,KAAK,iCAAiC,GAAG;IACvC,YAAY,EAAE,qBAAqB,CAAC;IACpC,aAAa,EAAE,sBAAsB,CAAC;IACtC,WAAW,EAAE,oBAAoB,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,mDAAmD;AACnD,qBAAa,eAAgB,YAAW,wBAAwB;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAyB;IAEjE,OAAO,CAAC,YAAY,CAAwB;IAE5C,OAAO,C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