@x-fiber-sys/dev-tool 0.1.0

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 (78) hide show
  1. package/README.md +11 -0
  2. package/dist/_cjs/common/action-kind.js +17 -0
  3. package/dist/_cjs/common/constants.js +8 -0
  4. package/dist/_cjs/common/document-kind.js +32 -0
  5. package/dist/_cjs/common/envs-kind.js +142 -0
  6. package/dist/_cjs/common/index.js +25 -0
  7. package/dist/_cjs/common/libraries-kind.js +116 -0
  8. package/dist/_cjs/common/menu-items.js +8 -0
  9. package/dist/_cjs/common/protocol-kind.js +62 -0
  10. package/dist/_cjs/common/symbols-kind.js +45 -0
  11. package/dist/_cjs/common/typings-kind.js +9 -0
  12. package/dist/_cjs/debug.js +195 -0
  13. package/dist/_cjs/index.js +5 -0
  14. package/dist/_cjs/initiator.js +28 -0
  15. package/dist/_cjs/schemas/generate.schema.js +2 -0
  16. package/dist/_cjs/schemas/index.js +18 -0
  17. package/dist/_cjs/schemas/row.schema.js +2 -0
  18. package/dist/_cjs/services/generator.js +107 -0
  19. package/dist/_cjs/services/index.js +19 -0
  20. package/dist/_cjs/services/installer.js +46 -0
  21. package/dist/_cjs/services/navigator.js +69 -0
  22. package/dist/_cjs/services/runner.js +20 -0
  23. package/dist/_cjs/templates/cache.template.js +58 -0
  24. package/dist/_cjs/templates/envs.template.js +115 -0
  25. package/dist/_cjs/templates/index.js +26 -0
  26. package/dist/_cjs/templates/index.template.js +38 -0
  27. package/dist/_cjs/templates/initiator.template.js +750 -0
  28. package/dist/_cjs/templates/ioc.template.js +107 -0
  29. package/dist/_cjs/templates/module.template.js +132 -0
  30. package/dist/_cjs/templates/pg-repository.template.js +432 -0
  31. package/dist/_cjs/templates/sys.template.js +110 -0
  32. package/dist/_cjs/templates/transport.template.js +490 -0
  33. package/dist/_cjs/templates/validator.template.js +16 -0
  34. package/dist/_cjs/types/index.js +2 -0
  35. package/dist/_cjs/types/module.js +2 -0
  36. package/dist/_cjs/types/service.js +2 -0
  37. package/dist/_cjs/utils/hello.js +17 -0
  38. package/dist/_cjs/utils/index.js +18 -0
  39. package/dist/_cjs/utils/ts-utils.js +7 -0
  40. package/dist/_types/common/action-kind.d.ts +15 -0
  41. package/dist/_types/common/constants.d.ts +5 -0
  42. package/dist/_types/common/document-kind.d.ts +29 -0
  43. package/dist/_types/common/envs-kind.d.ts +390 -0
  44. package/dist/_types/common/index.d.ts +9 -0
  45. package/dist/_types/common/libraries-kind.d.ts +115 -0
  46. package/dist/_types/common/menu-items.d.ts +7 -0
  47. package/dist/_types/common/protocol-kind.d.ts +59 -0
  48. package/dist/_types/common/symbols-kind.d.ts +44 -0
  49. package/dist/_types/common/typings-kind.d.ts +6 -0
  50. package/dist/_types/debug.d.ts +19 -0
  51. package/dist/_types/index.d.ts +2 -0
  52. package/dist/_types/initiator.d.ts +7 -0
  53. package/dist/_types/schemas/generate.schema.d.ts +38 -0
  54. package/dist/_types/schemas/index.d.ts +2 -0
  55. package/dist/_types/schemas/row.schema.d.ts +20 -0
  56. package/dist/_types/services/generator.d.ts +15 -0
  57. package/dist/_types/services/index.d.ts +3 -0
  58. package/dist/_types/services/installer.d.ts +5 -0
  59. package/dist/_types/services/navigator.d.ts +10 -0
  60. package/dist/_types/services/runner.d.ts +3 -0
  61. package/dist/_types/templates/cache.template.d.ts +8 -0
  62. package/dist/_types/templates/envs.template.d.ts +5 -0
  63. package/dist/_types/templates/index.d.ts +10 -0
  64. package/dist/_types/templates/index.template.d.ts +7 -0
  65. package/dist/_types/templates/initiator.template.d.ts +33 -0
  66. package/dist/_types/templates/ioc.template.d.ts +9 -0
  67. package/dist/_types/templates/module.template.d.ts +8 -0
  68. package/dist/_types/templates/pg-repository.template.d.ts +19 -0
  69. package/dist/_types/templates/sys.template.d.ts +23 -0
  70. package/dist/_types/templates/transport.template.d.ts +15 -0
  71. package/dist/_types/templates/validator.template.d.ts +7 -0
  72. package/dist/_types/types/index.d.ts +2 -0
  73. package/dist/_types/types/module.d.ts +10 -0
  74. package/dist/_types/types/service.d.ts +21 -0
  75. package/dist/_types/utils/hello.d.ts +1 -0
  76. package/dist/_types/utils/index.d.ts +2 -0
  77. package/dist/_types/utils/ts-utils.d.ts +1 -0
  78. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `c-argo-cli`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const cArgoCli = require('c-argo-cli');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionKindMapping = void 0;
