@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.
Files changed (68) hide show
  1. package/bin/cli.js +9 -3
  2. package/dist/build/helpers/deployment.d.ts +13 -13
  3. package/dist/build/main.js +32 -13
  4. package/dist/build/main.js.map +1 -1
  5. package/dist/deployment/gen/deployment-template.kumori +1 -1
  6. package/dist/deployment/gen/main.d.ts +1 -2
  7. package/dist/deployment/gen/main.js +7 -14
  8. package/dist/deployment/gen/main.js.map +1 -1
  9. package/dist/index/create/main.d.ts +1 -0
  10. package/dist/index/create/main.js +35 -15
  11. package/dist/index/create/main.js.map +1 -1
  12. package/dist/index/create/types.d.ts +1 -1
  13. package/dist/index/main.js +2 -0
  14. package/dist/index/main.js.map +1 -1
  15. package/dist/index/remove/main.d.ts +11 -0
  16. package/dist/index/remove/main.js +136 -0
  17. package/dist/index/remove/main.js.map +1 -0
  18. package/dist/lib/build.js +29 -42
  19. package/dist/lib/check.js +15 -45
  20. package/dist/lib/clean.js +1 -39
  21. package/dist/lib/deployment.d.ts +0 -3
  22. package/dist/lib/deployment.js +1 -5
  23. package/dist/lib/deployment.js.map +1 -1
  24. package/dist/lib/index-cmd.js +151 -60
  25. package/dist/lib/index.js +260 -54
  26. package/dist/lib/mod.js +78 -144
  27. package/dist/lib/registry.js +1 -67
  28. package/dist/mod/dependency/main.js +3 -4
  29. package/dist/mod/dependency/main.js.map +1 -1
  30. package/dist/mod/jsonschema/gen/main.js +3 -5
  31. package/dist/mod/jsonschema/gen/main.js.map +1 -1
  32. package/dist/mod/update/main.js +2 -2
  33. package/dist/mod/update/main.js.map +1 -1
  34. package/dist/util/git-or-fs-client.d.ts +13 -0
  35. package/dist/util/git-or-fs-client.js +86 -0
  36. package/dist/util/git-or-fs-client.js.map +1 -0
  37. package/out/deployment/gen/deployment-template.kumori +1 -1
  38. package/package.json +25 -15
  39. package/dist/lib/io/lib.kumori +0 -3
  40. package/dist/lib/kumori/builtin/apiserver.h.kumori +0 -19
  41. package/dist/lib/kumori/builtin/httpinbound.h.kumori +0 -34
  42. package/dist/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
  43. package/dist/lib/kumori/builtin.kumori +0 -16
  44. package/dist/lib/kumori/component.kumori +0 -120
  45. package/dist/lib/kumori/deployment.kumori +0 -14
  46. package/dist/lib/kumori/resource.kumori +0 -23
  47. package/dist/lib/kumori/service.kumori +0 -51
  48. package/dist/lib/kumori/shared.kumori +0 -18
  49. package/dist/lib/kumori/sized.kumori +0 -25
  50. package/dist/lib/sized.kumori +0 -8
  51. package/dist/lib/std.kumori +0 -8
  52. package/dist/lib/strconv/lib.kumori +0 -9
  53. package/out/deployment-template.kumori +0 -33
  54. package/out/lib/io/lib.kumori +0 -3
  55. package/out/lib/kumori/builtin/apiserver.h.kumori +0 -19
  56. package/out/lib/kumori/builtin/httpinbound.h.kumori +0 -34
  57. package/out/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
  58. package/out/lib/kumori/builtin.kumori +0 -16
  59. package/out/lib/kumori/component.kumori +0 -120
  60. package/out/lib/kumori/deployment.kumori +0 -14
  61. package/out/lib/kumori/resource.kumori +0 -23
  62. package/out/lib/kumori/service.kumori +0 -51
  63. package/out/lib/kumori/shared.kumori +0 -18
  64. package/out/lib/kumori/sized.kumori +0 -25
  65. package/out/lib/sized.kumori +0 -8
  66. package/out/lib/std.kumori +0 -8
  67. package/out/lib/strconv/lib.kumori +0 -9
  68. package/out/main.cjs +0 -820
