@w6w/sdk 0.3.0 → 0.5.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 +5 -5
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +2 -2
- package/dist/src/client.d.ts +34 -6
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +34 -5
- package/dist/src/client.js.map +1 -1
- package/dist/src/config.d.ts +2 -2
- package/dist/src/config.js +2 -2
- package/dist/src/connections.d.ts +2 -2
- package/dist/src/connections.js +1 -1
- package/dist/src/console/api-calls.d.ts +80 -0
- package/dist/src/console/api-calls.d.ts.map +1 -0
- package/dist/src/console/api-calls.js +69 -0
- package/dist/src/console/api-calls.js.map +1 -0
- package/dist/src/console/apps.d.ts +689 -0
- package/dist/src/console/apps.d.ts.map +1 -0
- package/dist/src/console/apps.js +402 -0
- package/dist/src/console/apps.js.map +1 -0
- package/dist/src/console/auth.d.ts +241 -0
- package/dist/src/console/auth.d.ts.map +1 -0
- package/dist/src/console/auth.js +173 -0
- package/dist/src/console/auth.js.map +1 -0
- package/dist/src/console/connections.d.ts +188 -0
- package/dist/src/console/connections.d.ts.map +1 -0
- package/dist/src/console/connections.js +182 -0
- package/dist/src/console/connections.js.map +1 -0
- package/dist/src/console/dashboard.d.ts +102 -0
- package/dist/src/console/dashboard.d.ts.map +1 -0
- package/dist/src/console/dashboard.js +59 -0
- package/dist/src/console/dashboard.js.map +1 -0
- package/dist/src/console/endpoints.d.ts +264 -0
- package/dist/src/console/endpoints.d.ts.map +1 -0
- package/dist/src/console/endpoints.js +164 -0
- package/dist/src/console/endpoints.js.map +1 -0
- package/dist/src/console/functions.d.ts +165 -0
- package/dist/src/console/functions.d.ts.map +1 -0
- package/dist/src/console/functions.js +117 -0
- package/dist/src/console/functions.js.map +1 -0
- package/dist/src/console/mod.d.ts +131 -0
- package/dist/src/console/mod.d.ts.map +1 -0
- package/dist/src/console/mod.js +121 -0
- package/dist/src/console/mod.js.map +1 -0
- package/dist/src/console/projects.d.ts +107 -0
- package/dist/src/console/projects.d.ts.map +1 -0
- package/dist/src/console/projects.js +97 -0
- package/dist/src/console/projects.js.map +1 -0
- package/dist/src/console/reliability.d.ts +149 -0
- package/dist/src/console/reliability.d.ts.map +1 -0
- package/dist/src/console/reliability.js +56 -0
- package/dist/src/console/reliability.js.map +1 -0
- package/dist/src/console/saved-tests.d.ts +198 -0
- package/dist/src/console/saved-tests.d.ts.map +1 -0
- package/dist/src/console/saved-tests.js +172 -0
- package/dist/src/console/saved-tests.js.map +1 -0
- package/dist/src/console/schedules.d.ts +127 -0
- package/dist/src/console/schedules.d.ts.map +1 -0
- package/dist/src/console/schedules.js +118 -0
- package/dist/src/console/schedules.js.map +1 -0
- package/dist/src/console/step-tests.d.ts +159 -0
- package/dist/src/console/step-tests.d.ts.map +1 -0
- package/dist/src/console/step-tests.js +129 -0
- package/dist/src/console/step-tests.js.map +1 -0
- package/dist/src/console/subscriptions.d.ts +199 -0
- package/dist/src/console/subscriptions.d.ts.map +1 -0
- package/dist/src/console/subscriptions.js +191 -0
- package/dist/src/console/subscriptions.js.map +1 -0
- package/dist/src/console/tenant-oauth-apps.d.ts +188 -0
- package/dist/src/console/tenant-oauth-apps.d.ts.map +1 -0
- package/dist/src/console/tenant-oauth-apps.js +152 -0
- package/dist/src/console/tenant-oauth-apps.js.map +1 -0
- package/dist/src/console/tokens.d.ts +159 -0
- package/dist/src/console/tokens.d.ts.map +1 -0
- package/dist/src/console/tokens.js +145 -0
- package/dist/src/console/tokens.js.map +1 -0
- package/dist/src/console/vault.d.ts +188 -0
- package/dist/src/console/vault.d.ts.map +1 -0
- package/dist/src/console/vault.js +164 -0
- package/dist/src/console/vault.js.map +1 -0
- package/dist/src/console/workflows.d.ts +243 -0
- package/dist/src/console/workflows.d.ts.map +1 -0
- package/dist/src/console/workflows.js +205 -0
- package/dist/src/console/workflows.js.map +1 -0
- package/dist/src/documents.d.ts +2 -2
- package/dist/src/documents.js +1 -1
- package/dist/src/http.d.ts +32 -2
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +11 -2
- package/dist/src/http.js.map +1 -1
- package/dist/src/me.d.ts +2 -2
- package/dist/src/me.js +1 -1
- package/dist/src/run.d.ts +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/vars.d.ts +2 -2
- package/dist/src/vars.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workflows.d.ts +2 -2
- package/dist/src/workflows.js +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -33,9 +33,9 @@ same set of operations in every language.
|
|
|
33
33
|
## Quick start
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
-
import {
|
|
36
|
+
import { W6WClient, isActionRun, isFunctionRun, isWorkflowRun } from "@w6w/sdk";
|
|
37
37
|
|
|
38
|
-
const client = new
|
|
38
|
+
const client = new W6WClient(); // reads W6W_BASE_URL and W6W_TOKEN
|
|
39
39
|
|
|
40
40
|
// Who am I, and what versions am I talking to?
|
|
41
41
|
const me = await client.me();
|
|
@@ -121,13 +121,13 @@ interference. There is no default base URL — a client built without one and wi
|
|
|
121
121
|
raises a configuration error naming the variable.
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
|
-
import {
|
|
124
|
+
import { W6WClient } from "@w6w/sdk";
|
|
125
125
|
|
|
126
126
|
// Everything from the environment.
|
|
127
|
-
const client = new
|
|
127
|
+
const client = new W6WClient();
|
|
128
128
|
|
|
129
129
|
// Explicit arguments override W6W_BASE_URL and W6W_TOKEN.
|
|
130
|
-
const other = new
|
|
130
|
+
const other = new W6WClient({ baseUrl: "https://api.example.com", token: "…" });
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
### `W6W_BASE_URL` is an origin
|
package/dist/mod.d.ts
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
17
|
export { VERSION } from "./src/version.ts";
|
|
18
|
-
export {
|
|
18
|
+
export { W6WClient } from "./src/client.ts";
|
|
19
19
|
export { ApiError, ConfigError } from "./src/errors.ts";
|
|
20
|
-
export { BASE_PATH, type FetchLike, joinBaseUrl, type ResolvedConfig, type
|
|
20
|
+
export { BASE_PATH, type FetchLike, joinBaseUrl, type ResolvedConfig, type W6WClientOptions, } from "./src/config.ts";
|
|
21
21
|
export type { HttpMethod, HttpResponse, QueryParams, RequestOptions } from "./src/http.ts";
|
|
22
22
|
export { path } from "./src/http.ts";
|
|
23
23
|
export { DocumentsApi } from "./src/documents.ts";
|
package/dist/mod.js
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export { VERSION } from "./src/version.js";
|
|
18
18
|
// Transport core (T2.1.2): the client, its configuration and the error model.
|
|
19
|
-
export {
|
|
19
|
+
export { W6WClient } from "./src/client.js";
|
|
20
20
|
export { ApiError, ConfigError } from "./src/errors.js";
|
|
21
21
|
export { BASE_PATH, joinBaseUrl, } from "./src/config.js";
|
|
22
|
-
// Exported because `
|
|
22
|
+
// Exported because `W6WClient.request` is public: a host reaching an endpoint
|
|
23
23
|
// this version does not model yet must have the same encoding-at-interpolation
|
|
24
24
|
// tag the operation modules use, or it will concatenate a caller value into a
|
|
25
25
|
// path by hand — the one bug the encoding pin exists to prevent.
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `
|
|
2
|
+
* `W6WClient` — the object every operation hangs off.
|
|
3
3
|
*
|
|
4
4
|
* It holds three things and no behaviour of its own: the resolved
|
|
5
5
|
* configuration, the transport, and (from T2.1.3 onward) the operation
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
|
-
import { type ResolvedConfig, type
|
|
17
|
+
import { type ResolvedConfig, type W6WClientOptions } from "./config.ts";
|
|
18
18
|
import { ConnectionsApi } from "./connections.ts";
|
|
19
|
+
import { ConsoleApi } from "./console/mod.ts";
|
|
19
20
|
import { DocumentsApi } from "./documents.ts";
|
|
20
21
|
import { type HttpResponse, type RequestOptions } from "./http.ts";
|
|
21
22
|
import { type RunInput } from "./run.ts";
|
|
@@ -33,14 +34,14 @@ import { WorkflowsApi } from "./workflows.ts";
|
|
|
33
34
|
* @example
|
|
34
35
|
* ```ts
|
|
35
36
|
* // From the environment.
|
|
36
|
-
* const client = new
|
|
37
|
+
* const client = new W6WClient();
|
|
37
38
|
*
|
|
38
39
|
* // Explicit, overriding the environment. Two clients, two credentials, one
|
|
39
40
|
* // process — no interference.
|
|
40
|
-
* const other = new
|
|
41
|
+
* const other = new W6WClient({ baseUrl: "https://api.example.com", token: "t_2" });
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
|
-
export declare class
|
|
44
|
+
export declare class W6WClient {
|
|
44
45
|
#private;
|
|
45
46
|
/**
|
|
46
47
|
* The resolved base URL, credential and default project. Exposed read-only
|
|
@@ -77,11 +78,38 @@ export declare class W6wClient {
|
|
|
77
78
|
* `@w6w/trigger` step and read downstream as `steps.<triggerId>.output.<key>`.
|
|
78
79
|
*/
|
|
79
80
|
readonly workflows: WorkflowsApi;
|
|
81
|
+
/**
|
|
82
|
+
* Console-only namespaces: `console.reliability.list`, `console.auth.*`
|
|
83
|
+
* (`login`, `signup`, `checkAccountSlug`, `createAccount`),
|
|
84
|
+
* `console.dashboard.stats`, `console.projects.*` (`list`, `create`,
|
|
85
|
+
* `delete`), `console.schedules.*` (`get`, `upsert`, `delete`),
|
|
86
|
+
* `console.apps.*` (`list`, `get`, `getAuth`, `getActions`, `getTriggers`,
|
|
87
|
+
* `getHealth`, `getHealthStatus`, `listOAuthConfig`, `upsertOAuthConfig`,
|
|
88
|
+
* `deleteOAuthConfig`, `startOAuthFlow`, `preview`, `import`, `refresh`,
|
|
89
|
+
* `invoke`, `delete`), `console.connections.*` (`listForApp`, `get`,
|
|
90
|
+
* `create`, `update`, `test`, `delete`), `console.workflows.*` (`get`,
|
|
91
|
+
* `upsert`, `archive`, `delete`, `listRuns`, `getRun`),
|
|
92
|
+
* `console.savedTests.*` (`list`, `create`, `update`, `delete`,
|
|
93
|
+
* `recordTestRun`, `listTestRuns`), `console.stepTests.*` (`save`,
|
|
94
|
+
* `list`, `recordRun`), `console.vault.*` (`list`, `get`, `create`,
|
|
95
|
+
* `update`, `delete`, `seal`), `console.tokens.*` (`list`, `create`,
|
|
96
|
+
* `disable`, `enable`, `revoke`), `console.functions.*` (`list`, `get`,
|
|
97
|
+
* `upsert`), `console.endpoints.*` (`list`, `get`, `upsert`, `invoke`),
|
|
98
|
+
* `console.subscriptions.*` (`list`, `listForWorkflow`, `get`, `create`,
|
|
99
|
+
* `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`) and
|
|
100
|
+
* `console.tenantOAuthApps.*` (`list`, `put`, `remove`).
|
|
101
|
+
* Studio-internal and unstable — not part of the published partner
|
|
102
|
+
* contract, excluded from `endpoints.json` and from this package's root
|
|
103
|
+
* barrel (`docs/console.md`, HITL-1). Reached only through
|
|
104
|
+
* `@w6w/sdk/console`'s re-exports, and constructed with the transport only,
|
|
105
|
+
* exactly like `vars` and `connections`.
|
|
106
|
+
*/
|
|
107
|
+
readonly console: ConsoleApi;
|
|
80
108
|
/**
|
|
81
109
|
* @param options - Explicit configuration; anything omitted falls back to the environment.
|
|
82
110
|
* @throws {ConfigError} When no base URL is configured, or the host has no `fetch`.
|
|
83
111
|
*/
|
|
84
|
-
constructor(options?:
|
|
112
|
+
constructor(options?: W6WClientOptions);
|
|
85
113
|
/**
|
|
86
114
|
* Who this client's credential says you are, plus the versions of the
|
|
87
115
|
* components that answered.
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,cAAc,EACn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AAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,SAAS;;IACpB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IAErC;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAI7B;;;OAGG;gBACS,OAAO,GAAE,gBAAqB;IA6B1C;;;;;;;;;;;;;OAaG;IACH,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC;IAIjB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;IAI1C;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAG9D"}
|
package/dist/src/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `
|
|
2
|
+
* `W6WClient` — the object every operation hangs off.
|
|
3
3
|
*
|
|
4
4
|
* It holds three things and no behaviour of its own: the resolved
|
|
5
5
|
* configuration, the transport, and (from T2.1.3 onward) the operation
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { resolveConfig, } from "./config.js";
|
|
18
18
|
import { ConnectionsApi } from "./connections.js";
|
|
19
|
+
import { ConsoleApi } from "./console/mod.js";
|
|
19
20
|
import { DocumentsApi } from "./documents.js";
|
|
20
21
|
import { ConfigError } from "./errors.js";
|
|
21
22
|
import { request } from "./http.js";
|
|
@@ -34,14 +35,14 @@ import { WorkflowsApi } from "./workflows.js";
|
|
|
34
35
|
* @example
|
|
35
36
|
* ```ts
|
|
36
37
|
* // From the environment.
|
|
37
|
-
* const client = new
|
|
38
|
+
* const client = new W6WClient();
|
|
38
39
|
*
|
|
39
40
|
* // Explicit, overriding the environment. Two clients, two credentials, one
|
|
40
41
|
* // process — no interference.
|
|
41
|
-
* const other = new
|
|
42
|
+
* const other = new W6WClient({ baseUrl: "https://api.example.com", token: "t_2" });
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
|
-
export class
|
|
45
|
+
export class W6WClient {
|
|
45
46
|
/**
|
|
46
47
|
* The resolved base URL, credential and default project. Exposed read-only
|
|
47
48
|
* so a host can log *which server* it is talking to without re-deriving the
|
|
@@ -77,6 +78,33 @@ export class W6wClient {
|
|
|
77
78
|
* `@w6w/trigger` step and read downstream as `steps.<triggerId>.output.<key>`.
|
|
78
79
|
*/
|
|
79
80
|
workflows;
|
|
81
|
+
/**
|
|
82
|
+
* Console-only namespaces: `console.reliability.list`, `console.auth.*`
|
|
83
|
+
* (`login`, `signup`, `checkAccountSlug`, `createAccount`),
|
|
84
|
+
* `console.dashboard.stats`, `console.projects.*` (`list`, `create`,
|
|
85
|
+
* `delete`), `console.schedules.*` (`get`, `upsert`, `delete`),
|
|
86
|
+
* `console.apps.*` (`list`, `get`, `getAuth`, `getActions`, `getTriggers`,
|
|
87
|
+
* `getHealth`, `getHealthStatus`, `listOAuthConfig`, `upsertOAuthConfig`,
|
|
88
|
+
* `deleteOAuthConfig`, `startOAuthFlow`, `preview`, `import`, `refresh`,
|
|
89
|
+
* `invoke`, `delete`), `console.connections.*` (`listForApp`, `get`,
|
|
90
|
+
* `create`, `update`, `test`, `delete`), `console.workflows.*` (`get`,
|
|
91
|
+
* `upsert`, `archive`, `delete`, `listRuns`, `getRun`),
|
|
92
|
+
* `console.savedTests.*` (`list`, `create`, `update`, `delete`,
|
|
93
|
+
* `recordTestRun`, `listTestRuns`), `console.stepTests.*` (`save`,
|
|
94
|
+
* `list`, `recordRun`), `console.vault.*` (`list`, `get`, `create`,
|
|
95
|
+
* `update`, `delete`, `seal`), `console.tokens.*` (`list`, `create`,
|
|
96
|
+
* `disable`, `enable`, `revoke`), `console.functions.*` (`list`, `get`,
|
|
97
|
+
* `upsert`), `console.endpoints.*` (`list`, `get`, `upsert`, `invoke`),
|
|
98
|
+
* `console.subscriptions.*` (`list`, `listForWorkflow`, `get`, `create`,
|
|
99
|
+
* `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`) and
|
|
100
|
+
* `console.tenantOAuthApps.*` (`list`, `put`, `remove`).
|
|
101
|
+
* Studio-internal and unstable — not part of the published partner
|
|
102
|
+
* contract, excluded from `endpoints.json` and from this package's root
|
|
103
|
+
* barrel (`docs/console.md`, HITL-1). Reached only through
|
|
104
|
+
* `@w6w/sdk/console`'s re-exports, and constructed with the transport only,
|
|
105
|
+
* exactly like `vars` and `connections`.
|
|
106
|
+
*/
|
|
107
|
+
console;
|
|
80
108
|
#fetch;
|
|
81
109
|
/**
|
|
82
110
|
* @param options - Explicit configuration; anything omitted falls back to the environment.
|
|
@@ -91,7 +119,7 @@ export class W6wClient {
|
|
|
91
119
|
const global = globalThis.fetch;
|
|
92
120
|
if (typeof global !== "function") {
|
|
93
121
|
throw new ConfigError("This runtime has no global fetch. Pass an implementation " +
|
|
94
|
-
"(new
|
|
122
|
+
"(new W6WClient({ fetch })) or run on Node 18+, Deno or Bun.");
|
|
95
123
|
}
|
|
96
124
|
// Bound, so the default keeps working when it is called as a bare
|
|
97
125
|
// function reference rather than as a method of the global object.
|
|
@@ -106,6 +134,7 @@ export class W6wClient {
|
|
|
106
134
|
this.vars = new VarsApi(this);
|
|
107
135
|
this.connections = new ConnectionsApi(this);
|
|
108
136
|
this.workflows = new WorkflowsApi(this);
|
|
137
|
+
this.console = new ConsoleApi(this);
|
|
109
138
|
}
|
|
110
139
|
/**
|
|
111
140
|
* Who this client's credential says you are, plus the versions of the
|
package/dist/src/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAqB,OAAO,EAAuB,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAiB,MAAM,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,SAAS;IACpB;;;;OAIG;IACM,MAAM,CAAiB;IAEhC;;;;OAIG;IACM,SAAS,CAAe;IAEjC;;;;;OAKG;IACM,IAAI,CAAU;IAEvB;;;;OAIG;IACM,WAAW,CAAiB;IAErC;;;;;;;;OAQG;IACM,SAAS,CAAe;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,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iE;QACjE,2EAA2E;QAC3E,0EAA0E;QAC1E,2DAA2D;QAC3D,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,EAAE;QACA,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,KAAe;QACjB,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAI,OAAuB;QAChC,OAAO,OAAO,CAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF"}
|
package/dist/src/config.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const BASE_PATH = "";
|
|
|
32
32
|
*/
|
|
33
33
|
export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
34
34
|
/** Constructor options for a client. Every field is optional. */
|
|
35
|
-
export interface
|
|
35
|
+
export interface W6WClientOptions {
|
|
36
36
|
/**
|
|
37
37
|
* The **origin** of the w6w server, e.g. `https://api.example.com`. The API
|
|
38
38
|
* is served at its root, so no path is appended. It must be an absolute
|
|
@@ -137,7 +137,7 @@ export declare function joinBaseUrl(origin: string): string;
|
|
|
137
137
|
* @returns The resolved configuration.
|
|
138
138
|
* @throws {ConfigError} When no usable base URL was supplied, naming `W6W_BASE_URL`.
|
|
139
139
|
*/
|
|
140
|
-
export declare function resolveConfig(options?:
|
|
140
|
+
export declare function resolveConfig(options?: W6WClientOptions): ResolvedConfig;
|
|
141
141
|
/**
|
|
142
142
|
* The token, or a {@linkcode ConfigError} naming `W6W_TOKEN`.
|
|
143
143
|
*
|
package/dist/src/config.js
CHANGED
|
@@ -84,7 +84,7 @@ export function joinBaseUrl(origin) {
|
|
|
84
84
|
const trimmed = origin.trim().replace(/\/+$/, "");
|
|
85
85
|
if (trimmed.length === 0) {
|
|
86
86
|
throw new ConfigError("No w6w base URL is configured. Pass one to the client " +
|
|
87
|
-
'(new
|
|
87
|
+
'(new W6WClient({ baseUrl: "https://api.example.com" })) or set the ' +
|
|
88
88
|
`${ENV_BASE_URL} environment variable. It holds the server's origin, ` +
|
|
89
89
|
"e.g. \"https://api.example.com\" — the API is served at its root, so no " +
|
|
90
90
|
"path is appended.");
|
|
@@ -161,7 +161,7 @@ export function resolveConfig(options = {}) {
|
|
|
161
161
|
export function requireToken(config) {
|
|
162
162
|
if (config.token === null || config.token.trim().length === 0) {
|
|
163
163
|
throw new ConfigError("No w6w API token is configured. Pass one to the client " +
|
|
164
|
-
'(new
|
|
164
|
+
'(new W6WClient({ token: "…" })) or set the ' +
|
|
165
165
|
`${ENV_TOKEN} environment variable. Every w6w API operation is authenticated.`);
|
|
166
166
|
}
|
|
167
167
|
return config.token;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import type { HttpResponse, RequestOptions } from "./http.ts";
|
|
23
23
|
import { type ConnectionSummary } from "./types.ts";
|
|
24
24
|
/**
|
|
25
|
-
* The slice of `
|
|
25
|
+
* The slice of `W6WClient` this namespace needs: the transport, and nothing
|
|
26
26
|
* else. Connections carry no `?project=` — the server scopes them by
|
|
27
27
|
* tenant/account from the credential — so, as with `vars`, this host cannot
|
|
28
28
|
* reach the client's configuration to send a scope even by accident.
|
|
@@ -32,7 +32,7 @@ export interface ConnectionsHost {
|
|
|
32
32
|
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* The `connections` namespace on a `
|
|
35
|
+
* The `connections` namespace on a `W6WClient`.
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```ts
|
package/dist/src/connections.js
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.console.apiCalls.*` — the outbound API call log behind a run,
|
|
3
|
+
* relocated from the studio's own API client.
|
|
4
|
+
*
|
|
5
|
+
* **Studio-internal, not the published partner contract.** This namespace
|
|
6
|
+
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
7
|
+
* `endpoints.json` and from the root barrel (`mod.ts`) — see `docs/console.md`
|
|
8
|
+
* and HITL-1 in this task's contract. `@w6w/sdk`'s instance-state mechanism
|
|
9
|
+
* pin still applies here exactly as it does to every other namespace
|
|
10
|
+
* (`docs/implementation.md` §MECHANISM PIN — instance state, never globals):
|
|
11
|
+
* this class holds no state of its own beyond the injected host, so two
|
|
12
|
+
* clients in one process never share a credential.
|
|
13
|
+
*
|
|
14
|
+
* One method: `list`, relocated from `client.ts:214-231`'s `listApiCalls` —
|
|
15
|
+
* which lived under the `client.ts` `// Apps` comment block despite having no
|
|
16
|
+
* apps-domain consumer (its only caller is reliability's drill-down page).
|
|
17
|
+
*
|
|
18
|
+
* **`ApiCallRecord` is REUSED from `console.apps`, never redefined.**
|
|
19
|
+
* `console/apps.ts` already declares it (used internally by `AppsApi.invoke`'s
|
|
20
|
+
* result type) and `console/mod.ts` already re-exports it — this module
|
|
21
|
+
* imports it as a type and uses it verbatim as `list`'s return element type.
|
|
22
|
+
*
|
|
23
|
+
* `api-calls` is scoped to the caller by the server's own repo, not by a
|
|
24
|
+
* `project` query param — so `ApiCallsHost` needs only the transport,
|
|
25
|
+
* mirroring `VarsHost`/`ProjectsHost`, not `DocumentsHost`.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import type { HttpResponse, RequestOptions } from "../http.ts";
|
|
30
|
+
import type { ApiCallRecord } from "./apps.ts";
|
|
31
|
+
export type { ApiCallRecord } from "./apps.ts";
|
|
32
|
+
/**
|
|
33
|
+
* The slice of `W6WClient` this namespace needs: the transport, and nothing
|
|
34
|
+
* else. Structural rather than a concrete client type, so the namespace stays
|
|
35
|
+
* independently constructible in a test and this module never imports the
|
|
36
|
+
* client back — mirrors `VarsHost` in `../vars.ts`.
|
|
37
|
+
*/
|
|
38
|
+
export interface ApiCallsHost {
|
|
39
|
+
/** Perform one request. */
|
|
40
|
+
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Optional filter for `list`. All fields optional; omitted or `undefined`
|
|
44
|
+
* fields are not sent as query params — mirrors `client.ts:214-231`'s default
|
|
45
|
+
* `{}` parameter and its `Object.entries` loop that skips `undefined`/`""`
|
|
46
|
+
* values.
|
|
47
|
+
*/
|
|
48
|
+
export interface ApiCallsFilter {
|
|
49
|
+
appId?: string;
|
|
50
|
+
actionKey?: string;
|
|
51
|
+
connectionId?: string;
|
|
52
|
+
sessionId?: string;
|
|
53
|
+
/** Server defaults to 25 when unset/invalid, caps at 200. */
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The `console.apiCalls` namespace on a `W6WClient`.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const calls = await client.console.apiCalls.list({ appId: "app_x", limit: 50 });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare class ApiCallsApi {
|
|
65
|
+
#private;
|
|
66
|
+
/**
|
|
67
|
+
* @param host - The client this namespace issues requests through.
|
|
68
|
+
*/
|
|
69
|
+
constructor(host: ApiCallsHost);
|
|
70
|
+
/**
|
|
71
|
+
* List outbound API calls, newest first. Filter by app/action/connection/
|
|
72
|
+
* session.
|
|
73
|
+
*
|
|
74
|
+
* @param filter - Optional filter; omitted entirely, no query params are sent.
|
|
75
|
+
* @returns The calls, unwrapped from the `apiCalls` envelope.
|
|
76
|
+
* @throws {ApiError} On any non-2xx.
|
|
77
|
+
*/
|
|
78
|
+
list(filter?: ApiCallsFilter): Promise<ApiCallRecord[]>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=api-calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-calls.d.ts","sourceRoot":"","sources":["../../../src/console/api-calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK/C,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,qBAAa,WAAW;;IAGtB;;OAEG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAc9D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.console.apiCalls.*` — the outbound API call log behind a run,
|
|
3
|
+
* relocated from the studio's own API client.
|
|
4
|
+
*
|
|
5
|
+
* **Studio-internal, not the published partner contract.** This namespace
|
|
6
|
+
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
7
|
+
* `endpoints.json` and from the root barrel (`mod.ts`) — see `docs/console.md`
|
|
8
|
+
* and HITL-1 in this task's contract. `@w6w/sdk`'s instance-state mechanism
|
|
9
|
+
* pin still applies here exactly as it does to every other namespace
|
|
10
|
+
* (`docs/implementation.md` §MECHANISM PIN — instance state, never globals):
|
|
11
|
+
* this class holds no state of its own beyond the injected host, so two
|
|
12
|
+
* clients in one process never share a credential.
|
|
13
|
+
*
|
|
14
|
+
* One method: `list`, relocated from `client.ts:214-231`'s `listApiCalls` —
|
|
15
|
+
* which lived under the `client.ts` `// Apps` comment block despite having no
|
|
16
|
+
* apps-domain consumer (its only caller is reliability's drill-down page).
|
|
17
|
+
*
|
|
18
|
+
* **`ApiCallRecord` is REUSED from `console.apps`, never redefined.**
|
|
19
|
+
* `console/apps.ts` already declares it (used internally by `AppsApi.invoke`'s
|
|
20
|
+
* result type) and `console/mod.ts` already re-exports it — this module
|
|
21
|
+
* imports it as a type and uses it verbatim as `list`'s return element type.
|
|
22
|
+
*
|
|
23
|
+
* `api-calls` is scoped to the caller by the server's own repo, not by a
|
|
24
|
+
* `project` query param — so `ApiCallsHost` needs only the transport,
|
|
25
|
+
* mirroring `VarsHost`/`ProjectsHost`, not `DocumentsHost`.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import { unwrap } from "../types.js";
|
|
30
|
+
/**
|
|
31
|
+
* The `console.apiCalls` namespace on a `W6WClient`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const calls = await client.console.apiCalls.list({ appId: "app_x", limit: 50 });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export class ApiCallsApi {
|
|
39
|
+
#host;
|
|
40
|
+
/**
|
|
41
|
+
* @param host - The client this namespace issues requests through.
|
|
42
|
+
*/
|
|
43
|
+
constructor(host) {
|
|
44
|
+
this.#host = host;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* List outbound API calls, newest first. Filter by app/action/connection/
|
|
48
|
+
* session.
|
|
49
|
+
*
|
|
50
|
+
* @param filter - Optional filter; omitted entirely, no query params are sent.
|
|
51
|
+
* @returns The calls, unwrapped from the `apiCalls` envelope.
|
|
52
|
+
* @throws {ApiError} On any non-2xx.
|
|
53
|
+
*/
|
|
54
|
+
async list(filter) {
|
|
55
|
+
const res = await this.#host.request({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: "/api-calls",
|
|
58
|
+
query: {
|
|
59
|
+
appId: filter?.appId,
|
|
60
|
+
actionKey: filter?.actionKey,
|
|
61
|
+
connectionId: filter?.connectionId,
|
|
62
|
+
sessionId: filter?.sessionId,
|
|
63
|
+
limit: filter?.limit,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
return unwrap(res, "apiCalls");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=api-calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-calls.js","sourceRoot":"","sources":["../../../src/console/api-calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkCrC;;;;;;;GAOG;AACH,MAAM,OAAO,WAAW;IACb,KAAK,CAAe;IAE7B;;OAEG;IACH,YAAY,IAAkB;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CAAC,MAAuB;QAChC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE;gBACL,KAAK,EAAE,MAAM,EAAE,KAAK;gBACpB,SAAS,EAAE,MAAM,EAAE,SAAS;gBAC5B,YAAY,EAAE,MAAM,EAAE,YAAY;gBAClC,SAAS,EAAE,MAAM,EAAE,SAAS;gBAC5B,KAAK,EAAE,MAAM,EAAE,KAAK;aACrB;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAkB,GAAG,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC;CACF"}
|