4
+ exports.ActionKindMapping = {
5
+ get_by_id: 'getById',
6
+ create_one: 'createOne',
7
+ update_by_id: 'updateById',
8
+ patch_by_id: 'patchById',
9
+ delete_by_id: 'deleteById',
10
+ soft_delete_by_id: 'softDeleteById',
11
+ restore_by_id: 'restoreById',
12
+ archive_by_id: 'archiveById',
13
+ unarchive_by_id: 'unarchiveById',
14
+ // aggregate
15
+ delete_modify_by_id: 'deleteModifyById',
16
+ archive_modify_by_id: 'archiveModifyById',
17
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DESTROY_METHOD = exports.INIT_METHOD = exports.IS_READY_METHOD = exports.THIS = exports.SYMBOL_NAME = void 0;
4
+ exports.SYMBOL_NAME = 'Symbols';
5
+ exports.THIS = 'this';
6
+ exports.IS_READY_METHOD = 'isReady';
7
+ exports.INIT_METHOD = 'init';
8
+ exports.DESTROY_METHOD = 'destroy';
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModuleBlockMapping = exports.DocumentClassMapping = exports.DocumentKindMapping = void 0;
4
+ exports.DocumentKindMapping = {
5
+ module: 'module',
6
+ transport: 'transport',
7
+ controller: 'controller',
8
+ pg_entity: 'pg-entity',
9
+ pg_repository: 'pg-repository',
10
+ tm_entity: 'tm-entity',
11
+ tm_repository: 'tm-repository',
12
+ ch_entity: 'ch-entity',
13
+ ch_repository: 'ch-repository',
14
+ validation_schema: 'validation-schema',
15
+ };
16
+ exports.DocumentClassMapping = {
17
+ module: 'Module',
18
+ transport: 'Transport',
19
+ controller: 'Controller',
20
+ pg_entity: 'PgEntity',
21
+ pg_repository: 'PgRepository',
22
+ tm_entity: 'TmEntity',
23
+ tm_repository: 'TmRepository',
24
+ ch_entity: 'ChEntity',
25
+ ch_repository: 'ChRepository',
26
+ };
27
+ exports.ModuleBlockMapping = {
28
+ postgres: 'postgres',
29
+ timescale: 'timescale',
30
+ entity: 'entity',
31
+ repository: 'repository',
32
+ };
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvsDefaultMapping = exports.getServiceName = exports.EnvsKindMapping = void 0;
4
+ exports.EnvsKindMapping = {
5
+ service_name: 'SERVICE_NAME',
6
+ default_log_level: 'DEFAULT_LOG_LEVEL',
7
+ // tracer
8
+ tracer_collect_url: 'TRACER_COLLECT_URL',
9
+ tracer_type: 'TRACER_TYPE',
10
+ tracer_param: 'TRACER_PARAM',
11
+ tracer_log_spans: 'TRACER_LOG_SPANS',
12
+ // scrambler envs
13
+ scrambler_algorithm: 'SCRAMBLER_ALGORITHM',
14
+ scrambler_random_bytes: 'SCRAMBLER_RANDOM_BYTES',
15
+ scrambler_salt: 'SCRAMBLER_SALT',
16
+ scrambler_access_token_minutes: 'SCRAMBLER_ACCESS_TOKEN_MINUTES',
17
+ scrambler_refresh_token_days: 'SCRAMBLER_REFRESH_TOKEN_DAYS',
18
+ scrambler_jwt_secret: 'SCRAMBLER_JWT_SECRET',
19
+ // mail envs
20
+ mail_is_secure: 'MAIL_IS_SECURE',
21
+ mail_auth_password: 'MAIL_AUTH_PASSWORD',
22
+ mail_auth_username: 'MAIL_AUTH_USERNAME',
23
+ mail_from_sender: 'MAIL_FROM_SENDER',
24
+ mail_port: 'MAIL_PORT',
25
+ mail_host: 'MAIL_HOST',
26
+ // slack envs
27
+ slack_secret: 'SLACK_SECRET',
28
+ slack_token: 'SLACK_TOKEN',
29
+ slack_server_port: 'SLACK_SERVER_PORT',
30
+ slack_server_host: 'SLACK_SERVER_HOST',
31
+ // telegram envs
32
+ telegram_bot_token: 'TELEGRAM_BOT_TOKEN',
33
+ // redis envs
34
+ redis_port: 'REDIS_PORT',
35
+ redis_host: 'REDIS_HOST',
36
+ redis_auth_user: 'REDIS_AUTH_USER',
37
+ redis_auth_password: 'REDIS_AUTH_PASSWORD',
38
+ // broker envs
39
+ broker_url: 'BROKER_URL',
40
+ // click house envs
41
+ click_house_write_host: 'CLICK_HOUSE_WRITE_HOST',
42
+ click_house_write_port: 'CLICK_HOUSE_WRITE_PORT',
43
+ click_house_write_user: 'CLICK_HOUSE_WRITE_USER',
44
+ click_house_write_password: 'CLICK_HOUSE_WRITE_PASSWORD',
45
+ click_house_database: 'CLICK_HOUSE_DATABASE',
46
+ // postgres envs
47
+ postgres_write_host: 'POSTGRES_WRITE_HOST',
48
+ postgres_write_port: 'POSTGRES_WRITE_PORT',
49
+ postgres_write_username: 'POSTGRES_WRITE_USERNAME',
50
+ postgres_write_password: 'POSTGRES_WRITE_PASSWORD',
51
+ postgres_database: 'POSTGRES_DATABASE',
52
+ // timescale envs
53
+ timescale_write_host: 'TIMESCALE_WRITE_HOST',
54
+ timescale_write_port: 'TIMESCALE_WRITE_PORT',
55
+ timescale_write_username: 'TIMESCALE_WRITE_USERNAME',
56
+ timescale_write_password: 'TIMESCALE_WRITE_PASSWORD',
57
+ timescale_database: 'TIMESCALE_DATABASE',
58
+ // storix envs
59
+ storix_aws_endpoint: 'STORIX_AWS_ENDPOINT',
60
+ storix_aws_region: 'STORIX_AWS_REGION',
61
+ storix_aws_access_id: 'STORIX_AWS_ACCESS_ID',
62
+ storix_aws_access_key: 'STORIX_AWS_ACCESS_KEY',
63
+ storix_force_path_style: 'STORIX_FORCE_PATH_STYLE',
64
+ // server envs
65
+ http_server_host: 'HTTP_SERVER_HOST',
66
+ http_server_port: 'HTTP_SERVER_PORT',
67
+ manager_host: 'MANAGER_HOST',
68
+ manager_port: 'MANAGER_PORT',
69
+ ws_server_host: 'WS_SERVER_HOST',
70
+ ws_server_port: 'WS_SERVER_PORT',
71
+ ws_gw_service_endpoint: 'WS_GW_SERVICE_ENDPOINT',
72
+ };
73
+ const getServiceName = (service) => ({ type: 'string', specs: { default: service } });
74
+ exports.getServiceName = getServiceName;
75
+ exports.EnvsDefaultMapping = {
76
+ default_log_level: { type: 'string', specs: { default: 'trace' } },
77
+ // tracer
78
+ tracer_collect_url: { type: 'string', specs: { default: 'http://sys-jaeger:14268/api/traces' } },
79
+ tracer_type: { type: 'string', specs: { default: 'const' } },
80
+ tracer_param: { type: 'number', specs: { default: 1 } },
81
+ tracer_log_spans: { type: 'boolean', specs: { default: true } },
82
+ // scrambler envs
83
+ scrambler_algorithm: { type: 'string', specs: { default: 'RS256' } },
84
+ scrambler_random_bytes: { type: 'number', specs: { default: 10 } },
85
+ scrambler_salt: { type: 'number', specs: { default: 10 } },
86
+ scrambler_access_token_minutes: { type: 'number', specs: { default: 2400 } },
87
+ scrambler_refresh_token_days: { type: 'number', specs: { default: 21 } },
88
+ scrambler_jwt_secret: { type: 'string', specs: { default: 'default' } },
89
+ // mail envs
90
+ mail_is_secure: { type: 'boolean', specs: { default: false } },
91
+ mail_auth_password: { type: 'string', specs: { default: '' } },
92
+ mail_auth_username: { type: 'string', specs: { default: '' } },
93
+ mail_from_sender: { type: 'string', specs: { default: '' } },
94
+ mail_port: { type: 'string', specs: { default: 'smtp.sendgrid.net' } },
95
+ mail_host: { type: 'number', specs: { default: 587 } },
96
+ // slack envs
97
+ slack_secret: { type: 'string', specs: { default: ' ' } },
98
+ slack_token: { type: 'string', specs: { default: ' ' } },
99
+ slack_server_port: { type: 'number', specs: { default: 10001 } },
100
+ slack_server_host: { type: 'string', specs: { default: '0.0.0.0' } },
101
+ // telegram envs
102
+ telegram_bot_token: { type: 'string', specs: { default: '' } },
103
+ // redis envs
104
+ redis_port: { type: 'string', specs: { default: 'sys-redis' } },
105
+ redis_host: { type: 'number', specs: { default: 6379 } },
106
+ redis_auth_user: { type: 'string', specs: { default: 'defaultuser' } },
107
+ redis_auth_password: { type: 'string', specs: { default: 'defaultpass' } },
108
+ // broker envs
109
+ broker_url: { type: 'string', specs: { default: 'sys-kafka:9092' } },
110
+ // click house envs
111
+ click_house_write_host: { type: 'string', specs: { default: '0.0.0.0' } },
112
+ click_house_write_port: { type: 'number', specs: { default: 8123 } },
113
+ click_house_write_user: { type: 'string', specs: { default: 'defaultuser' } },
114
+ click_house_write_password: { type: 'string', specs: { default: 'defaultpass' } },
115
+ click_house_database: { type: 'string', specs: { default: 'defaultdb' } },
116
+ // postgres envs
117
+ postgres_write_host: { type: 'string', specs: { default: 'sys-postgres' } },
118
+ postgres_write_port: { type: 'number', specs: { default: 5432 } },
119
+ postgres_write_username: { type: 'string', specs: { default: 'defaultuser' } },
120
+ postgres_write_password: { type: 'string', specs: { default: 'defaultpass' } },
121
+ postgres_database: { type: 'string', specs: { default: 'defaultdb' } },
122
+ // timescale envs
123
+ timescale_write_host: { type: 'string', specs: { default: 'sys-postgres' } },
124
+ timescale_write_port: { type: 'number', specs: { default: 5432 } },
125
+ timescale_write_username: { type: 'string', specs: { default: 'defaultuser' } },
126
+ timescale_write_password: { type: 'string', specs: { default: 'defaultpass' } },
127
+ timescale_database: { type: 'string', specs: { default: 'defaultdb' } },
128
+ // storix envs
129
+ storix_aws_endpoint: { type: 'string', specs: { default: 'http://localhost:9000' } },
130
+ storix_aws_region: { type: 'string', specs: { default: 'us-east-1' } },
131
+ storix_aws_access_id: { type: 'string', specs: { default: 'defaultuser' } },
132
+ storix_aws_access_key: { type: 'string', specs: { default: 'defaultpass' } },
133
+ storix_force_path_style: { type: 'boolean', specs: { default: true } },
134
+ // server envs
135
+ http_server_host: { type: 'string', specs: { default: '0.0.0.0' } },
136
+ http_server_port: { type: 'number', specs: { default: 10000 } },
137
+ manager_host: { type: 'string', specs: { default: '0.0.0.0' } },
138
+ manager_port: { type: 'number', specs: { default: 14000 } },
139
+ ws_server_host: { type: 'string', specs: { default: '0.0.0.0' } },
140
+ ws_server_port: { type: 'number', specs: { default: 10000 } },
141
+ ws_gw_service_endpoint: { type: 'string', specs: { default: '/ws' } },
142
+ };
@@ -0,0 +1,25 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constants"), exports);
18
+ __exportStar(require("./document-kind"), exports);
19
+ __exportStar(require("./libraries-kind"), exports);
20
+ __exportStar(require("./typings-kind"), exports);
21
+ __exportStar(require("./action-kind"), exports);
22
+ __exportStar(require("./protocol-kind"), exports);
23
+ __exportStar(require("./symbols-kind"), exports);
24
+ __exportStar(require("./envs-kind"), exports);
25
+ __exportStar(require("./menu-items"), exports);
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ManagerKindMapping = exports.TelegramKindMapping = exports.SlackKindMapping = exports.EmailsKindMapping = exports.SqlMethodKindMapping = exports.ClickHouseKindMapping = exports.BrokerKindMapping = exports.StorixKindMapping = exports.ScramblerKindMapping = exports.SqlKindMapping = exports.RedisKindMapping = exports.LoggerKindMapping = exports.ConfigKindMapping = exports.CommonKindTypingsMapping = exports.CommonKindItemsMapping = exports.TracerKindMapping = exports.ContextKindMapping = exports.ImportsKindMapping = exports.CommonKindMapping = exports.WsServerKindMapping = exports.HttpServerKindMapping = exports.ReflectionKindMapping = exports.LibrariesNameMapping = exports.LibrariesKindMapping = void 0;
4
+ exports.LibrariesKindMapping = {
5
+ be_common: '@harvestgate/be-common',
6
+ be_config: '@harvestgate/be-config',
7
+ context: '@harvestgate/context',
8
+ reflection: '@harvestgate/reflection',
9
+ tracer: '@harvestgate/tracer',
10
+ logger: '@harvestgate/logger',
11
+ scrambler: '@harvestgate/scrambler',
12
+ kafka: '@harvestgate/kafka',
13
+ redis: '@harvestgate/redis',
14
+ sql: '@harvestgate/sql',
15
+ slack: '@harvestgate/slack',
16
+ emails: '@harvestgate/emails',
17
+ telegram: '@harvestgate/telegram',
18
+ click_house: '@harvestgate/click-house',
19
+ storix: '@harvestgate/storix',
20
+ manager: '@harvestgate/manager',
21
+ http_server: '@harvestgate/http-server',
22
+ ws_server: '@harvestgate/ws-server',
23
+ };
24
+ exports.LibrariesNameMapping = {
25
+ be_axios: 'Axios',
26
+ scrambler: 'Scrambler',
27
+ email: 'Emails',
28
+ slack: 'Slack',
29
+ telegram: 'Telegram',
30
+ redis: 'Redis',
31
+ broker: 'Kafka broker',
32
+ click_house: 'Click House',
33
+ postgres: 'Postgres',
34
+ timescale: 'Timescale',
35
+ storix: 'Storix',
36
+ manager: 'Manager',
37
+ queue: 'Bull queue',
38
+ http_server: 'Http server',
39
+ ws_server: 'Ws server',
40
+ };
41
+ exports.ReflectionKindMapping = {
42
+ module: 'Module',
43
+ registry: 'Registry',
44
+ locator: 'locator',
45
+ bind: 'bind',
46
+ extract: 'extract',
47
+ transport: 'transport',
48
+ };
49
+ exports.HttpServerKindMapping = {
50
+ http_server: 'HttpServer',
51
+ request: 'Request',
52
+ reply: 'Reply',
53
+ };
54
+ exports.WsServerKindMapping = {
55
+ ws_server: 'WsServer',
56
+ };
57
+ exports.CommonKindMapping = {
58
+ create_symbols: 'createSymbols',
59
+ };
60
+ exports.ImportsKindMapping = {
61
+ schemas: 'schemas',
62
+ };
63
+ exports.ContextKindMapping = {
64
+ context: 'Context',
65
+ };
66
+ exports.TracerKindMapping = {
67
+ tracer: 'Tracer',
68
+ };
69
+ exports.CommonKindItemsMapping = {
70
+ abstract_id_schema: 'AbstractIdSchema',
71
+ };
72
+ exports.CommonKindTypingsMapping = {
73
+ abstract_id_schema: 'AbstractIdArgs',
74
+ };
75
+ exports.ConfigKindMapping = {
76
+ config: 'Config',
77
+ };
78
+ exports.LoggerKindMapping = {
79
+ logger: 'Logger',
80
+ };
81
+ exports.RedisKindMapping = {
82
+ redis: 'Redis',
83
+ };
84
+ exports.SqlKindMapping = {
85
+ postgres: 'Postgres',
86
+ timescale: 'Timescale',
87
+ };
88
+ exports.ScramblerKindMapping = {
89
+ scrambler: 'Scrambler',
90
+ };
91
+ exports.StorixKindMapping = {
92
+ storix: 'Storix',
93
+ };
94
+ exports.BrokerKindMapping = {
95
+ broker: 'Broker',
96
+ };
97
+ exports.ClickHouseKindMapping = {
98
+ click_house: 'ClickHouse',
99
+ };
100
+ exports.SqlMethodKindMapping = {
101
+ repository: 'repository',
102
+ insert_row: 'insertRow',
103
+ update_row: 'updateRow',
104
+ };
105
+ exports.EmailsKindMapping = {
106
+ emails: 'Emails',
107
+ };
108
+ exports.SlackKindMapping = {
109
+ slack: 'Slack',
110
+ };
111
+ exports.TelegramKindMapping = {
112
+ telegram: 'Telegram',
113
+ };
114
+ exports.ManagerKindMapping = {
115
+ manager: 'Manager',
116
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MenuItemsMapping = void 0;
4
+ exports.MenuItemsMapping = {
5
+ generate_service: 'Generate service',
6
+ help: 'Help',
7
+ exit: 'Exit',
8
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpAliasMapping = exports.HttpTypingsMapping = exports.StatusCodeMapping = exports.SchemaBlockMapping = exports.SchemaTypingsMapping = exports.HttpBlockMapping = exports.HttpMethodMapping = exports.AccessScopeMapping = exports.TransportFieldsMapping = exports.ProtocolKindMapping = void 0;
4
+ exports.ProtocolKindMapping = {
5
+ http: 'http',
6
+ };
7
+ exports.TransportFieldsMapping = {
8
+ scope: 'scope',
9
+ method: 'method',
10
+ version: 'version',
11
+ route: 'route',
12
+ schema: 'schema',
13
+ };
14
+ exports.AccessScopeMapping = {
15
+ private: 'private',
16
+ public: 'public',
17
+ hybrid: 'hybrid',
18
+ };
19
+ exports.HttpMethodMapping = {
20
+ get: 'GET',
21
+ post: 'POST',
22
+ put: 'PUT',
23
+ patch: 'PATCH',
24
+ delete: 'DELETE',
25
+ };
26
+ exports.HttpBlockMapping = {
27
+ querystring: 'querystring',
28
+ body: 'body',
29
+ response: 'response',
30
+ };
31
+ exports.SchemaTypingsMapping = {
32
+ schema: 'Schema',
33
+ id_schema: 'IdSchema',
34
+ abstract_id_schema: 'AbstractIdSchema',
35
+ created_schema: 'CreatedSchema',
36
+ updated_schema: 'UpdatedSchema',
37
+ item_schema: 'ItemSchema',
38
+ };
39
+ exports.SchemaBlockMapping = {
40
+ schema: 'Args',
41
+ abstract_id_schema: 'AbstractIdArgs',
42
+ created_schema: 'CreatedArgs',
43
+ updated_schema: 'UpdateArgs',
44
+ id_schema: 'IdArgs',
45
+ item_schema: 'ItemArgs',
46
+ };
47
+ exports.StatusCodeMapping = {
48
+ ok: 200,
49
+ created: 201,
50
+ noContent: 204,
51
+ };
52
+ exports.HttpTypingsMapping = {
53
+ request: 'Request',
54
+ reply: 'Reply',
55
+ params: 'Params',
56
+ querystring: 'Querystring',
57
+ body: 'Body',
58
+ };
59
+ exports.HttpAliasMapping = {
60
+ request: 'req',
61
+ reply: 'reply',
62
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SymbolsAliasMapping = exports.SymbolsKindMapping = void 0;
4
+ exports.SymbolsKindMapping = {
5
+ context: 'Context',
6
+ config: 'Config',
7
+ registry: 'Registry',
8
+ logger: 'Logger',
9
+ tracer: 'Tracer',
10
+ emails: 'Emails',
11
+ slack: 'Slack',
12
+ telegram: 'Telegram',
13
+ broker: 'Broker',
14
+ redis: 'Redis',
15
+ scrambler: 'Scrambler',
16
+ postgres: 'Postgres',
17
+ timescale: 'Timescale',
18
+ storix: 'Storix',
19
+ click_house: 'ClickHouse',
20
+ manager: 'Manager',
21
+ http_server: 'HttpServer',
22
+ ws_server: 'WsServer',
23
+ };
24
+ exports.SymbolsAliasMapping = {
25
+ registry: '_registry',
26
+ context: '_context',
27
+ config: '_config',
28
+ logger: '_logger',
29
+ tracer: '_tracer',
30
+ scrambler: '_scrambler',
31
+ emails: '_emails',
32
+ slack: '_slack',
33
+ telegram: '_telegram',
34
+ redis_subscriber: '_redisSubscriber',
35
+ redis_publisher: '_redisPublisher',
36
+ redis: '_redis',
37
+ broker: '_broker',
38
+ click_house: '_clickHouse',
39
+ postgres: '_postgres',
40
+ timescale: '_timescale',
41
+ storix: '_storix',
42
+ http_server: '_httpServer',
43
+ manager: '_manager',
44
+ ws_server: '_wsServer',
45
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServiceTypingsKindMapping = exports.TypingsKindMapping = void 0;
4
+ exports.TypingsKindMapping = {
5
+ service: 'service',
6
+ };
7
+ exports.ServiceTypingsKindMapping = {
8
+ domains: 'Domains',
9
+ };
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.concept = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const be_common_1 = require("@harvestgate/be-common");
6
+ const severity_kind_1 = require("@harvestgate/alerts-service/src/schemas/latest/common/severity-kind");
7
+ const templates_1 = require("./templates");
8
+ const AlertValidationSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ sysCode: typebox_1.Type.String(),
11
+ cooldownSeconds: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.Number()]),
12
+ severity: (0, be_common_1.LiteralUnion)(severity_kind_1.SeverityKindMapping),
13
+ description: typebox_1.Type.Optional(typebox_1.Type.String()),
14
+ createdAt: be_common_1.DateSchema,
15
+ updatedAt: be_common_1.DateSchema,
16
+ });
17
+ exports.concept = {
18
+ ref: {
19
+ service: 'alerts',
20
+ domain: 'alerts',
21
+ class: 'Alerts',
22
+ item: 'alert',
23
+ entity: 'alt_alerts',
24
+ },
25
+ actions: {
26
+ createOne: {
27
+ properties: {
28
+ withIdReturn: true,
29
+ },
30
+ modules: {
31
+ transport: true,
32
+ controller: true,
33
+ postresRepository: true,
34
+ },
35
+ },
36
+ updateById: {
37
+ modules: { transport: true, controller: true, postresRepository: true },
38
+ properties: {},
39
+ },
40
+ patchById: {
41
+ modules: { transport: true, controller: true, postresRepository: true },
42
+ properties: {},
43
+ },
44
+ getById: {
45
+ properties: {},
46
+ modules: {
47
+ transport: true,
48
+ controller: true,
49
+ postresRepository: true,
50
+ },
51
+ },
52
+ softDeleteById: {
53
+ properties: {},
54
+ modules: {
55
+ transport: true,
56
+ controller: true,
57
+ postresRepository: true,
58
+ },
59
+ },
60
+ restoreById: {
61
+ properties: {},
62
+ modules: {
63
+ transport: true,
64
+ controller: true,
65
+ postresRepository: true,
66
+ },
67
+ },
68
+ archiveById: {
69
+ properties: {},
70
+ modules: {
71
+ transport: true,
72
+ controller: true,
73
+ postresRepository: true,
74
+ },
75
+ },
76
+ unarchiveById: {
77
+ properties: {},
78
+ modules: {
79
+ transport: true,
80
+ controller: true,
81
+ postresRepository: true,
82
+ },
83
+ },
84
+ deleteById: {
85
+ properties: {},
86
+ modules: {
87
+ transport: true,
88
+ controller: true,
89
+ postresRepository: true,
90
+ },
91
+ },
92
+ },
93
+ item: {
94
+ name: {
95
+ structure: {
96
+ domain: { key: 'string', properties: { min: 3, max: 100 } },
97
+ isReadonly: false,
98
+ isPrimary: false,
99
+ isUnique: false,
100
+ },
101
+ generator: {
102
+ sqlAlias: 'name',
103
+ httpClause: 'body',
104
+ isTimestampGenerate: false,
105
+ isOptional: false,
106
+ isUpdated: true,
107
+ },
108
+ },
109
+ description: {
110
+ structure: {
111
+ domain: { key: 'string', properties: { min: 5, max: 2000 } },
112
+ isRequired: false,
113
+ },
114
+ generator: {
115
+ sqlAlias: 'description',
116
+ httpClause: 'body',
117
+ isOptional: true,
118
+ isUpdated: true,
119
+ },
120
+ },
121
+ sysCode: {
122
+ structure: {
123
+ domain: { key: 'string', properties: { min: 5, max: 15 } },
124
+ isUnique: true,
125
+ isReadonly: true,
126
+ },
127
+ generator: {
128
+ sqlAlias: 'sys_code',
129
+ httpClause: 'body',
130
+ isOptional: false,
131
+ },
132
+ },
133
+ cooldownSeconds: {
134
+ structure: {
135
+ domain: { key: 'number', properties: { min: 0, max: 60 * 60 * 24, step: 60 } },
136
+ },
137
+ generator: {
138
+ sqlAlias: 'cooldown_seconds',
139
+ httpClause: 'body',
140
+ isNullable: true,
141
+ isUpdated: true,
142
+ },
143
+ },
144
+ severity: {
145
+ structure: {
146
+ domain: { key: 'enum', properties: { values: (0, be_common_1.createObjectEnum)(severity_kind_1.SeverityKindMapping) } },
147
+ isRequired: true,
148
+ },
149
+ generator: {
150
+ sqlAlias: 'severity',
151
+ httpClause: 'body',
152
+ isOptional: true,
153
+ isUpdated: true,
154
+ },
155
+ },
156
+ createdAt: {
157
+ structure: {
158
+ domain: { key: 'date', properties: {} },
159
+ isRequired: true,
160
+ isReadonly: true,
161
+ },
162
+ generator: {
163
+ isTimestampGenerate: true,
164
+ sqlAlias: 'created_at',
165
+ },
166
+ },
167
+ updatedAt: {
168
+ structure: {
169
+ domain: { key: 'date', properties: {} },
170
+ isRequired: true,
171
+ isReadonly: true,
172
+ },
173
+ generator: {
174
+ isTimestampGenerate: true,
175
+ sqlAlias: 'updated_at',
176
+ },
177
+ },
178
+ },
179
+ };
180
+ // new Initiator().start().catch((e) => console.log(e))
181
+ new templates_1.InitiatorTemplate('./index.ts', {
182
+ service: 'users',
183
+ libraries: {
184
+ broker: true,
185
+ axios: true,
186
+ storix: true,
187
+ redis: true,
188
+ postgres: true,
189
+ scrambler: true,
190
+ httpServer: true,
191
+ timescale: true,
192
+ emails: true,
193
+ wsServer: true,
194
+ },
195
+ });