@verdocs/js-sdk 3.10.15 → 3.10.20
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/Templates/Actions.d.ts +1 -1
- package/Templates/Templates.d.ts +10 -0
- package/Templates/Templates.js +34 -0
- package/Templates/Types.d.ts +1 -1
- package/package.json +10 -10
package/Templates/Actions.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ITemplate, ITemplateSummary } from './Types';
|
|
2
2
|
import { TSession } from '../Sessions/Types';
|
|
3
3
|
export declare enum TemplateSenderTypes {
|
|
4
|
-
CREATOR = "creator"
|
|
4
|
+
CREATOR = "creator",// same as legacy
|
|
5
5
|
ORGANIZATION_MEMBER = "organization_member",
|
|
6
6
|
ORGANIZATION_MEMBER_AS_CREATOR = "organization_member_as_creator",
|
|
7
7
|
EVERYONE = "everyone",
|
package/Templates/Templates.d.ts
CHANGED
|
@@ -117,6 +117,16 @@ export interface ITemplateCreateParams {
|
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
119
|
export declare const createTemplate: (endpoint: VerdocsEndpoint, params: ITemplateCreateParams, onUploadProgress?: ((percent: number, loadedBytes: number, totalBytes: number) => void) | undefined) => Promise<ITemplate>;
|
|
120
|
+
/**
|
|
121
|
+
* Create a template.
|
|
122
|
+
*
|
|
123
|
+
* ```typescript
|
|
124
|
+
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
125
|
+
*
|
|
126
|
+
* const newTemplate = await Templates.createTemplatev2((VerdocsEndpoint.getDefault(), {...});
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const createTemplatev2: (endpoint: VerdocsEndpoint, params: ITemplateCreateParams, onUploadProgress?: ((percent: number, loadedBytes: number, totalBytes: number) => void) | undefined) => Promise<ITemplate>;
|
|
120
130
|
export interface ITemplateCreateFromSharepointParams {
|
|
121
131
|
/** Name for the template to create. */
|
|
122
132
|
name: string;
|
package/Templates/Templates.js
CHANGED
|
@@ -153,6 +153,40 @@ export var createTemplate = function (endpoint, params, onUploadProgress) {
|
|
|
153
153
|
return endpoint.api.post('/templates', params, options).then(function (r) { return r.data; });
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* Create a template.
|
|
158
|
+
*
|
|
159
|
+
* ```typescript
|
|
160
|
+
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
161
|
+
*
|
|
162
|
+
* const newTemplate = await Templates.createTemplatev2((VerdocsEndpoint.getDefault(), {...});
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export var createTemplatev2 = function (endpoint, params, onUploadProgress) {
|
|
166
|
+
var options = {
|
|
167
|
+
timeout: 120000,
|
|
168
|
+
onUploadProgress: function (event) {
|
|
169
|
+
var total = event.total || 1;
|
|
170
|
+
var loaded = event.loaded || 0;
|
|
171
|
+
onUploadProgress === null || onUploadProgress === void 0 ? void 0 : onUploadProgress(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
if (params.documents && params.documents[0] instanceof File) {
|
|
175
|
+
var formData_2 = new FormData();
|
|
176
|
+
ALLOWED_CREATE_FIELDS.forEach(function (allowedKey) {
|
|
177
|
+
if (params[allowedKey] !== undefined) {
|
|
178
|
+
formData_2.append(allowedKey, params[allowedKey]);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
params.documents.forEach(function (file) {
|
|
182
|
+
formData_2.append('documents', file, file.name);
|
|
183
|
+
});
|
|
184
|
+
return endpoint.api.post('/v2/templates', formData_2, options).then(function (r) { return r.data; });
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return endpoint.api.post('/v2/templates', params, options).then(function (r) { return r.data; });
|
|
188
|
+
}
|
|
189
|
+
};
|
|
156
190
|
/**
|
|
157
191
|
* Create a template from a Sharepoint asset.
|
|
158
192
|
*
|
package/Templates/Types.d.ts
CHANGED
|
@@ -130,7 +130,7 @@ export interface ITemplateSummary {
|
|
|
130
130
|
allowed_operations: TemplateActions[];
|
|
131
131
|
}
|
|
132
132
|
export declare enum TemplateSenderTypes {
|
|
133
|
-
CREATOR = "creator"
|
|
133
|
+
CREATOR = "creator",// same as legacy
|
|
134
134
|
ORGANIZATION_MEMBER = "organization_member",
|
|
135
135
|
ORGANIZATION_MEMBER_AS_CREATOR = "organization_member_as_creator",
|
|
136
136
|
EVERYONE = "everyone",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdocs/js-sdk",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": "https://github.com/Verdocs/js-sdk",
|
|
6
6
|
"description": "Verdocs JS SDK",
|
|
@@ -46,23 +46,23 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"axios": "^1.
|
|
50
|
-
"axios-retry": "^
|
|
49
|
+
"axios": "^1.6.2",
|
|
50
|
+
"axios-retry": "^4.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"typescript": "^5.
|
|
53
|
+
"typescript": "^5.3.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@jest/globals": "^29.5.0",
|
|
57
|
-
"@types/jest": "^29.5.
|
|
58
|
-
"axios-mock-adapter": "^1.
|
|
57
|
+
"@types/jest": "^29.5.10",
|
|
58
|
+
"axios-mock-adapter": "^1.22.0",
|
|
59
59
|
"jest": "^29.5.0",
|
|
60
|
-
"prettier": "^3.0
|
|
60
|
+
"prettier": "^3.1.0",
|
|
61
61
|
"ts-jest": "^29.1.1",
|
|
62
62
|
"tslint": "^6.1.3",
|
|
63
63
|
"tslint-config-prettier": "^1.18.0",
|
|
64
|
-
"typedoc": "^0.25.
|
|
65
|
-
"typedoc-plugin-markdown": "^3.
|
|
66
|
-
"typescript": "^5.
|
|
64
|
+
"typedoc": "^0.25.4",
|
|
65
|
+
"typedoc-plugin-markdown": "^3.17.1",
|
|
66
|
+
"typescript": "^5.3.2"
|
|
67
67
|
}
|
|
68
68
|
}
|