@mymehq/sdk 3.1.0 → 3.2.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
@@ -45,6 +45,9 @@ interface UpdateOptions {
45
45
  conflict?: ConflictStrategy;
46
46
  /** Custom conflict resolver (required when `conflict` is `"callback"`). */
47
47
  resolve?: ConflictResolver;
48
+ /** Toggle library / ambient state. Independent of the version-merge path
49
+ * for `properties`; a library-only update never conflicts. */
50
+ library?: boolean;
48
51
  }
49
52
  interface ListFilters {
50
53
  type?: string;
@@ -71,6 +74,9 @@ interface SearchFilters {
71
74
  state?: ItemState;
72
75
  /** Tri-value library filter, matching `ListFilters.library`. */
73
76
  library?: boolean;
77
+ /** Items must have ALL specified tags (AND semantics). Matches
78
+ * `ListFilters.tags` and `/items?tags=`. */
79
+ tags?: string[];
74
80
  filter?: string;
75
81
  limit?: number;
76
82
  }
@@ -120,12 +126,33 @@ declare class MymeClient {
120
126
  merge: (itemId: string, input: Partial<MetadataInput>) => Promise<Metadata>;
121
127
  addTags: (itemId: string, tags: string[]) => Promise<Metadata>;
122
128
  removeTag: (itemId: string, tag: string) => Promise<void>;
129
+ /**
130
+ * Enumerate the distinct set of tags in use across items the caller can
131
+ * read. Tenant-scoped, type-permission scoped, excludes trashed items.
132
+ * Returns tags with usage counts, sorted by count desc then tag asc.
133
+ */
134
+ listTags: () => Promise<{
135
+ tag: string;
136
+ count: number;
137
+ }[]>;
123
138
  getExtensions: (itemId: string, namespace?: string) => Promise<Record<string, Record<string, unknown>>>;
124
139
  setExtension: (itemId: string, namespace: string, data: Record<string, unknown>) => Promise<Record<string, Record<string, unknown>>>;
125
140
  deleteExtension: (itemId: string, namespace: string) => Promise<void>;
126
141
  };
127
142
  search(query: string, filters?: SearchFilters): Promise<SearchResult[]>;
128
143
  readonly edges: {
144
+ /**
145
+ * Global edge listing across the tenant, filtered by edge type
146
+ * (comma-separated string or array of type ids). Use this when you
147
+ * need "all edges of type X" — replaces the walk-every-item
148
+ * pattern. Per-target filters live on `listFromSource` /
149
+ * `listToTarget`.
150
+ */
151
+ list: (filters?: {
152
+ edge_type?: string | string[];
153
+ limit?: number;
154
+ cursor?: string;
155
+ }) => Promise<PaginatedResult<Edge>>;
129
156
  /** Create a single edge. Server enforces cardinality / type
130
157
  * constraints / cycle prevention; throws on violation. */
131
158
  create: (input: CreateEdgeInput) => Promise<Edge>;
package/dist/index.js CHANGED
@@ -173,14 +173,15 @@ function toConflictError(response, clientPatch) {
173
173
  clientPatch
174
174
  );
175
175
  }
176
- async function handleConflictUpdate(transport, itemId, clientPatch, version, strategy, resolver) {
176
+ async function handleConflictUpdate(transport, itemId, clientPatch, version, strategy, resolver, library) {
177
177
  let properties = clientPatch;
178
178
  let currentVersion = version;
179
179
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
180
180
  const result = await transport.requestWithConflict("PATCH", `/items/${itemId}`, {
181
181
  body: {
182
182
  properties,
183
- version: currentVersion
183
+ version: currentVersion,
184
+ ...library !== void 0 && { library }
184
185
  }
185
186
  });
186
187
  if (!isConflictResponse(result)) {
@@ -280,7 +281,8 @@ var MymeClient = class {
280
281
  properties,
281
282
  version,
282
283
  strategy,
283
- options?.resolve
284
+ options?.resolve,
285
+ options?.library
284
286
  );
285
287
  },
286
288
  delete: async (id) => {
@@ -366,6 +368,15 @@ var MymeClient = class {
366
368
  `/items/${itemId}/tags/${encodeURIComponent(tag)}`
367
369
  );
368
370
  },
371
+ /**
372
+ * Enumerate the distinct set of tags in use across items the caller can
373
+ * read. Tenant-scoped, type-permission scoped, excludes trashed items.
374
+ * Returns tags with usage counts, sorted by count desc then tag asc.
375
+ */
376
+ listTags: async () => {
377
+ const res = await this.transport.request("GET", "/metadata/tags");
378
+ return res.tags;
379
+ },
369
380
  getExtensions: async (itemId, namespace) => {
370
381
  if (namespace) {
371
382
  const res2 = await this.transport.request(
@@ -403,6 +414,23 @@ var MymeClient = class {
403
414
  }
404
415
  // ---- Edges ----
405
416
  edges = {
417
+ /**
418
+ * Global edge listing across the tenant, filtered by edge type
419
+ * (comma-separated string or array of type ids). Use this when you
420
+ * need "all edges of type X" — replaces the walk-every-item
421
+ * pattern. Per-target filters live on `listFromSource` /
422
+ * `listToTarget`.
423
+ */
424
+ list: async (filters) => {
425
+ const edgeType = Array.isArray(filters?.edge_type) ? filters.edge_type.join(",") : filters?.edge_type;
426
+ return this.transport.request("GET", "/edges", {
427
+ query: {
428
+ ...edgeType && { edge_type: edgeType },
429
+ ...filters?.limit !== void 0 && { limit: filters.limit },
430
+ ...filters?.cursor && { cursor: filters.cursor }
431
+ }
432
+ });
433
+ },
406
434
  /** Create a single edge. Server enforces cardinality / type
407
435
  * constraints / cycle prevention; throws on violation. */
408
436
  create: async (input) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mymehq/sdk",
3
- "version": "3.1.0",
3
+ "version": "3.2.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": "3.1.0"
19
+ "@mymehq/shared": "3.2.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^22.0.0",