@contractspec/example.saas-boilerplate 3.7.6 → 3.8.2

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 (143) hide show
  1. package/.turbo/turbo-build.log +39 -27
  2. package/AGENTS.md +50 -27
  3. package/CHANGELOG.md +36 -0
  4. package/README.md +65 -144
  5. package/dist/billing/billing.event.js +1 -1
  6. package/dist/billing/index.d.ts +6 -6
  7. package/dist/billing/index.js +1 -1
  8. package/dist/browser/billing/billing.event.js +1 -1
  9. package/dist/browser/billing/index.js +1 -1
  10. package/dist/browser/index.js +1147 -869
  11. package/dist/browser/project/index.js +209 -209
  12. package/dist/browser/project/project.event.js +1 -1
  13. package/dist/browser/saas-boilerplate.feature.js +208 -0
  14. package/dist/browser/ui/SaasDashboard.js +356 -105
  15. package/dist/browser/ui/SaasDashboard.visualizations.js +249 -0
  16. package/dist/browser/ui/SaasProjectList.js +7 -7
  17. package/dist/browser/ui/SaasSettingsPanel.js +12 -12
  18. package/dist/browser/ui/hooks/index.js +2 -2
  19. package/dist/browser/ui/hooks/useProjectList.js +1 -1
  20. package/dist/browser/ui/hooks/useProjectMutations.js +1 -1
  21. package/dist/browser/ui/index.js +790 -521
  22. package/dist/browser/ui/modals/CreateProjectModal.js +10 -10
  23. package/dist/browser/ui/modals/ProjectActionsModal.js +13 -13
  24. package/dist/browser/ui/modals/index.js +23 -23
  25. package/dist/browser/ui/renderers/index.js +341 -115
  26. package/dist/browser/ui/renderers/project-list.markdown.js +229 -3
  27. package/dist/browser/ui/renderers/project-list.renderer.js +7 -7
  28. package/dist/browser/visualizations/catalog.js +155 -0
  29. package/dist/browser/visualizations/index.js +217 -0
  30. package/dist/browser/visualizations/selectors.js +210 -0
  31. package/dist/handlers/index.d.ts +2 -2
  32. package/dist/index.d.ts +5 -4
  33. package/dist/index.js +1147 -869
  34. package/dist/node/billing/billing.event.js +1 -1
  35. package/dist/node/billing/index.js +1 -1
  36. package/dist/node/index.js +1147 -869
  37. package/dist/node/project/index.js +209 -209
  38. package/dist/node/project/project.event.js +1 -1
  39. package/dist/node/saas-boilerplate.feature.js +208 -0
  40. package/dist/node/ui/SaasDashboard.js +356 -105
  41. package/dist/node/ui/SaasDashboard.visualizations.js +249 -0
  42. package/dist/node/ui/SaasProjectList.js +7 -7
  43. package/dist/node/ui/SaasSettingsPanel.js +12 -12
  44. package/dist/node/ui/hooks/index.js +2 -2
  45. package/dist/node/ui/hooks/useProjectList.js +1 -1
  46. package/dist/node/ui/hooks/useProjectMutations.js +1 -1
  47. package/dist/node/ui/index.js +790 -521
  48. package/dist/node/ui/modals/CreateProjectModal.js +10 -10
  49. package/dist/node/ui/modals/ProjectActionsModal.js +13 -13
  50. package/dist/node/ui/modals/index.js +23 -23
  51. package/dist/node/ui/renderers/index.js +341 -115
  52. package/dist/node/ui/renderers/project-list.markdown.js +229 -3
  53. package/dist/node/ui/renderers/project-list.renderer.js +7 -7
  54. package/dist/node/visualizations/catalog.js +155 -0
  55. package/dist/node/visualizations/index.js +217 -0
  56. package/dist/node/visualizations/selectors.js +210 -0
  57. package/dist/presentations/index.d.ts +1 -1
  58. package/dist/project/index.d.ts +7 -7
  59. package/dist/project/index.js +209 -209
  60. package/dist/project/project.event.js +1 -1
  61. package/dist/saas-boilerplate.feature.js +208 -0
  62. package/dist/settings/index.d.ts +1 -1
  63. package/dist/ui/SaasDashboard.js +356 -105
  64. package/dist/ui/SaasDashboard.visualizations.d.ts +5 -0
  65. package/dist/ui/SaasDashboard.visualizations.js +250 -0
  66. package/dist/ui/SaasProjectList.js +7 -7
  67. package/dist/ui/SaasSettingsPanel.js +12 -12
  68. package/dist/ui/hooks/index.d.ts +2 -2
  69. package/dist/ui/hooks/index.js +2 -2
  70. package/dist/ui/hooks/useProjectList.d.ts +5 -0
  71. package/dist/ui/hooks/useProjectList.js +1 -1
  72. package/dist/ui/hooks/useProjectMutations.d.ts +8 -0
  73. package/dist/ui/hooks/useProjectMutations.js +1 -1
  74. package/dist/ui/index.d.ts +4 -4
  75. package/dist/ui/index.js +790 -521
  76. package/dist/ui/modals/CreateProjectModal.js +10 -10
  77. package/dist/ui/modals/ProjectActionsModal.js +13 -13
  78. package/dist/ui/modals/index.js +23 -23
  79. package/dist/ui/renderers/index.d.ts +1 -1
  80. package/dist/ui/renderers/index.js +341 -115
  81. package/dist/ui/renderers/project-list.markdown.js +229 -3
  82. package/dist/ui/renderers/project-list.renderer.d.ts +1 -1
  83. package/dist/ui/renderers/project-list.renderer.js +7 -7
  84. package/dist/visualizations/catalog.d.ts +11 -0
  85. package/dist/visualizations/catalog.js +156 -0
  86. package/dist/visualizations/index.d.ts +2 -0
  87. package/dist/visualizations/index.js +218 -0
  88. package/dist/visualizations/selectors.d.ts +8 -0
  89. package/dist/visualizations/selectors.js +211 -0
  90. package/dist/visualizations/selectors.test.d.ts +1 -0
  91. package/package.json +70 -14
  92. package/src/billing/billing.entity.ts +132 -132
  93. package/src/billing/billing.enum.ts +9 -9
  94. package/src/billing/billing.event.ts +71 -71
  95. package/src/billing/billing.handler.ts +87 -87
  96. package/src/billing/billing.operations.ts +158 -158
  97. package/src/billing/billing.presentation.ts +45 -45
  98. package/src/billing/billing.schema.ts +76 -76
  99. package/src/billing/index.ts +43 -48
  100. package/src/dashboard/dashboard.presentation.ts +45 -45
  101. package/src/dashboard/index.ts +2 -2
  102. package/src/docs/saas-boilerplate.docblock.ts +43 -43
  103. package/src/example.ts +32 -32
  104. package/src/handlers/index.ts +9 -9
  105. package/src/handlers/saas.handlers.ts +250 -249
  106. package/src/index.ts +41 -41
  107. package/src/presentations/index.ts +18 -20
  108. package/src/project/index.ts +45 -50
  109. package/src/project/project.entity.ts +68 -68
  110. package/src/project/project.enum.ts +8 -8
  111. package/src/project/project.event.ts +79 -79
  112. package/src/project/project.handler.ts +103 -103
  113. package/src/project/project.operations.ts +236 -236
  114. package/src/project/project.presentation.ts +46 -46
  115. package/src/project/project.schema.ts +90 -90
  116. package/src/saas-boilerplate.feature.ts +103 -100
  117. package/src/seeders/index.ts +20 -20
  118. package/src/settings/index.ts +2 -3
  119. package/src/settings/settings.entity.ts +65 -65
  120. package/src/settings/settings.enum.ts +4 -4
  121. package/src/shared/mock-data.ts +92 -92
  122. package/src/shared/overlay-types.ts +23 -23
  123. package/src/tests/operations.test-spec.ts +96 -96
  124. package/src/ui/SaasDashboard.tsx +278 -270
  125. package/src/ui/SaasDashboard.visualizations.tsx +41 -0
  126. package/src/ui/SaasProjectList.tsx +90 -90
  127. package/src/ui/SaasSettingsPanel.tsx +84 -84
  128. package/src/ui/hooks/index.ts +3 -3
  129. package/src/ui/hooks/useProjectList.ts +69 -68
  130. package/src/ui/hooks/useProjectMutations.ts +144 -143
  131. package/src/ui/index.ts +8 -12
  132. package/src/ui/modals/CreateProjectModal.tsx +154 -154
  133. package/src/ui/modals/ProjectActionsModal.tsx +321 -321
  134. package/src/ui/overlays/demo-overlays.ts +49 -49
  135. package/src/ui/renderers/index.ts +5 -4
  136. package/src/ui/renderers/project-list.markdown.ts +229 -205
  137. package/src/ui/renderers/project-list.renderer.tsx +14 -13
  138. package/src/visualizations/catalog.ts +153 -0
  139. package/src/visualizations/index.ts +2 -0
  140. package/src/visualizations/selectors.test.ts +25 -0
  141. package/src/visualizations/selectors.ts +85 -0
  142. package/tsconfig.json +7 -8
  143. package/tsdown.config.js +7 -3
