@onivoro/onix 20.5.54 → 20.5.56

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/executors.json CHANGED
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "typeorm-db-client": {
14
14
  "implementation": "./src/executors/typeorm-db-client/executor",
15
- "schema": "./src/executors/typeorm/schema.json",
15
+ "schema": "./src/executors/typeorm-db-client/schema.json",
16
16
  "description": "typeorm-db-client"
17
17
  },
18
18
  "docker-run": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onivoro/onix",
3
- "version": "20.5.54",
3
+ "version": "20.5.56",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
@@ -4,22 +4,32 @@ const tslib_1 = require("tslib");
4
4
  const load_env_file_function_1 = require("../../functions/load-env-file.function");
5
5
  const executor_factory_function_1 = require("../../functions/executor-factory.function");
6
6
  const child_process_1 = require("child_process");
7
+ const os_1 = require("os");
7
8
  exports.default = (0, executor_factory_function_1.executorFactory)((options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
8
- const { envFile, host = 'DV_HOST', database = 'DV_DB', password = 'DV_PASSWORD', port = 'DV_PORT', username = 'DV_USER', type = 'DV_TYPE', httpPort } = options || {};
9
+ const { envFile, host, db, password, port, user, type, httpPort } = options || {};
9
10
  if (envFile) {
10
11
  (0, load_env_file_function_1.loadEnvFile)(envFile);
11
12
  }
13
+ const http = env(httpPort);
12
14
  (0, child_process_1.execSync)(`docker` + ' ' + [
13
15
  'run',
14
- `-p ${httpPort}:${httpPort}`,
15
- `--env="DV_HOST=${process.env[host]}"`,
16
- `--env="DV_DB=${process.env[database]}"`,
17
- `--env="DV_PASSWORD=${process.env[password]}"`,
18
- `--env="DV_PORT=${process.env[port]}"`,
19
- `--env="DV_USER=${process.env[username]}"`,
20
- `--env="DV_TYPE=${process.env[type]}"`,
21
- `--env="PORT=${httpPort}"`,
22
- 'icedlee337/datavore:arm64v8'
16
+ `-p ${http}:${http}`,
17
+ `--env="DV_HOST=${env(host)}"`,
18
+ `--env="DV_DB=${env(db)}"`,
19
+ `--env="DV_PASSWORD=${env(password)}"`,
20
+ `--env="DV_PORT=${env(port)}"`,
21
+ `--env="DV_USER=${env(user)}"`,
22
+ `--env="DV_TYPE=${env(type)}"`,
23
+ `--env="PORT=${http}"`,
24
+ `icedlee337/datavore:${((0, os_1.arch)() === 'arm64') ? 'arm64v8' : 'amd64'}`
23
25
  ].join(' '));
24
26
  }));
27
+ function env(value) {
28
+ if (!value) {
29
+ return value;
30
+ }
31
+ if (value.toString().includes('process.env')) {
32
+ return eval(value);
33
+ }
34
+ }
25
35
  //# sourceMappingURL=executor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/typeorm-db-client/executor.ts"],"names":[],"mappings":";;;AAEA,mFAAqE;AACrE,yFAA4E;AAC5E,iDAAyC;AAEzC,kBAAe,IAAA,2CAAe,EAAC,CAC7B,OAAuB,EACvB,OAAwB,EACxB,EAAE;IACF,MAAM,EACJ,OAAO,EACP,IAAI,GAAG,SAAS,EAChB,QAAQ,GAAG,OAAO,EAClB,QAAQ,GAAG,aAAa,EACxB,IAAI,GAAG,SAAS,EAChB,QAAQ,GAAG,SAAS,EACpB,IAAI,GAAG,SAAS,EAChB,QAAQ,EACT,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,IAAI,OAAO,EAAE,CAAC;QACZ,IAAA,oCAAW,EAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,IAAA,wBAAQ,EAAC,QAAQ,GAAG,GAAG,GAAG;QACxB,KAAK;QACL,MAAM,QAAQ,IAAI,QAAQ,EAAE;QAC5B,kBAAkB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG;QACtC,gBAAgB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG;QACxC,sBAAsB,OAAO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G;QACtB,uBAAuB,CAAC,IAAA,SAAI,GAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE;KACpE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEf,CAAC,CAAA,CAAC,CAAC;AAEH,SAAS,GAAG,CAAC,KAAa;IACxB,IAAG,CAAC,KAAK,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -1,10 +1,10 @@
1
1
  export interface ExecutorSchema {
2
+ db: string;
2
3
  envFile?: string;
3
- host?: string;
4
- port?: number;
5
- username?: string;
6
- password?: string;
7
- database?: string;
8
- type?: string;
9
- httpPort: number;
4
+ host: string;
5
+ httpPort: string;
6
+ password: string;
7
+ port: string;
8
+ type: string;
9
+ user: string;
10
10
  }
@@ -11,42 +11,48 @@
11
11
  },
12
12
  "host": {
13
13
  "type": "string",
14
- "description": "Database host (defaults to localhost or DB_HOST env var)",
15
- "default": "localhost"
14
+ "description": "Database host"
16
15
  },
17
16
  "port": {
18
- "type": "number",
19
- "description": "Database port (defaults to 5432 or DB_PORT env var)",
20
- "default": 5432
17
+ "type": "string",
18
+ "description": "Database port"
21
19
  },
22
20
  "httpPort": {
23
- "type": "number",
24
- "description": "Local port to accept HTTP traffic",
21
+ "type": "string",
22
+ "description": "Local port to accept HTTP traffic"
25
23
  },
26
- "username": {
24
+ "user": {
27
25
  "type": "string",
28
- "description": "Database username (defaults to postgres or DB_USERNAME/DB_USER env var)",
29
- "default": "postgres"
26
+ "description": "Database username"
30
27
  },
31
28
  "password": {
32
29
  "type": "string",
33
- "description": "Database password (defaults to empty or DB_PASSWORD env var)",
34
- "default": ""
30
+ "description": "Database password"
35
31
  },
36
- "database": {
32
+ "db": {
37
33
  "type": "string",
38
- "description": "Database name (defaults to postgres or DB_DATABASE/DB_NAME env var)",
39
- "default": "postgres"
34
+ "description": "Database name"
40
35
  },
41
36
  "type": {
42
37
  "type": "string",
43
- "description": "Database type (defaults to postgres or DB_TYPE env var)",
44
- "default": "postgres",
45
- "enum": ["postgres", "mysql", "mariadb", "sqlite", "mssql", "oracle"]
38
+ "description": "Database type",
39
+ "enum": [
40
+ "postgres",
41
+ "mysql",
42
+ "mariadb",
43
+ "sqlite",
44
+ "mssql",
45
+ "oracle"
46
+ ]
46
47
  }
47
48
  },
48
49
  "required": [
49
- "envFile",
50
- "httpPort"
50
+ "db",
51
+ "host",
52
+ "httpPort",
53
+ "password",
54
+ "port",
55
+ "type",
56
+ "user"
51
57
  ]
52
- }
58
+ }