@xbg.solutions/utils-survey-connector 1.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/lib/index.d.ts +12 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +68 -0
- package/lib/index.js.map +1 -0
- package/lib/providers/surveymonkey-provider.d.ts +26 -0
- package/lib/providers/surveymonkey-provider.d.ts.map +1 -0
- package/lib/providers/surveymonkey-provider.js +167 -0
- package/lib/providers/surveymonkey-provider.js.map +1 -0
- package/lib/providers/typeform-provider.d.ts +26 -0
- package/lib/providers/typeform-provider.d.ts.map +1 -0
- package/lib/providers/typeform-provider.js +149 -0
- package/lib/providers/typeform-provider.js.map +1 -0
- package/lib/survey-connector.d.ts +83 -0
- package/lib/survey-connector.d.ts.map +1 -0
- package/lib/survey-connector.js +197 -0
- package/lib/survey-connector.js.map +1 -0
- package/lib/types.d.ts +110 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/package.json +30 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Survey Connector Barrel Export
|
|
3
|
+
*/
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './survey-connector';
|
|
6
|
+
export * from './providers/surveymonkey-provider';
|
|
7
|
+
export * from './providers/typeform-provider';
|
|
8
|
+
import { SurveyConnector } from './survey-connector';
|
|
9
|
+
export declare function initializeSurveyConnector(config: any): void;
|
|
10
|
+
export declare function createSurveyConnector(): SurveyConnector | null;
|
|
11
|
+
export declare function getSurveyConnector(): SurveyConnector | null;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAOrD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAI3D;AAED,wBAAgB,qBAAqB,IAAI,eAAe,GAAG,IAAI,CA4B9D;AAID,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAK3D"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Survey Connector Barrel Export
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.initializeSurveyConnector = initializeSurveyConnector;
|
|
21
|
+
exports.createSurveyConnector = createSurveyConnector;
|
|
22
|
+
exports.getSurveyConnector = getSurveyConnector;
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./survey-connector"), exports);
|
|
25
|
+
__exportStar(require("./providers/surveymonkey-provider"), exports);
|
|
26
|
+
__exportStar(require("./providers/typeform-provider"), exports);
|
|
27
|
+
const survey_connector_1 = require("./survey-connector");
|
|
28
|
+
const surveymonkey_provider_1 = require("./providers/surveymonkey-provider");
|
|
29
|
+
const typeform_provider_1 = require("./providers/typeform-provider");
|
|
30
|
+
// Config is provided via initializeSurveyConnector() at app startup
|
|
31
|
+
let connectorConfig = null;
|
|
32
|
+
function initializeSurveyConnector(config) {
|
|
33
|
+
connectorConfig = config;
|
|
34
|
+
// Reset singleton so it gets re-created with new config
|
|
35
|
+
surveyConnectorInstance = undefined;
|
|
36
|
+
}
|
|
37
|
+
function createSurveyConnector() {
|
|
38
|
+
if (!connectorConfig) {
|
|
39
|
+
throw new Error('Survey connector not initialized. Call initializeSurveyConnector() first.');
|
|
40
|
+
}
|
|
41
|
+
if (!connectorConfig.survey.enabled) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const provider = connectorConfig.survey.provider;
|
|
45
|
+
if (provider === 'surveymonkey') {
|
|
46
|
+
const config = connectorConfig.survey.providers.surveymonkey;
|
|
47
|
+
if (!(config === null || config === void 0 ? void 0 : config.accessToken)) {
|
|
48
|
+
throw new Error('SurveyMonkey access token is required');
|
|
49
|
+
}
|
|
50
|
+
return new survey_connector_1.SurveyConnector(new surveymonkey_provider_1.SurveyMonkeyProvider(config));
|
|
51
|
+
}
|
|
52
|
+
if (provider === 'typeform') {
|
|
53
|
+
const config = connectorConfig.survey.providers.typeform;
|
|
54
|
+
if (!(config === null || config === void 0 ? void 0 : config.accessToken)) {
|
|
55
|
+
throw new Error('Typeform access token is required');
|
|
56
|
+
}
|
|
57
|
+
return new survey_connector_1.SurveyConnector(new typeform_provider_1.TypeformProvider(config));
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Unsupported survey provider: ${provider}`);
|
|
60
|
+
}
|
|
61
|
+
let surveyConnectorInstance;
|
|
62
|
+
function getSurveyConnector() {
|
|
63
|
+
if (surveyConnectorInstance === undefined) {
|
|
64
|
+
surveyConnectorInstance = createSurveyConnector();
|
|
65
|
+
}
|
|
66
|
+
return surveyConnectorInstance;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAcH,8DAIC;AAED,sDA4BC;AAID,gDAKC;AAvDD,0CAAwB;AACxB,qDAAmC;AACnC,oEAAkD;AAClD,gEAA8C;AAE9C,yDAAqD;AACrD,6EAAyE;AACzE,qEAAiE;AAEjE,oEAAoE;AACpE,IAAI,eAAe,GAAQ,IAAI,CAAC;AAEhC,SAAgB,yBAAyB,CAAC,MAAW;IACnD,eAAe,GAAG,MAAM,CAAC;IACzB,wDAAwD;IACxD,uBAAuB,GAAG,SAAS,CAAC;AACtC,CAAC;AAED,SAAgB,qBAAqB;IACnC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;IAC/F,CAAC;IAED,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC;IAEjD,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC;QAC7D,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,CAAA,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,kCAAe,CAAC,IAAI,4CAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QACzD,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,CAAA,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,IAAI,kCAAe,CAAC,IAAI,oCAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,IAAI,uBAA2D,CAAC;AAEhE,SAAgB,kBAAkB;IAChC,IAAI,uBAAuB,KAAK,SAAS,EAAE,CAAC;QAC1C,uBAAuB,GAAG,qBAAqB,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SurveyMonkey Provider for Survey Connector
|
|
3
|
+
* https://developer.surveymonkey.com/api/v3/
|
|
4
|
+
*/
|
|
5
|
+
import { SurveyProvider } from '../survey-connector';
|
|
6
|
+
import { Survey, SurveyResponse, CreateSurveyRequest, UpdateSurveyRequest, SubmitResponseRequest, SurveyQueryOptions } from '../types';
|
|
7
|
+
export interface SurveyMonkeyProviderConfig {
|
|
8
|
+
accessToken: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SurveyMonkeyProvider implements SurveyProvider {
|
|
11
|
+
private client;
|
|
12
|
+
constructor(config: SurveyMonkeyProviderConfig);
|
|
13
|
+
getSurvey(surveyId: string): Promise<Survey>;
|
|
14
|
+
getSurveys(options?: SurveyQueryOptions): Promise<Survey[]>;
|
|
15
|
+
createSurvey(request: CreateSurveyRequest): Promise<Survey>;
|
|
16
|
+
updateSurvey(surveyId: string, updates: UpdateSurveyRequest): Promise<Survey>;
|
|
17
|
+
deleteSurvey(surveyId: string): Promise<void>;
|
|
18
|
+
getResponses(surveyId: string, options?: SurveyQueryOptions): Promise<SurveyResponse[]>;
|
|
19
|
+
getResponse(responseId: string): Promise<SurveyResponse>;
|
|
20
|
+
submitResponse(request: SubmitResponseRequest): Promise<SurveyResponse>;
|
|
21
|
+
private mapSurveyMonkeySurveyToSurvey;
|
|
22
|
+
private mapSurveyMonkeyResponseToSurveyResponse;
|
|
23
|
+
private mapQuestionTypeToSurveyMonkey;
|
|
24
|
+
private mapSurveyMonkeyQuestionType;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=surveymonkey-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surveymonkey-provider.d.ts","sourceRoot":"","sources":["../../src/providers/surveymonkey-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,0BAA0B;IAUxC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS5C,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgB3D,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IA6B3D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ7E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAWvF,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAKxD,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC;IAK7E,OAAO,CAAC,6BAA6B;IAyBrC,OAAO,CAAC,uCAAuC;IAiB/C,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,2BAA2B;CAUpC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SurveyMonkey Provider for Survey Connector
|
|
4
|
+
* https://developer.surveymonkey.com/api/v3/
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SurveyMonkeyProvider = void 0;
|
|
11
|
+
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
class SurveyMonkeyProvider {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.client = axios_1.default.create({
|
|
15
|
+
baseURL: 'https://api.surveymonkey.com/v3',
|
|
16
|
+
headers: {
|
|
17
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async getSurvey(surveyId) {
|
|
23
|
+
const [surveyResp, detailsResp] = await Promise.all([
|
|
24
|
+
this.client.get(`/surveys/${surveyId}`),
|
|
25
|
+
this.client.get(`/surveys/${surveyId}/details`),
|
|
26
|
+
]);
|
|
27
|
+
return this.mapSurveyMonkeySurveyToSurvey(surveyResp.data, detailsResp.data);
|
|
28
|
+
}
|
|
29
|
+
async getSurveys(options) {
|
|
30
|
+
const response = await this.client.get('/surveys', {
|
|
31
|
+
params: {
|
|
32
|
+
page: (options === null || options === void 0 ? void 0 : options.page) || 1,
|
|
33
|
+
per_page: (options === null || options === void 0 ? void 0 : options.limit) || 50,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return Promise.all(response.data.data.map(async (survey) => {
|
|
37
|
+
const details = await this.client.get(`/surveys/${survey.id}/details`);
|
|
38
|
+
return this.mapSurveyMonkeySurveyToSurvey(survey, details.data);
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
async createSurvey(request) {
|
|
42
|
+
var _a;
|
|
43
|
+
// Create survey
|
|
44
|
+
const surveyResp = await this.client.post('/surveys', {
|
|
45
|
+
title: request.title,
|
|
46
|
+
});
|
|
47
|
+
const surveyId = surveyResp.data.id;
|
|
48
|
+
// Add pages and questions
|
|
49
|
+
const pageResp = await this.client.post(`/surveys/${surveyId}/pages`, {
|
|
50
|
+
title: 'Page 1',
|
|
51
|
+
});
|
|
52
|
+
const pageId = pageResp.data.id;
|
|
53
|
+
for (const question of request.questions) {
|
|
54
|
+
await this.client.post(`/surveys/${surveyId}/pages/${pageId}/questions`, {
|
|
55
|
+
heading: question.text,
|
|
56
|
+
family: this.mapQuestionTypeToSurveyMonkey(question.type),
|
|
57
|
+
subtype: 'single',
|
|
58
|
+
answers: {
|
|
59
|
+
choices: (_a = question.choices) === null || _a === void 0 ? void 0 : _a.map(choice => ({ text: choice })),
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return this.getSurvey(surveyId);
|
|
64
|
+
}
|
|
65
|
+
async updateSurvey(surveyId, updates) {
|
|
66
|
+
const payload = {};
|
|
67
|
+
if (updates.title)
|
|
68
|
+
payload.title = updates.title;
|
|
69
|
+
await this.client.patch(`/surveys/${surveyId}`, payload);
|
|
70
|
+
return this.getSurvey(surveyId);
|
|
71
|
+
}
|
|
72
|
+
async deleteSurvey(surveyId) {
|
|
73
|
+
await this.client.delete(`/surveys/${surveyId}`);
|
|
74
|
+
}
|
|
75
|
+
async getResponses(surveyId, options) {
|
|
76
|
+
const response = await this.client.get(`/surveys/${surveyId}/responses/bulk`, {
|
|
77
|
+
params: {
|
|
78
|
+
page: (options === null || options === void 0 ? void 0 : options.page) || 1,
|
|
79
|
+
per_page: (options === null || options === void 0 ? void 0 : options.limit) || 100,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
return response.data.data.map((resp) => this.mapSurveyMonkeyResponseToSurveyResponse(resp, surveyId));
|
|
83
|
+
}
|
|
84
|
+
async getResponse(responseId) {
|
|
85
|
+
const response = await this.client.get(`/responses/${responseId}/details`);
|
|
86
|
+
return this.mapSurveyMonkeyResponseToSurveyResponse(response.data, response.data.survey_id);
|
|
87
|
+
}
|
|
88
|
+
async submitResponse(request) {
|
|
89
|
+
// SurveyMonkey doesn't support direct API submission - responses come through web collectors
|
|
90
|
+
throw new Error('SurveyMonkey does not support API-based response submission. Use web collectors instead.');
|
|
91
|
+
}
|
|
92
|
+
mapSurveyMonkeySurveyToSurvey(survey, details) {
|
|
93
|
+
var _a;
|
|
94
|
+
return {
|
|
95
|
+
id: survey.id,
|
|
96
|
+
title: survey.title,
|
|
97
|
+
description: survey.description,
|
|
98
|
+
status: survey.response_count > 0 ? 'active' : 'draft',
|
|
99
|
+
questions: ((_a = details.pages) === null || _a === void 0 ? void 0 : _a.flatMap((page) => {
|
|
100
|
+
var _a;
|
|
101
|
+
return ((_a = page.questions) === null || _a === void 0 ? void 0 : _a.map((q) => {
|
|
102
|
+
var _a, _b, _c, _d, _e;
|
|
103
|
+
return ({
|
|
104
|
+
id: q.id,
|
|
105
|
+
text: ((_b = (_a = q.headings) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.heading) || q.heading,
|
|
106
|
+
type: this.mapSurveyMonkeyQuestionType(q.family),
|
|
107
|
+
required: ((_c = q.required) === null || _c === void 0 ? void 0 : _c.text) === 'required',
|
|
108
|
+
choices: (_e = (_d = q.answers) === null || _d === void 0 ? void 0 : _d.choices) === null || _e === void 0 ? void 0 : _e.map((c) => ({
|
|
109
|
+
id: c.id,
|
|
110
|
+
text: c.text,
|
|
111
|
+
})),
|
|
112
|
+
});
|
|
113
|
+
})) || [];
|
|
114
|
+
})) || [],
|
|
115
|
+
responseCount: survey.response_count,
|
|
116
|
+
createdAt: new Date(survey.date_created),
|
|
117
|
+
updatedAt: new Date(survey.date_modified),
|
|
118
|
+
url: survey.href,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
mapSurveyMonkeyResponseToSurveyResponse(response, surveyId) {
|
|
122
|
+
var _a;
|
|
123
|
+
return {
|
|
124
|
+
id: response.id,
|
|
125
|
+
surveyId,
|
|
126
|
+
respondentId: response.recipient_id,
|
|
127
|
+
answers: ((_a = response.pages) === null || _a === void 0 ? void 0 : _a.flatMap((page) => {
|
|
128
|
+
var _a;
|
|
129
|
+
return ((_a = page.questions) === null || _a === void 0 ? void 0 : _a.map((q) => {
|
|
130
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
131
|
+
return ({
|
|
132
|
+
questionId: q.id,
|
|
133
|
+
value: ((_b = (_a = q.answers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) || ((_d = (_c = q.answers) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.choice_id),
|
|
134
|
+
text: (_f = (_e = q.answers) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.text,
|
|
135
|
+
choiceIds: (_g = q.answers) === null || _g === void 0 ? void 0 : _g.map((a) => a.choice_id).filter(Boolean),
|
|
136
|
+
});
|
|
137
|
+
})) || [];
|
|
138
|
+
})) || [],
|
|
139
|
+
completedAt: new Date(response.date_modified),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
mapQuestionTypeToSurveyMonkey(type) {
|
|
143
|
+
const map = {
|
|
144
|
+
'multiple_choice': 'multiple_choice',
|
|
145
|
+
'single_choice': 'single_choice',
|
|
146
|
+
'text': 'open_ended',
|
|
147
|
+
'email': 'open_ended',
|
|
148
|
+
'number': 'open_ended',
|
|
149
|
+
'rating': 'matrix',
|
|
150
|
+
'matrix': 'matrix',
|
|
151
|
+
'date': 'datetime',
|
|
152
|
+
};
|
|
153
|
+
return map[type] || 'open_ended';
|
|
154
|
+
}
|
|
155
|
+
mapSurveyMonkeyQuestionType(family) {
|
|
156
|
+
const map = {
|
|
157
|
+
'multiple_choice': 'multiple_choice',
|
|
158
|
+
'single_choice': 'single_choice',
|
|
159
|
+
'open_ended': 'text',
|
|
160
|
+
'matrix': 'matrix',
|
|
161
|
+
'datetime': 'date',
|
|
162
|
+
};
|
|
163
|
+
return map[family] || 'text';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.SurveyMonkeyProvider = SurveyMonkeyProvider;
|
|
167
|
+
//# sourceMappingURL=surveymonkey-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surveymonkey-provider.js","sourceRoot":"","sources":["../../src/providers/surveymonkey-provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAA6C;AAgB7C,MAAa,oBAAoB;IAG/B,YAAY,MAAkC;QAC5C,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,iCAAiC;YAC1C,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU,MAAM,CAAC,WAAW,EAAE;gBAC/C,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAgB;QAC9B,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAClD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,QAAQ,U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,0CAAE,SAAS,CAAA;wBACxD,IAAI,EAAE,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAG,CAAC,CAAC,0CAAE,IAAI;wBAC1B,SAAS,EAAE,MAAA,CAAC,CAAC,OAAO,0CAAE,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC;qBACnE,CAAC,CAAA;iBAAA,CAAC,KAAI,EAAE,CAAA;aAAA,CACV,KAAI,EAAE;YACP,WAAW,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;SAC9C,CAAC;IACJ,CAAC;IAEO,6BAA6B,CAAC,IAAkB;QACtD,MAAM,GAAG,GAAiC;YACxC,iBAAiB,EAAE,iBAAiB;YACpC,eAAe,EAAE,eAAe;YAChC,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,YAAY;YACrB,QAAQ,EAAE,YAAY;YACtB,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,UAAU;SACnB,CAAC;QACF,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC;IACnC,CAAC;IAEO,2BAA2B,CAAC,MAAc;QAChD,MAAM,GAAG,GAAiC;YACxC,iBAAiB,EAAE,iBAAiB;YACpC,eAAe,EAAE,eAAe;YAChC,YAAY,EAAE,MAAM;YACpB,QAAQ,EAAE,QAAQ;YAClB,UAAU,EAAE,MAAM;SACnB,CAAC;QACF,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;IAC/B,CAAC;CACF;AAtKD,oDAsKC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typeform Provider for Survey Connector
|
|
3
|
+
* https://developer.typeform.com/
|
|
4
|
+
*/
|
|
5
|
+
import { SurveyProvider } from '../survey-connector';
|
|
6
|
+
import { Survey, SurveyResponse, CreateSurveyRequest, UpdateSurveyRequest, SubmitResponseRequest, SurveyQueryOptions } from '../types';
|
|
7
|
+
export interface TypeformProviderConfig {
|
|
8
|
+
accessToken: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class TypeformProvider implements SurveyProvider {
|
|
11
|
+
private client;
|
|
12
|
+
constructor(config: TypeformProviderConfig);
|
|
13
|
+
getSurvey(surveyId: string): Promise<Survey>;
|
|
14
|
+
getSurveys(options?: SurveyQueryOptions): Promise<Survey[]>;
|
|
15
|
+
createSurvey(request: CreateSurveyRequest): Promise<Survey>;
|
|
16
|
+
updateSurvey(surveyId: string, updates: UpdateSurveyRequest): Promise<Survey>;
|
|
17
|
+
deleteSurvey(surveyId: string): Promise<void>;
|
|
18
|
+
getResponses(surveyId: string, options?: SurveyQueryOptions): Promise<SurveyResponse[]>;
|
|
19
|
+
getResponse(responseId: string): Promise<SurveyResponse>;
|
|
20
|
+
submitResponse(request: SubmitResponseRequest): Promise<SurveyResponse>;
|
|
21
|
+
private mapTypeformToSurvey;
|
|
22
|
+
private mapTypeformResponseToSurveyResponse;
|
|
23
|
+
private mapQuestionTypeToTypeform;
|
|
24
|
+
private mapTypeformQuestionType;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=typeform-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeform-provider.d.ts","sourceRoot":"","sources":["../../src/providers/typeform-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,gBAAiB,YAAW,cAAc;IACrD,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,sBAAsB;IAUpC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK5C,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAW3D,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB3D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ7E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAUvF,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMxD,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC;IAK7E,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,mCAAmC;IAgB3C,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,uBAAuB;CAahC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Typeform Provider for Survey Connector
|
|
4
|
+
* https://developer.typeform.com/
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TypeformProvider = void 0;
|
|
11
|
+
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
class TypeformProvider {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.client = axios_1.default.create({
|
|
15
|
+
baseURL: 'https://api.typeform.com',
|
|
16
|
+
headers: {
|
|
17
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async getSurvey(surveyId) {
|
|
23
|
+
const response = await this.client.get(`/forms/${surveyId}`);
|
|
24
|
+
return this.mapTypeformToSurvey(response.data);
|
|
25
|
+
}
|
|
26
|
+
async getSurveys(options) {
|
|
27
|
+
const response = await this.client.get('/forms', {
|
|
28
|
+
params: {
|
|
29
|
+
page: (options === null || options === void 0 ? void 0 : options.page) || 1,
|
|
30
|
+
page_size: (options === null || options === void 0 ? void 0 : options.limit) || 200,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return response.data.items.map((form) => this.mapTypeformToSurvey(form));
|
|
34
|
+
}
|
|
35
|
+
async createSurvey(request) {
|
|
36
|
+
const payload = {
|
|
37
|
+
title: request.title,
|
|
38
|
+
type: 'quiz',
|
|
39
|
+
fields: request.questions.map((q, idx) => ({
|
|
40
|
+
title: q.text,
|
|
41
|
+
type: this.mapQuestionTypeToTypeform(q.type),
|
|
42
|
+
required: q.required,
|
|
43
|
+
properties: q.choices ? {
|
|
44
|
+
choices: q.choices.map(choice => ({ label: choice })),
|
|
45
|
+
} : {},
|
|
46
|
+
ref: `question_${idx + 1}`,
|
|
47
|
+
})),
|
|
48
|
+
};
|
|
49
|
+
const response = await this.client.post('/forms', payload);
|
|
50
|
+
return this.mapTypeformToSurvey(response.data);
|
|
51
|
+
}
|
|
52
|
+
async updateSurvey(surveyId, updates) {
|
|
53
|
+
const payload = {};
|
|
54
|
+
if (updates.title)
|
|
55
|
+
payload.title = updates.title;
|
|
56
|
+
await this.client.patch(`/forms/${surveyId}`, payload);
|
|
57
|
+
return this.getSurvey(surveyId);
|
|
58
|
+
}
|
|
59
|
+
async deleteSurvey(surveyId) {
|
|
60
|
+
await this.client.delete(`/forms/${surveyId}`);
|
|
61
|
+
}
|
|
62
|
+
async getResponses(surveyId, options) {
|
|
63
|
+
const response = await this.client.get(`/forms/${surveyId}/responses`, {
|
|
64
|
+
params: {
|
|
65
|
+
page_size: (options === null || options === void 0 ? void 0 : options.limit) || 1000,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
return response.data.items.map((resp) => this.mapTypeformResponseToSurveyResponse(resp, surveyId));
|
|
69
|
+
}
|
|
70
|
+
async getResponse(responseId) {
|
|
71
|
+
// Typeform doesn't have a direct endpoint for single response
|
|
72
|
+
// Need to extract from form responses
|
|
73
|
+
throw new Error('Typeform does not support fetching individual responses by ID');
|
|
74
|
+
}
|
|
75
|
+
async submitResponse(request) {
|
|
76
|
+
// Typeform doesn't support direct API submission - responses come through form submissions
|
|
77
|
+
throw new Error('Typeform does not support API-based response submission. Use form links instead.');
|
|
78
|
+
}
|
|
79
|
+
mapTypeformToSurvey(form) {
|
|
80
|
+
var _a, _b, _c, _d;
|
|
81
|
+
return {
|
|
82
|
+
id: form.id,
|
|
83
|
+
title: form.title,
|
|
84
|
+
description: (_b = (_a = form.settings) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.description,
|
|
85
|
+
status: form.published_at ? 'active' : 'draft',
|
|
86
|
+
questions: ((_c = form.fields) === null || _c === void 0 ? void 0 : _c.map((field) => {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
return ({
|
|
89
|
+
id: field.id,
|
|
90
|
+
text: field.title,
|
|
91
|
+
type: this.mapTypeformQuestionType(field.type),
|
|
92
|
+
required: (_a = field.validations) === null || _a === void 0 ? void 0 : _a.required,
|
|
93
|
+
choices: (_c = (_b = field.properties) === null || _b === void 0 ? void 0 : _b.choices) === null || _c === void 0 ? void 0 : _c.map((c) => ({
|
|
94
|
+
id: c.id || c.label,
|
|
95
|
+
text: c.label,
|
|
96
|
+
})),
|
|
97
|
+
});
|
|
98
|
+
})) || [],
|
|
99
|
+
responseCount: form.response_count,
|
|
100
|
+
createdAt: new Date(form.created_at),
|
|
101
|
+
updatedAt: new Date(form.last_updated_at),
|
|
102
|
+
url: (_d = form._links) === null || _d === void 0 ? void 0 : _d.display,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
mapTypeformResponseToSurveyResponse(response, surveyId) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
return {
|
|
108
|
+
id: response.response_id || response.token,
|
|
109
|
+
surveyId,
|
|
110
|
+
respondentId: (_a = response.hidden) === null || _a === void 0 ? void 0 : _a.respondent_id,
|
|
111
|
+
answers: ((_b = response.answers) === null || _b === void 0 ? void 0 : _b.map((answer) => ({
|
|
112
|
+
questionId: answer.field.id,
|
|
113
|
+
value: answer[answer.type],
|
|
114
|
+
text: typeof answer[answer.type] === 'string' ? answer[answer.type] : undefined,
|
|
115
|
+
choiceIds: answer.choices ? answer.choices.labels || answer.choices.ids : undefined,
|
|
116
|
+
}))) || [],
|
|
117
|
+
completedAt: new Date(response.submitted_at),
|
|
118
|
+
metadata: response.hidden,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
mapQuestionTypeToTypeform(type) {
|
|
122
|
+
const map = {
|
|
123
|
+
'multiple_choice': 'multiple_choice',
|
|
124
|
+
'single_choice': 'multiple_choice',
|
|
125
|
+
'text': 'short_text',
|
|
126
|
+
'email': 'email',
|
|
127
|
+
'number': 'number',
|
|
128
|
+
'rating': 'rating',
|
|
129
|
+
'matrix': 'matrix',
|
|
130
|
+
'date': 'date',
|
|
131
|
+
};
|
|
132
|
+
return map[type] || 'short_text';
|
|
133
|
+
}
|
|
134
|
+
mapTypeformQuestionType(type) {
|
|
135
|
+
const map = {
|
|
136
|
+
'multiple_choice': 'multiple_choice',
|
|
137
|
+
'short_text': 'text',
|
|
138
|
+
'long_text': 'text',
|
|
139
|
+
'email': 'email',
|
|
140
|
+
'number': 'number',
|
|
141
|
+
'rating': 'rating',
|
|
142
|
+
'opinion_scale': 'rating',
|
|
143
|
+
'date': 'date',
|
|
144
|
+
};
|
|
145
|
+
return map[type] || 'text';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.TypeformProvider = TypeformProvider;
|
|
149
|
+
//# sourceMappingURL=typeform-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeform-provider.js","sourceRoot":"","sources":["../../src/providers/typeform-provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAA6C;AAgB7C,MAAa,gBAAgB;IAG3B,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,0BAA0B;YACnC,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU,MAAM,CAAC,WAAW,EAAE;gBAC/C,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAgB;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA4B;QAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE;gBACN,IAAI,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,KAAI,CAAC;gBACxB,SAAS,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,KAAI,GAAG;aACjC;SACF,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,MAAM,OAAO,GAAG;YACd,KAAK,EAAE,OAAO,CAA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pF,CAAC,CAAC,KAAI,EAAE;YACT,WAAW,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC5C,QAAQ,EAAE,QAAQ,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC;IAEO,yBAAyB,CAAC,IAAkB;QAClD,MAAM,GAAG,GAAiC;YACxC,iBAAiB,EAAE,iBAAiB;YACpC,eAAe,EAAE,iBAAiB;YAClC,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,MAAM;SACf,CAAC;QACF,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC;IACnC,CAAC;IAEO,uBAAuB,CAAC,IAAY;QAC1C,MAAM,GAAG,GAAiC;YACxC,iBAAiB,EAAE,iBAAiB;YACpC,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,MAAM;YACnB,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;YAClB,eAAe,EAAE,QAAQ;YACzB,MAAM,EAAE,MAAM;SACf,CAAC;QACF,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;IAC7B,CAAC;CACF;AAnJD,4CAmJC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Survey Connector
|
|
3
|
+
* Survey questions and responses management
|
|
4
|
+
*/
|
|
5
|
+
import { Survey, SurveyResponse, CreateSurveyRequest, UpdateSurveyRequest, SubmitResponseRequest, SurveyQueryOptions, SurveyConnectorResponse } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Survey Provider Interface
|
|
8
|
+
*/
|
|
9
|
+
export interface SurveyProvider {
|
|
10
|
+
/**
|
|
11
|
+
* Get survey by ID with questions
|
|
12
|
+
*/
|
|
13
|
+
getSurvey(surveyId: string): Promise<Survey>;
|
|
14
|
+
/**
|
|
15
|
+
* Get all surveys
|
|
16
|
+
*/
|
|
17
|
+
getSurveys(options?: SurveyQueryOptions): Promise<Survey[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Create new survey
|
|
20
|
+
*/
|
|
21
|
+
createSurvey(request: CreateSurveyRequest): Promise<Survey>;
|
|
22
|
+
/**
|
|
23
|
+
* Update survey
|
|
24
|
+
*/
|
|
25
|
+
updateSurvey(surveyId: string, updates: UpdateSurveyRequest): Promise<Survey>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete survey
|
|
28
|
+
*/
|
|
29
|
+
deleteSurvey(surveyId: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get responses for a survey
|
|
32
|
+
*/
|
|
33
|
+
getResponses(surveyId: string, options?: SurveyQueryOptions): Promise<SurveyResponse[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Get single response
|
|
36
|
+
*/
|
|
37
|
+
getResponse(responseId: string): Promise<SurveyResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Submit response to survey
|
|
40
|
+
*/
|
|
41
|
+
submitResponse(request: SubmitResponseRequest): Promise<SurveyResponse>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Survey Connector
|
|
45
|
+
* Unified interface for survey platforms
|
|
46
|
+
*/
|
|
47
|
+
export declare class SurveyConnector {
|
|
48
|
+
private provider;
|
|
49
|
+
constructor(provider: SurveyProvider);
|
|
50
|
+
/**
|
|
51
|
+
* Get survey by ID
|
|
52
|
+
*/
|
|
53
|
+
getSurvey(surveyId: string): Promise<SurveyConnectorResponse<Survey>>;
|
|
54
|
+
/**
|
|
55
|
+
* Get all surveys
|
|
56
|
+
*/
|
|
57
|
+
getSurveys(options?: SurveyQueryOptions): Promise<SurveyConnectorResponse<Survey[]>>;
|
|
58
|
+
/**
|
|
59
|
+
* Create new survey
|
|
60
|
+
*/
|
|
61
|
+
createSurvey(request: CreateSurveyRequest): Promise<SurveyConnectorResponse<Survey>>;
|
|
62
|
+
/**
|
|
63
|
+
* Update survey
|
|
64
|
+
*/
|
|
65
|
+
updateSurvey(surveyId: string, updates: UpdateSurveyRequest): Promise<SurveyConnectorResponse<Survey>>;
|
|
66
|
+
/**
|
|
67
|
+
* Delete survey
|
|
68
|
+
*/
|
|
69
|
+
deleteSurvey(surveyId: string): Promise<SurveyConnectorResponse<void>>;
|
|
70
|
+
/**
|
|
71
|
+
* Get responses for a survey
|
|
72
|
+
*/
|
|
73
|
+
getResponses(surveyId: string, options?: SurveyQueryOptions): Promise<SurveyConnectorResponse<SurveyResponse[]>>;
|
|
74
|
+
/**
|
|
75
|
+
* Get single response
|
|
76
|
+
*/
|
|
77
|
+
getResponse(responseId: string): Promise<SurveyConnectorResponse<SurveyResponse>>;
|
|
78
|
+
/**
|
|
79
|
+
* Submit response to survey
|
|
80
|
+
*/
|
|
81
|
+
submitResponse(request: SubmitResponseRequest): Promise<SurveyConnectorResponse<SurveyResponse>>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=survey-connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-connector.d.ts","sourceRoot":"","sources":["../src/survey-connector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5D;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5D;;OAEG;IAC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BAAuB,CAAC,cAAc,EAAE,CAAC,CAAC;IAoBtH;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAoBvF;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;CAsBvG"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Survey Connector
|
|
4
|
+
* Survey questions and responses management
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SurveyConnector = void 0;
|
|
8
|
+
const utils_logger_1 = require("@xbg/utils-logger");
|
|
9
|
+
/**
|
|
10
|
+
* Survey Connector
|
|
11
|
+
* Unified interface for survey platforms
|
|
12
|
+
*/
|
|
13
|
+
class SurveyConnector {
|
|
14
|
+
constructor(provider) {
|
|
15
|
+
this.provider = provider;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get survey by ID
|
|
19
|
+
*/
|
|
20
|
+
async getSurvey(surveyId) {
|
|
21
|
+
utils_logger_1.logger.info('Fetching survey', { surveyId });
|
|
22
|
+
try {
|
|
23
|
+
const survey = await this.provider.getSurvey(surveyId);
|
|
24
|
+
return { success: true, data: survey };
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
utils_logger_1.logger.error('Error fetching survey', error instanceof Error ? error : new Error('Unknown error'), {
|
|
28
|
+
surveyId,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
error: {
|
|
33
|
+
code: 'FETCH_ERROR',
|
|
34
|
+
message: 'Failed to fetch survey',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get all surveys
|
|
41
|
+
*/
|
|
42
|
+
async getSurveys(options) {
|
|
43
|
+
utils_logger_1.logger.info('Fetching surveys', { options });
|
|
44
|
+
try {
|
|
45
|
+
const surveys = await this.provider.getSurveys(options);
|
|
46
|
+
return { success: true, data: surveys };
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
utils_logger_1.logger.error('Error fetching surveys', error instanceof Error ? error : new Error('Unknown error'));
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
error: {
|
|
53
|
+
code: 'FETCH_ERROR',
|
|
54
|
+
message: 'Failed to fetch surveys',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create new survey
|
|
61
|
+
*/
|
|
62
|
+
async createSurvey(request) {
|
|
63
|
+
utils_logger_1.logger.info('Creating survey', {
|
|
64
|
+
title: request.title,
|
|
65
|
+
questionCount: request.questions.length,
|
|
66
|
+
});
|
|
67
|
+
try {
|
|
68
|
+
const survey = await this.provider.createSurvey(request);
|
|
69
|
+
return { success: true, data: survey };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
utils_logger_1.logger.error('Error creating survey', error instanceof Error ? error : new Error('Unknown error'));
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
error: {
|
|
76
|
+
code: 'CREATE_ERROR',
|
|
77
|
+
message: 'Failed to create survey',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Update survey
|
|
84
|
+
*/
|
|
85
|
+
async updateSurvey(surveyId, updates) {
|
|
86
|
+
utils_logger_1.logger.info('Updating survey', { surveyId, updates });
|
|
87
|
+
try {
|
|
88
|
+
const survey = await this.provider.updateSurvey(surveyId, updates);
|
|
89
|
+
return { success: true, data: survey };
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
utils_logger_1.logger.error('Error updating survey', error instanceof Error ? error : new Error('Unknown error'), {
|
|
93
|
+
surveyId,
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
error: {
|
|
98
|
+
code: 'UPDATE_ERROR',
|
|
99
|
+
message: 'Failed to update survey',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Delete survey
|
|
106
|
+
*/
|
|
107
|
+
async deleteSurvey(surveyId) {
|
|
108
|
+
utils_logger_1.logger.info('Deleting survey', { surveyId });
|
|
109
|
+
try {
|
|
110
|
+
await this.provider.deleteSurvey(surveyId);
|
|
111
|
+
return { success: true };
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
utils_logger_1.logger.error('Error deleting survey', error instanceof Error ? error : new Error('Unknown error'), {
|
|
115
|
+
surveyId,
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
success: false,
|
|
119
|
+
error: {
|
|
120
|
+
code: 'DELETE_ERROR',
|
|
121
|
+
message: 'Failed to delete survey',
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get responses for a survey
|
|
128
|
+
*/
|
|
129
|
+
async getResponses(surveyId, options) {
|
|
130
|
+
utils_logger_1.logger.info('Fetching survey responses', { surveyId, options });
|
|
131
|
+
try {
|
|
132
|
+
const responses = await this.provider.getResponses(surveyId, options);
|
|
133
|
+
return { success: true, data: responses };
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
utils_logger_1.logger.error('Error fetching responses', error instanceof Error ? error : new Error('Unknown error'), {
|
|
137
|
+
surveyId,
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
error: {
|
|
142
|
+
code: 'FETCH_ERROR',
|
|
143
|
+
message: 'Failed to fetch survey responses',
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get single response
|
|
150
|
+
*/
|
|
151
|
+
async getResponse(responseId) {
|
|
152
|
+
utils_logger_1.logger.info('Fetching response', { responseId });
|
|
153
|
+
try {
|
|
154
|
+
const response = await this.provider.getResponse(responseId);
|
|
155
|
+
return { success: true, data: response };
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
utils_logger_1.logger.error('Error fetching response', error instanceof Error ? error : new Error('Unknown error'), {
|
|
159
|
+
responseId,
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
success: false,
|
|
163
|
+
error: {
|
|
164
|
+
code: 'FETCH_ERROR',
|
|
165
|
+
message: 'Failed to fetch survey response',
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Submit response to survey
|
|
172
|
+
*/
|
|
173
|
+
async submitResponse(request) {
|
|
174
|
+
utils_logger_1.logger.info('Submitting survey response', {
|
|
175
|
+
surveyId: request.surveyId,
|
|
176
|
+
answerCount: request.answers.length,
|
|
177
|
+
});
|
|
178
|
+
try {
|
|
179
|
+
const response = await this.provider.submitResponse(request);
|
|
180
|
+
return { success: true, data: response };
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
utils_logger_1.logger.error('Error submitting response', error instanceof Error ? error : new Error('Unknown error'), {
|
|
184
|
+
surveyId: request.surveyId,
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
success: false,
|
|
188
|
+
error: {
|
|
189
|
+
code: 'SUBMIT_ERROR',
|
|
190
|
+
message: 'Failed to submit survey response',
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.SurveyConnector = SurveyConnector;
|
|
197
|
+
//# sourceMappingURL=survey-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-connector.js","sourceRoot":"","sources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BAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;SACpC,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,qBAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE;gBACrG,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,kCAAkC;iBAC5C;aACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAhMD,0CAgMC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Survey Connector Types
|
|
3
|
+
* Survey questions and responses management
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Survey question types
|
|
7
|
+
*/
|
|
8
|
+
export type QuestionType = 'multiple_choice' | 'single_choice' | 'text' | 'email' | 'number' | 'rating' | 'matrix' | 'date';
|
|
9
|
+
/**
|
|
10
|
+
* Survey question
|
|
11
|
+
*/
|
|
12
|
+
export interface SurveyQuestion {
|
|
13
|
+
id: string;
|
|
14
|
+
text: string;
|
|
15
|
+
type: QuestionType;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
choices?: Array<{
|
|
18
|
+
id: string;
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
properties?: Record<string, any>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Survey structure
|
|
25
|
+
*/
|
|
26
|
+
export interface Survey {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
status?: 'draft' | 'active' | 'closed';
|
|
31
|
+
questions: SurveyQuestion[];
|
|
32
|
+
responseCount?: number;
|
|
33
|
+
createdAt?: Date;
|
|
34
|
+
updatedAt?: Date;
|
|
35
|
+
url?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Survey response answer
|
|
39
|
+
*/
|
|
40
|
+
export interface SurveyAnswer {
|
|
41
|
+
questionId: string;
|
|
42
|
+
value: any;
|
|
43
|
+
text?: string;
|
|
44
|
+
choiceIds?: string[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Survey response
|
|
48
|
+
*/
|
|
49
|
+
export interface SurveyResponse {
|
|
50
|
+
id: string;
|
|
51
|
+
surveyId: string;
|
|
52
|
+
respondentId?: string;
|
|
53
|
+
answers: SurveyAnswer[];
|
|
54
|
+
completedAt?: Date;
|
|
55
|
+
metadata?: Record<string, any>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create survey request
|
|
59
|
+
*/
|
|
60
|
+
export interface CreateSurveyRequest {
|
|
61
|
+
title: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
questions: Array<{
|
|
64
|
+
text: string;
|
|
65
|
+
type: QuestionType;
|
|
66
|
+
required?: boolean;
|
|
67
|
+
choices?: string[];
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Update survey request
|
|
72
|
+
*/
|
|
73
|
+
export interface UpdateSurveyRequest {
|
|
74
|
+
title?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
status?: 'draft' | 'active' | 'closed';
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Submit response request
|
|
80
|
+
*/
|
|
81
|
+
export interface SubmitResponseRequest {
|
|
82
|
+
surveyId: string;
|
|
83
|
+
answers: SurveyAnswer[];
|
|
84
|
+
respondentId?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Survey query options
|
|
88
|
+
*/
|
|
89
|
+
export interface SurveyQueryOptions {
|
|
90
|
+
page?: number;
|
|
91
|
+
limit?: number;
|
|
92
|
+
status?: 'draft' | 'active' | 'closed';
|
|
93
|
+
sort?: {
|
|
94
|
+
field: string;
|
|
95
|
+
order: 'asc' | 'desc';
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Survey response wrapper
|
|
100
|
+
*/
|
|
101
|
+
export interface SurveyConnectorResponse<T> {
|
|
102
|
+
success: boolean;
|
|
103
|
+
data?: T;
|
|
104
|
+
error?: {
|
|
105
|
+
code: string;
|
|
106
|
+
message: string;
|
|
107
|
+
details?: any;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,eAAe,GACf,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACl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CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvC,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;CACH"}
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xbg.solutions/utils-survey-connector",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Survey integration",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"build:watch": "tsc --watch",
|
|
13
|
+
"clean": "rm -rf lib",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@xbg/utils-logger": "^1.0.0",
|
|
18
|
+
"axios": "^1.6.2"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.11.0",
|
|
22
|
+
"typescript": "^5.3.3"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": "22"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|