@mymehq/sdk 5.3.0 → 5.5.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 +35 -0
- package/dist/index.js +53 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,14 @@ interface UpdateOptions {
|
|
|
113
113
|
/** Toggle the tier (`library` ↔ `feed`). Independent of the version-merge
|
|
114
114
|
* path for `properties`; a tier-only update never conflicts. */
|
|
115
115
|
tier?: Tier;
|
|
116
|
+
/**
|
|
117
|
+
* Repoint the item at a new natural-key identifier under the caller's
|
|
118
|
+
* stamped `source`. The server enforces `(source, source_id)` uniqueness
|
|
119
|
+
* per tenant — a collision returns HTTP 409 `source_id_conflict`. PATCHing
|
|
120
|
+
* the value the item already carries is a no-op success. Used by the
|
|
121
|
+
* sync-agent (T-118) to preserve item identity through file renames.
|
|
122
|
+
*/
|
|
123
|
+
source_id?: string;
|
|
116
124
|
/**
|
|
117
125
|
* Item type. Required by the `auto` strategy when a `keep_both_copies`
|
|
118
126
|
* conflict spawns a sibling item. Omit to let the SDK pre-fetch it —
|
|
@@ -790,6 +798,33 @@ declare class MymeClient {
|
|
|
790
798
|
list: (tenantId: string) => Promise<TenantApiKeySummary[]>;
|
|
791
799
|
};
|
|
792
800
|
};
|
|
801
|
+
/**
|
|
802
|
+
* Account-lifecycle surface (T-116).
|
|
803
|
+
*
|
|
804
|
+
* The data plane (every other namespace on the client) authenticates
|
|
805
|
+
* with a bearer token; these account-management endpoints accept
|
|
806
|
+
* EITHER a bearer (workspace_admin / admin in the user's tenant)
|
|
807
|
+
* OR a better-auth session cookie. The CLI flow uses a bearer (the
|
|
808
|
+
* user's own key); web flows use the cookie. The transport sends
|
|
809
|
+
* the bearer header by default, so SDK callers operating with a
|
|
810
|
+
* bearer just work.
|
|
811
|
+
*/
|
|
812
|
+
readonly auth: {
|
|
813
|
+
account: {
|
|
814
|
+
/** Initiate deletion. Mints a confirm token and dispatches the
|
|
815
|
+
* confirmation email. Returns when the request is accepted
|
|
816
|
+
* (HTTP 202). Idempotent within the token TTL. */
|
|
817
|
+
requestDelete: () => Promise<void>;
|
|
818
|
+
/** Consume a confirmation token. The server's GET response is an
|
|
819
|
+
* HTML page intended for the email recipient's browser; this
|
|
820
|
+
* helper exposes the same effect to programmatic callers (CLI
|
|
821
|
+
* / integration tests). Throws on bad / expired tokens. */
|
|
822
|
+
confirmDelete: (token: string) => Promise<void>;
|
|
823
|
+
/** Cancel an in-flight deletion (session-cookie or bearer path).
|
|
824
|
+
* Throws if the account is not in pending-deletion. */
|
|
825
|
+
cancel: () => Promise<void>;
|
|
826
|
+
};
|
|
827
|
+
};
|
|
793
828
|
/**
|
|
794
829
|
* The calling user's profile. `system.profile` is a virtual type —
|
|
795
830
|
* served by a dedicated endpoint over the `users` table joined to
|
package/dist/index.js
CHANGED
|
@@ -289,7 +289,7 @@ function toConflictError(response, clientPatch) {
|
|
|
289
289
|
clientPatch
|
|
290
290
|
);
|
|
291
291
|
}
|
|
292
|
-
async function handleConflictUpdate(transport, itemId, itemType, clientPatch, version, strategy, resolver, tier, onAutoMerge) {
|
|
292
|
+
async function handleConflictUpdate(transport, itemId, itemType, clientPatch, version, strategy, resolver, tier, onAutoMerge, sourceId) {
|
|
293
293
|
let properties = clientPatch;
|
|
294
294
|
let currentVersion = version;
|
|
295
295
|
let pendingAutoMergeEvent;
|
|
@@ -298,7 +298,8 @@ async function handleConflictUpdate(transport, itemId, itemType, clientPatch, ve
|
|
|
298
298
|
body: {
|
|
299
299
|
properties,
|
|
300
300
|
version: currentVersion,
|
|
301
|
-
...tier !== void 0 && { tier }
|
|
301
|
+
...tier !== void 0 && { tier },
|
|
302
|
+
...sourceId !== void 0 && { source_id: sourceId }
|
|
302
303
|
}
|
|
303
304
|
});
|
|
304
305
|
if (!isConflictResponse(result)) {
|
|
@@ -473,7 +474,8 @@ var MymeClient = class {
|
|
|
473
474
|
strategy,
|
|
474
475
|
options?.resolve,
|
|
475
476
|
options?.tier,
|
|
476
|
-
onAutoMerge
|
|
477
|
+
onAutoMerge,
|
|
478
|
+
options?.source_id
|
|
477
479
|
);
|
|
478
480
|
},
|
|
479
481
|
delete: async (id) => {
|
|
@@ -1200,6 +1202,54 @@ var MymeClient = class {
|
|
|
1200
1202
|
}
|
|
1201
1203
|
}
|
|
1202
1204
|
};
|
|
1205
|
+
// ---- Auth (T-116) ----
|
|
1206
|
+
/**
|
|
1207
|
+
* Account-lifecycle surface (T-116).
|
|
1208
|
+
*
|
|
1209
|
+
* The data plane (every other namespace on the client) authenticates
|
|
1210
|
+
* with a bearer token; these account-management endpoints accept
|
|
1211
|
+
* EITHER a bearer (workspace_admin / admin in the user's tenant)
|
|
1212
|
+
* OR a better-auth session cookie. The CLI flow uses a bearer (the
|
|
1213
|
+
* user's own key); web flows use the cookie. The transport sends
|
|
1214
|
+
* the bearer header by default, so SDK callers operating with a
|
|
1215
|
+
* bearer just work.
|
|
1216
|
+
*/
|
|
1217
|
+
auth = {
|
|
1218
|
+
account: {
|
|
1219
|
+
/** Initiate deletion. Mints a confirm token and dispatches the
|
|
1220
|
+
* confirmation email. Returns when the request is accepted
|
|
1221
|
+
* (HTTP 202). Idempotent within the token TTL. */
|
|
1222
|
+
requestDelete: async () => {
|
|
1223
|
+
await this.transport.request(
|
|
1224
|
+
"POST",
|
|
1225
|
+
"/auth/account/delete"
|
|
1226
|
+
);
|
|
1227
|
+
},
|
|
1228
|
+
/** Consume a confirmation token. The server's GET response is an
|
|
1229
|
+
* HTML page intended for the email recipient's browser; this
|
|
1230
|
+
* helper exposes the same effect to programmatic callers (CLI
|
|
1231
|
+
* / integration tests). Throws on bad / expired tokens. */
|
|
1232
|
+
confirmDelete: async (token) => {
|
|
1233
|
+
const res = await this.transport.rawRequest(
|
|
1234
|
+
"GET",
|
|
1235
|
+
`/auth/account/delete/confirm?token=${encodeURIComponent(token)}`
|
|
1236
|
+
);
|
|
1237
|
+
if (!res.ok) {
|
|
1238
|
+
throw new Error(
|
|
1239
|
+
`Account-delete confirm failed (${String(res.status)})`
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1243
|
+
/** Cancel an in-flight deletion (session-cookie or bearer path).
|
|
1244
|
+
* Throws if the account is not in pending-deletion. */
|
|
1245
|
+
cancel: async () => {
|
|
1246
|
+
await this.transport.request(
|
|
1247
|
+
"POST",
|
|
1248
|
+
"/auth/account/delete/cancel"
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1203
1253
|
// ---- Profile (T-074) ----
|
|
1204
1254
|
/**
|
|
1205
1255
|
* 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
|
+
"version": "5.5.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.
|
|
23
|
+
"@mymehq/shared": "5.5.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^22.0.0",
|