@contractspec/example.saas-boilerplate 0.0.0-canary-20260113170453
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$colon$bundle.log +188 -0
- package/.turbo/turbo-build.log +189 -0
- package/CHANGELOG.md +440 -0
- package/LICENSE +21 -0
- package/README.md +155 -0
- package/dist/billing/billing.entity.d.ts +61 -0
- package/dist/billing/billing.entity.d.ts.map +1 -0
- package/dist/billing/billing.entity.js +122 -0
- package/dist/billing/billing.entity.js.map +1 -0
- package/dist/billing/billing.enum.d.ts +16 -0
- package/dist/billing/billing.enum.d.ts.map +1 -0
- package/dist/billing/billing.enum.js +27 -0
- package/dist/billing/billing.enum.js.map +1 -0
- package/dist/billing/billing.event.d.ts +86 -0
- package/dist/billing/billing.event.d.ts.map +1 -0
- package/dist/billing/billing.event.js +153 -0
- package/dist/billing/billing.event.js.map +1 -0
- package/dist/billing/billing.handler.d.ts +82 -0
- package/dist/billing/billing.handler.d.ts.map +1 -0
- package/dist/billing/billing.handler.js +58 -0
- package/dist/billing/billing.handler.js.map +1 -0
- package/dist/billing/billing.operations.d.ts +166 -0
- package/dist/billing/billing.operations.d.ts.map +1 -0
- package/dist/billing/billing.operations.js +181 -0
- package/dist/billing/billing.operations.js.map +1 -0
- package/dist/billing/billing.presentation.d.ts +14 -0
- package/dist/billing/billing.presentation.d.ts.map +1 -0
- package/dist/billing/billing.presentation.js +59 -0
- package/dist/billing/billing.presentation.js.map +1 -0
- package/dist/billing/billing.schema.d.ts +201 -0
- package/dist/billing/billing.schema.d.ts.map +1 -0
- package/dist/billing/billing.schema.js +214 -0
- package/dist/billing/billing.schema.js.map +1 -0
- package/dist/billing/index.d.ts +8 -0
- package/dist/billing/index.js +9 -0
- package/dist/dashboard/dashboard.presentation.d.ts +14 -0
- package/dist/dashboard/dashboard.presentation.d.ts.map +1 -0
- package/dist/dashboard/dashboard.presentation.js +55 -0
- package/dist/dashboard/dashboard.presentation.js.map +1 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.js +3 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/saas-boilerplate.docblock.d.ts +1 -0
- package/dist/docs/saas-boilerplate.docblock.js +100 -0
- package/dist/docs/saas-boilerplate.docblock.js.map +1 -0
- package/dist/example.d.ts +7 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +53 -0
- package/dist/example.js.map +1 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.js +5 -0
- package/dist/handlers/saas.handlers.d.ts +68 -0
- package/dist/handlers/saas.handlers.d.ts.map +1 -0
- package/dist/handlers/saas.handlers.js +148 -0
- package/dist/handlers/saas.handlers.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/presentations/index.d.ts +17 -0
- package/dist/presentations/index.d.ts.map +1 -0
- package/dist/presentations/index.js +17 -0
- package/dist/presentations/index.js.map +1 -0
- package/dist/project/index.d.ts +8 -0
- package/dist/project/index.js +9 -0
- package/dist/project/project.entity.d.ts +40 -0
- package/dist/project/project.entity.d.ts.map +1 -0
- package/dist/project/project.entity.js +85 -0
- package/dist/project/project.entity.js.map +1 -0
- package/dist/project/project.enum.d.ts +16 -0
- package/dist/project/project.enum.d.ts.map +1 -0
- package/dist/project/project.enum.js +26 -0
- package/dist/project/project.enum.js.map +1 -0
- package/dist/project/project.event.d.ts +92 -0
- package/dist/project/project.event.d.ts.map +1 -0
- package/dist/project/project.event.js +165 -0
- package/dist/project/project.event.js.map +1 -0
- package/dist/project/project.handler.d.ts +72 -0
- package/dist/project/project.handler.d.ts.map +1 -0
- package/dist/project/project.handler.js +82 -0
- package/dist/project/project.handler.js.map +1 -0
- package/dist/project/project.operations.d.ts +419 -0
- package/dist/project/project.operations.d.ts.map +1 -0
- package/dist/project/project.operations.js +260 -0
- package/dist/project/project.operations.js.map +1 -0
- package/dist/project/project.presentation.d.ts +14 -0
- package/dist/project/project.presentation.d.ts.map +1 -0
- package/dist/project/project.presentation.js +65 -0
- package/dist/project/project.presentation.js.map +1 -0
- package/dist/project/project.schema.d.ts +235 -0
- package/dist/project/project.schema.d.ts.map +1 -0
- package/dist/project/project.schema.js +215 -0
- package/dist/project/project.schema.js.map +1 -0
- package/dist/saas-boilerplate.feature.d.ts +12 -0
- package/dist/saas-boilerplate.feature.d.ts.map +1 -0
- package/dist/saas-boilerplate.feature.js +208 -0
- package/dist/saas-boilerplate.feature.js.map +1 -0
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +19 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/settings/index.d.ts +3 -0
- package/dist/settings/index.js +4 -0
- package/dist/settings/settings.entity.d.ts +37 -0
- package/dist/settings/settings.entity.d.ts.map +1 -0
- package/dist/settings/settings.entity.js +78 -0
- package/dist/settings/settings.entity.js.map +1 -0
- package/dist/settings/settings.enum.d.ts +10 -0
- package/dist/settings/settings.enum.d.ts.map +1 -0
- package/dist/settings/settings.enum.js +21 -0
- package/dist/settings/settings.enum.js.map +1 -0
- package/dist/shared/mock-data.d.ts +86 -0
- package/dist/shared/mock-data.d.ts.map +1 -0
- package/dist/shared/mock-data.js +138 -0
- package/dist/shared/mock-data.js.map +1 -0
- package/dist/shared/overlay-types.d.ts +34 -0
- package/dist/shared/overlay-types.d.ts.map +1 -0
- package/dist/shared/overlay-types.js +0 -0
- package/dist/tests/operations.test-spec.d.ts +10 -0
- package/dist/tests/operations.test-spec.d.ts.map +1 -0
- package/dist/tests/operations.test-spec.js +123 -0
- package/dist/tests/operations.test-spec.js.map +1 -0
- package/dist/ui/SaasDashboard.d.ts +7 -0
- package/dist/ui/SaasDashboard.d.ts.map +1 -0
- package/dist/ui/SaasDashboard.js +298 -0
- package/dist/ui/SaasDashboard.js.map +1 -0
- package/dist/ui/SaasProjectList.d.ts +14 -0
- package/dist/ui/SaasProjectList.d.ts.map +1 -0
- package/dist/ui/SaasProjectList.js +76 -0
- package/dist/ui/SaasProjectList.js.map +1 -0
- package/dist/ui/SaasSettingsPanel.d.ts +7 -0
- package/dist/ui/SaasSettingsPanel.d.ts.map +1 -0
- package/dist/ui/SaasSettingsPanel.js +138 -0
- package/dist/ui/SaasSettingsPanel.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +3 -0
- package/dist/ui/hooks/index.js +6 -0
- package/dist/ui/hooks/useProjectList.d.ts +34 -0
- package/dist/ui/hooks/useProjectList.d.ts.map +1 -0
- package/dist/ui/hooks/useProjectList.js +75 -0
- package/dist/ui/hooks/useProjectList.js.map +1 -0
- package/dist/ui/hooks/useProjectMutations.d.ts +28 -0
- package/dist/ui/hooks/useProjectMutations.d.ts.map +1 -0
- package/dist/ui/hooks/useProjectMutations.js +146 -0
- package/dist/ui/hooks/useProjectMutations.js.map +1 -0
- package/dist/ui/index.d.ts +14 -0
- package/dist/ui/index.js +15 -0
- package/dist/ui/modals/CreateProjectModal.d.ts +23 -0
- package/dist/ui/modals/CreateProjectModal.d.ts.map +1 -0
- package/dist/ui/modals/CreateProjectModal.js +139 -0
- package/dist/ui/modals/CreateProjectModal.js.map +1 -0
- package/dist/ui/modals/ProjectActionsModal.d.ts +38 -0
- package/dist/ui/modals/ProjectActionsModal.d.ts.map +1 -0
- package/dist/ui/modals/ProjectActionsModal.js +292 -0
- package/dist/ui/modals/ProjectActionsModal.js.map +1 -0
- package/dist/ui/modals/index.d.ts +3 -0
- package/dist/ui/modals/index.js +4 -0
- package/dist/ui/overlays/demo-overlays.d.ts +19 -0
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -0
- package/dist/ui/overlays/demo-overlays.js +70 -0
- package/dist/ui/overlays/demo-overlays.js.map +1 -0
- package/dist/ui/overlays/index.d.ts +2 -0
- package/dist/ui/overlays/index.js +3 -0
- package/dist/ui/renderers/index.d.ts +3 -0
- package/dist/ui/renderers/index.js +4 -0
- package/dist/ui/renderers/project-list.markdown.d.ts +31 -0
- package/dist/ui/renderers/project-list.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/project-list.markdown.js +148 -0
- package/dist/ui/renderers/project-list.markdown.js.map +1 -0
- package/dist/ui/renderers/project-list.renderer.d.ts +9 -0
- package/dist/ui/renderers/project-list.renderer.d.ts.map +1 -0
- package/dist/ui/renderers/project-list.renderer.js +17 -0
- package/dist/ui/renderers/project-list.renderer.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +135 -0
- package/src/billing/billing.entity.ts +158 -0
- package/src/billing/billing.enum.ts +23 -0
- package/src/billing/billing.event.ts +108 -0
- package/src/billing/billing.handler.ts +137 -0
- package/src/billing/billing.operations.ts +187 -0
- package/src/billing/billing.presentation.ts +56 -0
- package/src/billing/billing.schema.ts +133 -0
- package/src/billing/index.ts +64 -0
- package/src/dashboard/dashboard.presentation.ts +56 -0
- package/src/dashboard/index.ts +8 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/saas-boilerplate.docblock.ts +98 -0
- package/src/example.ts +38 -0
- package/src/handlers/index.ts +23 -0
- package/src/handlers/saas.handlers.ts +300 -0
- package/src/index.ts +76 -0
- package/src/presentations/index.ts +36 -0
- package/src/project/index.ts +66 -0
- package/src/project/project.entity.ts +93 -0
- package/src/project/project.enum.ts +22 -0
- package/src/project/project.event.ts +128 -0
- package/src/project/project.handler.ts +168 -0
- package/src/project/project.operations.ts +272 -0
- package/src/project/project.presentation.ts +58 -0
- package/src/project/project.schema.ts +147 -0
- package/src/saas-boilerplate.feature.ts +113 -0
- package/src/seeders/index.ts +28 -0
- package/src/settings/index.ts +9 -0
- package/src/settings/settings.entity.ts +89 -0
- package/src/settings/settings.enum.ts +11 -0
- package/src/shared/mock-data.ts +110 -0
- package/src/shared/overlay-types.ts +39 -0
- package/src/tests/operations.test-spec.ts +109 -0
- package/src/ui/SaasDashboard.tsx +325 -0
- package/src/ui/SaasProjectList.tsx +113 -0
- package/src/ui/SaasSettingsPanel.tsx +96 -0
- package/src/ui/hooks/index.ts +10 -0
- package/src/ui/hooks/useProjectList.ts +95 -0
- package/src/ui/hooks/useProjectMutations.ts +166 -0
- package/src/ui/index.ts +18 -0
- package/src/ui/modals/CreateProjectModal.tsx +176 -0
- package/src/ui/modals/ProjectActionsModal.tsx +346 -0
- package/src/ui/modals/index.ts +2 -0
- package/src/ui/overlays/demo-overlays.ts +74 -0
- package/src/ui/overlays/index.ts +1 -0
- package/src/ui/renderers/index.ts +7 -0
- package/src/ui/renderers/project-list.markdown.ts +239 -0
- package/src/ui/renderers/project-list.renderer.tsx +22 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +7 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts7 from "@contractspec/lib.contracts";
|
|
2
|
+
import * as _contractspec_lib_schema161 from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/project/project.operations.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Create a new project.
|
|
7
|
+
*/
|
|
8
|
+
declare const CreateProjectContract: _contractspec_lib_contracts7.OperationSpec<_contractspec_lib_schema161.SchemaModel<{
|
|
9
|
+
name: {
|
|
10
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
11
|
+
isOptional: false;
|
|
12
|
+
};
|
|
13
|
+
description: {
|
|
14
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
15
|
+
isOptional: true;
|
|
16
|
+
};
|
|
17
|
+
slug: {
|
|
18
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
19
|
+
isOptional: true;
|
|
20
|
+
};
|
|
21
|
+
isPublic: {
|
|
22
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
23
|
+
isOptional: true;
|
|
24
|
+
};
|
|
25
|
+
tags: {
|
|
26
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
27
|
+
isArray: true;
|
|
28
|
+
isOptional: true;
|
|
29
|
+
};
|
|
30
|
+
}>, _contractspec_lib_schema161.SchemaModel<{
|
|
31
|
+
id: {
|
|
32
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
33
|
+
isOptional: false;
|
|
34
|
+
};
|
|
35
|
+
name: {
|
|
36
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
37
|
+
isOptional: false;
|
|
38
|
+
};
|
|
39
|
+
description: {
|
|
40
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
41
|
+
isOptional: true;
|
|
42
|
+
};
|
|
43
|
+
slug: {
|
|
44
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
45
|
+
isOptional: true;
|
|
46
|
+
};
|
|
47
|
+
organizationId: {
|
|
48
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
49
|
+
isOptional: false;
|
|
50
|
+
};
|
|
51
|
+
createdBy: {
|
|
52
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
53
|
+
isOptional: false;
|
|
54
|
+
};
|
|
55
|
+
status: {
|
|
56
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
57
|
+
isOptional: false;
|
|
58
|
+
};
|
|
59
|
+
isPublic: {
|
|
60
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
61
|
+
isOptional: false;
|
|
62
|
+
};
|
|
63
|
+
tags: {
|
|
64
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
65
|
+
isArray: true;
|
|
66
|
+
isOptional: false;
|
|
67
|
+
};
|
|
68
|
+
createdAt: {
|
|
69
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
70
|
+
isOptional: false;
|
|
71
|
+
};
|
|
72
|
+
updatedAt: {
|
|
73
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
74
|
+
isOptional: false;
|
|
75
|
+
};
|
|
76
|
+
}>, {
|
|
77
|
+
key: string;
|
|
78
|
+
version: string;
|
|
79
|
+
when: string;
|
|
80
|
+
payload: _contractspec_lib_schema161.SchemaModel<{
|
|
81
|
+
id: {
|
|
82
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
83
|
+
isOptional: false;
|
|
84
|
+
};
|
|
85
|
+
name: {
|
|
86
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
87
|
+
isOptional: false;
|
|
88
|
+
};
|
|
89
|
+
description: {
|
|
90
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
91
|
+
isOptional: true;
|
|
92
|
+
};
|
|
93
|
+
slug: {
|
|
94
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
95
|
+
isOptional: true;
|
|
96
|
+
};
|
|
97
|
+
organizationId: {
|
|
98
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
99
|
+
isOptional: false;
|
|
100
|
+
};
|
|
101
|
+
createdBy: {
|
|
102
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
103
|
+
isOptional: false;
|
|
104
|
+
};
|
|
105
|
+
status: {
|
|
106
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
107
|
+
isOptional: false;
|
|
108
|
+
};
|
|
109
|
+
isPublic: {
|
|
110
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
111
|
+
isOptional: false;
|
|
112
|
+
};
|
|
113
|
+
tags: {
|
|
114
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
115
|
+
isArray: true;
|
|
116
|
+
isOptional: false;
|
|
117
|
+
};
|
|
118
|
+
createdAt: {
|
|
119
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
120
|
+
isOptional: false;
|
|
121
|
+
};
|
|
122
|
+
updatedAt: {
|
|
123
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
124
|
+
isOptional: false;
|
|
125
|
+
};
|
|
126
|
+
}>;
|
|
127
|
+
}[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Get project by ID.
|
|
130
|
+
*/
|
|
131
|
+
declare const GetProjectContract: _contractspec_lib_contracts7.OperationSpec<_contractspec_lib_schema161.SchemaModel<{
|
|
132
|
+
projectId: {
|
|
133
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
134
|
+
isOptional: false;
|
|
135
|
+
};
|
|
136
|
+
}>, _contractspec_lib_schema161.SchemaModel<{
|
|
137
|
+
id: {
|
|
138
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
139
|
+
isOptional: false;
|
|
140
|
+
};
|
|
141
|
+
name: {
|
|
142
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
143
|
+
isOptional: false;
|
|
144
|
+
};
|
|
145
|
+
description: {
|
|
146
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
147
|
+
isOptional: true;
|
|
148
|
+
};
|
|
149
|
+
slug: {
|
|
150
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
151
|
+
isOptional: true;
|
|
152
|
+
};
|
|
153
|
+
organizationId: {
|
|
154
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
155
|
+
isOptional: false;
|
|
156
|
+
};
|
|
157
|
+
createdBy: {
|
|
158
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
159
|
+
isOptional: false;
|
|
160
|
+
};
|
|
161
|
+
status: {
|
|
162
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
163
|
+
isOptional: false;
|
|
164
|
+
};
|
|
165
|
+
isPublic: {
|
|
166
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
167
|
+
isOptional: false;
|
|
168
|
+
};
|
|
169
|
+
tags: {
|
|
170
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
171
|
+
isArray: true;
|
|
172
|
+
isOptional: false;
|
|
173
|
+
};
|
|
174
|
+
createdAt: {
|
|
175
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
176
|
+
isOptional: false;
|
|
177
|
+
};
|
|
178
|
+
updatedAt: {
|
|
179
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
180
|
+
isOptional: false;
|
|
181
|
+
};
|
|
182
|
+
}>, undefined>;
|
|
183
|
+
/**
|
|
184
|
+
* Update a project.
|
|
185
|
+
*/
|
|
186
|
+
declare const UpdateProjectContract: _contractspec_lib_contracts7.OperationSpec<_contractspec_lib_schema161.SchemaModel<{
|
|
187
|
+
projectId: {
|
|
188
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
189
|
+
isOptional: false;
|
|
190
|
+
};
|
|
191
|
+
name: {
|
|
192
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
193
|
+
isOptional: true;
|
|
194
|
+
};
|
|
195
|
+
description: {
|
|
196
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
197
|
+
isOptional: true;
|
|
198
|
+
};
|
|
199
|
+
slug: {
|
|
200
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
201
|
+
isOptional: true;
|
|
202
|
+
};
|
|
203
|
+
isPublic: {
|
|
204
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
205
|
+
isOptional: true;
|
|
206
|
+
};
|
|
207
|
+
tags: {
|
|
208
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
209
|
+
isArray: true;
|
|
210
|
+
isOptional: true;
|
|
211
|
+
};
|
|
212
|
+
status: {
|
|
213
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
214
|
+
isOptional: true;
|
|
215
|
+
};
|
|
216
|
+
}>, _contractspec_lib_schema161.SchemaModel<{
|
|
217
|
+
id: {
|
|
218
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
219
|
+
isOptional: false;
|
|
220
|
+
};
|
|
221
|
+
name: {
|
|
222
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
223
|
+
isOptional: false;
|
|
224
|
+
};
|
|
225
|
+
description: {
|
|
226
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
227
|
+
isOptional: true;
|
|
228
|
+
};
|
|
229
|
+
slug: {
|
|
230
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
231
|
+
isOptional: true;
|
|
232
|
+
};
|
|
233
|
+
organizationId: {
|
|
234
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
235
|
+
isOptional: false;
|
|
236
|
+
};
|
|
237
|
+
createdBy: {
|
|
238
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
239
|
+
isOptional: false;
|
|
240
|
+
};
|
|
241
|
+
status: {
|
|
242
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
243
|
+
isOptional: false;
|
|
244
|
+
};
|
|
245
|
+
isPublic: {
|
|
246
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
247
|
+
isOptional: false;
|
|
248
|
+
};
|
|
249
|
+
tags: {
|
|
250
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
251
|
+
isArray: true;
|
|
252
|
+
isOptional: false;
|
|
253
|
+
};
|
|
254
|
+
createdAt: {
|
|
255
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
256
|
+
isOptional: false;
|
|
257
|
+
};
|
|
258
|
+
updatedAt: {
|
|
259
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
260
|
+
isOptional: false;
|
|
261
|
+
};
|
|
262
|
+
}>, {
|
|
263
|
+
key: string;
|
|
264
|
+
version: string;
|
|
265
|
+
when: string;
|
|
266
|
+
payload: _contractspec_lib_schema161.SchemaModel<{
|
|
267
|
+
id: {
|
|
268
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
269
|
+
isOptional: false;
|
|
270
|
+
};
|
|
271
|
+
name: {
|
|
272
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
273
|
+
isOptional: false;
|
|
274
|
+
};
|
|
275
|
+
description: {
|
|
276
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
277
|
+
isOptional: true;
|
|
278
|
+
};
|
|
279
|
+
slug: {
|
|
280
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
281
|
+
isOptional: true;
|
|
282
|
+
};
|
|
283
|
+
organizationId: {
|
|
284
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
285
|
+
isOptional: false;
|
|
286
|
+
};
|
|
287
|
+
createdBy: {
|
|
288
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
289
|
+
isOptional: false;
|
|
290
|
+
};
|
|
291
|
+
status: {
|
|
292
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
293
|
+
isOptional: false;
|
|
294
|
+
};
|
|
295
|
+
isPublic: {
|
|
296
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
297
|
+
isOptional: false;
|
|
298
|
+
};
|
|
299
|
+
tags: {
|
|
300
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
301
|
+
isArray: true;
|
|
302
|
+
isOptional: false;
|
|
303
|
+
};
|
|
304
|
+
createdAt: {
|
|
305
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
306
|
+
isOptional: false;
|
|
307
|
+
};
|
|
308
|
+
updatedAt: {
|
|
309
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
310
|
+
isOptional: false;
|
|
311
|
+
};
|
|
312
|
+
}>;
|
|
313
|
+
}[]>;
|
|
314
|
+
/**
|
|
315
|
+
* Delete a project.
|
|
316
|
+
*/
|
|
317
|
+
declare const DeleteProjectContract: _contractspec_lib_contracts7.OperationSpec<_contractspec_lib_schema161.SchemaModel<{
|
|
318
|
+
projectId: {
|
|
319
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
320
|
+
isOptional: false;
|
|
321
|
+
};
|
|
322
|
+
}>, _contractspec_lib_schema161.SchemaModel<{
|
|
323
|
+
success: {
|
|
324
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
325
|
+
isOptional: false;
|
|
326
|
+
};
|
|
327
|
+
}>, {
|
|
328
|
+
key: string;
|
|
329
|
+
version: string;
|
|
330
|
+
when: string;
|
|
331
|
+
payload: _contractspec_lib_schema161.SchemaModel<{
|
|
332
|
+
projectId: {
|
|
333
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
334
|
+
isOptional: false;
|
|
335
|
+
};
|
|
336
|
+
}>;
|
|
337
|
+
}[]>;
|
|
338
|
+
/**
|
|
339
|
+
* List organization projects.
|
|
340
|
+
*/
|
|
341
|
+
declare const ListProjectsContract: _contractspec_lib_contracts7.OperationSpec<_contractspec_lib_schema161.SchemaModel<{
|
|
342
|
+
status: {
|
|
343
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
344
|
+
isOptional: true;
|
|
345
|
+
};
|
|
346
|
+
search: {
|
|
347
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
348
|
+
isOptional: true;
|
|
349
|
+
};
|
|
350
|
+
limit: {
|
|
351
|
+
type: _contractspec_lib_schema161.FieldType<number, number>;
|
|
352
|
+
isOptional: true;
|
|
353
|
+
defaultValue: number;
|
|
354
|
+
};
|
|
355
|
+
offset: {
|
|
356
|
+
type: _contractspec_lib_schema161.FieldType<number, number>;
|
|
357
|
+
isOptional: true;
|
|
358
|
+
defaultValue: number;
|
|
359
|
+
};
|
|
360
|
+
}>, _contractspec_lib_schema161.SchemaModel<{
|
|
361
|
+
projects: {
|
|
362
|
+
type: _contractspec_lib_schema161.SchemaModel<{
|
|
363
|
+
id: {
|
|
364
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
365
|
+
isOptional: false;
|
|
366
|
+
};
|
|
367
|
+
name: {
|
|
368
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
369
|
+
isOptional: false;
|
|
370
|
+
};
|
|
371
|
+
description: {
|
|
372
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
373
|
+
isOptional: true;
|
|
374
|
+
};
|
|
375
|
+
slug: {
|
|
376
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
377
|
+
isOptional: true;
|
|
378
|
+
};
|
|
379
|
+
organizationId: {
|
|
380
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
381
|
+
isOptional: false;
|
|
382
|
+
};
|
|
383
|
+
createdBy: {
|
|
384
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
385
|
+
isOptional: false;
|
|
386
|
+
};
|
|
387
|
+
status: {
|
|
388
|
+
type: _contractspec_lib_schema161.EnumType<[string, string, string, string]>;
|
|
389
|
+
isOptional: false;
|
|
390
|
+
};
|
|
391
|
+
isPublic: {
|
|
392
|
+
type: _contractspec_lib_schema161.FieldType<boolean, boolean>;
|
|
393
|
+
isOptional: false;
|
|
394
|
+
};
|
|
395
|
+
tags: {
|
|
396
|
+
type: _contractspec_lib_schema161.FieldType<string, string>;
|
|
397
|
+
isArray: true;
|
|
398
|
+
isOptional: false;
|
|
399
|
+
};
|
|
400
|
+
createdAt: {
|
|
401
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
402
|
+
isOptional: false;
|
|
403
|
+
};
|
|
404
|
+
updatedAt: {
|
|
405
|
+
type: _contractspec_lib_schema161.FieldType<Date, string>;
|
|
406
|
+
isOptional: false;
|
|
407
|
+
};
|
|
408
|
+
}>;
|
|
409
|
+
isArray: true;
|
|
410
|
+
isOptional: false;
|
|
411
|
+
};
|
|
412
|
+
total: {
|
|
413
|
+
type: _contractspec_lib_schema161.FieldType<number, number>;
|
|
414
|
+
isOptional: false;
|
|
415
|
+
};
|
|
416
|
+
}>, undefined>;
|
|
417
|
+
//#endregion
|
|
418
|
+
export { CreateProjectContract, DeleteProjectContract, GetProjectContract, ListProjectsContract, UpdateProjectContract };
|
|
419
|
+
//# sourceMappingURL=project.operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.operations.d.ts","names":[],"sources":["../../src/project/project.operations.ts"],"sourcesContent":[],"mappings":";;;;;;;cAqBa,oDAAqB,0CAAA;EAArB,IAAA,EAAA;IA4DX,IAAA,EAAA,2BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;EA5DgC,CAAA;;;;;;;;;;;;;;;;UAAA,2BAAA,CAAA;;;;;;;;;;;;+CAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;EAiErB,CAAA;EA2CX,cAAA,EAAA;+CA3C6B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;;IAAA,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAgDlB,OAAA,EAAA,IAAA;IA8CX,UAAA,EAAA,KAAA;;;;;;;+CA9CgC,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAAA,CAAA,MAAA,EAAA,MAAA,CAAA;MAAA,UAAA,EAAA,KAAA;IAmDrB,CAAA;IA8CX,MAAA,EAAA;gDA9CgC,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;MAAA,UAAA,EAAA,KAAA;;;;;IAAA,CAAA;IAmDrB,IAAA,EAAA;MAmCX,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;MAnC+B,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;cAtJpB,iDAAkB,0CAAA;;UA2C7B,2BAAA,CAAA;;;CA2G+B,CAAA,yCAAA,CAAA;;UAtJF,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgDlB,oDAAqB,0CAAA;;UA8ChC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA9CgC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDrB,oDAAqB,0CAAA;;UA8ChC,2BAAA,CAAA;;;;;UA9CgC,2BAAA,CAAA;;;;;;;;;;;;;;;;;cAmDrB,mDAAoB,0CAAA;;UAmC/B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;cAnC+B,2BAAA,CAAA"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { CreateProjectInputModel, DeleteProjectInputModel, DeleteProjectOutputModel, GetProjectInputModel, ListProjectsInputModel, ListProjectsOutputModel, ProjectDeletedPayloadModel, ProjectModel, UpdateProjectInputModel } from "./project.schema.js";
|
|
2
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts/operations";
|
|
3
|
+
|
|
4
|
+
//#region src/project/project.operations.ts
|
|
5
|
+
const OWNERS = ["example.saas-boilerplate"];
|
|
6
|
+
/**
|
|
7
|
+
* Create a new project.
|
|
8
|
+
*/
|
|
9
|
+
const CreateProjectContract = defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "saas.project.create",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
stability: "stable",
|
|
14
|
+
owners: [...OWNERS],
|
|
15
|
+
tags: [
|
|
16
|
+
"saas",
|
|
17
|
+
"project",
|
|
18
|
+
"create"
|
|
19
|
+
],
|
|
20
|
+
description: "Create a new project in the organization.",
|
|
21
|
+
goal: "Allow users to create projects for organizing work.",
|
|
22
|
+
context: "Called from project creation UI or API."
|
|
23
|
+
},
|
|
24
|
+
io: {
|
|
25
|
+
input: CreateProjectInputModel,
|
|
26
|
+
output: ProjectModel,
|
|
27
|
+
errors: {
|
|
28
|
+
SLUG_EXISTS: {
|
|
29
|
+
description: "A project with this slug already exists",
|
|
30
|
+
http: 409,
|
|
31
|
+
gqlCode: "SLUG_EXISTS",
|
|
32
|
+
when: "Slug is already taken in the organization"
|
|
33
|
+
},
|
|
34
|
+
LIMIT_REACHED: {
|
|
35
|
+
description: "Project limit reached for this plan",
|
|
36
|
+
http: 403,
|
|
37
|
+
gqlCode: "LIMIT_REACHED",
|
|
38
|
+
when: "Organization has reached project limit"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
policy: { auth: "user" },
|
|
43
|
+
sideEffects: {
|
|
44
|
+
emits: [{
|
|
45
|
+
key: "project.created",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
when: "Project is created",
|
|
48
|
+
payload: ProjectModel
|
|
49
|
+
}],
|
|
50
|
+
audit: ["project.created"]
|
|
51
|
+
},
|
|
52
|
+
acceptance: {
|
|
53
|
+
scenarios: [{
|
|
54
|
+
key: "create-project-happy-path",
|
|
55
|
+
given: ["User is authenticated"],
|
|
56
|
+
when: ["User creates project"],
|
|
57
|
+
then: ["Project is created", "ProjectCreated event is emitted"]
|
|
58
|
+
}],
|
|
59
|
+
examples: [{
|
|
60
|
+
key: "create-basic",
|
|
61
|
+
input: {
|
|
62
|
+
name: "Website Redesign",
|
|
63
|
+
slug: "website-redesign"
|
|
64
|
+
},
|
|
65
|
+
output: {
|
|
66
|
+
id: "proj-123",
|
|
67
|
+
name: "Website Redesign",
|
|
68
|
+
isArchived: false
|
|
69
|
+
}
|
|
70
|
+
}]
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Get project by ID.
|
|
75
|
+
*/
|
|
76
|
+
const GetProjectContract = defineQuery({
|
|
77
|
+
meta: {
|
|
78
|
+
key: "saas.project.get",
|
|
79
|
+
version: "1.0.0",
|
|
80
|
+
stability: "stable",
|
|
81
|
+
owners: [...OWNERS],
|
|
82
|
+
tags: [
|
|
83
|
+
"saas",
|
|
84
|
+
"project",
|
|
85
|
+
"get"
|
|
86
|
+
],
|
|
87
|
+
description: "Get a project by ID.",
|
|
88
|
+
goal: "Retrieve project details.",
|
|
89
|
+
context: "Project detail page, API calls."
|
|
90
|
+
},
|
|
91
|
+
io: {
|
|
92
|
+
input: GetProjectInputModel,
|
|
93
|
+
output: ProjectModel,
|
|
94
|
+
errors: { NOT_FOUND: {
|
|
95
|
+
description: "Project not found",
|
|
96
|
+
http: 404,
|
|
97
|
+
gqlCode: "NOT_FOUND",
|
|
98
|
+
when: "Project ID is invalid or user lacks access"
|
|
99
|
+
} }
|
|
100
|
+
},
|
|
101
|
+
policy: { auth: "user" },
|
|
102
|
+
acceptance: {
|
|
103
|
+
scenarios: [{
|
|
104
|
+
key: "get-project-happy-path",
|
|
105
|
+
given: ["Project exists"],
|
|
106
|
+
when: ["User requests project"],
|
|
107
|
+
then: ["Project details are returned"]
|
|
108
|
+
}],
|
|
109
|
+
examples: [{
|
|
110
|
+
key: "get-existing",
|
|
111
|
+
input: { projectId: "proj-123" },
|
|
112
|
+
output: {
|
|
113
|
+
id: "proj-123",
|
|
114
|
+
name: "Website Redesign"
|
|
115
|
+
}
|
|
116
|
+
}]
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Update a project.
|
|
121
|
+
*/
|
|
122
|
+
const UpdateProjectContract = defineCommand({
|
|
123
|
+
meta: {
|
|
124
|
+
key: "saas.project.update",
|
|
125
|
+
version: "1.0.0",
|
|
126
|
+
stability: "stable",
|
|
127
|
+
owners: [...OWNERS],
|
|
128
|
+
tags: [
|
|
129
|
+
"saas",
|
|
130
|
+
"project",
|
|
131
|
+
"update"
|
|
132
|
+
],
|
|
133
|
+
description: "Update project details.",
|
|
134
|
+
goal: "Allow project owners/editors to modify project.",
|
|
135
|
+
context: "Project settings page."
|
|
136
|
+
},
|
|
137
|
+
io: {
|
|
138
|
+
input: UpdateProjectInputModel,
|
|
139
|
+
output: ProjectModel
|
|
140
|
+
},
|
|
141
|
+
policy: { auth: "user" },
|
|
142
|
+
sideEffects: {
|
|
143
|
+
emits: [{
|
|
144
|
+
key: "project.updated",
|
|
145
|
+
version: "1.0.0",
|
|
146
|
+
when: "Project is updated",
|
|
147
|
+
payload: ProjectModel
|
|
148
|
+
}],
|
|
149
|
+
audit: ["project.updated"]
|
|
150
|
+
},
|
|
151
|
+
acceptance: {
|
|
152
|
+
scenarios: [{
|
|
153
|
+
key: "update-project-happy-path",
|
|
154
|
+
given: ["Project exists"],
|
|
155
|
+
when: ["User updates description"],
|
|
156
|
+
then: ["Project is updated", "ProjectUpdated event is emitted"]
|
|
157
|
+
}],
|
|
158
|
+
examples: [{
|
|
159
|
+
key: "update-desc",
|
|
160
|
+
input: {
|
|
161
|
+
projectId: "proj-123",
|
|
162
|
+
description: "New description"
|
|
163
|
+
},
|
|
164
|
+
output: {
|
|
165
|
+
id: "proj-123",
|
|
166
|
+
description: "New description"
|
|
167
|
+
}
|
|
168
|
+
}]
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
172
|
+
* Delete a project.
|
|
173
|
+
*/
|
|
174
|
+
const DeleteProjectContract = defineCommand({
|
|
175
|
+
meta: {
|
|
176
|
+
key: "saas.project.delete",
|
|
177
|
+
version: "1.0.0",
|
|
178
|
+
stability: "stable",
|
|
179
|
+
owners: [...OWNERS],
|
|
180
|
+
tags: [
|
|
181
|
+
"saas",
|
|
182
|
+
"project",
|
|
183
|
+
"delete"
|
|
184
|
+
],
|
|
185
|
+
description: "Delete a project (soft delete).",
|
|
186
|
+
goal: "Allow project owners to remove projects.",
|
|
187
|
+
context: "Project settings page."
|
|
188
|
+
},
|
|
189
|
+
io: {
|
|
190
|
+
input: DeleteProjectInputModel,
|
|
191
|
+
output: DeleteProjectOutputModel
|
|
192
|
+
},
|
|
193
|
+
policy: { auth: "user" },
|
|
194
|
+
sideEffects: {
|
|
195
|
+
emits: [{
|
|
196
|
+
key: "project.deleted",
|
|
197
|
+
version: "1.0.0",
|
|
198
|
+
when: "Project is deleted",
|
|
199
|
+
payload: ProjectDeletedPayloadModel
|
|
200
|
+
}],
|
|
201
|
+
audit: ["project.deleted"]
|
|
202
|
+
},
|
|
203
|
+
acceptance: {
|
|
204
|
+
scenarios: [{
|
|
205
|
+
key: "delete-project-happy-path",
|
|
206
|
+
given: ["Project exists"],
|
|
207
|
+
when: ["User deletes project"],
|
|
208
|
+
then: ["Project is deleted", "ProjectDeleted event is emitted"]
|
|
209
|
+
}],
|
|
210
|
+
examples: [{
|
|
211
|
+
key: "delete-existing",
|
|
212
|
+
input: { projectId: "proj-123" },
|
|
213
|
+
output: { success: true }
|
|
214
|
+
}]
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
/**
|
|
218
|
+
* List organization projects.
|
|
219
|
+
*/
|
|
220
|
+
const ListProjectsContract = defineQuery({
|
|
221
|
+
meta: {
|
|
222
|
+
key: "saas.project.list",
|
|
223
|
+
version: "1.0.0",
|
|
224
|
+
stability: "stable",
|
|
225
|
+
owners: [...OWNERS],
|
|
226
|
+
tags: [
|
|
227
|
+
"saas",
|
|
228
|
+
"project",
|
|
229
|
+
"list"
|
|
230
|
+
],
|
|
231
|
+
description: "List projects in the organization.",
|
|
232
|
+
goal: "Show all projects user has access to.",
|
|
233
|
+
context: "Project list page, dashboard."
|
|
234
|
+
},
|
|
235
|
+
io: {
|
|
236
|
+
input: ListProjectsInputModel,
|
|
237
|
+
output: ListProjectsOutputModel
|
|
238
|
+
},
|
|
239
|
+
policy: { auth: "user" },
|
|
240
|
+
acceptance: {
|
|
241
|
+
scenarios: [{
|
|
242
|
+
key: "list-projects-happy-path",
|
|
243
|
+
given: ["Projects exist"],
|
|
244
|
+
when: ["User lists projects"],
|
|
245
|
+
then: ["List of projects is returned"]
|
|
246
|
+
}],
|
|
247
|
+
examples: [{
|
|
248
|
+
key: "list-all",
|
|
249
|
+
input: { limit: 10 },
|
|
250
|
+
output: {
|
|
251
|
+
items: [],
|
|
252
|
+
total: 5
|
|
253
|
+
}
|
|
254
|
+
}]
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
259
|
+
export { CreateProjectContract, DeleteProjectContract, GetProjectContract, ListProjectsContract, UpdateProjectContract };
|
|
260
|
+
//# sourceMappingURL=project.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.operations.js","names":[],"sources":["../../src/project/project.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport {\n CreateProjectInputModel,\n DeleteProjectInputModel,\n DeleteProjectOutputModel,\n GetProjectInputModel,\n ListProjectsInputModel,\n ListProjectsOutputModel,\n ProjectDeletedPayloadModel,\n ProjectModel,\n UpdateProjectInputModel,\n} from './project.schema';\n\nconst OWNERS = ['example.saas-boilerplate'] as const;\n\n/**\n * Create a new project.\n */\nexport const CreateProjectContract = defineCommand({\n meta: {\n key: 'saas.project.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'project', 'create'],\n description: 'Create a new project in the organization.',\n goal: 'Allow users to create projects for organizing work.',\n context: 'Called from project creation UI or API.',\n },\n io: {\n input: CreateProjectInputModel,\n output: ProjectModel,\n errors: {\n SLUG_EXISTS: {\n description: 'A project with this slug already exists',\n http: 409,\n gqlCode: 'SLUG_EXISTS',\n when: 'Slug is already taken in the organization',\n },\n LIMIT_REACHED: {\n description: 'Project limit reached for this plan',\n http: 403,\n gqlCode: 'LIMIT_REACHED',\n when: 'Organization has reached project limit',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'project.created',\n version: '1.0.0',\n when: 'Project is created',\n payload: ProjectModel,\n },\n ],\n audit: ['project.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-project-happy-path',\n given: ['User is authenticated'],\n when: ['User creates project'],\n then: ['Project is created', 'ProjectCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-basic',\n input: { name: 'Website Redesign', slug: 'website-redesign' },\n output: { id: 'proj-123', name: 'Website Redesign', isArchived: false },\n },\n ],\n },\n});\n\n/**\n * Get project by ID.\n */\nexport const GetProjectContract = defineQuery({\n meta: {\n key: 'saas.project.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'project', 'get'],\n description: 'Get a project by ID.',\n goal: 'Retrieve project details.',\n context: 'Project detail page, API calls.',\n },\n io: {\n input: GetProjectInputModel,\n output: ProjectModel,\n errors: {\n NOT_FOUND: {\n description: 'Project not found',\n http: 404,\n gqlCode: 'NOT_FOUND',\n when: 'Project ID is invalid or user lacks access',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n acceptance: {\n scenarios: [\n {\n key: 'get-project-happy-path',\n given: ['Project exists'],\n when: ['User requests project'],\n then: ['Project details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-existing',\n input: { projectId: 'proj-123' },\n output: { id: 'proj-123', name: 'Website Redesign' },\n },\n ],\n },\n});\n\n/**\n * Update a project.\n */\nexport const UpdateProjectContract = defineCommand({\n meta: {\n key: 'saas.project.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'project', 'update'],\n description: 'Update project details.',\n goal: 'Allow project owners/editors to modify project.',\n context: 'Project settings page.',\n },\n io: {\n input: UpdateProjectInputModel,\n output: ProjectModel,\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'project.updated',\n version: '1.0.0',\n when: 'Project is updated',\n payload: ProjectModel,\n },\n ],\n audit: ['project.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-project-happy-path',\n given: ['Project exists'],\n when: ['User updates description'],\n then: ['Project is updated', 'ProjectUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'update-desc',\n input: { projectId: 'proj-123', description: 'New description' },\n output: { id: 'proj-123', description: 'New description' },\n },\n ],\n },\n});\n\n/**\n * Delete a project.\n */\nexport const DeleteProjectContract = defineCommand({\n meta: {\n key: 'saas.project.delete',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'project', 'delete'],\n description: 'Delete a project (soft delete).',\n goal: 'Allow project owners to remove projects.',\n context: 'Project settings page.',\n },\n io: {\n input: DeleteProjectInputModel,\n output: DeleteProjectOutputModel,\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'project.deleted',\n version: '1.0.0',\n when: 'Project is deleted',\n payload: ProjectDeletedPayloadModel,\n },\n ],\n audit: ['project.deleted'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'delete-project-happy-path',\n given: ['Project exists'],\n when: ['User deletes project'],\n then: ['Project is deleted', 'ProjectDeleted event is emitted'],\n },\n ],\n examples: [\n {\n key: 'delete-existing',\n input: { projectId: 'proj-123' },\n output: { success: true },\n },\n ],\n },\n});\n\n/**\n * List organization projects.\n */\nexport const ListProjectsContract = defineQuery({\n meta: {\n key: 'saas.project.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'project', 'list'],\n description: 'List projects in the organization.',\n goal: 'Show all projects user has access to.',\n context: 'Project list page, dashboard.',\n },\n io: {\n input: ListProjectsInputModel,\n output: ListProjectsOutputModel,\n },\n policy: {\n auth: 'user',\n },\n acceptance: {\n scenarios: [\n {\n key: 'list-projects-happy-path',\n given: ['Projects exist'],\n when: ['User lists projects'],\n then: ['List of projects is returned'],\n },\n ],\n examples: [\n {\n key: 'list-all',\n input: { limit: 10 },\n output: { items: [], total: 5 },\n },\n ],\n },\n});\n"],"mappings":"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"}
|