@greatwait/contracts 0.2.0 → 0.2.2

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.
Files changed (46) hide show
  1. package/dist/billing.d.ts +339 -0
  2. package/dist/billing.js +131 -1
  3. package/dist/host-correlation.d.ts +4 -0
  4. package/dist/host-correlation.js +18 -0
  5. package/dist/identifiers.d.ts +2 -0
  6. package/dist/identifiers.js +3 -0
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +2 -1
  9. package/dist/operations.d.ts +514 -0
  10. package/dist/operations.js +93 -1
  11. package/dist/protocol.d.ts +2 -0
  12. package/dist/protocol.js +3 -0
  13. package/dist/scheduling-records.d.ts +4 -0
  14. package/dist/scheduling.d.ts +12 -0
  15. package/dist/scheduling.js +13 -0
  16. package/generated/v1/examples/billing.promotions.response.json +26 -0
  17. package/generated/v1/examples/billing.redeem.request.json +4 -0
  18. package/generated/v1/examples/billing.redeem.response.json +43 -0
  19. package/generated/v1/manifest.json +56 -0
  20. package/generated/v1/openapi.json +2749 -89
  21. package/generated/v1/policy-matrix.json +14 -0
  22. package/generated/v1/schemas/billing.change.response.json +64 -0
  23. package/generated/v1/schemas/billing.projects.response.json +64 -0
  24. package/generated/v1/schemas/billing.promotions.response.json +188 -0
  25. package/generated/v1/schemas/billing.quote.response.json +51 -0
  26. package/generated/v1/schemas/billing.reconcile.response.json +324 -0
  27. package/generated/v1/schemas/billing.redeem.request-headers.json +13 -0
  28. package/generated/v1/schemas/billing.redeem.request.json +22 -0
  29. package/generated/v1/schemas/billing.redeem.response-headers.json +10 -0
  30. package/generated/v1/schemas/billing.redeem.response.json +326 -0
  31. package/generated/v1/schemas/billing.summary.response.json +324 -0
  32. package/generated/v1/schemas/executions.list.query.json +12 -0
  33. package/generated/v1/schemas/schedules.archive.response.json +17 -0
  34. package/generated/v1/schemas/schedules.cancel.response.json +17 -0
  35. package/generated/v1/schemas/schedules.create.request.json +17 -0
  36. package/generated/v1/schemas/schedules.create.response.json +17 -0
  37. package/generated/v1/schemas/schedules.list.query.json +12 -0
  38. package/generated/v1/schemas/schedules.list.response.json +17 -0
  39. package/generated/v1/schemas/schedules.pause.response.json +17 -0
  40. package/generated/v1/schemas/schedules.read.response.json +17 -0
  41. package/generated/v1/schemas/schedules.replace.request.json +17 -0
  42. package/generated/v1/schemas/schedules.replace.response.json +17 -0
  43. package/generated/v1/schemas/schedules.resume.response.json +17 -0
  44. package/generated/v1/snippets/billing.promotions.json +6 -0
  45. package/generated/v1/snippets/billing.redeem.json +6 -0
  46. package/package.json +1 -1
@@ -160,6 +160,13 @@
160
160
  "roles": ["admin", "billing", "member"],
161
161
  "scopes": ["usage:read"]
162
162
  },
163
+ {
164
+ "mutates": false,
165
+ "operation": "billing.promotions",
166
+ "principals": ["api-credential", "oauth", "session"],
167
+ "roles": ["admin", "billing", "member"],
168
+ "scopes": ["usage:read"]
169
+ },
163
170
  {
164
171
  "mutates": true,
165
172
  "operation": "billing.purchase",
@@ -181,6 +188,13 @@
181
188
  "roles": ["admin", "billing"],
182
189
  "scopes": ["billing:write"]
183
190
  },
191
+ {
192
+ "mutates": true,
193
+ "operation": "billing.redeem",
194
+ "principals": ["api-credential", "oauth", "session"],
195
+ "roles": ["admin", "billing"],
196
+ "scopes": ["billing:write"]
197
+ },
184
198
  {
185
199
  "mutates": true,
186
200
  "operation": "billing.refundrequest",
@@ -67,11 +67,75 @@
67
67
  },
68
68
  "deleted": {
69
69
  "type": "boolean"
70
+ },
71
+ "complimentary": {
72
+ "type": "object",
73
+ "properties": {
74
+ "grant": {
75
+ "type": "string",
76
+ "pattern": "^grn_[0-9abcdefghjkmnpqrstvwxyz]{26}$"
77
+ },
78
+ "endsAt": {
79
+ "type": "string",
80
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
81
+ }
82
+ },
83
+ "required": ["grant", "endsAt"]
70
84
  }
71
85
  },
72
86
  "required": ["name", "project", "access", "deleted"]
73
87
  }
74
88
  },
