raiton 1.0.0-alpha.2 → 1.0.0-alpha.3

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 (72) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -2
  3. package/build/bin/index.mjs +3798 -3644
  4. package/build/raiton-1.0.0-alpha.3.tgz +0 -0
  5. package/deno.json +9 -0
  6. package/package.json +2 -1
  7. package/source/bin/cli-tools.ts +1 -6
  8. package/source/bin/constants.ts +5 -0
  9. package/source/bin/index.ts +1 -1
  10. package/source/commands/develop.command.ts +3 -3
  11. package/source/commands/start.command.ts +1 -1
  12. package/source/core/application.ts +66 -18
  13. package/source/core/builder.ts +27 -21
  14. package/source/core/controller/builder.ts +8 -5
  15. package/source/core/controller/metadata.ts +1 -1
  16. package/source/core/directories.ts +1 -1
  17. package/source/core/index.ts +0 -1
  18. package/source/core/injection/injection.ts +67 -5
  19. package/source/core/middleware/compose.ts +1 -1
  20. package/source/core/raiton.ts +2 -3
  21. package/source/core/router/handler.ts +100 -44
  22. package/source/core/thread.ts +18 -8
  23. package/source/sdk/artifacts.ts +65 -41
  24. package/source/sdk/constants/decorators.constant.ts +1 -0
  25. package/source/sdk/data-transfer-object.ts +11 -3
  26. package/source/sdk/decorators/parametrable.ts +19 -15
  27. package/source/sdk/decorators/routable.decorator.ts +0 -3
  28. package/source/sdk/encryption.ts +5 -6
  29. package/source/sdk/enums/encrypted.enum.ts +10 -0
  30. package/source/sdk/enums/http-status.enum.ts +73 -0
  31. package/source/sdk/enums/index.ts +2 -1
  32. package/source/sdk/exceptions/http-exception.ts +28 -0
  33. package/source/sdk/exceptions/index.ts +2 -0
  34. package/source/sdk/index.ts +7 -0
  35. package/source/sdk/parameter-bag.ts +55 -0
  36. package/source/sdk/repositories.ts +1 -1
  37. package/source/sdk/responses/error.ts +52 -0
  38. package/source/sdk/responses/helpers.ts +28 -0
  39. package/source/sdk/responses/http-throwable.ts +28 -0
  40. package/source/sdk/responses/http.ts +48 -0
  41. package/source/sdk/responses/index.ts +4 -0
  42. package/source/sdk/runtime/bun/server.ts +2 -1
  43. package/source/sdk/runtime/deno/server.ts +2 -2
  44. package/source/sdk/runtime/node/server.ts +2 -2
  45. package/source/sdk/utilities/artifact.util.ts +18 -0
  46. package/source/sdk/utilities/index.ts +1 -3
  47. package/source/types/application.ts +3 -3
  48. package/source/types/artifact.ts +36 -32
  49. package/source/types/builder.ts +0 -4
  50. package/source/types/config.ts +2 -2
  51. package/source/types/controller.ts +1 -2
  52. package/source/types/index.ts +2 -3
  53. package/source/types/lifecycle.ts +11 -0
  54. package/source/types/responses.ts +17 -7
  55. package/source/types/runtime.ts +1 -1
  56. package/build/raiton-1.0.0-alpha.2.tgz +0 -0
  57. package/source/core/artifacts/artifact.ts +0 -109
  58. package/source/core/artifacts/artifacts.ts +0 -10
  59. package/source/core/artifacts/index.ts +0 -1
  60. package/source/core/artifacts/runner.ts +0 -3
  61. package/source/core/hmr.ts +0 -106
  62. package/source/sdk/decorators/payload.decorator.ts +0 -77
  63. package/source/sdk/json.ts +0 -55
  64. package/source/sdk/request.ts +0 -3
  65. package/source/sdk/responses.ts +0 -45
  66. package/source/sdk/schemes.ts +0 -178
  67. package/source/sdk/utilities/artifacts.util.ts +0 -62
  68. package/source/sdk/utilities/controller.util.ts +0 -8
  69. package/source/types/data-transfer-object.ts +0 -4
  70. package/source/types/hmr.ts +0 -39
  71. /package/source/sdk/enums/{http.enum.ts → http-method.enum.ts} +0 -0
  72. /package/source/sdk/{throwable.ts → exceptions/throwable.ts} +0 -0
