@devpad/api 2.2.9 → 2.2.12
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 +37 -42
- package/dist/chunk-5L3AUVMM.js +261 -0
- package/dist/{chunk-NQZIDUBQ.js → chunk-BMT7GORG.js} +18 -3
- package/dist/{chunk-TEOIDOOX.js → chunk-DIX4XVUQ.js} +48 -11
- package/dist/index.d.ts +92 -49
- package/dist/index.js +412 -294
- package/dist/schema/blog.js +44 -231
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/media.js +9 -2
- package/dist/{types.d-BvfRohlZ.d.ts → types.d-yIorr_SU.d.ts} +1 -1
- package/package.json +44 -46
package/README.md
CHANGED
|
@@ -14,8 +14,8 @@ bun add @devpad/api
|
|
|
14
14
|
import ApiClient from "@devpad/api";
|
|
15
15
|
|
|
16
16
|
const client = new ApiClient({
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
base_url: "https://devpad.tools/api/v1",
|
|
18
|
+
api_key: "your-api-key",
|
|
19
19
|
});
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -31,8 +31,8 @@ import ApiClient, { type ApiResult } from "@devpad/api";
|
|
|
31
31
|
const result = await client.projects.list();
|
|
32
32
|
|
|
33
33
|
if (!result.ok) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
console.error(result.error.message, result.error.status_code);
|
|
35
|
+
return;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const projects = result.value;
|
|
@@ -45,18 +45,18 @@ The `ok()` and `err()` constructors are re-exported for building your own Result
|
|
|
45
45
|
### Projects
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
48
|
-
client.projects.list()
|
|
49
|
-
client.projects.find(id)
|
|
50
|
-
client.projects.getByName(name)
|
|
51
|
-
client.projects.create(data)
|
|
52
|
-
client.projects.upsert(data)
|
|
53
|
-
client.projects.config.load(id)
|
|
54
|
-
client.projects.config.save(id, config)
|
|
55
|
-
client.projects.history(id)
|
|
56
|
-
client.projects.specification(id)
|
|
57
|
-
client.projects.scan.initiate(name)
|
|
58
|
-
client.projects.scan.updates(id)
|
|
59
|
-
client.projects.map()
|
|
48
|
+
client.projects.list();
|
|
49
|
+
client.projects.find(id);
|
|
50
|
+
client.projects.getByName(name);
|
|
51
|
+
client.projects.create(data);
|
|
52
|
+
client.projects.upsert(data);
|
|
53
|
+
client.projects.config.load(id);
|
|
54
|
+
client.projects.config.save(id, config);
|
|
55
|
+
client.projects.history(id);
|
|
56
|
+
client.projects.specification(id);
|
|
57
|
+
client.projects.scan.initiate(name);
|
|
58
|
+
client.projects.scan.updates(id);
|
|
59
|
+
client.projects.map();
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
### Tasks
|
|
@@ -86,43 +86,43 @@ client.milestones.goals(id)
|
|
|
86
86
|
### Goals
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
|
-
client.goals.list()
|
|
90
|
-
client.goals.find(id)
|
|
91
|
-
client.goals.create(data)
|
|
92
|
-
client.goals.update(id, data)
|
|
93
|
-
client.goals.delete(id)
|
|
89
|
+
client.goals.list();
|
|
90
|
+
client.goals.find(id);
|
|
91
|
+
client.goals.create(data);
|
|
92
|
+
client.goals.update(id, data);
|
|
93
|
+
client.goals.delete(id);
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
### Tags
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
|
-
client.tags.list()
|
|
100
|
-
client.tags.save(tags)
|
|
99
|
+
client.tags.list();
|
|
100
|
+
client.tags.save(tags);
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
### Auth
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
|
-
client.auth.keys.list()
|
|
107
|
-
client.auth.keys.create(data)
|
|
108
|
-
client.auth.keys.update(id, data)
|
|
109
|
-
client.auth.keys.delete(id)
|
|
110
|
-
client.auth.user()
|
|
111
|
-
client.auth.login(code)
|
|
112
|
-
client.auth.loginUrl()
|
|
106
|
+
client.auth.keys.list();
|
|
107
|
+
client.auth.keys.create(data);
|
|
108
|
+
client.auth.keys.update(id, data);
|
|
109
|
+
client.auth.keys.delete(id);
|
|
110
|
+
client.auth.user();
|
|
111
|
+
client.auth.login(code);
|
|
112
|
+
client.auth.loginUrl();
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
### User
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
|
-
client.user.history()
|
|
118
|
+
client.user.history();
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
### GitHub
|
|
122
122
|
|
|
123
123
|
```typescript
|
|
124
|
-
client.github.repos()
|
|
125
|
-
client.github.branches(owner, repo)
|
|
124
|
+
client.github.repos();
|
|
125
|
+
client.github.branches(owner, repo);
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
Blog and media namespaces also exist but are documented separately.
|
|
@@ -131,18 +131,13 @@ Blog and media namespaces also exist but are documented separately.
|
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
133
|
import ApiClient, {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
type ApiResult,
|
|
135
|
+
type ApiResultError,
|
|
136
|
+
type AuthMode, // "session" | "key" | "cookie"
|
|
137
137
|
} from "@devpad/api";
|
|
138
138
|
|
|
139
139
|
// Schema types re-exported for convenience
|
|
140
|
-
import type {
|
|
141
|
-
Project,
|
|
142
|
-
TaskWithDetails,
|
|
143
|
-
UpsertProject,
|
|
144
|
-
UpsertTodo,
|
|
145
|
-
} from "@devpad/api";
|
|
140
|
+
import type { Project, TaskWithDetails, UpsertProject, UpsertTodo } from "@devpad/api";
|
|
146
141
|
```
|
|
147
142
|
|
|
148
143
|
Result utilities `ok` and `err` are also exported from the main entry point.
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// ../schema/dist/blog/corpus.js
|
|
2
|
+
import { define_store, json_codec } from "@f0rbit/corpus";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
var PostContentSchema = z.object({
|
|
5
|
+
title: z.string().min(1),
|
|
6
|
+
content: z.string(),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
format: z.enum(["md", "adoc"])
|
|
9
|
+
});
|
|
10
|
+
var postsStoreDefinition = define_store("posts", json_codec(PostContentSchema));
|
|
11
|
+
var postStoreId = (userId, postUuid) => `posts/${userId}/${postUuid}`;
|
|
12
|
+
var corpusPath = postStoreId;
|
|
13
|
+
var VersionInfoSchema = z.object({
|
|
14
|
+
hash: z.string(),
|
|
15
|
+
parent: z.string().nullable(),
|
|
16
|
+
created_at: z.date()
|
|
17
|
+
});
|
|
18
|
+
var hasCause = (value) => typeof value === "object" && value !== null && "cause" in value;
|
|
19
|
+
var mapCorpusError = (e) => {
|
|
20
|
+
if (e.kind === "not_found") {
|
|
21
|
+
return { kind: "not_found", path: e.store_id, version: e.version };
|
|
22
|
+
}
|
|
23
|
+
if (e.kind === "decode_error" || e.kind === "validation_error") {
|
|
24
|
+
return { kind: "invalid_content", message: e.cause.message };
|
|
25
|
+
}
|
|
26
|
+
if (e.kind === "storage_error") {
|
|
27
|
+
const drizzle_err = e.cause;
|
|
28
|
+
const underlying = hasCause(drizzle_err) ? drizzle_err.cause : void 0;
|
|
29
|
+
const message = underlying instanceof Error ? underlying.message : drizzle_err.message;
|
|
30
|
+
return { kind: "io_error", message };
|
|
31
|
+
}
|
|
32
|
+
return { kind: "io_error", message: "Unknown corpus error" };
|
|
33
|
+
};
|
|
34
|
+
var parsePostContent = PostContentSchema.parse.bind(PostContentSchema);
|
|
35
|
+
var serializePostContent = (content) => JSON.stringify(content);
|
|
36
|
+
|
|
37
|
+
// ../schema/dist/blog/corpus-shim.js
|
|
38
|
+
import { at, fetch_result, first, format_error, last, match, pipe, to_fallback, to_nullable, try_catch, try_catch_async, unwrap_or } from "@f0rbit/corpus";
|
|
39
|
+
|
|
40
|
+
// ../schema/dist/blog/types.js
|
|
41
|
+
import { z as z2 } from "zod";
|
|
42
|
+
import { at as at2, err, fetch_result as fetch_result2, first as first2, format_error as format_error2, last as last2, match as match2, ok, pipe as pipe2, to_fallback as to_fallback2, to_nullable as to_nullable2, try_catch as try_catch2, try_catch_async as try_catch_async2, unwrap_or as unwrap_or2 } from "@f0rbit/corpus";
|
|
43
|
+
var PostRowSchema = z2.object({
|
|
44
|
+
id: z2.number(),
|
|
45
|
+
uuid: z2.string(),
|
|
46
|
+
author_id: z2.string(),
|
|
47
|
+
slug: z2.string(),
|
|
48
|
+
corpus_version: z2.string().nullable(),
|
|
49
|
+
category: z2.string(),
|
|
50
|
+
archived: z2.boolean(),
|
|
51
|
+
publish_at: z2.coerce.date().nullable(),
|
|
52
|
+
created_at: z2.coerce.date(),
|
|
53
|
+
updated_at: z2.coerce.date()
|
|
54
|
+
});
|
|
55
|
+
var PostRowInsertSchema = z2.object({
|
|
56
|
+
id: z2.number().optional(),
|
|
57
|
+
uuid: z2.string(),
|
|
58
|
+
author_id: z2.string(),
|
|
59
|
+
slug: z2.string(),
|
|
60
|
+
corpus_version: z2.string().nullable().optional(),
|
|
61
|
+
category: z2.string().optional(),
|
|
62
|
+
archived: z2.boolean().optional(),
|
|
63
|
+
publish_at: z2.coerce.date().nullable().optional(),
|
|
64
|
+
created_at: z2.coerce.date().optional(),
|
|
65
|
+
updated_at: z2.coerce.date().optional()
|
|
66
|
+
});
|
|
67
|
+
var CategorySchema = z2.object({
|
|
68
|
+
id: z2.number(),
|
|
69
|
+
owner_id: z2.string(),
|
|
70
|
+
name: z2.string(),
|
|
71
|
+
parent: z2.string().nullable()
|
|
72
|
+
});
|
|
73
|
+
var CategoryInsertSchema = z2.object({
|
|
74
|
+
id: z2.number().optional(),
|
|
75
|
+
owner_id: z2.string(),
|
|
76
|
+
name: z2.string(),
|
|
77
|
+
parent: z2.string().nullable().optional()
|
|
78
|
+
});
|
|
79
|
+
var TagSchema = z2.object({
|
|
80
|
+
post_id: z2.number(),
|
|
81
|
+
tag: z2.string()
|
|
82
|
+
});
|
|
83
|
+
var TagInsertSchema = z2.object({
|
|
84
|
+
post_id: z2.number(),
|
|
85
|
+
tag: z2.string()
|
|
86
|
+
});
|
|
87
|
+
var AccessKeyRowSchema = z2.object({
|
|
88
|
+
id: z2.number(),
|
|
89
|
+
user_id: z2.string(),
|
|
90
|
+
key_hash: z2.string(),
|
|
91
|
+
name: z2.string(),
|
|
92
|
+
note: z2.string().nullable(),
|
|
93
|
+
enabled: z2.boolean(),
|
|
94
|
+
created_at: z2.coerce.date()
|
|
95
|
+
});
|
|
96
|
+
var AccessKeySchema = AccessKeyRowSchema.omit({ key_hash: true });
|
|
97
|
+
var AccessKeyInsertSchema = z2.object({
|
|
98
|
+
id: z2.number().optional(),
|
|
99
|
+
user_id: z2.string(),
|
|
100
|
+
key_hash: z2.string(),
|
|
101
|
+
name: z2.string(),
|
|
102
|
+
note: z2.string().nullable().optional(),
|
|
103
|
+
enabled: z2.boolean().optional(),
|
|
104
|
+
created_at: z2.coerce.date().optional()
|
|
105
|
+
});
|
|
106
|
+
var IntegrationSchema = z2.object({
|
|
107
|
+
id: z2.number(),
|
|
108
|
+
user_id: z2.string(),
|
|
109
|
+
source: z2.string(),
|
|
110
|
+
location: z2.string(),
|
|
111
|
+
data: z2.record(z2.unknown()).nullable(),
|
|
112
|
+
last_fetch: z2.coerce.date().nullable(),
|
|
113
|
+
status: z2.string().nullable(),
|
|
114
|
+
created_at: z2.coerce.date()
|
|
115
|
+
});
|
|
116
|
+
var IntegrationInsertSchema = z2.object({
|
|
117
|
+
id: z2.number().optional(),
|
|
118
|
+
user_id: z2.string(),
|
|
119
|
+
source: z2.string(),
|
|
120
|
+
location: z2.string(),
|
|
121
|
+
data: z2.record(z2.unknown()).nullable().optional(),
|
|
122
|
+
last_fetch: z2.coerce.date().nullable().optional(),
|
|
123
|
+
status: z2.string().nullable().optional(),
|
|
124
|
+
created_at: z2.coerce.date().optional()
|
|
125
|
+
});
|
|
126
|
+
var FetchLinkSchema = z2.object({
|
|
127
|
+
id: z2.number(),
|
|
128
|
+
post_id: z2.number(),
|
|
129
|
+
integration_id: z2.number(),
|
|
130
|
+
identifier: z2.string()
|
|
131
|
+
});
|
|
132
|
+
var FetchLinkInsertSchema = z2.object({
|
|
133
|
+
id: z2.number().optional(),
|
|
134
|
+
post_id: z2.number(),
|
|
135
|
+
integration_id: z2.number(),
|
|
136
|
+
identifier: z2.string()
|
|
137
|
+
});
|
|
138
|
+
var PostSchema = z2.object({
|
|
139
|
+
id: z2.number(),
|
|
140
|
+
uuid: z2.string().uuid(),
|
|
141
|
+
author_id: z2.string(),
|
|
142
|
+
slug: z2.string(),
|
|
143
|
+
title: z2.string(),
|
|
144
|
+
content: z2.string(),
|
|
145
|
+
description: z2.string().optional(),
|
|
146
|
+
format: z2.enum(["md", "adoc"]),
|
|
147
|
+
category: z2.string(),
|
|
148
|
+
tags: z2.array(z2.string()),
|
|
149
|
+
archived: z2.boolean(),
|
|
150
|
+
publish_at: z2.coerce.date().nullable(),
|
|
151
|
+
created_at: z2.coerce.date(),
|
|
152
|
+
updated_at: z2.coerce.date(),
|
|
153
|
+
project_ids: z2.array(z2.string()),
|
|
154
|
+
corpus_version: z2.string().nullable()
|
|
155
|
+
});
|
|
156
|
+
var SlugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
157
|
+
var PostCreateSchema = z2.object({
|
|
158
|
+
slug: z2.string().regex(SlugPattern, "Slug must be lowercase alphanumeric with hyphens"),
|
|
159
|
+
title: z2.string().min(1),
|
|
160
|
+
content: z2.string(),
|
|
161
|
+
description: z2.string().optional(),
|
|
162
|
+
format: z2.enum(["md", "adoc"]).default("md"),
|
|
163
|
+
category: z2.string().default("root"),
|
|
164
|
+
tags: z2.array(z2.string()).default([]),
|
|
165
|
+
publish_at: z2.coerce.date().nullable().optional(),
|
|
166
|
+
project_ids: z2.array(z2.string()).optional()
|
|
167
|
+
});
|
|
168
|
+
var PostUpdateSchema = z2.object({
|
|
169
|
+
slug: z2.string().regex(SlugPattern, "Slug must be lowercase alphanumeric with hyphens").optional(),
|
|
170
|
+
title: z2.string().min(1).optional(),
|
|
171
|
+
content: z2.string().optional(),
|
|
172
|
+
description: z2.string().optional(),
|
|
173
|
+
format: z2.enum(["md", "adoc"]).optional(),
|
|
174
|
+
category: z2.string().optional(),
|
|
175
|
+
tags: z2.array(z2.string()).optional(),
|
|
176
|
+
archived: z2.boolean().optional(),
|
|
177
|
+
publish_at: z2.coerce.date().nullable().optional(),
|
|
178
|
+
project_ids: z2.array(z2.string()).optional()
|
|
179
|
+
});
|
|
180
|
+
var PostListParamsSchema = z2.object({
|
|
181
|
+
category: z2.string().optional(),
|
|
182
|
+
tag: z2.string().optional(),
|
|
183
|
+
project: z2.string().optional(),
|
|
184
|
+
status: z2.enum(["published", "scheduled", "draft", "all"]).default("all"),
|
|
185
|
+
archived: z2.boolean().default(false),
|
|
186
|
+
limit: z2.coerce.number().min(1).max(100).default(10),
|
|
187
|
+
offset: z2.coerce.number().min(0).default(0),
|
|
188
|
+
sort: z2.enum(["created", "updated", "published"]).default("updated")
|
|
189
|
+
});
|
|
190
|
+
var PostsResponseSchema = z2.object({
|
|
191
|
+
posts: z2.array(PostSchema),
|
|
192
|
+
total_posts: z2.number(),
|
|
193
|
+
total_pages: z2.number(),
|
|
194
|
+
per_page: z2.number(),
|
|
195
|
+
current_page: z2.number()
|
|
196
|
+
});
|
|
197
|
+
var isPublished = (post) => post.publish_at !== null && post.publish_at <= /* @__PURE__ */ new Date();
|
|
198
|
+
var isScheduled = (post) => post.publish_at !== null && post.publish_at > /* @__PURE__ */ new Date();
|
|
199
|
+
var isDraft = (post) => post.publish_at === null;
|
|
200
|
+
var postStatus = (post) => {
|
|
201
|
+
if (isDraft(post))
|
|
202
|
+
return "draft";
|
|
203
|
+
if (isScheduled(post))
|
|
204
|
+
return "scheduled";
|
|
205
|
+
return "published";
|
|
206
|
+
};
|
|
207
|
+
var CategoryCreateSchema = z2.object({
|
|
208
|
+
name: z2.string().min(1),
|
|
209
|
+
parent: z2.string().default("root")
|
|
210
|
+
});
|
|
211
|
+
var AccessKeyCreateSchema = z2.object({
|
|
212
|
+
name: z2.string().min(1),
|
|
213
|
+
note: z2.string().optional()
|
|
214
|
+
});
|
|
215
|
+
var AccessKeyUpdateSchema = z2.object({
|
|
216
|
+
name: z2.string().min(1).optional(),
|
|
217
|
+
note: z2.string().optional(),
|
|
218
|
+
enabled: z2.boolean().optional()
|
|
219
|
+
});
|
|
220
|
+
var IntegrationUpsertSchema = z2.object({
|
|
221
|
+
source: z2.string().min(1),
|
|
222
|
+
location: z2.string().min(1),
|
|
223
|
+
data: z2.record(z2.unknown()).optional()
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export {
|
|
227
|
+
PostContentSchema,
|
|
228
|
+
postsStoreDefinition,
|
|
229
|
+
postStoreId,
|
|
230
|
+
corpusPath,
|
|
231
|
+
VersionInfoSchema,
|
|
232
|
+
mapCorpusError,
|
|
233
|
+
parsePostContent,
|
|
234
|
+
serializePostContent,
|
|
235
|
+
PostRowSchema,
|
|
236
|
+
PostRowInsertSchema,
|
|
237
|
+
CategorySchema,
|
|
238
|
+
CategoryInsertSchema,
|
|
239
|
+
TagSchema,
|
|
240
|
+
TagInsertSchema,
|
|
241
|
+
AccessKeyRowSchema,
|
|
242
|
+
AccessKeySchema,
|
|
243
|
+
AccessKeyInsertSchema,
|
|
244
|
+
IntegrationSchema,
|
|
245
|
+
IntegrationInsertSchema,
|
|
246
|
+
FetchLinkSchema,
|
|
247
|
+
FetchLinkInsertSchema,
|
|
248
|
+
PostSchema,
|
|
249
|
+
PostCreateSchema,
|
|
250
|
+
PostUpdateSchema,
|
|
251
|
+
PostListParamsSchema,
|
|
252
|
+
PostsResponseSchema,
|
|
253
|
+
isPublished,
|
|
254
|
+
isScheduled,
|
|
255
|
+
isDraft,
|
|
256
|
+
postStatus,
|
|
257
|
+
CategoryCreateSchema,
|
|
258
|
+
AccessKeyCreateSchema,
|
|
259
|
+
AccessKeyUpdateSchema,
|
|
260
|
+
IntegrationUpsertSchema
|
|
261
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// ../schema/dist/errors.js
|
|
2
2
|
import { err } from "@f0rbit/corpus";
|
|
3
3
|
var defaultLogger = ({ error, context }) => {
|
|
4
|
-
console.error(`[${context.timestamp}] [${error.kind}]`, error.message || error.kind, {
|
|
4
|
+
console.error(`[${context.timestamp}] [${error.kind}]`, error.message || error.kind, {
|
|
5
|
+
...error,
|
|
6
|
+
stack: context.stack?.split("\n").slice(2, 5).join("\n"),
|
|
7
|
+
...context
|
|
8
|
+
});
|
|
5
9
|
};
|
|
6
10
|
var errorLogger = defaultLogger;
|
|
7
11
|
var contextProvider = null;
|
|
@@ -12,7 +16,12 @@ var configureErrorLogging = (config) => {
|
|
|
12
16
|
contextProvider = config.contextProvider;
|
|
13
17
|
};
|
|
14
18
|
var logAndReturn = (error, ctx) => {
|
|
15
|
-
const context = {
|
|
19
|
+
const context = {
|
|
20
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21
|
+
stack: new Error().stack,
|
|
22
|
+
...contextProvider?.(),
|
|
23
|
+
...ctx
|
|
24
|
+
};
|
|
16
25
|
errorLogger({ error, context });
|
|
17
26
|
return err(error);
|
|
18
27
|
};
|
|
@@ -49,7 +58,13 @@ var parseError = (message, ctx) => logAndReturn({ kind: "parse_error", ...messag
|
|
|
49
58
|
var encryptionError = (operation, message, ctx) => logAndReturn({ kind: "encryption_error", operation, ...message && { message } }, ctx);
|
|
50
59
|
var dbError = (message, ctx) => logAndReturn({ kind: "db_error", ...message && { message } }, ctx);
|
|
51
60
|
var conflict = (resource, message, ctx) => logAndReturn({ kind: "conflict", ...resource && { resource }, ...message && { message } }, ctx);
|
|
52
|
-
var protectedEntity = (entity_id, message, modified_by, modified_at, ctx) => logAndReturn({
|
|
61
|
+
var protectedEntity = (entity_id, message, modified_by, modified_at, ctx) => logAndReturn({
|
|
62
|
+
kind: "protected",
|
|
63
|
+
...entity_id && { entity_id },
|
|
64
|
+
...message && { message },
|
|
65
|
+
...modified_by && { modified_by },
|
|
66
|
+
...modified_at && { modified_at }
|
|
67
|
+
}, ctx);
|
|
53
68
|
var badRequest = (message, details, ctx) => logAndReturn({ kind: "bad_request", ...message && { message }, ...details !== void 0 && { details } }, ctx);
|
|
54
69
|
var unauthorized = (message, ctx) => logAndReturn({ kind: "unauthorized", ...message && { message } }, ctx);
|
|
55
70
|
var scanError = (message, ctx) => logAndReturn({ kind: "scan_error", ...message && { message } }, ctx);
|
|
@@ -189,16 +189,12 @@ var tag = sqliteTable("tag", {
|
|
|
189
189
|
title: text("title").notNull(),
|
|
190
190
|
color: text("color"),
|
|
191
191
|
render: int("render", { mode: "boolean" }).notNull().default(true)
|
|
192
|
-
}, (table) => (
|
|
193
|
-
tag_unique: unique("tag_unique").on(table.owner_id, table.title)
|
|
194
|
-
}));
|
|
192
|
+
}, (table) => [unique("tag_unique").on(table.owner_id, table.title)]);
|
|
195
193
|
var task_tag = sqliteTable("task_tag", {
|
|
196
194
|
task_id: text("task_id").notNull().references(() => task.id),
|
|
197
195
|
tag_id: text("tag_id").notNull().references(() => tag.id),
|
|
198
196
|
...timestamps()
|
|
199
|
-
}, (table) => ({
|
|
200
|
-
task_tag_unique: primaryKey({ columns: [table.task_id, table.tag_id] })
|
|
201
|
-
}));
|
|
197
|
+
}, (table) => [primaryKey({ columns: [table.task_id, table.tag_id] })]);
|
|
202
198
|
var commit_detail = sqliteTable("commit_detail", {
|
|
203
199
|
sha: text("sha").primaryKey(),
|
|
204
200
|
message: text("message").notNull(),
|
|
@@ -401,11 +397,26 @@ var upsert_project = z.object({
|
|
|
401
397
|
repo_url: z.string().nullable(),
|
|
402
398
|
repo_id: z.number().nullable(),
|
|
403
399
|
icon_url: z.string().nullable(),
|
|
404
|
-
status: z.union([
|
|
400
|
+
status: z.union([
|
|
401
|
+
z.literal("DEVELOPMENT"),
|
|
402
|
+
z.literal("PAUSED"),
|
|
403
|
+
z.literal("RELEASED"),
|
|
404
|
+
z.literal("LIVE"),
|
|
405
|
+
z.literal("FINISHED"),
|
|
406
|
+
z.literal("ABANDONED"),
|
|
407
|
+
z.literal("STOPPED")
|
|
408
|
+
]).optional(),
|
|
405
409
|
deleted: z.boolean().optional().default(false),
|
|
406
410
|
link_url: z.string().nullable(),
|
|
407
411
|
link_text: z.string().nullable(),
|
|
408
|
-
visibility: z.union([
|
|
412
|
+
visibility: z.union([
|
|
413
|
+
z.literal("PUBLIC"),
|
|
414
|
+
z.literal("PRIVATE"),
|
|
415
|
+
z.literal("HIDDEN"),
|
|
416
|
+
z.literal("ARCHIVED"),
|
|
417
|
+
z.literal("DRAFT"),
|
|
418
|
+
z.literal("DELETED")
|
|
419
|
+
]).optional(),
|
|
409
420
|
current_version: z.string().nullable(),
|
|
410
421
|
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
411
422
|
});
|
|
@@ -415,7 +426,14 @@ var upsert_todo = z.object({
|
|
|
415
426
|
summary: z.string().optional().nullable(),
|
|
416
427
|
description: z.string().optional().nullable(),
|
|
417
428
|
progress: z.union([z.literal("UNSTARTED"), z.literal("IN_PROGRESS"), z.literal("COMPLETED")]).optional(),
|
|
418
|
-
visibility: z.union([
|
|
429
|
+
visibility: z.union([
|
|
430
|
+
z.literal("PUBLIC"),
|
|
431
|
+
z.literal("PRIVATE"),
|
|
432
|
+
z.literal("HIDDEN"),
|
|
433
|
+
z.literal("ARCHIVED"),
|
|
434
|
+
z.literal("DRAFT"),
|
|
435
|
+
z.literal("DELETED")
|
|
436
|
+
]).optional(),
|
|
419
437
|
start_time: z.string().optional().nullable(),
|
|
420
438
|
end_time: z.string().optional().nullable(),
|
|
421
439
|
priority: z.union([z.literal("LOW"), z.literal("MEDIUM"), z.literal("HIGH")]).optional(),
|
|
@@ -424,11 +442,30 @@ var upsert_todo = z.object({
|
|
|
424
442
|
goal_id: z.string().optional().nullable(),
|
|
425
443
|
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
426
444
|
});
|
|
427
|
-
var update_action = z.union([
|
|
445
|
+
var update_action = z.union([
|
|
446
|
+
z.literal("CONFIRM"),
|
|
447
|
+
z.literal("UNLINK"),
|
|
448
|
+
z.literal("CREATE"),
|
|
449
|
+
z.literal("IGNORE"),
|
|
450
|
+
z.literal("DELETE"),
|
|
451
|
+
z.literal("COMPLETE")
|
|
452
|
+
]);
|
|
428
453
|
var upsert_tag = z.object({
|
|
429
454
|
id: z.string().optional(),
|
|
430
455
|
title: z.string(),
|
|
431
|
-
color: z.union([
|
|
456
|
+
color: z.union([
|
|
457
|
+
z.literal("red"),
|
|
458
|
+
z.literal("green"),
|
|
459
|
+
z.literal("blue"),
|
|
460
|
+
z.literal("yellow"),
|
|
461
|
+
z.literal("purple"),
|
|
462
|
+
z.literal("orange"),
|
|
463
|
+
z.literal("teal"),
|
|
464
|
+
z.literal("pink"),
|
|
465
|
+
z.literal("gray"),
|
|
466
|
+
z.literal("cyan"),
|
|
467
|
+
z.literal("lime")
|
|
468
|
+
]).nullable().optional(),
|
|
432
469
|
deleted: z.boolean().optional().default(false),
|
|
433
470
|
render: z.boolean().optional().default(true),
|
|
434
471
|
owner_id: z.string()
|