@@ -2,35 +2,39 @@ $ contractspec-bun-build prebuild
2
2
  $ bun run prebuild && bun run build:bundle && bun run build:types
3
3
  $ contractspec-bun-build prebuild
4
4
  $ contractspec-bun-build transpile
5
- [contractspec-bun-build] transpile target=bun root=src entries=48 noBundle=false
6
- Bundled 48 modules in 95ms
5
+ [contractspec-bun-build] transpile target=bun root=src entries=52 noBundle=false
6
+ Bundled 52 modules in 68ms
7
7
 
8
8
  billing/billing.entity.js 3.54 KB (entry point)
9
9
  tests/operations.test-spec.js 2.91 KB (entry point)
10
10
  seeders/index.js 0.60 KB (entry point)
11
11
  shared/overlay-types.js 8 bytes (entry point)
12
12
  presentations/index.js 8.94 KB (entry point)
13
- ./index.js 113.60 KB (entry point)
14
- ui/index.js 65.70 KB (entry point)
13
+ ./index.js 122.20 KB (entry point)
14
+ ui/index.js 74.0 KB (entry point)
15
15
  ui/modals/index.js 19.42 KB (entry point)
16
16
  ui/overlays/index.js 1.31 KB (entry point)
17
17
  ui/overlays/demo-overlays.js 1.31 KB (entry point)
