@devpad/api 2.0.4 → 2.1.2
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.
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
// ../schema/dist/types.js
|
|
2
|
-
var TAG_COLOURS = {
|
|
3
|
-
red: { colour: "#F28B82", text: "#faeeef", border: "#F5A5A5" },
|
|
4
|
-
green: { colour: "#CCFF90", text: "#2E7D32", border: "#A5D6A7" },
|
|
5
|
-
blue: { colour: "#82B1FF", text: "#0D47A1", border: "#90CAF9" },
|
|
6
|
-
yellow: { colour: "#FFF176", text: "#F57F17", border: "#FFF59D" },
|
|
7
|
-
purple: { colour: "#E1BEE7", text: "#4A148C", border: "#CE93D8" },
|
|
8
|
-
orange: { colour: "#FFCC80", text: "#E65100", border: "#FFB74D" },
|
|
9
|
-
teal: { colour: "#80CBC4", text: "#004D40", border: "#4DB6AC" },
|
|
10
|
-
pink: { colour: "#F8BBD9", text: "#880E4F", border: "#F48FB1" },
|
|
11
|
-
gray: { colour: "#CFD8DC", text: "#37474F", border: "#B0BEC5" },
|
|
12
|
-
cyan: { colour: "#84FFFF", text: "#006064", border: "#4DD0E1" },
|
|
13
|
-
lime: { colour: "#ddf0bc", text: "#88b47f", border: "#becca5" }
|
|
14
|
-
};
|
|
15
|
-
var ArrayBufferedQueue = class {
|
|
16
|
-
constructor(_capacity) {
|
|
17
|
-
this._capacity = _capacity;
|
|
18
|
-
this._entries = [];
|
|
19
|
-
this._head = 0;
|
|
20
|
-
this._tail = 0;
|
|
21
|
-
this._size = 0;
|
|
22
|
-
}
|
|
23
|
-
latest() {
|
|
24
|
-
if (this._size === 0)
|
|
25
|
-
return null;
|
|
26
|
-
return this._entries[this._tail - 1] ?? null;
|
|
27
|
-
}
|
|
28
|
-
list() {
|
|
29
|
-
if (this._size === 0)
|
|
30
|
-
return [];
|
|
31
|
-
if (this._head < this._tail) {
|
|
32
|
-
return this._entries.slice(this._head, this._tail);
|
|
33
|
-
}
|
|
34
|
-
return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
|
|
35
|
-
}
|
|
36
|
-
add(item) {
|
|
37
|
-
if (this._size === this._capacity) {
|
|
38
|
-
this._head = (this._head + 1) % this._capacity;
|
|
39
|
-
} else {
|
|
40
|
-
this._size++;
|
|
41
|
-
}
|
|
42
|
-
this._entries[this._tail] = item;
|
|
43
|
-
this._tail = (this._tail + 1) % this._capacity;
|
|
44
|
-
}
|
|
45
|
-
size() {
|
|
46
|
-
return this._size;
|
|
47
|
-
}
|
|
48
|
-
clear() {
|
|
49
|
-
this._entries = [];
|
|
50
|
-
this._head = 0;
|
|
51
|
-
this._tail = 0;
|
|
52
|
-
this._size = 0;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
1
|
// ../schema/dist/validation.js
|
|
57
2
|
import { z } from "zod";
|
|
58
3
|
var upsert_project = z.object({
|
|
@@ -89,13 +34,6 @@ var upsert_todo = z.object({
|
|
|
89
34
|
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
90
35
|
});
|
|
91
36
|
var update_action = z.union([z.literal("CONFIRM"), z.literal("UNLINK"), z.literal("CREATE"), z.literal("IGNORE"), z.literal("DELETE"), z.literal("COMPLETE")]);
|
|
92
|
-
var ConfigSchema = z.object({
|
|
93
|
-
tags: z.array(z.object({
|
|
94
|
-
name: z.string(),
|
|
95
|
-
match: z.array(z.string())
|
|
96
|
-
})),
|
|
97
|
-
ignore: z.array(z.string().regex(/^[^]*$/, "Invalid path"))
|
|
98
|
-
});
|
|
99
37
|
var upsert_tag = z.object({
|
|
100
38
|
id: z.string().optional(),
|
|
101
39
|
title: z.string(),
|
|
@@ -153,12 +91,9 @@ var upsert_goal = z.object({
|
|
|
153
91
|
});
|
|
154
92
|
|
|
155
93
|
export {
|
|
156
|
-
TAG_COLOURS,
|
|
157
|
-
ArrayBufferedQueue,
|
|
158
94
|
upsert_project,
|
|
159
95
|
upsert_todo,
|
|
160
96
|
update_action,
|
|
161
|
-
ConfigSchema,
|
|
162
97
|
upsert_tag,
|
|
163
98
|
project_config,
|
|
164
99
|
save_config_request,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { A as ApiKey, P as Project, v as UpsertProject, L as GetConfigResult, E as SaveConfigRequest, M as Milestone, G as Goal, H as TaskWithDetails, w as UpsertTodo, x as UpsertTag, $ as HistoryAction, Q as TagWithTypedColor, a4 as BufferedQueue } from './types.d-CeY2wsr4.js';
|
|
2
|
-
export { D as ProjectConfig, T as Task } from './types.d-CeY2wsr4.js';
|
|
3
1
|
import { Q as PostListParams, S as PostsResponse, J as Post, L as PostCreate, N as PostUpdate, d as VersionInfo, a as PostContent, k as Category, $ as CategoryCreate, v as AccessKey } from './types.d-DLE9TSql.js';
|
|
4
2
|
import { T as Profile, a4 as CreateProfileInput, a5 as UpdateProfileInput, U as ProfileFilter, a6 as AddFilterInput, aI as Timeline, A as Account, ai as PlatformSettings } from './types.d-BgSkvLhS.js';
|
|
3
|
+
import { A as ApiKey, P as Project, g as UpsertProject, r as GetConfigResult, n as SaveConfigRequest, M as Milestone, G as Goal, o as TaskWithDetails, h as UpsertTodo, i as UpsertTag, H as HistoryAction, u as TagWithTypedColor } from './types.d-KTbLqF_P.js';
|
|
4
|
+
export { m as ProjectConfig, T as Task } from './types.d-KTbLqF_P.js';
|
|
5
5
|
import { Result } from '@f0rbit/corpus';
|
|
6
6
|
export { Result, err, ok } from '@f0rbit/corpus';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
|
-
import './schema.d-DcPuyqgh.js';
|
|
10
|
-
import 'drizzle-orm/sqlite-core';
|
|
11
9
|
import './media.d-CQ56ckoR.js';
|
|
10
|
+
import 'drizzle-orm/sqlite-core';
|
|
11
|
+
import './schema.d-DcPuyqgh.js';
|
|
12
12
|
|
|
13
|
+
interface BufferedQueue<T> {
|
|
14
|
+
latest(): T | null;
|
|
15
|
+
list(): T[];
|
|
16
|
+
add(item: T): void;
|
|
17
|
+
size(): number;
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
13
20
|
type RequestOptions = {
|
|
14
21
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
15
22
|
headers?: Record<string, string>;
|
|
@@ -92,7 +99,10 @@ declare class ApiClient {
|
|
|
92
99
|
list: () => Promise<ApiResult<ApiKey[]>>;
|
|
93
100
|
create: (name?: string) => Promise<ApiResult<{
|
|
94
101
|
message: string;
|
|
95
|
-
key:
|
|
102
|
+
key: {
|
|
103
|
+
key: ApiKey;
|
|
104
|
+
raw_key: string;
|
|
105
|
+
};
|
|
96
106
|
}>>;
|
|
97
107
|
revoke: (key_id: string) => Promise<ApiResult<{
|
|
98
108
|
message: string;
|
|
@@ -212,6 +222,7 @@ declare class ApiClient {
|
|
|
212
222
|
description?: string;
|
|
213
223
|
target_time?: string;
|
|
214
224
|
target_version?: string;
|
|
225
|
+
finished_at?: string;
|
|
215
226
|
}) => Promise<ApiResult<Milestone>>;
|
|
216
227
|
/**
|
|
217
228
|
* Update milestone
|
|
@@ -221,6 +232,7 @@ declare class ApiClient {
|
|
|
221
232
|
description?: string;
|
|
222
233
|
target_time?: string;
|
|
223
234
|
target_version?: string;
|
|
235
|
+
finished_at?: string | null;
|
|
224
236
|
}) => Promise<ApiResult<Milestone>>;
|
|
225
237
|
/**
|
|
226
238
|
* Delete milestone (soft delete)
|
|
@@ -254,6 +266,7 @@ declare class ApiClient {
|
|
|
254
266
|
name: string;
|
|
255
267
|
description?: string;
|
|
256
268
|
target_time?: string;
|
|
269
|
+
finished_at?: string;
|
|
257
270
|
}) => Promise<ApiResult<Goal>>;
|
|
258
271
|
/**
|
|
259
272
|
* Update goal
|
|
@@ -262,6 +275,7 @@ declare class ApiClient {
|
|
|
262
275
|
name?: string;
|
|
263
276
|
description?: string;
|
|
264
277
|
target_time?: string;
|
|
278
|
+
finished_at?: string | null;
|
|
265
279
|
}) => Promise<ApiResult<Goal>>;
|
|
266
280
|
/**
|
|
267
281
|
* Delete goal (soft delete)
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ArrayBufferedQueue,
|
|
3
2
|
save_config_request,
|
|
4
3
|
save_tags_request,
|
|
5
4
|
upsert_goal,
|
|
6
5
|
upsert_milestone,
|
|
7
6
|
upsert_project,
|
|
8
7
|
upsert_todo
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7SQVSGWV.js";
|
|
10
9
|
|
|
11
10
|
// src/errors.ts
|
|
12
11
|
var ApiError = class _ApiError extends Error {
|
|
@@ -185,6 +184,44 @@ function getUserFriendlyErrorMessage(error) {
|
|
|
185
184
|
}
|
|
186
185
|
|
|
187
186
|
// src/request.ts
|
|
187
|
+
var ArrayBufferedQueue = class {
|
|
188
|
+
constructor(_capacity) {
|
|
189
|
+
this._capacity = _capacity;
|
|
190
|
+
this._entries = [];
|
|
191
|
+
this._head = 0;
|
|
192
|
+
this._tail = 0;
|
|
193
|
+
this._size = 0;
|
|
194
|
+
}
|
|
195
|
+
latest() {
|
|
196
|
+
if (this._size === 0) return null;
|
|
197
|
+
return this._entries[this._tail - 1] ?? null;
|
|
198
|
+
}
|
|
199
|
+
list() {
|
|
200
|
+
if (this._size === 0) return [];
|
|
201
|
+
if (this._head < this._tail) {
|
|
202
|
+
return this._entries.slice(this._head, this._tail);
|
|
203
|
+
}
|
|
204
|
+
return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
|
|
205
|
+
}
|
|
206
|
+
add(item) {
|
|
207
|
+
if (this._size === this._capacity) {
|
|
208
|
+
this._head = (this._head + 1) % this._capacity;
|
|
209
|
+
} else {
|
|
210
|
+
this._size++;
|
|
211
|
+
}
|
|
212
|
+
this._entries[this._tail] = item;
|
|
213
|
+
this._tail = (this._tail + 1) % this._capacity;
|
|
214
|
+
}
|
|
215
|
+
size() {
|
|
216
|
+
return this._size;
|
|
217
|
+
}
|
|
218
|
+
clear() {
|
|
219
|
+
this._entries = [];
|
|
220
|
+
this._head = 0;
|
|
221
|
+
this._tail = 0;
|
|
222
|
+
this._size = 0;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
188
225
|
var ApiClient = class {
|
|
189
226
|
constructor(options) {
|
|
190
227
|
this.category = "api";
|
|
@@ -199,9 +236,7 @@ var ApiClient = class {
|
|
|
199
236
|
this.credentials = options.credentials;
|
|
200
237
|
this.default_headers = options.default_headers ?? {};
|
|
201
238
|
this.custom_fetch = options.custom_fetch;
|
|
202
|
-
this.request_history = new ArrayBufferedQueue(
|
|
203
|
-
options.max_history_size ?? 5
|
|
204
|
-
);
|
|
239
|
+
this.request_history = new ArrayBufferedQueue(options.max_history_size ?? 5);
|
|
205
240
|
this.debug = options.debug ?? false;
|
|
206
241
|
}
|
|
207
242
|
buildUrl(path, query) {
|
|
@@ -223,10 +258,7 @@ var ApiClient = class {
|
|
|
223
258
|
const startTime = Date.now();
|
|
224
259
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
225
260
|
if (this.debug) {
|
|
226
|
-
console.log(
|
|
227
|
-
`[DEBUG][${this.category}] ${method} ${path} [${requestId}]`,
|
|
228
|
-
{ body, query }
|
|
229
|
-
);
|
|
261
|
+
console.log(`[DEBUG][${this.category}] ${method} ${path} [${requestId}]`, { body, query });
|
|
230
262
|
}
|
|
231
263
|
const request_headers = {
|
|
232
264
|
"Content-Type": "application/json",
|
|
@@ -266,15 +298,12 @@ var ApiClient = class {
|
|
|
266
298
|
historyEntry.duration = duration;
|
|
267
299
|
if (!response.ok) {
|
|
268
300
|
if (this.debug) {
|
|
269
|
-
console.log(
|
|
270
|
-
|
|
271
|
-
{
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
query
|
|
276
|
-
}
|
|
277
|
-
);
|
|
301
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
302
|
+
status: response.status,
|
|
303
|
+
duration: `${duration}ms`,
|
|
304
|
+
body,
|
|
305
|
+
query
|
|
306
|
+
});
|
|
278
307
|
}
|
|
279
308
|
try {
|
|
280
309
|
handleHttpResponse(response);
|
|
@@ -303,28 +332,22 @@ var ApiClient = class {
|
|
|
303
332
|
}
|
|
304
333
|
}
|
|
305
334
|
if (this.debug) {
|
|
306
|
-
console.log(
|
|
307
|
-
|
|
308
|
-
{
|
|
309
|
-
|
|
310
|
-
duration: `${duration}ms`
|
|
311
|
-
}
|
|
312
|
-
);
|
|
335
|
+
console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
|
|
336
|
+
status: response.status,
|
|
337
|
+
duration: `${duration}ms`
|
|
338
|
+
});
|
|
313
339
|
}
|
|
314
340
|
return result;
|
|
315
341
|
} catch (error) {
|
|
316
342
|
const duration = Date.now() - startTime;
|
|
317
343
|
if (this.debug) {
|
|
318
|
-
console.log(
|
|
319
|
-
|
|
320
|
-
{
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
query
|
|
326
|
-
}
|
|
327
|
-
);
|
|
344
|
+
console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
|
|
345
|
+
url,
|
|
346
|
+
duration: `${duration}ms`,
|
|
347
|
+
error: error instanceof Error ? error.message : String(error),
|
|
348
|
+
body,
|
|
349
|
+
query
|
|
350
|
+
});
|
|
328
351
|
}
|
|
329
352
|
if (error instanceof ApiError || error instanceof AuthenticationError) {
|
|
330
353
|
throw error;
|
|
@@ -604,7 +627,8 @@ var ApiClient2 = class {
|
|
|
604
627
|
name: data.name ?? milestone.name,
|
|
605
628
|
description: data.description ?? milestone.description,
|
|
606
629
|
target_time: data.target_time ?? milestone.target_time,
|
|
607
|
-
target_version: data.target_version ?? milestone.target_version
|
|
630
|
+
target_version: data.target_version ?? milestone.target_version,
|
|
631
|
+
finished_at: data.finished_at !== void 0 ? data.finished_at : milestone.finished_at
|
|
608
632
|
};
|
|
609
633
|
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
610
634
|
body: updateData
|
|
@@ -648,7 +672,8 @@ var ApiClient2 = class {
|
|
|
648
672
|
milestone_id: goal.milestone_id,
|
|
649
673
|
name: data.name ?? goal.name,
|
|
650
674
|
description: data.description ?? goal.description,
|
|
651
|
-
target_time: data.target_time ?? goal.target_time
|
|
675
|
+
target_time: data.target_time ?? goal.target_time,
|
|
676
|
+
finished_at: data.finished_at !== void 0 ? data.finished_at : goal.finished_at
|
|
652
677
|
};
|
|
653
678
|
return this.clients.goals.patch(`/goals/${id}`, {
|
|
654
679
|
body: updateData
|
|
@@ -1076,13 +1101,15 @@ var tools = {
|
|
|
1076
1101
|
name: input.name,
|
|
1077
1102
|
description: input.description,
|
|
1078
1103
|
target_time: input.target_time,
|
|
1079
|
-
target_version: input.target_version
|
|
1104
|
+
target_version: input.target_version,
|
|
1105
|
+
finished_at: input.finished_at
|
|
1080
1106
|
}) : await client.milestones.create({
|
|
1081
1107
|
project_id: input.project_id,
|
|
1082
1108
|
name: input.name,
|
|
1083
1109
|
description: input.description,
|
|
1084
1110
|
target_time: input.target_time,
|
|
1085
|
-
target_version: input.target_version
|
|
1111
|
+
target_version: input.target_version,
|
|
1112
|
+
finished_at: input.finished_at
|
|
1086
1113
|
})
|
|
1087
1114
|
)
|
|
1088
1115
|
},
|
|
@@ -1107,12 +1134,14 @@ var tools = {
|
|
|
1107
1134
|
input.id ? await client.goals.update(input.id, {
|
|
1108
1135
|
name: input.name,
|
|
1109
1136
|
description: input.description,
|
|
1110
|
-
target_time: input.target_time
|
|
1137
|
+
target_time: input.target_time,
|
|
1138
|
+
finished_at: input.finished_at
|
|
1111
1139
|
}) : await client.goals.create({
|
|
1112
1140
|
milestone_id: input.milestone_id,
|
|
1113
1141
|
name: input.name,
|
|
1114
1142
|
description: input.description,
|
|
1115
|
-
target_time: input.target_time
|
|
1143
|
+
target_time: input.target_time,
|
|
1144
|
+
finished_at: input.finished_at
|
|
1116
1145
|
})
|
|
1117
1146
|
)
|
|
1118
1147
|
},
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { b as ApiError, A as AuthExpiredError, d as BadRequestError, B as BaseError, C as ConflictError, h as CronError, D as DatabaseError, E as EncryptionError, i as ErrorContext, j as ErrorLogEntry, F as ForbiddenError, G as GithubError, a as NetworkError, N as NotFoundError, P as ParseError, c as ProtectedError, g as ProviderError, R as RateLimitedError, e as ScanError, f as ServiceError, S as StoreError, U as UnauthorizedError, V as ValidationError, Y as apiError, X as authExpired, a2 as badRequest, k as configureErrorLogging, a0 as conflict, $ as dbError, _ as encryptionError, a6 as errors, M as forbidden, a5 as githubError, s as isApiError, r as isAuthExpiredError, y as isBadRequestError, w as isConflictError, v as isDatabaseError, u as isEncryptionError, m as isForbiddenError, I as isGithubError, q as isNetworkError, l as isNotFoundError, t as isParseError, x as isProtectedError, o as isRateLimitedError, K as isRetryableError, H as isScanError, J as isServiceError, p as isStoreError, z as isUnauthorizedError, n as isValidationError, W as networkError, L as notFound, Z as parseError, a1 as protectedEntity, Q as rateLimited, a4 as scanError, T as storeError, a3 as unauthorized, O as validation } from '../errors.d-DcjQAql-.js';
|
|
2
|
-
export { c as Action,
|
|
2
|
+
export { c as Action, A as ApiKey, C as CodebaseTask, z as ConfigSchemaType, r as GetConfigResult, G as Goal, H as HistoryAction, I as IgnorePath, M as Milestone, N as Nullable, P as Project, m as ProjectConfig, p as ProjectWithTasks, n as SaveConfigRequest, w as ScanStatus, S as Session, s as TAG_COLOURS, a as Tag, t as TagColor, f as TagConfig, q as TagWithColor, u as TagWithTypedColor, T as Task, b as TaskTag, v as TaskView, o as TaskWithDetails, d as TodoUpdate, e as TrackerResult, l as UpdateAction, x as UpdateData, y as UpdateUser, k as UpsertGoal, j as UpsertMilestone, g as UpsertProject, i as UpsertTag, h as UpsertTodo, U as User, Q as config_schema, J as project_config, K as save_config_request, L as save_tags_request, E as update_action, O as update_user, V as upsert_goal, R as upsert_milestone, B as upsert_project, F as upsert_tag, D as upsert_todo } from '../types.d-KTbLqF_P.js';
|
|
3
3
|
import '@f0rbit/corpus';
|
|
4
4
|
import 'drizzle-orm';
|
|
5
5
|
import 'zod';
|
package/dist/schema/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ArrayBufferedQueue,
|
|
3
|
-
ConfigSchema,
|
|
4
|
-
TAG_COLOURS,
|
|
5
2
|
config_schema,
|
|
6
3
|
project_config,
|
|
7
4
|
save_config_request,
|
|
@@ -13,7 +10,7 @@ import {
|
|
|
13
10
|
upsert_project,
|
|
14
11
|
upsert_tag,
|
|
15
12
|
upsert_todo
|
|
16
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-7SQVSGWV.js";
|
|
17
14
|
import {
|
|
18
15
|
apiError,
|
|
19
16
|
authExpired,
|
|
@@ -54,9 +51,22 @@ import {
|
|
|
54
51
|
unauthorized,
|
|
55
52
|
validation
|
|
56
53
|
} from "../chunk-5ALH7B5B.js";
|
|
54
|
+
|
|
55
|
+
// ../schema/dist/types.js
|
|
56
|
+
var TAG_COLOURS = {
|
|
57
|
+
red: { colour: "#F28B82", text: "#faeeef", border: "#F5A5A5" },
|
|
58
|
+
green: { colour: "#CCFF90", text: "#2E7D32", border: "#A5D6A7" },
|
|
59
|
+
blue: { colour: "#82B1FF", text: "#0D47A1", border: "#90CAF9" },
|
|
60
|
+
yellow: { colour: "#FFF176", text: "#F57F17", border: "#FFF59D" },
|
|
61
|
+
purple: { colour: "#E1BEE7", text: "#4A148C", border: "#CE93D8" },
|
|
62
|
+
orange: { colour: "#FFCC80", text: "#E65100", border: "#FFB74D" },
|
|
63
|
+
teal: { colour: "#80CBC4", text: "#004D40", border: "#4DB6AC" },
|
|
64
|
+
pink: { colour: "#F8BBD9", text: "#880E4F", border: "#F48FB1" },
|
|
65
|
+
gray: { colour: "#CFD8DC", text: "#37474F", border: "#B0BEC5" },
|
|
66
|
+
cyan: { colour: "#84FFFF", text: "#006064", border: "#4DD0E1" },
|
|
67
|
+
lime: { colour: "#ddf0bc", text: "#88b47f", border: "#becca5" }
|
|
68
|
+
};
|
|
57
69
|
export {
|
|
58
|
-
ArrayBufferedQueue,
|
|
59
|
-
ConfigSchema,
|
|
60
70
|
TAG_COLOURS,
|
|
61
71
|
apiError,
|
|
62
72
|
authExpired,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InferSelectModel
|
|
1
|
+
import { InferSelectModel } from 'drizzle-orm';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { a as api_keys, p as project, m as milestone, g as goal, t as task, c as codebase_tasks, b as action, A as ActionType, d as tag, u as user, s as session, e as task_tag, f as todo_updates, h as tracker_result, i as tag_config, j as ignore_path } from './schema.d-DcPuyqgh.js';
|
|
4
4
|
|
|
@@ -98,31 +98,6 @@ declare const upsert_todo: z.ZodObject<{
|
|
|
98
98
|
force?: boolean | undefined;
|
|
99
99
|
}>;
|
|
100
100
|
declare const update_action: z.ZodUnion<[z.ZodLiteral<"CONFIRM">, z.ZodLiteral<"UNLINK">, z.ZodLiteral<"CREATE">, z.ZodLiteral<"IGNORE">, z.ZodLiteral<"DELETE">, z.ZodLiteral<"COMPLETE">]>;
|
|
101
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
102
|
-
tags: z.ZodArray<z.ZodObject<{
|
|
103
|
-
name: z.ZodString;
|
|
104
|
-
match: z.ZodArray<z.ZodString, "many">;
|
|
105
|
-
}, "strip", z.ZodTypeAny, {
|
|
106
|
-
match: string[];
|
|
107
|
-
name: string;
|
|
108
|
-
}, {
|
|
109
|
-
match: string[];
|
|
110
|
-
name: string;
|
|
111
|
-
}>, "many">;
|
|
112
|
-
ignore: z.ZodArray<z.ZodString, "many">;
|
|
113
|
-
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
tags: {
|
|
115
|
-
match: string[];
|
|
116
|
-
name: string;
|
|
117
|
-
}[];
|
|
118
|
-
ignore: string[];
|
|
119
|
-
}, {
|
|
120
|
-
tags: {
|
|
121
|
-
match: string[];
|
|
122
|
-
name: string;
|
|
123
|
-
}[];
|
|
124
|
-
ignore: string[];
|
|
125
|
-
}>;
|
|
126
101
|
declare const upsert_tag: z.ZodObject<{
|
|
127
102
|
id: z.ZodOptional<z.ZodString>;
|
|
128
103
|
title: z.ZodString;
|
|
@@ -357,21 +332,6 @@ type TodoUpdate = InferSelectModel<typeof todo_updates>;
|
|
|
357
332
|
type TrackerResult = InferSelectModel<typeof tracker_result>;
|
|
358
333
|
type TagConfig = InferSelectModel<typeof tag_config>;
|
|
359
334
|
type IgnorePath = InferSelectModel<typeof ignore_path>;
|
|
360
|
-
type InsertUser = InferInsertModel<typeof user>;
|
|
361
|
-
type InsertSession = InferInsertModel<typeof session>;
|
|
362
|
-
type InsertApiKey = InferInsertModel<typeof api_keys>;
|
|
363
|
-
type InsertProject = InferInsertModel<typeof project>;
|
|
364
|
-
type InsertTask = InferInsertModel<typeof task>;
|
|
365
|
-
type InsertTag = InferInsertModel<typeof tag>;
|
|
366
|
-
type InsertMilestone = InferInsertModel<typeof milestone>;
|
|
367
|
-
type InsertGoal = InferInsertModel<typeof goal>;
|
|
368
|
-
type InsertTaskTag = InferInsertModel<typeof task_tag>;
|
|
369
|
-
type InsertAction = InferInsertModel<typeof action>;
|
|
370
|
-
type InsertCodebaseTask = InferInsertModel<typeof codebase_tasks>;
|
|
371
|
-
type InsertTodoUpdate = InferInsertModel<typeof todo_updates>;
|
|
372
|
-
type InsertTrackerResult = InferInsertModel<typeof tracker_result>;
|
|
373
|
-
type InsertTagConfig = InferInsertModel<typeof tag_config>;
|
|
374
|
-
type InsertIgnorePath = InferInsertModel<typeof ignore_path>;
|
|
375
335
|
type UpsertProject = z.infer<typeof upsert_project>;
|
|
376
336
|
type UpsertTodo = z.infer<typeof upsert_todo>;
|
|
377
337
|
type UpsertTag = z.infer<typeof upsert_tag>;
|
|
@@ -380,7 +340,6 @@ type UpsertGoal = z.infer<typeof upsert_goal>;
|
|
|
380
340
|
type UpdateAction = z.infer<typeof update_action>;
|
|
381
341
|
type ProjectConfig = z.infer<typeof project_config>;
|
|
382
342
|
type SaveConfigRequest = z.infer<typeof save_config_request>;
|
|
383
|
-
type SaveTagsRequest = z.infer<typeof save_tags_request>;
|
|
384
343
|
interface TaskWithDetails {
|
|
385
344
|
task: Task;
|
|
386
345
|
codebase_tasks: CodebaseTask | null;
|
|
@@ -462,49 +421,14 @@ type _FetchedTag = InferSelectModel<typeof tag>;
|
|
|
462
421
|
type TagWithTypedColor = Omit<_FetchedTag, "color"> & {
|
|
463
422
|
color: TagColor | null;
|
|
464
423
|
};
|
|
465
|
-
interface ApiClientConfig {
|
|
466
|
-
baseUrl: string;
|
|
467
|
-
apiKey: string;
|
|
468
|
-
}
|
|
469
|
-
interface RequestOptions {
|
|
470
|
-
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
471
|
-
headers?: Record<string, string>;
|
|
472
|
-
body?: object;
|
|
473
|
-
query?: Record<string, string>;
|
|
474
|
-
}
|
|
475
424
|
type Nullable<T> = {
|
|
476
425
|
[P in keyof T]: T[P] | null;
|
|
477
426
|
};
|
|
478
427
|
type TaskView = "list" | "grid";
|
|
479
428
|
type ScanStatus = "PENDING" | "ACCEPTED" | "REJECTED" | "IGNORED";
|
|
480
|
-
interface ScanStatusRequest {
|
|
481
|
-
project_id: string;
|
|
482
|
-
update_id: number;
|
|
483
|
-
actions: Record<string, string[]>;
|
|
484
|
-
titles: Record<string, string>;
|
|
485
|
-
approved: boolean;
|
|
486
|
-
}
|
|
487
|
-
interface ScanUpdate {
|
|
488
|
-
id: number;
|
|
489
|
-
project_id: string;
|
|
490
|
-
old_id: number | null;
|
|
491
|
-
new_id: number;
|
|
492
|
-
data: string;
|
|
493
|
-
status: "PENDING" | "ACCEPTED" | "REJECTED" | "IGNORED";
|
|
494
|
-
branch?: string;
|
|
495
|
-
commit_sha?: string;
|
|
496
|
-
commit_msg?: string;
|
|
497
|
-
commit_url?: string;
|
|
498
|
-
created_at: string;
|
|
499
|
-
}
|
|
500
429
|
type HistoryAction = Omit<Action, "updated_at" | "owner_id" | "type"> & {
|
|
501
430
|
type: ActionType | "SCAN";
|
|
502
431
|
};
|
|
503
|
-
interface ApiResponse<T> {
|
|
504
|
-
success: boolean;
|
|
505
|
-
data?: T;
|
|
506
|
-
error?: string;
|
|
507
|
-
}
|
|
508
432
|
interface UpdateData {
|
|
509
433
|
id: string;
|
|
510
434
|
tag: string;
|
|
@@ -527,25 +451,5 @@ interface UpdateData {
|
|
|
527
451
|
}
|
|
528
452
|
type UpdateUser = z.infer<typeof update_user>;
|
|
529
453
|
type ConfigSchemaType = z.infer<typeof config_schema>;
|
|
530
|
-
interface BufferedQueue<T> {
|
|
531
|
-
latest(): T | null;
|
|
532
|
-
list(): T[];
|
|
533
|
-
add(item: T): void;
|
|
534
|
-
size(): number;
|
|
535
|
-
clear(): void;
|
|
536
|
-
}
|
|
537
|
-
declare class ArrayBufferedQueue<T> implements BufferedQueue<T> {
|
|
538
|
-
private _capacity;
|
|
539
|
-
private _entries;
|
|
540
|
-
private _head;
|
|
541
|
-
private _tail;
|
|
542
|
-
private _size;
|
|
543
|
-
constructor(_capacity: number);
|
|
544
|
-
latest(): T | null;
|
|
545
|
-
list(): T[];
|
|
546
|
-
add(item: T): void;
|
|
547
|
-
size(): number;
|
|
548
|
-
clear(): void;
|
|
549
|
-
}
|
|
550
454
|
|
|
551
|
-
export { type
|
|
455
|
+
export { type ApiKey as A, upsert_project as B, type CodebaseTask as C, upsert_todo as D, update_action as E, upsert_tag as F, type Goal as G, type HistoryAction as H, type IgnorePath as I, project_config as J, save_config_request as K, save_tags_request as L, type Milestone as M, type Nullable as N, update_user as O, type Project as P, config_schema as Q, upsert_milestone as R, type Session as S, type Task as T, type User as U, upsert_goal as V, type Tag as a, type TaskTag as b, type Action as c, type TodoUpdate as d, type TrackerResult as e, type TagConfig as f, type UpsertProject as g, type UpsertTodo as h, type UpsertTag as i, type UpsertMilestone as j, type UpsertGoal as k, type UpdateAction as l, type ProjectConfig as m, type SaveConfigRequest as n, type TaskWithDetails as o, type ProjectWithTasks as p, type TagWithColor as q, type GetConfigResult as r, TAG_COLOURS as s, type TagColor as t, type TagWithTypedColor as u, type TaskView as v, type ScanStatus as w, type UpdateData as x, type UpdateUser as y, type ConfigSchemaType as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devpad/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "f0rbit",
|
|
6
6
|
"url": "https://github.com/f0rbit"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"zod": "^3.22.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@devpad/schema": "^2.
|
|
30
|
+
"@devpad/schema": "^2.1.2",
|
|
31
31
|
"@types/node": "^20.11.24",
|
|
32
32
|
"bun-types": "latest",
|
|
33
33
|
"eslint": "^8.57.0",
|