@w6w/sdk 0.5.0 → 0.9.8

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 (132) hide show
  1. package/README.md +185 -32
  2. package/dist/mod.d.ts +10 -4
  3. package/dist/mod.d.ts.map +1 -1
  4. package/dist/mod.js +3 -0
  5. package/dist/mod.js.map +1 -1
  6. package/dist/src/client.d.ts +37 -5
  7. package/dist/src/client.d.ts.map +1 -1
  8. package/dist/src/client.js +40 -5
  9. package/dist/src/client.js.map +1 -1
  10. package/dist/src/config.d.ts +83 -6
  11. package/dist/src/config.d.ts.map +1 -1
  12. package/dist/src/config.js +41 -5
  13. package/dist/src/config.js.map +1 -1
  14. package/dist/src/connections.d.ts +3 -2
  15. package/dist/src/connections.d.ts.map +1 -1
  16. package/dist/src/connections.js +7 -2
  17. package/dist/src/connections.js.map +1 -1
  18. package/dist/src/console/aliases.d.ts +137 -0
  19. package/dist/src/console/aliases.d.ts.map +1 -0
  20. package/dist/src/console/aliases.js +113 -0
  21. package/dist/src/console/aliases.js.map +1 -0
  22. package/dist/src/console/api-calls.d.ts +4 -3
  23. package/dist/src/console/api-calls.d.ts.map +1 -1
  24. package/dist/src/console/api-calls.js +4 -3
  25. package/dist/src/console/api-calls.js.map +1 -1
  26. package/dist/src/console/apps.d.ts +181 -8
  27. package/dist/src/console/apps.d.ts.map +1 -1
  28. package/dist/src/console/apps.js +67 -12
  29. package/dist/src/console/apps.js.map +1 -1
  30. package/dist/src/console/auth.d.ts +245 -7
  31. package/dist/src/console/auth.d.ts.map +1 -1
  32. package/dist/src/console/auth.js +177 -8
  33. package/dist/src/console/auth.js.map +1 -1
  34. package/dist/src/console/commerce.d.ts +428 -0
  35. package/dist/src/console/commerce.d.ts.map +1 -0
  36. package/dist/src/console/commerce.js +220 -0
  37. package/dist/src/console/commerce.js.map +1 -0
  38. package/dist/src/console/dashboard.d.ts +8 -0
  39. package/dist/src/console/dashboard.d.ts.map +1 -1
  40. package/dist/src/console/dashboard.js.map +1 -1
  41. package/dist/src/console/endpoints.d.ts +79 -6
  42. package/dist/src/console/endpoints.d.ts.map +1 -1
  43. package/dist/src/console/endpoints.js.map +1 -1
  44. package/dist/src/console/functions.d.ts +35 -4
  45. package/dist/src/console/functions.d.ts.map +1 -1
  46. package/dist/src/console/functions.js +13 -0
  47. package/dist/src/console/functions.js.map +1 -1
  48. package/dist/src/console/mod.d.ts +32 -7
  49. package/dist/src/console/mod.d.ts.map +1 -1
  50. package/dist/src/console/mod.js +26 -1
  51. package/dist/src/console/mod.js.map +1 -1
  52. package/dist/src/console/otp.d.ts +127 -0
  53. package/dist/src/console/otp.d.ts.map +1 -0
  54. package/dist/src/console/otp.js +118 -0
  55. package/dist/src/console/otp.js.map +1 -0
  56. package/dist/src/console/passkeys.d.ts +246 -0
  57. package/dist/src/console/passkeys.d.ts.map +1 -0
  58. package/dist/src/console/passkeys.js +192 -0
  59. package/dist/src/console/passkeys.js.map +1 -0
  60. package/dist/src/console/reliability.d.ts +101 -6
  61. package/dist/src/console/reliability.d.ts.map +1 -1
  62. package/dist/src/console/reliability.js +16 -5
  63. package/dist/src/console/reliability.js.map +1 -1
  64. package/dist/src/console/step-tests.d.ts +7 -1
  65. package/dist/src/console/step-tests.d.ts.map +1 -1
  66. package/dist/src/console/step-tests.js +1 -1
  67. package/dist/src/console/step-tests.js.map +1 -1
  68. package/dist/src/console/subscriptions.d.ts +38 -16
  69. package/dist/src/console/subscriptions.d.ts.map +1 -1
  70. package/dist/src/console/subscriptions.js +7 -13
  71. package/dist/src/console/subscriptions.js.map +1 -1
  72. package/dist/src/console/tenant-login-flags.d.ts +106 -0
  73. package/dist/src/console/tenant-login-flags.d.ts.map +1 -0
  74. package/dist/src/console/tenant-login-flags.js +113 -0
  75. package/dist/src/console/tenant-login-flags.js.map +1 -0
  76. package/dist/src/console/tenant-oauth-apps.d.ts +75 -14
  77. package/dist/src/console/tenant-oauth-apps.d.ts.map +1 -1
  78. package/dist/src/console/tenant-oauth-apps.js +37 -11
  79. package/dist/src/console/tenant-oauth-apps.js.map +1 -1
  80. package/dist/src/console/tokens.d.ts +2 -0
  81. package/dist/src/console/tokens.d.ts.map +1 -1
  82. package/dist/src/console/tokens.js.map +1 -1
  83. package/dist/src/console/workflows.d.ts +14 -0
  84. package/dist/src/console/workflows.d.ts.map +1 -1
  85. package/dist/src/console/workflows.js +13 -0
  86. package/dist/src/console/workflows.js.map +1 -1
  87. package/dist/src/documents.d.ts +9 -5
  88. package/dist/src/documents.d.ts.map +1 -1
  89. package/dist/src/documents.js +6 -3
  90. package/dist/src/documents.js.map +1 -1
  91. package/dist/src/endpoints.d.ts +75 -0
  92. package/dist/src/endpoints.d.ts.map +1 -0
  93. package/dist/src/endpoints.js +47 -0
  94. package/dist/src/endpoints.js.map +1 -0
  95. package/dist/src/functions.d.ts +236 -0
  96. package/dist/src/functions.d.ts.map +1 -0
  97. package/dist/src/functions.js +201 -0
  98. package/dist/src/functions.js.map +1 -0
  99. package/dist/src/http.d.ts +58 -10
  100. package/dist/src/http.d.ts.map +1 -1
  101. package/dist/src/http.js +82 -11
  102. package/dist/src/http.js.map +1 -1
  103. package/dist/src/me.d.ts +3 -2
  104. package/dist/src/me.d.ts.map +1 -1
  105. package/dist/src/me.js +7 -2
  106. package/dist/src/me.js.map +1 -1
  107. package/dist/src/run.d.ts +19 -5
  108. package/dist/src/run.d.ts.map +1 -1
  109. package/dist/src/run.js +14 -4
  110. package/dist/src/run.js.map +1 -1
  111. package/dist/src/server/mod.d.ts +100 -0
  112. package/dist/src/server/mod.d.ts.map +1 -0
  113. package/dist/src/server/mod.js +121 -0
  114. package/dist/src/server/mod.js.map +1 -0
  115. package/dist/src/team.d.ts +204 -0
  116. package/dist/src/team.d.ts.map +1 -0
  117. package/dist/src/team.js +161 -0
  118. package/dist/src/team.js.map +1 -0
  119. package/dist/src/types.d.ts +143 -10
  120. package/dist/src/types.d.ts.map +1 -1
  121. package/dist/src/types.js +27 -0
  122. package/dist/src/types.js.map +1 -1
  123. package/dist/src/vars.d.ts +5 -3
  124. package/dist/src/vars.d.ts.map +1 -1
  125. package/dist/src/vars.js +14 -4
  126. package/dist/src/vars.js.map +1 -1
  127. package/dist/src/version.js +1 -1
  128. package/dist/src/workflows.d.ts +261 -9
  129. package/dist/src/workflows.d.ts.map +1 -1
  130. package/dist/src/workflows.js +246 -7
  131. package/dist/src/workflows.js.map +1 -1
  132. package/package.json +5 -1