18
- ui/renderers/index.js 21.34 KB (entry point)
19
- ui/renderers/project-list.markdown.js 15.53 KB (entry point)
18
+ ui/renderers/index.js 28.1 KB (entry point)
20
19
  ui/renderers/project-list.renderer.js 5.82 KB (entry point)
21
- ui/SaasDashboard.js 38.33 KB (entry point)
20
+ ui/renderers/project-list.markdown.js 22.26 KB (entry point)
21
+ ui/SaasDashboard.js 46.0 KB (entry point)
22
22
  ui/modals/CreateProjectModal.js 6.22 KB (entry point)
23
23
  ui/modals/ProjectActionsModal.js 13.12 KB (entry point)
24
+ ui/SaasDashboard.visualizations.js 7.55 KB (entry point)
24
25
  ui/SaasProjectList.js 5.28 KB (entry point)
25
26
  ui/SaasSettingsPanel.js 6.42 KB (entry point)
26
27
  ui/hooks/index.js 5.0 KB (entry point)
27
28
  ui/hooks/useProjectList.js 2.1 KB (entry point)
28
29
  ui/hooks/useProjectMutations.js 2.91 KB (entry point)
29
- ./saas-boilerplate.feature.js 3.33 KB (entry point)
30
+ ./saas-boilerplate.feature.js 9.49 KB (entry point)
31
+ visualizations/index.js 6.39 KB (entry point)
32
+ visualizations/selectors.js 6.17 KB (entry point)
33
+ visualizations/catalog.js 4.37 KB (entry point)
30
34
  settings/index.js 2.30 KB (entry point)
31
35
  settings/settings.entity.js 2.28 KB (entry point)
32
36
  settings/settings.enum.js 310 bytes (entry point)
33
- project/index.js 22.48 KB (entry point)
37
+ project/index.js 22.50 KB (entry point)
34
38
  project/project.entity.js 2.27 KB (entry point)
35
39
  project/project.event.js 3.31 KB (entry point)
36
40
  project/project.operations.js 10.13 KB (entry point)
@@ -54,35 +58,39 @@ Bundled 48 modules in 95ms
54
58
  billing/billing.schema.js 4.50 KB (entry point)
55
59
  billing/billing.enum.js 443 bytes (entry point)
56
60
 
57
- [contractspec-bun-build] transpile target=node root=src entries=48 noBundle=false
58
- Bundled 48 modules in 84ms
61
+ [contractspec-bun-build] transpile target=node root=src entries=52 noBundle=false
62
+ Bundled 52 modules in 40ms
59
63
 
60
64
  billing/billing.entity.js 3.53 KB (entry point)
61
65
  tests/operations.test-spec.js 2.90 KB (entry point)
62
66
  seeders/index.js 0.59 KB (entry point)
63
67
  shared/overlay-types.js 0 KB (entry point)
64
68
  presentations/index.js 8.93 KB (entry point)
65
- ./index.js 113.50 KB (entry point)
66
- ui/index.js 65.60 KB (entry point)
69
+ ./index.js 122.10 KB (entry point)
70
+ ui/index.js 73.92 KB (entry point)
67
71
  ui/modals/index.js 19.40 KB (entry point)
68
72
  ui/overlays/index.js 1.30 KB (entry point)
69
73
  ui/overlays/demo-overlays.js 1.30 KB (entry point)
70
- ui/renderers/index.js 21.28 KB (entry point)
71
- ui/renderers/project-list.markdown.js 15.47 KB (entry point)
74
+ ui/renderers/index.js 28.0 KB (entry point)
72
75
  ui/renderers/project-list.renderer.js 5.81 KB (entry point)
73
- ui/SaasDashboard.js 38.29 KB (entry point)
76
+ ui/renderers/project-list.markdown.js 22.19 KB (entry point)
77
+ ui/SaasDashboard.js 46.0 KB (entry point)
74
78
  ui/modals/CreateProjectModal.js 6.21 KB (entry point)
75
79
  ui/modals/ProjectActionsModal.js 13.1 KB (entry point)
80
+ ui/SaasDashboard.visualizations.js 7.54 KB (entry point)
76
81
  ui/SaasProjectList.js 5.27 KB (entry point)
77
82
  ui/SaasSettingsPanel.js 6.41 KB (entry point)
78
83
  ui/hooks/index.js 5.0 KB (entry point)
79
84
  ui/hooks/useProjectList.js 2.0 KB (entry point)
