@stechquick/symphony-cli 0.2.297 → 0.2.300

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 CHANGED
@@ -19,7 +19,7 @@ $ npm install -g @stechquick/symphony-cli
19
19
  $ symphony-cli COMMAND
20
20
  running command...
21
21
  $ symphony-cli (-v|--version|version)
22
- @stechquick/symphony-cli/0.2.297 linux-x64 node-v16.16.0
22
+ @stechquick/symphony-cli/0.2.300 linux-x64 node-v16.18.0
23
23
  $ symphony-cli --help [COMMAND]
24
24
  USAGE
25
25
  $ symphony-cli COMMAND
@@ -81,7 +81,7 @@ EXAMPLE
81
81
  symphony-cli mui-create myUI -d="My Micro UI project"
82
82
  ```
83
83
 
84
- _See code: [src/commands/mui-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/mui-create.ts)_
84
+ _See code: [src/commands/mui-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/mui-create.ts)_
85
85
 
86
86
  ## `symphony-cli nc-addcomp NAME`
87
87
 
@@ -98,7 +98,7 @@ EXAMPLE
98
98
  symphony-cli nc-addcomp my_comp_name
99
99
  ```
100
100
 
101
- _See code: [src/commands/nc-addcomp.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/nc-addcomp.ts)_
101
+ _See code: [src/commands/nc-addcomp.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/nc-addcomp.ts)_
102
102
 
103
103
  ## `symphony-cli nc-build`
104
104
 
@@ -116,7 +116,7 @@ EXAMPLES
116
116
  $ symphony-cli nc-build -w
117
117
  ```
118
118
 
119
- _See code: [src/commands/nc-build.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/nc-build.ts)_
119
+ _See code: [src/commands/nc-build.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/nc-build.ts)_
120
120
 
121
121
  ## `symphony-cli nc-create NAME`
122
122
 
@@ -136,7 +136,7 @@ EXAMPLE
136
136
  symphony-cli nc-create nc_example -d="my named component example"
137
137
  ```
138
138
 
139
- _See code: [src/commands/nc-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/nc-create.ts)_
139
+ _See code: [src/commands/nc-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/nc-create.ts)_
140
140
 
141
141
  ## `symphony-cli qui-build`
142
142
 
@@ -150,7 +150,7 @@ EXAMPLE
150
150
  $ symphony-cli qui-build -w
151
151
  ```
152
152
 
153
- _See code: [src/commands/qui-build.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/qui-build.ts)_
153
+ _See code: [src/commands/qui-build.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/qui-build.ts)_
154
154
 
155
155
  ## `symphony-cli qui-create NAME`
156
156
 
@@ -172,7 +172,7 @@ EXAMPLES
172
172
  symphony-cli qui-create myUI -t=TOKEN -d="My Quick UI project"
173
173
  ```
174
174
 
175
- _See code: [src/commands/qui-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/qui-create.ts)_
175
+ _See code: [src/commands/qui-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/qui-create.ts)_
176
176
 
177
177
  ## `symphony-cli qui-start`
178
178
 
@@ -189,7 +189,7 @@ EXAMPLE
189
189
  $ symphony-cli qui-start -b
190
190
  ```
191
191
 
192
- _See code: [src/commands/qui-start.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/qui-start.ts)_
192
+ _See code: [src/commands/qui-start.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/qui-start.ts)_
193
193
 
194
194
  ## `symphony-cli quick-serve`
195
195
 
@@ -212,7 +212,7 @@ EXAMPLES
212
212
  $ symphony-cli quick-serve -g -r C:/MyPathToServe
213
213
  ```
214
214
 
215
- _See code: [src/commands/quick-serve.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/quick-serve.ts)_
215
+ _See code: [src/commands/quick-serve.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/quick-serve.ts)_
216
216
 
217
217
  ## `symphony-cli sym-addfunc FUNCNAME`
218
218
 
@@ -229,7 +229,7 @@ EXAMPLE
229
229
  symphony-cli sym-addfunc havalemenu
230
230
  ```
231
231
 
232
- _See code: [src/commands/sym-addfunc.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-addfunc.ts)_
232
+ _See code: [src/commands/sym-addfunc.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-addfunc.ts)_
233
233
 
234
234
  ## `symphony-cli sym-build`
235
235
 
@@ -242,13 +242,14 @@ USAGE
242
242
  OPTIONS
243
243
  -s, --skipversion skip version checking. Used for Deployment
244
244
  -w, --watch for watch
245
+ --swagger for swagger
245
246
 
246
247
  EXAMPLES
247
248
  $ symphony-cli sym-build
248
249
  $ symphony-cli sym-build -w
249
250
  ```
250
251
 
251
- _See code: [src/commands/sym-build.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-build.ts)_
252
+ _See code: [src/commands/sym-build.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-build.ts)_
252
253
 
253
254
  ## `symphony-cli sym-create NAME`
254
255
 
@@ -268,7 +269,7 @@ EXAMPLE
268
269
  symphony-cli sym-create havale -d="Kanallardan yapılan havale işlemi"
269
270
  ```
270
271
 
271
- _See code: [src/commands/sym-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-create.ts)_
272
+ _See code: [src/commands/sym-create.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-create.ts)_
272
273
 
273
274
  ## `symphony-cli sym-create-module NAME`
274
275
 
@@ -288,7 +289,7 @@ EXAMPLE
288
289
  symphony-cli sym-create-module abm -d="abm module description"
289
290
  ```
