@w6w/sdk 0.5.0 → 0.6.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.
Files changed (44) hide show
  1. package/README.md +20 -17
  2. package/dist/mod.d.ts +4 -0
  3. package/dist/mod.d.ts.map +1 -1
  4. package/dist/mod.js +2 -0
  5. package/dist/mod.js.map +1 -1
  6. package/dist/src/client.d.ts +26 -3
  7. package/dist/src/client.d.ts.map +1 -1
  8. package/dist/src/client.js +28 -3
  9. package/dist/src/client.js.map +1 -1
  10. package/dist/src/config.js +1 -1
  11. package/dist/src/config.js.map +1 -1
  12. package/dist/src/console/aliases.d.ts +137 -0
  13. package/dist/src/console/aliases.d.ts.map +1 -0
  14. package/dist/src/console/aliases.js +113 -0
  15. package/dist/src/console/aliases.js.map +1 -0
  16. package/dist/src/console/auth.d.ts +202 -4
  17. package/dist/src/console/auth.d.ts.map +1 -1
  18. package/dist/src/console/auth.js +154 -4
  19. package/dist/src/console/auth.js.map +1 -1
  20. package/dist/src/console/endpoints.d.ts +23 -5
  21. package/dist/src/console/endpoints.d.ts.map +1 -1
  22. package/dist/src/console/endpoints.js.map +1 -1
  23. package/dist/src/console/mod.d.ts +12 -2
  24. package/dist/src/console/mod.d.ts.map +1 -1
  25. package/dist/src/console/mod.js +10 -0
  26. package/dist/src/console/mod.js.map +1 -1
  27. package/dist/src/console/passkeys.d.ts +246 -0
  28. package/dist/src/console/passkeys.d.ts.map +1 -0
  29. package/dist/src/console/passkeys.js +192 -0
  30. package/dist/src/console/passkeys.js.map +1 -0
  31. package/dist/src/endpoints.d.ts +75 -0
  32. package/dist/src/endpoints.d.ts.map +1 -0
  33. package/dist/src/endpoints.js +47 -0
  34. package/dist/src/endpoints.js.map +1 -0
  35. package/dist/src/functions.d.ts +88 -0
  36. package/dist/src/functions.d.ts.map +1 -0
  37. package/dist/src/functions.js +56 -0
  38. package/dist/src/functions.js.map +1 -0
  39. package/dist/src/run.d.ts +8 -3
  40. package/dist/src/run.d.ts.map +1 -1
  41. package/dist/src/run.js +3 -2
  42. package/dist/src/run.js.map +1 -1
  43. package/dist/src/version.js +1 -1
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -33,7 +33,7 @@ same set of operations in every language.
33
33
  ## Quick start
34
34
 
35
35
  ```ts
36
- import { W6WClient, isActionRun, isFunctionRun, isWorkflowRun } from "@w6w/sdk";
36
+ import { isActionRun, isFunctionRun, isWorkflowRun, W6WClient } from "@w6w/sdk";
37
37
 
38
38
  const client = new W6WClient(); // reads W6W_BASE_URL and W6W_TOKEN
39
39
 
@@ -48,9 +48,9 @@ const workflows = await client.workflows.list();
48
48
 
49
49
  ### Run a connection action
50
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`):
51
+ A `conn_…` id resolves to an app action. `run` returns a `kind`-tagged envelope — narrow it with
52
+ `isActionRun` / `isFunctionRun` / `isWorkflowRun` before reading a field, since the three arms use
53
+ different field names on purpose (`value` vs `output` vs `runId`+`status`):
54
54
 
55
55
  ```ts
56
56
  const env = await client.run({
@@ -68,7 +68,10 @@ if (isActionRun(env)) console.log(env.value); // the action's return value
68
68
  operation:
69
69
 
70
70
  ```ts
71
- const env = await client.run({ urn: "fn_normalize_address", payload: { address: "1 Infinite Loop" } });
71
+ const env = await client.run({
72
+ urn: "fn_normalize_address",
73
+ payload: { address: "1 Infinite Loop" },
74
+ });
72
75
  if (isFunctionRun(env)) console.log(env.output);
