tapimo 0.2.0 → 0.3.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 +31 -3
- package/dist/ApiKey.d.ts +1 -0
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +5 -2
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +28 -1
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +34 -1
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +7167 -4507
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +8 -0
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +11 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +14 -3
- package/dist/Scope.js.map +1 -1
- package/dist/admin/App.d.ts +128 -118
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +7 -0
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/scopes.d.ts +8 -0
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/scopes.js +3 -0
- package/dist/admin/apps/scopes.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +57 -57
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +13 -13
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +151 -0
- package/dist/analytics/Analytics.d.ts.map +1 -0
- package/dist/analytics/Analytics.js +212 -0
- package/dist/analytics/Analytics.js.map +1 -0
- package/dist/analytics/tables/requestEvents.d.ts +215 -0
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -0
- package/dist/analytics/tables/requestEvents.js +264 -0
- package/dist/analytics/tables/requestEvents.js.map +1 -0
- package/dist/apps/data/App.d.ts +1024 -624
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +36 -0
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/balances.d.ts +45 -45
- package/dist/apps/data/routes/coingecko.d.ts +176 -176
- package/dist/apps/data/routes/exchanges.d.ts +455 -455
- package/dist/apps/data/routes/fee-amm.d.ts +101 -101
- package/dist/apps/data/routes/funding.d.ts +765 -0
- package/dist/apps/data/routes/funding.d.ts.map +1 -0
- package/dist/apps/data/routes/funding.js +383 -0
- package/dist/apps/data/routes/funding.js.map +1 -0
- package/dist/apps/data/routes/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +2 -8
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/rpc.d.ts +29 -36
- package/dist/apps/data/routes/rpc.d.ts.map +1 -1
- package/dist/apps/data/routes/rpc.js +29 -1
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +36 -36
- package/dist/apps/data/routes/transfers.d.ts +56 -56
- package/dist/apps/data/routes/verified-tokens.d.ts +36 -36
- package/dist/apps/data/routes/webhooks.d.ts +45 -45
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +8 -8
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/docs/App.d.ts +4 -2
- package/dist/apps/docs/App.d.ts.map +1 -1
- package/dist/apps/docs/App.js +27 -95
- package/dist/apps/docs/App.js.map +1 -1
- package/dist/apps/docs/reference.d.ts +21 -0
- package/dist/apps/docs/reference.d.ts.map +1 -0
- package/dist/apps/docs/reference.js +112 -0
- package/dist/apps/docs/reference.js.map +1 -0
- package/dist/apps/index.d.ts +1 -0
- package/dist/apps/index.d.ts.map +1 -1
- package/dist/apps/index.js +1 -0
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/mcp.d.ts +76 -0
- package/dist/apps/mcp.d.ts.map +1 -0
- package/dist/apps/mcp.js +188 -0
- package/dist/apps/mcp.js.map +1 -0
- package/dist/apps/platform/App.d.ts +3005 -728
- package/dist/apps/platform/App.d.ts.map +1 -1
- package/dist/apps/platform/App.js +13 -3
- package/dist/apps/platform/App.js.map +1 -1
- package/dist/apps/platform/Billing.d.ts +279 -0
- package/dist/apps/platform/Billing.d.ts.map +1 -0
- package/dist/apps/platform/Billing.js +477 -0
- package/dist/apps/platform/Billing.js.map +1 -0
- package/dist/apps/platform/index.d.ts +1 -0
- package/dist/apps/platform/index.d.ts.map +1 -1
- package/dist/apps/platform/index.js +1 -0
- package/dist/apps/platform/index.js.map +1 -1
- package/dist/apps/platform/routes/api-keys.d.ts +341 -49
- package/dist/apps/platform/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/platform/routes/api-keys.js +115 -13
- package/dist/apps/platform/routes/api-keys.js.map +1 -1
- package/dist/apps/platform/routes/billing.d.ts +1520 -0
- package/dist/apps/platform/routes/billing.d.ts.map +1 -0
- package/dist/apps/platform/routes/billing.js +795 -0
- package/dist/apps/platform/routes/billing.js.map +1 -0
- package/dist/apps/platform/routes/invitations.d.ts +201 -83
- package/dist/apps/platform/routes/invitations.d.ts.map +1 -1
- package/dist/apps/platform/routes/invitations.js +58 -0
- package/dist/apps/platform/routes/invitations.js.map +1 -1
- package/dist/apps/platform/routes/me.d.ts +17 -17
- package/dist/apps/platform/routes/orgs.d.ts +50 -36
- package/dist/apps/platform/routes/orgs.d.ts.map +1 -1
- package/dist/apps/platform/routes/orgs.js +14 -3
- package/dist/apps/platform/routes/orgs.js.map +1 -1
- package/dist/apps/platform/routes/projects.d.ts +97 -97
- package/dist/apps/platform/routes/scopes.d.ts +107 -0
- package/dist/apps/platform/routes/scopes.d.ts.map +1 -0
- package/dist/apps/platform/routes/scopes.js +66 -0
- package/dist/apps/platform/routes/scopes.js.map +1 -0
- package/dist/apps/platform/routes/usage.d.ts +588 -0
- package/dist/apps/platform/routes/usage.d.ts.map +1 -0
- package/dist/apps/platform/routes/usage.js +391 -0
- package/dist/apps/platform/routes/usage.js.map +1 -0
- package/dist/apps/relay/App.d.ts +4 -1
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +118 -10
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +2 -1
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/cli/Cli.d.ts +8 -1
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/Cli.js +11 -3
- package/dist/cli/Cli.js.map +1 -1
- package/dist/cli/commands/admin.d.ts +4 -0
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +80 -1
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/db/Db.d.ts +7 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +126 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +79 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +88 -2
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/billingSettings.d.ts +55 -0
- package/dist/db/tables/billingSettings.d.ts.map +1 -0
- package/dist/db/tables/billingSettings.js +70 -0
- package/dist/db/tables/billingSettings.js.map +1 -0
- package/dist/db/tables/invitations.js +2 -2
- package/dist/db/tables/invitations.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +6 -2
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +10 -4
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.js +2 -2
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts +121 -0
- package/dist/db/tables/requestUsage.d.ts.map +1 -0
- package/dist/db/tables/requestUsage.js +150 -0
- package/dist/db/tables/requestUsage.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +119 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +155 -2
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/stripeCustomers.d.ts +81 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -0
- package/dist/db/tables/stripeCustomers.js +120 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -0
- package/dist/db/tables/users.js +2 -2
- package/dist/db/tables/users.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +5 -2
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +19 -5
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/internal/utils.d.ts +10 -3
- package/dist/handlers/internal/utils.d.ts.map +1 -1
- package/dist/handlers/internal/utils.js +14 -6
- package/dist/handlers/internal/utils.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/Auth.d.ts +18 -4
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +148 -76
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +4 -1
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EdgeCache.d.ts +10 -0
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +39 -8
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/Fees.d.ts +27 -0
- package/dist/internal/Fees.d.ts.map +1 -0
- package/dist/internal/Fees.js +48 -0
- package/dist/internal/Fees.js.map +1 -0
- package/dist/internal/FundingRoutes.d.ts +183 -0
- package/dist/internal/FundingRoutes.d.ts.map +1 -0
- package/dist/internal/FundingRoutes.js +490 -0
- package/dist/internal/FundingRoutes.js.map +1 -0
- package/dist/internal/Id.d.ts +15 -0
- package/dist/internal/Id.d.ts.map +1 -0
- package/dist/internal/Id.js +22 -0
- package/dist/internal/Id.js.map +1 -0
- package/dist/internal/Log.d.ts +2 -0
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +3 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +10 -1
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +8 -1
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/RateLimit.d.ts +25 -0
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +51 -0
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Response.d.ts +1 -1
- package/dist/internal/Response.d.ts.map +1 -1
- package/dist/internal/Schema.d.ts +8 -0
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +7 -0
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +3 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/package.json +4 -3
- package/src/ApiKey.ts +9 -2
- package/src/ApiKeys.test.ts +51 -0
- package/src/ApiKeys.ts +50 -1
- package/src/App.test.ts +33 -86718
- package/src/App.ts +18 -0
- package/src/Client.test-d.ts +351 -0
- package/src/Scope.ts +16 -3
- package/src/admin/apps/scopes.test.ts +6 -0
- package/src/admin/apps/scopes.ts +3 -0
- package/src/admin/ui/src/components/Page.tsx +2 -3
- package/src/admin/ui/src/routes/__root.tsx +2 -2
- package/src/admin/ui/src/routes/api-keys.tsx +2 -2
- package/src/admin/ui.generated.ts +13 -13
- package/src/analytics/Analytics.test.ts +527 -0
- package/src/analytics/Analytics.ts +318 -0
- package/src/analytics/tables/requestEvents.ts +523 -0
- package/src/apps/data/App.test.ts +72 -0
- package/src/apps/data/App.ts +35 -0
- package/src/apps/data/routes/funding.test.ts +214 -0
- package/src/apps/data/routes/funding.ts +584 -0
- package/src/apps/data/routes/receipts.ts +2 -9
- package/src/apps/data/routes/rpc.test.ts +78 -2
- package/src/apps/data/routes/rpc.ts +31 -1
- package/src/apps/data/routes/webhooks.test.ts +1 -1
- package/src/apps/data/routes/webhooks.ts +11 -8
- package/src/apps/docs/App.ts +29 -100
- package/src/apps/docs/reference.ts +132 -0
- package/src/apps/index.ts +1 -0
- package/src/apps/mcp.test.ts +206 -0
- package/src/apps/mcp.ts +250 -0
- package/src/apps/platform/App.ts +43 -4
- package/src/apps/platform/Billing.test.ts +530 -0
- package/src/apps/platform/Billing.ts +682 -0
- package/src/apps/platform/index.ts +1 -0
- package/src/apps/platform/routes/api-keys.test.ts +172 -9
- package/src/apps/platform/routes/api-keys.ts +136 -20
- package/src/apps/platform/routes/billing.test.ts +1100 -0
- package/src/apps/platform/routes/billing.ts +966 -0
- package/src/apps/platform/routes/invitations.test.ts +55 -7
- package/src/apps/platform/routes/invitations.ts +68 -0
- package/src/apps/platform/routes/me.test.ts +230 -0
- package/src/apps/platform/routes/orgs.ts +26 -4
- package/src/apps/platform/routes/scopes.test.ts +29 -0
- package/src/apps/platform/routes/scopes.ts +85 -0
- package/src/apps/platform/routes/usage.test.ts +422 -0
- package/src/apps/platform/routes/usage.ts +527 -0
- package/src/apps/relay/App.test.ts +457 -8
- package/src/apps/relay/App.ts +120 -12
- package/src/apps/relay/Sponsorships.test.ts +1 -1
- package/src/apps/relay/Sponsorships.ts +2 -1
- package/src/cli/Cli.test.ts +25 -2
- package/src/cli/Cli.ts +17 -2
- package/src/cli/commands/admin.test.ts +83 -0
- package/src/cli/commands/admin.ts +89 -1
- package/src/db/Db.ts +137 -0
- package/src/db/Schema.ts +104 -2
- package/src/db/tables/billingSettings.test.ts +87 -0
- package/src/db/tables/billingSettings.ts +108 -0
- package/src/db/tables/invitations.ts +2 -2
- package/src/db/tables/organizations.test.ts +1 -1
- package/src/db/tables/organizations.ts +15 -5
- package/src/db/tables/projects.ts +2 -2
- package/src/db/tables/requestUsage.ts +231 -0
- package/src/db/tables/sponsoredTransactions.test.ts +108 -1
- package/src/db/tables/sponsoredTransactions.ts +230 -2
- package/src/db/tables/stripeCustomers.test.ts +109 -0
- package/src/db/tables/stripeCustomers.ts +162 -0
- package/src/db/tables/users.ts +2 -2
- package/src/handlers/internal/sponsorship.ts +34 -7
- package/src/handlers/internal/utils.ts +19 -7
- package/src/index.ts +1 -0
- package/src/internal/Auth.test.ts +175 -25
- package/src/internal/Auth.ts +175 -86
- package/src/internal/Cache.ts +5 -1
- package/src/internal/EdgeCache.test.ts +27 -4
- package/src/internal/EdgeCache.ts +47 -9
- package/src/internal/Fees.test.ts +32 -0
- package/src/internal/Fees.ts +51 -0
- package/src/internal/FundingRoutes.ts +583 -0
- package/src/internal/Id.test.ts +17 -0
- package/src/internal/Id.ts +24 -0
- package/src/internal/Log.test.ts +1 -0
- package/src/internal/Log.ts +5 -0
- package/src/internal/OpenApi.ts +12 -1
- package/src/internal/RateLimit.test.ts +84 -0
- package/src/internal/RateLimit.ts +70 -0
- package/src/internal/Response.ts +1 -1
- package/src/internal/Schema.ts +8 -0
- package/src/internal/Webhooks.test.ts +3 -3
- package/src/internal/Webhooks.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.generated.js","sourceRoot":"","sources":["../../src/admin/ui.generated.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,uEAAuE;AACvE,oBAAoB;AASpB,2EAA2E;AAC3E,MAAM,CAAC,MAAM,KAAK,GAChB,6hDAA6hD,CAAA;AAE/hD,gGAAgG;AAChG,MAAM,CAAC,MAAM,MAAM,GAA0B;IAC3C,6BAA6B,EAAE;QAC7B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"ui.generated.js","sourceRoot":"","sources":["../../src/admin/ui.generated.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,uEAAuE;AACvE,oBAAoB;AASpB,2EAA2E;AAC3E,MAAM,CAAC,MAAM,KAAK,GAChB,6hDAA6hD,CAAA;AAE/hD,gGAAgG;AAChG,MAAM,CAAC,MAAM,MAAM,GAA0B;IAC3C,6BAA6B,EAAE;QAC7B,OAAO,EACL,6ksBAA6ksB;QAC/ksB,WAAW,EAAE,gCAAgC;KAC9C;IACD,yBAAyB,EAAE;QACzB,OAAO,EACL,i/IAAi/I;QACn/I,WAAW,EAAE,gCAAgC;KAC9C;IACD,2BAA2B,EAAE;QAC3B,OAAO,EACL,g1wIAAg1wI;QACl1wI,WAAW,EAAE,gCAAgC;KAC9C;IACD,0BAA0B,EAAE;QAC1B,OAAO,EACL,wyqtBAAwyqtB;QAC1yqtB,WAAW,EAAE,gCAAgC;KAC9C;IACD,kCAAkC,EAAE;QAClC,OAAO,EACL,kgvDAAkgvD;QACpgvD,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,QAAQ;KACnB;IACD,qCAAqC,EAAE;QACrC,OAAO,EACL,0yuDAA0yuD;QAC5yuD,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,QAAQ;KACnB;IACD,4BAA4B,EAAE;QAC5B,OAAO,EACL,26pDAA26pD;QAC76pD,WAAW,EAAE,yBAAyB;KACvC;IACD,oCAAoC,EAAE;QACpC,OAAO,EACL,wh0BAAwh0B;QAC1h0B,WAAW,EAAE,gCAAgC;KAC9C;CACF,CAAA"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as RequestEvents from './tables/requestEvents.js';
|
|
2
|
+
export { createQueueSink } from './tables/requestEvents.js';
|
|
3
|
+
/** One org's deduped billable request count for a UTC hour; the reporter's source row. */
|
|
4
|
+
export type BillableCount = RequestEvents.BillableCount;
|
|
5
|
+
/** Options for {@link readBillableRequestCounts}. */
|
|
6
|
+
export type BillableCountsOptions = RequestEvents.BillableCountsOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Reads deduped billable request counts grouped by `(org, UTC hour)` from
|
|
9
|
+
* `request_events` — the request-metered billing source. Resolves the source
|
|
10
|
+
* at the leaf so a Workers factory builds a fresh connection.
|
|
11
|
+
*
|
|
12
|
+
* @param source - The analytics store or factory.
|
|
13
|
+
* @param options - The read options.
|
|
14
|
+
* @returns One deduped count per `(org, hour)`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readBillableRequestCounts(source: Source, options: BillableCountsOptions): Promise<BillableCount[]>;
|
|
17
|
+
/**
|
|
18
|
+
* ClickHouse schema; table repository modules (`tables/*`) type their rows
|
|
19
|
+
* through it.
|
|
20
|
+
*/
|
|
21
|
+
export type Database = {
|
|
22
|
+
request_events: RequestEvents.Table;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A ClickHouse-backed analytics store: row inserts, JSON reads, and schema
|
|
26
|
+
* migrations. Table repository modules (`tables/*`) query through it.
|
|
27
|
+
*/
|
|
28
|
+
export type Analytics = {
|
|
29
|
+
/** Inserts rows into a table. */
|
|
30
|
+
insert<name extends keyof Database>(table: name, rows: readonly Database[name][]): Promise<void>;
|
|
31
|
+
/** Applies any pending schema migrations; safe to re-run. */
|
|
32
|
+
migrate(): Promise<void>;
|
|
33
|
+
/** Runs a read query, returning JSON rows. */
|
|
34
|
+
query<row>(sql: string): Promise<row[]>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* An {@link Analytics}, or a factory for per-request construction. Resolve at
|
|
38
|
+
* the leaf with {@link get}.
|
|
39
|
+
*/
|
|
40
|
+
export type Source = Analytics | (() => Analytics);
|
|
41
|
+
/** One stored request row (`request_events`); hosts use it in their queue-body union. */
|
|
42
|
+
export type Event = RequestEvents.Table;
|
|
43
|
+
/** Queue name {@link handleQueue} consumes; the host's queue producer/consumer bindings must reference it. */
|
|
44
|
+
export declare const queueName = "api-request-analytics";
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a {@link Source} to an {@link Analytics}. Call at the request leaf
|
|
47
|
+
* so factories create per-request instances; singletons resolve to themselves.
|
|
48
|
+
*
|
|
49
|
+
* @param source - The analytics store or factory.
|
|
50
|
+
* @returns The resolved {@link Analytics}.
|
|
51
|
+
*/
|
|
52
|
+
export declare function get(source: Source): Analytics;
|
|
53
|
+
/** One schema migration: a single idempotent DDL statement, safe to re-apply. */
|
|
54
|
+
type Migration = {
|
|
55
|
+
/** Unique, ordered migration name (e.g. `0001_request_events`). */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Idempotent DDL applied by {@link Analytics.migrate}. */
|
|
58
|
+
sql: string;
|
|
59
|
+
/**
|
|
60
|
+
* Optional `SELECT` run before {@link Migration.sql}; a nonzero first value
|
|
61
|
+
* skips the migration. Lets a scoped user without an `ALTER` grant (preview)
|
|
62
|
+
* skip an `ALTER` whose columns already exist from the baseline `CREATE`.
|
|
63
|
+
*/
|
|
64
|
+
guard?: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Ordered migrations for {@link Analytics.migrate}. ClickHouse lacks
|
|
68
|
+
* transactional DDL and advisory locks, so each statement is idempotent
|
|
69
|
+
* (`IF NOT EXISTS`) and re-applied on every run; no applied-migrations ledger.
|
|
70
|
+
*/
|
|
71
|
+
export declare const migrations: readonly Migration[];
|
|
72
|
+
/**
|
|
73
|
+
* Creates a ClickHouse-backed {@link Analytics} over the HTTP interface.
|
|
74
|
+
* Requests scope to `database` (the `?database=` parameter); table names are
|
|
75
|
+
* code-owned by the `tables/*` modules, not configuration.
|
|
76
|
+
*
|
|
77
|
+
* @param options - ClickHouse connection options.
|
|
78
|
+
* @returns The analytics store.
|
|
79
|
+
*/
|
|
80
|
+
export declare function clickhouse(options: clickhouse.Options): Analytics;
|
|
81
|
+
export declare namespace clickhouse {
|
|
82
|
+
/** ClickHouse connection options. */
|
|
83
|
+
type Options = {
|
|
84
|
+
/** Database the connection scopes to (e.g. `tempo_api`). */
|
|
85
|
+
database: string;
|
|
86
|
+
/** Password for `user`. */
|
|
87
|
+
password: string;
|
|
88
|
+
/** ClickHouse HTTPS endpoint. */
|
|
89
|
+
url: string;
|
|
90
|
+
/** ClickHouse user; ingest and read deployments differ only here. */
|
|
91
|
+
user: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Consumes one queue batch when it is the analytics queue ({@link queueName}):
|
|
96
|
+
* batch-inserts the queued rows, acking on success and retrying on failure.
|
|
97
|
+
* Returns whether the batch was handled, so a multi-queue worker can chain:
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* async queue(batch) {
|
|
101
|
+
* if (await Analytics.handleQueue(analytics, batch)) return
|
|
102
|
+
* // … other queues …
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @param source - The analytics store or factory.
|
|
107
|
+
* @param batch - The queue batch.
|
|
108
|
+
* @param options - Options.
|
|
109
|
+
* @returns Whether the batch belonged to the analytics queue.
|
|
110
|
+
*/
|
|
111
|
+
export declare function handleQueue(source: Source, batch: handleQueue.Batch, options?: handleQueue.Options): Promise<boolean>;
|
|
112
|
+
export declare namespace handleQueue {
|
|
113
|
+
/** Options for {@link handleQueue}. */
|
|
114
|
+
type Options = {
|
|
115
|
+
/** Queue name to match instead of {@link queueName} (e.g. a per-preview queue). */
|
|
116
|
+
queue?: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
/** Minimal queue batch shape; Cloudflare's `MessageBatch` satisfies it. */
|
|
119
|
+
type Batch = {
|
|
120
|
+
/** Queued messages; bodies are {@link Event} rows when `queue` matches. */
|
|
121
|
+
messages: readonly Message[];
|
|
122
|
+
/** Originating queue name. */
|
|
123
|
+
queue: string;
|
|
124
|
+
};
|
|
125
|
+
/** One queued message. */
|
|
126
|
+
type Message = {
|
|
127
|
+
/** Acknowledges the message. */
|
|
128
|
+
ack(): void;
|
|
129
|
+
/** Queued body; an {@link Event} when the batch is the analytics queue. */
|
|
130
|
+
body: unknown;
|
|
131
|
+
/** Marks the message for redelivery. */
|
|
132
|
+
retry(): void;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/** Rejected ClickHouse identifier. */
|
|
136
|
+
export declare class ConfigError extends Error {
|
|
137
|
+
constructor(value: string);
|
|
138
|
+
}
|
|
139
|
+
/** Failed ClickHouse insert (non-2xx HTTP response). */
|
|
140
|
+
export declare class InsertError extends Error {
|
|
141
|
+
constructor(status: number, body: string);
|
|
142
|
+
}
|
|
143
|
+
/** Failed ClickHouse schema migration (non-2xx HTTP response). */
|
|
144
|
+
export declare class MigrateError extends Error {
|
|
145
|
+
constructor(name: string, status: number, body: string);
|
|
146
|
+
}
|
|
147
|
+
/** Failed ClickHouse read query (non-2xx HTTP response). */
|
|
148
|
+
export declare class QueryError extends Error {
|
|
149
|
+
constructor(status: number, body: string);
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=Analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Analytics.d.ts","sourceRoot":"","sources":["../../src/analytics/Analytics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,0FAA0F;AAC1F,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAA;AAEvD,qDAAqD;AACrD,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,qBAAqB,CAAA;AAEvE;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC,CAE1B;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,cAAc,EAAE,aAAa,CAAC,KAAK,CAAA;CACpC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,iCAAiC;IACjC,MAAM,CAAC,IAAI,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChG,6DAA6D;IAC7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,8CAA8C;IAC9C,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,MAA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G;QACb,mFAAmF;QACnF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC3B,CAAA;IAED,2EAA2E;IAC3E,KAAK,KAAK,GAAG;QACX,2EAA2E;QAC3E,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;QAC5B,8BAA8B;QAC9B,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IAED,0BAA0B;IAC1B,KAAK,OAAO,GAAG;QACb,gCAAgC;QAChC,GAAG,IAAI,IAAI,CAAA;QACX,2EAA2E;QAC3E,IAAI,EAAE,OAAO,CAAA;QACb,wCAAwC;QACxC,KAAK,IAAI,IAAI,CAAA;KACd,CAAA;CACF;AAUD,sCAAsC;AACtC,qBAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,KAAK,EAAE,MAAM,EAGxB;CACF;AAED,wDAAwD;AACxD,qBAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAGvC;CACF;AAED,kEAAkE;AAClE,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAGrD;CACF;AAED,4DAA4D;AAC5D,qBAAa,UAAW,SAAQ,KAAK;IACnC,YAAY,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAGvC;CACF"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import * as RequestEvents from './tables/requestEvents.js';
|
|
2
|
+
export { createQueueSink } from './tables/requestEvents.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reads deduped billable request counts grouped by `(org, UTC hour)` from
|
|
5
|
+
* `request_events` — the request-metered billing source. Resolves the source
|
|
6
|
+
* at the leaf so a Workers factory builds a fresh connection.
|
|
7
|
+
*
|
|
8
|
+
* @param source - The analytics store or factory.
|
|
9
|
+
* @param options - The read options.
|
|
10
|
+
* @returns One deduped count per `(org, hour)`.
|
|
11
|
+
*/
|
|
12
|
+
export function readBillableRequestCounts(source, options) {
|
|
13
|
+
return RequestEvents.readBillableCounts(get(source), options);
|
|
14
|
+
}
|
|
15
|
+
/** Queue name {@link handleQueue} consumes; the host's queue producer/consumer bindings must reference it. */
|
|
16
|
+
export const queueName = 'api-request-analytics';
|
|
17
|
+
/**
|
|
18
|
+
* Resolves a {@link Source} to an {@link Analytics}. Call at the request leaf
|
|
19
|
+
* so factories create per-request instances; singletons resolve to themselves.
|
|
20
|
+
*
|
|
21
|
+
* @param source - The analytics store or factory.
|
|
22
|
+
* @returns The resolved {@link Analytics}.
|
|
23
|
+
*/
|
|
24
|
+
export function get(source) {
|
|
25
|
+
return typeof source === 'function' ? source() : source;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Ordered migrations for {@link Analytics.migrate}. ClickHouse lacks
|
|
29
|
+
* transactional DDL and advisory locks, so each statement is idempotent
|
|
30
|
+
* (`IF NOT EXISTS`) and re-applied on every run; no applied-migrations ledger.
|
|
31
|
+
*/
|
|
32
|
+
export const migrations = [
|
|
33
|
+
{
|
|
34
|
+
name: '0001_request_events',
|
|
35
|
+
sql: `
|
|
36
|
+
CREATE TABLE IF NOT EXISTS request_events (
|
|
37
|
+
timestamp DateTime64(3, 'UTC'),
|
|
38
|
+
service LowCardinality(String),
|
|
39
|
+
environment LowCardinality(String),
|
|
40
|
+
method LowCardinality(String),
|
|
41
|
+
route LowCardinality(String),
|
|
42
|
+
status UInt16,
|
|
43
|
+
duration_ms Float64,
|
|
44
|
+
principal_type LowCardinality(String),
|
|
45
|
+
key_id Nullable(String),
|
|
46
|
+
key_environment Nullable(String),
|
|
47
|
+
org_id Nullable(String),
|
|
48
|
+
project_id Nullable(String),
|
|
49
|
+
rate_limit_scope Nullable(String),
|
|
50
|
+
error_code Nullable(String),
|
|
51
|
+
request_id Nullable(String),
|
|
52
|
+
billing_active Nullable(UInt8)
|
|
53
|
+
)
|
|
54
|
+
ENGINE = MergeTree
|
|
55
|
+
ORDER BY (timestamp)
|
|
56
|
+
`,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: '0002_request_events_billing',
|
|
60
|
+
// Patches tables created before the billing columns were folded into 0001
|
|
61
|
+
// (production). Fresh databases already carry them from the CREATE, so the
|
|
62
|
+
// guard skips this ALTER there, where the scoped migrate user (preview)
|
|
63
|
+
// lacks the ALTER grant. ADD COLUMN IF NOT EXISTS keeps it idempotent.
|
|
64
|
+
guard: `
|
|
65
|
+
SELECT toUInt8(count() = 2) FROM system.columns
|
|
66
|
+
WHERE database = currentDatabase()
|
|
67
|
+
AND table = 'request_events'
|
|
68
|
+
AND name IN ('request_id', 'billing_active')
|
|
69
|
+
`,
|
|
70
|
+
sql: `
|
|
71
|
+
ALTER TABLE request_events
|
|
72
|
+
ADD COLUMN IF NOT EXISTS request_id Nullable(String),
|
|
73
|
+
ADD COLUMN IF NOT EXISTS billing_active Nullable(UInt8)
|
|
74
|
+
`,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* Creates a ClickHouse-backed {@link Analytics} over the HTTP interface.
|
|
79
|
+
* Requests scope to `database` (the `?database=` parameter); table names are
|
|
80
|
+
* code-owned by the `tables/*` modules, not configuration.
|
|
81
|
+
*
|
|
82
|
+
* @param options - ClickHouse connection options.
|
|
83
|
+
* @returns The analytics store.
|
|
84
|
+
*/
|
|
85
|
+
export function clickhouse(options) {
|
|
86
|
+
const authorization = `Basic ${btoa(`${options.user}:${options.password}`)}`;
|
|
87
|
+
function endpoint() {
|
|
88
|
+
const url = new URL(options.url);
|
|
89
|
+
url.searchParams.set('database', options.database);
|
|
90
|
+
url.searchParams.set('date_time_input_format', 'best_effort');
|
|
91
|
+
return url;
|
|
92
|
+
}
|
|
93
|
+
// Runs a migration guard SELECT; true (skip) when its first value is nonzero.
|
|
94
|
+
// A failed guard returns false so the migration still runs and reports.
|
|
95
|
+
async function guarded(sql) {
|
|
96
|
+
const response = await fetch(endpoint(), {
|
|
97
|
+
body: `${sql} FORMAT JSON`,
|
|
98
|
+
headers: { Authorization: authorization, 'Content-Type': 'text/plain' },
|
|
99
|
+
method: 'POST',
|
|
100
|
+
});
|
|
101
|
+
if (!response.ok)
|
|
102
|
+
return false;
|
|
103
|
+
try {
|
|
104
|
+
const body = (await response.json());
|
|
105
|
+
const first = body.data?.[0];
|
|
106
|
+
return first ? Number(Object.values(first)[0]) > 0 : false;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
async insert(table, rows) {
|
|
114
|
+
if (rows.length === 0)
|
|
115
|
+
return;
|
|
116
|
+
const url = endpoint();
|
|
117
|
+
url.searchParams.set('query', `INSERT INTO ${quote(table)} FORMAT JSONEachRow`);
|
|
118
|
+
const response = await fetch(url, {
|
|
119
|
+
body: `${rows.map((row) => JSON.stringify(row)).join('\n')}\n`,
|
|
120
|
+
headers: { Authorization: authorization, 'Content-Type': 'application/x-ndjson' },
|
|
121
|
+
method: 'POST',
|
|
122
|
+
});
|
|
123
|
+
if (response.ok)
|
|
124
|
+
return;
|
|
125
|
+
throw new InsertError(response.status, await response.text());
|
|
126
|
+
},
|
|
127
|
+
async migrate() {
|
|
128
|
+
for (const migration of migrations) {
|
|
129
|
+
if (migration.guard && (await guarded(migration.guard)))
|
|
130
|
+
continue;
|
|
131
|
+
const response = await fetch(endpoint(), {
|
|
132
|
+
body: migration.sql,
|
|
133
|
+
headers: { Authorization: authorization, 'Content-Type': 'text/plain' },
|
|
134
|
+
method: 'POST',
|
|
135
|
+
});
|
|
136
|
+
if (response.ok)
|
|
137
|
+
continue;
|
|
138
|
+
throw new MigrateError(migration.name, response.status, await response.text());
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
async query(sql) {
|
|
142
|
+
const response = await fetch(endpoint(), {
|
|
143
|
+
body: `${sql} FORMAT JSON`,
|
|
144
|
+
headers: { Authorization: authorization, 'Content-Type': 'text/plain' },
|
|
145
|
+
method: 'POST',
|
|
146
|
+
});
|
|
147
|
+
if (!response.ok)
|
|
148
|
+
throw new QueryError(response.status, await response.text());
|
|
149
|
+
const body = (await response.json());
|
|
150
|
+
return body.data ?? [];
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Consumes one queue batch when it is the analytics queue ({@link queueName}):
|
|
156
|
+
* batch-inserts the queued rows, acking on success and retrying on failure.
|
|
157
|
+
* Returns whether the batch was handled, so a multi-queue worker can chain:
|
|
158
|
+
*
|
|
159
|
+
* ```ts
|
|
160
|
+
* async queue(batch) {
|
|
161
|
+
* if (await Analytics.handleQueue(analytics, batch)) return
|
|
162
|
+
* // … other queues …
|
|
163
|
+
* }
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param source - The analytics store or factory.
|
|
167
|
+
* @param batch - The queue batch.
|
|
168
|
+
* @param options - Options.
|
|
169
|
+
* @returns Whether the batch belonged to the analytics queue.
|
|
170
|
+
*/
|
|
171
|
+
export async function handleQueue(source, batch, options = {}) {
|
|
172
|
+
if (batch.queue !== (options.queue ?? queueName))
|
|
173
|
+
return false;
|
|
174
|
+
await RequestEvents.insertMessages(get(source), batch.messages);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
/** Valid unquoted ClickHouse identifier. */
|
|
178
|
+
const identifier = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
179
|
+
function quote(value) {
|
|
180
|
+
if (identifier.test(value))
|
|
181
|
+
return `\`${value}\``;
|
|
182
|
+
throw new ConfigError(value);
|
|
183
|
+
}
|
|
184
|
+
/** Rejected ClickHouse identifier. */
|
|
185
|
+
export class ConfigError extends Error {
|
|
186
|
+
constructor(value) {
|
|
187
|
+
super(`Invalid ClickHouse identifier: ${value}`);
|
|
188
|
+
this.name = 'Analytics.ConfigError';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/** Failed ClickHouse insert (non-2xx HTTP response). */
|
|
192
|
+
export class InsertError extends Error {
|
|
193
|
+
constructor(status, body) {
|
|
194
|
+
super(`ClickHouse insert failed with status ${status}: ${body.slice(0, 500)}`);
|
|
195
|
+
this.name = 'Analytics.InsertError';
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/** Failed ClickHouse schema migration (non-2xx HTTP response). */
|
|
199
|
+
export class MigrateError extends Error {
|
|
200
|
+
constructor(name, status, body) {
|
|
201
|
+
super(`ClickHouse migration "${name}" failed with status ${status}: ${body.slice(0, 500)}`);
|
|
202
|
+
this.name = 'Analytics.MigrateError';
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** Failed ClickHouse read query (non-2xx HTTP response). */
|
|
206
|
+
export class QueryError extends Error {
|
|
207
|
+
constructor(status, body) {
|
|
208
|
+
super(`ClickHouse query failed with status ${status}: ${body.slice(0, 500)}`);
|
|
209
|
+
this.name = 'Analytics.QueryError';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=Analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Analytics.js","sourceRoot":"","sources":["../../src/analytics/Analytics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAQ3D;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAc,EACd,OAA8B;IAE9B,OAAO,aAAa,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAA;AAC/D,CAAC;AAgCD,8GAA8G;AAC9G,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CAAC,MAAc;IAChC,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,C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pC,CAAC;CACF"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type * as Log from '../../internal/Log.js';
|
|
2
|
+
import type * as Metrics from '../../Metrics.js';
|
|
3
|
+
import type * as Analytics from '../Analytics.js';
|
|
4
|
+
/** Columns of the `request_events` table: one compact row per API request. */
|
|
5
|
+
export type Table = {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the owning org's billing was active at request time (`1`/`0`), for
|
|
8
|
+
* authenticated API-key callers; `null` otherwise. The request-metered
|
|
9
|
+
* billing gate for sandbox: only `1` rows bill.
|
|
10
|
+
*/
|
|
11
|
+
billing_active: number | null;
|
|
12
|
+
/** Total request duration in milliseconds. */
|
|
13
|
+
duration_ms: number;
|
|
14
|
+
/** Deployment environment that served the request. */
|
|
15
|
+
environment: string;
|
|
16
|
+
/** Stable API error code, when the response was an error envelope. */
|
|
17
|
+
error_code: string | null;
|
|
18
|
+
/** API-key environment for authenticated API-key callers. */
|
|
19
|
+
key_environment: 'production' | 'sandbox' | null;
|
|
20
|
+
/** API key id for authenticated API-key callers. */
|
|
21
|
+
key_id: string | null;
|
|
22
|
+
/** HTTP method. */
|
|
23
|
+
method: string;
|
|
24
|
+
/** Organization id for authenticated API-key callers. */
|
|
25
|
+
org_id: string | null;
|
|
26
|
+
/** Project id for authenticated API-key callers. */
|
|
27
|
+
project_id: string | null;
|
|
28
|
+
/** Caller principal kind. */
|
|
29
|
+
principal_type: 'api_key' | 'public' | 'session' | 'super_admin' | 'unknown';
|
|
30
|
+
/** Rate-limit bucket scope, when a rate limit was applied. */
|
|
31
|
+
rate_limit_scope: string | null;
|
|
32
|
+
/** Stable per-request id (`entry.requestId`); dedups the billing count via `uniqExact`. */
|
|
33
|
+
request_id: string | null;
|
|
34
|
+
/** Bounded matched route pattern. */
|
|
35
|
+
route: string;
|
|
36
|
+
/** Service that emitted the event. */
|
|
37
|
+
service: string;
|
|
38
|
+
/** HTTP response status code. */
|
|
39
|
+
status: number;
|
|
40
|
+
/** UTC request completion timestamp formatted for ClickHouse DateTime64. */
|
|
41
|
+
timestamp: string;
|
|
42
|
+
};
|
|
43
|
+
/** One request attribution term for usage reads. */
|
|
44
|
+
export type Attribution = {
|
|
45
|
+
/** API key ids matched by this term; absent means all keys. */
|
|
46
|
+
apiKeyIds?: readonly string[] | undefined;
|
|
47
|
+
/** API-key environment matched by this term; absent means all environments. */
|
|
48
|
+
environment?: Environment | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Project scope for this term: a project id matches that project, `null`
|
|
51
|
+
* matches rows without project attribution, and `undefined` matches the
|
|
52
|
+
* whole organization (any project, including unattributed rows).
|
|
53
|
+
*/
|
|
54
|
+
projectId?: string | null | undefined;
|
|
55
|
+
};
|
|
56
|
+
/** API-key environment for request usage. */
|
|
57
|
+
export type Environment = 'production' | 'sandbox';
|
|
58
|
+
/** API key usage grouped for one project. */
|
|
59
|
+
export type KeyBreakdown = {
|
|
60
|
+
/** API key id (`key_…`). */
|
|
61
|
+
apiKeyId: string;
|
|
62
|
+
/** Average request duration in milliseconds. */
|
|
63
|
+
averageDurationMs: number;
|
|
64
|
+
/** Requests whose status was at least 400. */
|
|
65
|
+
errors: number;
|
|
66
|
+
/** Total requests. */
|
|
67
|
+
requests: number;
|
|
68
|
+
};
|
|
69
|
+
/** Time bucket size for the usage series. */
|
|
70
|
+
export type Interval = 'day' | 'hour';
|
|
71
|
+
/** Route usage grouped for one project. */
|
|
72
|
+
export type RouteBreakdown = {
|
|
73
|
+
/** Average request duration in milliseconds. */
|
|
74
|
+
averageDurationMs: number;
|
|
75
|
+
/** Requests whose status was at least 400. */
|
|
76
|
+
errors: number;
|
|
77
|
+
/** Total requests. */
|
|
78
|
+
requests: number;
|
|
79
|
+
/** Matched route pattern. */
|
|
80
|
+
route: string;
|
|
81
|
+
};
|
|
82
|
+
/** One usage series point. */
|
|
83
|
+
export type SeriesPoint = {
|
|
84
|
+
/** Requests whose status was at least 400. */
|
|
85
|
+
errors: number;
|
|
86
|
+
/** Total requests. */
|
|
87
|
+
requests: number;
|
|
88
|
+
/** Bucket start timestamp (ISO 8601). */
|
|
89
|
+
time: string;
|
|
90
|
+
};
|
|
91
|
+
/** Status-code usage grouped for one project. */
|
|
92
|
+
export type StatusBreakdown = {
|
|
93
|
+
/** Total requests. */
|
|
94
|
+
requests: number;
|
|
95
|
+
/** HTTP status code. */
|
|
96
|
+
status: number;
|
|
97
|
+
};
|
|
98
|
+
/** Overall usage totals for one project. */
|
|
99
|
+
export type Totals = {
|
|
100
|
+
/** Average request duration in milliseconds. */
|
|
101
|
+
averageDurationMs: number;
|
|
102
|
+
/** Requests whose status was at least 400. */
|
|
103
|
+
errors: number;
|
|
104
|
+
/** Total requests. */
|
|
105
|
+
requests: number;
|
|
106
|
+
};
|
|
107
|
+
/** Usage read options for one project. */
|
|
108
|
+
export type ProjectUsageOptions = {
|
|
109
|
+
/** Attribution terms that define which request rows count. */
|
|
110
|
+
attributions: readonly Attribution[];
|
|
111
|
+
/** Inclusive lower timestamp bound (ISO 8601). */
|
|
112
|
+
from: string;
|
|
113
|
+
/** Bucket size for the time series. */
|
|
114
|
+
interval: Interval;
|
|
115
|
+
/** Organization id (`org_…`). */
|
|
116
|
+
orgId: string;
|
|
117
|
+
/** Inclusive upper timestamp bound (ISO 8601). */
|
|
118
|
+
to: string;
|
|
119
|
+
};
|
|
120
|
+
/** Project usage response body. */
|
|
121
|
+
export type ProjectUsage = {
|
|
122
|
+
/** Usage grouped by API key. */
|
|
123
|
+
byKey: readonly KeyBreakdown[];
|
|
124
|
+
/** Usage grouped by route. */
|
|
125
|
+
byRoute: readonly RouteBreakdown[];
|
|
126
|
+
/** Usage grouped by status code. */
|
|
127
|
+
byStatus: readonly StatusBreakdown[];
|
|
128
|
+
/** Inclusive lower timestamp bound used for the read (ISO 8601). */
|
|
129
|
+
from: string;
|
|
130
|
+
/** Bucket size used for the time series. */
|
|
131
|
+
interval: Interval;
|
|
132
|
+
/** Usage grouped into small time buckets. */
|
|
133
|
+
series: readonly SeriesPoint[];
|
|
134
|
+
/** Inclusive upper timestamp bound used for the read (ISO 8601). */
|
|
135
|
+
to: string;
|
|
136
|
+
/** Overall usage totals. */
|
|
137
|
+
totals: Totals;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Builds a `Metrics.cloudflare` analytics factory that enqueues one compact
|
|
141
|
+
* request row per entry onto `queue`. Pass the result directly as the
|
|
142
|
+
* backend's `analytics` option; it reuses the backend's
|
|
143
|
+
* `enabled`/`environment`/`service` context and self-disables when `enabled`
|
|
144
|
+
* is false.
|
|
145
|
+
*
|
|
146
|
+
* @param queue - The analytics queue producer.
|
|
147
|
+
* @returns The analytics factory.
|
|
148
|
+
*/
|
|
149
|
+
export declare function createQueueSink(queue: createQueueSink.Queue): createQueueSink.Factory;
|
|
150
|
+
export declare namespace createQueueSink {
|
|
151
|
+
/** Analytics factory accepted by `Metrics.cloudflare`'s `analytics` option. */
|
|
152
|
+
type Factory = (context: Metrics.cloudflare.Context) => Log.Emit;
|
|
153
|
+
/** Minimal Cloudflare Queue producer shape the sink sends rows to. */
|
|
154
|
+
type Queue = {
|
|
155
|
+
/** Enqueues one row; the result is awaited and discarded. */
|
|
156
|
+
send(message: Table): Promise<unknown>;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Inserts a batch of queued request rows, acking each message on success and
|
|
161
|
+
* retrying the batch on failure.
|
|
162
|
+
*
|
|
163
|
+
* @param analytics - The analytics store.
|
|
164
|
+
* @param messages - The queued messages.
|
|
165
|
+
*/
|
|
166
|
+
export declare function insertMessages(analytics: Analytics.Analytics, messages: readonly insertMessages.Message[]): Promise<void>;
|
|
167
|
+
export declare namespace insertMessages {
|
|
168
|
+
/** Minimal Cloudflare Queue message shape carrying one row. */
|
|
169
|
+
type Message = {
|
|
170
|
+
/** Acknowledges the message. */
|
|
171
|
+
ack(): void;
|
|
172
|
+
/** Queued row. */
|
|
173
|
+
body: Table;
|
|
174
|
+
/** Marks the message for redelivery. */
|
|
175
|
+
retry(): void;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Reads request usage for one project from the `request_events` table.
|
|
180
|
+
*
|
|
181
|
+
* @param analytics - The analytics store.
|
|
182
|
+
* @param options - The usage read options.
|
|
183
|
+
* @returns The project usage.
|
|
184
|
+
*/
|
|
185
|
+
export declare function readProjectUsage(analytics: Analytics.Analytics, options: ProjectUsageOptions): Promise<ProjectUsage>;
|
|
186
|
+
/** One org's deduped billable request count for a single UTC hour. */
|
|
187
|
+
export type BillableCount = {
|
|
188
|
+
/** UTC hour start (ISO 8601). */
|
|
189
|
+
bucketStart: string;
|
|
190
|
+
/** Deduped billable request count (`uniqExact(request_id)`). */
|
|
191
|
+
count: number;
|
|
192
|
+
/** Organization id (`org_…`). */
|
|
193
|
+
orgId: string;
|
|
194
|
+
};
|
|
195
|
+
/** Options for {@link readBillableCounts}. */
|
|
196
|
+
export type BillableCountsOptions = {
|
|
197
|
+
/** API-key environment to bill; `sandbox` rows require request-time billing. */
|
|
198
|
+
environment: Environment;
|
|
199
|
+
/** Inclusive lower timestamp bound (ISO 8601). */
|
|
200
|
+
from: string;
|
|
201
|
+
/** Exclusive upper timestamp bound (ISO 8601); the seal cutoff. */
|
|
202
|
+
to: string;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Reads deduped billable request counts grouped by `(org, UTC hour)` for the
|
|
206
|
+
* request-metered billing reporter. Counts dedupe on `request_id` via
|
|
207
|
+
* `uniqExact` (the queue → ClickHouse path can duplicate rows); production rows
|
|
208
|
+
* always bill, sandbox rows only when `billing_active = 1` at request time.
|
|
209
|
+
*
|
|
210
|
+
* @param analytics - The analytics store.
|
|
211
|
+
* @param options - The read options.
|
|
212
|
+
* @returns One deduped count per `(org, hour)`.
|
|
213
|
+
*/
|
|
214
|
+
export declare function readBillableCounts(analytics: Analytics.Analytics, options: BillableCountsOptions): Promise<BillableCount[]>;
|
|
215
|
+
//# sourceMappingURL=requestEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestEvents.d.ts","sourceRoot":"","sources":["../../../src/analytics/tables/requestEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAEjD,8EAA8E;AAC9E,MAAM,MAAM,KAAK,GAAG;IAClB;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAA;IACnB,sEAAsE;IACtE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,6DAA6D;IAC7D,eAAe,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAAA;IAChD,oDAAoD;IACpD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,oDAAoD;IACpD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,6BAA6B;IAC7B,cAAc,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;IAC5E,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,2FAA2F;IAC3F,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,o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