80
85
  ui/hooks/useProjectMutations.js 2.91 KB (entry point)
81
- ./saas-boilerplate.feature.js 3.32 KB (entry point)
86
+ ./saas-boilerplate.feature.js 9.48 KB (entry point)
87
+ visualizations/index.js 6.38 KB (entry point)
88
+ visualizations/selectors.js 6.16 KB (entry point)
89
+ visualizations/catalog.js 4.36 KB (entry point)
82
90
  settings/index.js 2.29 KB (entry point)
83
91
  settings/settings.entity.js 2.27 KB (entry point)
84
92
  settings/settings.enum.js 302 bytes (entry point)
85
- project/index.js 22.47 KB (entry point)
93
+ project/index.js 22.49 KB (entry point)
86
94
  project/project.entity.js 2.26 KB (entry point)
87
95
  project/project.event.js 3.30 KB (entry point)
88
96
  project/project.operations.js 10.12 KB (entry point)
@@ -106,35 +114,39 @@ Bundled 48 modules in 84ms
106
114
  billing/billing.schema.js 4.49 KB (entry point)
107
115
  billing/billing.enum.js 435 bytes (entry point)
108
116
 
109
- [contractspec-bun-build] transpile target=browser root=src entries=48 noBundle=false
110
- Bundled 48 modules in 106ms
117
+ [contractspec-bun-build] transpile target=browser root=src entries=52 noBundle=false
118
+ Bundled 52 modules in 70ms
111
119
 
112
120
  billing/billing.entity.js 3.53 KB (entry point)
113
121
  tests/operations.test-spec.js 2.90 KB (entry point)
114
122
  seeders/index.js 0.59 KB (entry point)
115
123
  shared/overlay-types.js 0 KB (entry point)
116
124
  presentations/index.js 8.93 KB (entry point)
117
- ./index.js 113.50 KB (entry point)
118
- ui/index.js 65.60 KB (entry point)
125
+ ./index.js 122.10 KB (entry point)
126
+ ui/index.js 73.92 KB (entry point)
119
127
  ui/modals/index.js 19.40 KB (entry point)
120
128
  ui/overlays/index.js 1.30 KB (entry point)
121
129
  ui/overlays/demo-overlays.js 1.30 KB (entry point)
122
- ui/renderers/index.js 21.28 KB (entry point)
123
- ui/renderers/project-list.markdown.js 15.47 KB (entry point)
130
+ ui/renderers/index.js 28.0 KB (entry point)
124
131
  ui/renderers/project-list.renderer.js 5.81 KB (entry point)
125
- ui/SaasDashboard.js 38.29 KB (entry point)
132
+ ui/renderers/project-list.markdown.js 22.19 KB (entry point)
133
+ ui/SaasDashboard.js 46.0 KB (entry point)
126
134
  ui/modals/CreateProjectModal.js 6.21 KB (entry point)
127
135
  ui/modals/ProjectActionsModal.js 13.1 KB (entry point)
136
+ ui/SaasDashboard.visualizations.js 7.54 KB (entry point)
128
137
  ui/SaasProjectList.js 5.27 KB (entry point)
129
138
  ui/SaasSettingsPanel.js 6.41 KB (entry point)
130
139
  ui/hooks/index.js 5.0 KB (entry point)
131
140
  ui/hooks/useProjectList.js 2.0 KB (entry point)
132
141
  ui/hooks/useProjectMutations.js 2.91 KB (entry point)
133
- ./saas-boilerplate.feature.js 3.32 KB (entry point)
142
+ ./saas-boilerplate.feature.js 9.48 KB (entry point)
143
+ visualizations/index.js 6.38 KB (entry point)
144
+ visualizations/selectors.js 6.16 KB (entry point)
145
+ visualizations/catalog.js 4.36 KB (entry point)
134
146
  settings/index.js 2.29 KB (entry point)
135
147
  settings/settings.entity.js 2.27 KB (entry point)
136
148
  settings/settings.enum.js 302 bytes (entry point)
137
- project/index.js 22.47 KB (entry point)
149
+ project/index.js 22.49 KB (entry point)
138
150
  project/project.entity.js 2.26 KB (entry point)
139
151
  project/project.event.js 3.30 KB (entry point)
140
152
  project/project.operations.js 10.12 KB (entry point)
package/AGENTS.md CHANGED
@@ -1,36 +1,59 @@
1
- # AI Agent Guide -- `@contractspec/example.saas-boilerplate`
1
+ # AI Agent Guide `@contractspec/example.saas-boilerplate`
2
2
 
3
3
  Scope: `packages/examples/saas-boilerplate/*`
4
4
 
5
- SaaS Boilerplate: Users, Orgs, Projects, Billing, and Settings with full CRUD, events, and UI.
5
+ SaaS Boilerplate - Users, Orgs, Projects, Billing, Settings.
6
6
 
7
7
  ## Quick Context
8
8
 
