@wocker/core
Advanced tools
Comparing version 1.0.1 to 1.0.2
import { DI } from "../makes/DI"; | ||
export declare const Injectable: (ddi?: DI) => <T extends new (...rest: any[]) => {}>(Target: T) => { | ||
export declare const Injectable: () => <T extends new (...rest: any[]) => {}>(Target: T) => { | ||
new (di: DI): {}; | ||
} & T; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Injectable = void 0; | ||
const Injectable = (ddi) => { | ||
const Injectable = () => { | ||
return (Target) => { | ||
@@ -6,0 +6,0 @@ // @ts-ignore |
@@ -6,8 +6,13 @@ export { Cli } from "@kearisp/cli"; | ||
export * from "./makes/DI"; | ||
export * from "./makes/Logger"; | ||
export * from "./makes/Plugin"; | ||
export * from "./models/Preset"; | ||
export * from "./models/Project"; | ||
export * from "./services/AppConfigService"; | ||
export * from "./services/AppEventsService"; | ||
export * from "./services/DockerService"; | ||
export * from "./services/LogService"; | ||
export * from "./services/PresetService"; | ||
export * from "./services/ProjectService"; | ||
export * from "./services/ProjectServiceInterface"; | ||
export * from "./types/AppConfig"; | ||
export * from "./types/EnvConfig"; |
@@ -24,8 +24,13 @@ "use strict"; | ||
__exportStar(require("./makes/DI"), exports); | ||
__exportStar(require("./makes/Logger"), exports); | ||
__exportStar(require("./makes/Plugin"), exports); | ||
__exportStar(require("./models/Preset"), exports); | ||
__exportStar(require("./models/Project"), exports); | ||
__exportStar(require("./services/AppConfigService"), exports); | ||
__exportStar(require("./services/AppEventsService"), exports); | ||
__exportStar(require("./services/DockerService"), exports); | ||
__exportStar(require("./services/LogService"), exports); | ||
__exportStar(require("./services/PresetService"), exports); | ||
__exportStar(require("./services/ProjectService"), exports); | ||
__exportStar(require("./services/ProjectServiceInterface"), exports); | ||
__exportStar(require("./types/AppConfig"), exports); | ||
__exportStar(require("./types/EnvConfig"), exports); |
@@ -6,4 +6,3 @@ import "reflect-metadata"; | ||
registerService(key: any, service: any): void; | ||
use(): void; | ||
} | ||
export { DI }; |
@@ -13,5 +13,7 @@ "use strict"; | ||
const types = Reflect.getMetadata("design:paramtypes", key); | ||
const params = types ? types.map((type) => { | ||
return this.resolveService(type); | ||
}) : []; | ||
if (types && types.length > 0) { | ||
types.forEach((type) => { | ||
this.resolveService(type); | ||
}); | ||
} | ||
res = new key(this); | ||
@@ -25,5 +27,3 @@ this.services.set(key, res); | ||
} | ||
use() { | ||
} | ||
} | ||
exports.DI = DI; |
@@ -14,2 +14,3 @@ import "reflect-metadata"; | ||
path: string; | ||
preset?: string; | ||
imageName?: string; | ||
@@ -20,4 +21,6 @@ dockerfile?: string; | ||
volumes?: string[]; | ||
ports?: string[]; | ||
static di?: DI; | ||
constructor(data: any); | ||
hasEnv(name: string): boolean; | ||
getEnv(name: string, defaultValue?: string): string | undefined; | ||
@@ -24,0 +27,0 @@ setEnv(name: string, value: string | boolean): void; |
@@ -25,6 +25,16 @@ "use strict"; | ||
this.path = data.path; | ||
this.preset = data.preset; | ||
this.dockerfile = data.dockerfile; | ||
this.imageName = data.imageName; | ||
this.buildArgs = data.buildArgs; | ||
this.env = data.env || {}; | ||
this.buildArgs = data.buildArgs; | ||
this.ports = data.ports; | ||
this.volumes = data.volumes; | ||
} | ||
hasEnv(name) { | ||
if (!this.env) { | ||
return false; | ||
} | ||
return this.env.hasOwnProperty(name); | ||
} | ||
getEnv(name, defaultValue) { | ||
@@ -31,0 +41,0 @@ const { [name]: value = defaultValue } = this.env; |
@@ -5,21 +5,16 @@ import { AppConfig } from "../types/AppConfig"; | ||
}; | ||
declare class AppConfigService { | ||
protected DATA_DIR: string; | ||
protected PLUGINS_DIR: string; | ||
protected MAP_PATH: string; | ||
protected pwd: string; | ||
protected mapTypes: TypeMap; | ||
constructor(DATA_DIR: string, PLUGINS_DIR: string, MAP_PATH: string); | ||
dataPath(...args: string[]): string; | ||
pluginsPath(...args: string[]): string; | ||
getData(): string; | ||
getPWD(): string; | ||
setPWD(pwd: string): void; | ||
getAppConfig(): Promise<AppConfig>; | ||
setProject(): Promise<void>; | ||
getAllEnvVariables(): Promise<AppConfig["env"]>; | ||
getEnvVariable(name: string, defaultValue?: string): Promise<string | undefined>; | ||
setProjectConfig(id: string, path: string): Promise<void>; | ||
getProjectTypes(): TypeMap; | ||
declare abstract class AppConfigService { | ||
abstract dataPath(...args: string[]): string; | ||
abstract pluginsPath(...args: string[]): string; | ||
abstract getPWD(): string; | ||
abstract setPWD(pwd: string): void; | ||
abstract getAppConfig(): Promise<AppConfig>; | ||
abstract getAllEnvVariables(): Promise<AppConfig["env"]>; | ||
abstract getEnvVariable(name: string, defaultValue?: string): Promise<string | undefined>; | ||
abstract setEnvVariable(name: string, value: string | number): Promise<void>; | ||
abstract setProjectConfig(id: string, path: string): Promise<void>; | ||
abstract getProjectTypes(): TypeMap; | ||
abstract registerProjectType(name: string, title?: string): void; | ||
abstract activatePlugin(name: string): Promise<void>; | ||
} | ||
export { AppConfigService }; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AppConfigService = void 0; | ||
const Path = __importStar(require("path")); | ||
const FS = __importStar(require("fs")); | ||
class AppConfigService { | ||
constructor(DATA_DIR, PLUGINS_DIR, MAP_PATH) { | ||
this.DATA_DIR = DATA_DIR; | ||
this.PLUGINS_DIR = PLUGINS_DIR; | ||
this.MAP_PATH = MAP_PATH; | ||
this.mapTypes = { | ||
image: "Image", | ||
dockerfile: "Dockerfile" | ||
}; | ||
this.pwd = (process.cwd() || process.env.PWD); | ||
} | ||
dataPath(...args) { | ||
return Path.join(this.DATA_DIR, ...args); | ||
} | ||
pluginsPath(...args) { | ||
return Path.join(this.PLUGINS_DIR, ...args); | ||
} | ||
getData() { | ||
return "Test"; | ||
} | ||
getPWD() { | ||
return this.pwd; | ||
} | ||
setPWD(pwd) { | ||
this.pwd = pwd; | ||
} | ||
getAppConfig() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const content = yield FS.promises.readFile(this.MAP_PATH); | ||
return JSON.parse(content.toString()); | ||
}); | ||
} | ||
setProject() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// | ||
}); | ||
} | ||
getAllEnvVariables() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
getEnvVariable(name, defaultValue) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return undefined; | ||
}); | ||
} | ||
setProjectConfig(id, path) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error(""); | ||
}); | ||
} | ||
getProjectTypes() { | ||
return this.mapTypes; | ||
} | ||
} | ||
exports.AppConfigService = AppConfigService; |
type EventHandle = (...args: any[]) => Promise<void> | void; | ||
declare class AppEventsService { | ||
protected handles: ({ | ||
[event: string]: EventHandle[]; | ||
}); | ||
on(event: string, handle: EventHandle): () => void; | ||
off(event: string, handle: EventHandle): void; | ||
emit(event: string, ...args: any[]): Promise<void>; | ||
declare abstract class AppEventsService { | ||
abstract on(event: string, handle: EventHandle): void; | ||
abstract off(event: string, handle: EventHandle): void; | ||
abstract emit(event: string, ...args: any[]): Promise<void>; | ||
} | ||
export { EventHandle as AppEventHandle, AppEventsService }; | ||
export { AppEventsService, EventHandle as AppEventHandle }; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AppEventsService = void 0; | ||
class AppEventsService { | ||
constructor() { | ||
this.handles = {}; | ||
} | ||
on(event, handle) { | ||
this.handles[event] = [ | ||
...this.handles[event] || [], | ||
handle | ||
]; | ||
return () => { | ||
this.handles[event] = this.handles[event].filter((filterHandle) => { | ||
return filterHandle !== handle; | ||
}); | ||
}; | ||
} | ||
off(event, handle) { | ||
// | ||
} | ||
emit(event, ...args) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const handles = this.handles[event] || []; | ||
for (const i in handles) { | ||
yield handles[i](...args); | ||
} | ||
}); | ||
} | ||
} | ||
exports.AppEventsService = AppEventsService; |
import { Project } from "../models/Project"; | ||
type SearchParams = { | ||
type SearchParams = Partial<{ | ||
id: string; | ||
name: string; | ||
path: string; | ||
}; | ||
declare class ProjectService { | ||
cdProject(name: string): Promise<void>; | ||
get(): Promise<Project>; | ||
start(project: Project): Promise<void>; | ||
stop(project: Project): Promise<void>; | ||
save(project: Project): Promise<void>; | ||
search(params?: Partial<SearchParams>): Promise<Project[]>; | ||
}>; | ||
declare abstract class ProjectService { | ||
abstract cdProject(name: string): Promise<void>; | ||
abstract get(): Promise<Project>; | ||
abstract start(project: Project): Promise<void>; | ||
abstract stop(project: Project): Promise<void>; | ||
abstract save(project: Project): Promise<void>; | ||
abstract search(params: SearchParams): Promise<Project[]>; | ||
searchOne(params?: SearchParams): Promise<Project | null>; | ||
} | ||
export { ProjectService, SearchParams as ProjectServiceSearchParams }; |
@@ -14,33 +14,9 @@ "use strict"; | ||
class ProjectService { | ||
cdProject(name) { | ||
searchOne(params = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error("Project not found"); | ||
const [project] = yield this.search(params); | ||
return project || null; | ||
}); | ||
} | ||
get() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error("Project not found"); | ||
}); | ||
} | ||
start(project) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error("Project not found"); | ||
}); | ||
} | ||
stop(project) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error("Project not found"); | ||
}); | ||
} | ||
save(project) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error("Dependency is missing"); | ||
}); | ||
} | ||
search(params = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
throw new Error("Dependency is missing"); | ||
}); | ||
} | ||
} | ||
exports.ProjectService = ProjectService; |
@@ -5,2 +5,3 @@ import { EnvConfig } from "./EnvConfig"; | ||
env: EnvConfig; | ||
plugins: string[]; | ||
projects: { | ||
@@ -7,0 +8,0 @@ id: string; |
{ | ||
"name": "@wocker/core", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Wocker Core", | ||
@@ -22,2 +22,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/dockerode": "^3.3.23", | ||
"@types/node": "^20.8.9", | ||
@@ -24,0 +25,0 @@ "typescript": "^5.2.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
32891
53
856
2
3