@forzalabs/remora 0.0.12

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.
Files changed (85) hide show
  1. package/Constants.js +8 -0
  2. package/actions/automap.js +73 -0
  3. package/actions/compile.js +57 -0
  4. package/actions/debug.js +61 -0
  5. package/actions/deploy.js +95 -0
  6. package/actions/discover.js +36 -0
  7. package/actions/init.js +78 -0
  8. package/actions/run.js +51 -0
  9. package/auth/AdminManager.js +48 -0
  10. package/auth/ApiKeysManager.js +45 -0
  11. package/auth/JWTManager.js +56 -0
  12. package/core/Affirm.js +42 -0
  13. package/core/Algo.js +155 -0
  14. package/core/dste/DSTE.js +113 -0
  15. package/core/logger/DebugLogService.js +48 -0
  16. package/core/logger/DevelopmentLogService.js +70 -0
  17. package/core/logger/LocalLogService.js +70 -0
  18. package/core/logger/Logger.js +54 -0
  19. package/database/DatabaseEngine.js +119 -0
  20. package/database/DatabaseInitializer.js +80 -0
  21. package/database/DatabaseStructure.js +27 -0
  22. package/definitions/agents/DestinationDriver.js +2 -0
  23. package/definitions/agents/SourceDriver.js +2 -0
  24. package/definitions/cli.js +2 -0
  25. package/definitions/database/ApiKeys.js +2 -0
  26. package/definitions/database/Stored.js +7 -0
  27. package/definitions/database/UsageStat.js +2 -0
  28. package/definitions/database/User.js +2 -0
  29. package/definitions/json_schemas/consumer-schema.json +423 -0
  30. package/definitions/json_schemas/producer-schema.json +236 -0
  31. package/definitions/json_schemas/project-schema.json +59 -0
  32. package/definitions/json_schemas/source-schema.json +109 -0
  33. package/definitions/requests/ConsumerRequest.js +2 -0
  34. package/definitions/requests/Developer.js +2 -0
  35. package/definitions/requests/Mapping.js +2 -0
  36. package/definitions/requests/ProducerRequest.js +2 -0
  37. package/definitions/requests/Request.js +2 -0
  38. package/definitions/resources/Compiled.js +2 -0
  39. package/definitions/resources/Consumer.js +2 -0
  40. package/definitions/resources/Environment.js +2 -0
  41. package/definitions/resources/Library.js +2 -0
  42. package/definitions/resources/Producer.js +2 -0
  43. package/definitions/resources/Project.js +2 -0
  44. package/definitions/resources/Schema.js +2 -0
  45. package/definitions/resources/Source.js +2 -0
  46. package/documentation/README.md +123 -0
  47. package/documentation/default_resources/consumer.json +52 -0
  48. package/documentation/default_resources/producer.json +32 -0
  49. package/documentation/default_resources/project.json +14 -0
  50. package/documentation/default_resources/schema.json +36 -0
  51. package/documentation/default_resources/source.json +15 -0
  52. package/drivers/DriverFactory.js +56 -0
  53. package/drivers/LocalDriver.js +122 -0
  54. package/drivers/RedshiftDriver.js +179 -0
  55. package/drivers/S3Driver.js +47 -0
  56. package/drivers/S3SourceDriver.js +127 -0
  57. package/engines/CryptoEngine.js +46 -0
  58. package/engines/Environment.js +139 -0
  59. package/engines/ParseManager.js +38 -0
  60. package/engines/ProducerEngine.js +150 -0
  61. package/engines/UsageManager.js +61 -0
  62. package/engines/UserManager.js +43 -0
  63. package/engines/Validator.js +154 -0
  64. package/engines/ai/AutoMapperEngine.js +37 -0
  65. package/engines/ai/DeveloperEngine.js +70 -0
  66. package/engines/ai/LLM.js +299 -0
  67. package/engines/consumer/ConsumerEngine.js +204 -0
  68. package/engines/consumer/ConsumerManager.js +155 -0
  69. package/engines/consumer/PostProcessor.js +143 -0
  70. package/engines/deployment/DeploymentPlanner.js +46 -0
  71. package/engines/execution/ExecutionEnvironment.js +114 -0
  72. package/engines/execution/ExecutionPlanner.js +92 -0
  73. package/engines/execution/RequestExecutor.js +100 -0
  74. package/engines/file/FileCompiler.js +28 -0
  75. package/engines/file/FileExporter.js +116 -0
  76. package/engines/schema/SchemaEngine.js +33 -0
  77. package/engines/schema/SchemaValidator.js +67 -0
  78. package/engines/sql/SQLBuilder.js +96 -0
  79. package/engines/sql/SQLCompiler.js +140 -0
  80. package/engines/sql/SQLUtils.js +22 -0
  81. package/engines/validation/Validator.js +151 -0
  82. package/helper/Helper.js +64 -0
  83. package/helper/Settings.js +13 -0
  84. package/index.js +63 -0
  85. package/package.json +77 -0
