@devpad/api 2.0.1 → 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/chunk-5X36WMYQ.js +130 -0
- package/dist/chunk-INGCIUMX.js +166 -0
- package/dist/errors.d-C73AkrdX.d.ts +159 -0
- package/dist/index.d.ts +541 -13
- package/dist/index.js +1587 -6
- package/dist/media.d-CQ56ckoR.d.ts +1047 -0
- package/dist/schema/blog.d.ts +5032 -0
- package/dist/schema/blog.js +277 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.js +106 -0
- package/dist/schema/media.d.ts +1675 -0
- package/dist/schema/media.js +680 -0
- package/dist/schema.d-DALWdx-o.d.ts +2666 -0
- package/dist/types.d-B1VbnHQT.d.ts +6146 -0
- package/dist/types.d-Bj4FU9Op.d.ts +539 -0
- package/dist/types.d-DLE9TSql.d.ts +684 -0
- package/package.json +17 -4
- package/dist/api-client.d.ts +0 -470
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -530
- package/dist/error-handlers.d.ts +0 -55
- package/dist/error-handlers.d.ts.map +0 -1
- package/dist/error-handlers.js +0 -217
- package/dist/errors.d.ts +0 -19
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -28
- package/dist/index.d.ts.map +0 -1
- package/dist/request.d.ts +0 -51
- package/dist/request.d.ts.map +0 -1
- package/dist/request.js +0 -197
- package/dist/result.d.ts +0 -10
- package/dist/result.d.ts.map +0 -1
- package/dist/result.js +0 -11
- package/dist/tools.d.ts +0 -84
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -474
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// ../schema/dist/errors.js
|
|
2
|
+
import { err } from "@f0rbit/corpus";
|
|
3
|
+
var defaultLogger = ({ error, context }) => {
|
|
4
|
+
console.error(`[${context.timestamp}] [${error.kind}]`, error.message || error.kind, { ...error, stack: context.stack?.split("\n").slice(2, 5).join("\n"), ...context });
|
|
5
|
+
};
|
|
6
|
+
var errorLogger = defaultLogger;
|
|
7
|
+
var contextProvider = null;
|
|
8
|
+
var configureErrorLogging = (config) => {
|
|
9
|
+
if (config.logger)
|
|
10
|
+
errorLogger = config.logger;
|
|
11
|
+
if (config.contextProvider)
|
|
12
|
+
contextProvider = config.contextProvider;
|
|
13
|
+
};
|
|
14
|
+
var logAndReturn = (error, ctx) => {
|
|
15
|
+
const context = { timestamp: (/* @__PURE__ */ new Date()).toISOString(), stack: new Error().stack, ...contextProvider?.(), ...ctx };
|
|
16
|
+
errorLogger({ error, context });
|
|
17
|
+
return err(error);
|
|
18
|
+
};
|
|
19
|
+
var hasKind = (e, kind) => typeof e === "object" && e !== null && "kind" in e && e.kind === kind;
|
|
20
|
+
var isNotFoundError = (e) => hasKind(e, "not_found");
|
|
21
|
+
var isForbiddenError = (e) => hasKind(e, "forbidden");
|
|
22
|
+
var isValidationError = (e) => hasKind(e, "validation");
|
|
23
|
+
var isRateLimitedError = (e) => hasKind(e, "rate_limited");
|
|
24
|
+
var isStoreError = (e) => hasKind(e, "store_error");
|
|
25
|
+
var isNetworkError = (e) => hasKind(e, "network_error");
|
|
26
|
+
var isAuthExpiredError = (e) => hasKind(e, "auth_expired");
|
|
27
|
+
var isApiError = (e) => hasKind(e, "api_error");
|
|
28
|
+
var isParseError = (e) => hasKind(e, "parse_error");
|
|
29
|
+
var isEncryptionError = (e) => hasKind(e, "encryption_error");
|
|
30
|
+
var isDatabaseError = (e) => hasKind(e, "db_error");
|
|
31
|
+
var isConflictError = (e) => hasKind(e, "conflict");
|
|
32
|
+
var isBadRequestError = (e) => hasKind(e, "bad_request");
|
|
33
|
+
var isUnauthorizedError = (e) => hasKind(e, "unauthorized");
|
|
34
|
+
var isScanError = (e) => hasKind(e, "scan_error");
|
|
35
|
+
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 isRetryableError = (e) => isRateLimitedError(e) || isNetworkError(e);
|
|
38
|
+
var notFound = (resource, id, ctx) => logAndReturn({ kind: "not_found", resource, ...id && { id } }, ctx);
|
|
39
|
+
var forbidden = (reason, ctx) => logAndReturn({ kind: "forbidden", ...reason && { reason, message: reason } }, ctx);
|
|
40
|
+
var validation = (errors2, ctx) => logAndReturn({ kind: "validation", errors: errors2 }, ctx);
|
|
41
|
+
var rateLimited = (retry_after, ctx) => logAndReturn({ kind: "rate_limited", ...retry_after !== void 0 && { retry_after } }, ctx);
|
|
42
|
+
var storeError = (operation, message, ctx) => logAndReturn({ kind: "store_error", operation, ...message && { message } }, ctx);
|
|
43
|
+
var networkError = (cause, message, ctx) => logAndReturn({ kind: "network_error", ...cause && { cause }, ...message && { message } }, ctx);
|
|
44
|
+
var authExpired = (message, ctx) => logAndReturn({ kind: "auth_expired", ...message && { message } }, ctx);
|
|
45
|
+
var apiError = (status, message, ctx) => logAndReturn({ kind: "api_error", status, ...message && { message } }, ctx);
|
|
46
|
+
var parseError = (message, ctx) => logAndReturn({ kind: "parse_error", ...message && { message } }, ctx);
|
|
47
|
+
var encryptionError = (operation, message, ctx) => logAndReturn({ kind: "encryption_error", operation, ...message && { message } }, ctx);
|
|
48
|
+
var dbError = (message, ctx) => logAndReturn({ kind: "db_error", ...message && { message } }, ctx);
|
|
49
|
+
var conflict = (resource, message, ctx) => logAndReturn({ kind: "conflict", ...resource && { resource }, ...message && { message } }, ctx);
|
|
50
|
+
var badRequest = (message, details, ctx) => logAndReturn({ kind: "bad_request", ...message && { message }, ...details !== void 0 && { details } }, ctx);
|
|
51
|
+
var unauthorized = (message, ctx) => logAndReturn({ kind: "unauthorized", ...message && { message } }, ctx);
|
|
52
|
+
var scanError = (message, ctx) => logAndReturn({ kind: "scan_error", ...message && { message } }, ctx);
|
|
53
|
+
var githubError = (message, ctx) => logAndReturn({ kind: "github_error", ...message && { message } }, ctx);
|
|
54
|
+
var errors = {
|
|
55
|
+
notFound,
|
|
56
|
+
forbidden,
|
|
57
|
+
validation,
|
|
58
|
+
rateLimited,
|
|
59
|
+
storeError,
|
|
60
|
+
networkError,
|
|
61
|
+
authExpired,
|
|
62
|
+
apiError,
|
|
63
|
+
parseError,
|
|
64
|
+
encryptionError,
|
|
65
|
+
dbError,
|
|
66
|
+
conflict,
|
|
67
|
+
badRequest,
|
|
68
|
+
unauthorized,
|
|
69
|
+
scanError,
|
|
70
|
+
githubError,
|
|
71
|
+
is: {
|
|
72
|
+
notFound: isNotFoundError,
|
|
73
|
+
forbidden: isForbiddenError,
|
|
74
|
+
validation: isValidationError,
|
|
75
|
+
rateLimited: isRateLimitedError,
|
|
76
|
+
storeError: isStoreError,
|
|
77
|
+
networkError: isNetworkError,
|
|
78
|
+
authExpired: isAuthExpiredError,
|
|
79
|
+
apiError: isApiError,
|
|
80
|
+
parseError: isParseError,
|
|
81
|
+
encryptionError: isEncryptionError,
|
|
82
|
+
dbError: isDatabaseError,
|
|
83
|
+
conflict: isConflictError,
|
|
84
|
+
badRequest: isBadRequestError,
|
|
85
|
+
unauthorized: isUnauthorizedError,
|
|
86
|
+
scanError: isScanError,
|
|
87
|
+
githubError: isGithubError,
|
|
88
|
+
serviceError: isServiceError,
|
|
89
|
+
retryable: isRetryableError
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
configureErrorLogging,
|
|
95
|
+
isNotFoundError,
|
|
96
|
+
isForbiddenError,
|
|
97
|
+
isValidationError,
|
|
98
|
+
isRateLimitedError,
|
|
99
|
+
isStoreError,
|
|
100
|
+
isNetworkError,
|
|
101
|
+
isAuthExpiredError,
|
|
102
|
+
isApiError,
|
|
103
|
+
isParseError,
|
|
104
|
+
isEncryptionError,
|
|
105
|
+
isDatabaseError,
|
|
106
|
+
isConflictError,
|
|
107
|
+
isBadRequestError,
|
|
108
|
+
isUnauthorizedError,
|
|
109
|
+
isScanError,
|
|
110
|
+
isGithubError,
|
|
111
|
+
isServiceError,
|
|
112
|
+
isRetryableError,
|
|
113
|
+
notFound,
|
|
114
|
+
forbidden,
|
|
115
|
+
validation,
|
|
116
|
+
rateLimited,
|
|
117
|
+
storeError,
|
|
118
|
+
networkError,
|
|
119
|
+
authExpired,
|
|
120
|
+
apiError,
|
|
121
|
+
parseError,
|
|
122
|
+
encryptionError,
|
|
123
|
+
dbError,
|
|
124
|
+
conflict,
|
|
125
|
+
badRequest,
|
|
126
|
+
unauthorized,
|
|
127
|
+
scanError,
|
|
128
|
+
githubError,
|
|
129
|
+
errors
|
|
130
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
// ../schema/dist/validation.js
|
|
57
|
+
import { z } from "zod";
|
|
58
|
+
var upsert_project = z.object({
|
|
59
|
+
id: z.string().optional().nullable(),
|
|
60
|
+
project_id: z.string(),
|
|
61
|
+
owner_id: z.string().optional(),
|
|
62
|
+
name: z.string(),
|
|
63
|
+
description: z.string().nullable(),
|
|
64
|
+
specification: z.string().nullable(),
|
|
65
|
+
repo_url: z.string().nullable(),
|
|
66
|
+
repo_id: z.number().nullable(),
|
|
67
|
+
icon_url: z.string().nullable(),
|
|
68
|
+
status: z.union([z.literal("DEVELOPMENT"), z.literal("PAUSED"), z.literal("RELEASED"), z.literal("LIVE"), z.literal("FINISHED"), z.literal("ABANDONED"), z.literal("STOPPED")]).optional(),
|
|
69
|
+
deleted: z.boolean().optional().default(false),
|
|
70
|
+
link_url: z.string().nullable(),
|
|
71
|
+
link_text: z.string().nullable(),
|
|
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()
|
|
74
|
+
});
|
|
75
|
+
var upsert_todo = z.object({
|
|
76
|
+
id: z.string().optional().nullable(),
|
|
77
|
+
title: z.string().optional(),
|
|
78
|
+
summary: z.string().optional().nullable(),
|
|
79
|
+
description: z.string().optional().nullable(),
|
|
80
|
+
progress: z.union([z.literal("UNSTARTED"), z.literal("IN_PROGRESS"), z.literal("COMPLETED")]).optional(),
|
|
81
|
+
visibility: z.union([z.literal("PUBLIC"), z.literal("PRIVATE"), z.literal("HIDDEN"), z.literal("ARCHIVED"), z.literal("DRAFT"), z.literal("DELETED")]).optional(),
|
|
82
|
+
start_time: z.string().optional().nullable(),
|
|
83
|
+
end_time: z.string().optional().nullable(),
|
|
84
|
+
priority: z.union([z.literal("LOW"), z.literal("MEDIUM"), z.literal("HIGH")]).optional(),
|
|
85
|
+
owner_id: z.string(),
|
|
86
|
+
project_id: z.string().optional().nullable(),
|
|
87
|
+
goal_id: z.string().optional().nullable()
|
|
88
|
+
});
|
|
89
|
+
var update_action = z.union([z.literal("CONFIRM"), z.literal("UNLINK"), z.literal("CREATE"), z.literal("IGNORE"), z.literal("DELETE"), z.literal("COMPLETE")]);
|
|
90
|
+
var ConfigSchema = z.object({
|
|
91
|
+
tags: z.array(z.object({
|
|
92
|
+
name: z.string(),
|
|
93
|
+
match: z.array(z.string())
|
|
94
|
+
})),
|
|
95
|
+
ignore: z.array(z.string().regex(/^[^]*$/, "Invalid path"))
|
|
96
|
+
});
|
|
97
|
+
var upsert_tag = z.object({
|
|
98
|
+
id: z.string().optional(),
|
|
99
|
+
title: z.string(),
|
|
100
|
+
color: z.union([z.literal("red"), z.literal("green"), z.literal("blue"), z.literal("yellow"), z.literal("purple"), z.literal("orange"), z.literal("teal"), z.literal("pink"), z.literal("gray"), z.literal("cyan"), z.literal("lime")]).nullable().optional(),
|
|
101
|
+
deleted: z.boolean().optional().default(false),
|
|
102
|
+
render: z.boolean().optional().default(true),
|
|
103
|
+
owner_id: z.string()
|
|
104
|
+
});
|
|
105
|
+
var project_config = z.object({
|
|
106
|
+
tags: z.array(z.object({
|
|
107
|
+
name: z.string(),
|
|
108
|
+
match: z.array(z.string())
|
|
109
|
+
})),
|
|
110
|
+
ignore: z.array(z.string())
|
|
111
|
+
});
|
|
112
|
+
var save_config_request = z.object({
|
|
113
|
+
id: z.string(),
|
|
114
|
+
config: project_config,
|
|
115
|
+
scan_branch: z.string().optional()
|
|
116
|
+
});
|
|
117
|
+
var save_tags_request = z.array(upsert_tag);
|
|
118
|
+
var update_user = z.object({
|
|
119
|
+
id: z.string(),
|
|
120
|
+
name: z.string().optional(),
|
|
121
|
+
image_url: z.string().optional(),
|
|
122
|
+
task_view: z.union([z.literal("list"), z.literal("grid")]).optional(),
|
|
123
|
+
email_verified: z.boolean().optional()
|
|
124
|
+
});
|
|
125
|
+
var config_schema = z.object({
|
|
126
|
+
tags: z.array(z.object({
|
|
127
|
+
name: z.string(),
|
|
128
|
+
match: z.array(z.string())
|
|
129
|
+
})),
|
|
130
|
+
ignore: z.array(z.string().regex(/^[^]*$/, "Invalid path"))
|
|
131
|
+
});
|
|
132
|
+
var upsert_milestone = z.object({
|
|
133
|
+
id: z.string().optional().nullable(),
|
|
134
|
+
project_id: z.string(),
|
|
135
|
+
name: z.string().min(1).max(200),
|
|
136
|
+
description: z.string().nullable().optional(),
|
|
137
|
+
target_time: z.string().nullable().optional(),
|
|
138
|
+
target_version: z.string().nullable().optional(),
|
|
139
|
+
finished_at: z.string().nullable().optional(),
|
|
140
|
+
after_id: z.string().nullable().optional()
|
|
141
|
+
});
|
|
142
|
+
var upsert_goal = z.object({
|
|
143
|
+
id: z.string().optional().nullable(),
|
|
144
|
+
milestone_id: z.string(),
|
|
145
|
+
name: z.string().min(1).max(200),
|
|
146
|
+
description: z.string().nullable().optional(),
|
|
147
|
+
target_time: z.string().nullable().optional(),
|
|
148
|
+
finished_at: z.string().nullable().optional()
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
TAG_COLOURS,
|
|
153
|
+
ArrayBufferedQueue,
|
|
154
|
+
upsert_project,
|
|
155
|
+
upsert_todo,
|
|
156
|
+
update_action,
|
|
157
|
+
ConfigSchema,
|
|
158
|
+
upsert_tag,
|
|
159
|
+
project_config,
|
|
160
|
+
save_config_request,
|
|
161
|
+
save_tags_request,
|
|
162
|
+
update_user,
|
|
163
|
+
config_schema,
|
|
164
|
+
upsert_milestone,
|
|
165
|
+
upsert_goal
|
|
166
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Result } from '@f0rbit/corpus';
|
|
2
|
+
|
|
3
|
+
type BaseError = {
|
|
4
|
+
kind: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
};
|
|
7
|
+
type NotFoundError = BaseError & {
|
|
8
|
+
kind: "not_found";
|
|
9
|
+
resource: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
};
|
|
12
|
+
type ForbiddenError = BaseError & {
|
|
13
|
+
kind: "forbidden";
|
|
14
|
+
reason?: string;
|
|
15
|
+
};
|
|
16
|
+
type ValidationError = BaseError & {
|
|
17
|
+
kind: "validation";
|
|
18
|
+
errors: Record<string, string[]>;
|
|
19
|
+
};
|
|
20
|
+
type RateLimitedError = BaseError & {
|
|
21
|
+
kind: "rate_limited";
|
|
22
|
+
retry_after?: number;
|
|
23
|
+
};
|
|
24
|
+
type StoreError = BaseError & {
|
|
25
|
+
kind: "store_error";
|
|
26
|
+
operation: string;
|
|
27
|
+
};
|
|
28
|
+
type NetworkError = BaseError & {
|
|
29
|
+
kind: "network_error";
|
|
30
|
+
cause?: Error;
|
|
31
|
+
};
|
|
32
|
+
type AuthExpiredError = BaseError & {
|
|
33
|
+
kind: "auth_expired";
|
|
34
|
+
};
|
|
35
|
+
type ApiError = BaseError & {
|
|
36
|
+
kind: "api_error";
|
|
37
|
+
status: number;
|
|
38
|
+
};
|
|
39
|
+
type ParseError = BaseError & {
|
|
40
|
+
kind: "parse_error";
|
|
41
|
+
};
|
|
42
|
+
type EncryptionError = BaseError & {
|
|
43
|
+
kind: "encryption_error";
|
|
44
|
+
operation: "encrypt" | "decrypt";
|
|
45
|
+
};
|
|
46
|
+
type DatabaseError = BaseError & {
|
|
47
|
+
kind: "db_error";
|
|
48
|
+
};
|
|
49
|
+
type ConflictError = BaseError & {
|
|
50
|
+
kind: "conflict";
|
|
51
|
+
resource?: string;
|
|
52
|
+
};
|
|
53
|
+
type BadRequestError = BaseError & {
|
|
54
|
+
kind: "bad_request";
|
|
55
|
+
details?: unknown;
|
|
56
|
+
};
|
|
57
|
+
type UnauthorizedError = BaseError & {
|
|
58
|
+
kind: "unauthorized";
|
|
59
|
+
};
|
|
60
|
+
type ScanError = BaseError & {
|
|
61
|
+
kind: "scan_error";
|
|
62
|
+
};
|
|
63
|
+
type GithubError = BaseError & {
|
|
64
|
+
kind: "github_error";
|
|
65
|
+
};
|
|
66
|
+
type ServiceError = NotFoundError | ForbiddenError | ValidationError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | BadRequestError | UnauthorizedError | ScanError | GithubError;
|
|
67
|
+
type ProviderError = RateLimitedError | AuthExpiredError | NetworkError | ApiError | ParseError;
|
|
68
|
+
type CronError = StoreError | NetworkError | AuthExpiredError | EncryptionError;
|
|
69
|
+
type ErrorContext = {
|
|
70
|
+
timestamp: string;
|
|
71
|
+
stack?: string;
|
|
72
|
+
requestId?: string;
|
|
73
|
+
userId?: string;
|
|
74
|
+
operation?: string;
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
};
|
|
77
|
+
type ErrorLogEntry = {
|
|
78
|
+
error: ServiceError;
|
|
79
|
+
context: ErrorContext;
|
|
80
|
+
};
|
|
81
|
+
type ErrorLogFn = (entry: ErrorLogEntry) => void;
|
|
82
|
+
declare const configureErrorLogging: (config: {
|
|
83
|
+
logger?: ErrorLogFn;
|
|
84
|
+
contextProvider?: () => Partial<ErrorContext>;
|
|
85
|
+
}) => void;
|
|
86
|
+
declare const isNotFoundError: (e: unknown) => e is NotFoundError;
|
|
87
|
+
declare const isForbiddenError: (e: unknown) => e is ForbiddenError;
|
|
88
|
+
declare const isValidationError: (e: unknown) => e is ValidationError;
|
|
89
|
+
declare const isRateLimitedError: (e: unknown) => e is RateLimitedError;
|
|
90
|
+
declare const isStoreError: (e: unknown) => e is StoreError;
|
|
91
|
+
declare const isNetworkError: (e: unknown) => e is NetworkError;
|
|
92
|
+
declare const isAuthExpiredError: (e: unknown) => e is AuthExpiredError;
|
|
93
|
+
declare const isApiError: (e: unknown) => e is ApiError;
|
|
94
|
+
declare const isParseError: (e: unknown) => e is ParseError;
|
|
95
|
+
declare const isEncryptionError: (e: unknown) => e is EncryptionError;
|
|
96
|
+
declare const isDatabaseError: (e: unknown) => e is DatabaseError;
|
|
97
|
+
declare const isConflictError: (e: unknown) => e is ConflictError;
|
|
98
|
+
declare const isBadRequestError: (e: unknown) => e is BadRequestError;
|
|
99
|
+
declare const isUnauthorizedError: (e: unknown) => e is UnauthorizedError;
|
|
100
|
+
declare const isScanError: (e: unknown) => e is ScanError;
|
|
101
|
+
declare const isGithubError: (e: unknown) => e is GithubError;
|
|
102
|
+
declare const isServiceError: (e: unknown) => e is ServiceError;
|
|
103
|
+
declare const isRetryableError: (e: unknown) => boolean;
|
|
104
|
+
declare const notFound: (resource: string, id?: string, ctx?: Record<string, unknown>) => Result<never, NotFoundError>;
|
|
105
|
+
declare const forbidden: (reason?: string, ctx?: Record<string, unknown>) => Result<never, ForbiddenError>;
|
|
106
|
+
declare const validation: (errors: Record<string, string[]>, ctx?: Record<string, unknown>) => Result<never, ValidationError>;
|
|
107
|
+
declare const rateLimited: (retry_after?: number, ctx?: Record<string, unknown>) => Result<never, RateLimitedError>;
|
|
108
|
+
declare const storeError: (operation: string, message?: string, ctx?: Record<string, unknown>) => Result<never, StoreError>;
|
|
109
|
+
declare const networkError: (cause?: Error, message?: string, ctx?: Record<string, unknown>) => Result<never, NetworkError>;
|
|
110
|
+
declare const authExpired: (message?: string, ctx?: Record<string, unknown>) => Result<never, AuthExpiredError>;
|
|
111
|
+
declare const apiError: (status: number, message?: string, ctx?: Record<string, unknown>) => Result<never, ApiError>;
|
|
112
|
+
declare const parseError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ParseError>;
|
|
113
|
+
declare const encryptionError: (operation: "encrypt" | "decrypt", message?: string, ctx?: Record<string, unknown>) => Result<never, EncryptionError>;
|
|
114
|
+
declare const dbError: (message?: string, ctx?: Record<string, unknown>) => Result<never, DatabaseError>;
|
|
115
|
+
declare const conflict: (resource?: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ConflictError>;
|
|
116
|
+
declare const badRequest: (message?: string, details?: unknown, ctx?: Record<string, unknown>) => Result<never, BadRequestError>;
|
|
117
|
+
declare const unauthorized: (message?: string, ctx?: Record<string, unknown>) => Result<never, UnauthorizedError>;
|
|
118
|
+
declare const scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
|
|
119
|
+
declare const githubError: (message?: string, ctx?: Record<string, unknown>) => Result<never, GithubError>;
|
|
120
|
+
declare const errors: {
|
|
121
|
+
readonly notFound: (resource: string, id?: string, ctx?: Record<string, unknown>) => Result<never, NotFoundError>;
|
|
122
|
+
readonly forbidden: (reason?: string, ctx?: Record<string, unknown>) => Result<never, ForbiddenError>;
|
|
123
|
+
readonly validation: (errors: Record<string, string[]>, ctx?: Record<string, unknown>) => Result<never, ValidationError>;
|
|
124
|
+
readonly rateLimited: (retry_after?: number, ctx?: Record<string, unknown>) => Result<never, RateLimitedError>;
|
|
125
|
+
readonly storeError: (operation: string, message?: string, ctx?: Record<string, unknown>) => Result<never, StoreError>;
|
|
126
|
+
readonly networkError: (cause?: Error, message?: string, ctx?: Record<string, unknown>) => Result<never, NetworkError>;
|
|
127
|
+
readonly authExpired: (message?: string, ctx?: Record<string, unknown>) => Result<never, AuthExpiredError>;
|
|
128
|
+
readonly apiError: (status: number, message?: string, ctx?: Record<string, unknown>) => Result<never, ApiError>;
|
|
129
|
+
readonly parseError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ParseError>;
|
|
130
|
+
readonly encryptionError: (operation: "encrypt" | "decrypt", message?: string, ctx?: Record<string, unknown>) => Result<never, EncryptionError>;
|
|
131
|
+
readonly dbError: (message?: string, ctx?: Record<string, unknown>) => Result<never, DatabaseError>;
|
|
132
|
+
readonly conflict: (resource?: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ConflictError>;
|
|
133
|
+
readonly badRequest: (message?: string, details?: unknown, ctx?: Record<string, unknown>) => Result<never, BadRequestError>;
|
|
134
|
+
readonly unauthorized: (message?: string, ctx?: Record<string, unknown>) => Result<never, UnauthorizedError>;
|
|
135
|
+
readonly scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
|
|
136
|
+
readonly githubError: (message?: string, ctx?: Record<string, unknown>) => Result<never, GithubError>;
|
|
137
|
+
readonly is: {
|
|
138
|
+
readonly notFound: (e: unknown) => e is NotFoundError;
|
|
139
|
+
readonly forbidden: (e: unknown) => e is ForbiddenError;
|
|
140
|
+
readonly validation: (e: unknown) => e is ValidationError;
|
|
141
|
+
readonly rateLimited: (e: unknown) => e is RateLimitedError;
|
|
142
|
+
readonly storeError: (e: unknown) => e is StoreError;
|
|
143
|
+
readonly networkError: (e: unknown) => e is NetworkError;
|
|
144
|
+
readonly authExpired: (e: unknown) => e is AuthExpiredError;
|
|
145
|
+
readonly apiError: (e: unknown) => e is ApiError;
|
|
146
|
+
readonly parseError: (e: unknown) => e is ParseError;
|
|
147
|
+
readonly encryptionError: (e: unknown) => e is EncryptionError;
|
|
148
|
+
readonly dbError: (e: unknown) => e is DatabaseError;
|
|
149
|
+
readonly conflict: (e: unknown) => e is ConflictError;
|
|
150
|
+
readonly badRequest: (e: unknown) => e is BadRequestError;
|
|
151
|
+
readonly unauthorized: (e: unknown) => e is UnauthorizedError;
|
|
152
|
+
readonly scanError: (e: unknown) => e is ScanError;
|
|
153
|
+
readonly githubError: (e: unknown) => e is GithubError;
|
|
154
|
+
readonly serviceError: (e: unknown) => e is ServiceError;
|
|
155
|
+
readonly retryable: (e: unknown) => boolean;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
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 };
|