@teardown/schemas 0.1.21 → 0.1.23

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.
Files changed (76) hide show
  1. package/package.json +49 -52
  2. package/src/common/primitives.ts +21 -0
  3. package/src/common/responses.ts +25 -0
  4. package/{dist/common/type-checks.d.ts → src/common/type-checks.ts} +23 -4
  5. package/{dist/index.js → src/index.ts} +1 -0
  6. package/src/modules/analytics/schemas.ts +178 -0
  7. package/src/modules/builds/schemas.ts +171 -0
  8. package/src/modules/devices/schemas.ts +196 -0
  9. package/src/modules/environment/schemas.ts +81 -0
  10. package/src/modules/events/index.ts +2 -0
  11. package/src/modules/events/schemas.ts +129 -0
  12. package/src/modules/identify/schemas.ts +257 -0
  13. package/src/modules/me/schemas.ts +87 -0
  14. package/src/modules/orgs/schemas.ts +260 -0
  15. package/src/modules/personas/schemas.ts +123 -0
  16. package/src/modules/projects/schemas.ts +179 -0
  17. package/src/modules/sessions/schemas.ts +158 -0
  18. package/src/modules/versions/schemas.ts +192 -0
  19. package/dist/common/index.js +0 -3
  20. package/dist/common/primitives.d.ts +0 -11
  21. package/dist/common/primitives.js +0 -8
  22. package/dist/common/responses.d.ts +0 -27
  23. package/dist/common/responses.js +0 -13
  24. package/dist/common/type-checks.js +0 -1
  25. package/dist/index.d.ts +0 -13
  26. package/dist/modules/analytics/schemas.d.ts +0 -239
  27. package/dist/modules/analytics/schemas.js +0 -136
  28. package/dist/modules/builds/schemas.d.ts +0 -248
  29. package/dist/modules/builds/schemas.js +0 -137
  30. package/dist/modules/devices/schemas.d.ts +0 -207
  31. package/dist/modules/devices/schemas.js +0 -165
  32. package/dist/modules/environment/schemas.d.ts +0 -56
  33. package/dist/modules/environment/schemas.js +0 -57
  34. package/dist/modules/events/schemas.d.ts +0 -138
  35. package/dist/modules/events/schemas.js +0 -116
  36. package/dist/modules/identify/index.js +0 -1
  37. package/dist/modules/identify/schemas.d.ts +0 -377
  38. package/dist/modules/identify/schemas.js +0 -221
  39. package/dist/modules/index.js +0 -12
  40. package/dist/modules/me/index.d.ts +0 -1
  41. package/dist/modules/me/index.js +0 -1
  42. package/dist/modules/me/schemas.d.ts +0 -75
  43. package/dist/modules/me/schemas.js +0 -76
  44. package/dist/modules/orgs/index.d.ts +0 -1
  45. package/dist/modules/orgs/index.js +0 -1
  46. package/dist/modules/orgs/schemas.d.ts +0 -308
  47. package/dist/modules/orgs/schemas.js +0 -214
  48. package/dist/modules/personas/index.d.ts +0 -1
  49. package/dist/modules/personas/index.js +0 -1
  50. package/dist/modules/personas/schemas.d.ts +0 -170
  51. package/dist/modules/personas/schemas.js +0 -100
  52. package/dist/modules/projects/index.d.ts +0 -1
  53. package/dist/modules/projects/index.js +0 -1
  54. package/dist/modules/projects/schemas.d.ts +0 -222
  55. package/dist/modules/projects/schemas.js +0 -145
  56. package/dist/modules/sessions/index.d.ts +0 -1
  57. package/dist/modules/sessions/index.js +0 -1
  58. package/dist/modules/sessions/schemas.d.ts +0 -258
  59. package/dist/modules/sessions/schemas.js +0 -128
  60. package/dist/modules/versions/index.d.ts +0 -1
  61. package/dist/modules/versions/index.js +0 -1
  62. package/dist/modules/versions/schemas.d.ts +0 -248
  63. package/dist/modules/versions/schemas.js +0 -155
  64. /package/{dist/common/index.d.ts → src/common/index.ts} +0 -0
  65. /package/{dist/modules/analytics/index.d.ts → src/modules/analytics/index.ts} +0 -0
  66. /package/{dist/modules/analytics/index.js → src/modules/builds/index.ts} +0 -0
  67. /package/{dist/modules/builds/index.d.ts → src/modules/devices/index.ts} +0 -0
  68. /package/{dist/modules/builds/index.js → src/modules/environment/index.ts} +0 -0
  69. /package/{dist/modules/devices/index.d.ts → src/modules/identify/index.ts} +0 -0
  70. /package/{dist/modules/index.d.ts → src/modules/index.ts} +0 -0
  71. /package/{dist/modules/devices/index.js → src/modules/me/index.ts} +0 -0
  72. /package/{dist/modules/environment/index.d.ts → src/modules/orgs/index.ts} +0 -0
  73. /package/{dist/modules/environment/index.js → src/modules/personas/index.ts} +0 -0
  74. /package/{dist/modules/events/index.d.ts → src/modules/projects/index.ts} +0 -0
  75. /package/{dist/modules/events/index.js → src/modules/sessions/index.ts} +0 -0
  76. /package/{dist/modules/identify/index.d.ts → src/modules/versions/index.ts} +0 -0
