@devpad/api 2.0.2 → 2.0.3
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 +6 -6
- package/dist/index.js +345 -103
- package/dist/{media.d-R87HGuRp.d.ts → media.d-CQ56ckoR.d.ts} +1 -1
- package/dist/schema/blog.d.ts +4 -607
- package/dist/schema/blog.js +10 -81
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.js +1 -81
- package/dist/schema/media.d.ts +5 -6
- package/dist/schema/media.js +1 -97
- package/dist/{schema.d-BceDyQED.d.ts → schema.d-DALWdx-o.d.ts} +1 -522
- package/dist/{types.d-UV8B6hPN.d.ts → types.d-B1VbnHQT.d.ts} +3 -3
- package/dist/{types.d-CoHRMrYJ.d.ts → types.d-Bj4FU9Op.d.ts} +1 -1
- package/dist/{types.d-1hBObc_N.d.ts → types.d-DLE9TSql.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-FOO5XXY5.js +0 -318
- /package/dist/{chunk-WTGVONUB.js → chunk-INGCIUMX.js} +0 -0
package/dist/chunk-FOO5XXY5.js
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
// ../schema/dist/database/schema.js
|
|
2
|
-
import { relations, sql } from "drizzle-orm";
|
|
3
|
-
import { int, integer, primaryKey, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
|
|
4
|
-
var timestamps = () => ({
|
|
5
|
-
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
6
|
-
updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
7
|
-
});
|
|
8
|
-
var deleted = () => ({
|
|
9
|
-
deleted: int("deleted", { mode: "boolean" }).notNull().default(false)
|
|
10
|
-
});
|
|
11
|
-
var owner_id = () => ({
|
|
12
|
-
owner_id: text("owner_id").notNull().references(() => user.id)
|
|
13
|
-
});
|
|
14
|
-
var id = (prefix) => ({
|
|
15
|
-
id: text("id").primaryKey().$defaultFn(() => `${prefix}_${crypto.randomUUID()}`)
|
|
16
|
-
});
|
|
17
|
-
var entity = (prefix) => ({
|
|
18
|
-
...id(prefix),
|
|
19
|
-
...timestamps(),
|
|
20
|
-
...deleted()
|
|
21
|
-
});
|
|
22
|
-
var owned_entity = (prefix) => ({
|
|
23
|
-
...entity(prefix),
|
|
24
|
-
...owner_id()
|
|
25
|
-
});
|
|
26
|
-
var user = sqliteTable("user", {
|
|
27
|
-
id: text("id").primaryKey().$defaultFn(() => `user_${crypto.randomUUID()}`),
|
|
28
|
-
github_id: integer("github_id"),
|
|
29
|
-
name: text("name"),
|
|
30
|
-
email: text("email").unique(),
|
|
31
|
-
email_verified: text("email_verified"),
|
|
32
|
-
// timestamp
|
|
33
|
-
image_url: text("image_url"),
|
|
34
|
-
task_view: text("task_view", { enum: ["list", "grid"] }).notNull().default("list")
|
|
35
|
-
});
|
|
36
|
-
var session = sqliteTable("session", {
|
|
37
|
-
id: text("id").notNull().primaryKey(),
|
|
38
|
-
userId: text("user_id").notNull().references(() => user.id),
|
|
39
|
-
expiresAt: integer("expires_at").notNull(),
|
|
40
|
-
access_token: text("access_token")
|
|
41
|
-
});
|
|
42
|
-
var api_keys = sqliteTable("api_keys", {
|
|
43
|
-
...id("apikey"),
|
|
44
|
-
user_id: text("user_id").notNull().references(() => user.id),
|
|
45
|
-
key_hash: text("key_hash").notNull().unique(),
|
|
46
|
-
name: text("name"),
|
|
47
|
-
note: text("note"),
|
|
48
|
-
scope: text("scope", { enum: ["devpad", "blog", "media", "all"] }).notNull().default("all"),
|
|
49
|
-
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
|
50
|
-
last_used_at: text("last_used_at"),
|
|
51
|
-
...timestamps(),
|
|
52
|
-
deleted: integer("deleted", { mode: "boolean" }).notNull().default(false)
|
|
53
|
-
});
|
|
54
|
-
var project = sqliteTable("project", {
|
|
55
|
-
...owned_entity("project"),
|
|
56
|
-
project_id: text("project_id").notNull(),
|
|
57
|
-
name: text("name").notNull(),
|
|
58
|
-
description: text("description"),
|
|
59
|
-
specification: text("specification"),
|
|
60
|
-
repo_url: text("repo_url"),
|
|
61
|
-
repo_id: integer("repo_id"),
|
|
62
|
-
icon_url: text("icon_url"),
|
|
63
|
-
status: text("status", { enum: ["DEVELOPMENT", "PAUSED", "RELEASED", "LIVE", "FINISHED", "ABANDONED", "STOPPED"] }).notNull().default("DEVELOPMENT"),
|
|
64
|
-
link_url: text("link_url"),
|
|
65
|
-
link_text: text("link_text"),
|
|
66
|
-
visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
|
|
67
|
-
current_version: text("current_version"),
|
|
68
|
-
scan_branch: text("scan_branch")
|
|
69
|
-
});
|
|
70
|
-
var ACTIONS = [
|
|
71
|
-
"CREATE_TASK",
|
|
72
|
-
"UPDATE_TASK",
|
|
73
|
-
"DELETE_TASK",
|
|
74
|
-
"CREATE_PROJECT",
|
|
75
|
-
"UPDATE_PROJECT",
|
|
76
|
-
"DELETE_PROJECT",
|
|
77
|
-
"CREATE_TAG",
|
|
78
|
-
"UPDATE_TAG",
|
|
79
|
-
"DELETE_TAG",
|
|
80
|
-
"CREATE_GOAL",
|
|
81
|
-
"UPDATE_GOAL",
|
|
82
|
-
"DELETE_GOAL",
|
|
83
|
-
"CREATE_MILESTONE",
|
|
84
|
-
"UPDATE_MILESTONE",
|
|
85
|
-
"DELETE_MILESTONE",
|
|
86
|
-
"CREATE_CHECKLIST",
|
|
87
|
-
"UPDATE_CHECKLIST",
|
|
88
|
-
"DELETE_CHECKLIST"
|
|
89
|
-
];
|
|
90
|
-
var action = sqliteTable("action", {
|
|
91
|
-
...owned_entity("action"),
|
|
92
|
-
type: text("type", { enum: ACTIONS }).notNull(),
|
|
93
|
-
description: text("description").notNull(),
|
|
94
|
-
data: text("data", { mode: "json" })
|
|
95
|
-
});
|
|
96
|
-
var tracker_result = sqliteTable("tracker_result", {
|
|
97
|
-
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
98
|
-
project_id: text("project_id").notNull().references(() => project.id),
|
|
99
|
-
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
100
|
-
data: text("data", { mode: "json" }).notNull(),
|
|
101
|
-
accepted: integer("accepted", { mode: "boolean" }).notNull().default(false)
|
|
102
|
-
});
|
|
103
|
-
var todo_updates = sqliteTable("todo_updates", {
|
|
104
|
-
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
105
|
-
project_id: text("project_id").notNull().references(() => project.id),
|
|
106
|
-
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
107
|
-
old_id: integer("old_id").references(() => tracker_result.id),
|
|
108
|
-
new_id: integer("new_id").notNull().references(() => tracker_result.id),
|
|
109
|
-
data: text("data", { mode: "json" }).notNull(),
|
|
110
|
-
status: text("status", { enum: ["PENDING", "ACCEPTED", "REJECTED", "IGNORED"] }).notNull().default("PENDING"),
|
|
111
|
-
branch: text("branch"),
|
|
112
|
-
commit_sha: text("commit_sha"),
|
|
113
|
-
commit_msg: text("commit_msg"),
|
|
114
|
-
commit_url: text("commit_url")
|
|
115
|
-
});
|
|
116
|
-
var update_tracker_relations = relations(todo_updates, ({ one }) => ({
|
|
117
|
-
old: one(tracker_result, { fields: [todo_updates.old_id], references: [tracker_result.id] }),
|
|
118
|
-
new: one(tracker_result, { fields: [todo_updates.new_id], references: [tracker_result.id] })
|
|
119
|
-
}));
|
|
120
|
-
var milestone = sqliteTable("milestone", {
|
|
121
|
-
...entity("milestone"),
|
|
122
|
-
project_id: text("project_id").notNull().references(() => project.id),
|
|
123
|
-
name: text("name").notNull(),
|
|
124
|
-
description: text("description"),
|
|
125
|
-
target_time: text("target_time"),
|
|
126
|
-
target_version: text("target_version"),
|
|
127
|
-
finished_at: text("finished_at"),
|
|
128
|
-
after_id: text("after_id")
|
|
129
|
-
});
|
|
130
|
-
var goal = sqliteTable("goal", {
|
|
131
|
-
...entity("goal"),
|
|
132
|
-
milestone_id: text("milestone_id").notNull().references(() => milestone.id),
|
|
133
|
-
name: text("name").notNull(),
|
|
134
|
-
description: text("description"),
|
|
135
|
-
target_time: text("target_time"),
|
|
136
|
-
finished_at: text("finished_at")
|
|
137
|
-
});
|
|
138
|
-
var task = sqliteTable("task", {
|
|
139
|
-
...owned_entity("task"),
|
|
140
|
-
title: text("title").notNull(),
|
|
141
|
-
progress: text("progress", { enum: ["UNSTARTED", "IN_PROGRESS", "COMPLETED"] }).notNull().default("UNSTARTED"),
|
|
142
|
-
visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
|
|
143
|
-
goal_id: text("goal_id").references(() => goal.id),
|
|
144
|
-
project_id: text("project_id").references(() => project.id),
|
|
145
|
-
description: text("description"),
|
|
146
|
-
start_time: text("start_time"),
|
|
147
|
-
end_time: text("end_time"),
|
|
148
|
-
summary: text("summary"),
|
|
149
|
-
codebase_task_id: text("codebase_task_id").references(() => codebase_tasks.id),
|
|
150
|
-
priority: text("priority", { enum: ["LOW", "MEDIUM", "HIGH"] }).notNull().default("LOW")
|
|
151
|
-
});
|
|
152
|
-
var checklist = sqliteTable("checklist", {
|
|
153
|
-
...entity("checklist"),
|
|
154
|
-
task_id: text("task_id").notNull().references(() => task.id),
|
|
155
|
-
name: text("name").notNull()
|
|
156
|
-
});
|
|
157
|
-
var checklist_item = sqliteTable("checklist_item", {
|
|
158
|
-
...entity("checklist-item"),
|
|
159
|
-
checklist_id: text("checklist_id").notNull().references(() => checklist.id),
|
|
160
|
-
parent_id: text("parent_id"),
|
|
161
|
-
name: text("name").notNull(),
|
|
162
|
-
checked: int("checked", { mode: "boolean" }).notNull().default(false)
|
|
163
|
-
});
|
|
164
|
-
var codebase_tasks = sqliteTable("codebase_tasks", {
|
|
165
|
-
...entity("codebase-task"),
|
|
166
|
-
branch: text("branch"),
|
|
167
|
-
commit_sha: text("commit_sha"),
|
|
168
|
-
commit_msg: text("commit_msg"),
|
|
169
|
-
commit_url: text("commit_url"),
|
|
170
|
-
type: text("type"),
|
|
171
|
-
text: text("text"),
|
|
172
|
-
file: text("file"),
|
|
173
|
-
line: integer("line"),
|
|
174
|
-
context: text("context", { mode: "json" }),
|
|
175
|
-
recent_scan_id: integer("recent_scan_id").references(() => tracker_result.id)
|
|
176
|
-
});
|
|
177
|
-
var tag = sqliteTable("tag", {
|
|
178
|
-
...owned_entity("tag"),
|
|
179
|
-
title: text("title").notNull(),
|
|
180
|
-
color: text("color"),
|
|
181
|
-
render: int("render", { mode: "boolean" }).notNull().default(true)
|
|
182
|
-
}, (table) => ({
|
|
183
|
-
tag_unique: unique("tag_unique").on(table.owner_id, table.title)
|
|
184
|
-
}));
|
|
185
|
-
var task_tag = sqliteTable("task_tag", {
|
|
186
|
-
task_id: text("task_id").notNull().references(() => task.id),
|
|
187
|
-
tag_id: text("tag_id").notNull().references(() => tag.id),
|
|
188
|
-
...timestamps()
|
|
189
|
-
}, (table) => ({
|
|
190
|
-
task_tag_unique: primaryKey({ columns: [table.task_id, table.tag_id] })
|
|
191
|
-
}));
|
|
192
|
-
var commit_detail = sqliteTable("commit_detail", {
|
|
193
|
-
sha: text("sha").primaryKey(),
|
|
194
|
-
message: text("message").notNull(),
|
|
195
|
-
url: text("url").notNull(),
|
|
196
|
-
avatar_url: text("avatar_url"),
|
|
197
|
-
author_user: text("author_user").notNull(),
|
|
198
|
-
author_name: text("author_name"),
|
|
199
|
-
author_email: text("author_email").notNull(),
|
|
200
|
-
date: text("date").notNull()
|
|
201
|
-
});
|
|
202
|
-
var tag_config = sqliteTable("tag_config", {
|
|
203
|
-
...id("tag_config"),
|
|
204
|
-
project_id: text("project_id").notNull().references(() => project.id),
|
|
205
|
-
// Foreign key to projects
|
|
206
|
-
tag_id: text("tag_id").notNull().references(() => tag.id),
|
|
207
|
-
// Foreign key to tags
|
|
208
|
-
match: text("match").notNull(),
|
|
209
|
-
// Match pattern for this tag
|
|
210
|
-
...timestamps()
|
|
211
|
-
});
|
|
212
|
-
var ignore_path = sqliteTable("ignore_path", {
|
|
213
|
-
...id("ignore_path"),
|
|
214
|
-
project_id: text("project_id").notNull().references(() => project.id),
|
|
215
|
-
// Foreign key to projects
|
|
216
|
-
path: text("path").notNull(),
|
|
217
|
-
// Ignore path
|
|
218
|
-
...timestamps()
|
|
219
|
-
});
|
|
220
|
-
var user_relations = relations(user, ({ many }) => ({
|
|
221
|
-
sessions: many(session),
|
|
222
|
-
api_keys: many(api_keys),
|
|
223
|
-
actions: many(action),
|
|
224
|
-
tasks: many(task),
|
|
225
|
-
tags: many(tag)
|
|
226
|
-
}));
|
|
227
|
-
var session_relations = relations(session, ({ one }) => ({
|
|
228
|
-
user: one(user, { fields: [session.userId], references: [user.id] })
|
|
229
|
-
}));
|
|
230
|
-
var api_keys_relations = relations(api_keys, ({ one }) => ({
|
|
231
|
-
owner: one(user, { fields: [api_keys.user_id], references: [user.id] })
|
|
232
|
-
}));
|
|
233
|
-
var project_relations = relations(project, ({ one, many }) => ({
|
|
234
|
-
owner: one(user, { fields: [project.owner_id], references: [user.id] }),
|
|
235
|
-
tracker_results: many(tracker_result),
|
|
236
|
-
milestones: many(milestone),
|
|
237
|
-
todo_updates: many(todo_updates)
|
|
238
|
-
}));
|
|
239
|
-
var action_relations = relations(action, ({ one }) => ({
|
|
240
|
-
owner: one(user, { fields: [action.owner_id], references: [user.id] })
|
|
241
|
-
}));
|
|
242
|
-
var tracker_result_relations = relations(tracker_result, ({ one }) => ({
|
|
243
|
-
project: one(project, { fields: [tracker_result.project_id], references: [project.id] })
|
|
244
|
-
}));
|
|
245
|
-
var todoUpdatesRelations = relations(todo_updates, ({ one }) => ({
|
|
246
|
-
project: one(project, { fields: [todo_updates.project_id], references: [project.id] }),
|
|
247
|
-
oldTrackerResult: one(tracker_result, { fields: [todo_updates.old_id], references: [tracker_result.id] }),
|
|
248
|
-
newTrackerResult: one(tracker_result, { fields: [todo_updates.new_id], references: [tracker_result.id] })
|
|
249
|
-
}));
|
|
250
|
-
var milestone_relations = relations(milestone, ({ one, many }) => ({
|
|
251
|
-
project: one(project, { fields: [milestone.project_id], references: [project.id] }),
|
|
252
|
-
goals: many(goal)
|
|
253
|
-
}));
|
|
254
|
-
var goal_relations = relations(goal, ({ one }) => ({
|
|
255
|
-
milestone: one(milestone, { fields: [goal.milestone_id], references: [milestone.id] })
|
|
256
|
-
}));
|
|
257
|
-
var task_relations = relations(task, ({ one, many }) => ({
|
|
258
|
-
owner: one(user, { fields: [task.owner_id], references: [user.id] }),
|
|
259
|
-
goal: one(goal, { fields: [task.goal_id], references: [goal.id] }),
|
|
260
|
-
codebase_task: one(codebase_tasks, { fields: [task.codebase_task_id], references: [codebase_tasks.id] }),
|
|
261
|
-
checklists: many(checklist)
|
|
262
|
-
}));
|
|
263
|
-
var checklist_relations = relations(checklist, ({ one, many }) => ({
|
|
264
|
-
task: one(task, { fields: [checklist.task_id], references: [task.id] }),
|
|
265
|
-
items: many(checklist_item)
|
|
266
|
-
}));
|
|
267
|
-
var checklist_item_relations = relations(checklist_item, ({ one }) => ({
|
|
268
|
-
checklist: one(checklist, { fields: [checklist_item.checklist_id], references: [checklist.id] })
|
|
269
|
-
}));
|
|
270
|
-
var tag_relations = relations(tag, ({ one }) => ({
|
|
271
|
-
owner: one(user, { fields: [tag.owner_id], references: [user.id] })
|
|
272
|
-
}));
|
|
273
|
-
var task_tag_relations = relations(task_tag, ({ one }) => ({
|
|
274
|
-
task: one(task, { fields: [task_tag.task_id], references: [task.id] }),
|
|
275
|
-
tag: one(tag, { fields: [task_tag.tag_id], references: [tag.id] })
|
|
276
|
-
}));
|
|
277
|
-
|
|
278
|
-
export {
|
|
279
|
-
timestamps,
|
|
280
|
-
deleted,
|
|
281
|
-
owner_id,
|
|
282
|
-
id,
|
|
283
|
-
entity,
|
|
284
|
-
owned_entity,
|
|
285
|
-
user,
|
|
286
|
-
session,
|
|
287
|
-
api_keys,
|
|
288
|
-
project,
|
|
289
|
-
action,
|
|
290
|
-
tracker_result,
|
|
291
|
-
todo_updates,
|
|
292
|
-
update_tracker_relations,
|
|
293
|
-
milestone,
|
|
294
|
-
goal,
|
|
295
|
-
task,
|
|
296
|
-
checklist,
|
|
297
|
-
checklist_item,
|
|
298
|
-
codebase_tasks,
|
|
299
|
-
tag,
|
|
300
|
-
task_tag,
|
|
301
|
-
commit_detail,
|
|
302
|
-
tag_config,
|
|
303
|
-
ignore_path,
|
|
304
|
-
user_relations,
|
|
305
|
-
session_relations,
|
|
306
|
-
api_keys_relations,
|
|
307
|
-
project_relations,
|
|
308
|
-
action_relations,
|
|
309
|
-
tracker_result_relations,
|
|
310
|
-
todoUpdatesRelations,
|
|
311
|
-
milestone_relations,
|
|
312
|
-
goal_relations,
|
|
313
|
-
task_relations,
|
|
314
|
-
checklist_relations,
|
|
315
|
-
checklist_item_relations,
|
|
316
|
-
tag_relations,
|
|
317
|
-
task_tag_relations
|
|
318
|
-
};
|
|
File without changes
|