nestia 2.0.6 → 2.0.7-dev.20220414

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 (121) hide show
  1. package/{src/IConfiguration.ts → bin/IConfiguration.d.ts} +5 -8
  2. package/bin/IConfiguration.d.ts.map +1 -0
  3. package/bin/IConfiguration.js +3 -0
  4. package/bin/NestiaApplication.d.ts +10 -0
  5. package/bin/NestiaApplication.d.ts.map +1 -0
  6. package/bin/NestiaApplication.js +281 -0
  7. package/bin/analyses/ControllerAnalyzer.d.ts +7 -0
  8. package/bin/analyses/ControllerAnalyzer.d.ts.map +1 -0
  9. package/bin/analyses/ControllerAnalyzer.js +186 -0
  10. package/bin/analyses/GenericAnalyzer.d.ts +6 -0
  11. package/bin/analyses/GenericAnalyzer.d.ts.map +1 -0
  12. package/bin/analyses/GenericAnalyzer.js +100 -0
  13. package/bin/analyses/ImportAnalyzer.d.ts +13 -0
  14. package/bin/analyses/ImportAnalyzer.d.ts.map +1 -0
  15. package/bin/analyses/ImportAnalyzer.js +82 -0
  16. package/bin/analyses/ReflectAnalyzer.d.ts +5 -0
  17. package/bin/analyses/ReflectAnalyzer.d.ts.map +1 -0
  18. package/bin/analyses/ReflectAnalyzer.js +307 -0
  19. package/bin/analyses/SourceFinder.d.ts +5 -0
  20. package/bin/analyses/SourceFinder.d.ts.map +1 -0
  21. package/bin/analyses/SourceFinder.js +260 -0
  22. package/bin/bundle/HttpError.d.ts +2 -0
  23. package/bin/bundle/HttpError.d.ts.map +1 -0
  24. package/bin/bundle/HttpError.js +6 -0
  25. package/bin/bundle/IConnection.d.ts +2 -0
  26. package/bin/bundle/IConnection.d.ts.map +1 -0
  27. package/bin/bundle/IConnection.js +3 -0
  28. package/bin/bundle/Primitive.d.ts +2 -0
  29. package/bin/bundle/Primitive.d.ts.map +1 -0
  30. package/bin/bundle/Primitive.js +6 -0
  31. package/bin/bundle/__internal/AesPkcs5.d.ts +2 -0
  32. package/bin/bundle/__internal/AesPkcs5.d.ts.map +1 -0
  33. package/bin/bundle/__internal/AesPkcs5.js +6 -0
  34. package/bin/bundle/__internal/Fetcher.d.ts +2 -0
  35. package/bin/bundle/__internal/Fetcher.d.ts.map +1 -0
  36. package/bin/bundle/__internal/Fetcher.js +6 -0
  37. package/bin/executable/internal/CompilerOptions.d.ts +13 -0
  38. package/bin/executable/internal/CompilerOptions.d.ts.map +1 -0
  39. package/bin/executable/internal/CompilerOptions.js +132 -0
  40. package/bin/executable/internal/NestiaConfig.d.ts +5 -0
  41. package/bin/executable/internal/NestiaConfig.d.ts.map +1 -0
  42. package/bin/executable/internal/NestiaConfig.js +196 -0
  43. package/bin/executable/internal/nestia.config.getter.d.ts +2 -0
  44. package/bin/executable/internal/nestia.config.getter.d.ts.map +1 -0
  45. package/bin/executable/internal/nestia.config.getter.js +60 -0
  46. package/bin/executable/nestia.d.ts +3 -0
  47. package/bin/executable/nestia.d.ts.map +1 -0
  48. package/bin/executable/nestia.js +136 -0
  49. package/bin/executable/sdk.d.ts +2 -0
  50. package/bin/executable/sdk.d.ts.map +1 -0
  51. package/bin/executable/sdk.js +206 -0
  52. package/bin/generates/FileGenerator.d.ts +6 -0
  53. package/bin/generates/FileGenerator.d.ts.map +1 -0
  54. package/bin/generates/FileGenerator.js +302 -0
  55. package/bin/generates/FunctionGenerator.d.ts +5 -0
  56. package/bin/generates/FunctionGenerator.d.ts.map +1 -0
  57. package/bin/generates/FunctionGenerator.js +207 -0
  58. package/bin/generates/SdkGenerator.d.ts +6 -0
  59. package/bin/generates/SdkGenerator.d.ts.map +1 -0
  60. package/bin/generates/SdkGenerator.js +147 -0
  61. package/bin/index.d.ts +3 -0
  62. package/bin/index.d.ts.map +1 -0
  63. package/bin/index.js +28 -0
  64. package/bin/module.d.ts +3 -0
  65. package/bin/module.d.ts.map +1 -0
  66. package/bin/module.js +19 -0
  67. package/{src/structures/IController.ts → bin/structures/IController.d.ts} +6 -13
  68. package/bin/structures/IController.d.ts.map +1 -0
  69. package/bin/structures/IController.js +3 -0
  70. package/{src/structures/IRoute.ts → bin/structures/IRoute.d.ts} +5 -11
  71. package/bin/structures/IRoute.d.ts.map +1 -0
  72. package/bin/structures/IRoute.js +3 -0
  73. package/bin/structures/MethodType.d.ts +5 -0
  74. package/bin/structures/MethodType.d.ts.map +1 -0
  75. package/bin/structures/MethodType.js +8 -0
  76. package/bin/structures/ParamCategory.d.ts +2 -0
  77. package/bin/structures/ParamCategory.d.ts.map +1 -0
  78. package/bin/structures/ParamCategory.js +3 -0
  79. package/bin/utils/ArrayUtil.d.ts +6 -0
  80. package/bin/utils/ArrayUtil.d.ts.map +1 -0
  81. package/bin/utils/ArrayUtil.js +144 -0
  82. package/bin/utils/DirectoryUtil.d.ts +6 -0
  83. package/bin/utils/DirectoryUtil.d.ts.map +1 -0
  84. package/bin/utils/DirectoryUtil.js +190 -0
  85. package/bin/utils/ImportDictionary.d.ts +7 -0
  86. package/bin/utils/ImportDictionary.d.ts.map +1 -0
  87. package/bin/utils/ImportDictionary.js +85 -0
  88. package/bin/utils/StringUtil.d.ts +4 -0
  89. package/bin/utils/StringUtil.d.ts.map +1 -0
  90. package/bin/utils/StringUtil.js +13 -0
  91. package/bin/utils/stripJsonComments.d.ts +4 -0
  92. package/bin/utils/stripJsonComments.d.ts.map +1 -0
  93. package/bin/utils/stripJsonComments.js +76 -0
  94. package/package.json +14 -10
  95. package/tsconfig.json +8 -7
  96. package/src/NestiaApplication.ts +0 -96
  97. package/src/analyses/ControllerAnalyzer.ts +0 -154
  98. package/src/analyses/GenericAnalyzer.ts +0 -52
  99. package/src/analyses/ImportAnalyzer.ts +0 -93
  100. package/src/analyses/ReflectAnalyzer.ts +0 -221
  101. package/src/analyses/SourceFinder.ts +0 -73
  102. package/src/bin/nestia.ts +0 -59
  103. package/src/bundle/HttpError.ts +0 -1
  104. package/src/bundle/IConnection.ts +0 -1
  105. package/src/bundle/Primitive.ts +0 -1
  106. package/src/bundle/__internal/AesPkcs5.ts +0 -1
  107. package/src/bundle/__internal/Fetcher.ts +0 -1
  108. package/src/executable/sdk.ts +0 -84
  109. package/src/generates/FileGenerator.ts +0 -150
  110. package/src/generates/FunctionGenerator.ts +0 -201
  111. package/src/generates/SdkGenerator.ts +0 -39
  112. package/src/internal/NestiaConfig.ts +0 -36
  113. package/src/internal/TsConfig.ts +0 -123
  114. package/src/internal/tsconfig.default.json +0 -81
  115. package/src/structures/MethodType.ts +0 -6
  116. package/src/structures/ParamCategory.ts +0 -1
  117. package/src/utils/ArrayUtil.ts +0 -26
  118. package/src/utils/DirectoryUtil.ts +0 -48
  119. package/src/utils/ImportDictionary.ts +0 -44
  120. package/src/utils/StringUtil.ts +0 -10
  121. package/src/utils/stripJsonComments.ts +0 -79
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpError = void 0;
4
+ var nestia_fetcher_1 = require("nestia-fetcher");
5
+ Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return nestia_fetcher_1.HttpError; } });
6
+ //# sourceMappingURL=HttpError.js.map
@@ -0,0 +1,2 @@
1
+ export { IConnection } from "nestia-fetcher";
2
+ //# sourceMappingURL=IConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IConnection.d.ts","sourceRoot":"","sources":["../../src/bundle/IConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IConnection.js.map
@@ -0,0 +1,2 @@
1
+ export { Primitive } from "nestia-fetcher";
2
+ //# sourceMappingURL=Primitive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Primitive.d.ts","sourceRoot":"","sources":["../../src/bundle/Primitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Primitive = void 0;
4
+ var nestia_fetcher_1 = require("nestia-fetcher");
5
+ Object.defineProperty(exports, "Primitive", { enumerable: true, get: function () { return nestia_fetcher_1.Primitive; } });
6
+ //# sourceMappingURL=Primitive.js.map
@@ -0,0 +1,2 @@
1
+ export { AesPkcs5 } from "nestia-fetcher";
2
+ //# sourceMappingURL=AesPkcs5.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AesPkcs5.d.ts","sourceRoot":"","sources":["../../../src/bundle/__internal/AesPkcs5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AesPkcs5 = void 0;
4
+ var nestia_fetcher_1 = require("nestia-fetcher");
5
+ Object.defineProperty(exports, "AesPkcs5", { enumerable: true, get: function () { return nestia_fetcher_1.AesPkcs5; } });
6
+ //# sourceMappingURL=AesPkcs5.js.map
@@ -0,0 +1,2 @@
1
+ export { Fetcher } from "nestia-fetcher";
2
+ //# sourceMappingURL=Fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fetcher.d.ts","sourceRoot":"","sources":["../../../src/bundle/__internal/Fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Fetcher = void 0;
4
+ var nestia_fetcher_1 = require("nestia-fetcher");
5
+ Object.defineProperty(exports, "Fetcher", { enumerable: true, get: function () { return nestia_fetcher_1.Fetcher; } });
6
+ //# sourceMappingURL=Fetcher.js.map
@@ -0,0 +1,13 @@
1
+ import * as tsc from "typescript";
2
+ export declare namespace CompilerOptions {
3
+ const DEFAULT_OPTIONS: {
4
+ target: string;
5
+ module: string;
6
+ types: string[];
7
+ esModuleInterop: boolean;
8
+ experimentalDecorators: boolean;
9
+ emitDecoratorMetadata: boolean;
10
+ };
11
+ function emend(options: tsc.CompilerOptions, assert: boolean): [boolean, boolean];
12
+ }
13
+ //# sourceMappingURL=CompilerOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompilerOptions.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/CompilerOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC,yBAAiB,eAAe,CAChC;IAcW,MAAM,eAAe;;;;;;;KAI3B,CAAC;IAEF,SAAgB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CA4CvF;CAaJ"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __values = (this && this.__values) || function(o) {
14
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
15
+ if (m) return m.call(o);
16
+ if (o && typeof o.length === "number") return {
17
+ next: function () {
18
+ if (o && i >= o.length) o = void 0;
19
+ return { value: o && o[i++], done: !o };
20
+ }
21
+ };
22
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
23
+ };
24
+ var __read = (this && this.__read) || function (o, n) {
25
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
26
+ if (!m) return o;
27
+ var i = m.call(o), r, ar = [], e;
28
+ try {
29
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30
+ }
31
+ catch (error) { e = { error: error }; }
32
+ finally {
33
+ try {
34
+ if (r && !r.done && (m = i["return"])) m.call(i);
35
+ }
36
+ finally { if (e) throw e.error; }
37
+ }
38
+ return ar;
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.CompilerOptions = void 0;
42
+ var nestia_fetcher_1 = require("nestia-fetcher");
43
+ var CompilerOptions;
44
+ (function (CompilerOptions) {
45
+ /* -----------------------------------------------------------
46
+ DEFAULT VALUES
47
+ ----------------------------------------------------------- */
48
+ var ESSENTIAL_OPTIONS = {
49
+ types: [
50
+ "node",
51
+ "reflect-metadata"
52
+ ],
53
+ esModuleInterop: true,
54
+ experimentalDecorators: true,
55
+ emitDecoratorMetadata: true
56
+ };
57
+ CompilerOptions.DEFAULT_OPTIONS = __assign(__assign({}, ESSENTIAL_OPTIONS), { target: "es5", module: "commonjs" });
58
+ function emend(options, assert) {
59
+ var e_1, _a;
60
+ try {
61
+ // EMEND PROPERTIES
62
+ for (var _b = __values(Object.entries(ESSENTIAL_OPTIONS)), _c = _b.next(); !_c.done; _c = _b.next()) {
63
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
64
+ if (options[key] instanceof Array && value instanceof Array)
65
+ merge_array(options[key], value);
66
+ else if (typeof options[key] === "object")
67
+ Object.assign(options[key], value);
68
+ else
69
+ options[key] = value;
70
+ }
71
+ }
72
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
73
+ finally {
74
+ try {
75
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
76
+ }
77
+ finally { if (e_1) throw e_1.error; }
78
+ }
79
+ //----
80
+ // CONSTRUCT PLUGINS
81
+ //----
82
+ // INITALIZE PLUGINS
83
+ if (!options.plugins || !(options.plugins instanceof Array))
84
+ options.plugins = [];
85
+ var transformed = false;
86
+ var aliased = false;
87
+ var plugins = options.plugins;
88
+ var emplace = function (input) {
89
+ var found = plugins.find(function (p) { return nestia_fetcher_1.Primitive.equal_to(p, input); });
90
+ if (found === undefined)
91
+ plugins.push(input);
92
+ transformed || (transformed = true);
93
+ };
94
+ if (assert === true)
95
+ emplace({
96
+ transform: "typescript-is/lib/transform-inline/transformer"
97
+ });
98
+ if (options.baseUrl ||
99
+ (options.paths && Object.entries(options.paths).length !== 0)) {
100
+ aliased = true;
101
+ emplace({
102
+ transform: "typescript-transform-paths",
103
+ useRootDirs: true,
104
+ });
105
+ }
106
+ return [transformed, aliased];
107
+ }
108
+ CompilerOptions.emend = emend;
109
+ function merge_array(origin, must) {
110
+ var e_2, _a;
111
+ var _loop_1 = function (m) {
112
+ var found = origin.find(function (elem) { return elem === m; });
113
+ if (found !== undefined)
114
+ return "continue";
115
+ origin.push(m);
116
+ };
117
+ try {
118
+ for (var must_1 = __values(must), must_1_1 = must_1.next(); !must_1_1.done; must_1_1 = must_1.next()) {
119
+ var m = must_1_1.value;
120
+ _loop_1(m);
121
+ }
122
+ }
123
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
124
+ finally {
125
+ try {
126
+ if (must_1_1 && !must_1_1.done && (_a = must_1.return)) _a.call(must_1);
127
+ }
128
+ finally { if (e_2) throw e_2.error; }
129
+ }
130
+ }
131
+ })(CompilerOptions = exports.CompilerOptions || (exports.CompilerOptions = {}));
132
+ //# sourceMappingURL=CompilerOptions.js.map
@@ -0,0 +1,5 @@
1
+ import { IConfiguration } from "../../IConfiguration";
2
+ export declare namespace NestiaConfig {
3
+ function get(): Promise<IConfiguration | null>;
4
+ }
5
+ //# sourceMappingURL=NestiaConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NestiaConfig.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/NestiaConfig.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,yBAAiB,YAAY,CAC7B;IACI,SAAgB,GAAG,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAGpD;CAuBJ"}
@@ -0,0 +1,196 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (_) try {
41
+ 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;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ var __values = (this && this.__values) || function(o) {
62
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
63
+ if (m) return m.call(o);
64
+ if (o && typeof o.length === "number") return {
65
+ next: function () {
66
+ if (o && i >= o.length) o = void 0;
67
+ return { value: o && o[i++], done: !o };
68
+ }
69
+ };
70
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
71
+ };
72
+ Object.defineProperty(exports, "__esModule", { value: true });
73
+ exports.NestiaConfig = void 0;
74
+ var fs = __importStar(require("fs"));
75
+ var path = __importStar(require("path"));
76
+ var runner = __importStar(require("ts-node"));
77
+ var InvalidArgument_1 = require("tstl/exception/InvalidArgument");
78
+ var nestia_fetcher_1 = require("nestia-fetcher");
79
+ var Singleton_1 = require("tstl/thread/Singleton");
80
+ var typescript_is_1 = require("typescript-is");
81
+ var NestiaConfig;
82
+ (function (NestiaConfig) {
83
+ var _this = this;
84
+ function get() {
85
+ return singleton.get();
86
+ }
87
+ NestiaConfig.get = get;
88
+ function assert(config) {
89
+ (0, typescript_is_1.assertType)(config, function (object) { var path = ["config"]; function _string(object) { ; if (typeof object !== "string")
90
+ return { message: "validation failed at " + path.join(".") + ": expected a string", path: path.slice(), reason: { type: "string" } };
91
+ else
92
+ return null; } function _undefined(object) { ; if (object !== undefined)
93
+ return { message: "validation failed at " + path.join(".") + ": expected undefined", path: path.slice(), reason: { type: "undefined" } };
94
+ else
95
+ return null; } function _false(object) { ; if (object !== false)
96
+ return { message: "validation failed at " + path.join(".") + ": expected false", path: path.slice(), reason: { type: "boolean-literal", value: false } };
97
+ else
98
+ return null; } function _true(object) { ; if (object !== true)
99
+ return { message: "validation failed at " + path.join(".") + ": expected true", path: path.slice(), reason: { type: "boolean-literal", value: true } };
100
+ else
101
+ return null; } function su__undefined__3__4_eu(object) {
102
+ var e_1, _a;
103
+ var conditions = [_undefined, _false, _true];
104
+ try {
105
+ for (var conditions_1 = __values(conditions), conditions_1_1 = conditions_1.next(); !conditions_1_1.done; conditions_1_1 = conditions_1.next()) {
106
+ var condition = conditions_1_1.value;
107
+ var error = condition(object);
108
+ if (!error)
109
+ return null;
110
+ }
111
+ }
112
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
113
+ finally {
114
+ try {
115
+ if (conditions_1_1 && !conditions_1_1.done && (_a = conditions_1.return)) _a.call(conditions_1);
116
+ }
117
+ finally { if (e_1) throw e_1.error; }
118
+ }
119
+ return { message: "validation failed at " + path.join(".") + ": there are no valid alternatives", path: path.slice(), reason: { type: "union" } };
120
+ } function _0(object) { ; if (typeof object !== "object" || object === null || Array.isArray(object))
121
+ return { message: "validation failed at " + path.join(".") + ": expected an object", path: path.slice(), reason: { type: "object" } }; {
122
+ if ("output" in object) {
123
+ path.push("output");
124
+ var error = _string(object["output"]);
125
+ path.pop();
126
+ if (error)
127
+ return error;
128
+ }
129
+ else
130
+ return { message: "validation failed at " + path.join(".") + ": expected 'output' in object", path: path.slice(), reason: { type: "missing-property", property: "output" } };
131
+ } {
132
+ if ("assert" in object) {
133
+ path.push("assert");
134
+ var error = su__undefined__3__4_eu(object["assert"]);
135
+ path.pop();
136
+ if (error)
137
+ return error;
138
+ }
139
+ } return null; } return _0(object); });
140
+ if ((0, typescript_is_1.is)(config.input, function (object) { function _string(object) { ; if (typeof object !== "string")
141
+ return {};
142
+ else
143
+ return null; } return _string(object); }) === false
144
+ && (0, typescript_is_1.is)(config.input, function (object) { function _string(object) { ; if (typeof object !== "string")
145
+ return {};
146
+ else
147
+ return null; } function sa__string_ea_2(object) { ; if (!Array.isArray(object))
148
+ return {}; for (var i = 0; i < object.length; i++) {
149
+ var error = _string(object[i]);
150
+ if (error)
151
+ return error;
152
+ } return null; } return sa__string_ea_2(object); }) === false
153
+ && (0, typescript_is_1.is)(config.input, function (object) { function _string(object) { ; if (typeof object !== "string")
154
+ return {};
155
+ else
156
+ return null; } function sa__string_ea_3(object) { ; if (!Array.isArray(object))
157
+ return {}; for (var i = 0; i < object.length; i++) {
158
+ var error = _string(object[i]);
159
+ if (error)
160
+ return error;
161
+ } return null; } function _0(object) { ; if (typeof object !== "object" || object === null || Array.isArray(object))
162
+ return {}; {
163
+ if ("include" in object) {
164
+ var error = sa__string_ea_3(object["include"]);
165
+ if (error)
166
+ return error;
167
+ }
168
+ else
169
+ return {};
170
+ } {
171
+ if ("exclude" in object) {
172
+ var error = sa__string_ea_3(object["exclude"]);
173
+ if (error)
174
+ return error;
175
+ }
176
+ } return null; } return _0(object); }) === false)
177
+ throw new InvalidArgument_1.InvalidArgument("Error on NestiaConfig.get(): invalid input type.");
178
+ return config;
179
+ }
180
+ var singleton = new Singleton_1.Singleton(function () { return __awaiter(_this, void 0, void 0, function () {
181
+ var config;
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0:
185
+ if (fs.existsSync("nestia.config.ts") === false)
186
+ return [2 /*return*/, null];
187
+ runner.register();
188
+ return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require(path.resolve("nestia.config.ts"))); })];
189
+ case 1:
190
+ config = _a.sent();
191
+ return [2 /*return*/, assert(nestia_fetcher_1.Primitive.clone(config))];
192
+ }
193
+ });
194
+ }); });
195
+ })(NestiaConfig = exports.NestiaConfig || (exports.NestiaConfig = {}));
196
+ //# sourceMappingURL=NestiaConfig.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nestia.config.getter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nestia.config.getter.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/nestia.config.getter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var WorkerServer_1 = require("tgrid/protocols/workers/WorkerServer");
40
+ var NestiaConfig_1 = require("./NestiaConfig");
41
+ function main() {
42
+ return __awaiter(this, void 0, void 0, function () {
43
+ var worker;
44
+ return __generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0:
47
+ worker = new WorkerServer_1.WorkerServer();
48
+ return [4 /*yield*/, worker.open(NestiaConfig_1.NestiaConfig)];
49
+ case 1:
50
+ _a.sent();
51
+ return [2 /*return*/];
52
+ }
53
+ });
54
+ });
55
+ }
56
+ main().catch(function (exp) {
57
+ console.log(exp);
58
+ process.exit(-1);
59
+ });
60
+ //# sourceMappingURL=nestia.config.getter.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=nestia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nestia.d.ts","sourceRoot":"","sources":["../../src/executable/nestia.ts"],"names":[],"mappings":""}
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
+ return new (P || (P = Promise))(function (resolve, reject) {
29
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
30
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
31
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
33
+ });
34
+ };
35
+ var __generator = (this && this.__generator) || function (thisArg, body) {
36
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
37
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38
+ function verb(n) { return function (v) { return step([n, v]); }; }
39
+ function step(op) {
40
+ if (f) throw new TypeError("Generator is already executing.");
41
+ while (_) try {
42
+ 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;
43
+ if (y = 0, t) op = [op[0] & 2, t.value];
44
+ switch (op[0]) {
45
+ case 0: case 1: t = op; break;
46
+ case 4: _.label++; return { value: op[1], done: false };
47
+ case 5: _.label++; y = op[1]; op = [0]; continue;
48
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
49
+ default:
50
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
51
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
52
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
53
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
54
+ if (t[2]) _.ops.pop();
55
+ _.trys.pop(); continue;
56
+ }
57
+ op = body.call(thisArg, _);
58
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60
+ }
61
+ };
62
+ var __values = (this && this.__values) || function(o) {
63
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
64
+ if (m) return m.call(o);
65
+ if (o && typeof o.length === "number") return {
66
+ next: function () {
67
+ if (o && i >= o.length) o = void 0;
68
+ return { value: o && o[i++], done: !o };
69
+ }
70
+ };
71
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
72
+ };
73
+ Object.defineProperty(exports, "__esModule", { value: true });
74
+ var cp = __importStar(require("child_process"));
75
+ var path = __importStar(require("path"));
76
+ var process = __importStar(require("process"));
77
+ function install() {
78
+ var e_1, _a;
79
+ try {
80
+ // INSTALL DEPENDENCIES
81
+ for (var _b = __values(["nestia-fetcher", "typescript-is"]), _c = _b.next(); !_c.done; _c = _b.next()) {
82
+ var lib = _c.value;
83
+ var command = "npm install ".concat(lib);
84
+ cp.execSync(command, { stdio: "inherit" });
85
+ }
86
+ }
87
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
88
+ finally {
89
+ try {
90
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
91
+ }
92
+ finally { if (e_1) throw e_1.error; }
93
+ }
94
+ }
95
+ function sdk() {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ return __generator(this, function (_a) {
98
+ switch (_a.label) {
99
+ case 0:
100
+ // EXECUTE THE COMMAND, BUT IGNORE WARNINGS
101
+ return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require(path.relative(process.cwd(), "".concat(__dirname, "/../executable/sdk")))); })];
102
+ case 1:
103
+ // EXECUTE THE COMMAND, BUT IGNORE WARNINGS
104
+ _a.sent();
105
+ return [2 /*return*/];
106
+ }
107
+ });
108
+ });
109
+ }
110
+ function main() {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ return __generator(this, function (_a) {
113
+ switch (_a.label) {
114
+ case 0:
115
+ if (!(process.argv[2] === "install")) return [3 /*break*/, 2];
116
+ return [4 /*yield*/, install()];
117
+ case 1:
118
+ _a.sent();
119
+ return [3 /*break*/, 5];
120
+ case 2:
121
+ if (!(process.argv[2] === "sdk")) return [3 /*break*/, 4];
122
+ return [4 /*yield*/, sdk()];
123
+ case 3:
124
+ _a.sent();
125
+ return [3 /*break*/, 5];
126
+ case 4: throw new Error("nestia supports only two commands; install and sdk, however you've typed the \"".concat(process.argv[2], "\""));
127
+ case 5: return [2 /*return*/];
128
+ }
129
+ });
130
+ });
131
+ }
132
+ main().catch(function (exp) {
133
+ console.log(exp.message);
134
+ process.exit(-1);
135
+ });
136
+ //# sourceMappingURL=nestia.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/executable/sdk.ts"],"names":[],"mappings":""}