@verdocs/js-sdk 4.2.27 → 4.2.28
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.mts +93 -106
- package/dist/index.d.ts +93 -106
- package/dist/index.js +44 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -38
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2374,21 +2374,39 @@ const hasRequiredPermissions = (profile, permissions) => permissions.every((perm
|
|
|
2374
2374
|
|
|
2375
2375
|
/**
|
|
2376
2376
|
* Add a field to a template.
|
|
2377
|
+
*
|
|
2378
|
+
* ```typescript
|
|
2379
|
+
* import {createField} from '@verdocs/js-sdk/Templates';
|
|
2380
|
+
*
|
|
2381
|
+
* await createField((VerdocsEndpoint.getDefault(), template_id, { ... });
|
|
2382
|
+
* ```
|
|
2377
2383
|
*/
|
|
2378
2384
|
const createField = (endpoint, templateId, params) => endpoint.api //
|
|
2379
|
-
.post(`/
|
|
2385
|
+
.post(`/v2/fields/${templateId}`, params)
|
|
2380
2386
|
.then((r) => r.data);
|
|
2381
2387
|
/**
|
|
2382
2388
|
* Update a template field.
|
|
2389
|
+
*
|
|
2390
|
+
* ```typescript
|
|
2391
|
+
* import {updateField} from '@verdocs/js-sdk/Templates';
|
|
2392
|
+
*
|
|
2393
|
+
* await updateField((VerdocsEndpoint.getDefault(), template_id, field_name, { ... });
|
|
2394
|
+
* ```
|
|
2383
2395
|
*/
|
|
2384
|
-
const updateField = (endpoint, templateId,
|
|
2385
|
-
.
|
|
2396
|
+
const updateField = (endpoint, templateId, name, params) => endpoint.api //
|
|
2397
|
+
.patch(`/fields/${templateId}/${name}`, params)
|
|
2386
2398
|
.then((r) => r.data);
|
|
2387
2399
|
/**
|
|
2388
|
-
*
|
|
2400
|
+
* Remove a field from a template.
|
|
2401
|
+
*
|
|
2402
|
+
* ```typescript
|
|
2403
|
+
* import {deleteField} from '@verdocs/js-sdk/Templates';
|
|
2404
|
+
*
|
|
2405
|
+
* await deleteField((VerdocsEndpoint.getDefault(), template_id, field_name);
|
|
2406
|
+
* ```
|
|
2389
2407
|
*/
|
|
2390
|
-
const deleteField = (endpoint, templateId,
|
|
2391
|
-
.delete(`/
|
|
2408
|
+
const deleteField = (endpoint, templateId, name) => endpoint.api //
|
|
2409
|
+
.delete(`/fields/${templateId}/${name}`)
|
|
2392
2410
|
.then((r) => r.data);
|
|
2393
2411
|
|
|
2394
2412
|
/**
|
|
@@ -2635,12 +2653,12 @@ const getAllTags = (endpoint) => endpoint.api //
|
|
|
2635
2653
|
* Get all templates accessible by the caller, with optional filters.
|
|
2636
2654
|
*
|
|
2637
2655
|
* ```typescript
|
|
2638
|
-
* import {
|
|
2656
|
+
* import {getTemplates} from '@verdocs/js-sdk/Templates';
|
|
2639
2657
|
*
|
|
2640
|
-
* await
|
|
2641
|
-
* await
|
|
2642
|
-
* await
|
|
2643
|
-
* await
|
|
2658
|
+
* await getTemplates((VerdocsEndpoint.getDefault());
|
|
2659
|
+
* await getTemplates((VerdocsEndpoint.getDefault(), { is_starred: true });
|
|
2660
|
+
* await getTemplates((VerdocsEndpoint.getDefault(), { is_creator: true });
|
|
2661
|
+
* await getTemplates((VerdocsEndpoint.getDefault(), { is_organization: true });
|
|
2644
2662
|
* ```
|
|
2645
2663
|
*/
|
|
2646
2664
|
const getTemplates = (endpoint, params) => endpoint.api //
|
|
@@ -2659,9 +2677,9 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
2659
2677
|
* Lists all templates accessible by the caller, with optional filters.
|
|
2660
2678
|
*
|
|
2661
2679
|
* ```typescript
|
|
2662
|
-
* import {
|
|
2680
|
+
* import {listTemplates} from '@verdocs/js-sdk/Templates';
|
|
2663
2681
|
*
|
|
2664
|
-
* await
|
|
2682
|
+
* await listTemplates((VerdocsEndpoint.getDefault(), { sharing: 'personal', sort: 'last_used_at' });
|
|
2665
2683
|
* ```
|
|
2666
2684
|
*/
|
|
2667
2685
|
// export const listTemplates = (endpoint: VerdocsEndpoint, params?: IListTemplatesParams) =>
|
|
@@ -2672,9 +2690,9 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
2672
2690
|
* Get one template by its ID.
|
|
2673
2691
|
*
|
|
2674
2692
|
* ```typescript
|
|
2675
|
-
* import {
|
|
2693
|
+
* import {getTemplate} from '@verdocs/js-sdk/Templates';
|
|
2676
2694
|
*
|
|
2677
|
-
* const template = await
|
|
2695
|
+
* const template = await getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
2678
2696
|
* ```
|
|
2679
2697
|
*/
|
|
2680
2698
|
const getTemplate = (endpoint, templateId) => endpoint.api //
|
|
@@ -2694,6 +2712,7 @@ const getTemplate = (endpoint, templateId) => endpoint.api //
|
|
|
2694
2712
|
document.pages = document.page_numbers;
|
|
2695
2713
|
}
|
|
2696
2714
|
});
|
|
2715
|
+
// Temporary upgrade from legacy app
|
|
2697
2716
|
template.fields?.forEach((field) => {
|
|
2698
2717
|
if (field.setting) {
|
|
2699
2718
|
field.settings = field.setting;
|
|
@@ -2714,9 +2733,9 @@ const ALLOWED_CREATE_FIELDS = [
|
|
|
2714
2733
|
* Create a template.
|
|
2715
2734
|
*
|
|
2716
2735
|
* ```typescript
|
|
2717
|
-
* import {
|
|
2736
|
+
* import {createTemplate} from '@verdocs/js-sdk/Templates';
|
|
2718
2737
|
*
|
|
2719
|
-
* const newTemplate = await
|
|
2738
|
+
* const newTemplate = await createTemplate((VerdocsEndpoint.getDefault(), {...});
|
|
2720
2739
|
* ```
|
|
2721
2740
|
*/
|
|
2722
2741
|
const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
@@ -2748,9 +2767,9 @@ const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
|
2748
2767
|
* Create a template from a Sharepoint asset.
|
|
2749
2768
|
*
|
|
2750
2769
|
* ```typescript
|
|
2751
|
-
* import {
|
|
2770
|
+
* import {createTemplateFromSharepoint} from '@verdocs/js-sdk/Templates';
|
|
2752
2771
|
*
|
|
2753
|
-
* const newTemplate = await
|
|
2772
|
+
* const newTemplate = await createTemplateFromSharepoint((VerdocsEndpoint.getDefault(), {...});
|
|
2754
2773
|
* ```
|
|
2755
2774
|
*/
|
|
2756
2775
|
const createTemplateFromSharepoint = (endpoint, params) => {
|
|
@@ -2763,9 +2782,9 @@ const createTemplateFromSharepoint = (endpoint, params) => {
|
|
|
2763
2782
|
* Update a template.
|
|
2764
2783
|
*
|
|
2765
2784
|
* ```typescript
|
|
2766
|
-
* import {
|
|
2785
|
+
* import {updateTemplate} from '@verdocs/js-sdk/Templates';
|
|
2767
2786
|
*
|
|
2768
|
-
* const updatedTemplate = await
|
|
2787
|
+
* const updatedTemplate = await updateTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9', { name: 'New Name' });
|
|
2769
2788
|
* ```
|
|
2770
2789
|
*/
|
|
2771
2790
|
const updateTemplate = (endpoint, templateId, params) => endpoint.api //
|
|
@@ -2775,33 +2794,21 @@ const updateTemplate = (endpoint, templateId, params) => endpoint.api //
|
|
|
2775
2794
|
* Delete a template.
|
|
2776
2795
|
*
|
|
2777
2796
|
* ```typescript
|
|
2778
|
-
* import {
|
|
2797
|
+
* import {deleteTemplate} from '@verdocs/js-sdk/Templates';
|
|
2779
2798
|
*
|
|
2780
|
-
* await
|
|
2799
|
+
* await deleteTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
2781
2800
|
* ```
|
|
2782
2801
|
*/
|
|
2783
2802
|
const deleteTemplate = (endpoint, templateId) => endpoint.api //
|
|
2784
2803
|
.delete(`/templates/${templateId}`)
|
|
2785
2804
|
.then((r) => r.data);
|
|
2786
2805
|
/**
|
|
2787
|
-
*
|
|
2788
|
-
*
|
|
2789
|
-
* ```typescript
|
|
2790
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2791
|
-
*
|
|
2792
|
-
* const {result, page, total} = await Templates.search((VerdocsEndpoint.getDefault(), { ... });
|
|
2793
|
-
* ```
|
|
2794
|
-
*/
|
|
2795
|
-
const searchTemplates = async (endpoint, params) => endpoint.api //
|
|
2796
|
-
.post('/templates/search', params)
|
|
2797
|
-
.then((r) => r.data);
|
|
2798
|
-
/**
|
|
2799
|
-
* List templates.
|
|
2806
|
+
* List
|
|
2800
2807
|
*
|
|
2801
2808
|
* ```typescript
|
|
2802
2809
|
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2803
2810
|
*
|
|
2804
|
-
* const {totals, templates} = await
|
|
2811
|
+
* const {totals, templates} = await listTemplates((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' }); * ```
|
|
2805
2812
|
*/
|
|
2806
2813
|
const listTemplates = async (endpoint, params = {}) => endpoint.api //
|
|
2807
2814
|
.post('/templates/list', params)
|
|
@@ -3063,7 +3070,6 @@ exports.resendOrganizationInvitation = resendOrganizationInvitation;
|
|
|
3063
3070
|
exports.resendVerification = resendVerification;
|
|
3064
3071
|
exports.resetPassword = resetPassword;
|
|
3065
3072
|
exports.rotateApiKey = rotateApiKey;
|
|
3066
|
-
exports.searchTemplates = searchTemplates;
|
|
3067
3073
|
exports.sendDelegate = sendDelegate;
|
|
3068
3074
|
exports.setWebhooks = setWebhooks;
|
|
3069
3075
|
exports.submitKbaChallengeResponse = submitKbaChallengeResponse;
|