@w6w/sdk 0.3.0 → 0.4.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 (84) hide show
  1. package/dist/src/client.d.ts +28 -0
  2. package/dist/src/client.d.ts.map +1 -1
  3. package/dist/src/client.js +29 -0
  4. package/dist/src/client.js.map +1 -1
  5. package/dist/src/console/api-calls.d.ts +80 -0
  6. package/dist/src/console/api-calls.d.ts.map +1 -0
  7. package/dist/src/console/api-calls.js +69 -0
  8. package/dist/src/console/api-calls.js.map +1 -0
  9. package/dist/src/console/apps.d.ts +689 -0
  10. package/dist/src/console/apps.d.ts.map +1 -0
  11. package/dist/src/console/apps.js +402 -0
  12. package/dist/src/console/apps.js.map +1 -0
  13. package/dist/src/console/auth.d.ts +241 -0
  14. package/dist/src/console/auth.d.ts.map +1 -0
  15. package/dist/src/console/auth.js +173 -0
  16. package/dist/src/console/auth.js.map +1 -0
  17. package/dist/src/console/connections.d.ts +188 -0
  18. package/dist/src/console/connections.d.ts.map +1 -0
  19. package/dist/src/console/connections.js +182 -0
  20. package/dist/src/console/connections.js.map +1 -0
  21. package/dist/src/console/dashboard.d.ts +102 -0
  22. package/dist/src/console/dashboard.d.ts.map +1 -0
  23. package/dist/src/console/dashboard.js +59 -0
  24. package/dist/src/console/dashboard.js.map +1 -0
  25. package/dist/src/console/endpoints.d.ts +264 -0
  26. package/dist/src/console/endpoints.d.ts.map +1 -0
  27. package/dist/src/console/endpoints.js +164 -0
  28. package/dist/src/console/endpoints.js.map +1 -0
  29. package/dist/src/console/functions.d.ts +165 -0
  30. package/dist/src/console/functions.d.ts.map +1 -0
  31. package/dist/src/console/functions.js +117 -0
  32. package/dist/src/console/functions.js.map +1 -0
  33. package/dist/src/console/mod.d.ts +131 -0
  34. package/dist/src/console/mod.d.ts.map +1 -0
  35. package/dist/src/console/mod.js +121 -0
  36. package/dist/src/console/mod.js.map +1 -0
  37. package/dist/src/console/projects.d.ts +107 -0
  38. package/dist/src/console/projects.d.ts.map +1 -0
  39. package/dist/src/console/projects.js +97 -0
  40. package/dist/src/console/projects.js.map +1 -0
  41. package/dist/src/console/reliability.d.ts +149 -0
  42. package/dist/src/console/reliability.d.ts.map +1 -0
  43. package/dist/src/console/reliability.js +56 -0
  44. package/dist/src/console/reliability.js.map +1 -0
  45. package/dist/src/console/saved-tests.d.ts +198 -0
  46. package/dist/src/console/saved-tests.d.ts.map +1 -0
  47. package/dist/src/console/saved-tests.js +172 -0
  48. package/dist/src/console/saved-tests.js.map +1 -0
  49. package/dist/src/console/schedules.d.ts +127 -0
  50. package/dist/src/console/schedules.d.ts.map +1 -0
  51. package/dist/src/console/schedules.js +118 -0
  52. package/dist/src/console/schedules.js.map +1 -0
  53. package/dist/src/console/step-tests.d.ts +159 -0
  54. package/dist/src/console/step-tests.d.ts.map +1 -0
  55. package/dist/src/console/step-tests.js +129 -0
  56. package/dist/src/console/step-tests.js.map +1 -0
  57. package/dist/src/console/subscriptions.d.ts +199 -0
  58. package/dist/src/console/subscriptions.d.ts.map +1 -0
  59. package/dist/src/console/subscriptions.js +191 -0
  60. package/dist/src/console/subscriptions.js.map +1 -0
  61. package/dist/src/console/tenant-oauth-apps.d.ts +188 -0
  62. package/dist/src/console/tenant-oauth-apps.d.ts.map +1 -0
  63. package/dist/src/console/tenant-oauth-apps.js +152 -0
  64. package/dist/src/console/tenant-oauth-apps.js.map +1 -0
  65. package/dist/src/console/tokens.d.ts +159 -0
  66. package/dist/src/console/tokens.d.ts.map +1 -0
  67. package/dist/src/console/tokens.js +145 -0
  68. package/dist/src/console/tokens.js.map +1 -0
  69. package/dist/src/console/vault.d.ts +188 -0
  70. package/dist/src/console/vault.d.ts.map +1 -0
  71. package/dist/src/console/vault.js +164 -0
  72. package/dist/src/console/vault.js.map +1 -0
  73. package/dist/src/console/workflows.d.ts +243 -0
  74. package/dist/src/console/workflows.d.ts.map +1 -0
  75. package/dist/src/console/workflows.js +205 -0
  76. package/dist/src/console/workflows.js.map +1 -0
  77. package/dist/src/http.d.ts +32 -2
  78. package/dist/src/http.d.ts.map +1 -1
  79. package/dist/src/http.js +11 -2
  80. package/dist/src/http.js.map +1 -1
  81. package/dist/src/types.d.ts +2 -2
  82. package/dist/src/types.d.ts.map +1 -1
  83. package/dist/src/version.js +1 -1
  84. package/package.json +5 -1