@@ -0,0 +1,55 @@
1
+ import {ParseableEntriesType, ParseablePrimitiveType} from "@/types";
2
+ import {stabilizeJson} from "./utilities";
3
+ import {DynamicParameter, IDynamicParameters, IDynamicProps, IParameter,} from "@protorians/parameters";
4
+
5
+
6
+ export class ParameterBag<T extends ParseableEntriesType> {
7
+
8
+ protected _bag: IDynamicParameters<any>;
9
+
10
+ constructor(data: T) {
11
+ this._bag = new DynamicParameter(this.initializeData(data));
12
+ }
13
+
14
+ protected initializeData(data: T): any {
15
+ const prepared = {} as IDynamicProps<T>
16
+
17
+ for (const [key, value] of Object.entries(data)) {
18
+ prepared[key as keyof T] = {
19
+ value,
20
+ } as IParameter<T[keyof T]>
21
+ }
22
+
23
+ return prepared
24
+ }
25
+
26
+ get bag(): IDynamicParameters<any> {
27
+ return this._bag;
28
+ }
29
+
30
+ records(data: T): this {
31
+ for (const [key, value] of Object.entries(data))
32
+ this._bag.update(key as keyof T, value);
33
+ return this;
34
+ }
35
+
36
+ render(): T {
37
+ return Object.fromEntries(this._bag.stack) as any as T;
38
+ }
39
+
40
+ toString(): string {
41
+ return JSON.stringify(this.render());
42
+ }
43
+
44
+ static stabilize<T>(json: string | T | null): T {
45
+ return stabilizeJson<T>(json);
46
+ }
47
+
48
+ static from<T extends IDynamicProps<T>>(data: T): ParameterBag<T> {
49
+ return new ParameterBag<T>(data);
50
+ }
51
+
52
+ static records<T extends IDynamicProps<T>>(support: ParameterBag<T>, data: ParseablePrimitiveType<T>): ParameterBag<T> {
53
+ return support.records(this.stabilize(data));
54
+ }
55
+ }
@@ -1,4 +1,4 @@
1
- import {Throwable} from "./throwable";
1
+ import {Throwable} from "@/sdk/exceptions";
2
2
 
3
3
 
