@mymehq/sdk 2.1.0 → 3.1.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 +29 -12
- package/dist/index.js +9 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConflictSnapshot, ItemState, CreateItemInput, Item, PaginatedResult, ItemWithMetadata, Version, Edge, Metadata, SearchResult, CreateEdgeInput, EdgeTypeSchema, TypeSchema, CreateKeyInput, ApiKey, CreateWebhookInput, Webhook, UpdateWebhookInput, WebhookDelivery, TenantConfig } from '@mymehq/shared';
|
|
2
|
-
export { ApiKey, ConflictSnapshot, CreateItemInput, CreateKeyInput, Item, ItemState, Metadata, PaginatedResult, SearchResult, TypeSchema, Version } from '@mymehq/shared';
|
|
1
|
+
import { ConflictSnapshot, ItemState, CreateItemInput, Item, PaginatedResult, ItemWithMetadata, Version, Edge, Metadata, SearchResult, CreateEdgeInput, EdgeTypeSchema, TypeSchema, CreateKeyInput, ApiKey, UpdateKeyInput, CreateWebhookInput, Webhook, UpdateWebhookInput, WebhookDelivery, TenantConfig } from '@mymehq/shared';
|
|
2
|
+
export { ApiKey, ConflictSnapshot, CreateItemInput, CreateKeyInput, Item, ItemState, Metadata, PaginatedResult, SearchResult, TypeSchema, UpdateKeyInput, Version } from '@mymehq/shared';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Conflict resolution strategy for item updates.
|
|
@@ -50,18 +50,14 @@ interface ListFilters {
|
|
|
50
50
|
type?: string;
|
|
51
51
|
state?: ItemState;
|
|
52
52
|
source?: string;
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
parent_id?: string;
|
|
57
|
-
root_only?: boolean;
|
|
58
|
-
/** When set, restricts the result to library items (true) or ambient
|
|
59
|
-
* items (false). Per V0 spec, the default unrestricted view returns
|
|
60
|
-
* library items only on a fresh /items query — the explicit filter
|
|
61
|
-
* here lets callers opt into the ambient slice or be explicit about
|
|
62
|
-
* the library slice. */
|
|
53
|
+
/** Tri-value library filter. `true` restricts to library items; `false`
|
|
54
|
+
* restricts to ambient items; omitting the field returns both (the V0
|
|
55
|
+
* default). */
|
|
63
56
|
library?: boolean;
|
|
64
57
|
tags?: string[];
|
|
58
|
+
/** Filter-language expression, e.g. `edge[parent-of] eq "<id>"` or
|
|
59
|
+
* `edge[parent-of] not_exists`. The filter language replaces the
|
|
60
|
+
* previously-exposed `parent_id` and `root_only` convenience params. */
|
|
65
61
|
filter?: string;
|
|
66
62
|
sort?: "created_at" | "updated_at" | "timestamp";
|
|
67
63
|
direction?: "asc" | "desc";
|
|
@@ -73,6 +69,8 @@ interface ListFilters {
|
|
|
73
69
|
interface SearchFilters {
|
|
74
70
|
type?: string;
|
|
75
71
|
state?: ItemState;
|
|
72
|
+
/** Tri-value library filter, matching `ListFilters.library`. */
|
|
73
|
+
library?: boolean;
|
|
76
74
|
filter?: string;
|
|
77
75
|
limit?: number;
|
|
78
76
|
}
|
|
@@ -185,6 +183,11 @@ declare class MymeClient {
|
|
|
185
183
|
key: string;
|
|
186
184
|
}>;
|
|
187
185
|
list: () => Promise<ApiKey[]>;
|
|
186
|
+
/** Update mutable fields on an existing key (PATCH semantics —
|
|
187
|
+
* omitted fields are left untouched). `source` and `role` are
|
|
188
|
+
* immutable after creation and cannot be changed; the server rejects
|
|
189
|
+
* them with a 400. */
|
|
190
|
+
update: (id: string, input: UpdateKeyInput) => Promise<ApiKey>;
|
|
188
191
|
revoke: (id: string) => Promise<void>;
|
|
189
192
|
};
|
|
190
193
|
readonly webhooks: {
|
|
@@ -211,6 +214,20 @@ declare class MymeClient {
|
|
|
211
214
|
private throwRawError;
|
|
212
215
|
}
|
|
213
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Base error thrown from every SDK HTTP failure path. Consumers catch on
|
|
219
|
+
* this class or one of its typed subclasses (`NotFoundError`,
|
|
220
|
+
* `ValidationError`, `UnauthorizedError`, `ForbiddenError`, `ConflictError`).
|
|
221
|
+
*
|
|
222
|
+
* Deliberately distinct from the `MymeError` in `@mymehq/shared`. The
|
|
223
|
+
* shared version is constructed server-side from an `ErrorCode` enum and
|
|
224
|
+
* derives its HTTP status through an internal map; this SDK version is
|
|
225
|
+
* constructed from an error response on the wire, so `code` is an opaque
|
|
226
|
+
* string (forward-compatible with server codes the SDK hasn't been
|
|
227
|
+
* regenerated against yet) and `status` is the HTTP status the server
|
|
228
|
+
* actually returned. The two classes serve symmetrical but distinct
|
|
229
|
+
* roles; do not try to unify them.
|
|
230
|
+
*/
|
|
214
231
|
declare class MymeError extends Error {
|
|
215
232
|
readonly code: string;
|
|
216
233
|
readonly status: number;
|
package/dist/index.js
CHANGED
|
@@ -560,6 +560,15 @@ var MymeClient = class {
|
|
|
560
560
|
);
|
|
561
561
|
return res.keys;
|
|
562
562
|
},
|
|
563
|
+
/** Update mutable fields on an existing key (PATCH semantics —
|
|
564
|
+
* omitted fields are left untouched). `source` and `role` are
|
|
565
|
+
* immutable after creation and cannot be changed; the server rejects
|
|
566
|
+
* them with a 400. */
|
|
567
|
+
update: async (id, input) => {
|
|
568
|
+
return this.transport.request("PATCH", `/keys/${id}`, {
|
|
569
|
+
body: input
|
|
570
|
+
});
|
|
571
|
+
},
|
|
563
572
|
revoke: async (id) => {
|
|
564
573
|
await this.transport.request("DELETE", `/keys/${id}`);
|
|
565
574
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mymehq/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@mymehq/shared": "
|
|
19
|
+
"@mymehq/shared": "3.1.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.0.0",
|