@@ -0,0 +1,117 @@
1
+ /**
2
+ * `client.console.functions.*` — the canonical, vendor-stable Function
3
+ * definition surface (`list`/`get`/`upsert`), relocated from the studio's own
4
+ * API client.
5
+ *
6
+ * **Studio-internal, not the published partner contract.** This namespace
7
+ * lives under the `console` subpath export (`@w6w/sdk/console`), excluded
8
+ * from `endpoints.json` and from the root barrel (`mod.ts`) — see
9
+ * `docs/console.md` and HITL-1 in this task's contract. `@w6w/sdk`'s
10
+ * instance-state mechanism pin still applies here exactly as it does to
11
+ * every other namespace (`docs/implementation.md` §MECHANISM PIN — instance
12
+ * state, never globals): this class holds no state of its own beyond the
13
+ * injected host, so two clients in one process never share a credential.
14
+ *
15
+ * **`invoke` is deliberately NOT modeled here.** The base
16
+ * `client.run({urn, payload})` (already-published surface,
17
+ * `endpoints.json`-named, exported from the root `mod.ts`) dispatches a
18
+ * `fn_…` URN through the exact same `InvokeFunctionService` the dedicated
19
+ * `/functions/:id/invoke` route uses, returning `{kind:"function", output}` —
20
+ * field-for-field identical to what the dedicated route returns. Adding a
21
+ * duplicate `console.functions.invoke` would give a caller two ways to reach
22
+ * the same route, the anti-duplication defect this project's own rules flag
23
+ * — mirrors `console.workflows`'s established precedent of NOT re-wrapping
24
+ * base `list`/`run`. Studio composes `client.run()` + `isFunctionRun` itself;
25
+ * no invoke method lives here, and none should be added later without
26
+ * re-litigating this reasoning.
27
+ *
28
+ * Three methods relocate from the studio's `// Functions` comment block
29
+ * (`packages/studio/src/api/client.ts:255-268`): `listFunctions`→`list`,
30
+ * `getFunction`→`get`, `saveFunction`→`upsert`.
31
+ *
32
+ * None of the three methods take a client-side default-project fallback or a
33
+ * `?project=` scoping parameter — neither is reachable via either HTTP route
34
+ * — so `FunctionsHost` needs only the transport, mirroring
35
+ * `WorkflowsHost`/`SchedulesHost`, not the base `DocumentsHost`.
36
+ *
37
+ * @module
38
+ */
39
+ import { path } from "../http.js";
40
+ import { unwrap } from "../types.js";
41
+ /**
42
+ * The `console.functions` namespace on a `W6wClient`.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const fns = await client.console.functions.list();
47
+ * const fn = await client.console.functions.get(fns[0].id);
48
+ * await client.console.functions.upsert({ ...fn, description: "Send an email" });
49
+ * ```
50
+ */
51
+ export class FunctionsApi {
52
+ #host;
53
+ /**
54
+ * @param host - The client this namespace issues requests through.
55
+ */
56
+ constructor(host) {
57
+ this.#host = host;
58
+ }
59
+ /**
60
+ * List the caller's Function definitions.
61
+ *
62
+ * Each row already carries `valid` — server-computed
63
+ * (`db/repos/functions.ts`'s `list()`) — same as {@linkcode get}'s splice,
64
+ * but here it arrives already flat on the summary row, nothing to merge.
65
+ *
66
+ * @returns The Functions, unwrapped from the `functions` envelope.
67
+ */
68
+ async list() {
69
+ const res = await this.#host.request({ method: "GET", path: "/functions" });
70
+ return unwrap(res, "functions");
71
+ }
72
+ /**
73
+ * Fetch one Function's stored definition.
74
+ *
75
+ * **`valid` is a TOP-LEVEL SIBLING of `function` on the wire, never spliced
76
+ * into the stored definition itself** (`admin/functions.ts:82-93`) — but
77
+ * this method DOES splice it into its own return value, for caller
78
+ * convenience: `{...body.function, valid: body.valid}`. This is a
79
+ * deliberate, behavior-preserving relocation of studio's own current
80
+ * `getFunction` (`client.ts:259-262`), not a redesign — a raw
81
+ * `{function, valid}` return would be a regression.
82
+ *
83
+ * No 404 special-casing — propagates as `ApiError` like every other "get"
84
+ * in this package except `console.schedules.get`'s documented exception.
85
+ *
86
+ * @param id - The `fn_…` id.
87
+ * @returns The Function definition with `valid` merged in at the top level.
88
+ * @throws {ApiError} `404 unknown_function` when there is no such id.
89
+ */
90
+ async get(id) {
91
+ const res = await this.#host.request({
92
+ method: "GET",
93
+ path: path `/functions/${id}`,
94
+ });
95
+ return { ...res.body.function, valid: res.body.valid };
96
+ }
97
+ /**
98
+ * Register (create or overwrite) a Function definition.
99
+ *
100
+ * `definition` is the whole definition, sent verbatim as the request body —
101
+ * not wrapped in an envelope key.
102
+ *
103
+ * @param definition - The whole Function definition, forwarded verbatim.
104
+ * @returns The new/updated Function's id and key.
105
+ * @throws {ApiError} `400 invalid_function` — structurally invalid body.
106
+ * @throws {ApiError} `409 function_conflict` — another `(tenant,subject)` owns this id.
107
+ */
108
+ async upsert(definition) {
109
+ const res = await this.#host.request({
110
+ method: "POST",
111
+ path: "/functions",
112
+ body: definition,
113
+ });
114
+ return unwrap(res, "function");
115
+ }
116
+ }
117
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/console/functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoErC;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACd,KAAK,CAAgB;IAE9B;;OAEG;IACH,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACrF,OAAO,MAAM,CAAoB,GAAG,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4C;YAC9E,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAA,cAAc,EAAE,EAAE;SAC7B,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,CAAC,UAAuB;QAClC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;QACH,OAAO,MAAM,CAA8B,GAAG,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * `@w6w/sdk/console` — the console-only namespace group.
3
+ *
4
+ * A **second, separate** entry point from the package's root (`@w6w/sdk`),
5
+ * built on the same transport (`../http.ts`, `../errors.ts`, `../config.ts`)
6
+ * but deliberately EXCLUDED from `endpoints.json`'s `operations[]` and from
7
+ * the root barrel (`../../mod.ts`) — see `docs/console.md` and HITL-1 in this
8
+ * task's contract. `client.console` is instance state exactly like every other
9
+ * namespace on `W6wClient` (`docs/implementation.md` §MECHANISM PIN —
10
+ * instance state, never globals): it holds the host it was constructed with
11
+ * and nothing of its own.
12
+ *
13
+ * This file is the append point for the console surface's later phases: each
14
+ * new console domain gets one `this.<domain> = new <Domain>Api(host)` line
15
+ * here, mirroring `reliability` below, rather than being folded into
16
+ * `../client.ts` directly.
17
+ *
18
+ * @module
19
+ */
20
+ import type { HttpResponse, RequestOptions } from "../http.ts";
21
+ import { ApiCallsApi } from "./api-calls.ts";
22
+ import { AppsApi } from "./apps.ts";
23
+ import { AuthApi } from "./auth.ts";
24
+ import { ConnectionsApi } from "./connections.ts";
25
+ import { DashboardApi } from "./dashboard.ts";
26
+ import { EndpointsApi } from "./endpoints.ts";
27
+ import { FunctionsApi } from "./functions.ts";
28
+ import { ReliabilityApi } from "./reliability.ts";
29
+ import { ProjectsApi } from "./projects.ts";
30
+ import { SavedTestsApi } from "./saved-tests.ts";
31
+ import { SchedulesApi } from "./schedules.ts";
32
+ import { StepTestsApi } from "./step-tests.ts";
33
+ import { SubscriptionsApi } from "./subscriptions.ts";
34
+ import { TenantOAuthAppsApi } from "./tenant-oauth-apps.ts";
35
+ import { TokensApi } from "./tokens.ts";
36
+ import { VaultApi } from "./vault.ts";
37
+ import { WorkflowsApi } from "./workflows.ts";
38
+ export { AuthApi } from "./auth.ts";
39
+ export type { AccountWire, AuthHost, ConsoleMe, CreateAccountResponse, LoginResponse, SignupInput, SignupResponse, SignupUser, SlugAvailabilityResponse, User, } from "./auth.ts";
40
+ export { DashboardApi } from "./dashboard.ts";
41
+ export type { DashboardHost, DashboardStats, DashboardStatsParams } from "./dashboard.ts";
42
+ export { ReliabilityApi } from "./reliability.ts";
43
+ export type { ReliabilityErrorMix, ReliabilityHost, ReliabilityService, ReliabilityServices, ReliabilityState, ReliabilityUptimeDay, ReliabilityVendorStatus, } from "./reliability.ts";
44
+ export { ProjectsApi } from "./projects.ts";
45
+ export type { Project, ProjectsHost } from "./projects.ts";
46
+ export { SchedulesApi } from "./schedules.ts";
47
+ export type { Schedule, SchedulesHost, ScheduleUpsertInput } from "./schedules.ts";
48
+ export { AppsApi } from "./apps.ts";
49
+ export type { ActionDef, ActionParam, ApiCallRecord, AppDetail, AppHealthStatus, AppsHost, AppSummary, AuthDef, AuthField, CredentialPosture, HealthCheckMeta, HealthKind, HealthQuota, HealthReport, HealthResult, HealthScope, HealthSeverity, HealthState, ImportResponse, InvokeOptions, InvokeStartState, OAuthConfigSummary, PackEntryPreview, PackPreviewInfo, PreviewSourceResponse, RefreshAppResponse, TriggerDef, UpsertOAuthConfigInput, } from "./apps.ts";
50
+ export { ConnectionsApi } from "./connections.ts";
51
+ export type { ConnectionsHost, ConnectionTestResult } from "./connections.ts";
52
+ export { WorkflowsApi } from "./workflows.ts";
53
+ export type { RunState, RunSummary, WorkflowsHost } from "./workflows.ts";
54
+ export { SavedTestsApi } from "./saved-tests.ts";
55
+ export type { SavedTest, SavedTestRun, SavedTestsHost, TestRunSummary } from "./saved-tests.ts";
56
+ export { StepTestsApi } from "./step-tests.ts";
57
+ export type { StepTest, StepTestRun, StepTestsHost } from "./step-tests.ts";
58
+ export { VaultApi } from "./vault.ts";
59
+ export type { SecretValue, VaultHost, VaultSecretSummary } from "./vault.ts";
60
+ export { TokensApi } from "./tokens.ts";
61
+ export type { ApiToken, ApiTokenStatus, CreateTokenResponse, TokensHost } from "./tokens.ts";
62
+ export { FunctionsApi } from "./functions.ts";
63
+ export type { FunctionDef, FunctionImpl, FunctionInput, FunctionOutputField, FunctionsHost, FunctionSummary, } from "./functions.ts";
64
+ export { EndpointsApi, SECRET_MASK } from "./endpoints.ts";
65
+ export type { ActionTarget, Callable, EndpointAuthMode, EndpointDef, EndpointInput, EndpointInvokeResult, EndpointSecurity, EndpointsHost, EndpointSummary, EndpointTarget, Exposure, } from "./endpoints.ts";
66
+ export { SubscriptionsApi } from "./subscriptions.ts";
67
+ export type { Subscription, SubscriptionCreateInput, SubscriptionsHost, TriggerEventStatus, TriggerEventSummary, } from "./subscriptions.ts";
68
+ export { ApiCallsApi } from "./api-calls.ts";
69
+ export type { ApiCallsFilter, ApiCallsHost } from "./api-calls.ts";
70
+ export { TenantOAuthAppsApi } from "./tenant-oauth-apps.ts";
71
+ export type { SetTenantOAuthAppInput, TenantOAuthAppsHost, TenantOAuthAppsResponse, TenantOAuthAppSummary, } from "./tenant-oauth-apps.ts";
72
+ /**
73
+ * The slice of `W6wClient` the console namespace group needs: the transport,
74
+ * and nothing else. Structural rather than a concrete client type, so
75
+ * `ConsoleApi` stays independently constructible in a test and this module
76
+ * never imports the client back.
77
+ */
78
+ export interface ConsoleHost {
79
+ /** Perform one request. */
80
+ request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
81
+ }
82
+ /**
83
+ * The `console` namespace group on a `W6wClient` — studio-internal, not part
84
+ * of the published partner contract.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const board = await client.console.reliability.list(30, 5);
89
+ * ```
90
+ */
91
+ export declare class ConsoleApi {
92
+ /** `console.reliability.*`. */
93
+ readonly reliability: ReliabilityApi;
94
+ /** `console.auth.*`. */
95
+ readonly auth: AuthApi;
96
+ /** `console.dashboard.*`. */
97
+ readonly dashboard: DashboardApi;
98
+ /** `console.projects.*`. */
99
+ readonly projects: ProjectsApi;
100
+ /** `console.schedules.*`. */
101
+ readonly schedules: SchedulesApi;
102
+ /** `console.apps.*`. */
103
+ readonly apps: AppsApi;
104
+ /** `console.connections.*`. */
105
+ readonly connections: ConnectionsApi;
106
+ /** `console.workflows.*`. */
107
+ readonly workflows: WorkflowsApi;
108
+ /** `console.savedTests.*`. */
109
+ readonly savedTests: SavedTestsApi;
110
+ /** `console.stepTests.*`. */
111
+ readonly stepTests: StepTestsApi;
112
+ /** `console.vault.*`. */
113
+ readonly vault: VaultApi;
114
+ /** `console.tokens.*`. */
115
+ readonly tokens: TokensApi;
116
+ /** `console.functions.*`. */
117
+ readonly functions: FunctionsApi;
118
+ /** `console.endpoints.*`. */
119
+ readonly endpoints: EndpointsApi;
120
+ /** `console.subscriptions.*`. */
121
+ readonly subscriptions: SubscriptionsApi;
122
+ /** `console.apiCalls.*`. */
123
+ readonly apiCalls: ApiCallsApi;
124
+ /** `console.tenantOAuthApps.*` — the caller's OWN tenant, never a tenant of its choosing. */
125
+ readonly tenantOAuthApps: TenantOAuthAppsApi;
126
+ /**
127
+ * @param host - The client this namespace group issues requests through.
128
+ */
129
+ constructor(host: ConsoleHost);
130
+ }
131
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/console/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;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;IAE7C;;OAEG;gBACS,IAAI,EAAE,WAAW;CAmB9B"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * `@w6w/sdk/console` — the console-only namespace group.
3
+ *
4
+ * A **second, separate** entry point from the package's root (`@w6w/sdk`),
5
+ * built on the same transport (`../http.ts`, `../errors.ts`, `../config.ts`)
6
+ * but deliberately EXCLUDED from `endpoints.json`'s `operations[]` and from
7
+ * the root barrel (`../../mod.ts`) — see `docs/console.md` and HITL-1 in this
8
+ * task's contract. `client.console` is instance state exactly like every other
9
+ * namespace on `W6wClient` (`docs/implementation.md` §MECHANISM PIN —
10
+ * instance state, never globals): it holds the host it was constructed with
11
+ * and nothing of its own.
12
+ *
13
+ * This file is the append point for the console surface's later phases: each
14
+ * new console domain gets one `this.<domain> = new <Domain>Api(host)` line
15
+ * here, mirroring `reliability` below, rather than being folded into
16
+ * `../client.ts` directly.
17
+ *
18
+ * @module
19
+ */
20
+ import { ApiCallsApi } from "./api-calls.js";
21
+ import { AppsApi } from "./apps.js";
22
+ import { AuthApi } from "./auth.js";
23
+ import { ConnectionsApi } from "./connections.js";
24
+ import { DashboardApi } from "./dashboard.js";
25
+ import { EndpointsApi } from "./endpoints.js";
26
+ import { FunctionsApi } from "./functions.js";
27
+ import { ReliabilityApi } from "./reliability.js";
28
+ import { ProjectsApi } from "./projects.js";
29
+ import { SavedTestsApi } from "./saved-tests.js";
30
+ import { SchedulesApi } from "./schedules.js";
31
+ import { StepTestsApi } from "./step-tests.js";
32
+ import { SubscriptionsApi } from "./subscriptions.js";
33
+ import { TenantOAuthAppsApi } from "./tenant-oauth-apps.js";
34
+ import { TokensApi } from "./tokens.js";
35
+ import { VaultApi } from "./vault.js";
36
+ import { WorkflowsApi } from "./workflows.js";
37
+ export { AuthApi } from "./auth.js";
38
+ export { DashboardApi } from "./dashboard.js";
39
+ export { ReliabilityApi } from "./reliability.js";
40
+ export { ProjectsApi } from "./projects.js";
41
+ export { SchedulesApi } from "./schedules.js";
42
+ export { AppsApi } from "./apps.js";
43
+ export { ConnectionsApi } from "./connections.js";
44
+ export { WorkflowsApi } from "./workflows.js";
45
+ export { SavedTestsApi } from "./saved-tests.js";
46
+ export { StepTestsApi } from "./step-tests.js";
47
+ export { VaultApi } from "./vault.js";
48
+ export { TokensApi } from "./tokens.js";
49
+ export { FunctionsApi } from "./functions.js";
50
+ export { EndpointsApi, SECRET_MASK } from "./endpoints.js";
51
+ export { SubscriptionsApi } from "./subscriptions.js";
52
+ export { ApiCallsApi } from "./api-calls.js";
53
+ export { TenantOAuthAppsApi } from "./tenant-oauth-apps.js";
54
+ /**
55
+ * The `console` namespace group on a `W6wClient` — studio-internal, not part
56
+ * of the published partner contract.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const board = await client.console.reliability.list(30, 5);
61
+ * ```
62
+ */
63
+ export class ConsoleApi {
64
+ /** `console.reliability.*`. */
65
+ reliability;
66
+ /** `console.auth.*`. */
67
+ auth;
68
+ /** `console.dashboard.*`. */
69
+ dashboard;
70
+ /** `console.projects.*`. */
71
+ projects;
72
+ /** `console.schedules.*`. */
73
+ schedules;
74
+ /** `console.apps.*`. */
75
+ apps;
76
+ /** `console.connections.*`. */
77
+ connections;
78
+ /** `console.workflows.*`. */
79
+ workflows;
80
+ /** `console.savedTests.*`. */
81
+ savedTests;
82
+ /** `console.stepTests.*`. */
83
+ stepTests;
84
+ /** `console.vault.*`. */
85
+ vault;
86
+ /** `console.tokens.*`. */
87
+ tokens;
88
+ /** `console.functions.*`. */
89
+ functions;
90
+ /** `console.endpoints.*`. */
91
+ endpoints;
92
+ /** `console.subscriptions.*`. */
93
+ subscriptions;
94
+ /** `console.apiCalls.*`. */
95
+ apiCalls;
96
+ /** `console.tenantOAuthApps.*` — the caller's OWN tenant, never a tenant of its choosing. */
97
+ tenantOAuthApps;
98
+ /**
99
+ * @param host - The client this namespace group issues requests through.
100
+ */
101
+ constructor(host) {
102
+ this.reliability = new ReliabilityApi(host);
103
+ this.auth = new AuthApi(host);
104
+ this.dashboard = new DashboardApi(host);
105
+ this.projects = new ProjectsApi(host);
106
+ this.schedules = new SchedulesApi(host);
107
+ this.apps = new AppsApi(host);
108
+ this.connections = new ConnectionsApi(host);
109
+ this.workflows = new WorkflowsApi(host);
110
+ this.savedTests = new SavedTestsApi(host);
111
+ this.stepTests = new StepTestsApi(host);
112
+ this.vault = new VaultApi(host);
113
+ this.tokens = new TokensApi(host);
114
+ this.functions = new FunctionsApi(host);
115
+ this.endpoints = new EndpointsApi(host);
116
+ this.subscriptions = new SubscriptionsApi(host);
117
+ this.apiCalls = new ApiCallsApi(host);
118
+ this.tenantOAuthApps = new TenantOAuthAppsApi(host);
119
+ }
120
+ }
121
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../src/console/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACt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,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * `client.console.projects.*` — account-level projects, relocated from the
3
+ * 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
+ * **Scope is studio's actual call surface, not the server's full route
15
+ * surface.** The server also exposes `PATCH /projects/:id` (rename),
16
+ * `POST /projects/:id/archive` and `POST /projects/:id/unarchive` — none of
17
+ * these were ever wrapped in studio's `api/client.ts` (zero client-side
18
+ * coverage, not just zero callers), and `GeneralPage.tsx`'s own header comment
19
+ * confirms this is deliberate ("no rename/archive/unarchive/view-archived
20
+ * here"). This module relocates exactly `listProjects`/`createProject`/
21
+ * `deleteProject` and no more — see this task's contract Requirement and
22
+ * `plan.md`'s FINDINGS DISPOSITION for the full reasoning.
23
+ *
24
+ * Neither method here takes a scoping parameter beyond what is modeled below:
25
+ * projects operate at the account level, so `ProjectsHost` needs only the
26
+ * transport, no client configuration — mirrors `VarsHost` in `../vars.ts`, not
27
+ * `DocumentsHost`.
28
+ *
29
+ * @module
30
+ */
31
+ import { type HttpResponse, type RequestOptions } from "../http.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 ProjectsHost {
39
+ /** Perform one request. */
40
+ request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
41
+ }
42
+ /**
43
+ * A project — a workspace within the account; each owns its own workflows.
44
+ * Field-for-field per `packages/studio/src/api/types.ts:308-317` — this module
45
+ * does not redesign the shape, only gives it a second home.
46
+ */
47
+ export interface Project {
48
+ id: string;
49
+ account: string;
50
+ name: string;
51
+ isDefault: boolean;
52
+ /** `archived` projects are hidden from the switcher; the default is never archived. */
53
+ status: "active" | "archived";
54
+ createdAt: string;
55
+ updatedAt: string;
56
+ }
57
+ /**
58
+ * The `console.projects` namespace on a `W6wClient`.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const projects = await client.console.projects.list();
63
+ * const created = await client.console.projects.create("Acme");
64
+ * await client.console.projects.delete(created.id);
65
+ * ```
66
+ */
67
+ export declare class ProjectsApi {
68
+ #private;
69
+ /**
70
+ * @param host - The client this namespace issues requests through.
71
+ */
72
+ constructor(host: ProjectsHost);
73
+ /**
74
+ * List the account's projects.
75
+ *
76
+ * No query parameter — the default excludes archived projects, and this
77
+ * method sends none: studio's own `listProjects` never exposed
78
+ * `includeArchived`, and this relocation does not add it
79
+ * (`packages/server/packages/api/admin/projects.ts:55-63`).
80
+ *
81
+ * @returns The projects, unwrapped from the `projects` envelope.
82
+ * @throws {ApiError} On any non-2xx.
83
+ */
84
+ list(): Promise<Project[]>;
85
+ /**
86
+ * Create a project under a caller-chosen name.
87
+ *
88
+ * @param name - The project's display name.
89
+ * @returns The created project (the server answers `201`).
90
+ * @throws {ApiError} On any non-2xx.
91
+ */
92
+ create(name: string): Promise<Project>;
93
+ /**
94
+ * Delete a project.
95
+ *
96
+ * Returns nothing: the server's `{ok: true}` carries no information a caller
97
+ * can use, and unwrapping it to a value would invite `if (await delete(...))`.
98
+ * Deleting an unknown id, or the account's default project, both answer
99
+ * `404 unknown_project` (`admin/projects.ts:131-147`) — this method does not
100
+ * discriminate the two, only whether the call succeeded.
101
+ *
102
+ * @param id - The `prj_…` id.
103
+ * @throws {ApiError} `404 unknown_project` when there is no such id, or it is the default project.
104
+ */
105
+ delete(id: string): Promise<void>;
106
+ }
107
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/console/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAG1E;;;;;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;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,qBAAa,WAAW;;IAGtB;;OAEG;gBACS,IAAI,EAAE,YAAY;IAI9B;;;;;;;;;;OAUG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAKhC;;;;;;OAMG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS5C;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * `client.console.projects.*` — account-level projects, relocated from the
3
+ * 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
+ * **Scope is studio's actual call surface, not the server's full route
15
+ * surface.** The server also exposes `PATCH /projects/:id` (rename),
16
+ * `POST /projects/:id/archive` and `POST /projects/:id/unarchive` — none of
17
+ * these were ever wrapped in studio's `api/client.ts` (zero client-side
18
+ * coverage, not just zero callers), and `GeneralPage.tsx`'s own header comment
19
+ * confirms this is deliberate ("no rename/archive/unarchive/view-archived
20
+ * here"). This module relocates exactly `listProjects`/`createProject`/
21
+ * `deleteProject` and no more — see this task's contract Requirement and
22
+ * `plan.md`'s FINDINGS DISPOSITION for the full reasoning.
23
+ *
24
+ * Neither method here takes a scoping parameter beyond what is modeled below:
25
+ * projects operate at the account level, so `ProjectsHost` needs only the
26
+ * transport, no client configuration — mirrors `VarsHost` in `../vars.ts`, not
27
+ * `DocumentsHost`.
28
+ *
29
+ * @module
30
+ */
31
+ import { path } from "../http.js";
32
+ import { unwrap } from "../types.js";
33
+ /**
34
+ * The `console.projects` namespace on a `W6wClient`.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const projects = await client.console.projects.list();
39
+ * const created = await client.console.projects.create("Acme");
40
+ * await client.console.projects.delete(created.id);
41
+ * ```
42
+ */
43
+ export class ProjectsApi {
44
+ #host;
45
+ /**
46
+ * @param host - The client this namespace issues requests through.
47
+ */
48
+ constructor(host) {
49
+ this.#host = host;
50
+ }
51
+ /**
52
+ * List the account's projects.
53
+ *
54
+ * No query parameter — the default excludes archived projects, and this
55
+ * method sends none: studio's own `listProjects` never exposed
56
+ * `includeArchived`, and this relocation does not add it
57
+ * (`packages/server/packages/api/admin/projects.ts:55-63`).
58
+ *
59
+ * @returns The projects, unwrapped from the `projects` envelope.
60
+ * @throws {ApiError} On any non-2xx.
61
+ */
62
+ async list() {
63
+ const res = await this.#host.request({ method: "GET", path: "/projects" });
64
+ return unwrap(res, "projects");
65
+ }
66
+ /**
67
+ * Create a project under a caller-chosen name.
68
+ *
69
+ * @param name - The project's display name.
70
+ * @returns The created project (the server answers `201`).
71
+ * @throws {ApiError} On any non-2xx.
72
+ */
73
+ async create(name) {
74
+ const res = await this.#host.request({
75
+ method: "POST",
76
+ path: "/projects",
77
+ body: { name },
78
+ });
79
+ return unwrap(res, "project");
80
+ }
81
+ /**
82
+ * Delete a project.
83
+ *
84
+ * Returns nothing: the server's `{ok: true}` carries no information a caller
85
+ * can use, and unwrapping it to a value would invite `if (await delete(...))`.
86
+ * Deleting an unknown id, or the account's default project, both answer
87
+ * `404 unknown_project` (`admin/projects.ts:131-147`) — this method does not
88
+ * discriminate the two, only whether the call succeeded.
89
+ *
90
+ * @param id - The `prj_…` id.
91
+ * @throws {ApiError} `404 unknown_project` when there is no such id, or it is the default project.
92
+ */
93
+ async delete(id) {
94
+ await this.#host.request({ method: "DELETE", path: path `/projects/${id}` });
95
+ }
96
+ }
97
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../src/console/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA6BrC;;;;;;;;;GASG;AACH,MAAM,OAAO,WAAW;IACb,KAAK,CAAe;IAE7B;;OAEG;IACH,YAAY,IAAkB;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QACpF,OAAO,MAAM,CAAY,GAAG,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;QACH,OAAO,MAAM,CAAU,GAAG,EAAE,SAAS,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAA,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;IACvF,CAAC;CACF"}