@boboddy/sdk 0.0.7-alpha

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.
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export declare const problemDetailsErrorItemSchema: z.ZodObject<{
3
+ path: z.ZodString;
4
+ message: z.ZodString;
5
+ summary: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strip>;
7
+ export declare const apiErrorResponseSchema: z.ZodObject<{
8
+ type: z.ZodString;
9
+ title: z.ZodString;
10
+ status: z.ZodNumber;
11
+ detail: z.ZodOptional<z.ZodString>;
12
+ instance: z.ZodOptional<z.ZodString>;
13
+ code: z.ZodOptional<z.ZodString>;
14
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
+ path: z.ZodString;
16
+ message: z.ZodString;
17
+ summary: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>>>;
19
+ }, z.core.$strip>;
20
+ export type ApiErrorResponse = z.infer<typeof apiErrorResponseSchema>;
@@ -0,0 +1,23 @@
1
+ type ApiErrorHandlerContext = {
2
+ code: string | number;
3
+ error: unknown;
4
+ request: Request;
5
+ set: {
6
+ status?: string | number;
7
+ headers: Record<string, unknown>;
8
+ };
9
+ };
10
+ export declare function apiErrorHandler({ code, error, request, set, }: ApiErrorHandlerContext): {
11
+ type: string;
12
+ title: string;
13
+ status: number;
14
+ detail?: string | undefined;
15
+ instance?: string | undefined;
16
+ code?: string | undefined;
17
+ errors?: {
18
+ path: string;
19
+ message: string;
20
+ summary?: string | undefined;
21
+ }[] | undefined;
22
+ };
23
+ export {};
@@ -0,0 +1,18 @@
1
+ import { type UuidV7 } from "@boboddy/core/common/contracts/uuid-v7";
2
+ import type { AppContext } from "@boboddy/core/lib/di";
3
+ import type { ProjectPermission } from "@boboddy/core/projects/project/domain/project-permission";
4
+ type MaybePromise<T> = T | Promise<T>;
5
+ type AuthenticatedContext = {
6
+ auth: {
7
+ userId: UuidV7;
8
+ };
9
+ body?: unknown;
10
+ params?: unknown;
11
+ query?: unknown;
12
+ };
13
+ type ProjectPermissionDeclaration<TContext> = {
14
+ permission: ProjectPermission;
15
+ projectId: (context: TContext) => MaybePromise<UuidV7 | string | readonly (UuidV7 | string)[]>;
16
+ };
17
+ export declare const withProjectPermission: <TContext extends AuthenticatedContext, TResult>(appContext: AppContext, declaration: ProjectPermissionDeclaration<TContext>, handler: (context: TContext) => MaybePromise<TResult>) => (context: TContext) => Promise<TResult>;
18
+ export {};
@@ -0,0 +1,57 @@
1
+ import { Elysia } from "elysia";
2
+ export declare const createAuthRoutes: () => Elysia<"", {
3
+ decorator: {};
4
+ store: {};
5
+ derive: {};
6
+ resolve: {};
7
+ }, {
8
+ typebox: {};
9
+ error: {};
10
+ }, {
11
+ schema: {};
12
+ standaloneSchema: {};
13
+ macro: {};
14
+ macroFn: {};
15
+ parser: {};
16
+ response: {};
17
+ }, {
18
+ api: {
19
+ auth: {
20
+ "*": {
21
+ [x: string]: {
22
+ body: unknown;
23
+ params: {
24
+ "*": string;
25
+ } & {};
26
+ query: unknown;
27
+ headers: unknown;
28
+ response: {
29
+ 422: {
30
+ type: "validation";
31
+ on: string;
32
+ summary?: string;
33
+ message?: string;
34
+ found?: unknown;
35
+ property?: string;
36
+ expected?: string;
37
+ };
38
+ 200: Response;
39
+ 405: "Method Not Allowed";
40
+ };
41
+ };
42
+ };
43
+ };
44
+ };
45
+ }, {
46
+ derive: {};
47
+ resolve: {};
48
+ schema: {};
49
+ standaloneSchema: {};
50
+ response: {};
51
+ }, {
52
+ derive: {};
53
+ resolve: {};
54
+ schema: {};
55
+ standaloneSchema: {};
56
+ response: {};
57
+ }>;
@@ -0,0 +1,75 @@
1
+ import { Elysia } from "elysia";
2
+ export declare const authenticated: Elysia<"", {
3
+ decorator: {};
4
+ store: {};
5
+ derive: {};
6
+ resolve: {};
7
+ }, {
8
+ typebox: {};
9
+ error: {};
10
+ }, {
11
+ schema: {};
12
+ standaloneSchema: {};
13
+ macro: {};
14
+ macroFn: {};
15
+ parser: {};
16
+ response: {};
17
+ }, {}, {
18
+ derive: {
19
+ readonly auth: {
20
+ readonly userId: import("@boboddy/core/common/contracts/uuid-v7").UuidV7;
21
+ readonly user: {
22
+ id: string;
23
+ createdAt: Date;
24
+ updatedAt: Date;
25
+ email: string;
26
+ emailVerified: boolean;
27
+ name: string;
28
+ image?: string | null | undefined | undefined;
29
+ };
30
+ readonly session: {
31
+ id: string;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ userId: string;
35
+ expiresAt: Date;
36
+ token: string;
37
+ ipAddress?: string | null | undefined | undefined;
38
+ userAgent?: string | null | undefined | undefined;
39
+ };
40
+ };
41
+ };
42
+ resolve: {};
43
+ schema: {};
44
+ standaloneSchema: {};
45
+ response: import("elysia").ExtractErrorFromHandle<{
46
+ readonly auth: {
47
+ readonly userId: import("@boboddy/core/common/contracts/uuid-v7").UuidV7;
48
+ readonly user: {
49
+ id: string;
50
+ createdAt: Date;
51
+ updatedAt: Date;
52
+ email: string;
53
+ emailVerified: boolean;
54
+ name: string;
55
+ image?: string | null | undefined | undefined;
56
+ };
57
+ readonly session: {
58
+ id: string;
59
+ createdAt: Date;
60
+ updatedAt: Date;
61
+ userId: string;
62
+ expiresAt: Date;
63
+ token: string;
64
+ ipAddress?: string | null | undefined | undefined;
65
+ userAgent?: string | null | undefined | undefined;
66
+ };
67
+ };
68
+ }>;
69
+ }, {
70
+ derive: {};
71
+ resolve: {};
72
+ schema: {};
73
+ standaloneSchema: {};
74
+ response: {};
75
+ }>;
@@ -0,0 +1,279 @@
1
+ import { Elysia } from "elysia";
2
+ import type { AppContext } from "@boboddy/core/lib/di";
3
+ export declare const createFeedbackRequestRoutes: (appContext: AppContext) => Elysia<"", {
4
+ decorator: {};
5
+ store: {};
6
+ derive: {};
7
+ resolve: {};
8
+ }, {
9
+ typebox: {};
10
+ error: {};
11
+ }, {
12
+ schema: {};
13
+ standaloneSchema: {};
14
+ macro: {};
15
+ macroFn: {};
16
+ parser: {};
17
+ response: {};
18
+ }, {
19
+ projects: {
20
+ ":projectId": {
21
+ "step-signals": {
22
+ ":stepSignalId": {
23
+ "feedback-requests": {
24
+ get: {
25
+ body: unknown;
26
+ params: {
27
+ projectId: string & {
28
+ readonly __brand: "uuidv7";
29
+ };
30
+ stepSignalId: string & {
31
+ readonly __brand: "uuidv7";
32
+ };
33
+ };
34
+ query: unknown;
35
+ headers: unknown;
36
+ response: {
37
+ 422: {
38
+ type: string;
39
+ title: string;
40
+ status: number;
41
+ detail?: string | undefined;
42
+ instance?: string | undefined;
43
+ code?: string | undefined;
44
+ errors?: {
45
+ path: string;
46
+ message: string;
47
+ summary?: string | undefined;
48
+ }[] | undefined;
49
+ };
50
+ 404: {
51
+ type: string;
52
+ title: string;
53
+ status: number;
54
+ detail?: string | undefined;
55
+ instance?: string | undefined;
56
+ code?: string | undefined;
57
+ errors?: {
58
+ path: string;
59
+ message: string;
60
+ summary?: string | undefined;
61
+ }[] | undefined;
62
+ };
63
+ 500: {
64
+ type: string;
65
+ title: string;
66
+ status: number;
67
+ detail?: string | undefined;
68
+ instance?: string | undefined;
69
+ code?: string | undefined;
70
+ errors?: {
71
+ path: string;
72
+ message: string;
73
+ summary?: string | undefined;
74
+ }[] | undefined;
75
+ };
76
+ 200: {
77
+ id: string & {
78
+ readonly __brand: "uuidv7";
79
+ };
80
+ stepSignalId: string & {
81
+ readonly __brand: "uuidv7";
82
+ };
83
+ question: string;
84
+ category: string;
85
+ suggestedKey: string | null;
86
+ status: "pending" | "answered" | "declined";
87
+ createdAt: string;
88
+ updatedAt: string;
89
+ }[];
90
+ 403: {
91
+ type: string;
92
+ title: string;
93
+ status: number;
94
+ detail?: string | undefined;
95
+ instance?: string | undefined;
96
+ code?: string | undefined;
97
+ errors?: {
98
+ path: string;
99
+ message: string;
100
+ summary?: string | undefined;
101
+ }[] | undefined;
102
+ };
103
+ 401: {
104
+ type: string;
105
+ title: string;
106
+ status: number;
107
+ detail?: string | undefined;
108
+ instance?: string | undefined;
109
+ code?: string | undefined;
110
+ errors?: {
111
+ path: string;
112
+ message: string;
113
+ summary?: string | undefined;
114
+ }[] | undefined;
115
+ };
116
+ };
117
+ };
118
+ };
119
+ };
120
+ };
121
+ };
122
+ };
123
+ } & {
124
+ projects: {
125
+ ":projectId": {
126
+ "feedback-requests": {
127
+ ":feedbackRequestId": {
128
+ decline: {
129
+ post: {
130
+ body: unknown;
131
+ params: {
132
+ projectId: string & {
133
+ readonly __brand: "uuidv7";
134
+ };
135
+ feedbackRequestId: string & {
136
+ readonly __brand: "uuidv7";
137
+ };
138
+ };
139
+ query: unknown;
140
+ headers: unknown;
141
+ response: {
142
+ 422: {
143
+ type: string;
144
+ title: string;
145
+ status: number;
146
+ detail?: string | undefined;
147
+ instance?: string | undefined;
148
+ code?: string | undefined;
149
+ errors?: {
150
+ path: string;
151
+ message: string;
152
+ summary?: string | undefined;
153
+ }[] | undefined;
154
+ };
155
+ 404: {
156
+ type: string;
157
+ title: string;
158
+ status: number;
159
+ detail?: string | undefined;
160
+ instance?: string | undefined;
161
+ code?: string | undefined;
162
+ errors?: {
163
+ path: string;
164
+ message: string;
165
+ summary?: string | undefined;
166
+ }[] | undefined;
167
+ };
168
+ 500: {
169
+ type: string;
170
+ title: string;
171
+ status: number;
172
+ detail?: string | undefined;
173
+ instance?: string | undefined;
174
+ code?: string | undefined;
175
+ errors?: {
176
+ path: string;
177
+ message: string;
178
+ summary?: string | undefined;
179
+ }[] | undefined;
180
+ };
181
+ 200: null;
182
+ 403: {
183
+ type: string;
184
+ title: string;
185
+ status: number;
186
+ detail?: string | undefined;
187
+ instance?: string | undefined;
188
+ code?: string | undefined;
189
+ errors?: {
190
+ path: string;
191
+ message: string;
192
+ summary?: string | undefined;
193
+ }[] | undefined;
194
+ };
195
+ 401: {
196
+ type: string;
197
+ title: string;
198
+ status: number;
199
+ detail?: string | undefined;
200
+ instance?: string | undefined;
201
+ code?: string | undefined;
202
+ errors?: {
203
+ path: string;
204
+ message: string;
205
+ summary?: string | undefined;
206
+ }[] | undefined;
207
+ };
208
+ };
209
+ };
210
+ };
211
+ };
212
+ };
213
+ };
214
+ };
215
+ }, {
216
+ derive: {};
217
+ resolve: {};
218
+ schema: {};
219
+ standaloneSchema: {};
220
+ response: {};
221
+ }, {
222
+ derive: {};
223
+ resolve: {};
224
+ schema: {};
225
+ standaloneSchema: {};
226
+ response: {};
227
+ } & {
228
+ derive: {
229
+ readonly auth: {
230
+ readonly userId: import("@boboddy/core/common/contracts/uuid-v7").UuidV7;
231
+ readonly user: {
232
+ id: string;
233
+ createdAt: Date;
234
+ updatedAt: Date;
235
+ email: string;
236
+ emailVerified: boolean;
237
+ name: string;
238
+ image?: string | null | undefined | undefined;
239
+ };
240
+ readonly session: {
241
+ id: string;
242
+ createdAt: Date;
243
+ updatedAt: Date;
244
+ userId: string;
245
+ expiresAt: Date;
246
+ token: string;
247
+ ipAddress?: string | null | undefined | undefined;
248
+ userAgent?: string | null | undefined | undefined;
249
+ };
250
+ };
251
+ };
252
+ resolve: {};
253
+ schema: {};
254
+ standaloneSchema: {};
255
+ response: import("elysia").ExtractErrorFromHandle<{
256
+ readonly auth: {
257
+ readonly userId: import("@boboddy/core/common/contracts/uuid-v7").UuidV7;
258
+ readonly user: {
259
+ id: string;
260
+ createdAt: Date;
261
+ updatedAt: Date;
262
+ email: string;
263
+ emailVerified: boolean;
264
+ name: string;
265
+ image?: string | null | undefined | undefined;
266
+ };
267
+ readonly session: {
268
+ id: string;
269
+ createdAt: Date;
270
+ updatedAt: Date;
271
+ userId: string;
272
+ expiresAt: Date;
273
+ token: string;
274
+ ipAddress?: string | null | undefined | undefined;
275
+ userAgent?: string | null | undefined | undefined;
276
+ };
277
+ };
278
+ }>;
279
+ }>;