@openmeter/sdk 1.0.0-alpha.3 → 1.0.0-beta-7b2d9ed372e3

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 (261) hide show
  1. package/README.md +45 -62
  2. package/dist/cjs/index.cjs +18 -0
  3. package/dist/cjs/index.d.cts +1 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/src/apps.cjs +176 -0
  6. package/dist/cjs/src/apps.d.cts +338 -0
  7. package/dist/cjs/src/apps.js.map +1 -0
  8. package/dist/cjs/src/billing.cjs +309 -0
  9. package/dist/cjs/src/billing.d.cts +645 -0
  10. package/dist/cjs/src/billing.js.map +1 -0
  11. package/dist/cjs/src/client/apps.cjs +174 -0
  12. package/dist/cjs/src/client/apps.d.cts +339 -0
  13. package/dist/cjs/src/client/apps.js.map +1 -0
  14. package/dist/cjs/src/client/billing.cjs +309 -0
  15. package/dist/cjs/src/client/billing.d.cts +646 -0
  16. package/dist/cjs/src/client/billing.js.map +1 -0
  17. package/dist/cjs/src/client/customers.cjs +185 -0
  18. package/dist/cjs/src/client/customers.d.cts +232 -0
  19. package/dist/cjs/src/client/customers.js.map +1 -0
  20. package/dist/cjs/src/client/entitlements.cjs +244 -0
  21. package/dist/cjs/src/client/entitlements.d.cts +506 -0
  22. package/dist/cjs/src/client/entitlements.js.map +1 -0
  23. package/dist/cjs/src/client/events.cjs +65 -0
  24. package/dist/cjs/src/client/events.d.cts +102 -0
  25. package/dist/cjs/src/client/events.js.map +1 -0
  26. package/dist/cjs/src/client/features.cjs +78 -0
  27. package/dist/cjs/src/client/features.d.cts +154 -0
  28. package/dist/cjs/src/client/features.js.map +1 -0
  29. package/dist/cjs/src/client/index.cjs +100 -0
  30. package/dist/cjs/src/client/index.d.cts +42 -0
  31. package/dist/cjs/src/client/index.js.map +1 -0
  32. package/dist/cjs/src/client/meters.cjs +93 -0
  33. package/dist/cjs/src/client/meters.d.cts +185 -0
  34. package/dist/cjs/src/client/meters.js.map +1 -0
  35. package/dist/cjs/src/client/notifications.cjs +249 -0
  36. package/dist/cjs/src/client/notifications.d.cts +315 -0
  37. package/dist/cjs/src/client/notifications.js.map +1 -0
  38. package/dist/cjs/src/client/plans.cjs +127 -0
  39. package/dist/cjs/src/client/plans.d.cts +193 -0
  40. package/dist/cjs/src/client/plans.js.map +1 -0
  41. package/dist/cjs/src/client/portal.cjs +55 -0
  42. package/dist/cjs/src/client/portal.d.cts +72 -0
  43. package/dist/cjs/src/client/portal.js.map +1 -0
  44. package/dist/cjs/src/client/subjects.cjs +76 -0
  45. package/dist/cjs/src/client/subjects.d.cts +102 -0
  46. package/dist/cjs/src/client/subjects.js.map +1 -0
  47. package/dist/cjs/src/client/subscriptions.cjs +116 -0
  48. package/dist/cjs/src/client/subscriptions.d.cts +198 -0
  49. package/dist/cjs/src/client/subscriptions.js.map +1 -0
  50. package/dist/cjs/src/client/utils.cjs +93 -0
  51. package/dist/cjs/src/client/utils.d.cts +30 -0
  52. package/dist/cjs/src/client/utils.js.map +1 -0
  53. package/dist/cjs/src/customers.cjs +185 -0
  54. package/dist/cjs/src/customers.d.cts +231 -0
  55. package/dist/cjs/src/customers.js.map +1 -0
  56. package/dist/cjs/src/entitlements.cjs +244 -0
  57. package/dist/cjs/src/entitlements.d.cts +505 -0
  58. package/dist/cjs/src/entitlements.js.map +1 -0
  59. package/dist/cjs/src/events.cjs +65 -0
  60. package/dist/cjs/src/events.d.cts +101 -0
  61. package/dist/cjs/src/events.js.map +1 -0
  62. package/dist/cjs/src/features.cjs +78 -0
  63. package/dist/cjs/src/features.d.cts +153 -0
  64. package/dist/cjs/src/features.js.map +1 -0
  65. package/dist/cjs/src/meters.cjs +93 -0
  66. package/dist/cjs/src/meters.d.cts +184 -0
  67. package/dist/cjs/src/meters.js.map +1 -0
  68. package/dist/cjs/src/notifications.cjs +249 -0
  69. package/dist/cjs/src/notifications.d.cts +314 -0
  70. package/dist/cjs/src/notifications.js.map +1 -0
  71. package/dist/cjs/src/plans.cjs +127 -0
  72. package/dist/cjs/src/plans.d.cts +192 -0
  73. package/dist/cjs/src/plans.js.map +1 -0
  74. package/dist/cjs/src/portal/index.cjs +57 -0
  75. package/dist/cjs/src/portal/index.d.cts +113 -0
  76. package/dist/cjs/src/portal/index.js.map +1 -0
  77. package/dist/cjs/src/react/context.cjs +35 -0
  78. package/dist/cjs/src/react/context.d.cts +9 -0
  79. package/dist/cjs/src/react/context.js.map +1 -0
  80. package/dist/cjs/src/subjects.cjs +76 -0
  81. package/dist/cjs/src/subjects.d.cts +101 -0
  82. package/dist/cjs/src/subjects.js.map +1 -0
  83. package/dist/cjs/src/subscriptions.cjs +116 -0
  84. package/dist/cjs/src/subscriptions.d.cts +197 -0
  85. package/dist/cjs/src/subscriptions.js.map +1 -0
  86. package/dist/cjs/src/utils.cjs +93 -0
  87. package/dist/cjs/src/utils.d.cts +29 -0
  88. package/dist/cjs/src/utils.js.map +1 -0
  89. package/dist/cjs/tsconfig.01ab6c6b.tsbuildinfo +1 -0
  90. package/dist/cjs/tsconfig.1e12acbb.tsbuildinfo +1 -0
  91. package/dist/cjs/tsconfig.38849cd1.tsbuildinfo +1 -0
  92. package/dist/cjs/tsconfig.3bd7bdb7.tsbuildinfo +1 -0
  93. package/dist/cjs/tsconfig.3db00db7.tsbuildinfo +1 -0
  94. package/dist/cjs/tsconfig.5cd8af0a.tsbuildinfo +1 -0
  95. package/dist/cjs/tsconfig.64c40770.tsbuildinfo +1 -0
  96. package/dist/cjs/tsconfig.769a7751.tsbuildinfo +1 -0
  97. package/dist/cjs/tsconfig.8fd1c6cd.tsbuildinfo +1 -0
  98. package/dist/cjs/tsconfig.c9e83bdd.tsbuildinfo +1 -0
  99. package/dist/cjs/tsconfig.d3cb3b9e.tsbuildinfo +1 -0
  100. package/dist/cjs/tsconfig.db7aa141.tsbuildinfo +1 -0
  101. package/dist/cjs/tsconfig.edd7b7ed.tsbuildinfo +1 -0
  102. package/dist/cjs/tsconfig.f343a141.tsbuildinfo +1 -0
  103. package/dist/cjs/tsconfig.f36f8639.tsbuildinfo +1 -0
  104. package/dist/cjs/tsconfig.fc8d5fa4.tsbuildinfo +1 -0
  105. package/dist/index.d.ts +1 -23
  106. package/dist/index.js +2 -28
  107. package/dist/index.js.map +1 -0
  108. package/dist/src/apps.d.ts +338 -0
  109. package/dist/src/apps.js +170 -0
  110. package/dist/src/apps.js.map +1 -0
  111. package/dist/src/billing.d.ts +645 -0
  112. package/dist/src/billing.js +302 -0
  113. package/dist/src/billing.js.map +1 -0
  114. package/dist/src/client/apps.d.ts +339 -0
  115. package/dist/src/client/apps.js +168 -0
  116. package/dist/src/client/apps.js.map +1 -0
  117. package/dist/src/client/billing.d.ts +646 -0
  118. package/dist/src/client/billing.js +302 -0
  119. package/dist/src/client/billing.js.map +1 -0
  120. package/dist/src/client/customers.d.ts +232 -0
  121. package/dist/src/client/customers.js +179 -0
  122. package/dist/src/client/customers.js.map +1 -0
  123. package/dist/src/client/entitlements.d.ts +506 -0
  124. package/dist/src/client/entitlements.js +239 -0
  125. package/dist/src/client/entitlements.js.map +1 -0
  126. package/dist/src/client/events.d.ts +102 -0
  127. package/dist/src/client/events.js +58 -0
  128. package/dist/src/client/events.js.map +1 -0
  129. package/dist/src/client/features.d.ts +154 -0
  130. package/dist/src/client/features.js +74 -0
  131. package/dist/src/client/features.js.map +1 -0
  132. package/dist/src/client/index.d.ts +42 -0
  133. package/dist/src/client/index.js +63 -0
  134. package/dist/src/client/index.js.map +1 -0
  135. package/dist/src/client/meters.d.ts +185 -0
  136. package/dist/src/client/meters.js +89 -0
  137. package/dist/src/client/meters.js.map +1 -0
  138. package/dist/src/client/notifications.d.ts +315 -0
  139. package/dist/src/client/notifications.js +242 -0
  140. package/dist/src/client/notifications.js.map +1 -0
  141. package/dist/src/client/plans.d.ts +193 -0
  142. package/dist/src/client/plans.js +123 -0
  143. package/dist/src/client/plans.js.map +1 -0
  144. package/dist/src/client/portal.d.ts +72 -0
  145. package/dist/src/client/portal.js +51 -0
  146. package/dist/src/client/portal.js.map +1 -0
  147. package/dist/src/client/subjects.d.ts +102 -0
  148. package/dist/src/client/subjects.js +72 -0
  149. package/dist/src/client/subjects.js.map +1 -0
  150. package/dist/src/client/subscriptions.d.ts +198 -0
  151. package/dist/src/client/subscriptions.js +112 -0
  152. package/dist/src/client/subscriptions.js.map +1 -0
  153. package/dist/src/client/utils.d.ts +30 -0
  154. package/dist/src/client/utils.js +85 -0
  155. package/dist/src/client/utils.js.map +1 -0
  156. package/dist/src/customers.d.ts +231 -0
  157. package/dist/src/customers.js +179 -0
  158. package/dist/src/customers.js.map +1 -0
  159. package/dist/src/entitlements.d.ts +505 -0
  160. package/dist/src/entitlements.js +239 -0
  161. package/dist/src/entitlements.js.map +1 -0
  162. package/dist/src/events.d.ts +101 -0
  163. package/dist/src/events.js +58 -0
  164. package/dist/src/events.js.map +1 -0
  165. package/dist/src/features.d.ts +153 -0
  166. package/dist/src/features.js +74 -0
  167. package/dist/src/features.js.map +1 -0
  168. package/dist/src/meters.d.ts +184 -0
  169. package/dist/src/meters.js +89 -0
  170. package/dist/src/meters.js.map +1 -0
  171. package/dist/src/notifications.d.ts +314 -0
  172. package/dist/src/notifications.js +242 -0
  173. package/dist/src/notifications.js.map +1 -0
  174. package/dist/src/plans.d.ts +192 -0
  175. package/dist/src/plans.js +123 -0
  176. package/dist/src/plans.js.map +1 -0
  177. package/dist/src/portal/index.d.ts +113 -0
  178. package/dist/src/portal/index.js +50 -0
  179. package/dist/src/portal/index.js.map +1 -0
  180. package/dist/src/react/context.d.ts +9 -0
  181. package/dist/src/react/context.js +16 -0
  182. package/dist/src/react/context.js.map +1 -0
  183. package/dist/src/subjects.d.ts +101 -0
  184. package/dist/src/subjects.js +72 -0
  185. package/dist/src/subjects.js.map +1 -0
  186. package/dist/src/subscriptions.d.ts +197 -0
  187. package/dist/src/subscriptions.js +112 -0
  188. package/dist/src/subscriptions.js.map +1 -0
  189. package/dist/src/utils.d.ts +29 -0
  190. package/dist/src/utils.js +85 -0
  191. package/dist/src/utils.js.map +1 -0
  192. package/dist/tsconfig.tsbuildinfo +1 -1
  193. package/package.json +95 -57
  194. package/patches/openapi-typescript.patch +73 -0
  195. package/dist/generated/HttpService.d.ts +0 -14
  196. package/dist/generated/HttpService.js +0 -27
  197. package/dist/generated/core/ApiError.d.ts +0 -10
  198. package/dist/generated/core/ApiError.js +0 -17
  199. package/dist/generated/core/ApiRequestOptions.d.ts +0 -13
  200. package/dist/generated/core/ApiRequestOptions.js +0 -2
  201. package/dist/generated/core/ApiResult.d.ts +0 -7
  202. package/dist/generated/core/ApiResult.js +0 -2
  203. package/dist/generated/core/BaseHttpRequest.d.ts +0 -8
  204. package/dist/generated/core/BaseHttpRequest.js +0 -7
  205. package/dist/generated/core/CancelablePromise.d.ts +0 -20
  206. package/dist/generated/core/CancelablePromise.js +0 -93
  207. package/dist/generated/core/NodeHttpRequest.d.ts +0 -14
  208. package/dist/generated/core/NodeHttpRequest.js +0 -17
  209. package/dist/generated/core/OpenAPI.d.ts +0 -16
  210. package/dist/generated/core/OpenAPI.js +0 -12
  211. package/dist/generated/core/request.d.ts +0 -34
  212. package/dist/generated/core/request.js +0 -268
  213. package/dist/generated/index.d.ts +0 -29
  214. package/dist/generated/index.js +0 -22
  215. package/dist/generated/models/Event.d.ts +0 -49
  216. package/dist/generated/models/Event.js +0 -11
  217. package/dist/generated/models/IdOrSlug.d.ts +0 -1
  218. package/dist/generated/models/IdOrSlug.js +0 -2
  219. package/dist/generated/models/Meter.d.ts +0 -30
  220. package/dist/generated/models/Meter.js +0 -2
  221. package/dist/generated/models/MeterAggregation.d.ts +0 -10
  222. package/dist/generated/models/MeterAggregation.js +0 -12
  223. package/dist/generated/models/MeterValue.d.ts +0 -10
  224. package/dist/generated/models/MeterValue.js +0 -2
  225. package/dist/generated/models/Namespace.d.ts +0 -6
  226. package/dist/generated/models/Namespace.js +0 -2
  227. package/dist/generated/models/Problem.d.ts +0 -4
  228. package/dist/generated/models/Problem.js +0 -2
  229. package/dist/generated/models/WindowSize.d.ts +0 -5
  230. package/dist/generated/models/WindowSize.js +0 -7
  231. package/dist/generated/models/meterIdOrSlug.d.ts +0 -5
  232. package/dist/generated/models/meterIdOrSlug.js +0 -2
  233. package/dist/generated/models/namespaceParam.d.ts +0 -4
  234. package/dist/generated/models/namespaceParam.js +0 -2
  235. package/dist/generated/schemas/$Event.d.ts +0 -59
  236. package/dist/generated/schemas/$Event.js +0 -60
  237. package/dist/generated/schemas/$IdOrSlug.d.ts +0 -13
  238. package/dist/generated/schemas/$IdOrSlug.js +0 -14
  239. package/dist/generated/schemas/$Meter.d.ts +0 -44
  240. package/dist/generated/schemas/$Meter.js +0 -45
  241. package/dist/generated/schemas/$MeterAggregation.d.ts +0 -3
  242. package/dist/generated/schemas/$MeterAggregation.js +0 -4
  243. package/dist/generated/schemas/$MeterValue.d.ts +0 -26
  244. package/dist/generated/schemas/$MeterValue.js +0 -27
  245. package/dist/generated/schemas/$Namespace.d.ts +0 -9
  246. package/dist/generated/schemas/$Namespace.js +0 -10
  247. package/dist/generated/schemas/$Problem.d.ts +0 -6
  248. package/dist/generated/schemas/$Problem.js +0 -7
  249. package/dist/generated/schemas/$WindowSize.d.ts +0 -3
  250. package/dist/generated/schemas/$WindowSize.js +0 -4
  251. package/dist/generated/schemas/$meterIdOrSlug.d.ts +0 -4
  252. package/dist/generated/schemas/$meterIdOrSlug.js +0 -5
  253. package/dist/generated/schemas/$namespaceParam.d.ts +0 -5
  254. package/dist/generated/schemas/$namespaceParam.js +0 -6
  255. package/dist/generated/services/DefaultService.d.ts +0 -16
  256. package/dist/generated/services/DefaultService.js +0 -22
  257. package/dist/generated/services/EventsService.d.ts +0 -17
  258. package/dist/generated/services/EventsService.js +0 -29
  259. package/dist/generated/services/MetersService.d.ts +0 -75
  260. package/dist/generated/services/MetersService.js +0 -140
  261. package/index.ts +0 -53
