@hexclave/shared 1.0.24 → 1.0.26

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 (73) hide show
  1. package/dist/ai/unified-prompts/reminders.js +1 -1
  2. package/dist/config/schema.d.ts +164 -164
  3. package/dist/config-authoring.d.ts +5 -2
  4. package/dist/config-authoring.d.ts.map +1 -1
  5. package/dist/config-authoring.js +3 -0
  6. package/dist/config-authoring.js.map +1 -1
  7. package/dist/esm/ai/unified-prompts/reminders.js +1 -1
  8. package/dist/esm/config/schema.d.ts +164 -164
  9. package/dist/esm/config-authoring.d.ts +5 -2
  10. package/dist/esm/config-authoring.d.ts.map +1 -1
  11. package/dist/esm/config-authoring.js +3 -0
  12. package/dist/esm/config-authoring.js.map +1 -1
  13. package/dist/esm/interface/admin-interface.d.ts +3 -1
  14. package/dist/esm/interface/admin-interface.d.ts.map +1 -1
  15. package/dist/esm/interface/admin-interface.js +3 -0
  16. package/dist/esm/interface/admin-interface.js.map +1 -1
  17. package/dist/esm/interface/admin-metrics.d.ts +14 -14
  18. package/dist/esm/interface/conversations.d.ts +1 -1
  19. package/dist/esm/interface/crud/current-user.d.ts +15 -15
  20. package/dist/esm/interface/crud/email-outbox.d.ts +158 -158
  21. package/dist/esm/interface/crud/products.d.ts +15 -15
  22. package/dist/esm/interface/crud/products.d.ts.map +1 -1
  23. package/dist/esm/interface/crud/project-api-keys.d.ts +2 -2
  24. package/dist/esm/interface/crud/projects.d.ts +57 -7
  25. package/dist/esm/interface/crud/projects.d.ts.map +1 -1
  26. package/dist/esm/interface/crud/projects.js +6 -0
  27. package/dist/esm/interface/crud/projects.js.map +1 -1
  28. package/dist/esm/interface/crud/team-member-profiles.d.ts +42 -42
  29. package/dist/esm/interface/crud/transactions.d.ts +21 -21
  30. package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
  31. package/dist/esm/interface/crud/users.d.ts +16 -16
  32. package/dist/esm/interface/plan-usage.d.ts +57 -0
  33. package/dist/esm/interface/plan-usage.d.ts.map +1 -0
  34. package/dist/esm/interface/plan-usage.js +35 -0
  35. package/dist/esm/interface/plan-usage.js.map +1 -0
  36. package/dist/esm/known-errors.d.ts +5 -5
  37. package/dist/esm/schema-fields.d.ts +5 -5
  38. package/dist/esm/sessions.d.ts +7 -7
  39. package/dist/{index-fQbeILq7.d.ts → index-nCRuFJTF.d.ts} +1 -1
  40. package/dist/{index-fQbeILq7.d.ts.map → index-nCRuFJTF.d.ts.map} +1 -1
  41. package/dist/interface/admin-interface.d.ts +3 -1
  42. package/dist/interface/admin-interface.d.ts.map +1 -1
  43. package/dist/interface/admin-interface.js +3 -0
  44. package/dist/interface/admin-interface.js.map +1 -1
  45. package/dist/interface/admin-metrics.d.ts +14 -14
  46. package/dist/interface/client-interface.d.ts +1 -1
  47. package/dist/interface/conversations.d.ts +1 -1
  48. package/dist/interface/crud/current-user.d.ts +15 -15
  49. package/dist/interface/crud/email-outbox.d.ts +158 -158
  50. package/dist/interface/crud/products.d.ts +15 -15
  51. package/dist/interface/crud/products.d.ts.map +1 -1
  52. package/dist/interface/crud/project-api-keys.d.ts +2 -2
  53. package/dist/interface/crud/projects.d.ts +57 -7
  54. package/dist/interface/crud/projects.d.ts.map +1 -1
  55. package/dist/interface/crud/projects.js +6 -0
  56. package/dist/interface/crud/projects.js.map +1 -1
  57. package/dist/interface/crud/team-member-profiles.d.ts +42 -42
  58. package/dist/interface/crud/transactions.d.ts +21 -21
  59. package/dist/interface/crud/transactions.d.ts.map +1 -1
  60. package/dist/interface/crud/users.d.ts +16 -16
  61. package/dist/interface/plan-usage.d.ts +57 -0
  62. package/dist/interface/plan-usage.d.ts.map +1 -0
  63. package/dist/interface/plan-usage.js +39 -0
  64. package/dist/interface/plan-usage.js.map +1 -0
  65. package/dist/known-errors.d.ts +5 -5
  66. package/dist/schema-fields.d.ts +5 -5
  67. package/dist/sessions.d.ts +7 -7
  68. package/dist/utils/passkey.d.ts +1 -1
  69. package/package.json +1 -1
  70. package/src/config-authoring.ts +5 -3
  71. package/src/interface/admin-interface.ts +14 -0
  72. package/src/interface/crud/projects.ts +12 -0
  73. package/src/interface/plan-usage.ts +34 -0
