@contractspec/example.saas-boilerplate 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build$colon$bundle.log +113 -0
- package/.turbo/turbo-build.log +114 -0
- package/CHANGELOG.md +246 -0
- package/LICENSE +21 -0
- package/README.md +156 -0
- package/dist/billing/billing.entity.d.ts +61 -0
- package/dist/billing/billing.entity.d.ts.map +1 -0
- package/dist/billing/billing.entity.js +122 -0
- package/dist/billing/billing.entity.js.map +1 -0
- package/dist/billing/billing.enum.d.ts +16 -0
- package/dist/billing/billing.enum.d.ts.map +1 -0
- package/dist/billing/billing.enum.js +27 -0
- package/dist/billing/billing.enum.js.map +1 -0
- package/dist/billing/billing.event.d.ts +86 -0
- package/dist/billing/billing.event.d.ts.map +1 -0
- package/dist/billing/billing.event.js +153 -0
- package/dist/billing/billing.event.js.map +1 -0
- package/dist/billing/billing.handler.d.ts +82 -0
- package/dist/billing/billing.handler.d.ts.map +1 -0
- package/dist/billing/billing.handler.js +58 -0
- package/dist/billing/billing.handler.js.map +1 -0
- package/dist/billing/billing.operations.d.ts +166 -0
- package/dist/billing/billing.operations.d.ts.map +1 -0
- package/dist/billing/billing.operations.js +181 -0
- package/dist/billing/billing.operations.js.map +1 -0
- package/dist/billing/billing.presentation.d.ts +15 -0
- package/dist/billing/billing.presentation.d.ts.map +1 -0
- package/dist/billing/billing.presentation.js +59 -0
- package/dist/billing/billing.presentation.js.map +1 -0
- package/dist/billing/billing.schema.d.ts +201 -0
- package/dist/billing/billing.schema.d.ts.map +1 -0
- package/dist/billing/billing.schema.js +214 -0
- package/dist/billing/billing.schema.js.map +1 -0
- package/dist/billing/index.d.ts +8 -0
- package/dist/billing/index.js +9 -0
- package/dist/dashboard/dashboard.presentation.d.ts +15 -0
- package/dist/dashboard/dashboard.presentation.d.ts.map +1 -0
- package/dist/dashboard/dashboard.presentation.js +55 -0
- package/dist/dashboard/dashboard.presentation.js.map +1 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.js +3 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/saas-boilerplate.docblock.d.ts +1 -0
- package/dist/docs/saas-boilerplate.docblock.js +100 -0
- package/dist/docs/saas-boilerplate.docblock.js.map +1 -0
- package/dist/example.d.ts +37 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +46 -0
- package/dist/example.js.map +1 -0
- package/dist/handlers/index.d.ts +3 -0
- package/dist/handlers/index.js +4 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/presentations/index.d.ts +17 -0
- package/dist/presentations/index.d.ts.map +1 -0
- package/dist/presentations/index.js +17 -0
- package/dist/presentations/index.js.map +1 -0
- package/dist/project/index.d.ts +8 -0
- package/dist/project/index.js +9 -0
- package/dist/project/project.entity.d.ts +40 -0
- package/dist/project/project.entity.d.ts.map +1 -0
- package/dist/project/project.entity.js +85 -0
- package/dist/project/project.entity.js.map +1 -0
- package/dist/project/project.enum.d.ts +16 -0
- package/dist/project/project.enum.d.ts.map +1 -0
- package/dist/project/project.enum.js +26 -0
- package/dist/project/project.enum.js.map +1 -0
- package/dist/project/project.event.d.ts +92 -0
- package/dist/project/project.event.d.ts.map +1 -0
- package/dist/project/project.event.js +165 -0
- package/dist/project/project.event.js.map +1 -0
- package/dist/project/project.handler.d.ts +72 -0
- package/dist/project/project.handler.d.ts.map +1 -0
- package/dist/project/project.handler.js +82 -0
- package/dist/project/project.handler.js.map +1 -0
- package/dist/project/project.operations.d.ts +419 -0
- package/dist/project/project.operations.d.ts.map +1 -0
- package/dist/project/project.operations.js +260 -0
- package/dist/project/project.operations.js.map +1 -0
- package/dist/project/project.presentation.d.ts +15 -0
- package/dist/project/project.presentation.d.ts.map +1 -0
- package/dist/project/project.presentation.js +65 -0
- package/dist/project/project.presentation.js.map +1 -0
- package/dist/project/project.schema.d.ts +235 -0
- package/dist/project/project.schema.d.ts.map +1 -0
- package/dist/project/project.schema.js +215 -0
- package/dist/project/project.schema.js.map +1 -0
- package/dist/saas-boilerplate.feature.d.ts +12 -0
- package/dist/saas-boilerplate.feature.d.ts.map +1 -0
- package/dist/saas-boilerplate.feature.js +201 -0
- package/dist/saas-boilerplate.feature.js.map +1 -0
- package/dist/settings/index.d.ts +3 -0
- package/dist/settings/index.js +4 -0
- package/dist/settings/settings.entity.d.ts +37 -0
- package/dist/settings/settings.entity.d.ts.map +1 -0
- package/dist/settings/settings.entity.js +78 -0
- package/dist/settings/settings.entity.js.map +1 -0
- package/dist/settings/settings.enum.d.ts +10 -0
- package/dist/settings/settings.enum.d.ts.map +1 -0
- package/dist/settings/settings.enum.js +21 -0
- package/dist/settings/settings.enum.js.map +1 -0
- package/dist/shared/mock-data.d.ts +86 -0
- package/dist/shared/mock-data.d.ts.map +1 -0
- package/dist/shared/mock-data.js +138 -0
- package/dist/shared/mock-data.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +113 -0
- package/src/billing/billing.entity.ts +158 -0
- package/src/billing/billing.enum.ts +23 -0
- package/src/billing/billing.event.ts +108 -0
- package/src/billing/billing.handler.ts +137 -0
- package/src/billing/billing.operations.ts +187 -0
- package/src/billing/billing.presentation.ts +57 -0
- package/src/billing/billing.schema.ts +133 -0
- package/src/billing/index.ts +64 -0
- package/src/dashboard/dashboard.presentation.ts +57 -0
- package/src/dashboard/index.ts +8 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/saas-boilerplate.docblock.ts +98 -0
- package/src/example.ts +31 -0
- package/src/handlers/index.ts +20 -0
- package/src/index.ts +71 -0
- package/src/presentations/index.ts +36 -0
- package/src/project/index.ts +66 -0
- package/src/project/project.entity.ts +93 -0
- package/src/project/project.enum.ts +22 -0
- package/src/project/project.event.ts +128 -0
- package/src/project/project.handler.ts +168 -0
- package/src/project/project.operations.ts +272 -0
- package/src/project/project.presentation.ts +59 -0
- package/src/project/project.schema.ts +147 -0
- package/src/saas-boilerplate.feature.ts +109 -0
- package/src/settings/index.ts +9 -0
- package/src/settings/settings.entity.ts +89 -0
- package/src/settings/settings.enum.ts +11 -0
- package/src/shared/mock-data.ts +110 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +7 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { FeatureAccessReasonEnum, SubscriptionStatusSchemaEnum } from "./billing.enum.js";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/billing/billing.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* Organization subscription details schema.
|
|
7
|
+
*/
|
|
8
|
+
const SubscriptionModel = defineSchemaModel({
|
|
9
|
+
name: "Subscription",
|
|
10
|
+
description: "Organization subscription details",
|
|
11
|
+
fields: {
|
|
12
|
+
id: {
|
|
13
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
14
|
+
isOptional: false
|
|
15
|
+
},
|
|
16
|
+
organizationId: {
|
|
17
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
+
isOptional: false
|
|
19
|
+
},
|
|
20
|
+
planId: {
|
|
21
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
22
|
+
isOptional: false
|
|
23
|
+
},
|
|
24
|
+
planName: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: false
|
|
27
|
+
},
|
|
28
|
+
status: {
|
|
29
|
+
type: SubscriptionStatusSchemaEnum,
|
|
30
|
+
isOptional: false
|
|
31
|
+
},
|
|
32
|
+
currentPeriodStart: {
|
|
33
|
+
type: ScalarTypeEnum.DateTime(),
|
|
34
|
+
isOptional: false
|
|
35
|
+
},
|
|
36
|
+
currentPeriodEnd: {
|
|
37
|
+
type: ScalarTypeEnum.DateTime(),
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
trialEndsAt: {
|
|
41
|
+
type: ScalarTypeEnum.DateTime(),
|
|
42
|
+
isOptional: true
|
|
43
|
+
},
|
|
44
|
+
cancelAtPeriodEnd: {
|
|
45
|
+
type: ScalarTypeEnum.Boolean(),
|
|
46
|
+
isOptional: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Usage summary for a feature schema.
|
|
52
|
+
*/
|
|
53
|
+
const UsageSummaryModel = defineSchemaModel({
|
|
54
|
+
name: "UsageSummary",
|
|
55
|
+
description: "Usage summary for a feature",
|
|
56
|
+
fields: {
|
|
57
|
+
feature: {
|
|
58
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
59
|
+
isOptional: false
|
|
60
|
+
},
|
|
61
|
+
used: {
|
|
62
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
63
|
+
isOptional: false
|
|
64
|
+
},
|
|
65
|
+
limit: {
|
|
66
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
67
|
+
isOptional: true
|
|
68
|
+
},
|
|
69
|
+
unit: {
|
|
70
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
71
|
+
isOptional: true
|
|
72
|
+
},
|
|
73
|
+
percentage: {
|
|
74
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
75
|
+
isOptional: true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Input for recording feature usage.
|
|
81
|
+
*/
|
|
82
|
+
const RecordUsageInputModel = defineSchemaModel({
|
|
83
|
+
name: "RecordUsageInput",
|
|
84
|
+
description: "Input for recording feature usage",
|
|
85
|
+
fields: {
|
|
86
|
+
feature: {
|
|
87
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
88
|
+
isOptional: false
|
|
89
|
+
},
|
|
90
|
+
quantity: {
|
|
91
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
92
|
+
isOptional: false
|
|
93
|
+
},
|
|
94
|
+
sourceId: {
|
|
95
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
96
|
+
isOptional: true
|
|
97
|
+
},
|
|
98
|
+
sourceType: {
|
|
99
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
100
|
+
isOptional: true
|
|
101
|
+
},
|
|
102
|
+
metadata: {
|
|
103
|
+
type: ScalarTypeEnum.JSONObject(),
|
|
104
|
+
isOptional: true
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* Output for recording feature usage.
|
|
110
|
+
*/
|
|
111
|
+
const RecordUsageOutputModel = defineSchemaModel({
|
|
112
|
+
name: "RecordUsageOutput",
|
|
113
|
+
description: "Output for recording feature usage",
|
|
114
|
+
fields: {
|
|
115
|
+
recorded: {
|
|
116
|
+
type: ScalarTypeEnum.Boolean(),
|
|
117
|
+
isOptional: false
|
|
118
|
+
},
|
|
119
|
+
currentUsage: {
|
|
120
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
121
|
+
isOptional: false
|
|
122
|
+
},
|
|
123
|
+
limit: {
|
|
124
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
125
|
+
isOptional: true
|
|
126
|
+
},
|
|
127
|
+
limitReached: {
|
|
128
|
+
type: ScalarTypeEnum.Boolean(),
|
|
129
|
+
isOptional: false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* Payload for usage.recorded event.
|
|
135
|
+
*/
|
|
136
|
+
const UsageRecordedPayloadModel = defineSchemaModel({
|
|
137
|
+
name: "UsageRecordedPayload",
|
|
138
|
+
description: "Payload for usage.recorded event",
|
|
139
|
+
fields: {
|
|
140
|
+
feature: {
|
|
141
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
142
|
+
isOptional: false
|
|
143
|
+
},
|
|
144
|
+
quantity: {
|
|
145
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
146
|
+
isOptional: false
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* Input for getting usage summary.
|
|
152
|
+
*/
|
|
153
|
+
const GetUsageSummaryInputModel = defineSchemaModel({
|
|
154
|
+
name: "GetUsageSummaryInput",
|
|
155
|
+
description: "Input for getting usage summary",
|
|
156
|
+
fields: { billingPeriod: {
|
|
157
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
158
|
+
isOptional: true
|
|
159
|
+
} }
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* Output for usage summary.
|
|
163
|
+
*/
|
|
164
|
+
const GetUsageSummaryOutputModel = defineSchemaModel({
|
|
165
|
+
name: "GetUsageSummaryOutput",
|
|
166
|
+
description: "Output for usage summary",
|
|
167
|
+
fields: {
|
|
168
|
+
billingPeriod: {
|
|
169
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
170
|
+
isOptional: false
|
|
171
|
+
},
|
|
172
|
+
usage: {
|
|
173
|
+
type: UsageSummaryModel,
|
|
174
|
+
isArray: true,
|
|
175
|
+
isOptional: false
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* Input for checking feature access.
|
|
181
|
+
*/
|
|
182
|
+
const CheckFeatureAccessInputModel = defineSchemaModel({
|
|
183
|
+
name: "CheckFeatureAccessInput",
|
|
184
|
+
description: "Input for checking feature access",
|
|
185
|
+
fields: { feature: {
|
|
186
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
187
|
+
isOptional: false
|
|
188
|
+
} }
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* Output for feature access check.
|
|
192
|
+
*/
|
|
193
|
+
const CheckFeatureAccessOutputModel = defineSchemaModel({
|
|
194
|
+
name: "CheckFeatureAccessOutput",
|
|
195
|
+
description: "Output for feature access check",
|
|
196
|
+
fields: {
|
|
197
|
+
hasAccess: {
|
|
198
|
+
type: ScalarTypeEnum.Boolean(),
|
|
199
|
+
isOptional: false
|
|
200
|
+
},
|
|
201
|
+
reason: {
|
|
202
|
+
type: FeatureAccessReasonEnum,
|
|
203
|
+
isOptional: true
|
|
204
|
+
},
|
|
205
|
+
upgradeUrl: {
|
|
206
|
+
type: ScalarTypeEnum.URL(),
|
|
207
|
+
isOptional: true
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
//#endregion
|
|
213
|
+
export { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel };
|
|
214
|
+
//# sourceMappingURL=billing.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.schema.js","names":[],"sources":["../../src/billing/billing.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport {\n SubscriptionStatusSchemaEnum,\n FeatureAccessReasonEnum,\n} from './billing.enum';\n\n/**\n * Organization subscription details schema.\n */\nexport const SubscriptionModel = defineSchemaModel({\n name: 'Subscription',\n description: 'Organization subscription details',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n planId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n planName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: SubscriptionStatusSchemaEnum, isOptional: false },\n currentPeriodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n currentPeriodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n trialEndsAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n cancelAtPeriodEnd: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n/**\n * Usage summary for a feature schema.\n */\nexport const UsageSummaryModel = defineSchemaModel({\n name: 'UsageSummary',\n description: 'Usage summary for a feature',\n fields: {\n feature: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n used: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n percentage: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for recording feature usage.\n */\nexport const RecordUsageInputModel = defineSchemaModel({\n name: 'RecordUsageInput',\n description: 'Input for recording feature usage',\n fields: {\n feature: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n sourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n },\n});\n\n/**\n * Output for recording feature usage.\n */\nexport const RecordUsageOutputModel = defineSchemaModel({\n name: 'RecordUsageOutput',\n description: 'Output for recording feature usage',\n fields: {\n recorded: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n currentUsage: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n limitReached: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n/**\n * Payload for usage.recorded event.\n */\nexport const UsageRecordedPayloadModel = defineSchemaModel({\n name: 'UsageRecordedPayload',\n description: 'Payload for usage.recorded event',\n fields: {\n feature: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\n/**\n * Input for getting usage summary.\n */\nexport const GetUsageSummaryInputModel = defineSchemaModel({\n name: 'GetUsageSummaryInput',\n description: 'Input for getting usage summary',\n fields: {\n billingPeriod: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Output for usage summary.\n */\nexport const GetUsageSummaryOutputModel = defineSchemaModel({\n name: 'GetUsageSummaryOutput',\n description: 'Output for usage summary',\n fields: {\n billingPeriod: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n usage: { type: UsageSummaryModel, isArray: true, isOptional: false },\n },\n});\n\n/**\n * Input for checking feature access.\n */\nexport const CheckFeatureAccessInputModel = defineSchemaModel({\n name: 'CheckFeatureAccessInput',\n description: 'Input for checking feature access',\n fields: {\n feature: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n/**\n * Output for feature access check.\n */\nexport const CheckFeatureAccessOutputModel = defineSchemaModel({\n name: 'CheckFeatureAccessOutput',\n description: 'Output for feature access check',\n fields: {\n hasAccess: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n reason: { type: FeatureAccessReasonEnum, isOptional: true },\n upgradeUrl: { type: ScalarTypeEnum.URL(), isOptional: true },\n },\n});\n"],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BillingUsageEntity, SubscriptionEntity, SubscriptionStatusEnum, UsageLimitEntity } from "./billing.entity.js";
|
|
2
|
+
import { FeatureAccessReasonEnum, SubscriptionStatusSchemaEnum } from "./billing.enum.js";
|
|
3
|
+
import { SubscriptionChangedEvent, UsageLimitReachedEvent, UsageRecordedEvent } from "./billing.event.js";
|
|
4
|
+
import { CheckFeatureAccessInput, CheckFeatureAccessOutput, RecordUsageInput, Subscription, UsageSummary, mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler } from "./billing.handler.js";
|
|
5
|
+
import { CheckFeatureAccessContract, GetSubscriptionContract, GetUsageSummaryContract, RecordUsageContract } from "./billing.operations.js";
|
|
6
|
+
import { SubscriptionPresentation, UsageDashboardPresentation } from "./billing.presentation.js";
|
|
7
|
+
import { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel } from "./billing.schema.js";
|
|
8
|
+
export { BillingUsageEntity, CheckFeatureAccessContract, type CheckFeatureAccessInput, CheckFeatureAccessInputModel, type CheckFeatureAccessOutput, CheckFeatureAccessOutputModel, FeatureAccessReasonEnum, GetSubscriptionContract, GetUsageSummaryContract, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageContract, type RecordUsageInput, RecordUsageInputModel, RecordUsageOutputModel, type Subscription, SubscriptionChangedEvent, SubscriptionEntity, SubscriptionModel, SubscriptionPresentation, SubscriptionStatusEnum, SubscriptionStatusSchemaEnum, UsageDashboardPresentation, UsageLimitEntity, UsageLimitReachedEvent, UsageRecordedEvent, UsageRecordedPayloadModel, type UsageSummary, UsageSummaryModel, mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FeatureAccessReasonEnum, SubscriptionStatusSchemaEnum } from "./billing.enum.js";
|
|
2
|
+
import { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel } from "./billing.schema.js";
|
|
3
|
+
import { CheckFeatureAccessContract, GetSubscriptionContract, GetUsageSummaryContract, RecordUsageContract } from "./billing.operations.js";
|
|
4
|
+
import { SubscriptionChangedEvent, UsageLimitReachedEvent, UsageRecordedEvent } from "./billing.event.js";
|
|
5
|
+
import { BillingUsageEntity, SubscriptionEntity, SubscriptionStatusEnum, UsageLimitEntity } from "./billing.entity.js";
|
|
6
|
+
import { SubscriptionPresentation, UsageDashboardPresentation } from "./billing.presentation.js";
|
|
7
|
+
import { mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler } from "./billing.handler.js";
|
|
8
|
+
|
|
9
|
+
export { BillingUsageEntity, CheckFeatureAccessContract, CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, FeatureAccessReasonEnum, GetSubscriptionContract, GetUsageSummaryContract, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageContract, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionChangedEvent, SubscriptionEntity, SubscriptionModel, SubscriptionPresentation, SubscriptionStatusEnum, SubscriptionStatusSchemaEnum, UsageDashboardPresentation, UsageLimitEntity, UsageLimitReachedEvent, UsageRecordedEvent, UsageRecordedPayloadModel, UsageSummaryModel, mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PresentationSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/dashboard/dashboard.presentation.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Main dashboard presentation for the SaaS application.
|
|
7
|
+
*/
|
|
8
|
+
declare const SaasDashboardPresentation: PresentationSpec;
|
|
9
|
+
/**
|
|
10
|
+
* Settings panel presentation.
|
|
11
|
+
*/
|
|
12
|
+
declare const SettingsPanelPresentation: PresentationSpec;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SaasDashboardPresentation, SettingsPanelPresentation };
|
|
15
|
+
//# sourceMappingURL=dashboard.presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.presentation.d.ts","names":[],"sources":["../../src/dashboard/dashboard.presentation.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;AA4Ba,cA5BA,yBA4B2B,EA5BA,gBAkDvC;;;;cAtBY,2BAA2B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { StabilityEnum } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/dashboard/dashboard.presentation.ts
|
|
4
|
+
/**
|
|
5
|
+
* Main dashboard presentation for the SaaS application.
|
|
6
|
+
*/
|
|
7
|
+
const SaasDashboardPresentation = {
|
|
8
|
+
meta: {
|
|
9
|
+
key: "saas.dashboard",
|
|
10
|
+
version: 1,
|
|
11
|
+
title: "SaaS Dashboard",
|
|
12
|
+
description: "Main SaaS dashboard with project overview, usage stats, and quick actions",
|
|
13
|
+
domain: "saas-boilerplate",
|
|
14
|
+
owners: ["@saas-team"],
|
|
15
|
+
tags: ["dashboard", "overview"],
|
|
16
|
+
stability: StabilityEnum.Beta,
|
|
17
|
+
goal: "Overview of SaaS activity and metrics",
|
|
18
|
+
context: "Main dashboard"
|
|
19
|
+
},
|
|
20
|
+
source: {
|
|
21
|
+
type: "component",
|
|
22
|
+
framework: "react",
|
|
23
|
+
componentKey: "SaasDashboard"
|
|
24
|
+
},
|
|
25
|
+
targets: ["react", "markdown"],
|
|
26
|
+
policy: { flags: ["saas.enabled"] }
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Settings panel presentation.
|
|
30
|
+
*/
|
|
31
|
+
const SettingsPanelPresentation = {
|
|
32
|
+
meta: {
|
|
33
|
+
key: "saas.settings",
|
|
34
|
+
version: 1,
|
|
35
|
+
title: "Settings Panel",
|
|
36
|
+
description: "Organization and user settings panel",
|
|
37
|
+
domain: "saas-boilerplate",
|
|
38
|
+
owners: ["@saas-team"],
|
|
39
|
+
tags: ["settings", "config"],
|
|
40
|
+
stability: StabilityEnum.Beta,
|
|
41
|
+
goal: "Configure organization and user settings",
|
|
42
|
+
context: "Settings section"
|
|
43
|
+
},
|
|
44
|
+
source: {
|
|
45
|
+
type: "component",
|
|
46
|
+
framework: "react",
|
|
47
|
+
componentKey: "SettingsPanel"
|
|
48
|
+
},
|
|
49
|
+
targets: ["react"],
|
|
50
|
+
policy: { flags: ["saas.enabled"] }
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { SaasDashboardPresentation, SettingsPanelPresentation };
|
|
55
|
+
//# sourceMappingURL=dashboard.presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.presentation.js","names":["SaasDashboardPresentation: PresentationSpec","SettingsPanelPresentation: PresentationSpec"],"sources":["../../src/dashboard/dashboard.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\n\n/**\n * Main dashboard presentation for the SaaS application.\n */\nexport const SaasDashboardPresentation: PresentationSpec = {\n meta: {\n key: 'saas.dashboard',\n version: 1,\n title: 'SaaS Dashboard',\n description:\n 'Main SaaS dashboard with project overview, usage stats, and quick actions',\n domain: 'saas-boilerplate',\n owners: ['@saas-team'],\n tags: ['dashboard', 'overview'],\n stability: StabilityEnum.Beta,\n goal: 'Overview of SaaS activity and metrics',\n context: 'Main dashboard',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'SaasDashboard',\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['saas.enabled'],\n },\n};\n\n/**\n * Settings panel presentation.\n */\nexport const SettingsPanelPresentation: PresentationSpec = {\n meta: {\n key: 'saas.settings',\n version: 1,\n title: 'Settings Panel',\n description: 'Organization and user settings panel',\n domain: 'saas-boilerplate',\n owners: ['@saas-team'],\n tags: ['settings', 'config'],\n stability: StabilityEnum.Beta,\n goal: 'Configure organization and user settings',\n context: 'Settings section',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'SettingsPanel',\n },\n targets: ['react'],\n policy: {\n flags: ['saas.enabled'],\n },\n};\n"],"mappings":";;;;;;AAMA,MAAaA,4BAA8C;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,aAAa;EACtB,MAAM,CAAC,aAAa,WAAW;EAC/B,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,eAAe,EACxB;CACF;;;;AAKD,MAAaC,4BAA8C;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,aAAa;EACtB,MAAM,CAAC,YAAY,SAAS;EAC5B,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,eAAe,EACxB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./saas-boilerplate.docblock.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/docs/saas-boilerplate.docblock.ts
|
|
4
|
+
registerDocBlocks([
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.saas-boilerplate.goal",
|
|
7
|
+
title: "SaaS Boilerplate — Goal",
|
|
8
|
+
summary: "Multi-tenant SaaS foundation with orgs, members, projects, settings, and usage.",
|
|
9
|
+
kind: "goal",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/saas-boilerplate/goal",
|
|
12
|
+
tags: ["saas", "goal"],
|
|
13
|
+
body: `## Why it matters
|
|
14
|
+
- Provides a regenerable SaaS base: orgs, members, projects, settings, usage/billing.
|
|
15
|
+
- Avoids drift across identity, settings, and usage capture.
|
|
16
|
+
|
|
17
|
+
## Business/Product goal
|
|
18
|
+
- Ship SaaS faster with tenant isolation, RBAC, and usage metering baked in.
|
|
19
|
+
- Keep audit/notifications ready for compliance and customer comms.
|
|
20
|
+
|
|
21
|
+
## Success criteria
|
|
22
|
+
- Spec changes to org/project/settings/usage regenerate UI/API/events cleanly.
|
|
23
|
+
- Tenant isolation and RBAC stay enforced; usage data is captured with PII scopes.`
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "docs.examples.saas-boilerplate.usage",
|
|
27
|
+
title: "SaaS Boilerplate — Usage",
|
|
28
|
+
summary: "How to seed, extend, and regenerate the SaaS base.",
|
|
29
|
+
kind: "usage",
|
|
30
|
+
visibility: "public",
|
|
31
|
+
route: "/docs/examples/saas-boilerplate/usage",
|
|
32
|
+
tags: ["saas", "usage"],
|
|
33
|
+
body: `## Setup
|
|
34
|
+
1) Seed (if available) or create orgs, members, and projects via UI.
|
|
35
|
+
2) Configure Notifications for invites and project events; set policy.pii for sensitive fields.
|
|
36
|
+
|
|
37
|
+
## Extend & regenerate
|
|
38
|
+
1) Adjust schemas (project metadata, settings, usage records) in spec.
|
|
39
|
+
2) Regenerate to sync UI/API/events and usage metering.
|
|
40
|
+
3) Use Feature Flags to roll out new settings or billing fields gradually.
|
|
41
|
+
|
|
42
|
+
## Guardrails
|
|
43
|
+
- Keep tenant/role context explicit in contracts and presentations.
|
|
44
|
+
- Emit events for invites, project changes, and usage records; log in Audit Trail.
|
|
45
|
+
- Redact sensitive user/org data in markdown/JSON outputs.`
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "docs.examples.saas-boilerplate.reference",
|
|
49
|
+
title: "SaaS Boilerplate — Reference",
|
|
50
|
+
summary: "Entities, contracts, events, and presentations for the SaaS starter.",
|
|
51
|
+
kind: "reference",
|
|
52
|
+
visibility: "public",
|
|
53
|
+
route: "/docs/examples/saas-boilerplate",
|
|
54
|
+
tags: ["saas", "reference"],
|
|
55
|
+
body: `## Entities
|
|
56
|
+
- Organization, Member, Role, Project, AppSettings, UserSettings, BillingUsage.
|
|
57
|
+
|
|
58
|
+
## Contracts
|
|
59
|
+
- org/project CRUD, invites, role assignment, usage recording.
|
|
60
|
+
|
|
61
|
+
## Events
|
|
62
|
+
- org.created, member.invited/accepted, project.created/updated, usage.recorded.
|
|
63
|
+
|
|
64
|
+
## Presentations
|
|
65
|
+
- Org/project dashboards, member management, settings screens, usage views.
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
- Tenant isolation is mandatory; enforce via RBAC/policies.
|
|
69
|
+
- Usage/Metering drives billing/limits; keep units explicit.`
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "docs.examples.saas-boilerplate.constraints",
|
|
73
|
+
title: "SaaS Boilerplate — Constraints & Safety",
|
|
74
|
+
summary: "Internal guardrails for tenancy, RBAC, usage metering, and regeneration.",
|
|
75
|
+
kind: "reference",
|
|
76
|
+
visibility: "internal",
|
|
77
|
+
route: "/docs/examples/saas-boilerplate/constraints",
|
|
78
|
+
tags: [
|
|
79
|
+
"saas",
|
|
80
|
+
"constraints",
|
|
81
|
+
"internal"
|
|
82
|
+
],
|
|
83
|
+
body: `## Constraints
|
|
84
|
+
- Tenant isolation and RBAC must remain explicit in spec; no implicit defaults in code.
|
|
85
|
+
- Events to emit: org.created, member.invited/accepted, project.created/updated, usage.recorded.
|
|
86
|
+
- Regeneration must not change billing/usage semantics without spec diffs.
|
|
87
|
+
|
|
88
|
+
## PII & Settings
|
|
89
|
+
- Mark PII (user emails, names) for redaction; keep settings scoped to org/member.
|
|
90
|
+
- Avoid leaking secrets/config in markdown/JSON presentations.
|
|
91
|
+
|
|
92
|
+
## Verification
|
|
93
|
+
- Add fixtures for usage recording and role changes.
|
|
94
|
+
- Ensure Audit/Notifications remain wired for invites/project updates.
|
|
95
|
+
- Use Feature Flags for new settings/billing fields; default safe/off.`
|
|
96
|
+
}
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
//# sourceMappingURL=saas-boilerplate.docblock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saas-boilerplate.docblock.js","names":[],"sources":["../../src/docs/saas-boilerplate.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst saasBoilerplateDocBlocks: DocBlock[] = [\n {\n id: 'docs.examples.saas-boilerplate.goal',\n title: 'SaaS Boilerplate — Goal',\n summary:\n 'Multi-tenant SaaS foundation with orgs, members, projects, settings, and usage.',\n kind: 'goal',\n visibility: 'public',\n route: '/docs/examples/saas-boilerplate/goal',\n tags: ['saas', 'goal'],\n body: `## Why it matters\n- Provides a regenerable SaaS base: orgs, members, projects, settings, usage/billing.\n- Avoids drift across identity, settings, and usage capture.\n\n## Business/Product goal\n- Ship SaaS faster with tenant isolation, RBAC, and usage metering baked in.\n- Keep audit/notifications ready for compliance and customer comms.\n\n## Success criteria\n- Spec changes to org/project/settings/usage regenerate UI/API/events cleanly.\n- Tenant isolation and RBAC stay enforced; usage data is captured with PII scopes.`,\n },\n {\n id: 'docs.examples.saas-boilerplate.usage',\n title: 'SaaS Boilerplate — Usage',\n summary: 'How to seed, extend, and regenerate the SaaS base.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/saas-boilerplate/usage',\n tags: ['saas', 'usage'],\n body: `## Setup\n1) Seed (if available) or create orgs, members, and projects via UI.\n2) Configure Notifications for invites and project events; set policy.pii for sensitive fields.\n\n## Extend & regenerate\n1) Adjust schemas (project metadata, settings, usage records) in spec.\n2) Regenerate to sync UI/API/events and usage metering.\n3) Use Feature Flags to roll out new settings or billing fields gradually.\n\n## Guardrails\n- Keep tenant/role context explicit in contracts and presentations.\n- Emit events for invites, project changes, and usage records; log in Audit Trail.\n- Redact sensitive user/org data in markdown/JSON outputs.`,\n },\n {\n id: 'docs.examples.saas-boilerplate.reference',\n title: 'SaaS Boilerplate — Reference',\n summary:\n 'Entities, contracts, events, and presentations for the SaaS starter.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/saas-boilerplate',\n tags: ['saas', 'reference'],\n body: `## Entities\n- Organization, Member, Role, Project, AppSettings, UserSettings, BillingUsage.\n\n## Contracts\n- org/project CRUD, invites, role assignment, usage recording.\n\n## Events\n- org.created, member.invited/accepted, project.created/updated, usage.recorded.\n\n## Presentations\n- Org/project dashboards, member management, settings screens, usage views.\n\n## Notes\n- Tenant isolation is mandatory; enforce via RBAC/policies.\n- Usage/Metering drives billing/limits; keep units explicit.`,\n },\n {\n id: 'docs.examples.saas-boilerplate.constraints',\n title: 'SaaS Boilerplate — Constraints & Safety',\n summary:\n 'Internal guardrails for tenancy, RBAC, usage metering, and regeneration.',\n kind: 'reference',\n visibility: 'internal',\n route: '/docs/examples/saas-boilerplate/constraints',\n tags: ['saas', 'constraints', 'internal'],\n body: `## Constraints\n- Tenant isolation and RBAC must remain explicit in spec; no implicit defaults in code.\n- Events to emit: org.created, member.invited/accepted, project.created/updated, usage.recorded.\n- Regeneration must not change billing/usage semantics without spec diffs.\n\n## PII & Settings\n- Mark PII (user emails, names) for redaction; keep settings scoped to org/member.\n- Avoid leaking secrets/config in markdown/JSON presentations.\n\n## Verification\n- Add fixtures for usage recording and role changes.\n- Ensure Audit/Notifications remain wired for invites/project updates.\n- Use Feature Flags for new settings/billing fields; default safe/off.`,\n },\n];\n\nregisterDocBlocks(saasBoilerplateDocBlocks);\n"],"mappings":";;;AAiGA,kBA9F6C;CAC3C;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,QAAQ,OAAO;EACtB,MAAM;;;;;;;;;;;EAWP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SAAS;EACT,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,QAAQ,QAAQ;EACvB,MAAM;;;;;;;;;;;;;EAaP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,QAAQ,YAAY;EAC3B,MAAM;;;;;;;;;;;;;;;EAeP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM;GAAC;GAAQ;GAAe;GAAW;EACzC,MAAM;;;;;;;;;;;;;EAaP;CACF,CAE0C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/example.d.ts
|
|
2
|
+
declare const example: {
|
|
3
|
+
readonly id: "saas-boilerplate";
|
|
4
|
+
readonly title: "SaaS Boilerplate";
|
|
5
|
+
readonly summary: "Multi-tenant SaaS foundation with orgs, projects, settings, billing usage, and RBAC.";
|
|
6
|
+
readonly tags: readonly ["saas", "multi-tenant", "billing", "rbac"];
|
|
7
|
+
readonly kind: "template";
|
|
8
|
+
readonly visibility: "public";
|
|
9
|
+
readonly docs: {
|
|
10
|
+
readonly rootDocId: "docs.examples.saas-boilerplate";
|
|
11
|
+
};
|
|
12
|
+
readonly entrypoints: {
|
|
13
|
+
readonly packageName: "@contractspec/example.saas-boilerplate";
|
|
14
|
+
readonly feature: "./feature";
|
|
15
|
+
readonly contracts: "./contracts";
|
|
16
|
+
readonly presentations: "./presentations";
|
|
17
|
+
readonly handlers: "./handlers";
|
|
18
|
+
readonly docs: "./docs";
|
|
19
|
+
};
|
|
20
|
+
readonly surfaces: {
|
|
21
|
+
readonly templates: true;
|
|
22
|
+
readonly sandbox: {
|
|
23
|
+
readonly enabled: true;
|
|
24
|
+
readonly modes: readonly ["playground", "specs", "builder", "markdown", "evolution"];
|
|
25
|
+
};
|
|
26
|
+
readonly studio: {
|
|
27
|
+
readonly enabled: true;
|
|
28
|
+
readonly installable: true;
|
|
29
|
+
};
|
|
30
|
+
readonly mcp: {
|
|
31
|
+
readonly enabled: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { example as default };
|
|
37
|
+
//# sourceMappingURL=example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EA4BI,EAAA,kBAAA"}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/example.ts
|
|
2
|
+
const example = {
|
|
3
|
+
id: "saas-boilerplate",
|
|
4
|
+
title: "SaaS Boilerplate",
|
|
5
|
+
summary: "Multi-tenant SaaS foundation with orgs, projects, settings, billing usage, and RBAC.",
|
|
6
|
+
tags: [
|
|
7
|
+
"saas",
|
|
8
|
+
"multi-tenant",
|
|
9
|
+
"billing",
|
|
10
|
+
"rbac"
|
|
11
|
+
],
|
|
12
|
+
kind: "template",
|
|
13
|
+
visibility: "public",
|
|
14
|
+
docs: { rootDocId: "docs.examples.saas-boilerplate" },
|
|
15
|
+
entrypoints: {
|
|
16
|
+
packageName: "@contractspec/example.saas-boilerplate",
|
|
17
|
+
feature: "./feature",
|
|
18
|
+
contracts: "./contracts",
|
|
19
|
+
presentations: "./presentations",
|
|
20
|
+
handlers: "./handlers",
|
|
21
|
+
docs: "./docs"
|
|
22
|
+
},
|
|
23
|
+
surfaces: {
|
|
24
|
+
templates: true,
|
|
25
|
+
sandbox: {
|
|
26
|
+
enabled: true,
|
|
27
|
+
modes: [
|
|
28
|
+
"playground",
|
|
29
|
+
"specs",
|
|
30
|
+
"builder",
|
|
31
|
+
"markdown",
|
|
32
|
+
"evolution"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
studio: {
|
|
36
|
+
enabled: true,
|
|
37
|
+
installable: true
|
|
38
|
+
},
|
|
39
|
+
mcp: { enabled: true }
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var example_default = example;
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { example_default as default };
|
|
46
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'saas-boilerplate',\n title: 'SaaS Boilerplate',\n summary:\n 'Multi-tenant SaaS foundation with orgs, projects, settings, billing usage, and RBAC.',\n tags: ['saas', 'multi-tenant', 'billing', 'rbac'],\n kind: 'template',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.examples.saas-boilerplate',\n },\n entrypoints: {\n packageName: '@contractspec/example.saas-boilerplate',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAQ;EAAgB;EAAW;EAAO;CACjD,MAAM;CACN,YAAY;CACZ,MAAM,EACJ,WAAW,kCACZ;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler } from "../billing/billing.handler.js";
|
|
2
|
+
import { mockCreateProjectHandler, mockDeleteProjectHandler, mockGetProjectHandler, mockListProjectsHandler, mockUpdateProjectHandler } from "../project/project.handler.js";
|
|
3
|
+
export { mockCheckFeatureAccessHandler, mockCreateProjectHandler, mockDeleteProjectHandler, mockGetProjectHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockListProjectsHandler, mockRecordUsageHandler, mockUpdateProjectHandler };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler } from "../billing/billing.handler.js";
|
|
2
|
+
import { mockCreateProjectHandler, mockDeleteProjectHandler, mockGetProjectHandler, mockListProjectsHandler, mockUpdateProjectHandler } from "../project/project.handler.js";
|
|
3
|
+
|
|
4
|
+
export { mockCheckFeatureAccessHandler, mockCreateProjectHandler, mockDeleteProjectHandler, mockGetProjectHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockListProjectsHandler, mockRecordUsageHandler, mockUpdateProjectHandler };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BillingUsageEntity, SubscriptionEntity, SubscriptionStatusEnum, UsageLimitEntity } from "./billing/billing.entity.js";
|
|
2
|
+
import { FeatureAccessReasonEnum, SubscriptionStatusSchemaEnum } from "./billing/billing.enum.js";
|
|
3
|
+
import { SubscriptionChangedEvent, UsageLimitReachedEvent, UsageRecordedEvent } from "./billing/billing.event.js";
|
|
4
|
+
import { CheckFeatureAccessInput, CheckFeatureAccessOutput, RecordUsageInput, Subscription, UsageSummary, mockCheckFeatureAccessHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockRecordUsageHandler } from "./billing/billing.handler.js";
|
|
5
|
+
import { CheckFeatureAccessContract, GetSubscriptionContract, GetUsageSummaryContract, RecordUsageContract } from "./billing/billing.operations.js";
|
|
6
|
+
import { SubscriptionPresentation, UsageDashboardPresentation } from "./billing/billing.presentation.js";
|
|
7
|
+
import { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel } from "./billing/billing.schema.js";
|
|
8
|
+
import "./billing/index.js";
|
|
9
|
+
import { SaasDashboardPresentation, SettingsPanelPresentation } from "./dashboard/dashboard.presentation.js";
|
|
10
|
+
import "./dashboard/index.js";
|
|
11
|
+
import example from "./example.js";
|
|
12
|
+
import { CreateProjectInput, ListProjectsInput, ListProjectsOutput, Project, UpdateProjectInput, mockCreateProjectHandler, mockDeleteProjectHandler, mockGetProjectHandler, mockListProjectsHandler, mockUpdateProjectHandler } from "./project/project.handler.js";
|
|
13
|
+
import { ProjectStatusFilterEnum, ProjectStatusSchemaEnum } from "./project/project.enum.js";
|
|
14
|
+
import { CreateProjectInputModel, DeleteProjectInputModel, DeleteProjectOutputModel, GetProjectInputModel, ListProjectsInputModel, ListProjectsOutputModel, ProjectDeletedPayloadModel, ProjectModel, UpdateProjectInputModel } from "./project/project.schema.js";
|
|
15
|
+
import { CreateProjectContract, DeleteProjectContract, GetProjectContract, ListProjectsContract, UpdateProjectContract } from "./project/project.operations.js";
|
|
16
|
+
import { ProjectArchivedEvent, ProjectCreatedEvent, ProjectDeletedEvent, ProjectUpdatedEvent } from "./project/project.event.js";
|
|
17
|
+
import { ProjectEntity, ProjectMemberEntity, ProjectStatusEnum } from "./project/project.entity.js";
|
|
18
|
+
import { ProjectDetailPresentation, ProjectListPresentation } from "./project/project.presentation.js";
|
|
19
|
+
import "./project/index.js";
|
|
20
|
+
import { SettingsScopeEnum } from "./settings/settings.enum.js";
|
|
21
|
+
import { FeatureFlagEntity, SettingsEntity } from "./settings/settings.entity.js";
|
|
22
|
+
import "./settings/index.js";
|
|
23
|
+
import { SaasBoilerplateFeature } from "./saas-boilerplate.feature.js";
|
|
24
|
+
import { ModuleSchemaContribution } from "@contractspec/lib.schema";
|
|
25
|
+
|
|
26
|
+
//#region src/index.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* SaaS boilerplate schema contribution.
|
|
29
|
+
*/
|
|
30
|
+
declare const saasBoilerplateSchemaContribution: ModuleSchemaContribution;
|
|
31
|
+
/**
|
|
32
|
+
* Complete schema composition for SaaS Boilerplate.
|
|
33
|
+
* Use with `database schema:compose` to generate Prisma schema.
|
|
34
|
+
*/
|
|
35
|
+
declare const schemaComposition: {
|
|
36
|
+
modules: ModuleSchemaContribution[];
|
|
37
|
+
provider: "postgresql";
|
|
38
|
+
outputPath: string;
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { BillingUsageEntity, CheckFeatureAccessContract, CheckFeatureAccessInput, CheckFeatureAccessInputModel, CheckFeatureAccessOutput, CheckFeatureAccessOutputModel, CreateProjectContract, CreateProjectInput, CreateProjectInputModel, DeleteProjectContract, DeleteProjectInputModel, DeleteProjectOutputModel, FeatureAccessReasonEnum, FeatureFlagEntity, GetProjectContract, GetProjectInputModel, GetSubscriptionContract, GetUsageSummaryContract, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, ListProjectsContract, ListProjectsInput, ListProjectsInputModel, ListProjectsOutput, ListProjectsOutputModel, Project, ProjectArchivedEvent, ProjectCreatedEvent, ProjectDeletedEvent, ProjectDeletedPayloadModel, ProjectDetailPresentation, ProjectEntity, ProjectListPresentation, ProjectMemberEntity, ProjectModel, ProjectStatusEnum, ProjectStatusFilterEnum, ProjectStatusSchemaEnum, ProjectUpdatedEvent, RecordUsageContract, RecordUsageInput, RecordUsageInputModel, RecordUsageOutputModel, SaasBoilerplateFeature, SaasDashboardPresentation, SettingsEntity, SettingsPanelPresentation, SettingsScopeEnum, Subscription, SubscriptionChangedEvent, SubscriptionEntity, SubscriptionModel, SubscriptionPresentation, SubscriptionStatusEnum, SubscriptionStatusSchemaEnum, UpdateProjectContract, UpdateProjectInput, UpdateProjectInputModel, UsageDashboardPresentation, UsageLimitEntity, UsageLimitReachedEvent, UsageRecordedEvent, UsageRecordedPayloadModel, UsageSummary, UsageSummaryModel, example, mockCheckFeatureAccessHandler, mockCreateProjectHandler, mockDeleteProjectHandler, mockGetProjectHandler, mockGetSubscriptionHandler, mockGetUsageSummaryHandler, mockListProjectsHandler, mockRecordUsageHandler, mockUpdateProjectHandler, saasBoilerplateSchemaContribution, schemaComposition };
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0Ca,mCAAmC;;;;;cAkBnC;WAUZ"}
|