@wocker/ws 1.0.7 → 1.0.8

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 (96) hide show
  1. package/bin/ws.js +1 -1
  2. package/lib/App.d.ts +1 -6
  3. package/lib/App.js +1 -27
  4. package/lib/AppModule.d.ts +6 -0
  5. package/lib/AppModule.js +97 -0
  6. package/lib/controllers/CompletionController.d.ts +6 -0
  7. package/lib/controllers/CompletionController.js +32 -0
  8. package/lib/controllers/ImageController.d.ts +5 -8
  9. package/lib/controllers/ImageController.js +27 -12
  10. package/lib/controllers/PluginController.d.ts +9 -13
  11. package/lib/controllers/PluginController.js +56 -18
  12. package/lib/controllers/PresetController.d.ts +9 -15
  13. package/lib/controllers/PresetController.js +41 -22
  14. package/lib/controllers/ProjectController.d.ts +27 -69
  15. package/lib/controllers/ProjectController.js +336 -261
  16. package/lib/controllers/ProxyController.d.ts +15 -25
  17. package/lib/controllers/ProxyController.js +142 -96
  18. package/lib/controllers/index.d.ts +1 -0
  19. package/lib/controllers/index.js +1 -0
  20. package/lib/index.d.ts +0 -1
  21. package/lib/index.js +0 -11
  22. package/lib/main.d.ts +3 -0
  23. package/lib/main.js +11 -0
  24. package/lib/makes/Logger.d.ts +2 -2
  25. package/lib/makes/Logger.js +19 -8
  26. package/lib/makes/Preset.d.ts +3 -4
  27. package/lib/makes/Preset.js +19 -8
  28. package/lib/makes/index.d.ts +0 -6
  29. package/lib/makes/index.js +0 -6
  30. package/lib/plugins/ElasticSearchPlugin.d.ts +5 -6
  31. package/lib/plugins/ElasticSearchPlugin.js +19 -8
  32. package/lib/plugins/LocaltunnelPlugin.d.ts +8 -8
  33. package/lib/plugins/LocaltunnelPlugin.js +25 -10
  34. package/lib/plugins/MaildevPlugin.d.ts +5 -6
  35. package/lib/plugins/MaildevPlugin.js +21 -8
  36. package/lib/plugins/MongodbPlugin.d.ts +5 -5
  37. package/lib/plugins/MongodbPlugin.js +26 -11
  38. package/lib/plugins/NgrokPlugin.d.ts +7 -6
  39. package/lib/plugins/NgrokPlugin.js +32 -17
  40. package/lib/plugins/PageKitePlugin.d.ts +10 -8
  41. package/lib/plugins/PageKitePlugin.js +36 -20
  42. package/lib/plugins/ProxmoxPlugin.d.ts +8 -5
  43. package/lib/plugins/ProxmoxPlugin.js +25 -9
  44. package/lib/plugins/RedisPlugin.d.ts +4 -6
  45. package/lib/plugins/RedisPlugin.js +19 -8
  46. package/lib/plugins/index.d.ts +0 -2
  47. package/lib/plugins/index.js +0 -2
  48. package/lib/services/AppConfigService.d.ts +3 -3
  49. package/lib/services/AppConfigService.js +16 -2
  50. package/lib/services/AppEventsService.d.ts +1 -2
  51. package/lib/services/AppEventsService.js +11 -2
  52. package/lib/services/DockerService.d.ts +9 -39
  53. package/lib/services/DockerService.js +122 -4
  54. package/lib/services/LogService.d.ts +3 -5
  55. package/lib/services/LogService.js +19 -4
  56. package/lib/services/PluginService.d.ts +4 -9
  57. package/lib/services/PluginService.js +18 -8
  58. package/lib/services/PresetService.d.ts +5 -5
  59. package/lib/services/PresetService.js +11 -2
  60. package/lib/services/ProjectService.d.ts +9 -6
  61. package/lib/services/ProjectService.js +62 -31
  62. package/lib/utils/get-config.d.ts +2 -2
  63. package/lib/utils/index.d.ts +0 -1
  64. package/lib/utils/index.js +0 -1
  65. package/lib/utils/set-config.d.ts +2 -2
  66. package/package.json +4 -4
  67. package/presets/node/config.json +1 -1
  68. package/presets/php-fpm/Dockerfile +1 -1
  69. package/lib/decorators/Inject.d.ts +0 -1
  70. package/lib/decorators/Inject.js +0 -8
  71. package/lib/decorators/Injectable.d.ts +0 -4
  72. package/lib/decorators/Injectable.js +0 -17
  73. package/lib/decorators/index.d.ts +0 -1
  74. package/lib/decorators/index.js +0 -17
  75. package/lib/makes/Controller.d.ts +0 -5
  76. package/lib/makes/Controller.js +0 -8
  77. package/lib/makes/DI.d.ts +0 -7
  78. package/lib/makes/DI.js +0 -27
  79. package/lib/makes/Docker.d.ts +0 -58
  80. package/lib/makes/Docker.js +0 -320
  81. package/lib/makes/Plugin.d.ts +0 -13
  82. package/lib/makes/Plugin.js +0 -61
  83. package/lib/makes/Project.d.ts +0 -45
  84. package/lib/makes/Project.js +0 -127
  85. package/lib/makes/Repository.d.ts +0 -11
  86. package/lib/makes/Repository.js +0 -22
  87. package/lib/plugins/PostgresPlugin.d.ts +0 -16
  88. package/lib/plugins/PostgresPlugin.js +0 -121
  89. package/lib/types/Config.d.ts +0 -12
  90. package/lib/types/Config.js +0 -2
  91. package/lib/types/EnvConfig.d.ts +0 -3
  92. package/lib/types/EnvConfig.js +0 -2
  93. package/lib/types/index.d.ts +0 -2
  94. package/lib/types/index.js +0 -18
  95. package/lib/utils/demuxOutput.d.ts +0 -2
  96. package/lib/utils/demuxOutput.js +0 -19
