@mymehq/sdk 5.3.0 → 5.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.
package/dist/index.d.ts CHANGED
@@ -790,6 +790,33 @@ declare class MymeClient {
790
790
  list: (tenantId: string) => Promise<TenantApiKeySummary[]>;
791
791
  };
792
792
  };
793
+ /**
794
+ * Account-lifecycle surface (T-116).
795
+ *
796
+ * The data plane (every other namespace on the client) authenticates
797
+ * with a bearer token; these account-management endpoints accept
798
+ * EITHER a bearer (workspace_admin / admin in the user's tenant)
799
+ * OR a better-auth session cookie. The CLI flow uses a bearer (the
800
+ * user's own key); web flows use the cookie. The transport sends
801
+ * the bearer header by default, so SDK callers operating with a
802
+ * bearer just work.
803
+ */
804
+ readonly auth: {
805
+ account: {
806
+ /** Initiate deletion. Mints a confirm token and dispatches the
807
+ * confirmation email. Returns when the request is accepted
808
+ * (HTTP 202). Idempotent within the token TTL. */
809
+ requestDelete: () => Promise<void>;
810
+ /** Consume a confirmation token. The server's GET response is an
811
+ * HTML page intended for the email recipient's browser; this
812
+ * helper exposes the same effect to programmatic callers (CLI
813
+ * / integration tests). Throws on bad / expired tokens. */
814
+ confirmDelete: (token: string) => Promise<void>;
815
+ /** Cancel an in-flight deletion (session-cookie or bearer path).
816
+ * Throws if the account is not in pending-deletion. */
817
+ cancel: () => Promise<void>;
818
+ };
819
+ };
793
820
  /**
794
821
  * The calling user's profile. `system.profile` is a virtual type —
795
822
  * served by a dedicated endpoint over the `users` table joined to
package/dist/index.js CHANGED
@@ -1200,6 +1200,54 @@ var MymeClient = class {
1200
1200
  }
1201
1201
  }
1202
1202
  };
1203
+ // ---- Auth (T-116) ----
1204
+ /**
1205
+ * Account-lifecycle surface (T-116).
1206
+ *
1207
+ * The data plane (every other namespace on the client) authenticates
1208
+ * with a bearer token; these account-management endpoints accept
1209
+ * EITHER a bearer (workspace_admin / admin in the user's tenant)
1210
+ * OR a better-auth session cookie. The CLI flow uses a bearer (the
1211
+ * user's own key); web flows use the cookie. The transport sends
1212
+ * the bearer header by default, so SDK callers operating with a
1213
+ * bearer just work.
1214
+ */
1215
+ auth = {
1216
+ account: {
1217
+ /** Initiate deletion. Mints a confirm token and dispatches the
1218
+ * confirmation email. Returns when the request is accepted
1219
+ * (HTTP 202). Idempotent within the token TTL. */
1220
+ requestDelete: async () => {
1221
+ await this.transport.request(
1222
+ "POST",
1223
+ "/auth/account/delete"
1224
+ );
1225
+ },
1226
+ /** Consume a confirmation token. The server's GET response is an
1227
+ * HTML page intended for the email recipient's browser; this
1228
+ * helper exposes the same effect to programmatic callers (CLI
1229
+ * / integration tests). Throws on bad / expired tokens. */
1230
+ confirmDelete: async (token) => {
1231
+ const res = await this.transport.rawRequest(
1232
+ "GET",
1233
+ `/auth/account/delete/confirm?token=${encodeURIComponent(token)}`
1234
+ );
1235
+ if (!res.ok) {
1236
+ throw new Error(
1237
+ `Account-delete confirm failed (${String(res.status)})`
1238
+ );
1239
+ }
1240
+ },
1241
+ /** Cancel an in-flight deletion (session-cookie or bearer path).
1242
+ * Throws if the account is not in pending-deletion. */
1243
+ cancel: async () => {
1244
+ await this.transport.request(
1245
+ "POST",
1246
+ "/auth/account/delete/cancel"
1247
+ );
1248
+ }
1249
+ }
1250
+ };
1203
1251
  // ---- Profile (T-074) ----
1204
1252
  /**
1205
1253
  * The calling user's profile. `system.profile` is a virtual type —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mymehq/sdk",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@mymehq/shared": "5.3.0"
23
+ "@mymehq/shared": "5.4.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.0.0",