airbyte-faros-destination 0.6.25 → 0.6.27
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/converters/abstract-surveys/models.js.map +1 -0
- package/lib/converters/abstract-surveys/surveys.d.ts +62 -0
- package/lib/converters/abstract-surveys/surveys.js +358 -0
- package/lib/converters/abstract-surveys/surveys.js.map +1 -0
- package/lib/converters/airtable/surveys.d.ts +9 -55
- package/lib/converters/airtable/surveys.js +31 -331
- package/lib/converters/airtable/surveys.js.map +1 -1
- package/lib/converters/sheets/surveys.d.ts +8 -0
- package/lib/converters/sheets/surveys.js +22 -0
- package/lib/converters/sheets/surveys.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/resources/source-specific-configs/surveys.json +7 -0
- package/lib/converters/airtable/common.d.ts +0 -10
- package/lib/converters/airtable/common.js +0 -36
- package/lib/converters/airtable/common.js.map +0 -1
- package/lib/converters/airtable/models.js.map +0 -1
- /package/lib/converters/{airtable → abstract-surveys}/models.d.ts +0 -0
- /package/lib/converters/{airtable → abstract-surveys}/models.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/converters/abstract-surveys/models.ts"],"names":[],"mappings":";;;AAqDA,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,6BAAW,CAAA;IACX,+CAA6B,CAAA;IAC7B,mCAAiB,CAAA;AACnB,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAOD,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,iDAAyB,CAAA;IACzB,yCAAiB,CAAA;AACnB,CAAC,EANW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAM/B;AAOD,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,iEAAuC,CAAA;IACvC,yEAA+C,CAAA;IAC/C,uCAAa,CAAA;IACb,qCAAW,CAAA;IACX,6CAAmB,CAAA;IACnB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;IACnC,2CAAiB,CAAA;AACnB,CAAC,EATW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QASjC;AAOD,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;IACjC,uDAA6B,CAAA;IAC7B,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;AACnB,CAAC,EATW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QASjC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter, DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { QuestionCategoryMapping } from './models';
|
|
4
|
+
declare type ColumnNameMapping = {
|
|
5
|
+
survey_name_column_name?: string;
|
|
6
|
+
survey_type_column_name?: string;
|
|
7
|
+
survey_description_column_name?: string;
|
|
8
|
+
survey_started_at_column_name?: string;
|
|
9
|
+
survey_ended_at_column_name?: string;
|
|
10
|
+
survey_status_column_name?: string;
|
|
11
|
+
respondent_name_column_name?: string;
|
|
12
|
+
respondent_email_column_name?: string;
|
|
13
|
+
respondent_team_name_column_name?: string;
|
|
14
|
+
respondent_team_id_column_name?: string;
|
|
15
|
+
question_category_column_name?: string;
|
|
16
|
+
response_type_column_name?: string;
|
|
17
|
+
question_column_name?: string;
|
|
18
|
+
response_submitted_at_column_name?: string;
|
|
19
|
+
};
|
|
20
|
+
export interface SurveysConfig {
|
|
21
|
+
survey_responses_table_name?: string;
|
|
22
|
+
survey_metadata_table_name?: string;
|
|
23
|
+
question_metadata_table_name?: string;
|
|
24
|
+
question_category_mapping?: QuestionCategoryMapping;
|
|
25
|
+
column_names_mapping?: ColumnNameMapping;
|
|
26
|
+
}
|
|
27
|
+
export declare abstract class AbstractSurveys extends Converter {
|
|
28
|
+
abstract getSurveyId(record: AirbyteRecord): string | undefined;
|
|
29
|
+
abstract getTableName(record: AirbyteRecord): string | undefined;
|
|
30
|
+
getSubmittedAt(record: AirbyteRecord): string | undefined;
|
|
31
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
32
|
+
private questionMetadata;
|
|
33
|
+
private surveyMetadata;
|
|
34
|
+
private surveyStats;
|
|
35
|
+
private usersSeen;
|
|
36
|
+
private teamsSeen;
|
|
37
|
+
private surveysSeen;
|
|
38
|
+
private questionsSeen;
|
|
39
|
+
private _config;
|
|
40
|
+
private _questionCategoryMapping;
|
|
41
|
+
private initialize;
|
|
42
|
+
protected get config(): SurveysConfig;
|
|
43
|
+
private get questionCategoryMapping();
|
|
44
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
45
|
+
private processQuestionMetadata;
|
|
46
|
+
private processSurveyMetadata;
|
|
47
|
+
private processResponse;
|
|
48
|
+
/** Upsert surveys to add stats and survey questions records to include metadata (question category and response type) **/
|
|
49
|
+
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
50
|
+
private getQuestionWithMetadata;
|
|
51
|
+
private getResponseRecords;
|
|
52
|
+
private getSurveyRecord;
|
|
53
|
+
private updateSurveyStats;
|
|
54
|
+
private getFilteredQuestions;
|
|
55
|
+
private getSurveyData;
|
|
56
|
+
private getSurveyUser;
|
|
57
|
+
private getSurveyTeam;
|
|
58
|
+
static createQuestionUid(surveyId: string, question: string): string;
|
|
59
|
+
static getTeamUid(teamName: string): string | undefined;
|
|
60
|
+
static digest(input: string): string;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AbstractSurveys = void 0;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
|
|
9
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
const converter_1 = require("../converter");
|
|
12
|
+
const models_1 = require("./models");
|
|
13
|
+
class AbstractSurveys extends converter_1.Converter {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.destinationModels = [
|
|
17
|
+
'survey_Survey',
|
|
18
|
+
'survey_Question',
|
|
19
|
+
'survey_SurveyQuestionAssociation',
|
|
20
|
+
'survey_QuestionResponse',
|
|
21
|
+
'survey_User',
|
|
22
|
+
'survey_Team',
|
|
23
|
+
'survey_TeamMembership',
|
|
24
|
+
];
|
|
25
|
+
this.questionMetadata = new Map();
|
|
26
|
+
this.surveyMetadata = new Map();
|
|
27
|
+
this.surveyStats = new Map();
|
|
28
|
+
this.usersSeen = new Set();
|
|
29
|
+
this.teamsSeen = new Set();
|
|
30
|
+
this.surveysSeen = new Set();
|
|
31
|
+
this.questionsSeen = new Set();
|
|
32
|
+
this._config = undefined;
|
|
33
|
+
this._questionCategoryMapping = undefined;
|
|
34
|
+
}
|
|
35
|
+
getSubmittedAt(record) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const submittedAtColumnName = this.config.column_names_mapping.response_submitted_at_column_name;
|
|
38
|
+
return (_b = (_a = record === null || record === void 0 ? void 0 : record.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.row[submittedAtColumnName];
|
|
39
|
+
}
|
|
40
|
+
initialize(ctx) {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42
|
+
this._config =
|
|
43
|
+
(_c = (_a = this._config) !== null && _a !== void 0 ? _a : (_b = ctx.config.source_specific_configs) === null || _b === void 0 ? void 0 : _b.surveys) !== null && _c !== void 0 ? _c : {};
|
|
44
|
+
this._questionCategoryMapping =
|
|
45
|
+
(_f = (_d = this._questionCategoryMapping) !== null && _d !== void 0 ? _d : (0, converter_1.parseObjectConfig)((_e = this._config) === null || _e === void 0 ? void 0 : _e.question_category_mapping, 'Question Category Mapping')) !== null && _f !== void 0 ? _f : {};
|
|
46
|
+
}
|
|
47
|
+
get config() {
|
|
48
|
+
return this._config;
|
|
49
|
+
}
|
|
50
|
+
get questionCategoryMapping() {
|
|
51
|
+
return this._questionCategoryMapping;
|
|
52
|
+
}
|
|
53
|
+
async convert(record, ctx) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
this.initialize(ctx);
|
|
56
|
+
const row = (_b = (_a = record === null || record === void 0 ? void 0 : record.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.row;
|
|
57
|
+
const surveyId = this.getSurveyId(record);
|
|
58
|
+
const tableName = this.getTableName(record);
|
|
59
|
+
if (!row || !surveyId || !tableName) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
// Be a bit more lenient with table names matching
|
|
63
|
+
const normalizeTableName = (tableName) => {
|
|
64
|
+
return tableName.toLowerCase().split(' ').join('_');
|
|
65
|
+
};
|
|
66
|
+
// Question metadata
|
|
67
|
+
if (normalizeTableName(tableName) ===
|
|
68
|
+
normalizeTableName(this.config.question_metadata_table_name)) {
|
|
69
|
+
this.processQuestionMetadata(surveyId, row);
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
// Survey metadata
|
|
73
|
+
if (normalizeTableName(tableName) ===
|
|
74
|
+
normalizeTableName(this.config.survey_metadata_table_name)) {
|
|
75
|
+
this.processSurveyMetadata(surveyId, row);
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
// Survey response
|
|
79
|
+
if (normalizeTableName(tableName) ===
|
|
80
|
+
normalizeTableName(this.config.survey_responses_table_name)) {
|
|
81
|
+
const responseId = this.id(record);
|
|
82
|
+
const submittedAt = this.getSubmittedAt(record);
|
|
83
|
+
const questions = this.getFilteredQuestions(row);
|
|
84
|
+
const res = this.processResponse(surveyId, row, responseId, submittedAt, questions);
|
|
85
|
+
// Update survey stats for pushing on processing complete
|
|
86
|
+
this.updateSurveyStats(surveyId, questions);
|
|
87
|
+
return res;
|
|
88
|
+
}
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
processQuestionMetadata(surveyId, row) {
|
|
92
|
+
const questionWithMetadata = this.getQuestionWithMetadata(surveyId, row);
|
|
93
|
+
if (!questionWithMetadata) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.questionMetadata.set(questionWithMetadata.uid, questionWithMetadata);
|
|
97
|
+
}
|
|
98
|
+
processSurveyMetadata(surveyId, row) {
|
|
99
|
+
const surveyRecord = this.getSurveyRecord(surveyId, row);
|
|
100
|
+
this.surveyMetadata.set(surveyRecord.uid, surveyRecord);
|
|
101
|
+
}
|
|
102
|
+
processResponse(surveyId, row, responseId, submittedAt, questions) {
|
|
103
|
+
const res = [];
|
|
104
|
+
const surveyUser = this.getSurveyUser(row);
|
|
105
|
+
const surveyTeam = this.getSurveyTeam(row);
|
|
106
|
+
if (surveyUser && !this.usersSeen.has(surveyUser.uid)) {
|
|
107
|
+
this.usersSeen.add(surveyUser.uid);
|
|
108
|
+
res.push({
|
|
109
|
+
model: 'survey_User',
|
|
110
|
+
record: surveyUser,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (surveyTeam && !this.teamsSeen.has(surveyTeam.uid)) {
|
|
114
|
+
this.teamsSeen.add(surveyTeam.uid);
|
|
115
|
+
res.push({
|
|
116
|
+
model: 'survey_Team',
|
|
117
|
+
record: surveyTeam,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (surveyUser && surveyTeam) {
|
|
121
|
+
res.push({
|
|
122
|
+
model: 'survey_TeamMembership',
|
|
123
|
+
record: {
|
|
124
|
+
member: lodash_1.default.pick(surveyUser, ['uid', 'source']),
|
|
125
|
+
team: lodash_1.default.pick(surveyTeam, ['uid', 'source']),
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
res.push(...this.getResponseRecords(surveyId, row, responseId, submittedAt, questions, surveyUser, surveyTeam));
|
|
130
|
+
return res;
|
|
131
|
+
}
|
|
132
|
+
/** Upsert surveys to add stats and survey questions records to include metadata (question category and response type) **/
|
|
133
|
+
async onProcessingComplete(ctx) {
|
|
134
|
+
const updateRecords = [];
|
|
135
|
+
// Add survey questions upsert mutations
|
|
136
|
+
this.questionMetadata.forEach((surveyQuestion) => {
|
|
137
|
+
const questionRecord = {
|
|
138
|
+
model: 'survey_Question__Update',
|
|
139
|
+
record: {
|
|
140
|
+
at: Date.now(),
|
|
141
|
+
where: { uid: surveyQuestion.uid, source: surveyQuestion.source },
|
|
142
|
+
mask: ['questionCategory', 'responseType'],
|
|
143
|
+
patch: {
|
|
144
|
+
questionCategory: surveyQuestion.questionCategory,
|
|
145
|
+
responseType: surveyQuestion.responseType,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
updateRecords.push(questionRecord);
|
|
150
|
+
});
|
|
151
|
+
this.surveyStats.forEach((surveyStats, surveyId) => {
|
|
152
|
+
const surveyRecord = {
|
|
153
|
+
model: 'survey_Survey__Update',
|
|
154
|
+
record: {
|
|
155
|
+
at: Date.now(),
|
|
156
|
+
where: { uid: surveyId, source: this.streamName.source },
|
|
157
|
+
mask: ['stats'],
|
|
158
|
+
patch: {
|
|
159
|
+
stats: surveyStats,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
updateRecords.push(surveyRecord);
|
|
164
|
+
});
|
|
165
|
+
this.surveyMetadata.forEach((survey) => {
|
|
166
|
+
updateRecords.push({
|
|
167
|
+
model: 'survey_Survey__Update',
|
|
168
|
+
record: {
|
|
169
|
+
at: Date.now(),
|
|
170
|
+
where: {
|
|
171
|
+
uid: survey.uid,
|
|
172
|
+
source: this.streamName.source,
|
|
173
|
+
},
|
|
174
|
+
mask: [
|
|
175
|
+
'name',
|
|
176
|
+
'description',
|
|
177
|
+
'type',
|
|
178
|
+
'status',
|
|
179
|
+
'startedAt',
|
|
180
|
+
'endedAt',
|
|
181
|
+
],
|
|
182
|
+
patch: {
|
|
183
|
+
name: survey.name,
|
|
184
|
+
description: survey.description,
|
|
185
|
+
type: survey.type,
|
|
186
|
+
status: survey.status,
|
|
187
|
+
startedAt: survey.startedAt,
|
|
188
|
+
endedAt: survey.endedAt,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
return updateRecords;
|
|
194
|
+
}
|
|
195
|
+
getQuestionWithMetadata(surveyId, row) {
|
|
196
|
+
const question = row[this.config.column_names_mapping.question_column_name];
|
|
197
|
+
if (!question) {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
const category = row[this.config.column_names_mapping.question_category_column_name];
|
|
201
|
+
const responseType = row[this.config.column_names_mapping.response_type_column_name];
|
|
202
|
+
return {
|
|
203
|
+
uid: AbstractSurveys.createQuestionUid(surveyId, question),
|
|
204
|
+
source: this.source,
|
|
205
|
+
questionCategory: category
|
|
206
|
+
? faros_js_client_1.Utils.toCategoryDetail(models_1.SurveyQuestionCategory, category, this.questionCategoryMapping)
|
|
207
|
+
: null,
|
|
208
|
+
responseType: responseType
|
|
209
|
+
? faros_js_client_1.Utils.toCategoryDetail(models_1.SurveyResponseCategory, responseType)
|
|
210
|
+
: null,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
getResponseRecords(surveyId, row, responseId, submittedAt, questions, surveyUser, surveyTeam) {
|
|
214
|
+
return questions.flatMap((question, index) => {
|
|
215
|
+
const surveyRecord = this.getSurveyRecord(surveyId, row);
|
|
216
|
+
const questionId = AbstractSurveys.createQuestionUid(surveyId, question);
|
|
217
|
+
const questionRecord = {
|
|
218
|
+
uid: questionId,
|
|
219
|
+
source: this.source,
|
|
220
|
+
question,
|
|
221
|
+
};
|
|
222
|
+
const surveyQuestionAssociationRecord = {
|
|
223
|
+
survey: { uid: surveyId, source: this.source },
|
|
224
|
+
question: { uid: questionRecord.uid, source: this.source },
|
|
225
|
+
order: index + 1,
|
|
226
|
+
};
|
|
227
|
+
const questionResponse = {
|
|
228
|
+
model: 'survey_QuestionResponse',
|
|
229
|
+
record: {
|
|
230
|
+
uid: responseId,
|
|
231
|
+
source: this.source,
|
|
232
|
+
submittedAt,
|
|
233
|
+
response: row[question].toString(),
|
|
234
|
+
surveyQuestion: {
|
|
235
|
+
survey: { uid: surveyId, source: this.source },
|
|
236
|
+
question: { uid: questionRecord.uid, source: this.source },
|
|
237
|
+
},
|
|
238
|
+
respondent: surveyUser
|
|
239
|
+
? { uid: surveyUser.uid, source: this.source }
|
|
240
|
+
: null,
|
|
241
|
+
team: surveyTeam ? { uid: surveyTeam.uid, source: this.source } : null,
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
const res = [questionResponse];
|
|
245
|
+
if (!this.questionsSeen.has(questionRecord.uid)) {
|
|
246
|
+
this.questionsSeen.add(questionRecord.uid);
|
|
247
|
+
res.push(...[
|
|
248
|
+
{
|
|
249
|
+
model: 'survey_Question',
|
|
250
|
+
record: questionRecord,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
model: 'survey_SurveyQuestionAssociation',
|
|
254
|
+
record: surveyQuestionAssociationRecord,
|
|
255
|
+
},
|
|
256
|
+
]);
|
|
257
|
+
}
|
|
258
|
+
if (!this.surveysSeen.has(surveyId)) {
|
|
259
|
+
this.surveysSeen.add(surveyId);
|
|
260
|
+
res.push({
|
|
261
|
+
model: 'survey_Survey',
|
|
262
|
+
record: surveyRecord,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
return res;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
getSurveyRecord(surveyId, row) {
|
|
269
|
+
const surveyData = this.getSurveyData(row);
|
|
270
|
+
return {
|
|
271
|
+
uid: surveyId,
|
|
272
|
+
source: this.source,
|
|
273
|
+
status: surveyData.status
|
|
274
|
+
? faros_js_client_1.Utils.toCategoryDetail(models_1.SurveyStatusCategory, surveyData.status)
|
|
275
|
+
: null,
|
|
276
|
+
type: surveyData.type
|
|
277
|
+
? faros_js_client_1.Utils.toCategoryDetail(models_1.SurveyCategory, surveyData.type)
|
|
278
|
+
: null,
|
|
279
|
+
name: surveyData.name,
|
|
280
|
+
description: surveyData.description,
|
|
281
|
+
startedAt: surveyData.startedAt ? (0, faros_airbyte_cdk_1.toDate)(surveyData.startedAt) : null,
|
|
282
|
+
endedAt: surveyData.endedAt ? (0, faros_airbyte_cdk_1.toDate)(surveyData.endedAt) : null,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
updateSurveyStats(surveyId, questions) {
|
|
286
|
+
const stats = this.surveyStats.get(surveyId) || {
|
|
287
|
+
questionCount: questions.length,
|
|
288
|
+
invitationCount: 0,
|
|
289
|
+
responseCount: 0,
|
|
290
|
+
};
|
|
291
|
+
stats.responseCount += 1;
|
|
292
|
+
this.surveyStats.set(surveyId, stats);
|
|
293
|
+
}
|
|
294
|
+
getFilteredQuestions(row) {
|
|
295
|
+
return Object.keys(row).filter((question) => ![
|
|
296
|
+
this.config.column_names_mapping.survey_name_column_name,
|
|
297
|
+
this.config.column_names_mapping.survey_type_column_name,
|
|
298
|
+
this.config.column_names_mapping.survey_description_column_name,
|
|
299
|
+
this.config.column_names_mapping.survey_started_at_column_name,
|
|
300
|
+
this.config.column_names_mapping.survey_ended_at_column_name,
|
|
301
|
+
this.config.column_names_mapping.survey_status_column_name,
|
|
302
|
+
this.config.column_names_mapping.respondent_name_column_name,
|
|
303
|
+
this.config.column_names_mapping.respondent_email_column_name,
|
|
304
|
+
this.config.column_names_mapping.respondent_team_name_column_name,
|
|
305
|
+
this.config.column_names_mapping.respondent_team_id_column_name,
|
|
306
|
+
].includes(question));
|
|
307
|
+
}
|
|
308
|
+
getSurveyData(row) {
|
|
309
|
+
var _a, _b, _c, _d, _e, _f;
|
|
310
|
+
return {
|
|
311
|
+
name: (_a = row[this.config.column_names_mapping.survey_name_column_name]) !== null && _a !== void 0 ? _a : null,
|
|
312
|
+
type: (_b = row[this.config.column_names_mapping.survey_type_column_name]) !== null && _b !== void 0 ? _b : null,
|
|
313
|
+
description: (_c = row[this.config.column_names_mapping.survey_description_column_name]) !== null && _c !== void 0 ? _c : null,
|
|
314
|
+
startedAt: (_d = row[this.config.column_names_mapping.survey_started_at_column_name]) !== null && _d !== void 0 ? _d : null,
|
|
315
|
+
endedAt: (_e = row[this.config.column_names_mapping.survey_ended_at_column_name]) !== null && _e !== void 0 ? _e : null,
|
|
316
|
+
status: (_f = row[this.config.column_names_mapping.survey_status_column_name]) !== null && _f !== void 0 ? _f : null,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
getSurveyUser(row) {
|
|
320
|
+
var _a;
|
|
321
|
+
const uid = row[this.config.column_names_mapping.respondent_email_column_name];
|
|
322
|
+
if (!uid) {
|
|
323
|
+
return undefined;
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
uid,
|
|
327
|
+
source: this.source,
|
|
328
|
+
email: uid,
|
|
329
|
+
name: (_a = row[this.config.column_names_mapping.respondent_name_column_name]) !== null && _a !== void 0 ? _a : null,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
getSurveyTeam(row) {
|
|
333
|
+
var _a;
|
|
334
|
+
const uid = (_a = row[this.config.column_names_mapping.respondent_team_id_column_name]) !== null && _a !== void 0 ? _a : AbstractSurveys.getTeamUid(row[this.config.column_names_mapping.respondent_team_name_column_name]);
|
|
335
|
+
if (!uid) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
uid,
|
|
340
|
+
source: this.source,
|
|
341
|
+
name: row[this.config.column_names_mapping.respondent_team_name_column_name],
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
static createQuestionUid(surveyId, question) {
|
|
345
|
+
return AbstractSurveys.digest(`${surveyId}-${question}`);
|
|
346
|
+
}
|
|
347
|
+
static getTeamUid(teamName) {
|
|
348
|
+
if (!teamName) {
|
|
349
|
+
return undefined;
|
|
350
|
+
}
|
|
351
|
+
return AbstractSurveys.digest(teamName);
|
|
352
|
+
}
|
|
353
|
+
static digest(input) {
|
|
354
|
+
return (0, crypto_1.createHash)('sha256').update(input).digest('hex');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
exports.AbstractSurveys = AbstractSurveys;
|
|
358
|
+
//# sourceMappingURL=surveys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surveys.js","sourceRoot":"","sources":["../../../src/converters/abstract-surveys/surveys.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAkC;AAClC,yDAAwD;AACxD,qDAAsC;AACtC,oDAAuB;AAEvB,4CAMsB;AACtB,qCAWkB;AA2BlB,MAAsB,eAAgB,SAAQ,qBAAS;IAAvD;;QAUW,sBAAiB,GAAoC;YAC5D,eAAe;YACf,iBAAiB;YACjB,kCAAkC;YAClC,yBAAyB;YACzB,aAAa;YACb,aAAa;YACb,uBAAuB;SACxB,CAAC;QAEM,qBAAgB,GAAgC,IAAI,GAAG,EAAE,CAAC;QAC1D,mBAAc,GAAwB,IAAI,GAAG,EAAE,CAAC;QAChD,gBAAW,GAA6B,IAAI,GAAG,EAAE,CAAC;QAElD,cAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAC9B,cAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAC9B,gBAAW,GAAG,IAAI,GAAG,EAAU,CAAC;QAChC,kBAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QAElC,YAAO,GAAkB,SAAS,CAAC;QACnC,6BAAwB,GAA4B,SA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;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,QAAgB,EAAE,QAAgB;QACzD,OAAO,eAAe,CAAC,MAAM,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,QAAgB;QAChC,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAa;QACzB,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AA9dD,0CA8dC"}
|
|
@@ -1,57 +1,11 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
survey_status_column_name?: string;
|
|
12
|
-
respondent_name_column_name?: string;
|
|
13
|
-
respondent_email_column_name?: string;
|
|
14
|
-
respondent_team_name_column_name?: string;
|
|
15
|
-
respondent_team_id_column_name?: string;
|
|
16
|
-
question_category_column_name?: string;
|
|
17
|
-
response_type_column_name?: string;
|
|
18
|
-
question_column_name?: string;
|
|
19
|
-
};
|
|
20
|
-
export interface SurveysConfig {
|
|
21
|
-
survey_responses_table_name?: string;
|
|
22
|
-
survey_metadata_table_name?: string;
|
|
23
|
-
question_metadata_table_name?: string;
|
|
24
|
-
question_category_mapping?: QuestionCategoryMapping;
|
|
25
|
-
column_names_mapping?: ColumnNameMapping;
|
|
2
|
+
import { AbstractSurveys } from '../abstract-surveys/surveys';
|
|
3
|
+
export declare class Surveys extends AbstractSurveys {
|
|
4
|
+
source: string;
|
|
5
|
+
id(record: AirbyteRecord): any;
|
|
6
|
+
static getBaseId(fqTableId: string): string;
|
|
7
|
+
static getTableName(fqTableName: string): string;
|
|
8
|
+
getSurveyId(record: AirbyteRecord): string | undefined;
|
|
9
|
+
getTableName(record: AirbyteRecord): string | undefined;
|
|
10
|
+
getSubmittedAt(record: AirbyteRecord): string | undefined;
|
|
26
11
|
}
|
|
27
|
-
export declare class Surveys extends AirtableConverter {
|
|
28
|
-
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
29
|
-
private questionMetadata;
|
|
30
|
-
private surveyMetadata;
|
|
31
|
-
private surveyStats;
|
|
32
|
-
private usersSeen;
|
|
33
|
-
private teamsSeen;
|
|
34
|
-
private surveysSeen;
|
|
35
|
-
private questionsSeen;
|
|
36
|
-
private _config;
|
|
37
|
-
private _questionCategoryMapping;
|
|
38
|
-
private initialize;
|
|
39
|
-
private get config();
|
|
40
|
-
private get questionCategoryMapping();
|
|
41
|
-
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
42
|
-
private processQuestionMetadata;
|
|
43
|
-
private processSurveyMetadata;
|
|
44
|
-
private processResponse;
|
|
45
|
-
/** Upsert surveys to add stats and survey questions records to include metadata (question category and response type) **/
|
|
46
|
-
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
47
|
-
private getQuestionWithMetadata;
|
|
48
|
-
private getResponseRecords;
|
|
49
|
-
private getSurveyRecord;
|
|
50
|
-
private updateSurveyStats;
|
|
51
|
-
private getFilteredQuestions;
|
|
52
|
-
private getSurveyData;
|
|
53
|
-
private getSurveyUser;
|
|
54
|
-
private getSurveyTeam;
|
|
55
|
-
static createQuestionUid(surveyId: string, question: string): string;
|
|
56
|
-
}
|
|
57
|
-
export {};
|