73
76
  ```
74
77
 
@@ -110,10 +113,10 @@ await client.vars.update(v.id, { value: "c@d.e" });
110
113
 
111
114
  Two environment variables, both read only at client construction:
112
115
 
113
- | Variable | Meaning | Required |
114
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------- |
116
+ | Variable | Meaning | Required |
117
+ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- |
115
118
  | `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
- | `W6W_TOKEN` | The bearer token, sent as `Authorization: Bearer <token>` on every request. | Yes |
119
+ | `W6W_TOKEN` | The bearer token, sent as `Authorization: Bearer <token>` on every request. | Yes |
117
120
 
118
121
  Explicit constructor arguments always win over the environment, and credentials are **instance
119
122
  state**: two clients in one process can hold different tokens and point at different servers with no
@@ -132,16 +135,16 @@ const other = new W6WClient({ baseUrl: "https://api.example.com", token: "…" }
132
135
 
133
136
  ### `W6W_BASE_URL` is an origin
134
137
 
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:
138
+ The API is served at the **root** of its own host — `https://api.example.com/vars`, not `…/api/vars`
139
+ — so the client appends **nothing**. Trailing slashes never matter, and any path you configure is
140
+ preserved verbatim, because it is indistinguishable from a real gateway prefix:
138
141
 
139
- | `W6W_BASE_URL` | Requests go to |
140
- | ----------------------------- | ------------------------------- |
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/…` |
142
+ | `W6W_BASE_URL` | Requests go to |
143
+ | ---------------------------- | ------------------------------ |
144
+ | `https://api.example.com` | `https://api.example.com/…` |
145
+ | `https://api.example.com/` | `https://api.example.com/…` |
146
+ | `https://api.example.com///` | `https://api.example.com/…` |
147
+ | `https://api.example.com/gw` | `https://api.example.com/gw/…` |
145
148
 
146
149
  > **Breaking in `0.2.0`.** The client used to append `/api`. If your `W6W_BASE_URL` ends in `/api`
147
150
  > because of that, **drop the suffix** — the path is now preserved rather than deduplicated, so a
package/dist/mod.d.ts CHANGED
@@ -29,6 +29,10 @@ export type { MeHost } from "./src/me.ts";
29
29
  export { ConnectionsApi } from "./src/connections.ts";
30
30
  export type { ConnectionsHost } from "./src/connections.ts";
31
31
  export { WorkflowsApi } from "./src/workflows.ts";
32
+ export { FunctionsApi } from "./src/functions.ts";
33
+ export type { FunctionRunOptions, FunctionsHost } from "./src/functions.ts";
34
+ export { EndpointsApi } from "./src/endpoints.ts";
35
+ export type { EndpointRunOptions, EndpointsHost } from "./src/endpoints.ts";
32
36
  export type { WorkflowListOptions, WorkflowRunOptions, WorkflowRunResult, WorkflowsHost, } from "./src/workflows.ts";
33
37
  export { runUrn } from "./src/run.ts";
34
38
  export type { RunHost, RunInput } from "./src/run.ts";
package/dist/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,SAAS,EACT,KAAK,SAAS,EACd,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK3F,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMrC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOxE,OAAO,EAAE,OAAO,EAA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ClB,GAAG,EACH,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
package/dist/mod.js CHANGED
@@ -38,6 +38,8 @@ export { VarsApi } from "./src/vars.js";
38
38
  export { fetchMe } from "./src/me.js";
39
39
  export { ConnectionsApi } from "./src/connections.js";
40
40
  export { WorkflowsApi } from "./src/workflows.js";
41
+ export { FunctionsApi } from "./src/functions.js";
42
+ export { EndpointsApi } from "./src/endpoints.js";
41
43
  // Execution (T2.1.5): the URN-addressed `run`. `client.run(input)` is a method
42
44
  // on the client, so what is exported is its host interface, its input type and
43
45
  // the standalone function the client delegates to.
package/dist/mod.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,8EAA8E;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,SAAS,EAET,WAAW,GAGZ,MAAM,iBAAiB,CAAC;AAEzB,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,iEAAiE;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,sCAAsC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,gFAAgF;AAChF,gFAAgF;AAChF,wEAAwE;AACxE,gFAAgF;AAChF,6CAA6C;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,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C;AASlD,+EAA+E;AAC/E,+EAA+E;AAC/E,mDAAmD;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,uEAAuE;AACvE,wEAAwE;AACxE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
@@ -22,6 +22,8 @@ import { type HttpResponse, type RequestOptions } from "./http.ts";
22
22
  import { type RunInput } from "./run.ts";
23
23
  import type { Me, RunEnvelope } from "./types.ts";
24
24
  import { VarsApi } from "./vars.ts";
25
+ import { EndpointsApi } from "./endpoints.ts";
26
+ import { FunctionsApi } from "./functions.ts";
25
27
  import { WorkflowsApi } from "./workflows.ts";
26
28
  /**
27
29
  * A client for the w6w HTTP API.
@@ -78,9 +80,28 @@ export declare class W6WClient {
78
80
  * `@w6w/trigger` step and read downstream as `steps.<triggerId>.output.<key>`.
79
81
  */
80
82
  readonly workflows: WorkflowsApi;
83
+ /**
84
+ * Run a Function by the name you gave it: `functions.run("send-email", {payload})`.
85
+ *
86
+ * The name is the first argument and may be the Function's KEY or its `fn_…`
87
+ * id — the server takes either in one slot, because the two shapes cannot
88
+ * collide. Returns the Function's output directly; the kind is already
89
+ * settled by the method name, so there is no envelope to unwrap.
90
+ */
91
+ readonly functions: FunctionsApi;
92
+ /**
93
+ * Run an Endpoint by the key you gave it: `endpoints.run("send-email", {payload})`.
94
+ *
95
+ * Same name-first shape as `functions.run`, but this one returns the
96
+ * `kind`-discriminated envelope: an Endpoint dispatches to an app action, a
97
+ * Function or a Workflow, and only the response says which answered.
98
+ */
99
+ readonly endpoints: EndpointsApi;
81
100
  /**
82
101
  * Console-only namespaces: `console.reliability.list`, `console.auth.*`
83
- * (`login`, `signup`, `checkAccountSlug`, `createAccount`),
102
+ * (`login`, `signup`, `checkAccountSlug`, `createAccount`, `getMe`,
103
+ * `getProfile`, `updateProfile`, `requestContactChange`,
104
+ * `confirmContactChange`, `removeContact`, `promoteContact`, `setPassword`),
84
105
  * `console.dashboard.stats`, `console.projects.*` (`list`, `create`,
85
106
  * `delete`), `console.schedules.*` (`get`, `upsert`, `delete`),
86
107
  * `console.apps.*` (`list`, `get`, `getAuth`, `getActions`, `getTriggers`,
@@ -96,8 +117,10 @@ export declare class W6WClient {
96
117
  * `disable`, `enable`, `revoke`), `console.functions.*` (`list`, `get`,
97
118
  * `upsert`), `console.endpoints.*` (`list`, `get`, `upsert`, `invoke`),
98
119
  * `console.subscriptions.*` (`list`, `listForWorkflow`, `get`, `create`,
99
- * `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`) and
100
- * `console.tenantOAuthApps.*` (`list`, `put`, `remove`).
120
+ * `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`),
121
+ * `console.tenantOAuthApps.*` (`list`, `put`, `remove`) and
122
+ * `console.passkeys.*` (`registrationOptions`, `registrationVerify`,
123
+ * `authenticationOptions`, `authenticationVerify`, `list`, `revoke`).
101
124
  * Studio-internal and unstable — not part of the published partner
102
125
  * contract, excluded from `endpoints.json` and from this package's root
103
126
  * barrel (`docs/console.md`, HITL-1). Reached only through
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,KAAK,YAAY,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,KAAK,QAAQ,EAAU,MAAM,UAAU,CAAC;AACjD,OAAO,K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;IACH,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAG9D"}
@@ -23,6 +23,8 @@ import { request } from "./http.js";
23
23
  import { fetchMe } from "./me.js";
24
24
  import { runUrn } from "./run.js";
25
25
  import { VarsApi } from "./vars.js";
26
+ import { EndpointsApi } from "./endpoints.js";
27
+ import { FunctionsApi } from "./functions.js";
26
28
  import { WorkflowsApi } from "./workflows.js";
27
29
  /**
28
30
  * A client for the w6w HTTP API.
@@ -78,9 +80,28 @@ export class W6WClient {
78
80
  * `@w6w/trigger` step and read downstream as `steps.<triggerId>.output.<key>`.
79
81
  */
80
82
  workflows;
83
+ /**
84
+ * Run a Function by the name you gave it: `functions.run("send-email", {payload})`.
85
+ *
86
+ * The name is the first argument and may be the Function's KEY or its `fn_…`
87
+ * id — the server takes either in one slot, because the two shapes cannot
88
+ * collide. Returns the Function's output directly; the kind is already
89
+ * settled by the method name, so there is no envelope to unwrap.
90
+ */
91
+ functions;
92
+ /**
93
+ * Run an Endpoint by the key you gave it: `endpoints.run("send-email", {payload})`.
94
+ *
95
+ * Same name-first shape as `functions.run`, but this one returns the
96
+ * `kind`-discriminated envelope: an Endpoint dispatches to an app action, a
97
+ * Function or a Workflow, and only the response says which answered.
98
+ */
99
+ endpoints;
81
100
  /**
82
101
  * Console-only namespaces: `console.reliability.list`, `console.auth.*`
83
- * (`login`, `signup`, `checkAccountSlug`, `createAccount`),
102
+ * (`login`, `signup`, `checkAccountSlug`, `createAccount`, `getMe`,
103
+ * `getProfile`, `updateProfile`, `requestContactChange`,
104
+ * `confirmContactChange`, `removeContact`, `promoteContact`, `setPassword`),
84
105
  * `console.dashboard.stats`, `console.projects.*` (`list`, `create`,
85
106
  * `delete`), `console.schedules.*` (`get`, `upsert`, `delete`),
86
107
  * `console.apps.*` (`list`, `get`, `getAuth`, `getActions`, `getTriggers`,
@@ -96,8 +117,10 @@ export class W6WClient {
96
117
  * `disable`, `enable`, `revoke`), `console.functions.*` (`list`, `get`,
97
118
  * `upsert`), `console.endpoints.*` (`list`, `get`, `upsert`, `invoke`),
98
119
  * `console.subscriptions.*` (`list`, `listForWorkflow`, `get`, `create`,
99
- * `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`) and
100
- * `console.tenantOAuthApps.*` (`list`, `put`, `remove`).
120
+ * `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`),
121
+ * `console.tenantOAuthApps.*` (`list`, `put`, `remove`) and
122
+ * `console.passkeys.*` (`registrationOptions`, `registrationVerify`,
123
+ * `authenticationOptions`, `authenticationVerify`, `list`, `revoke`).
101
124
  * Studio-internal and unstable — not part of the published partner
102
125
  * contract, excluded from `endpoints.json` and from this package's root
103
126
  * barrel (`docs/console.md`, HITL-1). Reached only through
@@ -134,6 +157,8 @@ export class W6WClient {
134
157
  this.vars = new VarsApi(this);
135
158
  this.connections = new ConnectionsApi(this);
136
159
  this.workflows = new WorkflowsApi(this);
160
+ this.functions = new FunctionsApi(this);
161
+ this.endpoints = new EndpointsApi(this);
137
162
  this.console = new ConsoleApi(this);
138
163
  }
139
164
  /**
@@ -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,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,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;AAE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AAC,CAAC;QACxC,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"}
@@ -86,7 +86,7 @@ export function joinBaseUrl(origin) {
86
86
  throw new ConfigError("No w6w base URL is configured. Pass one to the client " +
87
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
- "e.g. \"https://api.example.com\" — the API is served at its root, so no " +
89
+ 'e.g. "https://api.example.com" — the API is served at its root, so no ' +
90
90
  "path is appended.");
91
91
  }
92
92
  if (!ABSOLUTE_HTTP_ORIGIN.test(trimmed) || !parses(trimmed)) {
@@ -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;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC;AA4D5B;;;;;;;;;;GAUG;AACH,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAErD;;;;;;;;;;;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AC,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"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * `client.console.aliases.*` — account-scoped alias management
3
+ * (`list`/`get`/`upsert`/`delete`) for the names `run`'s URN dispatch
4
+ * resolves alongside its four `conn_…`/`wf_…`/`fn_…`/`ep_…` arms
5
+ * (`src/run.ts`).
6
+ *
7
+ * **Studio-internal, not the published partner contract.** This namespace
8
+ * lives under the `console` subpath export (`@w6w/sdk/console`), excluded
9
+ * from `endpoints.json` and from the root barrel (`mod.ts`) — see
10
+ * `docs/console.md` and HITL-2 in this project's contract. This surface is
11
+ * **new**: unlike `console.functions`/`console.endpoints`, there is no
12
+ * pre-existing `studio/src/api/client.ts` alias code being relocated here —
13
+ * Studio never had alias CRUD before this project. `@w6w/sdk`'s
14
+ * instance-state mechanism pin still applies here exactly as it does to
15
+ * every other namespace (`docs/implementation.md` §MECHANISM PIN — instance
16
+ * state, never globals): this class holds no state of its own beyond the
17
+ * injected host, so two clients in one process never share a credential.
18
+ *
19
+ * **`invoke`/`run` is deliberately NOT modeled here.** The base
20
+ * `client.run({urn: aliasName, payload})` (already-published surface,
21
+ * `endpoints.json`-named, exported from the root `mod.ts`) already reaches
22
+ * an alias's target — an alias name is one of `run`'s runnable `urn` arms,
23
+ * alongside `conn_…`/`wf_…`/`fn_…`/`ep_…` (`src/run.ts`). Adding a duplicate
24
+ * `console.aliases.invoke` would give a caller two ways to reach the same
25
+ * route — the exact anti-duplication defect `console/functions.ts:15-26`
26
+ * flags for Functions, applied here with alias/`run` substituted for
27
+ * function/`run`; `console.endpoints`/`console.workflows` follow the same
28
+ * precedent. No invoke method lives here, and none should be added later
29
+ * without re-litigating this reasoning.
30
+ *
31
+ * @module
32
+ */
33
+ import { type HttpResponse, type RequestOptions } from "../http.ts";
34
+ import type { EndpointTarget } from "./endpoints.ts";
35
+ /**
36
+ * The slice of `W6WClient` this namespace needs: the transport, and nothing
37
+ * else. Structural rather than a concrete client type, so the namespace
38
+ * stays independently constructible in a test and this module never
39
+ * imports the client back — mirrors `FunctionsHost` in `./functions.ts`.
40
+ */
41
+ export interface AliasesHost {
42
+ /** Perform one request. */
43
+ request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
44
+ }
45
+ /**
46
+ * An alias definition — an account-scoped name bound to one runnable
47
+ * target, typed with the same {@linkcode EndpointTarget} union
48
+ * `console.endpoints` dispatches to. Unlike `EndpointDef.target`, an
49
+ * alias's `target` may also carry the `endpoint` arm
50
+ * ({@linkcode EndpointRefTarget}) — dispatching to another Endpoint by id is
51
+ * legal for an alias only, so `run`'s URN dispatch can resolve it by name
52
+ * instead of by id.
53
+ *
54
+ * `name` is **immutable after first save** (HITL-3): a save that changes
55
+ * `name` on an already-stored alias answers `409 alias_name_immutable`.
56
+ */
57
+ export interface AliasDef {
58
+ id: string;
59
+ name: string;
60
+ displayName?: string;
61
+ description?: string;
62
+ target: EndpointTarget;
63
+ }
64
+ /** One row of `list`'s result — an alias's summary, not its full definition. */
65
+ export interface AliasSummary {
66
+ id: string;
67
+ name: string;
68
+ displayName: string;
69
+ description: string;
70
+ updatedAt: string;
71
+ target: EndpointTarget;
72
+ }
73
+ /**
74
+ * The `console.aliases` namespace on a `W6WClient`.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const aliases = await client.console.aliases.list();
79
+ * const alias = await client.console.aliases.get(aliases[0].id);
80
+ * await client.console.aliases.upsert({ ...alias, description: "Send email" });
81
+ * await client.console.aliases.delete(alias.id);
82
+ * ```
83
+ */
84
+ export declare class AliasesApi {
85
+ #private;
86
+ /**
87
+ * @param host - The client this namespace issues requests through.
88
+ */
89
+ constructor(host: AliasesHost);
90
+ /**
91
+ * List the caller's aliases.
92
+ *
93
+ * @returns The aliases, unwrapped from the `aliases` envelope.
94
+ */
95
+ list(): Promise<AliasSummary[]>;
96
+ /**
97
+ * Fetch one alias's stored definition.
98
+ *
99
+ * No server-computed field to splice in — unlike
100
+ * {@linkcode FunctionsApi.get}'s `valid` merge, this returns
101
+ * `unwrap<AliasDef>(res, "alias")` plainly.
102
+ *
103
+ * @param id - The alias's `id`.
104
+ * @returns The alias definition, unwrapped from the `alias` envelope.
105
+ * @throws {ApiError} `404 unknown_alias` when there is no such id.
106
+ */
107
+ get(id: string): Promise<AliasDef>;
108
+ /**
109
+ * Register (create or overwrite) an alias definition.
110
+ *
111
+ * `definition` is the whole definition, sent verbatim as the request body
112
+ * — not wrapped in an envelope key.
113
+ *
114
+ * @param definition - The whole alias definition, forwarded verbatim.
115
+ * @returns The new/updated alias's id and name.
116
+ * @throws {ApiError} `400 invalid_alias` — structurally invalid body.
117
+ * @throws {ApiError} `409 alias_conflict` — another `(tenant,subject)` owns this id.
118
+ * @throws {ApiError} `409 alias_name_conflict` — another alias already owns this name.
119
+ * @throws {ApiError} `409 alias_name_immutable` — `name` changed on an already-stored alias (HITL-3).
120
+ */
121
+ upsert(definition: AliasDef): Promise<{
122
+ id: string;
123
+ name: string;
124
+ }>;
125
+ /**
126
+ * Delete an alias.
127
+ *
128
+ * Returns nothing: the server's `{ok: true}` carries no information a
129
+ * caller can use, mirroring `console.vault.delete`/`console.projects.delete`
130
+ * in this same package.
131
+ *
132
+ * @param id - The alias's `id`.
133
+ * @throws {ApiError} `404 unknown_alias` when there is no such id.
134
+ */
135
+ delete(id: string): Promise<void>;
136
+ }
137
+ //# sourceMappingURL=aliases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../../src/console/aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;;IAGrB;;OAEG;gBACS,IAAI,EAAE,WAAW;IAI7B;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAKrC;;;;;;;;;;OAUG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKxC;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,UAAU,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IASzE;;;;;;;;;OASG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * `client.console.aliases.*` — account-scoped alias management
3
+ * (`list`/`get`/`upsert`/`delete`) for the names `run`'s URN dispatch
4
+ * resolves alongside its four `conn_…`/`wf_…`/`fn_…`/`ep_…` arms
5
+ * (`src/run.ts`).
6
+ *
7
+ * **Studio-internal, not the published partner contract.** This namespace
8
+ * lives under the `console` subpath export (`@w6w/sdk/console`), excluded
9
+ * from `endpoints.json` and from the root barrel (`mod.ts`) — see
10
+ * `docs/console.md` and HITL-2 in this project's contract. This surface is
11
+ * **new**: unlike `console.functions`/`console.endpoints`, there is no
12
+ * pre-existing `studio/src/api/client.ts` alias code being relocated here —
13
+ * Studio never had alias CRUD before this project. `@w6w/sdk`'s
14
+ * instance-state mechanism pin still applies here exactly as it does to
15
+ * every other namespace (`docs/implementation.md` §MECHANISM PIN — instance
16
+ * state, never globals): this class holds no state of its own beyond the
17
+ * injected host, so two clients in one process never share a credential.
18
+ *
19
+ * **`invoke`/`run` is deliberately NOT modeled here.** The base
20
+ * `client.run({urn: aliasName, payload})` (already-published surface,
21
+ * `endpoints.json`-named, exported from the root `mod.ts`) already reaches
22
+ * an alias's target — an alias name is one of `run`'s runnable `urn` arms,
23
+ * alongside `conn_…`/`wf_…`/`fn_…`/`ep_…` (`src/run.ts`). Adding a duplicate
24
+ * `console.aliases.invoke` would give a caller two ways to reach the same
25
+ * route — the exact anti-duplication defect `console/functions.ts:15-26`
26
+ * flags for Functions, applied here with alias/`run` substituted for
27
+ * function/`run`; `console.endpoints`/`console.workflows` follow the same
28
+ * precedent. No invoke method lives here, and none should be added later
29
+ * without re-litigating this reasoning.
30
+ *
31
+ * @module
32
+ */
33
+ import { path } from "../http.js";
34
+ import { unwrap } from "../types.js";
35
+ /**
36
+ * The `console.aliases` namespace on a `W6WClient`.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const aliases = await client.console.aliases.list();
41
+ * const alias = await client.console.aliases.get(aliases[0].id);
42
+ * await client.console.aliases.upsert({ ...alias, description: "Send email" });
43
+ * await client.console.aliases.delete(alias.id);
44
+ * ```
45
+ */
46
+ export class AliasesApi {
47
+ #host;
48
+ /**
49
+ * @param host - The client this namespace issues requests through.
50
+ */
51
+ constructor(host) {
52
+ this.#host = host;
53
+ }
54
+ /**
55
+ * List the caller's aliases.
56
+ *
57
+ * @returns The aliases, unwrapped from the `aliases` envelope.
58
+ */
59
+ async list() {
60
+ const res = await this.#host.request({ method: "GET", path: "/aliases" });
61
+ return unwrap(res, "aliases");
62
+ }
63
+ /**
64
+ * Fetch one alias's stored definition.
65
+ *
66
+ * No server-computed field to splice in — unlike
67
+ * {@linkcode FunctionsApi.get}'s `valid` merge, this returns
68
+ * `unwrap<AliasDef>(res, "alias")` plainly.
69
+ *
70
+ * @param id - The alias's `id`.
71
+ * @returns The alias definition, unwrapped from the `alias` envelope.
72
+ * @throws {ApiError} `404 unknown_alias` when there is no such id.
73
+ */
74
+ async get(id) {
75
+ const res = await this.#host.request({ method: "GET", path: path `/aliases/${id}` });
76
+ return unwrap(res, "alias");
77
+ }
78
+ /**
79
+ * Register (create or overwrite) an alias definition.
80
+ *
81
+ * `definition` is the whole definition, sent verbatim as the request body
82
+ * — not wrapped in an envelope key.
83
+ *
84
+ * @param definition - The whole alias definition, forwarded verbatim.
85
+ * @returns The new/updated alias's id and name.
86
+ * @throws {ApiError} `400 invalid_alias` — structurally invalid body.
87
+ * @throws {ApiError} `409 alias_conflict` — another `(tenant,subject)` owns this id.
88
+ * @throws {ApiError} `409 alias_name_conflict` — another alias already owns this name.
89
+ * @throws {ApiError} `409 alias_name_immutable` — `name` changed on an already-stored alias (HITL-3).
90
+ */
91
+ async upsert(definition) {
92
+ const res = await this.#host.request({
93
+ method: "POST",
94
+ path: "/aliases",
95
+ body: definition,
96
+ });
97
+ return unwrap(res, "alias");
98
+ }
99
+ /**
100
+ * Delete an alias.
101
+ *
102
+ * Returns nothing: the server's `{ok: true}` carries no information a
103
+ * caller can use, mirroring `console.vault.delete`/`console.projects.delete`
104
+ * in this same package.
105
+ *
106
+ * @param id - The alias's `id`.
107
+ * @throws {ApiError} `404 unknown_alias` when there is no such id.
108
+ */
109
+ async delete(id) {
110
+ await this.#host.request({ method: "DELETE", path: path `/aliases/${id}` });
111
+ }
112
+ }
113
+ //# sourceMappingURL=aliases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aliases.js","sourceRoot":"","sources":["../../../src/console/aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,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