@blimu/backend 1.1.4 → 1.2.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.
Files changed (106) hide show
  1. package/README.md +58 -58
  2. package/dist/client.cjs +121 -14
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.mts +4 -1
  5. package/dist/client.d.ts +4 -1
  6. package/dist/client.mjs +118 -11
  7. package/dist/client.mjs.map +1 -1
  8. package/dist/index.cjs +427 -142
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.mts +604 -4
  11. package/dist/index.d.ts +604 -4
  12. package/dist/index.mjs +420 -135
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/{schema-BbKn_i-U.d.mts → schema-CGYqiv8k.d.mts} +147 -39
  15. package/dist/{schema-BbKn_i-U.d.ts → schema-CGYqiv8k.d.ts} +147 -39
  16. package/dist/schema.cjs.map +1 -1
  17. package/dist/schema.d.mts +2 -1
  18. package/dist/schema.d.ts +2 -1
  19. package/dist/services/bulk_resources.cjs +0 -1
  20. package/dist/services/bulk_resources.cjs.map +1 -1
  21. package/dist/services/bulk_resources.d.mts +3 -2
  22. package/dist/services/bulk_resources.d.ts +3 -2
  23. package/dist/services/bulk_resources.mjs +0 -1
  24. package/dist/services/bulk_resources.mjs.map +1 -1
  25. package/dist/services/bulk_roles.cjs +0 -1
  26. package/dist/services/bulk_roles.cjs.map +1 -1
  27. package/dist/services/bulk_roles.d.mts +2 -1
  28. package/dist/services/bulk_roles.d.ts +2 -1
  29. package/dist/services/bulk_roles.mjs +0 -1
  30. package/dist/services/bulk_roles.mjs.map +1 -1
  31. package/dist/services/entitlements.cjs +0 -1
  32. package/dist/services/entitlements.cjs.map +1 -1
  33. package/dist/services/entitlements.d.mts +3 -2
  34. package/dist/services/entitlements.d.ts +3 -2
  35. package/dist/services/entitlements.mjs +0 -1
  36. package/dist/services/entitlements.mjs.map +1 -1
  37. package/dist/services/oauth.cjs +142 -0
  38. package/dist/services/oauth.cjs.map +1 -0
  39. package/dist/services/oauth.d.mts +19 -0
  40. package/dist/services/oauth.d.ts +19 -0
  41. package/dist/services/oauth.mjs +117 -0
  42. package/dist/services/oauth.mjs.map +1 -0
  43. package/dist/services/plans.cjs +0 -1
  44. package/dist/services/plans.cjs.map +1 -1
  45. package/dist/services/plans.d.mts +5 -4
  46. package/dist/services/plans.d.ts +5 -4
  47. package/dist/services/plans.mjs +0 -1
  48. package/dist/services/plans.mjs.map +1 -1
  49. package/dist/services/resource_members.cjs +0 -1
  50. package/dist/services/resource_members.cjs.map +1 -1
  51. package/dist/services/resource_members.d.mts +3 -2
  52. package/dist/services/resource_members.d.ts +3 -2
  53. package/dist/services/resource_members.mjs +0 -1
  54. package/dist/services/resource_members.mjs.map +1 -1
  55. package/dist/services/resources.cjs +0 -1
  56. package/dist/services/resources.cjs.map +1 -1
  57. package/dist/services/resources.d.mts +7 -6
  58. package/dist/services/resources.d.ts +7 -6
  59. package/dist/services/resources.mjs +0 -1
  60. package/dist/services/resources.mjs.map +1 -1
  61. package/dist/services/roles.cjs +0 -1
  62. package/dist/services/roles.cjs.map +1 -1
  63. package/dist/services/roles.d.mts +3 -2
  64. package/dist/services/roles.d.ts +3 -2
  65. package/dist/services/roles.mjs +0 -1
  66. package/dist/services/roles.mjs.map +1 -1
  67. package/dist/services/usage.cjs +0 -1
  68. package/dist/services/usage.cjs.map +1 -1
  69. package/dist/services/usage.d.mts +2 -1
  70. package/dist/services/usage.d.ts +2 -1
  71. package/dist/services/usage.mjs +0 -1
  72. package/dist/services/usage.mjs.map +1 -1
  73. package/dist/services/users.cjs +0 -1
  74. package/dist/services/users.cjs.map +1 -1
  75. package/dist/services/users.d.mts +2 -1
  76. package/dist/services/users.d.ts +2 -1
  77. package/dist/services/users.mjs +0 -1
  78. package/dist/services/users.mjs.map +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +6 -5
  81. package/dist/__tests__/token-verifier.test.cjs +0 -17662
  82. package/dist/__tests__/token-verifier.test.cjs.map +0 -1
  83. package/dist/__tests__/token-verifier.test.d.mts +0 -2
  84. package/dist/__tests__/token-verifier.test.d.ts +0 -2
  85. package/dist/__tests__/token-verifier.test.mjs +0 -17661
  86. package/dist/__tests__/token-verifier.test.mjs.map +0 -1
  87. package/dist/auth-strategies.cjs +0 -42
  88. package/dist/auth-strategies.cjs.map +0 -1
  89. package/dist/auth-strategies.d.mts +0 -16
  90. package/dist/auth-strategies.d.ts +0 -16
  91. package/dist/auth-strategies.mjs +0 -17
  92. package/dist/auth-strategies.mjs.map +0 -1
  93. package/dist/schema.zod-DtXVS-1g.d.mts +0 -434
  94. package/dist/schema.zod-DtXVS-1g.d.ts +0 -434
  95. package/dist/schema.zod.cjs +0 -489
  96. package/dist/schema.zod.cjs.map +0 -1
  97. package/dist/schema.zod.d.mts +0 -2
  98. package/dist/schema.zod.d.ts +0 -2
  99. package/dist/schema.zod.mjs +0 -427
  100. package/dist/schema.zod.mjs.map +0 -1
  101. package/dist/token-verifier.cjs +0 -218
  102. package/dist/token-verifier.cjs.map +0 -1
  103. package/dist/token-verifier.d.mts +0 -35
  104. package/dist/token-verifier.d.ts +0 -35
  105. package/dist/token-verifier.mjs +0 -180
  106. package/dist/token-verifier.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/client.ts
