@groovenet/contracts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -2
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -0
- package/build/liveSets.d.ts +288 -0
- package/build/liveSets.d.ts.map +1 -0
- package/build/liveSets.js +85 -0
- package/build/liveSets.js.map +1 -0
- package/package.json +28 -4
package/README.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @groovenet/contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared runtime schemas and TypeScript types for Groovenet API resources. The
|
|
4
|
+
package starts with live sets and is the source of truth for their wire enums,
|
|
5
|
+
entities, and update payloads.
|
|
6
|
+
|
|
7
|
+
## Adding or migrating a contract
|
|
8
|
+
|
|
9
|
+
1. Define the Zod schema in this package and export its inferred type with
|
|
10
|
+
`z.infer<typeof schema>`.
|
|
11
|
+
2. Use the schema in the app route to validate incoming JSON. Keep the route's
|
|
12
|
+
existing HTTP status and error response behavior when adding validation.
|
|
13
|
+
3. Import the inferred type in the app's repository/service layer and re-export
|
|
14
|
+
it from `@groovenet/client` when client methods return or accept the resource.
|
|
15
|
+
The CLI consumes client types and does not maintain a parallel declaration.
|
|
16
|
+
4. Export JSON Schema forms for OpenAPI components and reference those
|
|
17
|
+
components from the route contract. Add an OpenAPI test for the resource's
|
|
18
|
+
shape and enum values.
|
|
19
|
+
|
|
20
|
+
Migrate one resource family at a time: live sets, playlists, tracks/albums,
|
|
21
|
+
then the remaining API resources. Preserve permissive response fields where
|
|
22
|
+
the database returns additional wire fields; make request schemas strict only
|
|
23
|
+
when the endpoint already rejects unknown fields.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const liveSetStatusSchema: z.ZodEnum<{
|
|
3
|
+
archived: "archived";
|
|
4
|
+
draft: "draft";
|
|
5
|
+
performed: "performed";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const liveSetMediaTypeSchema: z.ZodEnum<{
|
|
8
|
+
audio: "audio";
|
|
9
|
+
flyer: "flyer";
|
|
10
|
+
image: "image";
|
|
11
|
+
link: "link";
|
|
12
|
+
youtube: "youtube";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const liveSetCollaboratorSchema: z.ZodObject<{
|
|
15
|
+
friend_id: z.ZodNumber;
|
|
16
|
+
username: z.ZodString;
|
|
17
|
+
role: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const liveSetPerformanceSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
performed_at: z.ZodString;
|
|
22
|
+
venue_name: z.ZodNullable<z.ZodString>;
|
|
23
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
24
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$loose>;
|
|
26
|
+
export declare const liveSetMediaSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
media_type: z.ZodEnum<{
|
|
29
|
+
audio: "audio";
|
|
30
|
+
flyer: "flyer";
|
|
31
|
+
image: "image";
|
|
32
|
+
link: "link";
|
|
33
|
+
youtube: "youtube";
|
|
34
|
+
}>;
|
|
35
|
+
url: z.ZodString;
|
|
36
|
+
filename: z.ZodNullable<z.ZodString>;
|
|
37
|
+
caption: z.ZodNullable<z.ZodString>;
|
|
38
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
}, z.core.$loose>;
|
|
40
|
+
export declare const liveSetSummarySchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodNumber;
|
|
42
|
+
title: z.ZodNullable<z.ZodString>;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
archived: "archived";
|
|
45
|
+
draft: "draft";
|
|
46
|
+
performed: "performed";
|
|
47
|
+
}>;
|
|
48
|
+
cover_image_url: z.ZodNullable<z.ZodString>;
|
|
49
|
+
last_performed_at: z.ZodNullable<z.ZodString>;
|
|
50
|
+
venue_name: z.ZodNullable<z.ZodString>;
|
|
51
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
52
|
+
collaborators: z.ZodArray<z.ZodObject<{
|
|
53
|
+
friend_id: z.ZodNumber;
|
|
54
|
+
username: z.ZodString;
|
|
55
|
+
role: z.ZodString;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$loose>;
|
|
58
|
+
export declare const liveSetSchema: z.ZodObject<{
|
|
59
|
+
id: z.ZodNumber;
|
|
60
|
+
playlist_id: z.ZodNumber;
|
|
61
|
+
title: z.ZodNullable<z.ZodString>;
|
|
62
|
+
status: z.ZodEnum<{
|
|
63
|
+
archived: "archived";
|
|
64
|
+
draft: "draft";
|
|
65
|
+
performed: "performed";
|
|
66
|
+
}>;
|
|
67
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
68
|
+
location_name: z.ZodNullable<z.ZodString>;
|
|
69
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
70
|
+
cover_image_url: z.ZodNullable<z.ZodString>;
|
|
71
|
+
collaborators: z.ZodArray<z.ZodObject<{
|
|
72
|
+
friend_id: z.ZodNumber;
|
|
73
|
+
username: z.ZodString;
|
|
74
|
+
role: z.ZodString;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
performances: z.ZodArray<z.ZodObject<{
|
|
77
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
performed_at: z.ZodString;
|
|
79
|
+
venue_name: z.ZodNullable<z.ZodString>;
|
|
80
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
81
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
82
|
+
}, z.core.$loose>>;
|
|
83
|
+
media: z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
media_type: z.ZodEnum<{
|
|
86
|
+
audio: "audio";
|
|
87
|
+
flyer: "flyer";
|
|
88
|
+
image: "image";
|
|
89
|
+
link: "link";
|
|
90
|
+
youtube: "youtube";
|
|
91
|
+
}>;
|
|
92
|
+
url: z.ZodString;
|
|
93
|
+
filename: z.ZodNullable<z.ZodString>;
|
|
94
|
+
caption: z.ZodNullable<z.ZodString>;
|
|
95
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
}, z.core.$loose>>;
|
|
97
|
+
}, z.core.$loose>;
|
|
98
|
+
export declare const liveSetMutationResponseSchema: z.ZodObject<{
|
|
99
|
+
id: z.ZodNumber;
|
|
100
|
+
playlist_id: z.ZodNumber;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
export declare const liveSetDeleteResponseSchema: z.ZodObject<{
|
|
103
|
+
success: z.ZodLiteral<true>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export declare const liveSetUpdateSchema: z.ZodObject<{
|
|
106
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
archived: "archived";
|
|
109
|
+
draft: "draft";
|
|
110
|
+
performed: "performed";
|
|
111
|
+
}>>;
|
|
112
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
location_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
location_city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
+
cover_image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
|
+
collaborators: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
117
|
+
friend_id: z.ZodNumber;
|
|
118
|
+
role: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>>;
|
|
120
|
+
performances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
|
+
performed_at: z.ZodString;
|
|
122
|
+
venue_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
123
|
+
location_city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
+
}, z.core.$strip>>>;
|
|
126
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
|
+
media_type: z.ZodEnum<{
|
|
128
|
+
audio: "audio";
|
|
129
|
+
flyer: "flyer";
|
|
130
|
+
image: "image";
|
|
131
|
+
link: "link";
|
|
132
|
+
youtube: "youtube";
|
|
133
|
+
}>;
|
|
134
|
+
url: z.ZodString;
|
|
135
|
+
filename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
caption: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
}, z.core.$strip>>>;
|
|
138
|
+
}, z.core.$loose>;
|
|
139
|
+
export type LiveSetStatus = z.infer<typeof liveSetStatusSchema>;
|
|
140
|
+
export type LiveSetMediaType = z.infer<typeof liveSetMediaTypeSchema>;
|
|
141
|
+
export type LiveSetCollaborator = z.infer<typeof liveSetCollaboratorSchema>;
|
|
142
|
+
export type LiveSetPerformance = z.infer<typeof liveSetPerformanceSchema>;
|
|
143
|
+
export type LiveSetMedia = z.infer<typeof liveSetMediaSchema>;
|
|
144
|
+
export type LiveSetSummary = z.infer<typeof liveSetSummarySchema>;
|
|
145
|
+
export type LiveSet = z.infer<typeof liveSetSchema>;
|
|
146
|
+
export type LiveSetMutationResponse = z.infer<typeof liveSetMutationResponseSchema>;
|
|
147
|
+
export type LiveSetDeleteResponse = z.infer<typeof liveSetDeleteResponseSchema>;
|
|
148
|
+
export type LiveSetUpdate = z.infer<typeof liveSetUpdateSchema>;
|
|
149
|
+
export declare const liveSetJsonSchemas: {
|
|
150
|
+
LiveSetStatus: z.core.ZodStandardJSONSchemaPayload<z.ZodEnum<{
|
|
151
|
+
archived: "archived";
|
|
152
|
+
draft: "draft";
|
|
153
|
+
performed: "performed";
|
|
154
|
+
}>>;
|
|
155
|
+
LiveSetMediaType: z.core.ZodStandardJSONSchemaPayload<z.ZodEnum<{
|
|
156
|
+
audio: "audio";
|
|
157
|
+
flyer: "flyer";
|
|
158
|
+
image: "image";
|
|
159
|
+
link: "link";
|
|
160
|
+
youtube: "youtube";
|
|
161
|
+
}>>;
|
|
162
|
+
LiveSetCollaborator: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
163
|
+
friend_id: z.ZodNumber;
|
|
164
|
+
username: z.ZodString;
|
|
165
|
+
role: z.ZodString;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
LiveSetPerformance: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
168
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
performed_at: z.ZodString;
|
|
170
|
+
venue_name: z.ZodNullable<z.ZodString>;
|
|
171
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
172
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
173
|
+
}, z.core.$loose>>;
|
|
174
|
+
LiveSetMedia: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
175
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
media_type: z.ZodEnum<{
|
|
177
|
+
audio: "audio";
|
|
178
|
+
flyer: "flyer";
|
|
179
|
+
image: "image";
|
|
180
|
+
link: "link";
|
|
181
|
+
youtube: "youtube";
|
|
182
|
+
}>;
|
|
183
|
+
url: z.ZodString;
|
|
184
|
+
filename: z.ZodNullable<z.ZodString>;
|
|
185
|
+
caption: z.ZodNullable<z.ZodString>;
|
|
186
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
}, z.core.$loose>>;
|
|
188
|
+
LiveSetSummary: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
189
|
+
id: z.ZodNumber;
|
|
190
|
+
title: z.ZodNullable<z.ZodString>;
|
|
191
|
+
status: z.ZodEnum<{
|
|
192
|
+
archived: "archived";
|
|
193
|
+
draft: "draft";
|
|
194
|
+
performed: "performed";
|
|
195
|
+
}>;
|
|
196
|
+
cover_image_url: z.ZodNullable<z.ZodString>;
|
|
197
|
+
last_performed_at: z.ZodNullable<z.ZodString>;
|
|
198
|
+
venue_name: z.ZodNullable<z.ZodString>;
|
|
199
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
200
|
+
collaborators: z.ZodArray<z.ZodObject<{
|
|
201
|
+
friend_id: z.ZodNumber;
|
|
202
|
+
username: z.ZodString;
|
|
203
|
+
role: z.ZodString;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
}, z.core.$loose>>;
|
|
206
|
+
LiveSet: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
207
|
+
id: z.ZodNumber;
|
|
208
|
+
playlist_id: z.ZodNumber;
|
|
209
|
+
title: z.ZodNullable<z.ZodString>;
|
|
210
|
+
status: z.ZodEnum<{
|
|
211
|
+
archived: "archived";
|
|
212
|
+
draft: "draft";
|
|
213
|
+
performed: "performed";
|
|
214
|
+
}>;
|
|
215
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
216
|
+
location_name: z.ZodNullable<z.ZodString>;
|
|
217
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
218
|
+
cover_image_url: z.ZodNullable<z.ZodString>;
|
|
219
|
+
collaborators: z.ZodArray<z.ZodObject<{
|
|
220
|
+
friend_id: z.ZodNumber;
|
|
221
|
+
username: z.ZodString;
|
|
222
|
+
role: z.ZodString;
|
|
223
|
+
}, z.core.$strip>>;
|
|
224
|
+
performances: z.ZodArray<z.ZodObject<{
|
|
225
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
performed_at: z.ZodString;
|
|
227
|
+
venue_name: z.ZodNullable<z.ZodString>;
|
|
228
|
+
location_city: z.ZodNullable<z.ZodString>;
|
|
229
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
230
|
+
}, z.core.$loose>>;
|
|
231
|
+
media: z.ZodArray<z.ZodObject<{
|
|
232
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
media_type: z.ZodEnum<{
|
|
234
|
+
audio: "audio";
|
|
235
|
+
flyer: "flyer";
|
|
236
|
+
image: "image";
|
|
237
|
+
link: "link";
|
|
238
|
+
youtube: "youtube";
|
|
239
|
+
}>;
|
|
240
|
+
url: z.ZodString;
|
|
241
|
+
filename: z.ZodNullable<z.ZodString>;
|
|
242
|
+
caption: z.ZodNullable<z.ZodString>;
|
|
243
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
}, z.core.$loose>>;
|
|
245
|
+
}, z.core.$loose>>;
|
|
246
|
+
LiveSetMutationResponse: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
247
|
+
id: z.ZodNumber;
|
|
248
|
+
playlist_id: z.ZodNumber;
|
|
249
|
+
}, z.core.$strip>>;
|
|
250
|
+
LiveSetDeleteResponse: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
251
|
+
success: z.ZodLiteral<true>;
|
|
252
|
+
}, z.core.$strip>>;
|
|
253
|
+
LiveSetUpdate: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
254
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
255
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
256
|
+
archived: "archived";
|
|
257
|
+
draft: "draft";
|
|
258
|
+
performed: "performed";
|
|
259
|
+
}>>;
|
|
260
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
261
|
+
location_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
262
|
+
location_city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
263
|
+
cover_image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
+
collaborators: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
265
|
+
friend_id: z.ZodNumber;
|
|
266
|
+
role: z.ZodOptional<z.ZodString>;
|
|
267
|
+
}, z.core.$strip>>>;
|
|
268
|
+
performances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
269
|
+
performed_at: z.ZodString;
|
|
270
|
+
venue_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
+
location_city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
272
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
273
|
+
}, z.core.$strip>>>;
|
|
274
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
275
|
+
media_type: z.ZodEnum<{
|
|
276
|
+
audio: "audio";
|
|
277
|
+
flyer: "flyer";
|
|
278
|
+
image: "image";
|
|
279
|
+
link: "link";
|
|
280
|
+
youtube: "youtube";
|
|
281
|
+
}>;
|
|
282
|
+
url: z.ZodString;
|
|
283
|
+
filename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
|
+
caption: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
285
|
+
}, z.core.$strip>>>;
|
|
286
|
+
}, z.core.$loose>>;
|
|
287
|
+
};
|
|
288
|
+
//# sourceMappingURL=liveSets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveSets.d.ts","sourceRoot":"","sources":["../src/liveSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;EAA6C,CAAC;AAC9E,eAAO,MAAM,sBAAsB;;;;;;EAAyD,CAAC;AAE7F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AC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,kBAAkB;IAC7B,aAAa;;;;;IACb,gBAAgB;;;;;;;IAChB,mBAAmB;;;;;IACnB,kBAAkB;;;;;;;IAClB,YAAY;;;;;;;;;;;;;;IACZ,cAAc;;;;;;;;;;;;;;;;;;IACd,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACP,uBAAuB;;;;IACvB,qBAAqB;;;IACrB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACd,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const liveSetStatusSchema = z.enum(["draft", "performed", "archived"]);
|
|
3
|
+
export const liveSetMediaTypeSchema = z.enum(["image", "flyer", "audio", "youtube", "link"]);
|
|
4
|
+
export const liveSetCollaboratorSchema = z.object({
|
|
5
|
+
friend_id: z.number().int(),
|
|
6
|
+
username: z.string(),
|
|
7
|
+
role: z.string(),
|
|
8
|
+
});
|
|
9
|
+
export const liveSetPerformanceSchema = z.object({
|
|
10
|
+
id: z.number().int().optional(),
|
|
11
|
+
performed_at: z.string(),
|
|
12
|
+
venue_name: z.string().nullable(),
|
|
13
|
+
location_city: z.string().nullable(),
|
|
14
|
+
notes: z.string().nullable(),
|
|
15
|
+
}).passthrough();
|
|
16
|
+
export const liveSetMediaSchema = z.object({
|
|
17
|
+
id: z.number().int().optional(),
|
|
18
|
+
media_type: liveSetMediaTypeSchema,
|
|
19
|
+
url: z.string(),
|
|
20
|
+
filename: z.string().nullable(),
|
|
21
|
+
caption: z.string().nullable(),
|
|
22
|
+
position: z.number().int().optional(),
|
|
23
|
+
}).passthrough();
|
|
24
|
+
export const liveSetSummarySchema = z.object({
|
|
25
|
+
id: z.number().int(),
|
|
26
|
+
title: z.string().nullable(),
|
|
27
|
+
status: liveSetStatusSchema,
|
|
28
|
+
cover_image_url: z.string().nullable(),
|
|
29
|
+
last_performed_at: z.string().nullable(),
|
|
30
|
+
venue_name: z.string().nullable(),
|
|
31
|
+
location_city: z.string().nullable(),
|
|
32
|
+
collaborators: z.array(liveSetCollaboratorSchema),
|
|
33
|
+
}).passthrough();
|
|
34
|
+
export const liveSetSchema = z.object({
|
|
35
|
+
id: z.number().int(),
|
|
36
|
+
playlist_id: z.number().int(),
|
|
37
|
+
title: z.string().nullable(),
|
|
38
|
+
status: liveSetStatusSchema,
|
|
39
|
+
notes: z.string().nullable(),
|
|
40
|
+
location_name: z.string().nullable(),
|
|
41
|
+
location_city: z.string().nullable(),
|
|
42
|
+
cover_image_url: z.string().nullable(),
|
|
43
|
+
collaborators: z.array(liveSetCollaboratorSchema),
|
|
44
|
+
performances: z.array(liveSetPerformanceSchema),
|
|
45
|
+
media: z.array(liveSetMediaSchema),
|
|
46
|
+
}).passthrough();
|
|
47
|
+
export const liveSetMutationResponseSchema = z.object({
|
|
48
|
+
id: z.number().int(),
|
|
49
|
+
playlist_id: z.number().int(),
|
|
50
|
+
});
|
|
51
|
+
export const liveSetDeleteResponseSchema = z.object({ success: z.literal(true) });
|
|
52
|
+
export const liveSetUpdateSchema = z.object({
|
|
53
|
+
title: z.string().nullable().optional(),
|
|
54
|
+
status: liveSetStatusSchema.optional(),
|
|
55
|
+
notes: z.string().nullable().optional(),
|
|
56
|
+
location_name: z.string().nullable().optional(),
|
|
57
|
+
location_city: z.string().nullable().optional(),
|
|
58
|
+
cover_image_url: z.string().nullable().optional(),
|
|
59
|
+
collaborators: z.array(z.object({ friend_id: z.number().int(), role: z.string().optional() })).optional(),
|
|
60
|
+
performances: z.array(z.object({
|
|
61
|
+
performed_at: z.string(),
|
|
62
|
+
venue_name: z.string().nullable().optional(),
|
|
63
|
+
location_city: z.string().nullable().optional(),
|
|
64
|
+
notes: z.string().nullable().optional(),
|
|
65
|
+
})).optional(),
|
|
66
|
+
media: z.array(z.object({
|
|
67
|
+
media_type: liveSetMediaTypeSchema,
|
|
68
|
+
url: z.string(),
|
|
69
|
+
filename: z.string().nullable().optional(),
|
|
70
|
+
caption: z.string().nullable().optional(),
|
|
71
|
+
})).optional(),
|
|
72
|
+
}).passthrough();
|
|
73
|
+
export const liveSetJsonSchemas = {
|
|
74
|
+
LiveSetStatus: z.toJSONSchema(liveSetStatusSchema),
|
|
75
|
+
LiveSetMediaType: z.toJSONSchema(liveSetMediaTypeSchema),
|
|
76
|
+
LiveSetCollaborator: z.toJSONSchema(liveSetCollaboratorSchema),
|
|
77
|
+
LiveSetPerformance: z.toJSONSchema(liveSetPerformanceSchema),
|
|
78
|
+
LiveSetMedia: z.toJSONSchema(liveSetMediaSchema),
|
|
79
|
+
LiveSetSummary: z.toJSONSchema(liveSetSummarySchema),
|
|
80
|
+
LiveSet: z.toJSONSchema(liveSetSchema),
|
|
81
|
+
LiveSetMutationResponse: z.toJSONSchema(liveSetMutationResponseSchema),
|
|
82
|
+
LiveSetDeleteResponse: z.toJSONSchema(liveSetDeleteResponseSchema),
|
|
83
|
+
LiveSetUpdate: z.toJSONSchema(liveSetUpdateSchema),
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=liveSets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveSets.js","sourceRoot":"","sources":["../src/liveSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG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ferred types for the Groovenet API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./build/index.d.ts",
|
|
11
|
+
"import": "./build/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"lint": "eslint .",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:coverage": "vitest run --coverage --coverage.include=src/liveSets.ts --coverage.reporter=lcov"
|
|
19
|
+
},
|
|
20
|
+
"files": ["build/"],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"zod": "^4.6.5"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@vitest/coverage-v8": "^5.0.2",
|
|
26
|
+
"typescript": "^7.0",
|
|
27
|
+
"vitest": "^5.0.0"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT"
|
|
30
|
+
}
|