@nvisy/sdk 0.52.0 → 0.54.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/dist/datatypes/index.d.ts +2 -2
  3. package/dist/{errors-CcTfWeEE.d.ts → errors-DShmkdjS.d.ts} +2 -2
  4. package/dist/{errors-CcTfWeEE.d.ts.map → errors-DShmkdjS.d.ts.map} +1 -1
  5. package/dist/guest/index.d.ts +38 -0
  6. package/dist/guest/index.d.ts.map +1 -0
  7. package/dist/guest/index.js +56 -0
  8. package/dist/guest/index.js.map +1 -0
  9. package/dist/http-BexRclA5.js +128 -0
  10. package/dist/http-BexRclA5.js.map +1 -0
  11. package/dist/{client-CSxuXX5e.d.ts → index-DFbHT_eq.d.ts} +443 -221
  12. package/dist/index-DFbHT_eq.d.ts.map +1 -0
  13. package/dist/{index-DmLbi0Gi.d.ts → index-DzEtj1r2.d.ts} +1837 -762
  14. package/dist/index-DzEtj1r2.d.ts.map +1 -0
  15. package/dist/index.d.ts +3 -4
  16. package/dist/index.js +28 -117
  17. package/dist/index.js.map +1 -1
  18. package/dist/services/index.d.ts +2 -2
  19. package/dist/services/index.js +2 -2
  20. package/dist/{services-Bt15MerP.js → services-BMmcawiT.js} +268 -73
  21. package/dist/services-BMmcawiT.js.map +1 -0
  22. package/dist/webhooks/index.d.ts +2 -2
  23. package/package.json +4 -4
  24. package/dist/client-CSxuXX5e.d.ts.map +0 -1
  25. package/dist/config-BdAgnJlh.d.ts +0 -103
  26. package/dist/config-BdAgnJlh.d.ts.map +0 -1
  27. package/dist/error-Bc6Sg_y-.js +0 -47
  28. package/dist/error-Bc6Sg_y-.js.map +0 -1
  29. package/dist/index-DmLbi0Gi.d.ts.map +0 -1
  30. package/dist/services-Bt15MerP.js.map +0 -1
  31. package/dist/standalone/index.d.ts +0 -117
  32. package/dist/standalone/index.d.ts.map +0 -1
  33. package/dist/standalone/index.js +0 -153
  34. package/dist/standalone/index.js.map +0 -1
@@ -309,7 +309,9 @@ var ApiTokens = class {
309
309
  //#endregion
310
310
  //#region src/services/auth.ts
311
311
  /**
312
- * Service for handling authentication operations
312
+ * Authenticated auth operations: ending the current session and minting a
313
+ * desktop token from it. Pre-auth sign-in (login / signup / OIDC start) lives on
314
+ * the guest client ({@link NvisyGuest}).
313
315
  */
314
316
  var Auth = class {
315
317
  #api;
@@ -317,34 +319,6 @@ var Auth = class {
317
319
  this.#api = api;
318
320
  }
319
321
  /**
320
- * Login with email and password, starting a browser session.
321
- *
322
- * Sets HttpOnly session and CSRF cookies; returns no body. Programmatic
323
- * clients should instead create an API token via {@link ApiTokens} and pass
324
- * it as `apiToken` when constructing the client.
325
- *
326
- * @param credentials - Login credentials
327
- * @returns Promise that resolves once the session is started
328
- * @throws {ApiError} if the request fails
329
- */
330
- async loginAccount(credentials) {
331
- await this.#api.POST("/auth/login", { body: credentials });
332
- }
333
- /**
334
- * Sign up a new account, starting a browser session.
335
- *
336
- * Sets HttpOnly session and CSRF cookies; returns no body. Programmatic
337
- * clients should instead create an API token via {@link ApiTokens} and pass
338
- * it as `apiToken` when constructing the client.
339
- *
340
- * @param credentials - Signup details
341
- * @returns Promise that resolves once the session is started
342
- * @throws {ApiError} if the request fails
343
- */
344
- async signupAccount(credentials) {
345
- await this.#api.POST("/auth/signup", { body: credentials });
346
- }
347
- /**
348
322
  * Logout, invalidating the current session and clearing its cookies.
349
323
  * @returns Promise that resolves when logout is complete
350
324
  * @throws {ApiError} if the request fails
@@ -353,25 +327,6 @@ var Auth = class {
353
327
  await this.#api.POST("/auth/logout");
354
328
  }
355
329
  /**
356
- * Begin an OpenID Connect sign-in with a provider.
357
- *
358
- * Returns the provider authorize URL to redirect the user to; on consent the
359
- * provider redirects to the callback, which signs the user in. Also available
360
- * as the standalone `startOidcSignIn` for use without a client.
361
- *
362
- * @param provider - The identity provider to sign in with
363
- * @param query - Optional frontend URL to return to once done
364
- * @returns Promise that resolves with the provider authorize URL
365
- * @throws {ApiError} if the request fails
366
- */
367
- async startOidcSignIn(provider, query) {
368
- const { data } = await this.#api.GET("/auth/{provider}/start", { params: {
369
- path: { provider },
370
- query
371
- } });
372
- return data;
373
- }
374
- /**
375
330
  * Mint a long-lived native-app token for a desktop app.
376
331
  *
377
332
  * Requires an active browser session (the desktop login completes in the
@@ -918,7 +873,7 @@ var Detections = class {
918
873
  //#endregion
919
874
  //#region src/services/documents.ts
920
875
  /**
921
- * Service for handling document operations, including review assignment.
876
+ * Service for handling document operations.
922
877
  */