9
- - **Layer**: example
10
- - **Related Packages**: `lib.identity-rbac`, `lib.jobs`, `module.audit-trail`, `module.notifications`, `lib.contracts-spec`, `lib.schema`, `lib.example-shared-ui`, `lib.design-system`, `lib.runtime-sandbox`
11
-
12
- ## What This Demonstrates
13
-
14
- - Multi-domain SaaS architecture (billing, project, settings, dashboard)
15
- - Per-domain entity/enum/event/handler/operations/presentation/schema pattern
16
- - React UI with hooks, modals, overlays, renderers, and dashboard
17
- - Feature definition, seeders, and test-spec patterns
18
- - RBAC, audit trail, and notification module integration
19
-
20
- ## Public Exports
21
-
22
- - `.` -- root barrel
23
- - `./billing`, `./project`, `./settings`, `./dashboard` -- domain modules
24
- - `./handlers` -- SaaS handlers
25
- - `./presentations` -- presentation layer
26
- - `./seeders` -- demo data
27
- - `./saas-boilerplate.feature` -- feature definition
28
- - `./ui` -- SaasDashboard, SaasProjectList, SaasSettingsPanel, hooks, modals, overlays, renderers
29
- - `./docs`, `./example`
9
+ - Layer: `example`.
10
+ - Package visibility: published package.
11
+ - Primary consumers are example explorers, template authors, and documentation readers.
12
+ - Related packages: `@contractspec/lib.contracts-spec`, `@contractspec/lib.design-system`, `@contractspec/lib.example-shared-ui`, `@contractspec/lib.identity-rbac`, `@contractspec/lib.jobs`, `@contractspec/lib.runtime-sandbox`, ...
13
+
14
+ ## Architecture
15
+
16
+ - `src/billing` is part of the package's public or composition surface.
17
+ - `src/dashboard` is part of the package's public or composition surface.
18
+ - `src/docs/` contains docblocks and documentation-facing exports.
19
+ - `src/example.ts` is the runnable example entrypoint.
20
+ - `src/handlers/` contains handlers or demo adapters wired to contract surfaces.
21
+ - `src/index.ts` is the root public barrel and package entrypoint.
22
+ - `src/presentations` is part of the package's public or composition surface.
23
+
24
+ ## Public Surface
25
+
26
+ - Export `.` resolves through `./src/index.ts`.
27
+ - Export `./billing` resolves through `./src/billing/index.ts`.
28
+ - Export `./billing/billing.entity` resolves through `./src/billing/billing.entity.ts`.
29
+ - Export `./billing/billing.enum` resolves through `./src/billing/billing.enum.ts`.
30
+ - Export `./billing/billing.event` resolves through `./src/billing/billing.event.ts`.
31
+ - Export `./billing/billing.handler` resolves through `./src/billing/billing.handler.ts`.
32
+ - Export `./billing/billing.operations` resolves through `./src/billing/billing.operations.ts`.
33
+ - Export `./billing/billing.presentation` resolves through `./src/billing/billing.presentation.ts`.
34
+ - Export `./billing/billing.schema` resolves through `./src/billing/billing.schema.ts`.
35
+ - Export `./dashboard` resolves through `./src/dashboard/index.ts`.
36
+ - The package publishes 48 total export subpaths; keep docs aligned with `package.json`.
37
+
38
+ ## Guardrails
39
+
40
+ - Keep the example package demonstrative, buildable, and aligned with the exported feature surface.
41
+ - Do not add hidden production assumptions that are not actually implemented in the example.
42
+ - Changes here can affect downstream packages such as `@contractspec/lib.contracts-spec`, `@contractspec/lib.design-system`, `@contractspec/lib.example-shared-ui`, `@contractspec/lib.identity-rbac`, `@contractspec/lib.jobs`, `@contractspec/lib.runtime-sandbox`, ....
43
+ - Changes here can affect downstream packages such as `@contractspec/lib.contracts-spec`, `@contractspec/lib.design-system`, `@contractspec/lib.example-shared-ui`, `@contractspec/lib.identity-rbac`, `@contractspec/lib.jobs`, `@contractspec/lib.runtime-sandbox`, ...
30
44
 
31
45
  ## Local Commands
32
46
 
33
- - Build: `bun run build`
34
- - Dev: `bun run dev`
35
- - Test: `bun test --pass-with-no-tests`
36
- - Typecheck: `bun run typecheck`
47
+ - `bun run dev` — contractspec-bun-build dev
48
+ - `bun run build`bun run prebuild && bun run build:bundle && bun run build:types
49
+ - `bun run test`bun test --pass-with-no-tests
50
+ - `bun run lint` — bun lint:fix
51
+ - `bun run lint:check` — biome check .
52
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
53
+ - `bun run typecheck` — tsc --noEmit
54
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
55
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
56
+ - `bun run clean` — rimraf dist .turbo
57
+ - `bun run build:bundle` — contractspec-bun-build transpile
58
+ - `bun run build:types` — contractspec-bun-build types
59
+ - `bun run prebuild` — contractspec-bun-build prebuild
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @contractspec/example.saas-boilerplate
2
2
 
