@flink-app/flink 0.11.14 → 0.12.1-alpha.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.
Files changed (51) hide show
  1. package/bin/flink.ts +6 -13
  2. package/dist/bin/flink.js +3 -10
  3. package/dist/cli/build.js +3 -3
  4. package/dist/cli/clean.js +2 -2
  5. package/dist/cli/cli-utils.js +1 -1
  6. package/dist/cli/run.js +2 -2
  7. package/dist/src/FlinkApp.d.ts +3 -2
  8. package/dist/src/FlinkApp.js +98 -86
  9. package/dist/src/FlinkContext.d.ts +1 -1
  10. package/dist/src/FlinkErrors.d.ts +1 -1
  11. package/dist/src/FlinkErrors.js +5 -5
  12. package/dist/src/FlinkHttpHandler.d.ts +7 -7
  13. package/dist/src/FlinkHttpHandler.js +1 -1
  14. package/dist/src/FlinkJob.d.ts +2 -2
  15. package/dist/src/FlinkLog.d.ts +2 -2
  16. package/dist/src/FlinkRepo.d.ts +11 -6
  17. package/dist/src/FlinkRepo.js +63 -20
  18. package/dist/src/FlinkResponse.d.ts +2 -2
  19. package/dist/src/FsUtils.js +7 -7
  20. package/dist/src/TypeScriptCompiler.js +83 -68
  21. package/dist/src/TypeScriptUtils.js +11 -33
  22. package/dist/src/index.js +5 -1
  23. package/dist/src/mock-data-generator.js +1 -1
  24. package/dist/src/utils.js +6 -6
  25. package/package.json +7 -8
  26. package/spec/FlinkRepo.spec.ts +3 -3
  27. package/spec/TypeScriptCompiler.spec.ts +36 -42
  28. package/spec/mock-project/dist/src/handlers/GetCar.js +10 -12
  29. package/spec/mock-project/dist/src/handlers/GetCar2.js +11 -13
  30. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema.js +8 -10
  31. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema2.js +8 -10
  32. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema3.js +8 -10
  33. package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema.js +10 -12
  34. package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema2.js +10 -12
  35. package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile.js +10 -12
  36. package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile2.js +10 -12
  37. package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler.js +10 -12
  38. package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler2.js +10 -12
  39. package/spec/mock-project/dist/src/handlers/PostCar.js +10 -12
  40. package/spec/mock-project/dist/src/handlers/PostLogin.js +11 -13
  41. package/spec/mock-project/dist/src/handlers/PutCar.js +10 -12
  42. package/spec/mock-project/dist/src/index.js +6 -2
  43. package/spec/mock-project/src/repos/CarRepo.ts +1 -1
  44. package/src/FlinkApp.ts +30 -16
  45. package/src/FlinkContext.ts +8 -8
  46. package/src/FlinkRepo.ts +36 -21
  47. package/src/TypeScriptCompiler.ts +13 -2
  48. package/src/TypeScriptUtils.ts +110 -164
  49. package/cli/generate-schemas.ts +0 -153
  50. package/dist/cli/generate-schemas.d.ts +0 -2
  51. package/dist/cli/generate-schemas.js +0 -140
package/bin/flink.ts CHANGED
@@ -1,29 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const commands = [
4
- "build",
5
- "generate" /* 'generate' is alias for 'build' */,
6
- "run",
7
- "clean",
8
- "generate-schemas",
9
- "help",
10
- ];
3
+ const commands = ["build", "generate" /* 'generate' is alias for 'build' */, "run", "clean", "help"];
11
4
 
12
5
  const argv = process.argv.slice(2);
13
6
  let argCommand = argv[0];
14
7
 
15
8
  if (!argCommand || argv[0] === "help") {
16
- console.log(`Usage: flink [${commands.join("|")}]`);
17
- process.exit();
9
+ console.log(`Usage: flink [${commands.join("|")}]`);
10
+ process.exit();
18
11
  }
19
12
 
20
13
  if (!commands.includes(argv[0])) {
21
- console.log(`Invalid command: ${argCommand}`);
22
- process.exit(1);
14
+ console.log(`Invalid command: ${argCommand}`);
15
+ process.exit(1);
23
16
  }
24
17
 
25
18
  if (argCommand === "generate") {
26
- argCommand = "build";
19
+ argCommand = "build";
27
20
  }
28
21
 
29
22
  const cmd = require("../cli/" + argCommand);
package/dist/bin/flink.js CHANGED
@@ -1,22 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- var commands = [
5
- "build",
6
- "generate" /* 'generate' is alias for 'build' */,
7
- "run",
8
- "clean",
9
- "generate-schemas",
10
- "help",
11
- ];
4
+ var commands = ["build", "generate" /* 'generate' is alias for 'build' */, "run", "clean", "help"];
12
5
  var argv = process.argv.slice(2);
13
6
  var argCommand = argv[0];
14
7
  if (!argCommand || argv[0] === "help") {
15
- console.log("Usage: flink [" + commands.join("|") + "]");
8
+ console.log("Usage: flink [".concat(commands.join("|"), "]"));
16
9
  process.exit();
17
10
  }
18
11
  if (!commands.includes(argv[0])) {
19
- console.log("Invalid command: " + argCommand);
12
+ console.log("Invalid command: ".concat(argCommand));
20
13
  process.exit(1);
21
14
  }
