@dyrected/sdk 2.5.59 → 2.5.60
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.cjs +25 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +25 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -340,7 +340,13 @@ var DyrectedClient = class {
|
|
|
340
340
|
* @param id - Document ID.
|
|
341
341
|
* @param args - Optional `limit` (default 50, max 100).
|
|
342
342
|
*/
|
|
343
|
-
workflowHistory: (id, args = {}) => this.workflowHistory(slug, id, args)
|
|
343
|
+
workflowHistory: (id, args = {}) => this.workflowHistory(slug, id, args),
|
|
344
|
+
/**
|
|
345
|
+
* Fetch audit entries for this collection.
|
|
346
|
+
*
|
|
347
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
348
|
+
*/
|
|
349
|
+
audit: (args = {}) => this.collectionAudit(slug, args)
|
|
344
350
|
};
|
|
345
351
|
}
|
|
346
352
|
/**
|
|
@@ -422,6 +428,24 @@ var DyrectedClient = class {
|
|
|
422
428
|
const query = args.limit ? `?limit=${args.limit}` : "";
|
|
423
429
|
return this.request(`/api/collections/${collection}/${id}/workflow-history${query}`);
|
|
424
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Fetch audit entries across every audited collection the current caller can read.
|
|
433
|
+
*
|
|
434
|
+
* Sends `GET /api/audit`.
|
|
435
|
+
*/
|
|
436
|
+
async audit(args = {}) {
|
|
437
|
+
const query = stringifyQuery(normalizeQueryArgs(args), { addQueryPrefix: true });
|
|
438
|
+
return this.request(`/api/audit${query}`);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Fetch audit entries for a single collection.
|
|
442
|
+
*
|
|
443
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
444
|
+
*/
|
|
445
|
+
async collectionAudit(collection, args = {}) {
|
|
446
|
+
const query = stringifyQuery(normalizeQueryArgs(args), { addQueryPrefix: true });
|
|
447
|
+
return this.request(`/api/collections/${collection}/__audit${query}`);
|
|
448
|
+
}
|
|
425
449
|
async deleteMany(collection, ids) {
|
|
426
450
|
return this.request(`/api/collections/${collection}/delete-many`, {
|
|
427
451
|
method: "DELETE",
|
package/dist/index.d.cts
CHANGED
|
@@ -63,6 +63,16 @@ interface WorkflowHistoryEntry {
|
|
|
63
63
|
actorId: string | null;
|
|
64
64
|
createdAt: string;
|
|
65
65
|
}
|
|
66
|
+
/** A single audit entry returned by `client.audit()` or `client.collection(slug).audit()`. */
|
|
67
|
+
interface AuditEntry {
|
|
68
|
+
id: string;
|
|
69
|
+
collection: string;
|
|
70
|
+
documentId: string | null;
|
|
71
|
+
operation: string;
|
|
72
|
+
user: string | null;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
changes?: string | Record<string, unknown> | null;
|
|
75
|
+
}
|
|
66
76
|
type ExtractDoc<T> = T extends CollectionConfig<infer TDoc> ? TDoc : T extends GlobalConfig<infer TDoc> ? TDoc : never;
|
|
67
77
|
/**
|
|
68
78
|
* Derives a typed `TSchema` from your exported collection and global config constants.
|
|
@@ -309,6 +319,12 @@ declare class DyrectedClient<TSchema extends BaseSchema = BaseSchema> {
|
|
|
309
319
|
workflowHistory: (id: string, args?: {
|
|
310
320
|
limit?: number;
|
|
311
321
|
}) => Promise<PaginatedResult<WorkflowHistoryEntry>>;
|
|
322
|
+
/**
|
|
323
|
+
* Fetch audit entries for this collection.
|
|
324
|
+
*
|
|
325
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
326
|
+
*/
|
|
327
|
+
audit: (args?: QueryArgs<AuditEntry>) => Promise<PaginatedResult<AuditEntry>>;
|
|
312
328
|
};
|
|
313
329
|
/**
|
|
314
330
|
* Access a global by its slug with a fluent builder.
|
|
@@ -358,6 +374,18 @@ declare class DyrectedClient<TSchema extends BaseSchema = BaseSchema> {
|
|
|
358
374
|
workflowHistory(collection: string, id: string, args?: {
|
|
359
375
|
limit?: number;
|
|
360
376
|
}): Promise<PaginatedResult<WorkflowHistoryEntry>>;
|
|
377
|
+
/**
|
|
378
|
+
* Fetch audit entries across every audited collection the current caller can read.
|
|
379
|
+
*
|
|
380
|
+
* Sends `GET /api/audit`.
|
|
381
|
+
*/
|
|
382
|
+
audit(args?: QueryArgs<AuditEntry>): Promise<PaginatedResult<AuditEntry>>;
|
|
383
|
+
/**
|
|
384
|
+
* Fetch audit entries for a single collection.
|
|
385
|
+
*
|
|
386
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
387
|
+
*/
|
|
388
|
+
collectionAudit(collection: string, args?: QueryArgs<AuditEntry>): Promise<PaginatedResult<AuditEntry>>;
|
|
361
389
|
deleteMany(collection: string, ids: string[]): Promise<{
|
|
362
390
|
message: string;
|
|
363
391
|
}>;
|
|
@@ -386,4 +414,4 @@ declare class DyrectedClient<TSchema extends BaseSchema = BaseSchema> {
|
|
|
386
414
|
}
|
|
387
415
|
declare function createClient<TSchema extends BaseSchema = BaseSchema>(config: DyrectedClientConfig): DyrectedClient<TSchema>;
|
|
388
416
|
|
|
389
|
-
export { type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, type InferSchema, type TransitionOptions, type UploadOptions, type WorkflowDocument, type WorkflowHistoryEntry, createClient };
|
|
417
|
+
export { type AuditEntry, type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, type InferSchema, type TransitionOptions, type UploadOptions, type WorkflowDocument, type WorkflowHistoryEntry, createClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,16 @@ interface WorkflowHistoryEntry {
|
|
|
63
63
|
actorId: string | null;
|
|
64
64
|
createdAt: string;
|
|
65
65
|
}
|
|
66
|
+
/** A single audit entry returned by `client.audit()` or `client.collection(slug).audit()`. */
|
|
67
|
+
interface AuditEntry {
|
|
68
|
+
id: string;
|
|
69
|
+
collection: string;
|
|
70
|
+
documentId: string | null;
|
|
71
|
+
operation: string;
|
|
72
|
+
user: string | null;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
changes?: string | Record<string, unknown> | null;
|
|
75
|
+
}
|
|
66
76
|
type ExtractDoc<T> = T extends CollectionConfig<infer TDoc> ? TDoc : T extends GlobalConfig<infer TDoc> ? TDoc : never;
|
|
67
77
|
/**
|
|
68
78
|
* Derives a typed `TSchema` from your exported collection and global config constants.
|
|
@@ -309,6 +319,12 @@ declare class DyrectedClient<TSchema extends BaseSchema = BaseSchema> {
|
|
|
309
319
|
workflowHistory: (id: string, args?: {
|
|
310
320
|
limit?: number;
|
|
311
321
|
}) => Promise<PaginatedResult<WorkflowHistoryEntry>>;
|
|
322
|
+
/**
|
|
323
|
+
* Fetch audit entries for this collection.
|
|
324
|
+
*
|
|
325
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
326
|
+
*/
|
|
327
|
+
audit: (args?: QueryArgs<AuditEntry>) => Promise<PaginatedResult<AuditEntry>>;
|
|
312
328
|
};
|
|
313
329
|
/**
|
|
314
330
|
* Access a global by its slug with a fluent builder.
|
|
@@ -358,6 +374,18 @@ declare class DyrectedClient<TSchema extends BaseSchema = BaseSchema> {
|
|
|
358
374
|
workflowHistory(collection: string, id: string, args?: {
|
|
359
375
|
limit?: number;
|
|
360
376
|
}): Promise<PaginatedResult<WorkflowHistoryEntry>>;
|
|
377
|
+
/**
|
|
378
|
+
* Fetch audit entries across every audited collection the current caller can read.
|
|
379
|
+
*
|
|
380
|
+
* Sends `GET /api/audit`.
|
|
381
|
+
*/
|
|
382
|
+
audit(args?: QueryArgs<AuditEntry>): Promise<PaginatedResult<AuditEntry>>;
|
|
383
|
+
/**
|
|
384
|
+
* Fetch audit entries for a single collection.
|
|
385
|
+
*
|
|
386
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
387
|
+
*/
|
|
388
|
+
collectionAudit(collection: string, args?: QueryArgs<AuditEntry>): Promise<PaginatedResult<AuditEntry>>;
|
|
361
389
|
deleteMany(collection: string, ids: string[]): Promise<{
|
|
362
390
|
message: string;
|
|
363
391
|
}>;
|
|
@@ -386,4 +414,4 @@ declare class DyrectedClient<TSchema extends BaseSchema = BaseSchema> {
|
|
|
386
414
|
}
|
|
387
415
|
declare function createClient<TSchema extends BaseSchema = BaseSchema>(config: DyrectedClientConfig): DyrectedClient<TSchema>;
|
|
388
416
|
|
|
389
|
-
export { type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, type InferSchema, type TransitionOptions, type UploadOptions, type WorkflowDocument, type WorkflowHistoryEntry, createClient };
|
|
417
|
+
export { type AuditEntry, type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, type InferSchema, type TransitionOptions, type UploadOptions, type WorkflowDocument, type WorkflowHistoryEntry, createClient };
|
package/dist/index.js
CHANGED
|
@@ -312,7 +312,13 @@ var DyrectedClient = class {
|
|
|
312
312
|
* @param id - Document ID.
|
|
313
313
|
* @param args - Optional `limit` (default 50, max 100).
|
|
314
314
|
*/
|
|
315
|
-
workflowHistory: (id, args = {}) => this.workflowHistory(slug, id, args)
|
|
315
|
+
workflowHistory: (id, args = {}) => this.workflowHistory(slug, id, args),
|
|
316
|
+
/**
|
|
317
|
+
* Fetch audit entries for this collection.
|
|
318
|
+
*
|
|
319
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
320
|
+
*/
|
|
321
|
+
audit: (args = {}) => this.collectionAudit(slug, args)
|
|
316
322
|
};
|
|
317
323
|
}
|
|
318
324
|
/**
|
|
@@ -394,6 +400,24 @@ var DyrectedClient = class {
|
|
|
394
400
|
const query = args.limit ? `?limit=${args.limit}` : "";
|
|
395
401
|
return this.request(`/api/collections/${collection}/${id}/workflow-history${query}`);
|
|
396
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Fetch audit entries across every audited collection the current caller can read.
|
|
405
|
+
*
|
|
406
|
+
* Sends `GET /api/audit`.
|
|
407
|
+
*/
|
|
408
|
+
async audit(args = {}) {
|
|
409
|
+
const query = stringifyQuery(normalizeQueryArgs(args), { addQueryPrefix: true });
|
|
410
|
+
return this.request(`/api/audit${query}`);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Fetch audit entries for a single collection.
|
|
414
|
+
*
|
|
415
|
+
* Sends `GET /api/collections/:collection/__audit`.
|
|
416
|
+
*/
|
|
417
|
+
async collectionAudit(collection, args = {}) {
|
|
418
|
+
const query = stringifyQuery(normalizeQueryArgs(args), { addQueryPrefix: true });
|
|
419
|
+
return this.request(`/api/collections/${collection}/__audit${query}`);
|
|
420
|
+
}
|
|
397
421
|
async deleteMany(collection, ids) {
|
|
398
422
|
return this.request(`/api/collections/${collection}/delete-many`, {
|
|
399
423
|
method: "DELETE",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dyrected/sdk",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"tsup": "^8.5.1",
|
|
31
31
|
"typescript": "^5.4.5",
|
|
32
32
|
"vitest": "^1.0.0",
|
|
33
|
-
"@dyrected/core": "2.5.
|
|
33
|
+
"@dyrected/core": "2.5.60"
|
|
34
34
|
},
|
|
35
35
|
"license": "BSL-1.1",
|
|
36
36
|
"author": "Busola Okeowo <busolaokemoney@gmail.com>",
|