@b-jones-rfd/qualtrics-api-tasks 0.3.5 → 0.3.7
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 +12 -0
- package/README.md +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -29
- package/dist/index.mjs +13 -26
- package/package.json +12 -5
- package/pnpm-workspace.yaml +1 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -341,9 +341,9 @@ Implements [List Distributions](https://api.qualtrics.com/234bb6b16cf6d-list-dis
|
|
|
341
341
|
|
|
342
342
|
| Property | Type | Description | Required | Default |
|
|
343
343
|
| ----------------------- | ------- | ------------------------------- | -------- | ------- |
|
|
344
|
+
| surveyId | string | Quatrics Survey ID | Y | |
|
|
344
345
|
| sendStartDate | Date | Export start date and time | Y | |
|
|
345
346
|
| sendEndDate | Date | Export end date and time | Y | |
|
|
346
|
-
| surveyId | string | Quatrics Survey ID | N | |
|
|
347
347
|
| mailingListId | string | Mailing List ID | N | |
|
|
348
348
|
| distributionRequestType | string | Distribution Request Type | N | |
|
|
349
349
|
| skipToken | string | Pagination offset | N | |
|
package/dist/index.d.mts
CHANGED
|
@@ -120,7 +120,7 @@ type Connection = {
|
|
|
120
120
|
listDistributions: Action<{
|
|
121
121
|
sendStartDate: Date;
|
|
122
122
|
sendEndDate: Date;
|
|
123
|
-
surveyId
|
|
123
|
+
surveyId: string;
|
|
124
124
|
distributionRequestType?: DistributionRequestType;
|
|
125
125
|
mailingListId?: string;
|
|
126
126
|
skipToken?: string;
|
|
@@ -431,9 +431,9 @@ declare const importContacts: ActionFactory<StartContactsImportOptions, Contacts
|
|
|
431
431
|
* @see https://api.qualtrics.com/234bb6b16cf6d-list-distributions
|
|
432
432
|
*/
|
|
433
433
|
declare const listDistributions: ActionFactory<{
|
|
434
|
+
surveyId: string;
|
|
434
435
|
sendStartDate: Date;
|
|
435
436
|
sendEndDate: Date;
|
|
436
|
-
surveyId?: string;
|
|
437
437
|
distributionRequestType?: DistributionRequestType;
|
|
438
438
|
mailingListId?: string;
|
|
439
439
|
skipToken?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ type Connection = {
|
|
|
120
120
|
listDistributions: Action<{
|
|
121
121
|
sendStartDate: Date;
|
|
122
122
|
sendEndDate: Date;
|
|
123
|
-
surveyId
|
|
123
|
+
surveyId: string;
|
|
124
124
|
distributionRequestType?: DistributionRequestType;
|
|
125
125
|
mailingListId?: string;
|
|
126
126
|
skipToken?: string;
|
|
@@ -431,9 +431,9 @@ declare const importContacts: ActionFactory<StartContactsImportOptions, Contacts
|
|
|
431
431
|
* @see https://api.qualtrics.com/234bb6b16cf6d-list-distributions
|
|
432
432
|
*/
|
|
433
433
|
declare const listDistributions: ActionFactory<{
|
|
434
|
+
surveyId: string;
|
|
434
435
|
sendStartDate: Date;
|
|
435
436
|
sendEndDate: Date;
|
|
436
|
-
surveyId?: string;
|
|
437
437
|
distributionRequestType?: DistributionRequestType;
|
|
438
438
|
mailingListId?: string;
|
|
439
439
|
skipToken?: string;
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
createConnection: () => createConnection,
|
|
24
24
|
createDistribution: () => createDistribution,
|
|
25
25
|
createMailingList: () => createMailingList,
|
|
@@ -39,7 +39,7 @@ __export(src_exports, {
|
|
|
39
39
|
startResponseExport: () => startResponseExport,
|
|
40
40
|
testConnection: () => testConnection
|
|
41
41
|
});
|
|
42
|
-
module.exports = __toCommonJS(
|
|
42
|
+
module.exports = __toCommonJS(index_exports);
|
|
43
43
|
|
|
44
44
|
// src/utils/index.ts
|
|
45
45
|
function success(data) {
|
|
@@ -394,8 +394,7 @@ var importContacts = (connectionOptions) => async (importOptions) => {
|
|
|
394
394
|
try {
|
|
395
395
|
const startImportAction = startContactsImport(connectionOptions);
|
|
396
396
|
const startResponse = await startImportAction(importOptions);
|
|
397
|
-
if (!startResponse.success)
|
|
398
|
-
return failure(startResponse.error);
|
|
397
|
+
if (!startResponse.success) return failure(startResponse.error);
|
|
399
398
|
const importProgressAction = getContactsImportStatus(connectionOptions);
|
|
400
399
|
const progressResponse = await poll({
|
|
401
400
|
fn: async () => await importProgressAction({
|
|
@@ -408,8 +407,7 @@ var importContacts = (connectionOptions) => async (importOptions) => {
|
|
|
408
407
|
interval: 1,
|
|
409
408
|
maxAttempts: 60
|
|
410
409
|
});
|
|
411
|
-
if (!progressResponse.success)
|
|
412
|
-
return failure(progressResponse.error);
|
|
410
|
+
if (!progressResponse.success) return failure(progressResponse.error);
|
|
413
411
|
const getContactImportSummaryAction = getContactsImportSummary(connectionOptions);
|
|
414
412
|
const fileResponse = await getContactImportSummaryAction({
|
|
415
413
|
directoryId: importOptions.directoryId,
|
|
@@ -435,8 +433,7 @@ var distributeSurveys = (connectionOptions) => async (options) => {
|
|
|
435
433
|
prioritizeListMetadata: options.prioritizeListMetadata,
|
|
436
434
|
bearerToken: options.bearerToken
|
|
437
435
|
});
|
|
438
|
-
if (!startResponse.success)
|
|
439
|
-
return failure(startResponse.error);
|
|
436
|
+
if (!startResponse.success) return failure(startResponse.error);
|
|
440
437
|
const importContactsAction = importContacts(connectionOptions);
|
|
441
438
|
const importResponse = await importContactsAction({
|
|
442
439
|
directoryId: options.directoryId,
|
|
@@ -445,8 +442,7 @@ var distributeSurveys = (connectionOptions) => async (options) => {
|
|
|
445
442
|
transactionMeta: options.transactionMeta,
|
|
446
443
|
bearerToken: options.bearerToken
|
|
447
444
|
});
|
|
448
|
-
if (!importResponse.success)
|
|
449
|
-
return failure(importResponse.error);
|
|
445
|
+
if (!importResponse.success) return failure(importResponse.error);
|
|
450
446
|
const createDistributionAction = createDistribution(connectionOptions);
|
|
451
447
|
const distributionResponse = await createDistributionAction({
|
|
452
448
|
libraryId: options.libraryId,
|
|
@@ -479,8 +475,7 @@ var distributeSurveys = (connectionOptions) => async (options) => {
|
|
|
479
475
|
sendDate: options.reminderSendDate,
|
|
480
476
|
bearerToken: options.bearerToken
|
|
481
477
|
});
|
|
482
|
-
if (!reminderResponse.success)
|
|
483
|
-
return failure(reminderResponse.error);
|
|
478
|
+
if (!reminderResponse.success) return failure(reminderResponse.error);
|
|
484
479
|
return success(reminderResponse.data);
|
|
485
480
|
} catch (error) {
|
|
486
481
|
const message = getErrorMessage(error);
|
|
@@ -566,8 +561,7 @@ var exportResponses = (connectionOptions) => async (responseOptions) => {
|
|
|
566
561
|
try {
|
|
567
562
|
const startResponseAction = startResponseExport(connectionOptions);
|
|
568
563
|
const startResponse = await startResponseAction(responseOptions);
|
|
569
|
-
if (!startResponse.success)
|
|
570
|
-
return failure(startResponse.error);
|
|
564
|
+
if (!startResponse.success) return failure(startResponse.error);
|
|
571
565
|
const exportProgressAction = getResponseExportProgress(connectionOptions);
|
|
572
566
|
const progressResponse = await poll({
|
|
573
567
|
fn: async () => await exportProgressAction({
|
|
@@ -579,8 +573,7 @@ var exportResponses = (connectionOptions) => async (responseOptions) => {
|
|
|
579
573
|
interval: 1,
|
|
580
574
|
maxAttempts: 60
|
|
581
575
|
});
|
|
582
|
-
if (!progressResponse.success)
|
|
583
|
-
return failure(progressResponse.error);
|
|
576
|
+
if (!progressResponse.success) return failure(progressResponse.error);
|
|
584
577
|
const getFileResponseAction = getResponseExportFile(connectionOptions);
|
|
585
578
|
const fileResponse = await getFileResponseAction({
|
|
586
579
|
surveyId: responseOptions.surveyId,
|
|
@@ -656,21 +649,17 @@ var listDistributions = (connectionOptions) => async ({
|
|
|
656
649
|
try {
|
|
657
650
|
const headers = getAuthHeaders(connectionOptions.apiToken, bearerToken);
|
|
658
651
|
const qs = new URLSearchParams({
|
|
652
|
+
surveyId,
|
|
659
653
|
sendStartDate: sendStartDate.toISOString(),
|
|
660
654
|
sendEndDate: sendEndDate.toISOString()
|
|
661
655
|
});
|
|
662
|
-
if (
|
|
663
|
-
qs.append("surveyId", surveyId);
|
|
664
|
-
if (mailingListId)
|
|
665
|
-
qs.append("mailingListId", mailingListId);
|
|
656
|
+
if (mailingListId) qs.append("mailingListId", mailingListId);
|
|
666
657
|
if (distributionRequestType)
|
|
667
658
|
qs.append("distributionRequestType", distributionRequestType);
|
|
668
|
-
if (skipToken)
|
|
669
|
-
qs.append("skipToken", skipToken);
|
|
659
|
+
if (skipToken) qs.append("skipToken", skipToken);
|
|
670
660
|
if (useNewPaginationScheme)
|
|
671
661
|
qs.append("useNewPaginationScheme", useNewPaginationScheme.toString());
|
|
672
|
-
if (pageSize)
|
|
673
|
-
qs.append("pageSize", pageSize.toString());
|
|
662
|
+
if (pageSize) qs.append("pageSize", pageSize.toString());
|
|
674
663
|
const route = `/API/v3/distributions?${qs.toString()}`;
|
|
675
664
|
const config = {
|
|
676
665
|
datacenterId: connectionOptions.datacenterId,
|
|
@@ -693,10 +682,8 @@ var listLibraryMessages = (connectionOptions) => async ({ libraryId, category, o
|
|
|
693
682
|
try {
|
|
694
683
|
const headers = getAuthHeaders(connectionOptions.apiToken, bearerToken);
|
|
695
684
|
const qs = new URLSearchParams();
|
|
696
|
-
if (category)
|
|
697
|
-
|
|
698
|
-
if (offset)
|
|
699
|
-
qs.append("offset", offset.toString());
|
|
685
|
+
if (category) qs.append("category", category);
|
|
686
|
+
if (offset) qs.append("offset", offset.toString());
|
|
700
687
|
const config = {
|
|
701
688
|
datacenterId: connectionOptions.datacenterId,
|
|
702
689
|
route: qs.size > 0 ? route + "?" + qs.toString() : route,
|
package/dist/index.mjs
CHANGED
|
@@ -351,8 +351,7 @@ var importContacts = (connectionOptions) => async (importOptions) => {
|
|
|
351
351
|
try {
|
|
352
352
|
const startImportAction = startContactsImport(connectionOptions);
|
|
353
353
|
const startResponse = await startImportAction(importOptions);
|
|
354
|
-
if (!startResponse.success)
|
|
355
|
-
return failure(startResponse.error);
|
|
354
|
+
if (!startResponse.success) return failure(startResponse.error);
|
|
356
355
|
const importProgressAction = getContactsImportStatus(connectionOptions);
|
|
357
356
|
const progressResponse = await poll({
|
|
358
357
|
fn: async () => await importProgressAction({
|
|
@@ -365,8 +364,7 @@ var importContacts = (connectionOptions) => async (importOptions) => {
|
|
|
365
364
|
interval: 1,
|
|
366
365
|
maxAttempts: 60
|
|
367
366
|
});
|
|
368
|
-
if (!progressResponse.success)
|
|
369
|
-
return failure(progressResponse.error);
|
|
367
|
+
if (!progressResponse.success) return failure(progressResponse.error);
|
|
370
368
|
const getContactImportSummaryAction = getContactsImportSummary(connectionOptions);
|
|
371
369
|
const fileResponse = await getContactImportSummaryAction({
|
|
372
370
|
directoryId: importOptions.directoryId,
|
|
@@ -392,8 +390,7 @@ var distributeSurveys = (connectionOptions) => async (options) => {
|
|
|
392
390
|
prioritizeListMetadata: options.prioritizeListMetadata,
|
|
393
391
|
bearerToken: options.bearerToken
|
|
394
392
|
});
|
|
395
|
-
if (!startResponse.success)
|
|
396
|
-
return failure(startResponse.error);
|
|
393
|
+
if (!startResponse.success) return failure(startResponse.error);
|
|
397
394
|
const importContactsAction = importContacts(connectionOptions);
|
|
398
395
|
const importResponse = await importContactsAction({
|
|
399
396
|
directoryId: options.directoryId,
|
|
@@ -402,8 +399,7 @@ var distributeSurveys = (connectionOptions) => async (options) => {
|
|
|
402
399
|
transactionMeta: options.transactionMeta,
|
|
403
400
|
bearerToken: options.bearerToken
|
|
404
401
|
});
|
|
405
|
-
if (!importResponse.success)
|
|
406
|
-
return failure(importResponse.error);
|
|
402
|
+
if (!importResponse.success) return failure(importResponse.error);
|
|
407
403
|
const createDistributionAction = createDistribution(connectionOptions);
|
|
408
404
|
const distributionResponse = await createDistributionAction({
|
|
409
405
|
libraryId: options.libraryId,
|
|
@@ -436,8 +432,7 @@ var distributeSurveys = (connectionOptions) => async (options) => {
|
|
|
436
432
|
sendDate: options.reminderSendDate,
|
|
437
433
|
bearerToken: options.bearerToken
|
|
438
434
|
});
|
|
439
|
-
if (!reminderResponse.success)
|
|
440
|
-
return failure(reminderResponse.error);
|
|
435
|
+
if (!reminderResponse.success) return failure(reminderResponse.error);
|
|
441
436
|
return success(reminderResponse.data);
|
|
442
437
|
} catch (error) {
|
|
443
438
|
const message = getErrorMessage(error);
|
|
@@ -523,8 +518,7 @@ var exportResponses = (connectionOptions) => async (responseOptions) => {
|
|
|
523
518
|
try {
|
|
524
519
|
const startResponseAction = startResponseExport(connectionOptions);
|
|
525
520
|
const startResponse = await startResponseAction(responseOptions);
|
|
526
|
-
if (!startResponse.success)
|
|
527
|
-
return failure(startResponse.error);
|
|
521
|
+
if (!startResponse.success) return failure(startResponse.error);
|
|
528
522
|
const exportProgressAction = getResponseExportProgress(connectionOptions);
|
|
529
523
|
const progressResponse = await poll({
|
|
530
524
|
fn: async () => await exportProgressAction({
|
|
@@ -536,8 +530,7 @@ var exportResponses = (connectionOptions) => async (responseOptions) => {
|
|
|
536
530
|
interval: 1,
|
|
537
531
|
maxAttempts: 60
|
|
538
532
|
});
|
|
539
|
-
if (!progressResponse.success)
|
|
540
|
-
return failure(progressResponse.error);
|
|
533
|
+
if (!progressResponse.success) return failure(progressResponse.error);
|
|
541
534
|
const getFileResponseAction = getResponseExportFile(connectionOptions);
|
|
542
535
|
const fileResponse = await getFileResponseAction({
|
|
543
536
|
surveyId: responseOptions.surveyId,
|
|
@@ -613,21 +606,17 @@ var listDistributions = (connectionOptions) => async ({
|
|
|
613
606
|
try {
|
|
614
607
|
const headers = getAuthHeaders(connectionOptions.apiToken, bearerToken);
|
|
615
608
|
const qs = new URLSearchParams({
|
|
609
|
+
surveyId,
|
|
616
610
|
sendStartDate: sendStartDate.toISOString(),
|
|
617
611
|
sendEndDate: sendEndDate.toISOString()
|
|
618
612
|
});
|
|
619
|
-
if (
|
|
620
|
-
qs.append("surveyId", surveyId);
|
|
621
|
-
if (mailingListId)
|
|
622
|
-
qs.append("mailingListId", mailingListId);
|
|
613
|
+
if (mailingListId) qs.append("mailingListId", mailingListId);
|
|
623
614
|
if (distributionRequestType)
|
|
624
615
|
qs.append("distributionRequestType", distributionRequestType);
|
|
625
|
-
if (skipToken)
|
|
626
|
-
qs.append("skipToken", skipToken);
|
|
616
|
+
if (skipToken) qs.append("skipToken", skipToken);
|
|
627
617
|
if (useNewPaginationScheme)
|
|
628
618
|
qs.append("useNewPaginationScheme", useNewPaginationScheme.toString());
|
|
629
|
-
if (pageSize)
|
|
630
|
-
qs.append("pageSize", pageSize.toString());
|
|
619
|
+
if (pageSize) qs.append("pageSize", pageSize.toString());
|
|
631
620
|
const route = `/API/v3/distributions?${qs.toString()}`;
|
|
632
621
|
const config = {
|
|
633
622
|
datacenterId: connectionOptions.datacenterId,
|
|
@@ -650,10 +639,8 @@ var listLibraryMessages = (connectionOptions) => async ({ libraryId, category, o
|
|
|
650
639
|
try {
|
|
651
640
|
const headers = getAuthHeaders(connectionOptions.apiToken, bearerToken);
|
|
652
641
|
const qs = new URLSearchParams();
|
|
653
|
-
if (category)
|
|
654
|
-
|
|
655
|
-
if (offset)
|
|
656
|
-
qs.append("offset", offset.toString());
|
|
642
|
+
if (category) qs.append("category", category);
|
|
643
|
+
if (offset) qs.append("offset", offset.toString());
|
|
657
644
|
const config = {
|
|
658
645
|
datacenterId: connectionOptions.datacenterId,
|
|
659
646
|
route: qs.size > 0 ? route + "?" + qs.toString() : route,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b-jones-rfd/qualtrics-api-tasks",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Perform common tasks using the Qualtrics API",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
"keywords": [],
|
|
10
10
|
"author": "B-Jones-RFD",
|
|
11
11
|
"license": "MIT",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/B-Jones-RFD/qualtrics-api-tasks.git"
|
|
21
|
+
},
|
|
12
22
|
"devDependencies": {
|
|
13
23
|
"@changesets/cli": "^2.27.1",
|
|
14
24
|
"@types/node": "^20.11.20",
|
|
@@ -17,15 +27,12 @@
|
|
|
17
27
|
"typescript": "^5.3.3",
|
|
18
28
|
"vitest": "^1.3.1"
|
|
19
29
|
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=18"
|
|
22
|
-
},
|
|
23
30
|
"scripts": {
|
|
24
31
|
"dev": "vitest",
|
|
25
32
|
"test": "vitest run",
|
|
26
33
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
27
34
|
"lint": "tsc",
|
|
28
35
|
"ci": "pnpm run lint && pnpm run test && pnpm run build",
|
|
29
|
-
"release": "pnpm run
|
|
36
|
+
"release": "pnpm run build && pnpm publish -r --no-git-checks"
|
|
30
37
|
}
|
|
31
38
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
git-checks: false
|