89
+ "discount": {
90
+ "type": "object",
91
+ "properties": {
92
+ "grant": {
93
+ "type": "string",
94
+ "pattern": "^grn_[0-9abcdefghjkmnpqrstvwxyz]{26}$"
95
+ },
96
+ "duration": {
97
+ "type": "string",
98
+ "enum": ["once", "repeating"]
99
+ },
100
+ "durationInMonths": {
101
+ "type": "integer",
102
+ "minimum": 1,
103
+ "maximum": 12
104
+ },
105
+ "percentOff": {
106
+ "type": "integer",
107
+ "minimum": 1,
108
+ "maximum": 100
109
+ },
110
+ "amountOff": {
111
+ "type": "object",
112
+ "properties": {
113
+ "currency": {
114
+ "type": "string",
115
+ "const": "USD"
116
+ },
117
+ "microdollars": {
118
+ "type": "string",
119
+ "pattern": "^(?:0|[1-9]\\d*)$"
120
+ },
121
+ "scale": {
122
+ "type": "number",
123
+ "const": 6
124
+ }
125
+ },
126
+ "required": ["currency", "microdollars", "scale"]
127
+ },
128
+ "state": {
129
+ "type": "string",
130
+ "enum": ["pending", "applied"]
131
+ },
132
+ "appliedAt": {
133
+ "type": "string",
134
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
135
+ }
136
+ },
137
+ "required": ["grant", "duration", "state"]
138
+ },
75
139
  "pendingOperations": {
76
140
  "type": "array",
77
141
  "items": {
@@ -67,11 +67,75 @@
67
67
  },
68
68
  "deleted": {
69
69
  "type": "boolean"
70
+ },
71
+ "complimentary": {
72
+ "type": "object",
73
+ "properties": {
74
+ "grant": {
75
+ "type": "string",
76
+ "pattern": "^grn_[0-9abcdefghjkmnpqrstvwxyz]{26}$"
77
+ },
78
+ "endsAt": {
79
+ "type": "string",
80
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
81
+ }
82
+ },
83
+ "required": ["grant", "endsAt"]
70
84
  }
71
85
  },
72
86
  "required": ["name", "project", "access", "deleted"]
73
87
  }
74
88
  },
