@hexclave/shared 1.0.61 → 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-ChuyYSXj.d.ts → admin-interface-D63SFHX_.d.ts} +94 -12
- package/dist/admin-interface-D63SFHX_.d.ts.map +1 -0
- package/dist/{admin-metrics-1yiWGq9z.d.ts → admin-metrics-bsOkw4YQ.d.ts} +15 -15
- package/dist/{admin-metrics-1yiWGq9z.d.ts.map → admin-metrics-bsOkw4YQ.d.ts.map} +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +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.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-C4H4gn_G.d.ts → client-interface-DvkciaL0.d.ts} +10 -10
- package/dist/{client-interface-C4H4gn_G.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-BCkMYzHx.d.ts → current-user-BBoN3hsn.d.ts} +17 -17
- package/dist/{current-user-BCkMYzHx.d.ts.map → current-user-BBoN3hsn.d.ts.map} +1 -1
- package/dist/{email-outbox-BRZiK0ZG.d.ts → email-outbox-CqzwInBL.d.ts} +313 -313
- package/dist/{email-outbox-BRZiK0ZG.d.ts.map → email-outbox-CqzwInBL.d.ts.map} +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +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.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 +249 -119
- 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 +14 -14
- package/dist/esm/interface/conversations.d.ts +37 -37
- package/dist/esm/interface/crud/current-user.d.ts +16 -16
- package/dist/esm/interface/crud/email-outbox.d.ts +312 -312
- 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 +32 -32
- package/dist/esm/interface/crud/transactions.d.ts +29 -29
- package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
- package/dist/esm/interface/crud/users.d.ts +22 -22
- package/dist/esm/interface/plan-usage.d.ts +1 -1
- package/dist/esm/interface/webhooks.d.ts +4 -4
- package/dist/esm/known-errors.d.ts +4 -4
- package/dist/esm/schema-fields.d.ts +12 -12
- package/dist/esm/sessions.d.ts +9 -9
- 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 +37 -37
- 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-Bhd0JAgh.d.ts → known-errors-Bm4a61wL.d.ts} +5 -5
- package/dist/{known-errors-Bhd0JAgh.d.ts.map → known-errors-Bm4a61wL.d.ts.map} +1 -1
- package/dist/known-errors.d.ts +1 -1
- package/dist/{plan-usage-COq9I00z.d.ts → plan-usage-BaDxcLZ1.d.ts} +2 -2
- package/dist/{plan-usage-COq9I00z.d.ts.map → plan-usage-BaDxcLZ1.d.ts.map} +1 -1
- package/dist/{products-BkPf1X78.d.ts → products-D4o8A2W0.d.ts} +24 -24
- package/dist/{products-BkPf1X78.d.ts.map → products-D4o8A2W0.d.ts.map} +1 -1
- package/dist/{project-api-keys-CK9SIo0q.d.ts → project-api-keys--7V5X_UW.d.ts} +5 -5
- package/dist/{project-api-keys-CK9SIo0q.d.ts.map → project-api-keys--7V5X_UW.d.ts.map} +1 -1
- package/dist/{projects-CVqfljhv.d.ts → projects-BX5Y50kJ.d.ts} +60 -60
- package/dist/{projects-CVqfljhv.d.ts.map → projects-BX5Y50kJ.d.ts.map} +1 -1
- package/dist/{schema-BPMGhu_7.d.ts → schema-dJ_7rUCO.d.ts} +250 -120
- package/dist/schema-dJ_7rUCO.d.ts.map +1 -0
- package/dist/{schema-fields-C8sIQVTq.d.ts → schema-fields-DZtDQEEO.d.ts} +13 -13
- package/dist/{schema-fields-C8sIQVTq.d.ts.map → schema-fields-DZtDQEEO.d.ts.map} +1 -1
- package/dist/schema-fields.d.ts +1 -1
- package/dist/{server-interface-CRp4VVZh.d.ts → server-interface-Ra_vIHP4.d.ts} +8 -8
- package/dist/{server-interface-CRp4VVZh.d.ts.map → server-interface-Ra_vIHP4.d.ts.map} +1 -1
- package/dist/{sessions-COluKK6_.d.ts → sessions-CI-0TBQb.d.ts} +11 -11
- package/dist/{sessions-COluKK6_.d.ts.map → sessions-CI-0TBQb.d.ts.map} +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/{team-member-profiles-CgYXR-Rx.d.ts → team-member-profiles-BoDEqx-0.d.ts} +33 -33
- package/dist/{team-member-profiles-CgYXR-Rx.d.ts.map → team-member-profiles-BoDEqx-0.d.ts.map} +1 -1
- package/dist/{transactions-7q13mxhG.d.ts → transactions-CHNUJ42J.d.ts} +30 -30
- package/dist/transactions-CHNUJ42J.d.ts.map +1 -0
- package/dist/{users-7MKfEyyq.d.ts → users-DHNRwoSz.d.ts} +24 -24
- package/dist/{users-7MKfEyyq.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-C5gG85Ce.d.ts → webhooks-8Ts1Clcb.d.ts} +5 -5
- package/dist/{webhooks-C5gG85Ce.d.ts.map → webhooks-8Ts1Clcb.d.ts.map} +1 -1
- package/package.json +1 -1
- package/src/ai/unified-prompts/skill-site-prompt-parts/deployments-skill.ts +128 -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-ChuyYSXj.d.ts.map +0 -1
- package/dist/schema-BPMGhu_7.d.ts.map +0 -1
- package/dist/transactions-7q13mxhG.d.ts.map +0 -1
|
@@ -4,7 +4,8 @@ import { InferType } from "yup";
|
|
|
4
4
|
//#region src/interface/crud/transactions.d.ts
|
|
5
5
|
declare const transactionEntrySchema: import("yup").MixedSchema<{
|
|
6
6
|
type: "money_transfer";
|
|
7
|
-
|
|
7
|
+
customer_id: string;
|
|
8
|
+
customer_type: "team" | "user" | "custom";
|
|
8
9
|
charged_amount: {
|
|
9
10
|
USD?: string | undefined;
|
|
10
11
|
EUR?: string | undefined;
|
|
@@ -19,32 +20,31 @@ declare const transactionEntrySchema: import("yup").MixedSchema<{
|
|
|
19
20
|
};
|
|
20
21
|
adjusted_transaction_id: string | null;
|
|
21
22
|
adjusted_entry_index: number | null;
|
|
22
|
-
customer_id: string;
|
|
23
23
|
} | {
|
|
24
24
|
type: "item_quantity_change";
|
|
25
|
+
item_id: string;
|
|
26
|
+
customer_id: string;
|
|
25
27
|
quantity: number;
|
|
26
|
-
customer_type: "
|
|
28
|
+
customer_type: "team" | "user" | "custom";
|
|
27
29
|
adjusted_transaction_id: string | null;
|
|
28
30
|
adjusted_entry_index: number | null;
|
|
29
|
-
customer_id: string;
|
|
30
|
-
item_id: string;
|
|
31
31
|
} | {
|
|
32
|
-
subscription_id?: string | undefined;
|
|
33
32
|
one_time_purchase_id?: string | undefined;
|
|
33
|
+
subscription_id?: string | undefined;
|
|
34
34
|
type: "product_grant";
|
|
35
|
+
customer_id: string;
|
|
36
|
+
product_id: string | null;
|
|
35
37
|
quantity: number;
|
|
36
|
-
customer_type: "
|
|
38
|
+
customer_type: "team" | "user" | "custom";
|
|
37
39
|
product: {
|
|
40
|
+
free_trial?: DayInterval | undefined;
|
|
38
41
|
client_metadata?: {} | null | undefined;
|
|
39
42
|
client_read_only_metadata?: {} | null | undefined;
|
|
40
43
|
server_metadata?: {} | null | undefined;
|
|
41
|
-
free_trial?: DayInterval | undefined;
|
|
42
|
-
display_name: string;
|
|
43
|
-
customer_type: "user" | "team" | "custom";
|
|
44
44
|
server_only: boolean;
|
|
45
|
+
customer_type: "team" | "user" | "custom";
|
|
45
46
|
stackable: boolean;
|
|
46
47
|
prices: Record<string, {
|
|
47
|
-
free_trial?: DayInterval | undefined;
|
|
48
48
|
USD?: string | undefined;
|
|
49
49
|
EUR?: string | undefined;
|
|
50
50
|
GBP?: string | undefined;
|
|
@@ -53,17 +53,17 @@ declare const transactionEntrySchema: import("yup").MixedSchema<{
|
|
|
53
53
|
AUD?: string | undefined;
|
|
54
54
|
CAD?: string | undefined;
|
|
55
55
|
interval?: DayInterval | undefined;
|
|
56
|
+
free_trial?: DayInterval | undefined;
|
|
56
57
|
}>;
|
|
58
|
+
display_name: string;
|
|
57
59
|
included_items: Record<string, {
|
|
58
|
-
repeat?: "never" | DayInterval | undefined;
|
|
59
60
|
quantity?: number | undefined;
|
|
61
|
+
repeat?: "never" | DayInterval | undefined;
|
|
60
62
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
61
63
|
}>;
|
|
62
64
|
};
|
|
63
|
-
product_id: string | null;
|
|
64
65
|
adjusted_transaction_id: string | null;
|
|
65
66
|
adjusted_entry_index: number | null;
|
|
66
|
-
customer_id: string;
|
|
67
67
|
price_id: string | null;
|
|
68
68
|
} | {
|
|
69
69
|
type: "product_revocation";
|
|
@@ -84,11 +84,12 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
84
84
|
created_at_millis: number;
|
|
85
85
|
effective_at_millis: number;
|
|
86
86
|
type: "purchase" | "subscription-cancellation" | "subscription-renewal" | "manual-item-quantity-change" | "refund" | "chargeback" | "product-change" | null;
|
|
87
|
-
customer_type: "
|
|
87
|
+
customer_type: "team" | "user" | "custom";
|
|
88
88
|
customer_id: string;
|
|
89
89
|
entries: ({
|
|
90
90
|
type: "money_transfer";
|
|
91
|
-
|
|
91
|
+
customer_id: string;
|
|
92
|
+
customer_type: "team" | "user" | "custom";
|
|
92
93
|
charged_amount: {
|
|
93
94
|
USD?: string | undefined;
|
|
94
95
|
EUR?: string | undefined;
|
|
@@ -103,32 +104,31 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
103
104
|
};
|
|
104
105
|
adjusted_transaction_id: string | null;
|
|
105
106
|
adjusted_entry_index: number | null;
|
|
106
|
-
customer_id: string;
|
|
107
107
|
} | {
|
|
108
108
|
type: "item_quantity_change";
|
|
109
|
+
item_id: string;
|
|
110
|
+
customer_id: string;
|
|
109
111
|
quantity: number;
|
|
110
|
-
customer_type: "
|
|
112
|
+
customer_type: "team" | "user" | "custom";
|
|
111
113
|
adjusted_transaction_id: string | null;
|
|
112
114
|
adjusted_entry_index: number | null;
|
|
113
|
-
customer_id: string;
|
|
114
|
-
item_id: string;
|
|
115
115
|
} | {
|
|
116
|
-
subscription_id?: string | undefined;
|
|
117
116
|
one_time_purchase_id?: string | undefined;
|
|
117
|
+
subscription_id?: string | undefined;
|
|
118
118
|
type: "product_grant";
|
|
119
|
+
customer_id: string;
|
|
120
|
+
product_id: string | null;
|
|
119
121
|
quantity: number;
|
|
120
|
-
customer_type: "
|
|
122
|
+
customer_type: "team" | "user" | "custom";
|
|
121
123
|
product: {
|
|
124
|
+
free_trial?: DayInterval | undefined;
|
|
122
125
|
client_metadata?: {} | null | undefined;
|
|
123
126
|
client_read_only_metadata?: {} | null | undefined;
|
|
124
127
|
server_metadata?: {} | null | undefined;
|
|
125
|
-
free_trial?: DayInterval | undefined;
|
|
126
|
-
display_name: string;
|
|
127
|
-
customer_type: "user" | "team" | "custom";
|
|
128
128
|
server_only: boolean;
|
|
129
|
+
customer_type: "team" | "user" | "custom";
|
|
129
130
|
stackable: boolean;
|
|
130
131
|
prices: Record<string, {
|
|
131
|
-
free_trial?: DayInterval | undefined;
|
|
132
132
|
USD?: string | undefined;
|
|
133
133
|
EUR?: string | undefined;
|
|
134
134
|
GBP?: string | undefined;
|
|
@@ -137,17 +137,17 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
137
137
|
AUD?: string | undefined;
|
|
138
138
|
CAD?: string | undefined;
|
|
139
139
|
interval?: DayInterval | undefined;
|
|
140
|
+
free_trial?: DayInterval | undefined;
|
|
140
141
|
}>;
|
|
142
|
+
display_name: string;
|
|
141
143
|
included_items: Record<string, {
|
|
142
|
-
repeat?: "never" | DayInterval | undefined;
|
|
143
144
|
quantity?: number | undefined;
|
|
145
|
+
repeat?: "never" | DayInterval | undefined;
|
|
144
146
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
145
147
|
}>;
|
|
146
148
|
};
|
|
147
|
-
product_id: string | null;
|
|
148
149
|
adjusted_transaction_id: string | null;
|
|
149
150
|
adjusted_entry_index: number | null;
|
|
150
|
-
customer_id: string;
|
|
151
151
|
price_id: string | null;
|
|
152
152
|
} | {
|
|
153
153
|
type: "product_revocation";
|
|
@@ -179,4 +179,4 @@ declare const transactionSchema: import("yup").ObjectSchema<{
|
|
|
179
179
|
type Transaction = InferType<typeof transactionSchema>;
|
|
180
180
|
//#endregion
|
|
181
181
|
export { transactionEntrySchema as a, TransactionType as i, Transaction as n, transactionSchema as o, TransactionEntry as r, TRANSACTION_TYPES as t };
|
|
182
|
-
//# sourceMappingURL=transactions-
|
|
182
|
+
//# sourceMappingURL=transactions-CHNUJ42J.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions-CHNUJ42J.d.ts","names":[],"sources":["../src/interface/crud/transactions.ts"],"mappings":";;;;cAwFa,sBAAA,gBAAsB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEC,gBAAA,GAAmB,SAAS,QAAQ,sBAAA;AAAA,cAEnC,iBAAA;AAAA,KAUD,eAAA,WAA0B,iBAAiB;AAAA,cAE1C,iBAAA,gBAAiB,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkBlB,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,WAAA,GAAc,SAAS,QAAQ,iBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as CrudTypeOf, s as CrudSchemaFromOptions } from "./crud-CqmEW9s6.js";
|
|
2
|
-
import { t as WebhookEvent } from "./webhooks-
|
|
2
|
+
import { t as WebhookEvent } from "./webhooks-8Ts1Clcb.js";
|
|
3
3
|
import * as yup$1 from "yup";
|
|
4
4
|
import { InferType } from "yup";
|
|
5
5
|
|
|
@@ -80,10 +80,10 @@ declare const usersCrudServerReadSchema: yup$1.ObjectSchema<{
|
|
|
80
80
|
client_metadata?: {} | null | undefined;
|
|
81
81
|
client_read_only_metadata?: {} | null | undefined;
|
|
82
82
|
server_metadata?: {} | null | undefined;
|
|
83
|
-
id: string;
|
|
84
83
|
display_name: string;
|
|
85
|
-
|
|
84
|
+
id: string;
|
|
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;
|
|
166
|
+
display_name: string | null | undefined;
|
|
165
167
|
client_metadata: {} | null | undefined;
|
|
166
168
|
client_read_only_metadata: {} | null | undefined;
|
|
167
169
|
server_metadata: {} | null | undefined;
|
|
168
|
-
|
|
170
|
+
is_anonymous: boolean | undefined;
|
|
171
|
+
password: string | null | undefined;
|
|
172
|
+
country_code: string | null | undefined;
|
|
173
|
+
profile_image_url: string | null | undefined;
|
|
169
174
|
primary_email_verified: boolean | undefined;
|
|
170
175
|
primary_email_auth_enabled: boolean | undefined;
|
|
171
|
-
display_name: string | null | 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;
|
|
@@ -233,10 +233,10 @@ declare const usersCrud: CrudSchemaFromOptions<{
|
|
|
233
233
|
client_metadata?: {} | null | undefined;
|
|
234
234
|
client_read_only_metadata?: {} | null | undefined;
|
|
235
235
|
server_metadata?: {} | null | undefined;
|
|
236
|
-
id: string;
|
|
237
236
|
display_name: string;
|
|
238
|
-
|
|
237
|
+
id: string;
|
|
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: CrudSchemaFromOptions<{
|
|
|
368
368
|
};
|
|
369
369
|
}, "">;
|
|
370
370
|
serverCreateSchema: yup$1.ObjectSchema<{
|
|
371
|
+
primary_email: string | null | undefined;
|
|
372
|
+
display_name: string | null | undefined;
|
|
371
373
|
client_metadata: {} | null | undefined;
|
|
372
374
|
client_read_only_metadata: {} | null | undefined;
|
|
373
375
|
server_metadata: {} | null | undefined;
|
|
374
|
-
|
|
376
|
+
is_anonymous: boolean | undefined;
|
|
377
|
+
password: string | null | undefined;
|
|
378
|
+
country_code: string | null | undefined;
|
|
379
|
+
profile_image_url: string | null | undefined;
|
|
375
380
|
primary_email_verified: boolean | undefined;
|
|
376
381
|
primary_email_auth_enabled: boolean | undefined;
|
|
377
|
-
display_name: string | null | 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;
|
|
@@ -467,10 +467,10 @@ declare const userCreatedWebhookEvent: WebhookEvent<yup$1.ObjectSchema<{
|
|
|
467
467
|
client_metadata?: {} | null | undefined;
|
|
468
468
|
client_read_only_metadata?: {} | null | undefined;
|
|
469
469
|
server_metadata?: {} | null | undefined;
|
|
470
|
-
id: string;
|
|
471
470
|
display_name: string;
|
|
472
|
-
|
|
471
|
+
id: string;
|
|
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;
|
|
@@ -558,10 +558,10 @@ declare const userUpdatedWebhookEvent: WebhookEvent<yup$1.ObjectSchema<{
|
|
|
558
558
|
client_metadata?: {} | null | undefined;
|
|
559
559
|
client_read_only_metadata?: {} | null | undefined;
|
|
560
560
|
server_metadata?: {} | null | undefined;
|
|
561
|
-
id: string;
|
|
562
561
|
display_name: string;
|
|
563
|
-
|
|
562
|
+
id: string;
|
|
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;
|
|
@@ -650,4 +650,4 @@ declare const userDeletedWebhookEvent: WebhookEvent<yup$1.ObjectSchema<{
|
|
|
650
650
|
}, "">>;
|
|
651
651
|
//#endregion
|
|
652
652
|
export { userCreatedWebhookEvent as a, usersCrud as c, usersCrudServerReadSchema as d, usersCrudServerUpdateSchema as f, signUpRiskScoresSchema as i, usersCrudServerCreateSchema as l, UsersCrud as n, userDeletedWebhookEvent as o, riskScoreFieldSchema as r, userUpdatedWebhookEvent as s, SignUpRiskScoresCrud as t, usersCrudServerDeleteSchema as u };
|
|
653
|
-
//# sourceMappingURL=users-
|
|
653
|
+
//# sourceMappingURL=users-DHNRwoSz.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users-
|
|
1
|
+
{"version":3,"file":"users-DHNRwoSz.d.ts","names":[],"sources":["../src/interface/crud/users.ts"],"mappings":";;;;;;cAea,oBAAA,EAAoB,KAAA,CAAA,YAAA,SAAA,KAAA,CAAA,SAAA;AAAA,cACpB,sBAAA,EAAsB,KAAA,CAAA,YAAA;;;;;GAKjC,KAAA,CAAA,SAAA;;;;;;KACU,oBAAA,GAAuB,SAAS,QAAQ,sBAAA;AAAA,cAqBvC,2BAAA,EAA2B,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBvC,KAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEY,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CrC,KAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEY,2BAAA,EAA2B,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM3B,KAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEA,2BAAA,EAA2B,KAAA,CAAA,WAAA,iBAAA,KAAA,CAAA,SAAA;AAAA,cAE3B,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCD,SAAA,GAAY,UAAU,QAAQ,SAAA;AAAA,cAc7B,uBAAA,EAAuB,YAAA,CAAA,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cACvB,uBAAA,EAAuB,YAAA,CAAA,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAQvB,uBAAA,EAAuB,YAAA,CAAA,KAAA,CAAA,YAAA"}
|
|
@@ -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,138 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let __errors_js = require("./errors.js");
|
|
3
|
+
//#region src/utils/tar.tsx
|
|
4
|
+
const BLOCK_SIZE = 512;
|
|
5
|
+
function writeOctal(header, offset, length, value) {
|
|
6
|
+
if (value < 0 || !Number.isSafeInteger(value)) throw new __errors_js.HexclaveAssertionError(`Invalid tar octal value: ${value}`);
|
|
7
|
+
const str = value.toString(8).padStart(length - 1, "0");
|
|
8
|
+
if (str.length > length - 1) throw new __errors_js.HexclaveAssertionError(`Tar octal value too large for field: ${value} (field length ${length})`);
|
|
9
|
+
for (let i = 0; i < str.length; i++) header[offset + i] = str.charCodeAt(i);
|
|
10
|
+
}
|
|
11
|
+
function writeString(header, offset, length, value) {
|
|
12
|
+
const bytes = new TextEncoder().encode(value);
|
|
13
|
+
if (bytes.length > length) throw new __errors_js.HexclaveAssertionError(`Tar string too long for field: ${value}`);
|
|
14
|
+
header.set(bytes, offset);
|
|
15
|
+
}
|
|
16
|
+
function splitUstarPath(path) {
|
|
17
|
+
if (new TextEncoder().encode(path).length <= 100) return {
|
|
18
|
+
prefix: "",
|
|
19
|
+
name: path
|
|
20
|
+
};
|
|
21
|
+
const parts = path.split("/");
|
|
22
|
+
for (let i = parts.length - 1; i > 0; i--) {
|
|
23
|
+
const prefix = parts.slice(0, i).join("/");
|
|
24
|
+
const name = parts.slice(i).join("/");
|
|
25
|
+
const prefixLen = new TextEncoder().encode(prefix).length;
|
|
26
|
+
const nameLen = new TextEncoder().encode(name).length;
|
|
27
|
+
if (prefixLen <= 155 && nameLen > 0 && nameLen <= 100) return {
|
|
28
|
+
prefix,
|
|
29
|
+
name
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Serializes entries into an (uncompressed) ustar tarball. Entries whose path
|
|
35
|
+
* ends with "/" are written as directories and must have empty data.
|
|
36
|
+
*/
|
|
37
|
+
function createTar(entries) {
|
|
38
|
+
const chunks = [];
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
if (entry.path.startsWith("/") || entry.path.split("/").includes("..") || entry.path === "") throw new __errors_js.HexclaveAssertionError(`Invalid tar entry path: ${JSON.stringify(entry.path)}`);
|
|
41
|
+
const isDirectory = entry.path.endsWith("/");
|
|
42
|
+
if (isDirectory && entry.data.length > 0) throw new __errors_js.HexclaveAssertionError(`Tar directory entry must have empty data: ${entry.path}`);
|
|
43
|
+
const split = splitUstarPath(entry.path) ?? throwPathTooLong(entry.path);
|
|
44
|
+
const header = new Uint8Array(BLOCK_SIZE);
|
|
45
|
+
writeString(header, 0, 100, split.name);
|
|
46
|
+
writeOctal(header, 100, 8, isDirectory ? 493 : 420);
|
|
47
|
+
writeOctal(header, 108, 8, 0);
|
|
48
|
+
writeOctal(header, 116, 8, 0);
|
|
49
|
+
writeOctal(header, 124, 12, entry.data.length);
|
|
50
|
+
writeOctal(header, 136, 12, 0);
|
|
51
|
+
header[156] = isDirectory ? 53 : 48;
|
|
52
|
+
writeString(header, 257, 6, "ustar");
|
|
53
|
+
header[263] = 48;
|
|
54
|
+
header[264] = 48;
|
|
55
|
+
writeString(header, 345, 155, split.prefix);
|
|
56
|
+
header.fill(32, 148, 156);
|
|
57
|
+
let checksum = 0;
|
|
58
|
+
for (const byte of header) checksum += byte;
|
|
59
|
+
header.fill(0, 148, 156);
|
|
60
|
+
writeOctal(header, 148, 7, checksum);
|
|
61
|
+
header[155] = 32;
|
|
62
|
+
chunks.push(header);
|
|
63
|
+
if (entry.data.length > 0) {
|
|
64
|
+
chunks.push(entry.data);
|
|
65
|
+
const padding = (BLOCK_SIZE - entry.data.length % BLOCK_SIZE) % BLOCK_SIZE;
|
|
66
|
+
if (padding > 0) chunks.push(new Uint8Array(padding));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
chunks.push(new Uint8Array(2 * BLOCK_SIZE));
|
|
70
|
+
const total = chunks.reduce((sum, c) => sum + c.length, 0);
|
|
71
|
+
const result = new Uint8Array(total);
|
|
72
|
+
let offset = 0;
|
|
73
|
+
for (const chunk of chunks) {
|
|
74
|
+
result.set(chunk, offset);
|
|
75
|
+
offset += chunk.length;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function throwPathTooLong(path) {
|
|
80
|
+
throw new __errors_js.StatusError(400, `File path too long to be packaged: ${JSON.stringify(path)}`);
|
|
81
|
+
}
|
|
82
|
+
function readString(block, offset, length) {
|
|
83
|
+
let end = offset;
|
|
84
|
+
while (end < offset + length && block[end] !== 0) end++;
|
|
85
|
+
return new TextDecoder().decode(block.subarray(offset, end));
|
|
86
|
+
}
|
|
87
|
+
function readOctal(block, offset, length) {
|
|
88
|
+
const str = readString(block, offset, length).trim();
|
|
89
|
+
if (str === "") return 0;
|
|
90
|
+
if (!/^[0-7]+$/.test(str)) throw new __errors_js.StatusError(400, "Invalid tarball: malformed octal header field");
|
|
91
|
+
return parseInt(str, 8);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Parses an (uncompressed) ustar tarball produced by `createTar` (or any tool
|
|
95
|
+
* emitting the plain ustar subset). Strict by design — see module comment.
|
|
96
|
+
* Directory entries are returned with a trailing "/" and empty data.
|
|
97
|
+
*
|
|
98
|
+
* Throws `StatusError(400, ...)` on malformed or unsafe input so backend routes
|
|
99
|
+
* can surface it directly to the uploader.
|
|
100
|
+
*/
|
|
101
|
+
function parseTar(bytes, limits) {
|
|
102
|
+
const entries = [];
|
|
103
|
+
let offset = 0;
|
|
104
|
+
let totalBytes = 0;
|
|
105
|
+
while (offset + BLOCK_SIZE <= bytes.length) {
|
|
106
|
+
const header = bytes.subarray(offset, offset + BLOCK_SIZE);
|
|
107
|
+
if (header.every((b) => b === 0)) return entries;
|
|
108
|
+
if (readString(header, 257, 6) !== "ustar") throw new __errors_js.StatusError(400, "Invalid tarball: not a ustar archive");
|
|
109
|
+
let expectedChecksum = 0;
|
|
110
|
+
for (let i = 0; i < BLOCK_SIZE; i++) expectedChecksum += i >= 148 && i < 156 ? 32 : header[i];
|
|
111
|
+
if (readOctal(header, 148, 8) !== expectedChecksum) throw new __errors_js.StatusError(400, "Invalid tarball: header checksum mismatch");
|
|
112
|
+
const typeflag = header[156];
|
|
113
|
+
if (typeflag !== 48 && typeflag !== 0 && typeflag !== 53) throw new __errors_js.StatusError(400, "Invalid tarball: only regular files and directories are supported");
|
|
114
|
+
const prefix = readString(header, 345, 155);
|
|
115
|
+
const name = readString(header, 0, 100);
|
|
116
|
+
const path = prefix === "" ? name : `${prefix}/${name}`;
|
|
117
|
+
if (path === "" || path.startsWith("/") || path.split("/").includes("..") || path.includes("\\")) throw new __errors_js.StatusError(400, `Invalid tarball: unsafe entry path ${JSON.stringify(path)}`);
|
|
118
|
+
const size = readOctal(header, 124, 12);
|
|
119
|
+
const isDirectory = typeflag === 53;
|
|
120
|
+
if (isDirectory && size !== 0) throw new __errors_js.StatusError(400, "Invalid tarball: directory entry with non-zero size");
|
|
121
|
+
offset += BLOCK_SIZE;
|
|
122
|
+
if (offset + size > bytes.length) throw new __errors_js.StatusError(400, "Invalid tarball: truncated file data");
|
|
123
|
+
totalBytes += size;
|
|
124
|
+
if (entries.length + 1 > limits.maxEntries) throw new __errors_js.StatusError(400, `Tarball contains too many files (max ${limits.maxEntries})`);
|
|
125
|
+
if (totalBytes > limits.maxTotalBytes) throw new __errors_js.StatusError(400, `Tarball contents too large (max ${limits.maxTotalBytes} bytes)`);
|
|
126
|
+
entries.push({
|
|
127
|
+
path: isDirectory && !path.endsWith("/") ? `${path}/` : path,
|
|
128
|
+
data: bytes.slice(offset, offset + size)
|
|
129
|
+
});
|
|
130
|
+
offset += size + (BLOCK_SIZE - size % BLOCK_SIZE) % BLOCK_SIZE;
|
|
131
|
+
}
|
|
132
|
+
throw new __errors_js.StatusError(400, "Invalid tarball: missing end-of-archive marker");
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
exports.createTar = createTar;
|
|
136
|
+
exports.parseTar = parseTar;
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=tar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar.js","names":["HexclaveAssertionError","StatusError"],"sources":["../../src/utils/tar.tsx"],"sourcesContent":["// A minimal, dependency-free ustar (POSIX.1-1988) tarball writer/reader.\n//\n// Why hand-rolled: the `hexclave deploy` CLI packages a source directory into a\n// tarball and the backend unpacks it to forward the files to Vercel. Both ends\n// are our own code, so we only need the ustar subset we produce ourselves\n// (regular files + directories), and hand-rolling avoids adding an npm\n// dependency to the CLI and backend. The reader is intentionally strict — it\n// rejects anything our writer wouldn't produce (symlinks, PAX extensions,\n// absolute or `..` paths) because on the backend it processes untrusted user\n// uploads.\n\nimport { HexclaveAssertionError, StatusError } from \"./errors\";\n\nconst BLOCK_SIZE = 512;\n\nexport type TarEntry = {\n // Relative POSIX path, e.g. \"src/index.ts\". Directories end with \"/\".\n path: string,\n data: Uint8Array,\n};\n\nexport type TarLimits = {\n maxEntries: number,\n maxTotalBytes: number,\n};\n\nfunction writeOctal(header: Uint8Array, offset: number, length: number, value: number): void {\n if (value < 0 || !Number.isSafeInteger(value)) {\n throw new HexclaveAssertionError(`Invalid tar octal value: ${value}`);\n }\n const str = value.toString(8).padStart(length - 1, \"0\");\n if (str.length > length - 1) {\n throw new HexclaveAssertionError(`Tar octal value too large for field: ${value} (field length ${length})`);\n }\n for (let i = 0; i < str.length; i++) {\n header[offset + i] = str.charCodeAt(i);\n }\n // NUL terminator (field is left NUL-filled past the digits).\n}\n\nfunction writeString(header: Uint8Array, offset: number, length: number, value: string): void {\n const bytes = new TextEncoder().encode(value);\n if (bytes.length > length) {\n throw new HexclaveAssertionError(`Tar string too long for field: ${value}`);\n }\n header.set(bytes, offset);\n}\n\n// Splits a path into (prefix, name) fitting ustar's 155+100 byte fields.\n// Returns undefined if the path can't be represented.\nfunction splitUstarPath(path: string): { prefix: string, name: string } | undefined {\n const bytes = new TextEncoder().encode(path);\n if (bytes.length <= 100) {\n return { prefix: \"\", name: path };\n }\n // Find a \"/\" such that everything before it fits in prefix (<=155) and\n // everything after fits in name (<=100). Prefer the longest possible prefix.\n const parts = path.split(\"/\");\n for (let i = parts.length - 1; i > 0; i--) {\n const prefix = parts.slice(0, i).join(\"/\");\n const name = parts.slice(i).join(\"/\");\n const prefixLen = new TextEncoder().encode(prefix).length;\n const nameLen = new TextEncoder().encode(name).length;\n if (prefixLen <= 155 && nameLen > 0 && nameLen <= 100) {\n return { prefix, name };\n }\n }\n return undefined;\n}\n\n/**\n * Serializes entries into an (uncompressed) ustar tarball. Entries whose path\n * ends with \"/\" are written as directories and must have empty data.\n */\nexport function createTar(entries: TarEntry[]): Uint8Array<ArrayBuffer> {\n const chunks: Uint8Array[] = [];\n for (const entry of entries) {\n if (entry.path.startsWith(\"/\") || entry.path.split(\"/\").includes(\"..\") || entry.path === \"\") {\n throw new HexclaveAssertionError(`Invalid tar entry path: ${JSON.stringify(entry.path)}`);\n }\n const isDirectory = entry.path.endsWith(\"/\");\n if (isDirectory && entry.data.length > 0) {\n throw new HexclaveAssertionError(`Tar directory entry must have empty data: ${entry.path}`);\n }\n const split = splitUstarPath(entry.path) ?? throwPathTooLong(entry.path);\n const header = new Uint8Array(BLOCK_SIZE);\n writeString(header, 0, 100, split.name);\n writeOctal(header, 100, 8, isDirectory ? 0o755 : 0o644); // mode\n writeOctal(header, 108, 8, 0); // uid\n writeOctal(header, 116, 8, 0); // gid\n writeOctal(header, 124, 12, entry.data.length); // size\n writeOctal(header, 136, 12, 0); // mtime — fixed at 0 so tarballs are deterministic for identical input\n header[156] = isDirectory ? 0x35 /* '5' */ : 0x30 /* '0' */; // typeflag\n writeString(header, 257, 6, \"ustar\");\n header[263] = 0x30; // version \"00\"\n header[264] = 0x30;\n writeString(header, 345, 155, split.prefix);\n // Checksum: sum of all header bytes with the checksum field as spaces.\n header.fill(0x20, 148, 156);\n let checksum = 0;\n for (const byte of header) checksum += byte;\n header.fill(0, 148, 156);\n writeOctal(header, 148, 7, checksum);\n header[155] = 0x20;\n chunks.push(header);\n if (entry.data.length > 0) {\n chunks.push(entry.data);\n const padding = (BLOCK_SIZE - (entry.data.length % BLOCK_SIZE)) % BLOCK_SIZE;\n if (padding > 0) chunks.push(new Uint8Array(padding));\n }\n }\n chunks.push(new Uint8Array(2 * BLOCK_SIZE)); // end-of-archive marker\n const total = chunks.reduce((sum, c) => sum + c.length, 0);\n const result = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n\nfunction throwPathTooLong(path: string): never {\n throw new StatusError(400, `File path too long to be packaged: ${JSON.stringify(path)}`);\n}\n\nfunction readString(block: Uint8Array, offset: number, length: number): string {\n let end = offset;\n while (end < offset + length && block[end] !== 0) end++;\n return new TextDecoder().decode(block.subarray(offset, end));\n}\n\nfunction readOctal(block: Uint8Array, offset: number, length: number): number {\n const str = readString(block, offset, length).trim();\n if (str === \"\") return 0;\n if (!/^[0-7]+$/.test(str)) {\n throw new StatusError(400, \"Invalid tarball: malformed octal header field\");\n }\n return parseInt(str, 8);\n}\n\n/**\n * Parses an (uncompressed) ustar tarball produced by `createTar` (or any tool\n * emitting the plain ustar subset). Strict by design — see module comment.\n * Directory entries are returned with a trailing \"/\" and empty data.\n *\n * Throws `StatusError(400, ...)` on malformed or unsafe input so backend routes\n * can surface it directly to the uploader.\n */\nexport function parseTar(bytes: Uint8Array, limits: TarLimits): TarEntry[] {\n const entries: TarEntry[] = [];\n let offset = 0;\n let totalBytes = 0;\n while (offset + BLOCK_SIZE <= bytes.length) {\n const header = bytes.subarray(offset, offset + BLOCK_SIZE);\n if (header.every((b) => b === 0)) {\n // End-of-archive marker (we accept a single zero block too).\n return entries;\n }\n const magic = readString(header, 257, 6);\n if (magic !== \"ustar\") {\n throw new StatusError(400, \"Invalid tarball: not a ustar archive\");\n }\n let expectedChecksum = 0;\n for (let i = 0; i < BLOCK_SIZE; i++) {\n expectedChecksum += (i >= 148 && i < 156) ? 0x20 : header[i];\n }\n if (readOctal(header, 148, 8) !== expectedChecksum) {\n throw new StatusError(400, \"Invalid tarball: header checksum mismatch\");\n }\n const typeflag = header[156];\n if (typeflag !== 0x30 && typeflag !== 0 && typeflag !== 0x35) {\n throw new StatusError(400, \"Invalid tarball: only regular files and directories are supported\");\n }\n const prefix = readString(header, 345, 155);\n const name = readString(header, 0, 100);\n const path = prefix === \"\" ? name : `${prefix}/${name}`;\n if (path === \"\" || path.startsWith(\"/\") || path.split(\"/\").includes(\"..\") || path.includes(\"\\\\\")) {\n throw new StatusError(400, `Invalid tarball: unsafe entry path ${JSON.stringify(path)}`);\n }\n const size = readOctal(header, 124, 12);\n const isDirectory = typeflag === 0x35;\n if (isDirectory && size !== 0) {\n throw new StatusError(400, \"Invalid tarball: directory entry with non-zero size\");\n }\n offset += BLOCK_SIZE;\n if (offset + size > bytes.length) {\n throw new StatusError(400, \"Invalid tarball: truncated file data\");\n }\n totalBytes += size;\n if (entries.length + 1 > limits.maxEntries) {\n throw new StatusError(400, `Tarball contains too many files (max ${limits.maxEntries})`);\n }\n if (totalBytes > limits.maxTotalBytes) {\n throw new StatusError(400, `Tarball contents too large (max ${limits.maxTotalBytes} bytes)`);\n }\n entries.push({\n path: isDirectory && !path.endsWith(\"/\") ? `${path}/` : path,\n data: bytes.slice(offset, offset + size),\n });\n offset += size + ((BLOCK_SIZE - (size % BLOCK_SIZE)) % BLOCK_SIZE);\n }\n throw new StatusError(400, \"Invalid tarball: missing end-of-archive marker\");\n}\n\nconst TEST_LIMITS: TarLimits = { maxEntries: 1000, maxTotalBytes: 10 * 1024 * 1024 };\n\nimport.meta.vitest?.test(\"createTar/parseTar roundtrip\", ({ expect }) => {\n const entries: TarEntry[] = [\n { path: \"package.json\", data: new TextEncoder().encode(`{\"name\":\"x\"}`) },\n { path: \"src/\", data: new Uint8Array(0) },\n { path: \"src/index.ts\", data: new TextEncoder().encode(\"export const a = 1;\\n\") },\n { path: \"empty.txt\", data: new Uint8Array(0) },\n { path: \"binary.bin\", data: new Uint8Array([0, 1, 2, 255, 254, 253]) },\n ];\n const tar = createTar(entries);\n expect(tar.length % 512).toBe(0);\n const parsed = parseTar(tar, TEST_LIMITS);\n expect(parsed.map((e) => e.path)).toEqual(entries.map((e) => e.path));\n for (let i = 0; i < entries.length; i++) {\n expect([...parsed[i].data]).toEqual([...entries[i].data]);\n }\n});\n\nimport.meta.vitest?.test(\"createTar/parseTar long paths use the ustar prefix field\", ({ expect }) => {\n const longDir = Array.from({ length: 12 }, (_, i) => `directory-number-${i}`).join(\"/\");\n const path = `${longDir}/file.txt`;\n expect(path.length).toBeGreaterThan(100);\n const tar = createTar([{ path, data: new TextEncoder().encode(\"hello\") }]);\n const parsed = parseTar(tar, TEST_LIMITS);\n expect(parsed).toHaveLength(1);\n expect(parsed[0].path).toBe(path);\n expect(new TextDecoder().decode(parsed[0].data)).toBe(\"hello\");\n});\n\nimport.meta.vitest?.test(\"createTar rejects unsafe paths\", ({ expect }) => {\n expect(() => createTar([{ path: \"/etc/passwd\", data: new Uint8Array(0) }])).toThrow();\n expect(() => createTar([{ path: \"../escape\", data: new Uint8Array(0) }])).toThrow();\n expect(() => createTar([{ path: \"a/../b\", data: new Uint8Array(0) }])).toThrow();\n expect(() => createTar([{ path: \"\", data: new Uint8Array(0) }])).toThrow();\n});\n\nimport.meta.vitest?.test(\"parseTar rejects malformed and unsafe archives\", ({ expect }) => {\n expect(() => parseTar(new Uint8Array(1024), TEST_LIMITS)).not.toThrow(); // all-zero = empty archive\n expect(() => parseTar(new TextEncoder().encode(\"too short to contain a single header block\"), TEST_LIMITS)).toThrow(\"missing end-of-archive marker\");\n const garbageBlock = new Uint8Array(512).fill(0x41 /* 'A' */);\n expect(() => parseTar(garbageBlock, TEST_LIMITS)).toThrow(\"not a ustar archive\");\n\n // Corrupt a valid archive's checksum.\n const tar = createTar([{ path: \"a.txt\", data: new TextEncoder().encode(\"hi\") }]);\n const corrupted = tar.slice();\n corrupted[0] ^= 0xff;\n expect(() => parseTar(corrupted, TEST_LIMITS)).toThrow(\"checksum mismatch\");\n\n // Truncated data section.\n expect(() => parseTar(tar.subarray(0, 512), TEST_LIMITS)).toThrow(\"truncated\");\n\n // Limits.\n expect(() => parseTar(tar, { maxEntries: 0, maxTotalBytes: 1000 })).toThrow(\"too many files\");\n expect(() => parseTar(tar, { maxEntries: 10, maxTotalBytes: 1 })).toThrow(\"too large\");\n});\n"],"mappings":";;;AAaA,MAAM,aAAa;AAanB,SAAS,WAAW,QAAoB,QAAgB,QAAgB,OAAqB;CAC3F,IAAI,QAAQ,KAAK,CAA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7E"}
|
|
@@ -20,10 +20,10 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
20
20
|
client_metadata?: {} | null | undefined;
|
|
21
21
|
client_read_only_metadata?: {} | null | undefined;
|
|
22
22
|
server_metadata?: {} | null | undefined;
|
|
23
|
-
id: string;
|
|
24
23
|
display_name: string;
|
|
25
|
-
|
|
24
|
+
id: string;
|
|
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;
|
|
@@ -110,10 +110,10 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
110
110
|
client_metadata?: {} | null | undefined;
|
|
111
111
|
client_read_only_metadata?: {} | null | undefined;
|
|
112
112
|
server_metadata?: {} | null | undefined;
|
|
113
|
-
id: string;
|
|
114
113
|
display_name: string;
|
|
115
|
-
|
|
114
|
+
id: string;
|
|
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;
|
|
@@ -323,4 +323,4 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
323
323
|
}];
|
|
324
324
|
//#endregion
|
|
325
325
|
export { webhookEvents as n, WebhookEvent as t };
|
|
326
|
-
//# sourceMappingURL=webhooks-
|
|
326
|
+
//# sourceMappingURL=webhooks-8Ts1Clcb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks-
|
|
1
|
+
{"version":3,"file":"webhooks-8Ts1Clcb.d.ts","names":[],"sources":["../src/interface/webhooks.ts"],"mappings":";;;KAMY,YAAA,WAAuB,KAAA,CAAI,MAAA;EACrC,IAAA;EACA,MAAA,EAAQ,CAAC;EACT,QAAA;IACE,OAAA;IACA,WAAA;IACA,IAAA;EAAA;AAAA;AAAA,cAIS,aAAA,YAAa,YAAA,CAAA,KAAA,CAAA,YAAA"}
|