@mymehq/sdk 2.0.1 → 3.0.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 +25 -31
- package/dist/index.js +0 -38
- 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,
|
|
2
|
-
export { ApiKey, ConflictSnapshot, CreateItemInput, CreateKeyInput, Item, ItemState, Metadata, PaginatedResult, SearchResult,
|
|
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';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Conflict resolution strategy for item updates.
|
|
@@ -50,22 +50,14 @@ interface ListFilters {
|
|
|
50
50
|
type?: string;
|
|
51
51
|
state?: ItemState;
|
|
52
52
|
source?: string;
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* `edge[parent-of]` existence check. */
|
|
57
|
-
parent_id?: string;
|
|
58
|
-
/** Filter to items in this thread. Server translates to
|
|
59
|
-
* `edge[in-thread]` check after the thread_id column was dropped. */
|
|
60
|
-
thread_id?: string;
|
|
61
|
-
root_only?: boolean;
|
|
62
|
-
/** When set, restricts the result to library items (true) or ambient
|
|
63
|
-
* items (false). Per V0 spec, the default unrestricted view returns
|
|
64
|
-
* library items only on a fresh /items query — the explicit filter
|
|
65
|
-
* here lets callers opt into the ambient slice or be explicit about
|
|
66
|
-
* 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). */
|
|
67
56
|
library?: boolean;
|
|
68
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. */
|
|
69
61
|
filter?: string;
|
|
70
62
|
sort?: "created_at" | "updated_at" | "timestamp";
|
|
71
63
|
direction?: "asc" | "desc";
|
|
@@ -77,6 +69,8 @@ interface ListFilters {
|
|
|
77
69
|
interface SearchFilters {
|
|
78
70
|
type?: string;
|
|
79
71
|
state?: ItemState;
|
|
72
|
+
/** Tri-value library filter, matching `ListFilters.library`. */
|
|
73
|
+
library?: boolean;
|
|
80
74
|
filter?: string;
|
|
81
75
|
limit?: number;
|
|
82
76
|
}
|
|
@@ -92,8 +86,7 @@ declare class MymeClient {
|
|
|
92
86
|
readonly items: {
|
|
93
87
|
create: (input: CreateItemInput & {
|
|
94
88
|
/** Atomic edges payload: for each edge type, listed ids become
|
|
95
|
-
* targets with the new item as source.
|
|
96
|
-
* / thread_id / about which were dropped in Wave 2 PR 4. */
|
|
89
|
+
* targets with the new item as source. */
|
|
97
90
|
edges?: Record<string, string[]>;
|
|
98
91
|
}) => Promise<Item>;
|
|
99
92
|
get: (id: string) => Promise<Item>;
|
|
@@ -132,19 +125,6 @@ declare class MymeClient {
|
|
|
132
125
|
deleteExtension: (itemId: string, namespace: string) => Promise<void>;
|
|
133
126
|
};
|
|
134
127
|
search(query: string, filters?: SearchFilters): Promise<SearchResult[]>;
|
|
135
|
-
readonly threads: {
|
|
136
|
-
create: () => Promise<Thread>;
|
|
137
|
-
list: (filters?: {
|
|
138
|
-
limit?: number;
|
|
139
|
-
cursor?: string;
|
|
140
|
-
}) => Promise<PaginatedResult<Thread>>;
|
|
141
|
-
get: (id: string) => Promise<{
|
|
142
|
-
thread: Thread;
|
|
143
|
-
items: Item[];
|
|
144
|
-
}>;
|
|
145
|
-
addItem: (threadId: string, itemId: string) => Promise<Item>;
|
|
146
|
-
removeItem: (threadId: string, itemId: string) => Promise<Item>;
|
|
147
|
-
};
|
|
148
128
|
readonly edges: {
|
|
149
129
|
/** Create a single edge. Server enforces cardinality / type
|
|
150
130
|
* constraints / cycle prevention; throws on violation. */
|
|
@@ -229,6 +209,20 @@ declare class MymeClient {
|
|
|
229
209
|
private throwRawError;
|
|
230
210
|
}
|
|
231
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Base error thrown from every SDK HTTP failure path. Consumers catch on
|
|
214
|
+
* this class or one of its typed subclasses (`NotFoundError`,
|
|
215
|
+
* `ValidationError`, `UnauthorizedError`, `ForbiddenError`, `ConflictError`).
|
|
216
|
+
*
|
|
217
|
+
* Deliberately distinct from the `MymeError` in `@mymehq/shared`. The
|
|
218
|
+
* shared version is constructed server-side from an `ErrorCode` enum and
|
|
219
|
+
* derives its HTTP status through an internal map; this SDK version is
|
|
220
|
+
* constructed from an error response on the wire, so `code` is an opaque
|
|
221
|
+
* string (forward-compatible with server codes the SDK hasn't been
|
|
222
|
+
* regenerated against yet) and `status` is the HTTP status the server
|
|
223
|
+
* actually returned. The two classes serve symmetrical but distinct
|
|
224
|
+
* roles; do not try to unify them.
|
|
225
|
+
*/
|
|
232
226
|
declare class MymeError extends Error {
|
|
233
227
|
readonly code: string;
|
|
234
228
|
readonly status: number;
|
package/dist/index.js
CHANGED
|
@@ -401,44 +401,6 @@ var MymeClient = class {
|
|
|
401
401
|
);
|
|
402
402
|
return res.results;
|
|
403
403
|
}
|
|
404
|
-
// ---- Threads ----
|
|
405
|
-
threads = {
|
|
406
|
-
create: async () => {
|
|
407
|
-
const res = await this.transport.request(
|
|
408
|
-
"POST",
|
|
409
|
-
"/threads"
|
|
410
|
-
);
|
|
411
|
-
return res.thread;
|
|
412
|
-
},
|
|
413
|
-
list: async (filters) => {
|
|
414
|
-
return this.transport.request(
|
|
415
|
-
"GET",
|
|
416
|
-
"/threads",
|
|
417
|
-
{ query: filters }
|
|
418
|
-
);
|
|
419
|
-
},
|
|
420
|
-
get: async (id) => {
|
|
421
|
-
return this.transport.request(
|
|
422
|
-
"GET",
|
|
423
|
-
`/threads/${id}`
|
|
424
|
-
);
|
|
425
|
-
},
|
|
426
|
-
addItem: async (threadId, itemId) => {
|
|
427
|
-
const res = await this.transport.request(
|
|
428
|
-
"POST",
|
|
429
|
-
`/threads/${threadId}/items`,
|
|
430
|
-
{ body: { item_id: itemId } }
|
|
431
|
-
);
|
|
432
|
-
return res.item;
|
|
433
|
-
},
|
|
434
|
-
removeItem: async (threadId, itemId) => {
|
|
435
|
-
const res = await this.transport.request(
|
|
436
|
-
"DELETE",
|
|
437
|
-
`/threads/${threadId}/items/${itemId}`
|
|
438
|
-
);
|
|
439
|
-
return res.item;
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
404
|
// ---- Edges ----
|
|
443
405
|
edges = {
|
|
444
406
|
/** Create a single edge. Server enforces cardinality / type
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mymehq/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.0.0",
|