@secondlayer/shared 6.5.0 → 6.7.0
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/README.md +9 -12
- package/dist/src/db/index.js.map +2 -2
- package/dist/src/db/queries/chain-reorgs.js.map +2 -2
- package/dist/src/index.d.ts +29 -42
- package/dist/src/index.js +94 -103
- package/dist/src/index.js.map +4 -5
- package/dist/src/schemas/index.d.ts +29 -42
- package/dist/src/schemas/index.js +94 -103
- package/dist/src/schemas/index.js.map +3 -4
- package/package.json +1 -29
- package/dist/src/db/queries/account-spend-caps.d.ts +0 -729
- package/dist/src/db/queries/account-spend-caps.js +0 -59
- package/dist/src/db/queries/account-spend-caps.js.map +0 -10
- package/dist/src/db/queries/account-usage.d.ts +0 -741
- package/dist/src/db/queries/account-usage.js +0 -266
- package/dist/src/db/queries/account-usage.js.map +0 -11
- package/dist/src/db/queries/accounts.d.ts +0 -741
- package/dist/src/db/queries/accounts.js +0 -86
- package/dist/src/db/queries/accounts.js.map +0 -10
- package/dist/src/db/queries/projects.d.ts +0 -722
- package/dist/src/db/queries/projects.js +0 -47
- package/dist/src/db/queries/projects.js.map +0 -10
- package/dist/src/db/queries/usage.d.ts +0 -731
- package/dist/src/db/queries/usage.js +0 -109
- package/dist/src/db/queries/usage.js.map +0 -10
- package/dist/src/pricing.d.ts +0 -60
- package/dist/src/pricing.js +0 -164
- package/dist/src/pricing.js.map +0 -10
- package/dist/src/schemas/accounts.d.ts +0 -14
- package/dist/src/schemas/accounts.js +0 -29
- package/dist/src/schemas/accounts.js.map +0 -10
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/db/queries/usage.ts
|
|
18
|
-
import { sql } from "kysely";
|
|
19
|
-
async function incrementApiRequests(db, accountId) {
|
|
20
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
21
|
-
await sql`
|
|
22
|
-
INSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries)
|
|
23
|
-
VALUES (${accountId}, NULL, ${today}, 1, 0)
|
|
24
|
-
ON CONFLICT (account_id, date) WHERE tenant_id IS NULL
|
|
25
|
-
DO UPDATE SET api_requests = usage_daily.api_requests + 1
|
|
26
|
-
`.execute(db);
|
|
27
|
-
}
|
|
28
|
-
async function incrementAccountDailyCounter(db, accountId, column, quantity) {
|
|
29
|
-
if (quantity <= 0)
|
|
30
|
-
return;
|
|
31
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
32
|
-
await sql`
|
|
33
|
-
INSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries, ${sql.raw(column)})
|
|
34
|
-
VALUES (${accountId}, NULL, ${today}, 0, 0, ${quantity})
|
|
35
|
-
ON CONFLICT (account_id, date) WHERE tenant_id IS NULL
|
|
36
|
-
DO UPDATE SET ${sql.raw(column)} = usage_daily.${sql.raw(column)} + ${quantity}
|
|
37
|
-
`.execute(db);
|
|
38
|
-
}
|
|
39
|
-
async function incrementStreamsEventsReturned(db, accountId, quantity) {
|
|
40
|
-
await incrementAccountDailyCounter(db, accountId, "streams_events_returned", quantity);
|
|
41
|
-
}
|
|
42
|
-
async function incrementIndexDecodedEventsReturned(db, accountId, quantity) {
|
|
43
|
-
await incrementAccountDailyCounter(db, accountId, "index_decoded_events_returned", quantity);
|
|
44
|
-
}
|
|
45
|
-
async function getUsage(db, accountId) {
|
|
46
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
47
|
-
const monthStart = `${today.slice(0, 7)}-01`;
|
|
48
|
-
const dailyRow = await db.selectFrom("usage_daily").select("api_requests").where("account_id", "=", accountId).where("date", "=", today).executeTakeFirst();
|
|
49
|
-
const monthlyRow = await db.selectFrom("usage_daily").select(sql`COALESCE(SUM(deliveries), 0)`.as("total")).where("account_id", "=", accountId).where("date", ">=", monthStart).executeTakeFirst();
|
|
50
|
-
const storageRow = await db.selectFrom("usage_snapshots").select("storage_bytes").where("account_id", "=", accountId).orderBy("measured_at", "desc").limit(1).executeTakeFirst();
|
|
51
|
-
return {
|
|
52
|
-
apiRequestsToday: dailyRow?.api_requests ?? 0,
|
|
53
|
-
deliveriesThisMonth: Number(monthlyRow?.total ?? 0),
|
|
54
|
-
storageBytes: Number(storageRow?.storage_bytes ?? 0)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
async function getProductUsage(db, accountId) {
|
|
58
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
59
|
-
const monthStart = `${today.slice(0, 7)}-01`;
|
|
60
|
-
const dailyRow = await db.selectFrom("usage_daily").select(["streams_events_returned", "index_decoded_events_returned"]).where("account_id", "=", accountId).where("date", "=", today).executeTakeFirst();
|
|
61
|
-
const monthlyRow = await db.selectFrom("usage_daily").select([
|
|
62
|
-
sql`COALESCE(SUM(streams_events_returned), 0)`.as("streams_total"),
|
|
63
|
-
sql`COALESCE(SUM(index_decoded_events_returned), 0)`.as("index_total")
|
|
64
|
-
]).where("account_id", "=", accountId).where("date", ">=", monthStart).executeTakeFirst();
|
|
65
|
-
return {
|
|
66
|
-
streamsEventsToday: Number(dailyRow?.streams_events_returned ?? 0),
|
|
67
|
-
streamsEventsThisMonth: Number(monthlyRow?.streams_total ?? 0),
|
|
68
|
-
indexDecodedEventsToday: Number(dailyRow?.index_decoded_events_returned ?? 0),
|
|
69
|
-
indexDecodedEventsThisMonth: Number(monthlyRow?.index_total ?? 0)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
async function measureStorage(db) {
|
|
73
|
-
const accountSubgraphs = await db.selectFrom("subgraphs").select(["account_id", "schema_name"]).where("schema_name", "is not", null).execute();
|
|
74
|
-
const byAccount = new Map;
|
|
75
|
-
for (const row of accountSubgraphs) {
|
|
76
|
-
const schemas = byAccount.get(row.account_id) ?? [];
|
|
77
|
-
if (row.schema_name)
|
|
78
|
-
schemas.push(row.schema_name);
|
|
79
|
-
byAccount.set(row.account_id, schemas);
|
|
80
|
-
}
|
|
81
|
-
for (const [accountId, schemas] of byAccount) {
|
|
82
|
-
let totalBytes = 0;
|
|
83
|
-
for (const schema of schemas) {
|
|
84
|
-
try {
|
|
85
|
-
const result = await sql`
|
|
86
|
-
SELECT COALESCE(SUM(pg_total_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename))), 0)::text as size
|
|
87
|
-
FROM pg_tables WHERE schemaname = ${schema}
|
|
88
|
-
`.execute(db);
|
|
89
|
-
const row = result.rows[0];
|
|
90
|
-
totalBytes += Number(row?.size ?? 0);
|
|
91
|
-
} catch {}
|
|
92
|
-
}
|
|
93
|
-
await db.insertInto("usage_snapshots").values({
|
|
94
|
-
account_id: accountId,
|
|
95
|
-
storage_bytes: totalBytes
|
|
96
|
-
}).execute();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export {
|
|
100
|
-
measureStorage,
|
|
101
|
-
incrementStreamsEventsReturned,
|
|
102
|
-
incrementIndexDecodedEventsReturned,
|
|
103
|
-
incrementApiRequests,
|
|
104
|
-
getUsage,
|
|
105
|
-
getProductUsage
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
//# debugId=4876492CE8C84D6164756E2164756E21
|
|
109
|
-
//# sourceMappingURL=usage.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/db/queries/usage.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { type Kysely, sql } from \"kysely\";\nimport type { Database } from \"../types.ts\";\n\n/** Increment API request counter for today. Fire-and-forget safe. */\nexport async function incrementApiRequests(\n\tdb: Kysely<Database>,\n\taccountId: string,\n): Promise<void> {\n\tconst today = new Date().toISOString().slice(0, 10);\n\tawait sql`\n\t\tINSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries)\n\t\tVALUES (${accountId}, NULL, ${today}, 1, 0)\n\t\tON CONFLICT (account_id, date) WHERE tenant_id IS NULL\n\t\tDO UPDATE SET api_requests = usage_daily.api_requests + 1\n\t`.execute(db);\n}\n\nasync function incrementAccountDailyCounter(\n\tdb: Kysely<Database>,\n\taccountId: string,\n\tcolumn: \"streams_events_returned\" | \"index_decoded_events_returned\",\n\tquantity: number,\n): Promise<void> {\n\tif (quantity <= 0) return;\n\tconst today = new Date().toISOString().slice(0, 10);\n\tawait sql`\n\t\tINSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries, ${sql.raw(column)})\n\t\tVALUES (${accountId}, NULL, ${today}, 0, 0, ${quantity})\n\t\tON CONFLICT (account_id, date) WHERE tenant_id IS NULL\n\t\tDO UPDATE SET ${sql.raw(column)} = usage_daily.${sql.raw(column)} + ${quantity}\n\t`.execute(db);\n}\n\nexport async function incrementStreamsEventsReturned(\n\tdb: Kysely<Database>,\n\taccountId: string,\n\tquantity: number,\n): Promise<void> {\n\tawait incrementAccountDailyCounter(\n\t\tdb,\n\t\taccountId,\n\t\t\"streams_events_returned\",\n\t\tquantity,\n\t);\n}\n\nexport async function incrementIndexDecodedEventsReturned(\n\tdb: Kysely<Database>,\n\taccountId: string,\n\tquantity: number,\n): Promise<void> {\n\tawait incrementAccountDailyCounter(\n\t\tdb,\n\t\taccountId,\n\t\t\"index_decoded_events_returned\",\n\t\tquantity,\n\t);\n}\n\nexport interface UsageSummary {\n\tapiRequestsToday: number;\n\tdeliveriesThisMonth: number;\n\tstorageBytes: number;\n}\n\n/** Get current usage for an account. */\nexport async function getUsage(\n\tdb: Kysely<Database>,\n\taccountId: string,\n): Promise<UsageSummary> {\n\tconst today = new Date().toISOString().slice(0, 10);\n\tconst monthStart = `${today.slice(0, 7)}-01`; // YYYY-MM-01\n\n\t// Today's API requests\n\tconst dailyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select(\"api_requests\")\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \"=\", today)\n\t\t.executeTakeFirst();\n\n\t// This month's deliveries\n\tconst monthlyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select(sql<number>`COALESCE(SUM(deliveries), 0)`.as(\"total\"))\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \">=\", monthStart)\n\t\t.executeTakeFirst();\n\n\t// Latest storage snapshot\n\tconst storageRow = await db\n\t\t.selectFrom(\"usage_snapshots\")\n\t\t.select(\"storage_bytes\")\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.orderBy(\"measured_at\", \"desc\")\n\t\t.limit(1)\n\t\t.executeTakeFirst();\n\n\treturn {\n\t\tapiRequestsToday: dailyRow?.api_requests ?? 0,\n\t\tdeliveriesThisMonth: Number(monthlyRow?.total ?? 0),\n\t\tstorageBytes: Number(storageRow?.storage_bytes ?? 0),\n\t};\n}\n\nexport interface ProductUsageBreakdown {\n\tstreamsEventsToday: number;\n\tstreamsEventsThisMonth: number;\n\tindexDecodedEventsToday: number;\n\tindexDecodedEventsThisMonth: number;\n}\n\n/** Get per-product event counts (today + this month) for an account. */\nexport async function getProductUsage(\n\tdb: Kysely<Database>,\n\taccountId: string,\n): Promise<ProductUsageBreakdown> {\n\tconst today = new Date().toISOString().slice(0, 10);\n\tconst monthStart = `${today.slice(0, 7)}-01`;\n\n\tconst dailyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select([\"streams_events_returned\", \"index_decoded_events_returned\"])\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \"=\", today)\n\t\t.executeTakeFirst();\n\n\tconst monthlyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select([\n\t\t\tsql<number>`COALESCE(SUM(streams_events_returned), 0)`.as(\n\t\t\t\t\"streams_total\",\n\t\t\t),\n\t\t\tsql<number>`COALESCE(SUM(index_decoded_events_returned), 0)`.as(\n\t\t\t\t\"index_total\",\n\t\t\t),\n\t\t])\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \">=\", monthStart)\n\t\t.executeTakeFirst();\n\n\treturn {\n\t\tstreamsEventsToday: Number(dailyRow?.streams_events_returned ?? 0),\n\t\tstreamsEventsThisMonth: Number(monthlyRow?.streams_total ?? 0),\n\t\tindexDecodedEventsToday: Number(\n\t\t\tdailyRow?.index_decoded_events_returned ?? 0,\n\t\t),\n\t\tindexDecodedEventsThisMonth: Number(monthlyRow?.index_total ?? 0),\n\t};\n}\n\n/**\n * Measure storage for all accounts by querying pg_total_relation_size\n * for each tenant's subgraph schemas.\n */\nexport async function measureStorage(db: Kysely<Database>): Promise<void> {\n\t// Get all accounts with subgraphs\n\tconst accountSubgraphs = await db\n\t\t.selectFrom(\"subgraphs\")\n\t\t.select([\"account_id\", \"schema_name\"])\n\t\t.where(\"schema_name\", \"is not\", null)\n\t\t.execute();\n\n\t// Group schemas by account\n\tconst byAccount = new Map<string, string[]>();\n\tfor (const row of accountSubgraphs) {\n\t\tconst schemas = byAccount.get(row.account_id) ?? [];\n\t\tif (row.schema_name) schemas.push(row.schema_name);\n\t\tbyAccount.set(row.account_id, schemas);\n\t}\n\n\tfor (const [accountId, schemas] of byAccount) {\n\t\tlet totalBytes = 0;\n\t\tfor (const schema of schemas) {\n\t\t\ttry {\n\t\t\t\tconst result = await sql<{ size: string }>`\n SELECT COALESCE(SUM(pg_total_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename))), 0)::text as size\n FROM pg_tables WHERE schemaname = ${schema}\n `.execute(db);\n\t\t\t\tconst row = result.rows[0] as { size?: string } | undefined;\n\t\t\t\ttotalBytes += Number(row?.size ?? 0);\n\t\t\t} catch {\n\t\t\t\t// Schema may not exist\n\t\t\t}\n\t\t}\n\n\t\tawait db\n\t\t\t.insertInto(\"usage_snapshots\")\n\t\t\t.values({\n\t\t\t\taccount_id: accountId,\n\t\t\t\tstorage_bytes: totalBytes,\n\t\t\t})\n\t\t\t.execute();\n\t}\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "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",
|
|
8
|
-
"debugId": "4876492CE8C84D6164756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/src/pricing.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Single source of truth for plan tiers — capacity, price, display copy,
|
|
3
|
-
* Stripe binding, and container allocations.
|
|
4
|
-
*
|
|
5
|
-
* Consumed by:
|
|
6
|
-
* - Provisioner (`packages/provisioner/src/plans.ts` re-exports)
|
|
7
|
-
* - API (`/api/accounts/usage` for allowance math + display)
|
|
8
|
-
* - Web app (`/billing` page renders plan cards from this)
|
|
9
|
-
*
|
|
10
|
-
* Adding a tier? Add an entry to PLANS. Removing one? Drop here, run
|
|
11
|
-
* the Stripe-side cleanup (archive lookup_key), and update env vars.
|
|
12
|
-
*/
|
|
13
|
-
declare const BYTES_PER_GB: number;
|
|
14
|
-
type AccountPlanId = "none" | PlanId;
|
|
15
|
-
type PlanId = "launch" | "scale" | "enterprise";
|
|
16
|
-
interface ContainerAlloc {
|
|
17
|
-
memoryMb: number;
|
|
18
|
-
cpus: number;
|
|
19
|
-
}
|
|
20
|
-
interface Plan {
|
|
21
|
-
id: PlanId;
|
|
22
|
-
displayName: string;
|
|
23
|
-
/** Monthly subscription price in cents. null = custom (Enterprise). */
|
|
24
|
-
monthlyPriceCents: number | null;
|
|
25
|
-
/** Annual subscription price in cents. null = no self-serve annual price. */
|
|
26
|
-
annualPriceCents: number | null;
|
|
27
|
-
totalCpus: number;
|
|
28
|
-
totalMemoryMb: number;
|
|
29
|
-
/** Hard cap. -1 = unlimited (Enterprise). Storage overage bills past this. */
|
|
30
|
-
storageLimitMb: number;
|
|
31
|
-
containers: {
|
|
32
|
-
postgres: ContainerAlloc
|
|
33
|
-
api: ContainerAlloc
|
|
34
|
-
processor: ContainerAlloc
|
|
35
|
-
};
|
|
36
|
-
/** Display-only. Marketing/short pitch. */
|
|
37
|
-
tagline: string;
|
|
38
|
-
/** Display-only. Bullet list on the plan card. */
|
|
39
|
-
features: string[];
|
|
40
|
-
/** Stripe `lookup_key` for monthly recurring tier price. null for enterprise. */
|
|
41
|
-
stripeLookupKey: string | null;
|
|
42
|
-
/** Stripe `lookup_key` for annual recurring tier price. null for enterprise. */
|
|
43
|
-
stripeAnnualLookupKey: string | null;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Split a compute envelope across (postgres, processor, api) containers.
|
|
47
|
-
* Auto-biases PG-heavy (60/25/15) for sub-1GB totals.
|
|
48
|
-
*/
|
|
49
|
-
declare function allocForTotals(totalMemoryMb: number, totalCpus: number): Plan["containers"];
|
|
50
|
-
declare const PLANS: Record<PlanId, Plan>;
|
|
51
|
-
declare const PLAN_IDS: readonly PlanId[];
|
|
52
|
-
declare function getPlan(id: string): Plan;
|
|
53
|
-
declare function isValidPlanId(id: string): id is PlanId;
|
|
54
|
-
declare function getComputeAllowanceHours(_plan: string): number;
|
|
55
|
-
declare function getStorageAllowanceBytes(plan: string): number;
|
|
56
|
-
/** Paid tiers bill $2/GB over allowance. Accounts with no plan do not accrue overage. */
|
|
57
|
-
declare function hasStorageOverage(plan: string): boolean;
|
|
58
|
-
declare function getBasePriceCents(plan: string): number;
|
|
59
|
-
declare function getPlanDisplayName(plan: string): string;
|
|
60
|
-
export { isValidPlanId, hasStorageOverage, getStorageAllowanceBytes, getPlanDisplayName, getPlan, getComputeAllowanceHours, getBasePriceCents, allocForTotals, PlanId, Plan, PLAN_IDS, PLANS, ContainerAlloc, BYTES_PER_GB, AccountPlanId };
|
package/dist/src/pricing.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/pricing.ts
|
|
18
|
-
var BYTES_PER_GB = 1024 ** 3;
|
|
19
|
-
function alloc(totalMb, totalCpus) {
|
|
20
|
-
return {
|
|
21
|
-
postgres: {
|
|
22
|
-
memoryMb: Math.floor(totalMb * 0.25),
|
|
23
|
-
cpus: round2(totalCpus * 0.25)
|
|
24
|
-
},
|
|
25
|
-
processor: {
|
|
26
|
-
memoryMb: Math.floor(totalMb * 0.55),
|
|
27
|
-
cpus: round2(totalCpus * 0.55)
|
|
28
|
-
},
|
|
29
|
-
api: {
|
|
30
|
-
memoryMb: Math.floor(totalMb * 0.2),
|
|
31
|
-
cpus: round2(totalCpus * 0.2)
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function allocTight(totalMb, totalCpus) {
|
|
36
|
-
return {
|
|
37
|
-
postgres: {
|
|
38
|
-
memoryMb: Math.floor(totalMb * 0.6),
|
|
39
|
-
cpus: round2(totalCpus * 0.6)
|
|
40
|
-
},
|
|
41
|
-
processor: {
|
|
42
|
-
memoryMb: Math.floor(totalMb * 0.25),
|
|
43
|
-
cpus: round2(totalCpus * 0.25)
|
|
44
|
-
},
|
|
45
|
-
api: {
|
|
46
|
-
memoryMb: Math.floor(totalMb * 0.15),
|
|
47
|
-
cpus: round2(totalCpus * 0.15)
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function round2(n) {
|
|
52
|
-
return Math.round(n * 100) / 100;
|
|
53
|
-
}
|
|
54
|
-
function allocForTotals(totalMemoryMb, totalCpus) {
|
|
55
|
-
return totalMemoryMb < 1024 ? allocTight(totalMemoryMb, totalCpus) : alloc(totalMemoryMb, totalCpus);
|
|
56
|
-
}
|
|
57
|
-
var PLANS = {
|
|
58
|
-
launch: {
|
|
59
|
-
id: "launch",
|
|
60
|
-
displayName: "Launch",
|
|
61
|
-
monthlyPriceCents: 9900,
|
|
62
|
-
annualPriceCents: 99000,
|
|
63
|
-
totalCpus: 2,
|
|
64
|
-
totalMemoryMb: 6144,
|
|
65
|
-
storageLimitMb: 102400,
|
|
66
|
-
containers: alloc(6144, 2),
|
|
67
|
-
tagline: "Real product",
|
|
68
|
-
features: [
|
|
69
|
-
"2 vCPU · 6 GB RAM",
|
|
70
|
-
"100 GB storage · always-on",
|
|
71
|
-
"3-5 contracts",
|
|
72
|
-
"Production reindex windows",
|
|
73
|
-
"Spend caps + alerts",
|
|
74
|
-
"Email support"
|
|
75
|
-
],
|
|
76
|
-
stripeLookupKey: "secondlayer_launch_monthly",
|
|
77
|
-
stripeAnnualLookupKey: "secondlayer_launch_yearly"
|
|
78
|
-
},
|
|
79
|
-
scale: {
|
|
80
|
-
id: "scale",
|
|
81
|
-
displayName: "Scale",
|
|
82
|
-
monthlyPriceCents: 29900,
|
|
83
|
-
annualPriceCents: 299000,
|
|
84
|
-
totalCpus: 8,
|
|
85
|
-
totalMemoryMb: 24576,
|
|
86
|
-
storageLimitMb: 512000,
|
|
87
|
-
containers: alloc(24576, 8),
|
|
88
|
-
tagline: "Full indexing",
|
|
89
|
-
features: [
|
|
90
|
-
"8 vCPU · 24 GB RAM",
|
|
91
|
-
"500 GB storage · always-on",
|
|
92
|
-
"Heavy history + replay",
|
|
93
|
-
"24h SLA · priority support"
|
|
94
|
-
],
|
|
95
|
-
stripeLookupKey: "secondlayer_scale_monthly",
|
|
96
|
-
stripeAnnualLookupKey: "secondlayer_scale_yearly"
|
|
97
|
-
},
|
|
98
|
-
enterprise: {
|
|
99
|
-
id: "enterprise",
|
|
100
|
-
displayName: "Enterprise",
|
|
101
|
-
monthlyPriceCents: null,
|
|
102
|
-
annualPriceCents: null,
|
|
103
|
-
totalCpus: 16,
|
|
104
|
-
totalMemoryMb: 65536,
|
|
105
|
-
storageLimitMb: -1,
|
|
106
|
-
containers: alloc(65536, 16),
|
|
107
|
-
tagline: "Whatever needed",
|
|
108
|
-
features: [
|
|
109
|
-
"Custom compute + storage",
|
|
110
|
-
"SLAs · regions · SSO",
|
|
111
|
-
"Dedicated success engineer"
|
|
112
|
-
],
|
|
113
|
-
stripeLookupKey: null,
|
|
114
|
-
stripeAnnualLookupKey: null
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
var PLAN_IDS = ["launch", "scale", "enterprise"];
|
|
118
|
-
function getPlan(id) {
|
|
119
|
-
const plan = PLANS[id];
|
|
120
|
-
if (!plan)
|
|
121
|
-
throw new Error(`Unknown plan: ${id}`);
|
|
122
|
-
return plan;
|
|
123
|
-
}
|
|
124
|
-
function isValidPlanId(id) {
|
|
125
|
-
return id in PLANS;
|
|
126
|
-
}
|
|
127
|
-
function getComputeAllowanceHours(_plan) {
|
|
128
|
-
return Number.POSITIVE_INFINITY;
|
|
129
|
-
}
|
|
130
|
-
function getStorageAllowanceBytes(plan) {
|
|
131
|
-
const planDef = PLANS[plan];
|
|
132
|
-
if (!planDef)
|
|
133
|
-
return 0;
|
|
134
|
-
if (planDef.storageLimitMb < 0)
|
|
135
|
-
return Number.POSITIVE_INFINITY;
|
|
136
|
-
return planDef.storageLimitMb * 1024 * 1024;
|
|
137
|
-
}
|
|
138
|
-
function hasStorageOverage(plan) {
|
|
139
|
-
return plan !== "none" && plan !== "enterprise";
|
|
140
|
-
}
|
|
141
|
-
function getBasePriceCents(plan) {
|
|
142
|
-
const planDef = PLANS[plan];
|
|
143
|
-
return planDef?.monthlyPriceCents ?? 0;
|
|
144
|
-
}
|
|
145
|
-
function getPlanDisplayName(plan) {
|
|
146
|
-
const planDef = PLANS[plan];
|
|
147
|
-
return planDef?.displayName ?? plan.charAt(0).toUpperCase() + plan.slice(1);
|
|
148
|
-
}
|
|
149
|
-
export {
|
|
150
|
-
isValidPlanId,
|
|
151
|
-
hasStorageOverage,
|
|
152
|
-
getStorageAllowanceBytes,
|
|
153
|
-
getPlanDisplayName,
|
|
154
|
-
getPlan,
|
|
155
|
-
getComputeAllowanceHours,
|
|
156
|
-
getBasePriceCents,
|
|
157
|
-
allocForTotals,
|
|
158
|
-
PLAN_IDS,
|
|
159
|
-
PLANS,
|
|
160
|
-
BYTES_PER_GB
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
//# debugId=E8AD34879BFF76E564756E2164756E21
|
|
164
|
-
//# sourceMappingURL=pricing.js.map
|
package/dist/src/pricing.js.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/pricing.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Single source of truth for plan tiers — capacity, price, display copy,\n * Stripe binding, and container allocations.\n *\n * Consumed by:\n * - Provisioner (`packages/provisioner/src/plans.ts` re-exports)\n * - API (`/api/accounts/usage` for allowance math + display)\n * - Web app (`/billing` page renders plan cards from this)\n *\n * Adding a tier? Add an entry to PLANS. Removing one? Drop here, run\n * the Stripe-side cleanup (archive lookup_key), and update env vars.\n */\n\nconst BYTES_PER_GB: number = 1024 ** 3;\n\nexport type AccountPlanId = \"none\" | PlanId;\nexport type PlanId = \"launch\" | \"scale\" | \"enterprise\";\n\nexport interface ContainerAlloc {\n\tmemoryMb: number;\n\tcpus: number;\n}\n\nexport interface Plan {\n\tid: PlanId;\n\tdisplayName: string;\n\t/** Monthly subscription price in cents. null = custom (Enterprise). */\n\tmonthlyPriceCents: number | null;\n\t/** Annual subscription price in cents. null = no self-serve annual price. */\n\tannualPriceCents: number | null;\n\ttotalCpus: number;\n\ttotalMemoryMb: number;\n\t/** Hard cap. -1 = unlimited (Enterprise). Storage overage bills past this. */\n\tstorageLimitMb: number;\n\tcontainers: {\n\t\tpostgres: ContainerAlloc;\n\t\tapi: ContainerAlloc;\n\t\tprocessor: ContainerAlloc;\n\t};\n\t/** Display-only. Marketing/short pitch. */\n\ttagline: string;\n\t/** Display-only. Bullet list on the plan card. */\n\tfeatures: string[];\n\t/** Stripe `lookup_key` for monthly recurring tier price. null for enterprise. */\n\tstripeLookupKey: string | null;\n\t/** Stripe `lookup_key` for annual recurring tier price. null for enterprise. */\n\tstripeAnnualLookupKey: string | null;\n}\n\n// ── Allocation helpers ──────────────────────────────────────────────\n//\n// Allocation within a plan (3 containers per tenant):\n// Default split (paid tiers) — PG 25% / proc 55% / api 20%\n// Sub-1GB total — PG 60% / proc 25% / api 15%\n//\n// Why proc-heavy: the subgraph processor is CPU-bound during backfill\n// (event decode + handler exec + DB writes), while PG idles at <1% CPU\n// observed during steady-state indexing on Launch tier. The 2026-05-13\n// rebalance shifts CPU from idle PG to active proc to recover backfill\n// throughput regressed by the move from shared infra to per-tenant\n// containers — Launch went from 5 blocks/min → ~100 blocks/min just by\n// raising the proc's `--cpus` allotment.\n//\n// Docker memory limit is a hard cap (OOM kill on overage). CPU is a soft\n// cap via `--cpus` (throttling, not killing). Storage is monitored\n// separately and billed as overage — PG crashes if we hard-cap it.\n\nfunction alloc(totalMb: number, totalCpus: number): Plan[\"containers\"] {\n\treturn {\n\t\tpostgres: {\n\t\t\tmemoryMb: Math.floor(totalMb * 0.25),\n\t\t\tcpus: round2(totalCpus * 0.25),\n\t\t},\n\t\tprocessor: {\n\t\t\tmemoryMb: Math.floor(totalMb * 0.55),\n\t\t\tcpus: round2(totalCpus * 0.55),\n\t\t},\n\t\tapi: {\n\t\t\tmemoryMb: Math.floor(totalMb * 0.2),\n\t\t\tcpus: round2(totalCpus * 0.2),\n\t\t},\n\t};\n}\n\nfunction allocTight(totalMb: number, totalCpus: number): Plan[\"containers\"] {\n\treturn {\n\t\tpostgres: {\n\t\t\tmemoryMb: Math.floor(totalMb * 0.6),\n\t\t\tcpus: round2(totalCpus * 0.6),\n\t\t},\n\t\tprocessor: {\n\t\t\tmemoryMb: Math.floor(totalMb * 0.25),\n\t\t\tcpus: round2(totalCpus * 0.25),\n\t\t},\n\t\tapi: {\n\t\t\tmemoryMb: Math.floor(totalMb * 0.15),\n\t\t\tcpus: round2(totalCpus * 0.15),\n\t\t},\n\t};\n}\n\nfunction round2(n: number): number {\n\treturn Math.round(n * 100) / 100;\n}\n\n/**\n * Split a compute envelope across (postgres, processor, api) containers.\n * Auto-biases PG-heavy (60/25/15) for sub-1GB totals.\n */\nexport function allocForTotals(\n\ttotalMemoryMb: number,\n\ttotalCpus: number,\n): Plan[\"containers\"] {\n\treturn totalMemoryMb < 1024\n\t\t? allocTight(totalMemoryMb, totalCpus)\n\t\t: alloc(totalMemoryMb, totalCpus);\n}\n\n// ── Canonical plan data ─────────────────────────────────────────────\n\nexport const PLANS: Record<PlanId, Plan> = {\n\tlaunch: {\n\t\tid: \"launch\",\n\t\tdisplayName: \"Launch\",\n\t\tmonthlyPriceCents: 9_900, // $99\n\t\tannualPriceCents: 99_000, // 2 months free\n\t\ttotalCpus: 2,\n\t\ttotalMemoryMb: 6_144,\n\t\tstorageLimitMb: 102_400, // 100 GB\n\t\tcontainers: alloc(6_144, 2),\n\t\ttagline: \"Real product\",\n\t\tfeatures: [\n\t\t\t\"2 vCPU · 6 GB RAM\",\n\t\t\t\"100 GB storage · always-on\",\n\t\t\t\"3-5 contracts\",\n\t\t\t\"Production reindex windows\",\n\t\t\t\"Spend caps + alerts\",\n\t\t\t\"Email support\",\n\t\t],\n\t\tstripeLookupKey: \"secondlayer_launch_monthly\",\n\t\tstripeAnnualLookupKey: \"secondlayer_launch_yearly\",\n\t},\n\tscale: {\n\t\tid: \"scale\",\n\t\tdisplayName: \"Scale\",\n\t\tmonthlyPriceCents: 29_900, // $299\n\t\tannualPriceCents: 299_000, // 2 months free\n\t\ttotalCpus: 8,\n\t\ttotalMemoryMb: 24_576,\n\t\tstorageLimitMb: 512_000, // 500 GB\n\t\tcontainers: alloc(24_576, 8),\n\t\ttagline: \"Full indexing\",\n\t\tfeatures: [\n\t\t\t\"8 vCPU · 24 GB RAM\",\n\t\t\t\"500 GB storage · always-on\",\n\t\t\t\"Heavy history + replay\",\n\t\t\t\"24h SLA · priority support\",\n\t\t],\n\t\tstripeLookupKey: \"secondlayer_scale_monthly\",\n\t\tstripeAnnualLookupKey: \"secondlayer_scale_yearly\",\n\t},\n\tenterprise: {\n\t\tid: \"enterprise\",\n\t\tdisplayName: \"Enterprise\",\n\t\tmonthlyPriceCents: null,\n\t\tannualPriceCents: null,\n\t\ttotalCpus: 16,\n\t\ttotalMemoryMb: 65_536,\n\t\tstorageLimitMb: -1,\n\t\tcontainers: alloc(65_536, 16),\n\t\ttagline: \"Whatever needed\",\n\t\tfeatures: [\n\t\t\t\"Custom compute + storage\",\n\t\t\t\"SLAs · regions · SSO\",\n\t\t\t\"Dedicated success engineer\",\n\t\t],\n\t\tstripeLookupKey: null,\n\t\tstripeAnnualLookupKey: null,\n\t},\n};\n\nexport const PLAN_IDS: readonly PlanId[] = [\"launch\", \"scale\", \"enterprise\"];\n\nexport function getPlan(id: string): Plan {\n\tconst plan = (PLANS as Record<string, Plan | undefined>)[id];\n\tif (!plan) throw new Error(`Unknown plan: ${id}`);\n\treturn plan;\n}\n\nexport function isValidPlanId(id: string): id is PlanId {\n\treturn id in PLANS;\n}\n\n// ── Allowance helpers (used by /api/accounts/usage display) ─────────\n//\n// Compute is hard-capped by Docker `--cpus`, so there's no compute\n// overage billing. The function below returns ∞ for paid plans (display-\n// only — no metering).\n//\n// Storage IS metered and billed past the plan's allowance via the\n// `storage_gb_months` Stripe meter at $2/GB-mo.\n\nexport function getComputeAllowanceHours(_plan: string): number {\n\t// Compute overage was killed when we removed the `compute_hours` meter.\n\t// All plans are now hard-capped by Docker `--cpus`. ∞ here means \"no\n\t// overage tracked\" for display purposes.\n\treturn Number.POSITIVE_INFINITY;\n}\n\nexport function getStorageAllowanceBytes(plan: string): number {\n\tconst planDef = (PLANS as Record<string, Plan | undefined>)[plan];\n\tif (!planDef) return 0;\n\tif (planDef.storageLimitMb < 0) return Number.POSITIVE_INFINITY;\n\treturn planDef.storageLimitMb * 1024 * 1024;\n}\n\n/** Paid tiers bill $2/GB over allowance. Accounts with no plan do not accrue overage. */\nexport function hasStorageOverage(plan: string): boolean {\n\treturn plan !== \"none\" && plan !== \"enterprise\";\n}\n\nexport function getBasePriceCents(plan: string): number {\n\tconst planDef = (PLANS as Record<string, Plan | undefined>)[plan];\n\treturn planDef?.monthlyPriceCents ?? 0;\n}\n\nexport function getPlanDisplayName(plan: string): string {\n\tconst planDef = (PLANS as Record<string, Plan | undefined>)[plan];\n\treturn planDef?.displayName ?? plan.charAt(0).toUpperCase() + plan.slice(1);\n}\n\n// Re-export bytes-per-GB constant for callers that compute display values.\nexport { BYTES_PER_GB };\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAaA,IAAM,eAAuB,QAAQ;AAsDrC,SAAS,KAAK,CAAC,SAAiB,WAAuC;AAAA,EACtE,OAAO;AAAA,IACN,UAAU;AAAA,MACT,UAAU,KAAK,MAAM,UAAU,IAAI;AAAA,MACnC,MAAM,OAAO,YAAY,IAAI;AAAA,IAC9B;AAAA,IACA,WAAW;AAAA,MACV,UAAU,KAAK,MAAM,UAAU,IAAI;AAAA,MACnC,MAAM,OAAO,YAAY,IAAI;AAAA,IAC9B;AAAA,IACA,KAAK;AAAA,MACJ,UAAU,KAAK,MAAM,UAAU,GAAG;AAAA,MAClC,MAAM,OAAO,YAAY,GAAG;AAAA,IAC7B;AAAA,EACD;AAAA;AAGD,SAAS,UAAU,CAAC,SAAiB,WAAuC;AAAA,EAC3E,OAAO;AAAA,IACN,UAAU;AAAA,MACT,UAAU,KAAK,MAAM,UAAU,GAAG;AAAA,MAClC,MAAM,OAAO,YAAY,GAAG;AAAA,IAC7B;AAAA,IACA,WAAW;AAAA,MACV,UAAU,KAAK,MAAM,UAAU,IAAI;AAAA,MACnC,MAAM,OAAO,YAAY,IAAI;AAAA,IAC9B;AAAA,IACA,KAAK;AAAA,MACJ,UAAU,KAAK,MAAM,UAAU,IAAI;AAAA,MACnC,MAAM,OAAO,YAAY,IAAI;AAAA,IAC9B;AAAA,EACD;AAAA;AAGD,SAAS,MAAM,CAAC,GAAmB;AAAA,EAClC,OAAO,KAAK,MAAM,IAAI,GAAG,IAAI;AAAA;AAOvB,SAAS,cAAc,CAC7B,eACA,WACqB;AAAA,EACrB,OAAO,gBAAgB,OACpB,WAAW,eAAe,SAAS,IACnC,MAAM,eAAe,SAAS;AAAA;AAK3B,IAAM,QAA8B;AAAA,EAC1C,QAAQ;AAAA,IACP,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY,MAAM,MAAO,CAAC;AAAA,IAC1B,SAAS;AAAA,IACT,UAAU;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,IACjB,uBAAuB;AAAA,EACxB;AAAA,EACA,OAAO;AAAA,IACN,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY,MAAM,OAAQ,CAAC;AAAA,IAC3B,SAAS;AAAA,IACT,UAAU;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,IACjB,uBAAuB;AAAA,EACxB;AAAA,EACA,YAAY;AAAA,IACX,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY,MAAM,OAAQ,EAAE;AAAA,IAC5B,SAAS;AAAA,IACT,UAAU;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,IACjB,uBAAuB;AAAA,EACxB;AACD;AAEO,IAAM,WAA8B,CAAC,UAAU,SAAS,YAAY;AAEpE,SAAS,OAAO,CAAC,IAAkB;AAAA,EACzC,MAAM,OAAQ,MAA2C;AAAA,EACzD,IAAI,CAAC;AAAA,IAAM,MAAM,IAAI,MAAM,iBAAiB,IAAI;AAAA,EAChD,OAAO;AAAA;AAGD,SAAS,aAAa,CAAC,IAA0B;AAAA,EACvD,OAAO,MAAM;AAAA;AAYP,SAAS,wBAAwB,CAAC,OAAuB;AAAA,EAI/D,OAAO,OAAO;AAAA;AAGR,SAAS,wBAAwB,CAAC,MAAsB;AAAA,EAC9D,MAAM,UAAW,MAA2C;AAAA,EAC5D,IAAI,CAAC;AAAA,IAAS,OAAO;AAAA,EACrB,IAAI,QAAQ,iBAAiB;AAAA,IAAG,OAAO,OAAO;AAAA,EAC9C,OAAO,QAAQ,iBAAiB,OAAO;AAAA;AAIjC,SAAS,iBAAiB,CAAC,MAAuB;AAAA,EACxD,OAAO,SAAS,UAAU,SAAS;AAAA;AAG7B,SAAS,iBAAiB,CAAC,MAAsB;AAAA,EACvD,MAAM,UAAW,MAA2C;AAAA,EAC5D,OAAO,SAAS,qBAAqB;AAAA;AAG/B,SAAS,kBAAkB,CAAC,MAAsB;AAAA,EACxD,MAAM,UAAW,MAA2C;AAAA,EAC5D,OAAO,SAAS,eAAe,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC;AAAA;",
|
|
8
|
-
"debugId": "E8AD34879BFF76E564756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
/**
|
|
3
|
-
* Account profile shapes. Unrelated to marketplace — previously lived in
|
|
4
|
-
* schemas/marketplace.ts alongside public-directory types. Kept here now
|
|
5
|
-
* that marketplace is gone so the profile fields (display_name, bio, slug)
|
|
6
|
-
* have a stable home.
|
|
7
|
-
*/
|
|
8
|
-
interface UpdateProfileRequest {
|
|
9
|
-
display_name?: string;
|
|
10
|
-
bio?: string;
|
|
11
|
-
slug?: string;
|
|
12
|
-
}
|
|
13
|
-
declare const UpdateProfileRequestSchema: z.ZodType<UpdateProfileRequest>;
|
|
14
|
-
export { UpdateProfileRequestSchema, UpdateProfileRequest };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/schemas/accounts.ts
|
|
18
|
-
import { z } from "zod/v4";
|
|
19
|
-
var UpdateProfileRequestSchema = z.object({
|
|
20
|
-
display_name: z.string().max(50).optional(),
|
|
21
|
-
bio: z.string().max(300).optional(),
|
|
22
|
-
slug: z.string().regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").min(3).max(30).optional()
|
|
23
|
-
});
|
|
24
|
-
export {
|
|
25
|
-
UpdateProfileRequestSchema
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//# debugId=F54EDBF58C290BFF64756E2164756E21
|
|
29
|
-
//# sourceMappingURL=accounts.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/schemas/accounts.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod/v4\";\n\n/**\n * Account profile shapes. Unrelated to marketplace — previously lived in\n * schemas/marketplace.ts alongside public-directory types. Kept here now\n * that marketplace is gone so the profile fields (display_name, bio, slug)\n * have a stable home.\n */\n\nexport interface UpdateProfileRequest {\n\tdisplay_name?: string;\n\tbio?: string;\n\tslug?: string;\n}\n\nexport const UpdateProfileRequestSchema: z.ZodType<UpdateProfileRequest> =\n\tz.object({\n\t\tdisplay_name: z.string().max(50).optional(),\n\t\tbio: z.string().max(300).optional(),\n\t\tslug: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.min(3)\n\t\t\t.max(30)\n\t\t\t.optional(),\n\t});\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAeO,IAAM,6BACZ,EAAE,OAAO;AAAA,EACR,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAC1C,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAClC,MAAM,EACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,CAAC,EACL,IAAI,EAAE,EACN,SAAS;AACZ,CAAC;",
|
|
8
|
-
"debugId": "F54EDBF58C290BFF64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|