22
15
  if (argCommand === "generate") {
package/dist/cli/build.js CHANGED
@@ -15,7 +15,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
15
15
  function verb(n) { return function (v) { return step([n, v]); }; }
16
16
  function step(op) {
17
17
  if (f) throw new TypeError("Generator is already executing.");
18
- while (_) try {
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
19
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
20
  if (y = 0, t) op = [op[0] & 2, t.value];
21
21
  switch (op[0]) {
@@ -57,7 +57,7 @@ module.exports = function run(args) {
57
57
  if (args[0] && !args[0].startsWith("--")) {
58
58
  dir = args[0];
59
59
  }
60
- exclude = cli_utils_1.getOption(args, "exclude", "/spec");
60
+ exclude = (0, cli_utils_1.getOption)(args, "exclude", "/spec");
61
61
  return [4 /*yield*/, TypeScriptCompiler_1.default.clean(dir)];
62
62
  case 1:
63
63
  _a.sent();
@@ -68,7 +68,7 @@ module.exports = function run(args) {
68
68
  return [4 /*yield*/, Promise.all([compiler.parseRepos(), compiler.parseHandlers(exclude.split(",")), compiler.parseJobs(), compiler.generateStartScript()])];
69
69
  case 2:
70
70
  _a.sent();
71
- console.log("Compilation done, took " + (Date.now() - startTime) + "ms");
71
+ console.log("Compilation done, took ".concat(Date.now() - startTime, "ms"));
72
72
  compiler.emit();
73
73
  return [2 /*return*/];
74
74
  }
package/dist/cli/clean.js CHANGED
@@ -15,7 +15,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
15
15
  function verb(n) { return function (v) { return step([n, v]); }; }
16
16
  function step(op) {
17
17
  if (f) throw new TypeError("Generator is already executing.");
18
- while (_) try {
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
19
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
20
  if (y = 0, t) op = [op[0] & 2, t.value];
21
21
  switch (op[0]) {
@@ -58,7 +58,7 @@ module.exports = function run(args) {
58
58
  return [4 /*yield*/, TypeScriptCompiler_1.default.clean(dir)];
59
59
  case 1:
60
60
  cleanedFolder = _a.sent();
61
- console.log("Cleaned directory " + cleanedFolder);
61
+ console.log("Cleaned directory ".concat(cleanedFolder));
62
62
  return [2 /*return*/];
63
63
  }
64
64
  });
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOption = void 0;
4
4
  function getOption(args, name, defaultValue, opts) {
5
5
  if (opts === void 0) { opts = {}; }
6
- var option = "--" + name;
6
+ var option = "--".concat(name);
7
7
  if (args.includes(option)) {
8
8
  if (opts.isBoolean && args[args.indexOf(option) + 1] !== "false") {
9
9
  return true;
package/dist/cli/run.js CHANGED
@@ -15,7 +15,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
15
15
  function verb(n) { return function (v) { return step([n, v]); }; }
16
16
  function step(op) {
17
17
  if (f) throw new TypeError("Generator is already executing.");
18
- while (_) try {
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
19
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
20
  if (y = 0, t) op = [op[0] & 2, t.value];
21
21
  switch (op[0]) {
@@ -81,7 +81,7 @@ module.exports = function run(args) {
81
81
  return [4 /*yield*/, Promise.all([compiler.parseRepos(), compiler.parseHandlers(), compiler.parseJobs(), compiler.generateStartScript(entry)])];
82
82
  case 2:
83
83
  _a.sent();
84
- console.log("Compilation done, took " + (Date.now() - startTime) + "ms");
84
+ console.log("Compilation done, took ".concat(Date.now() - startTime, "ms"));
85
85
  compiler.emit();
86
86
  forkedProcess = require("child_process").fork(dir + "/dist/.flink/start.js");
87
87
  forkedProcess.on("exit", function (code) {
@@ -9,7 +9,7 @@ import { HandlerFile, HttpMethod, QueryParamMetadata, RouteProps } from "./Flink
9
9
  import { FlinkJobFile } from "./FlinkJob";
10
10
  import { FlinkPlugin } from "./FlinkPlugin";
11
11
  import { FlinkRepo } from "./FlinkRepo";
12
- export declare type JSONSchema = JSONSchema7;
12
+ export type JSONSchema = JSONSchema7;
13
13
  /**
14
14
  * This will be populated at compile time when the apps handlers
15
15
  * are picked up by TypeScript compiler
@@ -197,7 +197,7 @@ export declare class FlinkApp<C extends FlinkContext> {
197
197
  */
198
198
  private registerAutoRegisterableHandlers;
199
199
  private registerAutoRegisterableJobs;
200
- addRepo(instanceName: string, repoInstance: FlinkRepo<C>): void;
200
+ addRepo(instanceName: string, repoInstance: FlinkRepo<C, any>): void;
201
201
  /**
202
202
  * Constructs the app context. Will inject context in all components
203
203
  * except for handlers which are handled in later stage.
@@ -214,4 +214,5 @@ export declare class FlinkApp<C extends FlinkContext> {
214
214
  private authenticate;
215
215
  getRegisteredRoutes(): string[];
216
216
  private get isSchedulingEnabled();
217
+ private getMongoConnectionOptions;
217
218
  }