@wtfalch/edge 0.11.0 → 0.12.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 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, CreatePlatformTunnelRequest, CreatePlatformWorkerRouteRequest, CreatePlatformZoneRequest, EnsureAccessProviderRequest, FindServiceTokenResponse, ListClaimsResponse, ListGatesResponse, ListPlatformAccessAppsRequest, ListPlatformAccessAppsResponse, ListPlatformAccessPoliciesResponse, ListPlatformRateLimitRulesRequest, ListPlatformRateLimitRulesResponse, ListPlatformRecordsRequest, ListPlatformRecordsResponse, ListPlatformTunnelsResponse, ListPlatformWorkerRoutesRequest, ListPlatformWorkerRoutesResponse, ListPlatformWorkerScriptsResponse, ListPlatformZonesRequest, ListPlatformZonesResponse, ListRecordsResponse, MintKeyRequest, MintKeyResponse, NameClaim, OrgSettingsRequest, PlatformAccessAppView, PlatformAccessPolicyView, PlatformGateView, PlatformRateLimitRuleView, PlatformRecordView, PlatformTunnelView, PlatformWorkerRouteView, PlatformWorkerScriptView, PlatformZoneView, PutPlatformTunnelConfigRequest, RecordInput, RecordPatch, RecordView, ReplacePlatformGateHostnamesRequest, 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, FindServiceTokenResponse, ListClaimsResponse, ListGatesResponse, ListPlatformAccessAppsRequest, ListPlatformAccessAppsResponse, ListPlatformAccessPoliciesResponse, ListPlatformRateLimitRulesRequest, ListPlatformRateLimitRulesResponse, ListPlatformRecordsRequest, ListPlatformRecordsResponse, ListPlatformTunnelsResponse, ListPlatformWorkerRoutesRequest, ListPlatformWorkerRoutesResponse, ListPlatformWorkerScriptsResponse, ListPlatformZonesRequest, ListPlatformZonesResponse, ListRecordsResponse, MintKeyRequest, MintKeyResponse, NameClaim, OrgSettingsRequest, PlatformAccessAppView, PlatformAccessPolicyView, PlatformGateView, PlatformRateLimitRuleView, PlatformRecordView, PlatformTunnelView, PlatformWorkerRouteView, PlatformWorkerScriptView, PlatformZoneView, PutPlatformTunnelConfigRequest, RecordInput, RecordPatch, RecordView, ReplacePlatformGateHostnamesRequest, SetGatePeopleResponse, SetPlatformWorkerSchedulesRequest, SetPlatformWorkerSchedulesResponse, SetPlatformWorkerSecretsRequest, SetPlatformWorkerSecretsResponse, TokenResponse, UpdatePlatformRecordRequest, UploadPlatformWorkerScriptRequest } 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
@@ -90,6 +90,15 @@ export declare function createEdgeClient(options: ClientOptions): {
90
90
  /** A service token's id by exact name; `token` is `null` when none has
91
91
  * it. Read-only: the secret is never returned. */
92
92
  findServiceToken: (name: string) => Promise<FindServiceTokenResponse>;
93
+ /** Makes a service token that never expires and returns its client id
94
+ * and secret, once; edge keeps neither. Rejects with `conflict` when a token of that name
95
+ * exists at Cloudflare. After a lost reply the token exists but the
96
+ * secret is gone: `findServiceToken(name)`, `removeServiceToken(id)`,
97
+ * then create again. */
98
+ createServiceToken: (input: CreatePlatformServiceTokenRequest) => Promise<CreatePlatformServiceTokenResponse>;
99
+ /** Deletes a service token edge made; any other rejects with `not_found`.
100
+ * One already gone at Cloudflare counts as deleted. */
101
+ removeServiceToken: (id: string) => Promise<void>;
93
102
  /** Writes platform rows for the live apps named. Nothing is deleted or
94
103
  * recreated, and an app nobody names is left alone. */
95
104
  adopt: (input: AdoptAccessAppsRequest) => Promise<AdoptAccessAppsResponse>;
package/dist/client.js CHANGED
@@ -95,6 +95,15 @@ export function createEdgeClient(options) {
95
95
  /** A service token's id by exact name; `token` is `null` when none has
96
96
  * it. Read-only: the secret is never returned. */
97
97
  findServiceToken: (name) => call('GET', `/v1/platform/access/service-tokens?${new URLSearchParams({ name })}`),
98
+ /** Makes a service token that never expires and returns its client id
99
+ * and secret, once; edge keeps neither. Rejects with `conflict` when a token of that name
100
+ * exists at Cloudflare. After a lost reply the token exists but the
101
+ * secret is gone: `findServiceToken(name)`, `removeServiceToken(id)`,
102
+ * then create again. */
103
+ createServiceToken: (input) => call('POST', '/v1/platform/access/service-tokens', input),
104
+ /** Deletes a service token edge made; any other rejects with `not_found`.
105
+ * One already gone at Cloudflare counts as deleted. */
106
+ removeServiceToken: (id) => call('DELETE', `/v1/platform/access/service-tokens/${encodeURIComponent(id)}`),
98
107
  /** Writes platform rows for the live apps named. Nothing is deleted or
99
108
  * recreated, and an app nobody names is left alone. */
100
109
  adopt: (input) => call('POST', '/v1/platform/access/apps/adopt', input),
package/dist/types.d.ts CHANGED
@@ -443,6 +443,18 @@ export interface FindServiceTokenResponse {
443
443
  name: string;
444
444
  } | null;
445
445
  }
446
+ export interface CreatePlatformServiceTokenRequest {
447
+ name: string;
448
+ }
449
+ /** `clientId` and `clientSecret` are shown once, here. Edge keeps neither and cannot return them again. */
450
+ export interface CreatePlatformServiceTokenResponse {
451
+ token: {
452
+ id: string;
453
+ name: string;
454
+ };
455
+ clientId: string;
456
+ clientSecret: string;
457
+ }
446
458
  export interface AdoptAccessAppEntry {
447
459
  name: string;
448
460
  /** Narrows several apps of one name. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/edge",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Public client SDK and API types for the edge service.",