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/utils.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AirbyteConfig, AirbyteSpec } from './protocol';
|
|
2
|
+
export declare const PACKAGE_ROOT: string;
|
|
3
|
+
export declare const PACKAGE_VERSION: any;
|
|
4
|
+
/** Redact config of all secret values based on the provided specification */
|
|
5
|
+
export declare function redactConfig(config: AirbyteConfig, spec: AirbyteSpec): string;
|
|
6
|
+
/**
|
|
7
|
+
* Sets all undefined values with defaults from spec to their default value.
|
|
8
|
+
* The changes are made on a copy of the input.
|
|
9
|
+
* */
|
|
10
|
+
export declare function withDefaults<Config extends AirbyteConfig>(config: Config, spec: AirbyteSpec): Config;
|
|
11
|
+
/** Convert a value to Date */
|
|
12
|
+
export declare function toDate(val: Date | string | number | undefined): Date | undefined;
|
|
13
|
+
export declare function base64Encode(str: string): string;
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
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.base64Encode = exports.toDate = exports.withDefaults = exports.redactConfig = exports.PACKAGE_VERSION = exports.PACKAGE_ROOT = void 0;
|
|
7
|
+
const fast_redact_1 = __importDefault(require("fast-redact"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const json_schema_traverse_1 = __importDefault(require("json-schema-traverse"));
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
exports.PACKAGE_ROOT = path_1.default.join(__dirname, '..');
|
|
13
|
+
const packageInfo = JSON.parse(fs_1.default.readFileSync(path_1.default.join(exports.PACKAGE_ROOT, 'package.json'), 'utf8'));
|
|
14
|
+
exports.PACKAGE_VERSION = packageInfo.version;
|
|
15
|
+
/** Redact config of all secret values based on the provided specification */
|
|
16
|
+
function redactConfig(config, spec) {
|
|
17
|
+
var _a;
|
|
18
|
+
const paths = [];
|
|
19
|
+
(0, json_schema_traverse_1.default)((_a = spec.spec.connectionSpecification) !== null && _a !== void 0 ? _a : {}, {
|
|
20
|
+
cb: (schema, pointer) => {
|
|
21
|
+
if (schema.airbyte_secret) {
|
|
22
|
+
paths.push(toPath(pointer));
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const redact = (0, fast_redact_1.default)({ paths, censor: 'REDACTED' });
|
|
27
|
+
return `${redact(config)}`;
|
|
28
|
+
}
|
|
29
|
+
exports.redactConfig = redactConfig;
|
|
30
|
+
function toPath(pointer) {
|
|
31
|
+
return pointer
|
|
32
|
+
.replace(/\/oneOf\/\d+/g, '')
|
|
33
|
+
.replace(/\/items(\/?)/g, '[*]$1')
|
|
34
|
+
.split('/properties/')
|
|
35
|
+
.filter((s) => s)
|
|
36
|
+
.join('.');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sets all undefined values with defaults from spec to their default value.
|
|
40
|
+
* The changes are made on a copy of the input.
|
|
41
|
+
* */
|
|
42
|
+
function withDefaults(config, spec) {
|
|
43
|
+
var _a;
|
|
44
|
+
const defaultsByPath = new Map();
|
|
45
|
+
(0, json_schema_traverse_1.default)((_a = spec.spec.connectionSpecification) !== null && _a !== void 0 ? _a : {}, {
|
|
46
|
+
cb: (schema, pointer) => {
|
|
47
|
+
if (schema.default) {
|
|
48
|
+
defaultsByPath.set(toPath(pointer), schema.default);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
// create a copy of input and apply defaults
|
|
53
|
+
const result = lodash_1.default.cloneDeep(config);
|
|
54
|
+
for (const [path, defaultValue] of defaultsByPath) {
|
|
55
|
+
if (lodash_1.default.get(result, path) === undefined) {
|
|
56
|
+
lodash_1.default.set(result, path, defaultValue);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
exports.withDefaults = withDefaults;
|
|
62
|
+
/** Convert a value to Date */
|
|
63
|
+
function toDate(val) {
|
|
64
|
+
if (typeof val === 'number') {
|
|
65
|
+
return new Date(val);
|
|
66
|
+
}
|
|
67
|
+
if (!val) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return new Date(val);
|
|
71
|
+
}
|
|
72
|
+
exports.toDate = toDate;
|
|
73
|
+
function base64Encode(str) {
|
|
74
|
+
return Buffer.from(str, 'binary').toString('base64');
|
|
75
|
+
}
|
|
76
|
+
exports.base64Encode = base64Encode;
|
|
77
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAqC;AACrC,4CAAoB;AACpB,gFAA4C;AAC5C,oDAAuB;AACvB,gDAAwB;AAIX,QAAA,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAEvD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAY,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CACjE,CAAC;AAEW,QAAA,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC;AAEnD,6EAA6E;AAC7E,SAAgB,YAAY,CAAC,MAAqB,EAAE,IAAiB;;IACnE,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAA,8BAAQ,EAAC,MAAA,IAAI,CAAC,IAAI,CAAC,uBAAuB,mCAAI,EAAE,EAAE;QAChD,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;YACtB,IAAI,MAAM,CA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AAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;SACnC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,oCAoBC;AAED,8BAA8B;AAC9B,SAAgB,MAAM,CACpB,GAAuC;IAEvC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;KACtB;IACD,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAVD,wBAUC;AAED,SAAgB,YAAY,CAAC,GAAW;IACtC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC;AAFD,oCAEC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "faros-airbyte-cdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Airbyte Connector Development Kit (CDK) for JavaScript/TypeScript",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"airbyte",
|
|
7
|
+
"cdk",
|
|
8
|
+
"faros"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://www.faros.ai",
|
|
11
|
+
"author": "Faros AI, Inc.",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"repository": "https://github.com/faros-ai/airbyte-connectors",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/faros-ai/airbyte-connectors/issues"
|
|
16
|
+
},
|
|
17
|
+
"directories": {
|
|
18
|
+
"lib": "lib",
|
|
19
|
+
"test": "test"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"lib/",
|
|
23
|
+
"resources/"
|
|
24
|
+
],
|
|
25
|
+
"main": "./lib",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p src",
|
|
31
|
+
"clean": "rm -rf lib node_modules out",
|
|
32
|
+
"fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts' && npm run lint -- --fix",
|
|
33
|
+
"lint": "eslint 'src/**/*.ts' 'test/**/*.ts'",
|
|
34
|
+
"prepare": "npm run build",
|
|
35
|
+
"test": "jest --verbose --color",
|
|
36
|
+
"test-cov": "jest --coverage --verbose --color",
|
|
37
|
+
"watch": "tsc -b -w src test"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@apidevtools/json-schema-ref-parser": "^9.0.9",
|
|
41
|
+
"commander": "^9.3.0",
|
|
42
|
+
"enquirer": "^2.3.6",
|
|
43
|
+
"fast-redact": "^3.0.2",
|
|
44
|
+
"json-schema-traverse": "^1.0.0",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"pino": "^8.5.0",
|
|
47
|
+
"table": "^6.8.1",
|
|
48
|
+
"verror": "^1.10.1"
|
|
49
|
+
},
|
|
50
|
+
"jest": {
|
|
51
|
+
"coverageDirectory": "out/coverage",
|
|
52
|
+
"coveragePathIgnorePatterns": [
|
|
53
|
+
"<rootDir>/node_modules/",
|
|
54
|
+
"<rootDir>/test/"
|
|
55
|
+
],
|
|
56
|
+
"preset": "ts-jest",
|
|
57
|
+
"testEnvironment": "node",
|
|
58
|
+
"testTimeout": 10000,
|
|
59
|
+
"globals": {
|
|
60
|
+
"ts-jest": {
|
|
61
|
+
"tsconfig": "test/tsconfig.json"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"snapshotFormat": {
|
|
65
|
+
"printBasicPrototype": true,
|
|
66
|
+
"escapeString": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|