@intentius/chant-lexicon-gcp 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": "99b71297b50bc2eacdee359a9a2074579841e019ec3da67510a7175f07e0179d",
|
|
5
5
|
"meta.json": "475f10909854d059a2e2d4fb541c058803422e38b9c64bd4d6858c0623eedb8c",
|
|
6
6
|
"types/index.d.ts": "5433b54c04b57d6fda8f3d81ef92ed0aca87f7e8e5dd3ea92d8de6e62a3ccfab",
|
|
7
7
|
"rules/hardcoded-project.ts": "228631d3159e1ffcce2359c66073d4ae59bb0285f378e46e446f416aec50481c",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"skills/chant-gcp-patterns.md": "a7ef31c1eb2f7244d3f73952c300472ef94c1eb09bd7a1003281b89299b6b704",
|
|
38
38
|
"skills/chant-gcp-gke.md": "be277019da9a722c851e47cd2dfb9c9536668948c3535fb20db7697e934c4e2b"
|
|
39
39
|
},
|
|
40
|
-
"composite": "
|
|
40
|
+
"composite": "414193cf3778e11c8cc72849add9573dcbd6059113835f26357ff256bed61b47"
|
|
41
41
|
}
|
package/dist/manifest.json
CHANGED
|
@@ -14,31 +14,16 @@ export interface FlociGcpDownArgs {
|
|
|
14
14
|
/** Container name to remove. Default: `chant-floci-gcp`. */
|
|
15
15
|
name?: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
export declare
|
|
19
|
-
|
|
20
|
-
export declare function flociGcpRunCommand(args: FlociGcpUpArgs): string;
|
|
21
|
-
/** Build the `docker rm -f` command. */
|
|
22
|
-
export declare function flociGcpRmCommand(name: string): string;
|
|
23
|
-
/** The floci-gcp health endpoint URL for a host port. */
|
|
24
|
-
export declare function flociGcpHealthUrl(port: number): string;
|
|
17
|
+
export declare const flociGcpExistsCommand: (name: string) => string;
|
|
18
|
+
export declare const flociGcpRmCommand: (name: string) => string;
|
|
19
|
+
export declare const flociGcpHealthUrl: (port: number) => string;
|
|
25
20
|
/** The GCP endpoint URL (what `gcpApply`'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 `gcpApply({ 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 flociGcpUp(args: FlociGcpUpArgs, signal?: AbortSignal): Promise<{
|
|
21
|
+
export declare const flociGcpEndpoint: (port: number) => string;
|
|
22
|
+
export declare const flociGcpRunCommand: (args?: FlociGcpUpArgs) => string;
|
|
23
|
+
/** Boot a local floci-gcp (GCP emulator) in Docker and return its endpoint. */
|
|
24
|
+
export declare const flociGcpUp: (args?: FlociGcpUpArgs, 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 flociGcpDown(args: FlociGcpDownArgs, signal?: AbortSignal): Promise<void>;
|
|
27
|
+
/** Stop and remove the local floci-gcp container (no-op if already gone). */
|
|
28
|
+
export declare const flociGcpDown: (args?: FlociGcpDownArgs, signal?: AbortSignal) => Promise<void>;
|
|
44
29
|
//# sourceMappingURL=floci-gcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floci-gcp.d.ts","sourceRoot":"","sources":["../../../src/op/activities/floci-gcp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"floci-gcp.d.ts","sourceRoot":"","sources":["../../../src/op/activities/floci-gcp.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,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,gBAAgB;IAC/B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAWD,eAAO,MAAM,qBAAqB,0BAAoB,CAAC;AACvD,eAAO,MAAM,iBAAiB,0BAAgB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,0BAAgB,CAAC;AAC/C,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,0BAAe,CAAC;AAC7C,eAAO,MAAM,kBAAkB,GAAI,OAAM,cAAmB,KAAG,MAA8B,CAAC;AAE9F,+EAA+E;AAC/E,eAAO,MAAM,UAAU,GAAI,OAAM,cAAmB,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CACnF,CAAC;AAEvB,6EAA6E;AAC7E,eAAO,MAAM,YAAY,GAAI,OAAM,gBAAqB,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,IAAI,CACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-gcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Google Cloud lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"typescript": "^5.9.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@intentius/chant": "^0.
|
|
79
|
+
"@intentius/chant": "^0.16.0"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -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-gcp";
|
|
8
|
-
const DEFAULT_PORT = 4588;
|
|
9
|
-
const DEFAULT_IMAGE = "floci/floci-gcp:latest";
|
|
1
|
+
import { emulatorLifecycle } from "@intentius/chant/op";
|
|
10
2
|
|
|
11
3
|
export interface FlociGcpUpArgs {
|
|
12
4
|
/** Container name. Default: `chant-floci-gcp`. */
|
|
@@ -26,98 +18,26 @@ export interface FlociGcpDownArgs {
|
|
|
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}:4588`, image].join(" ");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Build the `docker rm -f` command. */
|
|
43
|
-
export function flociGcpRmCommand(name: string): string {
|
|
44
|
-
return `docker rm -f ${name}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** The floci-gcp health endpoint URL for a host port. */
|
|
48
|
-
export function flociGcpHealthUrl(port: number): string {
|
|
49
|
-
return `http://localhost:${port}/_floci-gcp/health`;
|
|
50
|
-
}
|
|
21
|
+
// floci-gcp is a bespoke GCP-REST fake (not LocalStack) — a plain 200 on its
|
|
22
|
+
// health endpoint means ready. Shared lifecycle: emulatorLifecycle (#746).
|
|
23
|
+
const gcp = emulatorLifecycle({
|
|
24
|
+
name: "chant-floci-gcp",
|
|
25
|
+
image: "floci/floci-gcp:latest",
|
|
26
|
+
containerPort: 4588,
|
|
27
|
+
healthPath: "/_floci-gcp/health",
|
|
28
|
+
});
|
|
51
29
|
|
|
30
|
+
export const flociGcpExistsCommand = gcp.existsCommand;
|
|
31
|
+
export const flociGcpRmCommand = gcp.rmCommand;
|
|
32
|
+
export const flociGcpHealthUrl = gcp.healthUrl;
|
|
52
33
|
/** The GCP endpoint URL (what `gcpApply`'s `endpoint` should point at). */
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Boot a local floci-gcp (GCP emulator) in Docker and return its endpoint.
|
|
59
|
-
*
|
|
60
|
-
* Idempotent: reuses a running container of the same name. Waits for the health
|
|
61
|
-
* endpoint to answer, then returns `{ endpoint }` for `gcpApply({ 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 flociGcpUp(args: FlociGcpUpArgs, 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(flociGcpExistsCommand(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 flociGcpEndpoint = gcp.endpoint;
|
|
35
|
+
export const flociGcpRunCommand = (args: FlociGcpUpArgs = {}): string => gcp.runCommand(args);
|
|
79
36
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await execAsync(flociGcpRunCommand({ ...args, name, port }), { signal });
|
|
84
|
-
}
|
|
37
|
+
/** Boot a local floci-gcp (GCP emulator) in Docker and return its endpoint. */
|
|
38
|
+
export const flociGcpUp = (args: FlociGcpUpArgs = {}, signal?: AbortSignal): Promise<{ endpoint: string }> =>
|
|
39
|
+
gcp.up(args, signal);
|
|
85
40
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
while (Date.now() < deadline) {
|
|
90
|
-
if (signal?.aborted) throw new Error("flociGcpUp aborted");
|
|
91
|
-
safeHeartbeat({ step: "flociGcpUp", 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-gcp "${name}" did not become ready within ${timeoutMs}ms`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const endpoint = flociGcpEndpoint(port);
|
|
108
|
-
console.log(`floci-gcp ready on ${endpoint}`);
|
|
109
|
-
return { endpoint };
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Stop and remove the local floci-gcp container. A no-op success when the
|
|
114
|
-
* container is already gone. Uses fastIdempotent profile — 5m timeout.
|
|
115
|
-
*/
|
|
116
|
-
export async function flociGcpDown(args: FlociGcpDownArgs, signal?: AbortSignal): Promise<void> {
|
|
117
|
-
const name = args.name ?? DEFAULT_NAME;
|
|
118
|
-
try {
|
|
119
|
-
await execAsync(flociGcpRmCommand(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-gcp container (no-op if already gone). */
|
|
42
|
+
export const flociGcpDown = (args: FlociGcpDownArgs = {}, signal?: AbortSignal): Promise<void> =>
|
|
43
|
+
gcp.down(args, signal);
|