@sidekick-coder/zenith-kit 0.0.4 → 0.0.5

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.
@@ -61,7 +61,7 @@ command
61
61
  run('npm', ['version', bump])
62
62
 
63
63
  console.log('\nBuilding...')
64
- run('npm', ['run', 'build'])
64
+ run('npm', ['run', 'build', '--', '--dts'])
65
65
 
66
66
  console.log('\nPublishing to npm...')
67
67
  run('npm', ['publish'])
@@ -0,0 +1,147 @@
1
+ import { ChildProcess } from "node:child_process";
2
+
3
+ //#region src/server/gateways/GitGateway.d.ts
4
+ interface GitRepoInfo {
5
+ directory: string;
6
+ head: string | null;
7
+ shortHash: string;
8
+ isDetachedHead: boolean;
9
+ remotes: string[];
10
+ }
11
+ interface GitGatewayOptions {
12
+ cwd: string;
13
+ sshKey?: string;
14
+ }
15
+ declare class GitGateway {
16
+ private readonly cwd;
17
+ private readonly env?;
18
+ constructor({
19
+ cwd,
20
+ sshKey
21
+ }: GitGatewayOptions);
22
+ run(args: string): Promise<string>;
23
+ tryRun(args: string): Promise<string | null>;
24
+ checkout(ref: string): Promise<void>;
25
+ fetch(): Promise<void>;
26
+ pull(): Promise<void>;
27
+ getInfo(): Promise<GitRepoInfo>;
28
+ }
29
+ //#endregion
30
+ //#region src/server/services/GitBranchRepository.d.ts
31
+ interface GitBranch {
32
+ name: string;
33
+ remote: string | null;
34
+ isCurrent: boolean;
35
+ isRemote: boolean;
36
+ }
37
+ interface GitBranchFetchOptions {
38
+ remote: string;
39
+ branch: string;
40
+ localName?: string;
41
+ }
42
+ declare class GitBranchRepository {
43
+ private readonly gateway;
44
+ constructor(gateway: GitGateway);
45
+ list(): Promise<GitBranch[]>;
46
+ fetch(options: GitBranchFetchOptions): Promise<void>;
47
+ }
48
+ //#endregion
49
+ //#region src/server/services/GitCommitRepository.d.ts
50
+ interface GitCommitRef {
51
+ name: string;
52
+ shortName: string;
53
+ type: 'branch' | 'tag' | 'remote' | 'other';
54
+ }
55
+ interface GitCommit {
56
+ hash: string;
57
+ shortHash: string;
58
+ authorName: string;
59
+ authorEmail: string;
60
+ date: string;
61
+ message: string;
62
+ refs: GitCommitRef[];
63
+ }
64
+ interface GitCommitListOptions {
65
+ branch?: string;
66
+ page?: number;
67
+ perPage?: number;
68
+ }
69
+ interface PaginatedCommits {
70
+ items: GitCommit[];
71
+ total: number;
72
+ page: number;
73
+ perPage: number;
74
+ totalPages: number;
75
+ }
76
+ declare class GitCommitRepository {
77
+ private readonly gateway;
78
+ constructor(gateway: GitGateway);
79
+ list(options?: GitCommitListOptions): Promise<PaginatedCommits>;
80
+ }
81
+ //#endregion
82
+ //#region src/server/services/PluginIpcClient.d.ts
83
+ type IpcMessage<T = any> = {
84
+ id: string;
85
+ event: string;
86
+ data: T;
87
+ };
88
+ type IpcListener$1<T = any> = (data: T) => void;
89
+ declare class PluginIpcClient {
90
+ private listeners;
91
+ constructor();
92
+ on<T = any>(event: string, callback: IpcListener$1<T>): void;
93
+ off<T = any>(event: string, callback: IpcListener$1<T>): void;
94
+ emit<T = any>(event: string, data?: T): string;
95
+ }
96
+ //#endregion
97
+ //#region src/server/services/PluginIpcHost.d.ts
98
+ type IpcListener<T = any> = (data: T) => void;
99
+ declare class PluginIpcHost {
100
+ private readonly child;
101
+ private listeners;
102
+ constructor(child: ChildProcess);
103
+ on<T = any>(event: string, callback: IpcListener<T>): void;
104
+ off<T = any>(event: string, callback: IpcListener<T>): void;
105
+ emit<T = any>(event: string, data?: T): string;
106
+ }
107
+ //#endregion
108
+ //#region src/server/services/PluginRouter.d.ts
109
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
110
+ interface RouteDefinition {
111
+ method: HttpMethod;
112
+ path: string;
113
+ }
114
+ interface RouteRequest {
115
+ requestId: string;
116
+ method: HttpMethod;
117
+ path: string;
118
+ body?: any;
119
+ headers?: Record<string, string>;
120
+ query?: Record<string, string>;
121
+ params?: Record<string, string>;
122
+ }
123
+ interface RouteResponsePayload {
124
+ requestId: string;
125
+ status: number;
126
+ body?: any;
127
+ headers?: Record<string, string>;
128
+ }
129
+ interface RouteReply {
130
+ status(code: number): RouteReply;
131
+ send(body?: any): void;
132
+ }
133
+ type RouteHandler = (req: RouteRequest, reply: RouteReply) => void | Promise<void>;
134
+ declare class PluginRouter {
135
+ private readonly client;
136
+ private routes;
137
+ constructor(client: PluginIpcClient);
138
+ private dispatch;
139
+ private register;
140
+ get(path: string, handler: RouteHandler): void;
141
+ post(path: string, handler: RouteHandler): void;
142
+ put(path: string, handler: RouteHandler): void;
143
+ patch(path: string, handler: RouteHandler): void;
144
+ delete(path: string, handler: RouteHandler): void;
145
+ }
146
+ //#endregion
147
+ export { GitBranch, GitBranchFetchOptions, GitBranchRepository, GitCommit, GitCommitListOptions, GitCommitRef, GitCommitRepository, GitGateway, GitGatewayOptions, GitRepoInfo, HttpMethod, IpcMessage, PaginatedCommits, PluginIpcClient, PluginIpcHost, PluginRouter, RouteDefinition, RouteHandler, RouteReply, RouteRequest, RouteResponsePayload };
@@ -0,0 +1,110 @@
1
+ import * as v from "valibot";
2
+
3
+ //#region src/shared/services/LoggerService.d.ts
4
+ declare class LoggerService {
5
+ info(message: string, meta?: any): void;
6
+ debug(message: string, meta?: any): void;
7
+ warn(message: string, meta?: any): void;
8
+ error(message: string, meta?: any): void;
9
+ child(options: any): LoggerService;
10
+ }
11
+ //#endregion
12
+ //#region src/shared/services/EmmitterService.d.ts
13
+ interface EmmitterServiceOptions {
14
+ debug?: boolean;
15
+ logger?: LoggerService;
16
+ }
17
+ //#endregion
18
+ //#region src/shared/utils/typing.d.ts
19
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
20
+ type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
21
+ type PublicData<T> = { [K in keyof T as T[K] extends Function ? never : K]: T[K] };
22
+ //#endregion
23
+ //#region src/shared/utils/compose.d.ts
24
+ type AnyClass = new (...args: any[]) => any;
25
+ type Constructor<T = {}> = new (...args: any[]) => T;
26
+ type Mixin<T> = (base: Constructor) => Constructor<T>;
27
+ /**
28
+ * Composes multiple mixins into a single class that can be extended.
29
+ * Allows for multiple inheritance-like behavior by applying mixins sequentially.
30
+ *
31
+ * @param mixins - Array of mixin functions to compose
32
+ * @returns A class constructor that includes all mixin functionality
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * class User extends compose(Timestamp, SoftDelete) {
37
+ * constructor(public name: string) {
38
+ * super()
39
+ * }
40
+ * }
41
+ * ```
42
+ */
43
+ declare function compose<M extends Array<(base: Constructor<any>) => Constructor<any>>>(...mixins: M): UnionToIntersection<ReturnType<M[number]>>;
44
+ /**
45
+ * Alternative compose function that starts with a base class
46
+ *
47
+ * @param baseClass - The base class to start with
48
+ * @param mixins - Array of mixin functions to apply
49
+ * @returns A class constructor that extends the base class with all mixin functionality
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * class User extends composeWith(BaseEntity, Timestamp, SoftDelete) {
54
+ * constructor(public name: string) {
55
+ * super()
56
+ * }
57
+ * }
58
+ * ```
59
+ */
60
+ declare function composeWith<TBase extends Constructor, M extends Array<(base: Constructor) => Constructor<any>>>(baseClass: TBase, ...mixins: M): TBase & UnionToIntersection<ReturnType<M[number]>>;
61
+ declare function mixin<TBase extends Constructor>(Source: TBase): <TTarget extends Constructor>(Target: TTarget) => TTarget & TBase;
62
+ //#endregion
63
+ //#region src/shared/services/ValidatorService.d.ts
64
+ type Valibot = typeof v;
65
+ type ValibotSchema = v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>;
66
+ type ValibotSchemaAsync = v.BaseSchemaAsync<unknown, unknown, v.BaseIssue<unknown>>;
67
+ interface ValidatorCallback<T extends ValibotSchema> {
68
+ (_v: typeof v): T;
69
+ }
70
+ type ValidatorCallbackAsync<T extends ValibotSchemaAsync> = {
71
+ (_v: typeof v): T;
72
+ };
73
+ type ValidatorResult<T extends v.ObjectEntries> = v.InferOutput<v.ObjectSchema<T, undefined>>;
74
+ type ValidatePayload<T extends ValibotSchema = ValibotSchema> = ValidatorCallback<T> | T;
75
+ type ValidateResult<T extends ValidatePayload> = T extends ValibotSchema ? v.InferOutput<T> : T extends ValidatorCallback<infer U> ? v.InferOutput<U> : unknown;
76
+ declare class ValidatorService {
77
+ create<T extends ValibotSchema>(cb: ValidatorCallback<T>): T;
78
+ validate<T extends ValibotSchema>(payload: any, cb: ValidatePayload<T>): v.InferOutput<T>;
79
+ validateAsync<T extends ValibotSchemaAsync>(payload: any, cb: ValidatorCallbackAsync<T> | T): Promise<v.InferOutput<T>>;
80
+ isValid<T extends ValibotSchema>(payload: any, cb: ValidatePayload<T>): boolean;
81
+ }
82
+ //#endregion
83
+ //#region src/shared/utils/createId.d.ts
84
+ declare function createId(prefix?: string): string;
85
+ //#endregion
86
+ //#region src/shared/utils/flatten.d.ts
87
+ declare function flatten(obj: any, prefix?: string, res?: any): Record<string, any>;
88
+ declare function unflatten(obj: any): Record<string, any>;
89
+ //#endregion
90
+ //#region src/shared/utils/formatBytes.d.ts
91
+ declare function formatBytes(bytes: number, decimals?: number): string;
92
+ //#endregion
93
+ //#region src/shared/utils/generateIndexFile.d.ts
94
+ declare function generateIndexFile(options: any): void;
95
+ //#endregion
96
+ //#region src/shared/utils/tryCatch.d.ts
97
+ interface Tryer {
98
+ (...args: any[]): any;
99
+ }
100
+ interface TryerAsync {
101
+ (...args: any[]): Promise<any> | any;
102
+ }
103
+ type TryCatchResult<T extends Tryer> = [null, ReturnType<T>] | [Error, null];
104
+ type TryCatchAsyncResult<T extends TryerAsync> = [null, Awaited<ReturnType<T>>] | [Error, null];
105
+ declare function tryCatch<T extends TryerAsync>(tryer: T): Promise<TryCatchAsyncResult<T>>;
106
+ declare namespace tryCatch {
107
+ var sync: <T extends Tryer>(tryer: T) => TryCatchResult<T>;
108
+ }
109
+ //#endregion
110
+ export { AnyClass, Constructor, EmmitterServiceOptions, Mixin, PartialBy, PublicData, UnionToIntersection, Valibot, ValibotSchema, ValibotSchemaAsync, ValidatePayload, ValidateResult, ValidatorCallback, ValidatorCallbackAsync, ValidatorResult, ValidatorService, compose, composeWith, createId, flatten, formatBytes, generateIndexFile, mixin, tryCatch, unflatten };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sidekick-coder/zenith-kit",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "description": "A collection of utilities and tools for building language servers and related applications.",
6
6
  "keywords": [],