puls-dev 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/resource.d.ts
CHANGED
|
@@ -41,4 +41,10 @@ export declare abstract class BaseBuilder {
|
|
|
41
41
|
destroy(): Promise<any>;
|
|
42
42
|
abstract deploy(): Promise<any>;
|
|
43
43
|
}
|
|
44
|
-
export
|
|
44
|
+
export type DistributeArgs<Args extends any[]> = {
|
|
45
|
+
[K in keyof Args]: Args[K] | Args[K][];
|
|
46
|
+
};
|
|
47
|
+
export type BuilderGroup<B extends BaseBuilder> = B[] & {
|
|
48
|
+
[K in keyof B]: B[K] extends (...args: infer Args) => any ? (...args: DistributeArgs<Args>) => BuilderGroup<B> : B[K];
|
|
49
|
+
};
|
|
50
|
+
export declare function createBuilderArray<T extends BaseBuilder>(builders: T[]): BuilderGroup<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VMBuilder } from "./vm.js";
|
|
2
2
|
import { TemplateBuilder } from "./template.js";
|
|
3
|
+
import { BuilderGroup } from "../../core/resource.js";
|
|
3
4
|
export declare const Proxmox: {
|
|
4
5
|
init: (opts: {
|
|
5
6
|
url: string;
|
|
@@ -12,7 +13,7 @@ export declare const Proxmox: {
|
|
|
12
13
|
dnsServers?: string[];
|
|
13
14
|
verifySsl?: boolean;
|
|
14
15
|
}) => void;
|
|
15
|
-
VM: <T extends string | string[]>(name: T) => T extends string[] ? VMBuilder
|
|
16
|
-
Template: <T extends string | string[]>(name: T) => T extends string[] ? TemplateBuilder
|
|
16
|
+
VM: <T extends string | string[]>(name: T) => T extends string[] ? BuilderGroup<VMBuilder> : VMBuilder;
|
|
17
|
+
Template: <T extends string | string[]>(name: T) => T extends string[] ? BuilderGroup<TemplateBuilder> : TemplateBuilder;
|
|
17
18
|
};
|
|
18
19
|
export * from "../../types/proxmox.js";
|
|
@@ -200,9 +200,12 @@ describe("Proxmox TemplateBuilder Unit Tests", () => {
|
|
|
200
200
|
const builder = new TemplateBuilder("my-new-template")
|
|
201
201
|
.baseImage("ubuntu-base")
|
|
202
202
|
.provision("playbooks/nginx.yaml");
|
|
203
|
-
builder.waitFor = async () =>
|
|
203
|
+
builder.waitFor = async (label, condition) => {
|
|
204
|
+
return await condition();
|
|
205
|
+
};
|
|
204
206
|
builder.checkPort = async () => true;
|
|
205
207
|
builder.checkCloudInit = async () => true;
|
|
208
|
+
builder.runProvisioner = async () => { };
|
|
206
209
|
const result = await builder.deploy();
|
|
207
210
|
assert.strictEqual(result.vmid, 9001);
|
|
208
211
|
assert.strictEqual(result.node, "pve2");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "puls-dev",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Intent-driven infrastructure-as-code with eager discovery and no state files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -101,4 +101,4 @@
|
|
|
101
101
|
"reflect-metadata": "^0.2.2",
|
|
102
102
|
"undici": "^8.3.0"
|
|
103
103
|
}
|
|
104
|
-
}
|
|
104
|
+
}
|