@contractspec/example.saas-boilerplate 1.57.0 → 1.59.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 (283) hide show
  1. package/.turbo/turbo-build.log +160 -180
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +39 -0
  4. package/dist/billing/billing.entity.d.ts +40 -45
  5. package/dist/billing/billing.entity.d.ts.map +1 -1
  6. package/dist/billing/billing.entity.js +110 -118
  7. package/dist/billing/billing.enum.d.ts +2 -7
  8. package/dist/billing/billing.enum.d.ts.map +1 -1
  9. package/dist/billing/billing.enum.js +17 -24
  10. package/dist/billing/billing.event.d.ts +67 -73
  11. package/dist/billing/billing.event.d.ts.map +1 -1
  12. package/dist/billing/billing.event.js +84 -146
  13. package/dist/billing/billing.handler.d.ts +59 -62
  14. package/dist/billing/billing.handler.d.ts.map +1 -1
  15. package/dist/billing/billing.handler.js +140 -49
  16. package/dist/billing/billing.operations.d.ts +138 -144
  17. package/dist/billing/billing.operations.d.ts.map +1 -1
  18. package/dist/billing/billing.operations.js +273 -175
  19. package/dist/billing/billing.presentation.d.ts +2 -7
  20. package/dist/billing/billing.presentation.d.ts.map +1 -1
  21. package/dist/billing/billing.presentation.js +51 -57
  22. package/dist/billing/billing.schema.d.ts +159 -164
  23. package/dist/billing/billing.schema.d.ts.map +1 -1
  24. package/dist/billing/billing.schema.js +112 -204
  25. package/dist/billing/index.d.ts +11 -8
  26. package/dist/billing/index.d.ts.map +1 -0
  27. package/dist/billing/index.js +689 -9
  28. package/dist/browser/billing/billing.entity.js +113 -0
  29. package/dist/browser/billing/billing.enum.js +19 -0
  30. package/dist/browser/billing/billing.event.js +90 -0
  31. package/dist/browser/billing/billing.handler.js +148 -0
  32. package/dist/browser/billing/billing.operations.js +278 -0
  33. package/dist/browser/billing/billing.presentation.js +52 -0
  34. package/dist/browser/billing/billing.schema.js +121 -0
  35. package/dist/browser/billing/index.js +688 -0
  36. package/dist/browser/dashboard/dashboard.presentation.js +52 -0
  37. package/dist/browser/dashboard/index.js +52 -0
  38. package/dist/browser/docs/index.js +93 -0
  39. package/dist/browser/docs/saas-boilerplate.docblock.js +93 -0
  40. package/dist/browser/example.js +39 -0
  41. package/dist/browser/handlers/index.js +358 -0
  42. package/dist/browser/handlers/saas.handlers.js +134 -0
  43. package/dist/browser/index.js +3340 -0
  44. package/dist/browser/presentations/index.js +290 -0
  45. package/dist/browser/project/index.js +790 -0
  46. package/dist/browser/project/project.entity.js +77 -0
  47. package/dist/browser/project/project.enum.js +18 -0
  48. package/dist/browser/project/project.event.js +103 -0
  49. package/dist/browser/project/project.handler.js +178 -0
  50. package/dist/browser/project/project.operations.js +372 -0
  51. package/dist/browser/project/project.presentation.js +177 -0
  52. package/dist/browser/project/project.schema.js +134 -0
  53. package/dist/browser/saas-boilerplate.feature.js +88 -0
  54. package/dist/browser/seeders/index.js +20 -0
  55. package/dist/browser/settings/index.js +75 -0
  56. package/dist/browser/settings/settings.entity.js +74 -0
  57. package/dist/browser/settings/settings.enum.js +11 -0
  58. package/dist/browser/shared/mock-data.js +104 -0
  59. package/dist/browser/shared/overlay-types.js +0 -0
  60. package/dist/browser/tests/operations.test-spec.js +112 -0
  61. package/dist/browser/ui/SaasDashboard.js +988 -0
  62. package/dist/browser/ui/SaasProjectList.js +162 -0
  63. package/dist/browser/ui/SaasSettingsPanel.js +145 -0
  64. package/dist/browser/ui/hooks/index.js +159 -0
  65. package/dist/browser/ui/hooks/useProjectList.js +66 -0
  66. package/dist/browser/ui/hooks/useProjectMutations.js +91 -0
  67. package/dist/browser/ui/index.js +1808 -0
  68. package/dist/browser/ui/modals/CreateProjectModal.js +153 -0
  69. package/dist/browser/ui/modals/ProjectActionsModal.js +335 -0
  70. package/dist/browser/ui/modals/index.js +487 -0
  71. package/dist/browser/ui/overlays/demo-overlays.js +61 -0
  72. package/dist/browser/ui/overlays/index.js +61 -0
  73. package/dist/browser/ui/renderers/index.js +675 -0
  74. package/dist/browser/ui/renderers/project-list.markdown.js +499 -0
  75. package/dist/browser/ui/renderers/project-list.renderer.js +177 -0
  76. package/dist/dashboard/dashboard.presentation.d.ts +2 -7
  77. package/dist/dashboard/dashboard.presentation.d.ts.map +1 -1
  78. package/dist/dashboard/dashboard.presentation.js +51 -53
  79. package/dist/dashboard/index.d.ts +5 -2
  80. package/dist/dashboard/index.d.ts.map +1 -0
  81. package/dist/dashboard/index.js +53 -3
  82. package/dist/docs/index.d.ts +2 -1
  83. package/dist/docs/index.d.ts.map +1 -0
  84. package/dist/docs/index.js +94 -1
  85. package/dist/docs/saas-boilerplate.docblock.d.ts +2 -1
  86. package/dist/docs/saas-boilerplate.docblock.d.ts.map +1 -0
  87. package/dist/docs/saas-boilerplate.docblock.js +45 -51
  88. package/dist/example.d.ts +2 -6
  89. package/dist/example.d.ts.map +1 -1
  90. package/dist/example.js +38 -50
  91. package/dist/handlers/index.d.ts +7 -4
  92. package/dist/handlers/index.d.ts.map +1 -0
  93. package/dist/handlers/index.js +358 -4
  94. package/dist/handlers/saas.handlers.d.ts +60 -59
  95. package/dist/handlers/saas.handlers.d.ts.map +1 -1
  96. package/dist/handlers/saas.handlers.js +127 -140
  97. package/dist/index.d.ts +15 -45
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +3335 -75
  100. package/dist/node/billing/billing.entity.js +113 -0
  101. package/dist/node/billing/billing.enum.js +19 -0
  102. package/dist/node/billing/billing.event.js +90 -0
  103. package/dist/node/billing/billing.handler.js +148 -0
  104. package/dist/node/billing/billing.operations.js +278 -0
  105. package/dist/node/billing/billing.presentation.js +52 -0
  106. package/dist/node/billing/billing.schema.js +121 -0
  107. package/dist/node/billing/index.js +688 -0
  108. package/dist/node/dashboard/dashboard.presentation.js +52 -0
  109. package/dist/node/dashboard/index.js +52 -0
  110. package/dist/node/docs/index.js +93 -0
  111. package/dist/node/docs/saas-boilerplate.docblock.js +93 -0
  112. package/dist/node/example.js +39 -0
  113. package/dist/node/handlers/index.js +358 -0
  114. package/dist/node/handlers/saas.handlers.js +134 -0
  115. package/dist/node/index.js +3340 -0
  116. package/dist/node/presentations/index.js +290 -0
  117. package/dist/node/project/index.js +790 -0
  118. package/dist/node/project/project.entity.js +77 -0
  119. package/dist/node/project/project.enum.js +18 -0
  120. package/dist/node/project/project.event.js +103 -0
  121. package/dist/node/project/project.handler.js +178 -0
  122. package/dist/node/project/project.operations.js +372 -0
  123. package/dist/node/project/project.presentation.js +177 -0
  124. package/dist/node/project/project.schema.js +134 -0
  125. package/dist/node/saas-boilerplate.feature.js +88 -0
  126. package/dist/node/seeders/index.js +20 -0
  127. package/dist/node/settings/index.js +75 -0
  128. package/dist/node/settings/settings.entity.js +74 -0
  129. package/dist/node/settings/settings.enum.js +11 -0
  130. package/dist/node/shared/mock-data.js +104 -0
  131. package/dist/node/shared/overlay-types.js +0 -0
  132. package/dist/node/tests/operations.test-spec.js +112 -0
  133. package/dist/node/ui/SaasDashboard.js +988 -0
  134. package/dist/node/ui/SaasProjectList.js +162 -0
  135. package/dist/node/ui/SaasSettingsPanel.js +145 -0
  136. package/dist/node/ui/hooks/index.js +159 -0
  137. package/dist/node/ui/hooks/useProjectList.js +66 -0
  138. package/dist/node/ui/hooks/useProjectMutations.js +91 -0
  139. package/dist/node/ui/index.js +1808 -0
  140. package/dist/node/ui/modals/CreateProjectModal.js +153 -0
  141. package/dist/node/ui/modals/ProjectActionsModal.js +335 -0
  142. package/dist/node/ui/modals/index.js +487 -0
  143. package/dist/node/ui/overlays/demo-overlays.js +61 -0
  144. package/dist/node/ui/overlays/index.js +61 -0
  145. package/dist/node/ui/renderers/index.js +675 -0
  146. package/dist/node/ui/renderers/project-list.markdown.js +499 -0
  147. package/dist/node/ui/renderers/project-list.renderer.js +177 -0
  148. package/dist/presentations/index.d.ts +13 -14
  149. package/dist/presentations/index.d.ts.map +1 -1
  150. package/dist/presentations/index.js +289 -15
  151. package/dist/project/index.d.ts +11 -8
  152. package/dist/project/index.d.ts.map +1 -0
  153. package/dist/project/index.js +791 -9
  154. package/dist/project/project.entity.d.ts +23 -28
  155. package/dist/project/project.entity.d.ts.map +1 -1
  156. package/dist/project/project.entity.js +75 -82
  157. package/dist/project/project.enum.d.ts +2 -7
  158. package/dist/project/project.enum.d.ts.map +1 -1
  159. package/dist/project/project.enum.js +16 -23
  160. package/dist/project/project.event.d.ts +69 -75
  161. package/dist/project/project.event.d.ts.map +1 -1
  162. package/dist/project/project.event.js +95 -156
  163. package/dist/project/project.handler.d.ts +44 -47
  164. package/dist/project/project.handler.d.ts.map +1 -1
  165. package/dist/project/project.handler.js +168 -71
  166. package/dist/project/project.operations.d.ts +341 -347
  167. package/dist/project/project.operations.d.ts.map +1 -1
  168. package/dist/project/project.operations.js +366 -253
  169. package/dist/project/project.presentation.d.ts +2 -7
  170. package/dist/project/project.presentation.d.ts.map +1 -1
  171. package/dist/project/project.presentation.js +174 -61
  172. package/dist/project/project.schema.d.ts +191 -196
  173. package/dist/project/project.schema.d.ts.map +1 -1
  174. package/dist/project/project.schema.js +125 -205
  175. package/dist/saas-boilerplate.feature.d.ts +1 -6
  176. package/dist/saas-boilerplate.feature.d.ts.map +1 -1
  177. package/dist/saas-boilerplate.feature.js +87 -206
  178. package/dist/seeders/index.d.ts +4 -8
  179. package/dist/seeders/index.d.ts.map +1 -1
  180. package/dist/seeders/index.js +18 -16
  181. package/dist/settings/index.d.ts +6 -3
  182. package/dist/settings/index.d.ts.map +1 -0
  183. package/dist/settings/index.js +75 -3
  184. package/dist/settings/settings.entity.d.ts +23 -28
  185. package/dist/settings/settings.entity.d.ts.map +1 -1
  186. package/dist/settings/settings.entity.js +72 -75
  187. package/dist/settings/settings.enum.d.ts +1 -6
  188. package/dist/settings/settings.enum.d.ts.map +1 -1
  189. package/dist/settings/settings.enum.js +10 -19
  190. package/dist/shared/mock-data.d.ts +74 -77
  191. package/dist/shared/mock-data.d.ts.map +1 -1
  192. package/dist/shared/mock-data.js +102 -135
  193. package/dist/shared/overlay-types.d.ts +25 -28
  194. package/dist/shared/overlay-types.d.ts.map +1 -1
  195. package/dist/shared/overlay-types.js +1 -0
  196. package/dist/tests/operations.test-spec.d.ts +4 -9
  197. package/dist/tests/operations.test-spec.d.ts.map +1 -1
  198. package/dist/tests/operations.test-spec.js +108 -118
  199. package/dist/ui/SaasDashboard.d.ts +1 -6
  200. package/dist/ui/SaasDashboard.d.ts.map +1 -1
  201. package/dist/ui/SaasDashboard.js +977 -286
  202. package/dist/ui/SaasProjectList.d.ts +4 -11
  203. package/dist/ui/SaasProjectList.d.ts.map +1 -1
  204. package/dist/ui/SaasProjectList.js +159 -72
  205. package/dist/ui/SaasSettingsPanel.d.ts +1 -6
  206. package/dist/ui/SaasSettingsPanel.d.ts.map +1 -1
  207. package/dist/ui/SaasSettingsPanel.js +142 -134
  208. package/dist/ui/hooks/index.d.ts +3 -3
  209. package/dist/ui/hooks/index.d.ts.map +1 -0
  210. package/dist/ui/hooks/index.js +158 -4
  211. package/dist/ui/hooks/useProjectList.d.ts +26 -30
  212. package/dist/ui/hooks/useProjectList.d.ts.map +1 -1
  213. package/dist/ui/hooks/useProjectList.js +63 -71
  214. package/dist/ui/hooks/useProjectMutations.d.ts +20 -24
  215. package/dist/ui/hooks/useProjectMutations.d.ts.map +1 -1
  216. package/dist/ui/hooks/useProjectMutations.js +88 -142
  217. package/dist/ui/index.d.ts +8 -14
  218. package/dist/ui/index.d.ts.map +1 -0
  219. package/dist/ui/index.js +1809 -15
  220. package/dist/ui/modals/CreateProjectModal.d.ts +10 -19
  221. package/dist/ui/modals/CreateProjectModal.d.ts.map +1 -1
  222. package/dist/ui/modals/CreateProjectModal.js +150 -135
  223. package/dist/ui/modals/ProjectActionsModal.d.ts +20 -33
  224. package/dist/ui/modals/ProjectActionsModal.d.ts.map +1 -1
  225. package/dist/ui/modals/ProjectActionsModal.js +333 -289
  226. package/dist/ui/modals/index.d.ts +3 -3
  227. package/dist/ui/modals/index.d.ts.map +1 -0
  228. package/dist/ui/modals/index.js +487 -3
  229. package/dist/ui/overlays/demo-overlays.d.ts +10 -8
  230. package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
  231. package/dist/ui/overlays/demo-overlays.js +60 -68
  232. package/dist/ui/overlays/index.d.ts +2 -2
  233. package/dist/ui/overlays/index.d.ts.map +1 -0
  234. package/dist/ui/overlays/index.js +62 -3
  235. package/dist/ui/renderers/index.d.ts +3 -3
  236. package/dist/ui/renderers/index.d.ts.map +1 -0
  237. package/dist/ui/renderers/index.js +675 -3
  238. package/dist/ui/renderers/project-list.markdown.d.ts +15 -14
  239. package/dist/ui/renderers/project-list.markdown.d.ts.map +1 -1
  240. package/dist/ui/renderers/project-list.markdown.js +496 -146
  241. package/dist/ui/renderers/project-list.renderer.d.ts +6 -7
  242. package/dist/ui/renderers/project-list.renderer.d.ts.map +1 -1
  243. package/dist/ui/renderers/project-list.renderer.js +176 -15
  244. package/package.json +508 -98
  245. package/tsdown.config.js +1 -2
  246. package/.turbo/turbo-build$colon$bundle.log +0 -180
  247. package/dist/billing/billing.entity.js.map +0 -1
  248. package/dist/billing/billing.enum.js.map +0 -1
  249. package/dist/billing/billing.event.js.map +0 -1
  250. package/dist/billing/billing.handler.js.map +0 -1
  251. package/dist/billing/billing.operations.js.map +0 -1
  252. package/dist/billing/billing.presentation.js.map +0 -1
  253. package/dist/billing/billing.schema.js.map +0 -1
  254. package/dist/dashboard/dashboard.presentation.js.map +0 -1
  255. package/dist/docs/saas-boilerplate.docblock.js.map +0 -1
  256. package/dist/example.js.map +0 -1
  257. package/dist/handlers/saas.handlers.js.map +0 -1
  258. package/dist/index.js.map +0 -1
  259. package/dist/presentations/index.js.map +0 -1
  260. package/dist/project/project.entity.js.map +0 -1
  261. package/dist/project/project.enum.js.map +0 -1
  262. package/dist/project/project.event.js.map +0 -1
  263. package/dist/project/project.handler.js.map +0 -1
  264. package/dist/project/project.operations.js.map +0 -1
  265. package/dist/project/project.presentation.js.map +0 -1
  266. package/dist/project/project.schema.js.map +0 -1
  267. package/dist/saas-boilerplate.feature.js.map +0 -1
  268. package/dist/seeders/index.js.map +0 -1
  269. package/dist/settings/settings.entity.js.map +0 -1
  270. package/dist/settings/settings.enum.js.map +0 -1
  271. package/dist/shared/mock-data.js.map +0 -1
  272. package/dist/tests/operations.test-spec.js.map +0 -1
  273. package/dist/ui/SaasDashboard.js.map +0 -1
  274. package/dist/ui/SaasProjectList.js.map +0 -1
  275. package/dist/ui/SaasSettingsPanel.js.map +0 -1
  276. package/dist/ui/hooks/useProjectList.js.map +0 -1
  277. package/dist/ui/hooks/useProjectMutations.js.map +0 -1
  278. package/dist/ui/modals/CreateProjectModal.js.map +0 -1
  279. package/dist/ui/modals/ProjectActionsModal.js.map +0 -1
  280. package/dist/ui/overlays/demo-overlays.js.map +0 -1
  281. package/dist/ui/renderers/project-list.markdown.js.map +0 -1
  282. package/dist/ui/renderers/project-list.renderer.js.map +0 -1
  283. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,372 @@
