terse-types 0.11.2 → 0.12.1

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/dist/Billing.d.ts CHANGED
@@ -56,6 +56,8 @@ export declare const usageBucketSchema: z.ZodObject<{
56
56
  outputTokenCredits: z.ZodNumber;
57
57
  cachedInputCredits: z.ZodNumber;
58
58
  runCredits: z.ZodNumber;
59
+ cpuCredits: z.ZodOptional<z.ZodNumber>;
60
+ memoryCredits: z.ZodOptional<z.ZodNumber>;
59
61
  }, z.core.$strip>;
60
62
  export type UsageBucket = z.infer<typeof usageBucketSchema>;
61
63
  export declare const usageResponseSchema: z.ZodObject<{
@@ -66,6 +68,8 @@ export declare const usageResponseSchema: z.ZodObject<{
66
68
  outputTokenCredits: z.ZodNumber;
67
69
  cachedInputCredits: z.ZodNumber;
68
70
  runCredits: z.ZodNumber;
71
+ cpuCredits: z.ZodOptional<z.ZodNumber>;
72
+ memoryCredits: z.ZodOptional<z.ZodNumber>;
69
73
  }, z.core.$strip>>;
70
74
  }, z.core.$strip>;
71
75
  export type UsageResponse = z.infer<typeof usageResponseSchema>;
@@ -216,7 +220,16 @@ export type BillingChangeRequestBody = z.infer<typeof billingChangeRequestBodySc
216
220
  export declare const billingPortalSessionRequestBodySchema: z.ZodObject<{}, z.core.$strict>;
217
221
  export type BillingPortalSessionRequestBody = z.infer<typeof billingPortalSessionRequestBodySchema>;
218
222
  export declare const DEFAULT_BILLING_CONTEXT_TIMEZONE = "UTC";
223
+ export declare const billingUsageScopeSchema: z.ZodEnum<{
224
+ all: "all";
225
+ actors: "actors";
226
+ }>;
227
+ export type BillingUsageScope = z.infer<typeof billingUsageScopeSchema>;
219
228
  export declare const billingContextQuerySchema: z.ZodObject<{
229
+ usageScope: z.ZodOptional<z.ZodEnum<{
230
+ all: "all";
231
+ actors: "actors";
232
+ }>>;
220
233
  start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
221
234
  end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
222
235
  timezone: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string | undefined>>;
@@ -224,6 +237,10 @@ export declare const billingContextQuerySchema: z.ZodObject<{
224
237
  export type BillingContextQuery = z.infer<typeof billingContextQuerySchema>;
225
238
  export declare const MAX_BILLING_USAGE_RANGE_DAYS = 90;
226
239
  export declare const billingUsageBucketsQuerySchema: z.ZodObject<{
240
+ usageScope: z.ZodOptional<z.ZodEnum<{
241
+ all: "all";
242
+ actors: "actors";
243
+ }>>;
227
244
  start: z.ZodCoercedDate<unknown>;
228
245
  end: z.ZodCoercedDate<unknown>;
229
246
  timezone: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string | undefined>>;
@@ -237,6 +254,8 @@ export declare const billingUsageBucketsResponseSchema: z.ZodObject<{
237
254
  outputTokenCredits: z.ZodNumber;
238
255
  cachedInputCredits: z.ZodNumber;
239
256
  runCredits: z.ZodNumber;
257
+ cpuCredits: z.ZodOptional<z.ZodNumber>;
258
+ memoryCredits: z.ZodOptional<z.ZodNumber>;
240
259
  }, z.core.$strip>>;
241
260
  }, z.core.$strip>;
242
261
  export type BillingUsageBucketsResponse = z.infer<typeof billingUsageBucketsResponseSchema>;
package/dist/Billing.js CHANGED
@@ -52,7 +52,9 @@ export const usageBucketSchema = z.object({
52
52
  inputTokenCredits: z.number(),
53
53
  outputTokenCredits: z.number(),
54
54
  cachedInputCredits: z.number(),
55
- runCredits: z.number()
55
+ runCredits: z.number(),
56
+ cpuCredits: z.number().optional(),
57
+ memoryCredits: z.number().optional()
56
58
  });
57
59
  export const usageResponseSchema = z.object({
58
60
  buckets: z.array(usageBucketSchema)
@@ -134,7 +136,9 @@ function isValidTimezone(timezone) {
134
136
  return false;
135
137
  }
136
138
  }
139
+ export const billingUsageScopeSchema = z.enum(["all", "actors"]);
137
140
  export const billingContextQuerySchema = z.object({
141
+ usageScope: billingUsageScopeSchema.optional(),
138
142
  start: z.coerce.date().optional(),
139
143
  end: z.coerce.date().optional(),
140
144
  timezone: z
@@ -147,6 +151,7 @@ export const billingContextQuerySchema = z.object({
147
151
  export const MAX_BILLING_USAGE_RANGE_DAYS = 90;
148
152
  export const billingUsageBucketsQuerySchema = z
149
153
  .object({
154
+ usageScope: billingUsageScopeSchema.optional(),
150
155
  start: z.coerce.date(),
151
156
  end: z.coerce.date(),
152
157
  timezone: z
@@ -51,8 +51,8 @@ export declare const orgLogoKey: (organizationId: string | null | undefined) =>
51
51
  export declare const userByIdKey: (userId: string | null | undefined) => readonly [string, string] | null;
52
52
  export declare const projectDeploysKey: (projectId: string) => readonly [string, string];
53
53
  export declare const projectSecretsKey: (projectId: string) => readonly [string, string];
54
- export declare const billingContextKey: (params?: Partial<BillingContextQuery>) => readonly [string, string, string, string];
55
- export declare const billingUsageBucketsKey: (params?: Partial<BillingUsageBucketsQuery>) => readonly [string, string, string, string];
54
+ export declare const billingContextKey: (params?: Partial<BillingContextQuery>) => readonly [string, string, string, string, string];
55
+ export declare const billingUsageBucketsKey: (params?: Partial<BillingUsageBucketsQuery>) => readonly [string, string, string, string, string];
56
56
  export declare const billingCatalogKey: () => readonly [string];
57
57
  export declare const billingStatusKey: () => readonly [string];
58
58
  export declare const organizationProjectsKey: () => readonly [string];
@@ -151,13 +151,15 @@ export const billingContextKey = (params) => [
151
151
  "billingContext",
152
152
  params?.timezone ?? "",
153
153
  params?.start?.toISOString() ?? "",
154
- params?.end?.toISOString() ?? ""
154
+ params?.end?.toISOString() ?? "",
155
+ params?.usageScope ?? "all"
155
156
  ];
156
157
  export const billingUsageBucketsKey = (params) => [
157
158
  "billingUsageBuckets",
158
159
  params?.timezone ?? "",
159
160
  params?.start?.toISOString() ?? "",
160
- params?.end?.toISOString() ?? ""
161
+ params?.end?.toISOString() ?? "",
162
+ params?.usageScope ?? "all"
161
163
  ];
162
164
  export const billingCatalogKey = () => ["billingCatalog"];
163
165
  export const billingStatusKey = () => ["billingStatus"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terse-types",
3
- "version": "0.11.2",
3
+ "version": "0.12.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Shared Terse TypeScript types, enums, constants, and helpers.",