4
4
  export class DelegateRepository {
@@ -0,0 +1,52 @@
1
+ import type {ErrorResponseInterface} from "@/types";
2
+ import {HttpResponse} from "@/sdk/responses/http";
3
+
4
+
5
+ export class HttpErrorResponse {
6
+ public readonly stack: Map<string, ErrorResponseInterface> = new Map();
7
+
8
+ public get entries(): ErrorResponseInterface[] {
9
+ return [...this.stack.values()];
10
+ }
11
+
12
+ public add(input: ErrorResponseInterface): this {
13
+ this.stack.set(input.id, input)
14
+ return this;
15
+ }
16
+
17
+ public remove(id: string): this {
18
+ this.stack.delete(id);
19
+ return this;
20
+ }
21
+
22
+ public get(id: string): ErrorResponseInterface | undefined {
23
+ return this.stack.get(id);
24
+ }
25
+
26
+ public has(id: string): boolean {
27
+ return this.stack.has(id);
28
+ }
29
+
30
+ public clear(): this {
31
+ this.stack.clear();
32
+ return this;
33
+ }
34
+
35
+ public get empty(): boolean {
36
+ return this.stack.size === 0;
37
+ }
38
+
39
+ public get existence(): number {
40
+ return this.stack.size
41
+ }
42
+
43
+ public push() {
44
+ const first = this.stack.values().next().value;
45
+ HttpResponse.push({
46
+ statusCode: 500,
47
+ message: first?.message || 'Internal server error',
48
+ error: true,
49
+ errorStack: this.entries
50
+ })
51
+ }
52
+ }
@@ -0,0 +1,28 @@
1
+ import {HttpResponse, HttpStatus} from "@/sdk";
2
+ import {HttpResponseInterface} from "@/types";
3
+ import {Raiton} from "@/core";
4
+
5
+
6
+ export function RaitonResponses(
7
+ message: string,
8
+ data: HttpResponseInterface,
9
+ statusCode: HttpStatus,
10
+ metadata?: Omit<HttpResponseInterface<any>, 'data' | 'message' | 'statusCode'>
11
+ ) {
12
+
13
+ if (metadata) {
14
+ metadata.error = typeof data.error === 'boolean' ? data.error : false
15
+ metadata.errorStack = (metadata.errorStack instanceof Error)
16
+ ? metadata.errorStack
17
+ : (Raiton.thread?.builder?.options?.development
18
+ ? (Array.isArray(metadata.errorStack) ? metadata.errorStack : [])
19
+ : undefined)
20
+ }
21
+
22
+ return {
23
+ ...metadata,
24
+ statusCode,
25
+ message,
26
+ data,
27
+ }
28
+ }
@@ -0,0 +1,28 @@
1
+ import {HttpResponseInterface} from "@/types";
2
+ import {HttpStatus} from "@/sdk/enums";
3
+ import {Raiton} from "@/core";
4
+
5
+
6
+ export class ThrowableResponse extends Error {
7
+ constructor(
8
+ public input: string | HttpResponseInterface,
9
+ public statusCode: HttpStatus = HttpStatus.INTERNAL_SERVER_ERROR,
10
+ ) {
11
+ super(typeof input === 'string' ? input : input.message);
12
+ }
13
+
14
+ render() {
15
+ const stack = typeof this.input === 'object' ? this.input.errorStack : undefined
16
+ return {
17
+ message: this.message,
18
+ statusCode: this.statusCode,
19
+ data: (typeof this.input === 'object') ? this.input.data : undefined,
20
+ error: (typeof this.input === 'object') ? this.input.error : false,
21
+ stack: stack instanceof Error ?
22
+ (Raiton.thread?.builder?.options?.development
23
+ ? this.stack?.split('\n').map(e => e.trim())
24
+ : undefined)
25
+ : stack
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,48 @@
1
+ import {HttpResponseInterface} from "@/types";
2
+ import {HttpStatus} from "@/sdk/enums";
3
+ import {ThrowableResponse} from "@/sdk/responses";
4
+
5
+
6
+ export class HttpResponse {
7
+ public static push(response: Partial<HttpResponseInterface>): void {
8
+ throw new ThrowableResponse({
9
+ statusCode: response.statusCode || HttpStatus.BAD_REQUEST,
10
+ message: response.message || 'No response message provided',
11
+ data: response.data,
12
+ error: response.error,
13
+ errorStack: response.errorStack
14
+ })
15
+ }
16
+
17
+ constructor(public readonly response: HttpResponseInterface) {
18
+ }
19
+
20
+ status(statusCode: HttpStatus): this {
21
+ this.response.statusCode = statusCode;
22
+ return this;
23
+ }
24
+
25
+ message(message: string) {
26
+ this.response.message = message;
27
+ return this;
28
+ }
29
+
30
+ data(data: any) {
31
+ this.response.data = data;
32
+ return this;
33
+ }
34
+
35
+ error(error: boolean) {
36
+ this.response.error = error;
37
+ return this;
38
+ }
39
+
40
+ stack(stack: Error) {
41
+ this.response.errorStack = stack
42
+ return this;
43
+ }
44
+
45
+ render(): HttpResponseInterface {
46
+ return (new ThrowableResponse({...this.response})).render()
47
+ }
48
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./error"
2
+ export * from "./http-throwable"
3
+ export * from "./http"
4
+ export * from "./helpers"
@@ -9,9 +9,10 @@ export const bunRuntime: RuntimeAdapterInterface = {
9
9
  let server: any
10
10
 
11
11
  return {
12
- async listen(port) {
12
+ async listen(port, hostname) {
13
13
  server = Bun.serve({
14
14
  port,
15
+ hostname,
15
16
  fetch: async (request: Request) => {
16
17
  let responseBody: any
17
18
  let statusCode = 200
@@ -5,13 +5,13 @@ export const denoRuntime: RuntimeAdapterInterface = {
5
5
  let controller: AbortController
6
6
 
7
7
  return {
8
- async listen(port) {
8
+ async listen(port, hostname) {
9
9
  if (typeof Deno === 'undefined') throw new Error(
10
10
  'Deno is not installed, please run `deno install -A -f --unstable https://deno.land/x/raiton/cli.ts`'
11
11
  )
12
12
 
13
13
  controller = new AbortController()
14
- Deno.serve({port, signal: controller.signal}, async (req: any) => {
14
+ Deno.serve({port, hostname, signal: controller.signal}, async (req: any) => {
15
15
  let body: any
16
16
  let status = 200
17
17
  const headers = new Headers()
@@ -45,9 +45,9 @@ export const nodeRuntime: RuntimeAdapterInterface = {
45
45
  })
46
46
 
47
47
  return {
48
- listen(port) {
48
+ listen(port, hostname) {
49
49
  return new Promise((resolve) =>
50
- server.listen(port, resolve)
50
+ server.listen(port, hostname, resolve)
51
51
  )
52
52
  },
53
53
  close() {
@@ -0,0 +1,18 @@
1
+ export function isControllerArtifact(filename: string) {
2
+ return isArtifact(filename, 'controller')
3
+ }
4
+
5
+
6
+ export function isServiceArtifact(filename: string) {
7
+ return isArtifact(filename, 'service')
8
+ }
9
+
10
+ export function isArtifact(filename: string, artifact: string) {
11
+ return [
12
+ filename.endsWith(`.${artifact}.ts`),
13
+ filename.endsWith(`.${artifact}.js`),
14
+ filename.endsWith(`.${artifact}.mjs`),
15
+ filename.endsWith(`.${artifact}.cjs`),
16
+ ].some(Boolean)
17
+ }
18
+
@@ -1,7 +1,5 @@
1
- // export * from "./alias-path.util"
2
- export * from "./artifacts.util"
3
1
  export * from "./callable.util"
4
2
  export * from "./utilities.util"
5
- export * from "./controller.util"
3
+ export * from "./artifact.util"
6
4
  export * from "./json.util"
7
5
  export * from "./path.util"
@@ -16,9 +16,9 @@ export interface ApplicationInterface {
16
16
 
17
17
  get hostname(): string;
18
18
 
19
- // setOption<K extends keyof ApplicationConfig>(key: K, value: ApplicationConfig[K]): this;
20
- //
21
- // setOptions(options: ApplicationConfig): this;
19
+ setOption<K extends keyof ApplicationConfig>(key: K, value: ApplicationConfig[K]): this;
20
+
21
+ setOptions(options: ApplicationConfig): this;
22
22
 
23
23
  register(plugin: any): this;
24
24
 
@@ -4,37 +4,41 @@ export interface ArtifactEntry {
4
4
  size: number;
5
5
  }
6
6
 
7
- export type ArtifactDecoratorHandler = () => void;
8
-
9
- export interface ArtifactDecorator {
10
- syntax: RegExp;
11
- handler: ArtifactDecoratorHandler;
12
- }
13
-
14
- export interface ArtifactOptions {
15
- readonly artifact: string;
16
- readonly provider: string;
17
- readonly decorator: ArtifactDecorator;
18
- verbose?: boolean;
19
- }
20
-
21
- export interface ArtifactInterface {
22
- readonly options: ArtifactOptions;
23
- readonly directory: string;
24
- readonly file: string;
25
- readonly workdir: string;
26
-
27
- get files(): string[];
28
-
29
- get extensions(): string[];
30
-
31
- scan(): string[];
32
-
33
- generate(): boolean;
7
+ export interface ArtifactsConfig {
8
+ types: string[]
34
9
  }
35
10
 
36
- export interface ArtifactEntry {
37
- vendor: string;
38
- decorator: string;
39
- pattern: string;
40
- }
11
+ // export type ArtifactDecoratorHandler = () => void;
12
+
13
+ // export interface ArtifactDecorator {
14
+ // syntax: RegExp;
15
+ // handler: ArtifactDecoratorHandler;
16
+ // }
17
+
18
+ // export interface ArtifactOptions {
19
+ // readonly artifact: string;
20
+ // readonly provider: string;
21
+ // readonly decorator: ArtifactDecorator;
22
+ // verbose?: boolean;
23
+ // }
24
+
25
+ // export interface ArtifactInterface {
26
+ // readonly options: ArtifactOptions;
27
+ // readonly directory: string;
28
+ // readonly file: string;
29
+ // readonly workdir: string;
30
+ //
31
+ // get files(): string[];
32
+ //
33
+ // get extensions(): string[];
34
+ //
35
+ // scan(): string[];
36
+ //
37
+ // generate(): boolean;
38
+ // }
39
+
40
+ // export interface ArtifactEntry {
41
+ // vendor: string;
42
+ // decorator: string;
43
+ // pattern: string;
44
+ // }
@@ -1,6 +1,3 @@
1
- import type {BuildContext, BuildOptions, Metafile} from "esbuild";
2
- import {HmrInterface} from "@/types/hmr";
3
- import {ISignalStack} from "@protorians/core";
4
1
  import {WatchEventType} from "node:fs";
5
2
 
6
3
  export interface BuildCommandOptions {
@@ -17,7 +14,6 @@ export type BuilderBootCallable = (builder: BuilderInterface) => Promise<void>
17
14
  export interface BuilderInterface {
18
15
  readonly workdir: string;
19
16
  readonly options: BuilderConfig;
20
- readonly hmr: HmrInterface;
21
17
  // readonly signal: ISignalStack<BuilderSignalMap>;
22
18
 
23
19
  // get context(): BuildContext<BuildOptions> | null;
@@ -1,7 +1,7 @@
1
- import {ArtifactEntry} from "@/types/artifact";
1
+ import type {ArtifactsConfig} from "@/types/artifact";
2
2
 
3
3
  export interface Configurable {
4
4
  rootDir: string;
5
5
  version: string;
6
- artifacts?: ArtifactEntry[]
6
+ artifacts?: ArtifactsConfig
7
7
  }
@@ -5,7 +5,6 @@ import {MiddlewareCallable, MiddlewareType} from "@/types/middleware";
5
5
  export interface ControllerMetaInterface {
6
6
  prefix?: string;
7
7
  routes: RouteMetaInterface[];
8
- params: Record<string, ParamMetaInterface[]>;
9
8
  middlewares: Record<string, MiddlewareCallable[]>;
10
9
  }
11
10
 
@@ -15,7 +14,6 @@ export interface RouteMetaInterface {
15
14
  method: HttpMethod;
16
15
  path: string;
17
16
  propertyKey: string;
18
- params: ParamMetaInterface[];
19
17
  }
20
18
 
21
19
  export interface ParamMetaInterface {
@@ -23,6 +21,7 @@ export interface ParamMetaInterface {
23
21
  type: Parametrable;
24
22
  key?: string;
25
23
  callable?: (ctx: Context) => any;
24
+ metatype?: any;
26
25
  }
27
26
 
28
27
  export interface RouteDecoratorParameters {
@@ -3,7 +3,6 @@ export type * from "./builder"
3
3
  export type * from "./thread"
4
4
  export type * from "./access-guards"
5
5
  export type * from "./contruct"
6
- export type * from "./data-transfer-object"
7
6
  export type * from "./directory"
8
7
  export type * from "./encryption"
9
8
  export type * from "./generic"
@@ -13,7 +12,6 @@ export type * from "./scheme"
13
12
  export type * from "./values"
14
13
  export type * from "./utilities"
15
14
  export type * from "./artifact"
16
- export type * from "./hmr"
17
15
  export type * from "./middleware"
18
16
  export type * from "./core"
19
17
  export type * from "./plugin"
@@ -23,4 +21,5 @@ export type * from "./controller"
23
21
  export type * from "./injection"
24
22
  export type * from "./responses"
25
23
  export type * from "./server"
26
- export type * from "./raiton"
24
+ export type * from "./raiton"
25
+ export type * from "./lifecycle"
@@ -0,0 +1,11 @@
1
+ export interface OnMount {
2
+ onMount(): void | Promise<void>;
3
+ }
4
+
5
+ export interface OnUnmount {
6
+ onUnmount(): void | Promise<void>;
7
+ }
8
+
9
+ export interface OnInit {
10
+ onInit(): void | Promise<void>;
11
+ }
@@ -1,10 +1,20 @@
1
- import type {ParseableEntriesType} from "@/types/parseable";
1
+ import {HttpStatus} from "@/sdk/enums/http-status.enum";
2
2
 
3
- export interface ResponseParameters {
4
- readonly message?: string;
5
- readonly error?: boolean;
6
- readonly statusCode?: number;
7
- readonly errorStack?: Error;
8
- readonly data?: ParseableEntriesType
3
+ export interface HttpResponseBaseInterface {
4
+ message: string;
5
+ statusCode?: HttpStatus;
9
6
  }
10
7
 
8
+ export interface HttpResponseInterface<T = any> extends HttpResponseBaseInterface{
9
+ error?: boolean;
10
+ errorStack?: Error | ErrorResponseInterface[];
11
+ data?: T
12
+ }
13
+
14
+ export interface ErrorResponseInterface {
15
+ id: string;
16
+ message?: string;
17
+ code?: string;
18
+ statusCode?: HttpStatus;
19
+ error?: Error
20
+ }
@@ -1,7 +1,7 @@
1
1
  import {RuntimeType} from "@/sdk/enums/runtime.enum";
2
2
 
3
3
  export interface RuntimeServerInterface {
4
- listen(port: number): Promise<void>
4
+ listen(port: number, hostname?: string): Promise<void>
5
5
 
6
6
  close(): Promise<void>
7
7
 
Binary file
@@ -1,109 +0,0 @@
1
- import type {ArtifactEntry, ArtifactInterface, ArtifactOptions} from "@/types/artifact";
2
- import {RaitonDirectories} from "@/core/directories";
3
- import {Raiton} from "@/core/raiton";
4
- import path from "node:path";
5
- import fs from "node:fs";
6
- import {LBadge, Logger} from "@protorians/logger";
7
- import {ArtifactFactory} from "@/sdk/artifacts";
8
- import {Throwable} from "@/sdk/throwable";
9
-
10
- export class Artifact implements ArtifactInterface {
11
- public readonly directory: string;
12
- public readonly file: string;
13
- public readonly workdir: string;
14
-
15
- protected _files: string[] = [];
16
-
17
- constructor(
18
- public readonly options: ArtifactOptions,
19
- ) {
20
- this.options.verbose = typeof options.verbose === "undefined" ? false : options.verbose;
21
-
22
- if (!Raiton.thread.builder?.source)
23
- throw new Throwable("Artifact need project source");
24
-
25
- this.directory = RaitonDirectories.artifacts(Raiton.thread.builder?.workdir)
26
- this.workdir = Raiton.thread.builder.source;
27
- this.file = path.join(this.directory, `${this.options.artifact}.d.ts`);
28
- }
29
-
30
- get files(): string[] {
31
- return this._files;
32
- }
33
-
34
- get extensions(): string[] {
35
- return [
36
- `${this.options.artifact}.ts`,
37
- `${this.options.artifact}.js`,
38
- `${this.options.artifact}.mjs`,
39
- `${this.options.artifact}.cjs`,
40
- ]
41
- }
42
-
43
- /**
44
- * Finds all files with end 'artifact.EXT'
45
- */
46
- scan(): string[] {
47
- this._files = [];
48
-
49
- fs.readdirSync(this.workdir, {recursive: true})
50
- .forEach(f => {
51
- this._files = [
52
- ...this._files,
53
- ...this.extensions.filter(ext => f.toString().endsWith(ext))
54
- ];
55
- })
56
- ;
57
-
58
- return this._files;
59
- }
60
-
61
- generate(): boolean {
62
- try {
63
- let mappings = "";
64
-
65
- for (const file of this._files) {
66
- const filename = path.join(this.workdir, file);
67
- const content = fs.readFileSync(filename, "utf-8");
68
- const match = content.match(this.options.decorator?.syntax);
69
-
70
- if (!match) continue;
71
-
72
- let name = match[3] || match[1] || "";
73
- if (!name) {
74
- const classMatch = content.match(/export\s+default\s+class\s+([A-Za-z0-9_]+)/);
75
- name = classMatch?.[1] || path.parse(filename).name;
76
- }
77
-
78
- mappings += ` ${name}: InstanceType<typeof import("@/${file}").default>;\n`;
79
-
80
- if (this.options.verbose) Logger.info(LBadge.debug(name), `artifact detected`);
81
-
82
- ArtifactFactory.add(
83
- this.options.artifact, {
84
- file,
85
- dir: this.workdir,
86
- relative: file,
87
- absolute: filename
88
- }
89
- )
90
- }
91
-
92
- const content = `// AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
93
- declare global {
94
- interface ${this.options.provider} {
95
- ${mappings} }
96
- }
97
- export {};`;
98
- fs.writeFileSync(this.file, content, "utf-8");
99
- if (!ArtifactFactory.save(this.options.artifact))
100
- throw new Throwable(`Failed to save artifacts for ${this.options.artifact}`);
101
-
102
- return true;
103
- } catch (e: any) {
104
- Logger.error(`Failed to resolve artifacts for ${this.options.artifact}`, e.message ?? e);
105
- }
106
- return false;
107
- }
108
-
109
- }
@@ -1,10 +0,0 @@
1
- import {RaitonConfig} from "@/core";
2
-
3
- export class Artifacts {
4
-
5
- public static async load(workdir: string) {
6
- await RaitonConfig.sync(workdir);
7
- return RaitonConfig.get('artifacts');
8
- }
9
-
10
- }
@@ -1 +0,0 @@
1
- export * from "./artifact";
@@ -1,3 +0,0 @@
1
- export function artifactRunner () {
2
-
3
- }