boldsign 1.0.4 → 2.0.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/api/apis.ts +1 -1
- package/api/brandingApi.ts +12 -2
- package/boldsign-2.0.0.tgz +0 -0
- package/dist/api/apis.d.ts +1 -1
- package/dist/api/apis.js +1 -1
- package/dist/api/brandingApi.d.ts +2 -2
- package/dist/api/brandingApi.js +10 -4
- package/dist/api/brandingApi.js.map +1 -1
- package/dist/model/documentFormFields.d.ts +1 -0
- package/dist/model/documentFormFields.js +5 -0
- package/dist/model/documentFormFields.js.map +1 -1
- package/dist/model/viewBrandDetails.d.ts +1 -0
- package/dist/model/viewBrandDetails.js +5 -0
- package/dist/model/viewBrandDetails.js.map +1 -1
- package/dist/tests/performance/performanceApiTest.spec.d.ts +1 -0
- package/dist/tests/performance/performanceApiTest.spec.js +368 -0
- package/dist/tests/performance/performanceApiTest.spec.js.map +1 -0
- package/docs/BrandingApi.md +4 -2
- package/docs/DocumentFormFields.md +1 -0
- package/docs/ViewBrandDetails.md +1 -0
- package/model/documentFormFields.ts +6 -0
- package/model/viewBrandDetails.ts +6 -0
- package/package.json +1 -1
- package/tests/performance/performanceApiTest.spec.ts +362 -0
- package/boldsign-1.0.4.tgz +0 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import {BrandingApi,ContactsApi,CustomFieldApi,DocumentApi,TemplateApi,SenderIdentitiesApi,TeamsApi,UserApi} from '../../api';
|
|
2
|
+
import {ContactDetails,BrandCustomFieldDetails,CustomFormField,DocumentSigner,FormField,Rectangle,SendForSign,AuthenticationSettings,CreateTemplateRequest,TemplateRole,Role,SendForSignFromTemplateForm,ReminderSettings,CreateSenderIdentityRequest,CreateTeamRequest,CreateUser} from '../../model';
|
|
3
|
+
import config from '../config';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import { performance } from 'perf_hooks';
|
|
6
|
+
|
|
7
|
+
describe('Full Integration & Performance Test Suite', () => {
|
|
8
|
+
let senderIdentitiesApi:SenderIdentitiesApi;
|
|
9
|
+
let brandingApi: BrandingApi;
|
|
10
|
+
let contactsApi: ContactsApi;
|
|
11
|
+
let customFieldApi: CustomFieldApi;
|
|
12
|
+
let documentApi: DocumentApi;
|
|
13
|
+
let templateApi: TemplateApi;
|
|
14
|
+
let teamsApi: TeamsApi;
|
|
15
|
+
let userApi:UserApi;
|
|
16
|
+
|
|
17
|
+
let brandId;
|
|
18
|
+
let createdUserId;
|
|
19
|
+
let teamName;
|
|
20
|
+
let createdCustomFieldId;
|
|
21
|
+
let createdSenderIdentityId;
|
|
22
|
+
let createdDocumentId;
|
|
23
|
+
let createdTemplateId;
|
|
24
|
+
let emailId;
|
|
25
|
+
let customFieldName;
|
|
26
|
+
|
|
27
|
+
const generateRandomEmail = () => `sdktesting${Math.floor(1000 + Math.random() * 9000)}@syncfusion.com`;
|
|
28
|
+
const generateRandomNumber = () => Math.floor(1000 + Math.random() * 9000).toString();
|
|
29
|
+
|
|
30
|
+
beforeAll(() => {
|
|
31
|
+
const apiKey = config.apiKey;
|
|
32
|
+
const baseUrl = config.baseUrl;
|
|
33
|
+
|
|
34
|
+
if (!apiKey || !baseUrl) {
|
|
35
|
+
throw new Error("Environment variables 'API_KEY' or 'HOST_URL' are not set.");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
brandingApi = new BrandingApi(baseUrl);
|
|
39
|
+
brandingApi.setApiKey(apiKey);
|
|
40
|
+
|
|
41
|
+
contactsApi = new ContactsApi(baseUrl);
|
|
42
|
+
contactsApi.setApiKey(apiKey);
|
|
43
|
+
|
|
44
|
+
customFieldApi = new CustomFieldApi(baseUrl);
|
|
45
|
+
customFieldApi.setApiKey(apiKey);
|
|
46
|
+
|
|
47
|
+
documentApi = new DocumentApi(baseUrl);
|
|
48
|
+
documentApi.setApiKey(apiKey);
|
|
49
|
+
|
|
50
|
+
templateApi = new TemplateApi(baseUrl);
|
|
51
|
+
templateApi.setApiKey(apiKey);
|
|
52
|
+
|
|
53
|
+
senderIdentitiesApi =new SenderIdentitiesApi(baseUrl);
|
|
54
|
+
senderIdentitiesApi.setApiKey(apiKey);
|
|
55
|
+
|
|
56
|
+
teamsApi = new TeamsApi(baseUrl);
|
|
57
|
+
teamsApi.setApiKey(apiKey);
|
|
58
|
+
|
|
59
|
+
userApi = new UserApi(baseUrl);
|
|
60
|
+
userApi.setApiKey(apiKey);
|
|
61
|
+
|
|
62
|
+
emailId = generateRandomEmail();
|
|
63
|
+
customFieldName = `Test Custom Field ${generateRandomNumber()}`;
|
|
64
|
+
teamName = `sdktestingteam${generateRandomNumber()}`;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('Performance Test 1: Create a brand', async () => {
|
|
68
|
+
const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
|
|
69
|
+
|
|
70
|
+
const start = performance.now();
|
|
71
|
+
try {
|
|
72
|
+
const response = await brandingApi.createBrand(
|
|
73
|
+
"NodeSDK_Perf",
|
|
74
|
+
brandLogo,
|
|
75
|
+
"Blue",
|
|
76
|
+
"Black",
|
|
77
|
+
"White",
|
|
78
|
+
"{SenderName} from Syncfusion"
|
|
79
|
+
);
|
|
80
|
+
const end = performance.now();
|
|
81
|
+
const duration = end - start;
|
|
82
|
+
|
|
83
|
+
console.log(`Brand creation took ${duration.toFixed(10)} ms`);
|
|
84
|
+
brandId = response.brandId;
|
|
85
|
+
|
|
86
|
+
expect(brandId).toBeDefined();
|
|
87
|
+
expect(duration).toBeLessThan(10000);
|
|
88
|
+
} catch (error: any) {
|
|
89
|
+
console.error("Error during brand creation:", error.message);
|
|
90
|
+
expect(error).toBeUndefined();
|
|
91
|
+
}
|
|
92
|
+
}, 20000);
|
|
93
|
+
|
|
94
|
+
test('Performance Test 2: Create a contact', async () => {
|
|
95
|
+
const contactDetails = new ContactDetails();
|
|
96
|
+
contactDetails.name = "sdktesting";
|
|
97
|
+
contactDetails.email = emailId;
|
|
98
|
+
|
|
99
|
+
const start = performance.now();
|
|
100
|
+
try {
|
|
101
|
+
const response = await contactsApi.createContact([contactDetails]);
|
|
102
|
+
const end = performance.now();
|
|
103
|
+
const duration = end - start;
|
|
104
|
+
|
|
105
|
+
console.log(`Contact creationcontac took ${duration.toFixed(10)} ms`);
|
|
106
|
+
|
|
107
|
+
expect(response).toBeDefined();
|
|
108
|
+
expect(duration).toBeLessThan(10000);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error("Error during contact creation:", error);
|
|
111
|
+
expect(error).toBeUndefined();
|
|
112
|
+
}
|
|
113
|
+
}, 20000);
|
|
114
|
+
|
|
115
|
+
test('Performance Test 3: Create a custom field', async () => {
|
|
116
|
+
const formField = new CustomFormField();
|
|
117
|
+
formField.fieldType = CustomFormField.FieldTypeEnum.Signature;
|
|
118
|
+
formField.placeHolder = "string";
|
|
119
|
+
formField.isRequired = true;
|
|
120
|
+
|
|
121
|
+
const customFieldDetails = new BrandCustomFieldDetails();
|
|
122
|
+
customFieldDetails.fieldName = customFieldName;
|
|
123
|
+
customFieldDetails.fieldDescription = "string";
|
|
124
|
+
customFieldDetails.fieldOrder = 2;
|
|
125
|
+
customFieldDetails.brandId = brandId;
|
|
126
|
+
customFieldDetails.sharedField = true;
|
|
127
|
+
customFieldDetails.formField = formField;
|
|
128
|
+
|
|
129
|
+
const start = performance.now();
|
|
130
|
+
try {
|
|
131
|
+
const response = await customFieldApi.createCustomField(customFieldDetails);
|
|
132
|
+
const end = performance.now();
|
|
133
|
+
const duration = end - start;
|
|
134
|
+
|
|
135
|
+
console.log(`Custom field creation took ${duration.toFixed(10)} ms`);
|
|
136
|
+
createdCustomFieldId = response.customFieldId;
|
|
137
|
+
|
|
138
|
+
expect(createdCustomFieldId).toBeDefined();
|
|
139
|
+
expect(duration).toBeLessThan(10000);
|
|
140
|
+
} catch (error: any) {
|
|
141
|
+
console.error("Error during custom field creation:", error.message);
|
|
142
|
+
expect(error).toBeUndefined();
|
|
143
|
+
}
|
|
144
|
+
}, 20000);
|
|
145
|
+
|
|
146
|
+
test('Performance Test 4: Send document for signing', async () => {
|
|
147
|
+
const signer = new DocumentSigner();
|
|
148
|
+
signer.name = 'Test Signer';
|
|
149
|
+
signer.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
150
|
+
signer.signerOrder = 1;
|
|
151
|
+
signer.signerType = DocumentSigner.SignerTypeEnum.Signer;
|
|
152
|
+
signer.authenticationType = DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
153
|
+
signer.authenticationCode = '123456';
|
|
154
|
+
signer.authenticationSettings = {
|
|
155
|
+
authenticationFrequency: AuthenticationSettings.AuthenticationFrequencyEnum.EveryAccess
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const formField = new FormField();
|
|
159
|
+
formField.name = 'Sign';
|
|
160
|
+
formField.fieldType = FormField.FieldTypeEnum.Signature;
|
|
161
|
+
formField.font = FormField.FontEnum.Helvetica;
|
|
162
|
+
formField.pageNumber = 1;
|
|
163
|
+
formField.isRequired = true;
|
|
164
|
+
formField.bounds = new Rectangle();
|
|
165
|
+
|
|
166
|
+
signer.formFields = [formField];
|
|
167
|
+
signer.privateMessage = 'This is a private message for signer';
|
|
168
|
+
|
|
169
|
+
const sendRequest = new SendForSign();
|
|
170
|
+
sendRequest.title = 'Document SDK API';
|
|
171
|
+
sendRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
172
|
+
sendRequest.enablePrintAndSign = true;
|
|
173
|
+
sendRequest.signers = [signer];
|
|
174
|
+
sendRequest.message = 'Please sign this document';
|
|
175
|
+
|
|
176
|
+
const start = performance.now();
|
|
177
|
+
try {
|
|
178
|
+
const response = await documentApi.sendDocument(sendRequest);
|
|
179
|
+
const end = performance.now();
|
|
180
|
+
const duration = end - start;
|
|
181
|
+
|
|
182
|
+
console.log(`Document sending took ${duration.toFixed(10)} ms`);
|
|
183
|
+
createdDocumentId = response.documentId;
|
|
184
|
+
|
|
185
|
+
expect(createdDocumentId).toBeDefined();
|
|
186
|
+
expect(duration).toBeLessThan(10000);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error("Error during document sending:", error);
|
|
189
|
+
expect(error).toBeUndefined();
|
|
190
|
+
}
|
|
191
|
+
}, 20000);
|
|
192
|
+
|
|
193
|
+
test('Performance Test 5: Create a template', async () => {
|
|
194
|
+
const signatureField = new FormField();
|
|
195
|
+
signatureField.fieldType = FormField.FieldTypeEnum.Signature;
|
|
196
|
+
signatureField.pageNumber = 1;
|
|
197
|
+
const bounds = new Rectangle();
|
|
198
|
+
bounds.x = 50;
|
|
199
|
+
bounds.y = 100;
|
|
200
|
+
bounds.width = 150;
|
|
201
|
+
bounds.height = 50;
|
|
202
|
+
signatureField.bounds = bounds;
|
|
203
|
+
|
|
204
|
+
const role = new TemplateRole();
|
|
205
|
+
role.index = 1;
|
|
206
|
+
role.name = "Signer";
|
|
207
|
+
role.defaultSignerName = "John Doe";
|
|
208
|
+
role.defaultSignerEmail = "johndoe@example.com";
|
|
209
|
+
role.signerOrder = 1;
|
|
210
|
+
role.signerType = TemplateRole.SignerTypeEnum.Signer;
|
|
211
|
+
role.formFields = [signatureField];
|
|
212
|
+
|
|
213
|
+
const createTemplateRequest = new CreateTemplateRequest();
|
|
214
|
+
createTemplateRequest.title = "Testing node sdk";
|
|
215
|
+
createTemplateRequest.description = "Testing integration test case";
|
|
216
|
+
createTemplateRequest.documentTitle = "Node sdk test case";
|
|
217
|
+
createTemplateRequest.documentMessage = "Please check and sign";
|
|
218
|
+
createTemplateRequest.roles = [role];
|
|
219
|
+
createTemplateRequest.enableReassign = true;
|
|
220
|
+
createTemplateRequest.enableSigningOrder = true;
|
|
221
|
+
createTemplateRequest.allowNewRoles = true;
|
|
222
|
+
createTemplateRequest.allowMessageEditing = true;
|
|
223
|
+
createTemplateRequest.allowNewFiles = true;
|
|
224
|
+
createTemplateRequest.files = [fs.createReadStream("tests/documents/agreement.pdf")];
|
|
225
|
+
|
|
226
|
+
const start = performance.now();
|
|
227
|
+
try {
|
|
228
|
+
const response = await templateApi.createTemplate(createTemplateRequest);
|
|
229
|
+
const end = performance.now();
|
|
230
|
+
const duration = end - start;
|
|
231
|
+
|
|
232
|
+
console.log(`Template creation took ${duration.toFixed(10)} ms`);
|
|
233
|
+
createdTemplateId = response.templateId;
|
|
234
|
+
|
|
235
|
+
expect(createdTemplateId).toBeDefined();
|
|
236
|
+
expect(duration).toBeLessThan(10000);
|
|
237
|
+
} catch (error: any) {
|
|
238
|
+
console.error("Error during template creation:", error.message);
|
|
239
|
+
expect(error).toBeUndefined();
|
|
240
|
+
}
|
|
241
|
+
}, 20000);
|
|
242
|
+
|
|
243
|
+
test('Performanc Test 6: should send document for signing using template', async () => {
|
|
244
|
+
const start = performance.now();
|
|
245
|
+
const formField = new FormField();
|
|
246
|
+
formField.fieldType = FormField.FieldTypeEnum.Signature;
|
|
247
|
+
formField.pageNumber = 1;
|
|
248
|
+
const bounds = new Rectangle();
|
|
249
|
+
bounds.x = 100;
|
|
250
|
+
bounds.y = 50;
|
|
251
|
+
bounds.width = 100;
|
|
252
|
+
bounds.height = 100;
|
|
253
|
+
formField.bounds = bounds;
|
|
254
|
+
const role = new Role();
|
|
255
|
+
role.roleIndex = 50;
|
|
256
|
+
role.signerName = "Divya";
|
|
257
|
+
role.signerEmail = "divya.boopathy+20@syncfusion.com";
|
|
258
|
+
role.signerOrder = 1;
|
|
259
|
+
role.enableEmailOTP = false;
|
|
260
|
+
role.signerType = Role.SignerTypeEnum.Signer;
|
|
261
|
+
role.authenticationType = Role.AuthenticationTypeEnum.AccessCode;
|
|
262
|
+
role.authenticationCode = '123456';
|
|
263
|
+
role.authenticationSettings = {
|
|
264
|
+
authenticationFrequency: AuthenticationSettings.AuthenticationFrequencyEnum.EveryAccess
|
|
265
|
+
};
|
|
266
|
+
role.signerRole = "Manager";
|
|
267
|
+
role.privateMessage = "Please check and sign the document";
|
|
268
|
+
role.formFields = [formField];
|
|
269
|
+
const sendForSignFromTemplate = new SendForSignFromTemplateForm();
|
|
270
|
+
const files = fs.createReadStream("tests/documents/agreement.pdf");
|
|
271
|
+
sendForSignFromTemplate.files = [files];
|
|
272
|
+
sendForSignFromTemplate.title = "Invitation form";
|
|
273
|
+
sendForSignFromTemplate.message = "Kindly review and sign this.";
|
|
274
|
+
sendForSignFromTemplate.roles = [role];
|
|
275
|
+
sendForSignFromTemplate.disableEmails = false;
|
|
276
|
+
sendForSignFromTemplate.disableSMS = false;
|
|
277
|
+
sendForSignFromTemplate.hideDocumentId = true;
|
|
278
|
+
sendForSignFromTemplate.labels = ["Invitation", "Form", "Test"];
|
|
279
|
+
const reminderSettings = new ReminderSettings();
|
|
280
|
+
reminderSettings.reminderDays = 3;
|
|
281
|
+
reminderSettings.reminderCount = 5;
|
|
282
|
+
reminderSettings.enableAutoReminder = false;
|
|
283
|
+
sendForSignFromTemplate.reminderSettings = reminderSettings;
|
|
284
|
+
sendForSignFromTemplate.expiryValue = 60;
|
|
285
|
+
sendForSignFromTemplate.disableExpiryAlert = true;
|
|
286
|
+
sendForSignFromTemplate.enablePrintAndSign = true;
|
|
287
|
+
sendForSignFromTemplate.enableReassign = true;
|
|
288
|
+
sendForSignFromTemplate.enableSigningOrder = true;
|
|
289
|
+
try {
|
|
290
|
+
const response = await templateApi.sendUsingTemplate(createdTemplateId, sendForSignFromTemplate);
|
|
291
|
+
const end = performance.now();
|
|
292
|
+
const duration = end - start;
|
|
293
|
+
console.log(`Send document from template took ${duration.toFixed(10)} ms`);
|
|
294
|
+
expect(duration).toBeLessThan(10000);
|
|
295
|
+
console.log("Document sent for signing using template successfully:", response);
|
|
296
|
+
expect(response).toBeDefined();
|
|
297
|
+
} catch (error:any) {
|
|
298
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
299
|
+
expect(error.message).toBeUndefined();
|
|
300
|
+
}
|
|
301
|
+
}, 20000);
|
|
302
|
+
|
|
303
|
+
test('Performance Test 7: should create sender identity successfully', async () => {
|
|
304
|
+
const start = performance.now();
|
|
305
|
+
const createSenderIdentityRequest = new CreateSenderIdentityRequest();
|
|
306
|
+
createSenderIdentityRequest.name = "SenderIdentity API";
|
|
307
|
+
createSenderIdentityRequest.email = emailId;
|
|
308
|
+
createSenderIdentityRequest.redirectUrl = "https://boldsign.com";
|
|
309
|
+
try {
|
|
310
|
+
const response = await senderIdentitiesApi.createSenderIdentities(createSenderIdentityRequest);
|
|
311
|
+
console.log("Sender Identity created successfully:", response);
|
|
312
|
+
createdSenderIdentityId = response;
|
|
313
|
+
console.log("Created Sender Identity ID:", createdSenderIdentityId);
|
|
314
|
+
const end = performance.now();
|
|
315
|
+
const duration = end - start;
|
|
316
|
+
console.log(`Sender Identity creation took ${duration.toFixed(10)} ms`);
|
|
317
|
+
expect(duration).toBeLessThan(10000);
|
|
318
|
+
expect(response).toBeDefined();
|
|
319
|
+
} catch (error:any) {
|
|
320
|
+
console.log("Error occurred while calling the API:", error.message);
|
|
321
|
+
expect(error.message).toBeUndefined();
|
|
322
|
+
}
|
|
323
|
+
},20000);
|
|
324
|
+
|
|
325
|
+
test('Performance test 8: should create team successfully', async () => {
|
|
326
|
+
const start = performance.now();
|
|
327
|
+
const createTeamRequest = new CreateTeamRequest();
|
|
328
|
+
createTeamRequest.teamName = teamName;
|
|
329
|
+
try {
|
|
330
|
+
const createTeamResponse = await teamsApi.createTeam(createTeamRequest);
|
|
331
|
+
console.log('Team created successfully:', createTeamResponse);
|
|
332
|
+
const end = performance.now();
|
|
333
|
+
const duration = end - start;
|
|
334
|
+
console.log(`Teams creation took ${duration.toFixed(10)} ms`);
|
|
335
|
+
expect(duration).toBeLessThan(10000);
|
|
336
|
+
expect(createTeamResponse).toBeDefined();
|
|
337
|
+
} catch (error:any) {
|
|
338
|
+
console.error('Error occurred while creating team:', error.message);
|
|
339
|
+
expect(error.message).toBeUndefined();
|
|
340
|
+
}
|
|
341
|
+
},20000);
|
|
342
|
+
|
|
343
|
+
test('Performance test 9:should create user successfully', async () => {
|
|
344
|
+
const start = performance.now();
|
|
345
|
+
const createUserRequest = new CreateUser();
|
|
346
|
+
createUserRequest.emailId = emailId;
|
|
347
|
+
createUserRequest.userRole = CreateUser.UserRoleEnum.Member;
|
|
348
|
+
try {
|
|
349
|
+
const response = await userApi.createUser([createUserRequest]);
|
|
350
|
+
console.log("User created successfully:", response);
|
|
351
|
+
console.log("Created User ID:", createdUserId);
|
|
352
|
+
const end = performance.now();
|
|
353
|
+
const duration = end - start;
|
|
354
|
+
console.log(`User creation took ${duration.toFixed(10)} ms`);
|
|
355
|
+
expect(duration).toBeLessThan(10000);
|
|
356
|
+
expect(response).toBeDefined();
|
|
357
|
+
} catch (error:any) {
|
|
358
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
359
|
+
expect(error.message).toBeUndefined();
|
|
360
|
+
}
|
|
361
|
+
},20000);
|
|
362
|
+
});
|
package/boldsign-1.0.4.tgz
DELETED
|
Binary file
|