@stigg/typescript 0.1.0-beta.61 → 0.1.0-beta.63

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 (104) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/package.json +1 -1
  3. package/resources/v1/addons/addons.d.mts +1 -1
  4. package/resources/v1/addons/addons.d.ts +1 -1
  5. package/resources/v1/credits/credits.d.mts +77 -2
  6. package/resources/v1/credits/credits.d.mts.map +1 -1
  7. package/resources/v1/credits/credits.d.ts +77 -2
  8. package/resources/v1/credits/credits.d.ts.map +1 -1
  9. package/resources/v1/credits/credits.js +4 -0
  10. package/resources/v1/credits/credits.js.map +1 -1
  11. package/resources/v1/credits/credits.mjs +4 -0
  12. package/resources/v1/credits/credits.mjs.map +1 -1
  13. package/resources/v1/credits/index.d.mts +1 -0
  14. package/resources/v1/credits/index.d.mts.map +1 -1
  15. package/resources/v1/credits/index.d.ts +1 -0
  16. package/resources/v1/credits/index.d.ts.map +1 -1
  17. package/resources/v1/credits/index.js +3 -1
  18. package/resources/v1/credits/index.js.map +1 -1
  19. package/resources/v1/credits/index.mjs +1 -0
  20. package/resources/v1/credits/index.mjs.map +1 -1
  21. package/resources/v1/credits/reservations.d.mts +128 -0
  22. package/resources/v1/credits/reservations.d.mts.map +1 -0
  23. package/resources/v1/credits/reservations.d.ts +128 -0
  24. package/resources/v1/credits/reservations.d.ts.map +1 -0
  25. package/resources/v1/credits/reservations.js +30 -0
  26. package/resources/v1/credits/reservations.js.map +1 -0
  27. package/resources/v1/credits/reservations.mjs +26 -0
  28. package/resources/v1/credits/reservations.mjs.map +1 -0
  29. package/resources/v1/customers/customers.d.mts +27 -2
  30. package/resources/v1/customers/customers.d.mts.map +1 -1
  31. package/resources/v1/customers/customers.d.ts +27 -2
  32. package/resources/v1/customers/customers.d.ts.map +1 -1
  33. package/resources/v1/customers/customers.js.map +1 -1
  34. package/resources/v1/customers/customers.mjs.map +1 -1
  35. package/resources/v1/events/beta/customers.d.mts +18 -7
  36. package/resources/v1/events/beta/customers.d.mts.map +1 -1
  37. package/resources/v1/events/beta/customers.d.ts +18 -7
  38. package/resources/v1/events/beta/customers.d.ts.map +1 -1
  39. package/resources/v1/plans/plans.d.mts +1 -1
  40. package/resources/v1/plans/plans.d.ts +1 -1
  41. package/resources/v1/subscriptions/subscriptions.d.mts +1 -1
  42. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  43. package/resources/v1/subscriptions/subscriptions.d.ts +1 -1
  44. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  45. package/resources/v1/usage.d.mts +8 -7
  46. package/resources/v1/usage.d.mts.map +1 -1
  47. package/resources/v1/usage.d.ts +8 -7
  48. package/resources/v1/usage.d.ts.map +1 -1
  49. package/resources/v1-beta/customers/assignments.d.mts +2 -1
  50. package/resources/v1-beta/customers/assignments.d.mts.map +1 -1
  51. package/resources/v1-beta/customers/assignments.d.ts +2 -1
  52. package/resources/v1-beta/customers/assignments.d.ts.map +1 -1
  53. package/resources/v1-beta/customers/customers.d.mts +4 -0
  54. package/resources/v1-beta/customers/customers.d.mts.map +1 -1
  55. package/resources/v1-beta/customers/customers.d.ts +4 -0
  56. package/resources/v1-beta/customers/customers.d.ts.map +1 -1
  57. package/resources/v1-beta/customers/customers.js +4 -0
  58. package/resources/v1-beta/customers/customers.js.map +1 -1
  59. package/resources/v1-beta/customers/customers.mjs +4 -0
  60. package/resources/v1-beta/customers/customers.mjs.map +1 -1
  61. package/resources/v1-beta/customers/entitlements.d.mts +1 -1
  62. package/resources/v1-beta/customers/entitlements.d.mts.map +1 -1
  63. package/resources/v1-beta/customers/entitlements.d.ts +1 -1
  64. package/resources/v1-beta/customers/entitlements.d.ts.map +1 -1
  65. package/resources/v1-beta/customers/governance.d.mts +156 -0
  66. package/resources/v1-beta/customers/governance.d.mts.map +1 -0
  67. package/resources/v1-beta/customers/governance.d.ts +156 -0
  68. package/resources/v1-beta/customers/governance.d.ts.map +1 -0
  69. package/resources/v1-beta/customers/governance.js +43 -0
  70. package/resources/v1-beta/customers/governance.js.map +1 -0
  71. package/resources/v1-beta/customers/governance.mjs +39 -0
  72. package/resources/v1-beta/customers/governance.mjs.map +1 -0
  73. package/resources/v1-beta/customers/index.d.mts +1 -0
  74. package/resources/v1-beta/customers/index.d.mts.map +1 -1
  75. package/resources/v1-beta/customers/index.d.ts +1 -0
  76. package/resources/v1-beta/customers/index.d.ts.map +1 -1
  77. package/resources/v1-beta/customers/index.js +3 -1
  78. package/resources/v1-beta/customers/index.js.map +1 -1
  79. package/resources/v1-beta/customers/index.mjs +1 -0
  80. package/resources/v1-beta/customers/index.mjs.map +1 -1
  81. package/resources/v2/usage.d.mts +4 -3
  82. package/resources/v2/usage.d.mts.map +1 -1
  83. package/resources/v2/usage.d.ts +4 -3
  84. package/resources/v2/usage.d.ts.map +1 -1
  85. package/src/resources/v1/addons/addons.ts +1 -1
  86. package/src/resources/v1/credits/credits.ts +109 -2
  87. package/src/resources/v1/credits/index.ts +1 -0
  88. package/src/resources/v1/credits/reservations.ts +172 -0
  89. package/src/resources/v1/customers/customers.ts +32 -2
  90. package/src/resources/v1/events/beta/customers.ts +20 -7
  91. package/src/resources/v1/plans/plans.ts +1 -1
  92. package/src/resources/v1/subscriptions/subscriptions.ts +1 -1
  93. package/src/resources/v1/usage.ts +8 -7
  94. package/src/resources/v1-beta/customers/assignments.ts +2 -1
  95. package/src/resources/v1-beta/customers/customers.ts +16 -0
  96. package/src/resources/v1-beta/customers/entitlements.ts +1 -1
  97. package/src/resources/v1-beta/customers/governance.ts +210 -0
  98. package/src/resources/v1-beta/customers/index.ts +6 -0
  99. package/src/resources/v2/usage.ts +4 -3
  100. package/src/version.ts +1 -1
  101. package/version.d.mts +1 -1
  102. package/version.d.ts +1 -1
  103. package/version.js +1 -1
  104. package/version.mjs +1 -1
