@kumori/kdsl 0.0.54 → 0.1.1
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/bin/cli.js +9 -3
- package/dist/build/helpers/deployment.d.ts +13 -13
- package/dist/build/main.js +32 -13
- package/dist/build/main.js.map +1 -1
- package/dist/deployment/gen/deployment-template.kumori +1 -1
- package/dist/deployment/gen/main.d.ts +1 -2
- package/dist/deployment/gen/main.js +7 -14
- package/dist/deployment/gen/main.js.map +1 -1
- package/dist/index/create/main.d.ts +1 -0
- package/dist/index/create/main.js +35 -15
- package/dist/index/create/main.js.map +1 -1
- package/dist/index/create/types.d.ts +1 -1
- package/dist/index/main.js +2 -0
- package/dist/index/main.js.map +1 -1
- package/dist/index/remove/main.d.ts +11 -0
- package/dist/index/remove/main.js +136 -0
- package/dist/index/remove/main.js.map +1 -0
- package/dist/lib/build.js +29 -42
- package/dist/lib/check.js +15 -45
- package/dist/lib/clean.js +1 -39
- package/dist/lib/deployment.d.ts +0 -3
- package/dist/lib/deployment.js +1 -5
- package/dist/lib/deployment.js.map +1 -1
- package/dist/lib/index-cmd.js +151 -60
- package/dist/lib/index.js +260 -54
- package/dist/lib/mod.js +78 -144
- package/dist/lib/registry.js +1 -67
- package/dist/mod/dependency/main.js +3 -4
- package/dist/mod/dependency/main.js.map +1 -1
- package/dist/mod/jsonschema/gen/main.js +3 -5
- package/dist/mod/jsonschema/gen/main.js.map +1 -1
- package/dist/mod/update/main.js +2 -2
- package/dist/mod/update/main.js.map +1 -1
- package/dist/util/git-or-fs-client.d.ts +13 -0
- package/dist/util/git-or-fs-client.js +86 -0
- package/dist/util/git-or-fs-client.js.map +1 -0
- package/out/deployment/gen/deployment-template.kumori +1 -1
- package/package.json +25 -15
- package/dist/lib/io/lib.kumori +0 -3
- package/dist/lib/kumori/builtin/apiserver.h.kumori +0 -19
- package/dist/lib/kumori/builtin/httpinbound.h.kumori +0 -34
- package/dist/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
- package/dist/lib/kumori/builtin.kumori +0 -16
- package/dist/lib/kumori/component.kumori +0 -120
- package/dist/lib/kumori/deployment.kumori +0 -14
- package/dist/lib/kumori/resource.kumori +0 -23
- package/dist/lib/kumori/service.kumori +0 -51
- package/dist/lib/kumori/shared.kumori +0 -18
- package/dist/lib/kumori/sized.kumori +0 -25
- package/dist/lib/sized.kumori +0 -8
- package/dist/lib/std.kumori +0 -8
- package/dist/lib/strconv/lib.kumori +0 -9
- package/out/deployment-template.kumori +0 -33
- package/out/lib/io/lib.kumori +0 -3
- package/out/lib/kumori/builtin/apiserver.h.kumori +0 -19
- package/out/lib/kumori/builtin/httpinbound.h.kumori +0 -34
- package/out/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
- package/out/lib/kumori/builtin.kumori +0 -16
- package/out/lib/kumori/component.kumori +0 -120
- package/out/lib/kumori/deployment.kumori +0 -14
- package/out/lib/kumori/resource.kumori +0 -23
- package/out/lib/kumori/service.kumori +0 -51
- package/out/lib/kumori/shared.kumori +0 -18
- package/out/lib/kumori/sized.kumori +0 -25
- package/out/lib/sized.kumori +0 -8
- package/out/lib/std.kumori +0 -8
- package/out/lib/strconv/lib.kumori +0 -9
- package/out/main.cjs +0 -820
package/dist/lib/mod.js
CHANGED
|
@@ -1,144 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
version: options.version,
|
|
79
|
-
cacheLocation: options.cacheLocation,
|
|
80
|
-
path: options.path,
|
|
81
|
-
});
|
|
82
|
-
return Ok(undefined);
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
return Err([String(err)]);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Generate SHA-256 checksum for a module.
|
|
90
|
-
*
|
|
91
|
-
* @param options - Module checksum options
|
|
92
|
-
* @returns Result with checksum string on success, or string[] of errors
|
|
93
|
-
*/
|
|
94
|
-
export async function moduleChecksum(options) {
|
|
95
|
-
const { CalculateChecksum } = await import("@kumori/kdsl-lsp/module/integrity/checksum.js");
|
|
96
|
-
const { ModuleContext } = await import("@kumori/kdsl-lsp/module/context.js");
|
|
97
|
-
const { URI } = await import("langium");
|
|
98
|
-
const path = await import("node:path");
|
|
99
|
-
const fs = options.services.shared.workspace.FileSystemProvider;
|
|
100
|
-
const target = options.directory ?? options.cwd ?? ".";
|
|
101
|
-
const ctx = await ModuleContext(fs, URI.file(path.resolve(target)), options.configPath);
|
|
102
|
-
if (Result.isErr(ctx)) {
|
|
103
|
-
return Err([ctx.err]);
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
const checksum = await CalculateChecksum(ctx.value.Current.Root.fsPath);
|
|
107
|
-
return Ok(checksum);
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
return Err([String(err)]);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Extract JSON Schema for a specified module and artifact.
|
|
115
|
-
* Generates and outputs the JSON Schema that describes a particular Kumori DSL artifact.
|
|
116
|
-
*
|
|
117
|
-
* @param options - Module schema get options
|
|
118
|
-
* @returns Result with schema object on success, or string[] of errors
|
|
119
|
-
*/
|
|
120
|
-
export async function moduleSchemaGet(options) {
|
|
121
|
-
const log = getLogger(options.logger);
|
|
122
|
-
const { LocateModule, GetSchema } = await import("../mod/jsonschema/get/main.js");
|
|
123
|
-
const { ModuleContext } = await import("@kumori/kdsl-lsp/module/context.js");
|
|
124
|
-
const { Check } = await import("../check/main.js");
|
|
125
|
-
const { URI } = await import("langium");
|
|
126
|
-
const svcs = options.services;
|
|
127
|
-
const fs = svcs.shared.workspace.FileSystemProvider;
|
|
128
|
-
const locResult = await LocateModule(options.target, options.configPath);
|
|
129
|
-
if (Result.isErr(locResult)) {
|
|
130
|
-
return locResult;
|
|
131
|
-
}
|
|
132
|
-
const ctx = await ModuleContext(fs, URI.file(locResult.value.fsPath), options.configPath);
|
|
133
|
-
if (Result.isErr(ctx)) {
|
|
134
|
-
return Err([ctx.err]);
|
|
135
|
-
}
|
|
136
|
-
// Download dependencies
|
|
137
|
-
const checkResult = await Check(log, svcs, ctx.value);
|
|
138
|
-
if (Result.isErr(checkResult)) {
|
|
139
|
-
return checkResult;
|
|
140
|
-
}
|
|
141
|
-
// Get the schema
|
|
142
|
-
return await GetSchema(svcs, ctx.value, options.packagePath, options.artifactName);
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=mod.js.map
|
|
1
|
+
import{createRequire as fW}from"node:module";var DW=Object.create;var{getPrototypeOf:TW,defineProperty:o,getOwnPropertyNames:MW}=Object;var kW=Object.prototype.hasOwnProperty;var IY=(X,W,Y)=>{Y=X!=null?DW(TW(X)):{};let Z=W||!X||!X.__esModule?o(Y,"default",{value:X,enumerable:!0}):Y;for(let G of MW(X))if(!kW.call(Z,G))o(Z,G,{get:()=>X[G],enumerable:!0});return Z};var AY=(X,W)=>()=>(W||X((W={exports:{}}).exports,W),W.exports);var T=(X,W)=>{for(var Y in W)o(X,Y,{get:W[Y],enumerable:!0,configurable:!0,set:(Z)=>W[Y]=()=>Z})};var E=(X,W)=>()=>(X&&(W=X(X=0)),W);var b=fW(import.meta.url),hW=Symbol.dispose||Symbol.for("Symbol.dispose"),xW=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Q1=(X,W,Y)=>{if(W!=null){if(typeof W!=="object"&&typeof W!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var Z;if(Y)Z=W[xW];if(Z===void 0)Z=W[hW];if(typeof Z!=="function")throw TypeError("Object not disposable");X.push([Y,Z,W])}else if(Y)X.push([Y]);return W},B1=(X,W,Y)=>{var Z=typeof SuppressedError==="function"?SuppressedError:function(z,H,J,V){return V=Error(J),V.name="SuppressedError",V.error=z,V.suppressed=H,V},G=(z)=>W=Y?new Z(z,W,"An error was suppressed during disposal"):(Y=!0,z),K=(z)=>{while(z=X.pop())try{var H=z[1]&&z[1].call(z[2]);if(z[0])return Promise.resolve(H).then(K,(J)=>(G(J),K()))}catch(J){G(J)}if(Y)throw W};return K()};var $1={};T($1,{default:()=>iW,Register:()=>C1,ParseModuleIdentifier:()=>O1,NewModule:()=>b1,Description:()=>P1,Action:()=>E1});import{Maybe as uW}from"@kumori/kdsl-lsp/util/maybe.js";import{mkdir as dW,writeFile as pW}from"fs/promises";import{URI as cW}from"langium";import{NodeFileSystem as mW}from"langium/node";import{LocateModuleManifest as gW,MOD_FILE as N1}from"@kumori/kdsl-lsp/module/locator.js";import t from"path";function O1(X){let W=X.trim(),Y=W.indexOf("/");if(Y<=0||Y===W.length-1)return;let Z=W.slice(0,Y),G=W.slice(Y+1);if(!nW.test(Z))return;let K=G.split("/");if(K.some((H)=>!lW.test(H)))return;let z=K[K.length-1];return{domain:Z,module:G,name:z}}function C1(X,W){return X.command("init").summary(rW).argument("<name>","module identifier in the form <domain>/<module> (e.g., kumori.systems/my-module or kumori/mymodule)").argument("<version>","module version - defaults to 0.0.1").argument("[path]","location to create the module under - defaults to the current directory").argument("[cacheLocation]","location to store cached modules - default to .kumori/mod").description(P1).helpOption(!0).action(E1(W))}function E1(X){return async(...W)=>{await b1(X,process.cwd(),...W)}}var iW,S1="[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",nW,lW,rW="initializes a new kumori module",P1,b1=async(X,W,...[Y,Z,G,K])=>{if(!O1(Y))X.error(`error: invalid module name '${Y}'; expected '<domain>/<module>' (e.g. kumori.systems/my-module or kumori/my-module)`),process.exit(1);let z=mW.fileSystemProvider();if(G=G??W,!t.isAbsolute(G))G=t.join(W,G);let H=await gW(z,cW.file(G));if(uW.isSome(H)&&H.value.fsPath===G)X.error(`error: module ${G} already exists`),process.exit(1);let J={spec:"kumori/module/v1",kumori:"0.0.1",version:Z,module:Y,cacheLocation:K,requires:[]},V=t.join(G,N1);await dW(G,{recursive:!0}),await pW(V,JSON.stringify(J,null,4)),X.info(`creating new ${N1}: module ${Y}`)};var R1=E(()=>{iW={Register:C1},nW=new RegExp(`^${S1}(?:\\.${S1})*$`),lW=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;P1=`
|
|
2
|
+
Initializes a new Kumori module, which effectively means to create a new
|
|
3
|
+
kumori.mod.json file or overwrite it in case it already exists.
|
|
4
|
+
It is required to provide a name and a version for the module and optionally
|
|
5
|
+
a location path where the new module is going to be initialized.
|
|
6
|
+
|
|
7
|
+
The module name must be a valid module identifier in the form:
|
|
8
|
+
<domain>/<module>
|
|
9
|
+
|
|
10
|
+
Examples of valid identifiers:
|
|
11
|
+
kumori.systems/my-module
|
|
12
|
+
kumori/mymodule
|
|
13
|
+
example.io/path/to/module
|
|
14
|
+
|
|
15
|
+
kdsl mod init kumori.systems/my-module
|
|
16
|
+
|
|
17
|
+
You could as well provide a custom location for the module's local cache,
|
|
18
|
+
where all the dependencies will be downloaded. By default, the cache location
|
|
19
|
+
is set to ".kumori/mod" under the module location.
|
|
20
|
+
|
|
21
|
+
kdsl mod init kumori.systems/my-module ./my-module
|
|
22
|
+
|
|
23
|
+
`.trim()});import{Result as sW}from"@kumori/kdsl-lsp/util/result.js";function k(X,W){if(sW.isErr(W)){for(let Y of W.err)X.error(Y);process.exit(1)}return W.value}var c=()=>{};import{ParseQuery as k1}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as m,None as oW,Some as tW}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as C,Ok as a,Result as $}from"@kumori/kdsl-lsp/util/result.js";import{Version as D1}from"@kumori/kdsl-lsp/module/version.js";import{ListDependencies as aW}from"@kumori/kdsl-lsp/module/dependency/list.js";import e from"assert";import{LocateDependency as f1}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{ModuleContext as eW}from"@kumori/kdsl-lsp/module/context.js";import{MkdirTemp as WX}from"@kumori/kdsl-lsp/util/tmp.js";import{ValidateChecksum as XX}from"@kumori/kdsl-lsp/module/integrity/validate.js";import{URI as YX,UriUtils as ZX}from"langium";import{cp as GX,mkdir as zX,rm as T1}from"fs/promises";import{ForURL as KX}from"@kumori/kdsl-lsp/module/remote/factory.js";import{SemVer as M1}from"@kumori/kdsl-lsp/util/semver.js";import{URL as HX}from"@kumori/kdsl-lsp/util/url.js";import{DependencyId as h1}from"@kumori/kdsl-lsp/module/dependency/id.js";async function x1(X){let W=new Map;return await v1(X,W),W}async function y1(X,W){let Y=new Map;console.log(W);for(let Z of W){let G=k1(Z,X.Locations.Config());if(m.isNone(G)){let J=`invalid download query '${Z}': failed to parse`;Y.set(Z,{...C(J),required:!0});continue}let K=D1(G.value.Version);if(m.isNone(K)){let J=`invalid download query '${Z}': invalid version specifier '${G.value.Version}': failed to parse`;Y.set(Z,{...C(J),required:!0});continue}if(!D1.isSemVer(K.value)){let J=`invalid download query '${Z}': invalid version specifier '${G.value.Version}': invalid semver`;Y.set(Z,{...C(J),required:!0});continue}let z=`${G.value.Scheme}://${G.value.Location}`,H=G.value.Version;await L1(X,z,H,Y)}return Y}async function v1(X,W){let Y=aW(X.Current);for(let Z of Y.keys()){let G=Y.get(Z);if(G.length<1)continue;let{target:K,version:z}=G[0];await L1(X,K,z,W);let H=G.reduce((V,Q)=>V||Q.interface===void 0,!1),J=h1(K,z);e(W.has(J)),W.get(J).required||=H}}async function L1(X,W,Y,Z){let G=h1(W,Y);if(Z.has(G))return;let K=await JX(X,W,Y);if(Z.set(G,{...K,required:!1}),$.isErr(K))return;let z=await f1(X,W,Y);e(m.isSome(z));let H=await eW.Move(X,X.FS,z.value.Root);e($.isOk(H)),X={...X,...H.value},await v1(X,Z)}async function JX(X,W,Y){let V=[];try{let Z=await f1(X,W,Y);if($.isOk(Z))return a(oW);const G=Q1(V,await WX(),1);let K=await W1(X,W,Y,G.Path);if($.isErr(K))return C(`failed to fetch ${W}@${Y}: ${K.err}`);let z=await XX(X.SumDB,YX.file(G.Path),X,W,K.value);if($.isErr(z))return z;let H=`${W}@${Y}`;let J=ZX.joinPath(X.Locations.Cache(),H);await zX(J.fsPath,{recursive:!0});await T1(J.fsPath,{recursive:!0,force:!0});await GX(G.Path,J.fsPath,{recursive:!0});await T1(G.Path,{recursive:!0,force:!0});return a(tW(H))}catch(Q){var j=Q,B=1}finally{var q=B1(V,j,B);q&&await q}}async function W1(X,W,Y,Z){let G=`${W}@${Y}`,K=k1(G,X.Locations.Config());if(m.isNone(K))return C(`failed to resolve ${G}: invalid download query`);let z=M1(K.value.Version),H=new HX(`${K.value.Scheme}://${K.value.Location}`),J=KX(X.Remotes,H);if($.isErr(J))return C(`failed to resolve ${G}': invalid remote ${H}: ${J.err}`);let V=await J.value.Versions(H);if($.isErr(V))return C(`failed to read ${H}: ${V.err}`);let Q=z,j=V.value.filter((U)=>M1.Compare(U,Q)===0);if(j.length===0)return C(`no remote matches for ${H}@v${z}`);if(j.length>1){let U=`[${j.map(String).join(", ")}]`;return C(`ambiguous match for ${H}@v${z}: found ${U}`)}let B=j[0],q=await J.value.Get(H,B.toString(),Z);if($.isErr(q))return C(`failed to fetch ${H}@${z.toString()}: ${q.err}`);return a(B)}var X1=()=>{};var g1={};T(g1,{default:()=>FX,Register:()=>p1,Download:()=>R,Description:()=>c1,Action:()=>m1});import{ModuleContext as VX}from"@kumori/kdsl-lsp/module/context.js";import{SumDB as QX}from"@kumori/kdsl-lsp/module/integrity/sumdb.js";import{RemoteFetcherFactory as u1}from"@kumori/kdsl-lsp/module/remote/factory.js";import{Maybe as BX}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as d1,Ok as _X,Result as y}from"@kumori/kdsl-lsp/util/result.js";import{URI as qX}from"langium";import{NodeFileSystem as jX}from"langium/node";import{createKumoriServices as UX}from"@kumori/kdsl-lsp/language/kumori.js";import{RegistryManager as wX}from"@kumori/kdsl-lsp/module/registry/manager.js";function p1(X,W){return X.command("download").alias("dl").summary(IX).argument("[module...]").option("-q, --quiet","do not log warnings").description(c1).helpOption(!0).action(m1(W))}function m1(X){let W=(Y)=>k(X,Y);return async(Y,Z,G)=>{let K=G?.optsWithGlobals()?.config,z=UX(jX,K).Kumori;await new wX(K).ensureIndexes(),W(await R(X,z,process.cwd(),Y,Z,K))}}var FX,IX="download modules to local cache",c1,R=async(X,W,Y,Z,G,K)=>{let z=W.shared.workspace.FileSystemProvider,H=await VX(z,qX.file(Y),K);if(y.isErr(H))return d1([H.err]);let J=await QX.Open(H.value.Locations.Checksum());if(y.isErr(J))return y.mapErr(J,(B)=>[B]);let V;if(!Z.length)V=await x1({...H.value,FS:z,Remotes:u1(),SumDB:J.value});else V=await y1({...H.value,FS:z,Remotes:u1(),SumDB:J.value},Z);let Q=[];for(let[B,q]of V){if(y.isOk(q)){if(BX.isSome(q.value))X.info(`Downloaded dependency ${B}`);continue}if(q.required)Q.push(`${B}: ${q.err}`);else if(!G.quiet)X.warn(`${B}: ${q.err}`),X.warn(`${B}: not required - continuing`)}if(Array.from(V.entries()).filter(([,B])=>y.isErr(B)&&B.required).length>0)return d1(Q);return _X(void 0)};var g=E(()=>{c();X1();FX={Register:p1};c1=`
|
|
24
|
+
Downloads the specified modules, which can be module patterns selecting depen-
|
|
25
|
+
dencies of the current module or module queries of the form path@version.
|
|
26
|
+
|
|
27
|
+
With no arguments, download applies to the modules needed to build the packages
|
|
28
|
+
in the current module.
|
|
29
|
+
|
|
30
|
+
The kdsl command will automatically download modules as needed during ordinary
|
|
31
|
+
execution. The "kdsl mod download" command is useful mainly for pre-filling the
|
|
32
|
+
local cache.
|
|
33
|
+
|
|
34
|
+
By default, download writes nothing to standard output. It may print progress
|
|
35
|
+
messages and errors to standard error.
|
|
36
|
+
`.trim()});var t1={};T(t1,{default:()=>PX,Register:()=>r1,Description:()=>l1,Dependency:()=>o1,Action:()=>s1});import{URI as AX,UriUtils as Y1}from"langium";import{createKumoriServices as NX}from"@kumori/kdsl-lsp/language/kumori.js";import{NodeFileSystem as SX}from"langium/node";import{Result as v}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as OX}from"@kumori/kdsl-lsp/module/context.js";import{MOD_FILE as Z1}from"@kumori/kdsl-lsp/module/locator.js";import{ParseQuery as i1}from"@kumori/kdsl-lsp/module/query.js";import{RegistryManager as n1}from"@kumori/kdsl-lsp/module/registry/manager.js";function r1(X,W){return X.command("dependency").alias("dep").argument("<module>","Module URL with @<tag> (e.g. https://github.com/org/repo@v1.2.3)").option("--alias <alias>","Alias for the dependency").option("--headers <module>","Specify a separate location for the headers module").option("--remove","Remove the dependency").option("--download","Download the dependency after adding it").summary(CX).description(l1).helpOption(!0).showHelpAfterError(!0).action(s1(W))}function s1(X){return async(W,Y,Z)=>{let G=Z?.optsWithGlobals()?.config;await new n1(G).ensureIndexes();try{await o1(X,AX.file(process.cwd()),W,Y,G)}catch(z){throw X.error(`Failed to manage dependency: ${z}`),z}}}var CX="Add, update, or remove a dependency from the module declaration",l1,PX,o1=async(X,W,Y,Z,G)=>{let K=NX(SX,G).Kumori,z=K.shared.workspace.FileSystemProvider,H=await OX(z,W,G);if(v.isErr(H))throw Error(H.err);let J=H.value.Current.Manifest,V=i1(Y,H.value.Locations.Config());if(v.isErr(V))throw Error(`invalid query '${Y}': invalid format`);let Q=null;if(Z.headers){if(Q=i1(Z.headers,H.value.Locations.Config()),v.isErr(Q))throw Error(`invalid query '${Z.headers}': invalid format`)}let j=Q?Q.value:null,B=V.value;if(B.Location.endsWith("/"))B.Location=B.Location.replace(/\/+$/,"");let{alias:q,remove:U}=Z,w=B.Location;if(new n1(G).list().find((A)=>Y.startsWith(A.selector))!==void 0)w=Y.slice(0,Y.indexOf("@"));if(U){let A=J.requires.findIndex((d)=>d.target===w&&d.version===B.Version);if(A===-1)throw Error(`Dependency ${B} not found`);J.requires.splice(A,1),await Bun.write(Y1.joinPath(H.value.Current.Root,Z1).fsPath,JSON.stringify(J,void 0,4)),X.info(`Removed dependency ${B.toString()}`);return}if(q&&J.requires.some((A)=>A.alias===q&&A.target!==w))throw Error(`Alias '${q}' is already used by another dependency`);let h=J.requires.find((A)=>A.target===w);if(h){if(q)h.alias=q;else delete h.alias;if(j)h.headers={target:j.Location,version:j.Version};if(Z.download){let A=await R(X,K,W.fsPath,[],{quiet:!0},G);if(v.isErr(A))throw Error(`Failed to download dependency: ${A.err.join(", ")}`)}h.version=B.Version,await Bun.write(Y1.joinPath(H.value.Current.Root,Z1).fsPath,JSON.stringify(J,void 0,4)),X.info(`Updated dependency ${B.Location} to version ${B.Version}`+(q?` (alias: ${q})`:"")+(j?` (headers: ${j})`:""))}else{let A=B.Version,d={target:w,version:A,...q?{alias:q}:{},...j?{headers:{target:j.Location,version:j.Version}}:{}};if(J.requires.push(d),await Bun.write(Y1.joinPath(H.value.Current.Root,Z1).fsPath,JSON.stringify(J,void 0,4)),Z.download){let V1=await R(X,K,W.fsPath,[],{quiet:!0},G);if(v.isErr(V1))throw Error(`Failed to download dependency: ${V1.err.join(", ")}`)}X.info(`Added dependency ${B.toString()}`+(q?` (alias: ${q})`:"")+(j?` (headers: ${j})`:"")+" to module manifest")}};var a1=E(()=>{g();l1=`
|
|
37
|
+
Manage dependencies within the current module. It can add, update
|
|
38
|
+
or remove dependencies. Optionally, it can attempt to download the dependency after adding it.
|
|
39
|
+
Dependencies should resolve to a git repository.
|
|
40
|
+
|
|
41
|
+
To add a dependency:
|
|
42
|
+
kdsl mod dep github.com/org/repo@v1.0.0
|
|
43
|
+
|
|
44
|
+
To add a dependency with an alias:
|
|
45
|
+
kdsl mod dep github.com/org/repo@v1.0.0 --alias mydep
|
|
46
|
+
|
|
47
|
+
To update a dependency to a new version:
|
|
48
|
+
kdsl mod dep github.com/org/repo@1.2.0
|
|
49
|
+
|
|
50
|
+
To remove a dependency:
|
|
51
|
+
kdsl mod dep github.com/org/repo --remove
|
|
52
|
+
|
|
53
|
+
To add a dependency and download it immediately:
|
|
54
|
+
kdsl mod dep github.com/org/repo@v1.0.0 --download
|
|
55
|
+
`.trim(),PX={Register:r1}});var GW={};T(GW,{default:()=>DX,Register:()=>WW,NewModule:()=>ZW,Description:()=>XW,Action:()=>YW});import{Maybe as EX}from"@kumori/kdsl-lsp/util/maybe.js";import{mkdir as bX}from"node:fs/promises";import{URI as e1}from"langium";import{NodeFileSystem as $X}from"langium/node";import{LocateModuleManifest as RX,MOD_FILE as G1}from"@kumori/kdsl-lsp/module/locator.js";import i from"path";function WW(X,W){return X.command("update").summary(TX).option("-v, --version <version>","new module version").option("-p, --path <location>","location where the module to update is located - defaults to the current directory").option("-c, --cacheLocation <cacheLocation>","new cache location").description(XW).helpOption(!0).action(YW(W))}function YW(X){return async(W)=>{await ZW(X,process.cwd(),W)}}var DX,TX="updates an existing kumori module's version or cache location",XW,ZW=async(X,W,Y)=>{let Z=$X.fileSystemProvider(),G=Y.path??W;if(!i.isAbsolute(G))G=i.join(W,G);let K=await RX(Z,e1.file(G));if(EX.isSome(K)&&K.value.fsPath===G)X.error(`error: module ${G} already exists`),process.exit(1);let z=await Z.readFile(e1.file(i.join(G,G1))),H=JSON.parse(z),J={spec:"kumori/module/v1",kumori:"0.0.1",version:Y.version??H.version,module:H.module,cacheLocation:Y.cacheLocation??H.cacheLocation,requires:[]},V=i.join(G,G1);await bX(G,{recursive:!0}),await Bun.write(V,JSON.stringify(J,null,4)),X.info(`updated ${G1}: module ${J.module}`)};var zW=E(()=>{DX={Register:WW};XW=`
|
|
56
|
+
This command updates an existing Kumori module's version or cache location in the kumori.mod.json file. It is required to provide the new version and optionally
|
|
57
|
+
a new cache location for the module.
|
|
58
|
+
|
|
59
|
+
kdsl mod update -v 1.0.0
|
|
60
|
+
|
|
61
|
+
You could as well provide a new location for the module's local cache,
|
|
62
|
+
where all the dependencies will be downloaded.
|
|
63
|
+
|
|
64
|
+
kdsl mod update -v 1.0.0 -c ./my-mod-cache
|
|
65
|
+
|
|
66
|
+
If the module is not located in the current directory, you can provide a custom location path.
|
|
67
|
+
|
|
68
|
+
kdsl mod update -v 1.0.0 -p ./my-module
|
|
69
|
+
`.trim()});var qW={};T(qW,{default:()=>dX,Summary:()=>VW,Register:()=>JW,RawCheck:()=>_W,Description:()=>QW,Check:()=>n,Action:()=>BW});import{createKumoriServices as MX}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as kX,UriUtils as K1}from"langium";import{NodeFileSystem as fX}from"langium/node";import{DiagnosticSeverity as KW}from"vscode-languageserver";import{Err as z1,Ok as HW,Result as L}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as hX}from"@kumori/kdsl-lsp/module/context.js";import xX from"node:path";import{RegistryManager as yX}from"@kumori/kdsl-lsp/module/registry/manager.js";function JW(X,W){return X.command("check").argument("[directory]","directory containing a Kumori module").description(QW).summary(VW).action(BW(W))}function BW(X){return async(W,Y,Z)=>{await new yX(Z?.optsWithGlobals()?.config).ensureIndexes();let K=MX(fX).Kumori,z=K.shared.workspace.FileSystemProvider,H=(Q)=>k(X,Q),J=Z?.optsWithGlobals()?.config,V=H(L.mapErr(await hX(z,kX.file(xX.resolve(W??".")),J),(Q)=>[Q]));H(await n(X,K,V))}}function vX(X,W){return`lexer error: ${K1.relative(process.cwd(),X.uri.fsPath)}:${W.line||1}:${W.column||1}: ${W.message}`}function LX(X,W){return`parser error: ${K1.relative(process.cwd(),X.uri.fsPath)}:${W.token.startLine||1}:${W.token.startColumn||1}: ${W.message}`}function uX(X,W){return`diagnostic error: ${K1.relative(process.cwd(),X.uri.fsPath)}:${W.range.start.line+1}:${W.range.start.character+1}: ${W.message}`}var VW="typecheck and validate a module",QW,n=async(X,W,Y)=>{let Z=Y.Current.Root,G=await R(X,W,Z.fsPath,[],{quiet:!0},Y.Locations.Config());if(L.isErr(G))return G;let K=await _W(W,Y);if(L.isErr(K)){let z=K.err.warnings.concat(K.err.errors);return z1(z)}return HW(void 0)},_W=async(X,W)=>{let Y={errors:[],warnings:[]},Z=X.shared.workspace.FileSystemProvider,G=W.Current.Root,K=await L.tryCatchAsync(()=>Z.readDirectory(G));if(L.isErr(K)){let V=""+K.err;if(K.err instanceof Error)V=K.err.message;return Y.errors.push(`failed to read directory '${G.fsPath}': ${V}`),z1(Y)}await X.shared.workspace.WorkspaceManager.initializeWorkspace([{name:"root",uri:G.toString()}]);let H=X.shared.workspace.LangiumDocuments;await X.shared.workspace.DocumentBuilder.build(H.all.toArray(),{validation:!0});for(let V of X.shared.workspace.LangiumDocuments.all){for(let Q of V.parseResult.lexerErrors)Y.errors.push(vX(V,Q));for(let Q of V.parseResult.parserErrors)Y.errors.push(LX(V,Q));for(let Q of V.diagnostics||[]){let j=uX(V,Q);if(Q.severity===KW.Error)Y.errors.push(j);if(Q.severity===KW.Warning)Y.warnings.push(j)}}if(Y.errors.length>0)return z1(Y);return HW(void 0)},dX;var H1=E(()=>{g();c();QW=`
|
|
70
|
+
`.trim();dX={Register:JW}});import{AstUtils as pX,UriUtils as cX}from"langium";function jW(X){let W=X.node.$cstNode?.range??{start:{line:-1,character:-1},end:{line:-1,character:-1}},Y=pX.getDocument(X.node);return`${cX.relative(process.cwd(),Y.uri.fsPath)}:${W.start.line+1}:${W.start.character+1}: ${X.message}`}var UW=()=>{};var $W={};T($W,{default:()=>jY,ToJSONSchemaInternal:()=>P,ToJSONSchema:()=>bW,Register:()=>SW,LocateModule:()=>PW,GetSchema:()=>EW,Description:()=>OW,Action:()=>CW});import{createKumoriServices as mX}from"@kumori/kdsl-lsp/language/kumori.js";import{ModuleContext as gX}from"@kumori/kdsl-lsp/module/context.js";import{ParseQuery as iX}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as IW,None as nX,Some as lX}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as O,Ok as N,Result as I}from"@kumori/kdsl-lsp/util/result.js";import{TempCache as rX}from"@kumori/kdsl-lsp/util/tmp.js";import{NodeFileSystem as AW}from"langium/node";import D from"path";import{AstUtils as J1,URI as sX,UriUtils as NW}from"langium";import u from"assert";import{TAny as wW,TBoolean as oX,TEither as tX,TFunction as aX,TList as eX,TNumber as WY,TOptional as FW,TString as XY,TStruct as YY,TTypeDefAlias as ZY,TTypeDefNamed as GY,TypeSystemError as zY,TypeToString as KY}from"@kumori/kdsl-lsp/language/type-system/type.js";import{ModuleDescriptor as HY}from"@kumori/kdsl-lsp/module/descriptor.js";import{isBuiltinArtifact as JY,isComponentArtifact as VY,isServiceArtifact as QY}from"@kumori/kdsl-lsp/language/generated/ast.js";import{Scheme as BY}from"@kumori/kdsl-lsp/language/builtin/util.js";import{GatherModuleDocuments as _Y}from"@kumori/kdsl-lsp/module/documents.js";import{RemoteFetcherFactory as qY}from"@kumori/kdsl-lsp/module/remote/factory.js";function SW(X,W){return X.command("get").summary(UY).argument("<target>",'Unique path of the kmodule where the artifact is defined. Accepts remote targets (e.g., "github.com/MyOrg/component@v1.2.3") or local paths (e.g. "/abs/path/to/module", "../rel/path/to/module").').argument("<package-path>",`Relative path to the package that contains the artifact (e.g., "internal/service"). For artifacts in the module's root package, use ".".`).argument("<artifact-name>",'Name of the target artifact (e.g., "ExampleService").').description(OW).helpOption(!0).action(CW(W))}function CW(X){return async(W,Y,Z,G,K)=>{let z=K?.optsWithGlobals()?.config,H=mX(AW,z).Kumori,J=(q)=>k(X,q),V=J(await PW(W,z)),Q=H.shared.workspace.FileSystemProvider,j=J(I.mapErr(await gX(Q,sX.file(V.fsPath),z),(q)=>[q]));J(await n(X,H,j));let B=J(await EW(H,j,Y,Z));console.log(JSON.stringify(B,null,4))}}async function PW(X,W){let Y=await rX(),Z=AW.fileSystemProvider(),G=X;if(X[0]==="."||D.isAbsolute(X)){let j=D.isAbsolute(X)?X:D.resolve(process.cwd(),X);return N({$type:"local",fsPath:j})}let z=iX(X,W);if(IW.isNone(z))return O([`invalid remote target '${X}': invalid syntax`]);let H=z.value.Version,J=`${z.value.Location}@${H}`,V=NW.joinPath(Y,J),Q=await HY(Z,V);if(I.isErr(Q)){let j=await W1({Remotes:qY(),Locations:{Config:()=>W}},z.value.Location,H,V.fsPath);if(I.isErr(j))return O([`failed to fetch ${G}: ${j.err}`])}return N({$type:"remote",fsPath:V.fsPath,query:z.value})}async function EW(X,W,Y,Z){let G=NW.joinPath(W.Current.Root,D.normalize(Y)),K=X.references.KumoriPackages.GetPackage(G);if(I.isErr(K))return O([`error: failed to retrieve package: ${G.toString()}`]);let z=new Set(K.value.docs.map((w)=>w.uri.toString())),H=X.shared.workspace.IndexManager.allElements(void 0,z).toArray().filter((w)=>w.name===Z);if(H.length<1)return O([`error: no artifact named defined in ${G.toString()}`]);if(H.length>2)return O([`error: too many matches in ${G.toString()}`]);let J=H[0].node;if(!(VY(J)||QY(J)||JY(J)))return O([`invalid reference to node of type: ${J.$type}`]);if(!J1.getDocument(J).uri.fsPath.endsWith(".h.kumori")){if(!J.name.value.ref)return O(["no headers found for component"]);J=J.name.value.ref}let Q=X.validation.KumoriTypeSystem,j=X.validation.KumoriValidations.ctx(),[B,q]=Q.Infer(j,J);if(q.length>0){let w=[];return q.map((S)=>w.concat(S.message)),O([`type inference failed with errors: ${w}`])}let U=await bW(X,W,B,D.join(W.Current.Manifest.module,Y+"@"+Z));return I.mapErr(U,(w)=>w.map(jW))}async function bW(X,W,Y,Z){return I.map(await P({svcs:X,mod:W},Y),(G)=>({$schema:"https://json-schema.org/draft/2020-12/schema",$spec:"kumori/schema/v1",$id:Z,...G}))}async function P(X,W){if(wW.is(W))return N({});if(aX.is(W))return P(X,W.returns);if(FW.is(W))return P(X,W.inner);if(ZY.is(W))return P(X,W.spec);if(WY.is(W))if(W.literal===void 0)return N({type:"number"});else return N({const:W.literal});if(XY.is(W))if(W.literal===void 0)return N({type:"string"});else return N({const:W.literal});if(oX.is(W))if(W.literal===void 0)return N({type:"boolean"});else return N({const:W.literal});if(eX.is(W)){let Y=await P(X,W.restriction);if(I.isErr(Y))return Y;return N({type:"array",items:Y.value})}if(tX.is(W)){let Y=await Promise.all(W.variations.map((K)=>P(X,K))),Z=Y.filter(I.isErr).map((K)=>K.err).flat();if(Z.length>0)return O(Z);let G=Y.filter(I.isOk).map((K)=>K.value);return u(G.length===Y.length),N({oneOf:G})}if(YY.is(W)){let Y=await Promise.all(Object.entries(W.parameters).map(async(z)=>({key:z[0],value:z[1],schema:await P(X,z[1].value)}))),Z=Y.map((z)=>z.schema).filter((z)=>I.isErr(z)).map((z)=>z.err).flat(),G=nX;if(W.restriction!==void 0&&!wW.is(W.restriction)){let z=await P(X,W.restriction);if(I.isOk(z))G=lX(z.value);else Z=Z.concat(z.err)}if(Z.length>0)return O(Z);let K={type:"object",properties:Object.fromEntries(Y.map((z)=>{return u(I.isOk(z.schema)),[z.key,z.schema.value]})),required:Y.filter((z)=>z.value.optional===!1&&!FW.is(z.value.value)).map((z)=>z.key)};if(IW.isSome(G))K={...K,additionalProperties:G.value};return N(K)}if(GY.is(W)){let Y=await P(X,W.spec);if(I.isErr(Y))return Y;return N({type:"object",properties:{$kdsl:{const:{NamedType:await wY(X,W)}},inner:Y.value},required:["$kdsl","inner"]})}return O([zY.create({node:W,message:`cannot convert definition to JSONSchema: ${KY(W)}`})])}var jY,UY="extracts jsonschema for a specified module and artifact",OW,wY=async(X,W)=>{let Y=W.node;u(Y);let Z=X.svcs.shared.references.KumoriModules,G=J1.getDocument(Y).uri,K=X.svcs.references.KumoriPackages.GetPackage(Y),z=X.mod.Current;if(u(I.isOk(K)),G.scheme===BY)return{Import:K.value.uri.path.slice(1),Name:W.meta.name};if(!(await _Y(X.svcs.shared,X.mod.Root.Root)).map((B)=>B.fsPath).includes(G.fsPath)){let B=Z.getModule(G);u(I.isOk(B)),z=B.value}let Q=z.Root,j=K.value.uri.fsPath.slice(Q.fsPath.length);return{Import:D.join(z.Manifest.module,j),Name:W.meta.name}};var RW=E(()=>{H1();c();UW();X1();jY={Register:SW};OW=`
|
|
71
|
+
Generates and outputs the JSON Schema that describes a particular Kumori DSL
|
|
72
|
+
artifact. This schema defines the artifact's configurable properties, resource
|
|
73
|
+
requirements, and overall structure, making it valuable for programmatic
|
|
74
|
+
interaction, validation, or documentation purposes.
|
|
75
|
+
|
|
76
|
+
The command allows you to specify artifacts from both remote/external modules
|
|
77
|
+
and local modules.
|
|
78
|
+
`.trim()});var _=function(X){return X.info="info",X.warn="warn",X.error="error",X.debug="debug",X.trace="trace",X.fatal="fatal",X}({}),p={[_.trace]:10,[_.debug]:20,[_.info]:30,[_.warn]:40,[_.error]:50,[_.fatal]:60},yW={10:_.trace,20:_.debug,30:_.info,40:_.warn,50:_.error,60:_.fatal};var F=function(X){return X.transformLogLevel="transformLogLevel",X.onBeforeDataOut="onBeforeDataOut",X.shouldSendToLogger="shouldSendToLogger",X.onMetadataCalled="onMetadataCalled",X.onBeforeMessageOut="onBeforeMessageOut",X.onContextCalled="onContextCalled",X}({});var _1=class X{context={};hasContext=!1;setContext(W){if(!W){this.context={},this.hasContext=!1;return}this.context=W,this.hasContext=!0}appendContext(W){this.context={...this.context,...W},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(W){if(W===void 0){this.context={},this.hasContext=!1;return}let Y=Array.isArray(W)?W:[W];for(let Z of Y)delete this.context[Z];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:W,childContextManager:Y}){if(W.hasContextData()){let Z=W.getContext();Y.setContext({...Z})}}clone(){let W=new X;return W.setContext({...this.context}),W.hasContext=this.hasContext,W}},q1=class X{setContext(W){}appendContext(W){}getContext(){return{}}hasContextData(){return!1}clearContext(W){}onChildLoggerCreated(W){}clone(){return new X}};var j1=class X{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(W){let Y=p[W];for(let Z of Object.values(_)){let G=Z,K=p[Z];this.logLevelEnabledStatus[G]=K>=Y}}enableIndividualLevel(W){let Y=W;if(Y in this.logLevelEnabledStatus)this.logLevelEnabledStatus[Y]=!0}disableIndividualLevel(W){let Y=W;if(Y in this.logLevelEnabledStatus)this.logLevelEnabledStatus[Y]=!1}isLevelEnabled(W){let Y=W;return this.logLevelEnabledStatus[Y]}enableLogging(){for(let W of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[W]=!0}disableLogging(){for(let W of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[W]=!1}onChildLoggerCreated({parentLogLevelManager:W,childLogLevelManager:Y}){let Z=W.logLevelEnabledStatus;if(Y instanceof X)Y.logLevelEnabledStatus={...Z}}clone(){let W=new X;return W.logLevelEnabledStatus={...this.logLevelEnabledStatus},W}},U1=class X{setLevel(W){}enableIndividualLevel(W){}disableIndividualLevel(W){}isLevelEnabled(W){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(W){}clone(){return new X}};var vW=[F.onBeforeDataOut,F.onMetadataCalled,F.onBeforeMessageOut,F.transformLogLevel,F.shouldSendToLogger,F.onContextCalled],w1=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(X){this.idToPlugin={},this.mapPlugins(X),this.indexPlugins()}mapPlugins(X){for(let W of X){if(!W.id)W.id=Date.now().toString()+Math.random().toString();if(this.idToPlugin[W.id])throw Error(`[LogLayer] Plugin with id ${W.id} already exists.`);W.registeredAt=Date.now(),this.idToPlugin[W.id]=W}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let X=Object.values(this.idToPlugin).sort((W,Y)=>W.registeredAt-Y.registeredAt);for(let W of X){if(W.disabled)return;for(let Y of vW)if(W[Y]&&W.id)this[Y].push(W.id)}}hasPlugins(X){return this[X].length>0}countPlugins(X){if(X)return this[X].length;return Object.keys(this.idToPlugin).length}addPlugins(X){this.mapPlugins(X),this.indexPlugins()}enablePlugin(X){let W=this.idToPlugin[X];if(W)W.disabled=!1;this.indexPlugins()}disablePlugin(X){let W=this.idToPlugin[X];if(W)W.disabled=!0;this.indexPlugins()}removePlugin(X){delete this.idToPlugin[X],this.indexPlugins()}runTransformLogLevel(X,W){let Y=null;for(let Z of this.transformLogLevel){let G=this.idToPlugin[Z];if(G.transformLogLevel){let K=G.transformLogLevel({data:X.data,logLevel:X.logLevel,messages:X.messages,error:X.error,metadata:X.metadata,context:X.context},W);if(K!==null&&K!==void 0&&K!==!1)Y=K}}return Y!==null&&Y!==void 0&&Y!==!1?Y:X.logLevel}runOnBeforeDataOut(X,W){let Y={...X};for(let Z of this.onBeforeDataOut){let G=this.idToPlugin[Z];if(G.onBeforeDataOut){let K=G.onBeforeDataOut({data:Y.data,logLevel:Y.logLevel,error:Y.error,metadata:Y.metadata,context:Y.context},W);if(K){if(!Y.data)Y.data={};Object.assign(Y.data,K)}}}return Y.data}runShouldSendToLogger(X,W){return!this.shouldSendToLogger.some((Y)=>{return!this.idToPlugin[Y].shouldSendToLogger?.(X,W)})}runOnMetadataCalled(X,W){let Y={...X};for(let Z of this.onMetadataCalled){let G=this.idToPlugin[Z].onMetadataCalled?.(Y,W);if(G)Y=G;else return null}return Y}runOnBeforeMessageOut(X,W){let Y=[...X.messages];for(let Z of this.onBeforeMessageOut){let G=this.idToPlugin[Z].onBeforeMessageOut?.({messages:Y,logLevel:X.logLevel},W);if(G)Y=G}return Y}runOnContextCalled(X,W){let Y={...X};for(let Z of this.onContextCalled){let G=this.idToPlugin[Z].onContextCalled?.(Y,W);if(G)Y=G;else return null}return Y}},A1=class X{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_config;constructor(W){if(this._config={...W,enabled:W.enabled??!0},this.contextManager=new _1,this.logLevelManager=new j1,!this._config.enabled)this.disableLogging();if(this.pluginManager=new w1([...W.plugins||[],...x.pluginsToInit]),!this._config.errorFieldName)this._config.errorFieldName="err";if(!this._config.copyMsgOnOnlyError)this._config.copyMsgOnOnlyError=!1;if(this._initializeTransports(this._config.transport),x.logLayerHandlers.length>0)x.logLayerHandlers.forEach((Y)=>{if(Y.onConstruct)Y.onConstruct(this,W)})}withContextManager(W){if(this.contextManager&&typeof this.contextManager[Symbol.dispose]==="function")this.contextManager[Symbol.dispose]();return this.contextManager=W,this}getContextManager(){return this.contextManager}withLogLevelManager(W){if(this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==="function")this.logLevelManager[Symbol.dispose]();return this.logLevelManager=W,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(W){if(this.idToTransport){for(let Y in this.idToTransport)if(this.idToTransport[Y]&&typeof this.idToTransport[Y][Symbol.dispose]==="function")this.idToTransport[Y][Symbol.dispose]()}if(this.hasMultipleTransports=Array.isArray(W)&&W.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(W)?W[0]:W,Array.isArray(W))this.idToTransport=W.reduce((Y,Z)=>{return Y[Z.id]=Z,Y},{});else this.idToTransport={[W.id]:W}}withPrefix(W){let Y=this.child();return Y._config.prefix=W,Y}withContext(W){let Y=W;if(!W){if(this._config.consoleDebug)console.debug("[LogLayer] withContext was called with no context; dropping.");return this}if(this.pluginManager.hasPlugins(F.onContextCalled)){if(Y=this.pluginManager.runOnContextCalled(W,this),!Y){if(this._config.consoleDebug)console.debug("[LogLayer] Context was dropped due to plugin returning falsy value.");return this}}return this.contextManager.appendContext(Y),this}clearContext(W){return this.contextManager.clearContext(W),this}getContext(){return this.contextManager.getContext()}addPlugins(W){this.pluginManager.addPlugins(W)}enablePlugin(W){this.pluginManager.enablePlugin(W)}disablePlugin(W){this.pluginManager.disablePlugin(W)}removePlugin(W){this.pluginManager.removePlugin(W)}withMetadata(W){return new I1(this).withMetadata(W)}withError(W){return new I1(this).withError(W)}child(){let W=new X({...this._config,transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport}).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone()).withLogLevelManager(this.logLevelManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:W.contextManager,parentLogger:this,childLogger:W}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:W.logLevelManager,parentLogger:this,childLogger:W}),W}withFreshTransports(W){return this._config.transport=W,this._initializeTransports(W),this}addTransport(W){let Y=Array.isArray(W)?W:[W],Z=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],G=new Set(Y.map((z)=>z.id));for(let z of Y){let H=this.idToTransport[z.id];if(H&&typeof H[Symbol.dispose]==="function")H[Symbol.dispose]()}let K=[...Z.filter((z)=>!G.has(z.id)),...Y];this._config.transport=K;for(let z of Y)this.idToTransport[z.id]=z;return this.hasMultipleTransports=K.length>1,this.singleTransport=this.hasMultipleTransports?null:K[0],this}removeTransport(W){let Y=this.idToTransport[W];if(!Y)return!1;if(typeof Y[Symbol.dispose]==="function")Y[Symbol.dispose]();delete this.idToTransport[W];let Z=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter((G)=>G.id!==W);return this._config.transport=Z.length===1?Z[0]:Z,this.hasMultipleTransports=Z.length>1,this.singleTransport=this.hasMultipleTransports?null:Z[0]||null,!0}withFreshPlugins(W){return this._config.plugins=W,this.pluginManager=new w1(W),this}withPluginManager(W){return this.pluginManager=W,this}errorOnly(W,Y){let Z=Y?.logLevel||_.error;if(!this.isLevelEnabled(Z))return;let{copyMsgOnOnlyError:G}=this._config,K={logLevel:Z,err:W};if((G&&Y?.copyMsg!==!1||Y?.copyMsg===!0)&&W?.message)K.params=[W.message];this._formatLog(K)}metadataOnly(W,Y=_.info){if(!this.isLevelEnabled(Y))return;let{muteMetadata:Z,consoleDebug:G}=this._config;if(Z)return;if(!W){if(G)console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let K=W;if(this.pluginManager.hasPlugins(F.onMetadataCalled)){if(K=this.pluginManager.runOnMetadataCalled(W,this),!K){if(G)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}}let z={logLevel:Y,metadata:K};this._formatLog(z)}info(...W){if(!this.isLevelEnabled(_.info))return;this._formatMessage(W),this._formatLog({logLevel:_.info,params:W})}warn(...W){if(!this.isLevelEnabled(_.warn))return;this._formatMessage(W),this._formatLog({logLevel:_.warn,params:W})}error(...W){if(!this.isLevelEnabled(_.error))return;this._formatMessage(W),this._formatLog({logLevel:_.error,params:W})}debug(...W){if(!this.isLevelEnabled(_.debug))return;this._formatMessage(W),this._formatLog({logLevel:_.debug,params:W})}trace(...W){if(!this.isLevelEnabled(_.trace))return;this._formatMessage(W),this._formatLog({logLevel:_.trace,params:W})}fatal(...W){if(!this.isLevelEnabled(_.fatal))return;this._formatMessage(W),this._formatLog({logLevel:_.fatal,params:W})}raw(W){if(!this.isLevelEnabled(W.logLevel))return;let Y={logLevel:W.logLevel,params:W.messages,metadata:W.metadata,err:W.error,context:W.context};this._formatMessage(W.messages),this._formatLog(Y)}disableLogging(){return this.logLevelManager.disableLogging(),this}enableLogging(){return this.logLevelManager.enableLogging(),this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(W){return this.logLevelManager.enableIndividualLevel(W),this}disableIndividualLevel(W){return this.logLevelManager.disableIndividualLevel(W),this}setLevel(W){return this.logLevelManager.setLevel(W),this}isLevelEnabled(W){return this.logLevelManager.isLevelEnabled(W)}formatContext(W){let{contextFieldName:Y,muteContext:Z}=this._config;if(W&&Object.keys(W).length>0&&!Z){if(Y)return{[Y]:{...W}};return{...W}}return{}}formatMetadata(W=null){let{metadataFieldName:Y,muteMetadata:Z}=this._config;if(W&&!Z){if(Y)return{[Y]:{...W}};return{...W}}return{}}getLoggerInstance(W){let Y=this.idToTransport[W];if(!Y)return;return Y.getLoggerInstance()}_formatMessage(W=[]){let{prefix:Y}=this._config;if(Y&&typeof W[0]==="string")W[0]=`${Y} ${W[0]}`}_formatLog({logLevel:W,params:Y=[],metadata:Z=null,err:G,context:K=null}){let{errorSerializer:z,errorFieldInMetadata:H,muteContext:J,contextFieldName:V,metadataFieldName:Q,errorFieldName:j}=this._config,B=K!==null?K:this.contextManager.getContext(),q=!!Z||(J?!1:K!==null?Object.keys(K).length>0:this.contextManager.hasContextData()),U={};if(q)if(V&&V===Q){let w=this.formatContext(B)[V],S=this.formatMetadata(Z)[Q];U={[V]:{...w,...S}}}else U={...this.formatContext(B),...this.formatMetadata(Z)};if(G){let w=z?z(G):G;if(H&&Z&&Q)if(U?.[Q])U[Q][j]=w;else U={...U,[Q]:{[j]:w}};else if(H&&!Z&&Q)U={...U,[Q]:{[j]:w}};else U={...U,[j]:w};q=!0}if(this.pluginManager.hasPlugins(F.onBeforeDataOut)){if(U=this.pluginManager.runOnBeforeDataOut({data:q?U:void 0,logLevel:W,error:G,metadata:Z,context:B},this),U&&!q)q=!0}if(this.pluginManager.hasPlugins(F.onBeforeMessageOut))Y=this.pluginManager.runOnBeforeMessageOut({messages:[...Y],logLevel:W},this);if(this.pluginManager.hasPlugins(F.transformLogLevel))W=this.pluginManager.runTransformLogLevel({data:q?U:void 0,logLevel:W,messages:[...Y],error:G,metadata:Z,context:B},this);if(this.hasMultipleTransports){let w=this._config.transport.filter((S)=>S.enabled).map(async(S)=>{let s=W;if(this.pluginManager.hasPlugins(F.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...Y],data:q?U:void 0,logLevel:s,transportId:S.id,error:G,metadata:Z,context:B},this))return}return S._sendToLogger({logLevel:s,messages:[...Y],data:q?U:void 0,hasData:q,error:G,metadata:Z,context:B})});Promise.all(w).catch((S)=>{if(this._config.consoleDebug)console.error("[LogLayer] Error executing transports:",S)})}else{if(!this.singleTransport?.enabled)return;if(this.pluginManager.hasPlugins(F.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...Y],data:q?U:void 0,logLevel:W,transportId:this.singleTransport.id,error:G,metadata:Z,context:B},this))return}this.singleTransport._sendToLogger({logLevel:W,messages:[...Y],data:q?U:void 0,hasData:q,error:G,metadata:Z,context:B})}}},F1=class{debug(...X){}error(...X){}info(...X){}trace(...X){}warn(...X){}fatal(...X){}enableLogging(){return this}disableLogging(){return this}withMetadata(X){return this}withError(X){return this}},MY=class{mockLogBuilder=new F1;mockContextManager=new q1;mockLogLevelManager=new U1;info(...X){}warn(...X){}error(...X){}debug(...X){}trace(...X){}fatal(...X){}raw(X){}getLoggerInstance(X){}errorOnly(X,W){}metadataOnly(X,W){}addPlugins(X){}removePlugin(X){}enablePlugin(X){}disablePlugin(X){}withPrefix(X){return this}withContext(X){return this}withError(X){return this.mockLogBuilder.withError(X)}withMetadata(X){return this.mockLogBuilder.withMetadata(X)}getContext(){return{}}clearContext(X){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(X){return this}addTransport(X){return this}removeTransport(X){return!0}withFreshPlugins(X){return this}withContextManager(X){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(X){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(X){this.mockLogBuilder=X}enableIndividualLevel(X){return this}disableIndividualLevel(X){return this}setLevel(X){return this}isLevelEnabled(X){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new F1}};var x={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var I1=class{err;metadata;structuredLogger;hasMetadata;pluginManager;constructor(X){if(this.err=null,this.metadata={},this.structuredLogger=X,this.hasMetadata=!1,this.pluginManager=X.pluginManager,x.logBuilderHandlers.length>0)x.logBuilderHandlers.forEach((W)=>{if(W.onConstruct)W.onConstruct(this,X)})}withMetadata(X){let{pluginManager:W,structuredLogger:{_config:{consoleDebug:Y}}}=this;if(!X){if(Y)console.debug("[LogLayer] withMetadata was called with no metadata; dropping.");return this}let Z=X;if(W.hasPlugins(F.onMetadataCalled)){if(Z=W.runOnMetadataCalled(X,this.structuredLogger),!Z){if(Y)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return this}}return this.metadata={...this.metadata,...Z},this.hasMetadata=!0,this}withError(X){return this.err=X,this}info(...X){if(!this.structuredLogger.isLevelEnabled(_.info))return;this.structuredLogger._formatMessage(X),this.formatLog(_.info,X)}warn(...X){if(!this.structuredLogger.isLevelEnabled(_.warn))return;this.structuredLogger._formatMessage(X),this.formatLog(_.warn,X)}error(...X){if(!this.structuredLogger.isLevelEnabled(_.error))return;this.structuredLogger._formatMessage(X),this.formatLog(_.error,X)}debug(...X){if(!this.structuredLogger.isLevelEnabled(_.debug))return;this.structuredLogger._formatMessage(X),this.formatLog(_.debug,X)}trace(...X){if(!this.structuredLogger.isLevelEnabled(_.trace))return;this.structuredLogger._formatMessage(X),this.formatLog(_.trace,X)}fatal(...X){if(!this.structuredLogger.isLevelEnabled(_.fatal))return;this.structuredLogger._formatMessage(X),this.formatLog(_.fatal,X)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(X,W){let{muteMetadata:Y}=this.structuredLogger._config,Z=Y?!1:this.hasMetadata;this.structuredLogger._formatLog({logLevel:X,params:W,metadata:Z?this.metadata:null,err:this.err})}};function LW(){return new A1({transport:{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}})}function M(X){return X??LW()}import{URI as FY}from"langium";import{Result as l,Err as f,Ok as r}from"@kumori/kdsl-lsp/util/result.js";async function k0(X){let W=M(X.logger),{NewModule:Y}=await Promise.resolve().then(() => (R1(),$1));try{let Z=X.cwd??process.cwd();return await Y(W,Z,X.name,X.version,X.location,X.cacheLocation),r(void 0)}catch(Z){return f([String(Z)])}}async function f0(X){let W=M(X.logger),Y=FY.file(X.cwd??process.cwd()),{Dependency:Z}=await Promise.resolve().then(() => (a1(),t1)),{RegistryManager:G}=await import("@kumori/kdsl-lsp/module/registry/manager.js");await new G(X.configPath).ensureIndexes();try{return await Z(W,Y,X.module,{alias:X.alias,headers:X.headers,remove:X.remove?!0:void 0,download:X.download?!0:void 0},X.configPath),r(void 0)}catch(z){return f([String(z)])}}async function h0(X){let W=M(X.logger),{Download:Y}=await Promise.resolve().then(() => (g(),g1)),{RegistryManager:Z}=await import("@kumori/kdsl-lsp/module/registry/manager.js");return await new Z(X.configPath).ensureIndexes(),await Y(W,X.services,X.cwd??process.cwd(),X.modules??[],{quiet:X.quiet?!0:void 0},X.configPath)}async function x0(X){let W=M(X.logger),{NewModule:Y}=await Promise.resolve().then(() => (zW(),GW));try{return await Y(W,X.cwd??process.cwd(),{version:X.version,cacheLocation:X.cacheLocation,path:X.path}),r(void 0)}catch(Z){return f([String(Z)])}}async function y0(X){let{CalculateChecksum:W}=await import("@kumori/kdsl-lsp/module/integrity/checksum.js"),{ModuleContext:Y}=await import("@kumori/kdsl-lsp/module/context.js"),{URI:Z}=await import("langium"),G=await import("node:path"),K=X.services.shared.workspace.FileSystemProvider,z=X.directory??X.cwd??".",H=await Y(K,Z.file(G.resolve(z)),X.configPath);if(l.isErr(H))return f([H.err]);try{let J=await W(H.value.Current.Root.fsPath);return r(J)}catch(J){return f([String(J)])}}async function v0(X){let W=M(X.logger),{LocateModule:Y,GetSchema:Z}=await Promise.resolve().then(() => (RW(),$W)),{ModuleContext:G}=await import("@kumori/kdsl-lsp/module/context.js"),{Check:K}=await Promise.resolve().then(() => (H1(),qW)),{URI:z}=await import("langium"),H=X.services,J=H.shared.workspace.FileSystemProvider,V=await Y(X.target,X.configPath);if(l.isErr(V))return V;let Q=await G(J,z.file(V.value.fsPath),X.configPath);if(l.isErr(Q))return f([Q.err]);let j=await K(W,H,Q.value);if(l.isErr(j))return j;return await Z(H,Q.value,X.packagePath,X.artifactName)}export{x0 as moduleUpdate,v0 as moduleSchemaGet,k0 as moduleInit,h0 as moduleDownload,f0 as moduleDependency,y0 as moduleChecksum};
|
package/dist/lib/registry.js
CHANGED
|
@@ -1,67 +1 @@
|
|
|
1
|
-
import { getLogger } from "./logger.js";
|
|
2
|
-
import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
|
|
3
|
-
import { Ok, Err } from "@kumori/kdsl-lsp/util/result.js";
|
|
4
|
-
/**
|
|
5
|
-
* Add a registry to the resolver configuration.
|
|
6
|
-
*
|
|
7
|
-
* The selector argument is used to match artifacts. For example, a registry
|
|
8
|
-
* with Index URL "https://github.com/kumori" and selector "kumori.systems"
|
|
9
|
-
* will resolve dependencies starting with "kumori.systems".
|
|
10
|
-
*
|
|
11
|
-
* @param options - Registry add options
|
|
12
|
-
* @returns Result with void on success, or string[] of errors
|
|
13
|
-
*/
|
|
14
|
-
export async function registryAdd(options) {
|
|
15
|
-
const log = getLogger(options.logger);
|
|
16
|
-
const manager = new RegistryManager(options.configPath);
|
|
17
|
-
const registry = {
|
|
18
|
-
selector: options.selector,
|
|
19
|
-
repoUrl: options.url,
|
|
20
|
-
token: options.token,
|
|
21
|
-
};
|
|
22
|
-
try {
|
|
23
|
-
await manager.add(registry);
|
|
24
|
-
log.info(`Registry '${options.selector}' added at ${options.url}`);
|
|
25
|
-
return Ok(undefined);
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
return Err([`Failed to add registry: ${err}`]);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* List all configured registries.
|
|
33
|
-
*
|
|
34
|
-
* @param options - Registry list options
|
|
35
|
-
* @returns Result with array of registry objects on success, or string[] of errors
|
|
36
|
-
*/
|
|
37
|
-
export async function registryList(options) {
|
|
38
|
-
const log = getLogger(options.logger);
|
|
39
|
-
const manager = new RegistryManager(options.configPath);
|
|
40
|
-
try {
|
|
41
|
-
const registries = manager.list();
|
|
42
|
-
log.info("Configured Registries:");
|
|
43
|
-
return Ok(registries);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
return Err([`Failed to list registries: ${err}`]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Remove a configured registry by name.
|
|
51
|
-
*
|
|
52
|
-
* @param options - Registry remove options
|
|
53
|
-
* @returns Result with void on success, or string[] of errors
|
|
54
|
-
*/
|
|
55
|
-
export async function registryRemove(options) {
|
|
56
|
-
const log = getLogger(options.logger);
|
|
57
|
-
const manager = new RegistryManager(options.configPath);
|
|
58
|
-
try {
|
|
59
|
-
manager.remove(options.name);
|
|
60
|
-
log.info(`Registry '${options.name}' removed`);
|
|
61
|
-
return Ok(undefined);
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
return Err([`Failed to remove registry: ${err}`]);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=registry.js.map
|
|
1
|
+
import{createRequire as v}from"node:module";var x=Object.create;var{getPrototypeOf:y,defineProperty:A,getOwnPropertyNames:u}=Object;var c=Object.prototype.hasOwnProperty;var n=(H,q,J)=>{J=H!=null?x(y(H)):{};let Q=q||!H||!H.__esModule?A(J,"default",{value:H,enumerable:!0}):J;for(let W of u(H))if(!c.call(Q,W))A(Q,W,{get:()=>H[W],enumerable:!0});return Q};var g=(H,q)=>()=>(q||H((q={exports:{}}).exports,q),q.exports);var o=(H,q)=>{for(var J in q)A(H,J,{get:q[J],enumerable:!0,configurable:!0,set:(Q)=>q[J]=()=>Q})};var l=(H,q)=>()=>(H&&(q=H(H=0)),q);var t=v(import.meta.url),d=Symbol.dispose||Symbol.for("Symbol.dispose"),L=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),s=(H,q,J)=>{if(q!=null){if(typeof q!=="object"&&typeof q!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var Q;if(J)Q=q[L];if(Q===void 0)Q=q[d];if(typeof Q!=="function")throw TypeError("Object not disposable");H.push([J,Q,q])}else if(J)H.push([J]);return q},a=(H,q,J)=>{var Q=typeof SuppressedError==="function"?SuppressedError:function(Z,V,R,w){return w=Error(R),w.name="SuppressedError",w.error=Z,w.suppressed=V,w},W=(Z)=>q=J?new Q(Z,q,"An error was suppressed during disposal"):(J=!0,Z),Y=(Z)=>{while(Z=H.pop())try{var V=Z[1]&&Z[1].call(Z[2]);if(Z[0])return Promise.resolve(V).then(Y,(R)=>(W(R),Y()))}catch(R){W(R)}if(J)throw q};return Y()};var X=function(H){return H.info="info",H.warn="warn",H.error="error",H.debug="debug",H.trace="trace",H.fatal="fatal",H}({}),F={[X.trace]:10,[X.debug]:20,[X.info]:30,[X.warn]:40,[X.error]:50,[X.fatal]:60},p={10:X.trace,20:X.debug,30:X.info,40:X.warn,50:X.error,60:X.fatal};var K=function(H){return H.transformLogLevel="transformLogLevel",H.onBeforeDataOut="onBeforeDataOut",H.shouldSendToLogger="shouldSendToLogger",H.onMetadataCalled="onMetadataCalled",H.onBeforeMessageOut="onBeforeMessageOut",H.onContextCalled="onContextCalled",H}({});var h=class H{context={};hasContext=!1;setContext(q){if(!q){this.context={},this.hasContext=!1;return}this.context=q,this.hasContext=!0}appendContext(q){this.context={...this.context,...q},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(q){if(q===void 0){this.context={},this.hasContext=!1;return}let J=Array.isArray(q)?q:[q];for(let Q of J)delete this.context[Q];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:q,childContextManager:J}){if(q.hasContextData()){let Q=q.getContext();J.setContext({...Q})}}clone(){let q=new H;return q.setContext({...this.context}),q.hasContext=this.hasContext,q}},D=class H{setContext(q){}appendContext(q){}getContext(){return{}}hasContextData(){return!1}clearContext(q){}onChildLoggerCreated(q){}clone(){return new H}};var C=class H{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(q){let J=F[q];for(let Q of Object.values(X)){let W=Q,Y=F[Q];this.logLevelEnabledStatus[W]=Y>=J}}enableIndividualLevel(q){let J=q;if(J in this.logLevelEnabledStatus)this.logLevelEnabledStatus[J]=!0}disableIndividualLevel(q){let J=q;if(J in this.logLevelEnabledStatus)this.logLevelEnabledStatus[J]=!1}isLevelEnabled(q){let J=q;return this.logLevelEnabledStatus[J]}enableLogging(){for(let q of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[q]=!0}disableLogging(){for(let q of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[q]=!1}onChildLoggerCreated({parentLogLevelManager:q,childLogLevelManager:J}){let Q=q.logLevelEnabledStatus;if(J instanceof H)J.logLevelEnabledStatus={...Q}}clone(){let q=new H;return q.logLevelEnabledStatus={...this.logLevelEnabledStatus},q}},b=class H{setLevel(q){}enableIndividualLevel(q){}disableIndividualLevel(q){}isLevelEnabled(q){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(q){}clone(){return new H}};var m=[K.onBeforeDataOut,K.onMetadataCalled,K.onBeforeMessageOut,K.transformLogLevel,K.shouldSendToLogger,K.onContextCalled],M=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(H){this.idToPlugin={},this.mapPlugins(H),this.indexPlugins()}mapPlugins(H){for(let q of H){if(!q.id)q.id=Date.now().toString()+Math.random().toString();if(this.idToPlugin[q.id])throw Error(`[LogLayer] Plugin with id ${q.id} already exists.`);q.registeredAt=Date.now(),this.idToPlugin[q.id]=q}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let H=Object.values(this.idToPlugin).sort((q,J)=>q.registeredAt-J.registeredAt);for(let q of H){if(q.disabled)return;for(let J of m)if(q[J]&&q.id)this[J].push(q.id)}}hasPlugins(H){return this[H].length>0}countPlugins(H){if(H)return this[H].length;return Object.keys(this.idToPlugin).length}addPlugins(H){this.mapPlugins(H),this.indexPlugins()}enablePlugin(H){let q=this.idToPlugin[H];if(q)q.disabled=!1;this.indexPlugins()}disablePlugin(H){let q=this.idToPlugin[H];if(q)q.disabled=!0;this.indexPlugins()}removePlugin(H){delete this.idToPlugin[H],this.indexPlugins()}runTransformLogLevel(H,q){let J=null;for(let Q of this.transformLogLevel){let W=this.idToPlugin[Q];if(W.transformLogLevel){let Y=W.transformLogLevel({data:H.data,logLevel:H.logLevel,messages:H.messages,error:H.error,metadata:H.metadata,context:H.context},q);if(Y!==null&&Y!==void 0&&Y!==!1)J=Y}}return J!==null&&J!==void 0&&J!==!1?J:H.logLevel}runOnBeforeDataOut(H,q){let J={...H};for(let Q of this.onBeforeDataOut){let W=this.idToPlugin[Q];if(W.onBeforeDataOut){let Y=W.onBeforeDataOut({data:J.data,logLevel:J.logLevel,error:J.error,metadata:J.metadata,context:J.context},q);if(Y){if(!J.data)J.data={};Object.assign(J.data,Y)}}}return J.data}runShouldSendToLogger(H,q){return!this.shouldSendToLogger.some((J)=>{return!this.idToPlugin[J].shouldSendToLogger?.(H,q)})}runOnMetadataCalled(H,q){let J={...H};for(let Q of this.onMetadataCalled){let W=this.idToPlugin[Q].onMetadataCalled?.(J,q);if(W)J=W;else return null}return J}runOnBeforeMessageOut(H,q){let J=[...H.messages];for(let Q of this.onBeforeMessageOut){let W=this.idToPlugin[Q].onBeforeMessageOut?.({messages:J,logLevel:H.logLevel},q);if(W)J=W}return J}runOnContextCalled(H,q){let J={...H};for(let Q of this.onContextCalled){let W=this.idToPlugin[Q].onContextCalled?.(J,q);if(W)J=W;else return null}return J}},$=class H{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_config;constructor(q){if(this._config={...q,enabled:q.enabled??!0},this.contextManager=new h,this.logLevelManager=new C,!this._config.enabled)this.disableLogging();if(this.pluginManager=new M([...q.plugins||[],...B.pluginsToInit]),!this._config.errorFieldName)this._config.errorFieldName="err";if(!this._config.copyMsgOnOnlyError)this._config.copyMsgOnOnlyError=!1;if(this._initializeTransports(this._config.transport),B.logLayerHandlers.length>0)B.logLayerHandlers.forEach((J)=>{if(J.onConstruct)J.onConstruct(this,q)})}withContextManager(q){if(this.contextManager&&typeof this.contextManager[Symbol.dispose]==="function")this.contextManager[Symbol.dispose]();return this.contextManager=q,this}getContextManager(){return this.contextManager}withLogLevelManager(q){if(this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==="function")this.logLevelManager[Symbol.dispose]();return this.logLevelManager=q,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(q){if(this.idToTransport){for(let J in this.idToTransport)if(this.idToTransport[J]&&typeof this.idToTransport[J][Symbol.dispose]==="function")this.idToTransport[J][Symbol.dispose]()}if(this.hasMultipleTransports=Array.isArray(q)&&q.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(q)?q[0]:q,Array.isArray(q))this.idToTransport=q.reduce((J,Q)=>{return J[Q.id]=Q,J},{});else this.idToTransport={[q.id]:q}}withPrefix(q){let J=this.child();return J._config.prefix=q,J}withContext(q){let J=q;if(!q){if(this._config.consoleDebug)console.debug("[LogLayer] withContext was called with no context; dropping.");return this}if(this.pluginManager.hasPlugins(K.onContextCalled)){if(J=this.pluginManager.runOnContextCalled(q,this),!J){if(this._config.consoleDebug)console.debug("[LogLayer] Context was dropped due to plugin returning falsy value.");return this}}return this.contextManager.appendContext(J),this}clearContext(q){return this.contextManager.clearContext(q),this}getContext(){return this.contextManager.getContext()}addPlugins(q){this.pluginManager.addPlugins(q)}enablePlugin(q){this.pluginManager.enablePlugin(q)}disablePlugin(q){this.pluginManager.disablePlugin(q)}removePlugin(q){this.pluginManager.removePlugin(q)}withMetadata(q){return new T(this).withMetadata(q)}withError(q){return new T(this).withError(q)}child(){let q=new H({...this._config,transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport}).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone()).withLogLevelManager(this.logLevelManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:q.contextManager,parentLogger:this,childLogger:q}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:q.logLevelManager,parentLogger:this,childLogger:q}),q}withFreshTransports(q){return this._config.transport=q,this._initializeTransports(q),this}addTransport(q){let J=Array.isArray(q)?q:[q],Q=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],W=new Set(J.map((Z)=>Z.id));for(let Z of J){let V=this.idToTransport[Z.id];if(V&&typeof V[Symbol.dispose]==="function")V[Symbol.dispose]()}let Y=[...Q.filter((Z)=>!W.has(Z.id)),...J];this._config.transport=Y;for(let Z of J)this.idToTransport[Z.id]=Z;return this.hasMultipleTransports=Y.length>1,this.singleTransport=this.hasMultipleTransports?null:Y[0],this}removeTransport(q){let J=this.idToTransport[q];if(!J)return!1;if(typeof J[Symbol.dispose]==="function")J[Symbol.dispose]();delete this.idToTransport[q];let Q=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter((W)=>W.id!==q);return this._config.transport=Q.length===1?Q[0]:Q,this.hasMultipleTransports=Q.length>1,this.singleTransport=this.hasMultipleTransports?null:Q[0]||null,!0}withFreshPlugins(q){return this._config.plugins=q,this.pluginManager=new M(q),this}withPluginManager(q){return this.pluginManager=q,this}errorOnly(q,J){let Q=J?.logLevel||X.error;if(!this.isLevelEnabled(Q))return;let{copyMsgOnOnlyError:W}=this._config,Y={logLevel:Q,err:q};if((W&&J?.copyMsg!==!1||J?.copyMsg===!0)&&q?.message)Y.params=[q.message];this._formatLog(Y)}metadataOnly(q,J=X.info){if(!this.isLevelEnabled(J))return;let{muteMetadata:Q,consoleDebug:W}=this._config;if(Q)return;if(!q){if(W)console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let Y=q;if(this.pluginManager.hasPlugins(K.onMetadataCalled)){if(Y=this.pluginManager.runOnMetadataCalled(q,this),!Y){if(W)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}}let Z={logLevel:J,metadata:Y};this._formatLog(Z)}info(...q){if(!this.isLevelEnabled(X.info))return;this._formatMessage(q),this._formatLog({logLevel:X.info,params:q})}warn(...q){if(!this.isLevelEnabled(X.warn))return;this._formatMessage(q),this._formatLog({logLevel:X.warn,params:q})}error(...q){if(!this.isLevelEnabled(X.error))return;this._formatMessage(q),this._formatLog({logLevel:X.error,params:q})}debug(...q){if(!this.isLevelEnabled(X.debug))return;this._formatMessage(q),this._formatLog({logLevel:X.debug,params:q})}trace(...q){if(!this.isLevelEnabled(X.trace))return;this._formatMessage(q),this._formatLog({logLevel:X.trace,params:q})}fatal(...q){if(!this.isLevelEnabled(X.fatal))return;this._formatMessage(q),this._formatLog({logLevel:X.fatal,params:q})}raw(q){if(!this.isLevelEnabled(q.logLevel))return;let J={logLevel:q.logLevel,params:q.messages,metadata:q.metadata,err:q.error,context:q.context};this._formatMessage(q.messages),this._formatLog(J)}disableLogging(){return this.logLevelManager.disableLogging(),this}enableLogging(){return this.logLevelManager.enableLogging(),this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(q){return this.logLevelManager.enableIndividualLevel(q),this}disableIndividualLevel(q){return this.logLevelManager.disableIndividualLevel(q),this}setLevel(q){return this.logLevelManager.setLevel(q),this}isLevelEnabled(q){return this.logLevelManager.isLevelEnabled(q)}formatContext(q){let{contextFieldName:J,muteContext:Q}=this._config;if(q&&Object.keys(q).length>0&&!Q){if(J)return{[J]:{...q}};return{...q}}return{}}formatMetadata(q=null){let{metadataFieldName:J,muteMetadata:Q}=this._config;if(q&&!Q){if(J)return{[J]:{...q}};return{...q}}return{}}getLoggerInstance(q){let J=this.idToTransport[q];if(!J)return;return J.getLoggerInstance()}_formatMessage(q=[]){let{prefix:J}=this._config;if(J&&typeof q[0]==="string")q[0]=`${J} ${q[0]}`}_formatLog({logLevel:q,params:J=[],metadata:Q=null,err:W,context:Y=null}){let{errorSerializer:Z,errorFieldInMetadata:V,muteContext:R,contextFieldName:w,metadataFieldName:z,errorFieldName:j}=this._config,S=Y!==null?Y:this.contextManager.getContext(),U=!!Q||(R?!1:Y!==null?Object.keys(Y).length>0:this.contextManager.hasContextData()),G={};if(U)if(w&&w===z){let _=this.formatContext(S)[w],I=this.formatMetadata(Q)[z];G={[w]:{..._,...I}}}else G={...this.formatContext(S),...this.formatMetadata(Q)};if(W){let _=Z?Z(W):W;if(V&&Q&&z)if(G?.[z])G[z][j]=_;else G={...G,[z]:{[j]:_}};else if(V&&!Q&&z)G={...G,[z]:{[j]:_}};else G={...G,[j]:_};U=!0}if(this.pluginManager.hasPlugins(K.onBeforeDataOut)){if(G=this.pluginManager.runOnBeforeDataOut({data:U?G:void 0,logLevel:q,error:W,metadata:Q,context:S},this),G&&!U)U=!0}if(this.pluginManager.hasPlugins(K.onBeforeMessageOut))J=this.pluginManager.runOnBeforeMessageOut({messages:[...J],logLevel:q},this);if(this.pluginManager.hasPlugins(K.transformLogLevel))q=this.pluginManager.runTransformLogLevel({data:U?G:void 0,logLevel:q,messages:[...J],error:W,metadata:Q,context:S},this);if(this.hasMultipleTransports){let _=this._config.transport.filter((I)=>I.enabled).map(async(I)=>{let f=q;if(this.pluginManager.hasPlugins(K.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...J],data:U?G:void 0,logLevel:f,transportId:I.id,error:W,metadata:Q,context:S},this))return}return I._sendToLogger({logLevel:f,messages:[...J],data:U?G:void 0,hasData:U,error:W,metadata:Q,context:S})});Promise.all(_).catch((I)=>{if(this._config.consoleDebug)console.error("[LogLayer] Error executing transports:",I)})}else{if(!this.singleTransport?.enabled)return;if(this.pluginManager.hasPlugins(K.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...J],data:U?G:void 0,logLevel:q,transportId:this.singleTransport.id,error:W,metadata:Q,context:S},this))return}this.singleTransport._sendToLogger({logLevel:q,messages:[...J],data:U?G:void 0,hasData:U,error:W,metadata:Q,context:S})}}},k=class{debug(...H){}error(...H){}info(...H){}trace(...H){}warn(...H){}fatal(...H){}enableLogging(){return this}disableLogging(){return this}withMetadata(H){return this}withError(H){return this}},Kq=class{mockLogBuilder=new k;mockContextManager=new D;mockLogLevelManager=new b;info(...H){}warn(...H){}error(...H){}debug(...H){}trace(...H){}fatal(...H){}raw(H){}getLoggerInstance(H){}errorOnly(H,q){}metadataOnly(H,q){}addPlugins(H){}removePlugin(H){}enablePlugin(H){}disablePlugin(H){}withPrefix(H){return this}withContext(H){return this}withError(H){return this.mockLogBuilder.withError(H)}withMetadata(H){return this.mockLogBuilder.withMetadata(H)}getContext(){return{}}clearContext(H){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(H){return this}addTransport(H){return this}removeTransport(H){return!0}withFreshPlugins(H){return this}withContextManager(H){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(H){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(H){this.mockLogBuilder=H}enableIndividualLevel(H){return this}disableIndividualLevel(H){return this}setLevel(H){return this}isLevelEnabled(H){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new k}};var B={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var T=class{err;metadata;structuredLogger;hasMetadata;pluginManager;constructor(H){if(this.err=null,this.metadata={},this.structuredLogger=H,this.hasMetadata=!1,this.pluginManager=H.pluginManager,B.logBuilderHandlers.length>0)B.logBuilderHandlers.forEach((q)=>{if(q.onConstruct)q.onConstruct(this,H)})}withMetadata(H){let{pluginManager:q,structuredLogger:{_config:{consoleDebug:J}}}=this;if(!H){if(J)console.debug("[LogLayer] withMetadata was called with no metadata; dropping.");return this}let Q=H;if(q.hasPlugins(K.onMetadataCalled)){if(Q=q.runOnMetadataCalled(H,this.structuredLogger),!Q){if(J)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return this}}return this.metadata={...this.metadata,...Q},this.hasMetadata=!0,this}withError(H){return this.err=H,this}info(...H){if(!this.structuredLogger.isLevelEnabled(X.info))return;this.structuredLogger._formatMessage(H),this.formatLog(X.info,H)}warn(...H){if(!this.structuredLogger.isLevelEnabled(X.warn))return;this.structuredLogger._formatMessage(H),this.formatLog(X.warn,H)}error(...H){if(!this.structuredLogger.isLevelEnabled(X.error))return;this.structuredLogger._formatMessage(H),this.formatLog(X.error,H)}debug(...H){if(!this.structuredLogger.isLevelEnabled(X.debug))return;this.structuredLogger._formatMessage(H),this.formatLog(X.debug,H)}trace(...H){if(!this.structuredLogger.isLevelEnabled(X.trace))return;this.structuredLogger._formatMessage(H),this.formatLog(X.trace,H)}fatal(...H){if(!this.structuredLogger.isLevelEnabled(X.fatal))return;this.structuredLogger._formatMessage(H),this.formatLog(X.fatal,H)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(H,q){let{muteMetadata:J}=this.structuredLogger._config,Q=J?!1:this.hasMetadata;this.structuredLogger._formatLog({logLevel:H,params:q,metadata:Q?this.metadata:null,err:this.err})}};function i(){return new $({transport:{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}})}function N(H){return H??i()}import{RegistryManager as E}from"@kumori/kdsl-lsp/module/registry/manager.js";import{Ok as O,Err as P}from"@kumori/kdsl-lsp/util/result.js";async function Nq(H){let q=N(H.logger),J=new E(H.configPath),Q={selector:H.selector,repoUrl:H.url,token:H.token};try{return await J.add(Q),q.info(`Registry '${H.selector}' added at ${H.url}`),O(void 0)}catch(W){return P([`Failed to add registry: ${W}`])}}async function Aq(H){let q=N(H.logger),J=new E(H.configPath);try{let Q=J.list();return q.info("Configured Registries:"),O(Q)}catch(Q){return P([`Failed to list registries: ${Q}`])}}async function Eq(H){let q=N(H.logger),J=new E(H.configPath);try{return J.remove(H.name),q.info(`Registry '${H.name}' removed`),O(void 0)}catch(Q){return P([`Failed to remove registry: ${Q}`])}}export{Eq as registryRemove,Aq as registryList,Nq as registryAdd};
|
|
@@ -3,7 +3,6 @@ import { createKumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
|
3
3
|
import { NodeFileSystem } from "langium/node";
|
|
4
4
|
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
5
5
|
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
6
|
-
import { writeFile } from "fs/promises";
|
|
7
6
|
import { MOD_FILE } from "@kumori/kdsl-lsp/module/locator.js";
|
|
8
7
|
import { ParseQuery } from "@kumori/kdsl-lsp/module/query.js";
|
|
9
8
|
import { Download } from "../download/main.js";
|
|
@@ -105,7 +104,7 @@ export const Dependency = async (log, cwd, module, options, configPath) => {
|
|
|
105
104
|
throw new Error(`Dependency ${url} not found`);
|
|
106
105
|
}
|
|
107
106
|
manifest.requires.splice(idx, 1);
|
|
108
|
-
await
|
|
107
|
+
await Bun.write(UriUtils.joinPath(ctx.value.Current.Root, MOD_FILE).fsPath, JSON.stringify(manifest, undefined, 4));
|
|
109
108
|
log.info(`Removed dependency ${url.toString()}`);
|
|
110
109
|
return;
|
|
111
110
|
}
|
|
@@ -134,7 +133,7 @@ export const Dependency = async (log, cwd, module, options, configPath) => {
|
|
|
134
133
|
}
|
|
135
134
|
// Update the dependency version
|
|
136
135
|
dep.version = url.Version;
|
|
137
|
-
await
|
|
136
|
+
await Bun.write(UriUtils.joinPath(ctx.value.Current.Root, MOD_FILE).fsPath, JSON.stringify(manifest, undefined, 4));
|
|
138
137
|
log.info(`Updated dependency ${url.Location} to version ${url.Version}` +
|
|
139
138
|
(alias ? ` (alias: ${alias})` : "") +
|
|
140
139
|
(headers ? ` (headers: ${headers})` : ""));
|
|
@@ -156,7 +155,7 @@ export const Dependency = async (log, cwd, module, options, configPath) => {
|
|
|
156
155
|
: {}),
|
|
157
156
|
};
|
|
158
157
|
manifest.requires.push(depObj);
|
|
159
|
-
await
|
|
158
|
+
await Bun.write(UriUtils.joinPath(ctx.value.Current.Root, MOD_FILE).fsPath, JSON.stringify(manifest, undefined, 4));
|
|
160
159
|
if (options.download) {
|
|
161
160
|
const check = await Download(log, svcs, cwd.fsPath, [], { quiet: true }, configPath);
|
|
162
161
|
if (Result.isErr(check)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/mod/dependency/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/mod/dependency/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GA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EAAE;YAClC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACnC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,qBAAqB,CACxB,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -51,7 +51,6 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
51
51
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
52
|
});
|
|
53
53
|
import { Ajv } from "ajv";
|
|
54
|
-
import { readFile } from "node:fs/promises";
|
|
55
54
|
import { GetSchema, LocateModule } from "../get/main.js";
|
|
56
55
|
import { DefaultErrHandler } from "../../../util/err-handler.js";
|
|
57
56
|
import { createKumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
@@ -107,8 +106,7 @@ export function Action(log) {
|
|
|
107
106
|
const Schema = ErrHandler(await GetSchema(svcs, ctx, pkg, artifact));
|
|
108
107
|
// TODO: interactive user input instead of file
|
|
109
108
|
// Parse the given file as JSON
|
|
110
|
-
const
|
|
111
|
-
const Data = JSON.parse(rawData.toString("utf8"));
|
|
109
|
+
const Data = await Bun.file(data).json();
|
|
112
110
|
// Ajv is a library that will help us validate the incoming JSON file
|
|
113
111
|
// against the requested artifact's JSON Schema
|
|
114
112
|
const ajv = new Ajv({
|
|
@@ -156,7 +154,7 @@ export function Action(log) {
|
|
|
156
154
|
requires: [dependency],
|
|
157
155
|
};
|
|
158
156
|
const manifestFile = path.join(tmp.Path, MOD_FILE);
|
|
159
|
-
await
|
|
157
|
+
await Bun.write(manifestFile, JSON.stringify(manifest, null, 4));
|
|
160
158
|
// Write main.kumori
|
|
161
159
|
const imports = [
|
|
162
160
|
{ Alias: "ImportAlias0", Path: path.join(dependency.target, pkg) },
|
|
@@ -181,7 +179,7 @@ export function Action(log) {
|
|
|
181
179
|
]
|
|
182
180
|
.concat(deploymentParts)
|
|
183
181
|
.join("");
|
|
184
|
-
await
|
|
182
|
+
await Bun.write(path.join(tmp.Path, "main.kumori"), deploymentData);
|
|
185
183
|
await fs.cp(tmp.Path, ".", { recursive: true });
|
|
186
184
|
}
|
|
187
185
|
catch (e_1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/mod/jsonschema/gen/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/mod/jsonschema/gen/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAIzB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAKxD,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAA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p/util/maybe.js";
|
|
2
|
-
import { mkdir
|
|
2
|
+
import { mkdir } from "node:fs/promises";
|
|
3
3
|
import { URI } from "langium";
|
|
4
4
|
import { NodeFileSystem } from "langium/node";
|
|
5
5
|
import { LocateModuleManifest, MOD_FILE, } from "@kumori/kdsl-lsp/module/locator.js";
|
|
@@ -62,7 +62,7 @@ export const NewModule = async (log, cwd, options) => {
|
|
|
62
62
|
};
|
|
63
63
|
const file = path.join(location, MOD_FILE);
|
|
64
64
|
await mkdir(location, { recursive: true });
|
|
65
|
-
await
|
|
65
|
+
await Bun.write(file, JSON.stringify(updatedManifest, null, 4));
|
|
66
66
|
log.info(`updated ${MOD_FILE}: module ${updatedManifest.module}`);
|
|
67
67
|
};
|
|
68
68
|
//# sourceMappingURL=main.js.map
|