@@ -1,170 +0,0 @@
1
- import { type Static } from "@sinclair/typebox";
2
- import type { AssertSchemaCompatibleWithRow, AssertTrue } from "../../common";
3
- /**
4
- * Base persona schema
5
- * Represents personas table structure
6
- */
7
- export declare const PersonaSchema: import("@sinclair/typebox").TObject<{
8
- id: import("@sinclair/typebox").TString;
9
- environment_id: import("@sinclair/typebox").TString;
10
- user_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
11
- name: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
12
- email: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
13
- created_at: import("@sinclair/typebox").TString;
14
- updated_at: import("@sinclair/typebox").TString;
15
- }>;
16
- export type Persona = Static<typeof PersonaSchema>;
17
- /**
18
- * Persona params schema
19
- */
20
- export declare const PersonaParamsSchema: import("@sinclair/typebox").TObject<{
21
- persona_id: import("@sinclair/typebox").TString;
22
- }>;
23
- export type PersonaParams = Static<typeof PersonaParamsSchema>;
24
- /**
25
- * Search personas query schema
26
- * Supports pagination, search, and sorting
27
- */
28
- export declare const SearchPersonasQuerySchema: import("@sinclair/typebox").TObject<{
29
- project_id: import("@sinclair/typebox").TString;
30
- page: import("@sinclair/typebox").TNumber;
31
- limit: import("@sinclair/typebox").TNumber;
32
- search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
33
- sort_by: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"created_at">, import("@sinclair/typebox").TLiteral<"updated_at">, import("@sinclair/typebox").TLiteral<"name">, import("@sinclair/typebox").TLiteral<"email">]>;
34
- sort_order: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>;
35
- }>;
36
- export type SearchPersonasQuery = Static<typeof SearchPersonasQuerySchema>;
37
- /**
38
- * Search personas query schema without project_id (injected from headers)
39
- */
40
- export declare const SearchPersonasQueryParamsSchema: import("@sinclair/typebox").TObject<{
41
- search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
42
- limit: import("@sinclair/typebox").TNumber;
43
- page: import("@sinclair/typebox").TNumber;
44
- sort_by: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"created_at">, import("@sinclair/typebox").TLiteral<"updated_at">, import("@sinclair/typebox").TLiteral<"name">, import("@sinclair/typebox").TLiteral<"email">]>;
45
- sort_order: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>;
46
- }>;
47
- export type SearchPersonasQueryParams = Static<typeof SearchPersonasQueryParamsSchema>;
48
- /**
49
- * Personas by IDs request schema
50
- */
51
- export declare const PersonasByIdsSchema: import("@sinclair/typebox").TObject<{
52
- persona_ids: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
53
- }>;
54
- export type PersonasByIds = Static<typeof PersonasByIdsSchema>;
55
- /**
56
- * Paginated personas response schema
57
- */
58
- export declare const PersonasResponseSchema: import("@sinclair/typebox").TObject<{
59
- personas: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
60
- id: import("@sinclair/typebox").TString;
61
- environment_id: import("@sinclair/typebox").TString;
62
- user_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
63
- name: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
64
- email: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
65
- created_at: import("@sinclair/typebox").TString;
66
- updated_at: import("@sinclair/typebox").TString;
67
- }>>;
68
- pagination: import("@sinclair/typebox").TObject<{
69
- page: import("@sinclair/typebox").TInteger;
70
- limit: import("@sinclair/typebox").TInteger;
71
- total: import("@sinclair/typebox").TInteger;
72
- total_pages: import("@sinclair/typebox").TInteger;
73
- }>;
74
- }>;
75
- export type PersonasResponse = Static<typeof PersonasResponseSchema>;
76
- /**
77
- * Single persona response schema
78
- */
79
- export declare const PersonaResponseSchema: import("@sinclair/typebox").TObject<{
80
- success: import("@sinclair/typebox").TLiteral<true>;
81
- data: import("@sinclair/typebox").TObject<{
82
- id: import("@sinclair/typebox").TString;
83
- environment_id: import("@sinclair/typebox").TString;
84
- user_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
85
- name: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
86
- email: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
87
- created_at: import("@sinclair/typebox").TString;
88
- updated_at: import("@sinclair/typebox").TString;
89
- }>;
90
- }>;
91
- export type PersonaResponse = Static<typeof PersonaResponseSchema>;
92
- /**
93
- * Persona error response schema
94
- * Discriminated union by error code
95
- */
96
- export declare const PersonaErrorSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
97
- code: import("@sinclair/typebox").TLiteral<"PERSONA_NOT_FOUND">;
98
- message: import("@sinclair/typebox").TString;
99
- }>, import("@sinclair/typebox").TObject<{
100
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_FOUND">;
101
- message: import("@sinclair/typebox").TString;
102
- }>, import("@sinclair/typebox").TObject<{
103
- code: import("@sinclair/typebox").TLiteral<"FORBIDDEN">;
104
- message: import("@sinclair/typebox").TString;
105
- }>, import("@sinclair/typebox").TObject<{
106
- code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
107
- message: import("@sinclair/typebox").TString;
108
- }>, import("@sinclair/typebox").TObject<{
109
- code: import("@sinclair/typebox").TLiteral<"INVALID_PARAMS">;
110
- message: import("@sinclair/typebox").TString;
111
- }>]>;
112
- export type PersonaError = Static<typeof PersonaErrorSchema>;
113
- /**
114
- * Persona error response wrapper
115
- */
116
- export declare const PersonaErrorResponseSchema: import("@sinclair/typebox").TObject<{
117
- success: import("@sinclair/typebox").TLiteral<false>;
118
- error: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
119
- code: import("@sinclair/typebox").TLiteral<"PERSONA_NOT_FOUND">;
120
- message: import("@sinclair/typebox").TString;
121
- }>, import("@sinclair/typebox").TObject<{
122
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_FOUND">;
123
- message: import("@sinclair/typebox").TString;
124
- }>, import("@sinclair/typebox").TObject<{
125
- code: import("@sinclair/typebox").TLiteral<"FORBIDDEN">;
126
- message: import("@sinclair/typebox").TString;
127
- }>, import("@sinclair/typebox").TObject<{
128
- code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
129
- message: import("@sinclair/typebox").TString;
130
- }>, import("@sinclair/typebox").TObject<{
131
- code: import("@sinclair/typebox").TLiteral<"INVALID_PARAMS">;
132
- message: import("@sinclair/typebox").TString;
133
- }>]>;
134
- }>;
135
- export type PersonaErrorResponse = Static<typeof PersonaErrorResponseSchema>;
136
- /**
137
- * Persona request response schema
138
- */
139
- export declare const PersonaRequestResponseSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
140
- success: import("@sinclair/typebox").TLiteral<true>;
141
- data: import("@sinclair/typebox").TObject<{
142
- id: import("@sinclair/typebox").TString;
143
- environment_id: import("@sinclair/typebox").TString;
144
- user_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
145
- name: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
146
- email: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
147
- created_at: import("@sinclair/typebox").TString;
148
- updated_at: import("@sinclair/typebox").TString;
149
- }>;
150
- }>, import("@sinclair/typebox").TObject<{
151
- success: import("@sinclair/typebox").TLiteral<false>;
152
- error: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
153
- code: import("@sinclair/typebox").TLiteral<"PERSONA_NOT_FOUND">;
154
- message: import("@sinclair/typebox").TString;
155
- }>, import("@sinclair/typebox").TObject<{
156
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_FOUND">;
157
- message: import("@sinclair/typebox").TString;
158
- }>, import("@sinclair/typebox").TObject<{
159
- code: import("@sinclair/typebox").TLiteral<"FORBIDDEN">;
160
- message: import("@sinclair/typebox").TString;
161
- }>, import("@sinclair/typebox").TObject<{
162
- code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
163
- message: import("@sinclair/typebox").TString;
164
- }>, import("@sinclair/typebox").TObject<{
165
- code: import("@sinclair/typebox").TLiteral<"INVALID_PARAMS">;
166
- message: import("@sinclair/typebox").TString;
167
- }>]>;
168
- }>]>;
169
- export type PersonaRequestResponse = Static<typeof PersonaRequestResponseSchema>;
170
- export type _CheckPersonaRow = AssertTrue<AssertSchemaCompatibleWithRow<Persona, "personas">>;
@@ -1,100 +0,0 @@
1
- import { Type } from "@sinclair/typebox";
2
- /**
3
- * Base persona schema
4
- * Represents personas table structure
5
- */
6
- export const PersonaSchema = Type.Object({
7
- id: Type.String({ format: "uuid" }),
8
- environment_id: Type.String({ format: "uuid" }),
9
- user_id: Type.Union([Type.String(), Type.Null()]),
10
- name: Type.Union([Type.String(), Type.Null()]),
11
- email: Type.Union([Type.String({ format: "email" }), Type.Null()]),
12
- created_at: Type.String(),
13
- updated_at: Type.String(),
14
- });
15
- /**
16
- * Persona params schema
17
- */
18
- export const PersonaParamsSchema = Type.Object({
19
- persona_id: Type.String({ format: "uuid" }),
20
- });
21
- /**
22
- * Search personas query schema
23
- * Supports pagination, search, and sorting
24
- */
25
- export const SearchPersonasQuerySchema = Type.Object({
26
- project_id: Type.String({ format: "uuid" }),
27
- page: Type.Number({ minimum: 1, default: 1 }),
28
- limit: Type.Number({ minimum: 1, maximum: 100, default: 20 }),
29
- search: Type.Optional(Type.String()),
30
- sort_by: Type.Union([Type.Literal("created_at"), Type.Literal("updated_at"), Type.Literal("name"), Type.Literal("email")], {
31
- default: "created_at",
32
- }),
33
- sort_order: Type.Union([Type.Literal("asc"), Type.Literal("desc")], { default: "desc" }),
34
- });
35
- /**
36
- * Search personas query schema without project_id (injected from headers)
37
- */
38
- export const SearchPersonasQueryParamsSchema = Type.Omit(SearchPersonasQuerySchema, ["project_id"]);
39
- /**
40
- * Personas by IDs request schema
41
- */
42
- export const PersonasByIdsSchema = Type.Object({
43
- persona_ids: Type.Array(Type.String({ format: "uuid" }), { minItems: 1, maxItems: 100 }),
44
- });
45
- /**
46
- * Paginated personas response schema
47
- */
48
- export const PersonasResponseSchema = Type.Object({
49
- personas: Type.Array(PersonaSchema),
50
- pagination: Type.Object({
51
- page: Type.Integer({ minimum: 1 }),
52
- limit: Type.Integer({ minimum: 1 }),
53
- total: Type.Integer({ minimum: 0 }),
54
- total_pages: Type.Integer({ minimum: 0 }),
55
- }),
56
- });
57
- /**
58
- * Single persona response schema
59
- */
60
- export const PersonaResponseSchema = Type.Object({
61
- success: Type.Literal(true),
62
- data: PersonaSchema,
63
- });
64
- /**
65
- * Persona error response schema
66
- * Discriminated union by error code
67
- */
68
- export const PersonaErrorSchema = Type.Union([
69
- Type.Object({
70
- code: Type.Literal("PERSONA_NOT_FOUND"),
71
- message: Type.String(),
72
- }),
73
- Type.Object({
74
- code: Type.Literal("PROJECT_NOT_FOUND"),
75
- message: Type.String(),
76
- }),
77
- Type.Object({
78
- code: Type.Literal("FORBIDDEN"),
79
- message: Type.String(),
80
- }),
81
- Type.Object({
82
- code: Type.Literal("FETCH_FAILED"),
83
- message: Type.String(),
84
- }),
85
- Type.Object({
86
- code: Type.Literal("INVALID_PARAMS"),
87
- message: Type.String(),
88
- }),
89
- ]);
90
- /**
91
- * Persona error response wrapper
92
- */
93
- export const PersonaErrorResponseSchema = Type.Object({
94
- success: Type.Literal(false),
95
- error: PersonaErrorSchema,
96
- });
97
- /**
98
- * Persona request response schema
99
- */
100
- export const PersonaRequestResponseSchema = Type.Union([PersonaResponseSchema, PersonaErrorResponseSchema]);
@@ -1 +0,0 @@
1
- export * from "./schemas";
@@ -1 +0,0 @@
1
- export * from "./schemas";
@@ -1,222 +0,0 @@
1
- import { type Static } from "@sinclair/typebox";
2
- import { ProjectStatusEnum, ProjectTypeEnum } from "@teardown/types";
3
- import { type AssertSchemaCompatibleWithInsert, type AssertSchemaCompatibleWithRow, type AssertSchemaCompatibleWithUpdate, type AssertTrue } from "../../common";
4
- /**
5
- * Parse and validate a ProjectTypeEnum value
6
- * Uses a switch statement to ensure type safety and runtime validation
7
- * @param value - The value to parse
8
- * @returns The validated ProjectTypeEnum value
9
- * @throws Error if the value is not a valid ProjectTypeEnum
10
- */
11
- export declare function parseProjectTypeEnum(value: unknown): ProjectTypeEnum;
12
- /**
13
- * Parse and validate a ProjectStatusEnum value
14
- * Uses a switch statement to ensure type safety and runtime validation
15
- * @param value - The value to parse
16
- * @returns The validated ProjectStatusEnum value
17
- * @throws Error if the value is not a valid ProjectStatusEnum
18
- */
19
- export declare function parseProjectStatusEnum(value: unknown): ProjectStatusEnum;
20
- /**
21
- * Base project schema
22
- * Represents projects table structure
23
- */
24
- export declare const ProjectSchema: import("@sinclair/typebox").TObject<{
25
- id: import("@sinclair/typebox").TString;
26
- org_id: import("@sinclair/typebox").TString;
27
- name: import("@sinclair/typebox").TString;
28
- slug: import("@sinclair/typebox").TString;
29
- type: import("@sinclair/typebox").TEnum<typeof ProjectTypeEnum>;
30
- status: import("@sinclair/typebox").TEnum<typeof ProjectStatusEnum>;
31
- created_at: import("@sinclair/typebox").TString;
32
- updated_at: import("@sinclair/typebox").TString;
33
- }>;
34
- export type Project = Static<typeof ProjectSchema>;
35
- export declare const ProjectParamsSchema: import("@sinclair/typebox").TObject<{
36
- project_id_or_slug: import("@sinclair/typebox").TString;
37
- }>;
38
- export type ProjectParams = Static<typeof ProjectParamsSchema>;
39
- /**
40
- * Create project request schema
41
- */
42
- export declare const CreateProjectSchema: import("@sinclair/typebox").TObject<{
43
- name: import("@sinclair/typebox").TString;
44
- slug: import("@sinclair/typebox").TString;
45
- type: import("@sinclair/typebox").TEnum<typeof ProjectTypeEnum>;
46
- org_id: import("@sinclair/typebox").TString;
47
- }>;
48
- export type CreateProject = Static<typeof CreateProjectSchema>;
49
- /**
50
- * Update project request schema
51
- */
52
- export declare const UpdateProjectSchema: import("@sinclair/typebox").TObject<{
53
- name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
54
- slug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
55
- }>;
56
- export type UpdateProject = Static<typeof UpdateProjectSchema>;
57
- /**
58
- * Single project response schema
59
- */
60
- export declare const ProjectResponseSchema: import("@sinclair/typebox").TObject<{
61
- success: import("@sinclair/typebox").TLiteral<true>;
62
- data: import("@sinclair/typebox").TObject<{
63
- id: import("@sinclair/typebox").TString;
64
- org_id: import("@sinclair/typebox").TString;
65
- name: import("@sinclair/typebox").TString;
66
- slug: import("@sinclair/typebox").TString;
67
- type: import("@sinclair/typebox").TEnum<typeof ProjectTypeEnum>;
68
- status: import("@sinclair/typebox").TEnum<typeof ProjectStatusEnum>;
69
- created_at: import("@sinclair/typebox").TString;
70
- updated_at: import("@sinclair/typebox").TString;
71
- }>;
72
- }>;
73
- export type ProjectResponse = Static<typeof ProjectResponseSchema>;
74
- /**
75
- * Multiple projects response schema
76
- */
77
- export declare const ProjectsResponseSchema: import("@sinclair/typebox").TObject<{
78
- projects: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
79
- id: import("@sinclair/typebox").TString;
80
- org_id: import("@sinclair/typebox").TString;
81
- name: import("@sinclair/typebox").TString;
82
- slug: import("@sinclair/typebox").TString;
83
- type: import("@sinclair/typebox").TEnum<typeof ProjectTypeEnum>;
84
- status: import("@sinclair/typebox").TEnum<typeof ProjectStatusEnum>;
85
- created_at: import("@sinclair/typebox").TString;
86
- updated_at: import("@sinclair/typebox").TString;
87
- }>>;
88
- }>;
89
- export type ProjectsResponse = Static<typeof ProjectsResponseSchema>;
90
- /**
91
- * Project error response schema
92
- * Discriminated union by error code
93
- */
94
- export declare const ProjectErrorSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
95
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_FOUND">;
96
- message: import("@sinclair/typebox").TString;
97
- }>, import("@sinclair/typebox").TObject<{
98
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_IN_ORG">;
99
- message: import("@sinclair/typebox").TString;
100
- }>, import("@sinclair/typebox").TObject<{
101
- code: import("@sinclair/typebox").TLiteral<"INVALID_SLUG">;
102
- message: import("@sinclair/typebox").TString;
103
- }>, import("@sinclair/typebox").TObject<{
104
- code: import("@sinclair/typebox").TLiteral<"SLUG_ALREADY_EXISTS">;
105
- message: import("@sinclair/typebox").TString;
106
- }>, import("@sinclair/typebox").TObject<{
107
- code: import("@sinclair/typebox").TLiteral<"FORBIDDEN">;
108
- message: import("@sinclair/typebox").TString;
109
- }>, import("@sinclair/typebox").TObject<{
110
- code: import("@sinclair/typebox").TLiteral<"CREATE_FAILED">;
111
- message: import("@sinclair/typebox").TString;
112
- }>, import("@sinclair/typebox").TObject<{
113
- code: import("@sinclair/typebox").TLiteral<"UPDATE_FAILED">;
114
- message: import("@sinclair/typebox").TString;
115
- }>, import("@sinclair/typebox").TObject<{
116
- code: import("@sinclair/typebox").TLiteral<"DELETE_FAILED">;
117
- message: import("@sinclair/typebox").TString;
118
- }>, import("@sinclair/typebox").TObject<{
119
- code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
120
- message: import("@sinclair/typebox").TString;
121
- }>, import("@sinclair/typebox").TObject<{
122
- code: import("@sinclair/typebox").TLiteral<"ARCHIVE_FAILED">;
123
- message: import("@sinclair/typebox").TString;
124
- }>, import("@sinclair/typebox").TObject<{
125
- code: import("@sinclair/typebox").TLiteral<"INVALID_REQUEST">;
126
- message: import("@sinclair/typebox").TString;
127
- }>]>;
128
- export type ProjectError = Static<typeof ProjectErrorSchema>;
129
- /**
130
- * Project error response wrapper
131
- */
132
- export declare const ProjectErrorResponseSchema: import("@sinclair/typebox").TObject<{
133
- success: import("@sinclair/typebox").TLiteral<false>;
134
- error: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
135
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_FOUND">;
136
- message: import("@sinclair/typebox").TString;
137
- }>, import("@sinclair/typebox").TObject<{
138
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_IN_ORG">;
139
- message: import("@sinclair/typebox").TString;
140
- }>, import("@sinclair/typebox").TObject<{
141
- code: import("@sinclair/typebox").TLiteral<"INVALID_SLUG">;
142
- message: import("@sinclair/typebox").TString;
143
- }>, import("@sinclair/typebox").TObject<{
144
- code: import("@sinclair/typebox").TLiteral<"SLUG_ALREADY_EXISTS">;
145
- message: import("@sinclair/typebox").TString;
146
- }>, import("@sinclair/typebox").TObject<{
147
- code: import("@sinclair/typebox").TLiteral<"FORBIDDEN">;
148
- message: import("@sinclair/typebox").TString;
149
- }>, import("@sinclair/typebox").TObject<{
150
- code: import("@sinclair/typebox").TLiteral<"CREATE_FAILED">;
151
- message: import("@sinclair/typebox").TString;
152
- }>, import("@sinclair/typebox").TObject<{
153
- code: import("@sinclair/typebox").TLiteral<"UPDATE_FAILED">;
154
- message: import("@sinclair/typebox").TString;
155
- }>, import("@sinclair/typebox").TObject<{
156
- code: import("@sinclair/typebox").TLiteral<"DELETE_FAILED">;
157
- message: import("@sinclair/typebox").TString;
158
- }>, import("@sinclair/typebox").TObject<{
159
- code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
160
- message: import("@sinclair/typebox").TString;
161
- }>, import("@sinclair/typebox").TObject<{
162
- code: import("@sinclair/typebox").TLiteral<"ARCHIVE_FAILED">;
163
- message: import("@sinclair/typebox").TString;
164
- }>, import("@sinclair/typebox").TObject<{
165
- code: import("@sinclair/typebox").TLiteral<"INVALID_REQUEST">;
166
- message: import("@sinclair/typebox").TString;
167
- }>]>;
168
- }>;
169
- export type ProjectErrorResponse = Static<typeof ProjectErrorResponseSchema>;
170
- export declare const ProjectRequestResponseSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
171
- success: import("@sinclair/typebox").TLiteral<true>;
172
- data: import("@sinclair/typebox").TObject<{
173
- id: import("@sinclair/typebox").TString;
174
- org_id: import("@sinclair/typebox").TString;
175
- name: import("@sinclair/typebox").TString;
176
- slug: import("@sinclair/typebox").TString;
177
- type: import("@sinclair/typebox").TEnum<typeof ProjectTypeEnum>;
178
- status: import("@sinclair/typebox").TEnum<typeof ProjectStatusEnum>;
179
- created_at: import("@sinclair/typebox").TString;
180
- updated_at: import("@sinclair/typebox").TString;
181
- }>;
182
- }>, import("@sinclair/typebox").TObject<{
183
- success: import("@sinclair/typebox").TLiteral<false>;
184
- error: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
185
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_FOUND">;
186
- message: import("@sinclair/typebox").TString;
187
- }>, import("@sinclair/typebox").TObject<{
188
- code: import("@sinclair/typebox").TLiteral<"PROJECT_NOT_IN_ORG">;
189
- message: import("@sinclair/typebox").TString;
190
- }>, import("@sinclair/typebox").TObject<{
191
- code: import("@sinclair/typebox").TLiteral<"INVALID_SLUG">;
192
- message: import("@sinclair/typebox").TString;
193
- }>, import("@sinclair/typebox").TObject<{
194
- code: import("@sinclair/typebox").TLiteral<"SLUG_ALREADY_EXISTS">;
195
- message: import("@sinclair/typebox").TString;
196
- }>, import("@sinclair/typebox").TObject<{
197
- code: import("@sinclair/typebox").TLiteral<"FORBIDDEN">;
198
- message: import("@sinclair/typebox").TString;
199
- }>, import("@sinclair/typebox").TObject<{
200
- code: import("@sinclair/typebox").TLiteral<"CREATE_FAILED">;
201
- message: import("@sinclair/typebox").TString;
202
- }>, import("@sinclair/typebox").TObject<{
203
- code: import("@sinclair/typebox").TLiteral<"UPDATE_FAILED">;
204
- message: import("@sinclair/typebox").TString;
205
- }>, import("@sinclair/typebox").TObject<{
206
- code: import("@sinclair/typebox").TLiteral<"DELETE_FAILED">;
207
- message: import("@sinclair/typebox").TString;
208
- }>, import("@sinclair/typebox").TObject<{
209
- code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
210
- message: import("@sinclair/typebox").TString;
211
- }>, import("@sinclair/typebox").TObject<{
212
- code: import("@sinclair/typebox").TLiteral<"ARCHIVE_FAILED">;
213
- message: import("@sinclair/typebox").TString;
214
- }>, import("@sinclair/typebox").TObject<{
215
- code: import("@sinclair/typebox").TLiteral<"INVALID_REQUEST">;
216
- message: import("@sinclair/typebox").TString;
217
- }>]>;
218
- }>]>;
219
- export type ProjectRequestResponse = Static<typeof ProjectRequestResponseSchema>;
220
- export type _CheckProjectRow = AssertTrue<AssertSchemaCompatibleWithRow<Project, "projects">>;
221
- export type _CheckCreateProject = AssertTrue<AssertSchemaCompatibleWithInsert<CreateProject, "projects">>;
222
- export type _CheckUpdateProject = AssertTrue<AssertSchemaCompatibleWithUpdate<UpdateProject, "projects">>;
@@ -1,145 +0,0 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { ProjectStatusEnum, ProjectTypeEnum } from "@teardown/types";
3
- import { SlugSchema, } from "../../common";
4
- /**
5
- * Parse and validate a ProjectTypeEnum value
6
- * Uses a switch statement to ensure type safety and runtime validation
7
- * @param value - The value to parse
8
- * @returns The validated ProjectTypeEnum value
9
- * @throws Error if the value is not a valid ProjectTypeEnum
10
- */
11
- export function parseProjectTypeEnum(value) {
12
- switch (value) {
13
- case ProjectTypeEnum.REACT_NATIVE:
14
- return ProjectTypeEnum.REACT_NATIVE;
15
- case ProjectTypeEnum.EXPO:
16
- return ProjectTypeEnum.EXPO;
17
- default:
18
- throw new Error(`Invalid ProjectTypeEnum value: ${value}. Expected one of: ${Object.values(ProjectTypeEnum).join(", ")}`);
19
- }
20
- }
21
- /**
22
- * Parse and validate a ProjectStatusEnum value
23
- * Uses a switch statement to ensure type safety and runtime validation
24
- * @param value - The value to parse
25
- * @returns The validated ProjectStatusEnum value
26
- * @throws Error if the value is not a valid ProjectStatusEnum
27
- */
28
- export function parseProjectStatusEnum(value) {
29
- switch (value) {
30
- case ProjectStatusEnum.PENDING_SETUP:
31
- return ProjectStatusEnum.PENDING_SETUP;
32
- case ProjectStatusEnum.ACTIVE:
33
- return ProjectStatusEnum.ACTIVE;
34
- case ProjectStatusEnum.PAUSED:
35
- return ProjectStatusEnum.PAUSED;
36
- case ProjectStatusEnum.ARCHIVED:
37
- return ProjectStatusEnum.ARCHIVED;
38
- default:
39
- throw new Error(`Invalid ProjectStatusEnum value: ${value}. Expected one of: ${Object.values(ProjectStatusEnum).join(", ")}`);
40
- }
41
- }
42
- /**
43
- * Base project schema
44
- * Represents projects table structure
45
- */
46
- export const ProjectSchema = Type.Object({
47
- id: Type.String({ format: "uuid" }),
48
- org_id: Type.String({ format: "uuid" }),
49
- name: Type.String({ minLength: 1 }),
50
- slug: SlugSchema,
51
- type: Type.Enum(ProjectTypeEnum),
52
- status: Type.Enum(ProjectStatusEnum),
53
- created_at: Type.String(),
54
- updated_at: Type.String(),
55
- });
56
- export const ProjectParamsSchema = Type.Object({
57
- project_id_or_slug: Type.String(),
58
- });
59
- /**
60
- * Create project request schema
61
- */
62
- export const CreateProjectSchema = Type.Object({
63
- name: Type.String({ minLength: 1, maxLength: 255 }),
64
- slug: SlugSchema,
65
- type: Type.Enum(ProjectTypeEnum),
66
- org_id: Type.String(),
67
- });
68
- /**
69
- * Update project request schema
70
- */
71
- export const UpdateProjectSchema = Type.Object({
72
- name: Type.Optional(Type.String({ minLength: 1, maxLength: 255 })),
73
- slug: Type.Optional(SlugSchema),
74
- });
75
- /**
76
- * Single project response schema
77
- */
78
- export const ProjectResponseSchema = Type.Object({
79
- success: Type.Literal(true),
80
- data: ProjectSchema,
81
- });
82
- /**
83
- * Multiple projects response schema
84
- */
85
- export const ProjectsResponseSchema = Type.Object({
86
- projects: Type.Array(ProjectSchema),
87
- });
88
- /**
89
- * Project error response schema
90
- * Discriminated union by error code
91
- */
92
- export const ProjectErrorSchema = Type.Union([
93
- Type.Object({
94
- code: Type.Literal("PROJECT_NOT_FOUND"),
95
- message: Type.String(),
96
- }),
97
- Type.Object({
98
- code: Type.Literal("PROJECT_NOT_IN_ORG"),
99
- message: Type.String(),
100
- }),
101
- Type.Object({
102
- code: Type.Literal("INVALID_SLUG"),
103
- message: Type.String(),
104
- }),
105
- Type.Object({
106
- code: Type.Literal("SLUG_ALREADY_EXISTS"),
107
- message: Type.String(),
108
- }),
109
- Type.Object({
110
- code: Type.Literal("FORBIDDEN"),
111
- message: Type.String(),
112
- }),
113
- Type.Object({
114
- code: Type.Literal("CREATE_FAILED"),
115
- message: Type.String(),
116
- }),
117
- Type.Object({
118
- code: Type.Literal("UPDATE_FAILED"),
119
- message: Type.String(),
120
- }),
121
- Type.Object({
122
- code: Type.Literal("DELETE_FAILED"),
123
- message: Type.String(),
124
- }),
125
- Type.Object({
126
- code: Type.Literal("FETCH_FAILED"),
127
- message: Type.String(),
128
- }),
129
- Type.Object({
130
- code: Type.Literal("ARCHIVE_FAILED"),
131
- message: Type.String(),
132
- }),
133
- Type.Object({
134
- code: Type.Literal("INVALID_REQUEST"),
135
- message: Type.String(),
136
- }),
137
- ]);
138
- /**
139
- * Project error response wrapper
140
- */
141
- export const ProjectErrorResponseSchema = Type.Object({
142
- success: Type.Literal(false),
143
- error: ProjectErrorSchema,
144
- });
145
- export const ProjectRequestResponseSchema = Type.Union([ProjectResponseSchema, ProjectErrorResponseSchema]);
@@ -1 +0,0 @@
1
- export * from "./schemas";
@@ -1 +0,0 @@
1
- export * from "./schemas";