3
+ ## 3.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1a44cb6: feat: improve examples to increase coverage of Contracts type
8
+ - Updated dependencies [1a44cb6]
9
+ - @contractspec/lib.example-shared-ui@6.0.10
10
+ - @contractspec/module.notifications@3.7.10
11
+ - @contractspec/lib.runtime-sandbox@2.7.9
12
+ - @contractspec/lib.contracts-spec@4.1.2
13
+ - @contractspec/module.audit-trail@3.7.10
14
+ - @contractspec/lib.design-system@3.8.3
15
+ - @contractspec/lib.identity-rbac@3.7.10
16
+ - @contractspec/lib.schema@3.7.8
17
+ - @contractspec/lib.jobs@3.7.10
18
+
19
+ ## 3.8.1
20
+
21
+ ### Patch Changes
22
+
23
+ - fix: release
24
+ - Updated dependencies
25
+ - @contractspec/lib.example-shared-ui@6.0.9
26
+ - @contractspec/module.notifications@3.7.9
27
+ - @contractspec/lib.runtime-sandbox@2.7.8
28
+ - @contractspec/lib.contracts-spec@4.1.1
29
+ - @contractspec/module.audit-trail@3.7.9
30
+ - @contractspec/lib.design-system@3.8.2
31
+ - @contractspec/lib.identity-rbac@3.7.9
32
+ - @contractspec/lib.jobs@3.7.9
33
+ - @contractspec/lib.schema@3.7.7
34
+
3
35
  ## 3.7.6
4
36
 
5
37
  ### Patch Changes
@@ -625,6 +657,7 @@
625
657
  - 7f3203a: fix: make workspace test runs resilient when packages have no tests
626
658
 
627
659
  Updates package test scripts to pass cleanly when no matching test files exist:
660
+
628
661
  - Uses `bun test --pass-with-no-tests` in Bun-based packages that currently ship without test files.
629
662
  - Uses `jest --passWithNoTests` for the UI kit web package.
630
663
  - Adds `.vscode-test.mjs` for `vscode-contractspec` so VS Code extension test runs have an explicit config and stop failing on missing default configuration.
@@ -1130,14 +1163,17 @@
1130
1163
  feat: Contract layers support (features, examples, app-configs)
1131
1164
 
1132
1165
  ### New CLI Commands
1166
+
1133
1167
  - `contractspec list layers` - List all contract layers with filtering
1134
1168
 
1135
1169
  ### Enhanced Commands
1170
+
1136
1171
  - `contractspec ci` - New `layers` check category validates features/examples/config
1137
1172
  - `contractspec doctor` - New `layers` health checks
1138
1173
  - `contractspec integrity` - Now shows layer statistics
1139
1174
 
1140
1175
  ### New APIs
1176
+
1141
1177
  - `discoverLayers()` - Scan workspace for all layer files
1142
1178
  - `scanExampleSource()` - Parse ExampleSpec from source code
1143
1179
  - `isExampleFile()` - Check if file is an example spec
package/README.md CHANGED
@@ -1,155 +1,76 @@
1
- # SaaS Boilerplate
1
+ # @contractspec/example.saas-boilerplate
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
+ **SaaS Boilerplate - Users, Orgs, Projects, Billing, Settings.**
5
6
 
6
- A complete SaaS starter application demonstrating ContractSpec principles.
7
+ ## What This Demonstrates
7
8
 
8
- ## What's Included
9
+ - Multi-domain SaaS architecture (billing, project, settings, dashboard).
10
+ - Per-domain entity/enum/event/handler/operations/presentation/schema pattern.
11
+ - React UI with hooks, modals, overlays, renderers, and dashboard.
12
+ - Contract-backed visualizations for portfolio status, tier mix, usage, and recent project activity.
13
+ - Feature definition, seeders, and test-spec patterns.
14
+ - RBAC, audit trail, and notification module integration.
15
+ - `src/docs/` contains docblocks and documentation-facing exports.
9
16
 
10
- This example showcases a full SaaS application with:
17
+ ## Running Locally
11
18
 
