@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,166 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema60 from "@contractspec/lib.schema";
|
|
2
|
+
import * as _contractspec_lib_contracts2 from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/billing/billing.operations.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get subscription status.
|
|
7
|
+
*/
|
|
8
|
+
declare const GetSubscriptionContract: _contractspec_lib_contracts2.OperationSpec<_contractspec_lib_schema60.AnySchemaModel, _contractspec_lib_schema60.SchemaModel<{
|
|
9
|
+
id: {
|
|
10
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
11
|
+
isOptional: false;
|
|
12
|
+
};
|
|
13
|
+
organizationId: {
|
|
14
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
15
|
+
isOptional: false;
|
|
16
|
+
};
|
|
17
|
+
planId: {
|
|
18
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
19
|
+
isOptional: false;
|
|
20
|
+
};
|
|
21
|
+
planName: {
|
|
22
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
23
|
+
isOptional: false;
|
|
24
|
+
};
|
|
25
|
+
status: {
|
|
26
|
+
type: _contractspec_lib_schema60.EnumType<[string, string, string, string, string]>;
|
|
27
|
+
isOptional: false;
|
|
28
|
+
};
|
|
29
|
+
currentPeriodStart: {
|
|
30
|
+
type: _contractspec_lib_schema60.FieldType<Date, string>;
|
|
31
|
+
isOptional: false;
|
|
32
|
+
};
|
|
33
|
+
currentPeriodEnd: {
|
|
34
|
+
type: _contractspec_lib_schema60.FieldType<Date, string>;
|
|
35
|
+
isOptional: false;
|
|
36
|
+
};
|
|
37
|
+
trialEndsAt: {
|
|
38
|
+
type: _contractspec_lib_schema60.FieldType<Date, string>;
|
|
39
|
+
isOptional: true;
|
|
40
|
+
};
|
|
41
|
+
cancelAtPeriodEnd: {
|
|
42
|
+
type: _contractspec_lib_schema60.FieldType<boolean, boolean>;
|
|
43
|
+
isOptional: false;
|
|
44
|
+
};
|
|
45
|
+
}>, undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Record feature usage.
|
|
48
|
+
*/
|
|
49
|
+
declare const RecordUsageContract: _contractspec_lib_contracts2.OperationSpec<_contractspec_lib_schema60.SchemaModel<{
|
|
50
|
+
feature: {
|
|
51
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
52
|
+
isOptional: false;
|
|
53
|
+
};
|
|
54
|
+
quantity: {
|
|
55
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
56
|
+
isOptional: false;
|
|
57
|
+
};
|
|
58
|
+
sourceId: {
|
|
59
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
60
|
+
isOptional: true;
|
|
61
|
+
};
|
|
62
|
+
sourceType: {
|
|
63
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
64
|
+
isOptional: true;
|
|
65
|
+
};
|
|
66
|
+
metadata: {
|
|
67
|
+
type: _contractspec_lib_schema60.FieldType<Record<string, unknown>, Record<string, unknown>>;
|
|
68
|
+
isOptional: true;
|
|
69
|
+
};
|
|
70
|
+
}>, _contractspec_lib_schema60.SchemaModel<{
|
|
71
|
+
recorded: {
|
|
72
|
+
type: _contractspec_lib_schema60.FieldType<boolean, boolean>;
|
|
73
|
+
isOptional: false;
|
|
74
|
+
};
|
|
75
|
+
currentUsage: {
|
|
76
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
77
|
+
isOptional: false;
|
|
78
|
+
};
|
|
79
|
+
limit: {
|
|
80
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
81
|
+
isOptional: true;
|
|
82
|
+
};
|
|
83
|
+
limitReached: {
|
|
84
|
+
type: _contractspec_lib_schema60.FieldType<boolean, boolean>;
|
|
85
|
+
isOptional: false;
|
|
86
|
+
};
|
|
87
|
+
}>, {
|
|
88
|
+
key: string;
|
|
89
|
+
version: number;
|
|
90
|
+
when: string;
|
|
91
|
+
payload: _contractspec_lib_schema60.SchemaModel<{
|
|
92
|
+
feature: {
|
|
93
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
94
|
+
isOptional: false;
|
|
95
|
+
};
|
|
96
|
+
quantity: {
|
|
97
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
98
|
+
isOptional: false;
|
|
99
|
+
};
|
|
100
|
+
}>;
|
|
101
|
+
}[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Get usage summary.
|
|
104
|
+
*/
|
|
105
|
+
declare const GetUsageSummaryContract: _contractspec_lib_contracts2.OperationSpec<_contractspec_lib_schema60.SchemaModel<{
|
|
106
|
+
billingPeriod: {
|
|
107
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
108
|
+
isOptional: true;
|
|
109
|
+
};
|
|
110
|
+
}>, _contractspec_lib_schema60.SchemaModel<{
|
|
111
|
+
billingPeriod: {
|
|
112
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
113
|
+
isOptional: false;
|
|
114
|
+
};
|
|
115
|
+
usage: {
|
|
116
|
+
type: _contractspec_lib_schema60.SchemaModel<{
|
|
117
|
+
feature: {
|
|
118
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
119
|
+
isOptional: false;
|
|
120
|
+
};
|
|
121
|
+
used: {
|
|
122
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
123
|
+
isOptional: false;
|
|
124
|
+
};
|
|
125
|
+
limit: {
|
|
126
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
127
|
+
isOptional: true;
|
|
128
|
+
};
|
|
129
|
+
unit: {
|
|
130
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
131
|
+
isOptional: true;
|
|
132
|
+
};
|
|
133
|
+
percentage: {
|
|
134
|
+
type: _contractspec_lib_schema60.FieldType<number, number>;
|
|
135
|
+
isOptional: true;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
isArray: true;
|
|
139
|
+
isOptional: false;
|
|
140
|
+
};
|
|
141
|
+
}>, undefined>;
|
|
142
|
+
/**
|
|
143
|
+
* Check feature access.
|
|
144
|
+
*/
|
|
145
|
+
declare const CheckFeatureAccessContract: _contractspec_lib_contracts2.OperationSpec<_contractspec_lib_schema60.SchemaModel<{
|
|
146
|
+
feature: {
|
|
147
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
148
|
+
isOptional: false;
|
|
149
|
+
};
|
|
150
|
+
}>, _contractspec_lib_schema60.SchemaModel<{
|
|
151
|
+
hasAccess: {
|
|
152
|
+
type: _contractspec_lib_schema60.FieldType<boolean, boolean>;
|
|
153
|
+
isOptional: false;
|
|
154
|
+
};
|
|
155
|
+
reason: {
|
|
156
|
+
type: _contractspec_lib_schema60.EnumType<[string, string, string, string]>;
|
|
157
|
+
isOptional: true;
|
|
158
|
+
};
|
|
159
|
+
upgradeUrl: {
|
|
160
|
+
type: _contractspec_lib_schema60.FieldType<string, string>;
|
|
161
|
+
isOptional: true;
|
|
162
|
+
};
|
|
163
|
+
}>, undefined>;
|
|
164
|
+
//#endregion
|
|
165
|
+
export { CheckFeatureAccessContract, GetSubscriptionContract, GetUsageSummaryContract, RecordUsageContract };
|
|
166
|
+
//# sourceMappingURL=billing.operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.operations.d.ts","names":[],"sources":["../../src/billing/billing.operations.ts"],"sourcesContent":[],"mappings":";;;;;;;cAiBa,yBAAuB,4BAAA,CAAA,cAuClC,0BAAA,CAvCkC,cAAA,6BAAA;EAAvB,EAAA,EAAA;IAuCX,IAAA,EAvCkC,0BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;EAAA,CAAA;EAAA,MAAA,EAAA;IA4CvB,IAAA,qCA6CX,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;8CA7C8B,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;EAAA,CAAA;AAkDhC,CAAA,CAAA,EAAa,SAAA,CAAA;;;;cAlDA,kDAAmB,yCAAA;;UA6C9B,0BAAA,CAAA;;;;;;EAKkC,CAAA;EAwCvB,QAAA,EAAA;IAmCX,IAAA,sCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;EAnCqC,CAAA;;;;;EAAA,QAAA,EAAA;;;;;;UA1FP,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkDnB,sDAAuB,yCAAA;;UAmClC,0BAAA,CAAA;;;;;UAnCkC,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwCvB,yDAA0B,yCAAA;;UAmCrC,0BAAA,CAAA;;;;;UAnCqC,0BAAA,CAAA"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel } from "./billing.schema.js";
|
|
2
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/billing/billing.operations.ts
|
|
5
|
+
const OWNERS = ["@example.saas-boilerplate"];
|
|
6
|
+
/**
|
|
7
|
+
* Get subscription status.
|
|
8
|
+
*/
|
|
9
|
+
const GetSubscriptionContract = defineQuery({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "saas.billing.subscription.get",
|
|
12
|
+
version: 1,
|
|
13
|
+
stability: "stable",
|
|
14
|
+
owners: [...OWNERS],
|
|
15
|
+
tags: [
|
|
16
|
+
"saas",
|
|
17
|
+
"billing",
|
|
18
|
+
"subscription"
|
|
19
|
+
],
|
|
20
|
+
description: "Get organization subscription status.",
|
|
21
|
+
goal: "Show current plan and billing status.",
|
|
22
|
+
context: "Billing page, plan upgrade prompts."
|
|
23
|
+
},
|
|
24
|
+
io: {
|
|
25
|
+
input: null,
|
|
26
|
+
output: SubscriptionModel
|
|
27
|
+
},
|
|
28
|
+
policy: { auth: "user" },
|
|
29
|
+
acceptance: {
|
|
30
|
+
scenarios: [{
|
|
31
|
+
key: "get-subscription-happy-path",
|
|
32
|
+
given: ["Organization has active subscription"],
|
|
33
|
+
when: ["User requests subscription status"],
|
|
34
|
+
then: ["Subscription details are returned"]
|
|
35
|
+
}],
|
|
36
|
+
examples: [{
|
|
37
|
+
key: "get-basic",
|
|
38
|
+
input: null,
|
|
39
|
+
output: {
|
|
40
|
+
plan: "pro",
|
|
41
|
+
status: "active",
|
|
42
|
+
currentPeriodEnd: "2025-02-01T00:00:00Z"
|
|
43
|
+
}
|
|
44
|
+
}]
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Record feature usage.
|
|
49
|
+
*/
|
|
50
|
+
const RecordUsageContract = defineCommand({
|
|
51
|
+
meta: {
|
|
52
|
+
key: "saas.billing.usage.record",
|
|
53
|
+
version: 1,
|
|
54
|
+
stability: "stable",
|
|
55
|
+
owners: [...OWNERS],
|
|
56
|
+
tags: [
|
|
57
|
+
"saas",
|
|
58
|
+
"billing",
|
|
59
|
+
"usage"
|
|
60
|
+
],
|
|
61
|
+
description: "Record usage of a metered feature.",
|
|
62
|
+
goal: "Track feature usage for billing.",
|
|
63
|
+
context: "Called by services when metered features are used."
|
|
64
|
+
},
|
|
65
|
+
io: {
|
|
66
|
+
input: RecordUsageInputModel,
|
|
67
|
+
output: RecordUsageOutputModel
|
|
68
|
+
},
|
|
69
|
+
policy: { auth: "user" },
|
|
70
|
+
sideEffects: { emits: [{
|
|
71
|
+
key: "billing.usage.recorded",
|
|
72
|
+
version: 1,
|
|
73
|
+
when: "Usage is recorded",
|
|
74
|
+
payload: UsageRecordedPayloadModel
|
|
75
|
+
}] },
|
|
76
|
+
acceptance: {
|
|
77
|
+
scenarios: [{
|
|
78
|
+
key: "record-usage-happy-path",
|
|
79
|
+
given: ["Organization exists"],
|
|
80
|
+
when: ["System records feature usage"],
|
|
81
|
+
then: ["Usage is recorded"]
|
|
82
|
+
}],
|
|
83
|
+
examples: [{
|
|
84
|
+
key: "record-api-call",
|
|
85
|
+
input: {
|
|
86
|
+
feature: "api_calls",
|
|
87
|
+
quantity: 1,
|
|
88
|
+
idempotencyKey: "abc-123"
|
|
89
|
+
},
|
|
90
|
+
output: {
|
|
91
|
+
recorded: true,
|
|
92
|
+
currentUsage: 100
|
|
93
|
+
}
|
|
94
|
+
}]
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Get usage summary.
|
|
99
|
+
*/
|
|
100
|
+
const GetUsageSummaryContract = defineQuery({
|
|
101
|
+
meta: {
|
|
102
|
+
key: "saas.billing.usage.summary",
|
|
103
|
+
version: 1,
|
|
104
|
+
stability: "stable",
|
|
105
|
+
owners: [...OWNERS],
|
|
106
|
+
tags: [
|
|
107
|
+
"saas",
|
|
108
|
+
"billing",
|
|
109
|
+
"usage"
|
|
110
|
+
],
|
|
111
|
+
description: "Get usage summary for the current billing period.",
|
|
112
|
+
goal: "Show usage vs limits.",
|
|
113
|
+
context: "Billing page, usage dashboards."
|
|
114
|
+
},
|
|
115
|
+
io: {
|
|
116
|
+
input: GetUsageSummaryInputModel,
|
|
117
|
+
output: GetUsageSummaryOutputModel
|
|
118
|
+
},
|
|
119
|
+
policy: { auth: "user" },
|
|
120
|
+
acceptance: {
|
|
121
|
+
scenarios: [{
|
|
122
|
+
key: "get-usage-happy-path",
|
|
123
|
+
given: ["Organization has usage history"],
|
|
124
|
+
when: ["User requests usage summary"],
|
|
125
|
+
then: ["Usage metrics are returned"]
|
|
126
|
+
}],
|
|
127
|
+
examples: [{
|
|
128
|
+
key: "get-current-usage",
|
|
129
|
+
input: { period: "current" },
|
|
130
|
+
output: { features: [{
|
|
131
|
+
name: "api_calls",
|
|
132
|
+
used: 100,
|
|
133
|
+
limit: 1e3
|
|
134
|
+
}] }
|
|
135
|
+
}]
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Check feature access.
|
|
140
|
+
*/
|
|
141
|
+
const CheckFeatureAccessContract = defineQuery({
|
|
142
|
+
meta: {
|
|
143
|
+
key: "saas.billing.feature.check",
|
|
144
|
+
version: 1,
|
|
145
|
+
stability: "stable",
|
|
146
|
+
owners: [...OWNERS],
|
|
147
|
+
tags: [
|
|
148
|
+
"saas",
|
|
149
|
+
"billing",
|
|
150
|
+
"feature"
|
|
151
|
+
],
|
|
152
|
+
description: "Check if organization has access to a feature.",
|
|
153
|
+
goal: "Gate features based on plan/usage.",
|
|
154
|
+
context: "Feature access checks, upgrade prompts."
|
|
155
|
+
},
|
|
156
|
+
io: {
|
|
157
|
+
input: CheckFeatureAccessInputModel,
|
|
158
|
+
output: CheckFeatureAccessOutputModel
|
|
159
|
+
},
|
|
160
|
+
policy: { auth: "user" },
|
|
161
|
+
acceptance: {
|
|
162
|
+
scenarios: [{
|
|
163
|
+
key: "check-access-granted",
|
|
164
|
+
given: ["Organization is on Pro plan"],
|
|
165
|
+
when: ["User checks access to Pro feature"],
|
|
166
|
+
then: ["Access is granted"]
|
|
167
|
+
}],
|
|
168
|
+
examples: [{
|
|
169
|
+
key: "check-advanced-reports",
|
|
170
|
+
input: { feature: "advanced_reports" },
|
|
171
|
+
output: {
|
|
172
|
+
hasAccess: true,
|
|
173
|
+
reason: "Included in Pro plan"
|
|
174
|
+
}
|
|
175
|
+
}]
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
//#endregion
|
|
180
|
+
export { CheckFeatureAccessContract, GetSubscriptionContract, GetUsageSummaryContract, RecordUsageContract };
|
|
181
|
+
//# sourceMappingURL=billing.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.operations.js","names":[],"sources":["../../src/billing/billing.operations.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@contractspec/lib.contracts';\nimport {\n CheckFeatureAccessInputModel,\n CheckFeatureAccessOutputModel,\n GetUsageSummaryInputModel,\n GetUsageSummaryOutputModel,\n RecordUsageInputModel,\n RecordUsageOutputModel,\n SubscriptionModel,\n UsageRecordedPayloadModel,\n} from './billing.schema';\n\nconst OWNERS = ['@example.saas-boilerplate'] as const;\n\n/**\n * Get subscription status.\n */\nexport const GetSubscriptionContract = defineQuery({\n meta: {\n key: 'saas.billing.subscription.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'billing', 'subscription'],\n description: 'Get organization subscription status.',\n goal: 'Show current plan and billing status.',\n context: 'Billing page, plan upgrade prompts.',\n },\n io: {\n input: null,\n output: SubscriptionModel,\n },\n policy: {\n auth: 'user',\n },\n acceptance: {\n scenarios: [\n {\n key: 'get-subscription-happy-path',\n given: ['Organization has active subscription'],\n when: ['User requests subscription status'],\n then: ['Subscription details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: null,\n output: {\n plan: 'pro',\n status: 'active',\n currentPeriodEnd: '2025-02-01T00:00:00Z',\n },\n },\n ],\n },\n});\n\n/**\n * Record feature usage.\n */\nexport const RecordUsageContract = defineCommand({\n meta: {\n key: 'saas.billing.usage.record',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'billing', 'usage'],\n description: 'Record usage of a metered feature.',\n goal: 'Track feature usage for billing.',\n context: 'Called by services when metered features are used.',\n },\n io: {\n input: RecordUsageInputModel,\n output: RecordUsageOutputModel,\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'billing.usage.recorded',\n version: 1,\n when: 'Usage is recorded',\n payload: UsageRecordedPayloadModel,\n },\n ],\n },\n acceptance: {\n scenarios: [\n {\n key: 'record-usage-happy-path',\n given: ['Organization exists'],\n when: ['System records feature usage'],\n then: ['Usage is recorded'],\n },\n ],\n examples: [\n {\n key: 'record-api-call',\n input: { feature: 'api_calls', quantity: 1, idempotencyKey: 'abc-123' },\n output: { recorded: true, currentUsage: 100 },\n },\n ],\n },\n});\n\n/**\n * Get usage summary.\n */\nexport const GetUsageSummaryContract = defineQuery({\n meta: {\n key: 'saas.billing.usage.summary',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'billing', 'usage'],\n description: 'Get usage summary for the current billing period.',\n goal: 'Show usage vs limits.',\n context: 'Billing page, usage dashboards.',\n },\n io: {\n input: GetUsageSummaryInputModel,\n output: GetUsageSummaryOutputModel,\n },\n policy: {\n auth: 'user',\n },\n acceptance: {\n scenarios: [\n {\n key: 'get-usage-happy-path',\n given: ['Organization has usage history'],\n when: ['User requests usage summary'],\n then: ['Usage metrics are returned'],\n },\n ],\n examples: [\n {\n key: 'get-current-usage',\n input: { period: 'current' },\n output: { features: [{ name: 'api_calls', used: 100, limit: 1000 }] },\n },\n ],\n },\n});\n\n/**\n * Check feature access.\n */\nexport const CheckFeatureAccessContract = defineQuery({\n meta: {\n key: 'saas.billing.feature.check',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['saas', 'billing', 'feature'],\n description: 'Check if organization has access to a feature.',\n goal: 'Gate features based on plan/usage.',\n context: 'Feature access checks, upgrade prompts.',\n },\n io: {\n input: CheckFeatureAccessInputModel,\n output: CheckFeatureAccessOutputModel,\n },\n policy: {\n auth: 'user',\n },\n acceptance: {\n scenarios: [\n {\n key: 'check-access-granted',\n given: ['Organization is on Pro plan'],\n when: ['User checks access to Pro feature'],\n then: ['Access is granted'],\n },\n ],\n examples: [\n {\n key: 'check-advanced-reports',\n input: { feature: 'advanced_reports' },\n output: { hasAccess: true, reason: 'Included in Pro plan' },\n },\n ],\n },\n});\n"],"mappings":";;;;AAYA,MAAM,SAAS,CAAC,4BAA4B;;;;AAK5C,MAAa,0BAA0B,YAAY;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAW;GAAe;EACzC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,uCAAuC;GAC/C,MAAM,CAAC,oCAAoC;GAC3C,MAAM,CAAC,oCAAoC;GAC5C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;GACP,QAAQ;IACN,MAAM;IACN,QAAQ;IACR,kBAAkB;IACnB;GACF,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAW;GAAQ;EAClC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACD,aAAa,EACX,OAAO,CACL;EACE,KAAK;EACL,SAAS;EACT,MAAM;EACN,SAAS;EACV,CACF,EACF;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,sBAAsB;GAC9B,MAAM,CAAC,+BAA+B;GACtC,MAAM,CAAC,oBAAoB;GAC5B,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,SAAS;IAAa,UAAU;IAAG,gBAAgB;IAAW;GACvE,QAAQ;IAAE,UAAU;IAAM,cAAc;IAAK;GAC9C,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,0BAA0B,YAAY;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAW;GAAQ;EAClC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,iCAAiC;GACzC,MAAM,CAAC,8BAA8B;GACrC,MAAM,CAAC,6BAA6B;GACrC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO,EAAE,QAAQ,WAAW;GAC5B,QAAQ,EAAE,UAAU,CAAC;IAAE,MAAM;IAAa,MAAM;IAAK,OAAO;IAAM,CAAC,EAAE;GACtE,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,6BAA6B,YAAY;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAW;GAAU;EACpC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,8BAA8B;GACtC,MAAM,CAAC,oCAAoC;GAC3C,MAAM,CAAC,oBAAoB;GAC5B,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO,EAAE,SAAS,oBAAoB;GACtC,QAAQ;IAAE,WAAW;IAAM,QAAQ;IAAwB;GAC5D,CACF;EACF;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PresentationSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/billing/billing.presentation.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Presentation for subscription overview.
|
|
7
|
+
*/
|
|
8
|
+
declare const SubscriptionPresentation: PresentationSpec;
|
|
9
|
+
/**
|
|
10
|
+
* Presentation for usage dashboard.
|
|
11
|
+
*/
|
|
12
|
+
declare const UsageDashboardPresentation: PresentationSpec;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SubscriptionPresentation, UsageDashboardPresentation };
|
|
15
|
+
//# sourceMappingURL=billing.presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.presentation.d.ts","names":[],"sources":["../../src/billing/billing.presentation.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;AA4Ba,cA5BA,wBA4B4B,EA5BF,gBAkDtC;;;;cAtBY,4BAA4B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { StabilityEnum } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/billing/billing.presentation.ts
|
|
4
|
+
/**
|
|
5
|
+
* Presentation for subscription overview.
|
|
6
|
+
*/
|
|
7
|
+
const SubscriptionPresentation = {
|
|
8
|
+
meta: {
|
|
9
|
+
key: "saas.billing.subscription",
|
|
10
|
+
version: 1,
|
|
11
|
+
title: "Subscription Status",
|
|
12
|
+
description: "Subscription status with plan info, limits, and current usage",
|
|
13
|
+
domain: "saas-boilerplate",
|
|
14
|
+
owners: ["@saas-team"],
|
|
15
|
+
tags: ["billing", "subscription"],
|
|
16
|
+
stability: StabilityEnum.Beta,
|
|
17
|
+
goal: "View subscription plan and status",
|
|
18
|
+
context: "Billing section"
|
|
19
|
+
},
|
|
20
|
+
source: {
|
|
21
|
+
type: "component",
|
|
22
|
+
framework: "react",
|
|
23
|
+
componentKey: "SubscriptionView"
|
|
24
|
+
},
|
|
25
|
+
targets: ["react", "markdown"],
|
|
26
|
+
policy: { flags: ["saas.billing.enabled"] }
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Presentation for usage dashboard.
|
|
30
|
+
*/
|
|
31
|
+
const UsageDashboardPresentation = {
|
|
32
|
+
meta: {
|
|
33
|
+
key: "saas.billing.usage",
|
|
34
|
+
version: 1,
|
|
35
|
+
title: "Usage Dashboard",
|
|
36
|
+
description: "Usage metrics and breakdown by resource type",
|
|
37
|
+
domain: "saas-boilerplate",
|
|
38
|
+
owners: ["@saas-team"],
|
|
39
|
+
tags: [
|
|
40
|
+
"billing",
|
|
41
|
+
"usage",
|
|
42
|
+
"metrics"
|
|
43
|
+
],
|
|
44
|
+
stability: StabilityEnum.Beta,
|
|
45
|
+
goal: "Monitor feature usage and limits",
|
|
46
|
+
context: "Billing section"
|
|
47
|
+
},
|
|
48
|
+
source: {
|
|
49
|
+
type: "component",
|
|
50
|
+
framework: "react",
|
|
51
|
+
componentKey: "UsageDashboardView"
|
|
52
|
+
},
|
|
53
|
+
targets: ["react", "markdown"],
|
|
54
|
+
policy: { flags: ["saas.billing.enabled"] }
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { SubscriptionPresentation, UsageDashboardPresentation };
|
|
59
|
+
//# sourceMappingURL=billing.presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.presentation.js","names":["SubscriptionPresentation: PresentationSpec","UsageDashboardPresentation: PresentationSpec"],"sources":["../../src/billing/billing.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\n\n/**\n * Presentation for subscription overview.\n */\nexport const SubscriptionPresentation: PresentationSpec = {\n meta: {\n key: 'saas.billing.subscription',\n version: 1,\n title: 'Subscription Status',\n description:\n 'Subscription status with plan info, limits, and current usage',\n domain: 'saas-boilerplate',\n owners: ['@saas-team'],\n tags: ['billing', 'subscription'],\n stability: StabilityEnum.Beta,\n goal: 'View subscription plan and status',\n context: 'Billing section',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'SubscriptionView',\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['saas.billing.enabled'],\n },\n};\n\n/**\n * Presentation for usage dashboard.\n */\nexport const UsageDashboardPresentation: PresentationSpec = {\n meta: {\n key: 'saas.billing.usage',\n version: 1,\n title: 'Usage Dashboard',\n description: 'Usage metrics and breakdown by resource type',\n domain: 'saas-boilerplate',\n owners: ['@saas-team'],\n tags: ['billing', 'usage', 'metrics'],\n stability: StabilityEnum.Beta,\n goal: 'Monitor feature usage and limits',\n context: 'Billing section',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'UsageDashboardView',\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['saas.billing.enabled'],\n },\n};\n"],"mappings":";;;;;;AAMA,MAAaA,2BAA6C;CACxD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,aAAa;EACtB,MAAM,CAAC,WAAW,eAAe;EACjC,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,uBAAuB,EAChC;CACF;;;;AAKD,MAAaC,6BAA+C;CAC1D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,aAAa;EACtB,MAAM;GAAC;GAAW;GAAS;GAAU;EACrC,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,uBAAuB,EAChC;CACF"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema101 from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/billing/billing.schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Organization subscription details schema.
|
|
6
|
+
*/
|
|
7
|
+
declare const SubscriptionModel: _contractspec_lib_schema101.SchemaModel<{
|
|
8
|
+
id: {
|
|
9
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
10
|
+
isOptional: false;
|
|
11
|
+
};
|
|
12
|
+
organizationId: {
|
|
13
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
14
|
+
isOptional: false;
|
|
15
|
+
};
|
|
16
|
+
planId: {
|
|
17
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
18
|
+
isOptional: false;
|
|
19
|
+
};
|
|
20
|
+
planName: {
|
|
21
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
22
|
+
isOptional: false;
|
|
23
|
+
};
|
|
24
|
+
status: {
|
|
25
|
+
type: _contractspec_lib_schema101.EnumType<[string, string, string, string, string]>;
|
|
26
|
+
isOptional: false;
|
|
27
|
+
};
|
|
28
|
+
currentPeriodStart: {
|
|
29
|
+
type: _contractspec_lib_schema101.FieldType<Date, string>;
|
|
30
|
+
isOptional: false;
|
|
31
|
+
};
|
|
32
|
+
currentPeriodEnd: {
|
|
33
|
+
type: _contractspec_lib_schema101.FieldType<Date, string>;
|
|
34
|
+
isOptional: false;
|
|
35
|
+
};
|
|
36
|
+
trialEndsAt: {
|
|
37
|
+
type: _contractspec_lib_schema101.FieldType<Date, string>;
|
|
38
|
+
isOptional: true;
|
|
39
|
+
};
|
|
40
|
+
cancelAtPeriodEnd: {
|
|
41
|
+
type: _contractspec_lib_schema101.FieldType<boolean, boolean>;
|
|
42
|
+
isOptional: false;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Usage summary for a feature schema.
|
|
47
|
+
*/
|
|
48
|
+
declare const UsageSummaryModel: _contractspec_lib_schema101.SchemaModel<{
|
|
49
|
+
feature: {
|
|
50
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
51
|
+
isOptional: false;
|
|
52
|
+
};
|
|
53
|
+
used: {
|
|
54
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
55
|
+
isOptional: false;
|
|
56
|
+
};
|
|
57
|
+
limit: {
|
|
58
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
59
|
+
isOptional: true;
|
|
60
|
+
};
|
|
61
|
+
unit: {
|
|
62
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
63
|
+
isOptional: true;
|
|
64
|
+
};
|
|
65
|
+
percentage: {
|
|
66
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
67
|
+
isOptional: true;
|
|
68
|
+
};
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Input for recording feature usage.
|
|
72
|
+
*/
|
|
73
|
+
declare const RecordUsageInputModel: _contractspec_lib_schema101.SchemaModel<{
|
|
74
|
+
feature: {
|
|
75
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
76
|
+
isOptional: false;
|
|
77
|
+
};
|
|
78
|
+
quantity: {
|
|
79
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
80
|
+
isOptional: false;
|
|
81
|
+
};
|
|
82
|
+
sourceId: {
|
|
83
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
84
|
+
isOptional: true;
|
|
85
|
+
};
|
|
86
|
+
sourceType: {
|
|
87
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
88
|
+
isOptional: true;
|
|
89
|
+
};
|
|
90
|
+
metadata: {
|
|
91
|
+
type: _contractspec_lib_schema101.FieldType<Record<string, unknown>, Record<string, unknown>>;
|
|
92
|
+
isOptional: true;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Output for recording feature usage.
|
|
97
|
+
*/
|
|
98
|
+
declare const RecordUsageOutputModel: _contractspec_lib_schema101.SchemaModel<{
|
|
99
|
+
recorded: {
|
|
100
|
+
type: _contractspec_lib_schema101.FieldType<boolean, boolean>;
|
|
101
|
+
isOptional: false;
|
|
102
|
+
};
|
|
103
|
+
currentUsage: {
|
|
104
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
105
|
+
isOptional: false;
|
|
106
|
+
};
|
|
107
|
+
limit: {
|
|
108
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
109
|
+
isOptional: true;
|
|
110
|
+
};
|
|
111
|
+
limitReached: {
|
|
112
|
+
type: _contractspec_lib_schema101.FieldType<boolean, boolean>;
|
|
113
|
+
isOptional: false;
|
|
114
|
+
};
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Payload for usage.recorded event.
|
|
118
|
+
*/
|
|
119
|
+
declare const UsageRecordedPayloadModel: _contractspec_lib_schema101.SchemaModel<{
|
|
120
|
+
feature: {
|
|
121
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
122
|
+
isOptional: false;
|
|
123
|
+
};
|
|
124
|
+
quantity: {
|
|
125
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
126
|
+
isOptional: false;
|
|
127
|
+
};
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Input for getting usage summary.
|
|
131
|
+
*/
|
|
132
|
+
declare const GetUsageSummaryInputModel: _contractspec_lib_schema101.SchemaModel<{
|
|
133
|
+
billingPeriod: {
|
|
134
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
135
|
+
isOptional: true;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Output for usage summary.
|
|
140
|
+
*/
|
|
141
|
+
declare const GetUsageSummaryOutputModel: _contractspec_lib_schema101.SchemaModel<{
|
|
142
|
+
billingPeriod: {
|
|
143
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
144
|
+
isOptional: false;
|
|
145
|
+
};
|
|
146
|
+
usage: {
|
|
147
|
+
type: _contractspec_lib_schema101.SchemaModel<{
|
|
148
|
+
feature: {
|
|
149
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
150
|
+
isOptional: false;
|
|
151
|
+
};
|
|
152
|
+
used: {
|
|
153
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
154
|
+
isOptional: false;
|
|
155
|
+
};
|
|
156
|
+
limit: {
|
|
157
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
158
|
+
isOptional: true;
|
|
159
|
+
};
|
|
160
|
+
unit: {
|
|
161
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
162
|
+
isOptional: true;
|
|
163
|
+
};
|
|
164
|
+
percentage: {
|
|
165
|
+
type: _contractspec_lib_schema101.FieldType<number, number>;
|
|
166
|
+
isOptional: true;
|
|
167
|
+
};
|
|
168
|
+
}>;
|
|
169
|
+
isArray: true;
|
|
170
|
+
isOptional: false;
|
|
171
|
+
};
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Input for checking feature access.
|
|
175
|
+
*/
|
|
176
|
+
declare const CheckFeatureAccessInputModel: _contractspec_lib_schema101.SchemaModel<{
|
|
177
|
+
feature: {
|
|
178
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
179
|
+
isOptional: false;
|
|
180
|
+
};
|
|
181
|
+
}>;
|
|
182
|
+
/**
|
|
183
|
+
* Output for feature access check.
|
|
184
|
+
*/
|
|
185
|
+
declare const CheckFeatureAccessOutputModel: _contractspec_lib_schema101.SchemaModel<{
|
|
186
|
+
hasAccess: {
|
|
187
|
+
type: _contractspec_lib_schema101.FieldType<boolean, boolean>;
|
|
188
|
+
isOptional: false;
|
|
189
|
+
};
|
|
190
|
+
reason: {
|
|
191
|
+
type: _contractspec_lib_schema101.EnumType<[string, string, string, string]>;
|
|
192
|
+
isOptional: true;
|
|
193
|
+
};
|
|
194
|
+
upgradeUrl: {
|
|
195
|
+
type: _contractspec_lib_schema101.FieldType<string, string>;
|
|
196
|
+
isOptional: true;
|
|
197
|
+
};
|
|
198
|
+
}>;
|
|
199
|
+
//#endregion
|
|
200
|
+
export { CheckFeatureAccessInputModel, CheckFeatureAccessOutputModel, GetUsageSummaryInputModel, GetUsageSummaryOutputModel, RecordUsageInputModel, RecordUsageOutputModel, SubscriptionModel, UsageRecordedPayloadModel, UsageSummaryModel };
|
|
201
|
+
//# sourceMappingURL=billing.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.schema.d.ts","names":[],"sources":["../../src/billing/billing.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AASa,cAAA,iBAiBX,8BAjB4B,WAiB5B,CAAA;EAAA,EAAA,EAAA;UAAA,2BAAA,CAAA;;;;;;;;;;;;IAjB4B,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAsBjB,UAAA,EAAA,KAUX;EAAA,CAAA;;;;;;IAV4B,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;IAejB,UAAA,EAAA,KAAA;EAUX,CAAA;;;;;;;;EAVgC,CAAA;EAerB,iBAAA,EAAA;IASX,IAAA,uCAAA,CAAA,OAAA,EAAA,OAAA,CAAA;;;;;;AAKF;AAOE,cAnDW,iBAmDX,8BAnD4B,WAmD5B,CAAA;;UAzCA,2BAAA,CAAA,SAkCoC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAYzB,CAAA;EAWA,IAAA,EAAA;IAUX,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;IAVqC,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAe1B,UAAA,EAAA,IAAA;EAWA,CAAA;EAQX,UAAA,EAAA;;;;CARwC,CAAA;;;;cA9E7B,mDAAqB;;UAUhC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;cAKW,oDAAsB;;UASjC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;cAKW,uDAAyB;;UAOpC,2BAAA,CAAA;;;;;;;;;;;cAKW,2BAMX,2BAAA,CANoC;;UAMpC,2BAAA,CAAA;;;;;;;cAKW,wDAA0B;;UAUrC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,8BAMX,2BAAA,CANuC;;UAMvC,2BAAA,CAAA;;;;;;;cAKW,2DAA6B;;UAQxC,2BAAA,CAAA"}
|