@qaecy/cue-sdk 0.0.27 → 0.0.29

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/README.md CHANGED
@@ -234,6 +234,42 @@ const project = await cue.api.projects.createProject({
234
234
 
235
235
  Entity data for a project is accessed via a `CueProjectView`. Create a view with `cue.createProjectView(projectId)` and use `view.entities` (`CueProjectEntities`) for all entity-level operations.
236
236
 
237
+ ### `view.entities.entitiesByCategory(categoryIris, includeMetadata?)`
238
+
239
+ Fetch all canonical entities that belong to at least one of the given category IRIs. Accepts both full HTTP IRIs and prefixed forms.
240
+
241
+ By default returns a `string[]` of UUIDs — suitable for feeding directly into `requestEntityData()` for lazy detail loading. Pass `true` to also receive `iri`, `value`, and `categories`.
242
+
243
+ ```typescript
244
+ // Lean — just UUIDs (default)
245
+ const uuids = await view.entities.entitiesByCategory([
246
+ 'qcy:Building',
247
+ 'qcy:BuildingStorey',
248
+ ]);
249
+ view.entities.requestEntityData(uuids); // lazy-loads labels + categories
250
+
251
+ // With metadata
252
+ const entities = await view.entities.entitiesByCategory(
253
+ ['https://cue.qaecy.com/ontology#Building'],
254
+ true,
255
+ );
256
+ entities.forEach((e) => console.log(e.uuid, e.value, e.categories));
257
+ ```
258
+
259
+ | Parameter | Type | Description |
260
+ |---|---|---|
261
+ | `categoryIris` | `string[]` | Full IRIs (`https://…`) or prefixed forms (`qcy:…`) |
262
+ | `includeMetadata` | `boolean` | `false` (default) → `string[]` UUIDs; `true` → adds `iri`, `value`, and `categories` |
263
+
264
+ ### `view.entities.contentCategoriesInProject(orderByOccurrences?)`
265
+
266
+ Fetch all `qcy:EntityCategory` IRIs present in this project with their preferred labels:
267
+
268
+ ```typescript
269
+ const cats = await view.entities.contentCategoriesInProject();
270
+ cats.forEach((c) => console.log(c.iri, c.label));
271
+ ```
272
+
237
273
  ### `view.entities.buildSummaryGraph(format?)`
238
274
 
239
275
  Fetches a project-level summary of entity category relationships: how many times entities of one category point to entities of another via each predicate, ordered by descending occurrence count.
@@ -258,6 +294,67 @@ const md = await view.entities.buildSummaryGraph('md');
258
294
  const raw = await view.entities.buildSummaryGraph();
259
295
  ```
260
296
 
297
+ ## Documents
298
+
299
+ Document data for a project is accessed via `view.documents` (`CueProjectDocuments`). Use `fetchOverview()` to get aggregate counts and the methods below to retrieve document lists.
300
+
301
+ ### `view.documents.documentsBySuffix(suffixes, includeMetadata?)`
302
+
303
+ Fetch all documents whose file extension matches one of the given suffixes. The leading dot is optional — both `'ifc'` and `'.ifc'` are accepted.
304
+
305
+ By default returns a `string[]` of UUIDs — suitable for feeding directly into `requestDocumentData()`. Pass `true` to also receive `path`, `suffix`, and `size`.
306
+
307
+ ```typescript
308
+ // Lean — just UUIDs (default)
309
+ const uuids = await view.documents.documentsBySuffix(['.ifc', '.rvt']);
310
+ view.documents.requestDocumentData(uuids);
311
+
312
+ // With file metadata
313
+ const docs = await view.documents.documentsBySuffix(['pdf', 'docx'], true);
314
+ docs.forEach((d) => console.log(d.path, d.suffix, d.size));
315
+ ```
316
+
317
+ ### `view.documents.documentsByFileType(fileTypes, includeMetadata?)`
318
+
319
+ Fetch documents by semantic `FileType` category. Resolves all matching suffixes automatically from the built-in `fileExtensionsInfo` map.
320
+
321
+ ```typescript
322
+ import { FileType } from 'js/models';
323
+
324
+ // All BIM and CAD files — just UUIDs
325
+ const uuids = await view.documents.documentsByFileType([
326
+ FileType.BIM,
327
+ FileType.CAD,
328
+ ]);
329
+
330
+ // With metadata
331
+ const docs = await view.documents.documentsByFileType([FileType.IMAGE], true);
332
+ ```
333
+
334
+ ### `view.documents.documentsByMime(mimeTypes, includeMetadata?)`
335
+
336
+ Fetch documents whose MIME type matches one of the given strings:
337
+
338
+ ```typescript
339
+ // Just UUIDs
340
+ const uuids = await view.documents.documentsByMime([
341
+ 'application/x-step', // .ifc
342
+ 'application/pdf',
343
+ ]);
344
+
345
+ // With metadata
346
+ const docs = await view.documents.documentsByMime(
347
+ ['image/png', 'image/jpeg'],
348
+ true,
349
+ );
350
+ ```
351
+
352
+ | Method | Filters by | Default return | With `true` |
353
+ |---|---|---|---|
354
+ | `documentsBySuffix` | File extension string(s) | `string[]` UUIDs | adds `iri`, `path`, `suffix`, `size` |
355
+ | `documentsByFileType` | `FileType` enum value(s) | `string[]` UUIDs | adds `iri`, `path`, `suffix`, `size` |
356
+ | `documentsByMime` | MIME type string(s) | `string[]` UUIDs | adds `iri`, `path`, `suffix`, `size` |
357
+
261
358
  ## Node.js — file sync
262
359
 
263
360
  For server-side or CLI use with file-sync capabilities, import from `@qaecy/cue-sdk/node`: