@kernhq/module-quire 0.5.0 → 0.6.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/contract/properties.d.ts +2 -0
- package/dist/contract/properties.d.ts.map +1 -1
- package/dist/contract/properties.js.map +1 -1
- package/dist/contract/router.d.ts +1101 -0
- package/dist/contract/router.d.ts.map +1 -1
- package/dist/contract/router.js +88 -0
- package/dist/contract/router.js.map +1 -1
- package/dist/server/_impl.d.ts +1182 -0
- package/dist/server/_impl.d.ts.map +1 -1
- package/dist/server/_impl.js +113 -0
- package/dist/server/_impl.js.map +1 -1
- package/dist/server/schema.d.ts +51 -0
- package/dist/server/schema.d.ts.map +1 -1
- package/dist/server/schema.js +15 -0
- package/dist/server/schema.js.map +1 -1
- package/dist/server/services/access.d.ts +3 -0
- package/dist/server/services/access.d.ts.map +1 -1
- package/dist/server/services/databases.d.ts +330 -0
- package/dist/server/services/databases.d.ts.map +1 -0
- package/dist/server/services/databases.js +515 -0
- package/dist/server/services/databases.js.map +1 -0
- package/dist/server/services/index.d.ts +3 -0
- package/dist/server/services/index.d.ts.map +1 -1
- package/dist/server/services/index.js +3 -0
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/query.d.ts +13 -0
- package/dist/server/services/query.d.ts.map +1 -0
- package/dist/server/services/query.js +154 -0
- package/dist/server/services/query.js.map +1 -0
- package/dist/server/services/versions.d.ts +6 -0
- package/dist/server/services/versions.d.ts.map +1 -1
- package/migrations/0005_rows_are_pages.sql +6 -0
- package/migrations/meta/0004_snapshot.json +1 -1
- package/migrations/meta/0005_snapshot.json +1191 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/src/contract/properties.ts +2 -0
- package/src/contract/router.ts +115 -0
package/package.json
CHANGED
|
@@ -135,11 +135,13 @@ export const Filter = z.object({
|
|
|
135
135
|
operator: FilterOperator,
|
|
136
136
|
value: z.unknown().optional(),
|
|
137
137
|
})
|
|
138
|
+
export type Filter = z.infer<typeof Filter>
|
|
138
139
|
|
|
139
140
|
export const Sort = z.object({
|
|
140
141
|
propertyKey: z.string(),
|
|
141
142
|
direction: z.enum(['asc', 'desc']).default('asc'),
|
|
142
143
|
})
|
|
144
|
+
export type Sort = z.infer<typeof Sort>
|
|
143
145
|
|
|
144
146
|
export const ViewConfig = z.object({
|
|
145
147
|
filters: z.array(Filter).default([]),
|
package/src/contract/router.ts
CHANGED
|
@@ -12,6 +12,16 @@ import {
|
|
|
12
12
|
Space,
|
|
13
13
|
SpaceVisibility,
|
|
14
14
|
} from './models.js'
|
|
15
|
+
import {
|
|
16
|
+
Database,
|
|
17
|
+
Property,
|
|
18
|
+
PropertyConfig,
|
|
19
|
+
PropertyType,
|
|
20
|
+
Row,
|
|
21
|
+
View,
|
|
22
|
+
ViewConfig,
|
|
23
|
+
ViewKind,
|
|
24
|
+
} from './properties.js'
|
|
15
25
|
|
|
16
26
|
const ws = z.object({ workspaceId: WorkspaceId })
|
|
17
27
|
const t = (...tags: string[]) => ({ tags })
|
|
@@ -187,6 +197,111 @@ export const quireContract = {
|
|
|
187
197
|
.output(CommentThread),
|
|
188
198
|
},
|
|
189
199
|
|
|
200
|
+
databases: {
|
|
201
|
+
get: baseContract
|
|
202
|
+
.route({ method: 'GET', path: '/databases/{databaseId}', ...t('databases') })
|
|
203
|
+
.input(ws.extend({ databaseId: Id }))
|
|
204
|
+
.output(Database),
|
|
205
|
+
/** Turn a page into a database. It arrives with one column and one view, never empty. */
|
|
206
|
+
create: baseContract
|
|
207
|
+
.route({ method: 'POST', path: '/databases', ...t('databases') })
|
|
208
|
+
.input(
|
|
209
|
+
ws.extend({
|
|
210
|
+
spaceId: Id,
|
|
211
|
+
pageId: Id,
|
|
212
|
+
name: z.string().max(120).default(''),
|
|
213
|
+
inline: z.boolean().default(false),
|
|
214
|
+
}),
|
|
215
|
+
)
|
|
216
|
+
.output(Database),
|
|
217
|
+
/** The rows a view selects, filtered and ordered in SQL so a page of rows is a full page. */
|
|
218
|
+
rows: baseContract
|
|
219
|
+
.route({ method: 'GET', path: '/databases/{databaseId}/rows', ...t('databases') })
|
|
220
|
+
.input(ws.extend({ databaseId: Id, viewId: Id.nullable().default(null) }).extend(PageInput.shape))
|
|
221
|
+
.output(page(Row)),
|
|
222
|
+
addRow: baseContract
|
|
223
|
+
.route({ method: 'POST', path: '/databases/{databaseId}/rows', ...t('databases') })
|
|
224
|
+
.input(
|
|
225
|
+
ws.extend({
|
|
226
|
+
databaseId: Id,
|
|
227
|
+
title: z.string().max(300).default(''),
|
|
228
|
+
props: z.record(z.string(), z.unknown()).default({}),
|
|
229
|
+
}),
|
|
230
|
+
)
|
|
231
|
+
.output(Row),
|
|
232
|
+
updateRow: baseContract
|
|
233
|
+
.route({ method: 'PATCH', path: '/rows/{rowId}', ...t('databases') })
|
|
234
|
+
.input(
|
|
235
|
+
ws.extend({
|
|
236
|
+
rowId: Id,
|
|
237
|
+
title: z.string().max(300).optional(),
|
|
238
|
+
props: z.record(z.string(), z.unknown()).optional(),
|
|
239
|
+
}),
|
|
240
|
+
)
|
|
241
|
+
.output(Row),
|
|
242
|
+
|
|
243
|
+
addProperty: baseContract
|
|
244
|
+
.route({ method: 'POST', path: '/databases/{databaseId}/properties', ...t('databases') })
|
|
245
|
+
.input(
|
|
246
|
+
ws.extend({
|
|
247
|
+
databaseId: Id,
|
|
248
|
+
name: z.string().min(1).max(120),
|
|
249
|
+
type: PropertyType,
|
|
250
|
+
config: PropertyConfig.default({}),
|
|
251
|
+
}),
|
|
252
|
+
)
|
|
253
|
+
.output(Property),
|
|
254
|
+
updateProperty: baseContract
|
|
255
|
+
.route({ method: 'PATCH', path: '/properties/{propertyId}', ...t('databases') })
|
|
256
|
+
.input(
|
|
257
|
+
ws.extend({
|
|
258
|
+
propertyId: Id,
|
|
259
|
+
name: z.string().min(1).max(120).optional(),
|
|
260
|
+
type: PropertyType.optional(),
|
|
261
|
+
config: PropertyConfig.optional(),
|
|
262
|
+
hidden: z.boolean().optional(),
|
|
263
|
+
}),
|
|
264
|
+
)
|
|
265
|
+
.output(Property),
|
|
266
|
+
removeProperty: baseContract
|
|
267
|
+
.route({ method: 'DELETE', path: '/properties/{propertyId}', ...t('databases') })
|
|
268
|
+
.input(ws.extend({ propertyId: Id }))
|
|
269
|
+
.output(Ok),
|
|
270
|
+
|
|
271
|
+
addView: baseContract
|
|
272
|
+
.route({ method: 'POST', path: '/databases/{databaseId}/views', ...t('databases') })
|
|
273
|
+
.input(
|
|
274
|
+
ws.extend({
|
|
275
|
+
databaseId: Id,
|
|
276
|
+
name: z.string().min(1).max(120),
|
|
277
|
+
kind: ViewKind.default('table'),
|
|
278
|
+
config: ViewConfig.partial().default({}),
|
|
279
|
+
}),
|
|
280
|
+
)
|
|
281
|
+
.output(View),
|
|
282
|
+
updateView: baseContract
|
|
283
|
+
.route({ method: 'PATCH', path: '/views/{viewId}', ...t('databases') })
|
|
284
|
+
.input(
|
|
285
|
+
ws.extend({
|
|
286
|
+
viewId: Id,
|
|
287
|
+
name: z.string().min(1).max(120).optional(),
|
|
288
|
+
kind: ViewKind.optional(),
|
|
289
|
+
config: ViewConfig.partial().optional(),
|
|
290
|
+
}),
|
|
291
|
+
)
|
|
292
|
+
.output(View),
|
|
293
|
+
removeView: baseContract
|
|
294
|
+
.route({ method: 'DELETE', path: '/views/{viewId}', ...t('databases') })
|
|
295
|
+
.input(ws.extend({ viewId: Id }))
|
|
296
|
+
.output(Ok),
|
|
297
|
+
|
|
298
|
+
/** Both ends at once, because a link visible from one side only is the "wrong rollup" bug. */
|
|
299
|
+
setRelation: baseContract
|
|
300
|
+
.route({ method: 'POST', path: '/rows/{rowId}/relations', ...t('databases') })
|
|
301
|
+
.input(ws.extend({ rowId: Id, propertyId: Id, toPageIds: z.array(Id).max(200) }))
|
|
302
|
+
.output(Ok),
|
|
303
|
+
},
|
|
304
|
+
|
|
190
305
|
publishing: {
|
|
191
306
|
/** Make what is written now the version readers are served. Only meaningful for a `page`. */
|
|
192
307
|
publish: baseContract
|