@docmana/sdk 0.15.2 → 0.16.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/CHANGELOG.md +7 -0
- package/dist/api/organization-documents.d.ts +3 -2
- package/dist/cli.mjs +14 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/client.d.ts +3 -2
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
- Scope organization document access to a specific organization: `listOrganizationDocuments`
|
|
5
|
+
now accepts an `organization` option and `downloadOrganizationDocument(s)` an optional
|
|
6
|
+
`organization` argument, both forwarded as the `?organization=` query param (relayed to
|
|
7
|
+
docmana-api as `X-Selected-Organization`). Without it, consumer-edge reads the caller's
|
|
8
|
+
default organization depot, which leaks another org's documents to callers scoping by site.
|
|
9
|
+
|
|
3
10
|
## 0.15.0
|
|
4
11
|
- Expose `rejectionCode`, `rejectionMessage`, `documentTypeProximity`, and
|
|
5
12
|
`documentContentNature` as optional system fields on node results instead of
|
|
@@ -2,6 +2,7 @@ import type { HttpClient } from "../http/http-client.js";
|
|
|
2
2
|
import type { DownloadedOrganizationDocument, OrganizationDocumentsPayload } from "../types.js";
|
|
3
3
|
export declare function listOrganizationDocuments(http: HttpClient, options?: {
|
|
4
4
|
prefix?: string;
|
|
5
|
+
organization?: string;
|
|
5
6
|
}): Promise<OrganizationDocumentsPayload>;
|
|
6
|
-
export declare function downloadOrganizationDocument(http: HttpClient, path: string): Promise<DownloadedOrganizationDocument>;
|
|
7
|
-
export declare function downloadOrganizationDocuments(http: HttpClient, paths: string[]): Promise<DownloadedOrganizationDocument[]>;
|
|
7
|
+
export declare function downloadOrganizationDocument(http: HttpClient, path: string, organization?: string): Promise<DownloadedOrganizationDocument>;
|
|
8
|
+
export declare function downloadOrganizationDocuments(http: HttpClient, paths: string[], organization?: string): Promise<DownloadedOrganizationDocument[]>;
|
package/dist/cli.mjs
CHANGED
|
@@ -400,8 +400,11 @@ async function getFlowDefinition(http, flowId, organization) {
|
|
|
400
400
|
|
|
401
401
|
// src/sdk/api/organization-documents.ts
|
|
402
402
|
async function listOrganizationDocuments(http, options = {}) {
|
|
403
|
+
const query = {};
|
|
404
|
+
if (options.prefix) query.prefix = options.prefix;
|
|
405
|
+
if (options.organization) query.organization = options.organization;
|
|
403
406
|
const result = await http.requestJson("GET", "/organization-documents", {
|
|
404
|
-
query:
|
|
407
|
+
query: Object.keys(query).length ? query : void 0
|
|
405
408
|
});
|
|
406
409
|
const value = result && typeof result === "object" ? result : {};
|
|
407
410
|
return {
|
|
@@ -409,9 +412,11 @@ async function listOrganizationDocuments(http, options = {}) {
|
|
|
409
412
|
documents: Array.isArray(value.documents) ? value.documents.map(toOrganizationDocument).filter(isOrganizationDocument) : []
|
|
410
413
|
};
|
|
411
414
|
}
|
|
412
|
-
async function downloadOrganizationDocument(http, path) {
|
|
415
|
+
async function downloadOrganizationDocument(http, path, organization) {
|
|
416
|
+
const query = { path };
|
|
417
|
+
if (organization) query.organization = organization;
|
|
413
418
|
const result = await http.requestBytes("GET", "/organization-documents/download", {
|
|
414
|
-
query
|
|
419
|
+
query
|
|
415
420
|
});
|
|
416
421
|
return {
|
|
417
422
|
bytes: result.bytes,
|
|
@@ -419,8 +424,8 @@ async function downloadOrganizationDocument(http, path) {
|
|
|
419
424
|
contentType: result.headers.get("content-type") || void 0
|
|
420
425
|
};
|
|
421
426
|
}
|
|
422
|
-
async function downloadOrganizationDocuments(http, paths) {
|
|
423
|
-
return Promise.all(paths.map((path) => downloadOrganizationDocument(http, path)));
|
|
427
|
+
async function downloadOrganizationDocuments(http, paths, organization) {
|
|
428
|
+
return Promise.all(paths.map((path) => downloadOrganizationDocument(http, path, organization)));
|
|
424
429
|
}
|
|
425
430
|
function toOrganizationDocument(document) {
|
|
426
431
|
const value = document && typeof document === "object" ? document : {};
|
|
@@ -608,11 +613,11 @@ var Docmana = class {
|
|
|
608
613
|
async listOrganizationDocuments(options = {}) {
|
|
609
614
|
return listOrganizationDocuments(this.http, options);
|
|
610
615
|
}
|
|
611
|
-
async downloadOrganizationDocument(path) {
|
|
612
|
-
return downloadOrganizationDocument(this.http, path);
|
|
616
|
+
async downloadOrganizationDocument(path, organization) {
|
|
617
|
+
return downloadOrganizationDocument(this.http, path, organization);
|
|
613
618
|
}
|
|
614
|
-
async downloadOrganizationDocuments(paths) {
|
|
615
|
-
return downloadOrganizationDocuments(this.http, paths);
|
|
619
|
+
async downloadOrganizationDocuments(paths, organization) {
|
|
620
|
+
return downloadOrganizationDocuments(this.http, paths, organization);
|
|
616
621
|
}
|
|
617
622
|
isTerminalStatus(status) {
|
|
618
623
|
return isTerminalStatus(status);
|