@volter/twin-cloudflare 0.1.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/LICENSE +202 -0
- package/README.md +223 -0
- package/dist/r2/src/endpoint.d.ts +14 -0
- package/dist/r2/src/endpoint.js +30 -0
- package/dist/r2/src/fetch.d.ts +7 -0
- package/dist/r2/src/fetch.js +230 -0
- package/dist/r2/src/generated/surface.gen.json +1 -0
- package/dist/r2/src/manifest.d.ts +22 -0
- package/dist/r2/src/manifest.js +69 -0
- package/dist/r2/src/semantics/buckets.d.ts +18 -0
- package/dist/r2/src/semantics/buckets.js +145 -0
- package/dist/r2/src/semantics/objects.d.ts +8 -0
- package/dist/r2/src/semantics/objects.js +252 -0
- package/dist/r2/src/wire.d.ts +54 -0
- package/dist/r2/src/wire.js +120 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +26 -0
- package/dist/src/cloudflare-budget.d.ts +22 -0
- package/dist/src/cloudflare-budget.js +40 -0
- package/dist/src/cloudflare-capabilities.d.ts +6 -0
- package/dist/src/cloudflare-capabilities.js +1161 -0
- package/dist/src/cloudflare-common.d.ts +59 -0
- package/dist/src/cloudflare-common.js +142 -0
- package/dist/src/cloudflare-conformance.d.ts +6 -0
- package/dist/src/cloudflare-conformance.js +251 -0
- package/dist/src/cloudflare-connector.d.ts +53 -0
- package/dist/src/cloudflare-connector.js +418 -0
- package/dist/src/cloudflare-openapi-operations.d.ts +10 -0
- package/dist/src/cloudflare-openapi-operations.js +3336 -0
- package/dist/src/cloudflare-provisioning.d.ts +5 -0
- package/dist/src/cloudflare-provisioning.js +2097 -0
- package/dist/src/cloudflare-r2.d.ts +121 -0
- package/dist/src/cloudflare-r2.js +138 -0
- package/dist/src/cloudflare-server.d.ts +17 -0
- package/dist/src/cloudflare-server.js +101 -0
- package/dist/src/cloudflare-twin.d.ts +14 -0
- package/dist/src/cloudflare-twin.js +762 -0
- package/dist/src/cloudflare-worker-assets.d.ts +25 -0
- package/dist/src/cloudflare-worker-assets.js +192 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +69 -0
- package/dist/src/screens/dashboard.d.ts +3 -0
- package/dist/src/screens/dashboard.js +265 -0
- package/package.json +56 -0
- package/src/cli.ts +25 -0
- package/src/cloudflare-budget.ts +61 -0
- package/src/cloudflare-capabilities.ts +1107 -0
- package/src/cloudflare-common.ts +183 -0
- package/src/cloudflare-conformance.ts +204 -0
- package/src/cloudflare-connector.ts +443 -0
- package/src/cloudflare-openapi-operations.ts +3344 -0
- package/src/cloudflare-provisioning.ts +1969 -0
- package/src/cloudflare-r2.ts +173 -0
- package/src/cloudflare-server.ts +109 -0
- package/src/cloudflare-twin.ts +714 -0
- package/src/cloudflare-worker-assets.ts +207 -0
- package/src/index.ts +112 -0
- package/src/screens/dashboard.tsx +297 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RateBudget, type RateBudgetDeclaration, type RateBudgetOptions, type RateBudgetReservation, type RateBudgetSnapshot } from '@volter/world-core';
|
|
2
|
+
export declare const CLOUDFLARE_BUDGET_WINDOW_MS = 60000;
|
|
3
|
+
export declare const CLOUDFLARE_BUDGET_CEILING = 60;
|
|
4
|
+
export declare const CLOUDFLARE_BUDGET_MAX_RETRY_AFTER_S = 300;
|
|
5
|
+
export declare const CLOUDFLARE_CALL_WEIGHTS: {
|
|
6
|
+
readonly mutation: 3;
|
|
7
|
+
readonly read: 2;
|
|
8
|
+
};
|
|
9
|
+
export declare const CLOUDFLARE_RATE_BUDGET: RateBudgetDeclaration;
|
|
10
|
+
export declare function cloudflareCallWeight(method: string, path: string): number;
|
|
11
|
+
export declare function cloudflareBudgetPath(opts?: {
|
|
12
|
+
root?: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
} | string): string;
|
|
15
|
+
export type CloudflareBudgetOptions = Omit<RateBudgetOptions, 'vendor'>;
|
|
16
|
+
export declare class CloudflareBudget extends RateBudget {
|
|
17
|
+
constructor(opts?: CloudflareBudgetOptions);
|
|
18
|
+
}
|
|
19
|
+
export type { RateBudgetErrorKind as CloudflareBudgetErrorKind } from '@volter/world-core';
|
|
20
|
+
export { RateBudgetError as CloudflareBudgetError } from '@volter/world-core';
|
|
21
|
+
export type CloudflareBudgetReservation = RateBudgetReservation;
|
|
22
|
+
export type CloudflareBudgetSnapshot = RateBudgetSnapshot;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Cloudflare client-side rate budget. The mechanism is shared @volter/world-core RateBudget;
|
|
2
|
+
// only Cloudflare's documented limit and conservative weights live here.
|
|
3
|
+
//
|
|
4
|
+
// Official source, live-fetched 2026-08-21:
|
|
5
|
+
// https://developers.cloudflare.com/fundamentals/api/reference/limits/
|
|
6
|
+
// Cloudflare publishes a global 1,200 requests / five minutes per user/account token.
|
|
7
|
+
// This declaration stays at the kernel fallback's much tighter 60 weighted units/minute.
|
|
8
|
+
import { declareRateBudget, rateBudgetPath, rateBudgetWeight, RateBudget, } from '@volter/world-core';
|
|
9
|
+
const VENDOR = 'cloudflare';
|
|
10
|
+
export const CLOUDFLARE_BUDGET_WINDOW_MS = 60_000;
|
|
11
|
+
export const CLOUDFLARE_BUDGET_CEILING = 60;
|
|
12
|
+
export const CLOUDFLARE_BUDGET_MAX_RETRY_AFTER_S = 300;
|
|
13
|
+
export const CLOUDFLARE_CALL_WEIGHTS = { mutation: 3, read: 2 };
|
|
14
|
+
export const CLOUDFLARE_RATE_BUDGET = {
|
|
15
|
+
windowMs: CLOUDFLARE_BUDGET_WINDOW_MS,
|
|
16
|
+
ceiling: CLOUDFLARE_BUDGET_CEILING,
|
|
17
|
+
defaultWeight: CLOUDFLARE_CALL_WEIGHTS.read,
|
|
18
|
+
maxRetryAfterSeconds: CLOUDFLARE_BUDGET_MAX_RETRY_AFTER_S,
|
|
19
|
+
rules: [
|
|
20
|
+
{ match: '^(POST|PUT|PATCH|DELETE) ', weight: CLOUDFLARE_CALL_WEIGHTS.mutation },
|
|
21
|
+
],
|
|
22
|
+
reason: 'Cloudflare publishes a global Client API limit of 1,200 requests per five minutes per user/account token ' +
|
|
23
|
+
'(https://developers.cloudflare.com/fundamentals/api/reference/limits/, live-fetched 2026-08-21). ' +
|
|
24
|
+
'This declaration is deliberately tighter: 60 weighted units per minute; reads cost 2 (30/minute) and ' +
|
|
25
|
+
'mutations cost 3 (20/minute). It neither exceeds the documented sustained limit nor the kernel fallback burst.',
|
|
26
|
+
};
|
|
27
|
+
declareRateBudget(VENDOR, CLOUDFLARE_RATE_BUDGET);
|
|
28
|
+
export function cloudflareCallWeight(method, path) {
|
|
29
|
+
return rateBudgetWeight(VENDOR, `${method.toUpperCase()} ${path.split('?')[0] ?? path}`);
|
|
30
|
+
}
|
|
31
|
+
export function cloudflareBudgetPath(opts = {}) {
|
|
32
|
+
const value = typeof opts === 'string' ? { root: opts } : opts;
|
|
33
|
+
return rateBudgetPath({ ...value, vendor: VENDOR });
|
|
34
|
+
}
|
|
35
|
+
export class CloudflareBudget extends RateBudget {
|
|
36
|
+
constructor(opts = {}) {
|
|
37
|
+
super({ ...opts, vendor: VENDOR });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export { RateBudgetError as CloudflareBudgetError } from '@volter/world-core';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CapabilityReport, type CapabilitySpec } from '@volter/world-tooling';
|
|
2
|
+
export declare const CLOUDFLARE_OFFICIAL_AREAS: readonly ["abuse-reports", "accounts", "acm", "addressing", "ai", "ai-audit", "ai-gateway", "ai-security", "aisearch", "alerting", "analytics-query", "api-gateway", "argo", "audit-logs", "billing", "bot-management", "botnet-feed", "brand-protection", "browser-rendering", "cache", "calls", "certificate-authorities", "client-certificates", "cloud-connector", "cloudforce-one", "connectivity", "content-scanning", "csam-scanner", "custom-certificates", "custom-csrs", "custom-hostnames", "custom-nameservers", "custom-pages", "d1", "dcv-delegation", "ddos-protection", "diagnostics", "dls", "dns", "dns-firewall", "durable-objects", "email-auth", "email-routing", "email-security", "email-sending", "filters", "firewall", "flagship", "fraud", "google-tag-gateway", "healthchecks", "hostnames", "hyperdrive", "iam", "images", "intel", "ips", "keyless-certificates", "kv", "leaked-credential-checks", "load-balancers", "logpush", "logs", "magic-cloud-networking", "magic-network-monitoring", "magic-transit", "managed-transforms", "memberships", "moq", "mtls-certificates", "network-interconnects", "organizations", "origin-ca-certificates", "origin-post-quantum-encryption", "origin-tls-client-auth", "origin-tls-compliance-modes", "page-rules", "page-shield", "pages", "pipelines", "precursor", "queues", "r2", "r2-data-catalog", "radar", "rate-limits", "realtime-kit", "registrar", "registrar-sandbox", "request-tracers", "resource-sharing", "resource-tagging", "rules", "rulesets", "rum", "schema-validation", "secrets-store", "security-center", "security-txt", "snippets", "spectrum", "speed", "ssl", "stream", "tenant-custom-nameservers", "tenants", "token-validation", "turnstile", "url-normalization", "url-scanner", "user", "vectorize", "vulnerability-scanner", "waiting-rooms", "web3", "workers", "workers-for-platforms", "workflows", "zaraz", "zero-trust", "zones"];
|
|
3
|
+
export declare const CLOUDFLARE_OPENAPI_AREAS: string[];
|
|
4
|
+
export declare const CLOUDFLARE_AREAS: string[];
|
|
5
|
+
export declare const CLOUDFLARE_CAPABILITIES: CapabilitySpec[];
|
|
6
|
+
export declare function cloudflareCapabilities(): Promise<CapabilityReport>;
|