12
- - **User Management**: User profiles, authentication, preferences
13
- - **Organizations**: Multi-tenant workspaces with members and roles
14
- - **Projects**: Team-scoped projects with CRUD operations
15
- - **Billing**: Usage tracking and subscription management
16
- - **Settings**: Application and user settings
17
-
18
- ## Architecture
19
-
20
- ```
21
- saas-boilerplate/
22
- ├── entities/ # Entity specs (generates Prisma schema)
23
- │ ├── project.ts
24
- │ ├── settings.ts
25
- │ └── billing.ts
26
- ├── contracts/ # API contracts (generates GraphQL/REST)
27
- │ ├── project.ts
28
- │ └── billing.ts
29
- ├── events/ # Domain events
30
- │ └── index.ts
31
- ├── schema.config.ts # Schema composition config
32
- └── README.md
33
- ```
34
-
35
- ## Cross-Cutting Modules Used
36
-
37
- | Module | Purpose |
38
- |--------|---------|
39
- | @contractspec/lib.identity-rbac | User, Org, Member, Role entities |
40
- | @contractspec/module.audit-trail | Activity logging |
41
- | @contractspec/module.notifications | User notifications |
42
- | @contractspec/lib.jobs | Background tasks |
43
-
44
- ## Entities
45
-
46
- ### Project
47
-
48
- Projects belong to organizations and track team work.
49
-
50
- ```typescript
51
- const ProjectEntity = defineEntity({
52
- name: 'Project',
53
- fields: {
54
- id: field.id(),
55
- name: field.string(),
56
- description: field.string({ isOptional: true }),
57
- organizationId: field.foreignKey(),
58
- createdBy: field.foreignKey(),
59
- status: field.enum('ProjectStatus'),
60
- // ...
61
- },
62
- });
63
- ```
64
-
65
- ### Settings
66
-
67
- Application and organization settings.
68
-
69
- ```typescript
70
- const SettingsEntity = defineEntity({
71
- name: 'Settings',
72
- fields: {
73
- id: field.id(),
74
- key: field.string(),
75
- value: field.json(),
76
- scope: field.enum('SettingsScope'), // 'app', 'org', 'user'
77
- // ...
78
- },
79
- });
80
- ```
81
-
82
- ### BillingUsage
83
-
84
- Track feature usage for billing.
85
-
86
- ```typescript
87
- const BillingUsageEntity = defineEntity({
88
- name: 'BillingUsage',
89
- fields: {
90
- id: field.id(),
91
- organizationId: field.foreignKey(),
92
- feature: field.string(),
93
- quantity: field.int(),
94
- billingPeriod: field.string(),
95
- // ...
96
- },
97
- });
98
- ```
99
-
100
- ## Contracts
101
-
102
- ### Project CRUD
103
-
104
- - `project.create` - Create a new project
105
- - `project.get` - Get project by ID
106
- - `project.update` - Update project
107
- - `project.delete` - Delete project
108
- - `project.list` - List org projects
109
-
110
- ### Billing
111
-
112
- - `billing.usage.record` - Record feature usage
113
- - `billing.usage.get` - Get usage summary
114
- - `billing.subscription.get` - Get subscription status
115
-
116
- ## Events
117
-
118
- | Event | Description |
119
- |-------|-------------|
120
- | project.created | New project created |
121
- | project.updated | Project modified |
122
- | project.deleted | Project removed |
123
- | billing.usage.recorded | Usage tracked |
124
- | billing.limit.reached | Usage limit hit |
19
+ From `packages/examples/saas-boilerplate`:
20
+ - `bun run dev`
21
+ - `bun run build`
22
+ - `bun run test`
23
+ - `bun run typecheck`
125
24
 
126
25
  ## Usage
127
26
 
128
- ### Generate Schema
129
-
130
- ```bash
131
- cd packages/examples/saas-boilerplate
132
- ```
133
-
134
- ### Load as Studio Template
135
-
136
- This example is registered in the ContractSpec Studio template registry as `saas-boilerplate`.
27
+ Use `@contractspec/example.saas-boilerplate` as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
137
28
 
138
- From the Studio UI:
139
- 1. Click "New Project"
140
- 2. Select "SaaS Boilerplate" template
141
- 3. Customize entities and contracts as needed
142
-
143
- ### Clone via Git
144
-
145
- ```bash
146
- npx degit lssm/contractspec/packages/examples/saas-boilerplate my-saas-app
147
- ```
148
-
149
- ## Customization Points
150
-
151
- 1. **Add Custom Entities**: Extend with your domain models
152
- 2. **Modify Billing**: Adapt to your pricing model
153
- 3. **Extend Settings**: Add app-specific configuration
154
- 4. **Add Workflows**: Integrate with @contractspec/lib.jobs for background tasks
29
+ ## Architecture
155
30
 
