faros-airbyte-cdk 0.0.1
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/README.md +5 -0
- package/lib/connector.d.ts +17 -0
- package/lib/connector.js +7 -0
- package/lib/connector.js.map +1 -0
- package/lib/destinations/destination-runner.d.ts +17 -0
- package/lib/destinations/destination-runner.js +151 -0
- package/lib/destinations/destination-runner.js.map +1 -0
- package/lib/destinations/destination.d.ts +13 -0
- package/lib/destinations/destination.js +12 -0
- package/lib/destinations/destination.js.map +1 -0
- package/lib/errors.d.ts +2 -0
- package/lib/errors.js +61 -0
- package/lib/errors.js.map +1 -0
- package/lib/help.d.ts +22 -0
- package/lib/help.js +371 -0
- package/lib/help.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +31 -0
- package/lib/index.js.map +1 -0
- package/lib/logger.d.ts +21 -0
- package/lib/logger.js +100 -0
- package/lib/logger.js.map +1 -0
- package/lib/prompts.d.ts +14 -0
- package/lib/prompts.js +28 -0
- package/lib/prompts.js.map +1 -0
- package/lib/protocol.d.ts +189 -0
- package/lib/protocol.js +181 -0
- package/lib/protocol.js.map +1 -0
- package/lib/runner.d.ts +5 -0
- package/lib/runner.js +18 -0
- package/lib/runner.js.map +1 -0
- package/lib/sources/source-base.d.ts +59 -0
- package/lib/sources/source-base.js +168 -0
- package/lib/sources/source-base.js.map +1 -0
- package/lib/sources/source-runner.d.ts +17 -0
- package/lib/sources/source-runner.js +154 -0
- package/lib/sources/source-runner.js.map +1 -0
- package/lib/sources/source.d.ts +20 -0
- package/lib/sources/source.js +12 -0
- package/lib/sources/source.js.map +1 -0
- package/lib/sources/streams/stream-base.d.ts +94 -0
- package/lib/sources/streams/stream-base.js +139 -0
- package/lib/sources/streams/stream-base.js.map +1 -0
- package/lib/spec-loader.d.ts +4 -0
- package/lib/spec-loader.js +23 -0
- package/lib/spec-loader.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/utils.d.ts +13 -0
- package/lib/utils.js +77 -0
- package/lib/utils.js.map +1 -0
- package/package.json +69 -0
package/lib/help.js
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
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.buildArgs = exports.buildJson = exports.helpTable = exports.traverseObject = void 0;
|
|
7
|
+
const assert_1 = require("assert");
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const lodash_2 = require("lodash");
|
|
10
|
+
const table_1 = require("table");
|
|
11
|
+
const verror_1 = require("verror");
|
|
12
|
+
const prompts_1 = require("./prompts");
|
|
13
|
+
function visitLeaf(o, curPath, section, required = false) {
|
|
14
|
+
var _a;
|
|
15
|
+
const title = o.title || curPath.slice(-1)[0].split('_').map(lodash_2.upperFirst).join(' ');
|
|
16
|
+
const leaf = {
|
|
17
|
+
title,
|
|
18
|
+
path: curPath.join('.'),
|
|
19
|
+
section,
|
|
20
|
+
required,
|
|
21
|
+
description: o.description,
|
|
22
|
+
airbyte_secret: o.airbyte_secret,
|
|
23
|
+
default: o.default,
|
|
24
|
+
constValue: o.const,
|
|
25
|
+
multiline: o.multiline,
|
|
26
|
+
examples: o.examples,
|
|
27
|
+
type: o.type,
|
|
28
|
+
items_type: (_a = o.items) === null || _a === void 0 ? void 0 : _a.type,
|
|
29
|
+
enum: o.enum,
|
|
30
|
+
};
|
|
31
|
+
return leaf;
|
|
32
|
+
}
|
|
33
|
+
function traverseObject(startObject, startPath, section = 1, useDeprecatedFields = false, useHiddenFields = false) {
|
|
34
|
+
function shouldInclude(property) {
|
|
35
|
+
return ((useDeprecatedFields || !property['deprecated']) &&
|
|
36
|
+
(useHiddenFields || !property['airbyte_hidden']));
|
|
37
|
+
}
|
|
38
|
+
const result = [];
|
|
39
|
+
// Queue of objects to process in BFS
|
|
40
|
+
const process = [
|
|
41
|
+
[startObject, startPath, section, false],
|
|
42
|
+
];
|
|
43
|
+
let newIdx = section + 1;
|
|
44
|
+
while (process.length > 0) {
|
|
45
|
+
const [curObject, curPath, idx, req] = process.shift();
|
|
46
|
+
if (curObject['type'] !== 'object') {
|
|
47
|
+
result.push(visitLeaf(curObject, curPath, idx, req));
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
(0, assert_1.ok)(curObject.properties || curObject.oneOf);
|
|
51
|
+
(0, assert_1.ok)(curObject.properties === undefined || curObject.oneOf === undefined);
|
|
52
|
+
(0, assert_1.ok)(curObject.title);
|
|
53
|
+
if (curObject.properties) {
|
|
54
|
+
const children = Object.values(curObject.properties).filter(shouldInclude).length;
|
|
55
|
+
if (!children) {
|
|
56
|
+
result.push({
|
|
57
|
+
title: curObject.title,
|
|
58
|
+
path: curPath.join('.'),
|
|
59
|
+
section: idx,
|
|
60
|
+
description: 'Skip this section',
|
|
61
|
+
required: false,
|
|
62
|
+
type: 'empty_object',
|
|
63
|
+
examples: [],
|
|
64
|
+
});
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
result.push({
|
|
68
|
+
title: curObject.title,
|
|
69
|
+
path: curPath.join('.'),
|
|
70
|
+
section: idx,
|
|
71
|
+
children: lodash_1.default.range(newIdx, newIdx + children),
|
|
72
|
+
oneOf: false,
|
|
73
|
+
description: `Please configure argument${children > 1 ? 's' : ''} ${lodash_1.default.range(newIdx, newIdx + children).join()} as needed`,
|
|
74
|
+
required: req,
|
|
75
|
+
type: 'object',
|
|
76
|
+
examples: [],
|
|
77
|
+
});
|
|
78
|
+
const requiredProperties = curObject.required || [];
|
|
79
|
+
const cmp = function compareFn(a, b) {
|
|
80
|
+
const aOrder = curObject.properties[a]['order'];
|
|
81
|
+
const bOrder = curObject.properties[b]['order'];
|
|
82
|
+
// Properties with 'order' should appear before than
|
|
83
|
+
// those without.
|
|
84
|
+
if (aOrder !== undefined && bOrder === undefined)
|
|
85
|
+
return -1;
|
|
86
|
+
if (aOrder === undefined && bOrder !== undefined)
|
|
87
|
+
return 1;
|
|
88
|
+
// At this point they're both undefined or both
|
|
89
|
+
// with order. Only return if they are not tied.
|
|
90
|
+
if (aOrder !== bOrder)
|
|
91
|
+
return aOrder - bOrder;
|
|
92
|
+
// Break the tie by comparing the property names.
|
|
93
|
+
return a.localeCompare(b);
|
|
94
|
+
};
|
|
95
|
+
for (const propertyName of Object.keys(curObject.properties).sort(cmp)) {
|
|
96
|
+
if (!shouldInclude(curObject.properties[propertyName])) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
process.push([
|
|
100
|
+
curObject.properties[propertyName],
|
|
101
|
+
curPath.concat(propertyName),
|
|
102
|
+
newIdx++,
|
|
103
|
+
requiredProperties.includes(propertyName),
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const children = Object.values(curObject.oneOf).filter(shouldInclude).length;
|
|
109
|
+
(0, assert_1.ok)(children > 0);
|
|
110
|
+
result.push({
|
|
111
|
+
title: curObject.title,
|
|
112
|
+
path: curPath.join('.'),
|
|
113
|
+
section: idx,
|
|
114
|
+
children: lodash_1.default.range(newIdx, newIdx + children),
|
|
115
|
+
oneOf: true,
|
|
116
|
+
description: children > 1
|
|
117
|
+
? `Please select and configure a single argument from ${lodash_1.default.range(newIdx, newIdx + children).join()}`
|
|
118
|
+
: `Please configure argument ${newIdx}`,
|
|
119
|
+
required: req,
|
|
120
|
+
type: 'object',
|
|
121
|
+
examples: [],
|
|
122
|
+
});
|
|
123
|
+
for (const choice of curObject.oneOf) {
|
|
124
|
+
if (!shouldInclude(choice)) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
process.push([choice, curPath, newIdx++, false]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
exports.traverseObject = traverseObject;
|
|
134
|
+
function helpTable(rows) {
|
|
135
|
+
var _a;
|
|
136
|
+
const data = [
|
|
137
|
+
[
|
|
138
|
+
'Section ID',
|
|
139
|
+
'Title',
|
|
140
|
+
'Argument',
|
|
141
|
+
'Description',
|
|
142
|
+
'Required',
|
|
143
|
+
'Constant',
|
|
144
|
+
'Default',
|
|
145
|
+
'Examples',
|
|
146
|
+
],
|
|
147
|
+
];
|
|
148
|
+
const config = {
|
|
149
|
+
columns: {
|
|
150
|
+
1: { width: 15, wrapWord: true },
|
|
151
|
+
2: { width: 15, wrapWord: true },
|
|
152
|
+
3: { width: 30, wrapWord: true },
|
|
153
|
+
7: { width: 20, wrapWord: true },
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
for (const row of rows) {
|
|
157
|
+
data.push([
|
|
158
|
+
row.section,
|
|
159
|
+
row.title,
|
|
160
|
+
row.path,
|
|
161
|
+
row.description || '',
|
|
162
|
+
row.required ? 'Yes' : 'No',
|
|
163
|
+
row.constValue || '',
|
|
164
|
+
(_a = row.default) !== null && _a !== void 0 ? _a : '',
|
|
165
|
+
row.examples ? row.examples.join('\n') : '',
|
|
166
|
+
]);
|
|
167
|
+
}
|
|
168
|
+
return (0, table_1.table)(data, config);
|
|
169
|
+
}
|
|
170
|
+
exports.helpTable = helpTable;
|
|
171
|
+
async function promptOneOf(row, sections) {
|
|
172
|
+
const choices = [];
|
|
173
|
+
if (!row.required) {
|
|
174
|
+
choices.push({
|
|
175
|
+
message: 'Skip this section',
|
|
176
|
+
value: 'Skipped.',
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
for (const child of row.children) {
|
|
180
|
+
choices.push({ message: sections.get(child).title, value: child });
|
|
181
|
+
}
|
|
182
|
+
const choice = await (0, prompts_1.runSelect)({
|
|
183
|
+
name: 'oneOf',
|
|
184
|
+
message: row.title,
|
|
185
|
+
choices,
|
|
186
|
+
});
|
|
187
|
+
if (choice === 'Skipped.') {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
return +choice;
|
|
191
|
+
}
|
|
192
|
+
async function promptValue(row) {
|
|
193
|
+
var _a;
|
|
194
|
+
const type = (_a = row.items_type) !== null && _a !== void 0 ? _a : row.type;
|
|
195
|
+
(0, assert_1.ok)(type);
|
|
196
|
+
const message = row.description
|
|
197
|
+
? `${row.title}: ${row.description}`
|
|
198
|
+
: row.title;
|
|
199
|
+
switch (type) {
|
|
200
|
+
case 'boolean':
|
|
201
|
+
return await (0, prompts_1.runBooleanPrompt)({ message });
|
|
202
|
+
case 'integer':
|
|
203
|
+
return await (0, prompts_1.runNumberPrompt)({ message });
|
|
204
|
+
case 'string':
|
|
205
|
+
if (row.airbyte_secret) {
|
|
206
|
+
return await (0, prompts_1.runPassword)({ name: 'secret', message });
|
|
207
|
+
}
|
|
208
|
+
return await (0, prompts_1.runStringPrompt)({ message });
|
|
209
|
+
}
|
|
210
|
+
throw new verror_1.VError(`Unexpected type: ${type}`);
|
|
211
|
+
}
|
|
212
|
+
function choiceAsType(row, choice) {
|
|
213
|
+
var _a;
|
|
214
|
+
const type = (_a = row.items_type) !== null && _a !== void 0 ? _a : row.type;
|
|
215
|
+
(0, assert_1.ok)(type);
|
|
216
|
+
switch (type) {
|
|
217
|
+
case 'boolean':
|
|
218
|
+
return choice === 'true';
|
|
219
|
+
case 'integer':
|
|
220
|
+
return +choice;
|
|
221
|
+
case 'string':
|
|
222
|
+
return choice;
|
|
223
|
+
}
|
|
224
|
+
throw new verror_1.VError(`Unexpected type: ${type}`);
|
|
225
|
+
}
|
|
226
|
+
function formatArg(row, choice) {
|
|
227
|
+
let formattedChoice = typeof choice === 'string' ? `"${choice}"` : choice;
|
|
228
|
+
if (row.type === 'array') {
|
|
229
|
+
formattedChoice = `'${JSON.stringify(choice)}'`;
|
|
230
|
+
}
|
|
231
|
+
return `${row.path} ${formattedChoice}`;
|
|
232
|
+
}
|
|
233
|
+
async function promptLeaf(row, tail = false) {
|
|
234
|
+
var _a;
|
|
235
|
+
if (row.type === 'empty_object') {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
const choices = [];
|
|
239
|
+
if (row.constValue !== undefined) {
|
|
240
|
+
return row.constValue;
|
|
241
|
+
}
|
|
242
|
+
if (!row.required || tail) {
|
|
243
|
+
choices.push({
|
|
244
|
+
// If `tail` is true, this means we're prompting for the second or later element of an array.
|
|
245
|
+
message: tail ? 'Done' : 'Skip this section',
|
|
246
|
+
value: 'Skipped.',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
const enumChoices = row.enum !== undefined || row.type === 'boolean';
|
|
250
|
+
if (!enumChoices && row.default !== undefined) {
|
|
251
|
+
choices.push({
|
|
252
|
+
message: `Use default (${row.default})`,
|
|
253
|
+
value: 'Used default.',
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (!enumChoices && ((_a = row.examples) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
257
|
+
let idx = 0;
|
|
258
|
+
for (const example of row.examples) {
|
|
259
|
+
idx++;
|
|
260
|
+
choices.push({ message: `example ${idx} (${example})`, value: example });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (row.airbyte_secret || row.multiline) {
|
|
264
|
+
const variableName = row.path
|
|
265
|
+
.split('.')
|
|
266
|
+
.filter((part) => part[0].match(/[a-z]/i))
|
|
267
|
+
.join('_')
|
|
268
|
+
.toUpperCase();
|
|
269
|
+
choices.push({
|
|
270
|
+
message: `Use environment variable ${variableName}`,
|
|
271
|
+
value: `\${${variableName}}`,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
let choice = ' ';
|
|
275
|
+
if (choices.length) {
|
|
276
|
+
if (enumChoices) {
|
|
277
|
+
for (const choice of row.type === 'boolean' ? [false, true] : row.enum) {
|
|
278
|
+
if (row.default === choice) {
|
|
279
|
+
choices.push({
|
|
280
|
+
message: `${row.default} (default)`,
|
|
281
|
+
value: 'Used default.',
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
choices.push({
|
|
286
|
+
message: `${choice}`,
|
|
287
|
+
value: `${choice}`,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
choices.push({
|
|
294
|
+
message: 'Enter your own value',
|
|
295
|
+
value: ' ',
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const message = row.description
|
|
299
|
+
? `${row.title}: ${row.description}`
|
|
300
|
+
: row.title;
|
|
301
|
+
choice = await (0, prompts_1.runSelect)({
|
|
302
|
+
name: 'leaf',
|
|
303
|
+
message,
|
|
304
|
+
choices,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
let result;
|
|
308
|
+
switch (choice) {
|
|
309
|
+
case 'Skipped.':
|
|
310
|
+
return undefined;
|
|
311
|
+
case 'Used default.':
|
|
312
|
+
result = row.default;
|
|
313
|
+
break;
|
|
314
|
+
case ' ':
|
|
315
|
+
result = await promptValue(row);
|
|
316
|
+
break;
|
|
317
|
+
default:
|
|
318
|
+
result = choiceAsType(row, choice);
|
|
319
|
+
}
|
|
320
|
+
if (row.type === 'array') {
|
|
321
|
+
const nextResult = await promptLeaf(row, true);
|
|
322
|
+
return nextResult === undefined ? [result] : [result].concat(nextResult);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async function buildJson(rows) {
|
|
329
|
+
const result = {};
|
|
330
|
+
await acceptUserInput(rows, (row, choice) => lodash_1.default.set(result, row.path, choice));
|
|
331
|
+
return JSON.stringify(result);
|
|
332
|
+
}
|
|
333
|
+
exports.buildJson = buildJson;
|
|
334
|
+
async function buildArgs(rows) {
|
|
335
|
+
const result = [];
|
|
336
|
+
await acceptUserInput(rows, (row, choice) => result.push(formatArg(row, choice)));
|
|
337
|
+
return result.join(' \\\n');
|
|
338
|
+
}
|
|
339
|
+
exports.buildArgs = buildArgs;
|
|
340
|
+
async function acceptUserInput(rows, action) {
|
|
341
|
+
var _a;
|
|
342
|
+
const sections = new Map(rows.map((row) => [row.section, row]));
|
|
343
|
+
// Stack of sections to process in DFS
|
|
344
|
+
const process = [0];
|
|
345
|
+
const processed = [];
|
|
346
|
+
while (process.length) {
|
|
347
|
+
const section = process.pop();
|
|
348
|
+
processed.push(section);
|
|
349
|
+
const row = sections.get(section);
|
|
350
|
+
if ((_a = row.children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
351
|
+
if (row.oneOf) {
|
|
352
|
+
const choice = await promptOneOf(row, sections);
|
|
353
|
+
if (choice) {
|
|
354
|
+
process.push(choice);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
for (let idx = row.children.length - 1; idx >= 0; idx--) {
|
|
359
|
+
process.push(row.children[idx]);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
const choice = await promptLeaf(row);
|
|
365
|
+
if (choice !== undefined) {
|
|
366
|
+
action(row, choice);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=help.js.map
|
package/lib/help.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA0B;AAC1B,oDAAuB;AACvB,mCAAkC;AAClC,iCAA4B;AAE5B,mCAA8B;AAE9B,uCAMmB;AAoBnB,SAAS,SAAS,CAChB,CAAkB,EAClB,OAAiB,EACjB,OAAe,EACf,QAAQ,GAAG,KAAK;;IAEhB,MAAM,KAAK,GACT,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,mBAAU,CAAC,CAAC,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AAC,CAAC;QAClC,IAAI,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,EAAE;YACxB,IAAI,GAAG,CAAC,KAAK,EAAE;gBACb,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBAChD,IAAI,MAAM,EAAE;oBACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBACtB;aACF;iBAAM;gBACL,KAAK,IAAI,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE;oBACvD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;iBACjC;aACF;SACF;aAAM;YACL,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,MAAM,KAAK,SAAS,EAAE;gBACxB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;aACrB;SACF;KACF;AACH,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './destinations/destination';
|
|
2
|
+
export * from './destinations/destination-runner';
|
|
3
|
+
export { wrapApiError } from './errors';
|
|
4
|
+
export * from './help';
|
|
5
|
+
export * from './logger';
|
|
6
|
+
export * from './protocol';
|
|
7
|
+
export * from './sources/source-base';
|
|
8
|
+
export * from './sources/source';
|
|
9
|
+
export * from './sources/source-runner';
|
|
10
|
+
export * from './sources/streams/stream-base';
|
|
11
|
+
export * from './spec-loader';
|
|
12
|
+
export * from './utils';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.wrapApiError = void 0;
|
|
18
|
+
__exportStar(require("./destinations/destination"), exports);
|
|
19
|
+
__exportStar(require("./destinations/destination-runner"), exports);
|
|
20
|
+
var errors_1 = require("./errors");
|
|
21
|
+
Object.defineProperty(exports, "wrapApiError", { enumerable: true, get: function () { return errors_1.wrapApiError; } });
|
|
22
|
+
__exportStar(require("./help"), exports);
|
|
23
|
+
__exportStar(require("./logger"), exports);
|
|
24
|
+
__exportStar(require("./protocol"), exports);
|
|
25
|
+
__exportStar(require("./sources/source-base"), exports);
|
|
26
|
+
__exportStar(require("./sources/source"), exports);
|
|
27
|
+
__exportStar(require("./sources/source-runner"), exports);
|
|
28
|
+
__exportStar(require("./sources/streams/stream-base"), exports);
|
|
29
|
+
__exportStar(require("./spec-loader"), exports);
|
|
30
|
+
__exportStar(require("./utils"), exports);
|
|
31
|
+
//# 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,6DAA2C;AAC3C,oEAAkD;AAClD,mCAAsC;AAA9B,sGAAA,YAAY,OAAA;AACpB,yCAAuB;AACvB,2CAAyB;AACzB,6CAA2B;AAC3B,wDAAsC;AACtC,mDAAiC;AACjC,0DAAwC;AACxC,gEAA8C;AAC9C,gDAA8B;AAC9B,0CAAwB"}
|
package/lib/logger.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Level, Logger } from 'pino';
|
|
2
|
+
import { AirbyteLogLevel, AirbyteMessage, AirbyteTraceFailureType } from './protocol';
|
|
3
|
+
export declare class AirbyteLogger {
|
|
4
|
+
private level;
|
|
5
|
+
constructor(level?: AirbyteLogLevel);
|
|
6
|
+
error(message: string, stack_trace?: string): void;
|
|
7
|
+
warn(message: string, stack_trace?: string): void;
|
|
8
|
+
info(message: string, stack_trace?: string): void;
|
|
9
|
+
debug(message: string, stack_trace?: string): void;
|
|
10
|
+
trace(message: string, stack_trace?: string): void;
|
|
11
|
+
traceError(error: any, failure_type?: AirbyteTraceFailureType): void;
|
|
12
|
+
write(msg: AirbyteMessage): void;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Pino Logger writing messages in Airbyte format
|
|
15
|
+
*
|
|
16
|
+
* @param level logging level
|
|
17
|
+
* @returns Pino Logger
|
|
18
|
+
*/
|
|
19
|
+
asPino(level?: Level): Logger;
|
|
20
|
+
private static writeMessage;
|
|
21
|
+
}
|
package/lib/logger.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
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.AirbyteLogger = void 0;
|
|
7
|
+
const pino_1 = __importDefault(require("pino"));
|
|
8
|
+
const stream_1 = __importDefault(require("stream"));
|
|
9
|
+
const protocol_1 = require("./protocol");
|
|
10
|
+
class AirbyteLogger {
|
|
11
|
+
constructor(level) {
|
|
12
|
+
this.level = protocol_1.AirbyteLogLevel.INFO;
|
|
13
|
+
if (level) {
|
|
14
|
+
this.level = level;
|
|
15
|
+
}
|
|
16
|
+
else if (process.env.LOG_LEVEL &&
|
|
17
|
+
protocol_1.AirbyteLogLevel[process.env.LOG_LEVEL.toUpperCase()]) {
|
|
18
|
+
this.level = protocol_1.AirbyteLogLevel[process.env.LOG_LEVEL.toUpperCase()];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
error(message, stack_trace) {
|
|
22
|
+
this.write(protocol_1.AirbyteLog.make(protocol_1.AirbyteLogLevel.ERROR, message, stack_trace));
|
|
23
|
+
}
|
|
24
|
+
warn(message, stack_trace) {
|
|
25
|
+
this.write(protocol_1.AirbyteLog.make(protocol_1.AirbyteLogLevel.WARN, message, stack_trace));
|
|
26
|
+
}
|
|
27
|
+
info(message, stack_trace) {
|
|
28
|
+
this.write(protocol_1.AirbyteLog.make(protocol_1.AirbyteLogLevel.INFO, message, stack_trace));
|
|
29
|
+
}
|
|
30
|
+
debug(message, stack_trace) {
|
|
31
|
+
this.write(protocol_1.AirbyteLog.make(protocol_1.AirbyteLogLevel.DEBUG, message, stack_trace));
|
|
32
|
+
}
|
|
33
|
+
trace(message, stack_trace) {
|
|
34
|
+
this.write(protocol_1.AirbyteLog.make(protocol_1.AirbyteLogLevel.TRACE, message, stack_trace));
|
|
35
|
+
}
|
|
36
|
+
traceError(error, failure_type) {
|
|
37
|
+
this.write(protocol_1.AirbyteTrace.make(error, failure_type));
|
|
38
|
+
}
|
|
39
|
+
write(msg) {
|
|
40
|
+
AirbyteLogger.writeMessage(msg, this.level);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a Pino Logger writing messages in Airbyte format
|
|
44
|
+
*
|
|
45
|
+
* @param level logging level
|
|
46
|
+
* @returns Pino Logger
|
|
47
|
+
*/
|
|
48
|
+
asPino(level = 'info') {
|
|
49
|
+
const defaultLevel = protocol_1.AirbyteLogLevel[level.toUpperCase()];
|
|
50
|
+
const destination = new stream_1.default.Writable({
|
|
51
|
+
write: function (chunk, encoding, next) {
|
|
52
|
+
const msg = JSON.parse(chunk);
|
|
53
|
+
const lvl = msg.level
|
|
54
|
+
? protocol_1.AirbyteLogLevel[pino_1.default.levels.labels[msg.level].toUpperCase()]
|
|
55
|
+
: defaultLevel;
|
|
56
|
+
AirbyteLogger.writeMessage(protocol_1.AirbyteLog.make(lvl, msg.msg), defaultLevel);
|
|
57
|
+
next();
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const logger = (0, pino_1.default)({ level }, destination);
|
|
61
|
+
return logger;
|
|
62
|
+
}
|
|
63
|
+
static writeMessage(msg, level) {
|
|
64
|
+
if (msg.type === protocol_1.AirbyteMessageType.LOG) {
|
|
65
|
+
const levelOrder = (0, protocol_1.AirbyteLogLevelOrder)(level);
|
|
66
|
+
const msgLevelOrder = (0, protocol_1.AirbyteLogLevelOrder)(msg.log.level);
|
|
67
|
+
if (levelOrder > msgLevelOrder)
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
console.log(JSON.stringify(msg.type === protocol_1.AirbyteMessageType.RECORD
|
|
71
|
+
? prepareAirbyteRecord(msg)
|
|
72
|
+
: msg));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.AirbyteLogger = AirbyteLogger;
|
|
76
|
+
function prepareAirbyteRecord(record) {
|
|
77
|
+
return new protocol_1.AirbyteRecord({
|
|
78
|
+
stream: record.record.stream,
|
|
79
|
+
namespace: record.record.namespace,
|
|
80
|
+
emitted_at: record.record.emitted_at,
|
|
81
|
+
data: replaceUndefinedWithNull(record.record.data),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// convert undefined record values to nulls so they are stringified
|
|
85
|
+
function replaceUndefinedWithNull(obj) {
|
|
86
|
+
const result = {};
|
|
87
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
88
|
+
if (typeof value === 'object' &&
|
|
89
|
+
!Array.isArray(value) &&
|
|
90
|
+
!(value instanceof Date) &&
|
|
91
|
+
value !== null) {
|
|
92
|
+
result[key] = replaceUndefinedWithNull(value);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
result[key] = value === undefined ? null : value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;;;;AACA,gDAA4D;AAC5D,oDAA4B;AAG5B,yCASoB;AAEpB,MAAa,aAAa;IAGxB,YAAY,KAAuB;QAF3B,UAAK,GAAG,0BAAe,CAAC,IAAI,CAAC;QAGnC,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;aAAM,IACL,OAAO,CAAC,GAAG,CAAC,SAAS;YACrB,0BAAe,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EACpD;YACA,IAAI,CAAC,KAAK,GAAG,0BAAe,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;SACnE;IACH,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,WAAoB;QACzC,IAAI,CAAC,KAAK,CAAC,qBAAU,CAAC,IAAI,CAAC,0BAAe,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,WAAoB;QACxC,IAAI,CAAC,KAAK,CAAC,qBAAU,CAAC,IAAI,CAAC,0BAAe,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,WAAoB;QACxC,IAAI,CAAC,KAAK,CAAC,qBAAU,CAAC,IAAI,CAAC,0BAAe,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,OAAe,EAA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KAAK,YAAY,IAAI,CAAC;YACxB,KAAK,KAAK,IAAI,EACd;YACA,MAAM,CAAC,GAAG,CAAC,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;SAC/C;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;SAClD;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/prompts.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SelectConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
message: string;
|
|
4
|
+
choices: ReadonlyArray<any>;
|
|
5
|
+
}
|
|
6
|
+
export declare function runSelect(cfg: SelectConfig): Promise<string>;
|
|
7
|
+
export interface PasswordConfig {
|
|
8
|
+
name: string;
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function runPassword(cfg: PasswordConfig): Promise<string>;
|
|
12
|
+
export declare function runBooleanPrompt(cfg: any): Promise<boolean>;
|
|
13
|
+
export declare function runNumberPrompt(cfg: any): Promise<number>;
|
|
14
|
+
export declare function runStringPrompt(cfg: any): Promise<string>;
|
package/lib/prompts.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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.runStringPrompt = exports.runNumberPrompt = exports.runBooleanPrompt = exports.runPassword = exports.runSelect = void 0;
|
|
7
|
+
const enquirer_1 = __importDefault(require("enquirer"));
|
|
8
|
+
function runSelect(cfg) {
|
|
9
|
+
return new enquirer_1.default.Select(cfg).run();
|
|
10
|
+
}
|
|
11
|
+
exports.runSelect = runSelect;
|
|
12
|
+
function runPassword(cfg) {
|
|
13
|
+
return new enquirer_1.default.Password(cfg).run();
|
|
14
|
+
}
|
|
15
|
+
exports.runPassword = runPassword;
|
|
16
|
+
function runBooleanPrompt(cfg) {
|
|
17
|
+
return new enquirer_1.default.BooleanPrompt(cfg).run();
|
|
18
|
+
}
|
|
19
|
+
exports.runBooleanPrompt = runBooleanPrompt;
|
|
20
|
+
function runNumberPrompt(cfg) {
|
|
21
|
+
return new enquirer_1.default.NumberPrompt(cfg).run();
|
|
22
|
+
}
|
|
23
|
+
exports.runNumberPrompt = runNumberPrompt;
|
|
24
|
+
function runStringPrompt(cfg) {
|
|
25
|
+
return new enquirer_1.default.StringPrompt(cfg).run();
|
|
26
|
+
}
|
|
27
|
+
exports.runStringPrompt = runStringPrompt;
|
|
28
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAQhC,SAAgB,SAAS,CAAC,GAAiB;IACzC,OAAO,IAAK,kBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACjD,CAAC;AAFD,8BAEC;AAOD,SAAgB,WAAW,CAAC,GAAmB;IAC7C,OAAO,IAAK,kBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACnD,CAAC;AAFD,kCAEC;AAED,SAAgB,gBAAgB,CAAC,GAAQ;IACvC,OAAO,IAAK,kBAAgB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,OAAO,IAAK,kBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACvD,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,OAAO,IAAK,kBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACvD,CAAC;AAFD,0CAEC"}
|