@lssm/example.saas-boilerplate 0.0.0-canary-20251210171026 → 0.0.0-canary-20251212004227

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.
@@ -2,28 +2,30 @@ $ bun build:bundle && bun build:types
2
2
  $ tsdown
3
3
  ℹ tsdown v0.17.0 powered by rolldown v1.0.0-beta.53
4
4
  ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/saas-boilerplate/tsdown.config.js
5
- ℹ entry: src/events.ts, src/feature.ts, src/index.ts, src/contracts/billing.ts, src/contracts/index.ts, src/contracts/project.ts, src/handlers/billing.handlers.ts, src/handlers/index.ts, src/handlers/mock-data.ts, src/handlers/project.handlers.ts, src/entities/billing.ts, src/entities/index.ts, src/entities/project.ts, src/entities/settings.ts, src/presentations/billing.ts, src/presentations/dashboard.ts, src/presentations/index.ts, src/presentations/project-list.ts
5
+ ℹ entry: src/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
6
6
  ℹ target: esnext
7
7
  ℹ tsconfig: tsconfig.json
8
8
  ℹ Build start
9
- ℹ dist/contracts/project.js 5.13 kB │ gzip: 1.37 kB
10
- ℹ dist/index.js 4.98 kB │ gzip: 1.30 kB
11
- ℹ dist/contracts/billing.js 4.43 kB │ gzip: 1.25 kB
12
- ℹ dist/events.js 3.50 kB │ gzip: 0.76 kB
13
- ℹ dist/entities/billing.js 2.57 kB │ gzip: 0.94 kB
14
- ℹ dist/handlers/mock-data.js 2.06 kB │ gzip: 0.78 kB
15
- ℹ dist/feature.js 1.95 kB │ gzip: 0.52 kB
16
- ℹ dist/contracts/index.js 1.70 kB │ gzip: 0.44 kB
17
- ℹ dist/entities/project.js 1.64 kB │ gzip: 0.67 kB
18
- ℹ dist/entities/settings.js 1.60 kB │ gzip: 0.67 kB
19
- ℹ dist/handlers/project.handlers.js 1.43 kB │ gzip: 0.64 kB
20
- ℹ dist/entities/index.js 0.87 kB │ gzip: 0.36 kB
21
- ℹ dist/presentations/project-list.js 0.84 kB │ gzip: 0.38 kB
22
- ℹ dist/handlers/index.js 0.78 kB │ gzip: 0.30 kB
23
- ℹ dist/presentations/billing.js 0.77 kB │ gzip: 0.32 kB
24
- ℹ dist/handlers/billing.handlers.js 0.72 kB │ gzip: 0.41 kB
25
- ℹ dist/presentations/dashboard.js 0.71 kB │ gzip: 0.33 kB
26
- ℹ dist/presentations/index.js 0.52 kB │ gzip: 0.21 kB
27
- ℹ 18 files, total: 36.18 kB
28
- ✔ Build complete in 56ms
9
+ ℹ dist/contracts/project.js 5.13 kB │ gzip: 1.37 kB
10
+ ℹ dist/index.js 5.00 kB │ gzip: 1.31 kB
11
+ ℹ dist/contracts/billing.js 4.43 kB │ gzip: 1.25 kB
12
+ ℹ dist/events.js 3.50 kB │ gzip: 0.76 kB
13
+ ℹ dist/docs/saas-boilerplate.docblock.js 3.46 kB │ gzip: 1.38 kB
14
+ ℹ dist/entities/billing.js 2.57 kB │ gzip: 0.94 kB
15
+ ℹ dist/handlers/mock-data.js 2.06 kB │ gzip: 0.78 kB
16
+ ℹ dist/feature.js 1.95 kB │ gzip: 0.52 kB
17
+ ℹ dist/contracts/index.js 1.70 kB │ gzip: 0.44 kB
18
+ ℹ dist/entities/project.js 1.64 kB │ gzip: 0.67 kB
19
+ ℹ dist/entities/settings.js 1.60 kB │ gzip: 0.67 kB
20
+ ℹ dist/handlers/project.handlers.js 1.43 kB │ gzip: 0.64 kB
21
+ ℹ dist/entities/index.js 0.87 kB │ gzip: 0.36 kB
22
+ ℹ dist/presentations/project-list.js 0.84 kB │ gzip: 0.38 kB
23
+ ℹ dist/handlers/index.js 0.78 kB │ gzip: 0.30 kB
24
+ ℹ dist/presentations/billing.js 0.77 kB │ gzip: 0.32 kB
25
+ ℹ dist/handlers/billing.handlers.js 0.72 kB │ gzip: 0.41 kB
26
+ ℹ dist/presentations/dashboard.js 0.71 kB │ gzip: 0.33 kB
27
+ ℹ dist/presentations/index.js 0.52 kB │ gzip: 0.21 kB
28
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
29
+ ℹ 20 files, total: 39.71 kB
30
+ ✔ Build complete in 65ms
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-20251210171026
3
+ ## 0.0.0-canary-20251212004227
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-20251210171026
10
- - @lssm/lib.schema@0.0.0-canary-20251210171026
11
- - @lssm/lib.jobs@0.0.0-canary-20251210171026
12
- - @lssm/lib.bus@0.0.0-canary-20251210171026
13
- - @lssm/lib.identity-rbac@0.0.0-canary-20251210171026
14
- - @lssm/module.audit-trail@0.0.0-canary-20251210171026
15
- - @lssm/module.notifications@0.0.0-canary-20251210171026
9
+ - @lssm/lib.contracts@0.0.0-canary-20251212004227
10
+ - @lssm/lib.schema@0.0.0-canary-20251212004227
11
+ - @lssm/lib.jobs@0.0.0-canary-20251212004227
12
+ - @lssm/lib.bus@0.0.0-canary-20251212004227
13
+ - @lssm/lib.identity-rbac@0.0.0-canary-20251212004227
14
+ - @lssm/module.audit-trail@0.0.0-canary-20251212004227
15
+ - @lssm/module.notifications@0.0.0-canary-20251212004227
@@ -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-20251210171026",
3
+ "version": "0.0.0-canary-20251212004227",
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
@@ -7,6 +7,7 @@ export * from './events';
7
7
  export * from './handlers';
8
8
  export * from './presentations';
9
9
  export * from './feature';
10
+ import './docs';
10
11
 
11
12
  // Schema composition configuration
12
13
  import { identityRbacSchemaContribution } from '@lssm/lib.identity-rbac';