@forzalabs/remora 0.0.13 → 0.0.15

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/Constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const CONSTANTS = {
4
- cliVersion: '0.0.1',
4
+ cliVersion: '0.0.15',
5
5
  lambdaVersion: 1,
6
6
  port: 5069
7
7
  };
package/actions/init.js CHANGED
@@ -32,7 +32,7 @@ const init = () => __awaiter(void 0, void 0, void 0, function* () {
32
32
  const defaultSource = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../documentation/default_resources/source.json`), 'utf-8');
33
33
  const defaultConsumer = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../documentation/default_resources/consumer.json`), 'utf-8');
34
34
  const defaultProducer = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../documentation/default_resources/producer.json`), 'utf-8');
35
- const defaultSchema = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../documentation/default_resources/schema.json`), 'utf-8');
35
+ // const defaultSchema = fs.readFileSync(path.join(__dirname, `../documentation/default_resources/schema.json`), 'utf-8')
36
36
  const defaultRemoraProject = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../documentation/default_resources/project.json`), 'utf-8');
37
37
  const readme = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../documentation/README.md`), 'utf-8');
38
38
  const files = [
@@ -43,7 +43,6 @@ const init = () => __awaiter(void 0, void 0, void 0, function* () {
43
43
  { path: 'remora/producers/.gitkeep', content: '' },
44
44
  { path: 'remora/producers/default-producer.json', content: defaultProducer },
45
45
  { path: 'remora/schemas/.gitkeep', content: '' },
46
- { path: 'remora/schemas/default-schemas.json', content: defaultSchema },
47
46
  { path: 'remora/project.json', content: defaultRemoraProject },
48
47
  { path: 'remora/README.md', content: readme }
49
48
  ];
@@ -41,14 +41,65 @@
41
41
  "implicit"
42
42
  ],
43
43
  "description": "The authentication method to use"
44
+ },
45
+ "host": {
46
+ "type": "string",
47
+ "description": "Hostname or endpoint of the data source"
48
+ },
49
+ "user": {
50
+ "type": "string",
51
+ "description": "Username for authentication"
52
+ },
53
+ "password": {
54
+ "type": "string",
55
+ "description": "Password for authentication"
56
+ },
57
+ "database": {
58
+ "type": "string",
59
+ "description": "Database name"
60
+ },
61
+ "workgroup": {
62
+ "type": "string",
63
+ "description": "Workgroup name"
64
+ },
65
+ "schema": {
66
+ "type": "string",
67
+ "description": "Database schema name"
68
+ },
69
+ "port": {
70
+ "type": "string",
71
+ "description": "Port number for the connection"
72
+ },
73
+ "accessKey": {
74
+ "type": "string",
75
+ "description": "AWS access key ID"
76
+ },
77
+ "secretKey": {
78
+ "type": "string",
79
+ "description": "AWS secret access key"
80
+ },
81
+ "sessionToken": {
82
+ "type": "string",
83
+ "description": "AWS session token (if required)"
84
+ },
85
+ "region": {
86
+ "type": "string",
87
+ "description": "AWS region"
88
+ },
89
+ "bucket": {
90
+ "type": "string",
91
+ "description": "S3 bucket name"
92
+ },
93
+ "iamProfile": {
94
+ "type": "string",
95
+ "description": "IAM role or profile name"
96
+ },
97
+ "clusterId": {
98
+ "type": "string",
99
+ "description": "Redshift cluster identifier"
44
100
  }
45
101
  },
46
- "required": [
47
- "method"
48
- ],
49
- "additionalProperties": {
50
- "type": "string"
51
- }
102
+ "required": ["method"]
52
103
  },
53
104
  "_version": {
54
105
  "type": "number",
@@ -72,7 +123,7 @@
72
123
  "host": "prod-db.example.com",
73
124
  "user": "app_user",
74
125
  "password": "password123",
75
- "dbName": "customers",
126
+ "database": "customers",
76
127
  "schema": "public",
77
128
  "port": "5432"
78
129
  },
