@objectstack/core 1.0.4 → 1.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.
- package/.turbo/turbo-build.log +58 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +4294 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1777 -0
- package/dist/index.d.ts +1776 -21
- package/dist/index.js +4246 -23
- package/dist/index.js.map +1 -0
- package/package.json +4 -4
- package/tsconfig.json +1 -3
- package/dist/api-registry-plugin.d.ts +0 -54
- package/dist/api-registry-plugin.d.ts.map +0 -1
- package/dist/api-registry-plugin.js +0 -53
- package/dist/api-registry-plugin.test.d.ts +0 -2
- package/dist/api-registry-plugin.test.d.ts.map +0 -1
- package/dist/api-registry-plugin.test.js +0 -334
- package/dist/api-registry.d.ts +0 -259
- package/dist/api-registry.d.ts.map +0 -1
- package/dist/api-registry.js +0 -600
- package/dist/api-registry.test.d.ts +0 -2
- package/dist/api-registry.test.d.ts.map +0 -1
- package/dist/api-registry.test.js +0 -957
- package/dist/contracts/data-engine.d.ts +0 -62
- package/dist/contracts/data-engine.d.ts.map +0 -1
- package/dist/contracts/data-engine.js +0 -1
- package/dist/contracts/http-server.d.ts +0 -119
- package/dist/contracts/http-server.d.ts.map +0 -1
- package/dist/contracts/http-server.js +0 -11
- package/dist/contracts/logger.d.ts +0 -63
- package/dist/contracts/logger.d.ts.map +0 -1
- package/dist/contracts/logger.js +0 -1
- package/dist/dependency-resolver.d.ts +0 -62
- package/dist/dependency-resolver.d.ts.map +0 -1
- package/dist/dependency-resolver.js +0 -317
- package/dist/dependency-resolver.test.d.ts +0 -2
- package/dist/dependency-resolver.test.d.ts.map +0 -1
- package/dist/dependency-resolver.test.js +0 -241
- package/dist/health-monitor.d.ts +0 -65
- package/dist/health-monitor.d.ts.map +0 -1
- package/dist/health-monitor.js +0 -269
- package/dist/health-monitor.test.d.ts +0 -2
- package/dist/health-monitor.test.d.ts.map +0 -1
- package/dist/health-monitor.test.js +0 -68
- package/dist/hot-reload.d.ts +0 -79
- package/dist/hot-reload.d.ts.map +0 -1
- package/dist/hot-reload.js +0 -313
- package/dist/index.d.ts.map +0 -1
- package/dist/kernel-base.d.ts +0 -84
- package/dist/kernel-base.d.ts.map +0 -1
- package/dist/kernel-base.js +0 -219
- package/dist/kernel.d.ts +0 -113
- package/dist/kernel.d.ts.map +0 -1
- package/dist/kernel.js +0 -472
- package/dist/kernel.test.d.ts +0 -2
- package/dist/kernel.test.d.ts.map +0 -1
- package/dist/kernel.test.js +0 -414
- package/dist/lite-kernel.d.ts +0 -55
- package/dist/lite-kernel.d.ts.map +0 -1
- package/dist/lite-kernel.js +0 -112
- package/dist/lite-kernel.test.d.ts +0 -2
- package/dist/lite-kernel.test.d.ts.map +0 -1
- package/dist/lite-kernel.test.js +0 -161
- package/dist/logger.d.ts +0 -71
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -312
- package/dist/logger.test.d.ts +0 -2
- package/dist/logger.test.d.ts.map +0 -1
- package/dist/logger.test.js +0 -92
- package/dist/plugin-loader.d.ts +0 -164
- package/dist/plugin-loader.d.ts.map +0 -1
- package/dist/plugin-loader.js +0 -319
- package/dist/plugin-loader.test.d.ts +0 -2
- package/dist/plugin-loader.test.d.ts.map +0 -1
- package/dist/plugin-loader.test.js +0 -348
- package/dist/qa/adapter.d.ts +0 -14
- package/dist/qa/adapter.d.ts.map +0 -1
- package/dist/qa/adapter.js +0 -1
- package/dist/qa/http-adapter.d.ts +0 -16
- package/dist/qa/http-adapter.d.ts.map +0 -1
- package/dist/qa/http-adapter.js +0 -107
- package/dist/qa/index.d.ts +0 -4
- package/dist/qa/index.d.ts.map +0 -1
- package/dist/qa/index.js +0 -3
- package/dist/qa/runner.d.ts +0 -27
- package/dist/qa/runner.d.ts.map +0 -1
- package/dist/qa/runner.js +0 -157
- package/dist/security/index.d.ts +0 -17
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/index.js +0 -17
- package/dist/security/permission-manager.d.ts +0 -96
- package/dist/security/permission-manager.d.ts.map +0 -1
- package/dist/security/permission-manager.js +0 -235
- package/dist/security/permission-manager.test.d.ts +0 -2
- package/dist/security/permission-manager.test.d.ts.map +0 -1
- package/dist/security/permission-manager.test.js +0 -220
- package/dist/security/plugin-config-validator.d.ts +0 -79
- package/dist/security/plugin-config-validator.d.ts.map +0 -1
- package/dist/security/plugin-config-validator.js +0 -166
- package/dist/security/plugin-config-validator.test.d.ts +0 -2
- package/dist/security/plugin-config-validator.test.d.ts.map +0 -1
- package/dist/security/plugin-config-validator.test.js +0 -223
- package/dist/security/plugin-permission-enforcer.d.ts +0 -154
- package/dist/security/plugin-permission-enforcer.d.ts.map +0 -1
- package/dist/security/plugin-permission-enforcer.js +0 -323
- package/dist/security/plugin-permission-enforcer.test.d.ts +0 -2
- package/dist/security/plugin-permission-enforcer.test.d.ts.map +0 -1
- package/dist/security/plugin-permission-enforcer.test.js +0 -205
- package/dist/security/plugin-signature-verifier.d.ts +0 -96
- package/dist/security/plugin-signature-verifier.d.ts.map +0 -1
- package/dist/security/plugin-signature-verifier.js +0 -250
- package/dist/security/sandbox-runtime.d.ts +0 -115
- package/dist/security/sandbox-runtime.d.ts.map +0 -1
- package/dist/security/sandbox-runtime.js +0 -311
- package/dist/security/security-scanner.d.ts +0 -92
- package/dist/security/security-scanner.d.ts.map +0 -1
- package/dist/security/security-scanner.js +0 -273
- package/dist/types.d.ts +0 -89
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/env.d.ts +0 -20
- package/dist/utils/env.d.ts.map +0 -1
- package/dist/utils/env.js +0 -46
- package/dist/utils/env.test.d.ts +0 -2
- package/dist/utils/env.test.d.ts.map +0 -1
- package/dist/utils/env.test.js +0 -52
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { DataEngineQueryOptions, DataEngineInsertOptions, DataEngineUpdateOptions, DataEngineDeleteOptions, DataEngineAggregateOptions, DataEngineCountOptions, DataEngineRequest, // Added Request type for batch
|
|
2
|
-
QueryAST, DriverOptions } from '@objectstack/spec/data';
|
|
3
|
-
/**
|
|
4
|
-
* IDataEngine - Standard Data Engine Interface
|
|
5
|
-
*
|
|
6
|
-
* Abstract interface for data persistence capabilities.
|
|
7
|
-
* Following the Dependency Inversion Principle - plugins depend on this interface,
|
|
8
|
-
* not on concrete database implementations.
|
|
9
|
-
*
|
|
10
|
-
* Aligned with 'src/data/data-engine.zod.ts' in @objectstack/spec.
|
|
11
|
-
*/
|
|
12
|
-
export interface IDataEngine {
|
|
13
|
-
find(objectName: string, query?: DataEngineQueryOptions): Promise<any[]>;
|
|
14
|
-
findOne(objectName: string, query?: DataEngineQueryOptions): Promise<any>;
|
|
15
|
-
insert(objectName: string, data: any | any[], options?: DataEngineInsertOptions): Promise<any>;
|
|
16
|
-
update(objectName: string, data: any, options?: DataEngineUpdateOptions): Promise<any>;
|
|
17
|
-
delete(objectName: string, options?: DataEngineDeleteOptions): Promise<any>;
|
|
18
|
-
count(objectName: string, query?: DataEngineCountOptions): Promise<number>;
|
|
19
|
-
aggregate(objectName: string, query: DataEngineAggregateOptions): Promise<any[]>;
|
|
20
|
-
/**
|
|
21
|
-
* Vector Search (AI/RAG)
|
|
22
|
-
*/
|
|
23
|
-
vectorFind?(objectName: string, vector: number[], options?: {
|
|
24
|
-
filter?: any;
|
|
25
|
-
limit?: number;
|
|
26
|
-
select?: string[];
|
|
27
|
-
threshold?: number;
|
|
28
|
-
}): Promise<any[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Batch Operations (Transactional)
|
|
31
|
-
*/
|
|
32
|
-
batch?(requests: DataEngineRequest[], options?: {
|
|
33
|
-
transaction?: boolean;
|
|
34
|
-
}): Promise<any[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Execute raw command (Escape hatch)
|
|
37
|
-
*/
|
|
38
|
-
execute?(command: any, options?: Record<string, any>): Promise<any>;
|
|
39
|
-
}
|
|
40
|
-
export interface DriverInterface {
|
|
41
|
-
name: string;
|
|
42
|
-
version: string;
|
|
43
|
-
connect(): Promise<void>;
|
|
44
|
-
disconnect(): Promise<void>;
|
|
45
|
-
find(object: string, query: QueryAST, options?: DriverOptions): Promise<any[]>;
|
|
46
|
-
findOne(object: string, query: QueryAST, options?: DriverOptions): Promise<any>;
|
|
47
|
-
create(object: string, data: any, options?: DriverOptions): Promise<any>;
|
|
48
|
-
update(object: string, id: any, data: any, options?: DriverOptions): Promise<any>;
|
|
49
|
-
delete(object: string, id: any, options?: DriverOptions): Promise<any>;
|
|
50
|
-
/**
|
|
51
|
-
* Bulk & Batch Operations
|
|
52
|
-
*/
|
|
53
|
-
bulkCreate?(object: string, data: any[], options?: DriverOptions): Promise<any>;
|
|
54
|
-
updateMany?(object: string, query: QueryAST, data: any, options?: DriverOptions): Promise<any>;
|
|
55
|
-
deleteMany?(object: string, query: QueryAST, options?: DriverOptions): Promise<any>;
|
|
56
|
-
count?(object: string, query: QueryAST, options?: DriverOptions): Promise<number>;
|
|
57
|
-
/**
|
|
58
|
-
* Raw Execution
|
|
59
|
-
*/
|
|
60
|
-
execute?(command: any, params?: any, options?: DriverOptions): Promise<any>;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=data-engine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-engine.d.ts","sourceRoot":"","sources":["../../src/contracts/data-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EAAE,+BAA+B;AAClD,QAAQ,EACR,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;GAQG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACzE,OAAO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GAAG,CAAC,CAAC;IAC/F,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAEpF,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElF;;OAEG;IACH,OAAO,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IHttpServer - Standard HTTP Server Interface
|
|
3
|
-
*
|
|
4
|
-
* Abstract interface for HTTP server capabilities.
|
|
5
|
-
* This allows plugins to interact with HTTP servers without knowing
|
|
6
|
-
* the underlying implementation (Express, Fastify, Hono, etc.).
|
|
7
|
-
*
|
|
8
|
-
* Follows Dependency Inversion Principle - plugins depend on this interface,
|
|
9
|
-
* not on concrete HTTP framework implementations.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Generic HTTP Request type
|
|
13
|
-
* Abstraction over framework-specific request objects
|
|
14
|
-
*/
|
|
15
|
-
export interface IHttpRequest {
|
|
16
|
-
/** Request path parameters */
|
|
17
|
-
params: Record<string, string>;
|
|
18
|
-
/** Request query parameters */
|
|
19
|
-
query: Record<string, string | string[]>;
|
|
20
|
-
/** Request body */
|
|
21
|
-
body?: any;
|
|
22
|
-
/** Request headers */
|
|
23
|
-
headers: Record<string, string | string[]>;
|
|
24
|
-
/** HTTP method */
|
|
25
|
-
method: string;
|
|
26
|
-
/** Request path */
|
|
27
|
-
path: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Generic HTTP Response type
|
|
31
|
-
* Abstraction over framework-specific response objects
|
|
32
|
-
*/
|
|
33
|
-
export interface IHttpResponse {
|
|
34
|
-
/**
|
|
35
|
-
* Send a JSON response
|
|
36
|
-
* @param data - Data to send
|
|
37
|
-
*/
|
|
38
|
-
json(data: any): void | Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Send a text/html response
|
|
41
|
-
* @param data - Data to send
|
|
42
|
-
*/
|
|
43
|
-
send(data: string): void | Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Set HTTP status code
|
|
46
|
-
* @param code - HTTP status code
|
|
47
|
-
*/
|
|
48
|
-
status(code: number): IHttpResponse;
|
|
49
|
-
/**
|
|
50
|
-
* Set response header
|
|
51
|
-
* @param name - Header name
|
|
52
|
-
* @param value - Header value (string or array of strings for multi-value headers)
|
|
53
|
-
*/
|
|
54
|
-
header(name: string, value: string | string[]): IHttpResponse;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Route handler function
|
|
58
|
-
*/
|
|
59
|
-
export type RouteHandler = (req: IHttpRequest, res: IHttpResponse) => void | Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Middleware function
|
|
62
|
-
*/
|
|
63
|
-
export type Middleware = (req: IHttpRequest, res: IHttpResponse, next: () => void | Promise<void>) => void | Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* IHttpServer - HTTP Server capability interface
|
|
66
|
-
*
|
|
67
|
-
* Defines the contract for HTTP server implementations.
|
|
68
|
-
* Concrete implementations (Express, Fastify, Hono) should implement this interface.
|
|
69
|
-
*/
|
|
70
|
-
export interface IHttpServer {
|
|
71
|
-
/**
|
|
72
|
-
* Register a GET route handler
|
|
73
|
-
* @param path - Route path (e.g., '/api/users/:id')
|
|
74
|
-
* @param handler - Route handler function
|
|
75
|
-
*/
|
|
76
|
-
get(path: string, handler: RouteHandler): void;
|
|
77
|
-
/**
|
|
78
|
-
* Register a POST route handler
|
|
79
|
-
* @param path - Route path
|
|
80
|
-
* @param handler - Route handler function
|
|
81
|
-
*/
|
|
82
|
-
post(path: string, handler: RouteHandler): void;
|
|
83
|
-
/**
|
|
84
|
-
* Register a PUT route handler
|
|
85
|
-
* @param path - Route path
|
|
86
|
-
* @param handler - Route handler function
|
|
87
|
-
*/
|
|
88
|
-
put(path: string, handler: RouteHandler): void;
|
|
89
|
-
/**
|
|
90
|
-
* Register a DELETE route handler
|
|
91
|
-
* @param path - Route path
|
|
92
|
-
* @param handler - Route handler function
|
|
93
|
-
*/
|
|
94
|
-
delete(path: string, handler: RouteHandler): void;
|
|
95
|
-
/**
|
|
96
|
-
* Register a PATCH route handler
|
|
97
|
-
* @param path - Route path
|
|
98
|
-
* @param handler - Route handler function
|
|
99
|
-
*/
|
|
100
|
-
patch(path: string, handler: RouteHandler): void;
|
|
101
|
-
/**
|
|
102
|
-
* Register middleware
|
|
103
|
-
* @param path - Optional path to apply middleware to (if omitted, applies globally)
|
|
104
|
-
* @param handler - Middleware function
|
|
105
|
-
*/
|
|
106
|
-
use(path: string | Middleware, handler?: Middleware): void;
|
|
107
|
-
/**
|
|
108
|
-
* Start the HTTP server
|
|
109
|
-
* @param port - Port number to listen on
|
|
110
|
-
* @returns Promise that resolves when server is ready
|
|
111
|
-
*/
|
|
112
|
-
listen(port: number): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Stop the HTTP server
|
|
115
|
-
* @returns Promise that resolves when server is stopped
|
|
116
|
-
*/
|
|
117
|
-
close?(): Promise<void>;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=http-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../../src/contracts/http-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;I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;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAEhD;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAE/C;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAEjD;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAE3D;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;OAGG;IACH,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IHttpServer - Standard HTTP Server Interface
|
|
3
|
-
*
|
|
4
|
-
* Abstract interface for HTTP server capabilities.
|
|
5
|
-
* This allows plugins to interact with HTTP servers without knowing
|
|
6
|
-
* the underlying implementation (Express, Fastify, Hono, etc.).
|
|
7
|
-
*
|
|
8
|
-
* Follows Dependency Inversion Principle - plugins depend on this interface,
|
|
9
|
-
* not on concrete HTTP framework implementations.
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logger Contract
|
|
3
|
-
*
|
|
4
|
-
* Defines the interface for logging in ObjectStack.
|
|
5
|
-
* Compatible with both browser console and structured logging systems.
|
|
6
|
-
*/
|
|
7
|
-
export interface Logger {
|
|
8
|
-
/**
|
|
9
|
-
* Log a debug message
|
|
10
|
-
* @param message - The message to log
|
|
11
|
-
* @param meta - Optional metadata to include
|
|
12
|
-
*/
|
|
13
|
-
debug(message: string, meta?: Record<string, any>): void;
|
|
14
|
-
/**
|
|
15
|
-
* Log an informational message
|
|
16
|
-
* @param message - The message to log
|
|
17
|
-
* @param meta - Optional metadata to include
|
|
18
|
-
*/
|
|
19
|
-
info(message: string, meta?: Record<string, any>): void;
|
|
20
|
-
/**
|
|
21
|
-
* Log a warning message
|
|
22
|
-
* @param message - The message to log
|
|
23
|
-
* @param meta - Optional metadata to include
|
|
24
|
-
*/
|
|
25
|
-
warn(message: string, meta?: Record<string, any>): void;
|
|
26
|
-
/**
|
|
27
|
-
* Log an error message
|
|
28
|
-
* @param message - The message to log
|
|
29
|
-
* @param error - Optional error object
|
|
30
|
-
* @param meta - Optional metadata to include
|
|
31
|
-
*/
|
|
32
|
-
error(message: string, error?: Error, meta?: Record<string, any>): void;
|
|
33
|
-
/**
|
|
34
|
-
* Log a fatal error message
|
|
35
|
-
* @param message - The message to log
|
|
36
|
-
* @param error - Optional error object
|
|
37
|
-
* @param meta - Optional metadata to include
|
|
38
|
-
*/
|
|
39
|
-
fatal?(message: string, error?: Error, meta?: Record<string, any>): void;
|
|
40
|
-
/**
|
|
41
|
-
* Create a child logger with additional context
|
|
42
|
-
* @param context - Context to add to all logs from this child
|
|
43
|
-
*/
|
|
44
|
-
child?(context: Record<string, any>): Logger;
|
|
45
|
-
/**
|
|
46
|
-
* Set trace context for distributed tracing
|
|
47
|
-
* @param traceId - Trace identifier
|
|
48
|
-
* @param spanId - Span identifier
|
|
49
|
-
*/
|
|
50
|
-
withTrace?(traceId: string, spanId?: string): Logger;
|
|
51
|
-
/**
|
|
52
|
-
* Compatibility method for console.log usage
|
|
53
|
-
* @param message - The message to log
|
|
54
|
-
* @param args - Additional arguments
|
|
55
|
-
*/
|
|
56
|
-
log?(message: string, ...args: any[]): void;
|
|
57
|
-
/**
|
|
58
|
-
* Cleanup resources (close file streams, etc.)
|
|
59
|
-
* Should be called when the logger is no longer needed
|
|
60
|
-
*/
|
|
61
|
-
destroy?(): Promise<void>;
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/contracts/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACnB;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEzD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExE;;;;;OAKG;IACH,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEzE;;;OAGG;IACH,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IAE7C;;;;OAIG;IACH,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAErD;;;;OAIG;IACH,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5C;;;OAGG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B"}
|
package/dist/contracts/logger.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { SemanticVersion, VersionConstraint, CompatibilityLevel, DependencyConflict } from '@objectstack/spec/kernel';
|
|
2
|
-
import type { ObjectLogger } from './logger.js';
|
|
3
|
-
/**
|
|
4
|
-
* Semantic Version Parser and Comparator
|
|
5
|
-
*
|
|
6
|
-
* Implements semantic versioning comparison and constraint matching
|
|
7
|
-
*/
|
|
8
|
-
export declare class SemanticVersionManager {
|
|
9
|
-
/**
|
|
10
|
-
* Parse a version string into semantic version components
|
|
11
|
-
*/
|
|
12
|
-
static parse(versionStr: string): SemanticVersion;
|
|
13
|
-
/**
|
|
14
|
-
* Convert semantic version back to string
|
|
15
|
-
*/
|
|
16
|
-
static toString(version: SemanticVersion): string;
|
|
17
|
-
/**
|
|
18
|
-
* Compare two semantic versions
|
|
19
|
-
* Returns: -1 if a < b, 0 if a === b, 1 if a > b
|
|
20
|
-
*/
|
|
21
|
-
static compare(a: SemanticVersion, b: SemanticVersion): number;
|
|
22
|
-
/**
|
|
23
|
-
* Check if version satisfies constraint
|
|
24
|
-
*/
|
|
25
|
-
static satisfies(version: SemanticVersion, constraint: VersionConstraint): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Determine compatibility level between two versions
|
|
28
|
-
*/
|
|
29
|
-
static getCompatibilityLevel(from: SemanticVersion, to: SemanticVersion): CompatibilityLevel;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Plugin Dependency Resolver
|
|
33
|
-
*
|
|
34
|
-
* Resolves plugin dependencies using topological sorting and conflict detection
|
|
35
|
-
*/
|
|
36
|
-
export declare class DependencyResolver {
|
|
37
|
-
private logger;
|
|
38
|
-
constructor(logger: ObjectLogger);
|
|
39
|
-
/**
|
|
40
|
-
* Resolve dependencies using topological sort
|
|
41
|
-
*/
|
|
42
|
-
resolve(plugins: Map<string, {
|
|
43
|
-
version?: string;
|
|
44
|
-
dependencies?: string[];
|
|
45
|
-
}>): string[];
|
|
46
|
-
/**
|
|
47
|
-
* Detect dependency conflicts
|
|
48
|
-
*/
|
|
49
|
-
detectConflicts(plugins: Map<string, {
|
|
50
|
-
version: string;
|
|
51
|
-
dependencies?: Record<string, VersionConstraint>;
|
|
52
|
-
}>): DependencyConflict[];
|
|
53
|
-
/**
|
|
54
|
-
* Find best version that satisfies all constraints
|
|
55
|
-
*/
|
|
56
|
-
findBestVersion(availableVersions: string[], constraints: VersionConstraint[]): string | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Check if dependencies form a valid DAG (no cycles)
|
|
59
|
-
*/
|
|
60
|
-
isAcyclic(dependencies: Map<string, string[]>): boolean;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=dependency-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-resolver.d.ts","sourceRoot":"","sources":["../src/dependency-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe;IAsBjD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM;IAWjD;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM;IAkB9D;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO;IAoElF;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,GAAG,kBAAkB;CA0B7F;AAED;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,YAAY;IAIhC;;OAEG;IACH,OAAO,CACL,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,GAClE,MAAM,EAAE;IAkEX;;OAEG;IACH,eAAe,CACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;KAAE,CAAC,GAC1F,kBAAkB,EAAE;IA+EvB;;OAEG;IACH,eAAe,CACb,iBAAiB,EAAE,MAAM,EAAE,EAC3B,WAAW,EAAE,iBAAiB,EAAE,GAC/B,MAAM,GAAG,SAAS;IAoBrB;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO;CAcxD"}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Semantic Version Parser and Comparator
|
|
3
|
-
*
|
|
4
|
-
* Implements semantic versioning comparison and constraint matching
|
|
5
|
-
*/
|
|
6
|
-
export class SemanticVersionManager {
|
|
7
|
-
/**
|
|
8
|
-
* Parse a version string into semantic version components
|
|
9
|
-
*/
|
|
10
|
-
static parse(versionStr) {
|
|
11
|
-
// Remove 'v' prefix if present
|
|
12
|
-
const cleanVersion = versionStr.replace(/^v/, '');
|
|
13
|
-
// Match semver pattern: major.minor.patch[-prerelease][+build]
|
|
14
|
-
const match = cleanVersion.match(/^(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9.-]+))?(?:\+([a-zA-Z0-9.-]+))?$/);
|
|
15
|
-
if (!match) {
|
|
16
|
-
throw new Error(`Invalid semantic version: ${versionStr}`);
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
major: parseInt(match[1], 10),
|
|
20
|
-
minor: parseInt(match[2], 10),
|
|
21
|
-
patch: parseInt(match[3], 10),
|
|
22
|
-
preRelease: match[4],
|
|
23
|
-
build: match[5],
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Convert semantic version back to string
|
|
28
|
-
*/
|
|
29
|
-
static toString(version) {
|
|
30
|
-
let str = `${version.major}.${version.minor}.${version.patch}`;
|
|
31
|
-
if (version.preRelease) {
|
|
32
|
-
str += `-${version.preRelease}`;
|
|
33
|
-
}
|
|
34
|
-
if (version.build) {
|
|
35
|
-
str += `+${version.build}`;
|
|
36
|
-
}
|
|
37
|
-
return str;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Compare two semantic versions
|
|
41
|
-
* Returns: -1 if a < b, 0 if a === b, 1 if a > b
|
|
42
|
-
*/
|
|
43
|
-
static compare(a, b) {
|
|
44
|
-
// Compare major, minor, patch
|
|
45
|
-
if (a.major !== b.major)
|
|
46
|
-
return a.major - b.major;
|
|
47
|
-
if (a.minor !== b.minor)
|
|
48
|
-
return a.minor - b.minor;
|
|
49
|
-
if (a.patch !== b.patch)
|
|
50
|
-
return a.patch - b.patch;
|
|
51
|
-
// Pre-release versions have lower precedence
|
|
52
|
-
if (a.preRelease && !b.preRelease)
|
|
53
|
-
return -1;
|
|
54
|
-
if (!a.preRelease && b.preRelease)
|
|
55
|
-
return 1;
|
|
56
|
-
// Compare pre-release versions
|
|
57
|
-
if (a.preRelease && b.preRelease) {
|
|
58
|
-
return a.preRelease.localeCompare(b.preRelease);
|
|
59
|
-
}
|
|
60
|
-
return 0;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Check if version satisfies constraint
|
|
64
|
-
*/
|
|
65
|
-
static satisfies(version, constraint) {
|
|
66
|
-
const constraintStr = constraint;
|
|
67
|
-
// Any version
|
|
68
|
-
if (constraintStr === '*' || constraintStr === 'latest') {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
// Exact version
|
|
72
|
-
if (/^[\d.]+$/.test(constraintStr)) {
|
|
73
|
-
const exact = this.parse(constraintStr);
|
|
74
|
-
return this.compare(version, exact) === 0;
|
|
75
|
-
}
|
|
76
|
-
// Caret range (^): Compatible with version
|
|
77
|
-
if (constraintStr.startsWith('^')) {
|
|
78
|
-
const base = this.parse(constraintStr.slice(1));
|
|
79
|
-
return (version.major === base.major &&
|
|
80
|
-
this.compare(version, base) >= 0);
|
|
81
|
-
}
|
|
82
|
-
// Tilde range (~): Approximately equivalent
|
|
83
|
-
if (constraintStr.startsWith('~')) {
|
|
84
|
-
const base = this.parse(constraintStr.slice(1));
|
|
85
|
-
return (version.major === base.major &&
|
|
86
|
-
version.minor === base.minor &&
|
|
87
|
-
this.compare(version, base) >= 0);
|
|
88
|
-
}
|
|
89
|
-
// Greater than or equal
|
|
90
|
-
if (constraintStr.startsWith('>=')) {
|
|
91
|
-
const base = this.parse(constraintStr.slice(2));
|
|
92
|
-
return this.compare(version, base) >= 0;
|
|
93
|
-
}
|
|
94
|
-
// Greater than
|
|
95
|
-
if (constraintStr.startsWith('>')) {
|
|
96
|
-
const base = this.parse(constraintStr.slice(1));
|
|
97
|
-
return this.compare(version, base) > 0;
|
|
98
|
-
}
|
|
99
|
-
// Less than or equal
|
|
100
|
-
if (constraintStr.startsWith('<=')) {
|
|
101
|
-
const base = this.parse(constraintStr.slice(2));
|
|
102
|
-
return this.compare(version, base) <= 0;
|
|
103
|
-
}
|
|
104
|
-
// Less than
|
|
105
|
-
if (constraintStr.startsWith('<')) {
|
|
106
|
-
const base = this.parse(constraintStr.slice(1));
|
|
107
|
-
return this.compare(version, base) < 0;
|
|
108
|
-
}
|
|
109
|
-
// Range (1.2.3 - 2.3.4)
|
|
110
|
-
const rangeMatch = constraintStr.match(/^([\d.]+)\s*-\s*([\d.]+)$/);
|
|
111
|
-
if (rangeMatch) {
|
|
112
|
-
const min = this.parse(rangeMatch[1]);
|
|
113
|
-
const max = this.parse(rangeMatch[2]);
|
|
114
|
-
return this.compare(version, min) >= 0 && this.compare(version, max) <= 0;
|
|
115
|
-
}
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Determine compatibility level between two versions
|
|
120
|
-
*/
|
|
121
|
-
static getCompatibilityLevel(from, to) {
|
|
122
|
-
const cmp = this.compare(from, to);
|
|
123
|
-
// Same version
|
|
124
|
-
if (cmp === 0) {
|
|
125
|
-
return 'fully-compatible';
|
|
126
|
-
}
|
|
127
|
-
// Major version changed - breaking changes
|
|
128
|
-
if (from.major !== to.major) {
|
|
129
|
-
return 'breaking-changes';
|
|
130
|
-
}
|
|
131
|
-
// Minor version increased - backward compatible
|
|
132
|
-
if (from.minor < to.minor) {
|
|
133
|
-
return 'backward-compatible';
|
|
134
|
-
}
|
|
135
|
-
// Patch version increased - fully compatible
|
|
136
|
-
if (from.patch < to.patch) {
|
|
137
|
-
return 'fully-compatible';
|
|
138
|
-
}
|
|
139
|
-
// Downgrade - incompatible
|
|
140
|
-
return 'incompatible';
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Plugin Dependency Resolver
|
|
145
|
-
*
|
|
146
|
-
* Resolves plugin dependencies using topological sorting and conflict detection
|
|
147
|
-
*/
|
|
148
|
-
export class DependencyResolver {
|
|
149
|
-
constructor(logger) {
|
|
150
|
-
this.logger = logger.child({ component: 'DependencyResolver' });
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Resolve dependencies using topological sort
|
|
154
|
-
*/
|
|
155
|
-
resolve(plugins) {
|
|
156
|
-
const graph = new Map();
|
|
157
|
-
const inDegree = new Map();
|
|
158
|
-
// Build dependency graph
|
|
159
|
-
for (const [pluginName, pluginInfo] of plugins) {
|
|
160
|
-
if (!graph.has(pluginName)) {
|
|
161
|
-
graph.set(pluginName, []);
|
|
162
|
-
inDegree.set(pluginName, 0);
|
|
163
|
-
}
|
|
164
|
-
const deps = pluginInfo.dependencies || [];
|
|
165
|
-
for (const dep of deps) {
|
|
166
|
-
// Check if dependency exists
|
|
167
|
-
if (!plugins.has(dep)) {
|
|
168
|
-
throw new Error(`Missing dependency: ${pluginName} requires ${dep}`);
|
|
169
|
-
}
|
|
170
|
-
// Add edge
|
|
171
|
-
if (!graph.has(dep)) {
|
|
172
|
-
graph.set(dep, []);
|
|
173
|
-
inDegree.set(dep, 0);
|
|
174
|
-
}
|
|
175
|
-
graph.get(dep).push(pluginName);
|
|
176
|
-
inDegree.set(pluginName, (inDegree.get(pluginName) || 0) + 1);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Topological sort using Kahn's algorithm
|
|
180
|
-
const queue = [];
|
|
181
|
-
const result = [];
|
|
182
|
-
// Add all nodes with no incoming edges
|
|
183
|
-
for (const [node, degree] of inDegree) {
|
|
184
|
-
if (degree === 0) {
|
|
185
|
-
queue.push(node);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
while (queue.length > 0) {
|
|
189
|
-
const node = queue.shift();
|
|
190
|
-
result.push(node);
|
|
191
|
-
// Reduce in-degree for dependent nodes
|
|
192
|
-
const dependents = graph.get(node) || [];
|
|
193
|
-
for (const dependent of dependents) {
|
|
194
|
-
const newDegree = (inDegree.get(dependent) || 0) - 1;
|
|
195
|
-
inDegree.set(dependent, newDegree);
|
|
196
|
-
if (newDegree === 0) {
|
|
197
|
-
queue.push(dependent);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
// Check for circular dependencies
|
|
202
|
-
if (result.length !== plugins.size) {
|
|
203
|
-
const remaining = Array.from(plugins.keys()).filter(p => !result.includes(p));
|
|
204
|
-
this.logger.error('Circular dependency detected', { remaining });
|
|
205
|
-
throw new Error(`Circular dependency detected among: ${remaining.join(', ')}`);
|
|
206
|
-
}
|
|
207
|
-
this.logger.debug('Dependencies resolved', { order: result });
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Detect dependency conflicts
|
|
212
|
-
*/
|
|
213
|
-
detectConflicts(plugins) {
|
|
214
|
-
const conflicts = [];
|
|
215
|
-
const versionRequirements = new Map();
|
|
216
|
-
// Collect all version requirements
|
|
217
|
-
for (const [pluginName, pluginInfo] of plugins) {
|
|
218
|
-
if (!pluginInfo.dependencies)
|
|
219
|
-
continue;
|
|
220
|
-
for (const [depName, constraint] of Object.entries(pluginInfo.dependencies)) {
|
|
221
|
-
if (!versionRequirements.has(depName)) {
|
|
222
|
-
versionRequirements.set(depName, new Map());
|
|
223
|
-
}
|
|
224
|
-
versionRequirements.get(depName).set(pluginName, constraint);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// Check for version mismatches
|
|
228
|
-
for (const [depName, requirements] of versionRequirements) {
|
|
229
|
-
const depInfo = plugins.get(depName);
|
|
230
|
-
if (!depInfo)
|
|
231
|
-
continue;
|
|
232
|
-
const depVersion = SemanticVersionManager.parse(depInfo.version);
|
|
233
|
-
const unsatisfied = [];
|
|
234
|
-
for (const [requiringPlugin, constraint] of requirements) {
|
|
235
|
-
if (!SemanticVersionManager.satisfies(depVersion, constraint)) {
|
|
236
|
-
unsatisfied.push({
|
|
237
|
-
pluginId: requiringPlugin,
|
|
238
|
-
version: constraint,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (unsatisfied.length > 0) {
|
|
243
|
-
conflicts.push({
|
|
244
|
-
type: 'version-mismatch',
|
|
245
|
-
severity: 'error',
|
|
246
|
-
description: `Version mismatch for ${depName}: detected ${unsatisfied.length} unsatisfied requirements`,
|
|
247
|
-
plugins: [
|
|
248
|
-
{ pluginId: depName, version: depInfo.version },
|
|
249
|
-
...unsatisfied,
|
|
250
|
-
],
|
|
251
|
-
resolutions: [{
|
|
252
|
-
strategy: 'upgrade',
|
|
253
|
-
description: `Upgrade ${depName} to satisfy all constraints`,
|
|
254
|
-
targetPlugins: [depName],
|
|
255
|
-
automatic: false,
|
|
256
|
-
}],
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
// Check for circular dependencies (will be caught by resolve())
|
|
261
|
-
try {
|
|
262
|
-
this.resolve(new Map(Array.from(plugins.entries()).map(([name, info]) => [
|
|
263
|
-
name,
|
|
264
|
-
{ version: info.version, dependencies: info.dependencies ? Object.keys(info.dependencies) : [] }
|
|
265
|
-
])));
|
|
266
|
-
}
|
|
267
|
-
catch (error) {
|
|
268
|
-
if (error instanceof Error && error.message.includes('Circular dependency')) {
|
|
269
|
-
conflicts.push({
|
|
270
|
-
type: 'circular-dependency',
|
|
271
|
-
severity: 'critical',
|
|
272
|
-
description: error.message,
|
|
273
|
-
plugins: [], // Would need to extract from error
|
|
274
|
-
resolutions: [{
|
|
275
|
-
strategy: 'manual',
|
|
276
|
-
description: 'Remove circular dependency by restructuring plugins',
|
|
277
|
-
automatic: false,
|
|
278
|
-
}],
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return conflicts;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Find best version that satisfies all constraints
|
|
286
|
-
*/
|
|
287
|
-
findBestVersion(availableVersions, constraints) {
|
|
288
|
-
// Parse and sort versions (highest first)
|
|
289
|
-
const versions = availableVersions
|
|
290
|
-
.map(v => ({ str: v, parsed: SemanticVersionManager.parse(v) }))
|
|
291
|
-
.sort((a, b) => -SemanticVersionManager.compare(a.parsed, b.parsed));
|
|
292
|
-
// Find highest version that satisfies all constraints
|
|
293
|
-
for (const version of versions) {
|
|
294
|
-
const satisfiesAll = constraints.every(constraint => SemanticVersionManager.satisfies(version.parsed, constraint));
|
|
295
|
-
if (satisfiesAll) {
|
|
296
|
-
return version.str;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return undefined;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Check if dependencies form a valid DAG (no cycles)
|
|
303
|
-
*/
|
|
304
|
-
isAcyclic(dependencies) {
|
|
305
|
-
try {
|
|
306
|
-
const plugins = new Map(Array.from(dependencies.entries()).map(([name, deps]) => [
|
|
307
|
-
name,
|
|
308
|
-
{ dependencies: deps }
|
|
309
|
-
]));
|
|
310
|
-
this.resolve(plugins);
|
|
311
|
-
return true;
|
|
312
|
-
}
|
|
313
|
-
catch {
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-resolver.test.d.ts","sourceRoot":"","sources":["../src/dependency-resolver.test.ts"],"names":[],"mappings":""}
|