@principal-ai/subsystems-core 0.51.5 → 0.51.7
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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/c4.d.ts +59 -0
- package/dist/infra/c4.d.ts.map +1 -0
- package/dist/infra/c4.js +101 -0
- package/dist/infra/c4.js.map +1 -0
- package/dist/infra/index.d.ts +13 -0
- package/dist/infra/index.d.ts.map +1 -0
- package/dist/infra/index.js +22 -0
- package/dist/infra/index.js.map +1 -0
- package/dist/infra/jsonc.d.ts +10 -0
- package/dist/infra/jsonc.d.ts.map +1 -0
- package/dist/infra/jsonc.js +77 -0
- package/dist/infra/jsonc.js.map +1 -0
- package/dist/infra/terraform.d.ts +41 -0
- package/dist/infra/terraform.d.ts.map +1 -0
- package/dist/infra/terraform.js +208 -0
- package/dist/infra/terraform.js.map +1 -0
- package/dist/infra/types.d.ts +107 -0
- package/dist/infra/types.d.ts.map +1 -0
- package/dist/infra/types.js +47 -0
- package/dist/infra/types.js.map +1 -0
- package/dist/infra/wrangler.d.ts +24 -0
- package/dist/infra/wrangler.d.ts.map +1 -0
- package/dist/infra/wrangler.js +116 -0
- package/dist/infra/wrangler.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +3 -1
- package/dist/node.js.map +1 -1
- package/dist/storage/topic-share.d.ts +57 -0
- package/dist/storage/topic-share.d.ts.map +1 -0
- package/dist/storage/topic-share.js +55 -0
- package/dist/storage/topic-share.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/infra/c4.ts +141 -0
- package/src/infra/index.ts +21 -0
- package/src/infra/infra.test.ts +300 -0
- package/src/infra/jsonc.ts +70 -0
- package/src/infra/terraform.ts +251 -0
- package/src/infra/types.ts +136 -0
- package/src/infra/wrangler.ts +148 -0
- package/src/node.ts +2 -0
- package/src/storage/topic-share.test.ts +71 -0
- package/src/storage/topic-share.ts +91 -0
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
export * from './types';
|
|
14
14
|
export type { DraftTopic, TopicAsset, TopicCreator, TopicSubsystemModelRef, TopicReference, } from './storage/topic-types';
|
|
15
15
|
export { formatTopicReferenceLink, parseTopicReferenceLink } from './storage/topic-reference-links';
|
|
16
|
+
export { toSharedTopic } from './storage/topic-share';
|
|
17
|
+
export type { SharedTopic, SharedTopicAsset, SharedTopicProjection } from './storage/topic-share';
|
|
18
|
+
export * from './infra';
|
|
16
19
|
export { validateSubsystemModelCrossField } from './validation';
|
|
17
20
|
export type { SubsystemValidationProblem } from './validation';
|
|
18
21
|
export * from './audit/pure';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,SAAS,CAAC;AAExB,YAAY,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,SAAS,CAAC;AAExB,YAAY,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAIlG,cAAc,SAAS,CAAC;AAKxB,OAAO,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAI/D,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -26,11 +26,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.validateSubsystemModelCrossField = exports.parseTopicReferenceLink = exports.formatTopicReferenceLink = void 0;
|
|
29
|
+
exports.validateSubsystemModelCrossField = exports.toSharedTopic = exports.parseTopicReferenceLink = exports.formatTopicReferenceLink = void 0;
|
|
30
30
|
__exportStar(require("./types"), exports);
|
|
31
31
|
var topic_reference_links_1 = require("./storage/topic-reference-links");
|
|
32
32
|
Object.defineProperty(exports, "formatTopicReferenceLink", { enumerable: true, get: function () { return topic_reference_links_1.formatTopicReferenceLink; } });
|
|
33
33
|
Object.defineProperty(exports, "parseTopicReferenceLink", { enumerable: true, get: function () { return topic_reference_links_1.parseTopicReferenceLink; } });
|
|
34
|
+
var topic_share_1 = require("./storage/topic-share");
|
|
35
|
+
Object.defineProperty(exports, "toSharedTopic", { enumerable: true, get: function () { return topic_share_1.toSharedTopic; } });
|
|
36
|
+
// Infrastructure-as-code read side: what wrangler / terraform declare, and the
|
|
37
|
+
// shape a live-deployment observation takes. Pure — text and JSON in.
|
|
38
|
+
__exportStar(require("./infra"), exports);
|
|
34
39
|
// Cross-field validation (the rules the JSON Schema can't express). Structural
|
|
35
40
|
// (schema) validation is enforced per surface against
|
|
36
41
|
// `schemas/subsystem-model.schema.json`.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AASxB,yEAAoG;AAA3F,iIAAA,wBAAwB,OAAA;AAAE,gIAAA,uBAAuB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AASxB,yEAAoG;AAA3F,iIAAA,wBAAwB,OAAA;AAAE,gIAAA,uBAAuB,OAAA;AAC1D,qDAAsD;AAA7C,4GAAA,aAAa,OAAA;AAGtB,+EAA+E;AAC/E,sEAAsE;AACtE,0CAAwB;AAExB,+EAA+E;AAC/E,sDAAsD;AACtD,yCAAyC;AACzC,2CAAgE;AAAvD,8HAAA,gCAAgC,OAAA;AAGzC,gFAAgF;AAChF,uEAAuE;AACvE,+CAA6B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {@link InfraManifest} → proposed C4 containers and edges.
|
|
3
|
+
*
|
|
4
|
+
* The full C4 model lives in the viewer package, which depends on this one, so
|
|
5
|
+
* the shapes here are structural: they are assignable to the viewer's
|
|
6
|
+
* `C4Container` / `C4Edge` without this package importing them (the same
|
|
7
|
+
* arrangement as `audit/c4.ts`).
|
|
8
|
+
*
|
|
9
|
+
* Everything produced is `proposed`. A config file is evidence that a
|
|
10
|
+
* deployable unit exists, not a reviewer's acceptance of it as architecture.
|
|
11
|
+
*/
|
|
12
|
+
import type { InfraManifest, InfraResource, InfraResourceSource } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* The configured anchor a container carries — which declared resource it is.
|
|
15
|
+
* Holds no live fact: whether it is running is a separate observation, joined
|
|
16
|
+
* on `resourceKey`.
|
|
17
|
+
*/
|
|
18
|
+
export interface InfraC4Deployment {
|
|
19
|
+
resourceKey: string;
|
|
20
|
+
provider: string;
|
|
21
|
+
resourceType: string;
|
|
22
|
+
name: string;
|
|
23
|
+
source: InfraResourceSource;
|
|
24
|
+
}
|
|
25
|
+
export interface InfraC4Container {
|
|
26
|
+
id: string;
|
|
27
|
+
kind: 'container';
|
|
28
|
+
containerKind: 'application' | 'data-store';
|
|
29
|
+
label: string;
|
|
30
|
+
technology: string;
|
|
31
|
+
state: 'proposed';
|
|
32
|
+
rationale: string;
|
|
33
|
+
deployment: InfraC4Deployment;
|
|
34
|
+
}
|
|
35
|
+
export interface InfraC4Edge {
|
|
36
|
+
id: string;
|
|
37
|
+
source: string;
|
|
38
|
+
target: string;
|
|
39
|
+
label: string;
|
|
40
|
+
draft: true;
|
|
41
|
+
mechanisms: string[];
|
|
42
|
+
count: number;
|
|
43
|
+
}
|
|
44
|
+
/** The stable C4 element id for a declared resource. */
|
|
45
|
+
export declare function infraContainerId(resource: Pick<InfraResource, 'resourceType' | 'label'>): string;
|
|
46
|
+
/** The configured anchor for one resource. */
|
|
47
|
+
export declare function infraDeploymentRef(resource: InfraResource): InfraC4Deployment;
|
|
48
|
+
/**
|
|
49
|
+
* Propose one container per declared resource and one edge per binding.
|
|
50
|
+
*
|
|
51
|
+
* A binding whose target no parsed file declares (a service binding to a
|
|
52
|
+
* Worker configured elsewhere) is dropped rather than drawn to nothing; merge
|
|
53
|
+
* the other config's manifest in first to keep it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function infraToC4(manifest: InfraManifest): {
|
|
56
|
+
nodes: InfraC4Container[];
|
|
57
|
+
edges: InfraC4Edge[];
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=c4.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c4.d.ts","sourceRoot":"","sources":["../../src/infra/c4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEjF;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,aAAa,GAAG,YAAY,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AA4BD,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,MAAM,CAIhG;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,iBAAiB,CAQ7E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG;IAClD,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAsCA"}
|
package/dist/infra/c4.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* {@link InfraManifest} → proposed C4 containers and edges.
|
|
4
|
+
*
|
|
5
|
+
* The full C4 model lives in the viewer package, which depends on this one, so
|
|
6
|
+
* the shapes here are structural: they are assignable to the viewer's
|
|
7
|
+
* `C4Container` / `C4Edge` without this package importing them (the same
|
|
8
|
+
* arrangement as `audit/c4.ts`).
|
|
9
|
+
*
|
|
10
|
+
* Everything produced is `proposed`. A config file is evidence that a
|
|
11
|
+
* deployable unit exists, not a reviewer's acceptance of it as architecture.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.infraToC4 = exports.infraDeploymentRef = exports.infraContainerId = void 0;
|
|
15
|
+
const TECHNOLOGY = {
|
|
16
|
+
'cloudflare:worker': 'Cloudflare Worker',
|
|
17
|
+
'cloudflare:r2_bucket': 'Cloudflare R2',
|
|
18
|
+
'cloudflare:d1_database': 'Cloudflare D1',
|
|
19
|
+
'cloudflare:kv_namespace': 'Cloudflare KV',
|
|
20
|
+
'cloudflare:queue': 'Cloudflare Queue',
|
|
21
|
+
};
|
|
22
|
+
/** Resource types that run code. Everything else is something code reads or writes. */
|
|
23
|
+
const APPLICATION_TYPES = new Set(['worker']);
|
|
24
|
+
/** Short suffix that keeps a store's id distinct from a same-named Worker. */
|
|
25
|
+
const ID_SUFFIX = {
|
|
26
|
+
r2_bucket: 'r2',
|
|
27
|
+
d1_database: 'd1',
|
|
28
|
+
kv_namespace: 'kv',
|
|
29
|
+
queue: 'queue',
|
|
30
|
+
};
|
|
31
|
+
function slug(text) {
|
|
32
|
+
return text
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
35
|
+
.replace(/^-+|-+$/g, '');
|
|
36
|
+
}
|
|
37
|
+
/** The stable C4 element id for a declared resource. */
|
|
38
|
+
function infraContainerId(resource) {
|
|
39
|
+
const suffix = ID_SUFFIX[resource.resourceType];
|
|
40
|
+
const base = slug(resource.label) || 'resource';
|
|
41
|
+
return `container:${suffix ? `${base}-${suffix}` : base}`;
|
|
42
|
+
}
|
|
43
|
+
exports.infraContainerId = infraContainerId;
|
|
44
|
+
/** The configured anchor for one resource. */
|
|
45
|
+
function infraDeploymentRef(resource) {
|
|
46
|
+
return {
|
|
47
|
+
resourceKey: resource.key,
|
|
48
|
+
provider: resource.provider,
|
|
49
|
+
resourceType: resource.resourceType,
|
|
50
|
+
name: resource.name,
|
|
51
|
+
source: resource.source,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.infraDeploymentRef = infraDeploymentRef;
|
|
55
|
+
/**
|
|
56
|
+
* Propose one container per declared resource and one edge per binding.
|
|
57
|
+
*
|
|
58
|
+
* A binding whose target no parsed file declares (a service binding to a
|
|
59
|
+
* Worker configured elsewhere) is dropped rather than drawn to nothing; merge
|
|
60
|
+
* the other config's manifest in first to keep it.
|
|
61
|
+
*/
|
|
62
|
+
function infraToC4(manifest) {
|
|
63
|
+
const idByKey = new Map();
|
|
64
|
+
const nodes = manifest.resources.map((resource) => {
|
|
65
|
+
const id = infraContainerId(resource);
|
|
66
|
+
idByKey.set(resource.key, id);
|
|
67
|
+
const where = resource.source.pointer
|
|
68
|
+
? `${resource.source.file} at ${resource.source.pointer}`
|
|
69
|
+
: resource.source.file;
|
|
70
|
+
return {
|
|
71
|
+
id,
|
|
72
|
+
kind: 'container',
|
|
73
|
+
containerKind: APPLICATION_TYPES.has(resource.resourceType) ? 'application' : 'data-store',
|
|
74
|
+
label: resource.label,
|
|
75
|
+
technology: TECHNOLOGY[`${resource.provider}:${resource.resourceType}`] ??
|
|
76
|
+
`${resource.provider} ${resource.resourceType}`,
|
|
77
|
+
state: 'proposed',
|
|
78
|
+
rationale: `Declared by ${resource.source.tool} in ${where}.`,
|
|
79
|
+
deployment: infraDeploymentRef(resource),
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const edges = [];
|
|
83
|
+
for (const binding of manifest.bindings) {
|
|
84
|
+
const source = idByKey.get(binding.from);
|
|
85
|
+
const target = idByKey.get(binding.to);
|
|
86
|
+
if (!source || !target)
|
|
87
|
+
continue;
|
|
88
|
+
edges.push({
|
|
89
|
+
id: `edge:${source}->${target}:${binding.binding}`,
|
|
90
|
+
source,
|
|
91
|
+
target,
|
|
92
|
+
label: `env.${binding.binding}`,
|
|
93
|
+
draft: true,
|
|
94
|
+
mechanisms: [],
|
|
95
|
+
count: 0,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return { nodes, edges };
|
|
99
|
+
}
|
|
100
|
+
exports.infraToC4 = infraToC4;
|
|
101
|
+
//# sourceMappingURL=c4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c4.js","sourceRoot":"","sources":["../../src/infra/c4.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAsCH,MAAM,UAAU,GAA2B;IACzC,mBAAmB,EAAE,mBAAmB;IACxC,sBAAsB,EAAE,eAAe;IACvC,wBAAwB,EAAE,eAAe;IACzC,yBAAyB,EAAE,eAAe;IAC1C,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF,uFAAuF;AACvF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE9C,8EAA8E;AAC9E,MAAM,SAAS,GAA2B;IACxC,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI;SACR,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED,wDAAwD;AACxD,SAAgB,gBAAgB,CAAC,QAAuD;IACtF,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC;IAChD,OAAO,aAAa,MAAM,CAAC,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AQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,YAAY,EAAE;YACjD,KAAK,EAAE,UAAU;YACjB,SAAS,EAAE,eAAe,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,KAAK,GAAG;YAC7D,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC;SACzC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE;QACvC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;YAAE,SAAS;QACjC,KAAK,CAAC,IAAI,CAAC;YACT,EAAE,EAAE,QAAQ,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;YAClD,MAAM;YACN,MAAM;YACN,KAAK,EAAE,OAAO,OAAO,CAAC,OAAO,EAAE;YAC/B,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,EAAE;YACd,KAAK,EAAE,CAAC;SACT,CAAC,CAAC;KACJ;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAzCD,8BAyCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure-as-code read side. Pure and browser-safe.
|
|
3
|
+
*/
|
|
4
|
+
export { infraResourceKey, mergeInfraManifests } from './types';
|
|
5
|
+
export type { InfraBinding, InfraDeploymentObservation, InfraDeploymentStatus, InfraManifest, InfraResource, InfraResourceSource, InfraTool, } from './types';
|
|
6
|
+
export { parseJsonc, stripJsonc } from './jsonc';
|
|
7
|
+
export { extractWranglerManifest } from './wrangler';
|
|
8
|
+
export type { ExtractWranglerOptions } from './wrangler';
|
|
9
|
+
export { extractTerraformManifest, terraformStateObservations } from './terraform';
|
|
10
|
+
export type { ExtractTerraformOptions } from './terraform';
|
|
11
|
+
export { infraContainerId, infraDeploymentRef, infraToC4 } from './c4';
|
|
12
|
+
export type { InfraC4Container, InfraC4Deployment, InfraC4Edge } from './c4';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infra/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAChE,YAAY,EACV,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Infrastructure-as-code read side. Pure and browser-safe.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.infraToC4 = exports.infraDeploymentRef = exports.infraContainerId = exports.terraformStateObservations = exports.extractTerraformManifest = exports.extractWranglerManifest = exports.stripJsonc = exports.parseJsonc = exports.mergeInfraManifests = exports.infraResourceKey = void 0;
|
|
7
|
+
var types_1 = require("./types");
|
|
8
|
+
Object.defineProperty(exports, "infraResourceKey", { enumerable: true, get: function () { return types_1.infraResourceKey; } });
|
|
9
|
+
Object.defineProperty(exports, "mergeInfraManifests", { enumerable: true, get: function () { return types_1.mergeInfraManifests; } });
|
|
10
|
+
var jsonc_1 = require("./jsonc");
|
|
11
|
+
Object.defineProperty(exports, "parseJsonc", { enumerable: true, get: function () { return jsonc_1.parseJsonc; } });
|
|
12
|
+
Object.defineProperty(exports, "stripJsonc", { enumerable: true, get: function () { return jsonc_1.stripJsonc; } });
|
|
13
|
+
var wrangler_1 = require("./wrangler");
|
|
14
|
+
Object.defineProperty(exports, "extractWranglerManifest", { enumerable: true, get: function () { return wrangler_1.extractWranglerManifest; } });
|
|
15
|
+
var terraform_1 = require("./terraform");
|
|
16
|
+
Object.defineProperty(exports, "extractTerraformManifest", { enumerable: true, get: function () { return terraform_1.extractTerraformManifest; } });
|
|
17
|
+
Object.defineProperty(exports, "terraformStateObservations", { enumerable: true, get: function () { return terraform_1.terraformStateObservations; } });
|
|
18
|
+
var c4_1 = require("./c4");
|
|
19
|
+
Object.defineProperty(exports, "infraContainerId", { enumerable: true, get: function () { return c4_1.infraContainerId; } });
|
|
20
|
+
Object.defineProperty(exports, "infraDeploymentRef", { enumerable: true, get: function () { return c4_1.infraDeploymentRef; } });
|
|
21
|
+
Object.defineProperty(exports, "infraToC4", { enumerable: true, get: function () { return c4_1.infraToC4; } });
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infra/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iCAAgE;AAAvD,yGAAA,gBAAgB,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAU9C,iCAAiD;AAAxC,mGAAA,UAAU,OAAA;AAAE,mGAAA,UAAU,OAAA;AAC/B,uCAAqD;AAA5C,mHAAA,uBAAuB,OAAA;AAEhC,yCAAmF;AAA1E,qHAAA,wBAAwB,OAAA;AAAE,uHAAA,0BAA0B,OAAA;AAE7D,2BAAuE;AAA9D,sGAAA,gBAAgB,OAAA;AAAE,wGAAA,kBAAkB,OAAA;AAAE,+FAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal JSONC reader — JSON with `//` and block comments and trailing
|
|
3
|
+
* commas, which is what `wrangler.jsonc` allows. Kept in-house so the
|
|
4
|
+
* browser-safe entry gains no dependency for a small job.
|
|
5
|
+
*/
|
|
6
|
+
/** Remove comments and trailing commas, leaving string contents untouched. */
|
|
7
|
+
export declare function stripJsonc(text: string): string;
|
|
8
|
+
/** Parse JSONC text. Throws `SyntaxError` like `JSON.parse` on malformed input. */
|
|
9
|
+
export declare function parseJsonc(text: string): unknown;
|
|
10
|
+
//# sourceMappingURL=jsonc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../src/infra/jsonc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyDH,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal JSONC reader — JSON with `//` and block comments and trailing
|
|
4
|
+
* commas, which is what `wrangler.jsonc` allows. Kept in-house so the
|
|
5
|
+
* browser-safe entry gains no dependency for a small job.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.parseJsonc = exports.stripJsonc = void 0;
|
|
9
|
+
/** Index just past the string literal that opens at `start`. */
|
|
10
|
+
function skipString(text, start) {
|
|
11
|
+
let i = start + 1;
|
|
12
|
+
while (i < text.length && text[i] !== '"')
|
|
13
|
+
i += text[i] === '\\' ? 2 : 1;
|
|
14
|
+
return i + 1;
|
|
15
|
+
}
|
|
16
|
+
function stripComments(text) {
|
|
17
|
+
let out = '';
|
|
18
|
+
let i = 0;
|
|
19
|
+
while (i < text.length) {
|
|
20
|
+
const ch = text[i];
|
|
21
|
+
const next = text[i + 1];
|
|
22
|
+
if (ch === '"') {
|
|
23
|
+
const end = skipString(text, i);
|
|
24
|
+
out += text.slice(i, end);
|
|
25
|
+
i = end;
|
|
26
|
+
}
|
|
27
|
+
else if (ch === '/' && next === '/') {
|
|
28
|
+
while (i < text.length && text[i] !== '\n')
|
|
29
|
+
i += 1;
|
|
30
|
+
}
|
|
31
|
+
else if (ch === '/' && next === '*') {
|
|
32
|
+
const end = text.indexOf('*/', i + 2);
|
|
33
|
+
i = end === -1 ? text.length : end + 2;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
out += ch;
|
|
37
|
+
i += 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
function stripTrailingCommas(text) {
|
|
43
|
+
let out = '';
|
|
44
|
+
let i = 0;
|
|
45
|
+
while (i < text.length) {
|
|
46
|
+
const ch = text[i];
|
|
47
|
+
if (ch === '"') {
|
|
48
|
+
const end = skipString(text, i);
|
|
49
|
+
out += text.slice(i, end);
|
|
50
|
+
i = end;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (ch === ',') {
|
|
54
|
+
let j = i + 1;
|
|
55
|
+
while (j < text.length && /\s/.test(text[j]))
|
|
56
|
+
j += 1;
|
|
57
|
+
if (text[j] === '}' || text[j] === ']') {
|
|
58
|
+
i += 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
out += ch;
|
|
63
|
+
i += 1;
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
/** Remove comments and trailing commas, leaving string contents untouched. */
|
|
68
|
+
function stripJsonc(text) {
|
|
69
|
+
return stripTrailingCommas(stripComments(text));
|
|
70
|
+
}
|
|
71
|
+
exports.stripJsonc = stripJsonc;
|
|
72
|
+
/** Parse JSONC text. Throws `SyntaxError` like `JSON.parse` on malformed input. */
|
|
73
|
+
function parseJsonc(text) {
|
|
74
|
+
return JSON.parse(stripJsonc(text));
|
|
75
|
+
}
|
|
76
|
+
exports.parseJsonc = parseJsonc;
|
|
77
|
+
//# sourceMappingURL=jsonc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.js","sourceRoot":"","sources":["../../src/infra/jsonc.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gEAAgE;AAChE,SAAS,UAAU,CAAC,IAAY,EAAE,KAAa;IAC7C,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QACtB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,EAAE,KAAK,GAAG,EAAE;YACd,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAChC,GAA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I,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC;gBAAE,CAAC,IAAI,CAAC,CAAC;YACtD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBACtC,CAAC,IAAI,CAAC,CAAC;gBACP,SAAS;aACV;SACF;QACD,GAAG,IAAI,EAAE,CAAC;QACV,CAAC,IAAI,CAAC,CAAC;KACR;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8EAA8E;AAC9E,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,mBAAmB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,gCAEC;AAED,mFAAmF;AACnF,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAFD,gCAEC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terraform → {@link InfraManifest}, read from `terraform show -json`.
|
|
3
|
+
*
|
|
4
|
+
* We read Terraform's own JSON rendering, never HCL: it is the documented
|
|
5
|
+
* machine-readable form, modules and variables are already resolved in it, and
|
|
6
|
+
* the same walk covers a plan (`planned_values`) and applied state (`values`).
|
|
7
|
+
*
|
|
8
|
+
* Cloudflare provider v5 resource shapes only. Attribute names follow the
|
|
9
|
+
* provider's published schema for `cloudflare_workers_script`,
|
|
10
|
+
* `cloudflare_worker` + `cloudflare_worker_version`, `cloudflare_r2_bucket`,
|
|
11
|
+
* `cloudflare_d1_database`, `cloudflare_workers_kv_namespace` and
|
|
12
|
+
* `cloudflare_queue`.
|
|
13
|
+
*
|
|
14
|
+
* Only type, name, id and declared URLs are ever read off a resource. State
|
|
15
|
+
* can hold secrets in other attributes; nothing here copies them out.
|
|
16
|
+
*/
|
|
17
|
+
import { type InfraDeploymentObservation, type InfraManifest } from './types';
|
|
18
|
+
export interface ExtractTerraformOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Repo-root-relative path recorded on every source — the directory or file
|
|
21
|
+
* the JSON was rendered from (e.g. `infra/` or `infra/main.tf`).
|
|
22
|
+
*/
|
|
23
|
+
file: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Read the declared resources out of `terraform show -json` output — applied
|
|
27
|
+
* state or a saved plan. Unknown resource types are ignored.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractTerraformManifest(showJson: unknown, options: ExtractTerraformOptions): InfraManifest;
|
|
30
|
+
/**
|
|
31
|
+
* Turn applied state into deployment observations.
|
|
32
|
+
*
|
|
33
|
+
* State is a record of the last apply, not a live check: a resource deleted
|
|
34
|
+
* out of band still appears. The observation says so through its `source`
|
|
35
|
+
* (`terraform-state`), and `observedAt` should be when the state was read.
|
|
36
|
+
* A plan yields no observations.
|
|
37
|
+
*/
|
|
38
|
+
export declare function terraformStateObservations(showJson: unknown, options: ExtractTerraformOptions & {
|
|
39
|
+
observedAt: string;
|
|
40
|
+
}): InfraDeploymentObservation[];
|
|
41
|
+
//# sourceMappingURL=terraform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terraform.d.ts","sourceRoot":"","sources":["../../src/infra/terraform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AA6EjB,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AA+GD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,uBAAuB,GAC/B,aAAa,CAEf;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,uBAAuB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACxD,0BAA0B,EAAE,CAU9B"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Terraform → {@link InfraManifest}, read from `terraform show -json`.
|
|
4
|
+
*
|
|
5
|
+
* We read Terraform's own JSON rendering, never HCL: it is the documented
|
|
6
|
+
* machine-readable form, modules and variables are already resolved in it, and
|
|
7
|
+
* the same walk covers a plan (`planned_values`) and applied state (`values`).
|
|
8
|
+
*
|
|
9
|
+
* Cloudflare provider v5 resource shapes only. Attribute names follow the
|
|
10
|
+
* provider's published schema for `cloudflare_workers_script`,
|
|
11
|
+
* `cloudflare_worker` + `cloudflare_worker_version`, `cloudflare_r2_bucket`,
|
|
12
|
+
* `cloudflare_d1_database`, `cloudflare_workers_kv_namespace` and
|
|
13
|
+
* `cloudflare_queue`.
|
|
14
|
+
*
|
|
15
|
+
* Only type, name, id and declared URLs are ever read off a resource. State
|
|
16
|
+
* can hold secrets in other attributes; nothing here copies them out.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.terraformStateObservations = exports.extractTerraformManifest = void 0;
|
|
20
|
+
const types_1 = require("./types");
|
|
21
|
+
const PROVIDER = 'cloudflare';
|
|
22
|
+
function isObject(value) {
|
|
23
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
function str(value) {
|
|
26
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
27
|
+
}
|
|
28
|
+
/** Managed resources of a module and every child module, depth-first. */
|
|
29
|
+
function collectResources(module, out = []) {
|
|
30
|
+
if (!isObject(module))
|
|
31
|
+
return out;
|
|
32
|
+
if (Array.isArray(module.resources)) {
|
|
33
|
+
for (const resource of module.resources) {
|
|
34
|
+
if (!isObject(resource) || resource.mode !== 'managed')
|
|
35
|
+
continue;
|
|
36
|
+
const address = str(resource.address);
|
|
37
|
+
const type = str(resource.type);
|
|
38
|
+
if (!address || !type)
|
|
39
|
+
continue;
|
|
40
|
+
out.push({ address, type, values: isObject(resource.values) ? resource.values : {} });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(module.child_modules)) {
|
|
44
|
+
for (const child of module.child_modules)
|
|
45
|
+
collectResources(child, out);
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
/** State (`values`) when present, else a plan's `planned_values`. */
|
|
50
|
+
function rootModule(showJson) {
|
|
51
|
+
if (!isObject(showJson))
|
|
52
|
+
return { module: undefined, applied: false };
|
|
53
|
+
if (isObject(showJson.values))
|
|
54
|
+
return { module: showJson.values.root_module, applied: true };
|
|
55
|
+
if (isObject(showJson.planned_values)) {
|
|
56
|
+
return { module: showJson.planned_values.root_module, applied: false };
|
|
57
|
+
}
|
|
58
|
+
return { module: undefined, applied: false };
|
|
59
|
+
}
|
|
60
|
+
const STORE_TYPES = {
|
|
61
|
+
cloudflare_r2_bucket: { resourceType: 'r2_bucket', nameField: 'name', keyById: false },
|
|
62
|
+
cloudflare_d1_database: { resourceType: 'd1_database', nameField: 'name', keyById: false },
|
|
63
|
+
cloudflare_workers_kv_namespace: { resourceType: 'kv_namespace', nameField: 'title', keyById: true },
|
|
64
|
+
cloudflare_queue: { resourceType: 'queue', nameField: 'queue_name', keyById: false },
|
|
65
|
+
};
|
|
66
|
+
/** Binding `type` → the resource type it reaches and the field that names the target. */
|
|
67
|
+
const BINDING_TYPES = {
|
|
68
|
+
kv_namespace: { resourceType: 'kv_namespace', refFields: ['namespace_id'] },
|
|
69
|
+
r2_bucket: { resourceType: 'r2_bucket', refFields: ['bucket_name'] },
|
|
70
|
+
d1: { resourceType: 'd1_database', refFields: ['id', 'database_id'] },
|
|
71
|
+
queue: { resourceType: 'queue', refFields: ['queue_name'] },
|
|
72
|
+
service: { resourceType: 'worker', refFields: ['service'] },
|
|
73
|
+
};
|
|
74
|
+
function extract(showJson, options) {
|
|
75
|
+
const { module, applied } = rootModule(showJson);
|
|
76
|
+
const tfResources = collectResources(module);
|
|
77
|
+
const source = (pointer) => ({
|
|
78
|
+
tool: 'terraform',
|
|
79
|
+
file: options.file,
|
|
80
|
+
pointer,
|
|
81
|
+
});
|
|
82
|
+
const resources = [];
|
|
83
|
+
const observed = new Map();
|
|
84
|
+
/** `<resourceType>\0<id or name>` → key, so a binding can find its target either way. */
|
|
85
|
+
const lookup = new Map();
|
|
86
|
+
const index = (resourceType, ref, key) => {
|
|
87
|
+
if (ref)
|
|
88
|
+
lookup.set(`${resourceType}\u0000${ref}`, key);
|
|
89
|
+
};
|
|
90
|
+
// Stores first, so Worker bindings can resolve against them.
|
|
91
|
+
for (const tf of tfResources) {
|
|
92
|
+
const store = STORE_TYPES[tf.type];
|
|
93
|
+
if (!store)
|
|
94
|
+
continue;
|
|
95
|
+
const name = str(tf.values[store.nameField]);
|
|
96
|
+
const id = str(tf.values.id);
|
|
97
|
+
const identifier = store.keyById ? id ?? name : name;
|
|
98
|
+
if (!identifier)
|
|
99
|
+
continue;
|
|
100
|
+
const key = (0, types_1.infraResourceKey)(PROVIDER, store.resourceType, identifier);
|
|
101
|
+
resources.push({
|
|
102
|
+
key,
|
|
103
|
+
provider: PROVIDER,
|
|
104
|
+
resourceType: store.resourceType,
|
|
105
|
+
name: identifier,
|
|
106
|
+
label: name ?? identifier,
|
|
107
|
+
source: source(tf.address),
|
|
108
|
+
...(id ? { attributes: { id } } : {}),
|
|
109
|
+
});
|
|
110
|
+
index(store.resourceType, id, key);
|
|
111
|
+
index(store.resourceType, name, key);
|
|
112
|
+
observed.set(key, { ...(id ? { resourceId: id } : {}) });
|
|
113
|
+
}
|
|
114
|
+
// Workers: the classic single-resource script, and the split worker + version.
|
|
115
|
+
/** Worker id or name → key, for `cloudflare_worker_version.worker_id`. */
|
|
116
|
+
const workerKeys = new Map();
|
|
117
|
+
for (const tf of tfResources) {
|
|
118
|
+
const isScript = tf.type === 'cloudflare_workers_script';
|
|
119
|
+
if (!isScript && tf.type !== 'cloudflare_worker')
|
|
120
|
+
continue;
|
|
121
|
+
const name = str(isScript ? tf.values.script_name : tf.values.name);
|
|
122
|
+
if (!name)
|
|
123
|
+
continue;
|
|
124
|
+
const key = (0, types_1.infraResourceKey)(PROVIDER, 'worker', name);
|
|
125
|
+
const id = str(tf.values.id);
|
|
126
|
+
resources.push({
|
|
127
|
+
key,
|
|
128
|
+
provider: PROVIDER,
|
|
129
|
+
resourceType: 'worker',
|
|
130
|
+
name,
|
|
131
|
+
label: name,
|
|
132
|
+
source: source(tf.address),
|
|
133
|
+
});
|
|
134
|
+
workerKeys.set(name, key);
|
|
135
|
+
if (id)
|
|
136
|
+
workerKeys.set(id, key);
|
|
137
|
+
index('worker', name, key);
|
|
138
|
+
// `subdomain.url` is present whenever the account owns a workers.dev
|
|
139
|
+
// subdomain, so it is only a live URL when the subdomain is enabled.
|
|
140
|
+
const subdomain = isObject(tf.values.subdomain) ? tf.values.subdomain : undefined;
|
|
141
|
+
const url = subdomain?.enabled === true ? str(subdomain.url) : undefined;
|
|
142
|
+
observed.set(key, {
|
|
143
|
+
...(id ? { resourceId: id } : {}),
|
|
144
|
+
...(url ? { liveUrls: [url] } : {}),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const bindings = [];
|
|
148
|
+
for (const tf of tfResources) {
|
|
149
|
+
let from;
|
|
150
|
+
if (tf.type === 'cloudflare_workers_script') {
|
|
151
|
+
const name = str(tf.values.script_name);
|
|
152
|
+
from = name ? workerKeys.get(name) : undefined;
|
|
153
|
+
}
|
|
154
|
+
else if (tf.type === 'cloudflare_worker_version') {
|
|
155
|
+
const workerId = str(tf.values.worker_id);
|
|
156
|
+
from = workerId ? workerKeys.get(workerId) : undefined;
|
|
157
|
+
}
|
|
158
|
+
if (!from || !Array.isArray(tf.values.bindings))
|
|
159
|
+
continue;
|
|
160
|
+
tf.values.bindings.forEach((entry, i) => {
|
|
161
|
+
if (!isObject(entry))
|
|
162
|
+
return;
|
|
163
|
+
const family = BINDING_TYPES[str(entry.type) ?? ''];
|
|
164
|
+
const binding = str(entry.name);
|
|
165
|
+
if (!family || !binding)
|
|
166
|
+
return;
|
|
167
|
+
const ref = family.refFields.map((field) => str(entry[field])).find(Boolean);
|
|
168
|
+
if (!ref)
|
|
169
|
+
return;
|
|
170
|
+
// Resolve through a declared resource when there is one, so a D1 binding
|
|
171
|
+
// by id lands on the database's name-based key. Otherwise key by the ref.
|
|
172
|
+
const to = lookup.get(`${family.resourceType}\u0000${ref}`) ??
|
|
173
|
+
(0, types_1.infraResourceKey)(PROVIDER, family.resourceType, ref);
|
|
174
|
+
bindings.push({ from: from, to, binding, source: source(`${tf.address}.bindings[${i}]`) });
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return { manifest: { resources, bindings }, applied, observed };
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Read the declared resources out of `terraform show -json` output — applied
|
|
181
|
+
* state or a saved plan. Unknown resource types are ignored.
|
|
182
|
+
*/
|
|
183
|
+
function extractTerraformManifest(showJson, options) {
|
|
184
|
+
return extract(showJson, options).manifest;
|
|
185
|
+
}
|
|
186
|
+
exports.extractTerraformManifest = extractTerraformManifest;
|
|
187
|
+
/**
|
|
188
|
+
* Turn applied state into deployment observations.
|
|
189
|
+
*
|
|
190
|
+
* State is a record of the last apply, not a live check: a resource deleted
|
|
191
|
+
* out of band still appears. The observation says so through its `source`
|
|
192
|
+
* (`terraform-state`), and `observedAt` should be when the state was read.
|
|
193
|
+
* A plan yields no observations.
|
|
194
|
+
*/
|
|
195
|
+
function terraformStateObservations(showJson, options) {
|
|
196
|
+
const { manifest, applied, observed } = extract(showJson, options);
|
|
197
|
+
if (!applied)
|
|
198
|
+
return [];
|
|
199
|
+
return manifest.resources.map((resource) => ({
|
|
200
|
+
resourceKey: resource.key,
|
|
201
|
+
status: 'deployed',
|
|
202
|
+
...observed.get(resource.key),
|
|
203
|
+
observedAt: options.observedAt,
|
|
204
|
+
source: 'terraform-state',
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
exports.terraformStateObservations = terraformStateObservations;
|
|
208
|
+
//# sourceMappingURL=terraform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terraform.js","sourceRoot":"","sources":["../../src/infra/terraform.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mCAOiB;AAEjB,MAAM,QAAQ,GAAG,YAAY,CAAC;AAI9B,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAQD,yEAAyE;AACzE,SAAS,gBAAgB,CAAC,MAAe,EAAE,MAAoB,EAAE;IAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,GAAG,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QACnC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;YACvC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS;gBAAE,SAAS;YACjE,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI;gBAAE,SAAS;YAChC,GAAG,CAAC,IAAI,CAAC,EAAE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