@@ -0,0 +1,506 @@
1
+ import { type RequestOptions } from './utils.cjs';
2
+ import type { EntitlementCreateInputs, EntitlementGrantCreateInput, operations, paths, ResetEntitlementUsageInput } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Entitlements
6
+ * @description With Entitlements, you can define and enforce usage limits, implement quota-based pricing, and manage access to features in your application.
7
+ */
8
+ export declare class Entitlements {
9
+ private client;
10
+ grants: Grants;
11
+ constructor(client: Client<paths, `${string}/${string}`>);
12
+ /**
13
+ * Create an entitlement
14
+ *
15
+ * - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
16
+ * - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
17
+ * - Metered entitlements have many use cases, from setting up usage-based access to implementing complex credit systems. Example: The customer can use 10000 AI tokens during the usage period of the entitlement.
18
+ *
19
+ * A given subject can only have one active (non-deleted) entitlement per featureKey. If you try to create a new entitlement for a featureKey that already has an active entitlement, the request will fail with a 409 error.
20
+ *
21
+ * Once an entitlement is created you cannot modify it, only delete it.
22
+ *
23
+ * @param subjectIdOrKey - The ID or key of the subject
24
+ * @param entitlement - The entitlement to create
25
+ * @param signal - An optional abort signal
26
+ * @returns The created entitlement
27
+ */
28
+ create(subjectIdOrKey: operations['createEntitlement']['parameters']['path']['subjectIdOrKey'], entitlement: EntitlementCreateInputs, options?: RequestOptions): Promise<{
29
+ data?: never;
30
+ error: import("./utils.cjs").Problem;
31
+ response: Response;
32
+ } | {
33
+ data: import("openapi-typescript-helpers").SuccessResponse<{
34
+ 201: {
35
+ headers: {
36
+ [name: string]: unknown;
37
+ };
38
+ content: {
39
+ "application/json": import("./schemas.cjs").components["schemas"]["Entitlement"];
40
+ };
41
+ };
42
+ 400: {
43
+ headers: {
44
+ [name: string]: unknown;
45
+ };
46
+ content: {
47
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["BadRequestProblemResponse"];
48
+ };
49
+ };
50
+ 401: {
51
+ headers: {
52
+ [name: string]: unknown;
53
+ };
54
+ content: {
55
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnauthorizedProblemResponse"];
56
+ };
57
+ };
58
+ 403: {
59
+ headers: {
60
+ [name: string]: unknown;
61
+ };
62
+ content: {
63
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ForbiddenProblemResponse"];
64
+ };
65
+ };
66
+ 409: {
67
+ headers: {
68
+ [name: string]: unknown;
69
+ };
70
+ content: {
71
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ConflictProblemResponse"];
72
+ };
73
+ };
74
+ 500: {
75
+ headers: {
76
+ [name: string]: unknown;
77
+ };
78
+ content: {
79
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["InternalServerErrorProblemResponse"];
80
+ };
81
+ };
82
+ 503: {
83
+ headers: {
84
+ [name: string]: unknown;
85
+ };
86
+ content: {
87
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ServiceUnavailableProblemResponse"];
88
+ };
89
+ };
90
+ default: {
91
+ headers: {
92
+ [name: string]: unknown;
93
+ };
94
+ content: {
95
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnexpectedProblemResponse"];
96
+ };
97
+ };
98
+ }, `${string}/${string}`>;
99
+ error?: never;
100
+ response: Response;
101
+ }>;
102
+ /**
103
+ * Get an entitlement by ID
104
+ *
105
+ * @param id - The ID of the entitlement
106
+ * @param signal - An optional abort signal
107
+ * @returns The entitlement
108
+ */
109
+ get(id: operations['getEntitlement']['parameters']['path']['entitlementId'], options?: RequestOptions): Promise<{
110
+ data?: never;
111
+ error: import("./utils.cjs").Problem;
112
+ response: Response;
113
+ } | {
114
+ data: import("openapi-typescript-helpers").SuccessResponse<{
115
+ 200: {
116
+ headers: {
117
+ [name: string]: unknown;
118
+ };
119
+ content: {
120
+ "application/json": import("./schemas.cjs").components["schemas"]["Entitlement"];
121
+ };
122
+ };
123
+ 400: {
124
+ headers: {
125
+ [name: string]: unknown;
126
+ };
127
+ content: {
128
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["BadRequestProblemResponse"];
129
+ };
130
+ };
131
+ 401: {
132
+ headers: {
133
+ [name: string]: unknown;
134
+ };
135
+ content: {
136
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnauthorizedProblemResponse"];
137
+ };
138
+ };
139
+ 403: {
140
+ headers: {
141
+ [name: string]: unknown;
142
+ };
143
+ content: {
144
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ForbiddenProblemResponse"];
145
+ };
146
+ };
147
+ 404: {
148
+ headers: {
149
+ [name: string]: unknown;
150
+ };
151
+ content: {
152
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["NotFoundProblemResponse"];
153
+ };
154
+ };
155
+ 500: {
156
+ headers: {
157
+ [name: string]: unknown;
158
+ };
159
+ content: {
160
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["InternalServerErrorProblemResponse"];
161
+ };
162
+ };
163
+ 503: {
164
+ headers: {
165
+ [name: string]: unknown;
166
+ };
167
+ content: {
168
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ServiceUnavailableProblemResponse"];
169
+ };
170
+ };
171
+ default: {
172
+ headers: {
173
+ [name: string]: unknown;
174
+ };
175
+ content: {
176
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnexpectedProblemResponse"];
177
+ };
178
+ };
179
+ }, `${string}/${string}`>;
180
+ error?: never;
181
+ response: Response;
182
+ }>;
183
+ /**
184
+ * List entitlements
185
+ *
186
+ * @param query - The query parameters
187
+ * @param signal - An optional abort signal
188
+ * @returns The entitlements
189
+ */
190
+ list(query?: operations['listEntitlements']['parameters']['query'], options?: RequestOptions): Promise<{
191
+ data?: never;
192
+ error: import("./utils.cjs").Problem;
193
+ response: Response;
194
+ } | {
195
+ data: import("openapi-typescript-helpers").SuccessResponse<{
196
+ 200: {
197
+ headers: {
198
+ [name: string]: unknown;
199
+ };
200
+ content: {
201
+ "application/json": import("./schemas.cjs").components["schemas"]["ListEntitlementsResult"];
202
+ };
203
+ };
204
+ 400: {
205
+ headers: {
206
+ [name: string]: unknown;
207
+ };
208
+ content: {
209
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["BadRequestProblemResponse"];
210
+ };
211
+ };
212
+ 401: {
213
+ headers: {
214
+ [name: string]: unknown;
215
+ };
216
+ content: {
217
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnauthorizedProblemResponse"];
218
+ };
219
+ };
220
+ 403: {
221
+ headers: {
222
+ [name: string]: unknown;
223
+ };
224
+ content: {
225
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ForbiddenProblemResponse"];
226
+ };
227
+ };
228
+ 500: {
229
+ headers: {
230
+ [name: string]: unknown;
231
+ };
232
+ content: {
233
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["InternalServerErrorProblemResponse"];
234
+ };
235
+ };
236
+ 503: {
237
+ headers: {
238
+ [name: string]: unknown;
239
+ };
240
+ content: {
241
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ServiceUnavailableProblemResponse"];
242
+ };
243
+ };
244
+ default: {
245
+ headers: {
246
+ [name: string]: unknown;
247
+ };
248
+ content: {
249
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnexpectedProblemResponse"];
250
+ };
251
+ };
252
+ }, `${string}/${string}`>;
253
+ error?: never;
254
+ response: Response;
255
+ }>;
256
+ /**
257
+ * Delete an entitlement
258
+ *
259
+ * @param subjectIdOrKey - The ID or key of the subject
260
+ * @param entitlementId - The ID of the entitlement
261
+ * @param signal - An optional abort signal
262
+ * @returns The deleted entitlement
263
+ */
264
+ delete(subjectIdOrKey: operations['deleteEntitlement']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['deleteEntitlement']['parameters']['path']['entitlementId'], options?: RequestOptions): Promise<{
265
+ data?: never;
266
+ error: import("./utils.cjs").Problem;
267
+ response: Response;
268
+ } | {
269
+ data: undefined;
270
+ error?: never;
271
+ response: Response;
272
+ }>;
273
+ /**
274
+ * Get the value of an entitlement to check access
275
+ * All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
276
+ *
277
+ * @param subjectIdOrKey - The ID or key of the subject
278
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
279
+ * @param query - The query parameters
280
+ * @param signal - An optional abort signal
281
+ * @returns The entitlement value
282
+ */
283
+ value(subjectIdOrKey: operations['getEntitlementValue']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['getEntitlementValue']['parameters']['path']['entitlementIdOrFeatureKey'], query?: operations['getEntitlementValue']['parameters']['query'], options?: RequestOptions): Promise<{
284
+ data?: never;
285
+ error: import("./utils.cjs").Problem;
286
+ response: Response;
287
+ } | {
288
+ data: {
289
+ readonly hasAccess: boolean;
290
+ readonly balance?: number;
291
+ readonly usage?: number;
292
+ readonly overage?: number;
293
+ readonly config?: string;
294
+ };
295
+ error?: never;
296
+ response: Response;
297
+ }>;
298
+ /**
299
+ * Get the history of an entitlement
300
+ * Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
301
+ *
302
+ * @param subjectIdOrKey - The ID or key of the subject
303
+ * @param entitlementId - The ID of the entitlement
304
+ * @param query - The query parameters
305
+ * @param signal - An optional abort signal
306
+ * @returns The history of the entitlement
307
+ */
308
+ history(subjectIdOrKey: operations['getEntitlementHistory']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['getEntitlementHistory']['parameters']['path']['entitlementId'], query: operations['getEntitlementHistory']['parameters']['query'], options?: RequestOptions): Promise<{
309
+ data?: never;
310
+ error: import("./utils.cjs").Problem;
311
+ response: Response;
312
+ } | {
313
+ data: {
314
+ windowedHistory: import("./schemas.cjs").components["schemas"]["BalanceHistoryWindow"][];
315
+ burndownHistory: import("./schemas.cjs").components["schemas"]["GrantBurnDownHistorySegment"][];
316
+ };
317
+ error?: never;
318
+ response: Response;
319
+ }>;
320
+ /**
321
+ * Override an entitlement
322
+ * This is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
323
+ *
324
+ * @param subjectIdOrKey - The ID or key of the subject
325
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
326
+ * @param override - The override to create
327
+ * @param signal - An optional abort signal
328
+ * @returns The overridden entitlement
329
+ */
330
+ override(subjectIdOrKey: operations['overrideEntitlement']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['overrideEntitlement']['parameters']['path']['entitlementIdOrFeatureKey'], override: EntitlementCreateInputs, options?: RequestOptions): Promise<{
331
+ data?: never;
332
+ error: import("./utils.cjs").Problem;
333
+ response: Response;
334
+ } | {
335
+ data: import("openapi-typescript-helpers").SuccessResponse<{
336
+ 201: {
337
+ headers: {
338
+ [name: string]: unknown;
339
+ };
340
+ content: {
341
+ "application/json": import("./schemas.cjs").components["schemas"]["Entitlement"];
342
+ };
343
+ };
344
+ 400: {
345
+ headers: {
346
+ [name: string]: unknown;
347
+ };
348
+ content: {
349
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["BadRequestProblemResponse"];
350
+ };
351
+ };
352
+ 401: {
353
+ headers: {
354
+ [name: string]: unknown;
355
+ };
356
+ content: {
357
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnauthorizedProblemResponse"];
358
+ };
359
+ };
360
+ 403: {
361
+ headers: {
362
+ [name: string]: unknown;
363
+ };
364
+ content: {
365
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ForbiddenProblemResponse"];
366
+ };
367
+ };
368
+ 404: {
369
+ headers: {
370
+ [name: string]: unknown;
371
+ };
372
+ content: {
373
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["NotFoundProblemResponse"];
374
+ };
375
+ };
376
+ 409: {
377
+ headers: {
378
+ [name: string]: unknown;
379
+ };
380
+ content: {
381
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ConflictProblemResponse"];
382
+ };
383
+ };
384
+ 500: {
385
+ headers: {
386
+ [name: string]: unknown;
387
+ };
388
+ content: {
389
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["InternalServerErrorProblemResponse"];
390
+ };
391
+ };
392
+ 503: {
393
+ headers: {
394
+ [name: string]: unknown;
395
+ };
396
+ content: {
397
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["ServiceUnavailableProblemResponse"];
398
+ };
399
+ };
400
+ default: {
401
+ headers: {
402
+ [name: string]: unknown;
403
+ };
404
+ content: {
405
+ "application/problem+json": import("./schemas.cjs").components["schemas"]["UnexpectedProblemResponse"];
406
+ };
407
+ };
408
+ }, `${string}/${string}`>;
409
+ error?: never;
410
+ response: Response;
411
+ }>;
412
+ /**
413
+ * Reset entitlement usage
414
+ * - Reset marks the start of a new usage period for the entitlement and initiates grant rollover. At the start of a period usage is zerod out and grants are rolled over based on their rollover settings. It would typically be synced with the subjects billing period to enforce usage based on their subscription.
415
+ * - Usage is automatically reset for metered entitlements based on their usage period, but this endpoint allows to manually reset it at any time. When doing so the period anchor of the entitlement can be changed if needed.
416
+ *
417
+ * @param subjectIdOrKey - The ID or key of the subject
418
+ * @param entitlementId - The ID of the entitlement
419
+ * @param body - The body of the request
420
+ * @param signal - An optional abort signal
421
+ * @returns The reset entitlement
422
+ */
423
+ reset(subjectIdOrKey: operations['resetEntitlementUsage']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['resetEntitlementUsage']['parameters']['path']['entitlementId'], body: ResetEntitlementUsageInput, options?: RequestOptions): Promise<{
424
+ data?: never;
425
+ error: import("./utils.cjs").Problem;
426
+ response: Response;
427
+ } | {
428
+ data: undefined;
429
+ error?: never;
430
+ response: Response;
431
+ }>;
432
+ }
433
+ export declare class Grants {
434
+ private client;
435
+ constructor(client: Client<paths, `${string}/${string}`>);
436
+ /**
437
+ /**
438
+ * Grant usage to a subject for an entitlement
439
+ *
440
+ * @param subjectIdOrKey - The ID or key of the subject
441
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
442
+ * @param grant - The grant to create
443
+ * @param signal - An optional abort signal
444
+ * @returns The created grant
445
+ */
446
+ create(subjectIdOrKey: operations['createGrant']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['createGrant']['parameters']['path']['entitlementIdOrFeatureKey'], grant: EntitlementGrantCreateInput, options?: RequestOptions): Promise<{
447
+ data?: never;
448
+ error: import("./utils.cjs").Problem;
449
+ response: Response;
450
+ } | {
451
+ data: {
452
+ readonly createdAt: Date;
453
+ readonly updatedAt: Date;
454
+ readonly deletedAt?: Date;
455
+ amount: number;
456
+ priority?: number;
457
+ effectiveAt: Date;
458
+ expiration: import("./schemas.cjs").components["schemas"]["ExpirationPeriod"];
459
+ maxRolloverAmount?: number;
460
+ minRolloverAmount?: number;
461
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
462
+ readonly id: string;
463
+ readonly entitlementId: string;
464
+ nextRecurrence?: Date;
465
+ readonly expiresAt?: Date;
466
+ voidedAt?: Date;
467
+ recurrence?: import("./schemas.cjs").components["schemas"]["RecurringPeriod"];
468
+ };
469
+ error?: never;
470
+ response: Response;
471
+ }>;
472
+ /**
473
+ * List grants for an entitlement
474
+ *
475
+ * @param subjectIdOrKey - The ID or key of the subject
476
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
477
+ * @param signal - An optional abort signal
478
+ * @returns The grants
479
+ */
480
+ list(subjectIdOrKey: operations['listEntitlementGrants']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['listEntitlementGrants']['parameters']['path']['entitlementIdOrFeatureKey'], query?: operations['listEntitlementGrants']['parameters']['query'], options?: RequestOptions): Promise<{
481
+ data?: never;
482
+ error: import("./utils.cjs").Problem;
483
+ response: Response;
484
+ } | {
485
+ data: {
486
+ readonly createdAt: Date;
487
+ readonly updatedAt: Date;
488
+ readonly deletedAt?: Date;
489
+ amount: number;
490
+ priority?: number;
491
+ effectiveAt: Date;
492
+ expiration: import("./schemas.cjs").components["schemas"]["ExpirationPeriod"];
493
+ maxRolloverAmount?: number;
494
+ minRolloverAmount?: number;
495
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
496
+ readonly id: string;
497
+ readonly entitlementId: string;
498
+ nextRecurrence?: Date;
499
+ readonly expiresAt?: Date;
500
+ voidedAt?: Date;
501
+ recurrence?: import("./schemas.cjs").components["schemas"]["RecurringPeriod"];
502
+ }[];
503
+ error?: never;
504
+ response: Response;
505
+ }>;
506
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../../../../src/client/entitlements.ts"],"names":[],"mappings":";;;AAAA,yCAAmE;AAUnE;;;GAGG;AACH,MAAa,YAAY;IAGH;IAFb,MAAM,CAAQ;IAErB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;QAC9D,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAA;IAClC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,MAAM,CACjB,cAAuF,EACvF,WAAoC,EACpC,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,gDAAgD,EAChD;YACE,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,cAAc,EAAE,cAAc;iBAC/B;aACF;YACD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,GAAG,CACd,EAAuE,EACvE,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sCAAsC,EAAE;YACzE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,aAAa,EAAE,EAAE;iBAClB;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,CACf,KAA6D,EAC7D,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,G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AiH,EACjH,KAAkE,EAClE,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,mFAAmF,EACnF;YACE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,yBAAyB;oBACzB,cAAc;iBACf;gBACD,KAAK;aACN;YACD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAlED,wBAkEC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Events = void 0;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const utils_js_1 = require("./utils.cjs");
9
+ /**
10
+ * Events are used to track usage of your product or service.
11
+ * Events are processed asynchronously by the meters, so they may not be immediately available for querying.
12
+ */
13
+ class Events {
14
+ client;
15
+ constructor(client) {
16
+ this.client = client;
17
+ }
18
+ /**
19
+ * Ingests an event or batch of events
20
+ * @param events - The events to ingest
21
+ * @param signal - An optional abort signal
22
+ * @returns The ingested events
23
+ */
24
+ async ingest(events, options) {
25
+ const body = (Array.isArray(events) ? events : [events]).map(transformEvent);
26
+ const resp = await this.client.POST('/api/v1/events', {
27
+ body,
28
+ headers: {
29
+ 'Content-Type': 'application/cloudevents-batch+json',
30
+ },
31
+ ...options,
32
+ });
33
+ return (0, utils_js_1.transformResponse)(resp);
34
+ }
35
+ /**
36
+ * List ingested events
37
+ * @param query - The query parameters
38
+ * @param signal - An optional abort signal
39
+ * @returns The events
40
+ */
41
+ async list(query, options) {
42
+ const resp = await this.client.GET('/api/v1/events', {
43
+ params: {
44
+ query,
45
+ },
46
+ ...options,
47
+ });
48
+ return (0, utils_js_1.transformResponse)(resp);
49
+ }
50
+ }
51
+ exports.Events = Events;
52
+ function transformEvent(ev) {
53
+ return {
54
+ data: ev.data,
55
+ datacontenttype: ev.datacontenttype ?? 'application/json',
56
+ dataschema: ev.dataschema,
57
+ id: ev.id ?? crypto_1.default.randomUUID(),
58
+ source: ev.source ?? '@openmeter/sdk',
59
+ specversion: ev.specversion ?? '1.0',
60
+ subject: ev.subject,
61
+ time: ev.time,
62
+ type: ev.type,
63
+ };
64
+ }
65
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1,102 @@
1
+ import { type RequestOptions } from './utils.cjs';
2
+ import type { operations, paths } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Usage Event
6
+ */
7
+ export type Event = {
8
+ /**
9
+ * @description The version of the CloudEvents specification which the event uses.
10
+ * @example 1.0
11
+ */
12
+ specversion?: string;
13
+ /**
14
+ * @description Unique identifier for the event, defaults to uuid v4.
15
+ * @example "5c10fade-1c9e-4d6c-8275-c52c36731d3c"
16
+ */
17
+ id?: string;
18
+ /**
19
+ * Format: uri-reference
20
+ * @description Identifies the context in which an event happened, defaults to: @openmeter/sdk
21
+ * @example services/service-0
22
+ */
23
+ source?: string;
24
+ /**
25
+ * @description Describes the type of event related to the originating occurrence.
26
+ * @example "api_request"
27
+ */
28
+ type: string;
29
+ /**
30
+ * @description Describes the subject of the event in the context of the event producer (identified by source).
31
+ * @example "customer_id"
32
+ */
33
+ subject: string;
34
+ /**
35
+ * Format: date-time
36
+ * @description Date of when the occurrence happened.
37
+ * @example new Date('2023-01-01T01:01:01.001Z')
38
+ */
39
+ time?: Date;
40
+ /**
41
+ * Format: uri
42
+ * @description Identifies the schema that data adheres to.
43
+ */
44
+ dataschema?: string;
45
+ /**
46
+ * @description Content type of the data value. Must adhere to RFC 2046 format.
47
+ * @example application/json
48
+ * @enum {string|null}
49
+ */
50
+ datacontenttype?: 'application/json';
51
+ /**
52
+ * @description The event payload.
53
+ * @example {
54
+ * "duration_ms": "12",
55
+ * "path": "/hello"
56
+ * }
57
+ */
58
+ data: Record<string, unknown>;
59
+ };
60
+ /**
61
+ * Events are used to track usage of your product or service.
62
+ * Events are processed asynchronously by the meters, so they may not be immediately available for querying.
63
+ */
64
+ export declare class Events {
65
+ private client;
66
+ constructor(client: Client<paths, `${string}/${string}`>);
67
+ /**
68
+ * Ingests an event or batch of events
69
+ * @param events - The events to ingest
70
+ * @param signal - An optional abort signal
71
+ * @returns The ingested events
72
+ */
73
+ ingest(events: Event | Event[], options?: RequestOptions): Promise<{
74
+ data?: never;
75
+ error: import("./utils.cjs").Problem;
76
+ response: Response;
77
+ } | {
78
+ data: undefined;
79
+ error?: never;
80
+ response: Response;
81
+ }>;
82
+ /**
83
+ * List ingested events
84
+ * @param query - The query parameters
85
+ * @param signal - An optional abort signal
86
+ * @returns The events
87
+ */
88
+ list(query?: operations['listEvents']['parameters']['query'], options?: RequestOptions): Promise<{
89
+ data?: never;
90
+ error: import("./utils.cjs").Problem;
91
+ response: Response;
92
+ } | {
93
+ data: {
94
+ event: import("./schemas.cjs").components["schemas"]["Event"];
95
+ validationError?: string;
96
+ ingestedAt: Date;
97
+ storedAt: Date;
98
+ }[];
99
+ error?: never;
100
+ response: Response;
101
+ }>;
102
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/client/events.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAC3B,yCAAmE;AA6DnE;;;GAGG;AACH,MAAa,MAAM;IACG;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,MAAuB,EAAE,OAAwB;QACnE,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAE5E,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,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