@hexclave/shared 1.0.60 → 1.0.62
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/{admin-interface-BxUHaniY.d.ts → admin-interface-D63SFHX_.d.ts} +94 -12
- package/dist/admin-interface-D63SFHX_.d.ts.map +1 -0
- package/dist/{admin-metrics-DQ7vvSym.d.ts → admin-metrics-bsOkw4YQ.d.ts} +16 -16
- package/dist/{admin-metrics-DQ7vvSym.d.ts.map → admin-metrics-bsOkw4YQ.d.ts.map} +1 -1
- package/dist/ai/unified-prompts/reminders.js +1 -1
- package/dist/ai/unified-prompts/reminders.js.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +12 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.d.ts +5 -0
- package/dist/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.d.ts.map +1 -0
- package/dist/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.js +128 -0
- package/dist/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.js.map +1 -0
- package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js +1 -0
- package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt.d.ts +3 -1
- package/dist/ai/unified-prompts/skill-site-prompt.d.ts.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt.js +11 -0
- package/dist/ai/unified-prompts/skill-site-prompt.js.map +1 -1
- package/dist/apps/apps-config.d.ts +6 -0
- package/dist/apps/apps-config.d.ts.map +1 -1
- package/dist/apps/apps-config.js +6 -0
- package/dist/apps/apps-config.js.map +1 -1
- package/dist/{client-interface-D-cO5E3C.d.ts → client-interface-DvkciaL0.d.ts} +10 -10
- package/dist/{client-interface-D-cO5E3C.d.ts.map → client-interface-DvkciaL0.d.ts.map} +1 -1
- package/dist/config/schema-fuzzer.test.js +38 -1
- package/dist/config/schema-fuzzer.test.js.map +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/schema.js +45 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/config-authoring.d.ts +1 -1
- package/dist/{current-user-Cg6by3KK.d.ts → current-user-BBoN3hsn.d.ts} +13 -13
- package/dist/{current-user-Cg6by3KK.d.ts.map → current-user-BBoN3hsn.d.ts.map} +1 -1
- package/dist/{email-outbox-B3lyx4Eg.d.ts → email-outbox-CqzwInBL.d.ts} +207 -207
- package/dist/{email-outbox-B3lyx4Eg.d.ts.map → email-outbox-CqzwInBL.d.ts.map} +1 -1
- package/dist/esm/ai/unified-prompts/reminders.js +1 -1
- package/dist/esm/ai/unified-prompts/reminders.js.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +12 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.d.ts +5 -0
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.d.ts.map +1 -0
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.js +128 -0
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.js.map +1 -0
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js +1 -0
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt.d.ts +3 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt.d.ts.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt.js +10 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt.js.map +1 -1
- package/dist/esm/apps/apps-config.d.ts +6 -0
- package/dist/esm/apps/apps-config.d.ts.map +1 -1
- package/dist/esm/apps/apps-config.js +6 -0
- package/dist/esm/apps/apps-config.js.map +1 -1
- package/dist/esm/config/schema-fuzzer.test.js +38 -1
- package/dist/esm/config/schema-fuzzer.test.js.map +1 -1
- package/dist/esm/config/schema.d.ts +220 -90
- package/dist/esm/config/schema.d.ts.map +1 -1
- package/dist/esm/config/schema.js +42 -1
- package/dist/esm/config/schema.js.map +1 -1
- package/dist/esm/interface/admin-interface.d.ts +83 -1
- package/dist/esm/interface/admin-interface.d.ts.map +1 -1
- package/dist/esm/interface/admin-interface.js +48 -0
- package/dist/esm/interface/admin-interface.js.map +1 -1
- package/dist/esm/interface/admin-metrics.d.ts +15 -15
- package/dist/esm/interface/conversations.d.ts +36 -36
- package/dist/esm/interface/crud/current-user.d.ts +12 -12
- package/dist/esm/interface/crud/email-outbox.d.ts +206 -206
- package/dist/esm/interface/crud/invoices.d.ts +2 -2
- package/dist/esm/interface/crud/products.d.ts +23 -23
- package/dist/esm/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/esm/interface/crud/projects.d.ts +59 -59
- package/dist/esm/interface/crud/team-member-profiles.d.ts +26 -26
- package/dist/esm/interface/crud/transactions.d.ts +20 -20
- package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
- package/dist/esm/interface/crud/users.d.ts +16 -16
- package/dist/esm/interface/plan-usage.d.ts +2 -2
- package/dist/esm/interface/webhooks.d.ts +2 -2
- package/dist/esm/known-errors.d.ts +1 -1
- package/dist/esm/schema-fields.d.ts +4 -4
- package/dist/esm/sessions.d.ts +11 -11
- package/dist/esm/utils/tar.d.ts +26 -0
- package/dist/esm/utils/tar.d.ts.map +1 -0
- package/dist/esm/utils/tar.js +136 -0
- package/dist/esm/utils/tar.js.map +1 -0
- package/dist/helpers/password.d.ts +1 -1
- package/dist/helpers/production-mode.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/interface/admin-interface.d.ts +3 -3
- package/dist/interface/admin-interface.js +48 -0
- package/dist/interface/admin-interface.js.map +1 -1
- package/dist/interface/admin-metrics.d.ts +1 -1
- package/dist/interface/client-interface.d.ts +1 -1
- package/dist/interface/conversations.d.ts +36 -36
- package/dist/interface/crud/current-user.d.ts +1 -1
- package/dist/interface/crud/email-outbox.d.ts +1 -1
- package/dist/interface/crud/invoices.d.ts +1 -1
- package/dist/interface/crud/products.d.ts +1 -1
- package/dist/interface/crud/project-api-keys.d.ts +1 -1
- package/dist/interface/crud/projects.d.ts +1 -1
- package/dist/interface/crud/team-member-profiles.d.ts +1 -1
- package/dist/interface/crud/transactions.d.ts +1 -1
- package/dist/interface/crud/users.d.ts +1 -1
- package/dist/interface/plan-usage.d.ts +1 -1
- package/dist/interface/server-interface.d.ts +1 -1
- package/dist/interface/webhooks.d.ts +1 -1
- package/dist/{invoices-BGLLnTlR.d.ts → invoices-CHo9YKbI.d.ts} +3 -3
- package/dist/{invoices-BGLLnTlR.d.ts.map → invoices-CHo9YKbI.d.ts.map} +1 -1
- package/dist/{known-errors-BFf8SVm8.d.ts → known-errors-Bm4a61wL.d.ts} +2 -2
- package/dist/{known-errors-BFf8SVm8.d.ts.map → known-errors-Bm4a61wL.d.ts.map} +1 -1
- package/dist/known-errors.d.ts +1 -1
- package/dist/{plan-usage-Dw09F0sh.d.ts → plan-usage-BaDxcLZ1.d.ts} +3 -3
- package/dist/{plan-usage-Dw09F0sh.d.ts.map → plan-usage-BaDxcLZ1.d.ts.map} +1 -1
- package/dist/{products-Cwn7_4uD.d.ts → products-D4o8A2W0.d.ts} +24 -24
- package/dist/{products-Cwn7_4uD.d.ts.map → products-D4o8A2W0.d.ts.map} +1 -1
- package/dist/{project-api-keys-CXTBQ2IZ.d.ts → project-api-keys--7V5X_UW.d.ts} +5 -5
- package/dist/{project-api-keys-CXTBQ2IZ.d.ts.map → project-api-keys--7V5X_UW.d.ts.map} +1 -1
- package/dist/{projects-Cw80wrT7.d.ts → projects-BX5Y50kJ.d.ts} +60 -60
- package/dist/{projects-Cw80wrT7.d.ts.map → projects-BX5Y50kJ.d.ts.map} +1 -1
- package/dist/{schema-DGZfskAR.d.ts → schema-dJ_7rUCO.d.ts} +221 -91
- package/dist/schema-dJ_7rUCO.d.ts.map +1 -0
- package/dist/{schema-fields-DPaAnhmc.d.ts → schema-fields-DZtDQEEO.d.ts} +5 -5
- package/dist/{schema-fields-DPaAnhmc.d.ts.map → schema-fields-DZtDQEEO.d.ts.map} +1 -1
- package/dist/schema-fields.d.ts +1 -1
- package/dist/{server-interface-BXeSO8Wj.d.ts → server-interface-Ra_vIHP4.d.ts} +8 -8
- package/dist/{server-interface-BXeSO8Wj.d.ts.map → server-interface-Ra_vIHP4.d.ts.map} +1 -1
- package/dist/{sessions-B7755rIu.d.ts → sessions-CI-0TBQb.d.ts} +13 -13
- package/dist/{sessions-B7755rIu.d.ts.map → sessions-CI-0TBQb.d.ts.map} +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/{team-member-profiles-B9sAsj4g.d.ts → team-member-profiles-BoDEqx-0.d.ts} +27 -27
- package/dist/{team-member-profiles-B9sAsj4g.d.ts.map → team-member-profiles-BoDEqx-0.d.ts.map} +1 -1
- package/dist/{transactions-Brdmr3jE.d.ts → transactions-CHNUJ42J.d.ts} +21 -21
- package/dist/transactions-CHNUJ42J.d.ts.map +1 -0
- package/dist/{users-ydVQVHD_.d.ts → users-DHNRwoSz.d.ts} +18 -18
- package/dist/{users-ydVQVHD_.d.ts.map → users-DHNRwoSz.d.ts.map} +1 -1
- package/dist/utils/tar.d.ts +26 -0
- package/dist/utils/tar.d.ts.map +1 -0
- package/dist/utils/tar.js +138 -0
- package/dist/utils/tar.js.map +1 -0
- package/dist/{webhooks-ByXrdSOx.d.ts → webhooks-8Ts1Clcb.d.ts} +3 -3
- package/dist/{webhooks-ByXrdSOx.d.ts.map → webhooks-8Ts1Clcb.d.ts.map} +1 -1
- package/package.json +1 -1
- package/src/ai/unified-prompts/reminders.ts +1 -1
- package/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts +7 -7
- package/src/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.ts +128 -0
- package/src/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.ts +1 -0
- package/src/ai/unified-prompts/skill-site-prompt.ts +15 -0
- package/src/apps/apps-config.ts +9 -0
- package/src/config/schema-fuzzer.test.ts +37 -0
- package/src/config/schema.ts +193 -0
- package/src/interface/admin-interface.ts +173 -0
- package/src/utils/tar.tsx +261 -0
- package/dist/admin-interface-BxUHaniY.d.ts.map +0 -1
- package/dist/schema-DGZfskAR.d.ts.map +0 -1
- package/dist/transactions-Brdmr3jE.d.ts.map +0 -1
|
@@ -19,39 +19,40 @@ declare const teamMemberProfilesCrudServerReadSchema: import("yup").ObjectSchema
|
|
|
19
19
|
profile_image_url: string | null;
|
|
20
20
|
} & {
|
|
21
21
|
user: {
|
|
22
|
+
restricted_reason: {
|
|
23
|
+
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
24
|
+
} | null;
|
|
25
|
+
primary_email: string | null;
|
|
22
26
|
display_name: string | null;
|
|
23
27
|
client_metadata: {} | null;
|
|
24
28
|
client_read_only_metadata: {} | null;
|
|
25
29
|
server_metadata: {} | null;
|
|
26
30
|
id: string;
|
|
27
|
-
|
|
31
|
+
selected_team_id: string | null;
|
|
32
|
+
is_anonymous: boolean;
|
|
33
|
+
is_restricted: boolean;
|
|
34
|
+
requires_totp_mfa: boolean;
|
|
35
|
+
country_code: string | null;
|
|
36
|
+
profile_image_url: string | null;
|
|
37
|
+
signed_up_at_millis: number;
|
|
38
|
+
last_active_at_millis: number;
|
|
28
39
|
primary_email_verified: boolean;
|
|
29
40
|
primary_email_auth_enabled: boolean;
|
|
30
|
-
profile_image_url: string | null;
|
|
31
41
|
selected_team: {
|
|
32
42
|
client_metadata?: {} | null | undefined;
|
|
33
43
|
client_read_only_metadata?: {} | null | undefined;
|
|
34
44
|
server_metadata?: {} | null | undefined;
|
|
35
45
|
display_name: string;
|
|
36
46
|
id: string;
|
|
37
|
-
profile_image_url: string | null;
|
|
38
47
|
created_at_millis: number;
|
|
48
|
+
profile_image_url: string | null;
|
|
39
49
|
} | null;
|
|
40
|
-
selected_team_id: string | null;
|
|
41
|
-
signed_up_at_millis: number;
|
|
42
50
|
has_password: boolean;
|
|
43
51
|
otp_auth_enabled: boolean;
|
|
44
52
|
passkey_auth_enabled: boolean;
|
|
45
|
-
last_active_at_millis: number;
|
|
46
|
-
is_anonymous: boolean;
|
|
47
|
-
is_restricted: boolean;
|
|
48
|
-
restricted_reason: {
|
|
49
|
-
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
50
|
-
} | null;
|
|
51
53
|
restricted_by_admin: boolean;
|
|
52
54
|
restricted_by_admin_reason: string | null;
|
|
53
55
|
restricted_by_admin_private_details: string | null;
|
|
54
|
-
country_code: string | null;
|
|
55
56
|
risk_scores: {
|
|
56
57
|
sign_up: {
|
|
57
58
|
bot: number;
|
|
@@ -64,7 +65,6 @@ declare const teamMemberProfilesCrudServerReadSchema: import("yup").ObjectSchema
|
|
|
64
65
|
account_id: string;
|
|
65
66
|
}[];
|
|
66
67
|
auth_with_email: boolean;
|
|
67
|
-
requires_totp_mfa: boolean;
|
|
68
68
|
};
|
|
69
69
|
}, import("yup").AnyObject, {
|
|
70
70
|
team_id: undefined;
|
|
@@ -142,39 +142,40 @@ declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
142
142
|
profile_image_url: string | null;
|
|
143
143
|
} & {
|
|
144
144
|
user: {
|
|
145
|
+
restricted_reason: {
|
|
146
|
+
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
147
|
+
} | null;
|
|
148
|
+
primary_email: string | null;
|
|
145
149
|
display_name: string | null;
|
|
146
150
|
client_metadata: {} | null;
|
|
147
151
|
client_read_only_metadata: {} | null;
|
|
148
152
|
server_metadata: {} | null;
|
|
149
153
|
id: string;
|
|
150
|
-
|
|
154
|
+
selected_team_id: string | null;
|
|
155
|
+
is_anonymous: boolean;
|
|
156
|
+
is_restricted: boolean;
|
|
157
|
+
requires_totp_mfa: boolean;
|
|
158
|
+
country_code: string | null;
|
|
159
|
+
profile_image_url: string | null;
|
|
160
|
+
signed_up_at_millis: number;
|
|
161
|
+
last_active_at_millis: number;
|
|
151
162
|
primary_email_verified: boolean;
|
|
152
163
|
primary_email_auth_enabled: boolean;
|
|
153
|
-
profile_image_url: string | null;
|
|
154
164
|
selected_team: {
|
|
155
165
|
client_metadata?: {} | null | undefined;
|
|
156
166
|
client_read_only_metadata?: {} | null | undefined;
|
|
157
167
|
server_metadata?: {} | null | undefined;
|
|
158
168
|
display_name: string;
|
|
159
169
|
id: string;
|
|
160
|
-
profile_image_url: string | null;
|
|
161
170
|
created_at_millis: number;
|
|
171
|
+
profile_image_url: string | null;
|
|
162
172
|
} | null;
|
|
163
|
-
selected_team_id: string | null;
|
|
164
|
-
signed_up_at_millis: number;
|
|
165
173
|
has_password: boolean;
|
|
166
174
|
otp_auth_enabled: boolean;
|
|
167
175
|
passkey_auth_enabled: boolean;
|
|
168
|
-
last_active_at_millis: number;
|
|
169
|
-
is_anonymous: boolean;
|
|
170
|
-
is_restricted: boolean;
|
|
171
|
-
restricted_reason: {
|
|
172
|
-
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
173
|
-
} | null;
|
|
174
176
|
restricted_by_admin: boolean;
|
|
175
177
|
restricted_by_admin_reason: string | null;
|
|
176
178
|
restricted_by_admin_private_details: string | null;
|
|
177
|
-
country_code: string | null;
|
|
178
179
|
risk_scores: {
|
|
179
180
|
sign_up: {
|
|
180
181
|
bot: number;
|
|
@@ -187,7 +188,6 @@ declare const teamMemberProfilesCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
187
188
|
account_id: string;
|
|
188
189
|
}[];
|
|
189
190
|
auth_with_email: boolean;
|
|
190
|
-
requires_totp_mfa: boolean;
|
|
191
191
|
};
|
|
192
192
|
}, import("yup").AnyObject, {
|
|
193
193
|
team_id: undefined;
|
|
@@ -3,6 +3,7 @@ import { InferType } from "yup";
|
|
|
3
3
|
//#region src/interface/crud/transactions.d.ts
|
|
4
4
|
declare const transactionEntrySchema: import("yup").MixedSchema<{
|
|
5
5
|
type: "money_transfer";
|
|
6
|
+
customer_id: string;
|
|
6
7
|
customer_type: "team" | "user" | "custom";
|
|
7
8
|
charged_amount: {
|
|
8
9
|
USD?: string | undefined;
|
|
@@ -18,29 +19,29 @@ declare const transactionEntrySchema: import("yup").MixedSchema<{
|
|
|
18
19
|
};
|
|
19
20
|
adjusted_transaction_id: string | null;
|
|
20
21
|
adjusted_entry_index: number | null;
|
|
21
|
-
customer_id: string;
|
|
22
22
|
} | {
|
|
23
23
|
type: "item_quantity_change";
|
|
24
24
|
item_id: string;
|
|
25
|
+
customer_id: string;
|
|
25
26
|
quantity: number;
|
|
26
27
|
customer_type: "team" | "user" | "custom";
|
|
27
28
|
adjusted_transaction_id: string | null;
|
|
28
29
|
adjusted_entry_index: number | null;
|
|
29
|
-
customer_id: string;
|
|
30
30
|
} | {
|
|
31
|
-
subscription_id?: string | undefined;
|
|
32
31
|
one_time_purchase_id?: string | undefined;
|
|
32
|
+
subscription_id?: string | undefined;
|
|
33
33
|
type: "product_grant";
|
|
34
|
+
customer_id: string;
|
|
35
|
+
product_id: string | null;
|
|
34
36
|
quantity: number;
|
|
35
37
|
customer_type: "team" | "user" | "custom";
|
|
36
38
|
product: {
|
|
39
|
+
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
37
40
|
client_metadata?: {} | null | undefined;
|
|
38
41
|
client_read_only_metadata?: {} | null | undefined;
|
|
39
42
|
server_metadata?: {} | null | undefined;
|
|
40
|
-
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
41
|
-
display_name: string;
|
|
42
|
-
customer_type: "team" | "user" | "custom";
|
|
43
43
|
server_only: boolean;
|
|
44
|
+
customer_type: "team" | "user" | "custom";
|
|
44
45
|
stackable: boolean;
|
|
45
46
|
prices: Record<string, {
|
|
46
47
|
USD?: string | undefined;
|
|
@@ -50,19 +51,18 @@ declare const transactionEntrySchema: import("yup").MixedSchema<{
|
|
|
50
51
|
INR?: string | undefined;
|
|
51
52
|
AUD?: string | undefined;
|
|
52
53
|
CAD?: string | undefined;
|
|
53
|
-
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
54
54
|
interval?: import("../../utils/dates").DayInterval | undefined;
|
|
55
|
+
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
55
56
|
}>;
|
|
57
|
+
display_name: string;
|
|
56
58
|
included_items: Record<string, {
|
|
57
|
-
repeat?: "never" | import("../../utils/dates").DayInterval | undefined;
|
|
58
59
|
quantity?: number | undefined;
|
|
60
|
+
repeat?: "never" | import("../../utils/dates").DayInterval | undefined;
|
|
59
61
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
60
62
|
}>;
|
|
61
63
|
};
|
|
62
|
-
product_id: string | null;
|
|
63
64
|
adjusted_transaction_id: string | null;
|
|
64
65
|
adjusted_entry_index: number | null;
|
|
65
|
-
customer_id: string;
|
|
66
66
|
price_id: string | null;
|
|
67
67
|
} | {
|
|
68
68
|
type: "product_revocation";
|
|
@@ -87,6 +87,7 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
87
87
|
customer_id: string;
|
|
88
88
|
entries: ({
|
|
89
89
|
type: "money_transfer";
|
|
90
|
+
customer_id: string;
|
|
90
91
|
customer_type: "team" | "user" | "custom";
|
|
91
92
|
charged_amount: {
|
|
92
93
|
USD?: string | undefined;
|
|
@@ -102,29 +103,29 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
102
103
|
};
|
|
103
104
|
adjusted_transaction_id: string | null;
|
|
104
105
|
adjusted_entry_index: number | null;
|
|
105
|
-
customer_id: string;
|
|
106
106
|
} | {
|
|
107
107
|
type: "item_quantity_change";
|
|
108
108
|
item_id: string;
|
|
109
|
+
customer_id: string;
|
|
109
110
|
quantity: number;
|
|
110
111
|
customer_type: "team" | "user" | "custom";
|
|
111
112
|
adjusted_transaction_id: string | null;
|
|
112
113
|
adjusted_entry_index: number | null;
|
|
113
|
-
customer_id: string;
|
|
114
114
|
} | {
|
|
115
|
-
subscription_id?: string | undefined;
|
|
116
115
|
one_time_purchase_id?: string | undefined;
|
|
116
|
+
subscription_id?: string | undefined;
|
|
117
117
|
type: "product_grant";
|
|
118
|
+
customer_id: string;
|
|
119
|
+
product_id: string | null;
|
|
118
120
|
quantity: number;
|
|
119
121
|
customer_type: "team" | "user" | "custom";
|
|
120
122
|
product: {
|
|
123
|
+
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
121
124
|
client_metadata?: {} | null | undefined;
|
|
122
125
|
client_read_only_metadata?: {} | null | undefined;
|
|
123
126
|
server_metadata?: {} | null | undefined;
|
|
124
|
-
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
125
|
-
display_name: string;
|
|
126
|
-
customer_type: "team" | "user" | "custom";
|
|
127
127
|
server_only: boolean;
|
|
128
|
+
customer_type: "team" | "user" | "custom";
|
|
128
129
|
stackable: boolean;
|
|
129
130
|
prices: Record<string, {
|
|
130
131
|
USD?: string | undefined;
|
|
@@ -134,19 +135,18 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
134
135
|
INR?: string | undefined;
|
|
135
136
|
AUD?: string | undefined;
|
|
136
137
|
CAD?: string | undefined;
|
|
137
|
-
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
138
138
|
interval?: import("../../utils/dates").DayInterval | undefined;
|
|
139
|
+
free_trial?: import("../../utils/dates").DayInterval | undefined;
|
|
139
140
|
}>;
|
|
141
|
+
display_name: string;
|
|
140
142
|
included_items: Record<string, {
|
|
141
|
-
repeat?: "never" | import("../../utils/dates").DayInterval | undefined;
|
|
142
143
|
quantity?: number | undefined;
|
|
144
|
+
repeat?: "never" | import("../../utils/dates").DayInterval | undefined;
|
|
143
145
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
144
146
|
}>;
|
|
145
147
|
};
|
|
146
|
-
product_id: string | null;
|
|
147
148
|
adjusted_transaction_id: string | null;
|
|
148
149
|
adjusted_entry_index: number | null;
|
|
149
|
-
customer_id: string;
|
|
150
150
|
price_id: string | null;
|
|
151
151
|
} | {
|
|
152
152
|
type: "product_revocation";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.d.ts","names":[],"sources":["../../../../src/interface/crud/transactions.ts"],"mappings":";;;cAwFa,sBAAA,gBAAsB,WAAA
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","names":[],"sources":["../../../../src/interface/crud/transactions.ts"],"mappings":";;;cAwFa,sBAAA,gBAAsB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAMxB,MAAA;;;;;;;;;;;;oBAAA,MAAA;;;;;;;;;;;;;;;;;;;;KAEC,gBAAA,GAAmB,SAAS,QAAQ,sBAAA;AAAA,cAEnC,iBAAA;AAAA,KAUD,eAAA,WAA0B,iBAAiB;AAAA,cAE1C,iBAAA,gBAAiB,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBlB,MAAA;;;;;;;;;;;;sBAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,WAAA,GAAc,SAAS,QAAQ,iBAAA"}
|
|
@@ -82,8 +82,8 @@ declare const usersCrudServerReadSchema: yup$1.ObjectSchema<{
|
|
|
82
82
|
server_metadata?: {} | null | undefined;
|
|
83
83
|
display_name: string;
|
|
84
84
|
id: string;
|
|
85
|
-
profile_image_url: string | null;
|
|
86
85
|
created_at_millis: number;
|
|
86
|
+
profile_image_url: string | null;
|
|
87
87
|
} | null;
|
|
88
88
|
selected_team_id: string | null;
|
|
89
89
|
profile_image_url: string | null;
|
|
@@ -162,34 +162,34 @@ 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;
|
|
165
166
|
display_name: string | null | undefined;
|
|
166
167
|
client_metadata: {} | null | undefined;
|
|
167
168
|
client_read_only_metadata: {} | null | undefined;
|
|
168
169
|
server_metadata: {} | null | undefined;
|
|
169
|
-
|
|
170
|
+
is_anonymous: boolean | undefined;
|
|
171
|
+
password: string | null | undefined;
|
|
172
|
+
country_code: string | null | undefined;
|
|
173
|
+
profile_image_url: string | null | undefined;
|
|
170
174
|
primary_email_verified: boolean | undefined;
|
|
171
175
|
primary_email_auth_enabled: boolean | undefined;
|
|
172
|
-
profile_image_url: string | null | undefined;
|
|
173
176
|
otp_auth_enabled: boolean | undefined;
|
|
174
177
|
passkey_auth_enabled: boolean | undefined;
|
|
175
|
-
is_anonymous: boolean | undefined;
|
|
176
178
|
restricted_by_admin: boolean | undefined;
|
|
177
179
|
restricted_by_admin_reason: string | null | undefined;
|
|
178
180
|
restricted_by_admin_private_details: string | null | undefined;
|
|
179
|
-
country_code: string | null | undefined;
|
|
180
181
|
risk_scores: {
|
|
181
182
|
sign_up: {
|
|
182
183
|
bot: number;
|
|
183
184
|
free_trial_abuse: number;
|
|
184
185
|
};
|
|
185
186
|
} | undefined;
|
|
186
|
-
password: string | null | undefined;
|
|
187
187
|
password_hash: string | undefined;
|
|
188
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;
|
|
@@ -235,8 +235,8 @@ declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
235
235
|
server_metadata?: {} | null | undefined;
|
|
236
236
|
display_name: string;
|
|
237
237
|
id: string;
|
|
238
|
-
profile_image_url: string | null;
|
|
239
238
|
created_at_millis: number;
|
|
239
|
+
profile_image_url: string | null;
|
|
240
240
|
} | null;
|
|
241
241
|
selected_team_id: string | null;
|
|
242
242
|
profile_image_url: string | null;
|
|
@@ -368,34 +368,34 @@ declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
368
368
|
};
|
|
369
369
|
}, "">;
|
|
370
370
|
serverCreateSchema: yup$1.ObjectSchema<{
|
|
371
|
+
primary_email: string | null | undefined;
|
|
371
372
|
display_name: string | null | undefined;
|
|
372
373
|
client_metadata: {} | null | undefined;
|
|
373
374
|
client_read_only_metadata: {} | null | undefined;
|
|
374
375
|
server_metadata: {} | null | undefined;
|
|
375
|
-
|
|
376
|
+
is_anonymous: boolean | undefined;
|
|
377
|
+
password: string | null | undefined;
|
|
378
|
+
country_code: string | null | undefined;
|
|
379
|
+
profile_image_url: string | null | undefined;
|
|
376
380
|
primary_email_verified: boolean | undefined;
|
|
377
381
|
primary_email_auth_enabled: boolean | undefined;
|
|
378
|
-
profile_image_url: string | null | undefined;
|
|
379
382
|
otp_auth_enabled: boolean | undefined;
|
|
380
383
|
passkey_auth_enabled: boolean | undefined;
|
|
381
|
-
is_anonymous: boolean | undefined;
|
|
382
384
|
restricted_by_admin: boolean | undefined;
|
|
383
385
|
restricted_by_admin_reason: string | null | undefined;
|
|
384
386
|
restricted_by_admin_private_details: string | null | undefined;
|
|
385
|
-
country_code: string | null | undefined;
|
|
386
387
|
risk_scores: {
|
|
387
388
|
sign_up: {
|
|
388
389
|
bot: number;
|
|
389
390
|
free_trial_abuse: number;
|
|
390
391
|
};
|
|
391
392
|
} | undefined;
|
|
392
|
-
password: string | null | undefined;
|
|
393
393
|
password_hash: string | undefined;
|
|
394
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;
|
|
@@ -469,8 +469,8 @@ declare const userCreatedWebhookEvent: WebhookEvent<yup$1.ObjectSchema<{
|
|
|
469
469
|
server_metadata?: {} | null | undefined;
|
|
470
470
|
display_name: string;
|
|
471
471
|
id: string;
|
|
472
|
-
profile_image_url: string | null;
|
|
473
472
|
created_at_millis: number;
|
|
473
|
+
profile_image_url: string | null;
|
|
474
474
|
} | null;
|
|
475
475
|
selected_team_id: string | null;
|
|
476
476
|
profile_image_url: string | null;
|
|
@@ -560,8 +560,8 @@ declare const userUpdatedWebhookEvent: WebhookEvent<yup$1.ObjectSchema<{
|
|
|
560
560
|
server_metadata?: {} | null | undefined;
|
|
561
561
|
display_name: string;
|
|
562
562
|
id: string;
|
|
563
|
-
profile_image_url: string | null;
|
|
564
563
|
created_at_millis: number;
|
|
564
|
+
profile_image_url: string | null;
|
|
565
565
|
} | null;
|
|
566
566
|
selected_team_id: string | null;
|
|
567
567
|
profile_image_url: string | null;
|
|
@@ -24,16 +24,16 @@ declare const planUsageRowSchema: yup$1.ObjectSchema<{
|
|
|
24
24
|
declare const planUsageResponseSchema: yup$1.ObjectSchema<{
|
|
25
25
|
owner_team_id: string;
|
|
26
26
|
owner_team_display_name: string;
|
|
27
|
-
plan_id: "
|
|
27
|
+
plan_id: "team" | "free" | "growth";
|
|
28
28
|
plan_display_name: string;
|
|
29
29
|
period_start_millis: number;
|
|
30
30
|
period_end_millis: number;
|
|
31
31
|
next_plan_id: "team" | "growth" | null;
|
|
32
32
|
are_plan_limits_enforced: boolean;
|
|
33
33
|
rows: {
|
|
34
|
-
kind: "current" | "metered" | "capability";
|
|
35
34
|
item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
|
|
36
35
|
display_name: string;
|
|
36
|
+
kind: "current" | "metered" | "capability";
|
|
37
37
|
used: number | null;
|
|
38
38
|
limit: number | null;
|
|
39
39
|
remaining: number | null;
|
|
@@ -22,8 +22,8 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
22
22
|
server_metadata?: {} | null | undefined;
|
|
23
23
|
display_name: string;
|
|
24
24
|
id: string;
|
|
25
|
-
profile_image_url: string | null;
|
|
26
25
|
created_at_millis: number;
|
|
26
|
+
profile_image_url: string | null;
|
|
27
27
|
} | null;
|
|
28
28
|
selected_team_id: string | null;
|
|
29
29
|
profile_image_url: string | null;
|
|
@@ -112,8 +112,8 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
112
112
|
server_metadata?: {} | null | undefined;
|
|
113
113
|
display_name: string;
|
|
114
114
|
id: string;
|
|
115
|
-
profile_image_url: string | null;
|
|
116
115
|
created_at_millis: number;
|
|
116
|
+
profile_image_url: string | null;
|
|
117
117
|
} | null;
|
|
118
118
|
selected_team_id: string | null;
|
|
119
119
|
profile_image_url: string | null;
|
|
@@ -518,7 +518,7 @@ declare const KnownErrors: {
|
|
|
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: "
|
|
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
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"]> & {
|
|
@@ -140,7 +140,7 @@ declare const projectSignUpEnabledSchema: yup$1.BooleanSchema<boolean | undefine
|
|
|
140
140
|
declare const projectCredentialEnabledSchema: yup$1.BooleanSchema<boolean | undefined, yup$1.AnyObject, undefined, "">;
|
|
141
141
|
declare const oauthIdSchema: yup$1.StringSchema<"google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined, yup$1.AnyObject, undefined, "">;
|
|
142
142
|
declare const oauthEnabledSchema: yup$1.BooleanSchema<boolean | undefined, yup$1.AnyObject, undefined, "">;
|
|
143
|
-
declare const oauthTypeSchema: yup$1.StringSchema<"
|
|
143
|
+
declare const oauthTypeSchema: yup$1.StringSchema<"shared" | "standard" | undefined, yup$1.AnyObject, undefined, "">;
|
|
144
144
|
declare const oauthClientIdSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
145
145
|
declare const oauthClientSecretSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
146
146
|
declare const oauthCustomCallbackUrlSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
@@ -151,7 +151,7 @@ declare const oauthAppleBundleIdSchema: yup$1.StringSchema<string, yup$1.AnyObje
|
|
|
151
151
|
declare const oauthAccountMergeStrategySchema: yup$1.StringSchema<"link_method" | "raise_error" | "allow_duplicates" | undefined, yup$1.AnyObject, undefined, "">;
|
|
152
152
|
declare const oauthIssuerUrlSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
153
153
|
declare const oauthScopeSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
154
|
-
declare const emailTypeSchema: yup$1.StringSchema<"
|
|
154
|
+
declare const emailTypeSchema: yup$1.StringSchema<"shared" | "standard" | undefined, yup$1.AnyObject, undefined, "">;
|
|
155
155
|
declare const emailSenderNameSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
156
156
|
declare const emailHostSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
|
|
157
157
|
declare const emailPortSchema: yup$1.NumberSchema<number | undefined, yup$1.AnyObject, undefined, "">;
|
|
@@ -310,12 +310,12 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
|
|
|
310
310
|
INR?: string | undefined;
|
|
311
311
|
AUD?: string | undefined;
|
|
312
312
|
CAD?: string | undefined;
|
|
313
|
-
free_trial?: DayInterval | undefined;
|
|
314
313
|
interval?: DayInterval | undefined;
|
|
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;
|
package/dist/esm/sessions.d.ts
CHANGED
|
@@ -9,25 +9,25 @@ declare class AccessToken {
|
|
|
9
9
|
private constructor();
|
|
10
10
|
get payload(): {
|
|
11
11
|
exp?: number | undefined;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
is_restricted: boolean;
|
|
12
|
+
project_id: string;
|
|
13
|
+
refresh_token_id: string;
|
|
14
|
+
email: string | null;
|
|
16
15
|
restricted_reason: {
|
|
17
16
|
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
18
17
|
} | null;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
name: string | null;
|
|
22
|
-
role: "authenticated";
|
|
18
|
+
branch_id: string;
|
|
19
|
+
sub: string;
|
|
23
20
|
iat: number;
|
|
24
21
|
iss: string;
|
|
25
22
|
aud: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
refresh_token_id: string;
|
|
23
|
+
role: "authenticated";
|
|
24
|
+
name: string | null;
|
|
29
25
|
email_verified: boolean;
|
|
26
|
+
selected_team_id: string | null;
|
|
30
27
|
signed_up_at: number;
|
|
28
|
+
is_anonymous: boolean;
|
|
29
|
+
is_restricted: boolean;
|
|
30
|
+
requires_totp_mfa: boolean;
|
|
31
31
|
};
|
|
32
32
|
get expiresAt(): Date;
|
|
33
33
|
get issuedAt(): Date;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/utils/tar.d.ts
|
|
2
|
+
type TarEntry = {
|
|
3
|
+
path: string;
|
|
4
|
+
data: Uint8Array;
|
|
5
|
+
};
|
|
6
|
+
type TarLimits = {
|
|
7
|
+
maxEntries: number;
|
|
8
|
+
maxTotalBytes: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Serializes entries into an (uncompressed) ustar tarball. Entries whose path
|
|
12
|
+
* ends with "/" are written as directories and must have empty data.
|
|
13
|
+
*/
|
|
14
|
+
declare function createTar(entries: TarEntry[]): Uint8Array<ArrayBuffer>;
|
|
15
|
+
/**
|
|
16
|
+
* Parses an (uncompressed) ustar tarball produced by `createTar` (or any tool
|
|
17
|
+
* emitting the plain ustar subset). Strict by design — see module comment.
|
|
18
|
+
* Directory entries are returned with a trailing "/" and empty data.
|
|
19
|
+
*
|
|
20
|
+
* Throws `StatusError(400, ...)` on malformed or unsafe input so backend routes
|
|
21
|
+
* can surface it directly to the uploader.
|
|
22
|
+
*/
|
|
23
|
+
declare function parseTar(bytes: Uint8Array, limits: TarLimits): TarEntry[];
|
|
24
|
+
//#endregion
|
|
25
|
+
export { TarEntry, TarLimits, createTar, parseTar };
|
|
26
|
+
//# sourceMappingURL=tar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar.d.ts","names":[],"sources":["../../../src/utils/tar.tsx"],"mappings":";KAeY,QAAA;EAEV,IAAA;EACA,IAAA,EAAM,UAAU;AAAA;AAAA,KAGN,SAAA;EACV,UAAA;EACA,aAAa;AAAA;;AALG;AAGlB;;iBAqDgB,SAAA,CAAU,OAAA,EAAS,QAAA,KAAa,UAAA,CAAW,WAAA;;AAnD5C;AAmDf;;;;;;iBA2EgB,QAAA,CAAS,KAAA,EAAO,UAAA,EAAY,MAAA,EAAQ,SAAA,GAAY,QAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { HexclaveAssertionError, StatusError } from "./errors.js";
|
|
2
|
+
//#region src/utils/tar.tsx
|
|
3
|
+
const BLOCK_SIZE = 512;
|
|
4
|
+
function writeOctal(header, offset, length, value) {
|
|
5
|
+
if (value < 0 || !Number.isSafeInteger(value)) throw new HexclaveAssertionError(`Invalid tar octal value: ${value}`);
|
|
6
|
+
const str = value.toString(8).padStart(length - 1, "0");
|
|
7
|
+
if (str.length > length - 1) throw new HexclaveAssertionError(`Tar octal value too large for field: ${value} (field length ${length})`);
|
|
8
|
+
for (let i = 0; i < str.length; i++) header[offset + i] = str.charCodeAt(i);
|
|
9
|
+
}
|
|
10
|
+
function writeString(header, offset, length, value) {
|
|
11
|
+
const bytes = new TextEncoder().encode(value);
|
|
12
|
+
if (bytes.length > length) throw new HexclaveAssertionError(`Tar string too long for field: ${value}`);
|
|
13
|
+
header.set(bytes, offset);
|
|
14
|
+
}
|
|
15
|
+
function splitUstarPath(path) {
|
|
16
|
+
if (new TextEncoder().encode(path).length <= 100) return {
|
|
17
|
+
prefix: "",
|
|
18
|
+
name: path
|
|
19
|
+
};
|
|
20
|
+
const parts = path.split("/");
|
|
21
|
+
for (let i = parts.length - 1; i > 0; i--) {
|
|
22
|
+
const prefix = parts.slice(0, i).join("/");
|
|
23
|
+
const name = parts.slice(i).join("/");
|
|
24
|
+
const prefixLen = new TextEncoder().encode(prefix).length;
|
|
25
|
+
const nameLen = new TextEncoder().encode(name).length;
|
|
26
|
+
if (prefixLen <= 155 && nameLen > 0 && nameLen <= 100) return {
|
|
27
|
+
prefix,
|
|
28
|
+
name
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Serializes entries into an (uncompressed) ustar tarball. Entries whose path
|
|
34
|
+
* ends with "/" are written as directories and must have empty data.
|
|
35
|
+
*/
|
|
36
|
+
function createTar(entries) {
|
|
37
|
+
const chunks = [];
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
if (entry.path.startsWith("/") || entry.path.split("/").includes("..") || entry.path === "") throw new HexclaveAssertionError(`Invalid tar entry path: ${JSON.stringify(entry.path)}`);
|
|
40
|
+
const isDirectory = entry.path.endsWith("/");
|
|
41
|
+
if (isDirectory && entry.data.length > 0) throw new HexclaveAssertionError(`Tar directory entry must have empty data: ${entry.path}`);
|
|
42
|
+
const split = splitUstarPath(entry.path) ?? throwPathTooLong(entry.path);
|
|
43
|
+
const header = new Uint8Array(BLOCK_SIZE);
|
|
44
|
+
writeString(header, 0, 100, split.name);
|
|
45
|
+
writeOctal(header, 100, 8, isDirectory ? 493 : 420);
|
|
46
|
+
writeOctal(header, 108, 8, 0);
|
|
47
|
+
writeOctal(header, 116, 8, 0);
|
|
48
|
+
writeOctal(header, 124, 12, entry.data.length);
|
|
49
|
+
writeOctal(header, 136, 12, 0);
|
|
50
|
+
header[156] = isDirectory ? 53 : 48;
|
|
51
|
+
writeString(header, 257, 6, "ustar");
|
|
52
|
+
header[263] = 48;
|
|
53
|
+
header[264] = 48;
|
|
54
|
+
writeString(header, 345, 155, split.prefix);
|
|
55
|
+
header.fill(32, 148, 156);
|
|
56
|
+
let checksum = 0;
|
|
57
|
+
for (const byte of header) checksum += byte;
|
|
58
|
+
header.fill(0, 148, 156);
|
|
59
|
+
writeOctal(header, 148, 7, checksum);
|
|
60
|
+
header[155] = 32;
|
|
61
|
+
chunks.push(header);
|
|
62
|
+
if (entry.data.length > 0) {
|
|
63
|
+
chunks.push(entry.data);
|
|
64
|
+
const padding = (BLOCK_SIZE - entry.data.length % BLOCK_SIZE) % BLOCK_SIZE;
|
|
65
|
+
if (padding > 0) chunks.push(new Uint8Array(padding));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
chunks.push(new Uint8Array(2 * BLOCK_SIZE));
|
|
69
|
+
const total = chunks.reduce((sum, c) => sum + c.length, 0);
|
|
70
|
+
const result = new Uint8Array(total);
|
|
71
|
+
let offset = 0;
|
|
72
|
+
for (const chunk of chunks) {
|
|
73
|
+
result.set(chunk, offset);
|
|
74
|
+
offset += chunk.length;
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
function throwPathTooLong(path) {
|
|
79
|
+
throw new StatusError(400, `File path too long to be packaged: ${JSON.stringify(path)}`);
|
|
80
|
+
}
|
|
81
|
+
function readString(block, offset, length) {
|
|
82
|
+
let end = offset;
|
|
83
|
+
while (end < offset + length && block[end] !== 0) end++;
|
|
84
|
+
return new TextDecoder().decode(block.subarray(offset, end));
|
|
85
|
+
}
|
|
86
|
+
function readOctal(block, offset, length) {
|
|
87
|
+
const str = readString(block, offset, length).trim();
|
|
88
|
+
if (str === "") return 0;
|
|
89
|
+
if (!/^[0-7]+$/.test(str)) throw new StatusError(400, "Invalid tarball: malformed octal header field");
|
|
90
|
+
return parseInt(str, 8);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parses an (uncompressed) ustar tarball produced by `createTar` (or any tool
|
|
94
|
+
* emitting the plain ustar subset). Strict by design — see module comment.
|
|
95
|
+
* Directory entries are returned with a trailing "/" and empty data.
|
|
96
|
+
*
|
|
97
|
+
* Throws `StatusError(400, ...)` on malformed or unsafe input so backend routes
|
|
98
|
+
* can surface it directly to the uploader.
|
|
99
|
+
*/
|
|
100
|
+
function parseTar(bytes, limits) {
|
|
101
|
+
const entries = [];
|
|
102
|
+
let offset = 0;
|
|
103
|
+
let totalBytes = 0;
|
|
104
|
+
while (offset + BLOCK_SIZE <= bytes.length) {
|
|
105
|
+
const header = bytes.subarray(offset, offset + BLOCK_SIZE);
|
|
106
|
+
if (header.every((b) => b === 0)) return entries;
|
|
107
|
+
if (readString(header, 257, 6) !== "ustar") throw new StatusError(400, "Invalid tarball: not a ustar archive");
|
|
108
|
+
let expectedChecksum = 0;
|
|
109
|
+
for (let i = 0; i < BLOCK_SIZE; i++) expectedChecksum += i >= 148 && i < 156 ? 32 : header[i];
|
|
110
|
+
if (readOctal(header, 148, 8) !== expectedChecksum) throw new StatusError(400, "Invalid tarball: header checksum mismatch");
|
|
111
|
+
const typeflag = header[156];
|
|
112
|
+
if (typeflag !== 48 && typeflag !== 0 && typeflag !== 53) throw new StatusError(400, "Invalid tarball: only regular files and directories are supported");
|
|
113
|
+
const prefix = readString(header, 345, 155);
|
|
114
|
+
const name = readString(header, 0, 100);
|
|
115
|
+
const path = prefix === "" ? name : `${prefix}/${name}`;
|
|
116
|
+
if (path === "" || path.startsWith("/") || path.split("/").includes("..") || path.includes("\\")) throw new StatusError(400, `Invalid tarball: unsafe entry path ${JSON.stringify(path)}`);
|
|
117
|
+
const size = readOctal(header, 124, 12);
|
|
118
|
+
const isDirectory = typeflag === 53;
|
|
119
|
+
if (isDirectory && size !== 0) throw new StatusError(400, "Invalid tarball: directory entry with non-zero size");
|
|
120
|
+
offset += BLOCK_SIZE;
|
|
121
|
+
if (offset + size > bytes.length) throw new StatusError(400, "Invalid tarball: truncated file data");
|
|
122
|
+
totalBytes += size;
|
|
123
|
+
if (entries.length + 1 > limits.maxEntries) throw new StatusError(400, `Tarball contains too many files (max ${limits.maxEntries})`);
|
|
124
|
+
if (totalBytes > limits.maxTotalBytes) throw new StatusError(400, `Tarball contents too large (max ${limits.maxTotalBytes} bytes)`);
|
|
125
|
+
entries.push({
|
|
126
|
+
path: isDirectory && !path.endsWith("/") ? `${path}/` : path,
|
|
127
|
+
data: bytes.slice(offset, offset + size)
|
|
128
|
+
});
|
|
129
|
+
offset += size + (BLOCK_SIZE - size % BLOCK_SIZE) % BLOCK_SIZE;
|
|
130
|
+
}
|
|
131
|
+
throw new StatusError(400, "Invalid tarball: missing end-of-archive marker");
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { createTar, parseTar };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=tar.js.map
|