923
878
  var Documents = class {
924
879
  #api;
@@ -1043,36 +998,92 @@ var Documents = class {
1043
998
  });
1044
999
  return data;
1045
1000
  }
1001
+ };
1002
+
1003
+ //#endregion
1004
+ //#region src/services/guest-auth.ts
1005
+ /**
1006
+ * Pre-auth authentication operations, reachable without an API token: starting
1007
+ * a browser session (login / signup) and beginning an OIDC sign-in. Exposed on
1008
+ * the guest client ({@link NvisyGuest}).
1009
+ */
1010
+ var GuestAuth = class {
1011
+ #api;
1012
+ constructor(api) {
1013
+ this.#api = api;
1014
+ }
1046
1015
  /**
1047
- * Assign a document for review, opening a review thread.
1048
- * @param workspaceId - Workspace id
1049
- * @param documentId - Document ID
1050
- * @param assignment - Review assignment request
1051
- * @returns Promise that resolves with the review thread
1016
+ * Login with email and password, starting a browser session.
1017
+ *
1018
+ * Sets HttpOnly session and CSRF cookies; returns no body. For a programmatic
1019
+ * client, create an API token instead and pass it as `apiToken` when
1020
+ * constructing a {@link Nvisy} client.
1021
+ *
1022
+ * @param credentials - Login credentials
1023
+ * @returns Promise that resolves once the session is started
1052
1024
  * @throws {ApiError} if the request fails
1053
1025
  */
1054
- async assignReview(workspaceId, documentId, assignment) {
1055
- const { data } = await this.#api.PUT("/workspaces/{workspaceId}/documents/{documentId}/review/assign", {
1056
- params: { path: {
1057
- workspaceId,
1058
- documentId
1059
- } },
1060
- body: assignment
1061
- });
1026
+ async loginAccount(credentials) {
1027
+ await this.#api.POST("/auth/login", { body: credentials });
1028
+ }
1029
+ /**
1030
+ * Sign up a new account, starting a browser session.
1031
+ *
1032
+ * Sets HttpOnly session and CSRF cookies; returns no body. For a programmatic
1033
+ * client, create an API token instead and pass it as `apiToken` when
1034
+ * constructing a {@link Nvisy} client.
1035
+ *
1036
+ * @param credentials - Signup details
1037
+ * @returns Promise that resolves once the session is started
1038
+ * @throws {ApiError} if the request fails
1039
+ */
1040
+ async signupAccount(credentials) {
1041
+ await this.#api.POST("/auth/signup", { body: credentials });
1042
+ }
1043
+ /**
1044
+ * Begin an OpenID Connect sign-in with a provider.
1045
+ *
1046
+ * Returns the provider authorize URL to redirect the user to; on consent the
1047
+ * provider redirects to the callback, which signs the user in.
1048
+ *
1049
+ * @param provider - The identity provider to sign in with
1050
+ * @param query - Optional frontend URL to return to once done
1051
+ * @returns Promise that resolves with the provider authorize URL
1052
+ * @throws {ApiError} if the request fails
1053
+ */
1054
+ async startOidcSignIn(provider, query) {
1055
+ const { data } = await this.#api.GET("/auth/{provider}/start", { params: {
1056
+ path: { provider },
1057
+ query
1058
+ } });
1062
1059
  return data;
1063
1060
  }
