@wtfalch/edge 0.15.1 → 0.16.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/dist/client.d.ts +13 -1
- package/dist/client.js +12 -0
- package/dist/types.d.ts +31 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ClientOptions } from './transport.js';
|
|
2
|
-
import type { AccessProviderView, AccessReadinessResponse, AdoptAccessAppsRequest, AdoptAccessAppsResponse, AdoptRateLimitRulesRequest, AdoptRateLimitRulesResponse, AdoptRecordsRequest, AdoptRecordsResponse, AdoptTunnelsRequest, AdoptTunnelsResponse, AdoptWorkersRequest, AdoptWorkersResponse, AdoptZonesRequest, AdoptZonesResponse, AvailableResponse, ClaimNameRequest, CreatePlatformAccessAppRequest, CreatePlatformAccessPolicyRequest, CreatePlatformGateRequest, CreatePlatformRateLimitRuleRequest, CreatePlatformRecordRequest, CreatePlatformServiceTokenRequest, CreatePlatformServiceTokenResponse, CreatePlatformTunnelRequest, CreatePlatformWorkerRouteRequest, CreatePlatformZoneRequest, EnsureAccessProviderRequest, EnsurePlatformWorkerContainerRequest, EnsureRequestHeaderStripResponse, FindServiceTokenResponse, ListClaimsResponse, ListGatesResponse, ListPlatformAccessAppsRequest, ListPlatformAccessAppsResponse, ListPlatformAccessPoliciesResponse, ListPlatformRateLimitRulesRequest, ListPlatformRateLimitRulesResponse, ListPlatformRecordsRequest, ListPlatformRecordsResponse, ListPlatformTunnelsResponse, ListPlatformWorkerRoutesRequest, ListPlatformWorkerRoutesResponse, ListPlatformWorkerScriptsResponse, ListPlatformZonesRequest, ListPlatformZonesResponse, ListRecordsResponse, MintKeyRequest, MintKeyResponse, NameClaim, OneTimePinProviderView, OrgSettingsRequest, PlatformAccessAppView, PlatformAccessPolicyView, PlatformGateView, PlatformRateLimitRuleView, PlatformRecordView, PlatformTunnelView, PlatformWorkerContainerView, PlatformWorkerRouteView, PlatformWorkerScriptView, PlatformZoneView, PutPlatformTunnelConfigRequest, RecordInput, RecordPatch, RecordView, RemovePlatformWorkerContainerResponse, RemovePlatformWorkerSecretResponse, ReplacePlatformGateHostnamesRequest, RequestHeaderStripRule, SetGatePeopleResponse, SetPlatformWorkerSchedulesRequest, SetPlatformWorkerSchedulesResponse, SetPlatformWorkerSecretsRequest, SetPlatformWorkerSecretsResponse, TokenResponse, UpdatePlatformRecordRequest, UploadPlatformWorkerScriptRequest } from './types.js';
|
|
2
|
+
import type { AccessProviderView, AccessReadinessResponse, AdoptAccessAppsRequest, AdoptAccessAppsResponse, AdoptRateLimitRulesRequest, AdoptRateLimitRulesResponse, AdoptRecordsRequest, AdoptRecordsResponse, AdoptTunnelsRequest, AdoptTunnelsResponse, AdoptWorkersRequest, AdoptWorkersResponse, AdoptZonesRequest, AdoptZonesResponse, AvailableResponse, ClaimNameRequest, CreatePlatformAccessAppRequest, CreatePlatformAccessPolicyRequest, CreatePlatformGateRequest, CreatePlatformRateLimitRuleRequest, CreatePlatformRecordRequest, CreatePlatformServiceTokenRequest, CreatePlatformServiceTokenResponse, CreatePlatformTunnelRequest, CreatePlatformWorkerRouteRequest, CreatePlatformZoneRequest, EnsureAccessProviderRequest, EnsurePlatformWorkerContainerRequest, EnsureRequestHeaderStripResponse, FindServiceTokenResponse, ListClaimsResponse, ListGatesResponse, ListPlatformAccessAppsRequest, ListPlatformAccessAppsResponse, ListPlatformAccessPoliciesResponse, ListPlatformRateLimitRulesRequest, ListPlatformRateLimitRulesResponse, ListPlatformRecordsRequest, ListPlatformRecordsResponse, ListPlatformTunnelsResponse, ListPlatformWorkerRoutesRequest, ListPlatformWorkerRoutesResponse, ListPlatformWorkerScriptsResponse, ListPlatformZonesRequest, ListPlatformZonesResponse, ListRecordsResponse, MintKeyRequest, MintKeyResponse, NameClaim, OneTimePinProviderView, OrgSettingsRequest, PlatformAccessAppView, PlatformAccessPolicyView, PlatformGateView, PlatformRateLimitRuleView, PlatformRecordView, PlatformTunnelView, PlatformWorkerContainerView, PlatformWorkerRouteView, PlatformWorkerScriptView, PlatformZoneView, PutPlatformTunnelConfigRequest, RecordInput, RecordPatch, RecordView, RemovePlatformWorkerContainerResponse, RemovePlatformWorkerSecretResponse, ReplacePlatformGateHostnamesRequest, RequestHeaderStripRule, SetGatePeopleResponse, SetPlatformWorkerSchedulesRequest, SetPlatformWorkerSchedulesResponse, SetPlatformWorkerSecretsRequest, SetPlatformWorkerSecretsResponse, TokenResponse, UpdatePlatformRecordRequest, UploadPlatformWorkerScriptRequest, UpsertHyperdriveRequest, UpsertHyperdriveResponse } from './types.js';
|
|
3
3
|
export { EdgeApiError, type ClientOptions } from './transport.js';
|
|
4
4
|
/** Called with an entry's key: the key carries its organisation and domain, so
|
|
5
5
|
* no call names either. `setReservedLabels`, `mintKey` and `revokeKey` are
|
|
@@ -138,6 +138,18 @@ export declare function createEdgeClient(options: ClientOptions): {
|
|
|
138
138
|
* Cloudflare, and anything nobody names is left alone. */
|
|
139
139
|
adopt: (input: AdoptRateLimitRulesRequest) => Promise<AdoptRateLimitRulesResponse>;
|
|
140
140
|
};
|
|
141
|
+
/** Hyperdrive configs whose origin is a private database behind a Cloudflare Tunnel and an Access service token. */
|
|
142
|
+
hyperdrive: {
|
|
143
|
+
/** Creates the config, or rewrites the one of that name, so the same call
|
|
144
|
+
* twice leaves one config and the same id. Needs the platform credential.
|
|
145
|
+
* The password and Access secret go to Cloudflare and are not stored,
|
|
146
|
+
* returned or audited. A failure halfway (the config written, the audit
|
|
147
|
+
* not) throws with the config live; repeat the call. Rejects with
|
|
148
|
+
* `conflict` (reason `upstream_rejected`) when Cloudflare refuses it for good. */
|
|
149
|
+
upsert: (input: UpsertHyperdriveRequest) => Promise<UpsertHyperdriveResponse>;
|
|
150
|
+
/** Deletes the config of that name. One already gone counts as deleted. */
|
|
151
|
+
delete: (name: string) => Promise<void>;
|
|
152
|
+
};
|
|
141
153
|
/** Request-header Transform Rules in a zone. */
|
|
142
154
|
requestHeaders: {
|
|
143
155
|
/** Keeps one rule, named by `rule.description`, that removes `rule.headers`
|
package/dist/client.js
CHANGED
|
@@ -143,6 +143,18 @@ export function createEdgeClient(options) {
|
|
|
143
143
|
* Cloudflare, and anything nobody names is left alone. */
|
|
144
144
|
adopt: (input) => call('POST', '/v1/platform/ratelimits/adopt', input),
|
|
145
145
|
},
|
|
146
|
+
/** Hyperdrive configs whose origin is a private database behind a Cloudflare Tunnel and an Access service token. */
|
|
147
|
+
hyperdrive: {
|
|
148
|
+
/** Creates the config, or rewrites the one of that name, so the same call
|
|
149
|
+
* twice leaves one config and the same id. Needs the platform credential.
|
|
150
|
+
* The password and Access secret go to Cloudflare and are not stored,
|
|
151
|
+
* returned or audited. A failure halfway (the config written, the audit
|
|
152
|
+
* not) throws with the config live; repeat the call. Rejects with
|
|
153
|
+
* `conflict` (reason `upstream_rejected`) when Cloudflare refuses it for good. */
|
|
154
|
+
upsert: (input) => call('PUT', '/v1/platform/hyperdrive/configs', input),
|
|
155
|
+
/** Deletes the config of that name. One already gone counts as deleted. */
|
|
156
|
+
delete: (name) => call('DELETE', `/v1/platform/hyperdrive/configs/${encodeURIComponent(name)}`),
|
|
157
|
+
},
|
|
146
158
|
/** Request-header Transform Rules in a zone. */
|
|
147
159
|
requestHeaders: {
|
|
148
160
|
/** Keeps one rule, named by `rule.description`, that removes `rule.headers`
|
package/dist/types.d.ts
CHANGED
|
@@ -540,8 +540,14 @@ export interface WorkerDurableObjectBinding {
|
|
|
540
540
|
/** The exported class name. */
|
|
541
541
|
class_name: string;
|
|
542
542
|
}
|
|
543
|
+
/** A Hyperdrive config bound to the script as `name`; `id` is the id `platform.hyperdrive.upsert` returned (32 hex digits). It lives only as long as an upload lists it: send it on every deploy. */
|
|
544
|
+
export interface WorkerHyperdriveBinding {
|
|
545
|
+
type: 'hyperdrive';
|
|
546
|
+
name: string;
|
|
547
|
+
id: string;
|
|
548
|
+
}
|
|
543
549
|
/** Everything `uploadScript` accepts in `bindings`. Secrets are not here: see `setSecrets`. */
|
|
544
|
-
export type WorkerBinding = WorkerRateLimitBinding | WorkerKvBinding | WorkerPlainTextBinding | WorkerDurableObjectBinding;
|
|
550
|
+
export type WorkerBinding = WorkerRateLimitBinding | WorkerKvBinding | WorkerPlainTextBinding | WorkerDurableObjectBinding | WorkerHyperdriveBinding;
|
|
545
551
|
/** A Durable Object migration applied with the upload. `oldTag` is the tag the
|
|
546
552
|
* live script holds now (omit for a script with none): Cloudflare refuses the
|
|
547
553
|
* upload when it is not. Send only the steps not yet applied. */
|
|
@@ -776,6 +782,30 @@ export interface EnsureRequestHeaderStripResponse {
|
|
|
776
782
|
/** Cloudflare's rule id. */
|
|
777
783
|
id: string;
|
|
778
784
|
}
|
|
785
|
+
/** A Hyperdrive config's origin: a private database reached over a Cloudflare Tunnel hostname with an Access service token. */
|
|
786
|
+
export interface HyperdriveOrigin {
|
|
787
|
+
/** The tunnel's public hostname, lower case, with no scheme, port or path. */
|
|
788
|
+
host: string;
|
|
789
|
+
/** 1 to 63 printable characters. */
|
|
790
|
+
database: string;
|
|
791
|
+
/** 1 to 63 printable characters. */
|
|
792
|
+
user: string;
|
|
793
|
+
/** Goes to Cloudflare and is never stored, returned, audited or logged. */
|
|
794
|
+
password: string;
|
|
795
|
+
/** The Access service token's client id. */
|
|
796
|
+
accessClientId: string;
|
|
797
|
+
/** The Access service token's secret. Goes to Cloudflare and is never stored, returned, audited or logged. */
|
|
798
|
+
accessClientSecret: string;
|
|
799
|
+
}
|
|
800
|
+
export interface UpsertHyperdriveRequest {
|
|
801
|
+
/** Names the config: the key that makes a repeat safe. 1 to 63 letters, digits, dashes or underscores, starting with a letter or digit. */
|
|
802
|
+
name: string;
|
|
803
|
+
origin: HyperdriveOrigin;
|
|
804
|
+
}
|
|
805
|
+
export interface UpsertHyperdriveResponse {
|
|
806
|
+
/** Cloudflare's config id: what a `hyperdrive` Worker binding takes. */
|
|
807
|
+
id: string;
|
|
808
|
+
}
|
|
779
809
|
export interface AdoptRateLimitRuleEntry {
|
|
780
810
|
zoneId: string;
|
|
781
811
|
/** Match the live rule by description, by id, or both. At least one is needed. */
|