89
+ "discount": {
90
+ "type": "object",
91
+ "properties": {
92
+ "grant": {
93
+ "type": "string",
94
+ "pattern": "^grn_[0-9abcdefghjkmnpqrstvwxyz]{26}$"
95
+ },
96
+ "duration": {
97
+ "type": "string",
98
+ "enum": ["once", "repeating"]
99
+ },
100
+ "durationInMonths": {
101
+ "type": "integer",
102
+ "minimum": 1,
103
+ "maximum": 12
104
+ },
105
+ "percentOff": {
106
+ "type": "integer",
107
+ "minimum": 1,
108
+ "maximum": 100
109
+ },
110
+ "amountOff": {
111
+ "type": "object",
112
+ "properties": {
113
+ "currency": {
114
+ "type": "string",
115
+ "const": "USD"
116
+ },
117
+ "microdollars": {
118
+ "type": "string",
119
+ "pattern": "^(?:0|[1-9]\\d*)$"
120
+ },
121
+ "scale": {
122
+ "type": "number",
123
+ "const": 6
124
+ }
125
+ },
126
+ "required": ["currency", "microdollars", "scale"]
127
+ },
128
+ "state": {
129
+ "type": "string",
130
+ "enum": ["pending", "applied"]
131
+ },
132
+ "appliedAt": {
133
+ "type": "string",
134
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
135
+ }
136
+ },
137
+ "required": ["grant", "duration", "state"]
138
+ },
75
139
  "pendingOperations": {
76
140
  "type": "array",
77
141
  "items": {
@@ -0,0 +1,188 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "grants": {
6
+ "type": "array",
7
+ "items": {
8
+ "type": "object",
9
+ "properties": {
10
+ "id": {
11
+ "type": "string",
12
+ "pattern": "^grn_[0-9abcdefghjkmnpqrstvwxyz]{26}$"
13
+ },
14
+ "source": {
15
+ "type": "string",
16
+ "enum": ["operator", "code"]
17
+ },
18
+ "benefit": {
19
+ "oneOf": [
20
+ {
21
+ "type": "object",
22
+ "properties": {
23
+ "kind": {
24
+ "type": "string",
25
+ "const": "credit"
26
+ },
27
+ "amount": {
28
+ "type": "object",
29
+ "properties": {
30
+ "currency": {
31
+ "type": "string",
32
+ "const": "USD"
33
+ },
34
+ "microdollars": {
35
+ "type": "string",
36
+ "pattern": "^(?:0|[1-9]\\d*)$"
37
+ },
38
+ "scale": {
39
+ "type": "number",
40
+ "const": 6
41
+ }
42
+ },
43
+ "required": ["currency", "microdollars", "scale"]
44
+ }
45
+ },
46
+ "required": ["kind", "amount"]
47
+ },
48
+ {
49
+ "type": "object",
50
+ "properties": {
51
+ "kind": {
52
+ "type": "string",
53
+ "const": "project-slot"
54
+ },
55
+ "project": {
56
+ "type": "string",
57
+ "pattern": "^proj_[0-9abcdefghjkmnpqrstvwxyz]{26}$"
58
+ }
59
+ },
60
+ "required": ["kind", "project"]
61
+ },
62
+ {
63
+ "type": "object",
64
+ "properties": {
65
+ "kind": {
66
+ "type": "string",
67
+ "const": "perk"
68
+ },
69
+ "perk": {
70
+ "type": "string",
71
+ "pattern": "^[a-z][a-z0-9-]{0,63}$"
72
+ }
73
+ },
74
+ "required": ["kind", "perk"]
75
+ },
76
+ {
77
+ "type": "object",
78
+ "properties": {
79
+ "kind": {
80
+ "type": "string",
81
+ "const": "discount"
82
+ },
83
+ "percentOff": {
84
+ "type": "integer",
85
+ "minimum": 1,
86
+ "maximum": 100
87
+ },
88
+ "amountOff": {
89
+ "type": "object",
90
+ "properties": {
91
+ "currency": {
92
+ "type": "string",
93
+ "const": "USD"
94
+ },
95
+ "microdollars": {
96
+ "type": "string",
97
+ "pattern": "^(?:0|[1-9]\\d*)$"
98
+ },
99
+ "scale": {
100
+ "type": "number",
101
+ "const": 6
102
+ }
103
+ },
104
+ "required": ["currency", "microdollars", "scale"]
105
+ },
106
+ "duration": {
107
+ "type": "string",
108
+ "enum": ["once", "repeating"]
109
+ },
110
+ "durationInMonths": {
111
+ "type": "integer",
112
+ "minimum": 1,
113
+ "maximum": 12
114
+ }
115
+ },
116
+ "required": ["kind", "duration"]
117
+ }
118
+ ]
119
+ },
120
+ "state": {
121
+ "type": "string",
122
+ "enum": ["active", "expired", "revoked"]
123
+ },
124
+ "startsAt": {
125
+ "type": "string",
126
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
127
+ },
128
+ "endsAt": {
129
+ "type": "string",
130
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
131
+ },
132
+ "revokedAt": {
133
+ "type": "string",
134
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
135
+ }
136
+ },
137
+ "required": ["id", "source", "benefit", "state", "startsAt"]
138
+ }
139
+ },
140
+ "projectCapacity": {
141
+ "type": "object",
142
+ "properties": {
143
+ "included": {
144
+ "type": "integer",
145
+ "minimum": 0,
146
+ "maximum": 9007199254740991
147
+ },
148
+ "paid": {
149
+ "type": "integer",
150
+ "minimum": 0,
151
+ "maximum": 9007199254740991
152
+ },
153
+ "complimentary": {
154
+ "type": "integer",
155
+ "minimum": 0,
156
+ "maximum": 9007199254740991
157
+ }
158
+ },
159
+ "required": ["included", "paid", "complimentary"]
160
+ },
161
+ "perks": {
162
+ "type": "array",
163
+ "items": {
164
+ "type": "object",
165
+ "properties": {
166
+ "perk": {
167
+ "type": "string",
168
+ "pattern": "^[a-z][a-z0-9-]{0,63}$"
169
+ },
170
+ "endsAt": {
171
+ "type": "string",
172
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
173
+ }
174
+ },
175
+ "required": ["perk", "endsAt"]
176
+ }
177
+ },
178
+ "restrictions": {
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string",
182
+ "minLength": 1,
183
+ "maxLength": 300
184
+ }
185
+ }
186
+ },
187
+ "required": ["grants", "projectCapacity", "perks", "restrictions"]
188
+ }
@@ -70,6 +70,57 @@
70
70
  },
71
71
  "formerIncludedWillBlock": {
72
72
  "type": "boolean"
73
+ },
74
+ "discount": {
75
+ "type": "object",
76
+ "properties": {
77
+ "gross": {
78
+ "type": "object",
79
+ "properties": {
80
+ "currency": {
81
+ "type": "string",
82
+ "const": "USD"
83
+ },
84
+ "microdollars": {
85
+ "type": "string",
86
+ "pattern": "^(?:0|[1-9]\\d*)$"
87
+ },
88
+ "scale": {
89
+ "type": "number",
90
+ "const": 6
91
+ }
92
+ },
93
+ "required": ["currency", "microdollars", "scale"]
94
+ },
95
+ "amount": {
96
+ "type": "object",
97
+ "properties": {
98
+ "currency": {
99
+ "type": "string",
100
+ "const": "USD"
101
+ },
102
+ "microdollars": {
103
+ "type": "string",
104
+ "pattern": "^(?:0|[1-9]\\d*)$"
105
+ },
106
+ "scale": {
107
+ "type": "number",
108
+ "const": 6
109
+ }
110
+ },
111
+ "required": ["currency", "microdollars", "scale"]
112
+ },
113
+ "duration": {
114
+ "type": "string",
115
+ "enum": ["once", "repeating"]
116
+ },
117
+ "durationInMonths": {
118
+ "type": "integer",
119
+ "minimum": 1,
120
+ "maximum": 12
121
+ }
122
+ },
123
+ "required": ["gross", "amount", "duration"]
73
124
  }
74
125
  },
75
126
  "required": [