@contractspec/example.saas-boilerplate 1.44.0

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 (142) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +113 -0
  2. package/.turbo/turbo-build.log +114 -0
  3. package/CHANGELOG.md +246 -0
  4. package/LICENSE +21 -0
  5. package/README.md +156 -0
  6. package/dist/billing/billing.entity.d.ts +61 -0
  7. package/dist/billing/billing.entity.d.ts.map +1 -0
  8. package/dist/billing/billing.entity.js +122 -0
  9. package/dist/billing/billing.entity.js.map +1 -0
  10. package/dist/billing/billing.enum.d.ts +16 -0
  11. package/dist/billing/billing.enum.d.ts.map +1 -0
  12. package/dist/billing/billing.enum.js +27 -0
  13. package/dist/billing/billing.enum.js.map +1 -0
  14. package/dist/billing/billing.event.d.ts +86 -0
  15. package/dist/billing/billing.event.d.ts.map +1 -0
  16. package/dist/billing/billing.event.js +153 -0
  17. package/dist/billing/billing.event.js.map +1 -0
  18. package/dist/billing/billing.handler.d.ts +82 -0
  19. package/dist/billing/billing.handler.d.ts.map +1 -0
  20. package/dist/billing/billing.handler.js +58 -0
  21. package/dist/billing/billing.handler.js.map +1 -0
  22. package/dist/billing/billing.operations.d.ts +166 -0
  23. package/dist/billing/billing.operations.d.ts.map +1 -0
  24. package/dist/billing/billing.operations.js +181 -0
  25. package/dist/billing/billing.operations.js.map +1 -0
  26. package/dist/billing/billing.presentation.d.ts +15 -0
  27. package/dist/billing/billing.presentation.d.ts.map +1 -0
  28. package/dist/billing/billing.presentation.js +59 -0
  29. package/dist/billing/billing.presentation.js.map +1 -0
  30. package/dist/billing/billing.schema.d.ts +201 -0
  31. package/dist/billing/billing.schema.d.ts.map +1 -0
  32. package/dist/billing/billing.schema.js +214 -0
  33. package/dist/billing/billing.schema.js.map +1 -0
  34. package/dist/billing/index.d.ts +8 -0
  35. package/dist/billing/index.js +9 -0
  36. package/dist/dashboard/dashboard.presentation.d.ts +15 -0
  37. package/dist/dashboard/dashboard.presentation.d.ts.map +1 -0
  38. package/dist/dashboard/dashboard.presentation.js +55 -0
  39. package/dist/dashboard/dashboard.presentation.js.map +1 -0
  40. package/dist/dashboard/index.d.ts +2 -0
  41. package/dist/dashboard/index.js +3 -0
  42. package/dist/docs/index.d.ts +1 -0
  43. package/dist/docs/index.js +1 -0
  44. package/dist/docs/saas-boilerplate.docblock.d.ts +1 -0
  45. package/dist/docs/saas-boilerplate.docblock.js +100 -0
  46. package/dist/docs/saas-boilerplate.docblock.js.map +1 -0
  47. package/dist/example.d.ts +37 -0
  48. package/dist/example.d.ts.map +1 -0
  49. package/dist/example.js +46 -0
  50. package/dist/example.js.map +1 -0
  51. package/dist/handlers/index.d.ts +3 -0
  52. package/dist/handlers/index.js +4 -0
  53. package/dist/index.d.ts +42 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +69 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/presentations/index.d.ts +17 -0
  58. package/dist/presentations/index.d.ts.map +1 -0
  59. package/dist/presentations/index.js +17 -0
  60. package/dist/presentations/index.js.map +1 -0
  61. package/dist/project/index.d.ts +8 -0
  62. package/dist/project/index.js +9 -0
  63. package/dist/project/project.entity.d.ts +40 -0
  64. package/dist/project/project.entity.d.ts.map +1 -0
  65. package/dist/project/project.entity.js +85 -0
  66. package/dist/project/project.entity.js.map +1 -0
  67. package/dist/project/project.enum.d.ts +16 -0
  68. package/dist/project/project.enum.d.ts.map +1 -0
  69. package/dist/project/project.enum.js +26 -0
  70. package/dist/project/project.enum.js.map +1 -0
  71. package/dist/project/project.event.d.ts +92 -0
  72. package/dist/project/project.event.d.ts.map +1 -0
  73. package/dist/project/project.event.js +165 -0
  74. package/dist/project/project.event.js.map +1 -0
  75. package/dist/project/project.handler.d.ts +72 -0
  76. package/dist/project/project.handler.d.ts.map +1 -0
  77. package/dist/project/project.handler.js +82 -0
  78. package/dist/project/project.handler.js.map +1 -0
  79. package/dist/project/project.operations.d.ts +419 -0
  80. package/dist/project/project.operations.d.ts.map +1 -0
  81. package/dist/project/project.operations.js +260 -0
  82. package/dist/project/project.operations.js.map +1 -0
  83. package/dist/project/project.presentation.d.ts +15 -0
  84. package/dist/project/project.presentation.d.ts.map +1 -0
  85. package/dist/project/project.presentation.js +65 -0
  86. package/dist/project/project.presentation.js.map +1 -0
  87. package/dist/project/project.schema.d.ts +235 -0
  88. package/dist/project/project.schema.d.ts.map +1 -0
  89. package/dist/project/project.schema.js +215 -0
  90. package/dist/project/project.schema.js.map +1 -0
  91. package/dist/saas-boilerplate.feature.d.ts +12 -0
  92. package/dist/saas-boilerplate.feature.d.ts.map +1 -0
  93. package/dist/saas-boilerplate.feature.js +201 -0
  94. package/dist/saas-boilerplate.feature.js.map +1 -0
  95. package/dist/settings/index.d.ts +3 -0
  96. package/dist/settings/index.js +4 -0
  97. package/dist/settings/settings.entity.d.ts +37 -0
  98. package/dist/settings/settings.entity.d.ts.map +1 -0
  99. package/dist/settings/settings.entity.js +78 -0
  100. package/dist/settings/settings.entity.js.map +1 -0
  101. package/dist/settings/settings.enum.d.ts +10 -0
  102. package/dist/settings/settings.enum.d.ts.map +1 -0
  103. package/dist/settings/settings.enum.js +21 -0
  104. package/dist/settings/settings.enum.js.map +1 -0
  105. package/dist/shared/mock-data.d.ts +86 -0
  106. package/dist/shared/mock-data.d.ts.map +1 -0
  107. package/dist/shared/mock-data.js +138 -0
  108. package/dist/shared/mock-data.js.map +1 -0
  109. package/example.ts +1 -0
  110. package/package.json +113 -0
  111. package/src/billing/billing.entity.ts +158 -0
  112. package/src/billing/billing.enum.ts +23 -0
  113. package/src/billing/billing.event.ts +108 -0
  114. package/src/billing/billing.handler.ts +137 -0
  115. package/src/billing/billing.operations.ts +187 -0
  116. package/src/billing/billing.presentation.ts +57 -0
  117. package/src/billing/billing.schema.ts +133 -0
  118. package/src/billing/index.ts +64 -0
  119. package/src/dashboard/dashboard.presentation.ts +57 -0
  120. package/src/dashboard/index.ts +8 -0
  121. package/src/docs/index.ts +1 -0
  122. package/src/docs/saas-boilerplate.docblock.ts +98 -0
  123. package/src/example.ts +31 -0
  124. package/src/handlers/index.ts +20 -0
  125. package/src/index.ts +71 -0
  126. package/src/presentations/index.ts +36 -0
  127. package/src/project/index.ts +66 -0
  128. package/src/project/project.entity.ts +93 -0
  129. package/src/project/project.enum.ts +22 -0
  130. package/src/project/project.event.ts +128 -0
  131. package/src/project/project.handler.ts +168 -0
  132. package/src/project/project.operations.ts +272 -0
  133. package/src/project/project.presentation.ts +59 -0
  134. package/src/project/project.schema.ts +147 -0
  135. package/src/saas-boilerplate.feature.ts +109 -0
  136. package/src/settings/index.ts +9 -0
  137. package/src/settings/settings.entity.ts +89 -0
  138. package/src/settings/settings.enum.ts +11 -0
  139. package/src/shared/mock-data.ts +110 -0
  140. package/tsconfig.json +10 -0
  141. package/tsconfig.tsbuildinfo +1 -0
  142. package/tsdown.config.js +7 -0
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Mock handlers for Project contracts.
3
+ */
4
+ import { MOCK_PROJECTS } from '../shared/mock-data';
5
+
6
+ // Types inferred from contract schemas
7
+ export interface Project {
8
+ id: string;
9
+ name: string;
10
+ description?: string;
11
+ slug?: string;
12
+ organizationId: string;
13
+ createdBy: string;
14
+ status: 'DRAFT' | 'ACTIVE' | 'ARCHIVED' | 'DELETED';
15
+ isPublic: boolean;
16
+ tags: string[];
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ }
20
+
21
+ export interface CreateProjectInput {
22
+ name: string;
23
+ description?: string;
24
+ slug?: string;
25
+ isPublic?: boolean;
26
+ tags?: string[];
27
+ }
28
+
29
+ export interface UpdateProjectInput {
30
+ projectId: string;
31
+ name?: string;
32
+ description?: string;
33
+ slug?: string;
34
+ isPublic?: boolean;
35
+ tags?: string[];
36
+ status?: 'DRAFT' | 'ACTIVE' | 'ARCHIVED' | 'DELETED';
37
+ }
38
+
39
+ export interface ListProjectsInput {
40
+ status?: 'DRAFT' | 'ACTIVE' | 'ARCHIVED' | 'all';
41
+ search?: string;
42
+ limit?: number;
43
+ offset?: number;
44
+ }
45
+
46
+ export interface ListProjectsOutput {
47
+ projects: Project[];
48
+ total: number;
49
+ }
50
+
51
+ /**
52
+ * Mock handler for ListProjectsContract.
53
+ */
54
+ export async function mockListProjectsHandler(
55
+ input: ListProjectsInput
56
+ ): Promise<ListProjectsOutput> {
57
+ const { status, search, limit = 20, offset = 0 } = input;
58
+
59
+ let filtered = [...MOCK_PROJECTS];
60
+
61
+ if (status && status !== 'all') {
62
+ filtered = filtered.filter((p) => p.status === status);
63
+ }
64
+
65
+ if (search) {
66
+ const q = search.toLowerCase();
67
+ filtered = filtered.filter(
68
+ (p) =>
69
+ p.name.toLowerCase().includes(q) ||
70
+ p.description?.toLowerCase().includes(q) ||
71
+ p.tags.some((t) => t.toLowerCase().includes(q))
72
+ );
73
+ }
74
+
75
+ filtered.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
76
+
77
+ const total = filtered.length;
78
+ const projects = filtered.slice(offset, offset + limit);
79
+
80
+ return {
81
+ projects,
82
+ total,
83
+ };
84
+ }
85
+
86
+ /**
87
+ * Mock handler for GetProjectContract.
88
+ */
89
+ export async function mockGetProjectHandler(input: {
90
+ projectId: string;
91
+ }): Promise<Project> {
92
+ const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
93
+
94
+ if (!project) {
95
+ throw new Error('NOT_FOUND');
96
+ }
97
+
98
+ return project;
99
+ }
100
+
101
+ /**
102
+ * Mock handler for CreateProjectContract.
103
+ */
104
+ export async function mockCreateProjectHandler(
105
+ input: CreateProjectInput,
106
+ context: { organizationId: string; userId: string }
107
+ ): Promise<Project> {
108
+ if (input.slug) {
109
+ const exists = MOCK_PROJECTS.some((p) => p.slug === input.slug);
110
+ if (exists) {
111
+ throw new Error('SLUG_EXISTS');
112
+ }
113
+ }
114
+
115
+ const now = new Date();
116
+ return {
117
+ id: `proj-${Date.now()}`,
118
+ name: input.name,
119
+ description: input.description,
120
+ slug: input.slug ?? input.name.toLowerCase().replace(/\s+/g, '-'),
121
+ organizationId: context.organizationId,
122
+ createdBy: context.userId,
123
+ status: 'DRAFT',
124
+ isPublic: input.isPublic ?? false,
125
+ tags: input.tags ?? [],
126
+ createdAt: now,
127
+ updatedAt: now,
128
+ };
129
+ }
130
+
131
+ /**
132
+ * Mock handler for UpdateProjectContract.
133
+ */
134
+ export async function mockUpdateProjectHandler(
135
+ input: UpdateProjectInput
136
+ ): Promise<Project> {
137
+ const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
138
+
139
+ if (!project) {
140
+ throw new Error('NOT_FOUND');
141
+ }
142
+
143
+ return {
144
+ ...project,
145
+ name: input.name ?? project.name,
146
+ description: input.description ?? project.description,
147
+ slug: input.slug ?? project.slug,
148
+ isPublic: input.isPublic ?? project.isPublic,
149
+ tags: input.tags ?? project.tags,
150
+ status: input.status ?? project.status,
151
+ updatedAt: new Date(),
152
+ };
153
+ }
154
+
155
+ /**
156
+ * Mock handler for DeleteProjectContract.
157
+ */
158
+ export async function mockDeleteProjectHandler(input: {
159
+ projectId: string;
160
+ }): Promise<{ success: boolean }> {
161
+ const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
162
+
163
+ if (!project) {
164
+ throw new Error('NOT_FOUND');
165
+ }
166
+
167
+ return { success: true };
168
+ }
@@ -0,0 +1,272 @@
1
+ import {
2
+ defineCommand,
3
+ defineQuery,
4
+ } from '@contractspec/lib.contracts/operations';
5
+ import {
6
+ CreateProjectInputModel,
7
+ DeleteProjectInputModel,
8
+ DeleteProjectOutputModel,
9
+ GetProjectInputModel,
10
+ ListProjectsInputModel,
11
+ ListProjectsOutputModel,
12
+ ProjectDeletedPayloadModel,
13
+ ProjectModel,
14
+ UpdateProjectInputModel,
15
+ } from './project.schema';
16
+
17
+ const OWNERS = ['example.saas-boilerplate'] as const;
18
+
19
+ /**
20
+ * Create a new project.
21
+ */
22
+ export const CreateProjectContract = defineCommand({
23
+ meta: {
24
+ key: 'saas.project.create',
25
+ version: 1,
26
+ stability: 'stable',
27
+ owners: [...OWNERS],
28
+ tags: ['saas', 'project', 'create'],
29
+ description: 'Create a new project in the organization.',
30
+ goal: 'Allow users to create projects for organizing work.',
31
+ context: 'Called from project creation UI or API.',
32
+ },
33
+ io: {
34
+ input: CreateProjectInputModel,
35
+ output: ProjectModel,
36
+ errors: {
37
+ SLUG_EXISTS: {
38
+ description: 'A project with this slug already exists',
39
+ http: 409,
40
+ gqlCode: 'SLUG_EXISTS',
41
+ when: 'Slug is already taken in the organization',
42
+ },
43
+ LIMIT_REACHED: {
44
+ description: 'Project limit reached for this plan',
45
+ http: 403,
46
+ gqlCode: 'LIMIT_REACHED',
47
+ when: 'Organization has reached project limit',
48
+ },
49
+ },
50
+ },
51
+ policy: {
52
+ auth: 'user',
53
+ },
54
+ sideEffects: {
55
+ emits: [
56
+ {
57
+ key: 'project.created',
58
+ version: 1,
59
+ when: 'Project is created',
60
+ payload: ProjectModel,
61
+ },
62
+ ],
63
+ audit: ['project.created'],
64
+ },
65
+ acceptance: {
66
+ scenarios: [
67
+ {
68
+ key: 'create-project-happy-path',
69
+ given: ['User is authenticated'],
70
+ when: ['User creates project'],
71
+ then: ['Project is created', 'ProjectCreated event is emitted'],
72
+ },
73
+ ],
74
+ examples: [
75
+ {
76
+ key: 'create-basic',
77
+ input: { name: 'Website Redesign', slug: 'website-redesign' },
78
+ output: { id: 'proj-123', name: 'Website Redesign', isArchived: false },
79
+ },
80
+ ],
81
+ },
82
+ });
83
+
84
+ /**
85
+ * Get project by ID.
86
+ */
87
+ export const GetProjectContract = defineQuery({
88
+ meta: {
89
+ key: 'saas.project.get',
90
+ version: 1,
91
+ stability: 'stable',
92
+ owners: [...OWNERS],
93
+ tags: ['saas', 'project', 'get'],
94
+ description: 'Get a project by ID.',
95
+ goal: 'Retrieve project details.',
96
+ context: 'Project detail page, API calls.',
97
+ },
98
+ io: {
99
+ input: GetProjectInputModel,
100
+ output: ProjectModel,
101
+ errors: {
102
+ NOT_FOUND: {
103
+ description: 'Project not found',
104
+ http: 404,
105
+ gqlCode: 'NOT_FOUND',
106
+ when: 'Project ID is invalid or user lacks access',
107
+ },
108
+ },
109
+ },
110
+ policy: {
111
+ auth: 'user',
112
+ },
113
+ acceptance: {
114
+ scenarios: [
115
+ {
116
+ key: 'get-project-happy-path',
117
+ given: ['Project exists'],
118
+ when: ['User requests project'],
119
+ then: ['Project details are returned'],
120
+ },
121
+ ],
122
+ examples: [
123
+ {
124
+ key: 'get-existing',
125
+ input: { projectId: 'proj-123' },
126
+ output: { id: 'proj-123', name: 'Website Redesign' },
127
+ },
128
+ ],
129
+ },
130
+ });
131
+
132
+ /**
133
+ * Update a project.
134
+ */
135
+ export const UpdateProjectContract = defineCommand({
136
+ meta: {
137
+ key: 'saas.project.update',
138
+ version: 1,
139
+ stability: 'stable',
140
+ owners: [...OWNERS],
141
+ tags: ['saas', 'project', 'update'],
142
+ description: 'Update project details.',
143
+ goal: 'Allow project owners/editors to modify project.',
144
+ context: 'Project settings page.',
145
+ },
146
+ io: {
147
+ input: UpdateProjectInputModel,
148
+ output: ProjectModel,
149
+ },
150
+ policy: {
151
+ auth: 'user',
152
+ },
153
+ sideEffects: {
154
+ emits: [
155
+ {
156
+ key: 'project.updated',
157
+ version: 1,
158
+ when: 'Project is updated',
159
+ payload: ProjectModel,
160
+ },
161
+ ],
162
+ audit: ['project.updated'],
163
+ },
164
+ acceptance: {
165
+ scenarios: [
166
+ {
167
+ key: 'update-project-happy-path',
168
+ given: ['Project exists'],
169
+ when: ['User updates description'],
170
+ then: ['Project is updated', 'ProjectUpdated event is emitted'],
171
+ },
172
+ ],
173
+ examples: [
174
+ {
175
+ key: 'update-desc',
176
+ input: { projectId: 'proj-123', description: 'New description' },
177
+ output: { id: 'proj-123', description: 'New description' },
178
+ },
179
+ ],
180
+ },
181
+ });
182
+
183
+ /**
184
+ * Delete a project.
185
+ */
186
+ export const DeleteProjectContract = defineCommand({
187
+ meta: {
188
+ key: 'saas.project.delete',
189
+ version: 1,
190
+ stability: 'stable',
191
+ owners: [...OWNERS],
192
+ tags: ['saas', 'project', 'delete'],
193
+ description: 'Delete a project (soft delete).',
194
+ goal: 'Allow project owners to remove projects.',
195
+ context: 'Project settings page.',
196
+ },
197
+ io: {
198
+ input: DeleteProjectInputModel,
199
+ output: DeleteProjectOutputModel,
200
+ },
201
+ policy: {
202
+ auth: 'user',
203
+ },
204
+ sideEffects: {
205
+ emits: [
206
+ {
207
+ key: 'project.deleted',
208
+ version: 1,
209
+ when: 'Project is deleted',
210
+ payload: ProjectDeletedPayloadModel,
211
+ },
212
+ ],
213
+ audit: ['project.deleted'],
214
+ },
215
+ acceptance: {
216
+ scenarios: [
217
+ {
218
+ key: 'delete-project-happy-path',
219
+ given: ['Project exists'],
220
+ when: ['User deletes project'],
221
+ then: ['Project is deleted', 'ProjectDeleted event is emitted'],
222
+ },
223
+ ],
224
+ examples: [
225
+ {
226
+ key: 'delete-existing',
227
+ input: { projectId: 'proj-123' },
228
+ output: { success: true },
229
+ },
230
+ ],
231
+ },
232
+ });
233
+
234
+ /**
235
+ * List organization projects.
236
+ */
237
+ export const ListProjectsContract = defineQuery({
238
+ meta: {
239
+ key: 'saas.project.list',
240
+ version: 1,
241
+ stability: 'stable',
242
+ owners: [...OWNERS],
243
+ tags: ['saas', 'project', 'list'],
244
+ description: 'List projects in the organization.',
245
+ goal: 'Show all projects user has access to.',
246
+ context: 'Project list page, dashboard.',
247
+ },
248
+ io: {
249
+ input: ListProjectsInputModel,
250
+ output: ListProjectsOutputModel,
251
+ },
252
+ policy: {
253
+ auth: 'user',
254
+ },
255
+ acceptance: {
256
+ scenarios: [
257
+ {
258
+ key: 'list-projects-happy-path',
259
+ given: ['Projects exist'],
260
+ when: ['User lists projects'],
261
+ then: ['List of projects is returned'],
262
+ },
263
+ ],
264
+ examples: [
265
+ {
266
+ key: 'list-all',
267
+ input: { limit: 10 },
268
+ output: { items: [], total: 5 },
269
+ },
270
+ ],
271
+ },
272
+ });
@@ -0,0 +1,59 @@
1
+ import type { PresentationSpec } from '@contractspec/lib.contracts';
2
+ import { StabilityEnum } from '@contractspec/lib.contracts';
3
+ import { ProjectModel } from './project.schema';
4
+
5
+ /**
6
+ * Presentation for displaying a list of projects.
7
+ */
8
+ export const ProjectListPresentation: PresentationSpec = {
9
+ meta: {
10
+ key: 'saas.project.list',
11
+ version: 1,
12
+ title: 'Project List',
13
+ description:
14
+ 'List view of projects with status, tags, and last updated info',
15
+ domain: 'saas-boilerplate',
16
+ owners: ['@saas-team'],
17
+ tags: ['project', 'list', 'dashboard'],
18
+ stability: StabilityEnum.Beta,
19
+ goal: 'Browse and manage projects',
20
+ context: 'Project list page',
21
+ },
22
+ source: {
23
+ type: 'component',
24
+ framework: 'react',
25
+ componentKey: 'ProjectListView',
26
+ props: ProjectModel,
27
+ },
28
+ targets: ['react', 'markdown', 'application/json'],
29
+ policy: {
30
+ flags: ['saas.projects.enabled'],
31
+ },
32
+ };
33
+
34
+ /**
35
+ * Presentation for project detail view.
36
+ */
37
+ export const ProjectDetailPresentation: PresentationSpec = {
38
+ meta: {
39
+ key: 'saas.project.detail',
40
+ version: 1,
41
+ title: 'Project Details',
42
+ description: 'Detailed view of a project with settings and activity',
43
+ domain: 'saas-boilerplate',
44
+ owners: ['@saas-team'],
45
+ tags: ['project', 'detail'],
46
+ stability: StabilityEnum.Beta,
47
+ goal: 'View and edit project details',
48
+ context: 'Project detail page',
49
+ },
50
+ source: {
51
+ type: 'component',
52
+ framework: 'react',
53
+ componentKey: 'ProjectDetailView',
54
+ },
55
+ targets: ['react', 'markdown'],
56
+ policy: {
57
+ flags: ['saas.projects.enabled'],
58
+ },
59
+ };
@@ -0,0 +1,147 @@
1
+ import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2
+ import {
3
+ ProjectStatusSchemaEnum,
4
+ ProjectStatusFilterEnum,
5
+ } from './project.enum';
6
+
7
+ /**
8
+ * A project within an organization.
9
+ */
10
+ export const ProjectModel = defineSchemaModel({
11
+ name: 'Project',
12
+ description: 'A project within an organization',
13
+ fields: {
14
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
15
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
17
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
18
+ organizationId: {
19
+ type: ScalarTypeEnum.String_unsecure(),
20
+ isOptional: false,
21
+ },
22
+ createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
+ status: { type: ProjectStatusSchemaEnum, isOptional: false },
24
+ isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
25
+ tags: {
26
+ type: ScalarTypeEnum.String_unsecure(),
27
+ isArray: true,
28
+ isOptional: false,
29
+ },
30
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
31
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
32
+ },
33
+ });
34
+
35
+ /**
36
+ * Input for creating a project.
37
+ */
38
+ export const CreateProjectInputModel = defineSchemaModel({
39
+ name: 'CreateProjectInput',
40
+ description: 'Input for creating a project',
41
+ fields: {
42
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
43
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
44
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
45
+ isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: true },
46
+ tags: {
47
+ type: ScalarTypeEnum.String_unsecure(),
48
+ isArray: true,
49
+ isOptional: true,
50
+ },
51
+ },
52
+ });
53
+
54
+ /**
55
+ * Input for updating a project.
56
+ */
57
+ export const UpdateProjectInputModel = defineSchemaModel({
58
+ name: 'UpdateProjectInput',
59
+ description: 'Input for updating a project',
60
+ fields: {
61
+ projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
62
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
63
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
64
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
65
+ isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: true },
66
+ tags: {
67
+ type: ScalarTypeEnum.String_unsecure(),
68
+ isArray: true,
69
+ isOptional: true,
70
+ },
71
+ status: { type: ProjectStatusSchemaEnum, isOptional: true },
72
+ },
73
+ });
74
+
75
+ /**
76
+ * Input for getting a project.
77
+ */
78
+ export const GetProjectInputModel = defineSchemaModel({
79
+ name: 'GetProjectInput',
80
+ fields: {
81
+ projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
82
+ },
83
+ });
84
+
85
+ /**
86
+ * Input for deleting a project.
87
+ */
88
+ export const DeleteProjectInputModel = defineSchemaModel({
89
+ name: 'DeleteProjectInput',
90
+ fields: {
91
+ projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
92
+ },
93
+ });
94
+
95
+ /**
96
+ * Output for delete operation.
97
+ */
98
+ export const DeleteProjectOutputModel = defineSchemaModel({
99
+ name: 'DeleteProjectOutput',
100
+ fields: {
101
+ success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
102
+ },
103
+ });
104
+
105
+ /**
106
+ * Payload for project deleted event.
107
+ */
108
+ export const ProjectDeletedPayloadModel = defineSchemaModel({
109
+ name: 'ProjectDeletedPayload',
110
+ fields: {
111
+ projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
112
+ },
113
+ });
114
+
115
+ /**
116
+ * Input for listing projects.
117
+ */
118
+ export const ListProjectsInputModel = defineSchemaModel({
119
+ name: 'ListProjectsInput',
120
+ description: 'Input for listing projects',
121
+ fields: {
122
+ status: { type: ProjectStatusFilterEnum, isOptional: true },
123
+ search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
124
+ limit: {
125
+ type: ScalarTypeEnum.Int_unsecure(),
126
+ isOptional: true,
127
+ defaultValue: 20,
128
+ },
129
+ offset: {
130
+ type: ScalarTypeEnum.Int_unsecure(),
131
+ isOptional: true,
132
+ defaultValue: 0,
133
+ },
134
+ },
135
+ });
136
+
137
+ /**
138
+ * Output for listing projects.
139
+ */
140
+ export const ListProjectsOutputModel = defineSchemaModel({
141
+ name: 'ListProjectsOutput',
142
+ description: 'Output for listing projects',
143
+ fields: {
144
+ projects: { type: ProjectModel, isArray: true, isOptional: false },
145
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
146
+ },
147
+ });