@contractspec/example.saas-boilerplate 3.8.8 → 3.8.10
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/.turbo/turbo-build.log +156 -156
- package/CHANGELOG.md +40 -0
- package/dist/billing/billing.entity.js +1 -113
- package/dist/billing/billing.enum.js +1 -19
- package/dist/billing/billing.event.js +1 -90
- package/dist/billing/billing.handler.js +1 -148
- package/dist/billing/billing.operations.js +1 -278
- package/dist/billing/billing.presentation.js +1 -55
- package/dist/billing/billing.schema.js +1 -121
- package/dist/billing/index.js +1 -691
- package/dist/browser/billing/billing.entity.js +1 -113
- package/dist/browser/billing/billing.enum.js +1 -19
- package/dist/browser/billing/billing.event.js +1 -90
- package/dist/browser/billing/billing.handler.js +1 -148
- package/dist/browser/billing/billing.operations.js +1 -278
- package/dist/browser/billing/billing.presentation.js +1 -55
- package/dist/browser/billing/billing.schema.js +1 -121
- package/dist/browser/billing/index.js +1 -691
- package/dist/browser/dashboard/dashboard.presentation.js +1 -55
- package/dist/browser/dashboard/index.js +1 -55
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/docs/saas-boilerplate.docblock.js +5 -49
- package/dist/browser/example.js +1 -39
- package/dist/browser/handlers/index.js +2 -358
- package/dist/browser/handlers/saas.handlers.js +2 -134
- package/dist/browser/index.js +9 -3591
- package/dist/browser/presentations/index.js +1 -299
- package/dist/browser/project/index.js +1 -793
- package/dist/browser/project/project.entity.js +1 -77
- package/dist/browser/project/project.enum.js +1 -18
- package/dist/browser/project/project.event.js +1 -103
- package/dist/browser/project/project.handler.js +1 -178
- package/dist/browser/project/project.operations.js +1 -372
- package/dist/browser/project/project.presentation.js +1 -180
- package/dist/browser/project/project.schema.js +1 -134
- package/dist/browser/saas-boilerplate.feature.js +1 -304
- package/dist/browser/seeders/index.js +2 -20
- package/dist/browser/settings/index.js +1 -75
- package/dist/browser/settings/settings.entity.js +1 -74
- package/dist/browser/settings/settings.enum.js +1 -11
- package/dist/browser/shared/mock-data.js +1 -104
- package/dist/browser/tests/operations.test-spec.js +1 -112
- package/dist/browser/ui/SaasDashboard.js +1 -1239
- package/dist/browser/ui/SaasDashboard.visualizations.js +1 -249
- package/dist/browser/ui/SaasProjectList.js +1 -162
- package/dist/browser/ui/SaasSettingsPanel.js +1 -145
- package/dist/browser/ui/hooks/index.js +1 -159
- package/dist/browser/ui/hooks/useProjectList.js +1 -66
- package/dist/browser/ui/hooks/useProjectMutations.js +1 -91
- package/dist/browser/ui/index.js +5 -2077
- package/dist/browser/ui/modals/CreateProjectModal.js +1 -153
- package/dist/browser/ui/modals/ProjectActionsModal.js +1 -335
- package/dist/browser/ui/modals/index.js +1 -487
- package/dist/browser/ui/overlays/demo-overlays.js +1 -61
- package/dist/browser/ui/overlays/index.js +1 -61
- package/dist/browser/ui/renderers/index.js +5 -901
- package/dist/browser/ui/renderers/project-list.markdown.js +5 -725
- package/dist/browser/ui/renderers/project-list.renderer.js +1 -177
- package/dist/browser/visualizations/catalog.js +1 -155
- package/dist/browser/visualizations/index.js +1 -217
- package/dist/browser/visualizations/selectors.js +1 -210
- package/dist/dashboard/dashboard.presentation.js +1 -55
- package/dist/dashboard/index.js +1 -55
- package/dist/docs/index.js +5 -49
- package/dist/docs/saas-boilerplate.docblock.js +5 -49
- package/dist/example.js +1 -39
- package/dist/handlers/index.js +2 -358
- package/dist/handlers/saas.handlers.js +2 -134
- package/dist/index.js +9 -3591
- package/dist/node/billing/billing.entity.js +1 -113
- package/dist/node/billing/billing.enum.js +1 -19
- package/dist/node/billing/billing.event.js +1 -90
- package/dist/node/billing/billing.handler.js +1 -148
- package/dist/node/billing/billing.operations.js +1 -278
- package/dist/node/billing/billing.presentation.js +1 -55
- package/dist/node/billing/billing.schema.js +1 -121
- package/dist/node/billing/index.js +1 -691
- package/dist/node/dashboard/dashboard.presentation.js +1 -55
- package/dist/node/dashboard/index.js +1 -55
- package/dist/node/docs/index.js +5 -49
- package/dist/node/docs/saas-boilerplate.docblock.js +5 -49
- package/dist/node/example.js +1 -39
- package/dist/node/handlers/index.js +2 -358
- package/dist/node/handlers/saas.handlers.js +2 -134
- package/dist/node/index.js +9 -3591
- package/dist/node/presentations/index.js +1 -299
- package/dist/node/project/index.js +1 -793
- package/dist/node/project/project.entity.js +1 -77
- package/dist/node/project/project.enum.js +1 -18
- package/dist/node/project/project.event.js +1 -103
- package/dist/node/project/project.handler.js +1 -178
- package/dist/node/project/project.operations.js +1 -372
- package/dist/node/project/project.presentation.js +1 -180
- package/dist/node/project/project.schema.js +1 -134
- package/dist/node/saas-boilerplate.feature.js +1 -304
- package/dist/node/seeders/index.js +2 -20
- package/dist/node/settings/index.js +1 -75
- package/dist/node/settings/settings.entity.js +1 -74
- package/dist/node/settings/settings.enum.js +1 -11
- package/dist/node/shared/mock-data.js +1 -104
- package/dist/node/tests/operations.test-spec.js +1 -112
- package/dist/node/ui/SaasDashboard.js +1 -1239
- package/dist/node/ui/SaasDashboard.visualizations.js +1 -249
- package/dist/node/ui/SaasProjectList.js +1 -162
- package/dist/node/ui/SaasSettingsPanel.js +1 -145
- package/dist/node/ui/hooks/index.js +1 -159
- package/dist/node/ui/hooks/useProjectList.js +1 -66
- package/dist/node/ui/hooks/useProjectMutations.js +1 -91
- package/dist/node/ui/index.js +5 -2077
- package/dist/node/ui/modals/CreateProjectModal.js +1 -153
- package/dist/node/ui/modals/ProjectActionsModal.js +1 -335
- package/dist/node/ui/modals/index.js +1 -487
- package/dist/node/ui/overlays/demo-overlays.js +1 -61
- package/dist/node/ui/overlays/index.js +1 -61
- package/dist/node/ui/renderers/index.js +5 -901
- package/dist/node/ui/renderers/project-list.markdown.js +5 -725
- package/dist/node/ui/renderers/project-list.renderer.js +1 -177
- package/dist/node/visualizations/catalog.js +1 -155
- package/dist/node/visualizations/index.js +1 -217
- package/dist/node/visualizations/selectors.js +1 -210
- package/dist/presentations/index.js +1 -299
- package/dist/project/index.js +1 -793
- package/dist/project/project.entity.js +1 -77
- package/dist/project/project.enum.js +1 -18
- package/dist/project/project.event.js +1 -103
- package/dist/project/project.handler.js +1 -178
- package/dist/project/project.operations.js +1 -372
- package/dist/project/project.presentation.js +1 -180
- package/dist/project/project.schema.js +1 -134
- package/dist/saas-boilerplate.feature.js +1 -304
- package/dist/seeders/index.js +2 -20
- package/dist/settings/index.js +1 -75
- package/dist/settings/settings.entity.js +1 -74
- package/dist/settings/settings.enum.js +1 -11
- package/dist/shared/mock-data.js +1 -104
- package/dist/tests/operations.test-spec.js +1 -112
- package/dist/ui/SaasDashboard.js +1 -1239
- package/dist/ui/SaasDashboard.visualizations.js +1 -249
- package/dist/ui/SaasProjectList.js +1 -162
- package/dist/ui/SaasSettingsPanel.js +1 -145
- package/dist/ui/hooks/index.js +1 -159
- package/dist/ui/hooks/useProjectList.js +1 -66
- package/dist/ui/hooks/useProjectMutations.js +1 -91
- package/dist/ui/index.js +5 -2077
- package/dist/ui/modals/CreateProjectModal.js +1 -153
- package/dist/ui/modals/ProjectActionsModal.js +1 -335
- package/dist/ui/modals/index.js +1 -487
- package/dist/ui/overlays/demo-overlays.js +1 -61
- package/dist/ui/overlays/index.js +1 -61
- package/dist/ui/renderers/index.js +5 -901
- package/dist/ui/renderers/project-list.markdown.js +5 -725
- package/dist/ui/renderers/project-list.renderer.js +1 -177
- package/dist/visualizations/catalog.js +1 -155
- package/dist/visualizations/index.js +1 -217
- package/dist/visualizations/selectors.js +1 -210
- package/package.json +15 -15
|
@@ -1,372 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var ProjectStatusSchemaEnum = defineEnum("ProjectStatus", [
|
|
4
|
-
"DRAFT",
|
|
5
|
-
"ACTIVE",
|
|
6
|
-
"ARCHIVED",
|
|
7
|
-
"DELETED"
|
|
8
|
-
]);
|
|
9
|
-
var ProjectStatusFilterEnum = defineEnum("ProjectStatusFilter", [
|
|
10
|
-
"DRAFT",
|
|
11
|
-
"ACTIVE",
|
|
12
|
-
"ARCHIVED",
|
|
13
|
-
"all"
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
// src/project/project.schema.ts
|
|
17
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
18
|
-
var ProjectModel = defineSchemaModel({
|
|
19
|
-
name: "Project",
|
|
20
|
-
description: "A project within an organization",
|
|
21
|
-
fields: {
|
|
22
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
25
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
26
|
-
organizationId: {
|
|
27
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
28
|
-
isOptional: false
|
|
29
|
-
},
|
|
30
|
-
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
-
status: { type: ProjectStatusSchemaEnum, isOptional: false },
|
|
32
|
-
isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
33
|
-
tags: {
|
|
34
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
35
|
-
isArray: true,
|
|
36
|
-
isOptional: false
|
|
37
|
-
},
|
|
38
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
39
|
-
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var CreateProjectInputModel = defineSchemaModel({
|
|
43
|
-
name: "CreateProjectInput",
|
|
44
|
-
description: "Input for creating a project",
|
|
45
|
-
fields: {
|
|
46
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
47
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
48
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
49
|
-
isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
50
|
-
tags: {
|
|
51
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
52
|
-
isArray: true,
|
|
53
|
-
isOptional: true
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
var 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
|
-
var GetProjectInputModel = defineSchemaModel({
|
|
75
|
-
name: "GetProjectInput",
|
|
76
|
-
fields: {
|
|
77
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
var DeleteProjectInputModel = defineSchemaModel({
|
|
81
|
-
name: "DeleteProjectInput",
|
|
82
|
-
fields: {
|
|
83
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
var DeleteProjectOutputModel = defineSchemaModel({
|
|
87
|
-
name: "DeleteProjectOutput",
|
|
88
|
-
fields: {
|
|
89
|
-
success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var ProjectDeletedPayloadModel = defineSchemaModel({
|
|
93
|
-
name: "ProjectDeletedPayload",
|
|
94
|
-
fields: {
|
|
95
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
var ListProjectsInputModel = defineSchemaModel({
|
|
99
|
-
name: "ListProjectsInput",
|
|
100
|
-
description: "Input for listing projects",
|
|
101
|
-
fields: {
|
|
102
|
-
status: { type: ProjectStatusFilterEnum, isOptional: true },
|
|
103
|
-
search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
104
|
-
limit: {
|
|
105
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
106
|
-
isOptional: true,
|
|
107
|
-
defaultValue: 20
|
|
108
|
-
},
|
|
109
|
-
offset: {
|
|
110
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
111
|
-
isOptional: true,
|
|
112
|
-
defaultValue: 0
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var ListProjectsOutputModel = defineSchemaModel({
|
|
117
|
-
name: "ListProjectsOutput",
|
|
118
|
-
description: "Output for listing projects",
|
|
119
|
-
fields: {
|
|
120
|
-
projects: { type: ProjectModel, isArray: true, isOptional: false },
|
|
121
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// src/project/project.operations.ts
|
|
126
|
-
import {
|
|
127
|
-
defineCommand,
|
|
128
|
-
defineQuery
|
|
129
|
-
} from "@contractspec/lib.contracts-spec/operations";
|
|
130
|
-
var OWNERS = ["example.saas-boilerplate"];
|
|
131
|
-
var CreateProjectContract = defineCommand({
|
|
132
|
-
meta: {
|
|
133
|
-
key: "saas.project.create",
|
|
134
|
-
version: "1.0.0",
|
|
135
|
-
stability: "stable",
|
|
136
|
-
owners: [...OWNERS],
|
|
137
|
-
tags: ["saas", "project", "create"],
|
|
138
|
-
description: "Create a new project in the organization.",
|
|
139
|
-
goal: "Allow users to create projects for organizing work.",
|
|
140
|
-
context: "Called from project creation UI or API."
|
|
141
|
-
},
|
|
142
|
-
io: {
|
|
143
|
-
input: CreateProjectInputModel,
|
|
144
|
-
output: ProjectModel,
|
|
145
|
-
errors: {
|
|
146
|
-
SLUG_EXISTS: {
|
|
147
|
-
description: "A project with this slug already exists",
|
|
148
|
-
http: 409,
|
|
149
|
-
gqlCode: "SLUG_EXISTS",
|
|
150
|
-
when: "Slug is already taken in the organization"
|
|
151
|
-
},
|
|
152
|
-
LIMIT_REACHED: {
|
|
153
|
-
description: "Project limit reached for this plan",
|
|
154
|
-
http: 403,
|
|
155
|
-
gqlCode: "LIMIT_REACHED",
|
|
156
|
-
when: "Organization has reached project limit"
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
policy: {
|
|
161
|
-
auth: "user"
|
|
162
|
-
},
|
|
163
|
-
sideEffects: {
|
|
164
|
-
emits: [
|
|
165
|
-
{
|
|
166
|
-
key: "project.created",
|
|
167
|
-
version: "1.0.0",
|
|
168
|
-
when: "Project is created",
|
|
169
|
-
payload: ProjectModel
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
audit: ["project.created"]
|
|
173
|
-
},
|
|
174
|
-
acceptance: {
|
|
175
|
-
scenarios: [
|
|
176
|
-
{
|
|
177
|
-
key: "create-project-happy-path",
|
|
178
|
-
given: ["User is authenticated"],
|
|
179
|
-
when: ["User creates project"],
|
|
180
|
-
then: ["Project is created", "ProjectCreated event is emitted"]
|
|
181
|
-
}
|
|
182
|
-
],
|
|
183
|
-
examples: [
|
|
184
|
-
{
|
|
185
|
-
key: "create-basic",
|
|
186
|
-
input: { name: "Website Redesign", slug: "website-redesign" },
|
|
187
|
-
output: { id: "proj-123", name: "Website Redesign", isArchived: false }
|
|
188
|
-
}
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
var GetProjectContract = defineQuery({
|
|
193
|
-
meta: {
|
|
194
|
-
key: "saas.project.get",
|
|
195
|
-
version: "1.0.0",
|
|
196
|
-
stability: "stable",
|
|
197
|
-
owners: [...OWNERS],
|
|
198
|
-
tags: ["saas", "project", "get"],
|
|
199
|
-
description: "Get a project by ID.",
|
|
200
|
-
goal: "Retrieve project details.",
|
|
201
|
-
context: "Project detail page, API calls."
|
|
202
|
-
},
|
|
203
|
-
io: {
|
|
204
|
-
input: GetProjectInputModel,
|
|
205
|
-
output: ProjectModel,
|
|
206
|
-
errors: {
|
|
207
|
-
NOT_FOUND: {
|
|
208
|
-
description: "Project not found",
|
|
209
|
-
http: 404,
|
|
210
|
-
gqlCode: "NOT_FOUND",
|
|
211
|
-
when: "Project ID is invalid or user lacks access"
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
policy: {
|
|
216
|
-
auth: "user"
|
|
217
|
-
},
|
|
218
|
-
acceptance: {
|
|
219
|
-
scenarios: [
|
|
220
|
-
{
|
|
221
|
-
key: "get-project-happy-path",
|
|
222
|
-
given: ["Project exists"],
|
|
223
|
-
when: ["User requests project"],
|
|
224
|
-
then: ["Project details are returned"]
|
|
225
|
-
}
|
|
226
|
-
],
|
|
227
|
-
examples: [
|
|
228
|
-
{
|
|
229
|
-
key: "get-existing",
|
|
230
|
-
input: { projectId: "proj-123" },
|
|
231
|
-
output: { id: "proj-123", name: "Website Redesign" }
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
var UpdateProjectContract = defineCommand({
|
|
237
|
-
meta: {
|
|
238
|
-
key: "saas.project.update",
|
|
239
|
-
version: "1.0.0",
|
|
240
|
-
stability: "stable",
|
|
241
|
-
owners: [...OWNERS],
|
|
242
|
-
tags: ["saas", "project", "update"],
|
|
243
|
-
description: "Update project details.",
|
|
244
|
-
goal: "Allow project owners/editors to modify project.",
|
|
245
|
-
context: "Project settings page."
|
|
246
|
-
},
|
|
247
|
-
io: {
|
|
248
|
-
input: UpdateProjectInputModel,
|
|
249
|
-
output: ProjectModel
|
|
250
|
-
},
|
|
251
|
-
policy: {
|
|
252
|
-
auth: "user"
|
|
253
|
-
},
|
|
254
|
-
sideEffects: {
|
|
255
|
-
emits: [
|
|
256
|
-
{
|
|
257
|
-
key: "project.updated",
|
|
258
|
-
version: "1.0.0",
|
|
259
|
-
when: "Project is updated",
|
|
260
|
-
payload: ProjectModel
|
|
261
|
-
}
|
|
262
|
-
],
|
|
263
|
-
audit: ["project.updated"]
|
|
264
|
-
},
|
|
265
|
-
acceptance: {
|
|
266
|
-
scenarios: [
|
|
267
|
-
{
|
|
268
|
-
key: "update-project-happy-path",
|
|
269
|
-
given: ["Project exists"],
|
|
270
|
-
when: ["User updates description"],
|
|
271
|
-
then: ["Project is updated", "ProjectUpdated event is emitted"]
|
|
272
|
-
}
|
|
273
|
-
],
|
|
274
|
-
examples: [
|
|
275
|
-
{
|
|
276
|
-
key: "update-desc",
|
|
277
|
-
input: { projectId: "proj-123", description: "New description" },
|
|
278
|
-
output: { id: "proj-123", description: "New description" }
|
|
279
|
-
}
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
var DeleteProjectContract = defineCommand({
|
|
284
|
-
meta: {
|
|
285
|
-
key: "saas.project.delete",
|
|
286
|
-
version: "1.0.0",
|
|
287
|
-
stability: "stable",
|
|
288
|
-
owners: [...OWNERS],
|
|
289
|
-
tags: ["saas", "project", "delete"],
|
|
290
|
-
description: "Delete a project (soft delete).",
|
|
291
|
-
goal: "Allow project owners to remove projects.",
|
|
292
|
-
context: "Project settings page."
|
|
293
|
-
},
|
|
294
|
-
io: {
|
|
295
|
-
input: DeleteProjectInputModel,
|
|
296
|
-
output: DeleteProjectOutputModel
|
|
297
|
-
},
|
|
298
|
-
policy: {
|
|
299
|
-
auth: "user"
|
|
300
|
-
},
|
|
301
|
-
sideEffects: {
|
|
302
|
-
emits: [
|
|
303
|
-
{
|
|
304
|
-
key: "project.deleted",
|
|
305
|
-
version: "1.0.0",
|
|
306
|
-
when: "Project is deleted",
|
|
307
|
-
payload: ProjectDeletedPayloadModel
|
|
308
|
-
}
|
|
309
|
-
],
|
|
310
|
-
audit: ["project.deleted"]
|
|
311
|
-
},
|
|
312
|
-
acceptance: {
|
|
313
|
-
scenarios: [
|
|
314
|
-
{
|
|
315
|
-
key: "delete-project-happy-path",
|
|
316
|
-
given: ["Project exists"],
|
|
317
|
-
when: ["User deletes project"],
|
|
318
|
-
then: ["Project is deleted", "ProjectDeleted event is emitted"]
|
|
319
|
-
}
|
|
320
|
-
],
|
|
321
|
-
examples: [
|
|
322
|
-
{
|
|
323
|
-
key: "delete-existing",
|
|
324
|
-
input: { projectId: "proj-123" },
|
|
325
|
-
output: { success: true }
|
|
326
|
-
}
|
|
327
|
-
]
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
var ListProjectsContract = defineQuery({
|
|
331
|
-
meta: {
|
|
332
|
-
key: "saas.project.list",
|
|
333
|
-
version: "1.0.0",
|
|
334
|
-
stability: "stable",
|
|
335
|
-
owners: [...OWNERS],
|
|
336
|
-
tags: ["saas", "project", "list"],
|
|
337
|
-
description: "List projects in the organization.",
|
|
338
|
-
goal: "Show all projects user has access to.",
|
|
339
|
-
context: "Project list page, dashboard."
|
|
340
|
-
},
|
|
341
|
-
io: {
|
|
342
|
-
input: ListProjectsInputModel,
|
|
343
|
-
output: ListProjectsOutputModel
|
|
344
|
-
},
|
|
345
|
-
policy: {
|
|
346
|
-
auth: "user"
|
|
347
|
-
},
|
|
348
|
-
acceptance: {
|
|
349
|
-
scenarios: [
|
|
350
|
-
{
|
|
351
|
-
key: "list-projects-happy-path",
|
|
352
|
-
given: ["Projects exist"],
|
|
353
|
-
when: ["User lists projects"],
|
|
354
|
-
then: ["List of projects is returned"]
|
|
355
|
-
}
|
|
356
|
-
],
|
|
357
|
-
examples: [
|
|
358
|
-
{
|
|
359
|
-
key: "list-all",
|
|
360
|
-
input: { limit: 10 },
|
|
361
|
-
output: { items: [], total: 5 }
|
|
362
|
-
}
|
|
363
|
-
]
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
export {
|
|
367
|
-
UpdateProjectContract,
|
|
368
|
-
ListProjectsContract,
|
|
369
|
-
GetProjectContract,
|
|
370
|
-
DeleteProjectContract,
|
|
371
|
-
CreateProjectContract
|
|
372
|
-
};
|
|
1
|
+
import{defineEnum as A}from"@contractspec/lib.schema";var x=A("ProjectStatus",["DRAFT","ACTIVE","ARCHIVED","DELETED"]),B=A("ProjectStatusFilter",["DRAFT","ACTIVE","ARCHIVED","all"]);import{defineSchemaModel as q,ScalarTypeEnum as k}from"@contractspec/lib.schema";var v=q({name:"Project",description:"A project within an organization",fields:{id:{type:k.String_unsecure(),isOptional:!1},name:{type:k.String_unsecure(),isOptional:!1},description:{type:k.String_unsecure(),isOptional:!0},slug:{type:k.String_unsecure(),isOptional:!0},organizationId:{type:k.String_unsecure(),isOptional:!1},createdBy:{type:k.String_unsecure(),isOptional:!1},status:{type:x,isOptional:!1},isPublic:{type:k.Boolean(),isOptional:!1},tags:{type:k.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:k.DateTime(),isOptional:!1},updatedAt:{type:k.DateTime(),isOptional:!1}}}),H=q({name:"CreateProjectInput",description:"Input for creating a project",fields:{name:{type:k.NonEmptyString(),isOptional:!1},description:{type:k.String_unsecure(),isOptional:!0},slug:{type:k.String_unsecure(),isOptional:!0},isPublic:{type:k.Boolean(),isOptional:!0},tags:{type:k.String_unsecure(),isArray:!0,isOptional:!0}}}),J=q({name:"UpdateProjectInput",description:"Input for updating a project",fields:{projectId:{type:k.String_unsecure(),isOptional:!1},name:{type:k.String_unsecure(),isOptional:!0},description:{type:k.String_unsecure(),isOptional:!0},slug:{type:k.String_unsecure(),isOptional:!0},isPublic:{type:k.Boolean(),isOptional:!0},tags:{type:k.String_unsecure(),isArray:!0,isOptional:!0},status:{type:x,isOptional:!0}}}),K=q({name:"GetProjectInput",fields:{projectId:{type:k.String_unsecure(),isOptional:!1}}}),V=q({name:"DeleteProjectInput",fields:{projectId:{type:k.String_unsecure(),isOptional:!1}}}),X=q({name:"DeleteProjectOutput",fields:{success:{type:k.Boolean(),isOptional:!1}}}),Y=q({name:"ProjectDeletedPayload",fields:{projectId:{type:k.String_unsecure(),isOptional:!1}}}),Z=q({name:"ListProjectsInput",description:"Input for listing projects",fields:{status:{type:B,isOptional:!0},search:{type:k.String_unsecure(),isOptional:!0},limit:{type:k.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:k.Int_unsecure(),isOptional:!0,defaultValue:0}}}),_=q({name:"ListProjectsOutput",description:"Output for listing projects",fields:{projects:{type:v,isArray:!0,isOptional:!1},total:{type:k.Int_unsecure(),isOptional:!1}}});import{defineCommand as z,defineQuery as $}from"@contractspec/lib.contracts-spec/operations";var w=["example.saas-boilerplate"],D=z({meta:{key:"saas.project.create",version:"1.0.0",stability:"stable",owners:[...w],tags:["saas","project","create"],description:"Create a new project in the organization.",goal:"Allow users to create projects for organizing work.",context:"Called from project creation UI or API."},io:{input:H,output:v,errors:{SLUG_EXISTS:{description:"A project with this slug already exists",http:409,gqlCode:"SLUG_EXISTS",when:"Slug is already taken in the organization"},LIMIT_REACHED:{description:"Project limit reached for this plan",http:403,gqlCode:"LIMIT_REACHED",when:"Organization has reached project limit"}}},policy:{auth:"user"},sideEffects:{emits:[{key:"project.created",version:"1.0.0",when:"Project is created",payload:v}],audit:["project.created"]},acceptance:{scenarios:[{key:"create-project-happy-path",given:["User is authenticated"],when:["User creates project"],then:["Project is created","ProjectCreated event is emitted"]}],examples:[{key:"create-basic",input:{name:"Website Redesign",slug:"website-redesign"},output:{id:"proj-123",name:"Website Redesign",isArchived:!1}}]}}),C=$({meta:{key:"saas.project.get",version:"1.0.0",stability:"stable",owners:[...w],tags:["saas","project","get"],description:"Get a project by ID.",goal:"Retrieve project details.",context:"Project detail page, API calls."},io:{input:K,output:v,errors:{NOT_FOUND:{description:"Project not found",http:404,gqlCode:"NOT_FOUND",when:"Project ID is invalid or user lacks access"}}},policy:{auth:"user"},acceptance:{scenarios:[{key:"get-project-happy-path",given:["Project exists"],when:["User requests project"],then:["Project details are returned"]}],examples:[{key:"get-existing",input:{projectId:"proj-123"},output:{id:"proj-123",name:"Website Redesign"}}]}}),I=z({meta:{key:"saas.project.update",version:"1.0.0",stability:"stable",owners:[...w],tags:["saas","project","update"],description:"Update project details.",goal:"Allow project owners/editors to modify project.",context:"Project settings page."},io:{input:J,output:v},policy:{auth:"user"},sideEffects:{emits:[{key:"project.updated",version:"1.0.0",when:"Project is updated",payload:v}],audit:["project.updated"]},acceptance:{scenarios:[{key:"update-project-happy-path",given:["Project exists"],when:["User updates description"],then:["Project is updated","ProjectUpdated event is emitted"]}],examples:[{key:"update-desc",input:{projectId:"proj-123",description:"New description"},output:{id:"proj-123",description:"New description"}}]}}),N=z({meta:{key:"saas.project.delete",version:"1.0.0",stability:"stable",owners:[...w],tags:["saas","project","delete"],description:"Delete a project (soft delete).",goal:"Allow project owners to remove projects.",context:"Project settings page."},io:{input:V,output:X},policy:{auth:"user"},sideEffects:{emits:[{key:"project.deleted",version:"1.0.0",when:"Project is deleted",payload:Y}],audit:["project.deleted"]},acceptance:{scenarios:[{key:"delete-project-happy-path",given:["Project exists"],when:["User deletes project"],then:["Project is deleted","ProjectDeleted event is emitted"]}],examples:[{key:"delete-existing",input:{projectId:"proj-123"},output:{success:!0}}]}}),R=$({meta:{key:"saas.project.list",version:"1.0.0",stability:"stable",owners:[...w],tags:["saas","project","list"],description:"List projects in the organization.",goal:"Show all projects user has access to.",context:"Project list page, dashboard."},io:{input:Z,output:_},policy:{auth:"user"},acceptance:{scenarios:[{key:"list-projects-happy-path",given:["Projects exist"],when:["User lists projects"],then:["List of projects is returned"]}],examples:[{key:"list-all",input:{limit:10},output:{items:[],total:5}}]}});export{I as UpdateProjectContract,R as ListProjectsContract,C as GetProjectContract,N as DeleteProjectContract,D as CreateProjectContract};
|
|
@@ -1,180 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var ProjectStatusSchemaEnum = defineEnum("ProjectStatus", [
|
|
4
|
-
"DRAFT",
|
|
5
|
-
"ACTIVE",
|
|
6
|
-
"ARCHIVED",
|
|
7
|
-
"DELETED"
|
|
8
|
-
]);
|
|
9
|
-
var ProjectStatusFilterEnum = defineEnum("ProjectStatusFilter", [
|
|
10
|
-
"DRAFT",
|
|
11
|
-
"ACTIVE",
|
|
12
|
-
"ARCHIVED",
|
|
13
|
-
"all"
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
// src/project/project.schema.ts
|
|
17
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
18
|
-
var ProjectModel = defineSchemaModel({
|
|
19
|
-
name: "Project",
|
|
20
|
-
description: "A project within an organization",
|
|
21
|
-
fields: {
|
|
22
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
25
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
26
|
-
organizationId: {
|
|
27
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
28
|
-
isOptional: false
|
|
29
|
-
},
|
|
30
|
-
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
-
status: { type: ProjectStatusSchemaEnum, isOptional: false },
|
|
32
|
-
isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
33
|
-
tags: {
|
|
34
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
35
|
-
isArray: true,
|
|
36
|
-
isOptional: false
|
|
37
|
-
},
|
|
38
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
39
|
-
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var CreateProjectInputModel = defineSchemaModel({
|
|
43
|
-
name: "CreateProjectInput",
|
|
44
|
-
description: "Input for creating a project",
|
|
45
|
-
fields: {
|
|
46
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
47
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
48
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
49
|
-
isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
50
|
-
tags: {
|
|
51
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
52
|
-
isArray: true,
|
|
53
|
-
isOptional: true
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
var 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
|
-
var GetProjectInputModel = defineSchemaModel({
|
|
75
|
-
name: "GetProjectInput",
|
|
76
|
-
fields: {
|
|
77
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
var DeleteProjectInputModel = defineSchemaModel({
|
|
81
|
-
name: "DeleteProjectInput",
|
|
82
|
-
fields: {
|
|
83
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
var DeleteProjectOutputModel = defineSchemaModel({
|
|
87
|
-
name: "DeleteProjectOutput",
|
|
88
|
-
fields: {
|
|
89
|
-
success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var ProjectDeletedPayloadModel = defineSchemaModel({
|
|
93
|
-
name: "ProjectDeletedPayload",
|
|
94
|
-
fields: {
|
|
95
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
var ListProjectsInputModel = defineSchemaModel({
|
|
99
|
-
name: "ListProjectsInput",
|
|
100
|
-
description: "Input for listing projects",
|
|
101
|
-
fields: {
|
|
102
|
-
status: { type: ProjectStatusFilterEnum, isOptional: true },
|
|
103
|
-
search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
104
|
-
limit: {
|
|
105
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
106
|
-
isOptional: true,
|
|
107
|
-
defaultValue: 20
|
|
108
|
-
},
|
|
109
|
-
offset: {
|
|
110
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
111
|
-
isOptional: true,
|
|
112
|
-
defaultValue: 0
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var ListProjectsOutputModel = defineSchemaModel({
|
|
117
|
-
name: "ListProjectsOutput",
|
|
118
|
-
description: "Output for listing projects",
|
|
119
|
-
fields: {
|
|
120
|
-
projects: { type: ProjectModel, isArray: true, isOptional: false },
|
|
121
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// src/project/project.presentation.ts
|
|
126
|
-
import {
|
|
127
|
-
definePresentation,
|
|
128
|
-
StabilityEnum
|
|
129
|
-
} from "@contractspec/lib.contracts-spec";
|
|
130
|
-
var ProjectListPresentation = definePresentation({
|
|
131
|
-
meta: {
|
|
132
|
-
key: "saas.project.list",
|
|
133
|
-
version: "1.0.0",
|
|
134
|
-
title: "Project List",
|
|
135
|
-
description: "List view of projects with status, tags, and last updated info",
|
|
136
|
-
domain: "saas-boilerplate",
|
|
137
|
-
owners: ["@saas-team"],
|
|
138
|
-
tags: ["project", "list", "dashboard"],
|
|
139
|
-
stability: StabilityEnum.Beta,
|
|
140
|
-
goal: "Browse and manage projects",
|
|
141
|
-
context: "Project list page"
|
|
142
|
-
},
|
|
143
|
-
source: {
|
|
144
|
-
type: "component",
|
|
145
|
-
framework: "react",
|
|
146
|
-
componentKey: "ProjectListView",
|
|
147
|
-
props: ProjectModel
|
|
148
|
-
},
|
|
149
|
-
targets: ["react", "markdown", "application/json"],
|
|
150
|
-
policy: {
|
|
151
|
-
flags: ["saas.projects.enabled"]
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
var ProjectDetailPresentation = definePresentation({
|
|
155
|
-
meta: {
|
|
156
|
-
key: "saas.project.detail",
|
|
157
|
-
version: "1.0.0",
|
|
158
|
-
title: "Project Details",
|
|
159
|
-
description: "Detailed view of a project with settings and activity",
|
|
160
|
-
domain: "saas-boilerplate",
|
|
161
|
-
owners: ["@saas-team"],
|
|
162
|
-
tags: ["project", "detail"],
|
|
163
|
-
stability: StabilityEnum.Beta,
|
|
164
|
-
goal: "View and edit project details",
|
|
165
|
-
context: "Project detail page"
|
|
166
|
-
},
|
|
167
|
-
source: {
|
|
168
|
-
type: "component",
|
|
169
|
-
framework: "react",
|
|
170
|
-
componentKey: "ProjectDetailView"
|
|
171
|
-
},
|
|
172
|
-
targets: ["react", "markdown"],
|
|
173
|
-
policy: {
|
|
174
|
-
flags: ["saas.projects.enabled"]
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
export {
|
|
178
|
-
ProjectListPresentation,
|
|
179
|
-
ProjectDetailPresentation
|
|
180
|
-
};
|
|
1
|
+
import{defineEnum as x}from"@contractspec/lib.schema";var v=x("ProjectStatus",["DRAFT","ACTIVE","ARCHIVED","DELETED"]),z=x("ProjectStatusFilter",["DRAFT","ACTIVE","ARCHIVED","all"]);import{defineSchemaModel as q,ScalarTypeEnum as k}from"@contractspec/lib.schema";var w=q({name:"Project",description:"A project within an organization",fields:{id:{type:k.String_unsecure(),isOptional:!1},name:{type:k.String_unsecure(),isOptional:!1},description:{type:k.String_unsecure(),isOptional:!0},slug:{type:k.String_unsecure(),isOptional:!0},organizationId:{type:k.String_unsecure(),isOptional:!1},createdBy:{type:k.String_unsecure(),isOptional:!1},status:{type:v,isOptional:!1},isPublic:{type:k.Boolean(),isOptional:!1},tags:{type:k.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:k.DateTime(),isOptional:!1},updatedAt:{type:k.DateTime(),isOptional:!1}}}),I=q({name:"CreateProjectInput",description:"Input for creating a project",fields:{name:{type:k.NonEmptyString(),isOptional:!1},description:{type:k.String_unsecure(),isOptional:!0},slug:{type:k.String_unsecure(),isOptional:!0},isPublic:{type:k.Boolean(),isOptional:!0},tags:{type:k.String_unsecure(),isArray:!0,isOptional:!0}}}),J=q({name:"UpdateProjectInput",description:"Input for updating a project",fields:{projectId:{type:k.String_unsecure(),isOptional:!1},name:{type:k.String_unsecure(),isOptional:!0},description:{type:k.String_unsecure(),isOptional:!0},slug:{type:k.String_unsecure(),isOptional:!0},isPublic:{type:k.Boolean(),isOptional:!0},tags:{type:k.String_unsecure(),isArray:!0,isOptional:!0},status:{type:v,isOptional:!0}}}),K=q({name:"GetProjectInput",fields:{projectId:{type:k.String_unsecure(),isOptional:!1}}}),L=q({name:"DeleteProjectInput",fields:{projectId:{type:k.String_unsecure(),isOptional:!1}}}),N=q({name:"DeleteProjectOutput",fields:{success:{type:k.Boolean(),isOptional:!1}}}),Q=q({name:"ProjectDeletedPayload",fields:{projectId:{type:k.String_unsecure(),isOptional:!1}}}),R=q({name:"ListProjectsInput",description:"Input for listing projects",fields:{status:{type:z,isOptional:!0},search:{type:k.String_unsecure(),isOptional:!0},limit:{type:k.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:k.Int_unsecure(),isOptional:!0,defaultValue:0}}}),U=q({name:"ListProjectsOutput",description:"Output for listing projects",fields:{projects:{type:w,isArray:!0,isOptional:!1},total:{type:k.Int_unsecure(),isOptional:!1}}});import{definePresentation as A,StabilityEnum as B}from"@contractspec/lib.contracts-spec";var Y=A({meta:{key:"saas.project.list",version:"1.0.0",title:"Project List",description:"List view of projects with status, tags, and last updated info",domain:"saas-boilerplate",owners:["@saas-team"],tags:["project","list","dashboard"],stability:B.Beta,goal:"Browse and manage projects",context:"Project list page"},source:{type:"component",framework:"react",componentKey:"ProjectListView",props:w},targets:["react","markdown","application/json"],policy:{flags:["saas.projects.enabled"]}}),Z=A({meta:{key:"saas.project.detail",version:"1.0.0",title:"Project Details",description:"Detailed view of a project with settings and activity",domain:"saas-boilerplate",owners:["@saas-team"],tags:["project","detail"],stability:B.Beta,goal:"View and edit project details",context:"Project detail page"},source:{type:"component",framework:"react",componentKey:"ProjectDetailView"},targets:["react","markdown"],policy:{flags:["saas.projects.enabled"]}});export{Y as ProjectListPresentation,Z as ProjectDetailPresentation};
|