@@ -97,7 +148,7 @@
97
148
  "authentication": {
98
149
  "method": "iam",
99
150
  "host": "redshift-cluster.region.redshift.amazonaws.com",
100
- "dbName": "analytics",
151
+ "database": "analytics",
101
152
  "port": "5439",
102
153
  "iamProfile": "redshift-access-role",
103
154
  "region": "us-west-2",
@@ -3,6 +3,15 @@
3
3
  This README explains the available configurations for each resource type in the project.
4
4
  Each section details the expected values for different keys in the JSON files.
5
5
 
6
+ ## JSON Schemas
7
+
8
+ All configuration files follow specific JSON schemas to ensure consistency and validation. You can find the schema definitions at the following URLs:
9
+
10
+ - **Source**: [source-schema.json](https://raw.githubusercontent.com/ForzaLabs/remora-public/refs/heads/main/json_schemas/source-schema.json)
11
+ - **Producer**: [producer-schema.json](https://raw.githubusercontent.com/ForzaLabs/remora-public/refs/heads/main/json_schemas/producer-schema.json)
12
+ - **Consumer**: [consumer-schema.json](https://raw.githubusercontent.com/ForzaLabs/remora-public/refs/heads/main/json_schemas/consumer-schema.json)
13
+ - **Project**: [project-schema.json](https://raw.githubusercontent.com/ForzaLabs/remora-public/refs/heads/main/json_schemas/project-schema.json)
14
+
6
15
  ## Remora Configuration
7
16
 
8
17
  The main project configuration file.
@@ -29,13 +29,13 @@
29
29
  }
30
30
  ],
31
31
  "outputs": [
32
- { "format": "<api | json | csv | parquet | sql>" },
32
+ { "format": "<api | sql>" },
33
33
  {
34
- "format": "<json | csv | parquet | sql>",
34
+ "format": "<json | csv | parquet>",
35
35
  "exportDestination": "<export destination>"
36
36
  },
37
37
  {
38
- "format": "<csv>",
38
+ "format": "<csv | json>",
39
39
  "exportDestination": "<export destination>",
40
40
  "trigger": {
41
41
  "type": "<cron | api>",
@@ -58,7 +58,6 @@ class RedshiftDriver {
58
58
  const executeStatementRes = yield this._client.executeStatement(input);
59
59
  const queryId = (_a = executeStatementRes.Id) !== null && _a !== void 0 ? _a : '';
60
60
  const res = (yield this.executeStatement(queryId, { retry: 5 }))[0];
61
- console.log(res);
62
61
  return {
63
62
  rows: res.result
64
63
  };
@@ -77,7 +76,6 @@ class RedshiftDriver {
77
76
  const queryId = (_b = executeStatementRes.Id) !== null && _b !== void 0 ? _b : '';
78
77
  // TODO: handle errors (permission, wrong query, ...)
79
78
  const res = (yield this.executeStatement(queryId, { retry: 5 }))[0];
80
- console.log(res);
81
79
  return {
82
80
  rows: res.result
83
81
  };
@@ -18,7 +18,7 @@ const SecretManager_1 = __importDefault(require("../engines/SecretManager"));
18
18
  class S3Driver {
19
19
  constructor() {
20
20
  this.init = (source) => __awaiter(this, void 0, void 0, function* () {
21
- this._bucketName = source.authentication['bucketName'];
21
+ this._bucketName = source.authentication['bucket'];
22
22
  const sessionToken = SecretManager_1.default.replaceSecret(source.authentication['sessionToken']);
23
23
  const config = {
24
24
  region: source.authentication['region'],
@@ -26,7 +26,7 @@ const SecretManager_1 = __importDefault(require("../engines/SecretManager"));
26
26
  class S3SourceDriver {
27
27
  constructor() {
28
28
  this.init = (source) => __awaiter(this, void 0, void 0, function* () {
29
- this._bucketName = source.authentication['bucketName'];
29
+ this._bucketName = source.authentication['bucket'];
30
30
  const sessionToken = SecretManager_1.default.replaceSecret(source.authentication['sessionToken']);
31
31
  const config = {
32
32
  region: source.authentication['region'],
@@ -37,6 +37,7 @@ class DeveloperEngineClass {
37
37
  measures: [],
38
38
  _version: (_a = producer._version) !== null && _a !== void 0 ? _a : 1
39
39
  };
40
+ mappedProducer['$schema'] = producer['$schema'];
40
41
  // Save the mapped producer to file
41
42
  const producerPath = path_1.default.join(process.cwd(), 'remora', 'producers', `${producer.name}.json`);
42
43
  yield promises_1.default.writeFile(producerPath, JSON.stringify(mappedProducer, null, 4), 'utf-8');
@@ -68,7 +68,7 @@ class FileExporterClass {
68
68
  for (let i = 0; i < data.length; i++) {
69
69
  const row = data[i];
70
70
  const columns = keys.map(key => row[key]);
71
- const rowValues = columns.map(c => Algo_1.default.replaceAll(c.toString(), '"', '""')).map(c => `"${c}"`).join(',');
71
+ const rowValues = columns.map(c => { var _a; return Algo_1.default.replaceAll((_a = c === null || c === void 0 ? void 0 : c.toString()) !== null && _a !== void 0 ? _a : '', '"', '""'); }).map(c => `"${c}"`).join(',');
72
72
  lines.push(rowValues);
73
73
  }
74
74
  const csv = lines.join('\n');
@@ -105,7 +105,8 @@ class FileExporterClass {
105
105
  }
106
106
  case 'aws-s3': {
107
107
  const driver = yield DriverFactory_1.default.instantiateDestination(source);
108
- const res = yield driver.uploadFile({ content: exportData, name: `${consumer.name}_${DSTE_1.default.now().toJSON()}` });
108
+ const date = DSTE_1.default.now().toISOString().split('.')[0];
109
+ const res = yield driver.uploadFile({ content: exportData, name: `${consumer.name}_${date}.${extension}` });
109
110
  return res.key;
110
111
  }
111
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forzalabs/remora",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "A powerful CLI tool for seamless data translation.",
5
5
  "main": "index.js",
6
6
  "private": false,