@devpad/api 2.0.2 → 2.0.4
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/{chunk-5X36WMYQ.js → chunk-5ALH7B5B.js} +7 -1
- package/dist/{chunk-WTGVONUB.js → chunk-XGQQPYSB.js} +8 -4
- package/dist/{errors.d-C73AkrdX.d.ts → errors.d-DcjQAql-.d.ts} +12 -2
- package/dist/index.d.ts +14 -6
- package/dist/index.js +150 -48
- package/dist/{media.d-R87HGuRp.d.ts → media.d-CQ56ckoR.d.ts} +1 -1
- package/dist/schema/blog.d.ts +529 -607
- package/dist/schema/blog.js +10 -81
- package/dist/schema/index.d.ts +5 -5
- package/dist/schema/index.js +6 -82
- package/dist/schema/media.d.ts +8 -9
- package/dist/schema/media.js +6 -98
- package/dist/{schema.d-BceDyQED.d.ts → schema.d-DcPuyqgh.d.ts} +414 -531
- package/dist/{types.d-UV8B6hPN.d.ts → types.d-BgSkvLhS.d.ts} +4286 -4286
- package/dist/{types.d-CoHRMrYJ.d.ts → types.d-CeY2wsr4.d.ts} +13 -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
|
@@ -29,11 +29,12 @@ var isParseError = (e) => hasKind(e, "parse_error");
|
|
|
29
29
|
var isEncryptionError = (e) => hasKind(e, "encryption_error");
|
|
30
30
|
var isDatabaseError = (e) => hasKind(e, "db_error");
|
|
31
31
|
var isConflictError = (e) => hasKind(e, "conflict");
|
|
32
|
+
var isProtectedError = (e) => hasKind(e, "protected");
|
|
32
33
|
var isBadRequestError = (e) => hasKind(e, "bad_request");
|
|
33
34
|
var isUnauthorizedError = (e) => hasKind(e, "unauthorized");
|
|
34
35
|
var isScanError = (e) => hasKind(e, "scan_error");
|
|
35
36
|
var isGithubError = (e) => hasKind(e, "github_error");
|
|
36
|
-
var isServiceError = (e) => isNotFoundError(e) || isForbiddenError(e) || isValidationError(e) || isRateLimitedError(e) || isStoreError(e) || isNetworkError(e) || isAuthExpiredError(e) || isApiError(e) || isParseError(e) || isEncryptionError(e) || isDatabaseError(e) || isConflictError(e) || isBadRequestError(e) || isUnauthorizedError(e) || isScanError(e) || isGithubError(e);
|
|
37
|
+
var isServiceError = (e) => isNotFoundError(e) || isForbiddenError(e) || isValidationError(e) || isRateLimitedError(e) || isStoreError(e) || isNetworkError(e) || isAuthExpiredError(e) || isApiError(e) || isParseError(e) || isEncryptionError(e) || isDatabaseError(e) || isConflictError(e) || isProtectedError(e) || isBadRequestError(e) || isUnauthorizedError(e) || isScanError(e) || isGithubError(e);
|
|
37
38
|
var isRetryableError = (e) => isRateLimitedError(e) || isNetworkError(e);
|
|
38
39
|
var notFound = (resource, id, ctx) => logAndReturn({ kind: "not_found", resource, ...id && { id } }, ctx);
|
|
39
40
|
var forbidden = (reason, ctx) => logAndReturn({ kind: "forbidden", ...reason && { reason, message: reason } }, ctx);
|
|
@@ -47,6 +48,7 @@ var parseError = (message, ctx) => logAndReturn({ kind: "parse_error", ...messag
|
|
|
47
48
|
var encryptionError = (operation, message, ctx) => logAndReturn({ kind: "encryption_error", operation, ...message && { message } }, ctx);
|
|
48
49
|
var dbError = (message, ctx) => logAndReturn({ kind: "db_error", ...message && { message } }, ctx);
|
|
49
50
|
var conflict = (resource, message, ctx) => logAndReturn({ kind: "conflict", ...resource && { resource }, ...message && { message } }, ctx);
|
|
51
|
+
var protectedEntity = (entity_id, message, modified_by, modified_at, ctx) => logAndReturn({ kind: "protected", ...entity_id && { entity_id }, ...message && { message }, ...modified_by && { modified_by }, ...modified_at && { modified_at } }, ctx);
|
|
50
52
|
var badRequest = (message, details, ctx) => logAndReturn({ kind: "bad_request", ...message && { message }, ...details !== void 0 && { details } }, ctx);
|
|
51
53
|
var unauthorized = (message, ctx) => logAndReturn({ kind: "unauthorized", ...message && { message } }, ctx);
|
|
52
54
|
var scanError = (message, ctx) => logAndReturn({ kind: "scan_error", ...message && { message } }, ctx);
|
|
@@ -64,6 +66,7 @@ var errors = {
|
|
|
64
66
|
encryptionError,
|
|
65
67
|
dbError,
|
|
66
68
|
conflict,
|
|
69
|
+
protectedEntity,
|
|
67
70
|
badRequest,
|
|
68
71
|
unauthorized,
|
|
69
72
|
scanError,
|
|
@@ -81,6 +84,7 @@ var errors = {
|
|
|
81
84
|
encryptionError: isEncryptionError,
|
|
82
85
|
dbError: isDatabaseError,
|
|
83
86
|
conflict: isConflictError,
|
|
87
|
+
protectedEntity: isProtectedError,
|
|
84
88
|
badRequest: isBadRequestError,
|
|
85
89
|
unauthorized: isUnauthorizedError,
|
|
86
90
|
scanError: isScanError,
|
|
@@ -104,6 +108,7 @@ export {
|
|
|
104
108
|
isEncryptionError,
|
|
105
109
|
isDatabaseError,
|
|
106
110
|
isConflictError,
|
|
111
|
+
isProtectedError,
|
|
107
112
|
isBadRequestError,
|
|
108
113
|
isUnauthorizedError,
|
|
109
114
|
isScanError,
|
|
@@ -122,6 +127,7 @@ export {
|
|
|
122
127
|
encryptionError,
|
|
123
128
|
dbError,
|
|
124
129
|
conflict,
|
|
130
|
+
protectedEntity,
|
|
125
131
|
badRequest,
|
|
126
132
|
unauthorized,
|
|
127
133
|
scanError,
|
|
@@ -70,7 +70,8 @@ var upsert_project = z.object({
|
|
|
70
70
|
link_url: z.string().nullable(),
|
|
71
71
|
link_text: z.string().nullable(),
|
|
72
72
|
visibility: z.union([z.literal("PUBLIC"), z.literal("PRIVATE"), z.literal("HIDDEN"), z.literal("ARCHIVED"), z.literal("DRAFT"), z.literal("DELETED")]).optional(),
|
|
73
|
-
current_version: z.string().nullable()
|
|
73
|
+
current_version: z.string().nullable(),
|
|
74
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
74
75
|
});
|
|
75
76
|
var upsert_todo = z.object({
|
|
76
77
|
id: z.string().optional().nullable(),
|
|
@@ -84,7 +85,8 @@ var upsert_todo = z.object({
|
|
|
84
85
|
priority: z.union([z.literal("LOW"), z.literal("MEDIUM"), z.literal("HIGH")]).optional(),
|
|
85
86
|
owner_id: z.string(),
|
|
86
87
|
project_id: z.string().optional().nullable(),
|
|
87
|
-
goal_id: z.string().optional().nullable()
|
|
88
|
+
goal_id: z.string().optional().nullable(),
|
|
89
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
88
90
|
});
|
|
89
91
|
var update_action = z.union([z.literal("CONFIRM"), z.literal("UNLINK"), z.literal("CREATE"), z.literal("IGNORE"), z.literal("DELETE"), z.literal("COMPLETE")]);
|
|
90
92
|
var ConfigSchema = z.object({
|
|
@@ -137,7 +139,8 @@ var upsert_milestone = z.object({
|
|
|
137
139
|
target_time: z.string().nullable().optional(),
|
|
138
140
|
target_version: z.string().nullable().optional(),
|
|
139
141
|
finished_at: z.string().nullable().optional(),
|
|
140
|
-
after_id: z.string().nullable().optional()
|
|
142
|
+
after_id: z.string().nullable().optional(),
|
|
143
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
141
144
|
});
|
|
142
145
|
var upsert_goal = z.object({
|
|
143
146
|
id: z.string().optional().nullable(),
|
|
@@ -145,7 +148,8 @@ var upsert_goal = z.object({
|
|
|
145
148
|
name: z.string().min(1).max(200),
|
|
146
149
|
description: z.string().nullable().optional(),
|
|
147
150
|
target_time: z.string().nullable().optional(),
|
|
148
|
-
finished_at: z.string().nullable().optional()
|
|
151
|
+
finished_at: z.string().nullable().optional(),
|
|
152
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
149
153
|
});
|
|
150
154
|
|
|
151
155
|
export {
|
|
@@ -50,6 +50,12 @@ type ConflictError = BaseError & {
|
|
|
50
50
|
kind: "conflict";
|
|
51
51
|
resource?: string;
|
|
52
52
|
};
|
|
53
|
+
type ProtectedError = BaseError & {
|
|
54
|
+
kind: "protected";
|
|
55
|
+
entity_id?: string;
|
|
56
|
+
modified_by?: string;
|
|
57
|
+
modified_at?: string;
|
|
58
|
+
};
|
|
53
59
|
type BadRequestError = BaseError & {
|
|
54
60
|
kind: "bad_request";
|
|
55
61
|
details?: unknown;
|
|
@@ -63,7 +69,7 @@ type ScanError = BaseError & {
|
|
|
63
69
|
type GithubError = BaseError & {
|
|
64
70
|
kind: "github_error";
|
|
65
71
|
};
|
|
66
|
-
type ServiceError = NotFoundError | ForbiddenError | ValidationError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | BadRequestError | UnauthorizedError | ScanError | GithubError;
|
|
72
|
+
type ServiceError = NotFoundError | ForbiddenError | ValidationError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | ProtectedError | BadRequestError | UnauthorizedError | ScanError | GithubError;
|
|
67
73
|
type ProviderError = RateLimitedError | AuthExpiredError | NetworkError | ApiError | ParseError;
|
|
68
74
|
type CronError = StoreError | NetworkError | AuthExpiredError | EncryptionError;
|
|
69
75
|
type ErrorContext = {
|
|
@@ -95,6 +101,7 @@ declare const isParseError: (e: unknown) => e is ParseError;
|
|
|
95
101
|
declare const isEncryptionError: (e: unknown) => e is EncryptionError;
|
|
96
102
|
declare const isDatabaseError: (e: unknown) => e is DatabaseError;
|
|
97
103
|
declare const isConflictError: (e: unknown) => e is ConflictError;
|
|
104
|
+
declare const isProtectedError: (e: unknown) => e is ProtectedError;
|
|
98
105
|
declare const isBadRequestError: (e: unknown) => e is BadRequestError;
|
|
99
106
|
declare const isUnauthorizedError: (e: unknown) => e is UnauthorizedError;
|
|
100
107
|
declare const isScanError: (e: unknown) => e is ScanError;
|
|
@@ -113,6 +120,7 @@ declare const parseError: (message?: string, ctx?: Record<string, unknown>) => R
|
|
|
113
120
|
declare const encryptionError: (operation: "encrypt" | "decrypt", message?: string, ctx?: Record<string, unknown>) => Result<never, EncryptionError>;
|
|
114
121
|
declare const dbError: (message?: string, ctx?: Record<string, unknown>) => Result<never, DatabaseError>;
|
|
115
122
|
declare const conflict: (resource?: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ConflictError>;
|
|
123
|
+
declare const protectedEntity: (entity_id?: string, message?: string, modified_by?: string, modified_at?: string, ctx?: Record<string, unknown>) => Result<never, ProtectedError>;
|
|
116
124
|
declare const badRequest: (message?: string, details?: unknown, ctx?: Record<string, unknown>) => Result<never, BadRequestError>;
|
|
117
125
|
declare const unauthorized: (message?: string, ctx?: Record<string, unknown>) => Result<never, UnauthorizedError>;
|
|
118
126
|
declare const scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
|
|
@@ -130,6 +138,7 @@ declare const errors: {
|
|
|
130
138
|
readonly encryptionError: (operation: "encrypt" | "decrypt", message?: string, ctx?: Record<string, unknown>) => Result<never, EncryptionError>;
|
|
131
139
|
readonly dbError: (message?: string, ctx?: Record<string, unknown>) => Result<never, DatabaseError>;
|
|
132
140
|
readonly conflict: (resource?: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ConflictError>;
|
|
141
|
+
readonly protectedEntity: (entity_id?: string, message?: string, modified_by?: string, modified_at?: string, ctx?: Record<string, unknown>) => Result<never, ProtectedError>;
|
|
133
142
|
readonly badRequest: (message?: string, details?: unknown, ctx?: Record<string, unknown>) => Result<never, BadRequestError>;
|
|
134
143
|
readonly unauthorized: (message?: string, ctx?: Record<string, unknown>) => Result<never, UnauthorizedError>;
|
|
135
144
|
readonly scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
|
|
@@ -147,6 +156,7 @@ declare const errors: {
|
|
|
147
156
|
readonly encryptionError: (e: unknown) => e is EncryptionError;
|
|
148
157
|
readonly dbError: (e: unknown) => e is DatabaseError;
|
|
149
158
|
readonly conflict: (e: unknown) => e is ConflictError;
|
|
159
|
+
readonly protectedEntity: (e: unknown) => e is ProtectedError;
|
|
150
160
|
readonly badRequest: (e: unknown) => e is BadRequestError;
|
|
151
161
|
readonly unauthorized: (e: unknown) => e is UnauthorizedError;
|
|
152
162
|
readonly scanError: (e: unknown) => e is ScanError;
|
|
@@ -156,4 +166,4 @@ declare const errors: {
|
|
|
156
166
|
};
|
|
157
167
|
};
|
|
158
168
|
|
|
159
|
-
export {
|
|
169
|
+
export { dbError as $, type AuthExpiredError as A, type BaseError as B, type ConflictError as C, type DatabaseError as D, type EncryptionError as E, type ForbiddenError as F, type GithubError as G, isScanError as H, isGithubError as I, isServiceError as J, isRetryableError as K, notFound as L, forbidden as M, type NotFoundError as N, validation as O, type ParseError as P, rateLimited as Q, type RateLimitedError as R, type StoreError as S, storeError as T, type UnauthorizedError as U, type ValidationError as V, networkError as W, authExpired as X, apiError as Y, parseError as Z, encryptionError as _, type NetworkError as a, conflict as a0, protectedEntity as a1, badRequest as a2, unauthorized as a3, scanError as a4, githubError as a5, errors as a6, type ApiError as b, type ProtectedError as c, type BadRequestError as d, type ScanError as e, type ServiceError as f, type ProviderError as g, type CronError as h, type ErrorContext as i, type ErrorLogEntry as j, configureErrorLogging as k, isNotFoundError as l, isForbiddenError as m, isValidationError as n, isRateLimitedError as o, isStoreError as p, isNetworkError as q, isAuthExpiredError as r, isApiError as s, isParseError as t, isEncryptionError as u, isDatabaseError as v, isConflictError as w, isProtectedError as x, isBadRequestError as y, isUnauthorizedError as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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-
|
|
2
|
-
export { D as ProjectConfig, T as Task } from './types.d-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
+
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
|
+
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';
|
|
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-
|
|
9
|
+
import './schema.d-DcPuyqgh.js';
|
|
10
10
|
import 'drizzle-orm/sqlite-core';
|
|
11
|
-
import './media.d-
|
|
11
|
+
import './media.d-CQ56ckoR.js';
|
|
12
12
|
|
|
13
13
|
type RequestOptions = {
|
|
14
14
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
@@ -473,6 +473,14 @@ declare class ApiClient {
|
|
|
473
473
|
/**
|
|
474
474
|
* User namespace with Result-wrapped operations
|
|
475
475
|
*/
|
|
476
|
+
readonly activity: {
|
|
477
|
+
ai: (options?: {
|
|
478
|
+
limit?: number;
|
|
479
|
+
since?: string;
|
|
480
|
+
}) => Promise<ApiResult<{
|
|
481
|
+
sessions: any[];
|
|
482
|
+
}>>;
|
|
483
|
+
};
|
|
476
484
|
readonly user: {
|
|
477
485
|
/**
|
|
478
486
|
* Get user activity history
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,7 @@ import {
|
|
|
6
6
|
upsert_milestone,
|
|
7
7
|
upsert_project,
|
|
8
8
|
upsert_todo
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-5X36WMYQ.js";
|
|
11
|
-
import "./chunk-FOO5XXY5.js";
|
|
9
|
+
} from "./chunk-XGQQPYSB.js";
|
|
12
10
|
|
|
13
11
|
// src/errors.ts
|
|
14
12
|
var ApiError = class _ApiError extends Error {
|
|
@@ -201,7 +199,9 @@ var ApiClient = class {
|
|
|
201
199
|
this.credentials = options.credentials;
|
|
202
200
|
this.default_headers = options.default_headers ?? {};
|
|
203
201
|
this.custom_fetch = options.custom_fetch;
|
|
204
|
-
this.request_history = new ArrayBufferedQueue(
|
|
202
|
+
this.request_history = new ArrayBufferedQueue(
|
|
203
|
+
options.max_history_size ?? 5
|
|
204
|
+
);
|
|
205
205
|
this.debug = options.debug ?? false;
|
|
206
206
|
}
|
|
207
207
|
buildUrl(path, query) {
|
|
@@ -223,7 +223,10 @@ var ApiClient = class {
|
|
|
223
223
|
const startTime = Date.now();
|
|
224
224
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
225
225
|
if (this.debug) {
|
|
226
|
-
console.log(
|
|
226
|
+
console.log(
|
|
227
|
+
`[DEBUG][${this.category}] ${method} ${path} [${requestId}]`,
|
|
228
|
+
{ body, query }
|
|
229
|
+
);
|
|
227
230
|
}
|
|
228
231
|
const request_headers = {
|
|
229
232
|
"Content-Type": "application/json",
|
|
@@ -263,12 +266,15 @@ var ApiClient = class {
|
|
|
263
266
|
historyEntry.duration = duration;
|
|
264
267
|
if (!response.ok) {
|
|
265
268
|
if (this.debug) {
|
|
266
|
-
console.log(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
console.log(
|
|
270
|
+
`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`,
|
|
271
|
+
{
|
|
272
|
+
status: response.status,
|
|
273
|
+
duration: `${duration}ms`,
|
|
274
|
+
body,
|
|
275
|
+
query
|
|
276
|
+
}
|
|
277
|
+
);
|
|
272
278
|
}
|
|
273
279
|
try {
|
|
274
280
|
handleHttpResponse(response);
|
|
@@ -297,22 +303,28 @@ var ApiClient = class {
|
|
|
297
303
|
}
|
|
298
304
|
}
|
|
299
305
|
if (this.debug) {
|
|
300
|
-
console.log(
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
306
|
+
console.log(
|
|
307
|
+
`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`,
|
|
308
|
+
{
|
|
309
|
+
status: response.status,
|
|
310
|
+
duration: `${duration}ms`
|
|
311
|
+
}
|
|
312
|
+
);
|
|
304
313
|
}
|
|
305
314
|
return result;
|
|
306
315
|
} catch (error) {
|
|
307
316
|
const duration = Date.now() - startTime;
|
|
308
317
|
if (this.debug) {
|
|
309
|
-
console.log(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
318
|
+
console.log(
|
|
319
|
+
`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`,
|
|
320
|
+
{
|
|
321
|
+
url,
|
|
322
|
+
duration: `${duration}ms`,
|
|
323
|
+
error: error instanceof Error ? error.message : String(error),
|
|
324
|
+
body,
|
|
325
|
+
query
|
|
326
|
+
}
|
|
327
|
+
);
|
|
316
328
|
}
|
|
317
329
|
if (error instanceof ApiError || error instanceof AuthenticationError) {
|
|
318
330
|
throw error;
|
|
@@ -381,10 +393,16 @@ var ApiClient2 = class {
|
|
|
381
393
|
* Auth namespace with Result-wrapped operations
|
|
382
394
|
*/
|
|
383
395
|
this.auth = {
|
|
384
|
-
session: () => wrap(
|
|
396
|
+
session: () => wrap(
|
|
397
|
+
() => this.clients.auth_root.get("/auth/session")
|
|
398
|
+
),
|
|
385
399
|
keys: {
|
|
386
400
|
list: () => wrap(() => this.clients.auth.get("/keys")),
|
|
387
|
-
create: (name) => wrap(
|
|
401
|
+
create: (name) => wrap(
|
|
402
|
+
() => this.clients.auth.post("/keys", {
|
|
403
|
+
body: name ? { name } : {}
|
|
404
|
+
})
|
|
405
|
+
),
|
|
388
406
|
revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
|
|
389
407
|
remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
|
|
390
408
|
}
|
|
@@ -432,7 +450,9 @@ var ApiClient2 = class {
|
|
|
432
450
|
*/
|
|
433
451
|
update: async (idOrData, changes) => wrap(async () => {
|
|
434
452
|
if (typeof idOrData === "object" && idOrData.id) {
|
|
435
|
-
return this.clients.projects.patch("/projects", {
|
|
453
|
+
return this.clients.projects.patch("/projects", {
|
|
454
|
+
body: idOrData
|
|
455
|
+
});
|
|
436
456
|
}
|
|
437
457
|
const id = idOrData;
|
|
438
458
|
if (!changes) {
|
|
@@ -460,7 +480,9 @@ var ApiClient2 = class {
|
|
|
460
480
|
current_version: project.current_version,
|
|
461
481
|
...changes
|
|
462
482
|
};
|
|
463
|
-
return this.clients.projects.patch("/projects", {
|
|
483
|
+
return this.clients.projects.patch("/projects", {
|
|
484
|
+
body: updateData
|
|
485
|
+
});
|
|
464
486
|
}),
|
|
465
487
|
/**
|
|
466
488
|
* Project configuration operations
|
|
@@ -469,11 +491,19 @@ var ApiClient2 = class {
|
|
|
469
491
|
/**
|
|
470
492
|
* Get project configuration
|
|
471
493
|
*/
|
|
472
|
-
load: (project_id) => wrap(
|
|
494
|
+
load: (project_id) => wrap(
|
|
495
|
+
() => this.clients.projects.get("/projects/config", {
|
|
496
|
+
query: { project_id }
|
|
497
|
+
})
|
|
498
|
+
),
|
|
473
499
|
/**
|
|
474
500
|
* Save project configuration
|
|
475
501
|
*/
|
|
476
|
-
save: (request) => wrap(
|
|
502
|
+
save: (request) => wrap(
|
|
503
|
+
() => this.clients.projects.patch("/projects/save_config", {
|
|
504
|
+
body: request
|
|
505
|
+
})
|
|
506
|
+
)
|
|
477
507
|
},
|
|
478
508
|
/**
|
|
479
509
|
* Scanning operations
|
|
@@ -496,11 +526,18 @@ var ApiClient2 = class {
|
|
|
496
526
|
/**
|
|
497
527
|
* Get pending scan updates for a project
|
|
498
528
|
*/
|
|
499
|
-
updates: (project_id) => wrap(
|
|
529
|
+
updates: (project_id) => wrap(
|
|
530
|
+
() => this.clients.projects.get("/projects/updates", { query: { project_id } }).then((response) => response.updates)
|
|
531
|
+
),
|
|
500
532
|
/**
|
|
501
533
|
* Process scan results
|
|
502
534
|
*/
|
|
503
|
-
update: (project_id, data) => wrap(
|
|
535
|
+
update: (project_id, data) => wrap(
|
|
536
|
+
() => this.clients.projects.post("/projects/scan_status", {
|
|
537
|
+
query: { project_id },
|
|
538
|
+
body: data
|
|
539
|
+
})
|
|
540
|
+
)
|
|
504
541
|
},
|
|
505
542
|
/**
|
|
506
543
|
* Get project history
|
|
@@ -513,11 +550,19 @@ var ApiClient2 = class {
|
|
|
513
550
|
/**
|
|
514
551
|
* Fetch project specification from GitHub
|
|
515
552
|
*/
|
|
516
|
-
specification: (project_id) => wrap(
|
|
553
|
+
specification: (project_id) => wrap(
|
|
554
|
+
() => this.clients.projects.get("/projects/fetch_spec", {
|
|
555
|
+
query: { project_id }
|
|
556
|
+
})
|
|
557
|
+
),
|
|
517
558
|
/**
|
|
518
559
|
* Delete project (soft delete)
|
|
519
560
|
*/
|
|
520
|
-
deleteProject: (project) => wrap(
|
|
561
|
+
deleteProject: (project) => wrap(
|
|
562
|
+
() => this.clients.projects.patch("/projects", {
|
|
563
|
+
body: { ...project, deleted: true }
|
|
564
|
+
})
|
|
565
|
+
)
|
|
521
566
|
};
|
|
522
567
|
/**
|
|
523
568
|
* Milestones namespace with Result-wrapped operations
|
|
@@ -561,7 +606,9 @@ var ApiClient2 = class {
|
|
|
561
606
|
target_time: data.target_time ?? milestone.target_time,
|
|
562
607
|
target_version: data.target_version ?? milestone.target_version
|
|
563
608
|
};
|
|
564
|
-
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
609
|
+
return this.clients.milestones.patch(`/milestones/${id}`, {
|
|
610
|
+
body: updateData
|
|
611
|
+
});
|
|
565
612
|
}),
|
|
566
613
|
/**
|
|
567
614
|
* Delete milestone (soft delete)
|
|
@@ -603,7 +650,9 @@ var ApiClient2 = class {
|
|
|
603
650
|
description: data.description ?? goal.description,
|
|
604
651
|
target_time: data.target_time ?? goal.target_time
|
|
605
652
|
};
|
|
606
|
-
return this.clients.goals.patch(`/goals/${id}`, {
|
|
653
|
+
return this.clients.goals.patch(`/goals/${id}`, {
|
|
654
|
+
body: updateData
|
|
655
|
+
});
|
|
607
656
|
}),
|
|
608
657
|
/**
|
|
609
658
|
* Delete goal (soft delete)
|
|
@@ -630,7 +679,11 @@ var ApiClient2 = class {
|
|
|
630
679
|
/**
|
|
631
680
|
* Get tasks by project ID
|
|
632
681
|
*/
|
|
633
|
-
getByProject: (project_id) => wrap(
|
|
682
|
+
getByProject: (project_id) => wrap(
|
|
683
|
+
() => this.clients.tasks.get(`/tasks`, {
|
|
684
|
+
query: { project: project_id }
|
|
685
|
+
})
|
|
686
|
+
),
|
|
634
687
|
/**
|
|
635
688
|
* Create a new task
|
|
636
689
|
*/
|
|
@@ -657,7 +710,9 @@ var ApiClient2 = class {
|
|
|
657
710
|
project_id: task.task.project_id,
|
|
658
711
|
...changes
|
|
659
712
|
};
|
|
660
|
-
return this.clients.tasks.patch("/tasks", {
|
|
713
|
+
return this.clients.tasks.patch("/tasks", {
|
|
714
|
+
body: updateData
|
|
715
|
+
});
|
|
661
716
|
}),
|
|
662
717
|
/**
|
|
663
718
|
* Upsert task (create or update)
|
|
@@ -670,7 +725,11 @@ var ApiClient2 = class {
|
|
|
670
725
|
/**
|
|
671
726
|
* Delete task (soft delete)
|
|
672
727
|
*/
|
|
673
|
-
deleteTask: (task) => wrap(
|
|
728
|
+
deleteTask: (task) => wrap(
|
|
729
|
+
() => this.clients.tasks.patch("/tasks", {
|
|
730
|
+
body: { ...task.task, deleted: true }
|
|
731
|
+
})
|
|
732
|
+
),
|
|
674
733
|
/**
|
|
675
734
|
* Task history operations
|
|
676
735
|
*/
|
|
@@ -735,13 +794,21 @@ var ApiClient2 = class {
|
|
|
735
794
|
categories: {
|
|
736
795
|
tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
|
|
737
796
|
create: (data) => wrap(() => this.clients.blog.post("/blog/categories", { body: data })),
|
|
738
|
-
update: (name, data) => wrap(
|
|
797
|
+
update: (name, data) => wrap(
|
|
798
|
+
() => this.clients.blog.put(`/blog/categories/${name}`, {
|
|
799
|
+
body: data
|
|
800
|
+
})
|
|
801
|
+
),
|
|
739
802
|
delete: (name) => wrap(() => this.clients.blog.delete(`/blog/categories/${name}`))
|
|
740
803
|
},
|
|
741
804
|
tokens: {
|
|
742
805
|
list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
|
|
743
806
|
create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
|
|
744
|
-
update: (id, data) => wrap(
|
|
807
|
+
update: (id, data) => wrap(
|
|
808
|
+
() => this.clients.blog.put(`/blog/tokens/${id}`, {
|
|
809
|
+
body: data
|
|
810
|
+
})
|
|
811
|
+
),
|
|
745
812
|
delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
|
|
746
813
|
}
|
|
747
814
|
};
|
|
@@ -781,10 +848,18 @@ var ApiClient2 = class {
|
|
|
781
848
|
delete: (account_id) => wrap(() => this.clients.media.delete(`/connections/${account_id}`)),
|
|
782
849
|
refresh: (account_id) => wrap(() => this.clients.media.post(`/connections/${account_id}/refresh`)),
|
|
783
850
|
refreshAll: () => wrap(() => this.clients.media.post("/connections/refresh-all")),
|
|
784
|
-
updateStatus: (account_id, is_active) => wrap(
|
|
851
|
+
updateStatus: (account_id, is_active) => wrap(
|
|
852
|
+
() => this.clients.media.patch(`/connections/${account_id}`, {
|
|
853
|
+
body: { is_active }
|
|
854
|
+
})
|
|
855
|
+
),
|
|
785
856
|
settings: {
|
|
786
857
|
get: (account_id) => wrap(() => this.clients.media.get(`/connections/${account_id}/settings`)),
|
|
787
|
-
update: (account_id, settings) => wrap(
|
|
858
|
+
update: (account_id, settings) => wrap(
|
|
859
|
+
() => this.clients.media.put(`/connections/${account_id}/settings`, {
|
|
860
|
+
body: { settings }
|
|
861
|
+
})
|
|
862
|
+
)
|
|
788
863
|
},
|
|
789
864
|
repos: (account_id) => wrap(async () => {
|
|
790
865
|
const res = await this.clients.media.get(`/connections/${account_id}/repos`);
|
|
@@ -796,7 +871,9 @@ var ApiClient2 = class {
|
|
|
796
871
|
})
|
|
797
872
|
},
|
|
798
873
|
credentials: {
|
|
799
|
-
check: (platform, profile_id) => wrap(
|
|
874
|
+
check: (platform, profile_id) => wrap(
|
|
875
|
+
() => this.clients.media.get(`/credentials/${platform}`, { query: { profile_id } })
|
|
876
|
+
),
|
|
800
877
|
save: (platform, data) => wrap(() => this.clients.media.post(`/credentials/${platform}`, { body: data })),
|
|
801
878
|
delete: (platform, profile_id) => wrap(() => this.clients.media.delete(`/credentials/${platform}`, { query: { profile_id } }))
|
|
802
879
|
},
|
|
@@ -807,12 +884,24 @@ var ApiClient2 = class {
|
|
|
807
884
|
if (params?.to) query.to = params.to;
|
|
808
885
|
return this.clients.media.get(`/timeline/${user_id}`, Object.keys(query).length ? { query } : {});
|
|
809
886
|
}),
|
|
810
|
-
getRaw: (user_id, platform, account_id) => wrap(
|
|
887
|
+
getRaw: (user_id, platform, account_id) => wrap(
|
|
888
|
+
() => this.clients.media.get(`/timeline/${user_id}/raw/${platform}`, {
|
|
889
|
+
query: { account_id }
|
|
890
|
+
})
|
|
891
|
+
)
|
|
811
892
|
}
|
|
812
893
|
};
|
|
813
894
|
/**
|
|
814
895
|
* User namespace with Result-wrapped operations
|
|
815
896
|
*/
|
|
897
|
+
this.activity = {
|
|
898
|
+
ai: (options) => wrap(() => {
|
|
899
|
+
const query = {};
|
|
900
|
+
if (options?.limit) query.limit = String(options.limit);
|
|
901
|
+
if (options?.since) query.since = options.since;
|
|
902
|
+
return this.clients.projects.get("/activity/ai", Object.keys(query).length ? { query } : {});
|
|
903
|
+
})
|
|
904
|
+
};
|
|
816
905
|
this.user = {
|
|
817
906
|
/**
|
|
818
907
|
* Get user activity history
|
|
@@ -838,7 +927,11 @@ var ApiClient2 = class {
|
|
|
838
927
|
const auth_base_url = base_url.replace(/\/v1\/?$/, "");
|
|
839
928
|
this.clients = {
|
|
840
929
|
auth: new ApiClient({ ...clientOptions, category: "auth" }),
|
|
841
|
-
auth_root: new ApiClient({
|
|
930
|
+
auth_root: new ApiClient({
|
|
931
|
+
...clientOptions,
|
|
932
|
+
base_url: auth_base_url,
|
|
933
|
+
category: "auth"
|
|
934
|
+
}),
|
|
842
935
|
projects: new ApiClient({ ...clientOptions, category: "projects" }),
|
|
843
936
|
tasks: new ApiClient({ ...clientOptions, category: "tasks" }),
|
|
844
937
|
milestones: new ApiClient({ ...clientOptions, category: "milestones" }),
|
|
@@ -920,7 +1013,7 @@ var tools = {
|
|
|
920
1013
|
},
|
|
921
1014
|
devpad_projects_upsert: {
|
|
922
1015
|
name: "devpad_projects_upsert",
|
|
923
|
-
description: "Create or update a project (set deleted=true to delete)",
|
|
1016
|
+
description: "Create or update a project (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
|
|
924
1017
|
inputSchema: upsert_project,
|
|
925
1018
|
execute: async (client, input) => unwrap(await client.projects.upsert(input))
|
|
926
1019
|
},
|
|
@@ -948,7 +1041,7 @@ var tools = {
|
|
|
948
1041
|
},
|
|
949
1042
|
devpad_tasks_upsert: {
|
|
950
1043
|
name: "devpad_tasks_upsert",
|
|
951
|
-
description: "Create or update a task (set deleted=true to delete)",
|
|
1044
|
+
description: "Create or update a task (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
|
|
952
1045
|
inputSchema: upsert_todo,
|
|
953
1046
|
execute: async (client, input) => unwrap(await client.tasks.upsert(input))
|
|
954
1047
|
},
|
|
@@ -976,7 +1069,7 @@ var tools = {
|
|
|
976
1069
|
},
|
|
977
1070
|
devpad_milestones_upsert: {
|
|
978
1071
|
name: "devpad_milestones_upsert",
|
|
979
|
-
description: "Create or update a milestone",
|
|
1072
|
+
description: "Create or update a milestone. Returns 409 if entity is protected by user - pass force=true to override.",
|
|
980
1073
|
inputSchema: upsert_milestone,
|
|
981
1074
|
execute: async (client, input) => unwrap(
|
|
982
1075
|
input.id ? await client.milestones.update(input.id, {
|
|
@@ -1008,7 +1101,7 @@ var tools = {
|
|
|
1008
1101
|
},
|
|
1009
1102
|
devpad_goals_upsert: {
|
|
1010
1103
|
name: "devpad_goals_upsert",
|
|
1011
|
-
description: "Create or update a goal",
|
|
1104
|
+
description: "Create or update a goal. Returns 409 if entity is protected by user - pass force=true to override.",
|
|
1012
1105
|
inputSchema: upsert_goal,
|
|
1013
1106
|
execute: async (client, input) => unwrap(
|
|
1014
1107
|
input.id ? await client.goals.update(input.id, {
|
|
@@ -1145,6 +1238,15 @@ var tools = {
|
|
|
1145
1238
|
}),
|
|
1146
1239
|
execute: async (client, input) => unwrap(await client.user.preferences(input))
|
|
1147
1240
|
},
|
|
1241
|
+
devpad_activity_ai: {
|
|
1242
|
+
name: "devpad_activity_ai",
|
|
1243
|
+
description: "Get AI activity feed - shows recent actions made via API/MCP grouped into sessions by time window",
|
|
1244
|
+
inputSchema: z.object({
|
|
1245
|
+
limit: z.number().optional().describe("Max sessions to return (default 20)"),
|
|
1246
|
+
since: z.string().optional().describe("Only show activity after this ISO date")
|
|
1247
|
+
}),
|
|
1248
|
+
execute: async (client, input) => unwrap(await client.activity.ai(input))
|
|
1249
|
+
},
|
|
1148
1250
|
devpad_blog_posts_list: {
|
|
1149
1251
|
name: "devpad_blog_posts_list",
|
|
1150
1252
|
description: "List blog posts with optional filters",
|
|
@@ -1044,4 +1044,4 @@ declare const media_platform_credentials: drizzle_orm_sqlite_core.SQLiteTableWit
|
|
|
1044
1044
|
dialect: "sqlite";
|
|
1045
1045
|
}>;
|
|
1046
1046
|
|
|
1047
|
-
export { type MediaPlatform as M,
|
|
1047
|
+
export { type MediaPlatform as M, media_profile_filters as a, media_accounts as b, media_account_settings as c, media_platform_credentials as d, media_rate_limits as e, media_profiles as m };
|