31
+ - `src/billing` is part of the package's public or composition surface.
32
+ - `src/dashboard` is part of the package's public or composition surface.
33
+ - `src/docs/` contains docblocks and documentation-facing exports.
34
+ - `src/example.ts` is the runnable example entrypoint.
35
+ - `src/handlers/` contains handlers or demo adapters wired to contract surfaces.
36
+ - `src/index.ts` is the root public barrel and package entrypoint.
37
+ - `src/presentations` is part of the package's public or composition surface.
38
+
39
+ ## Public Entry Points
40
+
41
+ - Export `.` resolves through `./src/index.ts`.
42
+ - Export `./billing` resolves through `./src/billing/index.ts`.
43
+ - Export `./billing/billing.entity` resolves through `./src/billing/billing.entity.ts`.
44
+ - Export `./billing/billing.enum` resolves through `./src/billing/billing.enum.ts`.
45
+ - Export `./billing/billing.event` resolves through `./src/billing/billing.event.ts`.
46
+ - Export `./billing/billing.handler` resolves through `./src/billing/billing.handler.ts`.
47
+ - Export `./billing/billing.operations` resolves through `./src/billing/billing.operations.ts`.
48
+ - Export `./billing/billing.presentation` resolves through `./src/billing/billing.presentation.ts`.
49
+ - Export `./billing/billing.schema` resolves through `./src/billing/billing.schema.ts`.
50
+ - Export `./dashboard` resolves through `./src/dashboard/index.ts`.
51
+ - The package publishes 48 total export subpaths; keep docs aligned with `package.json`.
52
+
53
+ ## Local Commands
54
+
55
+ - `bun run dev` — contractspec-bun-build dev
56
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
57
+ - `bun run test` — bun test --pass-with-no-tests
58
+ - `bun run lint` — bun lint:fix
59
+ - `bun run lint:check` — biome check .
60
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
61
+ - `bun run typecheck` — tsc --noEmit
62
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
63
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
64
+ - `bun run clean` — rimraf dist .turbo
65
+ - `bun run build:bundle` — contractspec-bun-build transpile
66
+ - `bun run build:types` — contractspec-bun-build types
67
+ - `bun run prebuild` — contractspec-bun-build prebuild
68
+
69
+ ## Recent Updates
70
+
71
+ - Replace eslint+prettier by biomejs to optimize speed.
72
+ - Missing contract layers.
73
+
74
+ ## Notes
75
+
76
+ - Works alongside `@contractspec/lib.contracts-spec`, `@contractspec/lib.design-system`, `@contractspec/lib.example-shared-ui`, `@contractspec/lib.identity-rbac`, `@contractspec/lib.jobs`, ...
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/billing/billing.event.ts
3
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
4
3
  import { defineEvent } from "@contractspec/lib.contracts-spec";
4
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
5
5
  var UsageRecordedPayload = defineSchemaModel({
6
6
  name: "UsageRecordedPayload",
7
7
  description: "Payload when feature usage is recorded",
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Billing domain - subscription, usage tracking, and feature access.
3
3
  */
4
- export { SubscriptionStatusSchemaEnum, FeatureAccessReasonEnum, } from './billing.enum';
5
- export { SubscriptionModel, UsageSummaryModel, RecordUsageInputModel, RecordUsageOutputModel, UsageRecordedPayloadModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, } from './billing.schema';
6
- export { GetSubscriptionContract, RecordUsageContract, GetUsageSummaryContract, CheckFeatureAccessContract, } from './billing.operations';
7
- export { UsageRecordedEvent, UsageLimitReachedEvent, SubscriptionChangedEvent, } from './billing.event';
8
- export { SubscriptionStatusEnum, SubscriptionEntity, BillingUsageEntity, UsageLimitEntity, } from './billing.entity';
4
+ export { BillingUsageEntity, SubscriptionEntity, SubscriptionStatusEnum, UsageLimitEntity, } from './billing.entity';
5
+ export { FeatureAccessReasonEnum, SubscriptionStatusSchemaEnum, } from './billing.enum';
6
+ export { SubscriptionChangedEvent, UsageLimitReachedEvent, UsageRecordedEvent, } from './billing.event';
7
+ export { type CheckFeatureAccessInput, type CheckFeatureAccessOutput, mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler, type RecordUsageInput, type Subscription, type UsageSummary, } from './billing.handler';
8
+ export { CheckFeatureAccessContract, GetSubscriptionContract, GetUsageSummaryContract, RecordUsageContract, } from './billing.operations';
9
9
  export { SubscriptionPresentation, UsageDashboardPresentation, } from './billing.presentation';
10
- export { mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler, mockCheckFeatureAccessHandler, type Subscription, type UsageSummary, type RecordUsageInput, type CheckFeatureAccessInput, type CheckFeatureAccessOutput, } from './billing.handler';
10
+ export { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel, } from './billing.schema';
@@ -124,8 +124,8 @@ var FeatureAccessReasonEnum = defineEnum("FeatureAccessReason", [
124
124
  ]);
125
125
 
126
126
  // src/billing/billing.event.ts
127
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
128
127
  import { defineEvent } from "@contractspec/lib.contracts-spec";
128
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
129
129
  var UsageRecordedPayload = defineSchemaModel({
130
130
  name: "UsageRecordedPayload",
131
131
  description: "Payload when feature usage is recorded",
@@ -1,6 +1,6 @@
1
1
  // src/billing/billing.event.ts
2
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
2
  import { defineEvent } from "@contractspec/lib.contracts-spec";
3
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
4
  var UsageRecordedPayload = defineSchemaModel({
5
5
  name: "UsageRecordedPayload",
6
6
  description: "Payload when feature usage is recorded",
@@ -123,8 +123,8 @@ var FeatureAccessReasonEnum = defineEnum("FeatureAccessReason", [
123
123
  ]);
124
124
 
125
125
  // src/billing/billing.event.ts
126
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
127
126
  import { defineEvent } from "@contractspec/lib.contracts-spec";
127
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
128
128
  var UsageRecordedPayload = defineSchemaModel({
129
129
  name: "UsageRecordedPayload",
130
130
  description: "Payload when feature usage is recorded",