290
291
 
291
- _See code: [src/commands/sym-create-module.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-create-module.ts)_
292
+ _See code: [src/commands/sym-create-module.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-create-module.ts)_
292
293
 
293
294
  ## `symphony-cli sym-fn-deploy ENVIRONMENT`
294
295
 
@@ -322,7 +323,7 @@ EXAMPLES
322
323
  --f_url="MyFnApiUrl"
323
324
  ```
324
325
 
325
- _See code: [src/commands/sym-fn-deploy.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-fn-deploy.ts)_
326
+ _See code: [src/commands/sym-fn-deploy.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-fn-deploy.ts)_
326
327
 
327
328
  ## `symphony-cli sym-nano-deploy`
328
329
 
@@ -340,7 +341,7 @@ EXAMPLE
340
341
  symphony-cli sym-nano-deploy
341
342
  ```
342
343
 
343
- _See code: [src/commands/sym-nano-deploy.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-nano-deploy.ts)_
344
+ _See code: [src/commands/sym-nano-deploy.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-nano-deploy.ts)_
344
345
 
345
346
  ## `symphony-cli sym-start`
346
347
 
@@ -362,7 +363,7 @@ EXAMPLE
362
363
  $ symphony-cli sym-start -b -d
363
364
  ```
364
365
 
365
- _See code: [src/commands/sym-start.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-start.ts)_
366
+ _See code: [src/commands/sym-start.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-start.ts)_
366
367
 
367
368
  ## `symphony-cli sym-test`
368
369
 
@@ -379,5 +380,5 @@ EXAMPLE
379
380
  $ symphony-cli sym-test
380
381
  ```
381
382
 
