@intentius/chant-lexicon-azure 0.15.2 → 0.16.0
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/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "0b5a14f49bdda47a334f29c37668785c4b69b176155fa92504fa33ae3b7cc0ed",
|
|
5
5
|
"meta.json": "4b9c0be734f8b4a5fbba3136e14aaa1ea73ff0ee93f2aa480db83e476ce727b5",
|
|
6
6
|
"types/index.d.ts": "d62c0fd7947ddf04a9126cc8bf44a9f4437f21cf8647fc812c022398f2c00d57",
|
|
7
7
|
"rules/hardcoded-location.ts": "a9b1d1cec93f2ca9c5206641f53fc9621cefcfd2c00b3ab89c194b30a75fa949",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"skills/chant-azure-patterns.md": "1a3bacfac612826b77332d2692a59195638db9f1b5e8ea2eda7579621d25f603",
|
|
34
34
|
"skills/chant-azure-aks.md": "2d4e0098c1a22b54ffadd410564d9df0f3a04cb4eb7c6261f20ae33106e7aca8"
|
|
35
35
|
},
|
|
36
|
-
"composite": "
|
|
36
|
+
"composite": "a6d15485fe9337f12eff84c538506a05c1f88c75903b4e70050e29438c686044"
|
|
37
37
|
}
|
package/dist/manifest.json
CHANGED
|
@@ -14,31 +14,16 @@ export interface FlociAzDownArgs {
|
|
|
14
14
|
/** Container name to remove. Default: `chant-floci-az`. */
|
|
15
15
|
name?: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
export declare
|
|
19
|
-
|
|
20
|
-
export declare function flociAzRunCommand(args: FlociAzUpArgs): string;
|
|
21
|
-
/** Build the `docker rm -f` command. */
|
|
22
|
-
export declare function flociAzRmCommand(name: string): string;
|
|
23
|
-
/** The floci-az health endpoint URL for a host port. */
|
|
24
|
-
export declare function flociAzHealthUrl(port: number): string;
|
|
17
|
+
export declare const flociAzExistsCommand: (name: string) => string;
|
|
18
|
+
export declare const flociAzRmCommand: (name: string) => string;
|
|
19
|
+
export declare const flociAzHealthUrl: (port: number) => string;
|
|
25
20
|
/** The ARM endpoint URL (what `azApply`'s `endpoint` should point at). */
|
|
26
|
-
export declare
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* Idempotent: reuses a running container of the same name. Waits for the health
|
|
31
|
-
* endpoint to answer, then returns `{ endpoint }` for `azApply({ endpoint })`.
|
|
32
|
-
* The typed twin of the AWS `flociUp` — replaces a raw `docker run` shell step so
|
|
33
|
-
* the emulator lifecycle is modeled, not scripted. Uses longInfra profile — 20m
|
|
34
|
-
* timeout, heartbeat every poll (the image may pull).
|
|
35
|
-
*/
|
|
36
|
-
export declare function flociAzUp(args: FlociAzUpArgs, signal?: AbortSignal): Promise<{
|
|
21
|
+
export declare const flociAzEndpoint: (port: number) => string;
|
|
22
|
+
export declare const flociAzRunCommand: (args?: FlociAzUpArgs) => string;
|
|
23
|
+
/** Boot a local floci-az (Azure emulator) in Docker and return its ARM endpoint. */
|
|
24
|
+
export declare const flociAzUp: (args?: FlociAzUpArgs, signal?: AbortSignal) => Promise<{
|
|
37
25
|
endpoint: string;
|
|
38
26
|
}>;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
* container is already gone. Uses fastIdempotent profile — 5m timeout.
|
|
42
|
-
*/
|
|
43
|
-
export declare function flociAzDown(args: FlociAzDownArgs, signal?: AbortSignal): Promise<void>;
|
|
27
|
+
/** Stop and remove the local floci-az container (no-op if already gone). */
|
|
28
|
+
export declare const flociAzDown: (args?: FlociAzDownArgs, signal?: AbortSignal) => Promise<void>;
|
|
44
29
|
//# sourceMappingURL=floci-az.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floci-az.d.ts","sourceRoot":"","sources":["../../../src/op/activities/floci-az.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"floci-az.d.ts","sourceRoot":"","sources":["../../../src/op/activities/floci-az.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAWD,eAAO,MAAM,oBAAoB,0BAAmB,CAAC;AACrD,eAAO,MAAM,gBAAgB,0BAAe,CAAC;AAC7C,eAAO,MAAM,gBAAgB,0BAAe,CAAC;AAC7C,0EAA0E;AAC1E,eAAO,MAAM,eAAe,0BAAc,CAAC;AAC3C,eAAO,MAAM,iBAAiB,GAAI,OAAM,aAAkB,KAAG,MAA6B,CAAC;AAE3F,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,OAAM,aAAkB,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAClF,CAAC;AAEtB,4EAA4E;AAC5E,eAAO,MAAM,WAAW,GAAI,OAAM,eAAoB,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,IAAI,CACpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-azure",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Azure lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"typescript": "^5.9.3"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@intentius/chant": "^0.
|
|
77
|
+
"@intentius/chant": "^0.16.0"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promisify } from "node:util";
|
|
3
|
-
import { safeHeartbeat, sleep } from "@intentius/chant/op";
|
|
4
|
-
|
|
5
|
-
const execAsync = promisify(exec);
|
|
6
|
-
|
|
7
|
-
const DEFAULT_NAME = "chant-floci-az";
|
|
8
|
-
const DEFAULT_PORT = 4577;
|
|
9
|
-
const DEFAULT_IMAGE = "floci/floci-az:latest";
|
|
1
|
+
import { emulatorLifecycle } from "@intentius/chant/op";
|
|
10
2
|
|
|
11
3
|
export interface FlociAzUpArgs {
|
|
12
4
|
/** Container name. Default: `chant-floci-az`. */
|
|
@@ -26,98 +18,26 @@ export interface FlociAzDownArgs {
|
|
|
26
18
|
name?: string;
|
|
27
19
|
}
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const port = args.port ?? DEFAULT_PORT;
|
|
38
|
-
const image = args.image ?? DEFAULT_IMAGE;
|
|
39
|
-
return ["docker", "run", "-d", "--rm", "--name", name, "-p", `${port}:4577`, image].join(" ");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Build the `docker rm -f` command. */
|
|
43
|
-
export function flociAzRmCommand(name: string): string {
|
|
44
|
-
return `docker rm -f ${name}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** The floci-az health endpoint URL for a host port. */
|
|
48
|
-
export function flociAzHealthUrl(port: number): string {
|
|
49
|
-
return `http://localhost:${port}/_floci/health`;
|
|
50
|
-
}
|
|
21
|
+
// floci-az is a bespoke ARM fake (not LocalStack) — a plain 200 on its health
|
|
22
|
+
// endpoint means ready. Shared lifecycle: emulatorLifecycle (#746).
|
|
23
|
+
const az = emulatorLifecycle({
|
|
24
|
+
name: "chant-floci-az",
|
|
25
|
+
image: "floci/floci-az:latest",
|
|
26
|
+
containerPort: 4577,
|
|
27
|
+
healthPath: "/_floci/health",
|
|
28
|
+
});
|
|
51
29
|
|
|
30
|
+
export const flociAzExistsCommand = az.existsCommand;
|
|
31
|
+
export const flociAzRmCommand = az.rmCommand;
|
|
32
|
+
export const flociAzHealthUrl = az.healthUrl;
|
|
52
33
|
/** The ARM endpoint URL (what `azApply`'s `endpoint` should point at). */
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Boot a local floci-az (Azure emulator) in Docker and return its ARM endpoint.
|
|
59
|
-
*
|
|
60
|
-
* Idempotent: reuses a running container of the same name. Waits for the health
|
|
61
|
-
* endpoint to answer, then returns `{ endpoint }` for `azApply({ endpoint })`.
|
|
62
|
-
* The typed twin of the AWS `flociUp` — replaces a raw `docker run` shell step so
|
|
63
|
-
* the emulator lifecycle is modeled, not scripted. Uses longInfra profile — 20m
|
|
64
|
-
* timeout, heartbeat every poll (the image may pull).
|
|
65
|
-
*/
|
|
66
|
-
export async function flociAzUp(args: FlociAzUpArgs, signal?: AbortSignal): Promise<{ endpoint: string }> {
|
|
67
|
-
const name = args.name ?? DEFAULT_NAME;
|
|
68
|
-
const port = args.port ?? DEFAULT_PORT;
|
|
69
|
-
const timeoutMs = args.timeoutMs ?? 60_000;
|
|
70
|
-
const intervalMs = args.intervalMs ?? 2_000;
|
|
71
|
-
|
|
72
|
-
let running = false;
|
|
73
|
-
try {
|
|
74
|
-
const { stdout } = await execAsync(flociAzExistsCommand(name), { signal });
|
|
75
|
-
running = Boolean(stdout.trim());
|
|
76
|
-
} catch {
|
|
77
|
-
// `docker ps` failed — assume not running and try to start it.
|
|
78
|
-
}
|
|
34
|
+
export const flociAzEndpoint = az.endpoint;
|
|
35
|
+
export const flociAzRunCommand = (args: FlociAzUpArgs = {}): string => az.runCommand(args);
|
|
79
36
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await execAsync(flociAzRunCommand({ ...args, name, port }), { signal });
|
|
84
|
-
}
|
|
37
|
+
/** Boot a local floci-az (Azure emulator) in Docker and return its ARM endpoint. */
|
|
38
|
+
export const flociAzUp = (args: FlociAzUpArgs = {}, signal?: AbortSignal): Promise<{ endpoint: string }> =>
|
|
39
|
+
az.up(args, signal);
|
|
85
40
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
while (Date.now() < deadline) {
|
|
90
|
-
if (signal?.aborted) throw new Error("flociAzUp aborted");
|
|
91
|
-
safeHeartbeat({ step: "flociAzUp", container: name });
|
|
92
|
-
try {
|
|
93
|
-
const res = await fetch(url, { signal });
|
|
94
|
-
if (res.ok) {
|
|
95
|
-
ready = true;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
} catch {
|
|
99
|
-
// Not up yet (connection refused / non-2xx) — retry.
|
|
100
|
-
}
|
|
101
|
-
await sleep(intervalMs, signal);
|
|
102
|
-
}
|
|
103
|
-
if (!ready) {
|
|
104
|
-
throw new Error(`floci-az "${name}" did not become ready within ${timeoutMs}ms`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const endpoint = flociAzEndpoint(port);
|
|
108
|
-
console.log(`floci-az ready on ${endpoint}`);
|
|
109
|
-
return { endpoint };
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Stop and remove the local floci-az container. A no-op success when the
|
|
114
|
-
* container is already gone. Uses fastIdempotent profile — 5m timeout.
|
|
115
|
-
*/
|
|
116
|
-
export async function flociAzDown(args: FlociAzDownArgs, signal?: AbortSignal): Promise<void> {
|
|
117
|
-
const name = args.name ?? DEFAULT_NAME;
|
|
118
|
-
try {
|
|
119
|
-
await execAsync(flociAzRmCommand(name), { signal });
|
|
120
|
-
} catch {
|
|
121
|
-
// Already removed (`--rm` on exit, or never started) — treat as success.
|
|
122
|
-
}
|
|
123
|
-
}
|
|
41
|
+
/** Stop and remove the local floci-az container (no-op if already gone). */
|
|
42
|
+
export const flociAzDown = (args: FlociAzDownArgs = {}, signal?: AbortSignal): Promise<void> =>
|
|
43
|
+
az.down(args, signal);
|