@lssm/example.saas-boilerplate 0.0.0-canary-20251210171026 → 0.0.0-canary-20251212210835
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 +23 -21
- package/CHANGELOG.md +8 -8
- package/dist/docs/index.js +1 -0
- package/dist/docs/saas-boilerplate.docblock.js +49 -0
- package/dist/index.js +1 -1
- package/package.json +5 -1
- package/src/docs/index.ts +1 -0
- package/src/docs/saas-boilerplate.docblock.ts +98 -0
- package/src/index.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,28 +2,30 @@ $ bun build:bundle && bun build:types
|
|
|
2
2
|
$ tsdown
|
|
3
3
|
[34mℹ[39m tsdown [2mv0.17.0[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
4
4
|
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/saas-boilerplate/tsdown.config.js[24m
|
|
5
|
-
[34mℹ[39m entry: [34msrc/events.ts, src/feature.ts, src/index.ts, src/contracts/billing.ts, src/contracts/index.ts, src/contracts/project.ts, src/
|
|
5
|
+
[34mℹ[39m entry: [34msrc/events.ts, src/feature.ts, src/index.ts, src/contracts/billing.ts, src/contracts/index.ts, src/contracts/project.ts, src/docs/index.ts, src/docs/saas-boilerplate.docblock.ts, src/entities/billing.ts, src/entities/index.ts, src/entities/project.ts, src/entities/settings.ts, src/handlers/billing.handlers.ts, src/handlers/index.ts, src/handlers/mock-data.ts, src/handlers/project.handlers.ts, src/presentations/billing.ts, src/presentations/dashboard.ts, src/presentations/index.ts, src/presentations/project-list.ts[39m
|
|
6
6
|
[34mℹ[39m target: [34mesnext[39m
|
|
7
7
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
8
8
|
[34mℹ[39m Build start
|
|
9
|
-
[34mℹ[39m [2mdist/[22m[1mcontracts/project.js[22m
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mcontracts/billing.js[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[22m[1mevents.js[22m
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[
|
|
14
|
-
[34mℹ[39m [2mdist/[22m[
|
|
15
|
-
[34mℹ[39m [2mdist/[22m[
|
|
16
|
-
[34mℹ[39m [2mdist/[22m[
|
|
17
|
-
[34mℹ[39m [2mdist/[22m[
|
|
18
|
-
[34mℹ[39m [2mdist/[22m[1mentities/
|
|
19
|
-
[34mℹ[39m [2mdist/[22m[
|
|
20
|
-
[34mℹ[39m [2mdist/[22m[
|
|
21
|
-
[34mℹ[39m [2mdist/[22m[
|
|
22
|
-
[34mℹ[39m [2mdist/[22m[
|
|
23
|
-
[34mℹ[39m [2mdist/[22m[
|
|
24
|
-
[34mℹ[39m [2mdist/[22m[
|
|
25
|
-
[34mℹ[39m [2mdist/[22m[
|
|
26
|
-
[34mℹ[39m [2mdist/[22m[1mpresentations/
|
|
27
|
-
[34mℹ[39m
|
|
28
|
-
[
|
|
9
|
+
[34mℹ[39m [2mdist/[22m[1mcontracts/project.js[22m [2m5.13 kB[22m [2m│ gzip: 1.37 kB[22m
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m5.00 kB[22m [2m│ gzip: 1.31 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mcontracts/billing.js[22m [2m4.43 kB[22m [2m│ gzip: 1.25 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22m[1mevents.js[22m [2m3.50 kB[22m [2m│ gzip: 0.76 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/saas-boilerplate.docblock.js[22m [2m3.46 kB[22m [2m│ gzip: 1.38 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1mentities/billing.js[22m [2m2.57 kB[22m [2m│ gzip: 0.94 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1mhandlers/mock-data.js[22m [2m2.06 kB[22m [2m│ gzip: 0.78 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[1mfeature.js[22m [2m1.95 kB[22m [2m│ gzip: 0.52 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22m[1mcontracts/index.js[22m [2m1.70 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22m[1mentities/project.js[22m [2m1.64 kB[22m [2m│ gzip: 0.67 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22m[1mentities/settings.js[22m [2m1.60 kB[22m [2m│ gzip: 0.67 kB[22m
|
|
20
|
+
[34mℹ[39m [2mdist/[22m[1mhandlers/project.handlers.js[22m [2m1.43 kB[22m [2m│ gzip: 0.64 kB[22m
|
|
21
|
+
[34mℹ[39m [2mdist/[22m[1mentities/index.js[22m [2m0.87 kB[22m [2m│ gzip: 0.36 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22m[1mpresentations/project-list.js[22m [2m0.84 kB[22m [2m│ gzip: 0.38 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22m[1mhandlers/index.js[22m [2m0.78 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22m[1mpresentations/billing.js[22m [2m0.77 kB[22m [2m│ gzip: 0.32 kB[22m
|
|
25
|
+
[34mℹ[39m [2mdist/[22m[1mhandlers/billing.handlers.js[22m [2m0.72 kB[22m [2m│ gzip: 0.41 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22m[1mpresentations/dashboard.js[22m [2m0.71 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
27
|
+
[34mℹ[39m [2mdist/[22m[1mpresentations/index.js[22m [2m0.52 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
28
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
29
|
+
[34mℹ[39m 20 files, total: 39.71 kB
|
|
30
|
+
[32m✔[39m Build complete in [32m48ms[39m
|
|
29
31
|
$ tsc --noEmit
|
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# @lssm/example.saas-boilerplate
|
|
2
2
|
|
|
3
|
-
## 0.0.0-canary-
|
|
3
|
+
## 0.0.0-canary-20251212210835
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- 3086383: refactor: dependencies upgrade
|
|
8
8
|
- Updated dependencies [3086383]
|
|
9
|
-
- @lssm/lib.contracts@0.0.0-canary-
|
|
10
|
-
- @lssm/lib.schema@0.0.0-canary-
|
|
11
|
-
- @lssm/lib.jobs@0.0.0-canary-
|
|
12
|
-
- @lssm/lib.bus@0.0.0-canary-
|
|
13
|
-
- @lssm/lib.identity-rbac@0.0.0-canary-
|
|
14
|
-
- @lssm/module.audit-trail@0.0.0-canary-
|
|
15
|
-
- @lssm/module.notifications@0.0.0-canary-
|
|
9
|
+
- @lssm/lib.contracts@0.0.0-canary-20251212210835
|
|
10
|
+
- @lssm/lib.schema@0.0.0-canary-20251212210835
|
|
11
|
+
- @lssm/lib.jobs@0.0.0-canary-20251212210835
|
|
12
|
+
- @lssm/lib.bus@0.0.0-canary-20251212210835
|
|
13
|
+
- @lssm/lib.identity-rbac@0.0.0-canary-20251212210835
|
|
14
|
+
- @lssm/module.audit-trail@0.0.0-canary-20251212210835
|
|
15
|
+
- @lssm/module.notifications@0.0.0-canary-20251212210835
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./saas-boilerplate.docblock.js";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.examples.saas-boilerplate.goal`,title:`SaaS Boilerplate — Goal`,summary:`Multi-tenant SaaS foundation with orgs, members, projects, settings, and usage.`,kind:`goal`,visibility:`public`,route:`/docs/examples/saas-boilerplate/goal`,tags:[`saas`,`goal`],body:`## Why it matters
|
|
2
|
+
- Provides a regenerable SaaS base: orgs, members, projects, settings, usage/billing.
|
|
3
|
+
- Avoids drift across identity, settings, and usage capture.
|
|
4
|
+
|
|
5
|
+
## Business/Product goal
|
|
6
|
+
- Ship SaaS faster with tenant isolation, RBAC, and usage metering baked in.
|
|
7
|
+
- Keep audit/notifications ready for compliance and customer comms.
|
|
8
|
+
|
|
9
|
+
## Success criteria
|
|
10
|
+
- Spec changes to org/project/settings/usage regenerate UI/API/events cleanly.
|
|
11
|
+
- Tenant isolation and RBAC stay enforced; usage data is captured with PII scopes.`},{id:`docs.examples.saas-boilerplate.usage`,title:`SaaS Boilerplate — Usage`,summary:`How to seed, extend, and regenerate the SaaS base.`,kind:`usage`,visibility:`public`,route:`/docs/examples/saas-boilerplate/usage`,tags:[`saas`,`usage`],body:`## Setup
|
|
12
|
+
1) Seed (if available) or create orgs, members, and projects via UI.
|
|
13
|
+
2) Configure Notifications for invites and project events; set policy.pii for sensitive fields.
|
|
14
|
+
|
|
15
|
+
## Extend & regenerate
|
|
16
|
+
1) Adjust schemas (project metadata, settings, usage records) in spec.
|
|
17
|
+
2) Regenerate to sync UI/API/events and usage metering.
|
|
18
|
+
3) Use Feature Flags to roll out new settings or billing fields gradually.
|
|
19
|
+
|
|
20
|
+
## Guardrails
|
|
21
|
+
- Keep tenant/role context explicit in contracts and presentations.
|
|
22
|
+
- Emit events for invites, project changes, and usage records; log in Audit Trail.
|
|
23
|
+
- Redact sensitive user/org data in markdown/JSON outputs.`},{id:`docs.examples.saas-boilerplate.reference`,title:`SaaS Boilerplate — Reference`,summary:`Entities, contracts, events, and presentations for the SaaS starter.`,kind:`reference`,visibility:`public`,route:`/docs/examples/saas-boilerplate`,tags:[`saas`,`reference`],body:`## Entities
|
|
24
|
+
- Organization, Member, Role, Project, AppSettings, UserSettings, BillingUsage.
|
|
25
|
+
|
|
26
|
+
## Contracts
|
|
27
|
+
- org/project CRUD, invites, role assignment, usage recording.
|
|
28
|
+
|
|
29
|
+
## Events
|
|
30
|
+
- org.created, member.invited/accepted, project.created/updated, usage.recorded.
|
|
31
|
+
|
|
32
|
+
## Presentations
|
|
33
|
+
- Org/project dashboards, member management, settings screens, usage views.
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
- Tenant isolation is mandatory; enforce via RBAC/policies.
|
|
37
|
+
- Usage/Metering drives billing/limits; keep units explicit.`},{id:`docs.examples.saas-boilerplate.constraints`,title:`SaaS Boilerplate — Constraints & Safety`,summary:`Internal guardrails for tenancy, RBAC, usage metering, and regeneration.`,kind:`reference`,visibility:`internal`,route:`/docs/examples/saas-boilerplate/constraints`,tags:[`saas`,`constraints`,`internal`],body:`## Constraints
|
|
38
|
+
- Tenant isolation and RBAC must remain explicit in spec; no implicit defaults in code.
|
|
39
|
+
- Events to emit: org.created, member.invited/accepted, project.created/updated, usage.recorded.
|
|
40
|
+
- Regeneration must not change billing/usage semantics without spec diffs.
|
|
41
|
+
|
|
42
|
+
## PII & Settings
|
|
43
|
+
- Mark PII (user emails, names) for redaction; keep settings scoped to org/member.
|
|
44
|
+
- Avoid leaking secrets/config in markdown/JSON presentations.
|
|
45
|
+
|
|
46
|
+
## Verification
|
|
47
|
+
- Add fixtures for usage recording and role changes.
|
|
48
|
+
- Ensure Audit/Notifications remain wired for invites/project updates.
|
|
49
|
+
- Use Feature Flags for new settings/billing fields; default safe/off.`}]);
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ProjectArchivedEvent as e,ProjectCreatedEvent as t,ProjectDeletedEvent as n,ProjectUpdatedEvent as r,SaasBoilerplateEvents as i,SubscriptionChangedEvent as a,UsageLimitReachedEvent as o,UsageRecordedEvent as s}from"./events.js";import{SaasBoilerplateFeature as c}from"./feature.js";import{ProjectEntity as l,ProjectMemberEntity as u,ProjectStatusEnum as d}from"./entities/project.js";import{FeatureFlagEntity as f,SettingsEntity as p,SettingsScopeEnum as m}from"./entities/settings.js";import{BillingUsageEntity as h,SubscriptionEntity as g,SubscriptionStatusEnum as _,UsageLimitEntity as v}from"./entities/billing.js";import{identityRbacEntities as y,identityRbacSchemaContribution as b,saasBoilerplateEntities as x,saasBoilerplateSchemaContribution as S}from"./entities/index.js";import{CreateProjectContract as C,CreateProjectInputModel as w,DeleteProjectContract as T,DeleteProjectInputModel as E,DeleteProjectOutputModel as D,GetProjectContract as O,GetProjectInputModel as k,ListProjectsContract as A,ListProjectsInputModel as j,ListProjectsOutputModel as M,ProjectDeletedPayloadModel as N,ProjectModel as P,ProjectStatusFilterEnum as F,UpdateProjectContract as I,UpdateProjectInputModel as L}from"./contracts/project.js";import{CheckFeatureAccessContract as R,CheckFeatureAccessInputModel as z,CheckFeatureAccessOutputModel as B,FeatureAccessReasonEnum as V,GetSubscriptionContract as ee,GetUsageSummaryContract as H,GetUsageSummaryInputModel as U,GetUsageSummaryOutputModel as W,RecordUsageContract as G,RecordUsageInputModel as K,RecordUsageOutputModel as q,SubscriptionModel as J,UsageRecordedPayloadModel as Y,UsageSummaryModel as X}from"./contracts/billing.js";import"./contracts/index.js";import{MOCK_PROJECTS as Z,MOCK_SUBSCRIPTION as Q,MOCK_USAGE_SUMMARY as $}from"./handlers/mock-data.js";import{mockCreateProjectHandler as te,mockDeleteProjectHandler as ne,mockGetProjectHandler as re,mockListProjectsHandler as ie,mockUpdateProjectHandler as ae}from"./handlers/project.handlers.js";import{mockCheckFeatureAccessHandler as oe,mockGetSubscriptionHandler as se,mockGetUsageSummaryHandler as ce,mockRecordUsageHandler as le}from"./handlers/billing.handlers.js";import{ProjectDetailPresentation as ue,ProjectListPresentation as de}from"./presentations/project-list.js";import{SubscriptionPresentation as fe,UsageDashboardPresentation as pe}from"./presentations/billing.js";import{SaasDashboardPresentation as me,SettingsPanelPresentation as he}from"./presentations/dashboard.js";import{SaasBoilerplatePresentations as ge}from"./presentations/index.js";import{identityRbacSchemaContribution as _e}from"@lssm/lib.identity-rbac";import{jobsSchemaContribution as ve}from"@lssm/lib.jobs";import{auditTrailSchemaContribution as ye}from"@lssm/module.audit-trail";import{notificationsSchemaContribution as be}from"@lssm/module.notifications";const xe={modules:[_e,ve,ye,be,S],provider:`postgresql`,outputPath:`./prisma/schema/generated.prisma`};export{h as BillingUsageEntity,R as CheckFeatureAccessContract,z as CheckFeatureAccessInputModel,B as CheckFeatureAccessOutputModel,C as CreateProjectContract,w as CreateProjectInputModel,T as DeleteProjectContract,E as DeleteProjectInputModel,D as DeleteProjectOutputModel,V as FeatureAccessReasonEnum,f as FeatureFlagEntity,O as GetProjectContract,k as GetProjectInputModel,ee as GetSubscriptionContract,H as GetUsageSummaryContract,U as GetUsageSummaryInputModel,W as GetUsageSummaryOutputModel,A as ListProjectsContract,j as ListProjectsInputModel,M as ListProjectsOutputModel,Z as MOCK_PROJECTS,Q as MOCK_SUBSCRIPTION,$ as MOCK_USAGE_SUMMARY,e as ProjectArchivedEvent,t as ProjectCreatedEvent,n as ProjectDeletedEvent,N as ProjectDeletedPayloadModel,ue as ProjectDetailPresentation,l as ProjectEntity,de as ProjectListPresentation,u as ProjectMemberEntity,P as ProjectModel,d as ProjectStatusEnum,F as ProjectStatusFilterEnum,r as ProjectUpdatedEvent,G as RecordUsageContract,K as RecordUsageInputModel,q as RecordUsageOutputModel,i as SaasBoilerplateEvents,c as SaasBoilerplateFeature,ge as SaasBoilerplatePresentations,me as SaasDashboardPresentation,p as SettingsEntity,he as SettingsPanelPresentation,m as SettingsScopeEnum,a as SubscriptionChangedEvent,g as SubscriptionEntity,J as SubscriptionModel,fe as SubscriptionPresentation,_ as SubscriptionStatusEnum,I as UpdateProjectContract,L as UpdateProjectInputModel,pe as UsageDashboardPresentation,v as UsageLimitEntity,o as UsageLimitReachedEvent,s as UsageRecordedEvent,Y as UsageRecordedPayloadModel,X as UsageSummaryModel,y as identityRbacEntities,b as identityRbacSchemaContribution,oe as mockCheckFeatureAccessHandler,te as mockCreateProjectHandler,ne as mockDeleteProjectHandler,re as mockGetProjectHandler,se as mockGetSubscriptionHandler,ce as mockGetUsageSummaryHandler,ie as mockListProjectsHandler,le as mockRecordUsageHandler,ae as mockUpdateProjectHandler,x as saasBoilerplateEntities,S as saasBoilerplateSchemaContribution,xe as schemaComposition};
|
|
1
|
+
import{ProjectArchivedEvent as e,ProjectCreatedEvent as t,ProjectDeletedEvent as n,ProjectUpdatedEvent as r,SaasBoilerplateEvents as i,SubscriptionChangedEvent as a,UsageLimitReachedEvent as o,UsageRecordedEvent as s}from"./events.js";import{SaasBoilerplateFeature as c}from"./feature.js";import{ProjectEntity as l,ProjectMemberEntity as u,ProjectStatusEnum as d}from"./entities/project.js";import{FeatureFlagEntity as f,SettingsEntity as p,SettingsScopeEnum as m}from"./entities/settings.js";import{BillingUsageEntity as h,SubscriptionEntity as g,SubscriptionStatusEnum as _,UsageLimitEntity as v}from"./entities/billing.js";import{identityRbacEntities as y,identityRbacSchemaContribution as b,saasBoilerplateEntities as x,saasBoilerplateSchemaContribution as S}from"./entities/index.js";import{CreateProjectContract as C,CreateProjectInputModel as w,DeleteProjectContract as T,DeleteProjectInputModel as E,DeleteProjectOutputModel as D,GetProjectContract as O,GetProjectInputModel as k,ListProjectsContract as A,ListProjectsInputModel as j,ListProjectsOutputModel as M,ProjectDeletedPayloadModel as N,ProjectModel as P,ProjectStatusFilterEnum as F,UpdateProjectContract as I,UpdateProjectInputModel as L}from"./contracts/project.js";import{CheckFeatureAccessContract as R,CheckFeatureAccessInputModel as z,CheckFeatureAccessOutputModel as B,FeatureAccessReasonEnum as V,GetSubscriptionContract as ee,GetUsageSummaryContract as H,GetUsageSummaryInputModel as U,GetUsageSummaryOutputModel as W,RecordUsageContract as G,RecordUsageInputModel as K,RecordUsageOutputModel as q,SubscriptionModel as J,UsageRecordedPayloadModel as Y,UsageSummaryModel as X}from"./contracts/billing.js";import"./contracts/index.js";import{MOCK_PROJECTS as Z,MOCK_SUBSCRIPTION as Q,MOCK_USAGE_SUMMARY as $}from"./handlers/mock-data.js";import{mockCreateProjectHandler as te,mockDeleteProjectHandler as ne,mockGetProjectHandler as re,mockListProjectsHandler as ie,mockUpdateProjectHandler as ae}from"./handlers/project.handlers.js";import{mockCheckFeatureAccessHandler as oe,mockGetSubscriptionHandler as se,mockGetUsageSummaryHandler as ce,mockRecordUsageHandler as le}from"./handlers/billing.handlers.js";import{ProjectDetailPresentation as ue,ProjectListPresentation as de}from"./presentations/project-list.js";import{SubscriptionPresentation as fe,UsageDashboardPresentation as pe}from"./presentations/billing.js";import{SaasDashboardPresentation as me,SettingsPanelPresentation as he}from"./presentations/dashboard.js";import{SaasBoilerplatePresentations as ge}from"./presentations/index.js";import"./docs/index.js";import{identityRbacSchemaContribution as _e}from"@lssm/lib.identity-rbac";import{jobsSchemaContribution as ve}from"@lssm/lib.jobs";import{auditTrailSchemaContribution as ye}from"@lssm/module.audit-trail";import{notificationsSchemaContribution as be}from"@lssm/module.notifications";const xe={modules:[_e,ve,ye,be,S],provider:`postgresql`,outputPath:`./prisma/schema/generated.prisma`};export{h as BillingUsageEntity,R as CheckFeatureAccessContract,z as CheckFeatureAccessInputModel,B as CheckFeatureAccessOutputModel,C as CreateProjectContract,w as CreateProjectInputModel,T as DeleteProjectContract,E as DeleteProjectInputModel,D as DeleteProjectOutputModel,V as FeatureAccessReasonEnum,f as FeatureFlagEntity,O as GetProjectContract,k as GetProjectInputModel,ee as GetSubscriptionContract,H as GetUsageSummaryContract,U as GetUsageSummaryInputModel,W as GetUsageSummaryOutputModel,A as ListProjectsContract,j as ListProjectsInputModel,M as ListProjectsOutputModel,Z as MOCK_PROJECTS,Q as MOCK_SUBSCRIPTION,$ as MOCK_USAGE_SUMMARY,e as ProjectArchivedEvent,t as ProjectCreatedEvent,n as ProjectDeletedEvent,N as ProjectDeletedPayloadModel,ue as ProjectDetailPresentation,l as ProjectEntity,de as ProjectListPresentation,u as ProjectMemberEntity,P as ProjectModel,d as ProjectStatusEnum,F as ProjectStatusFilterEnum,r as ProjectUpdatedEvent,G as RecordUsageContract,K as RecordUsageInputModel,q as RecordUsageOutputModel,i as SaasBoilerplateEvents,c as SaasBoilerplateFeature,ge as SaasBoilerplatePresentations,me as SaasDashboardPresentation,p as SettingsEntity,he as SettingsPanelPresentation,m as SettingsScopeEnum,a as SubscriptionChangedEvent,g as SubscriptionEntity,J as SubscriptionModel,fe as SubscriptionPresentation,_ as SubscriptionStatusEnum,I as UpdateProjectContract,L as UpdateProjectInputModel,pe as UsageDashboardPresentation,v as UsageLimitEntity,o as UsageLimitReachedEvent,s as UsageRecordedEvent,Y as UsageRecordedPayloadModel,X as UsageSummaryModel,y as identityRbacEntities,b as identityRbacSchemaContribution,oe as mockCheckFeatureAccessHandler,te as mockCreateProjectHandler,ne as mockDeleteProjectHandler,re as mockGetProjectHandler,se as mockGetSubscriptionHandler,ce as mockGetUsageSummaryHandler,ie as mockListProjectsHandler,le as mockRecordUsageHandler,ae as mockUpdateProjectHandler,x as saasBoilerplateEntities,S as saasBoilerplateSchemaContribution,xe as schemaComposition};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/example.saas-boilerplate",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251212210835",
|
|
4
4
|
"description": "SaaS Boilerplate - Users, Orgs, Projects, Billing, Settings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
"./contracts": "./src/contracts/index.ts",
|
|
11
11
|
"./contracts/billing": "./src/contracts/billing.ts",
|
|
12
12
|
"./contracts/project": "./src/contracts/project.ts",
|
|
13
|
+
"./docs": "./src/docs/index.ts",
|
|
14
|
+
"./docs/saas-boilerplate.docblock": "./src/docs/saas-boilerplate.docblock.ts",
|
|
13
15
|
"./entities": "./src/entities/index.ts",
|
|
14
16
|
"./entities/billing": "./src/entities/billing.ts",
|
|
15
17
|
"./entities/project": "./src/entities/project.ts",
|
|
@@ -60,6 +62,8 @@
|
|
|
60
62
|
"./contracts": "./dist/contracts/index.js",
|
|
61
63
|
"./contracts/billing": "./dist/contracts/billing.js",
|
|
62
64
|
"./contracts/project": "./dist/contracts/project.js",
|
|
65
|
+
"./docs": "./dist/docs/index.js",
|
|
66
|
+
"./docs/saas-boilerplate.docblock": "./dist/docs/saas-boilerplate.docblock.js",
|
|
63
67
|
"./entities": "./dist/entities/index.js",
|
|
64
68
|
"./entities/billing": "./dist/entities/billing.js",
|
|
65
69
|
"./entities/project": "./dist/entities/project.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './saas-boilerplate.docblock';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { DocBlock } from '@lssm/lib.contracts/docs';
|
|
2
|
+
import { registerDocBlocks } from '@lssm/lib.contracts/docs';
|
|
3
|
+
|
|
4
|
+
const saasBoilerplateDocBlocks: DocBlock[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.examples.saas-boilerplate.goal',
|
|
7
|
+
title: 'SaaS Boilerplate — Goal',
|
|
8
|
+
summary:
|
|
9
|
+
'Multi-tenant SaaS foundation with orgs, members, projects, settings, and usage.',
|
|
10
|
+
kind: 'goal',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/examples/saas-boilerplate/goal',
|
|
13
|
+
tags: ['saas', 'goal'],
|
|
14
|
+
body: `## Why it matters
|
|
15
|
+
- Provides a regenerable SaaS base: orgs, members, projects, settings, usage/billing.
|
|
16
|
+
- Avoids drift across identity, settings, and usage capture.
|
|
17
|
+
|
|
18
|
+
## Business/Product goal
|
|
19
|
+
- Ship SaaS faster with tenant isolation, RBAC, and usage metering baked in.
|
|
20
|
+
- Keep audit/notifications ready for compliance and customer comms.
|
|
21
|
+
|
|
22
|
+
## Success criteria
|
|
23
|
+
- Spec changes to org/project/settings/usage regenerate UI/API/events cleanly.
|
|
24
|
+
- Tenant isolation and RBAC stay enforced; usage data is captured with PII scopes.`,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'docs.examples.saas-boilerplate.usage',
|
|
28
|
+
title: 'SaaS Boilerplate — Usage',
|
|
29
|
+
summary: 'How to seed, extend, and regenerate the SaaS base.',
|
|
30
|
+
kind: 'usage',
|
|
31
|
+
visibility: 'public',
|
|
32
|
+
route: '/docs/examples/saas-boilerplate/usage',
|
|
33
|
+
tags: ['saas', 'usage'],
|
|
34
|
+
body: `## Setup
|
|
35
|
+
1) Seed (if available) or create orgs, members, and projects via UI.
|
|
36
|
+
2) Configure Notifications for invites and project events; set policy.pii for sensitive fields.
|
|
37
|
+
|
|
38
|
+
## Extend & regenerate
|
|
39
|
+
1) Adjust schemas (project metadata, settings, usage records) in spec.
|
|
40
|
+
2) Regenerate to sync UI/API/events and usage metering.
|
|
41
|
+
3) Use Feature Flags to roll out new settings or billing fields gradually.
|
|
42
|
+
|
|
43
|
+
## Guardrails
|
|
44
|
+
- Keep tenant/role context explicit in contracts and presentations.
|
|
45
|
+
- Emit events for invites, project changes, and usage records; log in Audit Trail.
|
|
46
|
+
- Redact sensitive user/org data in markdown/JSON outputs.`,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'docs.examples.saas-boilerplate.reference',
|
|
50
|
+
title: 'SaaS Boilerplate — Reference',
|
|
51
|
+
summary:
|
|
52
|
+
'Entities, contracts, events, and presentations for the SaaS starter.',
|
|
53
|
+
kind: 'reference',
|
|
54
|
+
visibility: 'public',
|
|
55
|
+
route: '/docs/examples/saas-boilerplate',
|
|
56
|
+
tags: ['saas', 'reference'],
|
|
57
|
+
body: `## Entities
|
|
58
|
+
- Organization, Member, Role, Project, AppSettings, UserSettings, BillingUsage.
|
|
59
|
+
|
|
60
|
+
## Contracts
|
|
61
|
+
- org/project CRUD, invites, role assignment, usage recording.
|
|
62
|
+
|
|
63
|
+
## Events
|
|
64
|
+
- org.created, member.invited/accepted, project.created/updated, usage.recorded.
|
|
65
|
+
|
|
66
|
+
## Presentations
|
|
67
|
+
- Org/project dashboards, member management, settings screens, usage views.
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
- Tenant isolation is mandatory; enforce via RBAC/policies.
|
|
71
|
+
- Usage/Metering drives billing/limits; keep units explicit.`,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'docs.examples.saas-boilerplate.constraints',
|
|
75
|
+
title: 'SaaS Boilerplate — Constraints & Safety',
|
|
76
|
+
summary:
|
|
77
|
+
'Internal guardrails for tenancy, RBAC, usage metering, and regeneration.',
|
|
78
|
+
kind: 'reference',
|
|
79
|
+
visibility: 'internal',
|
|
80
|
+
route: '/docs/examples/saas-boilerplate/constraints',
|
|
81
|
+
tags: ['saas', 'constraints', 'internal'],
|
|
82
|
+
body: `## Constraints
|
|
83
|
+
- Tenant isolation and RBAC must remain explicit in spec; no implicit defaults in code.
|
|
84
|
+
- Events to emit: org.created, member.invited/accepted, project.created/updated, usage.recorded.
|
|
85
|
+
- Regeneration must not change billing/usage semantics without spec diffs.
|
|
86
|
+
|
|
87
|
+
## PII & Settings
|
|
88
|
+
- Mark PII (user emails, names) for redaction; keep settings scoped to org/member.
|
|
89
|
+
- Avoid leaking secrets/config in markdown/JSON presentations.
|
|
90
|
+
|
|
91
|
+
## Verification
|
|
92
|
+
- Add fixtures for usage recording and role changes.
|
|
93
|
+
- Ensure Audit/Notifications remain wired for invites/project updates.
|
|
94
|
+
- Use Feature Flags for new settings/billing fields; default safe/off.`,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
registerDocBlocks(saasBoilerplateDocBlocks);
|
package/src/index.ts
CHANGED