@@ -0,0 +1,64 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const fs = __importStar(require("fs"));
37
+ const path = __importStar(require("path"));
38
+ const uuid_1 = require("uuid");
39
+ const Helper = {
40
+ isDev: () => !process.env.AWS_LAMBDA_INITIALIZATION_TYPE,
41
+ uuid: () => (0, uuid_1.v4)(),
42
+ asError: (error) => error instanceof Error ? error : new Error(error),
43
+ readFile: (directory) => {
44
+ const functionFiles = [];
45
+ function read(directory) {
46
+ const files = fs.readdirSync(directory);
47
+ files.forEach(filename => {
48
+ const fullPath = path.join(directory, filename);
49
+ if (fs.statSync(fullPath).isDirectory()) {
50
+ read(fullPath);
51
+ }
52
+ else if (filename.endsWith('.json')) {
53
+ functionFiles.push({
54
+ name: path.parse(filename).name,
55
+ relativePath: directory
56
+ });
57
+ }
58
+ });
59
+ }
60
+ read(directory);
61
+ return functionFiles;
62
+ }
63
+ };
64
+ exports.default = Helper;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const SETTINGS = {
4
+ db: {
5
+ name: 'remora-db',
6
+ collections: {
7
+ usage: 'usage',
8
+ users: 'users',
9
+ apiKeys: 'apiKeys'
10
+ }
11
+ }
12
+ };
13
+ exports.default = SETTINGS;
package/index.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const dotenv_1 = __importDefault(require("dotenv"));
9
+ const compile_1 = require("./actions/compile");
10
+ const debug_1 = require("./actions/debug");
11
+ const deploy_1 = require("./actions/deploy");
12
+ const init_1 = require("./actions/init");
13
+ const run_1 = require("./actions/run");
14
+ const Constants_1 = __importDefault(require("./Constants"));
15
+ const discover_1 = require("./actions/discover");
16
+ const automap_1 = require("./actions/automap");
17
+ dotenv_1.default.configDotenv();
18
+ const program = new commander_1.Command();
19
+ program
20
+ .version(Constants_1.default.cliVersion + '', '-v, --version', 'Display the version of the CLI')
21
+ .description('CLI tool for setting up and managing Data-Remora');
22
+ program
23
+ .command('version')
24
+ .description('Display the version of the CLI')
25
+ .action(() => {
26
+ const packageJson = require('../package.json');
27
+ console.log(`Data-Remora CLI version: ${packageJson.version}`);
28
+ });
29
+ program
30
+ .command('init')
31
+ .description('Initialize the application and set up configuration')
32
+ .action(init_1.init);
33
+ program
34
+ .command('compile')
35
+ .description('Compile the config and check for errors')
36
+ .action(compile_1.compile);
37
+ program
38
+ .command('debug')
39
+ .description('Check the connection with sources and producers')
40
+ .action(debug_1.debug);
41
+ program
42
+ .command('deploy')
43
+ .description('Deploy the application to the specified environment')
44
+ .option('-e, --env <environment>', 'Target environment (staging, production)', 'staging')
45
+ .option('--skip-tests', 'Skip running tests before deployment')
46
+ .option('--build-only', 'Build without deploying')
47
+ .action(deploy_1.deploy);
48
+ program
49
+ .command('run [consumersName]')
50
+ .description('Execute consumers. Optionally specify a single consumers name to run.')
51
+ .action(run_1.run);
52
+ program
53
+ .command('discover')
54
+ .description('Discover the data shape of a producer and automatically create the resource for it.')
55
+ .argument('<producer>', 'The producer to discover')
56
+ .action(discover_1.discover);
57
+ program
58
+ .command('automap')
59
+ .description('Automatically map a producer to consumers using specified schemas.')
60
+ .argument('<producer>', 'The producer to analyze')
61
+ .argument('<schemas...>', 'One or more schema names to map against')
62
+ .action(automap_1.automap);
63
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@forzalabs/remora",
3
+ "version": "0.0.12",
4
+ "description": "Your Next.js and Node.js application with TypeScript CLI",
5
+ "main": "index.js",
6
+ "private": false,
7
+ "bin": {
8
+ "remora": "index.js"
9
+ },
10
+ "scripts": {
11
+ "sync": "cd ../dev_ops && npm run sync",
12
+ "init": "npx tsx ./src/index.ts init",
13
+ "version": "npx tsx ./src/index.ts -v",
14
+ "run": "npx tsx ./src/index.ts run",
15
+ "discover": "npx tsx ./src/index.ts discover",
16
+ "compile": "npx tsx ./src/index.ts compile",
17
+ "deploy": "npx tsx ./src/index.ts deploy",
18
+ "debug": "npx tsx ./src/index.ts debug",
19
+ "automap": "npx tsx ./src/index.ts automap",
20
+ "copy-static-file": "npx tsx ./scripts/CopyStaticFile.js",
21
+ "build": "npm i && npm run sync && tsc --outDir .build && npm run copy-static-file",
22
+ "upload": "npm run build && cd .build && npm publish --access=public"
23
+ },
24
+ "keywords": [
25
+ "nextjs",
26
+ "nodejs",
27
+ "cli",
28
+ "typescript"
29
+ ],
30
+ "author": "",
31
+ "license": "ISC",
32
+ "dependencies": {
33
+ "@aws-sdk/client-redshift-data": "^3.699.0",
34
+ "@aws-sdk/client-s3": "^3.701.0",
35
+ "adm-zip": "^0.5.16",
36
+ "ajv": "^8.17.1",
37
+ "ajv-formats": "^3.0.1",
38
+ "bcrypt": "^5.1.1",
39
+ "bcryptjs": "^3.0.2",
40
+ "chalk": "^4.1.2",
41
+ "commander": "^10.0.0",
42
+ "cross-env": "^7.0.3",
43
+ "dotenv": "^16.0.3",
44
+ "fs-extra": "^11.1.0",
45
+ "inquirer": "^8.2.5",
46
+ "json-schema": "^0.4.0",
47
+ "jsonwebtoken": "^9.0.2",
48
+ "knex": "^2.4.2",
49
+ "mongodb": "^6.15.0",
50
+ "next": "^13.4.1",
51
+ "openai": "^4.91.1",
52
+ "ora": "^5.4.1",
53
+ "react": "^18.2.0",
54
+ "react-dom": "^18.2.0",
55
+ "zod": "^3.24.2"
56
+ },
57
+ "devDependencies": {
58
+ "@eslint/js": "^8.57.1",
59
+ "@stylistic/eslint-plugin": "^2.9.0",
60
+ "@types/adm-zip": "^0.5.7",
61
+ "@types/fs-extra": "^11.0.1",
62
+ "@types/inquirer": "^8.2.5",
63
+ "@types/jest": "^29.5.0",
64
+ "@types/node": "^18.15.11",
65
+ "@types/react": "^18.0.37",
66
+ "@types/react-dom": "^18.0.11",
67
+ "eslint": "^8.57.1",
68
+ "eslint-config-next": "^13.5.10",
69
+ "eslint-plugin-react": "^7.37.4",
70
+ "jest": "^29.7.0",
71
+ "ts-jest": "^29.3.0",
72
+ "ts-node": "^10.9.2",
73
+ "tsx": "^4.19.3",
74
+ "typescript": "^5.8.2",
75
+ "typescript-eslint": "^8.28.0"
76
+ }
77
+ }