8
- import { FetchClient as FetchClient10, FetchError } from "@blimu/fetch";
8
+ import { FetchClient, FetchError } from "@blimu/fetch";
9
9
  import "@blimu/fetch";
10
10
 
11
11
  // src/auth-strategies.ts
@@ -22,12 +22,6 @@ function buildAuthStrategies(cfg) {
22
22
  return authStrategies;
23
23
  }
24
24
 
25
- // src/services/bulk_resources.ts
26
- import "@blimu/fetch";
27
-
28
- // src/schema.ts
29
- var schema_exports = {};
30
-
31
25
  // src/services/bulk_resources.ts
32
26
  var BulkResourcesService = class {
33
27
  constructor(core) {
@@ -48,7 +42,6 @@ var BulkResourcesService = class {
48
42
  };
49
43
 
50
44
  // src/services/bulk_roles.ts
51
- import "@blimu/fetch";
52
45
  var BulkRolesService = class {
53
46
  constructor(core) {
54
47
  this.core = core;
@@ -68,7 +61,6 @@ var BulkRolesService = class {
68
61
  };
69
62
 
70
63
  // src/services/entitlements.ts
71
- import "@blimu/fetch";
72
64
  var EntitlementsService = class {
73
65
  constructor(core) {
74
66
  this.core = core;
@@ -111,8 +103,121 @@ var EntitlementsService = class {
111
103
  }
112
104
  };
113
105
 
106
+ // src/services/oauth.ts
107
+ var OauthService = class {
108
+ constructor(core) {
109
+ this.core = core;
110
+ }
111
+ /**
112
+ * GET /v1/oauth/authorize*
113
+ * @summary Check consent requirement*
114
+ * @description Checks if user consent is required for the OAuth2 app and requested scopes.*/
115
+ checkConsentRequired(query, init) {
116
+ return this.core.request({
117
+ method: "GET",
118
+ path: `/v1/oauth/authorize`,
119
+ query,
120
+ ...init ?? {}
121
+ });
122
+ }
123
+ /**
124
+ * POST /v1/oauth/authorize*
125
+ * @summary Authorize OAuth2 application*
126
+ * @description Handles user consent approval/denial. Validates auto_approved flag against consent requirements.*/
127
+ authorize(body, init) {
128
+ return this.core.request({
129
+ method: "POST",
130
+ path: `/v1/oauth/authorize`,
131
+ body,
132
+ ...init ?? {}
133
+ });
134
+ }
135
+ /**
136
+ * POST /v1/oauth/device/authorize*
137
+ * @summary Authorize or deny device code*
138
+ * @description Allows an authenticated user to authorize or deny a device code request. Requires valid user session.*/
139
+ authorizeDeviceCode(body, init) {
140
+ return this.core.request({
141
+ method: "POST",
142
+ path: `/v1/oauth/device/authorize`,
143
+ body,
144
+ ...init ?? {}
145
+ });
146
+ }
147
+ /**
148
+ * POST /v1/oauth/device/code*
149
+ * @summary Request device authorization codes*
150
+ * @description Initiates device authorization flow. Returns device_code (for polling) and user_code (for user entry).*/
151
+ requestDeviceCode(body, init) {
152
+ return this.core.request({
153
+ method: "POST",
154
+ path: `/v1/oauth/device/code`,
155
+ body,
156
+ ...init ?? {}
157
+ });
158
+ }
159
+ /**
160
+ * GET /v1/oauth/device/code/{user_code}*
161
+ * @summary Get device code information*
162
+ * @description Returns device code information including app name, scopes, and consent requirement status.*/
163
+ getDeviceCodeInfo(user_code, init) {
164
+ return this.core.request({
165
+ method: "GET",
166
+ path: `/v1/oauth/device/code/${encodeURIComponent(user_code)}`,
167
+ ...init ?? {}
168
+ });
169
+ }
170
+ /**
171
+ * POST /v1/oauth/device/token*
172
+ * @summary Poll for device authorization tokens*
173
+ * @description Client polls this endpoint to exchange device_code for tokens once user has authorized.*/
174
+ exchangeDeviceCode(body, init) {
175
+ return this.core.request({
176
+ method: "POST",
177
+ path: `/v1/oauth/device/token`,
178
+ body,
179
+ ...init ?? {}
180
+ });
181
+ }
182
+ /**
183
+ * POST /v1/oauth/introspect*
184
+ * @summary Introspect token*
185
+ * @description Validates a token and returns metadata. Requires client authentication.*/
186
+ introspect(body, init) {
187
+ return this.core.request({
188
+ method: "POST",
189
+ path: `/v1/oauth/introspect`,
190
+ body,
191
+ ...init ?? {}
192
+ });
193
+ }
194
+ /**
195
+ * POST /v1/oauth/revoke*
196
+ * @summary Revoke token*
197
+ * @description Revokes an access or refresh token. Requires client authentication.*/
198
+ revoke(body, init) {
199
+ return this.core.request({
200
+ method: "POST",
201
+ path: `/v1/oauth/revoke`,
202
+ body,
203
+ ...init ?? {}
204
+ });
205
+ }
206
+ /**
207
+ * POST /v1/oauth/token*
208
+ * @summary Token endpoint*
209
+ * @description Issues access and refresh tokens. Supports authorization_code and refresh_token (always available per OAuth2 spec).*/
210
+ token(body, init) {
211
+ return this.core.request({
212
+ method: "POST",
213
+ path: `/v1/oauth/token`,
214
+ body,
215
+ ...init ?? {}
216
+ });
217
+ }
218
+ };
219
+
114
220
  // src/services/plans.ts
115
- import "@blimu/fetch";
116
221
  var PlansService = class {
117
222
  constructor(core) {
118
223
  this.core = core;
@@ -154,7 +259,6 @@ var PlansService = class {
154
259
  };
155
260
 
156
261
  // src/services/resource_members.ts
157
- import "@blimu/fetch";
158
262
  var ResourceMembersService = class {
159
263
  constructor(core) {
160
264
  this.core = core;
@@ -174,7 +278,6 @@ var ResourceMembersService = class {
174
278
  };
175
279
 
176
280
  // src/services/resources.ts
177
- import "@blimu/fetch";
178
281
  var ResourcesService = class {
179
282
  constructor(core) {
180
283
  this.core = core;
@@ -240,7 +343,6 @@ var ResourcesService = class {
240
343
  };
241
344
 
242
345
  // src/services/roles.ts
243
- import "@blimu/fetch";
244
346
  var RolesService = class {
245
347
  constructor(core) {
246
348
  this.core = core;
@@ -283,7 +385,6 @@ var RolesService = class {
283
385
  };
284
386
 
285
387
  // src/services/usage.ts
286
- import "@blimu/fetch";
287
388
  var UsageService = class {
288
389
  constructor(core) {
289
390
  this.core = core;
@@ -351,7 +452,6 @@ var UsageService = class {
351
452
  };
352
453
 
353
454
  // src/services/users.ts
354
- import "@blimu/fetch";
355
455
  var UsersService = class {
356
456
  constructor(core) {
357
457
  this.core = core;
@@ -432,6 +532,7 @@ var Blimu = class {
432
532
  bulkResources;
433
533
  bulkRoles;
434
534
  entitlements;
535
+ oauth;
435
536
  plans;
436
537
  resourceMembers;
437
538
  resources;
@@ -442,7 +543,7 @@ var Blimu = class {
442
543
  const restCfg = { ...options ?? {} };
443
544
  delete restCfg.apiKey;
444
545
  const authStrategies = buildAuthStrategies(options ?? {});
445
- const core = new FetchClient10({
546
+ const core = new FetchClient({
446
547
  ...restCfg,
447
548
  baseURL: options?.baseURL ?? "https://api.blimu.dev",
448
549
  ...authStrategies.length > 0 ? { authStrategies } : {}
@@ -450,6 +551,7 @@ var Blimu = class {
450
551
  this.bulkResources = new BulkResourcesService(core);
451
552
  this.bulkRoles = new BulkRolesService(core);
452
553
  this.entitlements = new EntitlementsService(core);
554
+ this.oauth = new OauthService(core);
453
555
  this.plans = new PlansService(core);
454
556
  this.resourceMembers = new ResourceMembersService(core);
455
557
  this.resources = new ResourcesService(core);
@@ -490,19 +592,35 @@ function isNotUndefined(arr) {
490
592
  );
491
593
  }
492
594
 
595
+ // src/schema.ts
596
+ var schema_exports = {};
597
+
493
598
  // src/schema.zod.ts
494
599
  var schema_zod_exports = {};
495
600
  __export(schema_zod_exports, {
601
+ AuthorizeRequestSchema: () => AuthorizeRequestSchema,
496
602
  BalanceResponseSchema: () => BalanceResponseSchema,
497
603
  CheckLimitResponseSchema: () => CheckLimitResponseSchema,
604
+ ConsentCheckResponseSchema: () => ConsentCheckResponseSchema,
605
+ DeviceAuthorizeRequestSchema: () => DeviceAuthorizeRequestSchema,
606
+ DeviceAuthorizeResponseSchema: () => DeviceAuthorizeResponseSchema,
607
+ DeviceCodeInfoResponseSchema: () => DeviceCodeInfoResponseSchema,
608
+ DeviceCodeRequestSchema: () => DeviceCodeRequestSchema,
609
+ DeviceCodeResponseSchema: () => DeviceCodeResponseSchema,
610
+ DeviceTokenRequestSchema: () => DeviceTokenRequestSchema,
498
611
  EntitlementCheckBodySchema: () => EntitlementCheckBodySchema,
499
612
  EntitlementCheckResultSchema: () => EntitlementCheckResultSchema,
613
+ EntitlementTypeSchema: () => EntitlementTypeSchema,
500
614
  EntitlementsListForResourceQuerySchema: () => EntitlementsListForResourceQuerySchema,
501
615
  EntitlementsListForTenantQuerySchema: () => EntitlementsListForTenantQuerySchema,
502
616
  EntitlementsListResultSchema: () => EntitlementsListResultSchema,
617
+ IntrospectionRequestSchema: () => IntrospectionRequestSchema,
618
+ IntrospectionResponseSchema: () => IntrospectionResponseSchema,
619
+ OauthCheckConsentRequiredQuerySchema: () => OauthCheckConsentRequiredQuerySchema,
503
620
  PlanAssignBodySchema: () => PlanAssignBodySchema,
504
621
  PlanDeleteResponseSchema: () => PlanDeleteResponseSchema,
505
622
  PlanResponseSchema: () => PlanResponseSchema,
623
+ PlanTypeSchema: () => PlanTypeSchema,
506
624
  ResourceBulkCreateBodySchema: () => ResourceBulkCreateBodySchema,
507
625
  ResourceBulkResultSchema: () => ResourceBulkResultSchema,
508
626
  ResourceCreateBodySchema: () => ResourceCreateBodySchema,
@@ -510,20 +628,25 @@ __export(schema_zod_exports, {
510
628
  ResourceMemberListSchema: () => ResourceMemberListSchema,
511
629
  ResourceMembersListQuerySchema: () => ResourceMembersListQuerySchema,
512
630
  ResourceSchema: () => ResourceSchema,
631
+ ResourceTypeSchema: () => ResourceTypeSchema,
513
632
  ResourceUpdateBodySchema: () => ResourceUpdateBodySchema,
514
633
  ResourcesListQuerySchema: () => ResourcesListQuerySchema,
634
+ RevocationRequestSchema: () => RevocationRequestSchema,
515
635
  RoleBulkCreateBodySchema: () => RoleBulkCreateBodySchema,
516
636
  RoleBulkResultSchema: () => RoleBulkResultSchema,
517
637
  RoleCreateBodySchema: () => RoleCreateBodySchema,
518
638
  RoleListSchema: () => RoleListSchema,
519
639
  RoleSchema: () => RoleSchema,
520
640
  RolesListQuerySchema: () => RolesListQuerySchema,
641
+ TokenRequestSchema: () => TokenRequestSchema,
642
+ TokenResponseSchema: () => TokenResponseSchema,
521
643
  TransactionHistoryResponseSchema: () => TransactionHistoryResponseSchema,
522
644
  UsageCheckBodySchema: () => UsageCheckBodySchema,
523
645
  UsageConsumeBodySchema: () => UsageConsumeBodySchema,
524
646
  UsageCreditBodySchema: () => UsageCreditBodySchema,
525
647
  UsageGetBalanceQuerySchema: () => UsageGetBalanceQuerySchema,
526
648
  UsageGetTransactionHistoryQuerySchema: () => UsageGetTransactionHistoryQuerySchema,
649
+ UsageLimitTypeSchema: () => UsageLimitTypeSchema,
527
650
  UsageWalletResponseSchema: () => UsageWalletResponseSchema,
528
651
  UserCreateBodySchema: () => UserCreateBodySchema,
529
652
  UserListSchema: () => UserListSchema,
@@ -533,6 +656,32 @@ __export(schema_zod_exports, {
533
656
  UsersListQuerySchema: () => UsersListQuerySchema
534
657
  });
535
658
  import { z } from "zod";
659
+ var EntitlementTypeSchema = z.string();
660
+ var PlanTypeSchema = z.string();
661
+ var ResourceTypeSchema = z.string();
662
+ var UsageLimitTypeSchema = z.string();
663
+ var AuthorizeRequestSchema = z.object({
664
+ /** Action to take: allow or deny */
665
+ action: z.enum(["allow", "deny"]),
666
+ /** True if consent was auto-approved (not required or previously granted) */
667
+ auto_approved: z.boolean().optional(),
668
+ /** OAuth2 client ID */
669
+ client_id: z.string(),
670
+ /** PKCE code challenge */
671
+ code_challenge: z.string().optional(),
672
+ /** PKCE code challenge method */
673
+ code_challenge_method: z.string().optional(),
674
+ /** Redirect URI */
675
+ redirect_uri: z.string(),
676
+ /** Response type (typically "code") */
677
+ response_type: z.string(),
678
+ /** Space-separated list of scopes */
679
+ scope: z.string().optional(),
680
+ /** State parameter for CSRF protection */
681
+ state: z.string().optional(),
682
+ /** True if user explicitly clicked Allow, false if auto-approved */
683
+ user_action: z.boolean().optional()
684
+ });
536
685
  var BalanceResponseSchema = z.object({ balance: z.number() });
537
686
  var CheckLimitResponseSchema = z.object({
538
687
  allowed: z.boolean(),
@@ -540,9 +689,206 @@ var CheckLimitResponseSchema = z.object({
540
689
  remaining: z.number().optional(),
541
690
  requested: z.number()
542
691
  });
692
+ var ConsentCheckResponseSchema = z.object({
693
+ /** Whether user consent is required */
694
+ consent_required: z.boolean(),
695
+ /** Whether consent was previously granted for this app and scopes */
696
+ previously_granted: z.boolean()
697
+ });
698
+ var DeviceAuthorizeRequestSchema = z.object({
699
+ /** Action to take: allow or deny */
700
+ action: z.enum(["allow", "deny"]),
701
+ /** True if consent was auto-approved (not required or previously granted) */
702
+ auto_approved: z.boolean().optional(),
703
+ /** True if user explicitly clicked Allow, false if auto-approved */
704
+ user_action: z.boolean().optional(),
705
+ /** The user code displayed to the user */
706
+ user_code: z.string()
707
+ });
708
+ var DeviceAuthorizeResponseSchema = z.object({
709
+ /** Whether the authorization was successful */
710
+ success: z.boolean()
711
+ });
712
+ var DeviceCodeInfoResponseSchema = z.object({
713
+ /** The name of the OAuth2 application */
714
+ appName: z.string(),
715
+ /** Whether the user has already granted consent for this app and scopes */
716
+ previouslyGranted: z.boolean(),
717
+ /** Whether the app requires user consent */
718
+ requireConsent: z.boolean(),
719
+ /** The scopes requested by the device code */
720
+ scopes: z.string().array()
721
+ });
722
+ var DeviceCodeRequestSchema = z.object({
723
+ /** OAuth2 client ID */
724
+ client_id: z.string(),
725
+ /** PKCE code challenge (base64url encoded SHA256 hash) */
726
+ code_challenge: z.string().optional(),
727
+ /** PKCE code challenge method */
728
+ code_challenge_method: z.enum(["S256", "plain"]).optional(),
729
+ /** Space-separated list of scopes */
730
+ scope: z.string().optional()
731
+ });
732
+ var DeviceCodeResponseSchema = z.object({
733
+ /** Device verification code (for polling) */
734
+ device_code: z.string(),
735
+ /** Device code expiration time in seconds */
736
+ expires_in: z.number(),
737
+ /** Minimum polling interval in seconds */
738
+ interval: z.number(),
739
+ /** User verification code (short, human-readable) */
740
+ user_code: z.string(),
741
+ /** Verification URI for user */
742
+ verification_uri: z.string(),
743
+ /** Complete verification URI with user code */
744
+ verification_uri_complete: z.string()
745
+ });
746
+ var DeviceTokenRequestSchema = z.object({
747
+ /** OAuth2 client ID */
748
+ client_id: z.string(),
749
+ /** PKCE code verifier (if challenge was provided) */
750
+ code_verifier: z.string().optional(),
751
+ /** Device code from authorization response */
752
+ device_code: z.string(),
753
+ /** Grant type (must be device_code) */
754
+ grant_type: z.enum([
755
+ "urn:ietf:params:oauth:grant-type:device_code"
756
+ ])
757
+ });
758
+ var IntrospectionRequestSchema = z.object({
759
+ /** The token to introspect */
760
+ token: z.string(),
761
+ /** Hint about token type */
762
+ token_type_hint: z.enum(["access_token", "refresh_token"]).optional()
763
+ });
764
+ var IntrospectionResponseSchema = z.object({
765
+ /** Whether the token is active */
766
+ active: z.boolean(),
767
+ /** Client ID */
768
+ client_id: z.string().optional(),
769
+ /** Environment ID */
770
+ environment_id: z.string().optional(),
771
+ /** Token expiration timestamp */
772
+ exp: z.number().optional(),
773
+ /** Token issued at timestamp */
774
+ iat: z.number().optional(),
775
+ /** Space-separated list of scopes */
776
+ scope: z.string().optional(),
777
+ /** Subject (user ID) */
778
+ sub: z.string().optional(),
779
+ /** Token type */
780
+ token_type: z.string().optional(),
781
+ /** Username or user ID */
782
+ username: z.string().optional()
783
+ });
784
+ var PlanDeleteResponseSchema = z.object({ success: z.boolean() });
785
+ var ResourceMemberListSchema = z.object({
786
+ items: z.object({
787
+ inherited: z.boolean(),
788
+ role: z.string(),
789
+ user: z.object({
790
+ avatarUrl: z.string().nullable(),
791
+ createdAt: z.iso.datetime(),
792
+ email: z.email(),
793
+ emailVerified: z.boolean(),
794
+ firstName: z.string().nullable(),
795
+ id: z.string(),
796
+ lastLoginAt: z.iso.datetime().nullable(),
797
+ lastName: z.string().nullable(),
798
+ lookupKey: z.string().nullable(),
799
+ updatedAt: z.iso.datetime()
800
+ }),
801
+ userId: z.string()
802
+ }).array(),
803
+ limit: z.number(),
804
+ page: z.number(),
805
+ total: z.number()
806
+ });
807
+ var RevocationRequestSchema = z.object({
808
+ /** The token to revoke */
809
+ token: z.string(),
810
+ /** Hint about token type */
811
+ token_type_hint: z.enum(["access_token", "refresh_token"]).optional()
812
+ });
813
+ var TokenRequestSchema = z.object({
814
+ /** OAuth2 client ID */
815
+ client_id: z.string(),
816
+ /** OAuth2 client secret (required for confidential clients) */
817
+ client_secret: z.string().optional(),
818
+ /** Authorization code (required for authorization_code grant) */
819
+ code: z.string().optional(),
820
+ /** PKCE code verifier (if challenge was provided) */
821
+ code_verifier: z.string().optional(),
822
+ /** OAuth2 grant type */
823
+ grant_type: z.enum(["authorization_code", "refresh_token"]),
824
+ /** Redirect URI (required for authorization_code grant) */
825
+ redirect_uri: z.string().optional(),
826
+ /** Refresh token (required for refresh_token grant) */
827
+ refresh_token: z.string().optional(),
828
+ /** Space-separated list of scopes (optional for refresh) */
829
+ scope: z.string().optional()
830
+ });
831
+ var TokenResponseSchema = z.object({
832
+ /** Access token (JWT) */
833
+ access_token: z.string(),
834
+ /** Access token expiration time in seconds */
835
+ expires_in: z.number(),
836
+ /** Refresh token (for obtaining new access tokens) */
837
+ refresh_token: z.string(),
838
+ /** Space-separated list of granted scopes */
839
+ scope: z.string().optional(),
840
+ /** Token type */
841
+ token_type: z.string()
842
+ });
843
+ var UserSchema = z.object({
844
+ avatarUrl: z.string().nullable(),
845
+ createdAt: z.iso.datetime(),
846
+ email: z.email(),
847
+ emailVerified: z.boolean(),
848
+ firstName: z.string().nullable(),
849
+ id: z.string(),
850
+ lastLoginAt: z.iso.datetime().nullable(),
851
+ lastName: z.string().nullable(),
852
+ lookupKey: z.string().nullable(),
853
+ updatedAt: z.iso.datetime()
854
+ });
855
+ var UserCreateBodySchema = z.object({
856
+ avatarUrl: z.url().optional(),
857
+ email: z.email(),
858
+ firstName: z.string().nullable().optional(),
859
+ lastName: z.string().nullable().optional(),
860
+ lookupKey: z.string(),
861
+ newUser: z.boolean().nullable().optional(),
862
+ password: z.string().nullable().optional()
863
+ });
864
+ var UserListSchema = z.object({
865
+ items: z.object({
866
+ avatarUrl: z.string().nullable(),
867
+ createdAt: z.iso.datetime(),
868
+ email: z.email(),
869
+ emailVerified: z.boolean(),
870
+ firstName: z.string().nullable(),
871
+ id: z.string(),
872
+ lastLoginAt: z.iso.datetime().nullable(),
873
+ lastName: z.string().nullable(),
874
+ lookupKey: z.string().nullable(),
875
+ updatedAt: z.iso.datetime()
876
+ }).array(),
877
+ limit: z.number(),
878
+ page: z.number(),
879
+ total: z.number()
880
+ });
881
+ var UserUpdateBodySchema = z.object({
882
+ avatarUrl: z.url().nullable().optional(),
883
+ email: z.email().optional(),
884
+ firstName: z.string().nullable().optional(),
885
+ lastName: z.string().nullable().optional(),
886
+ lookupKey: z.string().optional(),
887
+ password: z.string().optional()
888
+ });
543
889
  var EntitlementCheckBodySchema = z.object({
544
890
  amount: z.number().int().optional(),
545
- entitlement: z.string(),
891
+ entitlement: EntitlementTypeSchema,
546
892
  resourceId: z.string(),
547
893
  userId: z.string()
548
894
  });
@@ -552,15 +898,15 @@ var EntitlementCheckResultSchema = z.object({
552
898
  allowed: z.boolean(),
553
899
  current: z.number().optional(),
554
900
  limit: z.number().optional(),
555
- plan: z.string().nullable().optional(),
901
+ plan: PlanTypeSchema.optional(),
556
902
  reason: z.string().optional(),
557
903
  remaining: z.number().optional(),
558
904
  scope: z.string().optional()
559
905
  }).nullable().optional(),
560
906
  plans: z.object({
561
907
  allowed: z.boolean(),
562
- allowedPlans: z.string().array().optional(),
563
- plan: z.string().nullable().optional(),
908
+ allowedPlans: PlanTypeSchema.array().optional(),
909
+ plan: PlanTypeSchema.optional(),
564
910
  reason: z.string().optional()
565
911
  }).nullable().optional(),
566
912
  roles: z.object({
@@ -570,30 +916,29 @@ var EntitlementCheckResultSchema = z.object({
570
916
  userRoles: z.string().array().optional()
571
917
  }).nullable().optional()
572
918
  });
919
+ var PlanAssignBodySchema = z.object({ planKey: PlanTypeSchema });
573
920
  var EntitlementsListResultSchema = z.object({
574
921
  results: z.object({
575
922
  entitlements: z.object({
576
923
  allowed: z.boolean(),
577
924
  allowedByPlan: z.boolean(),
578
925
  allowedByRole: z.boolean(),
579
- allowedPlans: z.string().array().optional(),
926
+ allowedPlans: PlanTypeSchema.array().optional(),
580
927
  allowedRoles: z.string().array(),
581
- currentPlan: z.string().optional(),
928
+ currentPlan: PlanTypeSchema.optional(),
582
929
  currentRole: z.string().optional(),
583
- entitlement: z.string()
930
+ entitlement: EntitlementTypeSchema
584
931
  }).array(),
585
932
  resourceId: z.string(),
586
- resourceType: z.string()
933
+ resourceType: ResourceTypeSchema
587
934
  }).array()
588
935
  });
589
- var PlanAssignBodySchema = z.object({ planKey: z.string() });
590
- var PlanDeleteResponseSchema = z.object({ success: z.boolean() });
591
936
  var PlanResponseSchema = z.object({
592
937
  createdAt: z.iso.datetime(),
593
938
  environmentId: z.string(),
594
- planKey: z.string(),
939
+ planKey: PlanTypeSchema,
595
940
  resourceId: z.string(),
596
- resourceType: z.string(),
941
+ resourceType: ResourceTypeSchema,
597
942
  updatedAt: z.iso.datetime()
598
943
  });
599
944
  var ResourceSchema = z.object({
@@ -602,9 +947,9 @@ var ResourceSchema = z.object({
602
947
  name: z.string().nullable(),
603
948
  parents: z.object({
604
949
  id: z.string(),
605
- type: z.string()
950
+ type: ResourceTypeSchema
606
951
  }).array().optional(),
607
- type: z.string()
952
+ type: ResourceTypeSchema
608
953
  });
609
954
  var ResourceBulkCreateBodySchema = z.object({
610
955
  resources: z.object({
@@ -612,7 +957,7 @@ var ResourceBulkCreateBodySchema = z.object({
612
957
  name: z.string().optional(),
613
958
  parents: z.object({
614
959
  id: z.string(),
615
- type: z.string()
960
+ type: ResourceTypeSchema
616
961
  }).array().optional(),
617
962
  roles: z.object({
618
963
  role: z.string(),
@@ -624,7 +969,7 @@ var ResourceBulkResultSchema = z.object({
624
969
  created: z.object({
625
970
  environmentId: z.string(),
626
971
  id: z.string(),
627
- type: z.string()
972
+ type: ResourceTypeSchema
628
973
  }).array(),
629
974
  errors: z.object({
630
975
  error: z.string(),
@@ -634,7 +979,7 @@ var ResourceBulkResultSchema = z.object({
634
979
  name: z.string().optional(),
635
980
  parents: z.object({
636
981
  id: z.string(),
637
- type: z.string()
982
+ type: ResourceTypeSchema
638
983
  }).array().optional(),
639
984
  roles: z.object({
640
985
  role: z.string(),
@@ -654,55 +999,33 @@ var ResourceCreateBodySchema = z.object({
654
999
  name: z.string().optional(),
655
1000
  parents: z.object({
656
1001
  id: z.string(),
657
- type: z.string()
1002
+ type: ResourceTypeSchema
658
1003
  }).array().optional(),
659
1004
  roles: z.object({
660
1005
  role: z.string(),
661
1006
  userId: z.string()
662
1007
  }).array().optional()
663
1008
  });
664
- var ResourceMemberListSchema = z.object({
665
- items: z.object({
666
- inherited: z.boolean(),
667
- role: z.string(),
668
- user: z.object({
669
- avatarUrl: z.string().nullable(),
670
- createdAt: z.iso.datetime(),
671
- email: z.email(),
672
- emailVerified: z.boolean(),
673
- firstName: z.string().nullable(),
674
- id: z.string(),
675
- lastLoginAt: z.iso.datetime().nullable(),
676
- lastName: z.string().nullable(),
677
- lookupKey: z.string().nullable(),
678
- updatedAt: z.iso.datetime()
679
- }),
680
- userId: z.string()
681
- }).array(),
682
- limit: z.number(),
683
- page: z.number(),
684
- total: z.number()
685
- });
686
1009
  var ResourceUpdateBodySchema = z.object({
687
1010
  name: z.string().optional(),
688
1011
  /** Creates relationships with other resources. Parent resources must already exist. */
689
1012
  parents: z.object({
690
1013
  id: z.string(),
691
- type: z.string()
1014
+ type: ResourceTypeSchema
692
1015
  }).array().optional()
693
1016
  });
694
1017
  var RoleSchema = z.object({
695
1018
  createdAt: z.string(),
696
1019
  environmentId: z.string(),
697
1020
  resourceId: z.string(),
698
- resourceType: z.string(),
1021
+ resourceType: ResourceTypeSchema,
699
1022
  role: z.string(),
700
1023
  userId: z.string()
701
1024
  });
702
1025
  var RoleBulkCreateBodySchema = z.object({
703
1026
  roles: z.object({
704
1027
  resourceId: z.string(),
705
- resourceType: z.string(),
1028
+ resourceType: ResourceTypeSchema,
706
1029
  role: z.string(),
707
1030
  userId: z.string()
708
1031
  }).array()
@@ -712,7 +1035,7 @@ var RoleBulkResultSchema = z.object({
712
1035
  createdAt: z.string(),
713
1036
  environmentId: z.string(),
714
1037
  resourceId: z.string(),
715
- resourceType: z.string(),
1038
+ resourceType: ResourceTypeSchema,
716
1039
  role: z.string(),
717
1040
  userId: z.string()
718
1041
  }).array(),
@@ -721,7 +1044,7 @@ var RoleBulkResultSchema = z.object({
721
1044
  index: z.number(),
722
1045
  role: z.object({
723
1046
  resourceId: z.string(),
724
- resourceType: z.string(),
1047
+ resourceType: ResourceTypeSchema,
725
1048
  role: z.string(),
726
1049
  userId: z.string()
727
1050
  })
@@ -735,7 +1058,7 @@ var RoleBulkResultSchema = z.object({
735
1058
  });
736
1059
  var RoleCreateBodySchema = z.object({
737
1060
  resourceId: z.string(),
738
- resourceType: z.string(),
1061
+ resourceType: ResourceTypeSchema,
739
1062
  role: z.string()
740
1063
  });
741
1064
  var RoleListSchema = z.object({
@@ -745,43 +1068,58 @@ var RoleListSchema = z.object({
745
1068
  createdAt: z.string(),
746
1069
  environmentId: z.string(),
747
1070
  resourceId: z.string(),
748
- resourceType: z.string(),
1071
+ resourceType: ResourceTypeSchema,
749
1072
  role: z.string(),
750
1073
  userId: z.string()
751
1074
  }).array(),
752
1075
  total: z.number()
753
1076
  });
1077
+ var UserResourceListSchema = z.array(
1078
+ z.object({
1079
+ inherited: z.boolean(),
1080
+ resource: z.object({
1081
+ id: z.string(),
1082
+ name: z.string(),
1083
+ parents: z.object({
1084
+ id: z.string(),
1085
+ type: ResourceTypeSchema
1086
+ }).array(),
1087
+ type: ResourceTypeSchema
1088
+ }).catchall(z.unknown()),
1089
+ role: z.string()
1090
+ })
1091
+ );
754
1092
  var TransactionHistoryResponseSchema = z.object({
755
1093
  items: z.object({
756
1094
  amount: z.number().int(),
757
1095
  createdAt: z.iso.datetime(),
758
1096
  environmentId: z.string(),
759
1097
  id: z.string(),
760
- limitType: z.string(),
1098
+ limitType: UsageLimitTypeSchema,
761
1099
  resourceId: z.string(),
762
- resourceType: z.string(),
1100
+ resourceType: ResourceTypeSchema,
763
1101
  tags: z.record(z.string(), z.unknown()).nullable()
764
1102
  }).array()
765
1103
  });
766
1104
  var UsageCheckBodySchema = z.object({
767
1105
  amount: z.number().int(),
768
- limitType: z.string(),
1106
+ limitType: UsageLimitTypeSchema,
769
1107
  period: z.enum(["monthly", "yearly", "lifetime"]),
770
1108
  resourceId: z.string(),
771
- resourceType: z.string()
1109
+ resourceType: ResourceTypeSchema
772
1110
  });
773
1111
  var UsageConsumeBodySchema = z.object({
774
1112
  amount: z.number().int(),
775
- limitType: z.string(),
1113
+ limitType: UsageLimitTypeSchema,
776
1114
  resourceId: z.string(),
777
- resourceType: z.string(),
1115
+ resourceType: ResourceTypeSchema,
778
1116
  tags: z.record(z.string(), z.unknown()).optional()
779
1117
  });
780
1118
  var UsageCreditBodySchema = z.object({
781
1119
  amount: z.number().int(),
782
- limitType: z.string(),
1120
+ limitType: UsageLimitTypeSchema,
783
1121
  resourceId: z.string(),
784
- resourceType: z.string(),
1122
+ resourceType: ResourceTypeSchema,
785
1123
  tags: z.record(z.string(), z.unknown()).optional()
786
1124
  });
787
1125
  var UsageWalletResponseSchema = z.object({
@@ -789,72 +1127,11 @@ var UsageWalletResponseSchema = z.object({
789
1127
  createdAt: z.iso.datetime(),
790
1128
  environmentId: z.string(),
791
1129
  id: z.string(),
792
- limitType: z.string(),
1130
+ limitType: UsageLimitTypeSchema,
793
1131
  resourceId: z.string(),
794
- resourceType: z.string(),
1132
+ resourceType: ResourceTypeSchema,
795
1133
  tags: z.record(z.string(), z.unknown()).nullable()
796
1134
  });
797
- var UserSchema = z.object({
798
- avatarUrl: z.string().nullable(),
799
- createdAt: z.iso.datetime(),
800
- email: z.email(),
801
- emailVerified: z.boolean(),
802
- firstName: z.string().nullable(),
803
- id: z.string(),
804
- lastLoginAt: z.iso.datetime().nullable(),
805
- lastName: z.string().nullable(),
806
- lookupKey: z.string().nullable(),
807
- updatedAt: z.iso.datetime()
808
- });
809
- var UserCreateBodySchema = z.object({
810
- avatarUrl: z.url().optional(),
811
- email: z.email(),
812
- firstName: z.string().nullable().optional(),
813
- lastName: z.string().nullable().optional(),
814
- lookupKey: z.string(),
815
- newUser: z.boolean().nullable().optional(),
816
- password: z.string().nullable().optional()
817
- });
818
- var UserListSchema = z.object({
819
- items: z.object({
820
- avatarUrl: z.string().nullable(),
821
- createdAt: z.iso.datetime(),
822
- email: z.email(),
823
- emailVerified: z.boolean(),
824
- firstName: z.string().nullable(),
825
- id: z.string(),
826
- lastLoginAt: z.iso.datetime().nullable(),
827
- lastName: z.string().nullable(),
828
- lookupKey: z.string().nullable(),
829
- updatedAt: z.iso.datetime()
830
- }).array(),
831
- limit: z.number(),
832
- page: z.number(),
833
- total: z.number()
834
- });
835
- var UserResourceListSchema = z.array(
836
- z.object({
837
- inherited: z.boolean(),
838
- resource: z.object({
839
- id: z.string(),
840
- name: z.string(),
841
- parents: z.object({
842
- id: z.string(),
843
- type: z.string()
844
- }).array(),
845
- type: z.string()
846
- }).catchall(z.unknown()),
847
- role: z.string()
848
- })
849
- );
850
- var UserUpdateBodySchema = z.object({
851
- avatarUrl: z.url().nullable().optional(),
852
- email: z.email().optional(),
853
- firstName: z.string().nullable().optional(),
854
- lastName: z.string().nullable().optional(),
855
- lookupKey: z.string().optional(),
856
- password: z.string().optional()
857
- });
858
1135
  var ResourceListSchema = z.object({
859
1136
  items: ResourceSchema.array(),
860
1137
  limit: z.number(),
@@ -869,6 +1146,14 @@ var EntitlementsListForTenantQuerySchema = z.object({
869
1146
  /** The unique identifier of the user */
870
1147
  userId: z.string()
871
1148
  });
1149
+ var OauthCheckConsentRequiredQuerySchema = z.object({
1150
+ /** OAuth2 client ID */
1151
+ client_id: z.string(),
1152
+ /** Redirect URI */
1153
+ redirect_uri: z.string().optional(),
1154
+ /** Space-separated list of scopes */
1155
+ scope: z.string().optional()
1156
+ });
872
1157
  var ResourceMembersListQuerySchema = z.object({
873
1158
  /** Number of items per page (minimum: 1, maximum: 100) */
874
1159
  limit: z.number().optional(),
@@ -893,7 +1178,7 @@ var RolesListQuerySchema = z.object({
893
1178
  /** Filter roles by specific resource ID */
894
1179
  resourceId: z.string().optional(),
895
1180
  /** Filter roles by resource type */
896
- resourceType: z.string().optional(),
1181
+ resourceType: ResourceTypeSchema.optional(),
897
1182
  /** Filter by role name */
898
1183
  role: z.string().optional()
899
1184
  });