1
+ // src/project/project.enum.ts
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/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
+ };
@@ -0,0 +1,177 @@
1
+ // src/project/project.enum.ts
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 { definePresentation, StabilityEnum } from "@contractspec/lib.contracts";
127
+ var ProjectListPresentation = definePresentation({
128
+ meta: {
129
+ key: "saas.project.list",
130
+ version: "1.0.0",
131
+ title: "Project List",
132
+ description: "List view of projects with status, tags, and last updated info",
133
+ domain: "saas-boilerplate",
134
+ owners: ["@saas-team"],
135
+ tags: ["project", "list", "dashboard"],
136
+ stability: StabilityEnum.Beta,
137
+ goal: "Browse and manage projects",
138
+ context: "Project list page"
139
+ },
140
+ source: {
141
+ type: "component",
142
+ framework: "react",
143
+ componentKey: "ProjectListView",
144
+ props: ProjectModel
145
+ },
146
+ targets: ["react", "markdown", "application/json"],
147
+ policy: {
148
+ flags: ["saas.projects.enabled"]
149
+ }
150
+ });
151
+ var ProjectDetailPresentation = definePresentation({
152
+ meta: {
153
+ key: "saas.project.detail",
154
+ version: "1.0.0",
155
+ title: "Project Details",
156
+ description: "Detailed view of a project with settings and activity",
157
+ domain: "saas-boilerplate",
158
+ owners: ["@saas-team"],
159
+ tags: ["project", "detail"],
160
+ stability: StabilityEnum.Beta,
161
+ goal: "View and edit project details",
162
+ context: "Project detail page"
163
+ },
164
+ source: {
165
+ type: "component",
166
+ framework: "react",
167
+ componentKey: "ProjectDetailView"
168
+ },
169
+ targets: ["react", "markdown"],
170
+ policy: {
171
+ flags: ["saas.projects.enabled"]
172
+ }
173
+ });
174
+ export {
175
+ ProjectListPresentation,
176
+ ProjectDetailPresentation
177
+ };
@@ -0,0 +1,134 @@
1
+ // src/project/project.enum.ts
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
+ export {
125
+ UpdateProjectInputModel,
126
+ ProjectModel,
127
+ ProjectDeletedPayloadModel,
128
+ ListProjectsOutputModel,
129
+ ListProjectsInputModel,
130
+ GetProjectInputModel,
131
+ DeleteProjectOutputModel,
132
+ DeleteProjectInputModel,
133
+ CreateProjectInputModel
134
+ };