From 49ebf991a226e46b4c04cc297891378a832e4273 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 3 Sep 2019 15:21:30 +0200 Subject: [PATCH] fix(core): update --- package-lock.json | 167 ++++++---------------- package.json | 6 +- test/test.ts | 7 +- ts/index.ts | 4 +- ts/smartdaemon.classes.service.ts | 53 +++++++ ts/smartdaemon.classes.smartdaemon.ts | 63 +++----- ts/smartdaemon.classes.systemdmanager.ts | 43 ++++++ ts/smartdaemon.classes.templatemanager.ts | 13 +- ts/smartdaemon.plugins.ts | 4 + 9 files changed, 180 insertions(+), 180 deletions(-) create mode 100644 ts/smartdaemon.classes.service.ts create mode 100644 ts/smartdaemon.classes.systemdmanager.ts diff --git a/package-lock.json b/package-lock.json index c287732..10b7492 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,24 +93,17 @@ } }, "@pushrocks/lik": { - "version": "3.0.5", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.5.tgz", - "integrity": "sha512-pc5Nq0WUysS34qPpyiZXiX254kL3vyRVbt3D36Q5QU+eHhxAThHofSzgOdyVHUZU2WFoaMlKowIVsyUFzIkfdw==", + "version": "3.0.11", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.11.tgz", + "integrity": "sha512-SDKRPj9+xBTqozlDPcA7O6BcccM1Tw/sXPVP+OnhNxCubDZ/L2kGNpPpqm43NJUoNxSSo5wdBw4N7MAFYCGdVg==", "requires": { - "@pushrocks/smartdelay": "^2.0.2", - "@pushrocks/smartpromise": "^2.0.5", + "@pushrocks/smartdelay": "^2.0.3", + "@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartrx": "^2.0.3", - "@pushrocks/smarttime": "^3.0.5", + "@pushrocks/smarttime": "^3.0.12", "@types/minimatch": "^3.0.3", "minimatch": "^3.0.4", - "symbol-tree": "^3.2.2" - }, - "dependencies": { - "@pushrocks/smartpromise": { - "version": "2.0.5", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz", - "integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g==" - } + "symbol-tree": "^3.2.4" } }, "@pushrocks/smartcli": { @@ -187,10 +180,9 @@ } }, "@pushrocks/smartfile": { - "version": "7.0.2", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.2.tgz", - "integrity": "sha512-38l9DRalp1McEBFG+qKzBqefVQZZLPNk+uo7Ff1guy8BDxA+tATlZ6O6FuXW7M3wjFDBi245VJs+KWVKcCxBRA==", - "dev": true, + "version": "7.0.4", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.4.tgz", + "integrity": "sha512-ym8eigWJAQhwgmuVLew3GLrk4WhV03ajapwuMWytxKSzfIW9ZqceJBX2QzOkmhFGA2bp+gc4Q2wOBy3Ffnlj+A==", "requires": { "@pushrocks/smartpath": "^4.0.1", "@pushrocks/smartpromise": "^3.0.2", @@ -207,7 +199,6 @@ "version": "5.1.0", "resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-5.1.0.tgz", "integrity": "sha512-AInn5+UBFIK9FK5xc9yP5e3TQSPNNgjHByqYcj9g5elVBnDQcQL7PlO1CIRy2gWlbwK7UPYqi7vRvFA44dCmYQ==", - "dev": true, "requires": { "@types/node": "*" } @@ -216,7 +207,6 @@ "version": "7.0.1", "resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-7.0.1.tgz", "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -284,8 +274,7 @@ "@pushrocks/smartpath": { "version": "4.0.1", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.1.tgz", - "integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA==", - "dev": true + "integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA==" }, "@pushrocks/smartpromise": { "version": "3.0.2", @@ -293,10 +282,9 @@ "integrity": "sha512-jmrJMUEmBCWChWK8CIcx4Vw3wv/8OgVNmkaxJrbs+WMaoRUfJtpWWJfrAwwHWt9ZXJbarJ+CwfwfYiiZXymndQ==" }, "@pushrocks/smartrequest": { - "version": "1.1.16", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.16.tgz", - "integrity": "sha512-3LbtqoqnjfzWSQ10NryhJmgwPpvMlVoYyTzE676+yC4hM2rnGSzxozLZxMr6enV4VeZcloQ0CqHBivKoT/kdvA==", - "dev": true, + "version": "1.1.23", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.23.tgz", + "integrity": "sha512-Hws3YfzIE0b/E3aTkSugLskKWBq7e8HDXEN+RlRyTFONxW/XONKJFTw4mp3jk+puWpYGDoOTcP+Ua4jd19z9pA==", "requires": { "@pushrocks/smartpromise": "^3.0.2", "@types/form-data": "^2.2.1", @@ -426,20 +414,11 @@ } }, "@types/form-data": { - "version": "2.2.1", - "resolved": "https://verdaccio.lossless.one/@types%2fform-data/-/form-data-2.2.1.tgz", - "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", - "dev": true, + "version": "2.5.0", + "resolved": "https://verdaccio.lossless.one/@types%2fform-data/-/form-data-2.5.0.tgz", + "integrity": "sha512-23/wYiuckYYtFpL+4RPWiWmRQH2BjFuqCUi2+N3amB1a1Drv+i/byTrGvlLwRVLFNAZbwpbQ7JvTK+VCAPMbcg==", "requires": { - "@types/node": "*" - } - }, - "@types/fs-extra": { - "version": "8.0.0", - "resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-8.0.0.tgz", - "integrity": "sha512-bCtL5v9zdbQW86yexOlXWTEGvLNqWxMFyi7gQA7Gcthbezr2cPSOb8SkESVKA937QD5cIwOFLDFt0MQoXOEr9Q==", - "requires": { - "@types/node": "*" + "form-data": "*" } }, "@types/luxon": { @@ -461,7 +440,6 @@ "version": "2.0.3", "resolved": "https://verdaccio.lossless.one/@types%2fvinyl/-/vinyl-2.0.3.tgz", "integrity": "sha512-hrT6xg16CWSmndZqOTJ6BGIn2abKyTw0B58bI+7ioUoj3Sma6u8ftZ1DTI2yCaJamOVGLOnQWiPH3a74+EaqTA==", - "dev": true, "requires": { "@types/node": "*" } @@ -506,7 +484,6 @@ "version": "1.0.10", "resolved": "https://verdaccio.lossless.one/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -520,8 +497,7 @@ "asynckit": { "version": "0.4.0", "resolved": "https://verdaccio.lossless.one/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "balanced-match": { "version": "1.0.0", @@ -627,26 +603,22 @@ "clone": { "version": "2.1.2", "resolved": "https://verdaccio.lossless.one/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" }, "clone-buffer": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", - "dev": true + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=" }, "clone-stats": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=" }, "cloneable-readable": { "version": "1.1.3", "resolved": "https://verdaccio.lossless.one/cloneable-readable/-/cloneable-readable-1.1.3.tgz", "integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==", - "dev": true, "requires": { "inherits": "^2.0.1", "process-nextick-args": "^2.0.0", @@ -676,7 +648,6 @@ "version": "1.0.8", "resolved": "https://verdaccio.lossless.one/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -695,8 +666,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://verdaccio.lossless.one/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cron": { "version": "1.7.1", @@ -752,8 +722,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "diff": { "version": "4.0.1", @@ -778,8 +747,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://verdaccio.lossless.one/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esutils": { "version": "2.0.2", @@ -824,44 +792,24 @@ "version": "2.0.0", "resolved": "https://verdaccio.lossless.one/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", "integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=", - "dev": true, "requires": { "readable-stream": "^2.0.2" } }, "form-data": { - "version": "2.4.0", - "resolved": "https://verdaccio.lossless.one/form-data/-/form-data-2.4.0.tgz", - "integrity": "sha512-4FinE8RfqYnNim20xDwZZE0V2kOs/AuElIjFUbPuegQSaoZM+vUT5FnwSl10KPugH4voTg1bEQlcbCG9ka75TA==", - "dev": true, + "version": "2.5.1", + "resolved": "https://verdaccio.lossless.one/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", "mime-types": "^2.1.12" } }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.2", - "resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.2.2.tgz", - "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==" - } - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "get-caller-file": { "version": "1.0.3", @@ -888,7 +836,6 @@ "version": "7.1.4", "resolved": "https://verdaccio.lossless.one/glob/-/glob-7.1.4.tgz", "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -899,9 +846,9 @@ } }, "graceful-fs": { - "version": "4.1.15", - "resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.1.15.tgz", - "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" + "version": "4.2.2", + "resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.2.2.tgz", + "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==" }, "has-flag": { "version": "3.0.0", @@ -912,7 +859,6 @@ "version": "1.0.6", "resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -921,8 +867,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://verdaccio.lossless.one/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "invert-kv": { "version": "2.0.0", @@ -950,14 +895,12 @@ "is-utf8": { "version": "0.2.1", "resolved": "https://verdaccio.lossless.one/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" }, "isarray": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -974,7 +917,6 @@ "version": "3.13.1", "resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -1049,14 +991,12 @@ "mime-db": { "version": "1.40.0", "resolved": "https://verdaccio.lossless.one/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", - "dev": true + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" }, "mime-types": { "version": "2.1.24", "resolved": "https://verdaccio.lossless.one/mime-types/-/mime-types-2.1.24.tgz", "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "dev": true, "requires": { "mime-db": "1.40.0" } @@ -1130,7 +1070,6 @@ "version": "1.4.0", "resolved": "https://verdaccio.lossless.one/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -1240,8 +1179,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://verdaccio.lossless.one/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { "version": "2.0.1", @@ -1264,14 +1202,12 @@ "pify": { "version": "2.3.0", "resolved": "https://verdaccio.lossless.one/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://verdaccio.lossless.one/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "pump": { "version": "3.0.0", @@ -1287,7 +1223,6 @@ "version": "2.3.6", "resolved": "https://verdaccio.lossless.one/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -1301,14 +1236,12 @@ "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://verdaccio.lossless.one/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" }, "replace-ext": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" }, "require-directory": { "version": "2.1.1", @@ -1351,8 +1284,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://verdaccio.lossless.one/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "semver": { "version": "5.7.0", @@ -1419,8 +1351,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://verdaccio.lossless.one/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "string-width": { "version": "2.1.1", @@ -1436,7 +1367,6 @@ "version": "1.1.1", "resolved": "https://verdaccio.lossless.one/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -1454,7 +1384,6 @@ "version": "2.0.0", "resolved": "https://verdaccio.lossless.one/strip-bom/-/strip-bom-2.0.0.tgz", "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, "requires": { "is-utf8": "^0.2.0" } @@ -1463,7 +1392,6 @@ "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/strip-bom-buf/-/strip-bom-buf-1.0.0.tgz", "integrity": "sha1-HLRar1dTD0yvhsf3UXnSyaUd1XI=", - "dev": true, "requires": { "is-utf8": "^0.2.1" } @@ -1472,7 +1400,6 @@ "version": "2.0.0", "resolved": "https://verdaccio.lossless.one/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz", "integrity": "sha1-+H217yYT9paKpUWr/h7HKLaoKco=", - "dev": true, "requires": { "first-chunk-stream": "^2.0.0", "strip-bom": "^2.0.0" @@ -1579,14 +1506,12 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://verdaccio.lossless.one/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "vinyl": { "version": "2.2.0", "resolved": "https://verdaccio.lossless.one/vinyl/-/vinyl-2.2.0.tgz", "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, "requires": { "clone": "^2.1.1", "clone-buffer": "^1.0.0", @@ -1600,7 +1525,6 @@ "version": "3.0.0", "resolved": "https://verdaccio.lossless.one/vinyl-file/-/vinyl-file-3.0.0.tgz", "integrity": "sha1-sQTZ5ECf+jJfqt1SBkLQo7SIs2U=", - "dev": true, "requires": { "graceful-fs": "^4.1.2", "pify": "^2.3.0", @@ -1681,8 +1605,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://verdaccio.lossless.one/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "y18n": { "version": "4.0.0", diff --git a/package.json b/package.json index 5dcea56..c7669c4 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,12 @@ "tslint-config-prettier": "^1.15.0" }, "dependencies": { + "@pushrocks/lik": "^3.0.11", + "@pushrocks/smartfile": "^7.0.4", "@pushrocks/smartlog": "^2.0.19", "@pushrocks/smartlog-destination-local": "^8.0.2", "@pushrocks/smartshell": "^2.0.25", - "@pushrocks/smartsystem": "^2.0.8", - "@types/fs-extra": "^8.0.0", - "fs-extra": "^8.1.0" + "@pushrocks/smartsystem": "^2.0.8" }, "files": [ "ts/*", diff --git a/test/test.ts b/test/test.ts index 2fa064b..d3f3648 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,8 +1,11 @@ import { expect, tap } from '@pushrocks/tapbundle'; import * as smartdaemon from '../ts/index'; -tap.test('first test', async () => { - console.log(smartdaemon.standardExport); +let testSmartdaemon: smartdaemon.SmartDaemon; + +tap.test('should create an instance of smartdaemon', async () => { + testSmartdaemon = new smartdaemon.SmartDaemon(); + expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon); }); tap.start(); diff --git a/ts/index.ts b/ts/index.ts index 7d6cd2b..9a95325 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,3 +1 @@ -import * as plugins from './smartdaemon.plugins'; - -export let standardExport = 'Hi there! :) This is an exported string'; +export * from './smartdaemon.classes.smartdaemon'; diff --git a/ts/smartdaemon.classes.service.ts b/ts/smartdaemon.classes.service.ts new file mode 100644 index 0000000..c9c96b0 --- /dev/null +++ b/ts/smartdaemon.classes.service.ts @@ -0,0 +1,53 @@ +import * as plugins from './smartdaemon.plugins'; +import * as paths from './smartdaemon.paths'; +import { SmartDaemon } from './smartdaemon.classes.smartdaemon'; + +export interface SmartDaemonServiceConstructorOptions { + name: string; + command: string; + workingDir: string; +} + +/** + * represents a service that is being spawned by SmartDaemon + */ +export class SmartDaemonService implements SmartDaemonServiceConstructorOptions { + public static async createFromOptions(smartdaemonRef: SmartDaemon, optionsArg: SmartDaemonServiceConstructorOptions) { + const service = new SmartDaemonService(smartdaemonRef); + for (const key of Object.keys(optionsArg)) { + service[key] = optionsArg[key]; + } + + } + + public options: SmartDaemonServiceConstructorOptions; + + public name: string; + public command: string; + public workingDir: string; + + public smartdaemonRef: SmartDaemon; + + constructor(smartdaemonRegfArg: SmartDaemon) { + this.smartdaemonRef = smartdaemonRegfArg; + } + + /** + * enables the service + */ + public async enable() { + this.smartdaemonRef + } + + /** + * disables the service + */ + public async disable() { + + } + + /** + * pauses the service + */ + public pause() {}; +} diff --git a/ts/smartdaemon.classes.smartdaemon.ts b/ts/smartdaemon.classes.smartdaemon.ts index 00b01a2..dc92201 100644 --- a/ts/smartdaemon.classes.smartdaemon.ts +++ b/ts/smartdaemon.classes.smartdaemon.ts @@ -1,60 +1,29 @@ import * as plugins from './smartdaemon.plugins'; import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanager'; +import { SmartDaemonService } from './smartdaemon.classes.service'; +import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager'; -const smartDaemonNamespace = 'smartdaemon_'; -interface SmartDaemonConstructorOptions { - name: string; - scriptPath: string; - workingDir: string; -} export class SmartDaemon { - private templateManager: SmartDaemonTemplateManager; - private smartshellInstance: plugins.smartshell.Smartshell; - private smartsystem: plugins.smartsystem.Smartsystem; - private shouldExecute: boolean = false; + + public serviceMap: plugins.lik.Objectmap; + public templateManager: SmartDaemonTemplateManager; + public systemdManager: SmartDaemonSystemdManager; constructor() { - this.templateManager = new SmartDaemonTemplateManager; - this.smartshellInstance = new plugins.smartshell.Smartshell({ - executor: 'bash' - }); - this.smartsystem = new plugins.smartsystem.Smartsystem(); + this.serviceMap = new plugins.lik.Objectmap(); + this.templateManager = new SmartDaemonTemplateManager(this); + this.systemdManager = new SmartDaemonSystemdManager(this); } - public async checkElegibility () { - if (await this.smartsystem.env.isLinuxAsync()) { - this.shouldExecute = true; - } else { - console.log('Smartdaemon can only be used on Linuc systems! Refusing to set up a service.'); - this.shouldExecute = false; - } - return this.shouldExecute; - } - - /** - * enables the service - */ - public async enable() { - + public async addService(serviceName: string, workingDirectory): Promise { + const existingService = this.serviceMap.find(serviceArg => { + return serviceArg + }) }; - /** - * disables the service - */ - public async disable() { - - }; - - /** - * pauses the service - */ - public pause() {}; - - - private async execute(commandArg: string) { - - this.smartshellInstance.exec(commandArg); + public async init() { + await this.systemdManager.init(); } -} \ No newline at end of file +} diff --git a/ts/smartdaemon.classes.systemdmanager.ts b/ts/smartdaemon.classes.systemdmanager.ts new file mode 100644 index 0000000..1230fac --- /dev/null +++ b/ts/smartdaemon.classes.systemdmanager.ts @@ -0,0 +1,43 @@ +import * as plugins from './smartdaemon.plugins'; +import * as paths from './smartdaemon.paths'; +import { SmartDaemon } from './smartdaemon.classes.smartdaemon'; + +export class SmartDaemonSystemdManager { + private smartDaemonNamespace = 'smartdaemon_'; + public smartdaemonRef: SmartDaemon; + public smartshellInstance: plugins.smartshell.Smartshell; + public smartsystem: plugins.smartsystem.Smartsystem; + + public shouldExecute: boolean = false; + + constructor(smartdaemonRefArg: SmartDaemon) { + this.smartdaemonRef = smartdaemonRefArg; + this.smartshellInstance = new plugins.smartshell.Smartshell({ + executor: 'bash' + }); + this.smartsystem = new plugins.smartsystem.Smartsystem(); + } + + public async checkElegibility() { + if (await this.smartsystem.env.isLinuxAsync()) { + this.shouldExecute = true; + } else { + console.log('Smartdaemon can only be used on Linuc systems! Refusing to set up a service.'); + this.shouldExecute = false; + } + return this.shouldExecute; + } + + public async execute(commandArg: string) { + (await this.checkElegibility()) ? await this.smartshellInstance.exec(commandArg) : null; + } + + public async getServices () { + const availableServices = plugins.smartfile.fs.listAllItems(paths.systemdDir, new RegExp(`${this.smartDaemonNamespace}`)); + } + + public async init() { + + }; + +} \ No newline at end of file diff --git a/ts/smartdaemon.classes.templatemanager.ts b/ts/smartdaemon.classes.templatemanager.ts index f185645..6935ff8 100644 --- a/ts/smartdaemon.classes.templatemanager.ts +++ b/ts/smartdaemon.classes.templatemanager.ts @@ -1,11 +1,18 @@ import * as plugins from './smartdaemon.plugins'; +import { SmartDaemon } from './smartdaemon.classes.smartdaemon'; export class SmartDaemonTemplateManager { + public smartdaemonRef: SmartDaemon; + + constructor(smartdaemonRefArg: SmartDaemon) { + this.smartdaemonRef = smartdaemonRefArg; + } + public generateServiceTemplate = (optionsArg: { serviceName: string; description: string; serviceVersion: string; - pathNodeJs: string; + command: string; pathWorkkingDir; pathJsFileToRun; }) => { @@ -18,7 +25,7 @@ After=network.target [Service] Type=simple -ExecStart=${optionsArg.pathNodeJs} ${optionsArg.pathJsFileToRun} +ExecStart=/bin/bash -c "cd ${optionsArg.pathWorkkingDir} && ${optionsArg.command}" WorkingDirectory=${optionsArg.pathWorkkingDir} Restart=on-failure LimitNOFILE=infinity @@ -30,5 +37,5 @@ Restart=always [Install] WantedBy=multi-user.target `; - }; + } } diff --git a/ts/smartdaemon.plugins.ts b/ts/smartdaemon.plugins.ts index 72f2ba5..9133f07 100644 --- a/ts/smartdaemon.plugins.ts +++ b/ts/smartdaemon.plugins.ts @@ -7,12 +7,16 @@ export { }; // @pushrocks scope +import * as lik from '@pushrocks/lik'; +import * as smartfile from '@pushrocks/smartfile'; import * as smartlog from '@pushrocks/smartlog'; import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local'; import * as smartshell from '@pushrocks/smartshell'; import * as smartsystem from '@pushrocks/smartsystem'; export { + lik, + smartfile, smartlog, smartlogDestinationLocal, smartshell,