@devpad/api 2.0.3 → 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.
@@ -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 { badRequest 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, isServiceError as H, isRetryableError as I, notFound as J, forbidden as K, validation as L, rateLimited as M, type NotFoundError as N, storeError as O, type ParseError as P, networkError as Q, type RateLimitedError as R, type StoreError as S, authExpired as T, type UnauthorizedError as U, type ValidationError as V, apiError as W, parseError as X, encryptionError as Y, dbError as Z, conflict as _, type NetworkError as a, unauthorized as a0, scanError as a1, githubError as a2, errors as a3, type ApiError as b, type BadRequestError as c, type ScanError as d, type ServiceError as e, type ProviderError as f, type CronError as g, type ErrorContext as h, type ErrorLogEntry as i, configureErrorLogging as j, isNotFoundError as k, isForbiddenError as l, isValidationError as m, isRateLimitedError as n, isStoreError as o, isNetworkError as p, isAuthExpiredError as q, isApiError as r, isParseError as s, isEncryptionError as t, isDatabaseError as u, isConflictError as v, isBadRequestError as w, isUnauthorizedError as x, isScanError as y, isGithubError as z };
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,12 +1,12 @@
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-Bj4FU9Op.js';
2
- export { D as ProjectConfig, T as Task } from './types.d-Bj4FU9Op.js';
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
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-B1VbnHQT.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-DALWdx-o.js';
9
+ import './schema.d-DcPuyqgh.js';
10
10
  import 'drizzle-orm/sqlite-core';
11
11
  import './media.d-CQ56ckoR.js';
12
12
 
@@ -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