@senhainfo/shared-utils 1.2.2 → 1.2.4
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/lib/windows-service.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { Service, ServiceConfig } from "node-windows";
|
|
2
|
+
interface WindowsServiceOptions extends Partial<ServiceConfig> {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
script: string;
|
|
6
|
+
}
|
|
2
7
|
export declare class WindowsService {
|
|
3
8
|
private options;
|
|
4
9
|
service: Service;
|
|
5
10
|
/**
|
|
6
11
|
* Constructor
|
|
7
|
-
* @param {
|
|
12
|
+
* @param {WindowsServiceOptions} options - Options for the Windows service
|
|
8
13
|
*
|
|
9
14
|
* @default { name: "Senha API - Service", script: "dist/server.js" }
|
|
10
15
|
*
|
|
11
16
|
* @example
|
|
12
17
|
* const service = new WindowsService({ name: "My Service", script: "path/to/service" });
|
|
13
18
|
*/
|
|
14
|
-
constructor(
|
|
19
|
+
constructor(options: WindowsServiceOptions);
|
|
20
|
+
private initialize;
|
|
15
21
|
}
|
|
22
|
+
export {};
|
|
16
23
|
//# sourceMappingURL=windows-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-service.d.ts","sourceRoot":"","sources":["../src/windows-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"windows-service.d.ts","sourceRoot":"","sources":["../src/windows-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtD,UAAU,qBAAsB,SAAQ,OAAO,CAAC,aAAa,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA8B;IACtC,OAAO,EAAE,OAAO,CAAC;IAExB;;;;;;;;OAQG;gBACS,OAAO,EAAE,qBAAqB;IAM1C,OAAO,CAAC,UAAU;CAmBnB"}
|
package/lib/windows-service.js
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.WindowsService = void 0;
|
|
7
4
|
const node_windows_1 = require("node-windows");
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
5
|
class WindowsService {
|
|
10
6
|
/**
|
|
11
7
|
* Constructor
|
|
12
|
-
* @param {
|
|
8
|
+
* @param {WindowsServiceOptions} options - Options for the Windows service
|
|
13
9
|
*
|
|
14
10
|
* @default { name: "Senha API - Service", script: "dist/server.js" }
|
|
15
11
|
*
|
|
16
12
|
* @example
|
|
17
13
|
* const service = new WindowsService({ name: "My Service", script: "path/to/service" });
|
|
18
14
|
*/
|
|
19
|
-
constructor(
|
|
20
|
-
this.options = {
|
|
21
|
-
|
|
22
|
-
description: "Senha API - Service",
|
|
23
|
-
script: node_path_1.default.join("dist", "server.js"),
|
|
24
|
-
};
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.options = {};
|
|
17
|
+
Object.assign(this.options, options);
|
|
25
18
|
this.service = new node_windows_1.Service(this.options);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
this.initialize();
|
|
20
|
+
}
|
|
21
|
+
initialize() {
|
|
29
22
|
this.service
|
|
30
23
|
.on("install", () => {
|
|
31
24
|
this.service.start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-service.js","sourceRoot":"","sources":["../src/windows-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"windows-service.js","sourceRoot":"","sources":["../src/windows-service.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AAQtD,MAAa,cAAc;IAIzB;;;;;;;;OAQG;IACH,YAAY,OAA8B;QAZlC,YAAO,GAA2B,EAAE,CAAC;QAa3C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAO,CAAC,IAAI,CAAC,OAAwB,CAAC,CAAC;QAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAEO,UAAU;QAChB,IAAI,CAAC,OAAO;aACT,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,CAAC;QAC1D,CAAC,CAAC;aACD,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC3B,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,IAAI,wBAAwB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;YACpB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,IAAI,eAAe,CAAC,CAAC;QAC5D,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC,CAAC;aACD,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;CACF;AAtCD,wCAsCC"}
|