@read-frog/api-contract 0.4.1 → 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/index.d.ts +1158 -325
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +486 -202
- package/dist/index.js.map +1 -1
- package/package.json +18 -10
- package/src/contracts/beta-access.ts +1 -1
- package/src/contracts/card-template.ts +71 -0
- package/src/contracts/card.ts +45 -0
- package/src/contracts/notebase-column.ts +63 -0
- package/src/contracts/notebase-row.ts +62 -0
- package/src/contracts/notebase.ts +82 -0
- package/src/contracts/shared.ts +1 -1
- package/src/contracts/srs.ts +38 -0
- package/src/contracts/user.ts +17 -0
- package/src/index.ts +22 -10
- package/src/public-errors.ts +46 -12
- package/src/schemas/card.ts +120 -0
- package/src/schemas/notebase-column.ts +74 -0
- package/src/schemas/notebase-row.ts +73 -0
- package/src/schemas/notebase-view.ts +61 -0
- package/src/schemas/notebase.ts +103 -0
- package/src/schemas/srs.ts +129 -0
- package/src/schemas/timezone.ts +23 -0
- package/src/schemas/user.ts +13 -0
- package/src/contracts/column.ts +0 -62
- package/src/contracts/custom-table.ts +0 -82
- package/src/contracts/row.ts +0 -62
- package/src/schemas/column.ts +0 -74
- package/src/schemas/custom-table.ts +0 -86
- package/src/schemas/row.ts +0 -73
- package/src/schemas/view.ts +0 -61
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
-
import { BETA_FEATURE_KEYS,
|
|
2
|
+
import { BETA_FEATURE_KEYS, NOTEBASE_COLUMN_MAX_WIDTH, NOTEBASE_COLUMN_MIN_WIDTH, SRS_REVIEW_DURATION_MS_MAX, cardIdentityShape, cardMemoryStateShape, cardStateSchema, cardStateSchema as cardStateSchema$1, cardTemplateConfigSchema, fsrsReviewLogSnapshotSchema, notebaseColumnConfigSchema, reviewRatingSchema, scheduleStatusSchema, scheduleStatusSchema as scheduleStatusSchema$1, schedulingParamsSchema, schedulingParamsShape, srsStepSchema, srsWeightsSchema } from "@read-frog/definitions";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/schemas/beta-access.ts
|
|
5
5
|
const BetaFeatureKeySchema = z.enum(BETA_FEATURE_KEYS);
|
|
@@ -19,7 +19,7 @@ const betaAccessContract = { status: oc.route({
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/public-errors.ts
|
|
21
21
|
const CellValidationFailureReasonSchema = z.enum([
|
|
22
|
-
"
|
|
22
|
+
"unknown_notebase_column",
|
|
23
23
|
"type_mismatch",
|
|
24
24
|
"invalid_select_option",
|
|
25
25
|
"invalid_date_format"
|
|
@@ -32,29 +32,59 @@ const CellValidationFailureDetailsSchema = z.object({
|
|
|
32
32
|
validOptions: z.array(z.string()).optional()
|
|
33
33
|
}).strict();
|
|
34
34
|
const CellValidationFailedDataSchema = z.object({
|
|
35
|
-
|
|
35
|
+
notebaseColumnId: z.string(),
|
|
36
36
|
details: CellValidationFailureDetailsSchema,
|
|
37
37
|
reason: CellValidationFailureReasonSchema
|
|
38
38
|
}).strict();
|
|
39
|
+
const CardTemplateInvalidColumnsDataSchema = z.object({ notebaseColumnIds: z.array(z.string()) }).strict();
|
|
39
40
|
const PUBLIC_APP_ERROR_DEFS = {
|
|
40
41
|
NOTEBASE_BETA_RESTRICTED: {
|
|
41
42
|
message: "Notebase is currently in beta for selected accounts",
|
|
42
43
|
status: 403
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
-
message: "
|
|
45
|
+
NOTEBASE_NOT_FOUND: {
|
|
46
|
+
message: "Notebase not found",
|
|
46
47
|
status: 404
|
|
47
48
|
},
|
|
48
|
-
|
|
49
|
-
message: "
|
|
49
|
+
NOTEBASE_COLUMN_NOT_FOUND: {
|
|
50
|
+
message: "Notebase column not found",
|
|
50
51
|
status: 404
|
|
51
52
|
},
|
|
52
|
-
|
|
53
|
-
message: "
|
|
53
|
+
NOTEBASE_ROW_NOT_FOUND: {
|
|
54
|
+
message: "Notebase row not found",
|
|
54
55
|
status: 404
|
|
55
56
|
},
|
|
56
|
-
|
|
57
|
-
message: "
|
|
57
|
+
CARD_NOT_FOUND: {
|
|
58
|
+
message: "Card not found",
|
|
59
|
+
status: 404
|
|
60
|
+
},
|
|
61
|
+
CARD_TEMPLATE_NOT_FOUND: {
|
|
62
|
+
message: "Card template not found",
|
|
63
|
+
status: 404
|
|
64
|
+
},
|
|
65
|
+
CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS: {
|
|
66
|
+
data: CardTemplateInvalidColumnsDataSchema,
|
|
67
|
+
message: "Card template references unknown notebase columns",
|
|
68
|
+
status: 422
|
|
69
|
+
},
|
|
70
|
+
CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE: {
|
|
71
|
+
message: "Notebase column is used by a card template",
|
|
72
|
+
status: 409
|
|
73
|
+
},
|
|
74
|
+
CARD_NOT_REVIEWABLE: {
|
|
75
|
+
message: "Card cannot be reviewed in its current state",
|
|
76
|
+
status: 409
|
|
77
|
+
},
|
|
78
|
+
CARD_REVIEW_STATE_STALE: {
|
|
79
|
+
message: "Card review state is stale",
|
|
80
|
+
status: 409
|
|
81
|
+
},
|
|
82
|
+
CARD_REVIEW_ROLLBACK_UNAVAILABLE: {
|
|
83
|
+
message: "Card review cannot be rolled back",
|
|
84
|
+
status: 409
|
|
85
|
+
},
|
|
86
|
+
NOTEBASE_VIEW_NOT_FOUND: {
|
|
87
|
+
message: "Notebase view not found",
|
|
58
88
|
status: 404
|
|
59
89
|
},
|
|
60
90
|
CELL_VALIDATION_FAILED: {
|
|
@@ -62,8 +92,8 @@ const PUBLIC_APP_ERROR_DEFS = {
|
|
|
62
92
|
message: "Cell validation failed",
|
|
63
93
|
status: 422
|
|
64
94
|
},
|
|
65
|
-
|
|
66
|
-
message: "Cannot delete primary column",
|
|
95
|
+
PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED: {
|
|
96
|
+
message: "Cannot delete primary notebase column",
|
|
67
97
|
status: 400
|
|
68
98
|
},
|
|
69
99
|
CONCURRENT_POSITION_CONFLICT: {
|
|
@@ -92,162 +122,246 @@ function pickPublicErrorMap(...codes) {
|
|
|
92
122
|
}));
|
|
93
123
|
}
|
|
94
124
|
//#endregion
|
|
95
|
-
//#region src/schemas/
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
tableId: z.string(),
|
|
125
|
+
//#region src/schemas/card.ts
|
|
126
|
+
const cardTemplateSchema = z.object({
|
|
127
|
+
id: z.uuid(),
|
|
128
|
+
notebaseId: z.uuid(),
|
|
100
129
|
name: z.string(),
|
|
101
|
-
config:
|
|
102
|
-
position: z.number(),
|
|
103
|
-
isPrimary: z.boolean(),
|
|
104
|
-
width: z.number().nullable(),
|
|
130
|
+
config: cardTemplateConfigSchema,
|
|
105
131
|
createdAt: z.coerce.date(),
|
|
106
132
|
updatedAt: z.coerce.date()
|
|
107
133
|
});
|
|
108
|
-
const
|
|
134
|
+
const CardTemplateListInputSchema = z.object({ notebaseId: z.uuid() });
|
|
135
|
+
const CardTemplateListOutputSchema = z.array(cardTemplateSchema);
|
|
136
|
+
const CardTemplateGetInputSchema = z.object({ id: z.uuid() });
|
|
137
|
+
const CardTemplateGetOutputSchema = cardTemplateSchema;
|
|
138
|
+
const CardTemplateCreateInputSchema = z.object({
|
|
109
139
|
id: z.uuid().optional(),
|
|
140
|
+
notebaseId: z.uuid(),
|
|
110
141
|
name: z.string().min(1),
|
|
111
|
-
config:
|
|
142
|
+
config: cardTemplateConfigSchema
|
|
112
143
|
}).strict();
|
|
113
|
-
const
|
|
144
|
+
const CardTemplateCreateOutputSchema = cardTemplateSchema.extend({ txid: z.number() });
|
|
145
|
+
const CardTemplateUpdateInputSchema = z.object({
|
|
146
|
+
id: z.uuid(),
|
|
114
147
|
name: z.string().min(1).optional(),
|
|
115
|
-
config:
|
|
116
|
-
width: columnWidthSchema.nullable().optional()
|
|
148
|
+
config: cardTemplateConfigSchema.optional()
|
|
117
149
|
}).strict();
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
150
|
+
const CardTemplateUpdateOutputSchema = cardTemplateSchema.extend({ txid: z.number() });
|
|
151
|
+
const CardTemplateDeleteInputSchema = z.object({ id: z.uuid() });
|
|
152
|
+
const CardTemplateDeleteOutputSchema = z.object({ txid: z.number() });
|
|
153
|
+
const cardSchema = z.object({
|
|
154
|
+
...cardIdentityShape,
|
|
155
|
+
...cardMemoryStateShape,
|
|
156
|
+
createdAt: z.coerce.date(),
|
|
157
|
+
updatedAt: z.coerce.date()
|
|
121
158
|
});
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
data: columnUpdateDataSchema
|
|
159
|
+
const renderedCardSchema = cardSchema.extend({
|
|
160
|
+
front: z.string(),
|
|
161
|
+
back: z.string()
|
|
126
162
|
});
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
163
|
+
const CardListInputSchema = z.object({
|
|
164
|
+
notebaseId: z.uuid(),
|
|
165
|
+
templateId: z.uuid().optional(),
|
|
166
|
+
limit: z.number().int().min(1).max(500).optional(),
|
|
167
|
+
offset: z.number().int().min(0).optional()
|
|
168
|
+
});
|
|
169
|
+
const CardListOutputSchema = z.array(renderedCardSchema);
|
|
170
|
+
const CardGetInputSchema = z.object({ id: z.uuid() });
|
|
171
|
+
const CardGetOutputSchema = renderedCardSchema;
|
|
172
|
+
const CardGenerateInputSchema = z.object({
|
|
173
|
+
notebaseId: z.uuid(),
|
|
174
|
+
templateId: z.uuid().optional()
|
|
175
|
+
});
|
|
176
|
+
const CardGenerateOutputSchema = z.object({
|
|
177
|
+
created: z.number().int().min(0),
|
|
178
|
+
txid: z.number()
|
|
133
179
|
});
|
|
134
|
-
const ColumnReorderOutputSchema = z.object({ txid: z.number() });
|
|
135
180
|
//#endregion
|
|
136
181
|
//#region src/contracts/shared.ts
|
|
137
182
|
const notebaseProcedure = oc.errors(pickPublicErrorMap("NOTEBASE_BETA_RESTRICTED"));
|
|
138
183
|
//#endregion
|
|
139
|
-
//#region src/contracts/
|
|
140
|
-
const
|
|
141
|
-
|
|
184
|
+
//#region src/contracts/card.ts
|
|
185
|
+
const cardContract = {
|
|
186
|
+
list: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
187
|
+
method: "GET",
|
|
188
|
+
path: "/cards",
|
|
189
|
+
summary: "List rendered cards",
|
|
190
|
+
tags: ["Cards"]
|
|
191
|
+
}).input(CardListInputSchema).output(CardListOutputSchema),
|
|
192
|
+
get: notebaseProcedure.errors(pickPublicErrorMap("CARD_NOT_FOUND")).route({
|
|
193
|
+
method: "GET",
|
|
194
|
+
path: "/cards/{id}",
|
|
195
|
+
summary: "Get rendered card",
|
|
196
|
+
tags: ["Cards"]
|
|
197
|
+
}).input(CardGetInputSchema).output(CardGetOutputSchema),
|
|
198
|
+
generate: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_NOT_FOUND")).route({
|
|
199
|
+
method: "POST",
|
|
200
|
+
path: "/cards/generate",
|
|
201
|
+
summary: "Generate missing cards",
|
|
202
|
+
tags: ["Cards"]
|
|
203
|
+
}).input(CardGenerateInputSchema).output(CardGenerateOutputSchema)
|
|
204
|
+
};
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/contracts/card-template.ts
|
|
207
|
+
const cardTemplateContract = {
|
|
208
|
+
list: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
209
|
+
method: "GET",
|
|
210
|
+
path: "/card-templates",
|
|
211
|
+
summary: "List card templates",
|
|
212
|
+
tags: ["Card Templates"]
|
|
213
|
+
}).input(CardTemplateListInputSchema).output(CardTemplateListOutputSchema),
|
|
214
|
+
get: notebaseProcedure.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND")).route({
|
|
215
|
+
method: "GET",
|
|
216
|
+
path: "/card-templates/{id}",
|
|
217
|
+
summary: "Get card template",
|
|
218
|
+
tags: ["Card Templates"]
|
|
219
|
+
}).input(CardTemplateGetInputSchema).output(CardTemplateGetOutputSchema),
|
|
220
|
+
create: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS")).route({
|
|
142
221
|
method: "POST",
|
|
143
|
-
path: "/
|
|
144
|
-
summary: "Create
|
|
145
|
-
tags: ["
|
|
146
|
-
}).input(
|
|
147
|
-
update: notebaseProcedure.errors(pickPublicErrorMap("
|
|
222
|
+
path: "/card-templates",
|
|
223
|
+
summary: "Create card template",
|
|
224
|
+
tags: ["Card Templates"]
|
|
225
|
+
}).input(CardTemplateCreateInputSchema).output(CardTemplateCreateOutputSchema),
|
|
226
|
+
update: notebaseProcedure.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS")).route({
|
|
148
227
|
method: "PATCH",
|
|
149
|
-
path: "/
|
|
150
|
-
summary: "Update
|
|
151
|
-
tags: ["
|
|
152
|
-
}).input(
|
|
153
|
-
delete: notebaseProcedure.errors(pickPublicErrorMap("
|
|
228
|
+
path: "/card-templates/{id}",
|
|
229
|
+
summary: "Update card template",
|
|
230
|
+
tags: ["Card Templates"]
|
|
231
|
+
}).input(CardTemplateUpdateInputSchema).output(CardTemplateUpdateOutputSchema),
|
|
232
|
+
delete: notebaseProcedure.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND")).route({
|
|
154
233
|
method: "DELETE",
|
|
155
|
-
path: "/
|
|
156
|
-
summary: "Delete
|
|
157
|
-
tags: ["
|
|
158
|
-
}).input(
|
|
159
|
-
reorder: notebaseProcedure.errors(pickPublicErrorMap("TABLE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
160
|
-
method: "POST",
|
|
161
|
-
path: "/columns/reorder",
|
|
162
|
-
summary: "Reorder columns in a table",
|
|
163
|
-
tags: ["Columns"]
|
|
164
|
-
}).input(ColumnReorderInputSchema).output(ColumnReorderOutputSchema)
|
|
234
|
+
path: "/card-templates/{id}",
|
|
235
|
+
summary: "Delete card template",
|
|
236
|
+
tags: ["Card Templates"]
|
|
237
|
+
}).input(CardTemplateDeleteInputSchema).output(CardTemplateDeleteOutputSchema)
|
|
165
238
|
};
|
|
166
239
|
//#endregion
|
|
167
|
-
//#region src/schemas/
|
|
168
|
-
const
|
|
169
|
-
const
|
|
240
|
+
//#region src/schemas/notebase-column.ts
|
|
241
|
+
const notebaseColumnWidthSchema = z.number().int().min(NOTEBASE_COLUMN_MIN_WIDTH).max(NOTEBASE_COLUMN_MAX_WIDTH);
|
|
242
|
+
const notebaseColumnSchema = z.object({
|
|
170
243
|
id: z.string(),
|
|
171
|
-
|
|
172
|
-
|
|
244
|
+
notebaseId: z.string(),
|
|
245
|
+
name: z.string(),
|
|
246
|
+
config: notebaseColumnConfigSchema,
|
|
173
247
|
position: z.number(),
|
|
248
|
+
isPrimary: z.boolean(),
|
|
249
|
+
width: z.number().nullable(),
|
|
174
250
|
createdAt: z.coerce.date(),
|
|
175
251
|
updatedAt: z.coerce.date()
|
|
176
252
|
});
|
|
177
|
-
const
|
|
253
|
+
const notebaseColumnCreateDataSchema = z.object({
|
|
178
254
|
id: z.uuid().optional(),
|
|
179
|
-
|
|
255
|
+
name: z.string().min(1),
|
|
256
|
+
config: notebaseColumnConfigSchema
|
|
257
|
+
}).strict();
|
|
258
|
+
const notebaseColumnUpdateDataSchema = z.object({
|
|
259
|
+
name: z.string().min(1).optional(),
|
|
260
|
+
config: notebaseColumnConfigSchema.optional(),
|
|
261
|
+
width: notebaseColumnWidthSchema.nullable().optional()
|
|
180
262
|
}).strict();
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
263
|
+
const NotebaseColumnCreateInputSchema = z.object({
|
|
264
|
+
notebaseId: z.uuid(),
|
|
265
|
+
data: notebaseColumnCreateDataSchema
|
|
266
|
+
});
|
|
267
|
+
const NotebaseColumnCreateOutputSchema = z.object({ txid: z.number() });
|
|
268
|
+
const NotebaseColumnUpdateInputSchema = z.object({
|
|
269
|
+
notebaseColumnId: z.uuid(),
|
|
270
|
+
data: notebaseColumnUpdateDataSchema
|
|
185
271
|
});
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
272
|
+
const NotebaseColumnUpdateOutputSchema = z.object({ txid: z.number() });
|
|
273
|
+
const NotebaseColumnDeleteInputSchema = z.object({ notebaseColumnId: z.uuid() });
|
|
274
|
+
const NotebaseColumnDeleteOutputSchema = z.object({ txid: z.number() });
|
|
275
|
+
const NotebaseColumnReorderInputSchema = z.object({
|
|
276
|
+
notebaseId: z.uuid(),
|
|
277
|
+
ids: z.array(z.uuid())
|
|
190
278
|
});
|
|
191
|
-
const
|
|
279
|
+
const NotebaseColumnReorderOutputSchema = z.object({ txid: z.number() });
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/schemas/notebase-row.ts
|
|
282
|
+
const notebaseRowCellsSchema = z.record(z.string(), z.unknown());
|
|
283
|
+
const notebaseRowSchema = z.object({
|
|
284
|
+
id: z.string(),
|
|
285
|
+
notebaseId: z.string(),
|
|
286
|
+
cells: notebaseRowCellsSchema,
|
|
287
|
+
position: z.number(),
|
|
288
|
+
createdAt: z.coerce.date(),
|
|
289
|
+
updatedAt: z.coerce.date()
|
|
290
|
+
});
|
|
291
|
+
const notebaseRowCreateDataSchema = z.object({
|
|
292
|
+
id: z.uuid().optional(),
|
|
293
|
+
cells: notebaseRowCellsSchema.optional()
|
|
294
|
+
}).strict();
|
|
295
|
+
const notebaseRowUpdateDataSchema = z.object({ cells: notebaseRowCellsSchema.optional() }).strict();
|
|
296
|
+
const NotebaseRowCreateInputSchema = z.object({
|
|
297
|
+
notebaseId: z.uuid(),
|
|
298
|
+
data: notebaseRowCreateDataSchema
|
|
299
|
+
});
|
|
300
|
+
const NotebaseRowCreateOutputSchema = z.object({ txid: z.number() });
|
|
301
|
+
const NotebaseRowUpdateInputSchema = z.object({
|
|
302
|
+
notebaseRowId: z.uuid(),
|
|
303
|
+
data: notebaseRowUpdateDataSchema
|
|
304
|
+
});
|
|
305
|
+
const NotebaseRowUpdateOutputSchema = z.object({
|
|
192
306
|
id: z.uuid(),
|
|
193
|
-
|
|
194
|
-
cells:
|
|
307
|
+
notebaseId: z.uuid(),
|
|
308
|
+
cells: notebaseRowCellsSchema,
|
|
195
309
|
position: z.number().int(),
|
|
196
310
|
createdAt: z.date(),
|
|
197
311
|
updatedAt: z.date(),
|
|
198
312
|
txid: z.number()
|
|
199
313
|
});
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
|
|
314
|
+
const NotebaseRowDeleteInputSchema = z.object({ notebaseRowId: z.uuid() });
|
|
315
|
+
const NotebaseRowDeleteOutputSchema = z.object({ txid: z.number() });
|
|
316
|
+
const NotebaseRowReorderInputSchema = z.object({
|
|
317
|
+
notebaseId: z.uuid(),
|
|
204
318
|
ids: z.array(z.uuid())
|
|
205
319
|
});
|
|
206
|
-
const
|
|
320
|
+
const NotebaseRowReorderOutputSchema = z.object({ txid: z.number() });
|
|
207
321
|
//#endregion
|
|
208
|
-
//#region src/schemas/view.ts
|
|
209
|
-
const
|
|
322
|
+
//#region src/schemas/notebase-view.ts
|
|
323
|
+
const notebaseViewTypeSchema = z.enum([
|
|
210
324
|
"table",
|
|
211
325
|
"kanban",
|
|
212
326
|
"gallery"
|
|
213
327
|
]);
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
328
|
+
const notebaseViewConfigSchema = z.object({
|
|
329
|
+
notebaseColumnWidths: z.record(z.string(), z.number()).optional(),
|
|
330
|
+
hiddenNotebaseColumns: z.array(z.string()).optional(),
|
|
331
|
+
groupByNotebaseColumnId: z.string().optional()
|
|
218
332
|
}).catchall(z.unknown());
|
|
219
|
-
const
|
|
220
|
-
|
|
333
|
+
const notebaseViewFilterSchema = z.object({
|
|
334
|
+
notebaseColumnId: z.string(),
|
|
221
335
|
operator: z.string(),
|
|
222
336
|
value: z.unknown()
|
|
223
337
|
}).strict();
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
|
|
338
|
+
const notebaseViewFiltersSchema = z.array(notebaseViewFilterSchema);
|
|
339
|
+
const notebaseViewSortSchema = z.object({
|
|
340
|
+
notebaseColumnId: z.string(),
|
|
227
341
|
direction: z.enum(["asc", "desc"])
|
|
228
342
|
}).strict();
|
|
229
|
-
const
|
|
230
|
-
const
|
|
343
|
+
const notebaseViewSortsSchema = z.array(notebaseViewSortSchema);
|
|
344
|
+
const notebaseViewCreateDataSchema = z.object({
|
|
231
345
|
id: z.uuid().optional(),
|
|
232
346
|
name: z.string().min(1),
|
|
233
|
-
type:
|
|
234
|
-
config:
|
|
235
|
-
filters:
|
|
236
|
-
sorts:
|
|
347
|
+
type: notebaseViewTypeSchema,
|
|
348
|
+
config: notebaseViewConfigSchema.optional(),
|
|
349
|
+
filters: notebaseViewFiltersSchema.optional(),
|
|
350
|
+
sorts: notebaseViewSortsSchema.optional()
|
|
237
351
|
}).strict();
|
|
238
|
-
const
|
|
352
|
+
const notebaseViewUpdateDataSchema = z.object({
|
|
239
353
|
name: z.string().min(1).optional(),
|
|
240
|
-
type:
|
|
241
|
-
config:
|
|
242
|
-
filters:
|
|
243
|
-
sorts:
|
|
354
|
+
type: notebaseViewTypeSchema.optional(),
|
|
355
|
+
config: notebaseViewConfigSchema.optional(),
|
|
356
|
+
filters: notebaseViewFiltersSchema.optional(),
|
|
357
|
+
sorts: notebaseViewSortsSchema.optional()
|
|
244
358
|
}).strict();
|
|
245
|
-
const
|
|
359
|
+
const notebaseViewSchema = z.object({
|
|
246
360
|
id: z.string(),
|
|
247
|
-
|
|
361
|
+
notebaseId: z.string(),
|
|
248
362
|
name: z.string(),
|
|
249
|
-
type:
|
|
250
|
-
config:
|
|
363
|
+
type: notebaseViewTypeSchema,
|
|
364
|
+
config: notebaseViewConfigSchema.nullable(),
|
|
251
365
|
filters: z.array(z.unknown()).nullable(),
|
|
252
366
|
sorts: z.array(z.unknown()).nullable(),
|
|
253
367
|
position: z.number(),
|
|
@@ -255,113 +369,283 @@ const tableViewSchema = z.object({
|
|
|
255
369
|
updatedAt: z.coerce.date()
|
|
256
370
|
});
|
|
257
371
|
//#endregion
|
|
258
|
-
//#region src/schemas/
|
|
259
|
-
const
|
|
260
|
-
const
|
|
372
|
+
//#region src/schemas/notebase.ts
|
|
373
|
+
const NotebaseListInputSchema = z.object({});
|
|
374
|
+
const NotebaseListItemSchema = z.object({
|
|
261
375
|
id: z.string(),
|
|
262
376
|
name: z.string()
|
|
263
377
|
});
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
id: z.uuid().optional(),
|
|
267
|
-
name: z.string().min(1)
|
|
268
|
-
}).strict();
|
|
269
|
-
const CustomTableCreateInputSchema = customTableCreateDataSchema;
|
|
270
|
-
const CustomTableCreateOutputSchema = z.object({ txid: z.number() });
|
|
271
|
-
const customTableUpdateDataSchema = z.object({ name: z.string().min(1).optional() }).strict();
|
|
272
|
-
const CustomTableUpdateInputSchema = customTableUpdateDataSchema.extend({ id: z.uuid() });
|
|
273
|
-
const CustomTableUpdateOutputSchema = z.object({ txid: z.number() });
|
|
274
|
-
const CustomTableDeleteInputSchema = z.object({ id: z.uuid() });
|
|
275
|
-
const CustomTableDeleteOutputSchema = z.object({ txid: z.number() });
|
|
276
|
-
const CustomTableGetInputSchema = z.object({ id: z.uuid() });
|
|
277
|
-
const CustomTableGetSchemaInputSchema = z.object({ id: z.uuid() });
|
|
278
|
-
const CustomTableGetOutputSchema = z.object({
|
|
378
|
+
const NotebaseListOutputSchema = z.array(NotebaseListItemSchema);
|
|
379
|
+
const notebaseSchema = z.object({
|
|
279
380
|
id: z.string(),
|
|
280
381
|
userId: z.string(),
|
|
281
382
|
name: z.string(),
|
|
383
|
+
srsNewPerDay: schedulingParamsShape.newPerDay,
|
|
384
|
+
srsReviewsPerDay: schedulingParamsShape.reviewsPerDay,
|
|
385
|
+
srsDesiredRetention: schedulingParamsShape.desiredRetention,
|
|
386
|
+
srsEnableShortTerm: schedulingParamsShape.enableShortTerm,
|
|
387
|
+
srsMaximumInterval: schedulingParamsShape.maximumInterval,
|
|
388
|
+
srsLearningSteps: schedulingParamsShape.learningSteps,
|
|
389
|
+
srsRelearningSteps: schedulingParamsShape.relearningSteps,
|
|
390
|
+
srsLeechThreshold: schedulingParamsShape.leechThreshold,
|
|
391
|
+
srsEnableFuzz: schedulingParamsShape.enableFuzz,
|
|
392
|
+
srsWeights: srsWeightsSchema.nullable(),
|
|
393
|
+
createdAt: z.date(),
|
|
394
|
+
updatedAt: z.date()
|
|
395
|
+
});
|
|
396
|
+
const notebaseCreateDataSchema = z.object({
|
|
397
|
+
id: z.uuid().optional(),
|
|
398
|
+
name: z.string().min(1)
|
|
399
|
+
}).strict();
|
|
400
|
+
const NotebaseCreateInputSchema = notebaseCreateDataSchema;
|
|
401
|
+
const NotebaseCreateOutputSchema = z.object({ txid: z.number() });
|
|
402
|
+
const notebaseUpdateDataSchema = z.object({ name: z.string().min(1).optional() }).strict();
|
|
403
|
+
const NotebaseUpdateInputSchema = notebaseUpdateDataSchema.extend({ id: z.uuid() });
|
|
404
|
+
const NotebaseUpdateOutputSchema = z.object({ txid: z.number() });
|
|
405
|
+
const NotebaseDeleteInputSchema = z.object({ id: z.uuid() });
|
|
406
|
+
const NotebaseDeleteOutputSchema = z.object({ txid: z.number() });
|
|
407
|
+
const NotebaseGetInputSchema = z.object({ id: z.uuid() });
|
|
408
|
+
const NotebaseGetSchemaInputSchema = z.object({ id: z.uuid() });
|
|
409
|
+
const NotebaseGetOutputSchema = notebaseSchema.extend({
|
|
282
410
|
createdAt: z.coerce.date(),
|
|
283
411
|
updatedAt: z.coerce.date(),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
412
|
+
notebaseColumns: z.array(notebaseColumnSchema),
|
|
413
|
+
notebaseRows: z.array(notebaseRowSchema),
|
|
414
|
+
notebaseViews: z.array(notebaseViewSchema)
|
|
287
415
|
});
|
|
288
|
-
const
|
|
416
|
+
const NotebaseGetSchemaOutputSchema = z.object({
|
|
289
417
|
id: z.string(),
|
|
290
418
|
name: z.string(),
|
|
291
419
|
updatedAt: z.coerce.date(),
|
|
292
|
-
|
|
420
|
+
notebaseColumns: z.array(notebaseColumnSchema)
|
|
293
421
|
});
|
|
294
422
|
//#endregion
|
|
423
|
+
//#region src/contracts/notebase.ts
|
|
424
|
+
const notebaseContract = {
|
|
425
|
+
list: notebaseProcedure.route({
|
|
426
|
+
method: "GET",
|
|
427
|
+
path: "/notebases",
|
|
428
|
+
summary: "List notebases",
|
|
429
|
+
tags: ["Notebases"]
|
|
430
|
+
}).input(NotebaseListInputSchema).output(NotebaseListOutputSchema),
|
|
431
|
+
get: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
432
|
+
method: "GET",
|
|
433
|
+
path: "/notebases/{id}",
|
|
434
|
+
summary: "Get notebase with notebase columns, rows, and views",
|
|
435
|
+
tags: ["Notebases"]
|
|
436
|
+
}).input(NotebaseGetInputSchema).output(NotebaseGetOutputSchema),
|
|
437
|
+
getSchema: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
438
|
+
method: "GET",
|
|
439
|
+
path: "/notebases/{id}/schema",
|
|
440
|
+
summary: "Get notebase schema",
|
|
441
|
+
tags: ["Notebases"]
|
|
442
|
+
}).input(NotebaseGetSchemaInputSchema).output(NotebaseGetSchemaOutputSchema),
|
|
443
|
+
create: notebaseProcedure.route({
|
|
444
|
+
method: "POST",
|
|
445
|
+
path: "/notebases",
|
|
446
|
+
summary: "Create notebase",
|
|
447
|
+
tags: ["Notebases"]
|
|
448
|
+
}).input(NotebaseCreateInputSchema).output(NotebaseCreateOutputSchema),
|
|
449
|
+
update: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
450
|
+
method: "PUT",
|
|
451
|
+
path: "/notebases/{id}",
|
|
452
|
+
summary: "Update notebase",
|
|
453
|
+
tags: ["Notebases"]
|
|
454
|
+
}).input(NotebaseUpdateInputSchema).output(NotebaseUpdateOutputSchema),
|
|
455
|
+
delete: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
456
|
+
method: "DELETE",
|
|
457
|
+
path: "/notebases/{id}",
|
|
458
|
+
summary: "Delete notebase",
|
|
459
|
+
tags: ["Notebases"]
|
|
460
|
+
}).input(NotebaseDeleteInputSchema).output(NotebaseDeleteOutputSchema)
|
|
461
|
+
};
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/contracts/notebase-column.ts
|
|
464
|
+
const notebaseColumnContract = {
|
|
465
|
+
create: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
466
|
+
method: "POST",
|
|
467
|
+
path: "/notebase-columns",
|
|
468
|
+
summary: "Create notebase column",
|
|
469
|
+
tags: ["Notebase Columns"]
|
|
470
|
+
}).input(NotebaseColumnCreateInputSchema).output(NotebaseColumnCreateOutputSchema),
|
|
471
|
+
update: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_COLUMN_NOT_FOUND")).route({
|
|
472
|
+
method: "PATCH",
|
|
473
|
+
path: "/notebase-columns/{notebaseColumnId}",
|
|
474
|
+
summary: "Update notebase column",
|
|
475
|
+
tags: ["Notebase Columns"]
|
|
476
|
+
}).input(NotebaseColumnUpdateInputSchema).output(NotebaseColumnUpdateOutputSchema),
|
|
477
|
+
delete: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_COLUMN_NOT_FOUND", "PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED", "CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
478
|
+
method: "DELETE",
|
|
479
|
+
path: "/notebase-columns/{notebaseColumnId}",
|
|
480
|
+
summary: "Delete notebase column",
|
|
481
|
+
tags: ["Notebase Columns"]
|
|
482
|
+
}).input(NotebaseColumnDeleteInputSchema).output(NotebaseColumnDeleteOutputSchema),
|
|
483
|
+
reorder: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
484
|
+
method: "POST",
|
|
485
|
+
path: "/notebase-columns/reorder",
|
|
486
|
+
summary: "Reorder notebase columns",
|
|
487
|
+
tags: ["Notebase Columns"]
|
|
488
|
+
}).input(NotebaseColumnReorderInputSchema).output(NotebaseColumnReorderOutputSchema)
|
|
489
|
+
};
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/contracts/notebase-row.ts
|
|
492
|
+
const notebaseRowContract = {
|
|
493
|
+
create: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CELL_VALIDATION_FAILED", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
494
|
+
method: "POST",
|
|
495
|
+
path: "/notebase-rows",
|
|
496
|
+
summary: "Create notebase row",
|
|
497
|
+
tags: ["Notebase Rows"]
|
|
498
|
+
}).input(NotebaseRowCreateInputSchema).output(NotebaseRowCreateOutputSchema),
|
|
499
|
+
update: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CELL_VALIDATION_FAILED")).route({
|
|
500
|
+
method: "PATCH",
|
|
501
|
+
path: "/notebase-rows/{notebaseRowId}",
|
|
502
|
+
summary: "Update notebase row cells",
|
|
503
|
+
tags: ["Notebase Rows"]
|
|
504
|
+
}).input(NotebaseRowUpdateInputSchema).output(NotebaseRowUpdateOutputSchema),
|
|
505
|
+
delete: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
506
|
+
method: "DELETE",
|
|
507
|
+
path: "/notebase-rows/{notebaseRowId}",
|
|
508
|
+
summary: "Delete notebase row",
|
|
509
|
+
tags: ["Notebase Rows"]
|
|
510
|
+
}).input(NotebaseRowDeleteInputSchema).output(NotebaseRowDeleteOutputSchema),
|
|
511
|
+
reorder: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
512
|
+
method: "POST",
|
|
513
|
+
path: "/notebase-rows/reorder",
|
|
514
|
+
summary: "Reorder notebase rows",
|
|
515
|
+
tags: ["Notebase Rows"]
|
|
516
|
+
}).input(NotebaseRowReorderInputSchema).output(NotebaseRowReorderOutputSchema)
|
|
517
|
+
};
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/schemas/timezone.ts
|
|
520
|
+
const localeTimeZoneFormatter = /* @__PURE__ */ new Map();
|
|
521
|
+
function createTimezoneFormatter(timezone) {
|
|
522
|
+
let formatter = localeTimeZoneFormatter.get(timezone);
|
|
523
|
+
if (!formatter) {
|
|
524
|
+
formatter = new Intl.DateTimeFormat("en-US", { timeZone: timezone });
|
|
525
|
+
localeTimeZoneFormatter.set(timezone, formatter);
|
|
526
|
+
}
|
|
527
|
+
return formatter;
|
|
528
|
+
}
|
|
529
|
+
const timezoneSchema = z.string().trim().min(1).refine((timezone) => {
|
|
530
|
+
try {
|
|
531
|
+
createTimezoneFormatter(timezone).format(/* @__PURE__ */ new Date());
|
|
532
|
+
return true;
|
|
533
|
+
} catch {
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
}, "Invalid timezone");
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region src/schemas/srs.ts
|
|
539
|
+
const stepSchema = srsStepSchema;
|
|
540
|
+
const SRS_REVIEW_CLIENT_ID_NAMESPACE = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
541
|
+
const srsReviewClientIdNamePrefix = "readfrog:srs-review";
|
|
542
|
+
const nullLastReviewTimeSentinel = "null";
|
|
543
|
+
async function createSrsReviewClientId(card) {
|
|
544
|
+
return uuidV5(`${srsReviewClientIdNamePrefix}:${card.id}:${formatLastReviewTime(card.lastReviewTime)}`, SRS_REVIEW_CLIENT_ID_NAMESPACE);
|
|
545
|
+
}
|
|
546
|
+
const srsReviewInputSchema = z.object({
|
|
547
|
+
cardId: z.uuid(),
|
|
548
|
+
id: z.uuid().optional(),
|
|
549
|
+
rating: reviewRatingSchema,
|
|
550
|
+
durationMs: z.number().int().min(0).max(SRS_REVIEW_DURATION_MS_MAX),
|
|
551
|
+
timezone: timezoneSchema
|
|
552
|
+
}).strict();
|
|
553
|
+
const srsRollbackReviewInputSchema = z.object({ cardId: z.uuid() }).strict();
|
|
554
|
+
const srsRevlogSchema = z.object({
|
|
555
|
+
id: z.uuid(),
|
|
556
|
+
notebaseId: z.uuid(),
|
|
557
|
+
cardId: z.uuid(),
|
|
558
|
+
rating: reviewRatingSchema,
|
|
559
|
+
state: cardStateSchema$1,
|
|
560
|
+
afterScheduleStatus: scheduleStatusSchema$1,
|
|
561
|
+
reviewedAt: z.coerce.date(),
|
|
562
|
+
durationMs: z.number().int(),
|
|
563
|
+
fsrsReviewLogSnapshot: fsrsReviewLogSnapshotSchema,
|
|
564
|
+
createdAt: z.coerce.date()
|
|
565
|
+
});
|
|
566
|
+
const srsReviewOutputSchema = z.object({
|
|
567
|
+
card: cardSchema,
|
|
568
|
+
revlog: srsRevlogSchema,
|
|
569
|
+
txid: z.number()
|
|
570
|
+
});
|
|
571
|
+
const srsRollbackReviewOutputSchema = z.object({
|
|
572
|
+
card: cardSchema,
|
|
573
|
+
rolledBackRevlogId: z.uuid(),
|
|
574
|
+
txid: z.number()
|
|
575
|
+
});
|
|
576
|
+
function formatLastReviewTime(lastReviewTime) {
|
|
577
|
+
return lastReviewTime ? new Date(lastReviewTime).toISOString() : nullLastReviewTimeSentinel;
|
|
578
|
+
}
|
|
579
|
+
async function uuidV5(name, namespace) {
|
|
580
|
+
const namespaceBytes = uuidToBytes(namespace);
|
|
581
|
+
const nameBytes = new TextEncoder().encode(name);
|
|
582
|
+
const input = new Uint8Array(namespaceBytes.length + nameBytes.length);
|
|
583
|
+
input.set(namespaceBytes);
|
|
584
|
+
input.set(nameBytes, namespaceBytes.length);
|
|
585
|
+
const bytes = new Uint8Array(await crypto.subtle.digest("SHA-1", input)).slice(0, 16);
|
|
586
|
+
const versionByte = bytes[6];
|
|
587
|
+
const variantByte = bytes[8];
|
|
588
|
+
if (versionByte === void 0 || variantByte === void 0) throw new Error("SHA-1 digest was too short");
|
|
589
|
+
bytes[6] = versionByte & 15 | 80;
|
|
590
|
+
bytes[8] = variantByte & 63 | 128;
|
|
591
|
+
return bytesToUuid(bytes);
|
|
592
|
+
}
|
|
593
|
+
function uuidToBytes(uuid) {
|
|
594
|
+
const hex = uuid.replaceAll("-", "").toLowerCase();
|
|
595
|
+
if (!/^[0-9a-f]{32}$/.test(hex)) throw new Error("Invalid UUID namespace");
|
|
596
|
+
return new Uint8Array(Array.from({ length: 16 }, (_, index) => Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16)));
|
|
597
|
+
}
|
|
598
|
+
function bytesToUuid(bytes) {
|
|
599
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
|
|
600
|
+
return [
|
|
601
|
+
hex.slice(0, 4).join(""),
|
|
602
|
+
hex.slice(4, 6).join(""),
|
|
603
|
+
hex.slice(6, 8).join(""),
|
|
604
|
+
hex.slice(8, 10).join(""),
|
|
605
|
+
hex.slice(10, 16).join("")
|
|
606
|
+
].join("-");
|
|
607
|
+
}
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region src/contracts/srs.ts
|
|
610
|
+
const srsContract = {
|
|
611
|
+
review: notebaseProcedure.errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_NOT_REVIEWABLE", "CARD_REVIEW_STATE_STALE")).route({
|
|
612
|
+
method: "POST",
|
|
613
|
+
path: "/srs/review",
|
|
614
|
+
summary: "Review a card with SRS scheduling",
|
|
615
|
+
tags: ["SRS"]
|
|
616
|
+
}).input(srsReviewInputSchema).output(srsReviewOutputSchema),
|
|
617
|
+
rollbackReview: notebaseProcedure.errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_REVIEW_ROLLBACK_UNAVAILABLE")).route({
|
|
618
|
+
method: "POST",
|
|
619
|
+
path: "/srs/review/rollback",
|
|
620
|
+
summary: "Roll back the latest SRS review for a card",
|
|
621
|
+
tags: ["SRS"]
|
|
622
|
+
}).input(srsRollbackReviewInputSchema).output(srsRollbackReviewOutputSchema)
|
|
623
|
+
};
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region src/schemas/user.ts
|
|
626
|
+
const userEnsureTimezoneInputSchema = z.object({ timezone: timezoneSchema }).strict();
|
|
627
|
+
const userEnsureTimezoneOutputSchema = z.object({
|
|
628
|
+
timezone: timezoneSchema,
|
|
629
|
+
updated: z.boolean()
|
|
630
|
+
}).strict();
|
|
631
|
+
//#endregion
|
|
295
632
|
//#region src/index.ts
|
|
296
633
|
const contract = {
|
|
297
634
|
betaAccess: betaAccessContract,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}).input(CustomTableGetInputSchema).output(CustomTableGetOutputSchema),
|
|
311
|
-
getSchema: notebaseProcedure.errors(pickPublicErrorMap("TABLE_NOT_FOUND")).route({
|
|
312
|
-
method: "GET",
|
|
313
|
-
path: "/custom-tables/{id}/schema",
|
|
314
|
-
summary: "Get custom table schema",
|
|
315
|
-
tags: ["Custom Tables"]
|
|
316
|
-
}).input(CustomTableGetSchemaInputSchema).output(CustomTableGetSchemaOutputSchema),
|
|
317
|
-
create: notebaseProcedure.route({
|
|
318
|
-
method: "POST",
|
|
319
|
-
path: "/custom-tables",
|
|
320
|
-
summary: "Create custom table",
|
|
321
|
-
tags: ["Custom Tables"]
|
|
322
|
-
}).input(CustomTableCreateInputSchema).output(CustomTableCreateOutputSchema),
|
|
323
|
-
update: notebaseProcedure.errors(pickPublicErrorMap("TABLE_NOT_FOUND")).route({
|
|
324
|
-
method: "PUT",
|
|
325
|
-
path: "/custom-tables/{id}",
|
|
326
|
-
summary: "Update custom table",
|
|
327
|
-
tags: ["Custom Tables"]
|
|
328
|
-
}).input(CustomTableUpdateInputSchema).output(CustomTableUpdateOutputSchema),
|
|
329
|
-
delete: notebaseProcedure.errors(pickPublicErrorMap("TABLE_NOT_FOUND")).route({
|
|
330
|
-
method: "DELETE",
|
|
331
|
-
path: "/custom-tables/{id}",
|
|
332
|
-
summary: "Delete custom table",
|
|
333
|
-
tags: ["Custom Tables"]
|
|
334
|
-
}).input(CustomTableDeleteInputSchema).output(CustomTableDeleteOutputSchema)
|
|
335
|
-
},
|
|
336
|
-
column: columnContract,
|
|
337
|
-
row: {
|
|
338
|
-
create: notebaseProcedure.errors(pickPublicErrorMap("TABLE_NOT_FOUND", "CELL_VALIDATION_FAILED", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
339
|
-
method: "POST",
|
|
340
|
-
path: "/rows",
|
|
341
|
-
summary: "Create row",
|
|
342
|
-
tags: ["Rows"]
|
|
343
|
-
}).input(RowCreateInputSchema).output(RowCreateOutputSchema),
|
|
344
|
-
update: notebaseProcedure.errors(pickPublicErrorMap("ROW_NOT_FOUND", "CELL_VALIDATION_FAILED")).route({
|
|
345
|
-
method: "PATCH",
|
|
346
|
-
path: "/rows/{rowId}",
|
|
347
|
-
summary: "Update row cells",
|
|
348
|
-
tags: ["Rows"]
|
|
349
|
-
}).input(RowUpdateInputSchema).output(RowUpdateOutputSchema),
|
|
350
|
-
delete: notebaseProcedure.errors(pickPublicErrorMap("ROW_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
351
|
-
method: "DELETE",
|
|
352
|
-
path: "/rows/{rowId}",
|
|
353
|
-
summary: "Delete row",
|
|
354
|
-
tags: ["Rows"]
|
|
355
|
-
}).input(RowDeleteInputSchema).output(RowDeleteOutputSchema),
|
|
356
|
-
reorder: notebaseProcedure.errors(pickPublicErrorMap("TABLE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
357
|
-
method: "POST",
|
|
358
|
-
path: "/rows/reorder",
|
|
359
|
-
summary: "Reorder rows in a table",
|
|
360
|
-
tags: ["Rows"]
|
|
361
|
-
}).input(RowReorderInputSchema).output(RowReorderOutputSchema)
|
|
362
|
-
}
|
|
635
|
+
card: cardContract,
|
|
636
|
+
cardTemplate: cardTemplateContract,
|
|
637
|
+
notebase: notebaseContract,
|
|
638
|
+
notebaseColumn: notebaseColumnContract,
|
|
639
|
+
notebaseRow: notebaseRowContract,
|
|
640
|
+
srs: srsContract,
|
|
641
|
+
user: { ensureTimezone: oc.route({
|
|
642
|
+
method: "POST",
|
|
643
|
+
path: "/users/me/timezone/ensure",
|
|
644
|
+
summary: "Ensure the authenticated user has a timezone",
|
|
645
|
+
tags: ["Users"]
|
|
646
|
+
}).input(userEnsureTimezoneInputSchema).output(userEnsureTimezoneOutputSchema) }
|
|
363
647
|
};
|
|
364
648
|
//#endregion
|
|
365
|
-
export { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema, BetaFeatureKeySchema, CellValidationFailedDataSchema, CellValidationFailureDetailsSchema, CellValidationFailureReasonSchema,
|
|
649
|
+
export { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema, BetaFeatureKeySchema, CardGenerateInputSchema, CardGenerateOutputSchema, CardGetInputSchema, CardGetOutputSchema, CardListInputSchema, CardListOutputSchema, CardTemplateCreateInputSchema, CardTemplateCreateOutputSchema, CardTemplateDeleteInputSchema, CardTemplateDeleteOutputSchema, CardTemplateGetInputSchema, CardTemplateGetOutputSchema, CardTemplateInvalidColumnsDataSchema, CardTemplateListInputSchema, CardTemplateListOutputSchema, CardTemplateUpdateInputSchema, CardTemplateUpdateOutputSchema, CellValidationFailedDataSchema, CellValidationFailureDetailsSchema, CellValidationFailureReasonSchema, NotebaseColumnCreateInputSchema, NotebaseColumnCreateOutputSchema, NotebaseColumnDeleteInputSchema, NotebaseColumnDeleteOutputSchema, NotebaseColumnReorderInputSchema, NotebaseColumnReorderOutputSchema, NotebaseColumnUpdateInputSchema, NotebaseColumnUpdateOutputSchema, NotebaseCreateInputSchema, NotebaseCreateOutputSchema, NotebaseDeleteInputSchema, NotebaseDeleteOutputSchema, NotebaseGetInputSchema, NotebaseGetOutputSchema, NotebaseGetSchemaInputSchema, NotebaseGetSchemaOutputSchema, NotebaseListInputSchema, NotebaseListItemSchema, NotebaseListOutputSchema, NotebaseRowCreateInputSchema, NotebaseRowCreateOutputSchema, NotebaseRowDeleteInputSchema, NotebaseRowDeleteOutputSchema, NotebaseRowReorderInputSchema, NotebaseRowReorderOutputSchema, NotebaseRowUpdateInputSchema, NotebaseRowUpdateOutputSchema, NotebaseUpdateInputSchema, NotebaseUpdateOutputSchema, PUBLIC_APP_ERROR_DEFS, SRS_REVIEW_CLIENT_ID_NAMESPACE, SRS_REVIEW_DURATION_MS_MAX, cardSchema, cardStateSchema, cardTemplateSchema, contract, createSrsReviewClientId, getPublicErrorDefinition, isPublicAppErrorCode, notebaseColumnCreateDataSchema, notebaseColumnSchema, notebaseColumnUpdateDataSchema, notebaseColumnWidthSchema, notebaseCreateDataSchema, notebaseRowCellsSchema, notebaseRowCreateDataSchema, notebaseRowSchema, notebaseRowUpdateDataSchema, notebaseSchema, notebaseUpdateDataSchema, notebaseViewConfigSchema, notebaseViewCreateDataSchema, notebaseViewFilterSchema, notebaseViewFiltersSchema, notebaseViewSchema, notebaseViewSortSchema, notebaseViewSortsSchema, notebaseViewTypeSchema, notebaseViewUpdateDataSchema, pickPublicErrorMap, renderedCardSchema, reviewRatingSchema, scheduleStatusSchema, schedulingParamsSchema, srsReviewInputSchema, srsReviewOutputSchema, srsRevlogSchema, srsRollbackReviewInputSchema, srsRollbackReviewOutputSchema, stepSchema, timezoneSchema, userEnsureTimezoneInputSchema, userEnsureTimezoneOutputSchema };
|
|
366
650
|
|
|
367
651
|
//# sourceMappingURL=index.js.map
|