@@ -0,0 +1,136 @@
1
+ import { createKumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
2
+ import { NodeFileSystem } from "langium/node";
3
+ import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
4
+ import { URI } from "langium";
5
+ import path from "path";
6
+ import { Result } from "@kumori/kdsl-lsp/util/result.js";
7
+ import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
8
+ import { GitOrLocalFsClient } from "../../util/git-or-fs-client.js";
9
+ const Summary = `Removes a module entry from an index file`;
10
+ export const Description = `
11
+ Removes the entry of the current module from an index file
12
+
13
+ This command will delete the entry for the current module from the specified index:
14
+ kdsl index remove path/to/index
15
+
16
+ Or you can provide a module location to generate the entry for:
17
+ kdsl index remove path/to/index path/to/module
18
+
19
+ You can specify a remote index location:
20
+ kdsl index remove git://path/to/index path/to/module
21
+
22
+ The updated index entry will be saved to disk or comitted to the remote git repository (as long as
23
+ you have the correct permissions)
24
+
25
+ `.trim();
26
+ export default { Register };
27
+ export function Register(cmd, log) {
28
+ const c = cmd
29
+ .command("remove")
30
+ .argument("<index>", "Path to the index file to append the new entry to. It can be either a relative, absolute path, or git URI.")
31
+ .argument("[module]", "Path to the module to generate the index entry for. It can be either a relative or absolute path. Defaults to the current directory.")
32
+ .summary(Summary)
33
+ .description(Description)
34
+ .helpOption(true)
35
+ .showHelpAfterError(true)
36
+ .action(Action(log));
37
+ return c;
38
+ }
39
+ export function Action(log) {
40
+ return async (index, module = ".", _options, command) => {
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ const configPath = command?.optsWithGlobals()?.config;
43
+ const svcs = createKumoriServices(NodeFileSystem, configPath).Kumori;
44
+ const kumoriFs = svcs.shared.workspace.FileSystemProvider;
45
+ let location = process.cwd();
46
+ location = path.isAbsolute(module)
47
+ ? module
48
+ : path.resolve(process.cwd(), module);
49
+ const ctx = await ModuleContext(kumoriFs, URI.file(location), configPath);
50
+ if (Result.isErr(ctx)) {
51
+ throw new Error(ctx.err);
52
+ }
53
+ let indexLocation = null;
54
+ const GitOrLocalFs = new GitOrLocalFsClient(log);
55
+ if (GitOrLocalFs.isGitUri(URI.parse(index))) {
56
+ indexLocation = URI.parse(index + "/index.json");
57
+ }
58
+ else {
59
+ const isPath = index[0] === "." || path.isAbsolute(index);
60
+ if (isPath) {
61
+ // If the path is relative, build an absolute path based on the current working directory
62
+ indexLocation = path.isAbsolute(index)
63
+ ? index
64
+ : path.resolve(process.cwd(), index);
65
+ }
66
+ else {
67
+ indexLocation = path.resolve(process.cwd(), index);
68
+ }
69
+ indexLocation = URI.parse(indexLocation);
70
+ }
71
+ // Read the index file and validate against the JSON Schema
72
+ let parsed = null;
73
+ if (indexLocation) {
74
+ try {
75
+ let data = null;
76
+ try {
77
+ data = await GitOrLocalFs.readFile(indexLocation);
78
+ }
79
+ catch {
80
+ // File does not exist, will create a new one
81
+ data = "";
82
+ }
83
+ if (data === null || data === "") {
84
+ // Empty index file, initialize a new one
85
+ parsed = { modules: [] };
86
+ log.info(`Index file at ${indexLocation} is either missing or empty. A new one will be created.`);
87
+ try {
88
+ await GitOrLocalFs.write(indexLocation, JSON.stringify(parsed, null, 2));
89
+ log.info(`Created new index file at ${indexLocation}`);
90
+ }
91
+ catch (err) {
92
+ log.error(`Failed to create new index file at ${indexLocation}: ${err}`);
93
+ return;
94
+ }
95
+ }
96
+ try {
97
+ data = await GitOrLocalFs.readFile(indexLocation);
98
+ parsed = (await JSON.parse(data));
99
+ }
100
+ catch (e) {
101
+ throw new Error(`Failed to parse index file at ${indexLocation}: ${e}`);
102
+ }
103
+ const manager = new RegistryManager(
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
+ command?.optsWithGlobals()?.config);
106
+ const isValid = manager.validateIndexSchema(parsed);
107
+ if (!isValid) {
108
+ throw new Error(`Index schema validation failed for ${indexLocation}`);
109
+ }
110
+ }
111
+ catch (err) {
112
+ log.error(`Failed to read index file at ${indexLocation}: ${err}`);
113
+ return;
114
+ }
115
+ }
116
+ const moduleToDelete = ctx.value.Current.Manifest;
117
+ let moduleToDeleteIdx = -1;
118
+ log.info(`parsed: ${parsed}, ${parsed?.modules.length}`);
119
+ if (parsed?.modules) {
120
+ moduleToDeleteIdx = parsed.modules.findIndex((m) => m.domain === moduleToDelete.module &&
121
+ m.version === moduleToDelete.version);
122
+ }
123
+ else {
124
+ log.warn(`Index at ${indexLocation} did not contain any modules`);
125
+ return;
126
+ }
127
+ log.info(`to delete: ${moduleToDeleteIdx}`);
128
+ if (moduleToDeleteIdx === -1) {
129
+ log.warn(`Module ${moduleToDelete.module} version ${moduleToDelete.version} does not exist in the index file at ${indexLocation}.`);
130
+ return;
131
+ }
132
+ parsed.modules.splice(moduleToDeleteIdx, 1);
133
+ await GitOrLocalFs.write(indexLocation, JSON.stringify(parsed, null, 2));
134
+ };
135
+ }
136
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/index/remove/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAEnE,MAAM,OAAO,GAAG,2CAA2C,CAAA;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;CAe1B,CAAC,IAAI,EAAE,CAAA;AAER,eAAe,EAAE,QAAQ,EAAE,CAAA;AAC3B,MAAM,UAAU,QAAQ,CAAC,GAAY,EAAE,GAAc;IACnD,MAAM,CAAC,GAAG,GAAG;SACV,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,CACP,SAAS,EACT,4GAA4G,CAC7G;SACA,QAAQ,CACP,UAAU,EACV,sIAAsI,CACvI;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,WAAW,CAAC;SACxB,UAAU,CAAC,IAAI,CAAC;SAChB,kBAAkB,CAAC,IAAI,CAAC;SACxB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IACtB,OAAO,CAAC,CAAA;AACV,CAAC;AAGD,MAAM,UAAU,MAAM,CAAC,GAAc;IACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAiB,EAAE;QACrE,8DAA8D;QAC9D,MAAM,UAAU,GAAI,OAAO,EAAE,eAAe,EAAU,EAAE,MAAgB,CAAA;QACxE,MAAM,IAAI,GAAG,oBAAoB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,MAAM,CAAA;QAEpE,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAA;QACzD,IAAI,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;QAE5B,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAChC,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAA;QAEvC,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAA;QACzE,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC;QAED,IAAI,aAAa,GAAG,IAAI,CAAA;QACxB,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAA;QAEhD,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC5C,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC,CAAA;QAClD,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YACzD,IAAI,MAAM,EAAE,CAAC;gBACX,yFAAyF;gBACzF,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;oBACpC,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAA;YACxC,CAAC;iBAAM,CAAC;gBACN,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAA;YACpD,CAAC;YACD,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAC1C,CAAC;QAED,2DAA2D;QAC3D,IAAI,MAAM,GAAyB,IAAI,CAAA;QACvC,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC;gBACH,IAAI,IAAI,GAAkB,IAAI,CAAA;gBAC9B,IAAI,CAAC;oBACH,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;gBACnD,CAAC;gBAAC,MAAM,CAAC;oBACP,6CAA6C;oBAC7C,IAAI,GAAG,EAAE,CAAA;gBACX,CAAC;gBAED,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;oBACjC,yCAAyC;oBACzC,MAAM,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;oBACxB,GAAG,CAAC,IAAI,CACN,iBAAiB,aAAa,yDAAyD,CACxF,CAAA;oBAED,IAAI,CAAC;wBACH,MAAM,YAAY,CAAC,KAAK,CACtB,aAAa,EACb,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAChC,CAAA;wBACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,aAAa,EAAE,CAAC,CAAA;oBACxD,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,GAAG,CAAC,KAAK,CACP,sCAAsC,aAAa,KAAK,GAAG,EAAE,CAC9D,CAAA;wBACD,OAAM;oBACR,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC;oBACH,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;oBACjD,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAkB,CAAA;gBACpD,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,MAAM,IAAI,KAAK,CACb,iCAAiC,aAAa,KAAK,CAAC,EAAE,CACvD,CAAA;gBACH,CAAC;gBACD,MAAM,OAAO,GAAG,IAAI,eAAe;gBACjC,8DAA8D;gBAC7D,OAAO,EAAE,eAAe,EAAU,EAAE,MAAgB,CACtD,CAAA;gBACD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;gBACnD,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,IAAI,KAAK,CAAC,sCAAsC,aAAa,EAAE,CAAC,CAAA;gBACxE,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,CAAC,KAAK,CAAC,gCAAgC,aAAa,KAAK,GAAG,EAAE,CAAC,CAAA;gBAClE,OAAM;YACR,CAAC;QACH,CAAC;QACD,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAA;QACjD,IAAI,iBAAiB,GAAG,CAAC,CAAC,CAAA;QAC1B,GAAG,CAAC,IAAI,CAAC,WAAW,MAAM,KAAK,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;QACxD,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,iBAAiB,GAAG,MAAO,CAAC,OAAO,CAAC,SAAS,CAC3C,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM;gBAClC,CAAC,CAAC,OAAO,KAAK,cAAc,CAAC,OAAO,CACvC,CAAA;QACH,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,YAAY,aAAa,8BAA8B,CAAC,CAAA;YACjE,OAAM;QACR,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,cAAc,iBAAiB,EAAE,CAAC,CAAA;QAE3C,IAAI,iBAAiB,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,IAAI,CACN,UAAU,cAAc,CAAC,MAAM,YAAY,cAAc,CAAC,OAAO,wCAAwC,aAAa,GAAG,CAC1H,CAAA;YACD,OAAM;QACR,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;QAC3C,MAAM,YAAY,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC,CAAA;AACH,CAAC"}
package/dist/lib/build.js CHANGED
@@ -1,42 +1,29 @@
1
- import { getLogger } from "./logger.js";
2
- import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
3
- import { BuildImpl } from "../build/main.js";
4
- /**
5
- * Produces deployable artifact specifications.
6
- * Generates a solution.json file for a specified Kumori package.
7
- *
8
- * @param options - Build command options
9
- * @returns Result with void on success, or string[] of errors
10
- *
11
- * @example
12
- * ```typescript
13
- * import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
14
- * import { NodeFileSystem } from 'langium/node'
15
- * import { build } from '@kumori/kdsl'
16
- *
17
- * const services = createKumoriServices(NodeFileSystem).Kumori
18
- *
19
- * const result = await build({
20
- * services,
21
- * package: 'my-package',
22
- * directory: '.'
23
- * })
24
- *
25
- * if (result.ok) {
26
- * console.log('Build succeeded!')
27
- * } else {
28
- * console.error('Errors:', result.err)
29
- * }
30
- * ```
31
- */
32
- export async function build(options) {
33
- const log = getLogger(options.logger);
34
- const pkgStr = options.package ?? ".";
35
- const target = options.directory ?? options.cwd ?? ".";
36
- const svcs = options.services;
37
- const manager = new RegistryManager(options.configPath);
38
- await manager.ensureIndexes();
39
- // Use the shared BuildImpl function
40
- return await BuildImpl(log, svcs, pkgStr, target, options.configPath);
41
- }
42
- //# sourceMappingURL=build.js.map
1
+ import{createRequire as CX}from"node:module";var DX=Object.create;var{getPrototypeOf:hX,defineProperty:e,getOwnPropertyNames:MX}=Object;var bX=Object.prototype.hasOwnProperty;var SZ=(Y,X,Z)=>{Z=Y!=null?DX(hX(Y)):{};let W=X||!Y||!Y.__esModule?e(Z,"default",{value:Y,enumerable:!0}):Z;for(let Q of MX(Y))if(!bX.call(W,Q))e(W,Q,{get:()=>Y[Q],enumerable:!0});return W};var TZ=(Y,X)=>()=>(X||Y((X={exports:{}}).exports,X),X.exports);var O1=(Y,X)=>{for(var Z in X)e(Y,Z,{get:X[Z],enumerable:!0,configurable:!0,set:(W)=>X[Z]=()=>W})};var p=(Y,X)=>()=>(Y&&(X=Y(Y=0)),X);var RZ=CX(import.meta.url),kX=Symbol.dispose||Symbol.for("Symbol.dispose"),fX=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),A1=(Y,X,Z)=>{if(X!=null){if(typeof X!=="object"&&typeof X!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var W;if(Z)W=X[fX];if(W===void 0)W=X[kX];if(typeof W!=="function")throw TypeError("Object not disposable");Y.push([Z,W,X])}else if(Z)Y.push([Z]);return X},E1=(Y,X,Z)=>{var W=typeof SuppressedError==="function"?SuppressedError:function(K,G,V,_){return _=Error(V),_.name="SuppressedError",_.error=K,_.suppressed=G,_},Q=(K)=>X=Z?new W(K,X,"An error was suppressed during disposal"):(Z=!0,K),H=(K)=>{while(K=Y.pop())try{var G=K[1]&&K[1].call(K[2]);if(K[0])return Promise.resolve(G).then(H,(V)=>(Q(V),H()))}catch(V){Q(V)}if(Z)throw X};return H()};import{Result as DY}from"@kumori/kdsl-lsp/util/result.js";function i(Y,X){if(DY.isErr(X)){for(let Z of X.err)Y.error(Z);process.exit(1)}return X.value}var K1=()=>{};import{ParseQuery as XX}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as l,None as hY,Some as MY}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as P,Ok as V1,Result as T}from"@kumori/kdsl-lsp/util/result.js";import{Version as a1}from"@kumori/kdsl-lsp/module/version.js";import{ListDependencies as bY}from"@kumori/kdsl-lsp/module/dependency/list.js";import J1 from"assert";import{LocateDependency as YX}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{ModuleContext as CY}from"@kumori/kdsl-lsp/module/context.js";import{MkdirTemp as kY}from"@kumori/kdsl-lsp/util/tmp.js";import{ValidateChecksum as fY}from"@kumori/kdsl-lsp/module/integrity/validate.js";import{URI as yY,UriUtils as LY}from"langium";import{cp as xY,mkdir as uY,rm as t1}from"fs/promises";import{ForURL as vY}from"@kumori/kdsl-lsp/module/remote/factory.js";import{SemVer as e1}from"@kumori/kdsl-lsp/util/semver.js";import{URL as dY}from"@kumori/kdsl-lsp/util/url.js";import{DependencyId as ZX}from"@kumori/kdsl-lsp/module/dependency/id.js";async function WX(Y){let X=new Map;return await HX(Y,X),X}async function QX(Y,X){let Z=new Map;console.log(X);for(let W of X){let Q=XX(W,Y.Locations.Config());if(l.isNone(Q)){let V=`invalid download query '${W}': failed to parse`;Z.set(W,{...P(V),required:!0});continue}let H=a1(Q.value.Version);if(l.isNone(H)){let V=`invalid download query '${W}': invalid version specifier '${Q.value.Version}': failed to parse`;Z.set(W,{...P(V),required:!0});continue}if(!a1.isSemVer(H.value)){let V=`invalid download query '${W}': invalid version specifier '${Q.value.Version}': invalid semver`;Z.set(W,{...P(V),required:!0});continue}let K=`${Q.value.Scheme}://${Q.value.Location}`,G=Q.value.Version;await GX(Y,K,G,Z)}return Z}async function HX(Y,X){let Z=bY(Y.Current);for(let W of Z.keys()){let Q=Z.get(W);if(Q.length<1)continue;let{target:H,version:K}=Q[0];await GX(Y,H,K,X);let G=Q.reduce((_,J)=>_||J.interface===void 0,!1),V=ZX(H,K);J1(X.has(V)),X.get(V).required||=G}}async function GX(Y,X,Z,W){let Q=ZX(X,Z);if(W.has(Q))return;let H=await pY(Y,X,Z);if(W.set(Q,{...H,required:!1}),T.isErr(H))return;let K=await YX(Y,X,Z);J1(l.isSome(K));let G=await CY.Move(Y,Y.FS,K.value.Root);J1(T.isOk(G)),Y={...Y,...G.value},await HX(Y,W)}async function pY(Y,X,Z){let _=[];try{let W=await YX(Y,X,Z);if(T.isOk(W))return V1(hY);const Q=A1(_,await kY(),1);let H=await gY(Y,X,Z,Q.Path);if(T.isErr(H))return P(`failed to fetch ${X}@${Z}: ${H.err}`);let K=await fY(Y.SumDB,yY.file(Q.Path),Y,X,H.value);if(T.isErr(K))return K;let G=`${X}@${Z}`;let V=LY.joinPath(Y.Locations.Cache(),G);await uY(V.fsPath,{recursive:!0});await t1(V.fsPath,{recursive:!0,force:!0});await xY(Q.Path,V.fsPath,{recursive:!0});await t1(Q.Path,{recursive:!0,force:!0});return V1(MY(G))}catch(J){var w=J,z=1}finally{var q=E1(_,w,z);q&&await q}}async function gY(Y,X,Z,W){let Q=`${X}@${Z}`,H=XX(Q,Y.Locations.Config());if(l.isNone(H))return P(`failed to resolve ${Q}: invalid download query`);let K=e1(H.value.Version),G=new dY(`${H.value.Scheme}://${H.value.Location}`),V=vY(Y.Remotes,G);if(T.isErr(V))return P(`failed to resolve ${Q}': invalid remote ${G}: ${V.err}`);let _=await V.value.Versions(G);if(T.isErr(_))return P(`failed to read ${G}: ${_.err}`);let J=K,w=_.value.filter((I)=>e1.Compare(I,J)===0);if(w.length===0)return P(`no remote matches for ${G}@v${K}`);if(w.length>1){let I=`[${w.map(String).join(", ")}]`;return P(`ambiguous match for ${G}@v${K}: found ${I}`)}let z=w[0],q=await V.value.Get(G,z.toString(),W);if(T.isErr(q))return P(`failed to fetch ${G}@${K.toString()}: ${q.err}`);return V1(z)}var _X=()=>{};var eY={};O1(eY,{default:()=>aY,Register:()=>JX,Download:()=>n,Description:()=>wX,Action:()=>qX});import{ModuleContext as mY}from"@kumori/kdsl-lsp/module/context.js";import{SumDB as cY}from"@kumori/kdsl-lsp/module/integrity/sumdb.js";import{RemoteFetcherFactory as KX}from"@kumori/kdsl-lsp/module/remote/factory.js";import{Maybe as iY}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as VX,Ok as lY,Result as u}from"@kumori/kdsl-lsp/util/result.js";import{URI as nY}from"langium";import{NodeFileSystem as sY}from"langium/node";import{createKumoriServices as oY}from"@kumori/kdsl-lsp/language/kumori.js";import{RegistryManager as rY}from"@kumori/kdsl-lsp/module/registry/manager.js";function JX(Y,X){return Y.command("download").alias("dl").summary(tY).argument("[module...]").option("-q, --quiet","do not log warnings").description(wX).helpOption(!0).action(qX(X))}function qX(Y){let X=(Z)=>i(Y,Z);return async(Z,W,Q)=>{let H=Q?.optsWithGlobals()?.config,K=oY(sY,H).Kumori;await new rY(H).ensureIndexes(),X(await n(Y,K,process.cwd(),Z,W,H))}}var aY,tY="download modules to local cache",wX,n=async(Y,X,Z,W,Q,H)=>{let K=X.shared.workspace.FileSystemProvider,G=await mY(K,nY.file(Z),H);if(u.isErr(G))return VX([G.err]);let V=await cY.Open(G.value.Locations.Checksum());if(u.isErr(V))return u.mapErr(V,(z)=>[z]);let _;if(!W.length)_=await WX({...G.value,FS:K,Remotes:KX(),SumDB:V.value});else _=await QX({...G.value,FS:K,Remotes:KX(),SumDB:V.value},W);let J=[];for(let[z,q]of _){if(u.isOk(q)){if(iY.isSome(q.value))Y.info(`Downloaded dependency ${z}`);continue}if(q.required)J.push(`${z}: ${q.err}`);else if(!Q.quiet)Y.warn(`${z}: ${q.err}`),Y.warn(`${z}: not required - continuing`)}if(Array.from(_.entries()).filter(([,z])=>u.isErr(z)&&z.required).length>0)return VX(J);return lY(void 0)};var zX=p(()=>{K1();_X();aY={Register:JX};wX=`
2
+ Downloads the specified modules, which can be module patterns selecting depen-
3
+ dencies of the current module or module queries of the form path@version.
4
+
5
+ With no arguments, download applies to the modules needed to build the packages
6
+ in the current module.
7
+
8
+ The kdsl command will automatically download modules as needed during ordinary
9
+ execution. The "kdsl mod download" command is useful mainly for pre-filling the
10
+ local cache.
11
+
12
+ By default, download writes nothing to standard output. It may print progress
13
+ messages and errors to standard error.
14
+ `.trim()});var JZ={};O1(JZ,{default:()=>VZ,Summary:()=>UX,Register:()=>FX,RawCheck:()=>AX,Description:()=>jX,Check:()=>s,Action:()=>OX});import{createKumoriServices as XZ}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as YZ,UriUtils as q1}from"langium";import{NodeFileSystem as ZZ}from"langium/node";import{DiagnosticSeverity as BX}from"vscode-languageserver";import{Err as w1,Ok as IX,Result as v}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as WZ}from"@kumori/kdsl-lsp/module/context.js";import QZ from"node:path";import{RegistryManager as HZ}from"@kumori/kdsl-lsp/module/registry/manager.js";function FX(Y,X){return Y.command("check").argument("[directory]","directory containing a Kumori module").description(jX).summary(UX).action(OX(X))}function OX(Y){return async(X,Z,W)=>{await new HZ(W?.optsWithGlobals()?.config).ensureIndexes();let H=XZ(ZZ).Kumori,K=H.shared.workspace.FileSystemProvider,G=(J)=>i(Y,J),V=W?.optsWithGlobals()?.config,_=G(v.mapErr(await WZ(K,YZ.file(QZ.resolve(X??".")),V),(J)=>[J]));G(await s(Y,H,_))}}function GZ(Y,X){return`lexer error: ${q1.relative(process.cwd(),Y.uri.fsPath)}:${X.line||1}:${X.column||1}: ${X.message}`}function _Z(Y,X){return`parser error: ${q1.relative(process.cwd(),Y.uri.fsPath)}:${X.token.startLine||1}:${X.token.startColumn||1}: ${X.message}`}function KZ(Y,X){return`diagnostic error: ${q1.relative(process.cwd(),Y.uri.fsPath)}:${X.range.start.line+1}:${X.range.start.character+1}: ${X.message}`}var UX="typecheck and validate a module",jX,s=async(Y,X,Z)=>{let W=Z.Current.Root,Q=await n(Y,X,W.fsPath,[],{quiet:!0},Z.Locations.Config());if(v.isErr(Q))return Q;let H=await AX(X,Z);if(v.isErr(H)){let K=H.err.warnings.concat(H.err.errors);return w1(K)}return IX(void 0)},AX=async(Y,X)=>{let Z={errors:[],warnings:[]},W=Y.shared.workspace.FileSystemProvider,Q=X.Current.Root,H=await v.tryCatchAsync(()=>W.readDirectory(Q));if(v.isErr(H)){let _=""+H.err;if(H.err instanceof Error)_=H.err.message;return Z.errors.push(`failed to read directory '${Q.fsPath}': ${_}`),w1(Z)}await Y.shared.workspace.WorkspaceManager.initializeWorkspace([{name:"root",uri:Q.toString()}]);let G=Y.shared.workspace.LangiumDocuments;await Y.shared.workspace.DocumentBuilder.build(G.all.toArray(),{validation:!0});for(let _ of Y.shared.workspace.LangiumDocuments.all){for(let J of _.parseResult.lexerErrors)Z.errors.push(GZ(_,J));for(let J of _.parseResult.parserErrors)Z.errors.push(_Z(_,J));for(let J of _.diagnostics||[]){let w=KZ(_,J);if(J.severity===BX.Error)Z.errors.push(w);if(J.severity===BX.Warning)Z.warnings.push(w)}}if(Z.errors.length>0)return w1(Z);return IX(void 0)},VZ;var EX=p(()=>{zX();K1();jX=`
15
+ `.trim();VZ={Register:FX}});var B=function(Y){return Y.info="info",Y.warn="warn",Y.error="error",Y.debug="debug",Y.trace="trace",Y.fatal="fatal",Y}({}),g={[B.trace]:10,[B.debug]:20,[B.info]:30,[B.warn]:40,[B.error]:50,[B.fatal]:60},yX={10:B.trace,20:B.debug,30:B.info,40:B.warn,50:B.error,60:B.fatal};var A=function(Y){return Y.transformLogLevel="transformLogLevel",Y.onBeforeDataOut="onBeforeDataOut",Y.shouldSendToLogger="shouldSendToLogger",Y.onMetadataCalled="onMetadataCalled",Y.onBeforeMessageOut="onBeforeMessageOut",Y.onContextCalled="onContextCalled",Y}({});var P1=class Y{context={};hasContext=!1;setContext(X){if(!X){this.context={},this.hasContext=!1;return}this.context=X,this.hasContext=!0}appendContext(X){this.context={...this.context,...X},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(X){if(X===void 0){this.context={},this.hasContext=!1;return}let Z=Array.isArray(X)?X:[X];for(let W of Z)delete this.context[W];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:X,childContextManager:Z}){if(X.hasContextData()){let W=X.getContext();Z.setContext({...W})}}clone(){let X=new Y;return X.setContext({...this.context}),X.hasContext=this.hasContext,X}},$1=class Y{setContext(X){}appendContext(X){}getContext(){return{}}hasContextData(){return!1}clearContext(X){}onChildLoggerCreated(X){}clone(){return new Y}};var S1=class Y{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(X){let Z=g[X];for(let W of Object.values(B)){let Q=W,H=g[W];this.logLevelEnabledStatus[Q]=H>=Z}}enableIndividualLevel(X){let Z=X;if(Z in this.logLevelEnabledStatus)this.logLevelEnabledStatus[Z]=!0}disableIndividualLevel(X){let Z=X;if(Z in this.logLevelEnabledStatus)this.logLevelEnabledStatus[Z]=!1}isLevelEnabled(X){let Z=X;return this.logLevelEnabledStatus[Z]}enableLogging(){for(let X of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[X]=!0}disableLogging(){for(let X of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[X]=!1}onChildLoggerCreated({parentLogLevelManager:X,childLogLevelManager:Z}){let W=X.logLevelEnabledStatus;if(Z instanceof Y)Z.logLevelEnabledStatus={...W}}clone(){let X=new Y;return X.logLevelEnabledStatus={...this.logLevelEnabledStatus},X}},T1=class Y{setLevel(X){}enableIndividualLevel(X){}disableIndividualLevel(X){}isLevelEnabled(X){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(X){}clone(){return new Y}};var LX=[A.onBeforeDataOut,A.onMetadataCalled,A.onBeforeMessageOut,A.transformLogLevel,A.shouldSendToLogger,A.onContextCalled],N1=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(Y){this.idToPlugin={},this.mapPlugins(Y),this.indexPlugins()}mapPlugins(Y){for(let X of Y){if(!X.id)X.id=Date.now().toString()+Math.random().toString();if(this.idToPlugin[X.id])throw Error(`[LogLayer] Plugin with id ${X.id} already exists.`);X.registeredAt=Date.now(),this.idToPlugin[X.id]=X}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let Y=Object.values(this.idToPlugin).sort((X,Z)=>X.registeredAt-Z.registeredAt);for(let X of Y){if(X.disabled)return;for(let Z of LX)if(X[Z]&&X.id)this[Z].push(X.id)}}hasPlugins(Y){return this[Y].length>0}countPlugins(Y){if(Y)return this[Y].length;return Object.keys(this.idToPlugin).length}addPlugins(Y){this.mapPlugins(Y),this.indexPlugins()}enablePlugin(Y){let X=this.idToPlugin[Y];if(X)X.disabled=!1;this.indexPlugins()}disablePlugin(Y){let X=this.idToPlugin[Y];if(X)X.disabled=!0;this.indexPlugins()}removePlugin(Y){delete this.idToPlugin[Y],this.indexPlugins()}runTransformLogLevel(Y,X){let Z=null;for(let W of this.transformLogLevel){let Q=this.idToPlugin[W];if(Q.transformLogLevel){let H=Q.transformLogLevel({data:Y.data,logLevel:Y.logLevel,messages:Y.messages,error:Y.error,metadata:Y.metadata,context:Y.context},X);if(H!==null&&H!==void 0&&H!==!1)Z=H}}return Z!==null&&Z!==void 0&&Z!==!1?Z:Y.logLevel}runOnBeforeDataOut(Y,X){let Z={...Y};for(let W of this.onBeforeDataOut){let Q=this.idToPlugin[W];if(Q.onBeforeDataOut){let H=Q.onBeforeDataOut({data:Z.data,logLevel:Z.logLevel,error:Z.error,metadata:Z.metadata,context:Z.context},X);if(H){if(!Z.data)Z.data={};Object.assign(Z.data,H)}}}return Z.data}runShouldSendToLogger(Y,X){return!this.shouldSendToLogger.some((Z)=>{return!this.idToPlugin[Z].shouldSendToLogger?.(Y,X)})}runOnMetadataCalled(Y,X){let Z={...Y};for(let W of this.onMetadataCalled){let Q=this.idToPlugin[W].onMetadataCalled?.(Z,X);if(Q)Z=Q;else return null}return Z}runOnBeforeMessageOut(Y,X){let Z=[...Y.messages];for(let W of this.onBeforeMessageOut){let Q=this.idToPlugin[W].onBeforeMessageOut?.({messages:Z,logLevel:Y.logLevel},X);if(Q)Z=Q}return Z}runOnContextCalled(Y,X){let Z={...Y};for(let W of this.onContextCalled){let Q=this.idToPlugin[W].onContextCalled?.(Z,X);if(Q)Z=Q;else return null}return Z}},h1=class Y{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_config;constructor(X){if(this._config={...X,enabled:X.enabled??!0},this.contextManager=new P1,this.logLevelManager=new S1,!this._config.enabled)this.disableLogging();if(this.pluginManager=new N1([...X.plugins||[],...y.pluginsToInit]),!this._config.errorFieldName)this._config.errorFieldName="err";if(!this._config.copyMsgOnOnlyError)this._config.copyMsgOnOnlyError=!1;if(this._initializeTransports(this._config.transport),y.logLayerHandlers.length>0)y.logLayerHandlers.forEach((Z)=>{if(Z.onConstruct)Z.onConstruct(this,X)})}withContextManager(X){if(this.contextManager&&typeof this.contextManager[Symbol.dispose]==="function")this.contextManager[Symbol.dispose]();return this.contextManager=X,this}getContextManager(){return this.contextManager}withLogLevelManager(X){if(this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==="function")this.logLevelManager[Symbol.dispose]();return this.logLevelManager=X,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(X){if(this.idToTransport){for(let Z in this.idToTransport)if(this.idToTransport[Z]&&typeof this.idToTransport[Z][Symbol.dispose]==="function")this.idToTransport[Z][Symbol.dispose]()}if(this.hasMultipleTransports=Array.isArray(X)&&X.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(X)?X[0]:X,Array.isArray(X))this.idToTransport=X.reduce((Z,W)=>{return Z[W.id]=W,Z},{});else this.idToTransport={[X.id]:X}}withPrefix(X){let Z=this.child();return Z._config.prefix=X,Z}withContext(X){let Z=X;if(!X){if(this._config.consoleDebug)console.debug("[LogLayer] withContext was called with no context; dropping.");return this}if(this.pluginManager.hasPlugins(A.onContextCalled)){if(Z=this.pluginManager.runOnContextCalled(X,this),!Z){if(this._config.consoleDebug)console.debug("[LogLayer] Context was dropped due to plugin returning falsy value.");return this}}return this.contextManager.appendContext(Z),this}clearContext(X){return this.contextManager.clearContext(X),this}getContext(){return this.contextManager.getContext()}addPlugins(X){this.pluginManager.addPlugins(X)}enablePlugin(X){this.pluginManager.enablePlugin(X)}disablePlugin(X){this.pluginManager.disablePlugin(X)}removePlugin(X){this.pluginManager.removePlugin(X)}withMetadata(X){return new D1(this).withMetadata(X)}withError(X){return new D1(this).withError(X)}child(){let X=new Y({...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:X.contextManager,parentLogger:this,childLogger:X}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:X.logLevelManager,parentLogger:this,childLogger:X}),X}withFreshTransports(X){return this._config.transport=X,this._initializeTransports(X),this}addTransport(X){let Z=Array.isArray(X)?X:[X],W=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],Q=new Set(Z.map((K)=>K.id));for(let K of Z){let G=this.idToTransport[K.id];if(G&&typeof G[Symbol.dispose]==="function")G[Symbol.dispose]()}let H=[...W.filter((K)=>!Q.has(K.id)),...Z];this._config.transport=H;for(let K of Z)this.idToTransport[K.id]=K;return this.hasMultipleTransports=H.length>1,this.singleTransport=this.hasMultipleTransports?null:H[0],this}removeTransport(X){let Z=this.idToTransport[X];if(!Z)return!1;if(typeof Z[Symbol.dispose]==="function")Z[Symbol.dispose]();delete this.idToTransport[X];let W=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter((Q)=>Q.id!==X);return this._config.transport=W.length===1?W[0]:W,this.hasMultipleTransports=W.length>1,this.singleTransport=this.hasMultipleTransports?null:W[0]||null,!0}withFreshPlugins(X){return this._config.plugins=X,this.pluginManager=new N1(X),this}withPluginManager(X){return this.pluginManager=X,this}errorOnly(X,Z){let W=Z?.logLevel||B.error;if(!this.isLevelEnabled(W))return;let{copyMsgOnOnlyError:Q}=this._config,H={logLevel:W,err:X};if((Q&&Z?.copyMsg!==!1||Z?.copyMsg===!0)&&X?.message)H.params=[X.message];this._formatLog(H)}metadataOnly(X,Z=B.info){if(!this.isLevelEnabled(Z))return;let{muteMetadata:W,consoleDebug:Q}=this._config;if(W)return;if(!X){if(Q)console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let H=X;if(this.pluginManager.hasPlugins(A.onMetadataCalled)){if(H=this.pluginManager.runOnMetadataCalled(X,this),!H){if(Q)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}}let K={logLevel:Z,metadata:H};this._formatLog(K)}info(...X){if(!this.isLevelEnabled(B.info))return;this._formatMessage(X),this._formatLog({logLevel:B.info,params:X})}warn(...X){if(!this.isLevelEnabled(B.warn))return;this._formatMessage(X),this._formatLog({logLevel:B.warn,params:X})}error(...X){if(!this.isLevelEnabled(B.error))return;this._formatMessage(X),this._formatLog({logLevel:B.error,params:X})}debug(...X){if(!this.isLevelEnabled(B.debug))return;this._formatMessage(X),this._formatLog({logLevel:B.debug,params:X})}trace(...X){if(!this.isLevelEnabled(B.trace))return;this._formatMessage(X),this._formatLog({logLevel:B.trace,params:X})}fatal(...X){if(!this.isLevelEnabled(B.fatal))return;this._formatMessage(X),this._formatLog({logLevel:B.fatal,params:X})}raw(X){if(!this.isLevelEnabled(X.logLevel))return;let Z={logLevel:X.logLevel,params:X.messages,metadata:X.metadata,err:X.error,context:X.context};this._formatMessage(X.messages),this._formatLog(Z)}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(X){return this.logLevelManager.enableIndividualLevel(X),this}disableIndividualLevel(X){return this.logLevelManager.disableIndividualLevel(X),this}setLevel(X){return this.logLevelManager.setLevel(X),this}isLevelEnabled(X){return this.logLevelManager.isLevelEnabled(X)}formatContext(X){let{contextFieldName:Z,muteContext:W}=this._config;if(X&&Object.keys(X).length>0&&!W){if(Z)return{[Z]:{...X}};return{...X}}return{}}formatMetadata(X=null){let{metadataFieldName:Z,muteMetadata:W}=this._config;if(X&&!W){if(Z)return{[Z]:{...X}};return{...X}}return{}}getLoggerInstance(X){let Z=this.idToTransport[X];if(!Z)return;return Z.getLoggerInstance()}_formatMessage(X=[]){let{prefix:Z}=this._config;if(Z&&typeof X[0]==="string")X[0]=`${Z} ${X[0]}`}_formatLog({logLevel:X,params:Z=[],metadata:W=null,err:Q,context:H=null}){let{errorSerializer:K,errorFieldInMetadata:G,muteContext:V,contextFieldName:_,metadataFieldName:J,errorFieldName:w}=this._config,z=H!==null?H:this.contextManager.getContext(),q=!!W||(V?!1:H!==null?Object.keys(H).length>0:this.contextManager.hasContextData()),I={};if(q)if(_&&_===J){let U=this.formatContext(z)[_],j=this.formatMetadata(W)[J];I={[_]:{...U,...j}}}else I={...this.formatContext(z),...this.formatMetadata(W)};if(Q){let U=K?K(Q):Q;if(G&&W&&J)if(I?.[J])I[J][w]=U;else I={...I,[J]:{[w]:U}};else if(G&&!W&&J)I={...I,[J]:{[w]:U}};else I={...I,[w]:U};q=!0}if(this.pluginManager.hasPlugins(A.onBeforeDataOut)){if(I=this.pluginManager.runOnBeforeDataOut({data:q?I:void 0,logLevel:X,error:Q,metadata:W,context:z},this),I&&!q)q=!0}if(this.pluginManager.hasPlugins(A.onBeforeMessageOut))Z=this.pluginManager.runOnBeforeMessageOut({messages:[...Z],logLevel:X},this);if(this.pluginManager.hasPlugins(A.transformLogLevel))X=this.pluginManager.runTransformLogLevel({data:q?I:void 0,logLevel:X,messages:[...Z],error:Q,metadata:W,context:z},this);if(this.hasMultipleTransports){let U=this._config.transport.filter((j)=>j.enabled).map(async(j)=>{let $=X;if(this.pluginManager.hasPlugins(A.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...Z],data:q?I:void 0,logLevel:$,transportId:j.id,error:Q,metadata:W,context:z},this))return}return j._sendToLogger({logLevel:$,messages:[...Z],data:q?I:void 0,hasData:q,error:Q,metadata:W,context:z})});Promise.all(U).catch((j)=>{if(this._config.consoleDebug)console.error("[LogLayer] Error executing transports:",j)})}else{if(!this.singleTransport?.enabled)return;if(this.pluginManager.hasPlugins(A.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...Z],data:q?I:void 0,logLevel:X,transportId:this.singleTransport.id,error:Q,metadata:W,context:z},this))return}this.singleTransport._sendToLogger({logLevel:X,messages:[...Z],data:q?I:void 0,hasData:q,error:Q,metadata:W,context:z})}}},R1=class{debug(...Y){}error(...Y){}info(...Y){}trace(...Y){}warn(...Y){}fatal(...Y){}enableLogging(){return this}disableLogging(){return this}withMetadata(Y){return this}withError(Y){return this}},uZ=class{mockLogBuilder=new R1;mockContextManager=new $1;mockLogLevelManager=new T1;info(...Y){}warn(...Y){}error(...Y){}debug(...Y){}trace(...Y){}fatal(...Y){}raw(Y){}getLoggerInstance(Y){}errorOnly(Y,X){}metadataOnly(Y,X){}addPlugins(Y){}removePlugin(Y){}enablePlugin(Y){}disablePlugin(Y){}withPrefix(Y){return this}withContext(Y){return this}withError(Y){return this.mockLogBuilder.withError(Y)}withMetadata(Y){return this.mockLogBuilder.withMetadata(Y)}getContext(){return{}}clearContext(Y){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(Y){return this}addTransport(Y){return this}removeTransport(Y){return!0}withFreshPlugins(Y){return this}withContextManager(Y){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(Y){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(Y){this.mockLogBuilder=Y}enableIndividualLevel(Y){return this}disableIndividualLevel(Y){return this}setLevel(Y){return this}isLevelEnabled(Y){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new R1}};var y={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var D1=class{err;metadata;structuredLogger;hasMetadata;pluginManager;constructor(Y){if(this.err=null,this.metadata={},this.structuredLogger=Y,this.hasMetadata=!1,this.pluginManager=Y.pluginManager,y.logBuilderHandlers.length>0)y.logBuilderHandlers.forEach((X)=>{if(X.onConstruct)X.onConstruct(this,Y)})}withMetadata(Y){let{pluginManager:X,structuredLogger:{_config:{consoleDebug:Z}}}=this;if(!Y){if(Z)console.debug("[LogLayer] withMetadata was called with no metadata; dropping.");return this}let W=Y;if(X.hasPlugins(A.onMetadataCalled)){if(W=X.runOnMetadataCalled(Y,this.structuredLogger),!W){if(Z)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return this}}return this.metadata={...this.metadata,...W},this.hasMetadata=!0,this}withError(Y){return this.err=Y,this}info(...Y){if(!this.structuredLogger.isLevelEnabled(B.info))return;this.structuredLogger._formatMessage(Y),this.formatLog(B.info,Y)}warn(...Y){if(!this.structuredLogger.isLevelEnabled(B.warn))return;this.structuredLogger._formatMessage(Y),this.formatLog(B.warn,Y)}error(...Y){if(!this.structuredLogger.isLevelEnabled(B.error))return;this.structuredLogger._formatMessage(Y),this.formatLog(B.error,Y)}debug(...Y){if(!this.structuredLogger.isLevelEnabled(B.debug))return;this.structuredLogger._formatMessage(Y),this.formatLog(B.debug,Y)}trace(...Y){if(!this.structuredLogger.isLevelEnabled(B.trace))return;this.structuredLogger._formatMessage(Y),this.formatLog(B.trace,Y)}fatal(...Y){if(!this.structuredLogger.isLevelEnabled(B.fatal))return;this.structuredLogger._formatMessage(Y),this.formatLog(B.fatal,Y)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(Y,X){let{muteMetadata:Z}=this.structuredLogger._config,W=Z?!1:this.hasMetadata;this.structuredLogger._formatLog({logLevel:Y,params:X,metadata:W?this.metadata:null,err:this.err})}};function xX(){return new h1({transport:{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}})}function M1(Y){return Y??xX()}import{RegistryManager as PZ}from"@kumori/kdsl-lsp/module/registry/manager.js";import{DeploymentArtifact as wZ,isIdentifierExpression as qZ,isDeploymentArtifact as zZ,isStringLiteralExpression as BZ}from"@kumori/kdsl-lsp/language/generated/ast.js";import{createKumoriServices as g4}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as IZ,UriUtils as FZ}from"langium";import{NodeFileSystem as l4}from"langium/node";import{Result as k,Err as C,Ok as UZ}from"@kumori/kdsl-lsp/util/result.js";import{Deployment as NY}from"@kumori/kdsl-lsp/language/builtin/lib/kumori/deployment.js";import{toJSON as RY}from"@kumori/kdsl-lsp/language/type-system/toJSON.js";import{Result as s1,Err as G1,Ok as o1}from"@kumori/kdsl-lsp/util/result.js";import{AstUtils as n1}from"langium";import{ToUnits as wY}from"@kumori/kdsl-lsp/util/sized.js";import{EphemeralName as uX,Ephemeral as vX,PersistentName as dX,Persistent as pX,RegisteredName as gX,Registered as mX,VolatileName as cX,Volatile as iX,PersistedName as lX,Persisted as nX,NonReplicatedName as sX,NonReplicated as oX,CAName as rX,CA as aX,CertificateName as tX,SecretName as eX,Secret as XY,DomainName as YY,PortName as ZY,Port as WY,Domain as QY,Certificate as HY}from"@kumori/kdsl-lsp/language/builtin/lib/kumori/resource.js";function E(Y){if(Y.$type===uX){let X=vX.parse(Y);return{volume:{size:X.value.size,unit:X.value.unit,kind:"storage"}}}if(Y.$type===dX)return{volume:pX.parse(Y).value};if(Y.$type===gX)return{volume:mX.parse(Y).value};if(Y.$type===cX){let X=iX.parse(Y);return{volume:{size:X.value.size,unit:X.value.unit,kind:"storage",type:"volatile"}}}if(Y.$type===lX){let X=nX.parse(Y);return{volume:{size:X.value.size,unit:X.value.unit,kind:"storage",type:"persistent"}}}if(Y.$type===sX){let X=oX.parse(Y);return{volume:{size:X.value.size,unit:X.value.unit,kind:"storage",type:"nonreplicated"}}}if(Y.$type===rX)return{ca:aX.parse(Y).value};if(Y.$type===tX)return{certificate:HY.parse(Y).value};if(Y.$type===eX)return{secret:XY.parse(Y).value};if(Y.$type===YY)return{domain:QY.parse(Y).value};if(Y.$type===ZY)return{port:WY.parse(Y).value};throw Error(`unknown resource type '${Y.$type}'`)}import{ParseOCIString as GY}from"@kumori/kdsl-lsp/util/oci.js";import{Result as L}from"@kumori/kdsl-lsp/util/result.js";import{AstUtils as _Y}from"langium";import{basename as KY}from"path";function C1(Y){if(typeof Y==="string")return L.orElse(L.map(GY(Y),(X)=>({tag:X.tag,hub:{name:X.hub,secret:typeof Y==="string"?"":Y.hub?.secret??""}})),(X)=>{throw Error(X)});else return Y}function D(Y,X){if(!X)return[];let Z=_Y.getDocument(X).uri,W=Y.getModule(Z);if(L.isErr(W))return[];let Q=L.tryCatch(()=>new URL(`file://${W.value.Manifest.module}`));if(L.isErr(Q))return[];let H=[];if(Q.value.hostname.length)H.push((G)=>G.domain=Q.value.hostname);if(Q.value.pathname.length)H.push((G)=>{G.module=Q.value.pathname.replace(/^\//,""),G.name=KY(G.module)});let K=W.value.Manifest.version;if(K){let G=K.split(".").map(Number);if(G.length>=3&&G.every((V)=>!isNaN(V)))H.push((V)=>V.version=[G[0],G[1],G[2]])}return H}function k1(Y){let X="";if(Y.domain!==""){if(X+=`${Y.domain}`,Y.module!=="")X+=`/${Y.module}`}else if(Y.module!=="")X+=Y.module;return X}function x(Y){return Array.isArray(Y)?Y:[Y]}function b1(Y){if(Y===null||Y===void 0)return;if(typeof Y==="string"){let X=Y.trim();if(X.length===0)return;try{return JSON.parse(X)}catch{return{}}}if(typeof Y==="object"){if(Array.isArray(Y))return Y.length>0?Y:void 0;return Object.keys(Y).length>0?Y:void 0}return Y}function m(Y){return!!Y&&typeof Y==="object"&&!Array.isArray(Y)}function f1(Y,X){if(!m(Y)||!m(X))return X;let Z={...Y};for(let[W,Q]of Object.entries(X))Z[W]=W in Z?f1(Z[W],Q):Q;return Z}function c(Y,X){let Z=b1(Y),W=b1(X);if(Z&&W&&m(Z)&&m(W))return f1(Z,W);return W??Z??{}}import{isComponentArtifact as qY}from"@kumori/kdsl-lsp/language/generated/ast.js";import{LoadBalancerName as VY,FullConnectorName as JY}from"@kumori/kdsl-lsp/language/builtin/lib/kumori/service.js";function X1(Y,X,Z,W){let Q=Y.svcs.shared.references.KumoriModules,H=D(Q,Y.nodes.get(X));for(let K of H)K(Z);if(W)Z.kind="service";return Z}function y1(Y,X){return Y.some((Z)=>JSON.stringify(Z)===JSON.stringify(X))}function L1(Y,X){return{role:Y,channel:X}}function Y1(Y,X,Z){return{meta:Y,links:[{role:X,channel:Z}]}}function x1(Y,X,Z){let W={version:[0,0,0],kind:"component",domain:"unknown",module:"unknown",name:"unknown"};if(Z.$type===VY){Z=Z;let Q=[],H=[];if("from"in Z.value&&"to"in Z.value){let K=x(Z.value.from),G=x(Z.value.to);for(let V of K){H.push(L1(V.target,V.channel));for(let _ of G){let J=_.meta??{},w=X.role[_.target=="self"?V.target:_.target],z=S(w.artifact)||_.target=="self";X1(Y,w,W,z);let q=c(Z.value.meta,J),I=[{auto:{channel:_.target!=="self"?_.target+"."+_.channel:_.channel,compRef:W,roleName:_.target=="self"?V.target:_.target},user:q}],U=Y1(I,_.target,_.channel);if(!y1(Q,U))Q.push(U)}}}return{kind:"lb",clients:H,servers:Q}}if(Z.$type===JY){Z=Z;let Q=[],H=[];if("from"in Z.value&&"to"in Z.value){let K=x(Z.value.from),G=x(Z.value.to);for(let V of K){H.push(L1(V.target,V.channel));for(let _ of G){let J=X.role[_.target=="self"?V.target:_.target],w=S(J.artifact);X1(Y,J,W,w);let z=c(Z.value.meta,_.meta),q=[{auto:{channel:_.target!=="self"?_.target+"."+_.channel:_.channel,compRef:W,roleName:_.target=="self"?V.target:_.target},user:z}],I=Y1(q,_.target,_.channel);if(!y1(Q,I))Q.push(I)}}}else if("target"in Z.value&&"channel"in Z.value){let K=X.role[Z.value.target],G=S(K.artifact);X1(Y,K,W,G);let V=c(Z.value.meta,void 0),_=[{auto:{channel:Z.value.channel,compRef:W,roleName:Z.value.target},user:V}];Q.push(Y1(_,Z.value.target,Z.value.channel))}return{kind:"full",clients:H,servers:Q}}throw Error(`unknown connection type '${Z.$type}'`)}function Z1(Y,X,Z,W){return{kind:"lb",clients:[{role:W==="server"?"self":Z,channel:X}],servers:[{meta:[{auto:{channel:X,compRef:Y,roleName:W==="client"?"self":Z},user:{}}],links:[{role:W==="client"?"self":Z,channel:X}]}]}}function v1(Y,X,Z){let W={version:[0,0,0],kind:"service",domain:"unknown",module:"unknown",name:"unknown"},Q=Y.svcs.shared.references.KumoriModules,H=D(Q,Y.nodes.get(X));for(let _ of H)_(W);let K=Y.nodes.get(X),G="";if(K&&qY(K))G=K.name.value.$refText;if(G==="")throw Error("Unable to determine component name for service artifact conversion.");let V=W1(Y,X,Z);return{spec:[1,0],ref:W,description:{builtin:!1,connector:Object.fromEntries([...Object.entries(X.srv?.server??{}).map(([_])=>[`self_${_}_to_${_}`,Z1(V.ref,_,G,"server")]),...Object.entries(X.srv?.client??{}).map(([_])=>[`c-${_}`,Z1(W,_,G,"client")])]),config:{resilience:0,scale:{},parameter:{},resource:{}},role:{[G]:{name:G,meta:{},artifact:V}},srv:{client:Object.fromEntries(Object.entries(X.srv?.client??{}).map(([_,J])=>[_,{protocol:J,inherited:!1}])),server:Object.fromEntries(Object.entries(X.srv?.server??{}).map(([_,J])=>{let w;if(typeof J==="string")w={port:80,inherited:!1,protocol:J};else w={...J,inherited:!1};return[_,w]})),duplex:Object.fromEntries(Object.entries(X.srv?.duplex??{}).map(([_,J])=>{let w;if(typeof J==="string")w={port:80,inherited:!1,protocol:J};else w={...J,inherited:!1};return[_,w]}))}}}}function W1(Y,X,Z){let W={version:[0,0,0],kind:"component",domain:"unknown",module:"unknown",name:"unknown"},Q=Y.svcs.shared.references.KumoriModules,H=D(Q,Y.nodes.get(X));for(let J of H)J(W);function K(J,w=!1){return Object.fromEntries(Object.entries(J??{}).map(([z,q])=>{return[z,{name:z,init:w,entrypoint:q.entrypoint,user:q.user,image:C1(q.image),cmd:q.cmd,size:{memory:{...q.size.memory,kind:"ram"},cpu:{...q.size.cpu,kind:"cpu"},mincpu:q.size.mincpu?q.size.mincpu.size:q.size.cpu.size},mapping:{filesystem:Object.fromEntries(Object.entries(q.fs??{}).map(([U,j])=>[U,zY(U,j)])),env:Object.fromEntries(Object.entries(q.env??{}).map(([U,j])=>{let $=U,o=(()=>{if(typeof j==="string"||typeof j==="number"||typeof j==="boolean")return{value:String(j)};return j})();return[$,o]}))}}]}))}let G=Object.fromEntries((X.init??[]).map((J,w)=>[`INIT_${w}`,J])),V=K(X.code),_=K(G,!0);return{spec:[1,0],ref:W,description:{builtin:!1,config:{resilience:0,scale:{hsize:Z?Z:X.scale?X.scale:1},parameter:X.config,resource:Object.fromEntries(Object.entries(X.resource??{}).map(([J,w])=>[J,E(w)]))},size:{bandwidth:{...X.size.bandwidth,kind:"bandwidth"},minbandwidth:Math.ceil(wY(X.size.minbandwidth??X.size.bandwidth,X.size.bandwidth.unit).size),mincpu:{...X.size.mincpu,kind:"cpu"}},profile:{threadability:"*",iopsintensive:!1},srv:{client:Object.fromEntries(Object.entries(X.srv?.client??{}).map(([J,w])=>[J,{protocol:w,inherited:!1}])),server:Object.fromEntries(Object.entries(X.srv?.server??{}).map(([J,w])=>{let z;if(typeof w==="string")z={port:80,portnum:1,inherited:!1,protocol:w};else z={...w,portnum:1,inherited:!1};return[J,z]})),duplex:Object.fromEntries(Object.entries(X.srv?.duplex??{}).map(([J,w])=>{let z;if(typeof w==="string")z={port:80,portnum:1,inherited:!1,protocol:w};else z={...w,portnum:1,inherited:!1};return[J,z]}))},code:{..._,...V},probe:Object.fromEntries(Object.entries(X.probe??{}).map(([J,w])=>{return[J,w]}))}}}function zY(Y,X){if(typeof X==="string"){let Z=u1(Y,X);return{path:Y,data:{value:Z.value},format:Z.format,rebootOnUpdate:!1}}if(typeof X==="object"){if("volume"in X)return{path:Y,volume:X.volume};if("data"in X){let Q=u1(Y,X.data,X.format);return{path:Y,data:{value:Q.value},format:Q.format,mode:X.mode??420,rebootOnUpdate:X.rebootOnUpdate??!1}}let W=["secret","port","domain","certificate","ca"].find((Q)=>(Q in X));if(W){let Q=W;return{path:Y,data:{[Q]:X[Q]},format:X.format??"text",mode:X.mode??420,rebootOnUpdate:X.rebootOnUpdate??!1}}}throw Error(`Unknown key '${Y}': ${JSON.stringify(X)}`)}function u1(Y,X,Z){if(Z)return{value:IY(X,Z),format:Z};let W=BY(Y,X);if(W)return W;return{value:X,format:"text"}}function BY(Y,X){if(typeof X!=="string"||!Y.toLowerCase().endsWith(".json"))return;let Z=X.trim();if(!(Z.startsWith("{")||Z.startsWith("[")))return;try{return{value:JSON.parse(X),format:"json"}}catch{return}}function IY(Y,X){if(X!=="json"||typeof Y!=="string")return Y;try{return JSON.parse(Y)}catch{return Y}}import{Maybe as UY,None as jY,Some as OY}from"@kumori/kdsl-lsp/util/maybe.js";import{SemVer as FY}from"@kumori/kdsl-lsp/util/semver.js";function Q1(Y){let X=FY(Y.id.version);return{spec:[1,0],ref:{version:[X.major,X.minor,X.patch],kind:Y.id.kind,domain:Y.id.domain,module:Y.id.module,name:Y.id.name},description:{builtin:!0,srv:{client:Object.fromEntries(Object.entries(Y.srv.client??{}).map(([Z])=>[Z,{protocol:"http",inherited:!1}])),server:Object.fromEntries(Object.entries(Y.srv.server??{}).map(([Z,W])=>{let Q;if(typeof W==="string")Q={port:80,portnum:1,inherited:!1,protocol:W};else Q={...W,inherited:!1};return[Z,Q]})),duplex:{}},config:{resilience:0,scale:{},parameter:Y.config??{},resource:Object.fromEntries(Object.entries(Y.resource).map(([Z,W])=>[Z,E(W)]))},connector:{},role:{}}}}function d1(Y,X){return{name:h(Y),up:b(Y),meta:{},config:{resilience:0,scale:{},parameter:X.config??{},resource:Object.fromEntries(Object.entries(X.resource??{}).map(([Z,W])=>[Z,E(W)]))},artifact:Q1(X)}}function AY(Y,X){if(typeof Y==="number")return Y;if(Y&&typeof Y==="object"&&X in Y){let Z=Y[X];return typeof Z==="number"?Z:void 0}return}function EY(Y){let X=Y.scale;if(typeof X==="number")return X;if(X&&typeof X==="object"&&!Array.isArray(X)&&"hsize"in X&&typeof X.hsize==="number")return X.hsize;return}function PY(Y,X){return Object.fromEntries(Object.entries(Y.role??{}).map(([Z,W])=>{if("id"in W.artifact)return[Z,{hsize:1}];let Q=AY(X,Z);if(typeof Q==="number")return[Z,{hsize:Q}];let H=EY(W);if(typeof H==="number")return[Z,{hsize:H}];return[Z,{hsize:1}]}))}function p1(Y,X){if(typeof X==="number")return Object.fromEntries(Object.keys(Y.role??{}).map((Z)=>[Z,X]));if(X&&typeof X==="object"&&!Array.isArray(X)){let Z=new Set(Object.keys(Y.role??{})),W=Object.fromEntries(Object.entries(X).filter(([Q,H])=>Z.has(Q)&&typeof H==="number").map(([Q,H])=>[Q,H]));return Object.keys(W).length>0?W:void 0}return}function g1(Y,X){return{detail:PY(Y,X)}}function H1(Y,X,Z){let W={version:[0,0,0],kind:"service",domain:"unknown",module:"unknown",name:"unknown"},Q=Y.svcs.shared.references.KumoriModules,H=D(Q,Y.nodes.get(X));for(let G of H)G(W);let K={spec:[1,0],ref:W,description:{builtin:!1,config:{resilience:0,scale:g1(X,Z),parameter:X?.config??{},resource:Object.fromEntries(Object.entries(X.resource??{}).map(([G,V])=>[G,E(V)]))},role:{},connector:Object.fromEntries(Object.entries(X.connect??{}).map(([G,V])=>[G,x1(Y,X,V)])),srv:{client:Object.fromEntries(Object.entries(X.srv?.client??{}).map(([G,V])=>[G,{protocol:V,inherited:!1}])),server:Object.fromEntries(Object.entries(X.srv?.server??{}).map(([G,V])=>{let _;if(typeof V==="string")_={port:80,inherited:!1,protocol:V};else _={...V,inherited:!1};return[G,_]})),duplex:Object.fromEntries(Object.entries(X.srv?.duplex??{}).map(([G,V])=>{let _;if(typeof V==="string")_={port:80,inherited:!1,protocol:V};else _={...V,inherited:!1};return[G,_]}))}}};return K.description.role=Object.fromEntries(Object.entries(X.role??{}).map(([G,V])=>[G,SY(Y,G,V,K)]).filter(([,G])=>UY.isSome(G)).map(([G,V])=>[G,V.value])),K}function $Y(Y,X,Z){let W=Z!==void 0?Z:p1(X,X.config?.scale);return{name:h(Y),up:b(Y),meta:{},config:{resilience:0,scale:g1(X,W),parameter:X.config?.parameter??{},resource:Object.fromEntries(Object.entries(X.config?.resource??{}).map(([Q,H])=>[Q,E(H)]))},artifact:H1(Y,X,W)}}function SY(Y,X,Z,W){if(M(Z.artifact)){let K=W.description.config?.scale?.detail?W.description.config.scale.detail[X]?.hsize:1;return OY({name:X,meta:Z.meta,config:{resilience:0,scale:{hsize:K},parameter:Z.artifact.config??{},resource:{}},artifact:W1(Y,Z.artifact,K)})}let Q=Z.artifact;Y=m1(Y,X),c1(Y,(()=>{if(S(Q)){let K=p1(Q,Z.scale);return $Y(Y,Q,K)}else return d1(Y,Q)})()),W.description.srv??={},W.description.srv.server??={},W.description.srv.client??={};for(let[,K]of Object.entries(W.description.connector??{})){for(let G of K.clients){if(G.role!==X)continue;let V={...G},_=`${G.role}.${G.channel}`,J=(Q?.srv?.client??{})[G.channel];W.description.srv.server[_]={inherited:!0,protocol:G.channel=="inbound"?"http":J},G.role="self",G.channel=_,Y.root.links??=[],Y.root.links.push({meta:{},s_d:h(Y),s_c:V.channel,t_d:b(Y),t_c:_})}for(let G of K.servers)for(let V of G.links)if(V.role===X){let _=`${V.role}.${V.channel}`,J=(Q?.srv?.server??{})[V.channel];if(J===void 0)J=(Q?.srv?.duplex??{})[V.channel];W.description.srv.client[_]={inherited:!0,protocol:typeof J==="string"?J:J.protocol,port:typeof J==="object"?J.port:void 0},Y.root.links??=[],Y.root.links.push({meta:{},s_d:b(Y),s_c:_,t_d:h(Y),t_c:V.channel}),V.role="self",V.channel=_}}return jY}import{isComponentArtifact as TY}from"@kumori/kdsl-lsp/language/generated/ast.js";var h=(Y)=>Y.path.join("."),b=(Y)=>Y.path.slice(0,-1).join("."),m1=(Y,X)=>({...Y,path:[...Y.path,X]}),c1=(Y,X)=>Y.root.deployments[h(Y)]=X;function i1(Y,X,Z){let W={cspec:"1.0",top:Z.name,deployments:{},links:[]},Q={svcs:Y,path:[Z.name],root:W,nodes:X};return W.deployments[Z.name]={name:Z.name,meta:Z.meta,config:{parameter:Z.config??{},resource:Object.fromEntries(Object.entries(Z.resource??{}).map(([H,K])=>[H,E(K)])),resilience:Z.resilience??0,scale:{detail:(()=>{if(M(Z.artifact)){if(typeof Z.scale!=="number")return{};let H=Q.nodes.get(Z.artifact),K="";if(H&&TY(H))K=H.name.value.$refText;if(K==="")throw Error("Unable to determine component name for scale detail.");return{[K]:{hsize:Z.scale}}}if(S(Z.artifact)){if(!Z.scale||typeof Z.scale!=="object"||Array.isArray(Z.scale))return{};let H=Z.scale,K=Object.entries(Z.artifact.role??{});return Object.fromEntries(K.map(([G])=>{if(!(G in H))return null;let V=H[G];if(typeof V!=="number")return null;return[G,{hsize:V}]}).filter((G)=>Boolean(G)))}return{}})()}},artifact:(()=>{if(M(Z.artifact))return v1(Q,Z.artifact,Z.scale);if(S(Z.artifact))return H1(Q,Z.artifact,Z.scale);if(l1(Z.artifact))return Q1(Z.artifact);throw Error("unknown artifact")})()},W}function M(Y){return"size"in Y}function S(Y){return!(M(Y)||l1(Y))}function l1(Y){return"id"in Y}function r1(Y,X,Z){let W=_1(Y,X,Z);if(s1.isErr(W))return W;let{nodes:Q,deployment:H}=W.value,K=JSON.stringify(i1(X,Q,H),null,2);return o1(K)}function _1(Y,X,Z){let W=X.validation.KumoriTypeSystem,[{Value:Q},H]=W.Eval(X.validation.KumoriValidations.ctx(),Z);if(H.length!==0){let _=[];for(let J of H){let w=J.node,z=n1.getDocument(w),q=w.$cstNode?.range.start||{line:0,character:0},I=`${z.uri.fsPath}:${q.line}:${q.character}: type error: ${J.message}`;Y.error(I),_.push(I)}return G1(_)}let K=new Map,G=RY({svcs:X,nodes:K},Q);if(s1.isErr(G)){let _=[];for(let J of G.err){let w=J.node,z=n1.getDocument(w),q=w.$cstNode?.range.start||{line:0,character:0},I=`${z.uri.fsPath}:${q.line}:${q.character}: json conversion error: ${J.message}`;Y.error(I),_.push(I)}return G1(_)}let V=NY.safeParse(G.value);if(!V.success){let _=[];for(let J of V.error.issues){let w=`${J.code}: ${J.path}: invalid deployment: ${J.message}`;Y.error(w),_.push(w)}return G1(_)}return o1({nodes:K,deployment:G.value})}EX();import{ModuleContext as $X}from"@kumori/kdsl-lsp/module/context.js";import{ListDependencies as jZ}from"@kumori/kdsl-lsp/module/dependency/list.js";import N from"assert";import{LocateDependency as OZ}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{Maybe as AZ}from"@kumori/kdsl-lsp/util/maybe.js";import{DependencyId as EZ}from"@kumori/kdsl-lsp/module/dependency/id.js";import z1 from"node:path";import{RegistryManager as H5}from"@kumori/kdsl-lsp/module/registry/manager.js";var K5=`
16
+ Generates a solution.json file for a specified Kumori package containing deployment definitions.
17
+ The command requires the path to the package as an argument, and optionally accepts a directory
18
+ path where the Kumori module is located. If the directory is not provided, the current working
19
+ directory is used by default.
20
+
21
+ Some usage examples:
22
+ kdsl build
23
+ kdsl build my-package
24
+ kdsl build my-package path/to/module
25
+
26
+ The generated solution.json file will be created in the package directory, containing all necessary
27
+ information for deploying the resources defined in the package's deployment artifacts.
28
+ `.trim();function PX(Y){if(Y.value)return Y.value;let X=Y.$document;if(X&&X.uri.path.endsWith(".h.kumori"))return;return Y.type}async function SX(Y,X,Z,W,Q){let H=X.shared.workspace.FileSystemProvider,K=await $X(H,IZ.file(z1.resolve(W)),Q);if(k.isErr(K)){let F=`error: ${K.err}`;return Y.error(F),C([F])}let G={FS:H,...K.value},V=await TX(G);if(V.size>0){let F=["error: missing modules"];Y.error(F[0]);for(let t of V){let j1=`+ ${t}`;Y.error(j1),F.push(j1)}let d="unable to build solution.json";return Y.error(d),F.push(d),C(F)}let _=await s(Y,X,K.value);if(k.isErr(_))return Y.error(`failed to check modules ${_.err.join(`
29
+ `)}`),_;let J=FZ.joinPath(K.value.Current.Root,Z),w=X.references.KumoriPackages.GetPackage(J);if(k.isErr(w)){let F=`error: failed to retrieve package: ${J.toString()}`;return Y.error(F),C([F])}let z=new Set(w.value.docs.map((F)=>F.uri.toString())),q=X.shared.workspace.IndexManager.allElements(wZ.$type,z).toArray();if(q.length<1){let F=`error: no deployment defined in ${J.toString()}`;return Y.error(F),C([F])}if(q.length>1){let F=`error: too many deployments in ${J.toString()}`;return Y.error(F),C([F])}let I=q[0],U=I.node;if(!zZ(U)){let F=`error: invalid target doc=${I.documentUri} location=${I.path}`;return Y.error(F),C([F])}let j=r1(Y,X,U);if(k.isErr(j))return j;let $=_1(Y,X,U);if(k.isErr($))return $;let{deployment:o}=$.value,B1=z1.join(J.fsPath,"solution.json");await Bun.write(B1,j.value),Y.info(`solution.json written to ${B1}`);let NX=JSON.parse(j.value),f=U.body.stmt.find((F)=>F.$type==="StructEntry"&&F.key==="name"),r=f&&f.$type==="StructEntry"?PX(f):void 0;N(f&&f.$type==="StructEntry"&&r&&BZ(r));let O=NX.deployments[r.value];if(M(o.artifact)){let F=Object.entries(O.artifact.description.role);N(F.length===1,"Component deployment should have exactly one role");let[d,t]=F[0];O={...O,artifact:t.artifact,config:{...O.config,scale:O.config?.scale?.detail?.[d]??{hsize:1}}}}if(O&&O.artifact)delete O.artifact.description,delete O.artifact.spec;let a=U.body.stmt.find((F)=>F.$type==="StructEntry"&&F.key==="artifact");N(a&&a.$type==="StructEntry");let R=PX(a);N(R&&qZ(R)),N(R.value.ref);let RX=O.artifact.ref,I1=k1(RX),F1=U.$container.imports.find((F)=>F.target.$refText.includes(I1))?.target.$refText?.substring(I1.length+1);if(O.artifact.ref.package=F1?F1:"",R.next)N(R.next.$type==="IdentifierExpression"),O.artifact.ref.name=R.next.value.$refText;else O.artifact.ref.name=R.value.$refText;if(O.artifact.ref.domain==="kumori.systems"&&O.artifact.ref.module.startsWith("builtins/"))O.artifact.ref.domain="kumori",O.artifact.ref.module="builtin";let U1=z1.join(J.fsPath,"deployment-config.json");return await Bun.write(Bun.file(U1),JSON.stringify(O,null,2)),Y.info(`deployment-config.json written to ${U1}`),UZ(void 0)}async function TX(Y,X=new Set){let Z=jZ(Y.Current);for(let[,W]of Z.entriesGroupedByKey()){N(W.length>0);let{target:Q,version:H}=W[0],K=await OZ(Y,Q,H);if(AZ.isNone(K)){X.add(EZ(Q,H));continue}let G=await $X.Move(Y,Y.FS,K.value.Root);N(k.isOk(G));let V={...Y,...G.value};await TX(V,X)}return X}async function z5(Y){let X=M1(Y.logger),Z=Y.package??".",W=Y.directory??Y.cwd??".",Q=Y.services;return await new PZ(Y.configPath).ensureIndexes(),await SX(X,Q,Z,W,Y.configPath)}export{z5 as build};
package/dist/lib/check.js CHANGED
@@ -1,45 +1,15 @@
1
- import { getLogger } from "./logger.js";
2
- import { Check as CheckImpl } from "../check/main.js";
3
- import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
4
- import { URI } from "langium";
5
- import { Result, Err } from "@kumori/kdsl-lsp/util/result.js";
6
- import path from "node:path";
7
- /**
8
- * Typecheck and validate a Kumori module.
9
- * Downloads dependencies unless skipDownload is true.
10
- *
11
- * @param options - Check command options
12
- * @returns Result with void on success, or string[] of errors
13
- *
14
- * @example
15
- * ```typescript
16
- * import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
17
- * import { NodeFileSystem } from 'langium/node'
18
- * import { check } from '@kumori/kdsl'
19
- *
20
- * const services = createKumoriServices(NodeFileSystem).Kumori
21
- *
22
- * const result = await check({
23
- * services,
24
- * directory: './my-module'
25
- * })
26
- *
27
- * if (result.ok) {
28
- * console.log('Check passed!')
29
- * } else {
30
- * console.error('Errors:', result.err)
31
- * }
32
- * ```
33
- */
34
- export async function check(options) {
35
- const log = getLogger(options.logger);
36
- const target = options.directory ?? options.cwd ?? ".";
37
- const svcs = options.services;
38
- const fs = svcs.shared.workspace.FileSystemProvider;
39
- const ctx = await ModuleContext(fs, URI.file(path.resolve(target)), options.configPath);
40
- if (Result.isErr(ctx)) {
41
- return Err([ctx.err]);
42
- }
43
- return await CheckImpl(log, svcs, ctx.value);
44
- }
45
- //# sourceMappingURL=check.js.map
1
+ import{createRequire as R1}from"node:module";var N1=Object.create;var{getPrototypeOf:O1,defineProperty:D,getOwnPropertyNames:F1}=Object;var E1=Object.prototype.hasOwnProperty;var qJ=(W,J,X)=>{X=W!=null?N1(O1(W)):{};let Y=J||!W||!W.__esModule?D(X,"default",{value:W,enumerable:!0}):X;for(let Z of F1(W))if(!E1.call(Y,Z))D(Y,Z,{get:()=>W[Z],enumerable:!0});return Y};var AJ=(W,J)=>()=>(J||W((J={exports:{}}).exports,J),J.exports);var v=(W,J)=>{for(var X in J)D(W,X,{get:J[X],enumerable:!0,configurable:!0,set:(Y)=>J[X]=()=>Y})};var R=(W,J)=>()=>(W&&(J=W(W=0)),J);var OJ=R1(import.meta.url),P1=Symbol.dispose||Symbol.for("Symbol.dispose"),f1=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),u=(W,J,X)=>{if(J!=null){if(typeof J!=="object"&&typeof J!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var Y;if(X)Y=J[f1];if(Y===void 0)Y=J[P1];if(typeof Y!=="function")throw TypeError("Object not disposable");W.push([X,Y,J])}else if(X)W.push([X]);return J},L=(W,J,X)=>{var Y=typeof SuppressedError==="function"?SuppressedError:function(Q,K,_,z){return z=Error(_),z.name="SuppressedError",z.error=Q,z.suppressed=K,z},Z=(Q)=>J=X?new Y(Q,J,"An error was suppressed during disposal"):(X=!0,Q),G=(Q)=>{while(Q=W.pop())try{var K=Q[1]&&Q[1].call(Q[2]);if(Q[0])return Promise.resolve(K).then(G,(_)=>(Z(_),G()))}catch(_){Z(_)}if(X)throw J};return G()};import{Result as D1}from"@kumori/kdsl-lsp/util/result.js";function f(W,J){if(D1.isErr(J)){for(let X of J.err)W.error(X);process.exit(1)}return J.value}var T=()=>{};import{ParseQuery as a}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as C,None as T1,Some as M1}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as j,Ok as M,Result as N}from"@kumori/kdsl-lsp/util/result.js";import{Version as r}from"@kumori/kdsl-lsp/module/version.js";import{ListDependencies as k1}from"@kumori/kdsl-lsp/module/dependency/list.js";import k from"assert";import{LocateDependency as e}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{ModuleContext as $1}from"@kumori/kdsl-lsp/module/context.js";import{MkdirTemp as y1}from"@kumori/kdsl-lsp/util/tmp.js";import{ValidateChecksum as x1}from"@kumori/kdsl-lsp/module/integrity/validate.js";import{URI as v1,UriUtils as u1}from"langium";import{cp as L1,mkdir as c1,rm as s}from"fs/promises";import{ForURL as p1}from"@kumori/kdsl-lsp/module/remote/factory.js";import{SemVer as t}from"@kumori/kdsl-lsp/util/semver.js";import{URL as d1}from"@kumori/kdsl-lsp/util/url.js";import{DependencyId as J1}from"@kumori/kdsl-lsp/module/dependency/id.js";async function W1(W){let J=new Map;return await Y1(W,J),J}async function X1(W,J){let X=new Map;console.log(J);for(let Y of J){let Z=a(Y,W.Locations.Config());if(C.isNone(Z)){let _=`invalid download query '${Y}': failed to parse`;X.set(Y,{...j(_),required:!0});continue}let G=r(Z.value.Version);if(C.isNone(G)){let _=`invalid download query '${Y}': invalid version specifier '${Z.value.Version}': failed to parse`;X.set(Y,{...j(_),required:!0});continue}if(!r.isSemVer(G.value)){let _=`invalid download query '${Y}': invalid version specifier '${Z.value.Version}': invalid semver`;X.set(Y,{...j(_),required:!0});continue}let Q=`${Z.value.Scheme}://${Z.value.Location}`,K=Z.value.Version;await Z1(W,Q,K,X)}return X}async function Y1(W,J){let X=k1(W.Current);for(let Y of X.keys()){let Z=X.get(Y);if(Z.length<1)continue;let{target:G,version:Q}=Z[0];await Z1(W,G,Q,J);let K=Z.reduce((z,V)=>z||V.interface===void 0,!1),_=J1(G,Q);k(J.has(_)),J.get(_).required||=K}}async function Z1(W,J,X,Y){let Z=J1(J,X);if(Y.has(Z))return;let G=await m1(W,J,X);if(Y.set(Z,{...G,required:!1}),N.isErr(G))return;let Q=await e(W,J,X);k(C.isSome(Q));let K=await $1.Move(W,W.FS,Q.value.Root);k(N.isOk(K)),W={...W,...K.value},await Y1(W,Y)}async function m1(W,J,X){let z=[];try{let Y=await e(W,J,X);if(N.isOk(Y))return M(T1);const Z=u(z,await y1(),1);let G=await i1(W,J,X,Z.Path);if(N.isErr(G))return j(`failed to fetch ${J}@${X}: ${G.err}`);let Q=await x1(W.SumDB,v1.file(Z.Path),W,J,G.value);if(N.isErr(Q))return Q;let K=`${J}@${X}`;let _=u1.joinPath(W.Locations.Cache(),K);await c1(_.fsPath,{recursive:!0});await s(_.fsPath,{recursive:!0,force:!0});await L1(Z.Path,_.fsPath,{recursive:!0});await s(Z.Path,{recursive:!0,force:!0});return M(M1(K))}catch(V){var S=V,U=1}finally{var B=L(z,S,U);B&&await B}}async function i1(W,J,X,Y){let Z=`${J}@${X}`,G=a(Z,W.Locations.Config());if(C.isNone(G))return j(`failed to resolve ${Z}: invalid download query`);let Q=t(G.value.Version),K=new d1(`${G.value.Scheme}://${G.value.Location}`),_=p1(W.Remotes,K);if(N.isErr(_))return j(`failed to resolve ${Z}': invalid remote ${K}: ${_.err}`);let z=await _.value.Versions(K);if(N.isErr(z))return j(`failed to read ${K}: ${z.err}`);let V=Q,S=z.value.filter((I)=>t.Compare(I,V)===0);if(S.length===0)return j(`no remote matches for ${K}@v${Q}`);if(S.length>1){let I=`[${S.map(String).join(", ")}]`;return j(`ambiguous match for ${K}@v${Q}: found ${I}`)}let U=S[0],B=await _.value.Get(K,U.toString(),Y);if(N.isErr(B))return j(`failed to fetch ${K}@${Q.toString()}: ${B.err}`);return M(U)}var G1=()=>{};var WJ={};v(WJ,{default:()=>e1,Register:()=>K1,Download:()=>h,Description:()=>z1,Action:()=>_1});import{ModuleContext as n1}from"@kumori/kdsl-lsp/module/context.js";import{SumDB as g1}from"@kumori/kdsl-lsp/module/integrity/sumdb.js";import{RemoteFetcherFactory as Q1}from"@kumori/kdsl-lsp/module/remote/factory.js";import{Maybe as l1}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as H1,Ok as o1,Result as F}from"@kumori/kdsl-lsp/util/result.js";import{URI as r1}from"langium";import{NodeFileSystem as s1}from"langium/node";import{createKumoriServices as t1}from"@kumori/kdsl-lsp/language/kumori.js";import{RegistryManager as a1}from"@kumori/kdsl-lsp/module/registry/manager.js";function K1(W,J){return W.command("download").alias("dl").summary(JJ).argument("[module...]").option("-q, --quiet","do not log warnings").description(z1).helpOption(!0).action(_1(J))}function _1(W){let J=(X)=>f(W,X);return async(X,Y,Z)=>{let G=Z?.optsWithGlobals()?.config,Q=t1(s1,G).Kumori;await new a1(G).ensureIndexes(),J(await h(W,Q,process.cwd(),X,Y,G))}}var e1,JJ="download modules to local cache",z1,h=async(W,J,X,Y,Z,G)=>{let Q=J.shared.workspace.FileSystemProvider,K=await n1(Q,r1.file(X),G);if(F.isErr(K))return H1([K.err]);let _=await g1.Open(K.value.Locations.Checksum());if(F.isErr(_))return F.mapErr(_,(U)=>[U]);let z;if(!Y.length)z=await W1({...K.value,FS:Q,Remotes:Q1(),SumDB:_.value});else z=await X1({...K.value,FS:Q,Remotes:Q1(),SumDB:_.value},Y);let V=[];for(let[U,B]of z){if(F.isOk(B)){if(l1.isSome(B.value))W.info(`Downloaded dependency ${U}`);continue}if(B.required)V.push(`${U}: ${B.err}`);else if(!Z.quiet)W.warn(`${U}: ${B.err}`),W.warn(`${U}: not required - continuing`)}if(Array.from(z.entries()).filter(([,U])=>F.isErr(U)&&U.required).length>0)return H1(V);return o1(void 0)};var V1=R(()=>{T();G1();e1={Register:K1};z1=`
2
+ Downloads the specified modules, which can be module patterns selecting depen-
3
+ dencies of the current module or module queries of the form path@version.
4
+
5
+ With no arguments, download applies to the modules needed to build the packages
6
+ in the current module.
7
+
8
+ The kdsl command will automatically download modules as needed during ordinary
9
+ execution. The "kdsl mod download" command is useful mainly for pre-filling the
10
+ local cache.
11
+
12
+ By default, download writes nothing to standard output. It may print progress
13
+ messages and errors to standard error.
14
+ `.trim()});var UJ={};v(UJ,{default:()=>VJ,Summary:()=>w1,Register:()=>I1,RawCheck:()=>q1,Description:()=>S1,Check:()=>b,Action:()=>j1});import{createKumoriServices as XJ}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as YJ,UriUtils as y}from"langium";import{NodeFileSystem as ZJ}from"langium/node";import{DiagnosticSeverity as U1}from"vscode-languageserver";import{Err as $,Ok as B1,Result as E}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as GJ}from"@kumori/kdsl-lsp/module/context.js";import QJ from"node:path";import{RegistryManager as HJ}from"@kumori/kdsl-lsp/module/registry/manager.js";function I1(W,J){return W.command("check").argument("[directory]","directory containing a Kumori module").description(S1).summary(w1).action(j1(J))}function j1(W){return async(J,X,Y)=>{await new HJ(Y?.optsWithGlobals()?.config).ensureIndexes();let G=XJ(ZJ).Kumori,Q=G.shared.workspace.FileSystemProvider,K=(V)=>f(W,V),_=Y?.optsWithGlobals()?.config,z=K(E.mapErr(await GJ(Q,YJ.file(QJ.resolve(J??".")),_),(V)=>[V]));K(await b(W,G,z))}}function KJ(W,J){return`lexer error: ${y.relative(process.cwd(),W.uri.fsPath)}:${J.line||1}:${J.column||1}: ${J.message}`}function zJ(W,J){return`parser error: ${y.relative(process.cwd(),W.uri.fsPath)}:${J.token.startLine||1}:${J.token.startColumn||1}: ${J.message}`}function _J(W,J){return`diagnostic error: ${y.relative(process.cwd(),W.uri.fsPath)}:${J.range.start.line+1}:${J.range.start.character+1}: ${J.message}`}var w1="typecheck and validate a module",S1,b=async(W,J,X)=>{let Y=X.Current.Root,Z=await h(W,J,Y.fsPath,[],{quiet:!0},X.Locations.Config());if(E.isErr(Z))return Z;let G=await q1(J,X);if(E.isErr(G)){let Q=G.err.warnings.concat(G.err.errors);return $(Q)}return B1(void 0)},q1=async(W,J)=>{let X={errors:[],warnings:[]},Y=W.shared.workspace.FileSystemProvider,Z=J.Current.Root,G=await E.tryCatchAsync(()=>Y.readDirectory(Z));if(E.isErr(G)){let z=""+G.err;if(G.err instanceof Error)z=G.err.message;return X.errors.push(`failed to read directory '${Z.fsPath}': ${z}`),$(X)}await W.shared.workspace.WorkspaceManager.initializeWorkspace([{name:"root",uri:Z.toString()}]);let K=W.shared.workspace.LangiumDocuments;await W.shared.workspace.DocumentBuilder.build(K.all.toArray(),{validation:!0});for(let z of W.shared.workspace.LangiumDocuments.all){for(let V of z.parseResult.lexerErrors)X.errors.push(KJ(z,V));for(let V of z.parseResult.parserErrors)X.errors.push(zJ(z,V));for(let V of z.diagnostics||[]){let S=_J(z,V);if(V.severity===U1.Error)X.errors.push(S);if(V.severity===U1.Warning)X.warnings.push(S)}}if(X.errors.length>0)return $(X);return B1(void 0)},VJ;var A1=R(()=>{V1();T();S1=`
15
+ `.trim();VJ={Register:I1}});var H=function(W){return W.info="info",W.warn="warn",W.error="error",W.debug="debug",W.trace="trace",W.fatal="fatal",W}({}),P={[H.trace]:10,[H.debug]:20,[H.info]:30,[H.warn]:40,[H.error]:50,[H.fatal]:60},C1={10:H.trace,20:H.debug,30:H.info,40:H.warn,50:H.error,60:H.fatal};var w=function(W){return W.transformLogLevel="transformLogLevel",W.onBeforeDataOut="onBeforeDataOut",W.shouldSendToLogger="shouldSendToLogger",W.onMetadataCalled="onMetadataCalled",W.onBeforeMessageOut="onBeforeMessageOut",W.onContextCalled="onContextCalled",W}({});var c=class W{context={};hasContext=!1;setContext(J){if(!J){this.context={},this.hasContext=!1;return}this.context=J,this.hasContext=!0}appendContext(J){this.context={...this.context,...J},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(J){if(J===void 0){this.context={},this.hasContext=!1;return}let X=Array.isArray(J)?J:[J];for(let Y of X)delete this.context[Y];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:J,childContextManager:X}){if(J.hasContextData()){let Y=J.getContext();X.setContext({...Y})}}clone(){let J=new W;return J.setContext({...this.context}),J.hasContext=this.hasContext,J}},p=class W{setContext(J){}appendContext(J){}getContext(){return{}}hasContextData(){return!1}clearContext(J){}onChildLoggerCreated(J){}clone(){return new W}};var d=class W{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(J){let X=P[J];for(let Y of Object.values(H)){let Z=Y,G=P[Y];this.logLevelEnabledStatus[Z]=G>=X}}enableIndividualLevel(J){let X=J;if(X in this.logLevelEnabledStatus)this.logLevelEnabledStatus[X]=!0}disableIndividualLevel(J){let X=J;if(X in this.logLevelEnabledStatus)this.logLevelEnabledStatus[X]=!1}isLevelEnabled(J){let X=J;return this.logLevelEnabledStatus[X]}enableLogging(){for(let J of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[J]=!0}disableLogging(){for(let J of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[J]=!1}onChildLoggerCreated({parentLogLevelManager:J,childLogLevelManager:X}){let Y=J.logLevelEnabledStatus;if(X instanceof W)X.logLevelEnabledStatus={...Y}}clone(){let J=new W;return J.logLevelEnabledStatus={...this.logLevelEnabledStatus},J}},m=class W{setLevel(J){}enableIndividualLevel(J){}disableIndividualLevel(J){}isLevelEnabled(J){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(J){}clone(){return new W}};var h1=[w.onBeforeDataOut,w.onMetadataCalled,w.onBeforeMessageOut,w.transformLogLevel,w.shouldSendToLogger,w.onContextCalled],i=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(W){this.idToPlugin={},this.mapPlugins(W),this.indexPlugins()}mapPlugins(W){for(let J of W){if(!J.id)J.id=Date.now().toString()+Math.random().toString();if(this.idToPlugin[J.id])throw Error(`[LogLayer] Plugin with id ${J.id} already exists.`);J.registeredAt=Date.now(),this.idToPlugin[J.id]=J}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let W=Object.values(this.idToPlugin).sort((J,X)=>J.registeredAt-X.registeredAt);for(let J of W){if(J.disabled)return;for(let X of h1)if(J[X]&&J.id)this[X].push(J.id)}}hasPlugins(W){return this[W].length>0}countPlugins(W){if(W)return this[W].length;return Object.keys(this.idToPlugin).length}addPlugins(W){this.mapPlugins(W),this.indexPlugins()}enablePlugin(W){let J=this.idToPlugin[W];if(J)J.disabled=!1;this.indexPlugins()}disablePlugin(W){let J=this.idToPlugin[W];if(J)J.disabled=!0;this.indexPlugins()}removePlugin(W){delete this.idToPlugin[W],this.indexPlugins()}runTransformLogLevel(W,J){let X=null;for(let Y of this.transformLogLevel){let Z=this.idToPlugin[Y];if(Z.transformLogLevel){let G=Z.transformLogLevel({data:W.data,logLevel:W.logLevel,messages:W.messages,error:W.error,metadata:W.metadata,context:W.context},J);if(G!==null&&G!==void 0&&G!==!1)X=G}}return X!==null&&X!==void 0&&X!==!1?X:W.logLevel}runOnBeforeDataOut(W,J){let X={...W};for(let Y of this.onBeforeDataOut){let Z=this.idToPlugin[Y];if(Z.onBeforeDataOut){let G=Z.onBeforeDataOut({data:X.data,logLevel:X.logLevel,error:X.error,metadata:X.metadata,context:X.context},J);if(G){if(!X.data)X.data={};Object.assign(X.data,G)}}}return X.data}runShouldSendToLogger(W,J){return!this.shouldSendToLogger.some((X)=>{return!this.idToPlugin[X].shouldSendToLogger?.(W,J)})}runOnMetadataCalled(W,J){let X={...W};for(let Y of this.onMetadataCalled){let Z=this.idToPlugin[Y].onMetadataCalled?.(X,J);if(Z)X=Z;else return null}return X}runOnBeforeMessageOut(W,J){let X=[...W.messages];for(let Y of this.onBeforeMessageOut){let Z=this.idToPlugin[Y].onBeforeMessageOut?.({messages:X,logLevel:W.logLevel},J);if(Z)X=Z}return X}runOnContextCalled(W,J){let X={...W};for(let Y of this.onContextCalled){let Z=this.idToPlugin[Y].onContextCalled?.(X,J);if(Z)X=Z;else return null}return X}},l=class W{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_config;constructor(J){if(this._config={...J,enabled:J.enabled??!0},this.contextManager=new c,this.logLevelManager=new d,!this._config.enabled)this.disableLogging();if(this.pluginManager=new i([...J.plugins||[],...O.pluginsToInit]),!this._config.errorFieldName)this._config.errorFieldName="err";if(!this._config.copyMsgOnOnlyError)this._config.copyMsgOnOnlyError=!1;if(this._initializeTransports(this._config.transport),O.logLayerHandlers.length>0)O.logLayerHandlers.forEach((X)=>{if(X.onConstruct)X.onConstruct(this,J)})}withContextManager(J){if(this.contextManager&&typeof this.contextManager[Symbol.dispose]==="function")this.contextManager[Symbol.dispose]();return this.contextManager=J,this}getContextManager(){return this.contextManager}withLogLevelManager(J){if(this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==="function")this.logLevelManager[Symbol.dispose]();return this.logLevelManager=J,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(J){if(this.idToTransport){for(let X in this.idToTransport)if(this.idToTransport[X]&&typeof this.idToTransport[X][Symbol.dispose]==="function")this.idToTransport[X][Symbol.dispose]()}if(this.hasMultipleTransports=Array.isArray(J)&&J.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(J)?J[0]:J,Array.isArray(J))this.idToTransport=J.reduce((X,Y)=>{return X[Y.id]=Y,X},{});else this.idToTransport={[J.id]:J}}withPrefix(J){let X=this.child();return X._config.prefix=J,X}withContext(J){let X=J;if(!J){if(this._config.consoleDebug)console.debug("[LogLayer] withContext was called with no context; dropping.");return this}if(this.pluginManager.hasPlugins(w.onContextCalled)){if(X=this.pluginManager.runOnContextCalled(J,this),!X){if(this._config.consoleDebug)console.debug("[LogLayer] Context was dropped due to plugin returning falsy value.");return this}}return this.contextManager.appendContext(X),this}clearContext(J){return this.contextManager.clearContext(J),this}getContext(){return this.contextManager.getContext()}addPlugins(J){this.pluginManager.addPlugins(J)}enablePlugin(J){this.pluginManager.enablePlugin(J)}disablePlugin(J){this.pluginManager.disablePlugin(J)}removePlugin(J){this.pluginManager.removePlugin(J)}withMetadata(J){return new g(this).withMetadata(J)}withError(J){return new g(this).withError(J)}child(){let J=new W({...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:J.contextManager,parentLogger:this,childLogger:J}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:J.logLevelManager,parentLogger:this,childLogger:J}),J}withFreshTransports(J){return this._config.transport=J,this._initializeTransports(J),this}addTransport(J){let X=Array.isArray(J)?J:[J],Y=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],Z=new Set(X.map((Q)=>Q.id));for(let Q of X){let K=this.idToTransport[Q.id];if(K&&typeof K[Symbol.dispose]==="function")K[Symbol.dispose]()}let G=[...Y.filter((Q)=>!Z.has(Q.id)),...X];this._config.transport=G;for(let Q of X)this.idToTransport[Q.id]=Q;return this.hasMultipleTransports=G.length>1,this.singleTransport=this.hasMultipleTransports?null:G[0],this}removeTransport(J){let X=this.idToTransport[J];if(!X)return!1;if(typeof X[Symbol.dispose]==="function")X[Symbol.dispose]();delete this.idToTransport[J];let Y=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter((Z)=>Z.id!==J);return this._config.transport=Y.length===1?Y[0]:Y,this.hasMultipleTransports=Y.length>1,this.singleTransport=this.hasMultipleTransports?null:Y[0]||null,!0}withFreshPlugins(J){return this._config.plugins=J,this.pluginManager=new i(J),this}withPluginManager(J){return this.pluginManager=J,this}errorOnly(J,X){let Y=X?.logLevel||H.error;if(!this.isLevelEnabled(Y))return;let{copyMsgOnOnlyError:Z}=this._config,G={logLevel:Y,err:J};if((Z&&X?.copyMsg!==!1||X?.copyMsg===!0)&&J?.message)G.params=[J.message];this._formatLog(G)}metadataOnly(J,X=H.info){if(!this.isLevelEnabled(X))return;let{muteMetadata:Y,consoleDebug:Z}=this._config;if(Y)return;if(!J){if(Z)console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let G=J;if(this.pluginManager.hasPlugins(w.onMetadataCalled)){if(G=this.pluginManager.runOnMetadataCalled(J,this),!G){if(Z)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}}let Q={logLevel:X,metadata:G};this._formatLog(Q)}info(...J){if(!this.isLevelEnabled(H.info))return;this._formatMessage(J),this._formatLog({logLevel:H.info,params:J})}warn(...J){if(!this.isLevelEnabled(H.warn))return;this._formatMessage(J),this._formatLog({logLevel:H.warn,params:J})}error(...J){if(!this.isLevelEnabled(H.error))return;this._formatMessage(J),this._formatLog({logLevel:H.error,params:J})}debug(...J){if(!this.isLevelEnabled(H.debug))return;this._formatMessage(J),this._formatLog({logLevel:H.debug,params:J})}trace(...J){if(!this.isLevelEnabled(H.trace))return;this._formatMessage(J),this._formatLog({logLevel:H.trace,params:J})}fatal(...J){if(!this.isLevelEnabled(H.fatal))return;this._formatMessage(J),this._formatLog({logLevel:H.fatal,params:J})}raw(J){if(!this.isLevelEnabled(J.logLevel))return;let X={logLevel:J.logLevel,params:J.messages,metadata:J.metadata,err:J.error,context:J.context};this._formatMessage(J.messages),this._formatLog(X)}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(J){return this.logLevelManager.enableIndividualLevel(J),this}disableIndividualLevel(J){return this.logLevelManager.disableIndividualLevel(J),this}setLevel(J){return this.logLevelManager.setLevel(J),this}isLevelEnabled(J){return this.logLevelManager.isLevelEnabled(J)}formatContext(J){let{contextFieldName:X,muteContext:Y}=this._config;if(J&&Object.keys(J).length>0&&!Y){if(X)return{[X]:{...J}};return{...J}}return{}}formatMetadata(J=null){let{metadataFieldName:X,muteMetadata:Y}=this._config;if(J&&!Y){if(X)return{[X]:{...J}};return{...J}}return{}}getLoggerInstance(J){let X=this.idToTransport[J];if(!X)return;return X.getLoggerInstance()}_formatMessage(J=[]){let{prefix:X}=this._config;if(X&&typeof J[0]==="string")J[0]=`${X} ${J[0]}`}_formatLog({logLevel:J,params:X=[],metadata:Y=null,err:Z,context:G=null}){let{errorSerializer:Q,errorFieldInMetadata:K,muteContext:_,contextFieldName:z,metadataFieldName:V,errorFieldName:S}=this._config,U=G!==null?G:this.contextManager.getContext(),B=!!Y||(_?!1:G!==null?Object.keys(G).length>0:this.contextManager.hasContextData()),I={};if(B)if(z&&z===V){let q=this.formatContext(U)[z],A=this.formatMetadata(Y)[V];I={[z]:{...q,...A}}}else I={...this.formatContext(U),...this.formatMetadata(Y)};if(Z){let q=Q?Q(Z):Z;if(K&&Y&&V)if(I?.[V])I[V][S]=q;else I={...I,[V]:{[S]:q}};else if(K&&!Y&&V)I={...I,[V]:{[S]:q}};else I={...I,[S]:q};B=!0}if(this.pluginManager.hasPlugins(w.onBeforeDataOut)){if(I=this.pluginManager.runOnBeforeDataOut({data:B?I:void 0,logLevel:J,error:Z,metadata:Y,context:U},this),I&&!B)B=!0}if(this.pluginManager.hasPlugins(w.onBeforeMessageOut))X=this.pluginManager.runOnBeforeMessageOut({messages:[...X],logLevel:J},this);if(this.pluginManager.hasPlugins(w.transformLogLevel))J=this.pluginManager.runTransformLogLevel({data:B?I:void 0,logLevel:J,messages:[...X],error:Z,metadata:Y,context:U},this);if(this.hasMultipleTransports){let q=this._config.transport.filter((A)=>A.enabled).map(async(A)=>{let x=J;if(this.pluginManager.hasPlugins(w.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...X],data:B?I:void 0,logLevel:x,transportId:A.id,error:Z,metadata:Y,context:U},this))return}return A._sendToLogger({logLevel:x,messages:[...X],data:B?I:void 0,hasData:B,error:Z,metadata:Y,context:U})});Promise.all(q).catch((A)=>{if(this._config.consoleDebug)console.error("[LogLayer] Error executing transports:",A)})}else{if(!this.singleTransport?.enabled)return;if(this.pluginManager.hasPlugins(w.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...X],data:B?I:void 0,logLevel:J,transportId:this.singleTransport.id,error:Z,metadata:Y,context:U},this))return}this.singleTransport._sendToLogger({logLevel:J,messages:[...X],data:B?I:void 0,hasData:B,error:Z,metadata:Y,context:U})}}},n=class{debug(...W){}error(...W){}info(...W){}trace(...W){}warn(...W){}fatal(...W){}enableLogging(){return this}disableLogging(){return this}withMetadata(W){return this}withError(W){return this}},MJ=class{mockLogBuilder=new n;mockContextManager=new p;mockLogLevelManager=new m;info(...W){}warn(...W){}error(...W){}debug(...W){}trace(...W){}fatal(...W){}raw(W){}getLoggerInstance(W){}errorOnly(W,J){}metadataOnly(W,J){}addPlugins(W){}removePlugin(W){}enablePlugin(W){}disablePlugin(W){}withPrefix(W){return this}withContext(W){return this}withError(W){return this.mockLogBuilder.withError(W)}withMetadata(W){return this.mockLogBuilder.withMetadata(W)}getContext(){return{}}clearContext(W){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(W){return this}addTransport(W){return this}removeTransport(W){return!0}withFreshPlugins(W){return this}withContextManager(W){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(W){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(W){this.mockLogBuilder=W}enableIndividualLevel(W){return this}disableIndividualLevel(W){return this}setLevel(W){return this}isLevelEnabled(W){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new n}};var O={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var g=class{err;metadata;structuredLogger;hasMetadata;pluginManager;constructor(W){if(this.err=null,this.metadata={},this.structuredLogger=W,this.hasMetadata=!1,this.pluginManager=W.pluginManager,O.logBuilderHandlers.length>0)O.logBuilderHandlers.forEach((J)=>{if(J.onConstruct)J.onConstruct(this,W)})}withMetadata(W){let{pluginManager:J,structuredLogger:{_config:{consoleDebug:X}}}=this;if(!W){if(X)console.debug("[LogLayer] withMetadata was called with no metadata; dropping.");return this}let Y=W;if(J.hasPlugins(w.onMetadataCalled)){if(Y=J.runOnMetadataCalled(W,this.structuredLogger),!Y){if(X)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return this}}return this.metadata={...this.metadata,...Y},this.hasMetadata=!0,this}withError(W){return this.err=W,this}info(...W){if(!this.structuredLogger.isLevelEnabled(H.info))return;this.structuredLogger._formatMessage(W),this.formatLog(H.info,W)}warn(...W){if(!this.structuredLogger.isLevelEnabled(H.warn))return;this.structuredLogger._formatMessage(W),this.formatLog(H.warn,W)}error(...W){if(!this.structuredLogger.isLevelEnabled(H.error))return;this.structuredLogger._formatMessage(W),this.formatLog(H.error,W)}debug(...W){if(!this.structuredLogger.isLevelEnabled(H.debug))return;this.structuredLogger._formatMessage(W),this.formatLog(H.debug,W)}trace(...W){if(!this.structuredLogger.isLevelEnabled(H.trace))return;this.structuredLogger._formatMessage(W),this.formatLog(H.trace,W)}fatal(...W){if(!this.structuredLogger.isLevelEnabled(H.fatal))return;this.structuredLogger._formatMessage(W),this.formatLog(H.fatal,W)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(W,J){let{muteMetadata:X}=this.structuredLogger._config,Y=X?!1:this.hasMetadata;this.structuredLogger._formatLog({logLevel:W,params:J,metadata:Y?this.metadata:null,err:this.err})}};function b1(){return new l({transport:{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}})}function o(W){return W??b1()}A1();import{ModuleContext as BJ}from"@kumori/kdsl-lsp/module/context.js";import{URI as IJ}from"langium";import{Result as wJ,Err as SJ}from"@kumori/kdsl-lsp/util/result.js";import jJ from"node:path";async function dW(W){let J=o(W.logger),X=W.directory??W.cwd??".",Y=W.services,Z=Y.shared.workspace.FileSystemProvider,G=await BJ(Z,IJ.file(jJ.resolve(X)),W.configPath);if(wJ.isErr(G))return SJ([G.err]);return await b(J,Y,G.value)}export{dW as check};
package/dist/lib/clean.js CHANGED
@@ -1,39 +1 @@
1
- import { getLogger } from "./logger.js";
2
- import { TempCache } from "@kumori/kdsl-lsp/util/tmp.js";
3
- import { rm } from "fs/promises";
4
- import { Ok, Err } from "@kumori/kdsl-lsp/util/result.js";
5
- /**
6
- * Remove cached files.
7
- *
8
- * The kdsl command builds most artifacts in a temporary directory,
9
- * so clean is mainly concerned with files left by manual invocations.
10
- *
11
- * @param options - Clean command options
12
- * @returns Result with void on success, or string[] of errors
13
- *
14
- * @example
15
- * ```typescript
16
- * import { clean } from '@kumori/kdsl'
17
- *
18
- * const result = await clean()
19
- *
20
- * if (result.ok) {
21
- * console.log('Cache cleaned!')
22
- * } else {
23
- * console.error('Errors:', result.err)
24
- * }
25
- * ```
26
- */
27
- export async function clean(options = {}) {
28
- const log = getLogger(options.logger);
29
- try {
30
- const location = await TempCache();
31
- log.info(location.fsPath);
32
- await rm(location.fsPath, { force: true, recursive: true });
33
- return Ok(undefined);
34
- }
35
- catch (err) {
36
- return Err([String(err)]);
37
- }
38
- }
39
- //# sourceMappingURL=clean.js.map
1
+ import{createRequire as y}from"node:module";var k=Object.create;var{getPrototypeOf:T,defineProperty:F,getOwnPropertyNames:$}=Object;var x=Object.prototype.hasOwnProperty;var g=(H,q,J)=>{J=H!=null?k(T(H)):{};let Q=q||!H||!H.__esModule?F(J,"default",{value:H,enumerable:!0}):J;for(let X of $(H))if(!x.call(Q,X))F(Q,X,{get:()=>H[X],enumerable:!0});return Q};var o=(H,q)=>()=>(q||H((q={exports:{}}).exports,q),q.exports);var l=(H,q)=>{for(var J in q)F(H,J,{get:q[J],enumerable:!0,configurable:!0,set:(Q)=>q[J]=()=>Q})};var r=(H,q)=>()=>(H&&(q=H(H=0)),q);var s=y(import.meta.url),u=Symbol.dispose||Symbol.for("Symbol.dispose"),v=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),a=(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[v];if(Q===void 0)Q=q[u];if(typeof Q!=="function")throw TypeError("Object not disposable");H.push([J,Q,q])}else if(J)H.push([J]);return q},e=(H,q,J)=>{var Q=typeof SuppressedError==="function"?SuppressedError:function(Z,V,R,z){return z=Error(R),z.name="SuppressedError",z.error=Z,z.suppressed=V,z},X=(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)=>(X(R),Y()))}catch(R){X(R)}if(J)throw q};return Y()};var W=function(H){return H.info="info",H.warn="warn",H.error="error",H.debug="debug",H.trace="trace",H.fatal="fatal",H}({}),E={[W.trace]:10,[W.debug]:20,[W.info]:30,[W.warn]:40,[W.error]:50,[W.fatal]:60},c={10:W.trace,20:W.debug,30:W.info,40:W.warn,50:W.error,60:W.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 A=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}},O=class H{setContext(q){}appendContext(q){}getContext(){return{}}hasContextData(){return!1}clearContext(q){}onChildLoggerCreated(q){}clone(){return new H}};var P=class H{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(q){let J=E[q];for(let Q of Object.values(W)){let X=Q,Y=E[Q];this.logLevelEnabledStatus[X]=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}},D=class H{setLevel(q){}enableIndividualLevel(q){}disableIndividualLevel(q){}isLevelEnabled(q){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(q){}clone(){return new H}};var d=[K.onBeforeDataOut,K.onMetadataCalled,K.onBeforeMessageOut,K.transformLogLevel,K.shouldSendToLogger,K.onContextCalled],h=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 d)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 X=this.idToPlugin[Q];if(X.transformLogLevel){let Y=X.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 X=this.idToPlugin[Q];if(X.onBeforeDataOut){let Y=X.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 X=this.idToPlugin[Q].onMetadataCalled?.(J,q);if(X)J=X;else return null}return J}runOnBeforeMessageOut(H,q){let J=[...H.messages];for(let Q of this.onBeforeMessageOut){let X=this.idToPlugin[Q].onBeforeMessageOut?.({messages:J,logLevel:H.logLevel},q);if(X)J=X}return J}runOnContextCalled(H,q){let J={...H};for(let Q of this.onContextCalled){let X=this.idToPlugin[Q].onContextCalled?.(J,q);if(X)J=X;else return null}return J}},M=class H{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_config;constructor(q){if(this._config={...q,enabled:q.enabled??!0},this.contextManager=new A,this.logLevelManager=new P,!this._config.enabled)this.disableLogging();if(this.pluginManager=new h([...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 C(this).withMetadata(q)}withError(q){return new C(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],X=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)=>!X.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((X)=>X.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 h(q),this}withPluginManager(q){return this.pluginManager=q,this}errorOnly(q,J){let Q=J?.logLevel||W.error;if(!this.isLevelEnabled(Q))return;let{copyMsgOnOnlyError:X}=this._config,Y={logLevel:Q,err:q};if((X&&J?.copyMsg!==!1||J?.copyMsg===!0)&&q?.message)Y.params=[q.message];this._formatLog(Y)}metadataOnly(q,J=W.info){if(!this.isLevelEnabled(J))return;let{muteMetadata:Q,consoleDebug:X}=this._config;if(Q)return;if(!q){if(X)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(X)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(W.info))return;this._formatMessage(q),this._formatLog({logLevel:W.info,params:q})}warn(...q){if(!this.isLevelEnabled(W.warn))return;this._formatMessage(q),this._formatLog({logLevel:W.warn,params:q})}error(...q){if(!this.isLevelEnabled(W.error))return;this._formatMessage(q),this._formatLog({logLevel:W.error,params:q})}debug(...q){if(!this.isLevelEnabled(W.debug))return;this._formatMessage(q),this._formatLog({logLevel:W.debug,params:q})}trace(...q){if(!this.isLevelEnabled(W.trace))return;this._formatMessage(q),this._formatLog({logLevel:W.trace,params:q})}fatal(...q){if(!this.isLevelEnabled(W.fatal))return;this._formatMessage(q),this._formatLog({logLevel:W.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:X,context:Y=null}){let{errorSerializer:Z,errorFieldInMetadata:V,muteContext:R,contextFieldName:z,metadataFieldName:S,errorFieldName:j}=this._config,w=Y!==null?Y:this.contextManager.getContext(),U=!!Q||(R?!1:Y!==null?Object.keys(Y).length>0:this.contextManager.hasContextData()),G={};if(U)if(z&&z===S){let _=this.formatContext(w)[z],I=this.formatMetadata(Q)[S];G={[z]:{..._,...I}}}else G={...this.formatContext(w),...this.formatMetadata(Q)};if(X){let _=Z?Z(X):X;if(V&&Q&&S)if(G?.[S])G[S][j]=_;else G={...G,[S]:{[j]:_}};else if(V&&!Q&&S)G={...G,[S]:{[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:X,metadata:Q,context:w},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:X,metadata:Q,context:w},this);if(this.hasMultipleTransports){let _=this._config.transport.filter((I)=>I.enabled).map(async(I)=>{let N=q;if(this.pluginManager.hasPlugins(K.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...J],data:U?G:void 0,logLevel:N,transportId:I.id,error:X,metadata:Q,context:w},this))return}return I._sendToLogger({logLevel:N,messages:[...J],data:U?G:void 0,hasData:U,error:X,metadata:Q,context:w})});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:X,metadata:Q,context:w},this))return}this.singleTransport._sendToLogger({logLevel:q,messages:[...J],data:U?G:void 0,hasData:U,error:X,metadata:Q,context:w})}}},f=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}},Uq=class{mockLogBuilder=new f;mockContextManager=new O;mockLogLevelManager=new D;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 f}};var B={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var C=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(W.info))return;this.structuredLogger._formatMessage(H),this.formatLog(W.info,H)}warn(...H){if(!this.structuredLogger.isLevelEnabled(W.warn))return;this.structuredLogger._formatMessage(H),this.formatLog(W.warn,H)}error(...H){if(!this.structuredLogger.isLevelEnabled(W.error))return;this.structuredLogger._formatMessage(H),this.formatLog(W.error,H)}debug(...H){if(!this.structuredLogger.isLevelEnabled(W.debug))return;this.structuredLogger._formatMessage(H),this.formatLog(W.debug,H)}trace(...H){if(!this.structuredLogger.isLevelEnabled(W.trace))return;this.structuredLogger._formatMessage(H),this.formatLog(W.trace,H)}fatal(...H){if(!this.structuredLogger.isLevelEnabled(W.fatal))return;this.structuredLogger._formatMessage(H),this.formatLog(W.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 p(){return new M({transport:{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}})}function b(H){return H??p()}import{TempCache as L}from"@kumori/kdsl-lsp/util/tmp.js";import{rm as m}from"fs/promises";import{Ok as i,Err as n}from"@kumori/kdsl-lsp/util/result.js";async function Aq(H={}){let q=b(H.logger);try{let J=await L();return q.info(J.fsPath),await m(J.fsPath,{force:!0,recursive:!0}),i(void 0)}catch(J){return n([String(J)])}}export{Aq as clean};
@@ -23,10 +23,7 @@ export interface DeploymentGenOptions extends LibraryOptions {
23
23
  * import { NodeFileSystem } from 'langium/node'
24
24
  * import { generateDeployment } from '@kumori/kdsl'
25
25
  *
26
- * const services = createKumoriServices(NodeFileSystem).Kumori
27
- *
28
26
  * await generateDeployment({
29
- * services,
30
27
  * input: 'path/to/deployment-config.json',
31
28
  * output: 'path/to/output/directory'
32
29
  * })
@@ -12,10 +12,7 @@ import { GenDeployment } from "../deployment/gen/main.js";
12
12
  * import { NodeFileSystem } from 'langium/node'
13
13
  * import { generateDeployment } from '@kumori/kdsl'
14
14
  *
15
- * const services = createKumoriServices(NodeFileSystem).Kumori
16
- *
17
15
  * await generateDeployment({
18
- * services,
19
16
  * input: 'path/to/deployment-config.json',
20
17
  * output: 'path/to/output/directory'
21
18
  * })
@@ -25,7 +22,6 @@ export async function generateDeployment(options) {
25
22
  const log = getLogger(options.logger);
26
23
  const inputPath = options.input ?? "deployment-config.json";
27
24
  const outputDir = options.output ?? options.cwd ?? ".";
28
- const svcs = options.services;
29
- return await GenDeployment(log, svcs, inputPath, outputDir);
25
+ return await GenDeployment(log, inputPath, outputDir);
30
26
  }
31
27
  //# sourceMappingURL=deployment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../src/lib/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAgBzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAA6B;IAE7B,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAA;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAA;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAA;IAE7B,OAAO,MAAM,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAC7D,CAAC"}
1
+ {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../src/lib/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAgBzD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAA6B;IAE7B,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAA;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAA;IAEtD,OAAO,MAAM,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AACvD,CAAC"}