@wocker/ws 1.0.3 → 1.0.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.
@@ -0,0 +1 @@
1
+ export declare const Inject: () => (target: any) => void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Inject = void 0;
4
+ const Inject = () => {
5
+ return (target) => {
6
+ };
7
+ };
8
+ exports.Inject = Inject;
@@ -0,0 +1,4 @@
1
+ import { DI } from "../makes";
2
+ export declare const Injectable: () => <T extends new (...rest: any[]) => {}>(Target: T) => {
3
+ new (di: DI): {};
4
+ } & T;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Injectable = void 0;
4
+ const Injectable = () => {
5
+ return (Target) => {
6
+ return class extends Target {
7
+ constructor(di) {
8
+ const types = Reflect.getMetadata("design:paramtypes", Target);
9
+ const params = types.map((type) => {
10
+ return (di).resolveService(type);
11
+ });
12
+ super(...params);
13
+ }
14
+ };
15
+ };
16
+ };
17
+ exports.Injectable = Injectable;
@@ -0,0 +1 @@
1
+ export * from "./Injectable";
@@ -0,0 +1,17 @@
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("./Injectable"), exports);
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { App } from "./App";
2
2
  declare const app: App;
3
3
  export { app };
4
+ export * from "./decorators";
4
5
  export * from "./makes";
5
6
  export * from "./services";
package/lib/index.js CHANGED
@@ -28,5 +28,6 @@ app.use(plugins_1.PageKitePlugin);
28
28
  app.use(plugins_1.PostgresPlugin);
29
29
  app.use(plugins_1.ProxmoxPlugin);
30
30
  app.use(plugins_1.RedisPlugin);
31
+ __exportStar(require("./decorators"), exports);
31
32
  __exportStar(require("./makes"), exports);
32
33
  __exportStar(require("./services"), exports);
package/lib/makes/FS.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- /// <reference types="node" />
3
+ import { FS as CoreFS } from "@wocker/core";
4
4
  import * as fs from "fs";
5
- import { Stats, BigIntStats, PathLike, PathOrFileDescriptor, WriteFileOptions, MakeDirectoryOptions, RmOptions } from "fs";
5
+ import { Stats, BigIntStats, PathLike, PathOrFileDescriptor, WriteFileOptions, MakeDirectoryOptions } from "fs";
6
6
  import { PassThrough } from "readable-stream";
7
7
  type ReaddirFilesOptions = {
8
8
  recursive?: boolean;
9
9
  };