1061
+ };
1062
+
1063
+ //#endregion
1064
+ //#region src/services/guest-capabilities.ts
1065
+ /**
1066
+ * The pre-auth subset of the deployment's capabilities: the sign-in methods it
1067
+ * offers. The label / recognizer / connector capability reads require an
1068
+ * authenticated client and live on {@link Capabilities}.
1069
+ */
1070
+ var GuestCapabilities = class {
1071
+ #api;
1072
+ constructor(api) {
1073
+ this.#api = api;
1074
+ }
1064
1075
  /**
1065
- * Mark a document's review as verified (resolved).
1066
- * @param workspaceId - Workspace id
1067
- * @param documentId - Document ID
1068
- * @returns Promise that resolves with the review thread
1076
+ * Get the deployment's available sign-in methods.
1077
+ *
1078
+ * Public: reports whether password sign-in is enabled and which OIDC
1079
+ * providers are configured, so a login screen can render the right buttons
1080
+ * before anyone signs in.
1081
+ *
1082
+ * @returns Promise that resolves with the auth capabilities.
1069
1083
  * @throws {ApiError} if the request fails
1070
1084
  */
1071
- async verifyReview(workspaceId, documentId) {
1072
- const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/{documentId}/review/verify", { params: { path: {
1073
- workspaceId,
1074
- documentId
1075
- } } });
1085
+ async getAuthCapabilities() {
1086
+ const { data } = await this.#api.GET("/capabilities/auth");
1076
1087
  return data;
1077
1088
  }
1078
1089
  };
@@ -1643,6 +1654,190 @@ var Redactions = class {
1643
1654
  }
1644
1655
  };
1645
1656
 
