@suss/contract-wrangler 0.8.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/LICENSE +205 -0
- package/README.md +63 -0
- package/dist/index.cjs +376 -0
- package/dist/index.d.cts +133 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +334 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable by
|
|
79
|
+
such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and do not
|
|
117
|
+
modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor has
|
|
163
|
+
been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format please. Also add information on
|
|
185
|
+
how to contact you by electronic and paper mail.
|
|
186
|
+
|
|
187
|
+
If the program does not interact with users remotely through a computer
|
|
188
|
+
network, then your name and employer's name (e.g., your institution)
|
|
189
|
+
is sufficient to fill in the "name of copyright owner" field. Feel
|
|
190
|
+
free to omit the "name of employer" line if you are in no way affiliated
|
|
191
|
+
with any institution.
|
|
192
|
+
|
|
193
|
+
Copyright 2026 Nimbus Cloud AI LLC
|
|
194
|
+
|
|
195
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
you may not use this file except in compliance with the License.
|
|
197
|
+
You may obtain a copy of the License at
|
|
198
|
+
|
|
199
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
|
|
201
|
+
Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
See the License for the specific language governing permissions and
|
|
205
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @suss/contract-wrangler
|
|
2
|
+
|
|
3
|
+
Reads a Cloudflare `wrangler.toml` (or `wrangler.jsonc`) and says what the Worker it deploys is given.
|
|
4
|
+
|
|
5
|
+
## What this package is
|
|
6
|
+
|
|
7
|
+
A contract source. `suss contract --from wrangler services/api` reads the document and emits the declared side of four boundaries:
|
|
8
|
+
|
|
9
|
+
```toml
|
|
10
|
+
name = "greeting-router"
|
|
11
|
+
main = "src/index.ts"
|
|
12
|
+
|
|
13
|
+
[vars]
|
|
14
|
+
GREETING_TABLE = "prod-greetings-v2"
|
|
15
|
+
|
|
16
|
+
[[kv_namespaces]]
|
|
17
|
+
binding = "SESSIONS"
|
|
18
|
+
id = "prod-sessions"
|
|
19
|
+
|
|
20
|
+
[[queues.consumers]]
|
|
21
|
+
queue = "greeting-events"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| What the document says | What comes out |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `name`, `main` | the deployable unit and the code it runs |
|
|
27
|
+
| `[vars]` | the Worker's runtime configuration, names and values |
|
|
28
|
+
| `[[kv_namespaces]]`, `[[r2_buckets]]`, `[[d1_databases]]` | one store each |
|
|
29
|
+
| `[[queues.producers]]`, `[[queues.consumers]]` | one channel each, on `cloudflare-queues` |
|
|
30
|
+
| `[env.<name>]` | the same Worker deployed again, with the top-level document as its default |
|
|
31
|
+
|
|
32
|
+
## The values, not only the names
|
|
33
|
+
|
|
34
|
+
A runtime-config contract usually records which variables a runtime supplies, and that is enough to say whether code reads one nobody set. A Worker needs more, because it addresses its stores through a variable:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
await dynamoRequest(env, aws, "Query", { TableName: env.EDITION_TABLE });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Nothing at that call site says which table. The container comes out as `{EDITION_TABLE}`, which pairs with nothing until something says what the variable is. `[vars]` says it, so the summary keeps the values under `metadata.runtimeContract.envVarValues`, and the storage check grounds the access through the runtime that runs it.
|
|
41
|
+
|
|
42
|
+
A value the document does not state stays out. A secret is set with `wrangler secret put` or by the deployment's own tooling, never in the file, so the reader has nothing to record and the container stays unresolved.
|
|
43
|
+
|
|
44
|
+
## Environments
|
|
45
|
+
|
|
46
|
+
`[env.staging]` deploys the same Worker again under its own name, `greeting-router-staging` unless the block gives a `name`. Each one gets its own summary.
|
|
47
|
+
|
|
48
|
+
Wrangler replaces a whole block rather than merging it, so an environment that declares `[env.staging.vars]` supplies those variables and none of the top-level ones. A variable that comes through untouched is recorded as `globals`, which is the same provenance a SAM `Globals` section gets, and the checker judges it once for the document instead of once per deployment.
|
|
49
|
+
|
|
50
|
+
## Code scope
|
|
51
|
+
|
|
52
|
+
The Worker's code is the directory the document is in, and `main` says which file it enters. `main` often points at a bundle a build step writes rather than at source; an entry that matches no file leaves the directory in charge, which is what places the code either way.
|
|
53
|
+
|
|
54
|
+
## Out of scope for now
|
|
55
|
+
|
|
56
|
+
- **Durable Object and service bindings.** `[[durable_objects.bindings]]` and `[[services]]` are boundaries between two Workers, and pairing them needs both sides of a deployment suss does not read yet.
|
|
57
|
+
- **Routes.** `routes` says which hostnames reach the Worker. The code side states no path, so a declared route would pair with nothing.
|
|
58
|
+
- **Cron expressions.** `[triggers] crons` says when a Worker runs, not what it exchanges.
|
|
59
|
+
- **`.dev.vars`.** It is local development configuration, and it is not what a deployment supplies.
|
|
60
|
+
|
|
61
|
+
## Where it fits in suss
|
|
62
|
+
|
|
63
|
+
Depends on `@suss/behavioral-ir` and `@suss/ir-core` for the bindings it writes. `@suss/framework-cloudflare-workers` reads the code side: the triggers the Worker serves and the variables it reads. The storage check in `@suss/checker` pairs a store this reader declares, or one a Terraform module declares, against the accesses that reach it.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
CONFIGURATION_FILE_NAMES: () => CONFIGURATION_FILE_NAMES,
|
|
34
|
+
RECOGNITION: () => RECOGNITION,
|
|
35
|
+
environmentDocuments: () => environmentDocuments,
|
|
36
|
+
isConfigurationFile: () => isConfigurationFile,
|
|
37
|
+
loadConfigurationDocument: () => loadConfigurationDocument,
|
|
38
|
+
locateConfigurationFile: () => locateConfigurationFile,
|
|
39
|
+
wranglerFileToSummaries: () => wranglerFileToSummaries,
|
|
40
|
+
wranglerToSummaries: () => wranglerToSummaries
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(index_exports);
|
|
43
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
44
|
+
var import_ir_core2 = require("@suss/ir-core");
|
|
45
|
+
|
|
46
|
+
// src/bindings.ts
|
|
47
|
+
var import_behavioral_ir = require("@suss/behavioral-ir");
|
|
48
|
+
var RECOGNITION = "wrangler";
|
|
49
|
+
var STORES = [
|
|
50
|
+
{
|
|
51
|
+
block: "kv_namespaces",
|
|
52
|
+
nameKey: "id",
|
|
53
|
+
storageSystem: "cloudflare-kv",
|
|
54
|
+
fieldSet: "none"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
block: "r2_buckets",
|
|
58
|
+
nameKey: "bucket_name",
|
|
59
|
+
storageSystem: "r2",
|
|
60
|
+
fieldSet: "none"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
block: "d1_databases",
|
|
64
|
+
nameKey: "database_name",
|
|
65
|
+
storageSystem: "d1",
|
|
66
|
+
fieldSet: "partial"
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
function storeSummaries(document, context) {
|
|
70
|
+
const summaries = [];
|
|
71
|
+
for (const store of STORES) {
|
|
72
|
+
for (const entry of blockEntries(document[store.block])) {
|
|
73
|
+
const summary = storeSummary(store, entry, context);
|
|
74
|
+
if (summary !== null) {
|
|
75
|
+
summaries.push(summary);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return summaries;
|
|
80
|
+
}
|
|
81
|
+
function storeSummary(store, entry, context) {
|
|
82
|
+
const container = stringOf(entry[store.nameKey]);
|
|
83
|
+
const boundAs = stringOf(entry.binding);
|
|
84
|
+
if (container === null) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
kind: "library",
|
|
89
|
+
location: {
|
|
90
|
+
file: context.sourceFile,
|
|
91
|
+
range: { start: 1, end: 1 },
|
|
92
|
+
exportName: null
|
|
93
|
+
},
|
|
94
|
+
identity: {
|
|
95
|
+
name: `${store.block}.${boundAs ?? container}`,
|
|
96
|
+
exportPath: null,
|
|
97
|
+
boundaryBinding: (0, import_behavioral_ir.storageBinding)({
|
|
98
|
+
recognition: RECOGNITION,
|
|
99
|
+
storageSystem: store.storageSystem,
|
|
100
|
+
scope: "default",
|
|
101
|
+
container,
|
|
102
|
+
accessPath: null
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
inputs: [],
|
|
106
|
+
transitions: [],
|
|
107
|
+
gaps: [],
|
|
108
|
+
confidence: { source: "declared", level: "high" },
|
|
109
|
+
metadata: {
|
|
110
|
+
storageContract: { fieldSet: store.fieldSet, physicalTable: container },
|
|
111
|
+
...boundAs === null ? {} : { wrangler: { binding: boundAs } }
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function queueSummaries(document, context) {
|
|
116
|
+
const queues = document.queues;
|
|
117
|
+
if (queues === null || typeof queues !== "object") {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
const block = queues;
|
|
121
|
+
return [
|
|
122
|
+
...queueSide(blockEntries(block.producers), "producers", context),
|
|
123
|
+
...queueSide(blockEntries(block.consumers), "consumers", context)
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
function queueSide(entries, side, context) {
|
|
127
|
+
const summaries = [];
|
|
128
|
+
for (const entry of entries) {
|
|
129
|
+
const channel = stringOf(entry.queue);
|
|
130
|
+
if (channel === null) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
summaries.push({
|
|
134
|
+
// A producer block declares a queue the Worker sends to, which is
|
|
135
|
+
// a channel rather than a unit that runs, so it is a library. A
|
|
136
|
+
// consumer block says this Worker drains that queue.
|
|
137
|
+
kind: side === "consumers" ? "consumer" : "library",
|
|
138
|
+
location: {
|
|
139
|
+
file: context.sourceFile,
|
|
140
|
+
range: { start: 1, end: 1 },
|
|
141
|
+
exportName: null
|
|
142
|
+
},
|
|
143
|
+
identity: {
|
|
144
|
+
name: side === "consumers" ? `${context.scriptName}.queue.${channel}` : `queues.producers.${channel}`,
|
|
145
|
+
exportPath: null,
|
|
146
|
+
boundaryBinding: (0, import_behavioral_ir.messageBusBinding)({
|
|
147
|
+
recognition: RECOGNITION,
|
|
148
|
+
messageBus: "cloudflare-queues",
|
|
149
|
+
channel
|
|
150
|
+
}),
|
|
151
|
+
...side === "consumers" ? {
|
|
152
|
+
deployableUnit: {
|
|
153
|
+
deploymentTarget: "worker",
|
|
154
|
+
instanceName: context.scriptName
|
|
155
|
+
}
|
|
156
|
+
} : {}
|
|
157
|
+
},
|
|
158
|
+
inputs: [],
|
|
159
|
+
transitions: [],
|
|
160
|
+
gaps: [],
|
|
161
|
+
confidence: { source: "declared", level: "high" },
|
|
162
|
+
metadata: { messageBus: { queue: channel } }
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return summaries;
|
|
166
|
+
}
|
|
167
|
+
function blockEntries(raw) {
|
|
168
|
+
if (!Array.isArray(raw)) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
return raw.filter(
|
|
172
|
+
(entry) => entry !== null && typeof entry === "object" && !Array.isArray(entry)
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function stringOf(raw) {
|
|
176
|
+
return typeof raw === "string" && raw.length > 0 ? raw : null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/document.ts
|
|
180
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
181
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
182
|
+
var import_jsonc_parser = require("jsonc-parser");
|
|
183
|
+
var import_smol_toml = require("smol-toml");
|
|
184
|
+
var CONFIGURATION_FILE_NAMES = [
|
|
185
|
+
"wrangler.jsonc",
|
|
186
|
+
"wrangler.json",
|
|
187
|
+
"wrangler.toml"
|
|
188
|
+
];
|
|
189
|
+
function isConfigurationFile(basename) {
|
|
190
|
+
return CONFIGURATION_FILE_NAMES.includes(basename);
|
|
191
|
+
}
|
|
192
|
+
function locateConfigurationFile(target) {
|
|
193
|
+
const resolved = import_node_path.default.resolve(target);
|
|
194
|
+
if (!import_node_fs.default.existsSync(resolved)) {
|
|
195
|
+
return { kind: "missing" };
|
|
196
|
+
}
|
|
197
|
+
if (import_node_fs.default.statSync(resolved).isFile()) {
|
|
198
|
+
return { kind: "file", file: resolved };
|
|
199
|
+
}
|
|
200
|
+
for (const name of CONFIGURATION_FILE_NAMES) {
|
|
201
|
+
const candidate = import_node_path.default.join(resolved, name);
|
|
202
|
+
if (import_node_fs.default.existsSync(candidate)) {
|
|
203
|
+
return { kind: "file", file: candidate };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return { kind: "missing" };
|
|
207
|
+
}
|
|
208
|
+
function loadConfigurationDocument(file) {
|
|
209
|
+
const text = import_node_fs.default.readFileSync(file, "utf8");
|
|
210
|
+
const parsed = file.endsWith(".toml") ? (0, import_smol_toml.parse)(text) : (0, import_jsonc_parser.parse)(text);
|
|
211
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
212
|
+
throw new Error(`${file} does not contain a Wrangler configuration object`);
|
|
213
|
+
}
|
|
214
|
+
return parsed;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/runtimeConfig.ts
|
|
218
|
+
var import_behavioral_ir2 = require("@suss/behavioral-ir");
|
|
219
|
+
var import_ir_core = require("@suss/ir-core");
|
|
220
|
+
function environmentDocuments(document) {
|
|
221
|
+
const rootName = nameOf(document) ?? "worker";
|
|
222
|
+
const deployments = [
|
|
223
|
+
{
|
|
224
|
+
scriptName: rootName,
|
|
225
|
+
environment: null,
|
|
226
|
+
merged: document,
|
|
227
|
+
inherited: /* @__PURE__ */ new Set()
|
|
228
|
+
}
|
|
229
|
+
];
|
|
230
|
+
const environments = document.env;
|
|
231
|
+
if (environments === null || typeof environments !== "object") {
|
|
232
|
+
return deployments;
|
|
233
|
+
}
|
|
234
|
+
for (const [environment, raw] of Object.entries(environments)) {
|
|
235
|
+
if (raw === null || typeof raw !== "object") {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const overrides = raw;
|
|
239
|
+
const merged = { ...document, ...overrides };
|
|
240
|
+
delete merged.env;
|
|
241
|
+
deployments.push({
|
|
242
|
+
scriptName: nameOf(overrides) ?? `${rootName}-${environment}`,
|
|
243
|
+
environment,
|
|
244
|
+
merged,
|
|
245
|
+
inherited: inheritedNames(document, overrides)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
return deployments;
|
|
249
|
+
}
|
|
250
|
+
function inheritedNames(document, overrides) {
|
|
251
|
+
if (overrides.vars !== void 0) {
|
|
252
|
+
return /* @__PURE__ */ new Set();
|
|
253
|
+
}
|
|
254
|
+
return new Set(Object.keys(varsOf(document)));
|
|
255
|
+
}
|
|
256
|
+
function nameOf(document) {
|
|
257
|
+
return typeof document.name === "string" && document.name.length > 0 ? document.name : null;
|
|
258
|
+
}
|
|
259
|
+
function varsOf(document) {
|
|
260
|
+
const vars = document.vars;
|
|
261
|
+
return vars !== null && typeof vars === "object" && !Array.isArray(vars) ? vars : {};
|
|
262
|
+
}
|
|
263
|
+
function runtimeConfigSummary(deployment, context) {
|
|
264
|
+
const vars = varsOf(deployment.merged);
|
|
265
|
+
const names = Object.keys(vars).sort();
|
|
266
|
+
const sources = {};
|
|
267
|
+
const values = {};
|
|
268
|
+
for (const name of names) {
|
|
269
|
+
sources[name] = deployment.inherited.has(name) ? "globals" : "template";
|
|
270
|
+
const value = vars[name];
|
|
271
|
+
if (typeof value === "string") {
|
|
272
|
+
values[name] = value;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const deployableUnit = {
|
|
276
|
+
deploymentTarget: "worker",
|
|
277
|
+
instanceName: deployment.scriptName
|
|
278
|
+
};
|
|
279
|
+
return {
|
|
280
|
+
kind: "library",
|
|
281
|
+
location: {
|
|
282
|
+
file: context.sourceFile,
|
|
283
|
+
range: { start: 1, end: 1 },
|
|
284
|
+
exportName: null
|
|
285
|
+
},
|
|
286
|
+
identity: {
|
|
287
|
+
name: deployment.scriptName,
|
|
288
|
+
exportPath: null,
|
|
289
|
+
boundaryBinding: (0, import_ir_core.runtimeConfigBinding)({
|
|
290
|
+
recognition: RECOGNITION,
|
|
291
|
+
...deployableUnit
|
|
292
|
+
}),
|
|
293
|
+
deployableUnit
|
|
294
|
+
},
|
|
295
|
+
inputs: [],
|
|
296
|
+
transitions: [],
|
|
297
|
+
gaps: [],
|
|
298
|
+
confidence: { source: "declared", level: "high" },
|
|
299
|
+
metadata: (0, import_behavioral_ir2.withRuntimeContractMetadata)(
|
|
300
|
+
{ codeScope: context.codeScope },
|
|
301
|
+
{
|
|
302
|
+
envVars: names,
|
|
303
|
+
envVarSources: sources,
|
|
304
|
+
...Object.keys(values).length > 0 ? { envVarValues: values } : {}
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/index.ts
|
|
311
|
+
function wranglerToSummaries(document, options) {
|
|
312
|
+
const summaries = [];
|
|
313
|
+
const named = /* @__PURE__ */ new Set();
|
|
314
|
+
for (const deployment of environmentDocuments(document)) {
|
|
315
|
+
const context = {
|
|
316
|
+
sourceFile: options.source,
|
|
317
|
+
scriptName: deployment.scriptName
|
|
318
|
+
};
|
|
319
|
+
summaries.push(
|
|
320
|
+
runtimeConfigSummary(deployment, {
|
|
321
|
+
sourceFile: options.source,
|
|
322
|
+
codeScope: codeScopeFor(deployment.merged, options.codeScope)
|
|
323
|
+
})
|
|
324
|
+
);
|
|
325
|
+
for (const summary of [
|
|
326
|
+
...storeSummaries(deployment.merged, context),
|
|
327
|
+
...queueSummaries(deployment.merged, context)
|
|
328
|
+
]) {
|
|
329
|
+
if (named.has(summary.identity.name)) {
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
named.add(summary.identity.name);
|
|
333
|
+
summaries.push(summary);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return summaries;
|
|
337
|
+
}
|
|
338
|
+
function wranglerFileToSummaries(target, options = {}) {
|
|
339
|
+
const located = locateConfigurationFile(target);
|
|
340
|
+
if (located.kind === "missing") {
|
|
341
|
+
throw new Error(`Wrangler configuration not found: ${target}`);
|
|
342
|
+
}
|
|
343
|
+
const document = loadConfigurationDocument(located.file);
|
|
344
|
+
return wranglerToSummaries(document, {
|
|
345
|
+
source: options.source ?? `${RECOGNITION}:${relativeToRun(located.file)}`,
|
|
346
|
+
codeScope: options.codeScope ?? (0, import_ir_core2.codeScopePath)(import_node_path2.default.dirname(relativeToRun(located.file)))
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function relativeToRun(file) {
|
|
350
|
+
const relative = import_node_path2.default.relative(process.cwd(), import_node_path2.default.resolve(file));
|
|
351
|
+
if (relative === "" || relative.startsWith("..")) {
|
|
352
|
+
return import_node_path2.default.resolve(file).split(import_node_path2.default.sep).join("/");
|
|
353
|
+
}
|
|
354
|
+
return relative.split(import_node_path2.default.sep).join("/");
|
|
355
|
+
}
|
|
356
|
+
function codeScopeFor(document, scope) {
|
|
357
|
+
const main = typeof document.main === "string" ? document.main : null;
|
|
358
|
+
if (main === null) {
|
|
359
|
+
return { kind: "codeUri", path: scope };
|
|
360
|
+
}
|
|
361
|
+
const entry = (0, import_ir_core2.codeScopePath)(
|
|
362
|
+
import_node_path2.default.posix.join(scope, main.replace(/\.[cm]?[jt]sx?$/, ""))
|
|
363
|
+
);
|
|
364
|
+
return { kind: "codeUri", path: scope, entry };
|
|
365
|
+
}
|
|
366
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
367
|
+
0 && (module.exports = {
|
|
368
|
+
CONFIGURATION_FILE_NAMES,
|
|
369
|
+
RECOGNITION,
|
|
370
|
+
environmentDocuments,
|
|
371
|
+
isConfigurationFile,
|
|
372
|
+
loadConfigurationDocument,
|
|
373
|
+
locateConfigurationFile,
|
|
374
|
+
wranglerFileToSummaries,
|
|
375
|
+
wranglerToSummaries
|
|
376
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { BehavioralSummary } from '@suss/behavioral-ir';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Finding and parsing a Wrangler configuration document.
|
|
5
|
+
*
|
|
6
|
+
* Wrangler accepts the same configuration in two spellings, TOML and
|
|
7
|
+
* JSONC, and prefers the JSON one where a project has both. This module
|
|
8
|
+
* settles which file a path means and hands back the parsed object; the
|
|
9
|
+
* shape of what is in it is `translate.ts`'s problem.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The names Wrangler looks for, in the order it prefers them. Wrangler
|
|
13
|
+
* defines the list, so a project that spells its file otherwise passes
|
|
14
|
+
* the path to that file outright.
|
|
15
|
+
*/
|
|
16
|
+
declare const CONFIGURATION_FILE_NAMES: string[];
|
|
17
|
+
/** Whether a file is one Wrangler would read as a Worker's configuration. */
|
|
18
|
+
declare function isConfigurationFile(basename: string): boolean;
|
|
19
|
+
/** One binding a Worker is given, as Wrangler writes it. */
|
|
20
|
+
type WranglerRecord = Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* A parsed Wrangler document, top-level and per-environment alike. The
|
|
23
|
+
* fields are Wrangler's own names, and everything is optional because
|
|
24
|
+
* every one of them is optional in the file.
|
|
25
|
+
*/
|
|
26
|
+
interface WranglerDocument {
|
|
27
|
+
name?: string;
|
|
28
|
+
main?: string;
|
|
29
|
+
vars?: Record<string, unknown>;
|
|
30
|
+
kv_namespaces?: WranglerRecord[];
|
|
31
|
+
r2_buckets?: WranglerRecord[];
|
|
32
|
+
d1_databases?: WranglerRecord[];
|
|
33
|
+
queues?: {
|
|
34
|
+
producers?: WranglerRecord[];
|
|
35
|
+
consumers?: WranglerRecord[];
|
|
36
|
+
};
|
|
37
|
+
env?: Record<string, WranglerDocument>;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
type DocumentLocation = {
|
|
41
|
+
kind: "file";
|
|
42
|
+
file: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "missing";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The configuration file a path means. A path may be the file itself or
|
|
48
|
+
* the directory a Worker lives in, since that is where a person points
|
|
49
|
+
* when they mean the Worker rather than one of its two spellings.
|
|
50
|
+
*/
|
|
51
|
+
declare function locateConfigurationFile(target: string): DocumentLocation;
|
|
52
|
+
/** The document a file contains, read by whichever parser its suffix asks for. */
|
|
53
|
+
declare function loadConfigurationDocument(file: string): WranglerDocument;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The stores and queues a Worker is bound to, as boundary summaries.
|
|
57
|
+
*
|
|
58
|
+
* Every binding block in a Wrangler document has the same two halves:
|
|
59
|
+
* `binding`, the name the code reads it under, and a key giving the
|
|
60
|
+
* resource's own name. The code says the first, the deployment declares the
|
|
61
|
+
* second, so a summary keeps both: the container is the resource's own
|
|
62
|
+
* name, which is what another manifest declaring that resource spells,
|
|
63
|
+
* and `physicalTable` records it again for a reader.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/** The manifest language recorded on every binding this reader writes. */
|
|
67
|
+
declare const RECOGNITION = "wrangler";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The configuration contract a Wrangler document declares.
|
|
71
|
+
*
|
|
72
|
+
* A Worker reads its variables off the second argument to every
|
|
73
|
+
* trigger, so the channel is the same one a Node process reads through
|
|
74
|
+
* `process.env`, and the summary is the same shape the CloudFormation
|
|
75
|
+
* reader writes for a Lambda: a runtime-config provider, one per
|
|
76
|
+
* deployment, keyed on the deployable unit.
|
|
77
|
+
*
|
|
78
|
+
* The values go on it as well as the names. A Worker addresses a store
|
|
79
|
+
* through a variable rather than by name, `TableName: env.EDITION_TABLE`,
|
|
80
|
+
* so the value is what says which store the access reaches.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/** One Worker as deployed: an environment's document over the default one. */
|
|
84
|
+
interface Deployment {
|
|
85
|
+
/** The name Cloudflare deploys this script under. */
|
|
86
|
+
scriptName: string;
|
|
87
|
+
/** The environment this deployment is, or null for the default one. */
|
|
88
|
+
environment: string | null;
|
|
89
|
+
/** The environment's document with the top-level one behind it. */
|
|
90
|
+
merged: WranglerDocument;
|
|
91
|
+
/** Which variables the top-level document supplied rather than this one. */
|
|
92
|
+
inherited: Set<string>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Every deployment a document declares. Wrangler deploys the top-level
|
|
96
|
+
* document as one Worker and each `[env.<name>]` as another, and an
|
|
97
|
+
* environment with no `name` of its own is deployed as
|
|
98
|
+
* `<name>-<environment>`.
|
|
99
|
+
*/
|
|
100
|
+
declare function environmentDocuments(document: WranglerDocument): Deployment[];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @suss/contract-wrangler: behavioral summaries from a Wrangler
|
|
104
|
+
* configuration document.
|
|
105
|
+
*
|
|
106
|
+
* A `wrangler.toml` deploys a working Worker, and before this reader
|
|
107
|
+
* existed suss saw none of it: no deployable unit, no configuration
|
|
108
|
+
* contract, no stores and no queues. `name` and `main` give the unit
|
|
109
|
+
* and the code it runs, `vars` gives the configuration, the three
|
|
110
|
+
* binding blocks give stores, `queues` gives the channels it sends on
|
|
111
|
+
* and drains, and each `env.<name>` deploys the same Worker again with
|
|
112
|
+
* the top-level document as its default. The README says how each half
|
|
113
|
+
* pairs.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
interface WranglerToSummariesOptions {
|
|
117
|
+
/** Override the logical source file recorded on each summary. */
|
|
118
|
+
source?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The directory the Worker's code is in, relative to wherever the
|
|
121
|
+
* extraction run was pointed. Defaults to where the document is,
|
|
122
|
+
* relative to the working directory.
|
|
123
|
+
*/
|
|
124
|
+
codeScope?: string;
|
|
125
|
+
}
|
|
126
|
+
declare function wranglerToSummaries(document: WranglerDocument, options: {
|
|
127
|
+
source: string;
|
|
128
|
+
codeScope: string;
|
|
129
|
+
}): BehavioralSummary[];
|
|
130
|
+
/** The path may be the document itself or the directory the Worker is in. */
|
|
131
|
+
declare function wranglerFileToSummaries(target: string, options?: WranglerToSummariesOptions): BehavioralSummary[];
|
|
132
|
+
|
|
133
|
+
export { CONFIGURATION_FILE_NAMES, type DocumentLocation, RECOGNITION, type WranglerDocument, type WranglerRecord, type WranglerToSummariesOptions, environmentDocuments, isConfigurationFile, loadConfigurationDocument, locateConfigurationFile, wranglerFileToSummaries, wranglerToSummaries };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { BehavioralSummary } from '@suss/behavioral-ir';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Finding and parsing a Wrangler configuration document.
|
|
5
|
+
*
|
|
6
|
+
* Wrangler accepts the same configuration in two spellings, TOML and
|
|
7
|
+
* JSONC, and prefers the JSON one where a project has both. This module
|
|
8
|
+
* settles which file a path means and hands back the parsed object; the
|
|
9
|
+
* shape of what is in it is `translate.ts`'s problem.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The names Wrangler looks for, in the order it prefers them. Wrangler
|
|
13
|
+
* defines the list, so a project that spells its file otherwise passes
|
|
14
|
+
* the path to that file outright.
|
|
15
|
+
*/
|
|
16
|
+
declare const CONFIGURATION_FILE_NAMES: string[];
|
|
17
|
+
/** Whether a file is one Wrangler would read as a Worker's configuration. */
|
|
18
|
+
declare function isConfigurationFile(basename: string): boolean;
|
|
19
|
+
/** One binding a Worker is given, as Wrangler writes it. */
|
|
20
|
+
type WranglerRecord = Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* A parsed Wrangler document, top-level and per-environment alike. The
|
|
23
|
+
* fields are Wrangler's own names, and everything is optional because
|
|
24
|
+
* every one of them is optional in the file.
|
|
25
|
+
*/
|
|
26
|
+
interface WranglerDocument {
|
|
27
|
+
name?: string;
|
|
28
|
+
main?: string;
|
|
29
|
+
vars?: Record<string, unknown>;
|
|
30
|
+
kv_namespaces?: WranglerRecord[];
|
|
31
|
+
r2_buckets?: WranglerRecord[];
|
|
32
|
+
d1_databases?: WranglerRecord[];
|
|
33
|
+
queues?: {
|
|
34
|
+
producers?: WranglerRecord[];
|
|
35
|
+
consumers?: WranglerRecord[];
|
|
36
|
+
};
|
|
37
|
+
env?: Record<string, WranglerDocument>;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
type DocumentLocation = {
|
|
41
|
+
kind: "file";
|
|
42
|
+
file: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "missing";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The configuration file a path means. A path may be the file itself or
|
|
48
|
+
* the directory a Worker lives in, since that is where a person points
|
|
49
|
+
* when they mean the Worker rather than one of its two spellings.
|
|
50
|
+
*/
|
|
51
|
+
declare function locateConfigurationFile(target: string): DocumentLocation;
|
|
52
|
+
/** The document a file contains, read by whichever parser its suffix asks for. */
|
|
53
|
+
declare function loadConfigurationDocument(file: string): WranglerDocument;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The stores and queues a Worker is bound to, as boundary summaries.
|
|
57
|
+
*
|
|
58
|
+
* Every binding block in a Wrangler document has the same two halves:
|
|
59
|
+
* `binding`, the name the code reads it under, and a key giving the
|
|
60
|
+
* resource's own name. The code says the first, the deployment declares the
|
|
61
|
+
* second, so a summary keeps both: the container is the resource's own
|
|
62
|
+
* name, which is what another manifest declaring that resource spells,
|
|
63
|
+
* and `physicalTable` records it again for a reader.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/** The manifest language recorded on every binding this reader writes. */
|
|
67
|
+
declare const RECOGNITION = "wrangler";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The configuration contract a Wrangler document declares.
|
|
71
|
+
*
|
|
72
|
+
* A Worker reads its variables off the second argument to every
|
|
73
|
+
* trigger, so the channel is the same one a Node process reads through
|
|
74
|
+
* `process.env`, and the summary is the same shape the CloudFormation
|
|
75
|
+
* reader writes for a Lambda: a runtime-config provider, one per
|
|
76
|
+
* deployment, keyed on the deployable unit.
|
|
77
|
+
*
|
|
78
|
+
* The values go on it as well as the names. A Worker addresses a store
|
|
79
|
+
* through a variable rather than by name, `TableName: env.EDITION_TABLE`,
|
|
80
|
+
* so the value is what says which store the access reaches.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/** One Worker as deployed: an environment's document over the default one. */
|
|
84
|
+
interface Deployment {
|
|
85
|
+
/** The name Cloudflare deploys this script under. */
|
|
86
|
+
scriptName: string;
|
|
87
|
+
/** The environment this deployment is, or null for the default one. */
|
|
88
|
+
environment: string | null;
|
|
89
|
+
/** The environment's document with the top-level one behind it. */
|
|
90
|
+
merged: WranglerDocument;
|
|
91
|
+
/** Which variables the top-level document supplied rather than this one. */
|
|
92
|
+
inherited: Set<string>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Every deployment a document declares. Wrangler deploys the top-level
|
|
96
|
+
* document as one Worker and each `[env.<name>]` as another, and an
|
|
97
|
+
* environment with no `name` of its own is deployed as
|
|
98
|
+
* `<name>-<environment>`.
|
|
99
|
+
*/
|
|
100
|
+
declare function environmentDocuments(document: WranglerDocument): Deployment[];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @suss/contract-wrangler: behavioral summaries from a Wrangler
|
|
104
|
+
* configuration document.
|
|
105
|
+
*
|
|
106
|
+
* A `wrangler.toml` deploys a working Worker, and before this reader
|
|
107
|
+
* existed suss saw none of it: no deployable unit, no configuration
|
|
108
|
+
* contract, no stores and no queues. `name` and `main` give the unit
|
|
109
|
+
* and the code it runs, `vars` gives the configuration, the three
|
|
110
|
+
* binding blocks give stores, `queues` gives the channels it sends on
|
|
111
|
+
* and drains, and each `env.<name>` deploys the same Worker again with
|
|
112
|
+
* the top-level document as its default. The README says how each half
|
|
113
|
+
* pairs.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
interface WranglerToSummariesOptions {
|
|
117
|
+
/** Override the logical source file recorded on each summary. */
|
|
118
|
+
source?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The directory the Worker's code is in, relative to wherever the
|
|
121
|
+
* extraction run was pointed. Defaults to where the document is,
|
|
122
|
+
* relative to the working directory.
|
|
123
|
+
*/
|
|
124
|
+
codeScope?: string;
|
|
125
|
+
}
|
|
126
|
+
declare function wranglerToSummaries(document: WranglerDocument, options: {
|
|
127
|
+
source: string;
|
|
128
|
+
codeScope: string;
|
|
129
|
+
}): BehavioralSummary[];
|
|
130
|
+
/** The path may be the document itself or the directory the Worker is in. */
|
|
131
|
+
declare function wranglerFileToSummaries(target: string, options?: WranglerToSummariesOptions): BehavioralSummary[];
|
|
132
|
+
|
|
133
|
+
export { CONFIGURATION_FILE_NAMES, type DocumentLocation, RECOGNITION, type WranglerDocument, type WranglerRecord, type WranglerToSummariesOptions, environmentDocuments, isConfigurationFile, loadConfigurationDocument, locateConfigurationFile, wranglerFileToSummaries, wranglerToSummaries };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import path2 from "path";
|
|
3
|
+
import { codeScopePath } from "@suss/ir-core";
|
|
4
|
+
|
|
5
|
+
// src/bindings.ts
|
|
6
|
+
import { messageBusBinding, storageBinding } from "@suss/behavioral-ir";
|
|
7
|
+
var RECOGNITION = "wrangler";
|
|
8
|
+
var STORES = [
|
|
9
|
+
{
|
|
10
|
+
block: "kv_namespaces",
|
|
11
|
+
nameKey: "id",
|
|
12
|
+
storageSystem: "cloudflare-kv",
|
|
13
|
+
fieldSet: "none"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
block: "r2_buckets",
|
|
17
|
+
nameKey: "bucket_name",
|
|
18
|
+
storageSystem: "r2",
|
|
19
|
+
fieldSet: "none"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
block: "d1_databases",
|
|
23
|
+
nameKey: "database_name",
|
|
24
|
+
storageSystem: "d1",
|
|
25
|
+
fieldSet: "partial"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
function storeSummaries(document, context) {
|
|
29
|
+
const summaries = [];
|
|
30
|
+
for (const store of STORES) {
|
|
31
|
+
for (const entry of blockEntries(document[store.block])) {
|
|
32
|
+
const summary = storeSummary(store, entry, context);
|
|
33
|
+
if (summary !== null) {
|
|
34
|
+
summaries.push(summary);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return summaries;
|
|
39
|
+
}
|
|
40
|
+
function storeSummary(store, entry, context) {
|
|
41
|
+
const container = stringOf(entry[store.nameKey]);
|
|
42
|
+
const boundAs = stringOf(entry.binding);
|
|
43
|
+
if (container === null) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
kind: "library",
|
|
48
|
+
location: {
|
|
49
|
+
file: context.sourceFile,
|
|
50
|
+
range: { start: 1, end: 1 },
|
|
51
|
+
exportName: null
|
|
52
|
+
},
|
|
53
|
+
identity: {
|
|
54
|
+
name: `${store.block}.${boundAs ?? container}`,
|
|
55
|
+
exportPath: null,
|
|
56
|
+
boundaryBinding: storageBinding({
|
|
57
|
+
recognition: RECOGNITION,
|
|
58
|
+
storageSystem: store.storageSystem,
|
|
59
|
+
scope: "default",
|
|
60
|
+
container,
|
|
61
|
+
accessPath: null
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
inputs: [],
|
|
65
|
+
transitions: [],
|
|
66
|
+
gaps: [],
|
|
67
|
+
confidence: { source: "declared", level: "high" },
|
|
68
|
+
metadata: {
|
|
69
|
+
storageContract: { fieldSet: store.fieldSet, physicalTable: container },
|
|
70
|
+
...boundAs === null ? {} : { wrangler: { binding: boundAs } }
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function queueSummaries(document, context) {
|
|
75
|
+
const queues = document.queues;
|
|
76
|
+
if (queues === null || typeof queues !== "object") {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
const block = queues;
|
|
80
|
+
return [
|
|
81
|
+
...queueSide(blockEntries(block.producers), "producers", context),
|
|
82
|
+
...queueSide(blockEntries(block.consumers), "consumers", context)
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
function queueSide(entries, side, context) {
|
|
86
|
+
const summaries = [];
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
const channel = stringOf(entry.queue);
|
|
89
|
+
if (channel === null) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
summaries.push({
|
|
93
|
+
// A producer block declares a queue the Worker sends to, which is
|
|
94
|
+
// a channel rather than a unit that runs, so it is a library. A
|
|
95
|
+
// consumer block says this Worker drains that queue.
|
|
96
|
+
kind: side === "consumers" ? "consumer" : "library",
|
|
97
|
+
location: {
|
|
98
|
+
file: context.sourceFile,
|
|
99
|
+
range: { start: 1, end: 1 },
|
|
100
|
+
exportName: null
|
|
101
|
+
},
|
|
102
|
+
identity: {
|
|
103
|
+
name: side === "consumers" ? `${context.scriptName}.queue.${channel}` : `queues.producers.${channel}`,
|
|
104
|
+
exportPath: null,
|
|
105
|
+
boundaryBinding: messageBusBinding({
|
|
106
|
+
recognition: RECOGNITION,
|
|
107
|
+
messageBus: "cloudflare-queues",
|
|
108
|
+
channel
|
|
109
|
+
}),
|
|
110
|
+
...side === "consumers" ? {
|
|
111
|
+
deployableUnit: {
|
|
112
|
+
deploymentTarget: "worker",
|
|
113
|
+
instanceName: context.scriptName
|
|
114
|
+
}
|
|
115
|
+
} : {}
|
|
116
|
+
},
|
|
117
|
+
inputs: [],
|
|
118
|
+
transitions: [],
|
|
119
|
+
gaps: [],
|
|
120
|
+
confidence: { source: "declared", level: "high" },
|
|
121
|
+
metadata: { messageBus: { queue: channel } }
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return summaries;
|
|
125
|
+
}
|
|
126
|
+
function blockEntries(raw) {
|
|
127
|
+
if (!Array.isArray(raw)) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
return raw.filter(
|
|
131
|
+
(entry) => entry !== null && typeof entry === "object" && !Array.isArray(entry)
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function stringOf(raw) {
|
|
135
|
+
return typeof raw === "string" && raw.length > 0 ? raw : null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/document.ts
|
|
139
|
+
import fs from "fs";
|
|
140
|
+
import path from "path";
|
|
141
|
+
import { parse as parseJsonc } from "jsonc-parser";
|
|
142
|
+
import { parse as parseToml } from "smol-toml";
|
|
143
|
+
var CONFIGURATION_FILE_NAMES = [
|
|
144
|
+
"wrangler.jsonc",
|
|
145
|
+
"wrangler.json",
|
|
146
|
+
"wrangler.toml"
|
|
147
|
+
];
|
|
148
|
+
function isConfigurationFile(basename) {
|
|
149
|
+
return CONFIGURATION_FILE_NAMES.includes(basename);
|
|
150
|
+
}
|
|
151
|
+
function locateConfigurationFile(target) {
|
|
152
|
+
const resolved = path.resolve(target);
|
|
153
|
+
if (!fs.existsSync(resolved)) {
|
|
154
|
+
return { kind: "missing" };
|
|
155
|
+
}
|
|
156
|
+
if (fs.statSync(resolved).isFile()) {
|
|
157
|
+
return { kind: "file", file: resolved };
|
|
158
|
+
}
|
|
159
|
+
for (const name of CONFIGURATION_FILE_NAMES) {
|
|
160
|
+
const candidate = path.join(resolved, name);
|
|
161
|
+
if (fs.existsSync(candidate)) {
|
|
162
|
+
return { kind: "file", file: candidate };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return { kind: "missing" };
|
|
166
|
+
}
|
|
167
|
+
function loadConfigurationDocument(file) {
|
|
168
|
+
const text = fs.readFileSync(file, "utf8");
|
|
169
|
+
const parsed = file.endsWith(".toml") ? parseToml(text) : parseJsonc(text);
|
|
170
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
171
|
+
throw new Error(`${file} does not contain a Wrangler configuration object`);
|
|
172
|
+
}
|
|
173
|
+
return parsed;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/runtimeConfig.ts
|
|
177
|
+
import { withRuntimeContractMetadata } from "@suss/behavioral-ir";
|
|
178
|
+
import { runtimeConfigBinding } from "@suss/ir-core";
|
|
179
|
+
function environmentDocuments(document) {
|
|
180
|
+
const rootName = nameOf(document) ?? "worker";
|
|
181
|
+
const deployments = [
|
|
182
|
+
{
|
|
183
|
+
scriptName: rootName,
|
|
184
|
+
environment: null,
|
|
185
|
+
merged: document,
|
|
186
|
+
inherited: /* @__PURE__ */ new Set()
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
const environments = document.env;
|
|
190
|
+
if (environments === null || typeof environments !== "object") {
|
|
191
|
+
return deployments;
|
|
192
|
+
}
|
|
193
|
+
for (const [environment, raw] of Object.entries(environments)) {
|
|
194
|
+
if (raw === null || typeof raw !== "object") {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const overrides = raw;
|
|
198
|
+
const merged = { ...document, ...overrides };
|
|
199
|
+
delete merged.env;
|
|
200
|
+
deployments.push({
|
|
201
|
+
scriptName: nameOf(overrides) ?? `${rootName}-${environment}`,
|
|
202
|
+
environment,
|
|
203
|
+
merged,
|
|
204
|
+
inherited: inheritedNames(document, overrides)
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return deployments;
|
|
208
|
+
}
|
|
209
|
+
function inheritedNames(document, overrides) {
|
|
210
|
+
if (overrides.vars !== void 0) {
|
|
211
|
+
return /* @__PURE__ */ new Set();
|
|
212
|
+
}
|
|
213
|
+
return new Set(Object.keys(varsOf(document)));
|
|
214
|
+
}
|
|
215
|
+
function nameOf(document) {
|
|
216
|
+
return typeof document.name === "string" && document.name.length > 0 ? document.name : null;
|
|
217
|
+
}
|
|
218
|
+
function varsOf(document) {
|
|
219
|
+
const vars = document.vars;
|
|
220
|
+
return vars !== null && typeof vars === "object" && !Array.isArray(vars) ? vars : {};
|
|
221
|
+
}
|
|
222
|
+
function runtimeConfigSummary(deployment, context) {
|
|
223
|
+
const vars = varsOf(deployment.merged);
|
|
224
|
+
const names = Object.keys(vars).sort();
|
|
225
|
+
const sources = {};
|
|
226
|
+
const values = {};
|
|
227
|
+
for (const name of names) {
|
|
228
|
+
sources[name] = deployment.inherited.has(name) ? "globals" : "template";
|
|
229
|
+
const value = vars[name];
|
|
230
|
+
if (typeof value === "string") {
|
|
231
|
+
values[name] = value;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const deployableUnit = {
|
|
235
|
+
deploymentTarget: "worker",
|
|
236
|
+
instanceName: deployment.scriptName
|
|
237
|
+
};
|
|
238
|
+
return {
|
|
239
|
+
kind: "library",
|
|
240
|
+
location: {
|
|
241
|
+
file: context.sourceFile,
|
|
242
|
+
range: { start: 1, end: 1 },
|
|
243
|
+
exportName: null
|
|
244
|
+
},
|
|
245
|
+
identity: {
|
|
246
|
+
name: deployment.scriptName,
|
|
247
|
+
exportPath: null,
|
|
248
|
+
boundaryBinding: runtimeConfigBinding({
|
|
249
|
+
recognition: RECOGNITION,
|
|
250
|
+
...deployableUnit
|
|
251
|
+
}),
|
|
252
|
+
deployableUnit
|
|
253
|
+
},
|
|
254
|
+
inputs: [],
|
|
255
|
+
transitions: [],
|
|
256
|
+
gaps: [],
|
|
257
|
+
confidence: { source: "declared", level: "high" },
|
|
258
|
+
metadata: withRuntimeContractMetadata(
|
|
259
|
+
{ codeScope: context.codeScope },
|
|
260
|
+
{
|
|
261
|
+
envVars: names,
|
|
262
|
+
envVarSources: sources,
|
|
263
|
+
...Object.keys(values).length > 0 ? { envVarValues: values } : {}
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/index.ts
|
|
270
|
+
function wranglerToSummaries(document, options) {
|
|
271
|
+
const summaries = [];
|
|
272
|
+
const named = /* @__PURE__ */ new Set();
|
|
273
|
+
for (const deployment of environmentDocuments(document)) {
|
|
274
|
+
const context = {
|
|
275
|
+
sourceFile: options.source,
|
|
276
|
+
scriptName: deployment.scriptName
|
|
277
|
+
};
|
|
278
|
+
summaries.push(
|
|
279
|
+
runtimeConfigSummary(deployment, {
|
|
280
|
+
sourceFile: options.source,
|
|
281
|
+
codeScope: codeScopeFor(deployment.merged, options.codeScope)
|
|
282
|
+
})
|
|
283
|
+
);
|
|
284
|
+
for (const summary of [
|
|
285
|
+
...storeSummaries(deployment.merged, context),
|
|
286
|
+
...queueSummaries(deployment.merged, context)
|
|
287
|
+
]) {
|
|
288
|
+
if (named.has(summary.identity.name)) {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
named.add(summary.identity.name);
|
|
292
|
+
summaries.push(summary);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return summaries;
|
|
296
|
+
}
|
|
297
|
+
function wranglerFileToSummaries(target, options = {}) {
|
|
298
|
+
const located = locateConfigurationFile(target);
|
|
299
|
+
if (located.kind === "missing") {
|
|
300
|
+
throw new Error(`Wrangler configuration not found: ${target}`);
|
|
301
|
+
}
|
|
302
|
+
const document = loadConfigurationDocument(located.file);
|
|
303
|
+
return wranglerToSummaries(document, {
|
|
304
|
+
source: options.source ?? `${RECOGNITION}:${relativeToRun(located.file)}`,
|
|
305
|
+
codeScope: options.codeScope ?? codeScopePath(path2.dirname(relativeToRun(located.file)))
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
function relativeToRun(file) {
|
|
309
|
+
const relative = path2.relative(process.cwd(), path2.resolve(file));
|
|
310
|
+
if (relative === "" || relative.startsWith("..")) {
|
|
311
|
+
return path2.resolve(file).split(path2.sep).join("/");
|
|
312
|
+
}
|
|
313
|
+
return relative.split(path2.sep).join("/");
|
|
314
|
+
}
|
|
315
|
+
function codeScopeFor(document, scope) {
|
|
316
|
+
const main = typeof document.main === "string" ? document.main : null;
|
|
317
|
+
if (main === null) {
|
|
318
|
+
return { kind: "codeUri", path: scope };
|
|
319
|
+
}
|
|
320
|
+
const entry = codeScopePath(
|
|
321
|
+
path2.posix.join(scope, main.replace(/\.[cm]?[jt]sx?$/, ""))
|
|
322
|
+
);
|
|
323
|
+
return { kind: "codeUri", path: scope, entry };
|
|
324
|
+
}
|
|
325
|
+
export {
|
|
326
|
+
CONFIGURATION_FILE_NAMES,
|
|
327
|
+
RECOGNITION,
|
|
328
|
+
environmentDocuments,
|
|
329
|
+
isConfigurationFile,
|
|
330
|
+
loadConfigurationDocument,
|
|
331
|
+
locateConfigurationFile,
|
|
332
|
+
wranglerFileToSummaries,
|
|
333
|
+
wranglerToSummaries
|
|
334
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@suss/contract-wrangler",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Generate suss behavioral summaries from a Cloudflare wrangler.toml or wrangler.jsonc.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"suss",
|
|
8
|
+
"behavioral-summary",
|
|
9
|
+
"cloudflare",
|
|
10
|
+
"workers",
|
|
11
|
+
"wrangler"
|
|
12
|
+
],
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"author": "Nimbus Cloud AI LLC",
|
|
15
|
+
"homepage": "https://github.com/nimbuscloud-ai/suss/tree/main/packages/contract/wrangler#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/nimbuscloud-ai/suss.git",
|
|
19
|
+
"directory": "packages/contract/wrangler"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/nimbuscloud-ai/suss/issues"
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:coverage": "vitest run --coverage",
|
|
43
|
+
"lint": "biome check .",
|
|
44
|
+
"lint:fix": "biome check --write .",
|
|
45
|
+
"typecheck": "tsc --noEmit"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@suss/behavioral-ir": "0.8.0",
|
|
49
|
+
"@suss/ir-core": "0.8.0",
|
|
50
|
+
"jsonc-parser": "^3.3.1",
|
|
51
|
+
"smol-toml": "^1.4.2"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"tsup": "*",
|
|
55
|
+
"typescript": "*",
|
|
56
|
+
"vitest": "*"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
}
|
|
61
|
+
}
|