@@ -0,0 +1,210 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../core/pagination';
5
+ import { buildHeaders } from '../../../internal/headers';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+ import { path } from '../../../internal/utils/path';
8
+
9
+ export class Governance extends APIResource {
10
+ /**
11
+ * Queries the customer's governance hierarchy tree, returning a cursor-paginated
12
+ * list of nodes with their usage configuration (limit, cadence, scope) and current
13
+ * usage, sortable and filterable by usage. Each node carries `parentId` so the
14
+ * tree can be rebuilt client-side. Usage is read from a periodically-refreshed
15
+ * read model and never gates access.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Automatically fetches more pages as needed.
20
+ * for await (const governanceListResponse of client.v1Beta.customers.governance.list(
21
+ * 'id',
22
+ * )) {
23
+ * // ...
24
+ * }
25
+ * ```
26
+ */
27
+ list(
28
+ id: string,
29
+ params: GovernanceListParams | null | undefined = {},
30
+ options?: RequestOptions,
31
+ ): PagePromise<GovernanceListResponsesMyCursorIDPage, GovernanceListResponse> {
32
+ const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...query } = params ?? {};
33
+ return this._client.getAPIList(
34
+ path`/api/v1-beta/customers/${id}/governance`,
35
+ MyCursorIDPage<GovernanceListResponse>,
36
+ {
37
+ query,
38
+ ...options,
39
+ headers: buildHeaders([
40
+ {
41
+ ...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
42
+ ...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
43
+ },
44
+ options?.headers,
45
+ ]),
46
+ },
47
+ );
48
+ }
49
+ }
50
+
51
+ export type GovernanceListResponsesMyCursorIDPage = MyCursorIDPage<GovernanceListResponse>;
52
+
53
+ /**
54
+ * A node of the governance hierarchy tree with its usage configuration (limit,
55
+ * cadence, scope) and current usage. Usage is read from a periodically-refreshed
56
+ * read model and may lag the live counter by a short interval; it never gates
57
+ * access.
58
+ */
59
+ export interface GovernanceListResponse {
60
+ /**
61
+ * Usage-reset cadence as an ISO-8601 single-unit duration, e.g. `P1M`, `P30D`,
62
+ * `PT1M`; `null` when the node has no usage configuration.
63
+ */
64
+ cadence: string | null;
65
+
66
+ /**
67
+ * Usage consumed in the current cadence period (may lag the live counter by a
68
+ * short interval).
69
+ */
70
+ currentUsage: number | null;
71
+
72
+ /**
73
+ * Human-readable name of the entity, or null when none is set (display the entity
74
+ * id instead).
75
+ */
76
+ displayName: string | null;
77
+
78
+ /**
79
+ * External id of the entity at this node.
80
+ */
81
+ entityId: string;
82
+
83
+ /**
84
+ * External id of the entity type (e.g. `team`, `user`).
85
+ */
86
+ entityTypeId: string;
87
+
88
+ /**
89
+ * External id of the parent entity in the tree. `null` means the entity is either
90
+ * a root or not yet placed in the hierarchy — placement rides on an assignment, so
91
+ * an entity with no limits set has no parent yet. Both render at the top level;
92
+ * use it to rebuild the tree.
93
+ */
94
+ parentId: string | null;
95
+
96
+ /**
97
+ * The configuration scope (entity ids). Empty is the node-wide configuration; a
98
+ * non-empty set is a dimension-scoped sub-configuration.
99
+ */
100
+ scopeEntityIds: Array<string>;
101
+
102
+ /**
103
+ * Hard usage limit for this node per cadence period.
104
+ */
105
+ usageLimit: number | null;
106
+
107
+ /**
108
+ * Exclusive end of the cadence period in progress now — when usage resets. `null`
109
+ * when the node has no usage configuration, or when a stored cadence cannot be
110
+ * parsed.
111
+ */
112
+ usagePeriodEnd: string | null;
113
+
114
+ /**
115
+ * Start of the cadence period in progress now, derived from the cadence and the
116
+ * assignment anchor — it stays correct across a rollover. `null` when the node has
117
+ * no usage configuration, or when a stored cadence cannot be parsed.
118
+ */
119
+ usagePeriodStart: string | null;
120
+
121
+ /**
122
+ * `currentUsage / usageLimit` (1 when usageLimit is 0 — always at limit). The
123
+ * cross-capability-safe sort key.
124
+ */
125
+ utilization: number | null;
126
+
127
+ /**
128
+ * The metered currency ID (present when the configured capability is a credit
129
+ * currency).
130
+ */
131
+ currencyId?: string;
132
+
133
+ /**
134
+ * The metered feature ID (present when the configured capability is a feature).
135
+ */
136
+ featureId?: string;
137
+ }
138
+
139
+ export interface GovernanceListParams extends MyCursorIDPageParams {
140
+ /**
141
+ * Query param: Currency ids to include, comma-separated (e.g.
142
+ * `?currencyIds=credits`), up to 100. Omit both featureIds and currencyIds for
143
+ * tree mode.
144
+ */
145
+ currencyIds?: Array<string>;
146
+
147
+ /**
148
+ * Query param: Case-insensitive substring match on the entity id or its display
149
+ * name (`%`/`_` matched literally).
150
+ */
151
+ entityIdSearch?: string;
152
+
153
+ /**
154
+ * Query param: Filter to one or more entity types, comma-separated (e.g.
155
+ * `?entityTypeIds=team,user`), up to 100.
156
+ */
157
+ entityTypeIds?: Array<string>;
158
+
159
+ /**
160
+ * Query param: Feature ids to include, comma-separated (e.g.
161
+ * `?featureIds=ai-tokens,seats`), up to 100. Omit both featureIds and currencyIds
162
+ * for tree mode — every node in the hierarchy with no usage configuration
163
+ * attached.
164
+ */
165
+ featureIds?: Array<string>;
166
+
167
+ /**
168
+ * Query param: Only nodes with utilization ≥ this value (e.g. 0.8 for ≥80%, 1 for
169
+ * at/over limit).
170
+ */
171
+ minUtilization?: number;
172
+
173
+ /**
174
+ * Query param: Sort direction: `asc` or `desc` (default `desc`).
175
+ */
176
+ order?: 'asc' | 'desc';
177
+
178
+ /**
179
+ * Query param: Filter by configuration scope: `all` (default), `nodeWide` (`[]`
180
+ * only), or `scoped` (non-empty only).
181
+ */
182
+ scope?: 'all' | 'nodeWide' | 'scoped';
183
+
184
+ /**
185
+ * Query param: Sort key: `utilization` (default, cross-capability-safe),
186
+ * `currentUsage`, `usageLimit`, `scopeSize`, `id`, or `createdAt`.
187
+ */
188
+ sortBy?: 'utilization' | 'currentUsage' | 'usageLimit' | 'scopeSize' | 'id' | 'createdAt';
189
+
190
+ /**
191
+ * Header param: Account ID — optional when authenticating with a user JWT (Bearer
192
+ * token); falls back to the user's first membership. Ignored for API-key auth.
193
+ */
194
+ 'X-ACCOUNT-ID'?: string;
195
+
196
+ /**
197
+ * Header param: Environment ID — required when authenticating with a user JWT
198
+ * (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
199
+ * intrinsic to the key).
200
+ */
201
+ 'X-ENVIRONMENT-ID'?: string;
202
+ }
203
+
204
+ export declare namespace Governance {
205
+ export {
206
+ type GovernanceListResponse as GovernanceListResponse,
207
+ type GovernanceListResponsesMyCursorIDPage as GovernanceListResponsesMyCursorIDPage,
208
+ type GovernanceListParams as GovernanceListParams,
209
+ };
210
+ }
@@ -24,3 +24,9 @@ export {
24
24
  type EntityListResponsesMyCursorIDPage,
25
25
  } from './entities';