10
- declare class FS {
10
+ declare class FS extends CoreFS {
11
11
  static access(path: PathLike): Promise<any>;
12
12
  static exists(path: PathLike): Promise<boolean>;
13
13
  static existsSync(path: PathLike): boolean;
@@ -17,21 +17,15 @@ declare class FS {
17
17
  static readdirFiles(path: string, options?: ReaddirFilesOptions): Promise<string[]>;
18
18
  static appendFile(path: PathOrFileDescriptor, data: any, options?: WriteFileOptions): Promise<unknown>;
19
19
  static appendFileSync(path: PathOrFileDescriptor, data: any, options?: WriteFileOptions): void;
20
- static read(): void;
21
20
  static readBytes(filePath: PathLike, position?: number | bigint, size?: number | bigint): Promise<Buffer>;
22
- static readFile(filePath: PathLike | number): Promise<Buffer>;
23
21
  static readFileSync(filePath: PathLike): Buffer;
24
- static writeFile(filePath: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise<void>;
25
22
  static writeFileSync(path: PathLike, data: any, options?: WriteFileOptions): void;
26
23
  static createWriteStream(path: PathLike): fs.WriteStream;
27
- static readJSON(...paths: string[]): Promise<any>;
28
- static writeJSON(filePath: PathLike | number, data: any): Promise<void>;
29
24
  static unlink(filePath: PathLike): Promise<void>;
30
25
  static watch(filename: PathLike, options?: any): fs.FSWatcher;
31
26
  static stat(filename: PathLike, options?: Parameters<typeof fs.stat>[1]): Promise<Stats | BigIntStats>;
32
27
  static createReadStream(path: PathLike, options?: Parameters<typeof fs.createReadStream>[1]): fs.ReadStream;
33
28
  static createReadLinesStream(path: PathLike, count?: number): PassThrough;
34
29
  static copyFile(src: PathLike, dest: PathLike): Promise<void>;
35
- static rm(path: PathLike, options?: RmOptions): Promise<unknown>;
36
30
  }
37
31
  export { FS };
package/lib/makes/FS.js CHANGED
@@ -24,10 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.FS = void 0;
27
+ const core_1 = require("@wocker/core");
27
28
  const fs = __importStar(require("fs"));
28
29
  const Path = __importStar(require("path"));
29
30
  const readable_stream_1 = require("readable-stream");
30
- class FS {
31
+ class FS extends core_1.FS {
31
32
  static async access(path) {
32
33
  return new Promise((resolve, reject) => {
33
34
  fs.access(path, (err) => {
@@ -131,8 +132,6 @@ class FS {
131
132
  static appendFileSync(path, data, options) {
132
133
  return fs.appendFileSync(path, data, options);
133
134
  }
134
- static read() {
135
- }
136
135
  static async readBytes(filePath, position = 0, size) {
137
136
  if (position < 0 && typeof size === "undefined") {
138
137
  const stats = await FS.stat(filePath);
@@ -171,56 +170,15 @@ class FS {
171
170
  });
172
171
  });
173
172
  }
174
- static async readFile(filePath) {
175
- return new Promise((resolve, reject) => {
176
- fs.readFile(filePath, (err, data) => {
177
- if (!err) {
178
- resolve(data);
179
- }
180
- else {
181
- reject(err);
182
- }
183
- });
184
- });
185
- }
186
173
  static readFileSync(filePath) {
187
174
  return fs.readFileSync(filePath);
188
175
  }
189
- static async writeFile(filePath, data, options) {
190
- return new Promise((resolve, reject) => {
191
- fs.writeFile(filePath, data, options, (err) => {
192
- if (!err) {
193
- resolve();
194
- }
195
- else {
196
- reject(err);
197
- }
198
- });
199
- });
200
- }
201
176
  static writeFileSync(path, data, options) {
202
177
  return fs.writeFileSync(path, data, options);
203
178
  }
204
179
  static createWriteStream(path) {
205
180
  return fs.createWriteStream(path);
206
181
  }
207
- static async readJSON(...paths) {
208
- const res = await new Promise((resolve, reject) => {
209
- const filePath = Path.join(...paths);
210
- fs.readFile(filePath, (err, data) => {
211
- if (err) {
212
- reject(err);
213
- return;
214
- }
215
- resolve(data);
216
- });
217
- });
218
- return JSON.parse(res.toString());
219
- }
220
- static async writeJSON(filePath, data) {
221
- const json = JSON.stringify(data, null, 4);
222
- return FS.writeFile(filePath, json);
223
- }
224
182
  static async unlink(filePath) {
225
183
  return new Promise((resolve, reject) => {
226
184
  fs.unlink(filePath, (err) => {
@@ -330,15 +288,5 @@ class FS {
330
288
  });
331
289
  });
332
290
  }
333
- static async rm(path, options) {
334
- return new Promise((resolve, reject) => {
335
- fs.rm(path, options, (err) => {
336
- if (err) {
337
- return reject(err);
338
- }
339
- return resolve(undefined);
340
- });
341
- });
342
- }
343
291
  }
344
292
  exports.FS = FS;
package/lib/utils/exec.js CHANGED
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.exec = void 0;
7
- const core_1 = require("@wocker/core");
8
7
  const child_process_1 = require("child_process");
9
8
  const chalk_1 = __importDefault(require("chalk"));
9
+ const makes_1 = require("../makes");
10
10
  const exec = async (command) => {
11
- core_1.Logger.info(` > ${command.trim().replace(/\s+/g, " ")}`);
11
+ makes_1.Logger.info(` > ${command.trim().replace(/\s+/g, " ")}`);
12
12
  return new Promise((resolve, reject) => {
13
13
  const worker = (0, child_process_1.exec)(command, {
14
14
  maxBuffer: Infinity
@@ -32,10 +32,10 @@ const exec = async (command) => {
32
32
  });
33
33
  }
34
34
  worker.on("close", (code) => {
35
- core_1.Logger.info("close", chalk_1.default.red(code));
35
+ makes_1.Logger.info("close", chalk_1.default.red(code));
36
36
  });
37
37
  worker.on("exit", (code) => {
38
- core_1.Logger.info("exit", chalk_1.default.red(code));
38
+ makes_1.Logger.info("exit", chalk_1.default.red(code));
39
39
  });
40
40
  });
41
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocker/ws",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Docker workspace for web projects",
6
6
  "license": "MIT",