@@ -5,8 +5,8 @@ import { InferType } from "yup";
5
5
  //#region src/interface/crud/transactions.d.ts
6
6
  declare const transactionEntrySchema: yup$1.MixedSchema<{
7
7
  type: "money_transfer";
8
- customer_type: "user" | "team" | "custom";
9
8
  customer_id: string;
9
+ customer_type: "team" | "user" | "custom";
10
10
  charged_amount: {
11
11
  USD?: string | undefined;
12
12
  EUR?: string | undefined;
@@ -23,21 +23,27 @@ declare const transactionEntrySchema: yup$1.MixedSchema<{
23
23
  adjusted_entry_index: number | null;
24
24
  } | {
25
25
  type: "item_quantity_change";
26
- quantity: number;
27
- customer_type: "user" | "team" | "custom";
28
26
  item_id: string;
29
27
  customer_id: string;
28
+ quantity: number;
29
+ customer_type: "team" | "user" | "custom";
30
30
  adjusted_transaction_id: string | null;
31
31
  adjusted_entry_index: number | null;
32
32
  } | {
33
33
  one_time_purchase_id?: string | undefined;
34
34
  subscription_id?: string | undefined;
35
35
  type: "product_grant";
36
+ customer_id: string;
37
+ product_id: string | null;
38
+ quantity: number;
39
+ customer_type: "team" | "user" | "custom";
36
40
  product: {
37
41
  free_trial?: DayInterval | undefined;
38
42
  client_metadata?: {} | null | undefined;
39
43
  client_read_only_metadata?: {} | null | undefined;
40
44
  server_metadata?: {} | null | undefined;
45
+ server_only: boolean;
46
+ customer_type: "team" | "user" | "custom";
41
47
  stackable: boolean;
42
48
  prices: Record<string, {
43
49
  USD?: string | undefined;
@@ -51,18 +57,12 @@ declare const transactionEntrySchema: yup$1.MixedSchema<{
51
57
  free_trial?: DayInterval | undefined;
52
58
  }>;
53
59
  display_name: string;
54
- customer_type: "user" | "team" | "custom";
55
- server_only: boolean;
56
60
  included_items: Record<string, {
57
- repeat?: "never" | DayInterval | undefined;
58
61
  quantity?: number | undefined;
62
+ repeat?: "never" | DayInterval | undefined;
59
63
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
60
64
  }>;
61
65
  };
62
- quantity: number;
63
- customer_type: "user" | "team" | "custom";
64
- customer_id: string;
65
- product_id: string | null;
66
66
  adjusted_transaction_id: string | null;
67
67
  adjusted_entry_index: number | null;
68
68
  price_id: string | null;
@@ -85,12 +85,12 @@ declare const transactionSchema: yup$1.ObjectSchema<{
85
85
  created_at_millis: number;
86
86
  effective_at_millis: number;
87
87
  type: "purchase" | "subscription-cancellation" | "subscription-renewal" | "manual-item-quantity-change" | "refund" | "chargeback" | "product-change" | null;
88
- customer_type: "user" | "team" | "custom";
88
+ customer_type: "team" | "user" | "custom";
89
89
  customer_id: string;
90
90
  entries: ({
91
91
  type: "money_transfer";
92
- customer_type: "user" | "team" | "custom";
93
92
  customer_id: string;
93
+ customer_type: "team" | "user" | "custom";
94
94
  charged_amount: {
95
95
  USD?: string | undefined;
96
96
  EUR?: string | undefined;
@@ -107,21 +107,27 @@ declare const transactionSchema: yup$1.ObjectSchema<{
107
107
  adjusted_entry_index: number | null;
108
108
  } | {
109
109
  type: "item_quantity_change";
110
- quantity: number;
111
- customer_type: "user" | "team" | "custom";
112
110
  item_id: string;
113
111
  customer_id: string;
112
+ quantity: number;
113
+ customer_type: "team" | "user" | "custom";
114
114
  adjusted_transaction_id: string | null;
115
115
  adjusted_entry_index: number | null;
116
116
  } | {
117
117
  one_time_purchase_id?: string | undefined;
118
118
  subscription_id?: string | undefined;
119
119
  type: "product_grant";
120
+ customer_id: string;
121
+ product_id: string | null;
122
+ quantity: number;
123
+ customer_type: "team" | "user" | "custom";
120
124
  product: {
121
125
  free_trial?: DayInterval | undefined;
122
126
  client_metadata?: {} | null | undefined;
123
127
  client_read_only_metadata?: {} | null | undefined;
124
128
  server_metadata?: {} | null | undefined;
129
+ server_only: boolean;
130
+ customer_type: "team" | "user" | "custom";
125
131
  stackable: boolean;
126
132
  prices: Record<string, {
127
133
  USD?: string | undefined;
@@ -135,18 +141,12 @@ declare const transactionSchema: yup$1.ObjectSchema<{
135
141
  free_trial?: DayInterval | undefined;
136
142
  }>;
137
143
  display_name: string;
138
- customer_type: "user" | "team" | "custom";
139
- server_only: boolean;
140
144
  included_items: Record<string, {
141
- repeat?: "never" | DayInterval | undefined;
142
145
  quantity?: number | undefined;
146
+ repeat?: "never" | DayInterval | undefined;
143
147
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
144
148
  }>;
145
149
  };
146
- quantity: number;
147
- customer_type: "user" | "team" | "custom";
148
- customer_id: string;
149
- product_id: string | null;
150
150
  adjusted_transaction_id: string | null;
151
151
  adjusted_entry_index: number | null;
152
152
  price_id: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"transactions.d.ts","names":[],"sources":["../../../src/interface/crud/transactions.ts"],"mappings":";;;;;cAwFa,sBAAA,QAAsB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEC,gBAAA,GAAmB,SAAA,QAAiB,sBAAA;AAAA,cAEnC,iBAAA;AAAA,KAUD,eAAA,WAA0B,iBAAA;AAAA,cAEzB,iBAAA,QAAiB,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkBlB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,WAAA,GAAc,SAAA,QAAiB,iBAAA"}
1
+ {"version":3,"file":"transactions.d.ts","names":[],"sources":["../../../src/interface/crud/transactions.ts"],"mappings":";;;;;cAwFa,sBAAA,QAAsB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEC,gBAAA,GAAmB,SAAA,QAAiB,sBAAA;AAAA,cAEnC,iBAAA;AAAA,KAUD,eAAA,WAA0B,iBAAA;AAAA,cAEzB,iBAAA,QAAiB,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkBlB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,WAAA,GAAc,SAAA,QAAiB,iBAAA"}
@@ -162,20 +162,17 @@ declare const usersCrudServerReadSchema: yup$1.ObjectSchema<{
162
162
  requires_totp_mfa: undefined;
163
163
  }, "">;
164
164
  declare const usersCrudServerCreateSchema: yup$1.ObjectSchema<{
165
+ primary_email: string | null | undefined;
166
+ is_anonymous: boolean | undefined;
165
167
  display_name: string | null | undefined;
166
168
  client_metadata: {} | null | undefined;
167
169
  client_read_only_metadata: {} | null | undefined;
168
170
  server_metadata: {} | null | undefined;
169
- is_anonymous: boolean | undefined;
170
- primary_email: string | null | undefined;
171
- profile_image_url: string | null | undefined;
172
171
  primary_email_verified: boolean | undefined;
173
172
  primary_email_auth_enabled: boolean | undefined;
174
- passkey_auth_enabled: boolean | undefined;
175
- password: string | null | undefined;
176
- password_hash: string | undefined;
173
+ profile_image_url: string | null | undefined;
177
174
  otp_auth_enabled: boolean | undefined;
178
- totp_secret_base64: string | null | undefined;
175
+ passkey_auth_enabled: boolean | undefined;
179
176
  restricted_by_admin: boolean | undefined;
180
177
  restricted_by_admin_reason: string | null | undefined;
181
178
  restricted_by_admin_private_details: string | null | undefined;
@@ -186,10 +183,13 @@ declare const usersCrudServerCreateSchema: yup$1.ObjectSchema<{
186
183
  free_trial_abuse: number;
187
184
  };
188
185
  } | undefined;
186
+ password: string | null | undefined;
187
+ password_hash: string | undefined;
188
+ totp_secret_base64: string | null | undefined;
189
189
  } & {
190
190
  oauth_providers: {
191
- id: string;
192
191
  email: string | null;
192
+ id: string;
193
193
  account_id: string;
194
194
  }[] | undefined;
195
195
  is_anonymous: boolean | undefined;
@@ -368,20 +368,17 @@ declare const usersCrud: CrudSchemaFromOptions<{
368
368
  };
369
369
  }, "">;
370
370
  serverCreateSchema: yup$1.ObjectSchema<{
371
+ primary_email: string | null | undefined;
372
+ is_anonymous: boolean | undefined;
371
373
  display_name: string | null | undefined;
372
374
  client_metadata: {} | null | undefined;
373
375
  client_read_only_metadata: {} | null | undefined;
374
376
  server_metadata: {} | null | undefined;
375
- is_anonymous: boolean | undefined;
376
- primary_email: string | null | undefined;
377
- profile_image_url: string | null | undefined;
378
377
  primary_email_verified: boolean | undefined;
379
378
  primary_email_auth_enabled: boolean | undefined;
380
- passkey_auth_enabled: boolean | undefined;
381
- password: string | null | undefined;
382
- password_hash: string | undefined;
379
+ profile_image_url: string | null | undefined;
383
380
  otp_auth_enabled: boolean | undefined;
384
- totp_secret_base64: string | null | undefined;
381
+ passkey_auth_enabled: boolean | undefined;
385
382
  restricted_by_admin: boolean | undefined;
386
383
  restricted_by_admin_reason: string | null | undefined;
387
384
  restricted_by_admin_private_details: string | null | undefined;
@@ -392,10 +389,13 @@ declare const usersCrud: CrudSchemaFromOptions<{
392
389
  free_trial_abuse: number;
393
390
  };
394
391
  } | undefined;
392
+ password: string | null | undefined;
393
+ password_hash: string | undefined;
394
+ totp_secret_base64: string | null | undefined;
395
395
  } & {
396
396
  oauth_providers: {
397
- id: string;
398
397
  email: string | null;
398
+ id: string;
399
399
  account_id: string;
400
400
  }[] | undefined;
401
401
  is_anonymous: boolean | undefined;
@@ -0,0 +1,57 @@
1
+ import * as yup$1 from "yup";
2
+
3
+ //#region src/interface/plan-usage.d.ts
4
+ declare const planUsageKindSchema: yup$1.StringSchema<"current" | "metered" | "capability", yup$1.AnyObject, undefined, "">;
5
+ declare const planUsageRowSchema: yup$1.ObjectSchema<{
6
+ item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
7
+ display_name: string;
8
+ kind: "current" | "metered" | "capability";
9
+ used: number | null;
10
+ limit: number | null;
11
+ remaining: number | null;
12
+ overage: number | null;
13
+ is_unlimited: boolean;
14
+ }, yup$1.AnyObject, {
15
+ item_id: undefined;
16
+ display_name: undefined;
17
+ kind: undefined;
18
+ used: undefined;
19
+ limit: undefined;
20
+ remaining: undefined;
21
+ overage: undefined;
22
+ is_unlimited: undefined;
23
+ }, "">;
24
+ declare const planUsageResponseSchema: yup$1.ObjectSchema<{
25
+ owner_team_id: string;
26
+ owner_team_display_name: string;
27
+ plan_id: "team" | "free" | "growth";
28
+ plan_display_name: string;
29
+ period_start_millis: number;
30
+ period_end_millis: number;
31
+ next_plan_id: "team" | "growth" | null;
32
+ rows: {
33
+ item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
34
+ display_name: string;
35
+ kind: "current" | "metered" | "capability";
36
+ used: number | null;
37
+ limit: number | null;
38
+ remaining: number | null;
39
+ overage: number | null;
40
+ is_unlimited: boolean;
41
+ }[];
42
+ }, yup$1.AnyObject, {
43
+ owner_team_id: undefined;
44
+ owner_team_display_name: undefined;
45
+ plan_id: undefined;
46
+ plan_display_name: undefined;
47
+ period_start_millis: undefined;
48
+ period_end_millis: undefined;
49
+ next_plan_id: undefined;
50
+ rows: undefined;
51
+ }, "">;
52
+ type PlanUsageKind = yup$1.InferType<typeof planUsageKindSchema>;
53
+ type PlanUsageRow = yup$1.InferType<typeof planUsageRowSchema>;
54
+ type PlanUsageResponse = yup$1.InferType<typeof planUsageResponseSchema>;
55
+ //#endregion
56
+ export { PlanUsageKind, PlanUsageResponse, PlanUsageRow, planUsageKindSchema, planUsageResponseSchema, planUsageRowSchema };
57
+ //# sourceMappingURL=plan-usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-usage.d.ts","names":[],"sources":["../../src/interface/plan-usage.ts"],"mappings":";;;cAOa,mBAAA,EAAmB,KAAA,CAAA,YAAA,uCAAA,KAAA,CAAA,SAAA;AAAA,cAEnB,kBAAA,EAAkB,KAAA,CAAA,YAAA;;;;;;;;;GASnB,KAAA,CAAA,SAAA;;;;;;;;;;cAEC,uBAAA,EAAuB,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;GASxB,KAAA,CAAA,SAAA;;;;;;;;;;KAEA,aAAA,GAAgB,KAAA,CAAI,SAAA,QAAiB,mBAAA;AAAA,KACrC,YAAA,GAAe,KAAA,CAAI,SAAA,QAAiB,kBAAA;AAAA,KACpC,iBAAA,GAAoB,KAAA,CAAI,SAAA,QAAiB,uBAAA"}
@@ -0,0 +1,39 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('../chunk-BE-pF4vm.js');
3
+ let ___schema_fields_js = require("../schema-fields.js");
4
+ let ___plans_js = require("../plans.js");
5
+
6
+ //#region src/interface/plan-usage.ts
7
+ const PLAN_IDS = Object.keys(___plans_js.PLAN_LIMITS);
8
+ const UPGRADE_PLAN_IDS = PLAN_IDS.filter((id) => id !== "free");
9
+ const planUsageKindSchema = (0, ___schema_fields_js.yupString)().oneOf([
10
+ "current",
11
+ "metered",
12
+ "capability"
13
+ ]).defined();
14
+ const planUsageRowSchema = (0, ___schema_fields_js.yupObject)({
15
+ item_id: (0, ___schema_fields_js.yupString)().oneOf(Object.values(___plans_js.ITEM_IDS)).defined(),
16
+ display_name: (0, ___schema_fields_js.yupString)().defined(),
17
+ kind: planUsageKindSchema,
18
+ used: (0, ___schema_fields_js.yupNumber)().integer().nullable().defined(),
19
+ limit: (0, ___schema_fields_js.yupNumber)().integer().nullable().defined(),
20
+ remaining: (0, ___schema_fields_js.yupNumber)().integer().nullable().defined(),
21
+ overage: (0, ___schema_fields_js.yupNumber)().integer().nullable().defined(),
22
+ is_unlimited: (0, ___schema_fields_js.yupBoolean)().defined()
23
+ }).defined();
24
+ const planUsageResponseSchema = (0, ___schema_fields_js.yupObject)({
25
+ owner_team_id: (0, ___schema_fields_js.yupString)().uuid().defined(),
26
+ owner_team_display_name: (0, ___schema_fields_js.yupString)().defined(),
27
+ plan_id: (0, ___schema_fields_js.yupString)().oneOf(PLAN_IDS).defined(),
28
+ plan_display_name: (0, ___schema_fields_js.yupString)().defined(),
29
+ period_start_millis: (0, ___schema_fields_js.yupNumber)().integer().defined(),
30
+ period_end_millis: (0, ___schema_fields_js.yupNumber)().integer().defined(),
31
+ next_plan_id: (0, ___schema_fields_js.yupString)().oneOf(UPGRADE_PLAN_IDS).nullable().defined(),
32
+ rows: (0, ___schema_fields_js.yupArray)(planUsageRowSchema).defined()
33
+ }).defined();
34
+
35
+ //#endregion
36
+ exports.planUsageKindSchema = planUsageKindSchema;
37
+ exports.planUsageResponseSchema = planUsageResponseSchema;
38
+ exports.planUsageRowSchema = planUsageRowSchema;
39
+ //# sourceMappingURL=plan-usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-usage.js","names":["PLAN_LIMITS","ITEM_IDS"],"sources":["../../src/interface/plan-usage.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { ITEM_IDS, PLAN_LIMITS } from \"../plans\";\nimport { yupArray, yupBoolean, yupNumber, yupObject, yupString } from \"../schema-fields\";\n\nconst PLAN_IDS = Object.keys(PLAN_LIMITS) as (keyof typeof PLAN_LIMITS)[];\nconst UPGRADE_PLAN_IDS = PLAN_IDS.filter((id): id is Exclude<keyof typeof PLAN_LIMITS, \"free\"> => id !== \"free\");\n\nexport const planUsageKindSchema = yupString().oneOf([\"current\", \"metered\", \"capability\"]).defined();\n\nexport const planUsageRowSchema = yupObject({\n item_id: yupString().oneOf(Object.values(ITEM_IDS)).defined(),\n display_name: yupString().defined(),\n kind: planUsageKindSchema,\n used: yupNumber().integer().nullable().defined(),\n limit: yupNumber().integer().nullable().defined(),\n remaining: yupNumber().integer().nullable().defined(),\n overage: yupNumber().integer().nullable().defined(),\n is_unlimited: yupBoolean().defined(),\n}).defined();\n\nexport const planUsageResponseSchema = yupObject({\n owner_team_id: yupString().uuid().defined(),\n owner_team_display_name: yupString().defined(),\n plan_id: yupString().oneOf(PLAN_IDS).defined(),\n plan_display_name: yupString().defined(),\n period_start_millis: yupNumber().integer().defined(),\n period_end_millis: yupNumber().integer().defined(),\n next_plan_id: yupString().oneOf(UPGRADE_PLAN_IDS).nullable().defined(),\n rows: yupArray(planUsageRowSchema).defined(),\n}).defined();\n\nexport type PlanUsageKind = yup.InferType<typeof planUsageKindSchema>;\nexport type PlanUsageRow = yup.InferType<typeof planUsageRowSchema>;\nexport type PlanUsageResponse = yup.InferType<typeof planUsageResponseSchema>;\n"],"mappings":";;;;;;AAIA,MAAM,WAAW,OAAO,KAAKA,wBAAY;AACzC,MAAM,mBAAmB,SAAS,QAAQ,OAAwD,OAAO,OAAO;AAEhH,MAAa,0DAAiC,CAAC,MAAM;CAAC;CAAW;CAAW;CAAa,CAAC,CAAC,SAAS;AAEpG,MAAa,wDAA+B;CAC1C,6CAAoB,CAAC,MAAM,OAAO,OAAOC,qBAAS,CAAC,CAAC,SAAS;CAC7D,kDAAyB,CAAC,SAAS;CACnC,MAAM;CACN,0CAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS;CAChD,2CAAkB,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS;CACjD,+CAAsB,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS;CACrD,6CAAoB,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS;CACnD,mDAA0B,CAAC,SAAS;CACrC,CAAC,CAAC,SAAS;AAEZ,MAAa,6DAAoC;CAC/C,mDAA0B,CAAC,MAAM,CAAC,SAAS;CAC3C,6DAAoC,CAAC,SAAS;CAC9C,6CAAoB,CAAC,MAAM,SAAS,CAAC,SAAS;CAC9C,uDAA8B,CAAC,SAAS;CACxC,yDAAgC,CAAC,SAAS,CAAC,SAAS;CACpD,uDAA8B,CAAC,SAAS,CAAC,SAAS;CAClD,kDAAyB,CAAC,MAAM,iBAAiB,CAAC,UAAU,CAAC,SAAS;CACtE,wCAAe,mBAAmB,CAAC,SAAS;CAC7C,CAAC,CAAC,SAAS"}
@@ -369,7 +369,7 @@ declare const KnownErrors: {
369
369
  PermissionNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"PERMISSION_NOT_FOUND">, [permissionId: string]> & {
370
370
  errorCode: "PERMISSION_NOT_FOUND";
371
371
  };
372
- PermissionScopeMismatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"WRONG_PERMISSION_SCOPE">, [permissionId: string, expectedScope: "project" | "team", actualScope: "project" | "team" | null]> & {
372
+ PermissionScopeMismatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"WRONG_PERMISSION_SCOPE">, [permissionId: string, expectedScope: "team" | "project", actualScope: "team" | "project" | null]> & {
373
373
  errorCode: "WRONG_PERMISSION_SCOPE";
374
374
  };
375
375
  ContainedPermissionNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"CONTAINED_PERMISSION_NOT_FOUND">, [permissionId: string]> & {
@@ -512,16 +512,16 @@ declare const KnownErrors: {
512
512
  ItemNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_NOT_FOUND">, [itemId: string]> & {
513
513
  errorCode: "ITEM_NOT_FOUND";
514
514
  };
515
- ItemCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH">, [itemId: string, customerId: string, itemCustomerType: "user" | "team" | "custom" | undefined, actualCustomerType: "user" | "team" | "custom"]> & {
515
+ ItemCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH">, [itemId: string, customerId: string, itemCustomerType: "team" | "user" | "custom" | undefined, actualCustomerType: "team" | "user" | "custom"]> & {
516
516
  errorCode: "ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH";
517
517
  };
518
518
  CustomerDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"CUSTOMER_DOES_NOT_EXIST">, [customerId: string]> & {
519
519
  errorCode: "CUSTOMER_DOES_NOT_EXIST";
520
520
  };
521
- ProductDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_DOES_NOT_EXIST">, [productId: string, context: "server_only" | "item_exists" | null]> & {
521
+ ProductDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_DOES_NOT_EXIST">, [productId: string, context: "item_exists" | "server_only" | null]> & {
522
522
  errorCode: "PRODUCT_DOES_NOT_EXIST";
523
523
  };
524
- ProductCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH">, [productId: string | undefined, customerId: string, productCustomerType: "user" | "team" | "custom" | undefined, actualCustomerType: "user" | "team" | "custom"]> & {
524
+ ProductCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH">, [productId: string | undefined, customerId: string, productCustomerType: "team" | "user" | "custom" | undefined, actualCustomerType: "team" | "user" | "custom"]> & {
525
525
  errorCode: "PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH";
526
526
  };
527
527
  ProductAlreadyGranted: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_ALREADY_GRANTED">, [productId: string, customerId: string]> & {
@@ -548,7 +548,7 @@ declare const KnownErrors: {
548
548
  StripeAccountInfoNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"STRIPE_ACCOUNT_INFO_NOT_FOUND">, []> & {
549
549
  errorCode: "STRIPE_ACCOUNT_INFO_NOT_FOUND";
550
550
  };
551
- DefaultPaymentMethodRequired: KnownErrorConstructor<KnownError & KnownErrorBrand<"DEFAULT_PAYMENT_METHOD_REQUIRED">, [customerType: "user" | "team", customerId: string]> & {
551
+ DefaultPaymentMethodRequired: KnownErrorConstructor<KnownError & KnownErrorBrand<"DEFAULT_PAYMENT_METHOD_REQUIRED">, [customerType: "team" | "user", customerId: string]> & {
552
552
  errorCode: "DEFAULT_PAYMENT_METHOD_REQUIRED";
553
553
  };
554
554
  NewPurchasesBlocked: KnownErrorConstructor<KnownError & KnownErrorBrand<"NEW_PURCHASES_BLOCKED">, []> & {
@@ -174,7 +174,7 @@ declare const customDashboardsSchema: yup$1.MixedSchema<Record<string, {
174
174
  displayName: string;
175
175
  tsxSource: string;
176
176
  }>, yup$1.AnyObject, undefined, "">;
177
- declare const customerTypeSchema: yup$1.StringSchema<"user" | "team" | "custom" | undefined, yup$1.AnyObject, undefined, "">;
177
+ declare const customerTypeSchema: yup$1.StringSchema<"team" | "user" | "custom" | undefined, yup$1.AnyObject, undefined, "">;
178
178
  /**
179
179
  * Schema for a single product price. Each currency field (USD, EUR, etc.) is a decimal string
180
180
  * like `"9.99"` or `"1000"` — never cent integers. See `MoneyAmount` for the exact format.
@@ -218,7 +218,7 @@ declare const productSchema: yup$1.ObjectSchema<{
218
218
  displayName: string | undefined;
219
219
  productLineId: string | undefined;
220
220
  isAddOnTo: false | Record<string, true> | undefined;
221
- customerType: "user" | "team" | "custom";
221
+ customerType: "team" | "user" | "custom";
222
222
  freeTrial: DayInterval | undefined;
223
223
  serverOnly: boolean | undefined;
224
224
  stackable: boolean | undefined;
@@ -257,7 +257,7 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
257
257
  displayName: string | undefined;
258
258
  productLineId: string | undefined;
259
259
  isAddOnTo: false | Record<string, true> | undefined;
260
- customerType: "user" | "team" | "custom";
260
+ customerType: "team" | "user" | "custom";
261
261
  freeTrial: DayInterval | undefined;
262
262
  serverOnly: boolean | undefined;
263
263
  stackable: boolean | undefined;
@@ -298,7 +298,7 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
298
298
  }, "">;
299
299
  declare const inlineProductSchema: yup$1.ObjectSchema<{
300
300
  display_name: string;
301
- customer_type: "user" | "team" | "custom";
301
+ customer_type: "team" | "user" | "custom";
302
302
  free_trial: DayInterval | undefined;
303
303
  server_only: boolean;
304
304
  stackable: boolean;
@@ -314,8 +314,8 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
314
314
  free_trial?: DayInterval | undefined;
315
315
  }>;
316
316
  included_items: Record<string, {
317
- repeat?: "never" | DayInterval | undefined;
318
317
  quantity?: number | undefined;
318
+ repeat?: "never" | DayInterval | undefined;
319
319
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
320
320
  }>;
321
321
  client_metadata: {} | null | undefined;
@@ -9,24 +9,24 @@ declare class AccessToken {
9
9
  private constructor();
10
10
  get payload(): {
11
11
  exp?: number | undefined;
12
+ project_id: string;
13
+ refresh_token_id: string;
14
+ email: string | null;
15
+ restricted_reason: {
16
+ type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
17
+ } | null;
18
+ branch_id: string;
12
19
  sub: string;
13
20
  iat: number;
14
21
  iss: string;
15
22
  aud: string;
16
- project_id: string;
17
- branch_id: string;
18
- refresh_token_id: string;
19
23
  role: "authenticated";
20
24
  name: string | null;
21
- email: string | null;
22
25
  email_verified: boolean;
23
26
  selected_team_id: string | null;
24
27
  signed_up_at: number;
25
28
  is_anonymous: boolean;
26
29
  is_restricted: boolean;
27
- restricted_reason: {
28
- type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
29
- } | null;
30
30
  requires_totp_mfa: boolean;
31
31
  };
32
32
  get expiresAt(): Date;
@@ -1,2 +1,2 @@
1
- import { a as RegistrationResponseJSON, i as PublicKeyCredentialRequestOptionsJSON, n as AuthenticatorAttestationResponseJSON, r as PublicKeyCredentialCreationOptionsJSON, t as AuthenticationResponseJSON } from "../index-fQbeILq7.js";
1
+ import { a as RegistrationResponseJSON, i as PublicKeyCredentialRequestOptionsJSON, n as AuthenticatorAttestationResponseJSON, r as PublicKeyCredentialCreationOptionsJSON, t as AuthenticationResponseJSON } from "../index-nCRuFJTF.js";
2
2
  export { type AuthenticationResponseJSON, type AuthenticatorAttestationResponseJSON, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexclave/shared",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "repository": "https://github.com/hexclave/hexclave",
5
5
  "files": [
6
6
  "README.md",
@@ -27,11 +27,13 @@ type StrictStackConfig<T extends StackConfig> =
27
27
  : T;
28
28
 
29
29
  /** @deprecated Use `defineHexclaveConfig` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */
30
- export function defineStackConfig<const T extends StackConfig>(config: StrictStackConfig<T>): T {
30
+ export function defineStackConfig(config: StrictStackConfig<StackConfig>): StackConfig {
31
31
  return config;
32
32
  }
33
33
 
34
- // Hexclave alias — separate function so it does not inherit the deprecation tag.
35
- export function defineHexclaveConfig<const T extends HexclaveConfig>(config: StrictStackConfig<T>): T {
34
+ /**
35
+ * Defines a Hexclave project configuration as code. See the documentation at https://skill.hexclave.com for more information.
36
+ */
37
+ export function defineHexclaveConfig(config: StrictStackConfig<HexclaveConfig>): HexclaveConfig {
36
38
  return config;
37
39
  }
@@ -6,6 +6,7 @@ import type { MoneyAmount } from "../utils/currency-constants";
6
6
  import type { Json } from "../utils/json";
7
7
  import { Result } from "../utils/results";
8
8
  import { urlString } from "../utils/urls";
9
+ import type { PlanUsageResponse } from "./plan-usage";
9
10
  import type { AnalyticsClickmapDevice, AnalyticsClickmapKind, AnalyticsClickmapResponse, AnalyticsClickmapTokenResponse, MetricsResponse, MetricsUserCounts, UserActivityResponse } from "./admin-metrics";
10
11
  import type { AnalyticsQueryOptions, AnalyticsQueryResponse } from "./crud/analytics";
11
12
  import { EmailOutboxCrud } from "./crud/email-outbox";
@@ -27,6 +28,8 @@ import { TeamPermissionDefinitionsCrud } from "./crud/team-permissions";
27
28
  import type { Transaction, TransactionType } from "./crud/transactions";
28
29
  import { ServerAuthApplicationOptions, HexclaveServerInterface } from "./server-interface";
29
30
 
31
+ export type { PlanUsageResponse } from "./plan-usage";
32
+
30
33
  type BranchConfigSourceApi = yup.InferType<typeof branchConfigSourceSchema>;
31
34
 
32
35
  export type ChatContent = Array<
@@ -424,6 +427,17 @@ export class HexclaveAdminInterface extends HexclaveServerInterface {
424
427
  };
425
428
  }
426
429
 
430
+ async getPlanUsage(): Promise<PlanUsageResponse> {
431
+ const response = await this.sendAdminRequest(
432
+ "/internal/plan-usage",
433
+ {
434
+ method: "GET",
435
+ },
436
+ null,
437
+ );
438
+ return await response.json();
439
+ }
440
+
427
441
  async getUserActivity(userId: string): Promise<UserActivityResponse> {
428
442
  const response = await this.sendAdminRequest(
429
443
  urlString`/internal/user-activity?user_id=${userId}`,
@@ -32,6 +32,14 @@ const enabledOAuthProviderSchema = yupObject({
32
32
  id: schemaFields.oauthIdSchema.defined(),
33
33
  });
34
34
 
35
+ const pushedConfigErrorSchema = yupObject({
36
+ message: yupString().defined(),
37
+ }).defined();
38
+
39
+ const configWarningSchema = yupObject({
40
+ message: yupString().defined(),
41
+ }).defined();
42
+
35
43
  const onboardingConfigChoiceValues = ["create-new", "link-existing"] as const;
36
44
  const onboardingSignInMethodValues = ["credential", "magicLink", "passkey", "google", "github", "microsoft"] as const;
37
45
  const onboardingPaymentsCountryValues = ["US", "OTHER"] as const;
@@ -89,6 +97,8 @@ export const projectsCrudAdminReadSchema = yupObject({
89
97
  owner_team_id: schemaFields.yupString().nullable().defined(),
90
98
  onboarding_status: schemaFields.projectOnboardingStatusSchema.defined(),
91
99
  onboarding_state: projectOnboardingStateSchema.nullable().optional(),
100
+ pushed_config_error: pushedConfigErrorSchema.nullable().defined(),
101
+ config_warnings: yupArray(configWarningSchema).defined(),
92
102
  /** @deprecated */
93
103
  config: yupObject({
94
104
  allow_localhost: schemaFields.projectAllowLocalhostSchema.defined(),
@@ -117,6 +127,8 @@ export const projectsCrudAdminReadSchema = yupObject({
117
127
  export const projectsCrudClientReadSchema = yupObject({
118
128
  id: schemaFields.projectIdSchema.defined(),
119
129
  display_name: schemaFields.projectDisplayNameSchema.defined(),
130
+ pushed_config_error: pushedConfigErrorSchema.nullable().defined(),
131
+ config_warnings: yupArray(configWarningSchema).defined(),
120
132
  config: yupObject({
121
133
  sign_up_enabled: schemaFields.projectSignUpEnabledSchema.defined(),
122
134
  credential_enabled: schemaFields.projectCredentialEnabledSchema.defined(),
@@ -0,0 +1,34 @@
1
+ import * as yup from "yup";
2
+ import { ITEM_IDS, PLAN_LIMITS } from "../plans";
3
+ import { yupArray, yupBoolean, yupNumber, yupObject, yupString } from "../schema-fields";
4
+
5
+ const PLAN_IDS = Object.keys(PLAN_LIMITS) as (keyof typeof PLAN_LIMITS)[];
6
+ const UPGRADE_PLAN_IDS = PLAN_IDS.filter((id): id is Exclude<keyof typeof PLAN_LIMITS, "free"> => id !== "free");
7
+
8
+ export const planUsageKindSchema = yupString().oneOf(["current", "metered", "capability"]).defined();
9
+
10
+ export const planUsageRowSchema = yupObject({
11
+ item_id: yupString().oneOf(Object.values(ITEM_IDS)).defined(),
12
+ display_name: yupString().defined(),
13
+ kind: planUsageKindSchema,
14
+ used: yupNumber().integer().nullable().defined(),
15
+ limit: yupNumber().integer().nullable().defined(),
16
+ remaining: yupNumber().integer().nullable().defined(),
17
+ overage: yupNumber().integer().nullable().defined(),
18
+ is_unlimited: yupBoolean().defined(),
19
+ }).defined();
20
+
21
+ export const planUsageResponseSchema = yupObject({
22
+ owner_team_id: yupString().uuid().defined(),
23
+ owner_team_display_name: yupString().defined(),
24
+ plan_id: yupString().oneOf(PLAN_IDS).defined(),
25
+ plan_display_name: yupString().defined(),
26
+ period_start_millis: yupNumber().integer().defined(),
27
+ period_end_millis: yupNumber().integer().defined(),
28
+ next_plan_id: yupString().oneOf(UPGRADE_PLAN_IDS).nullable().defined(),
29
+ rows: yupArray(planUsageRowSchema).defined(),
30
+ }).defined();
31
+
32
+ export type PlanUsageKind = yup.InferType<typeof planUsageKindSchema>;
33
+ export type PlanUsageRow = yup.InferType<typeof planUsageRowSchema>;
34
+ export type PlanUsageResponse = yup.InferType<typeof planUsageResponseSchema>;