26
26
  export { Entitlements, type EntitlementCheckResponse, type EntitlementCheckParams } from './entitlements';
27
+ export {
28
+ Governance,
29
+ type GovernanceListResponse,
30
+ type GovernanceListParams,
31
+ type GovernanceListResponsesMyCursorIDPage,
32
+ } from './governance';
@@ -299,9 +299,10 @@ export namespace UsageReportParams {
299
299
  featureId: string;
300
300
 
301
301
  /**
302
- * The value to report for usage. Must be a whole number — the REST API does not
303
- * accept fractional (float) usage values; scale up (e.g. report cents instead of
304
- * dollars, or milliseconds instead of seconds) if you need sub-unit precision.
302
+ * The value to report for usage. Fractional values are accepted and rounded half
303
+ * away from zero to 5 decimal places. A value with a fractional part must have an
304
+ * absolute value below 34,359,738,368 (2^35); whole numbers are accepted up to
305
+ * ±9,007,199,254,740,991.
305
306
  */
306
307
  value: number;
307
308
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-beta.61'; // x-release-please-version
1
+ export const VERSION = '0.1.0-beta.63'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-beta.61";
1
+ export declare const VERSION = "0.1.0-beta.63";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-beta.61";
1
+ export declare const VERSION = "0.1.0-beta.63";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.0-beta.61'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-beta.63'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0-beta.61'; // x-release-please-version
1
+ export const VERSION = '0.1.0-beta.63'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map