@contractspec/example.saas-boilerplate 3.7.5 → 3.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/AGENTS.md +50 -27
- package/CHANGELOG.md +16 -0
- package/README.md +64 -144
- package/dist/billing/billing.event.js +1 -1
- package/dist/billing/index.d.ts +6 -6
- package/dist/billing/index.js +1 -1
- package/dist/browser/billing/billing.event.js +1 -1
- package/dist/browser/billing/index.js +1 -1
- package/dist/browser/index.js +931 -932
- package/dist/browser/project/index.js +209 -209
- package/dist/browser/project/project.event.js +1 -1
- package/dist/browser/ui/SaasDashboard.js +45 -45
- package/dist/browser/ui/SaasProjectList.js +7 -7
- package/dist/browser/ui/SaasSettingsPanel.js +12 -12
- package/dist/browser/ui/hooks/index.js +2 -2
- package/dist/browser/ui/hooks/useProjectList.js +1 -1
- package/dist/browser/ui/hooks/useProjectMutations.js +1 -1
- package/dist/browser/ui/index.js +483 -484
- package/dist/browser/ui/modals/CreateProjectModal.js +10 -10
- package/dist/browser/ui/modals/ProjectActionsModal.js +13 -13
- package/dist/browser/ui/modals/index.js +23 -23
- package/dist/browser/ui/renderers/index.js +112 -112
- package/dist/browser/ui/renderers/project-list.renderer.js +7 -7
- package/dist/handlers/index.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +931 -932
- package/dist/node/billing/billing.event.js +1 -1
- package/dist/node/billing/index.js +1 -1
- package/dist/node/index.js +931 -932
- package/dist/node/project/index.js +209 -209
- package/dist/node/project/project.event.js +1 -1
- package/dist/node/ui/SaasDashboard.js +45 -45
- package/dist/node/ui/SaasProjectList.js +7 -7
- package/dist/node/ui/SaasSettingsPanel.js +12 -12
- package/dist/node/ui/hooks/index.js +2 -2
- package/dist/node/ui/hooks/useProjectList.js +1 -1
- package/dist/node/ui/hooks/useProjectMutations.js +1 -1
- package/dist/node/ui/index.js +483 -484
- package/dist/node/ui/modals/CreateProjectModal.js +10 -10
- package/dist/node/ui/modals/ProjectActionsModal.js +13 -13
- package/dist/node/ui/modals/index.js +23 -23
- package/dist/node/ui/renderers/index.js +112 -112
- package/dist/node/ui/renderers/project-list.renderer.js +7 -7
- package/dist/presentations/index.d.ts +1 -1
- package/dist/project/index.d.ts +7 -7
- package/dist/project/index.js +209 -209
- package/dist/project/project.event.js +1 -1
- package/dist/settings/index.d.ts +1 -1
- package/dist/ui/SaasDashboard.js +45 -45
- package/dist/ui/SaasProjectList.js +7 -7
- package/dist/ui/SaasSettingsPanel.js +12 -12
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.js +2 -2
- package/dist/ui/hooks/useProjectList.d.ts +5 -0
- package/dist/ui/hooks/useProjectList.js +1 -1
- package/dist/ui/hooks/useProjectMutations.d.ts +8 -0
- package/dist/ui/hooks/useProjectMutations.js +1 -1
- package/dist/ui/index.d.ts +4 -4
- package/dist/ui/index.js +483 -484
- package/dist/ui/modals/CreateProjectModal.js +10 -10
- package/dist/ui/modals/ProjectActionsModal.js +13 -13
- package/dist/ui/modals/index.js +23 -23
- package/dist/ui/renderers/index.d.ts +1 -1
- package/dist/ui/renderers/index.js +112 -112
- package/dist/ui/renderers/project-list.renderer.d.ts +1 -1
- package/dist/ui/renderers/project-list.renderer.js +7 -7
- package/package.json +14 -14
- package/src/billing/billing.entity.ts +132 -132
- package/src/billing/billing.enum.ts +9 -9
- package/src/billing/billing.event.ts +71 -71
- package/src/billing/billing.handler.ts +87 -87
- package/src/billing/billing.operations.ts +158 -158
- package/src/billing/billing.presentation.ts +45 -45
- package/src/billing/billing.schema.ts +76 -76
- package/src/billing/index.ts +43 -48
- package/src/dashboard/dashboard.presentation.ts +45 -45
- package/src/dashboard/index.ts +2 -2
- package/src/docs/saas-boilerplate.docblock.ts +43 -43
- package/src/example.ts +32 -32
- package/src/handlers/index.ts +9 -9
- package/src/handlers/saas.handlers.ts +250 -249
- package/src/index.ts +40 -41
- package/src/presentations/index.ts +18 -20
- package/src/project/index.ts +45 -50
- package/src/project/project.entity.ts +68 -68
- package/src/project/project.enum.ts +8 -8
- package/src/project/project.event.ts +79 -79
- package/src/project/project.handler.ts +103 -103
- package/src/project/project.operations.ts +236 -236
- package/src/project/project.presentation.ts +46 -46
- package/src/project/project.schema.ts +90 -90
- package/src/saas-boilerplate.feature.ts +100 -100
- package/src/seeders/index.ts +20 -20
- package/src/settings/index.ts +2 -3
- package/src/settings/settings.entity.ts +65 -65
- package/src/settings/settings.enum.ts +4 -4
- package/src/shared/mock-data.ts +92 -92
- package/src/shared/overlay-types.ts +23 -23
- package/src/tests/operations.test-spec.ts +96 -96
- package/src/ui/SaasDashboard.tsx +270 -270
- package/src/ui/SaasProjectList.tsx +90 -90
- package/src/ui/SaasSettingsPanel.tsx +84 -84
- package/src/ui/hooks/index.ts +3 -3
- package/src/ui/hooks/useProjectList.ts +69 -68
- package/src/ui/hooks/useProjectMutations.ts +144 -143
- package/src/ui/index.ts +8 -12
- package/src/ui/modals/CreateProjectModal.tsx +154 -154
- package/src/ui/modals/ProjectActionsModal.tsx +321 -321
- package/src/ui/overlays/demo-overlays.ts +49 -49
- package/src/ui/renderers/index.ts +5 -4
- package/src/ui/renderers/project-list.markdown.ts +204 -204
- package/src/ui/renderers/project-list.renderer.tsx +14 -13
- package/tsconfig.json +7 -8
- package/tsdown.config.js +7 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -3,7 +3,7 @@ $ bun run prebuild && bun run build:bundle && bun run build:types
|
|
|
3
3
|
$ contractspec-bun-build prebuild
|
|
4
4
|
$ contractspec-bun-build transpile
|
|
5
5
|
[contractspec-bun-build] transpile target=bun root=src entries=48 noBundle=false
|
|
6
|
-
Bundled 48 modules in
|
|
6
|
+
Bundled 48 modules in 67ms
|
|
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)
|
|
@@ -30,7 +30,7 @@ Bundled 48 modules in 88ms
|
|
|
30
30
|
settings/index.js 2.30 KB (entry point)
|
|
31
31
|
settings/settings.entity.js 2.28 KB (entry point)
|
|
32
32
|
settings/settings.enum.js 310 bytes (entry point)
|
|
33
|
-
project/index.js 22.
|
|
33
|
+
project/index.js 22.50 KB (entry point)
|
|
34
34
|
project/project.entity.js 2.27 KB (entry point)
|
|
35
35
|
project/project.event.js 3.31 KB (entry point)
|
|
36
36
|
project/project.operations.js 10.13 KB (entry point)
|
|
@@ -55,7 +55,7 @@ Bundled 48 modules in 88ms
|
|
|
55
55
|
billing/billing.enum.js 443 bytes (entry point)
|
|
56
56
|
|
|
57
57
|
[contractspec-bun-build] transpile target=node root=src entries=48 noBundle=false
|
|
58
|
-
Bundled 48 modules in
|
|
58
|
+
Bundled 48 modules in 68ms
|
|
59
59
|
|
|
60
60
|
billing/billing.entity.js 3.53 KB (entry point)
|
|
61
61
|
tests/operations.test-spec.js 2.90 KB (entry point)
|
|
@@ -63,7 +63,7 @@ Bundled 48 modules in 58ms
|
|
|
63
63
|
shared/overlay-types.js 0 KB (entry point)
|
|
64
64
|
presentations/index.js 8.93 KB (entry point)
|
|
65
65
|
./index.js 113.50 KB (entry point)
|
|
66
|
-
ui/index.js 65.
|
|
66
|
+
ui/index.js 65.61 KB (entry point)
|
|
67
67
|
ui/modals/index.js 19.40 KB (entry point)
|
|
68
68
|
ui/overlays/index.js 1.30 KB (entry point)
|
|
69
69
|
ui/overlays/demo-overlays.js 1.30 KB (entry point)
|
|
@@ -82,7 +82,7 @@ Bundled 48 modules in 58ms
|
|
|
82
82
|
settings/index.js 2.29 KB (entry point)
|
|
83
83
|
settings/settings.entity.js 2.27 KB (entry point)
|
|
84
84
|
settings/settings.enum.js 302 bytes (entry point)
|
|
85
|
-
project/index.js 22.
|
|
85
|
+
project/index.js 22.49 KB (entry point)
|
|
86
86
|
project/project.entity.js 2.26 KB (entry point)
|
|
87
87
|
project/project.event.js 3.30 KB (entry point)
|
|
88
88
|
project/project.operations.js 10.12 KB (entry point)
|
|
@@ -107,7 +107,7 @@ Bundled 48 modules in 58ms
|
|
|
107
107
|
billing/billing.enum.js 435 bytes (entry point)
|
|
108
108
|
|
|
109
109
|
[contractspec-bun-build] transpile target=browser root=src entries=48 noBundle=false
|
|
110
|
-
Bundled 48 modules in
|
|
110
|
+
Bundled 48 modules in 82ms
|
|
111
111
|
|
|
112
112
|
billing/billing.entity.js 3.53 KB (entry point)
|
|
113
113
|
tests/operations.test-spec.js 2.90 KB (entry point)
|
|
@@ -115,7 +115,7 @@ Bundled 48 modules in 95ms
|
|
|
115
115
|
shared/overlay-types.js 0 KB (entry point)
|
|
116
116
|
presentations/index.js 8.93 KB (entry point)
|
|
117
117
|
./index.js 113.50 KB (entry point)
|
|
118
|
-
ui/index.js 65.
|
|
118
|
+
ui/index.js 65.61 KB (entry point)
|
|
119
119
|
ui/modals/index.js 19.40 KB (entry point)
|
|
120
120
|
ui/overlays/index.js 1.30 KB (entry point)
|
|
121
121
|
ui/overlays/demo-overlays.js 1.30 KB (entry point)
|
|
@@ -134,7 +134,7 @@ Bundled 48 modules in 95ms
|
|
|
134
134
|
settings/index.js 2.29 KB (entry point)
|
|
135
135
|
settings/settings.entity.js 2.27 KB (entry point)
|
|
136
136
|
settings/settings.enum.js 302 bytes (entry point)
|
|
137
|
-
project/index.js 22.
|
|
137
|
+
project/index.js 22.49 KB (entry point)
|
|
138
138
|
project/project.entity.js 2.26 KB (entry point)
|
|
139
139
|
project/project.event.js 3.30 KB (entry point)
|
|
140
140
|
project/project.operations.js 10.12 KB (entry point)
|
package/AGENTS.md
CHANGED
|
@@ -1,36 +1,59 @@
|
|
|
1
|
-
# AI Agent Guide
|
|
1
|
+
# AI Agent Guide — `@contractspec/example.saas-boilerplate`
|
|
2
2
|
|
|
3
3
|
Scope: `packages/examples/saas-boilerplate/*`
|
|
4
4
|
|
|
5
|
-
SaaS Boilerplate
|
|
5
|
+
SaaS Boilerplate - Users, Orgs, Projects, Billing, Settings.
|
|
6
6
|
|
|
7
7
|
## Quick Context
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
- `./
|
|
28
|
-
- `./
|
|
29
|
-
- `./
|
|
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
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
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,21 @@
|
|
|
1
1
|
# @contractspec/example.saas-boilerplate
|
|
2
2
|
|
|
3
|
+
## 3.7.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: release manifest
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @contractspec/lib.example-shared-ui@6.0.6
|
|
10
|
+
- @contractspec/module.notifications@3.7.6
|
|
11
|
+
- @contractspec/lib.runtime-sandbox@2.7.6
|
|
12
|
+
- @contractspec/lib.contracts-spec@3.7.6
|
|
13
|
+
- @contractspec/module.audit-trail@3.7.6
|
|
14
|
+
- @contractspec/lib.design-system@3.7.6
|
|
15
|
+
- @contractspec/lib.identity-rbac@3.7.6
|
|
16
|
+
- @contractspec/lib.schema@3.7.6
|
|
17
|
+
- @contractspec/lib.jobs@3.7.6
|
|
18
|
+
|
|
3
19
|
## 3.7.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,155 +1,75 @@
|
|
|
1
|
-
#
|
|
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
|
-
|
|
7
|
+
## What This Demonstrates
|
|
7
8
|
|
|
8
|
-
|
|
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
|
+
- Feature definition, seeders, and test-spec patterns.
|
|
13
|
+
- RBAC, audit trail, and notification module integration.
|
|
14
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
## Running Locally
|
|
11
17
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
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 |
|
|
18
|
+
From `packages/examples/saas-boilerplate`:
|
|
19
|
+
- `bun run dev`
|
|
20
|
+
- `bun run build`
|
|
21
|
+
- `bun run test`
|
|
22
|
+
- `bun run typecheck`
|
|
125
23
|
|
|
126
24
|
## Usage
|
|
127
25
|
|
|
128
|
-
|
|
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`.
|
|
26
|
+
Use `@contractspec/example.saas-boilerplate` as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
|
|
137
27
|
|
|
138
|
-
|
|
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
|
|
28
|
+
## Architecture
|
|
155
29
|
|
|
30
|
+
- `src/billing` is part of the package's public or composition surface.
|
|
31
|
+
- `src/dashboard` is part of the package's public or composition surface.
|
|
32
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
33
|
+
- `src/example.ts` is the runnable example entrypoint.
|
|
34
|
+
- `src/handlers/` contains handlers or demo adapters wired to contract surfaces.
|
|
35
|
+
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
36
|
+
- `src/presentations` is part of the package's public or composition surface.
|
|
37
|
+
|
|
38
|
+
## Public Entry Points
|
|
39
|
+
|
|
40
|
+
- Export `.` resolves through `./src/index.ts`.
|
|
41
|
+
- Export `./billing` resolves through `./src/billing/index.ts`.
|
|
42
|
+
- Export `./billing/billing.entity` resolves through `./src/billing/billing.entity.ts`.
|
|
43
|
+
- Export `./billing/billing.enum` resolves through `./src/billing/billing.enum.ts`.
|
|
44
|
+
- Export `./billing/billing.event` resolves through `./src/billing/billing.event.ts`.
|
|
45
|
+
- Export `./billing/billing.handler` resolves through `./src/billing/billing.handler.ts`.
|
|
46
|
+
- Export `./billing/billing.operations` resolves through `./src/billing/billing.operations.ts`.
|
|
47
|
+
- Export `./billing/billing.presentation` resolves through `./src/billing/billing.presentation.ts`.
|
|
48
|
+
- Export `./billing/billing.schema` resolves through `./src/billing/billing.schema.ts`.
|
|
49
|
+
- Export `./dashboard` resolves through `./src/dashboard/index.ts`.
|
|
50
|
+
- The package publishes 48 total export subpaths; keep docs aligned with `package.json`.
|
|
51
|
+
|
|
52
|
+
## Local Commands
|
|
53
|
+
|
|
54
|
+
- `bun run dev` — contractspec-bun-build dev
|
|
55
|
+
- `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
|
|
56
|
+
- `bun run test` — bun test --pass-with-no-tests
|
|
57
|
+
- `bun run lint` — bun lint:fix
|
|
58
|
+
- `bun run lint:check` — biome check .
|
|
59
|
+
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
|
|
60
|
+
- `bun run typecheck` — tsc --noEmit
|
|
61
|
+
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
|
|
62
|
+
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
|
|
63
|
+
- `bun run clean` — rimraf dist .turbo
|
|
64
|
+
- `bun run build:bundle` — contractspec-bun-build transpile
|
|
65
|
+
- `bun run build:types` — contractspec-bun-build types
|
|
66
|
+
- `bun run prebuild` — contractspec-bun-build prebuild
|
|
67
|
+
|
|
68
|
+
## Recent Updates
|
|
69
|
+
|
|
70
|
+
- Replace eslint+prettier by biomejs to optimize speed.
|
|
71
|
+
- Missing contract layers.
|
|
72
|
+
|
|
73
|
+
## Notes
|
|
74
|
+
|
|
75
|
+
- 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",
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Billing domain - subscription, usage tracking, and feature access.
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
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 {
|
|
10
|
+
export { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel, } from './billing.schema';
|
package/dist/billing/index.js
CHANGED
|
@@ -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",
|