@@ -43,9 +43,27 @@
43
43
  * handlers, not assumed) — every method here returns `res.body` directly and
44
44
  * never calls this package's `unwrap()` helper.
45
45
  *
46
+ * **T1.1.4's seven `/me/*` methods added here (profile, contact
47
+ * change-and-confirm, promote, remove, password).** Registered BELOW the auth
48
+ * guard (`packages/server/packages/api/data/me.ts`'s own doc comment) — every
49
+ * one of the seven is AUTHENTICATED, the default `requireAuth`, unlike
50
+ * `login`/`signup`/`checkAccountSlug` above. `removeContact` and
51
+ * `promoteContact` are not in this task's pinned method list but are added
52
+ * per HITL-7 ("if T1.1.4 ships routes for adding / removing / promoting a
53
+ * secondary contact, they get methods here too") — both routes exist on the
54
+ * merged branch (`data/me.ts:135-154`).
55
+ *
56
+ * **`UserProfile.hasPassword` is a RENAME of the wire's `passwordSet`, not an
57
+ * invented field.** `GET /me/profile` answers `passwordSet` (`data/me.ts:9`,
58
+ * `packages/bll/signup.ts:555`, derived server-side from
59
+ * `password_hash !== null` — the hash itself never appears). HITL-10 needs
60
+ * this fact under a name Studio's "Set a password"/"Change password" fork
61
+ * reads directly; `toUserProfile()` below performs the rename from the exact
62
+ * value the wire sent, never a default and never computed from anything else.
63
+ *
46
64
  * @module
47
65
  */
48
- import type { HttpResponse, RequestOptions } from "../http.ts";
66
+ import { type HttpResponse, type RequestOptions } from "../http.ts";
49
67
  /**
50
68
  * The slice of `W6WClient` this namespace needs: the transport, and nothing
51
69
  * else. Structural rather than a concrete client type, so the namespace stays
@@ -66,6 +84,11 @@ export interface LoginResponse {
66
84
  user: User;
67
85
  expiresIn: number;
68
86
  }
87
+ /** `POST /auth/refresh` → 200 (`id/auth.ts`'s `refreshHandler`). */
88
+ export interface RefreshResponse {
89
+ token: string;
90
+ expiresIn: number;
91
+ }
69
92
  /** The signed-up user, as `POST /auth/signup` returns it (`data/signup.ts:147-152`). */
70
93
  export interface SignupUser {
71
94
  id: string;
@@ -110,6 +133,17 @@ export interface SlugAvailabilityResponse {
110
133
  available: boolean;
111
134
  suggestions: string[];
112
135
  }
136
+ /** The body `createAccount` sends. An options object, matching `signup`'s
137
+ * `SignupInput` shape two methods below — `name`/`slug` are **not** sent, the
138
+ * server mints the slug from `companyName`. */
139
+ export interface CreateAccountInput {
140
+ /** The company/workspace name. Optional — the server mints the account slug from it when present. */
141
+ companyName?: string;
142
+ /** The caller's role in the company, from the signup form's dropdown. Optional. */
143
+ role?: string;
144
+ /** What the caller intends to use w6w for, from the signup form's dropdown. Optional. */
145
+ usage?: string;
146
+ }
113
147
  /** `POST /accounts` → 201 (`id/signup.ts:69-73`). The token re-issues the session
114
148
  * with the new account's claim on it. */
115
149
  export interface CreateAccountResponse {
@@ -149,15 +183,118 @@ export interface ConsoleMe {
149
183
  * accidentally granted.
150
184
  */
151
185
  tenantAdmin: boolean;
186
+ /**
187
+ * Server-decided: may this caller manage its account's team (invite, change
188
+ * a role, remove a member)? Studio-internal; not on the published `Me`.
189
+ *
190
+ * **Required, not optional, on purpose.** A client forced to branch on
191
+ * `undefined` is a client that will branch wrong; an older server that omits
192
+ * the key yields `undefined` at runtime, which is falsy, so every
193
+ * `if (me.canManageMembers)` fails CLOSED — the capability is denied, never
194
+ * accidentally granted.
195
+ */
196
+ canManageMembers: boolean;
152
197
  /** Component versions, as the published `Me` documents them. Optional and open. */
153
198
  versions?: Record<string, string>;
154
199
  }
200
+ /**
201
+ * One of the caller's own contact addresses (email or phone), as `GET /me/profile`
202
+ * lists it (`packages/bll/signup.ts`'s `ProfileContact`, `data/me.ts:9-12`).
203
+ */
204
+ export interface ProfileContact {
205
+ id: string;
206
+ kind: "email" | "phone";
207
+ value: string;
208
+ /** ISO-8601 timestamp, or `null` while unverified. */
209
+ verifiedAt: string | null;
210
+ }
211
+ /** One of the caller's registered login methods (`data/me.ts:9-12`). */
212
+ export interface ProfileLoginMethod {
213
+ id: string;
214
+ /** e.g. `"password"`, `"passkey"`. */
215
+ kind: string;
216
+ label: string;
217
+ /** ISO-8601 timestamp. */
218
+ createdAt: string;
219
+ /** ISO-8601 timestamp, or `null` if never used. */
220
+ lastUsedAt: string | null;
221
+ }
222
+ /** A pending, unconfirmed contact-change request (`data/me.ts:9-12`). */
223
+ export interface ProfilePendingChange {
224
+ id: string;
225
+ method: "email" | "phone";
226
+ value: string;
227
+ /** ISO-8601 timestamp; the pending row is unusable past this point. */
228
+ expiresAt: string;
229
+ /** ISO-8601 timestamp. */
230
+ createdAt: string;
231
+ }
232
+ /**
233
+ * The `users` row and its dependent state, as `GET`/`PATCH /me/profile`,
234
+ * `POST /me/contacts/confirm` and `POST /me/contacts/:id/primary` all return
235
+ * it (`data/me.ts:6-19`). Every method on this namespace that returns a
236
+ * profile returns THIS shape, mapped from the wire's `passwordSet` — see this
237
+ * module's header for why {@linkcode UserProfile.hasPassword} is a rename,
238
+ * not an invented field.
239
+ */
240
+ export interface UserProfile {
241
+ userId: string;
242
+ tenant: string;
243
+ displayName: string;
244
+ email: string | null;
245
+ emailVerified: boolean;
246
+ /**
247
+ * Whether the caller already has a local password. Read straight off the
248
+ * wire's `passwordSet` (`packages/bll/signup.ts:555`) — never defaulted,
249
+ * never computed client-side. Drives HITL-10's "Set a password" (`false`)
250
+ * vs "Change password" (`true`) fork.
251
+ */
252
+ hasPassword: boolean;
253
+ contacts: ProfileContact[];
254
+ loginMethods: ProfileLoginMethod[];
255
+ pending: ProfilePendingChange[];
256
+ }
257
+ /** The body `updateProfile` sends (`PATCH /me/profile`, `data/me.ts:53-71`). */
258
+ export interface UpdateProfileInput {
259
+ displayName: string;
260
+ }
261
+ /**
262
+ * The body `requestContactChange` sends (`POST /me/contacts/change`,
263
+ * `data/me.ts:73-98`). Parks a pending change; does not confirm it.
264
+ */
265
+ export interface RequestContactChangeInput {
266
+ method: "email" | "phone";
267
+ value: string;
268
+ }
269
+ /**
270
+ * The body `confirmContactChange` sends (`POST /me/contacts/confirm`,
271
+ * `data/me.ts:100-133`). Consumes the code sent to `requestContactChange`'s
272
+ * `value`.
273
+ */
274
+ export interface ConfirmContactChangeInput {
275
+ method: "email" | "phone";
276
+ code: string;
277
+ /** Promote the newly-confirmed contact to primary in the same call (D3). */
278
+ promote?: boolean;
279
+ }
280
+ /**
281
+ * The body `setPassword` sends (`POST /me/password`, `data/me.ts:156-184`).
282
+ * One method for HITL-10's set-and-change: `currentPassword` is a field, not
283
+ * a second method, because the merged route is the single `POST /me/password`
284
+ * — not two routes.
285
+ */
286
+ export interface SetPasswordInput {
287
+ newPassword: string;
288
+ /** Required by the server when the caller already has a password (`hasPassword: true`); omit
289
+ * for the first-time "set a password" case. */
290
+ currentPassword?: string;
291
+ }
155
292
  /**
156
293
  * The `console.auth` namespace on a `W6WClient`.
157
294
  *
158
295
  * @example
159
296
  * ```ts
160
- * const { token } = await client.console.auth.login("user", "pass");
297
+ * const { token } = await client.console.auth.login("user@example.com", "pass");
161
298
  * const me = await client.console.auth.getMe();
162
299
  * if (me.tenantAdmin) { // tenant-admin surface
163
300
  * }
@@ -175,12 +312,29 @@ export declare class AuthApi {
175
312
  * PUBLIC — sends no bearer, even on a client that already holds one
176
313
  * (`requireAuth: false`).
177
314
  *
178
- * @param username - The account username.
315
+ * @param identifier - The login identifier, normally the account's email. The
316
+ * platform operator credential (`AUTH_USERNAME`) is NOT email-shaped and is a
317
+ * legitimate value here — never validate this as an email (DECISIONS.md HITL-1).
318
+ * It is sent as the `email` key: the server resolves `body.email ?? body.username`.
179
319
  * @param password - The account password.
180
320
  * @returns The token, the caller's identity, and the token's lifetime.
181
321
  * @throws {ApiError} On any non-2xx, e.g. `401` for invalid credentials.
182
322
  */
183
- login(username: string, password: string): Promise<LoginResponse>;
323
+ login(identifier: string, password: string): Promise<LoginResponse>;
324
+ /**
325
+ * Mint a fresh token for the CURRENT session — same identity (subject,
326
+ * tenant, role, account, any admin claim), just a renewed lifetime. The
327
+ * sliding-session mechanism: a client that keeps calling this while a
328
+ * user is active never sees the original token's `exp` arrive.
329
+ *
330
+ * AUTHENTICATED — the default `requireAuth` applies (a caller with no
331
+ * token has no session to extend).
332
+ *
333
+ * @returns The new token and its lifetime in seconds.
334
+ * @throws {ApiError} `401` if the CURRENT token is already invalid/expired
335
+ * — refreshing cannot resurrect a session that has already lapsed.
336
+ */
337
+ refresh(): Promise<RefreshResponse>;
184
338
  /**
185
339
  * Self-serve signup: creates the user and mints a `role: "user"` session.
186
340
  *
@@ -213,12 +367,11 @@ export declare class AuthApi {
213
367
  * adopting it downgrades an operator; this method never writes the session
214
368
  * itself, the caller decides.
215
369
  *
216
- * @param name - The account's display name.
217
- * @param slug - The account's slug.
370
+ * @param input - The optional company name, role and use-case from the signup form.
218
371
  * @returns The created account, a re-issued token carrying its claim, and the token's lifetime.
219
372
  * @throws {ApiError} On any non-2xx, e.g. `409` when the slug is taken.
220
373
  */
221
- createAccount(name: string, slug: string): Promise<CreateAccountResponse>;
374
+ createAccount(input: CreateAccountInput): Promise<CreateAccountResponse>;
222
375
  /**
223
376
  * Read the caller's identity **and its tenant-admin capability**.
224
377
  *
@@ -237,5 +390,90 @@ export declare class AuthApi {
237
390
  * @throws {ApiError} On any non-2xx, e.g. `401` when the bearer is missing or expired.
238
391
  */
239
392
  getMe(): Promise<ConsoleMe>;
393
+ /**
394
+ * Read the caller's own profile — the real `users` row, including
395
+ * {@linkcode UserProfile.hasPassword}. Distinct from `getMe()`, which reads
396
+ * session claims: this reads the actual database row (`data/me.ts:43-51`).
397
+ *
398
+ * AUTHENTICATED — the default `requireAuth` applies.
399
+ *
400
+ * @returns The caller's profile.
401
+ * @throws {ApiError} `404 no_user_profile` when there is no `users` row for this principal.
402
+ */
403
+ getProfile(): Promise<UserProfile>;
404
+ /**
405
+ * Patch the caller's display name.
406
+ *
407
+ * AUTHENTICATED — the default `requireAuth` applies.
408
+ *
409
+ * @param input - The new display name.
410
+ * @returns The updated profile (`data/me.ts:53-71`).
411
+ * @throws {ApiError} `400 invalid_body`/`invalid_display_name`.
412
+ */
413
+ updateProfile(input: UpdateProfileInput): Promise<UserProfile>;
414
+ /**
415
+ * Park a pending email/phone change and send its confirmation code. Does
416
+ * NOT confirm the change — see {@linkcode confirmContactChange}.
417
+ *
418
+ * AUTHENTICATED — the default `requireAuth` applies.
419
+ *
420
+ * @param input - The contact method and the new value.
421
+ * @returns Nothing: the server answers `202` with `{ok: true}`, which carries no information a
422
+ * caller can use (`data/me.ts:73-98`).
423
+ * @throws {ApiError} `400 invalid_body`/`invalid_email`, `409 email_taken`.
424
+ */
425
+ requestContactChange(input: RequestContactChangeInput): Promise<void>;
426
+ /**
427
+ * Consume the code from {@linkcode requestContactChange} and confirm the
428
+ * pending change. Optionally promotes the newly-confirmed contact to
429
+ * primary in the same call (D3).
430
+ *
431
+ * AUTHENTICATED — the default `requireAuth` applies.
432
+ *
433
+ * @param input - The contact method, the code, and an optional promote flag.
434
+ * @returns The updated profile (`data/me.ts:100-133`).
435
+ * @throws {ApiError} `400 invalid_body`/`invalid_code`, `404 contact_not_found`.
436
+ */
437
+ confirmContactChange(input: ConfirmContactChangeInput): Promise<UserProfile>;
438
+ /**
439
+ * Remove one of the caller's own (non-primary) contacts. Added per HITL-7
440
+ * — `DELETE /me/contacts/:id` exists on the merged branch (`data/me.ts:135-144`).
441
+ *
442
+ * AUTHENTICATED — the default `requireAuth` applies.
443
+ *
444
+ * @param id - The contact id.
445
+ * @returns Nothing: the server answers `{ok: true}`, which carries no information a caller can
446
+ * use, mirroring `console.projects.delete`/`console.schedules.delete` in this same package.
447
+ * @throws {ApiError} `404 contact_not_found`.
448
+ */
449
+ removeContact(id: string): Promise<void>;
450
+ /**
451
+ * Promote one of the caller's own secondary contacts to primary. Added per
452
+ * HITL-7 — `POST /me/contacts/:id/primary` exists on the merged branch
453
+ * (`data/me.ts:146-154`).
454
+ *
455
+ * AUTHENTICATED — the default `requireAuth` applies.
456
+ *
457
+ * @param id - The contact id.
458
+ * @returns The updated profile.
459
+ * @throws {ApiError} `404 contact_not_found`, `403 contact_not_verified`.
460
+ */
461
+ promoteContact(id: string): Promise<UserProfile>;
462
+ /**
463
+ * Set or change the caller's password (HITL-10) — one method, since the
464
+ * merged route is the single `POST /me/password`, not two. Omit
465
+ * `currentPassword` for the first-time "set a password" case
466
+ * (`hasPassword: false`); the server requires it once a password already
467
+ * exists.
468
+ *
469
+ * AUTHENTICATED — the default `requireAuth` applies.
470
+ *
471
+ * @param input - The new password, plus the current one when required.
472
+ * @returns Nothing: the server answers `{ok: true}`, which carries no information a caller can
473
+ * use (`data/me.ts:156-184`).
474
+ * @throws {ApiError} `400 invalid_body`/`invalid_password`/`current_password_required`,
475
+ * `403 invalid_current_password`.
476
+ */
477
+ setPassword(input: SetPasswordInput): Promise<void>;
240
478
  }
241
479
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/console/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,qFAAqF;AACrF,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EA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
  * handlers, not assumed) — every method here returns `res.body` directly and
44
44
  * never calls this package's `unwrap()` helper.
45
45
  *
46
+ * **T1.1.4's seven `/me/*` methods added here (profile, contact
47
+ * change-and-confirm, promote, remove, password).** Registered BELOW the auth
48
+ * guard (`packages/server/packages/api/data/me.ts`'s own doc comment) — every
49
+ * one of the seven is AUTHENTICATED, the default `requireAuth`, unlike
50
+ * `login`/`signup`/`checkAccountSlug` above. `removeContact` and
51
+ * `promoteContact` are not in this task's pinned method list but are added
52
+ * per HITL-7 ("if T1.1.4 ships routes for adding / removing / promoting a
53
+ * secondary contact, they get methods here too") — both routes exist on the
54
+ * merged branch (`data/me.ts:135-154`).
55
+ *
56
+ * **`UserProfile.hasPassword` is a RENAME of the wire's `passwordSet`, not an
57
+ * invented field.** `GET /me/profile` answers `passwordSet` (`data/me.ts:9`,
58
+ * `packages/bll/signup.ts:555`, derived server-side from
59
+ * `password_hash !== null` — the hash itself never appears). HITL-10 needs
60
+ * this fact under a name Studio's "Set a password"/"Change password" fork
61
+ * reads directly; `toUserProfile()` below performs the rename from the exact
62
+ * value the wire sent, never a default and never computed from anything else.
63
+ *
46
64
  * @module
47
65
  */
66
+ import { path } from "../http.js";
67
+ /** `passwordSet` → `hasPassword`. The one hop between the wire and {@linkcode UserProfile}. */
68
+ function toUserProfile(wire) {
69
+ const { passwordSet, ...rest } = wire;
70
+ return { ...rest, hasPassword: passwordSet };
71
+ }
48
72
  /**
49
73
  * The `console.auth` namespace on a `W6WClient`.
50
74
  *
51
75
  * @example
52
76
  * ```ts
53
- * const { token } = await client.console.auth.login("user", "pass");
77
+ * const { token } = await client.console.auth.login("user@example.com", "pass");
54
78
  * const me = await client.console.auth.getMe();
55
79
  * if (me.tenantAdmin) { // tenant-admin surface
56
80
  * }
@@ -70,20 +94,43 @@ export class AuthApi {
70
94
  * PUBLIC — sends no bearer, even on a client that already holds one
71
95
  * (`requireAuth: false`).
72
96
  *
73
- * @param username - The account username.
97
+ * @param identifier - The login identifier, normally the account's email. The
98
+ * platform operator credential (`AUTH_USERNAME`) is NOT email-shaped and is a
99
+ * legitimate value here — never validate this as an email (DECISIONS.md HITL-1).
100
+ * It is sent as the `email` key: the server resolves `body.email ?? body.username`.
74
101
  * @param password - The account password.
75
102
  * @returns The token, the caller's identity, and the token's lifetime.
76
103
  * @throws {ApiError} On any non-2xx, e.g. `401` for invalid credentials.
77
104
  */
78
- async login(username, password) {
105
+ async login(identifier, password) {
79
106
  const res = await this.#host.request({
80
107
  method: "POST",
81
108
  path: "/auth/login",
82
- body: { username, password },
109
+ body: { email: identifier, password },
83
110
  requireAuth: false,
84
111
  });
85
112
  return res.body;
86
113
  }
114
+ /**
115
+ * Mint a fresh token for the CURRENT session — same identity (subject,
116
+ * tenant, role, account, any admin claim), just a renewed lifetime. The
117
+ * sliding-session mechanism: a client that keeps calling this while a
118
+ * user is active never sees the original token's `exp` arrive.
119
+ *
120
+ * AUTHENTICATED — the default `requireAuth` applies (a caller with no
121
+ * token has no session to extend).
122
+ *
123
+ * @returns The new token and its lifetime in seconds.
124
+ * @throws {ApiError} `401` if the CURRENT token is already invalid/expired
125
+ * — refreshing cannot resurrect a session that has already lapsed.
126
+ */
127
+ async refresh() {
128
+ const res = await this.#host.request({
129
+ method: "POST",
130
+ path: "/auth/refresh",
131
+ });
132
+ return res.body;
133
+ }
87
134
  /**
88
135
  * Self-serve signup: creates the user and mints a `role: "user"` session.
89
136
  *
@@ -132,16 +179,15 @@ export class AuthApi {
132
179
  * adopting it downgrades an operator; this method never writes the session
133
180
  * itself, the caller decides.
134
181
  *
135
- * @param name - The account's display name.
136
- * @param slug - The account's slug.
182
+ * @param input - The optional company name, role and use-case from the signup form.
137
183
  * @returns The created account, a re-issued token carrying its claim, and the token's lifetime.
138
184
  * @throws {ApiError} On any non-2xx, e.g. `409` when the slug is taken.
139
185
  */
