@digicap-web/sdk 0.1.0-dev.13

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/index.cjs ADDED
@@ -0,0 +1,1613 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AreaIdListSchema: () => AreaIdListSchema,
34
+ AreaIdSchema: () => AreaIdSchema,
35
+ AreaListSchema: () => AreaListSchema,
36
+ AreaRepository: () => AreaRepository,
37
+ AreaSchema: () => AreaSchema,
38
+ AreaSpotRepository: () => AreaSpotRepository,
39
+ ArticleAudioRepository: () => ArticleAudioRepository,
40
+ ArticleEventRepository: () => ArticleEventRepository,
41
+ ArticleIdListSchema: () => ArticleIdListSchema,
42
+ ArticleIdSchema: () => ArticleIdSchema,
43
+ ArticleListSchema: () => ArticleListSchema,
44
+ ArticlePictureRepository: () => ArticlePictureRepository,
45
+ ArticleRepository: () => ArticleRepository,
46
+ ArticleSchema: () => ArticleSchema,
47
+ ArticleSpotRepository: () => ArticleSpotRepository,
48
+ ArticleTagRepository: () => ArticleTagRepository,
49
+ AudioIdListSchema: () => AudioIdListSchema,
50
+ AudioIdSchema: () => AudioIdSchema,
51
+ AudioListSchema: () => AudioListSchema,
52
+ AudioRepository: () => AudioRepository,
53
+ AudioSchema: () => AudioSchema,
54
+ AuthRepository: () => AuthRepository,
55
+ CreateAreaSchema: () => CreateAreaSchema,
56
+ CreateArticleSchema: () => CreateArticleSchema,
57
+ CreateEventSchema: () => CreateEventSchema,
58
+ CreateGuideSchema: () => CreateGuideSchema,
59
+ CreateMuseumSchema: () => CreateMuseumSchema,
60
+ CreateSpotSchema: () => CreateSpotSchema,
61
+ CreateTagSchema: () => CreateTagSchema,
62
+ CredentialsSchema: () => CredentialsSchema,
63
+ EventArticleRepository: () => EventArticleRepository,
64
+ EventIdListSchema: () => EventIdListSchema,
65
+ EventIdSchema: () => EventIdSchema,
66
+ EventListSchema: () => EventListSchema,
67
+ EventPictureRepository: () => EventPictureRepository,
68
+ EventRepository: () => EventRepository,
69
+ EventSchema: () => EventSchema,
70
+ GuideIdListSchema: () => GuideIdListSchema,
71
+ GuideIdSchema: () => GuideIdSchema,
72
+ GuideListSchema: () => GuideListSchema,
73
+ GuidePictureRepository: () => GuidePictureRepository,
74
+ GuideRepository: () => GuideRepository,
75
+ GuideSchema: () => GuideSchema,
76
+ MuseumIdListSchema: () => MuseumIdListSchema,
77
+ MuseumIdSchema: () => MuseumIdSchema,
78
+ MuseumListSchema: () => MuseumListSchema,
79
+ MuseumRepository: () => MuseumRepository,
80
+ MuseumSchema: () => MuseumSchema,
81
+ PictureIdListSchema: () => PictureIdListSchema,
82
+ PictureIdSchema: () => PictureIdSchema,
83
+ PictureListSchema: () => PictureListSchema,
84
+ PictureRepository: () => PictureRepository,
85
+ PictureSchema: () => PictureSchema,
86
+ SpotArticleRepository: () => SpotArticleRepository,
87
+ SpotIdListSchema: () => SpotIdListSchema,
88
+ SpotIdSchema: () => SpotIdSchema,
89
+ SpotListSchema: () => SpotListSchema,
90
+ SpotRepository: () => SpotRepository,
91
+ SpotSchema: () => SpotSchema,
92
+ TagArticleRepository: () => TagArticleRepository,
93
+ TagIdListSchema: () => TagIdListSchema,
94
+ TagIdSchema: () => TagIdSchema,
95
+ TagListSchema: () => TagListSchema,
96
+ TagRepository: () => TagRepository,
97
+ TagSchema: () => TagSchema,
98
+ UpdateAreaSchema: () => UpdateAreaSchema,
99
+ UpdateArticleSchema: () => UpdateArticleSchema,
100
+ UpdateEventSchema: () => UpdateEventSchema,
101
+ UpdateGuideSchema: () => UpdateGuideSchema,
102
+ UpdateMuseumSchema: () => UpdateMuseumSchema,
103
+ UpdateSpotSchema: () => UpdateSpotSchema,
104
+ UpdateTagSchema: () => UpdateTagSchema,
105
+ UserIdListSchema: () => UserIdListSchema,
106
+ UserIdSchema: () => UserIdSchema,
107
+ UserListSchema: () => UserListSchema,
108
+ UserRepository: () => UserRepository,
109
+ UserSchema: () => UserSchema
110
+ });
111
+ module.exports = __toCommonJS(index_exports);
112
+
113
+ // src/schema/article.ts
114
+ var import_zod = require("zod");
115
+ var ArticleIdSchema = import_zod.z.uuid().transform((id) => id);
116
+ var ArticleIdListSchema = import_zod.z.array(ArticleIdSchema);
117
+ var ArticleSchema = import_zod.z.object({
118
+ id: ArticleIdSchema,
119
+ name: import_zod.z.string().min(1).max(255),
120
+ body: import_zod.z.string().min(0).max(4096),
121
+ published: import_zod.z.boolean().default(false),
122
+ createdAt: import_zod.z.union([
123
+ import_zod.z.date(),
124
+ import_zod.z.iso.datetime().transform((s) => new Date(s))
125
+ ]),
126
+ updatedAt: import_zod.z.union([
127
+ import_zod.z.date(),
128
+ import_zod.z.iso.datetime().transform((s) => new Date(s))
129
+ ])
130
+ }).strip();
131
+ var CreateArticleSchema = ArticleSchema.pick({
132
+ name: true,
133
+ body: true,
134
+ published: true
135
+ }).strip();
136
+ var UpdateArticleSchema = CreateArticleSchema;
137
+ var ArticleListSchema = import_zod.z.array(ArticleSchema);
138
+
139
+ // src/schema/area.ts
140
+ var import_zod2 = require("zod");
141
+ var AreaIdSchema = import_zod2.z.uuid().transform((id) => id);
142
+ var AreaIdListSchema = import_zod2.z.array(AreaIdSchema);
143
+ var AreaSchema = import_zod2.z.object({
144
+ id: AreaIdSchema,
145
+ name: import_zod2.z.string().min(1).max(255),
146
+ createdAt: import_zod2.z.union([
147
+ import_zod2.z.date(),
148
+ import_zod2.z.iso.datetime().transform((s) => new Date(s))
149
+ ]),
150
+ updatedAt: import_zod2.z.union([
151
+ import_zod2.z.date(),
152
+ import_zod2.z.iso.datetime().transform((s) => new Date(s))
153
+ ])
154
+ }).strip();
155
+ var CreateAreaSchema = AreaSchema.pick({
156
+ name: true
157
+ }).strip();
158
+ var UpdateAreaSchema = CreateAreaSchema;
159
+ var AreaListSchema = import_zod2.z.array(AreaSchema);
160
+
161
+ // src/schema/spot.ts
162
+ var import_zod3 = require("zod");
163
+ var SpotIdSchema = import_zod3.z.uuid().transform((id) => id);
164
+ var SpotIdListSchema = import_zod3.z.array(SpotIdSchema);
165
+ var SpotSchema = import_zod3.z.object({
166
+ id: SpotIdSchema,
167
+ name: import_zod3.z.string().min(1).max(255),
168
+ createdAt: import_zod3.z.union([
169
+ import_zod3.z.date(),
170
+ import_zod3.z.iso.datetime().transform((s) => new Date(s))
171
+ ]),
172
+ updatedAt: import_zod3.z.union([
173
+ import_zod3.z.date(),
174
+ import_zod3.z.iso.datetime().transform((s) => new Date(s))
175
+ ]),
176
+ areaId: import_zod3.z.lazy(() => AreaIdSchema),
177
+ articleId: import_zod3.z.lazy(() => ArticleIdSchema.nullable())
178
+ }).strip();
179
+ var CreateSpotSchema = SpotSchema.pick({
180
+ name: true,
181
+ areaId: true
182
+ }).strip();
183
+ var UpdateSpotSchema = CreateSpotSchema;
184
+ var SpotListSchema = import_zod3.z.array(SpotSchema);
185
+
186
+ // src/schema/tag.ts
187
+ var import_zod4 = require("zod");
188
+ var TagIdSchema = import_zod4.z.uuid().transform((id) => id);
189
+ var TagIdListSchema = import_zod4.z.array(TagIdSchema);
190
+ var TagSchema = import_zod4.z.object({
191
+ id: TagIdSchema,
192
+ name: import_zod4.z.string().min(1).max(255),
193
+ color: import_zod4.z.string().min(1).max(255),
194
+ createdAt: import_zod4.z.union([
195
+ import_zod4.z.date(),
196
+ import_zod4.z.iso.datetime().transform((s) => new Date(s))
197
+ ]),
198
+ updatedAt: import_zod4.z.union([
199
+ import_zod4.z.date(),
200
+ import_zod4.z.iso.datetime().transform((s) => new Date(s))
201
+ ])
202
+ }).strip();
203
+ var CreateTagSchema = TagSchema.pick({
204
+ name: true,
205
+ color: true
206
+ }).strip();
207
+ var UpdateTagSchema = CreateTagSchema;
208
+ var TagListSchema = import_zod4.z.array(TagSchema);
209
+
210
+ // src/schema/user.ts
211
+ var import_zod5 = require("zod");
212
+ var UserIdSchema = import_zod5.z.uuid().transform((id) => id);
213
+ var UserIdListSchema = import_zod5.z.array(UserIdSchema);
214
+ var UserSchema = import_zod5.z.object({
215
+ id: UserIdSchema,
216
+ email: import_zod5.z.email(),
217
+ createdAt: import_zod5.z.union([
218
+ import_zod5.z.date(),
219
+ import_zod5.z.iso.datetime().transform((s) => new Date(s))
220
+ ]),
221
+ updatedAt: import_zod5.z.union([
222
+ import_zod5.z.date(),
223
+ import_zod5.z.iso.datetime().transform((s) => new Date(s))
224
+ ])
225
+ }).strip();
226
+ var UserListSchema = import_zod5.z.array(UserSchema);
227
+
228
+ // src/schema/audio.ts
229
+ var import_zod6 = require("zod");
230
+ var AudioIdSchema = import_zod6.z.uuid().transform((id) => id);
231
+ var AudioIdListSchema = import_zod6.z.array(AudioIdSchema);
232
+ var AudioSchema = import_zod6.z.object({
233
+ id: AudioIdSchema,
234
+ createdAt: import_zod6.z.union([
235
+ import_zod6.z.date(),
236
+ import_zod6.z.iso.datetime().transform((s) => new Date(s))
237
+ ]),
238
+ updatedAt: import_zod6.z.union([
239
+ import_zod6.z.date(),
240
+ import_zod6.z.iso.datetime().transform((s) => new Date(s))
241
+ ])
242
+ }).strip();
243
+ var AudioListSchema = import_zod6.z.array(AudioSchema);
244
+
245
+ // src/schema/picture.ts
246
+ var import_zod7 = require("zod");
247
+ var PictureIdSchema = import_zod7.z.uuid().transform((id) => id);
248
+ var PictureIdListSchema = import_zod7.z.array(PictureIdSchema);
249
+ var PictureSchema = import_zod7.z.object({
250
+ id: PictureIdSchema,
251
+ createdAt: import_zod7.z.union([
252
+ import_zod7.z.date(),
253
+ import_zod7.z.iso.datetime().transform((s) => new Date(s))
254
+ ]),
255
+ updatedAt: import_zod7.z.union([
256
+ import_zod7.z.date(),
257
+ import_zod7.z.iso.datetime().transform((s) => new Date(s))
258
+ ])
259
+ }).strip();
260
+ var PictureListSchema = import_zod7.z.array(PictureSchema);
261
+
262
+ // src/schema/guide.ts
263
+ var import_zod8 = require("zod");
264
+ var GuideIdSchema = import_zod8.z.uuid().transform((id) => id);
265
+ var GuideIdListSchema = import_zod8.z.array(GuideIdSchema);
266
+ var GuideSchema = import_zod8.z.object({
267
+ id: GuideIdSchema,
268
+ name: import_zod8.z.string().min(1).max(255),
269
+ createdAt: import_zod8.z.union([
270
+ import_zod8.z.date(),
271
+ import_zod8.z.iso.datetime().transform((s) => new Date(s))
272
+ ]),
273
+ updatedAt: import_zod8.z.union([
274
+ import_zod8.z.date(),
275
+ import_zod8.z.iso.datetime().transform((s) => new Date(s))
276
+ ]),
277
+ pictureId: import_zod8.z.lazy(() => PictureIdSchema).nullable()
278
+ }).strip();
279
+ var CreateGuideSchema = GuideSchema.pick({
280
+ name: true
281
+ }).strip();
282
+ var UpdateGuideSchema = CreateGuideSchema;
283
+ var GuideListSchema = import_zod8.z.array(GuideSchema);
284
+
285
+ // src/schema/event.ts
286
+ var import_zod9 = require("zod");
287
+ var EventIdSchema = import_zod9.z.uuid().transform((id) => id);
288
+ var EventIdListSchema = import_zod9.z.array(EventIdSchema);
289
+ var EventSchema = import_zod9.z.object({
290
+ id: EventIdSchema,
291
+ name: import_zod9.z.string().min(1).max(255),
292
+ about: import_zod9.z.string().min(0).max(1024),
293
+ createdAt: import_zod9.z.union([
294
+ import_zod9.z.date(),
295
+ import_zod9.z.iso.datetime().transform((s) => new Date(s))
296
+ ]),
297
+ updatedAt: import_zod9.z.union([
298
+ import_zod9.z.date(),
299
+ import_zod9.z.iso.datetime().transform((s) => new Date(s))
300
+ ]),
301
+ startTime: import_zod9.z.iso.datetime().transform((s) => new Date(s)),
302
+ endTime: import_zod9.z.iso.datetime().transform((s) => new Date(s)),
303
+ pictureId: import_zod9.z.lazy(() => PictureIdSchema.nullable())
304
+ }).strip();
305
+ var CreateEventSchema = EventSchema.pick({
306
+ name: true,
307
+ about: true,
308
+ startTime: true,
309
+ endTime: true
310
+ }).strip();
311
+ var UpdateEventSchema = CreateEventSchema;
312
+ var EventListSchema = import_zod9.z.array(EventSchema);
313
+
314
+ // src/schema/auth.ts
315
+ var import_zod10 = require("zod");
316
+ var CredentialsSchema = import_zod10.z.object({
317
+ email: import_zod10.z.email().transform((e) => e.toLowerCase()),
318
+ password: import_zod10.z.string().min(8).max(32)
319
+ }).strip();
320
+
321
+ // src/schema/museum.ts
322
+ var import_zod11 = require("zod");
323
+ var MuseumIdSchema = import_zod11.z.uuid().transform((id) => id);
324
+ var MuseumIdListSchema = import_zod11.z.array(MuseumIdSchema);
325
+ var MuseumSchema = import_zod11.z.object({
326
+ id: MuseumIdSchema,
327
+ name: import_zod11.z.string().min(1).max(255),
328
+ createdAt: import_zod11.z.union([
329
+ import_zod11.z.date(),
330
+ import_zod11.z.iso.datetime().transform((s) => new Date(s))
331
+ ]),
332
+ updatedAt: import_zod11.z.union([
333
+ import_zod11.z.date(),
334
+ import_zod11.z.iso.datetime().transform((s) => new Date(s))
335
+ ]),
336
+ startTime: import_zod11.z.iso.datetime().transform((s) => new Date(s)),
337
+ endTime: import_zod11.z.iso.datetime().transform((s) => new Date(s))
338
+ }).strip();
339
+ var CreateMuseumSchema = MuseumSchema.pick({
340
+ name: true,
341
+ startTime: true,
342
+ endTime: true
343
+ }).strip();
344
+ var UpdateMuseumSchema = CreateMuseumSchema;
345
+ var MuseumListSchema = import_zod11.z.array(MuseumSchema);
346
+
347
+ // src/repository/museum/article.ts
348
+ var ArticleRepository = class {
349
+ baseURL;
350
+ constructor(baseURL, museumId) {
351
+ this.baseURL = `${baseURL}/museums/${museumId}/articles`;
352
+ }
353
+ async collect() {
354
+ const url = `${this.baseURL}`;
355
+ const response = await fetch(url, {
356
+ method: "GET",
357
+ credentials: "include"
358
+ });
359
+ if (!response.ok) {
360
+ throw new Error(response.statusText);
361
+ }
362
+ return ArticleListSchema.parse(await response.json());
363
+ }
364
+ async get(id) {
365
+ const url = `${this.baseURL}/${id}`;
366
+ const response = await fetch(url, {
367
+ method: "GET",
368
+ credentials: "include"
369
+ });
370
+ if (!response.ok) {
371
+ throw new Error(response.statusText);
372
+ }
373
+ return ArticleSchema.parse(await response.json());
374
+ }
375
+ async create(article) {
376
+ const url = `${this.baseURL}`;
377
+ const response = await fetch(url, {
378
+ method: "POST",
379
+ headers: { "Content-Type": "application/json" },
380
+ credentials: "include",
381
+ body: JSON.stringify(article)
382
+ });
383
+ if (!response.ok) {
384
+ throw new Error(response.statusText);
385
+ }
386
+ return ArticleSchema.parse(await response.json());
387
+ }
388
+ async update(id, article) {
389
+ const url = `${this.baseURL}/${id}`;
390
+ const response = await fetch(url, {
391
+ method: "PATCH",
392
+ headers: { "Content-Type": "application/json" },
393
+ credentials: "include",
394
+ body: JSON.stringify(article)
395
+ });
396
+ if (!response.ok) {
397
+ throw new Error(response.statusText);
398
+ }
399
+ return ArticleSchema.parse(await response.json());
400
+ }
401
+ async delete(id) {
402
+ const url = `${this.baseURL}/${id}`;
403
+ const response = await fetch(url, {
404
+ method: "DELETE",
405
+ headers: { "Content-Type": "application/json" },
406
+ credentials: "include",
407
+ body: JSON.stringify({})
408
+ });
409
+ if (!response.ok) {
410
+ throw new Error(response.statusText);
411
+ }
412
+ }
413
+ async setPublished(id, published) {
414
+ const url = `${this.baseURL}/${id}/published`;
415
+ const response = await fetch(url, {
416
+ method: "PATCH",
417
+ headers: { "Content-Type": "application/json" },
418
+ credentials: "include",
419
+ body: JSON.stringify({ published })
420
+ });
421
+ if (!response.ok) {
422
+ throw new Error(response.statusText);
423
+ }
424
+ return ArticleSchema.parse(await response.json());
425
+ }
426
+ };
427
+
428
+ // src/repository/museum/area.ts
429
+ var AreaRepository = class {
430
+ baseURL;
431
+ constructor(baseURL, museumId) {
432
+ this.baseURL = `${baseURL}/museums/${museumId}/areas`;
433
+ }
434
+ async collect() {
435
+ const url = `${this.baseURL}`;
436
+ const response = await fetch(url, {
437
+ method: "GET",
438
+ credentials: "include"
439
+ });
440
+ if (!response.ok) {
441
+ throw new Error(response.statusText);
442
+ }
443
+ return AreaListSchema.parse(await response.json());
444
+ }
445
+ async get(id) {
446
+ const url = `${this.baseURL}/${id}`;
447
+ const response = await fetch(url, {
448
+ method: "GET",
449
+ headers: { "Content-Type": "application/json" },
450
+ credentials: "include"
451
+ });
452
+ if (!response.ok) {
453
+ throw new Error(response.statusText);
454
+ }
455
+ return AreaSchema.parse(await response.json());
456
+ }
457
+ async create(area) {
458
+ const url = `${this.baseURL}`;
459
+ const response = await fetch(url, {
460
+ method: "POST",
461
+ headers: { "Content-Type": "application/json" },
462
+ credentials: "include",
463
+ body: JSON.stringify(area)
464
+ });
465
+ if (!response.ok) {
466
+ throw new Error(response.statusText);
467
+ }
468
+ return AreaSchema.parse(await response.json());
469
+ }
470
+ async update(id, area) {
471
+ const url = `${this.baseURL}/${id}`;
472
+ const response = await fetch(url, {
473
+ method: "PATCH",
474
+ headers: { "Content-Type": "application/json" },
475
+ credentials: "include",
476
+ body: JSON.stringify(area)
477
+ });
478
+ if (!response.ok) {
479
+ throw new Error(response.statusText);
480
+ }
481
+ return AreaSchema.parse(await response.json());
482
+ }
483
+ async delete(id) {
484
+ const url = `${this.baseURL}/${id}`;
485
+ const response = await fetch(url, {
486
+ method: "DELETE",
487
+ headers: { "Content-Type": "application/json" },
488
+ credentials: "include",
489
+ body: JSON.stringify({})
490
+ });
491
+ if (!response.ok) {
492
+ throw new Error(response.statusText);
493
+ }
494
+ }
495
+ };
496
+
497
+ // src/repository/museum/spot.ts
498
+ var SpotRepository = class {
499
+ baseURL;
500
+ constructor(baseURL, museumId) {
501
+ this.baseURL = `${baseURL}/museums/${museumId}/spots`;
502
+ }
503
+ async collect() {
504
+ const url = `${this.baseURL}`;
505
+ const response = await fetch(url, {
506
+ method: "GET",
507
+ credentials: "include"
508
+ });
509
+ if (!response.ok) {
510
+ throw new Error(response.statusText);
511
+ }
512
+ return SpotListSchema.parse(await response.json());
513
+ }
514
+ async get(id) {
515
+ const url = `${this.baseURL}/${id}`;
516
+ const response = await fetch(url, {
517
+ method: "GET",
518
+ credentials: "include"
519
+ });
520
+ if (!response.ok) {
521
+ throw new Error(response.statusText);
522
+ }
523
+ return SpotSchema.parse(await response.json());
524
+ }
525
+ async create(spot) {
526
+ const url = `${this.baseURL}`;
527
+ const response = await fetch(url, {
528
+ method: "POST",
529
+ headers: { "Content-Type": "application/json" },
530
+ credentials: "include",
531
+ body: JSON.stringify(spot)
532
+ });
533
+ if (!response.ok) {
534
+ throw new Error(response.statusText);
535
+ }
536
+ return SpotSchema.parse(await response.json());
537
+ }
538
+ async update(id, spot) {
539
+ const url = `${this.baseURL}/${id}`;
540
+ const response = await fetch(url, {
541
+ method: "PATCH",
542
+ headers: { "Content-Type": "application/json" },
543
+ credentials: "include",
544
+ body: JSON.stringify(spot)
545
+ });
546
+ if (!response.ok) {
547
+ throw new Error(response.statusText);
548
+ }
549
+ return SpotSchema.parse(await response.json());
550
+ }
551
+ async delete(id) {
552
+ const url = `${this.baseURL}/${id}`;
553
+ const response = await fetch(url, {
554
+ method: "DELETE",
555
+ headers: { "Content-Type": "application/json" },
556
+ credentials: "include",
557
+ body: JSON.stringify({})
558
+ });
559
+ if (!response.ok) {
560
+ throw new Error(response.statusText);
561
+ }
562
+ }
563
+ };
564
+
565
+ // src/repository/museum/tag.ts
566
+ var TagRepository = class {
567
+ baseURL;
568
+ constructor(baseURL, museumId) {
569
+ this.baseURL = `${baseURL}/museums/${museumId}/tags`;
570
+ }
571
+ async collect() {
572
+ const url = `${this.baseURL}`;
573
+ const response = await fetch(url, {
574
+ method: "GET",
575
+ credentials: "include"
576
+ });
577
+ if (!response.ok) {
578
+ throw new Error(response.statusText);
579
+ }
580
+ return TagListSchema.parse(await response.json());
581
+ }
582
+ async get(id) {
583
+ const url = `${this.baseURL}/${id}`;
584
+ const response = await fetch(url, {
585
+ method: "GET",
586
+ credentials: "include"
587
+ });
588
+ if (!response.ok) {
589
+ throw new Error(response.statusText);
590
+ }
591
+ return TagSchema.parse(await response.json());
592
+ }
593
+ async create(tag) {
594
+ const url = `${this.baseURL}`;
595
+ const response = await fetch(url, {
596
+ method: "POST",
597
+ headers: { "Content-Type": "application/json" },
598
+ credentials: "include",
599
+ body: JSON.stringify(tag)
600
+ });
601
+ if (!response.ok) {
602
+ throw new Error(response.statusText);
603
+ }
604
+ return TagSchema.parse(await response.json());
605
+ }
606
+ async update(id, tag) {
607
+ const url = `${this.baseURL}/${id}`;
608
+ const response = await fetch(url, {
609
+ method: "PATCH",
610
+ headers: { "Content-Type": "application/json" },
611
+ credentials: "include",
612
+ body: JSON.stringify(tag)
613
+ });
614
+ if (!response.ok) {
615
+ throw new Error(response.statusText);
616
+ }
617
+ return TagSchema.parse(await response.json());
618
+ }
619
+ async delete(id) {
620
+ const url = `${this.baseURL}/${id}`;
621
+ const response = await fetch(url, {
622
+ method: "DELETE",
623
+ headers: { "Content-Type": "application/json" },
624
+ credentials: "include",
625
+ body: JSON.stringify({})
626
+ });
627
+ if (!response.ok) {
628
+ throw new Error(response.statusText);
629
+ }
630
+ }
631
+ };
632
+
633
+ // src/repository/museum/audio.ts
634
+ var AudioRepository = class {
635
+ baseURL;
636
+ constructor(baseURL, museumId) {
637
+ this.baseURL = `${baseURL}/museums/${museumId}/audios`;
638
+ }
639
+ async collect() {
640
+ const url = `${this.baseURL}`;
641
+ const response = await fetch(url, {
642
+ method: "GET",
643
+ credentials: "include"
644
+ });
645
+ if (!response.ok) {
646
+ throw new Error(response.statusText);
647
+ }
648
+ return AudioListSchema.parse(await response.json());
649
+ }
650
+ async get(id) {
651
+ const url = `${this.baseURL}/${id}`;
652
+ const response = await fetch(url, {
653
+ method: "GET",
654
+ credentials: "include"
655
+ });
656
+ if (!response.ok) {
657
+ throw new Error(response.statusText);
658
+ }
659
+ return AudioSchema.parse(await response.json());
660
+ }
661
+ async create(file) {
662
+ const formData = new FormData();
663
+ formData.append("file", file);
664
+ const url = `${this.baseURL}`;
665
+ const response = await fetch(url, {
666
+ method: "POST",
667
+ credentials: "include",
668
+ body: formData
669
+ });
670
+ if (!response.ok) {
671
+ throw new Error(response.statusText);
672
+ }
673
+ return AudioSchema.parse(await response.json());
674
+ }
675
+ async delete(id) {
676
+ const url = `${this.baseURL}/${id}`;
677
+ const response = await fetch(url, {
678
+ method: "DELETE",
679
+ headers: { "Content-Type": "application/json" },
680
+ credentials: "include",
681
+ body: JSON.stringify({})
682
+ });
683
+ if (!response.ok) {
684
+ throw new Error(response.statusText);
685
+ }
686
+ }
687
+ embed(id) {
688
+ return `${this.baseURL}/${id}/embed`;
689
+ }
690
+ };
691
+
692
+ // src/repository/museum/picture.ts
693
+ var PictureRepository = class {
694
+ baseURL;
695
+ constructor(baseURL, museumId) {
696
+ this.baseURL = `${baseURL}/museums/${museumId}/pictures`;
697
+ }
698
+ async collect() {
699
+ const url = `${this.baseURL}`;
700
+ const response = await fetch(url, {
701
+ method: "GET",
702
+ credentials: "include"
703
+ });
704
+ if (!response.ok) {
705
+ throw new Error(response.statusText);
706
+ }
707
+ return PictureListSchema.parse(await response.json());
708
+ }
709
+ async get(id) {
710
+ const url = `${this.baseURL}/${id}`;
711
+ const response = await fetch(url, {
712
+ method: "GET",
713
+ credentials: "include"
714
+ });
715
+ if (!response.ok) {
716
+ throw new Error(response.statusText);
717
+ }
718
+ return PictureSchema.parse(await response.json());
719
+ }
720
+ async create(file) {
721
+ const formData = new FormData();
722
+ formData.append("file", file);
723
+ const url = `${this.baseURL}`;
724
+ const response = await fetch(url, {
725
+ method: "POST",
726
+ credentials: "include",
727
+ body: formData
728
+ });
729
+ if (!response.ok) {
730
+ throw new Error(response.statusText);
731
+ }
732
+ return PictureSchema.parse(await response.json());
733
+ }
734
+ async delete(id) {
735
+ const url = `${this.baseURL}/${id}`;
736
+ const response = await fetch(url, {
737
+ method: "DELETE",
738
+ headers: { "Content-Type": "application/json" },
739
+ credentials: "include",
740
+ body: JSON.stringify({})
741
+ });
742
+ if (!response.ok) {
743
+ throw new Error(response.statusText);
744
+ }
745
+ }
746
+ embed(id) {
747
+ return `${this.baseURL}/${id}/embed`;
748
+ }
749
+ };
750
+
751
+ // src/repository/museum/guide.ts
752
+ var GuideRepository = class {
753
+ baseURL;
754
+ constructor(baseURL, museumId) {
755
+ this.baseURL = `${baseURL}/museums/${museumId}/guides`;
756
+ }
757
+ async collect() {
758
+ const url = `${this.baseURL}`;
759
+ const response = await fetch(url, {
760
+ method: "GET",
761
+ credentials: "include"
762
+ });
763
+ if (!response.ok) {
764
+ throw new Error(response.statusText);
765
+ }
766
+ return GuideListSchema.parse(await response.json());
767
+ }
768
+ async get(id) {
769
+ const url = `${this.baseURL}/${id}`;
770
+ const response = await fetch(url, {
771
+ method: "GET",
772
+ credentials: "include"
773
+ });
774
+ if (!response.ok) {
775
+ throw new Error(response.statusText);
776
+ }
777
+ return GuideSchema.parse(await response.json());
778
+ }
779
+ async create(guide) {
780
+ const url = `${this.baseURL}`;
781
+ const response = await fetch(url, {
782
+ method: "POST",
783
+ headers: { "Content-Type": "application/json" },
784
+ credentials: "include",
785
+ body: JSON.stringify(guide)
786
+ });
787
+ if (!response.ok) {
788
+ throw new Error(response.statusText);
789
+ }
790
+ return GuideSchema.parse(await response.json());
791
+ }
792
+ async update(id, guide) {
793
+ const url = `${this.baseURL}/${id}`;
794
+ const response = await fetch(url, {
795
+ method: "PATCH",
796
+ headers: { "Content-Type": "application/json" },
797
+ credentials: "include",
798
+ body: JSON.stringify(guide)
799
+ });
800
+ if (!response.ok) {
801
+ throw new Error(response.statusText);
802
+ }
803
+ return GuideSchema.parse(await response.json());
804
+ }
805
+ async delete(id) {
806
+ const url = `${this.baseURL}/${id}`;
807
+ const response = await fetch(url, {
808
+ method: "DELETE",
809
+ headers: { "Content-Type": "application/json" },
810
+ credentials: "include",
811
+ body: JSON.stringify({})
812
+ });
813
+ if (!response.ok) {
814
+ throw new Error(response.statusText);
815
+ }
816
+ }
817
+ };
818
+
819
+ // src/repository/museum/event.ts
820
+ var EventRepository = class {
821
+ baseURL;
822
+ constructor(baseURL, museumId) {
823
+ this.baseURL = `${baseURL}/museums/${museumId}/events`;
824
+ }
825
+ async collect() {
826
+ const url = `${this.baseURL}`;
827
+ const response = await fetch(url, {
828
+ method: "GET",
829
+ credentials: "include"
830
+ });
831
+ return EventListSchema.parse(await response.json());
832
+ }
833
+ async get(id) {
834
+ const url = `${this.baseURL}/${id}`;
835
+ const response = await fetch(url, {
836
+ method: "GET",
837
+ credentials: "include"
838
+ });
839
+ if (!response.ok) {
840
+ throw new Error(response.statusText);
841
+ }
842
+ return EventSchema.parse(await response.json());
843
+ }
844
+ async create(event) {
845
+ const url = `${this.baseURL}`;
846
+ const response = await fetch(url, {
847
+ method: "POST",
848
+ headers: { "Content-Type": "application/json" },
849
+ credentials: "include",
850
+ body: JSON.stringify(event)
851
+ });
852
+ if (!response.ok) {
853
+ throw new Error(response.statusText);
854
+ }
855
+ return EventSchema.parse(await response.json());
856
+ }
857
+ async update(id, event) {
858
+ const url = `${this.baseURL}/${id}`;
859
+ const response = await fetch(url, {
860
+ method: "PATCH",
861
+ headers: { "Content-Type": "application/json" },
862
+ credentials: "include",
863
+ body: JSON.stringify(event)
864
+ });
865
+ if (!response.ok) {
866
+ throw new Error(response.statusText);
867
+ }
868
+ return EventSchema.parse(await response.json());
869
+ }
870
+ async delete(id) {
871
+ const url = `${this.baseURL}/${id}`;
872
+ const response = await fetch(url, {
873
+ method: "DELETE",
874
+ headers: { "Content-Type": "application/json" },
875
+ credentials: "include",
876
+ body: JSON.stringify({})
877
+ });
878
+ if (!response.ok) {
879
+ throw new Error(response.statusText);
880
+ }
881
+ }
882
+ };
883
+
884
+ // src/repository/museum.ts
885
+ var import_zod12 = __toESM(require("zod"), 1);
886
+ var RoleEnum = import_zod12.default.enum(["admin", "owner", "staff", "guest"]);
887
+ var MuseumRepository = class {
888
+ constructor(baseURL) {
889
+ this.baseURL = baseURL;
890
+ this.baseURL = `${baseURL}/museums`;
891
+ }
892
+ async collect() {
893
+ const url = `${this.baseURL}`;
894
+ const response = await fetch(url, {
895
+ method: "GET",
896
+ credentials: "include"
897
+ });
898
+ if (!response.ok) {
899
+ throw new Error(response.statusText);
900
+ }
901
+ return MuseumListSchema.parse(await response.json());
902
+ }
903
+ async get(id) {
904
+ const url = `${this.baseURL}/${id}`;
905
+ const response = await fetch(url, {
906
+ method: "GET",
907
+ credentials: "include"
908
+ });
909
+ if (!response.ok) {
910
+ throw new Error(response.statusText);
911
+ }
912
+ return MuseumSchema.parse(await response.json());
913
+ }
914
+ async create(museum) {
915
+ const url = `${this.baseURL}`;
916
+ const response = await fetch(url, {
917
+ method: "POST",
918
+ headers: { "Content-Type": "application/json" },
919
+ credentials: "include",
920
+ body: JSON.stringify(museum)
921
+ });
922
+ if (!response.ok) {
923
+ throw new Error(response.statusText);
924
+ }
925
+ return MuseumSchema.parse(await response.json());
926
+ }
927
+ async update(id, museum) {
928
+ const url = `${this.baseURL}/${id}`;
929
+ const response = await fetch(url, {
930
+ method: "PATCH",
931
+ headers: { "Content-Type": "application/json" },
932
+ credentials: "include",
933
+ body: JSON.stringify(museum)
934
+ });
935
+ if (!response.ok) {
936
+ throw new Error(response.statusText);
937
+ }
938
+ return MuseumSchema.parse(await response.json());
939
+ }
940
+ async delete(id) {
941
+ const url = `${this.baseURL}/${id}`;
942
+ const response = await fetch(url, {
943
+ method: "DELETE",
944
+ credentials: "include"
945
+ });
946
+ if (!response.ok) {
947
+ throw new Error(response.statusText);
948
+ }
949
+ }
950
+ async invite(museumId, email) {
951
+ const url = `${this.baseURL}/${museumId}/users`;
952
+ const response = await fetch(url, {
953
+ method: "POST",
954
+ headers: { "Content-Type": "application/json" },
955
+ credentials: "include",
956
+ body: JSON.stringify(email)
957
+ });
958
+ if (!response.ok) {
959
+ throw new Error(response.statusText);
960
+ }
961
+ }
962
+ async reject(museumId, userId) {
963
+ const url = `${this.baseURL}/${museumId}/users/${userId}`;
964
+ const response = await fetch(url, {
965
+ method: "DELETE",
966
+ credentials: "include"
967
+ });
968
+ if (!response.ok) {
969
+ throw new Error(response.statusText);
970
+ }
971
+ }
972
+ async everyone(museumId) {
973
+ const url = `${this.baseURL}/${museumId}/users`;
974
+ const response = await fetch(url, {
975
+ method: "GET",
976
+ credentials: "include"
977
+ });
978
+ if (!response.ok) {
979
+ throw new Error(response.statusText);
980
+ }
981
+ return UserListSchema.parse(await response.json());
982
+ }
983
+ async getThumbnail(museumId) {
984
+ const url = `${this.baseURL}/${museumId}/thumbnail-picture`;
985
+ const response = await fetch(url, {
986
+ method: "GET",
987
+ credentials: "include"
988
+ });
989
+ if (!response.ok) {
990
+ throw new Error(response.statusText);
991
+ }
992
+ return PictureSchema.parse(await response.json());
993
+ }
994
+ async setThumbnail(museumId, pictureId) {
995
+ const url = `${this.baseURL}/${museumId}/thumbnail-picture`;
996
+ const response = await fetch(url, {
997
+ method: "PUT",
998
+ headers: {
999
+ "Content-Type": "application/json"
1000
+ },
1001
+ credentials: "include",
1002
+ body: JSON.stringify(pictureId)
1003
+ });
1004
+ if (!response.ok) {
1005
+ throw new Error(response.statusText);
1006
+ }
1007
+ }
1008
+ async deleteThumbnail(museumId) {
1009
+ const url = `${this.baseURL}/${museumId}/thumbnail-picture`;
1010
+ const response = await fetch(url, {
1011
+ method: "DELETE",
1012
+ headers: { "Content-Type": "application/json" },
1013
+ credentials: "include",
1014
+ body: JSON.stringify({})
1015
+ });
1016
+ if (!response.ok) {
1017
+ throw new Error(response.statusText);
1018
+ }
1019
+ }
1020
+ async getOwnerships(museumId) {
1021
+ const url = `${this.baseURL}/${museumId}/users/ownership`;
1022
+ const response = await fetch(url, {
1023
+ method: "GET",
1024
+ credentials: "include"
1025
+ });
1026
+ if (!response.ok) {
1027
+ throw new Error(response.statusText);
1028
+ }
1029
+ return UserListSchema.parse(await response.json());
1030
+ }
1031
+ async grant(museumId, userId) {
1032
+ const url = `${this.baseURL}/${museumId}/users/${userId}/ownership`;
1033
+ const response = await fetch(url, {
1034
+ method: "POST",
1035
+ credentials: "include"
1036
+ });
1037
+ if (!response.ok) {
1038
+ throw new Error(response.statusText);
1039
+ }
1040
+ }
1041
+ async revoke(museumId, userId) {
1042
+ const url = `${this.baseURL}/${museumId}/users/${userId}/ownership`;
1043
+ const response = await fetch(url, {
1044
+ method: "DELETE",
1045
+ credentials: "include"
1046
+ });
1047
+ if (!response.ok) {
1048
+ throw new Error(response.statusText);
1049
+ }
1050
+ }
1051
+ async getRole(museumId, userId) {
1052
+ const url = `${this.baseURL}/${museumId}/users/${userId}/role`;
1053
+ const response = await fetch(url, {
1054
+ method: "GET",
1055
+ credentials: "include"
1056
+ });
1057
+ if (!response.ok) {
1058
+ throw new Error(response.statusText);
1059
+ }
1060
+ return RoleEnum.parse(await response.json());
1061
+ }
1062
+ };
1063
+
1064
+ // src/repository/user.ts
1065
+ var UserRepository = class {
1066
+ constructor(baseURL) {
1067
+ this.baseURL = baseURL;
1068
+ }
1069
+ async get(userId) {
1070
+ const url = `${this.baseURL}/users/${userId}`;
1071
+ const response = await fetch(url, {
1072
+ method: "GET",
1073
+ headers: { "Content-Type": "application/json" },
1074
+ credentials: "include"
1075
+ });
1076
+ if (!response.ok) {
1077
+ throw new Error(response.statusText);
1078
+ }
1079
+ return UserSchema.parse(await response.json());
1080
+ }
1081
+ async getMe() {
1082
+ const url = `${this.baseURL}/users/me`;
1083
+ const response = await fetch(url, {
1084
+ method: "GET",
1085
+ headers: { "Content-Type": "application/json" },
1086
+ credentials: "include"
1087
+ });
1088
+ if (!response.ok) {
1089
+ throw new Error(response.statusText);
1090
+ }
1091
+ return UserSchema.parse(await response.json());
1092
+ }
1093
+ async getMuseums() {
1094
+ const url = `${this.baseURL}/users/me/museums`;
1095
+ const response = await fetch(url, {
1096
+ method: "GET",
1097
+ headers: { "Content-Type": "application/json" },
1098
+ credentials: "include"
1099
+ });
1100
+ if (!response.ok) {
1101
+ throw new Error(response.statusText);
1102
+ }
1103
+ return MuseumListSchema.parse(await response.json());
1104
+ }
1105
+ async delete(userId) {
1106
+ const url = `${this.baseURL}/users/${userId}`;
1107
+ const response = await fetch(url, {
1108
+ method: "DELETE",
1109
+ headers: { "Content-Type": "application/json" },
1110
+ credentials: "include",
1111
+ body: JSON.stringify({})
1112
+ });
1113
+ if (!response.ok) {
1114
+ throw new Error(response.statusText);
1115
+ }
1116
+ }
1117
+ // isAdminの変更が必要なら変更
1118
+ async getRole(userId) {
1119
+ const url = `${this.baseURL}/users/${userId}/role`;
1120
+ const response = await fetch(url, {
1121
+ method: "GET",
1122
+ headers: { "Content-Type": "application/json" },
1123
+ credentials: "include"
1124
+ });
1125
+ if (!response.ok) {
1126
+ throw new Error(response.statusText);
1127
+ }
1128
+ const data = await response.json();
1129
+ return { isAdmin: data === "admin" };
1130
+ }
1131
+ };
1132
+
1133
+ // src/repository/auth.ts
1134
+ var AuthRepository = class {
1135
+ constructor(baseURL) {
1136
+ this.baseURL = baseURL;
1137
+ }
1138
+ async signup(creds) {
1139
+ const url = `${this.baseURL}/auth/signup`;
1140
+ const response = await fetch(url, {
1141
+ method: "POST",
1142
+ headers: { "Content-Type": "application/json" },
1143
+ credentials: "include",
1144
+ body: JSON.stringify(creds)
1145
+ });
1146
+ if (!response.ok) {
1147
+ throw new Error(response.statusText);
1148
+ }
1149
+ return UserSchema.parse(await response.json());
1150
+ }
1151
+ async signin(creds) {
1152
+ const url = `${this.baseURL}/auth/signin`;
1153
+ const response = await fetch(url, {
1154
+ method: "POST",
1155
+ headers: { "Content-Type": "application/json" },
1156
+ credentials: "include",
1157
+ body: JSON.stringify(creds)
1158
+ });
1159
+ if (!response.ok) {
1160
+ throw new Error(response.statusText);
1161
+ }
1162
+ return UserSchema.parse(await response.json());
1163
+ }
1164
+ async signout() {
1165
+ const url = `${this.baseURL}/auth/signout`;
1166
+ const response = await fetch(url, {
1167
+ method: "POST",
1168
+ credentials: "include"
1169
+ });
1170
+ if (!response.ok) {
1171
+ throw new Error(response.statusText);
1172
+ }
1173
+ }
1174
+ async refresh() {
1175
+ const url = `${this.baseURL}/auth/refresh`;
1176
+ const response = await fetch(url, {
1177
+ method: "POST",
1178
+ credentials: "include"
1179
+ });
1180
+ if (!response.ok) {
1181
+ throw new Error(response.statusText);
1182
+ }
1183
+ }
1184
+ async erasure() {
1185
+ const url = `${this.baseURL}/auth/erasure`;
1186
+ const response = await fetch(url, {
1187
+ method: "POST",
1188
+ credentials: "include"
1189
+ });
1190
+ if (!response.ok) {
1191
+ throw new Error(response.statusText);
1192
+ }
1193
+ }
1194
+ };
1195
+
1196
+ // src/repository/museum/article-audio.ts
1197
+ var ArticleAudioRepository = class {
1198
+ baseURL;
1199
+ constructor(baseURL, museumId, articleId) {
1200
+ this.baseURL = `${baseURL}/museums/${museumId}/articles/${articleId}/audio`;
1201
+ }
1202
+ async get() {
1203
+ const response = await fetch(this.baseURL, {
1204
+ method: "GET",
1205
+ credentials: "include"
1206
+ });
1207
+ if (response.status === 404) {
1208
+ throw new Error("Audio_not_related");
1209
+ }
1210
+ if (!response.ok) {
1211
+ throw new Error(response.statusText);
1212
+ }
1213
+ return AudioSchema.parse(await response.json());
1214
+ }
1215
+ async put(audioId) {
1216
+ const response = await fetch(this.baseURL, {
1217
+ method: "PUT",
1218
+ headers: { "Content-Type": "application/json" },
1219
+ credentials: "include",
1220
+ body: JSON.stringify(audioId)
1221
+ });
1222
+ if (!response.ok) {
1223
+ throw new Error(response.statusText);
1224
+ }
1225
+ }
1226
+ async delete() {
1227
+ const response = await fetch(this.baseURL, {
1228
+ method: "DELETE",
1229
+ headers: { "Content-Type": "application/json" },
1230
+ credentials: "include",
1231
+ body: JSON.stringify({})
1232
+ });
1233
+ if (!response.ok) {
1234
+ throw new Error(response.statusText);
1235
+ }
1236
+ }
1237
+ };
1238
+
1239
+ // src/repository/museum/article-spot.ts
1240
+ var ArticleSpotRepository = class {
1241
+ baseURL;
1242
+ constructor(baseURL, museumId, articleId) {
1243
+ this.baseURL = `${baseURL}/museums/${museumId}/articles/${articleId}/spot`;
1244
+ }
1245
+ async get() {
1246
+ const url = `${this.baseURL}`;
1247
+ const response = await fetch(url, {
1248
+ method: "GET",
1249
+ credentials: "include"
1250
+ });
1251
+ if (response.status === 404) {
1252
+ throw new Error("Spot_not_related");
1253
+ }
1254
+ if (!response.ok) {
1255
+ throw new Error(response.statusText);
1256
+ }
1257
+ return SpotSchema.parse(await response.json());
1258
+ }
1259
+ };
1260
+
1261
+ // src/repository/museum/spot-article.ts
1262
+ var SpotArticleRepository = class {
1263
+ baseURL;
1264
+ constructor(baseURL, museumId, spotId) {
1265
+ this.baseURL = `${baseURL}/museums/${museumId}/spots/${spotId}/article`;
1266
+ }
1267
+ async get() {
1268
+ const response = await fetch(this.baseURL, {
1269
+ method: "GET",
1270
+ credentials: "include"
1271
+ });
1272
+ if (!response.ok) {
1273
+ throw new Error(response.statusText);
1274
+ }
1275
+ return ArticleSchema.parse(await response.json());
1276
+ }
1277
+ async put(articleId) {
1278
+ const response = await fetch(this.baseURL, {
1279
+ method: "PUT",
1280
+ headers: { "Content-Type": "application/json" },
1281
+ credentials: "include",
1282
+ body: JSON.stringify(articleId)
1283
+ });
1284
+ if (!response.ok) {
1285
+ throw new Error(response.statusText);
1286
+ }
1287
+ }
1288
+ async delete() {
1289
+ const response = await fetch(this.baseURL, {
1290
+ method: "DELETE",
1291
+ headers: { "Content-Type": "application/json" },
1292
+ credentials: "include",
1293
+ body: JSON.stringify({})
1294
+ });
1295
+ if (!response.ok) {
1296
+ throw new Error(response.statusText);
1297
+ }
1298
+ }
1299
+ };
1300
+
1301
+ // src/repository/museum/area-spot.ts
1302
+ var AreaSpotRepository = class {
1303
+ baseURL;
1304
+ constructor(baseURL, museumId, areaId) {
1305
+ this.baseURL = `${baseURL}/museums/${museumId}/areas/${areaId}/spots`;
1306
+ }
1307
+ async get() {
1308
+ const url = `${this.baseURL}`;
1309
+ const response = await fetch(url, {
1310
+ method: "GET",
1311
+ credentials: "include"
1312
+ });
1313
+ if (!response.ok) {
1314
+ throw new Error(response.statusText);
1315
+ }
1316
+ return SpotListSchema.parse(await response.json());
1317
+ }
1318
+ };
1319
+
1320
+ // src/repository/museum/article-tag.ts
1321
+ var ArticleTagRepository = class {
1322
+ baseURL;
1323
+ constructor(baseURL, museumId, articleId) {
1324
+ this.baseURL = `${baseURL}/museums/${museumId}/articles/${articleId}/tags`;
1325
+ }
1326
+ async get() {
1327
+ const url = `${this.baseURL}`;
1328
+ const response = await fetch(url, {
1329
+ method: "GET",
1330
+ credentials: "include"
1331
+ });
1332
+ if (!response.ok) {
1333
+ throw new Error(response.statusText);
1334
+ }
1335
+ return TagListSchema.parse(await response.json());
1336
+ }
1337
+ async put(tagIds) {
1338
+ const url = `${this.baseURL}`;
1339
+ const response = await fetch(url, {
1340
+ method: "PUT",
1341
+ headers: { "Content-Type": "application/json" },
1342
+ credentials: "include",
1343
+ body: JSON.stringify(tagIds)
1344
+ });
1345
+ if (!response.ok) {
1346
+ throw new Error(response.statusText);
1347
+ }
1348
+ return TagListSchema.parse(await response.json());
1349
+ }
1350
+ };
1351
+
1352
+ // src/repository/museum/article-picture.ts
1353
+ var ArticlePictureRepository = class {
1354
+ baseURL;
1355
+ constructor(baseURL, museumId, articleId) {
1356
+ this.baseURL = `${baseURL}/museums/${museumId}/articles/${articleId}/pictures`;
1357
+ }
1358
+ async get() {
1359
+ const url = `${this.baseURL}`;
1360
+ const response = await fetch(url, {
1361
+ method: "GET",
1362
+ credentials: "include"
1363
+ });
1364
+ if (!response.ok) {
1365
+ throw new Error(response.statusText);
1366
+ }
1367
+ return PictureListSchema.parse(await response.json());
1368
+ }
1369
+ async put(pictureIds) {
1370
+ const url = `${this.baseURL}`;
1371
+ const response = await fetch(url, {
1372
+ method: "PUT",
1373
+ headers: { "Content-Type": "application/json" },
1374
+ credentials: "include",
1375
+ body: JSON.stringify(pictureIds)
1376
+ });
1377
+ if (!response.ok) {
1378
+ throw new Error(response.statusText);
1379
+ }
1380
+ return PictureListSchema.parse(await response.json());
1381
+ }
1382
+ };
1383
+
1384
+ // src/repository/museum/article-event.ts
1385
+ var ArticleEventRepository = class {
1386
+ baseURL;
1387
+ constructor(baseURL, museumId, articleId) {
1388
+ this.baseURL = `${baseURL}/museums/${museumId}/articles/${articleId}/events`;
1389
+ }
1390
+ async get() {
1391
+ const url = `${this.baseURL}`;
1392
+ const response = await fetch(url, {
1393
+ method: "GET",
1394
+ credentials: "include"
1395
+ });
1396
+ if (!response.ok) {
1397
+ throw new Error(response.statusText);
1398
+ }
1399
+ return EventListSchema.parse(await response.json());
1400
+ }
1401
+ async update(eventIds) {
1402
+ const url = `${this.baseURL}`;
1403
+ const response = await fetch(url, {
1404
+ method: "PUT",
1405
+ headers: { "Content-Type": "application/json" },
1406
+ credentials: "include",
1407
+ body: JSON.stringify(eventIds)
1408
+ });
1409
+ if (!response.ok) {
1410
+ throw new Error(response.statusText);
1411
+ }
1412
+ return EventListSchema.parse(await response.json());
1413
+ }
1414
+ };
1415
+
1416
+ // src/repository/museum/event-article.ts
1417
+ var EventArticleRepository = class {
1418
+ baseURL;
1419
+ constructor(baseURL, museumId, eventId) {
1420
+ this.baseURL = `${baseURL}/museums/${museumId}/events/${eventId}/articles`;
1421
+ }
1422
+ async get() {
1423
+ const url = `${this.baseURL}`;
1424
+ const response = await fetch(url, {
1425
+ method: "GET",
1426
+ headers: { "Content-Type": "application/json" },
1427
+ credentials: "include"
1428
+ });
1429
+ if (!response.ok) {
1430
+ throw new Error(response.statusText);
1431
+ }
1432
+ return ArticleListSchema.parse(await response.json());
1433
+ }
1434
+ async put(articleIds) {
1435
+ const url = `${this.baseURL}`;
1436
+ const response = await fetch(url, {
1437
+ method: "PUT",
1438
+ headers: { "Content-Type": "application/json" },
1439
+ credentials: "include",
1440
+ body: JSON.stringify(articleIds)
1441
+ });
1442
+ if (!response.ok) {
1443
+ throw new Error(response.statusText);
1444
+ }
1445
+ return ArticleListSchema.parse(await response.json());
1446
+ }
1447
+ };
1448
+
1449
+ // src/repository/museum/event-picture.ts
1450
+ var EventPictureRepository = class {
1451
+ baseURL;
1452
+ constructor(baseURL, museumId, eventId) {
1453
+ this.baseURL = `${baseURL}/museums/${museumId}/events/${eventId}/picture`;
1454
+ }
1455
+ async get() {
1456
+ const url = `${this.baseURL}`;
1457
+ const response = await fetch(url, {
1458
+ method: "GET",
1459
+ headers: { "Content-Type": "application/json" },
1460
+ credentials: "include"
1461
+ });
1462
+ if (!response.ok) {
1463
+ throw new Error(response.statusText);
1464
+ }
1465
+ return PictureSchema.parse(await response.json());
1466
+ }
1467
+ async put(pictureId) {
1468
+ const url = `${this.baseURL}`;
1469
+ const response = await fetch(url, {
1470
+ method: "PUT",
1471
+ headers: { "Content-Type": "application/json" },
1472
+ credentials: "include",
1473
+ body: JSON.stringify(pictureId)
1474
+ });
1475
+ if (!response.ok) {
1476
+ throw new Error(response.statusText);
1477
+ }
1478
+ return PictureSchema.parse(await response.json());
1479
+ }
1480
+ };
1481
+
1482
+ // src/repository/museum/guide-picture.ts
1483
+ var GuidePictureRepository = class {
1484
+ baseURL;
1485
+ constructor(baseURL, museumId, guideId) {
1486
+ this.baseURL = `${baseURL}/museums/${museumId}/guides/${guideId}/picture`;
1487
+ }
1488
+ async get() {
1489
+ const url = `${this.baseURL}`;
1490
+ const response = await fetch(url, {
1491
+ method: "GET",
1492
+ headers: { "Content-Type": "application/json" },
1493
+ credentials: "include"
1494
+ });
1495
+ if (!response.ok) {
1496
+ throw new Error(response.statusText);
1497
+ }
1498
+ return PictureSchema.parse(await response.json());
1499
+ }
1500
+ async put(pictureId) {
1501
+ const url = `${this.baseURL}`;
1502
+ const response = await fetch(url, {
1503
+ method: "PUT",
1504
+ headers: { "Content-Type": "application/json" },
1505
+ credentials: "include",
1506
+ body: JSON.stringify(pictureId)
1507
+ });
1508
+ if (!response.ok) {
1509
+ throw new Error(response.statusText);
1510
+ }
1511
+ return PictureSchema.parse(await response.json());
1512
+ }
1513
+ };
1514
+
1515
+ // src/repository/museum/tag-article.ts
1516
+ var TagArticleRepository = class {
1517
+ baseURL;
1518
+ constructor(baseURL, museumId, tagId) {
1519
+ this.baseURL = `${baseURL}/museums/${museumId}/tags/${tagId}/articles`;
1520
+ }
1521
+ async get() {
1522
+ const url = `${this.baseURL}`;
1523
+ const response = await fetch(url, {
1524
+ method: "GET",
1525
+ headers: { "Content-Type": "application/json" },
1526
+ credentials: "include"
1527
+ });
1528
+ if (!response.ok) {
1529
+ throw new Error(response.statusText);
1530
+ }
1531
+ return ArticleListSchema.parse(await response.json());
1532
+ }
1533
+ };
1534
+ // Annotate the CommonJS export names for ESM import in node:
1535
+ 0 && (module.exports = {
1536
+ AreaIdListSchema,
1537
+ AreaIdSchema,
1538
+ AreaListSchema,
1539
+ AreaRepository,
1540
+ AreaSchema,
1541
+ AreaSpotRepository,
1542
+ ArticleAudioRepository,
1543
+ ArticleEventRepository,
1544
+ ArticleIdListSchema,
1545
+ ArticleIdSchema,
1546
+ ArticleListSchema,
1547
+ ArticlePictureRepository,
1548
+ ArticleRepository,
1549
+ ArticleSchema,
1550
+ ArticleSpotRepository,
1551
+ ArticleTagRepository,
1552
+ AudioIdListSchema,
1553
+ AudioIdSchema,
1554
+ AudioListSchema,
1555
+ AudioRepository,
1556
+ AudioSchema,
1557
+ AuthRepository,
1558
+ CreateAreaSchema,
1559
+ CreateArticleSchema,
1560
+ CreateEventSchema,
1561
+ CreateGuideSchema,
1562
+ CreateMuseumSchema,
1563
+ CreateSpotSchema,
1564
+ CreateTagSchema,
1565
+ CredentialsSchema,
1566
+ EventArticleRepository,
1567
+ EventIdListSchema,
1568
+ EventIdSchema,
1569
+ EventListSchema,
1570
+ EventPictureRepository,
1571
+ EventRepository,
1572
+ EventSchema,
1573
+ GuideIdListSchema,
1574
+ GuideIdSchema,
1575
+ GuideListSchema,
1576
+ GuidePictureRepository,
1577
+ GuideRepository,
1578
+ GuideSchema,
1579
+ MuseumIdListSchema,
1580
+ MuseumIdSchema,
1581
+ MuseumListSchema,
1582
+ MuseumRepository,
1583
+ MuseumSchema,
1584
+ PictureIdListSchema,
1585
+ PictureIdSchema,
1586
+ PictureListSchema,
1587
+ PictureRepository,
1588
+ PictureSchema,
1589
+ SpotArticleRepository,
1590
+ SpotIdListSchema,
1591
+ SpotIdSchema,
1592
+ SpotListSchema,
1593
+ SpotRepository,
1594
+ SpotSchema,
1595
+ TagArticleRepository,
1596
+ TagIdListSchema,
1597
+ TagIdSchema,
1598
+ TagListSchema,
1599
+ TagRepository,
1600
+ TagSchema,
1601
+ UpdateAreaSchema,
1602
+ UpdateArticleSchema,
1603
+ UpdateEventSchema,
1604
+ UpdateGuideSchema,
1605
+ UpdateMuseumSchema,
1606
+ UpdateSpotSchema,
1607
+ UpdateTagSchema,
1608
+ UserIdListSchema,
1609
+ UserIdSchema,
1610
+ UserListSchema,
1611
+ UserRepository,
1612
+ UserSchema
1613
+ });