382
- _See code: [src/commands/sym-test.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.297/src/commands/sym-test.ts)_
383
+ _See code: [src/commands/sym-test.ts](https://github.com/alper-batioglu/symphony-cli/blob/v0.2.300/src/commands/sym-test.ts)_
383
384
  <!-- commandsstop -->
@@ -5,6 +5,7 @@ export default class Build extends Command {
5
5
  static flags: {
6
6
  watch: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
7
7
  skipversion: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8
+ swagger: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8
9
  };
9
10
  private static versionCheckSetting;
10
11
  run(): Promise<void>;
@@ -7,6 +7,7 @@ const packageHelper_1 = require("../helpers/packageHelper");
7
7
  const cli_ux_1 = require("cli-ux");
8
8
  const log_1 = require("@stechquick/symphony-common/lib/log");
9
9
  const styling_1 = require("@stechquick/symphony-common/lib/styling");
10
+ const swaggerHelper_1 = require("../helpers/swaggerHelper");
10
11
  class Build extends command_1.Command {
11
12
  async run() {
12
13
  const { flags } = this.parse(Build);
@@ -39,6 +40,8 @@ class Build extends command_1.Command {
39
40
  }
40
41
  continueToBuild(watch) {
41
42
  npmHelper_1.NpmHelper.build({ watch });
43
+ new swaggerHelper_1.SwaggerHelper().Swagger("./functions");
44
+ log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Swagger created/updated successfully."), timeFormat: "datetime" });
42
45
  log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Build finished successfully."), timeFormat: "datetime" });
43
46
  }
44
47
  }
@@ -47,9 +50,10 @@ Build.description = 'Plateau-Symphony command to build the app with/without watc
47
50
  Build.examples = ["$ symphony-cli sym-build", "$ symphony-cli sym-build -w"];
48
51
  Build.flags = {
49
52
  watch: command_1.flags.boolean({ char: 'w', description: 'for watch' }),
50
- skipversion: command_1.flags.boolean({ char: 's', description: 'skip version checking. Used for Deployment' })
53
+ skipversion: command_1.flags.boolean({ char: 's', description: 'skip version checking. Used for Deployment' }),
54
+ swagger: command_1.flags.boolean({ description: 'for swagger' }),
51
55
  };
52
56
  Build.versionCheckSetting = {
53
- packageNames: ["@stech-sym\/\symphony", "@stechquick\/\symphony-cli"],
57
+ packageNames: ["@stechsym\/\symphony", "@stechquick\/\symphony-cli"],
54
58
  packageJsonFilePath: "/templates/init/{{AppName}}/{{remove}}package.json"
55
59
  };
@@ -14,6 +14,7 @@ export interface IRunSettings {
14
14
  export declare class NpmHelper {
15
15
  private static readonly BUILD_CMD;
16
16
  private static readonly WEBPACK_CMD;
17
+ static packageInstall(packageName: string): void;
17
18
  static install(settings: IInstallSettings): void;
18
19
  static build(settings?: IBuildSettings): void;
19
20
  static buildWebpack(settings?: IBuildSettings): void;
@@ -9,6 +9,11 @@ const initHelper_1 = require("./initHelper");
9
9
  const log_1 = require("@stechquick/symphony-common/lib/log");
10
10
  const styling_1 = require("@stechquick/symphony-common/lib/styling");
11
11
  class NpmHelper {
12
+ static packageInstall(packageName) {
13
+ log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", packageName + " package install starting...") });
14
+ child_process_1.execSync(`npm install ${packageName}`, { stdio: 'inherit' });
15
+ log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", packageName + " package install finished...") });
16
+ }
12
17
  static install(settings) {
13
18
  log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Install starting, please wait...") });
14
19
  child_process_1.execSync(`cd ${settings.folderName} && npm install`, { stdio: 'inherit' });
@@ -0,0 +1,8 @@
1
+ export declare class SwaggerHelper {
2
+ static swaggerTemplate: any;
3
+ static existedSwaggerJson: any;
4
+ generateJsonSchema(fileName: string, fileData: string): Promise<any>;
5
+ appendtoTemplatePaths(fileName: string, obj: any): Promise<void>;
6
+ generateSwaggerJSON(dirPath: string): Promise<any>;
7
+ Swagger(path: string): Promise<void>;
8
+ }
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwaggerHelper = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeconv = require("typeconv");
6
+ const fs2 = require("fs-extra");
7
+ const fs_1 = tslib_1.__importDefault(require("fs"));
8
+ const npmHelper_1 = require("../helpers/npmHelper");
9
+ let SwaggerDict = {
10
+ symSwaggerFolderPath: "./sym-engine/swagger",
11
+ symSwaggerJsonPath: "./sym-engine/swagger/swagger.json",
12
+ distSwaggerFolderPath: "./dist/sym-engine/swagger",
13
+ swaggerUIdistPath: "./node_modules/swagger-ui-dist",
14
+ distSwaggerUIdistPath: "./dist/sym-engine/swagger/swagger-ui-dist",
15
+ swaggerPackageName: "swagger-ui-dist"
16
+ };
17
+ class SwaggerHelper {
18
+ async generateJsonSchema(fileName, fileData) {
19
+ const reader = typeconv.getTypeScriptReader();
20
+ const writer = typeconv.getJsonSchemaWriter({ format: 'json', title: fileName, version: 'v1' });
21
+ const { convert } = typeconv.makeConverter(reader, writer);
22
+ const { data } = await convert({ data: fileData });
23
+ return data;
24
+ }
25
+ async appendtoTemplatePaths(fileName, obj) {
26
+ obj.paths[`/${fileName}`] = {
27
+ "get": {
28
+ "tags": [],
29
+ "summary": "",
30
+ "description": "",
31
+ "parameters": [],
32
+ "responses": {
33
+ "200": {
34
+ "description": "successful operation",
35
+ "schema": {
36
+ "$ref": `swaggerAPI/${fileName}Schema.json#/definitions/IResponse`
37
+ }
38
+ }
39
+ }
40
+ },
41
+ "post": {
42
+ "tags": [],
43
+ "summary": "",
44
+ "description": "",
45
+ "parameters": [],
46
+ "responses": {
47
+ "200": {
48
+ "description": "successful operation",
49
+ "schema": {
50
+ "$ref": `swaggerAPI/${fileName}Schema.json#/definitions/IResponse`
51
+ }
52
+ }
53
+ }
54
+ }
55
+ };
56
+ }
57
+ async generateSwaggerJSON(dirPath) {
58
+ let files = fs_1.default.readdirSync(dirPath);
59
+ if (!files)
60
+ return;
61
+ if (!fs_1.default.existsSync(SwaggerDict.symSwaggerFolderPath))
62
+ fs_1.default.mkdir(SwaggerDict.symSwaggerFolderPath, (err) => { if (err)
63
+ throw err; });
64
+ let swaggerJson;
65
+ files.forEach(file => {
66
+ if (fs_1.default.statSync(dirPath + "/" + file).isDirectory()) {
67
+ this.generateSwaggerJSON(dirPath + "/" + file);
68
+ }
69
+ else {
70
+ if (file.endsWith(".ts")) {
71
+ var fileName = file.replace(".ts", "");
72
+ if (!fs_1.default.existsSync(SwaggerDict.symSwaggerJsonPath))
73
+ this.appendtoTemplatePaths(fileName, SwaggerHelper.swaggerTemplate);
74
+ fs_1.default.readFile(dirPath + "/" + file, 'utf8', (err, fileData) => {
75
+ if (!fileData || fileData.length == 0)
76
+ return;
77
+ this.generateJsonSchema(fileName, fileData).then(data => {
78
+ fs_1.default.writeFile('./sym-engine/swagger/' + fileName + 'Schema.json', data, (err) => { if (err)
79
+ throw err; });
80
+ }).catch(() => { console.log(`Unable to create ${fileName}Schema.json!`); });
81
+ });
82
+ }
83
+ }
84
+ });
85
+ if (fs_1.default.existsSync('./app.yaml') && !fs_1.default.existsSync(SwaggerDict.symSwaggerJsonPath)) {
86
+ let fileContent = fs_1.default.readFileSync('./app.yaml', 'utf8');
87
+ let appName = fileContent.substring(fileContent.indexOf(':') + 2);
88
+ SwaggerHelper.swaggerTemplate["info"].title = appName;
89
+ SwaggerHelper.swaggerTemplate["basePath"] = "/" + appName;
90
+ swaggerJson = SwaggerHelper.swaggerTemplate;
91
+ }
92
+ return swaggerJson;
93
+ }
94
+ async Swagger(path) {
95
+ let swaggerTemplate = await this.generateSwaggerJSON(path);
96
+ if (!swaggerTemplate) {
97
+ let functions = fs_1.default.readdirSync(path);
98
+ SwaggerHelper.existedSwaggerJson = JSON.parse(fs_1.default.readFileSync(SwaggerDict.symSwaggerJsonPath, 'utf8'));
99
+ //Case for added function
100
+ if (functions.length > Object.keys(SwaggerHelper.existedSwaggerJson.paths).length) {
101
+ functions.forEach(func => {
102
+ if (!SwaggerHelper.existedSwaggerJson.paths.hasOwnProperty("/" + func)) {
103
+ this.appendtoTemplatePaths(func, SwaggerHelper.existedSwaggerJson);
104
+ fs_1.default.writeFile(SwaggerDict.symSwaggerJsonPath, JSON.stringify(SwaggerHelper.existedSwaggerJson), (err) => { if (err)
105
+ throw err; });
106
+ }
107
+ });
108
+ //Case for deleted function
109
+ }
110
+ else {
111
+ Object.keys(SwaggerHelper.existedSwaggerJson.paths).forEach(key => {
112
+ key = key.replace("/", "");
113
+ if (!functions.includes(key)) {
114
+ delete SwaggerHelper.existedSwaggerJson.paths["/" + key];
115
+ fs_1.default.unlinkSync('./sym-engine/swagger/' + key + 'Schema.json');
116
+ fs_1.default.writeFile(SwaggerDict.symSwaggerJsonPath, JSON.stringify(SwaggerHelper.existedSwaggerJson), (err) => { if (err)
117
+ throw err; });
118
+ }
119
+ });
120
+ }
121
+ //TODO: If a user decides to delete and add a function at the same time (array length === obj length nested for loops compare one by one :/ )
122
+ //TODO: Functionalize function cases
123
+ }
124
+ else
125
+ fs_1.default.writeFile(SwaggerDict.symSwaggerJsonPath, JSON.stringify(swaggerTemplate), (err) => { if (err)
126
+ throw err; });
127
+ await fs2.copy(SwaggerDict.symSwaggerFolderPath, SwaggerDict.distSwaggerFolderPath);
128
+ if (fs_1.default.existsSync(SwaggerDict.swaggerUIdistPath)) {
129
+ fs2.copy(SwaggerDict.swaggerUIdistPath, SwaggerDict.distSwaggerUIdistPath);
130
+ return;
131
+ }
132
+ npmHelper_1.NpmHelper.packageInstall(SwaggerDict.swaggerPackageName);
133
+ fs2.copy(SwaggerDict.swaggerUIdistPath, SwaggerDict.distSwaggerUIdistPath);
134
+ }
135
+ }
136
+ exports.SwaggerHelper = SwaggerHelper;
137
+ SwaggerHelper.swaggerTemplate = {
138
+ "swagger": "2.0",
139
+ "info": {
140
+ "description": "You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
141
+ "version": "1.0.6",
142
+ "title": ""
143
+ },
144
+ "basePath": "",
145
+ "produces": [
146
+ "application/json",
147
+ "application/xml"
148
+ ],
149
+ "schemes": ["http", "https"],
150
+ "securityDefinitions": {
151
+ "JWT": {
152
+ "type": "apiKey",
153
+ "in": "header",
154
+ "name": "Authorization",
155
+ "description": "Basic apiKey Authotization in the system"
156
+ }
157
+ },
158
+ "paths": {}
159
+ };
@@ -5,6 +5,9 @@ export declare class FolderCopier {
5
5
  copyIfExists?: boolean;
6
6
  }): void;
7
7
  DeleteFolder(target: string): void;
8
+ private qJsonMediumDecider;
9
+ private ParseQJsonContent;
10
+ private deleteSourceMapping;
8
11
  private ReplaceFile;
9
12
  private substringBetween;
10
13
  private getReplaceFiles;
@@ -47,7 +47,18 @@ class FolderCopier {
47
47
  fs.mkdirSync(destPath, { recursive: true });
48
48
  }
49
49
  //console.log(`Dir: ${srcPath}-->${destPath}`);
50
- fs.copyFileSync(srcPath, path.join(destPath, item));
50
+ if (path.extname(item) === '.qjson') {
51
+ let loadQjson = fs.readFileSync(srcPath, { encoding: 'utf8' });
52
+ let jsonString = this.qJsonMediumDecider(loadQjson);
53
+ jsonString = this.deleteSourceMapping(jsonString);
54
+ let qjson = this.ParseQJsonContent(jsonString);
55
+ qjson === null || qjson === void 0 ? true : delete qjson.pJson;
56
+ qjson === null || qjson === void 0 ? true : delete qjson.lrids;
57
+ fs.writeFileSync(path.join(destPath, item), "let pjson = " + JSON.stringify(qjson) + ";\nexport default pjson");
58
+ }
59
+ else {
60
+ fs.copyFileSync(srcPath, path.join(destPath, item));
61
+ }
51
62
  }, (folder, item, relativeFolder) => {
52
63
  const relativeItemPath = path.join(relativeFolder, item);
53
64
  if (exceptDict === null || exceptDict === void 0 ? void 0 : exceptDict[relativeItemPath]) {
@@ -86,6 +97,40 @@ class FolderCopier {
86
97
  }
87
98
  });
88
99
  }
100
+ qJsonMediumDecider(qjsonData) {
101
+ if (typeof qjsonData == "string") {
102
+ return qjsonData.startsWith('{"qjson":"') ? JSON.parse(qjsonData).qjson : qjsonData;
103
+ }
104
+ else {
105
+ const qjsonString = JSON.stringify(qjsonData);
106
+ return qjsonData.qjson || qjsonString;
107
+ }
108
+ }
109
+ ParseQJsonContent(jsonString) {
110
+ let json = jsonString;
111
+ if (jsonString.indexOf("let pjson =") > -1) {
112
+ let jsonSplitted = jsonString.split("let pjson =");
113
+ jsonSplitted = jsonSplitted[1].split(';\nexport')[0].split(';\r\nexport');
114
+ json = jsonSplitted[0];
115
+ }
116
+ else if (json.indexOf("rally_microUI") > -1) {
117
+ const registerIndex = json.indexOf("registerQJson");
118
+ const jsonStartIndex = json.indexOf(",", registerIndex) + 1;
119
+ json = json.substring(jsonStartIndex, json.length - 2);
120
+ }
121
+ return JSON.parse(json);
122
+ }
123
+ deleteSourceMapping(jsonString) {
124
+ let searchValue = '//# sourceMappingURL=data:application/json;base64';
125
+ let regex = new RegExp(`(${searchValue}+)`, 'gi');
126
+ let regexCount = jsonString.match(regex);
127
+ regexCount === null || regexCount === void 0 ? void 0 : regexCount.forEach(() => {
128
+ let indexStart = jsonString.indexOf(searchValue);
129
+ let indexEnd = jsonString.substring(indexStart).indexOf('"');
130
+ jsonString = jsonString.substring(0, indexStart) + jsonString.substring(indexStart + indexEnd);
131
+ });
132
+ return jsonString;
133
+ }
89
134
  ReplaceFile(source, skipIfNone, cb) {
90
135
  const srcFile = path.resolve(source);
91
136
  if (!fs.existsSync(srcFile)) {
@@ -1 +1 @@
1
- {"version":"0.2.297","commands":{"mui-create":{"id":"mui-create","description":"MicroUI command to create a new Micro UI project","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli mui-create myUI -d=\"My Micro UI project\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to project","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input microui name","required":true}]},"nc-addcomp":{"id":"nc-addcomp","description":"Command for add a named component to nc project.","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli nc-addcomp my_comp_name"],"flags":{},"args":[{"name":"name","description":"input component name","required":true}]},"nc-build":{"id":"nc-build","description":"Command for build your named component project.","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli nc-build","$ symphony-cli nc-build -w"],"flags":{"watch":{"name":"watch","type":"boolean","char":"w","description":"for watch","allowNo":false}},"args":[]},"nc-create":{"id":"nc-create","description":"Command for create a named component template project.","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli nc-create nc_example -d=\"my named component example\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to named component","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input project name","required":true}]},"qui-build":{"id":"qui-build","description":"Plateau-QUI command to build your Quick ui project","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli qui-build -w"],"flags":{},"args":[]},"qui-create":{"id":"qui-create","description":"Plateau-QUI command to create a new Quick ui project","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli qui-create myUI -t=TOKEN","symphony-cli qui-create myUI -t=TOKEN -d=\"My Quick UI project\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to project","hidden":false,"required":false,"default":""},"token":{"name":"token","type":"option","char":"t","description":"npm token for @stechquick","hidden":false,"required":true}},"args":[{"name":"name","description":"input quick ui name","required":true}]},"qui-start":{"id":"qui-start","description":"Plateau-QUI command for start your Quick ui project with/without build","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli qui-start -b"],"flags":{"build":{"name":"build","type":"boolean","char":"b","description":"for build","allowNo":false}},"args":[]},"quick-serve":{"id":"quick-serve","description":"QUICK command for serving your path","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli quick-serve","$ symphony-cli quick-serve -p 3000","$ symphony-cli quick-serve -g","$ symphony-cli quick-serve -r C:/MyPathToServe","$ symphony-cli quick-serve -g -r C:/MyPathToServe"],"flags":{"path":{"name":"path","type":"option","char":"r","description":"Change path to serve"},"httpPort":{"name":"httpPort","type":"option","char":"p","description":"HTTP port to serve"},"global":{"name":"global","type":"boolean","char":"g","description":"Host/visible for everyone.","allowNo":false}},"args":[]},"sym-addfunc":{"id":"sym-addfunc","description":"Plateau-Symphony command to create a new function","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-addfunc havalemenu"],"flags":{},"args":[{"name":"funcname","description":"input function name","required":true,"hidden":false}]},"sym-build":{"id":"sym-build","description":"Plateau-Symphony command to build the app with/without watch","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli sym-build","$ symphony-cli sym-build -w"],"flags":{"watch":{"name":"watch","type":"boolean","char":"w","description":"for watch","allowNo":false},"skipversion":{"name":"skipversion","type":"boolean","char":"s","description":"skip version checking. Used for Deployment","allowNo":false}},"args":[]},"sym-create-module":{"id":"sym-create-module","description":"Plateau-Symphony command to create a Symphony App","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-create-module abm -d=\"abm module description\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to module","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input module name","required":true}]},"sym-create":{"id":"sym-create","description":"Plateau-Symphony command to create a Symphony App","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-create havale -d=\"Kanallardan yapılan havale işlemi\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to application","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input application name","required":true}]},"sym-fn-deploy":{"id":"sym-fn-deploy","description":"Plateau-Symphony fn command to deploy the all functions in your app","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-fn-deploy local","symphony-cli sym-fn-deploy play","symphony-cli sym-fn-deploy remote","symphony-cli sym-fn-deploy remote -d MyDockerUrl -u MyDockerUser -p MyDockerPassword -f MyFnApiUrl","symphony-cli sym-fn-deploy remote --d_url MyDockerUrl --d_user MyDockerUser --d_pass MyDockerPassword --f_url MyFnApiUrl","symphony-cli sym-fn-deploy remote --d_url=\"MyDockerUrl\" --d_user=\"MyDockerUser\" --d_pass=\"MyDockerPassword\" --f_url=\"MyFnApiUrl\""],"flags":{"d_url":{"name":"d_url","type":"option","char":"d","description":"docker url to deploy","hidden":false,"required":false,"default":""},"d_user":{"name":"d_user","type":"option","char":"u","description":"docker username to deploy","hidden":false,"required":false,"default":""},"d_pass":{"name":"d_pass","type":"option","char":"p","description":"docker password for this username to deploy","hidden":false,"required":false,"default":""},"f_url":{"name":"f_url","type":"option","char":"f","description":"fn api url to deploy","hidden":false,"required":false,"default":""},"node_env":{"name":"node_env","type":"option","char":"e","description":"symphony environment name","hidden":false,"required":false}},"args":[{"name":"environment","description":"deploy environment: \n [local: your local] \n [play: playground environment] \n [remote: remote server]","required":true,"options":["local","play","remote"],"hidden":false}]},"sym-nano-deploy":{"id":"sym-nano-deploy","description":"Plateau-Symphony nano command to deploy the all functions in your app","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-nano-deploy"],"flags":{"node_env":{"name":"node_env","type":"option","char":"e","description":"symphony environment name","hidden":false,"required":false},"imagename":{"name":"imagename","type":"option","char":"i","description":"image name for docker","hidden":false,"required":true}},"args":[]},"sym-start":{"id":"sym-start","description":"Plateau-Symphony command to start your functions with/without debug","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli sym-start -b -d"],"flags":{"debug":{"name":"debug","type":"boolean","char":"d","description":"for debug","allowNo":false},"build":{"name":"build","type":"boolean","char":"b","description":"for build","allowNo":false},"http_port":{"name":"http_port","type":"option","char":"p","description":"port to HTTP server"},"https_port":{"name":"https_port","type":"option","char":"h","description":"port to HTTPS server"},"environment":{"name":"environment","type":"option","char":"e","description":"environment variable","hidden":false,"required":false},"hosted_path":{"name":"hosted_path","type":"option","description":"application hosted sub path","required":false}},"args":[]},"sym-test":{"id":"sym-test","description":"Plateau-Symphony command to run your all test functions with coverage","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli sym-test"],"flags":{"func":{"name":"func","type":"option","char":"f","description":"funtion name to test particular file"}},"args":[]}}}
1
+ {"version":"0.2.300","commands":{"mui-create":{"id":"mui-create","description":"MicroUI command to create a new Micro UI project","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli mui-create myUI -d=\"My Micro UI project\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to project","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input microui name","required":true}]},"nc-addcomp":{"id":"nc-addcomp","description":"Command for add a named component to nc project.","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli nc-addcomp my_comp_name"],"flags":{},"args":[{"name":"name","description":"input component name","required":true}]},"nc-build":{"id":"nc-build","description":"Command for build your named component project.","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli nc-build","$ symphony-cli nc-build -w"],"flags":{"watch":{"name":"watch","type":"boolean","char":"w","description":"for watch","allowNo":false}},"args":[]},"nc-create":{"id":"nc-create","description":"Command for create a named component template project.","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli nc-create nc_example -d=\"my named component example\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to named component","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input project name","required":true}]},"qui-build":{"id":"qui-build","description":"Plateau-QUI command to build your Quick ui project","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli qui-build -w"],"flags":{},"args":[]},"qui-create":{"id":"qui-create","description":"Plateau-QUI command to create a new Quick ui project","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli qui-create myUI -t=TOKEN","symphony-cli qui-create myUI -t=TOKEN -d=\"My Quick UI project\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to project","hidden":false,"required":false,"default":""},"token":{"name":"token","type":"option","char":"t","description":"npm token for @stechquick","hidden":false,"required":true}},"args":[{"name":"name","description":"input quick ui name","required":true}]},"qui-start":{"id":"qui-start","description":"Plateau-QUI command for start your Quick ui project with/without build","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli qui-start -b"],"flags":{"build":{"name":"build","type":"boolean","char":"b","description":"for build","allowNo":false}},"args":[]},"quick-serve":{"id":"quick-serve","description":"QUICK command for serving your path","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli quick-serve","$ symphony-cli quick-serve -p 3000","$ symphony-cli quick-serve -g","$ symphony-cli quick-serve -r C:/MyPathToServe","$ symphony-cli quick-serve -g -r C:/MyPathToServe"],"flags":{"path":{"name":"path","type":"option","char":"r","description":"Change path to serve"},"httpPort":{"name":"httpPort","type":"option","char":"p","description":"HTTP port to serve"},"global":{"name":"global","type":"boolean","char":"g","description":"Host/visible for everyone.","allowNo":false}},"args":[]},"sym-addfunc":{"id":"sym-addfunc","description":"Plateau-Symphony command to create a new function","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-addfunc havalemenu"],"flags":{},"args":[{"name":"funcname","description":"input function name","required":true,"hidden":false}]},"sym-build":{"id":"sym-build","description":"Plateau-Symphony command to build the app with/without watch","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli sym-build","$ symphony-cli sym-build -w"],"flags":{"watch":{"name":"watch","type":"boolean","char":"w","description":"for watch","allowNo":false},"skipversion":{"name":"skipversion","type":"boolean","char":"s","description":"skip version checking. Used for Deployment","allowNo":false},"swagger":{"name":"swagger","type":"boolean","description":"for swagger","allowNo":false}},"args":[]},"sym-create-module":{"id":"sym-create-module","description":"Plateau-Symphony command to create a Symphony App","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-create-module abm -d=\"abm module description\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to module","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input module name","required":true}]},"sym-create":{"id":"sym-create","description":"Plateau-Symphony command to create a Symphony App","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-create havale -d=\"Kanallardan yapılan havale işlemi\""],"flags":{"desc":{"name":"desc","type":"option","char":"d","description":"description to application","hidden":false,"required":false,"default":""}},"args":[{"name":"name","description":"input application name","required":true}]},"sym-fn-deploy":{"id":"sym-fn-deploy","description":"Plateau-Symphony fn command to deploy the all functions in your app","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-fn-deploy local","symphony-cli sym-fn-deploy play","symphony-cli sym-fn-deploy remote","symphony-cli sym-fn-deploy remote -d MyDockerUrl -u MyDockerUser -p MyDockerPassword -f MyFnApiUrl","symphony-cli sym-fn-deploy remote --d_url MyDockerUrl --d_user MyDockerUser --d_pass MyDockerPassword --f_url MyFnApiUrl","symphony-cli sym-fn-deploy remote --d_url=\"MyDockerUrl\" --d_user=\"MyDockerUser\" --d_pass=\"MyDockerPassword\" --f_url=\"MyFnApiUrl\""],"flags":{"d_url":{"name":"d_url","type":"option","char":"d","description":"docker url to deploy","hidden":false,"required":false,"default":""},"d_user":{"name":"d_user","type":"option","char":"u","description":"docker username to deploy","hidden":false,"required":false,"default":""},"d_pass":{"name":"d_pass","type":"option","char":"p","description":"docker password for this username to deploy","hidden":false,"required":false,"default":""},"f_url":{"name":"f_url","type":"option","char":"f","description":"fn api url to deploy","hidden":false,"required":false,"default":""},"node_env":{"name":"node_env","type":"option","char":"e","description":"symphony environment name","hidden":false,"required":false}},"args":[{"name":"environment","description":"deploy environment: \n [local: your local] \n [play: playground environment] \n [remote: remote server]","required":true,"options":["local","play","remote"],"hidden":false}]},"sym-nano-deploy":{"id":"sym-nano-deploy","description":"Plateau-Symphony nano command to deploy the all functions in your app","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["symphony-cli sym-nano-deploy"],"flags":{"node_env":{"name":"node_env","type":"option","char":"e","description":"symphony environment name","hidden":false,"required":false},"imagename":{"name":"imagename","type":"option","char":"i","description":"image name for docker","hidden":false,"required":true}},"args":[]},"sym-start":{"id":"sym-start","description":"Plateau-Symphony command to start your functions with/without debug","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli sym-start -b -d"],"flags":{"debug":{"name":"debug","type":"boolean","char":"d","description":"for debug","allowNo":false},"build":{"name":"build","type":"boolean","char":"b","description":"for build","allowNo":false},"http_port":{"name":"http_port","type":"option","char":"p","description":"port to HTTP server"},"https_port":{"name":"https_port","type":"option","char":"h","description":"port to HTTPS server"},"environment":{"name":"environment","type":"option","char":"e","description":"environment variable","hidden":false,"required":false},"hosted_path":{"name":"hosted_path","type":"option","description":"application hosted sub path","required":false}},"args":[]},"sym-test":{"id":"sym-test","description":"Plateau-Symphony command to run your all test functions with coverage","pluginName":"@stechquick/symphony-cli","pluginType":"core","aliases":[],"examples":["$ symphony-cli sym-test"],"flags":{"func":{"name":"func","type":"option","char":"f","description":"funtion name to test particular file"}},"args":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stechquick/symphony-cli",
3
3
  "description": "quick symphony server cli tools",
4
- "version": "0.2.297",
4
+ "version": "0.2.300",
5
5
  "author": "alper-batioglu @alper-batioglu",
6
6
  "bin": {
7
7
  "symphony-cli": "./bin/run"
@@ -32,7 +32,8 @@
32
32
  "debug": "^4.1.1",
33
33
  "fs-extra": "^9.0.1",
34
34
  "js-yaml": "^3.14.0",
35
- "tslib": "^1.13.0"
35
+ "tslib": "^1.13.0",
36
+ "typeconv": "^1.8.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@oclif/dev-cli": "^1.22.2",
@@ -1,6 +1,6 @@
1
1
  import { ModuleObject, IModuleObject } from "./implementation/object";
2
2
  import { ISymphonyObject } from "@stechquick/symphony-common/lib/symphony";
3
- import { symphony, ISymphonyModule } from "@stech-sym/symphony";
3
+ import { symphony, ISymphonyModule } from "@stechsym/symphony";
4
4
 
5
5
  export class Module implements ISymphonyModule {
6
6
  ObjectCreation(){
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@stechquick/symphony-common": "^0.1.2",
19
- "@stech-sym/symphony": "^0.0.2",
19
+ "@stechsym/symphony": "^0.0.2",
20
20
  "source-map-loader": "^0.2.4",
21
21
  "ts-loader": "^5.3.3",
22
22
  "typescript": "^3.7.3",
@@ -0,0 +1,9 @@
1
+ schema_version: 20180708
2
+ name: {{FuncName}}
3
+ version: 0.0.0
4
+ runtime: docker
5
+ entrypoint: node ./dist/{{FuncName}}.js
6
+ triggers:
7
+ - name: {{FuncName}}
8
+ type: http
9
+ source: /{{FuncName}}
@@ -1,8 +1,18 @@
1
- import { symphony } from "@stech-sym/symphony";
1
+ import { ISymphonyObject, symphony } from "@stechsym/symphony";
2
+ import { TReqDefault, TReqHeaderDefault } from "@stechsym/symphony/dist/src/infrastructure/managers/symphonyObject/symphonyRequest";
3
+ import { TRespDefault, TRespHeaderDefault } from "@stechsym/symphony/dist/src/infrastructure/managers/symphonyObject/symphonyResponse";
2
4
 
5
+ export interface IRequest extends TReqDefault {};
6
+ export interface IRequestHeader extends TReqHeaderDefault {};
7
+ export interface IResponse extends TRespDefault {};
8
+ export interface IResponseHeader extends TRespHeaderDefault {};
3
9
 
4
10
  symphony.registerFunc({
5
- funcName: "{{FuncName}}", keepBag: false, requireFunc: require, func: async (sym) => {
11
+ funcName: "{{FuncName}}",
12
+ keepBag: false,
13
+ requireFunc: require,
14
+ func: async (sym: ISymphonyObject<IRequest, IRequestHeader, IResponse, IResponseHeader>): Promise<void> => {
6
15
  //write your code here
7
16
  }
8
- });
17
+ });
18
+
@@ -1,4 +1,4 @@
1
- import { symphony, IRestResponse } from "@stech-sym/symphony";
1
+ import { symphony, IRestResponse } from "@stechsym/symphony";
2
2
 
3
3
  let func = symphony.retrieveFunction(() => require("../functions/{{FuncName}}/{{FuncName}}"));
4
4
 
@@ -1,3 +1,3 @@
1
- import { symphony } from "p@stech-sym/symphony";
1
+ import { symphony } from "@stechsym/symphony";
2
2
 
3
3
  symphony.serveQJsons({ requireFunc: require });
@@ -0,0 +1,9 @@
1
+ schema_version: 20180708
2
+ name: samplefunc
3
+ version: 0.0.0
4
+ runtime: docker
5
+ entrypoint: node ./dist/samplefunc.js
6
+ triggers:
7
+ - name: samplefunc
8
+ type: http
9
+ source: /samplefunc
@@ -1,4 +1,4 @@
1
- import { symphony } from "@stech-sym/symphony";
1
+ import { symphony } from "@stechsym/symphony";
2
2
 
3
3
  symphony.registerFunc({
4
4
  funcName: "samplefunc", keepBag: false, requireFunc: require, func: async (sym) => {
@@ -1,4 +1,4 @@
1
- import { symphony } from "@stech-sym/symphony";
1
+ import { symphony } from "@stechsym/symphony";
2
2
 
3
3
 
4
4
 
@@ -1,4 +1,4 @@
1
- import { ISymPipeline, ISoapRequest } from "@stech-sym/symphony";
1
+ import { ISymPipeline, ISoapRequest } from "@stechsym/symphony";
2
2
 
3
3
  export default <ISymPipeline>{
4
4
  // preFunc: async sym => {
@@ -1,4 +1,4 @@
1
- import { symphony, IRestResponse, ISoapResponse } from "@stech-sym/symphony";
1
+ import { symphony, IRestResponse, ISoapResponse } from "@stechsym/symphony";
2
2
 
3
3
  let func = symphony.retrieveFunction(() => require("../functions/samplefunc/samplefunc"));
4
4
 
@@ -14,7 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@types/node": "^12.12.39",
16
16
  "@types/jest": "^26.0.4",
17
- "@stech-sym/symphony": "^0.0.2",
17
+ "@stechsym/symphony": "^0.0.3",
18
18
  "@stechquick/symphony-cli": "^0.2.290",
19
19
  "jest": "^26.1.0",
20
20
  "ts-jest": "^26.1.1",