140
- async createAccount(name, slug) {
186
+ async createAccount(input) {
141
187
  const res = await this.#host.request({
142
188
  method: "POST",
143
189
  path: "/accounts",
144
- body: { name, slug },
190
+ body: input,
145
191
  });
146
192
  return res.body;
147
193
  }
@@ -169,5 +215,128 @@ export class AuthApi {
169
215
  });
170
216
  return res.body;
171
217
  }
218
+ /**
219
+ * Read the caller's own profile — the real `users` row, including
220
+ * {@linkcode UserProfile.hasPassword}. Distinct from `getMe()`, which reads
221
+ * session claims: this reads the actual database row (`data/me.ts:43-51`).
222
+ *
223
+ * AUTHENTICATED — the default `requireAuth` applies.
224
+ *
225
+ * @returns The caller's profile.
226
+ * @throws {ApiError} `404 no_user_profile` when there is no `users` row for this principal.
227
+ */
228
+ async getProfile() {
229
+ const res = await this.#host.request({ method: "GET", path: "/me/profile" });
230
+ return toUserProfile(res.body);
231
+ }
232
+ /**
233
+ * Patch the caller's display name.
234
+ *
235
+ * AUTHENTICATED — the default `requireAuth` applies.
236
+ *
237
+ * @param input - The new display name.
238
+ * @returns The updated profile (`data/me.ts:53-71`).
239
+ * @throws {ApiError} `400 invalid_body`/`invalid_display_name`.
240
+ */
241
+ async updateProfile(input) {
242
+ const res = await this.#host.request({
243
+ method: "PATCH",
244
+ path: "/me/profile",
245
+ body: input,
246
+ });
247
+ return toUserProfile(res.body);
248
+ }
249
+ /**
250
+ * Park a pending email/phone change and send its confirmation code. Does
251
+ * NOT confirm the change — see {@linkcode confirmContactChange}.
252
+ *
253
+ * AUTHENTICATED — the default `requireAuth` applies.
254
+ *
255
+ * @param input - The contact method and the new value.
256
+ * @returns Nothing: the server answers `202` with `{ok: true}`, which carries no information a
257
+ * caller can use (`data/me.ts:73-98`).
258
+ * @throws {ApiError} `400 invalid_body`/`invalid_email`, `409 email_taken`.
259
+ */
260
+ async requestContactChange(input) {
261
+ await this.#host.request({
262
+ method: "POST",
263
+ path: "/me/contacts/change",
264
+ body: input,
265
+ });
266
+ }
267
+ /**
268
+ * Consume the code from {@linkcode requestContactChange} and confirm the
269
+ * pending change. Optionally promotes the newly-confirmed contact to
270
+ * primary in the same call (D3).
271
+ *
272
+ * AUTHENTICATED — the default `requireAuth` applies.
273
+ *
274
+ * @param input - The contact method, the code, and an optional promote flag.
275
+ * @returns The updated profile (`data/me.ts:100-133`).
276
+ * @throws {ApiError} `400 invalid_body`/`invalid_code`, `404 contact_not_found`.
277
+ */
278
+ async confirmContactChange(input) {
279
+ const res = await this.#host.request({
280
+ method: "POST",
281
+ path: "/me/contacts/confirm",
282
+ body: input,
283
+ });
284
+ return toUserProfile(res.body);
285
+ }
286
+ /**
287
+ * Remove one of the caller's own (non-primary) contacts. Added per HITL-7
288
+ * — `DELETE /me/contacts/:id` exists on the merged branch (`data/me.ts:135-144`).
289
+ *
290
+ * AUTHENTICATED — the default `requireAuth` applies.
291
+ *
292
+ * @param id - The contact id.
293
+ * @returns Nothing: the server answers `{ok: true}`, which carries no information a caller can
294
+ * use, mirroring `console.projects.delete`/`console.schedules.delete` in this same package.
295
+ * @throws {ApiError} `404 contact_not_found`.
296
+ */
297
+ async removeContact(id) {
298
+ await this.#host.request({ method: "DELETE", path: path `/me/contacts/${id}` });
299
+ }
300
+ /**
301
+ * Promote one of the caller's own secondary contacts to primary. Added per
302
+ * HITL-7 — `POST /me/contacts/:id/primary` exists on the merged branch
303
+ * (`data/me.ts:146-154`).
304
+ *
305
+ * AUTHENTICATED — the default `requireAuth` applies.
306
+ *
307
+ * @param id - The contact id.
308
+ * @returns The updated profile.
309
+ * @throws {ApiError} `404 contact_not_found`, `403 contact_not_verified`.
310
+ */
311
+ async promoteContact(id) {
312
+ const res = await this.#host.request({
313
+ method: "POST",
314
+ path: path `/me/contacts/${id}/primary`,
315
+ body: {},
316
+ });
317
+ return toUserProfile(res.body);
318
+ }
319
+ /**
320
+ * Set or change the caller's password (HITL-10) — one method, since the
321
+ * merged route is the single `POST /me/password`, not two. Omit
322
+ * `currentPassword` for the first-time "set a password" case
323
+ * (`hasPassword: false`); the server requires it once a password already
324
+ * exists.
325
+ *
326
+ * AUTHENTICATED — the default `requireAuth` applies.
327
+ *
328
+ * @param input - The new password, plus the current one when required.
329
+ * @returns Nothing: the server answers `{ok: true}`, which carries no information a caller can
330
+ * use (`data/me.ts:156-184`).
331
+ * @throws {ApiError} `400 invalid_body`/`invalid_password`/`current_password_required`,
332
+ * `403 invalid_current_password`.
333
+ */
334
+ async setPassword(input) {
335
+ await this.#host.request({
336
+ method: "POST",
337
+ path: "/me/password",
338
+ body: input,
339
+ });
340
+ }
172
341
  }
173
342
  //# sourceMappingURL=auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/console/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAwHH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,OAAO;IACT,KAAK,CAAW;IAEzB;;OAEG;IACH,YAAY,IAAc;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,QAAgB;QAC5C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgB;YAClD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;YAC5B,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,CAAC,KAAkB;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAiB;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,gBAAgB,CAAC,IAAY;QACjC,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