1657
+ //#endregion
1658
+ //#region src/services/reviews.ts
1659
+ /**
1660
+ * Service for document reviews: assigning a document to a reviewer and tracking
1661
+ * the review through its lifecycle, with a timeline of events.
1662
+ */
1663
+ var Reviews = class {
1664
+ #api;
1665
+ constructor(api) {
1666
+ this.#api = api;
1667
+ }
1668
+ /**
1669
+ * List the reviews on a document, most recent first.
1670
+ * @param workspaceId - Workspace id
1671
+ * @param documentId - Document ID
1672
+ * @returns Promise that resolves with the document's reviews
1673
+ * @throws {ApiError} if the request fails
1674
+ */
1675
+ async listForDocument(workspaceId, documentId) {
1676
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/documents/{documentId}/reviews", { params: { path: {
1677
+ workspaceId,
1678
+ documentId
1679
+ } } });
1680
+ return data;
1681
+ }
1682
+ /**
1683
+ * Open a review on a document.
1684
+ * @param workspaceId - Workspace id
1685
+ * @param documentId - Document ID
1686
+ * @param review - Review creation request
1687
+ * @returns Promise that resolves with the created review
1688
+ * @throws {ApiError} if the request fails
1689
+ */
1690
+ async createForDocument(workspaceId, documentId, review) {
1691
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/{documentId}/reviews", {
1692
+ params: { path: {
1693
+ workspaceId,
1694
+ documentId
1695
+ } },
1696
+ body: review
1697
+ });
1698
+ return data;
1699
+ }
1700
+ /**
1701
+ * List a workspace's reviews.
1702
+ * @param workspaceId - Workspace id
1703
+ * @param query - Optional pagination and filters (assignee, documentId,
1704
+ * reviewStatus, limit, after)
1705
+ * @returns Promise that resolves with a paginated list of reviews
1706
+ * @throws {ApiError} if the request fails
1707
+ */
1708
+ async listReviews(workspaceId, query) {
1709
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/reviews", { params: {
1710
+ path: { workspaceId },
1711
+ query
1712
+ } });
1713
+ return data;
1714
+ }
1715
+ /**
1716
+ * Get review details by ID.
1717
+ * @param workspaceId - Workspace id
1718
+ * @param reviewId - Review ID
1719
+ * @returns Promise that resolves with the review details
1720
+ * @throws {ApiError} if the request fails
1721
+ */
1722
+ async getReview(workspaceId, reviewId) {
1723
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/reviews/{reviewId}", { params: { path: {
1724
+ workspaceId,
1725
+ reviewId
1726
+ } } });
1727
+ return data;
1728
+ }
1729
+ /**
1730
+ * Assign a reviewer to a review (idempotent).
1731
+ * @param workspaceId - Workspace id
1732
+ * @param reviewId - Review ID
1733
+ * @param accountId - Account id of the reviewer to assign
1734
+ * @returns Promise that resolves with the updated review
1735
+ * @throws {ApiError} if the request fails
1736
+ */
1737
+ async assignReviewer(workspaceId, reviewId, accountId) {
1738
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/reviews/{reviewId}/assignees/{accountId}", { params: { path: {
1739
+ workspaceId,
1740
+ reviewId,
1741
+ accountId
1742
+ } } });
1743
+ return data;
1744
+ }
1745
+ /**
1746
+ * Remove a reviewer from a review.
1747
+ * @param workspaceId - Workspace id
1748
+ * @param reviewId - Review ID
1749
+ * @param accountId - Account id of the reviewer to remove
1750
+ * @returns Promise that resolves with the updated review
1751
+ * @throws {ApiError} if the request fails
1752
+ */
1753
+ async unassignReviewer(workspaceId, reviewId, accountId) {
1754
+ const { data } = await this.#api.DELETE("/workspaces/{workspaceId}/reviews/{reviewId}/assignees/{accountId}", { params: { path: {
1755
+ workspaceId,
1756
+ reviewId,
1757
+ accountId
1758
+ } } });
1759
+ return data;
1760
+ }
1761
+ /**
1762
+ * Verify (resolve) a review.
1763
+ * @param workspaceId - Workspace id
1764
+ * @param reviewId - Review ID
1765
+ * @returns Promise that resolves with the updated review
1766
+ * @throws {ApiError} if the request fails
1767
+ */
1768
+ async verifyReview(workspaceId, reviewId) {
1769
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/reviews/{reviewId}/verify", { params: { path: {
1770
+ workspaceId,
1771
+ reviewId
1772
+ } } });
1773
+ return data;
1774
+ }
1775
+ /**
1776
+ * Reopen a resolved review.
1777
+ * @param workspaceId - Workspace id
1778
+ * @param reviewId - Review ID
1779
+ * @returns Promise that resolves with the updated review
1780
+ * @throws {ApiError} if the request fails
1781
+ */
1782
+ async reopenReview(workspaceId, reviewId) {
1783
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/reviews/{reviewId}/reopen", { params: { path: {
1784
+ workspaceId,
1785
+ reviewId
1786
+ } } });
1787
+ return data;
1788
+ }
1789
+ /**
1790
+ * Get a review's timeline: the events in its life.
1791
+ * @param workspaceId - Workspace id
1792
+ * @param reviewId - Review ID
1793
+ * @param query - Optional pagination (limit, after)
1794
+ * @returns Promise that resolves with a paginated list of review events
1795
+ * @throws {ApiError} if the request fails
1796
+ */
1797
+ async getTimeline(workspaceId, reviewId, query) {
1798
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/reviews/{reviewId}/timeline", { params: {
1799
+ path: {
1800
+ workspaceId,
1801
+ reviewId
1802
+ },
1803
+ query
1804
+ } });
1805
+ return data;
1806
+ }
1807
+ /**
1808
+ * Link a detection to a review (idempotent).
1809
+ * @param workspaceId - Workspace id
1810
+ * @param reviewId - Review ID
1811
+ * @param detectionId - Detection ID
1812
+ * @returns Promise that resolves with the updated review
1813
+ * @throws {ApiError} if the request fails
1814
+ */
1815
+ async linkDetection(workspaceId, reviewId, detectionId) {
1816
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/reviews/{reviewId}/detections/{detectionId}", { params: { path: {
1817
+ workspaceId,
1818
+ reviewId,
1819
+ detectionId
1820
+ } } });
1821
+ return data;
1822
+ }
1823
+ /**
1824
+ * Link a redaction to a review (idempotent).
1825
+ * @param workspaceId - Workspace id
1826
+ * @param reviewId - Review ID
1827
+ * @param redactionId - Redaction ID
1828
+ * @returns Promise that resolves with the updated review
1829
+ * @throws {ApiError} if the request fails
1830
+ */
1831
+ async linkRedaction(workspaceId, reviewId, redactionId) {
1832
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/reviews/{reviewId}/redactions/{redactionId}", { params: { path: {
1833
+ workspaceId,
1834
+ reviewId,
1835
+ redactionId
1836
+ } } });
1837
+ return data;
1838
+ }
1839
+ };
1840
+
1646
1841
  //#endregion
1647
1842
  //#region src/services/status.ts
1648
1843
  /**
@@ -2173,5 +2368,5 @@ var Workspaces = class {
2173
2368
  };
2174
2369
 
2175
2370
  //#endregion
2176
- export { Auth as _, Status as a, Activities as b, Policies as c, Members as d, Invites as f, Capabilities as g, Connections as h, Syncs as i, Pipelines as l, Detections as m, Webhooks as n, Redactions as o, Documents as p, Threads as r, Providers as s, Workspaces as t, Notifications as u, ApiTokens as v, Account as x, Analytics as y };
2177
- //# sourceMappingURL=services-Bt15MerP.js.map
2371
+ export { Activities as C, Analytics as S, Detections as _, Status as a, Auth as b, Providers as c, Notifications as d, Members as f, Documents as g, GuestAuth as h, Syncs as i, Policies as l, GuestCapabilities as m, Webhooks as n, Reviews as o, Invites as p, Threads as r, Redactions as s, Workspaces as t, Pipelines as u, Connections as v, Account as w, ApiTokens as x, Capabilities as y };
2372
+ //# sourceMappingURL=services-BMmcawiT.js.map