@w6w/sdk 0.1.0 → 0.2.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 +90 -8
- package/dist/src/config.d.ts +25 -17
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +26 -18
- package/dist/src/config.js.map +1 -1
- package/dist/src/env.d.ts +6 -4
- package/dist/src/env.d.ts.map +1 -1
- package/dist/src/env.js +6 -4
- package/dist/src/env.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The package is authored as runtime-neutral TypeScript against Web standards (`fe
|
|
|
10
10
|
`URL`, `AbortController`), so the same build runs under Node 18+, Deno and Bun.
|
|
11
11
|
|
|
12
12
|
- **License:** MIT (see [LICENSE](./LICENSE)).
|
|
13
|
-
- **Version:** `0.
|
|
13
|
+
- **Version:** `0.2.0`.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -30,13 +30,89 @@ Both registries publish the **same version at the same time** — `@w6w/sdk`, `@
|
|
|
30
30
|
Python `w6w` package share one version number and are released together. A given version means the
|
|
31
31
|
same set of operations in every language.
|
|
32
32
|
|
|
33
|
+
## Quick start
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { W6wClient, isActionRun, isFunctionRun, isWorkflowRun } from "@w6w/sdk";
|
|
37
|
+
|
|
38
|
+
const client = new W6wClient(); // reads W6W_BASE_URL and W6W_TOKEN
|
|
39
|
+
|
|
40
|
+
// Who am I, and what versions am I talking to?
|
|
41
|
+
const me = await client.me();
|
|
42
|
+
|
|
43
|
+
// What can I run? `run` is addressed by a `conn_…` / `fn_…` / `ep_…` / `wf_…`
|
|
44
|
+
// id — these are how you discover one.
|
|
45
|
+
const connections = await client.connections.list();
|
|
46
|
+
const workflows = await client.workflows.list();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Run a connection action
|
|
50
|
+
|
|
51
|
+
A `conn_…` id resolves to an app action. `run` returns a `kind`-tagged envelope —
|
|
52
|
+
narrow it with `isActionRun` / `isFunctionRun` / `isWorkflowRun` before reading a field, since the
|
|
53
|
+
three arms use different field names on purpose (`value` vs `output` vs `runId`+`status`):
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const env = await client.run({
|
|
57
|
+
urn: connections[0].id, // "conn_…"
|
|
58
|
+
action: "send_message", // which of the app's actions to invoke
|
|
59
|
+
payload: { channel: "#general", text: "Hello from @w6w/sdk" },
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (isActionRun(env)) console.log(env.value); // the action's return value
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Run a function or an endpoint
|
|
66
|
+
|
|
67
|
+
`fn_…` and `ep_…` ids run the same way — no `action`, since a function or endpoint has exactly one
|
|
68
|
+
operation:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const env = await client.run({ urn: "fn_normalize_address", payload: { address: "1 Infinite Loop" } });
|
|
72
|
+
if (isFunctionRun(env)) console.log(env.output);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Run a workflow
|
|
76
|
+
|
|
77
|
+
Two ways to start a `wf_…` run. `client.run()` dispatches it like anything else and always answers
|
|
78
|
+
`202` (queued) — use it when you're treating workflows the same as any other runnable URN:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const env = await client.run({ urn: workflows[0].id, payload: { customerId: "cus_1" } });
|
|
82
|
+
if (isWorkflowRun(env)) console.log(env.runId, env.status); // "queued"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`workflows.run` is the typed path, and the only one that can wait for the result server-side:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const run = await client.workflows.run(workflows[0].id, {
|
|
89
|
+
wait: true,
|
|
90
|
+
variables: { customerId: "cus_1" },
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// A failed run is data, not a thrown error — `run.terminal` tells you it's done.
|
|
94
|
+
if (run.terminal && run.status === "failed") console.error(run.error);
|
|
95
|
+
else if (run.terminal) console.log(run.output);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Documents and vars
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const doc = await client.documents.create({ key: "welcome", content: "# Hi" });
|
|
102
|
+
await client.documents.update(doc.id, { content: "# Hello" });
|
|
103
|
+
await client.documents.delete(doc.id);
|
|
104
|
+
|
|
105
|
+
const v = await client.vars.create({ name: "sender_email", type: "string", value: "a@b.c" });
|
|
106
|
+
await client.vars.update(v.id, { value: "c@d.e" });
|
|
107
|
+
```
|
|
108
|
+
|
|
33
109
|
## Configuration
|
|
34
110
|
|
|
35
111
|
Two environment variables, both read only at client construction:
|
|
36
112
|
|
|
37
113
|
| Variable | Meaning | Required |
|
|
38
114
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
39
|
-
| `W6W_BASE_URL` | The **origin** of your w6w server, e.g. `https://api.example.com`. The API
|
|
115
|
+
| `W6W_BASE_URL` | The **origin** of your w6w server, e.g. `https://api.example.com`. The API is served at the root of that host, so nothing is appended. | Yes |
|
|
40
116
|
| `W6W_TOKEN` | The bearer token, sent as `Authorization: Bearer <token>` on every request. | Yes |
|
|
41
117
|
|
|
42
118
|
Explicit constructor arguments always win over the environment, and credentials are **instance
|
|
@@ -56,15 +132,21 @@ const other = new W6wClient({ baseUrl: "https://api.example.com", token: "…" }
|
|
|
56
132
|
|
|
57
133
|
### `W6W_BASE_URL` is an origin
|
|
58
134
|
|
|
59
|
-
The
|
|
60
|
-
|
|
135
|
+
The API is served at the **root** of its own host — `https://api.example.com/vars`, not
|
|
136
|
+
`…/api/vars` — so the client appends **nothing**. Trailing slashes never matter, and any path you
|
|
137
|
+
configure is preserved verbatim, because it is indistinguishable from a real gateway prefix:
|
|
61
138
|
|
|
62
139
|
| `W6W_BASE_URL` | Requests go to |
|
|
63
140
|
| ----------------------------- | ------------------------------- |
|
|
64
|
-
| `https://api.example.com` | `https://api.example.com
|
|
65
|
-
| `https://api.example.com/` | `https://api.example.com
|
|
66
|
-
| `https://api.example.com///` | `https://api.example.com
|
|
67
|
-
| `https://api.example.com/
|
|
141
|
+
| `https://api.example.com` | `https://api.example.com/…` |
|
|
142
|
+
| `https://api.example.com/` | `https://api.example.com/…` |
|
|
143
|
+
| `https://api.example.com///` | `https://api.example.com/…` |
|
|
144
|
+
| `https://api.example.com/gw` | `https://api.example.com/gw/…` |
|
|
145
|
+
|
|
146
|
+
> **Breaking in `0.2.0`.** The client used to append `/api`. If your `W6W_BASE_URL` ends in `/api`
|
|
147
|
+
> because of that, **drop the suffix** — the path is now preserved rather than deduplicated, so a
|
|
148
|
+
> stale one 404s on every call. It is not stripped for you: a configured path is exactly how a
|
|
149
|
+
> deployment behind a gateway prefix is addressed, and silently removing it would break those.
|
|
68
150
|
|
|
69
151
|
A variable that is **set but empty** — or whitespace-only — counts as **unset**, in both variables.
|
|
70
152
|
`W6W_BASE_URL=` is how a shell or a Dockerfile spells "I meant to set this and did not", so it
|
package/dist/src/config.d.ts
CHANGED
|
@@ -10,10 +10,15 @@
|
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* The API's base path, from the shared contract's `basePath`
|
|
13
|
-
* (`packages/wrappers/endpoints.json`).
|
|
14
|
-
*
|
|
13
|
+
* (`packages/wrappers/endpoints.json`).
|
|
14
|
+
*
|
|
15
|
+
* **Empty since v0.2.0.** The server serves its routes at the ROOT of its own
|
|
16
|
+
* host (`https://api.w6w.io/vars`, not `.../api/vars` — the host already says
|
|
17
|
+
* "api"), so there is no prefix to append and {@linkcode joinBaseUrl} appends
|
|
18
|
+
* nothing. Kept exported, and kept mirroring the contract, so the constant
|
|
19
|
+
* still answers "what does this client prepend?" — the answer is now "nothing".
|
|
15
20
|
*/
|
|
16
|
-
export declare const BASE_PATH = "
|
|
21
|
+
export declare const BASE_PATH = "";
|
|
17
22
|
/**
|
|
18
23
|
* A `fetch`-shaped function.
|
|
19
24
|
*
|
|
@@ -29,11 +34,11 @@ export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>
|
|
|
29
34
|
/** Constructor options for a client. Every field is optional. */
|
|
30
35
|
export interface W6wClientOptions {
|
|
31
36
|
/**
|
|
32
|
-
* The **origin** of the w6w server, e.g. `https://api.example.com`. The
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
+
* The **origin** of the w6w server, e.g. `https://api.example.com`. The API
|
|
38
|
+
* is served at its root, so no path is appended. It must be an absolute
|
|
39
|
+
* `http(s)` URL with a host: a relative value like `/api` is a browser
|
|
40
|
+
* same-origin assumption with no meaning in a library, and is rejected at
|
|
41
|
+
* construction rather than misreported as an outage later.
|
|
37
42
|
* Overrides `W6W_BASE_URL`.
|
|
38
43
|
*/
|
|
39
44
|
baseUrl?: string;
|
|
@@ -59,7 +64,7 @@ export interface W6wClientOptions {
|
|
|
59
64
|
*/
|
|
60
65
|
export interface ResolvedConfig {
|
|
61
66
|
/**
|
|
62
|
-
*
|
|
67
|
+
* The normalized base, e.g. `https://api.example.com`. Never
|
|
63
68
|
* trailing-slashed, and never relative — {@linkcode joinBaseUrl} rejects a
|
|
64
69
|
* value that is not an absolute `http(s)` URL with a host.
|
|
65
70
|
*/
|
|
@@ -86,18 +91,21 @@ export interface ResolvedConfig {
|
|
|
86
91
|
*
|
|
87
92
|
* 1. strip surrounding whitespace, then **all** trailing slashes;
|
|
88
93
|
* 2. reject anything that is not an absolute `http`/`https` URL with a host;
|
|
89
|
-
* 3.
|
|
90
|
-
* double it**;
|
|
91
|
-
* 4. otherwise append the base path.
|
|
94
|
+
* 3. append nothing — the API is served at the root of its own host.
|
|
92
95
|
*
|
|
93
96
|
* ```
|
|
94
|
-
* https://api.example.com → https://api.example.com
|
|
95
|
-
* https://api.example.com/ → https://api.example.com
|
|
96
|
-
* https://api.example.com/// → https://api.example.com
|
|
97
|
-
* https://api.example.com/api → https://api.example.com/api
|
|
98
|
-
* https://api.example.com/api/ → https://api.example.com/api
|
|
97
|
+
* https://api.example.com → https://api.example.com
|
|
98
|
+
* https://api.example.com/ → https://api.example.com
|
|
99
|
+
* https://api.example.com/// → https://api.example.com
|
|
99
100
|
* ```
|
|
100
101
|
*
|
|
102
|
+
* Any path in the configured value is preserved verbatim, so a deployment that
|
|
103
|
+
* genuinely sits behind a gateway prefix can still be addressed by configuring
|
|
104
|
+
* that prefix. This is also why a stale `https://api.example.com/api` is NOT
|
|
105
|
+
* silently rewritten: it is indistinguishable from such a prefix, and quietly
|
|
106
|
+
* stripping it would break the deployments that mean it. It will 404 — the
|
|
107
|
+
* announced break for the v0.1.x base path.
|
|
108
|
+
*
|
|
101
109
|
* Step 2 exists because a **relative** base URL has to fail *here*, as
|
|
102
110
|
* configuration, with a message about configuration. Blank-is-absent
|
|
103
111
|
* (`src/env.ts`) already stops `""` from joining to the relative `"/api"`; with
|
package/dist/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjF,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAuBlD;AAkBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,gBAAqB,GAAG,cAAc,CAS5E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAS3D"}
|
package/dist/src/config.js
CHANGED
|
@@ -12,10 +12,15 @@ import { ENV_BASE_URL, ENV_TOKEN, readEnv } from "./env.js";
|
|
|
12
12
|
import { ConfigError } from "./errors.js";
|
|
13
13
|
/**
|
|
14
14
|
* The API's base path, from the shared contract's `basePath`
|
|
15
|
-
* (`packages/wrappers/endpoints.json`).
|
|
16
|
-
*
|
|
15
|
+
* (`packages/wrappers/endpoints.json`).
|
|
16
|
+
*
|
|
17
|
+
* **Empty since v0.2.0.** The server serves its routes at the ROOT of its own
|
|
18
|
+
* host (`https://api.w6w.io/vars`, not `.../api/vars` — the host already says
|
|
19
|
+
* "api"), so there is no prefix to append and {@linkcode joinBaseUrl} appends
|
|
20
|
+
* nothing. Kept exported, and kept mirroring the contract, so the constant
|
|
21
|
+
* still answers "what does this client prepend?" — the answer is now "nothing".
|
|
17
22
|
*/
|
|
18
|
-
export const BASE_PATH = "
|
|
23
|
+
export const BASE_PATH = "";
|
|
19
24
|
/**
|
|
20
25
|
* An absolute `http(s)` origin, spelled with a real authority.
|
|
21
26
|
*
|
|
@@ -45,18 +50,21 @@ const ABSOLUTE_HTTP_ORIGIN = /^https?:\/\/[^/\\?#]/i;
|
|
|
45
50
|
*
|
|
46
51
|
* 1. strip surrounding whitespace, then **all** trailing slashes;
|
|
47
52
|
* 2. reject anything that is not an absolute `http`/`https` URL with a host;
|
|
48
|
-
* 3.
|
|
49
|
-
* double it**;
|
|
50
|
-
* 4. otherwise append the base path.
|
|
53
|
+
* 3. append nothing — the API is served at the root of its own host.
|
|
51
54
|
*
|
|
52
55
|
* ```
|
|
53
|
-
* https://api.example.com → https://api.example.com
|
|
54
|
-
* https://api.example.com/ → https://api.example.com
|
|
55
|
-
* https://api.example.com/// → https://api.example.com
|
|
56
|
-
* https://api.example.com/api → https://api.example.com/api
|
|
57
|
-
* https://api.example.com/api/ → https://api.example.com/api
|
|
56
|
+
* https://api.example.com → https://api.example.com
|
|
57
|
+
* https://api.example.com/ → https://api.example.com
|
|
58
|
+
* https://api.example.com/// → https://api.example.com
|
|
58
59
|
* ```
|
|
59
60
|
*
|
|
61
|
+
* Any path in the configured value is preserved verbatim, so a deployment that
|
|
62
|
+
* genuinely sits behind a gateway prefix can still be addressed by configuring
|
|
63
|
+
* that prefix. This is also why a stale `https://api.example.com/api` is NOT
|
|
64
|
+
* silently rewritten: it is indistinguishable from such a prefix, and quietly
|
|
65
|
+
* stripping it would break the deployments that mean it. It will 404 — the
|
|
66
|
+
* announced break for the v0.1.x base path.
|
|
67
|
+
*
|
|
60
68
|
* Step 2 exists because a **relative** base URL has to fail *here*, as
|
|
61
69
|
* configuration, with a message about configuration. Blank-is-absent
|
|
62
70
|
* (`src/env.ts`) already stops `""` from joining to the relative `"/api"`; with
|
|
@@ -77,17 +85,17 @@ export function joinBaseUrl(origin) {
|
|
|
77
85
|
if (trimmed.length === 0) {
|
|
78
86
|
throw new ConfigError("No w6w base URL is configured. Pass one to the client " +
|
|
79
87
|
'(new W6wClient({ baseUrl: "https://api.example.com" })) or set the ' +
|
|
80
|
-
`${ENV_BASE_URL} environment variable. It holds the server's origin
|
|
81
|
-
|
|
88
|
+
`${ENV_BASE_URL} environment variable. It holds the server's origin, ` +
|
|
89
|
+
"e.g. \"https://api.example.com\" — the API is served at its root, so no " +
|
|
90
|
+
"path is appended.");
|
|
82
91
|
}
|
|
83
92
|
if (!ABSOLUTE_HTTP_ORIGIN.test(trimmed) || !parses(trimmed)) {
|
|
84
93
|
throw new ConfigError(`The w6w base URL "${trimmed}" is not an absolute http(s) URL. ` +
|
|
85
|
-
`${ENV_BASE_URL} holds an ORIGIN, e.g. "https://api.example.com" — scheme and host
|
|
86
|
-
|
|
87
|
-
"
|
|
88
|
-
"the configuration mistake it is.");
|
|
94
|
+
`${ENV_BASE_URL} holds an ORIGIN, e.g. "https://api.example.com" — scheme and host. ` +
|
|
95
|
+
"A relative or hostless value cannot be requested and would fail later as a " +
|
|
96
|
+
"connection problem rather than as the configuration mistake it is.");
|
|
89
97
|
}
|
|
90
|
-
return trimmed
|
|
98
|
+
return trimmed;
|
|
91
99
|
}
|
|
92
100
|
/**
|
|
93
101
|
* Does the runtime's URL parser accept this origin at all?
|
package/dist/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC;AA4D5B;;;;;;;;;;GAUG;AACH,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,0EAA0E;IAC1E,8EAA8E;IAC9E,4DAA4D;IAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,WAAW,CACnB,wDAAwD;YACtD,qEAAqE;YACrE,GAAG,YAAY,uDAAuD;YACtE,0EAA0E;YAC1E,mBAAmB,CACtB,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,WAAW,CACnB,qBAAqB,OAAO,oCAAoC;YAC9D,GAAG,YAAY,sEAAsE;YACrF,6EAA6E;YAC7E,oEAAoE,CACvE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,MAAM,CAAC,MAAc;IAC5B,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAAC,UAA4B,EAAE;IAC1D,OAAO;QACL,6EAA6E;QAC7E,2EAA2E;QAC3E,+CAA+C;QAC/C,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QACpE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,IAAI;QAClD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;KACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,MAAsB;IACjD,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,WAAW,CACnB,yDAAyD;YACvD,6CAA6C;YAC7C,GAAG,SAAS,kEAAkE,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC"}
|
package/dist/src/env.d.ts
CHANGED
|
@@ -40,10 +40,12 @@ export declare const ENV_TOKEN = "W6W_TOKEN";
|
|
|
40
40
|
* This deviates deliberately from the pinned snippet in
|
|
41
41
|
* `docs/implementation.md` §2, which reads `g.Deno.env.get(name) ?? undefined`.
|
|
42
42
|
* A nullish coalesce does **not** convert `""` to `undefined`, so an empty
|
|
43
|
-
* `W6W_BASE_URL` would survive as a value
|
|
44
|
-
* the
|
|
45
|
-
*
|
|
46
|
-
*
|
|
43
|
+
* `W6W_BASE_URL` would survive as a value and short-circuit the precedence
|
|
44
|
+
* chain — the client would resolve to an empty base instead of falling through
|
|
45
|
+
* to the next source, and every request would be issued against a relative URL.
|
|
46
|
+
* That is the browser same-origin default §2 forbids a library from having, and
|
|
47
|
+
* it fails later, somewhere else, with a message about the request rather than
|
|
48
|
+
* about the configuration.
|
|
47
49
|
*
|
|
48
50
|
* So the check below is a **truthiness/trim** check and not a nullish one, on
|
|
49
51
|
* purpose. Do not "tidy" it back to `??`. An empty-string environment variable
|
package/dist/src/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,gFAAgF;AAChF,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,qDAAqD;AACrD,eAAO,MAAM,SAAS,cAAc,CAAC;AAarC
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,gFAAgF;AAChF,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,qDAAqD;AACrD,eAAO,MAAM,SAAS,cAAc,CAAC;AAarC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQxD"}
|
package/dist/src/env.js
CHANGED
|
@@ -40,10 +40,12 @@ export const ENV_TOKEN = "W6W_TOKEN";
|
|
|
40
40
|
* This deviates deliberately from the pinned snippet in
|
|
41
41
|
* `docs/implementation.md` §2, which reads `g.Deno.env.get(name) ?? undefined`.
|
|
42
42
|
* A nullish coalesce does **not** convert `""` to `undefined`, so an empty
|
|
43
|
-
* `W6W_BASE_URL` would survive as a value
|
|
44
|
-
* the
|
|
45
|
-
*
|
|
46
|
-
*
|
|
43
|
+
* `W6W_BASE_URL` would survive as a value and short-circuit the precedence
|
|
44
|
+
* chain — the client would resolve to an empty base instead of falling through
|
|
45
|
+
* to the next source, and every request would be issued against a relative URL.
|
|
46
|
+
* That is the browser same-origin default §2 forbids a library from having, and
|
|
47
|
+
* it fails later, somewhere else, with a message about the request rather than
|
|
48
|
+
* about the configuration.
|
|
47
49
|
*
|
|
48
50
|
* So the check below is a **truthiness/trim** check and not a nullish one, on
|
|
49
51
|
* purpose. Do not "tidy" it back to `??`. An empty-string environment variable
|
package/dist/src/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,qDAAqD;AACrD,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAarC
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,qDAAqD;AACrD,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAarC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,CAAC,GAAG,UAAyC,CAAC;IACpD,IAAI,KAAyB,CAAC;IAC9B,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG;QAAE,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC9C,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG;QAAE,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;;QAChD,OAAO,SAAS,CAAC;IACtB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w6w/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Typed client for the w6w HTTP API. Thin transport, auth and error mapping — nothing else.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/w6w-io/w6w-
|
|
8
|
+
"url": "git+https://github.com/w6w-io/w6w-wrappers.git",
|
|
9
|
+
"directory": "node"
|
|
9
10
|
},
|
|
10
|
-
"homepage": "https://github.com/w6w-io/w6w-node#readme",
|
|
11
|
-
"bugs": "https://github.com/w6w-io/w6w-
|
|
11
|
+
"homepage": "https://github.com/w6w-io/w6w-wrappers/tree/main/node#readme",
|
|
12
|
+
"bugs": "https://github.com/w6w-io/w6w-wrappers/issues",
|
|
12
13
|
"keywords": ["w6w", "workflow", "sdk", "client", "api"],
|
|
13
14
|
"type": "module",
|
|
14
15
|
"types": "./dist/mod.d.ts",
|