@w6w/sdk 0.1.1 → 0.2.1

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 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.1.1`.
13
+ - **Version:** `0.2.0`.
14
14
 
15
15
  ## Install
16
16
 
@@ -112,7 +112,7 @@ Two environment variables, both read only at client construction:
112
112
 
113
113
  | Variable | Meaning | Required |
114
114
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------- |
115
- | `W6W_BASE_URL` | The **origin** of your w6w server, e.g. `https://api.example.com`. The API's base path is appended by the client — do not include it. | Yes |
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 |
116
116
  | `W6W_TOKEN` | The bearer token, sent as `Authorization: Bearer <token>` on every request. | Yes |
117
117
 
118
118
  Explicit constructor arguments always win over the environment, and credentials are **instance
@@ -132,15 +132,21 @@ const other = new W6wClient({ baseUrl: "https://api.example.com", token: "…" }
132
132
 
133
133
  ### `W6W_BASE_URL` is an origin
134
134
 
135
- The client appends the API's base path (`/api`) itself, and never doubles it — so a value that
136
- already carries the prefix is left alone, and trailing slashes never matter:
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:
137
138
 
138
139
  | `W6W_BASE_URL` | Requests go to |
139
140
  | ----------------------------- | ------------------------------- |
140
- | `https://api.example.com` | `https://api.example.com/api/…` |
141
- | `https://api.example.com/` | `https://api.example.com/api/…` |
142
- | `https://api.example.com///` | `https://api.example.com/api/…` |
143
- | `https://api.example.com/api` | `https://api.example.com/api/…` |
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.
144
150
 
145
151
  A variable that is **set but empty** — or whitespace-only — counts as **unset**, in both variables.
146
152
  `W6W_BASE_URL=` is how a shell or a Dockerfile spells "I meant to set this and did not", so it
@@ -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`). It is appended to the configured
14
- * origin by {@linkcode joinBaseUrl}; users never type it.
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 = "/api";
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 base
33
- * path (`/api`) is appended for you and is never doubled. It must be an
34
- * absolute `http(s)` URL with a host: a relative value like `/api` is a
35
- * browser same-origin assumption with no meaning in a library, and is
36
- * rejected at construction rather than misreported as an outage later.
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
- * Fully joined base, e.g. `https://api.example.com/api`. Never
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. if the result already ends with the base path, use it as-is — **never
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/api
95
- * https://api.example.com/ → https://api.example.com/api
96
- * https://api.example.com/// → https://api.example.com/api
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
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;GAIG;AACH,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;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"}
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"}
@@ -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`). It is appended to the configured
16
- * origin by {@linkcode joinBaseUrl}; users never type it.
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 = "/api";
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. if the result already ends with the base path, use it as-is — **never
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/api
54
- * https://api.example.com/ → https://api.example.com/api
55
- * https://api.example.com/// → https://api.example.com/api
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 — the ` +
81
- `${BASE_PATH} base path is appended for you.`);
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
- `with the ${BASE_PATH} base path appended for you. A relative or hostless value ` +
87
- "cannot be requested and would fail later as a connection problem rather than as " +
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.endsWith(BASE_PATH) ? trimmed : `${trimmed}${BASE_PATH}`;
98
+ return trimmed;
91
99
  }
92
100
  /**
93
101
  * Does the runtime's URL parser accept this origin at all?
@@ -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;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AA4DhC;;;;;;;;;;GAUG;AACH,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,WAAW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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, reach the join rule, and resolve to
44
- * the relative URL `"/api"` — exactly the browser same-origin default that §2
45
- * forbids a library from having. A relative base URL fails later, somewhere
46
- * else, with a message about the request rather than about the configuration.
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
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQxD"}
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, reach the join rule, and resolve to
44
- * the relative URL `"/api"` — exactly the browser same-origin default that §2
45
- * forbids a library from having. A relative base URL fails later, somewhere
46
- * else, with a message about the request rather than about the configuration.
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
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;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"}
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"}
@@ -10,5 +10,5 @@
10
10
  * this file as TypeScript source and rejects inferred public types ("no slow
11
11
  * types").
12
12
  */
13
- export const VERSION = "0.1.1";
13
+ export const VERSION = "0.2.1";
14
14
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@w6w/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
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-node.git"
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-node/issues",
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",