@@ -1,320 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Docker = void 0;
7
- const dockerode_1 = __importDefault(require("dockerode"));
8
- const image_build_1 = require("../utils/image-build");
9
- const followProgress_1 = require("../utils/followProgress");
10
- const FS_1 = require("./FS");
11
- const Logger_1 = require("./Logger");
12
- const docker = new dockerode_1.default({
13
- socketPath: "/var/run/docker.sock"
14
- });
15
- class Docker {
16
- static async exec(name, args, tty = true) {
17
- const container = docker.getContainer(name);
18
- const exec = await container.exec({
19
- AttachStdin: true,
20
- AttachStdout: true,
21
- AttachStderr: tty,
22
- Tty: tty,
23
- Cmd: args
24
- });
25
- const stream = await exec.start({
26
- hijack: true,
27
- stdin: tty,
28
- Tty: tty
29
- });
30
- if (tty) {
31
- stream.setEncoding("utf-8");
32
- process.stdin.resume();
33
- if (process.stdin.setRawMode) {
34
- process.stdin.setRawMode(true);
35
- }
36
- process.stdin.setEncoding("utf-8");
37
- process.stdin.pipe(stream);
38
- stream.pipe(process.stdout);
39
- stream.on("error", (err) => {
40
- Logger_1.Logger.error(err.message);
41
- });
42
- stream.on("end", async () => {
43
- process.stdin.setRawMode(false);
44
- });
45
- stream.on("end", async () => {
46
- process.exit();
47
- });
48
- }
49
- return stream;
50
- }
51
- static async getImage(name) {
52
- return docker.getImage(name);
53
- }
54
- static async getContainer(name) {
55
- const containers = await docker.listContainers({
56
- all: true,
57
- filters: {
58
- name: [name]
59
- }
60
- });
61
- const container = containers.find((container) => {
62
- return container.Names.indexOf("/" + name) >= 0;
63
- });
64
- if (container) {
65
- return docker.getContainer(container.Id);
66
- }
67
- return null;
68
- }
69
- static async removeContainer(name) {
70
- const container = await Docker.getContainer(name);
71
- if (!container) {
72
- return;
73
- }
74
- const { State: { Status } } = await container.inspect();
75
- if (Status === "running") {
76
- try {
77
- await container.stop();
78
- }
79
- catch (err) {
80
- Logger_1.Logger.error("Docker.removeContainer: ", err.message);
81
- }
82
- }
83
- try {
84
- await container.remove();
85
- }
86
- catch (err) {
87
- Logger_1.Logger.error("Docker.removeContainer: ", err.message);
88
- }
89
- }
90
- static async getContainerList(options) {
91
- const { name, projectId } = options || {};
92
- const filters = {};
93
- if (name) {
94
- filters.name = [`/${name}`];
95
- }
96
- if (projectId) {
97
- if (!filters.label) {
98
- filters.label = [];
99
- }
100
- filters.label.push(`projectId=${projectId}`);
101
- }
102
- return docker.listContainers({
103
- all: true,
104
- filters: JSON.stringify(filters)
105
- });
106
- }
107
- static async attach(name) {
108
- const container = await Docker.getContainer(name);
109
- const stream = await container.attach({
110
- logs: true,
111
- stream: true,
112
- hijack: true,
113
- stdin: true,
114
- stdout: true,
115
- stderr: true
116
- });
117
- process.stdin.resume();
118
- process.stdin.setEncoding("utf8");
119
- process.stdin.setRawMode(true);
120
- process.stdin.pipe(stream);
121
- process.stdin.on("data", (data) => {
122
- if (data.toString() === "\u0003") {
123
- process.stdin.setRawMode(false);
124
- }
125
- });
126
- stream.setEncoding("utf8");
127
- stream.pipe(process.stdout);
128
- const [width, height] = process.stdout.getWindowSize();
129
- await container.resize({
130
- w: width,
131
- h: height
132
- });
133
- stream.on("end", async () => {
134
- process.exit();
135
- });
136
- process.stdout.on("resize", () => {
137
- const [width, height] = process.stdout.getWindowSize();
138
- container.resize({
139
- w: width,
140
- h: height
141
- });
142
- });
143
- }
144
- static async attachStream(stream) {
145
- process.stdin.resume();
146
- process.stdin.setEncoding("utf8");
147
- process.stdin.pipe(stream);
148
- if (process.stdin.isTTY) {
149
- process.stdin.setRawMode(true);
150
- }
151
- stream.setEncoding("utf8");
152
- stream.pipe(process.stdout);
153
- const end = () => {
154
- process.stdin.pause();
155
- process.stdin.unpipe(stream);
156
- if (process.stdin.isTTY) {
157
- process.stdin.setRawMode(false);
158
- }
159
- stream.unpipe(process.stdout);
160
- };
161
- await new Promise((resolve, reject) => {
162
- stream.on("end", end);
163
- stream.on("error", end);
164
- stream.on("end", resolve);
165
- stream.on("error", reject);
166
- });
167
- }
168
- static async imageExists(tag) {
169
- const image = docker.getImage(tag);
170
- try {
171
- await image.inspect();
172
- return true;
173
- }
174
- catch (ignore) {
175
- return false;
176
- }
177
- }
178
- static async imageLs(options) {
179
- const { tag, reference, labels } = options || {};
180
- const filters = {};
181
- if (reference) {
182
- filters.reference = [
183
- ...filters.reference || [],
184
- reference
185
- ];
186
- }
187
- if (tag) {
188
- filters.reference = [
189
- ...filters.reference || [],
190
- tag
191
- ];
192
- }
193
- if (labels) {
194
- filters.label = [];
195
- for (const i in labels) {
196
- filters.label.push(`${i}=${labels[i]}`);
197
- }
198
- }
199
- return docker.listImages({
200
- filters: JSON.stringify(filters)
201
- });
202
- }
203
- static async imageBuild(options) {
204
- await (0, image_build_1.imageBuild)(options);
205
- }
206
- static async imageBuild2(options) {
207
- const { tag, labels = {}, buildArgs = {}, context, src } = options;
208
- const files = await FS_1.FS.readdirFiles(context, {
209
- recursive: true
210
- });
211
- const stream = await docker.buildImage({
212
- context,
213
- src: files
214
- }, {
215
- t: tag,
216
- labels,
217
- dockerfile: src,
218
- buildargs: buildArgs
219
- });
220
- return stream;
221
- }
222
- static async imageRm(name) {
223
- const image = await docker.getImage(name);
224
- if (!image) {
225
- return;
226
- }
227
- await image.remove();
228
- }
229
- static async pullImage(tag) {
230
- const isExists = await this.imageExists(tag);
231
- if (isExists) {
232
- return;
233
- }
234
- const stream = await docker.pull(tag, {});
235
- await (0, followProgress_1.followProgress)(stream);
236
- }
237
- static async createContainer(options) {
238
- const { name, tty, image, projectId, restart, extraHosts, networkMode, links = [], env = {}, volumes = [], ports = [], cmd = [] } = options;
239
- const network = docker.getNetwork("workspace");
240
- try {
241
- await network.inspect();
242
- }
243
- catch (err) {
244
- if (err.statusCode === 404) {
245
- await docker.createNetwork({
246
- Name: "workspace"
247
- });
248
- }
249
- }
250
- await this.pullImage(image);
251
- return await docker.createContainer({
252
- name,
253
- Image: image,
254
- Hostname: name,
255
- Labels: {
256
- ...projectId ? { projectId } : {}
257
- },
258
- AttachStdin: true,
259
- AttachStdout: true,
260
- AttachStderr: true,
261
- OpenStdin: true,
262
- StdinOnce: false,
263
- Tty: tty,
264
- Cmd: cmd,
265
- Env: Object.keys(env).map((key) => {
266
- const value = env[key];
267
- return `${key}=${value}`;
268
- }),
269
- ExposedPorts: ports.reduce((res, value) => {
270
- const [, , containerPort] = /(\d+):(\d+)/.exec(value) || [];
271
- if (containerPort) {
272
- res[`${containerPort}/tcp`] = {};
273
- }
274
- return res;
275
- }, {}),
276
- HostConfig: {
277
- NetworkMode: networkMode,
278
- ExtraHosts: extraHosts,
279
- ...restart ? {
280
- RestartPolicy: {
281
- Name: restart
282
- }
283
- } : {},
284
- Binds: volumes,
285
- PortBindings: ports.reduce((res, value) => {
286
- const [, hostPort, containerPort] = /(\d+):(\d+)/.exec(value) || [];
287
- if (hostPort && containerPort) {
288
- res[`${containerPort}/tcp`] = [
289
- { HostPort: hostPort }
290
- ];
291
- }
292
- return res;
293
- }, {})
294
- },
295
- NetworkingConfig: {
296
- EndpointsConfig: networkMode === "host" ? {} : {
297
- workspace: {
298
- Links: links
299
- }
300
- }
301
- }
302
- });
303
- }
304
- static async containerRun(options, attach = false) {
305
- const container = await Docker.createContainer(options);
306
- if (attach) {
307
- const stdout = await container.attach({
308
- stream: true,
309
- stdin: true,
310
- stdout: true,
311
- stderr: true
312
- });
313
- stdout.pipe(process.stdout);
314
- }
315
- await container.start();
316
- return container;
317
- }
318
- }
319
- exports.Docker = Docker;
320
- Docker.docker = docker;
@@ -1,13 +0,0 @@
1
- import { Cli } from "@kearisp/cli";
2
- import { Controller } from "../makes/Controller";
3
- declare class Plugin extends Controller {
4
- protected certsDir: string;
5
- protected dataDir: string;
6
- protected pluginDir: string;
7
- constructor(name: string);
8
- install(cli: Cli): void;
9
- certsPath(...paths: string[]): string;
10
- dataPath(...paths: string[]): string;
11
- pluginPath(...paths: string[]): string;
12
- }
13
- export { Plugin };
@@ -1,61 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Plugin = void 0;
27
- const Path = __importStar(require("path"));
28
- const env_1 = require("../env");
29
- const Controller_1 = require("../makes/Controller");
30
- const FS_1 = require("../makes/FS");
31
- class Plugin extends Controller_1.Controller {
32
- constructor(name) {
33
- super();
34
- this.certsDir = Path.join(env_1.DATA_DIR, "certs");
35
- this.dataDir = Path.join(env_1.DATA_DIR, "plugins", name);
36
- this.pluginDir = Path.join(env_1.PLUGINS_DIR, name);
37
- }
38
- install(cli) {
39
- super.install(cli);
40
- if (!FS_1.FS.existsSync(this.certsDir)) {
41
- FS_1.FS.mkdirSync(this.certsDir, {
42
- recursive: true
43
- });
44
- }
45
- if (!FS_1.FS.existsSync(this.dataDir)) {
46
- FS_1.FS.mkdirSync(this.dataDir, {
47
- recursive: true
48
- });
49
- }
50
- }
51
- certsPath(...paths) {
52
- return Path.join(this.certsDir, ...paths);
53
- }
54
- dataPath(...paths) {
55
- return Path.join(this.dataDir, ...paths);
56
- }
57
- pluginPath(...paths) {
58
- return Path.join(this.pluginDir, ...paths);
59
- }
60
- }
61
- exports.Plugin = Plugin;
@@ -1,45 +0,0 @@
1
- import "reflect-metadata";
2
- import { DI } from "../makes/DI";
3
- import { EnvConfig } from "../types";
4
- type SearchOptions = {
5
- id: string;
6
- name: string;
7
- path: string;
8
- };
9
- declare class Project {
10
- id: string;
11
- name: string;
12
- type: string;
13
- path: string;
14
- preset?: string;
15
- imageName?: string;
16
- dockerfile?: string;
17
- scripts?: string[];
18
- buildArgs?: EnvConfig;
19
- env: EnvConfig;
20
- ports?: string[];
21
- volumes?: string[];
22
- metadata?: EnvConfig;
23
- constructor(data: any);
24
- get containerName(): string;
25
- hasEnv(name: string): boolean;
26
- getEnv(name: string, defaultValue?: string): string | undefined;
27
- setEnv(name: string, value: string | boolean): void;
28
- unsetEnv(name: string): void;
29
- hasMeta(name: string): boolean;
30
- getMeta<D = string | undefined>(name: string, defaultValue?: D): D;
31
- setMeta(name: string, value: string | boolean): void;
32
- unsetMeta(name: string): void;
33
- volumeMount(...volumes: string[]): void;
34
- getVolumeBySource(source: string): string | undefined;
35
- getVolumeByDestination(destination: string): string | undefined;
36
- volumeUnmount(...volumes: string[]): void;
37
- save(): Promise<void>;
38
- static install(di: DI): void;
39
- static fromObject(data: any): Project;
40
- static search(params?: Partial<SearchOptions>): Promise<Project[]>;
41
- static searchOne(params: Partial<SearchOptions>): Promise<Project | null>;
42
- }
43
- export { Project };
44
- export declare const PROJECT_TYPE_DOCKERFILE = "dockerfile";
45
- export declare const PROJECT_TYPE_IMAGE = "image";
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0;
4
- require("reflect-metadata");
5
- const ProjectService_1 = require("../services/ProjectService");
6
- const volumeParse_1 = require("../utils/volumeParse");
7
- let projectService;
8
- class Project {
9
- constructor(data) {
10
- this.id = data.id;
11
- this.name = data.name;
12
- this.type = data.type;
13
- this.path = data.path;
14
- this.preset = data.preset;
15
- this.dockerfile = data.dockerfile;
16
- this.imageName = data.imageName;
17
- this.scripts = data.scripts;
18
- this.buildArgs = data.buildArgs;
19
- this.env = data.env || {};
20
- this.ports = data.ports;
21
- this.volumes = data.volumes;
22
- this.metadata = data.metadata;
23
- }
24
- get containerName() {
25
- return `${this.name}.workspace`;
26
- }
27
- hasEnv(name) {
28
- if (!this.env) {
29
- return false;
30
- }
31
- return this.env.hasOwnProperty(name);
32
- }
33
- getEnv(name, defaultValue) {
34
- const { [name]: value = defaultValue } = this.env;
35
- return value;
36
- }
37
- setEnv(name, value) {
38
- this.env = {
39
- ...this.env,
40
- [name]: typeof value === "boolean"
41
- ? (value ? "true" : "false")
42
- : value
43
- };
44
- }
45
- unsetEnv(name) {
46
- if (name in this.env) {
47
- delete this.env[name];
48
- }
49
- }
50
- hasMeta(name) {
51
- return !!this.metadata && this.metadata.hasOwnProperty(name);
52
- }
53
- getMeta(name, defaultValue) {
54
- const { [name]: value = defaultValue } = this.metadata || {};
55
- return value;
56
- }
57
- setMeta(name, value) {
58
- if (!this.metadata) {
59
- this.metadata = {};
60
- }
61
- this.metadata[name] = typeof value === "boolean"
62
- ? (value ? "true" : "false")
63
- : value;
64
- }
65
- unsetMeta(name) {
66
- if (this.metadata && name in this.metadata) {
67
- delete this.metadata[name];
68
- }
69
- if (this.metadata && Object.keys(this.metadata).length === 0) {
70
- delete this.metadata;
71
- }
72
- }
73
- volumeMount(...volumes) {
74
- if (volumes.length === 0) {
75
- return;
76
- }
77
- const [volume, ...restVolumes] = volumes;
78
- const { destination } = (0, volumeParse_1.volumeParse)(volume);
79
- this.volumes = [
80
- ...(this.volumes || []).filter((v) => {
81
- return v !== this.getVolumeByDestination(destination);
82
- }),
83
- volume
84
- ];
85
- this.volumeMount(...restVolumes);
86
- }
87
- getVolumeBySource(source) {
88
- return (this.volumes || []).find((volume) => {
89
- return (0, volumeParse_1.volumeParse)(volume).source === source;
90
- });
91
- }
92
- getVolumeByDestination(destination) {
93
- return (this.volumes || []).find((volume) => {
94
- return (0, volumeParse_1.volumeParse)(volume).destination === destination;
95
- });
96
- }
97
- volumeUnmount(...volumes) {
98
- this.volumes = (this.volumes || []).filter((mounted) => {
99
- return !volumes.includes(mounted);
100
- });
101
- }
102
- async save() {
103
- if (!projectService) {
104
- throw new Error("Dependency is missing");
105
- }
106
- await projectService.save(this);
107
- }
108
- static install(di) {
109
- projectService = di.resolveService(ProjectService_1.ProjectService);
110
- }
111
- static fromObject(data) {
112
- return new Project(data);
113
- }
114
- static async search(params = {}) {
115
- if (!projectService) {
116
- throw new Error("Dependency is missing");
117
- }
118
- return projectService.search(params);
119
- }
120
- static async searchOne(params) {
121
- const [project] = await Project.search(params);
122
- return project || null;
123
- }
124
- }
125
- exports.Project = Project;
126
- exports.PROJECT_TYPE_DOCKERFILE = "dockerfile";
127
- exports.PROJECT_TYPE_IMAGE = "image";
@@ -1,11 +0,0 @@
1
- type Entity = {
2
- id: number | string;
3
- };
4
- export declare class Repository<E extends Entity> {
5
- create(data: Partial<E>): Promise<E>;
6
- update(id: E["id"], record: Partial<E>): Promise<E>;
7
- byId(id: E["id"]): Promise<E>;
8
- search(params?: any): Promise<E[]>;
9
- searchOne(params?: any): Promise<E>;
10
- }
11
- export {};
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Repository = void 0;
4
- class Repository {
5
- async create(data) {
6
- return null;
7
- }
8
- async update(id, record) {
9
- return null;
10
- }
11
- async byId(id) {
12
- return null;
13
- }
14
- async search(params) {
15
- return [];
16
- }
17
- async searchOne(params) {
18
- const [item] = await this.search(params);
19
- return item;
20
- }
21
- }
22
- exports.Repository = Repository;
@@ -1,16 +0,0 @@
1
- import { Cli } from "@kearisp/cli";
2
- import { Plugin } from "../makes";
3
- declare class PostgresPlugin extends Plugin {
4
- protected container: string;
5
- protected adminContainer: string;
6
- constructor();
7
- install(cli: Cli): void;
8
- start(): Promise<void>;
9
- protected startDB(): Promise<void>;
10
- protected startAdmin(): Promise<void>;
11
- stop(): Promise<void>;
12
- protected stopDB(): Promise<void>;
13
- protected stopAdmin(): Promise<void>;
14
- restart(): Promise<void>;
15
- }
16
- export { PostgresPlugin };