@venn-lang/stdlib 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vinicius Borges
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # @venn-lang/stdlib
2
+
3
+ > The one list of standard-library plugins, plus the fake port implementations the tooling runs them with.
4
+
5
+ The Venn kernel knows no verbs. Every namespace a `.vn` file can `use` comes from a plugin, and this
6
+ package is where the set of them is named. The CLI runs that list, and the language server reads it
7
+ for completion, hover, highlighting and `venn check`. Adding a plugin to the standard library touches
8
+ this package and nothing else.
9
+
10
+ ## Usage
11
+
12
+ ```ts
13
+ import { createNodeHost } from "@venn-lang/contracts/node";
14
+ import { parse } from "@venn-lang/core";
15
+ import { createMemorySink, createRunner } from "@venn-lang/runtime";
16
+ import { allPlugins, stdlibPortBindings } from "@venn-lang/stdlib";
17
+
18
+ const { ast, problems } = parse(source, { uri: "flow.vn" });
19
+ if (problems.length > 0) {
20
+ throw new Error(problems.map((one) => `${one.code} ${one.title}`).join("\n"));
21
+ }
22
+
23
+ const runner = createRunner({
24
+ host: createNodeHost(),
25
+ plugins: allPlugins,
26
+ sink: createMemorySink(),
27
+ ports: stdlibPortBindings,
28
+ });
29
+
30
+ const result = await runner.run(ast);
31
+ ```
32
+
33
+ The flow being run is ordinary Venn source. It declares the namespaces it wants with `use`, and every
34
+ one of them resolves because the whole stdlib is loaded:
35
+
36
+ ```ruby
37
+ module demo.stdlib
38
+
39
+ use "venn/data"
40
+ use "venn/auth"
41
+ use "venn/db"
42
+ use "venn/assert"
43
+
44
+ flow "Stdlib showcase" {
45
+ step "auth builds a bearer header" {
46
+ const header = auth.bearer "tok123"
47
+ expect header.Authorization == "Bearer tok123"
48
+ }
49
+
50
+ step "deterministic fake data" {
51
+ const roll = data.range 1 10
52
+ expect roll >= 1
53
+ }
54
+
55
+ step "in-memory database" {
56
+ db.seed { users: [{ id: 1 }, { id: 2 }] }
57
+ const rows = db.query "SELECT * FROM users"
58
+ expect rows.len == 2
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## API
64
+
65
+ | Export | Type | What it is |
66
+ | --- | --- | --- |
67
+ | `allPlugins` | `PluginDefinition[]` | Every stdlib plugin, in load order. Hand it to `createRunner`, `buildRegistry` or `createTypeCatalog`. |
68
+ | `stdlibPortBindings` | `PortBinding[]` | One implementation per stdlib port, fake where a real one would touch the network. Hand it to `createRunner` as `ports`. |
69
+
70
+ ## The plugins
71
+
72
+ Nineteen plugins, each contributing one namespace. Namespaces are unique across the list, so no
73
+ plugin can shadow another.
74
+
75
+ | Package | Namespace | Requires | What it contributes |
76
+ | --- | --- | --- | --- |
77
+ | [`@venn-lang/http`](../std-http) | `http` | `net` | Request verbs, response matchers and a nominal `Response` type. |
78
+ | [`@venn-lang/assert`](../std-assert) | `assert` | | Matchers only. `expect` is kernel; the words after it come from here. |
79
+ | [`@venn-lang/data`](../std-data) | `data` | | Deterministic test-data generators. Pure, no port. |
80
+ | [`@venn-lang/crypto`](../std-crypto) | `crypto` | | Digests, encodings, password hashing and JSON Web Tokens. |
81
+ | [`@venn-lang/env`](../std-env) | `env` | | The name only. `env.NAME` is a read, filled from the `[env.*]` tables of `venn.toml`. |
82
+ | [`@venn-lang/fmt`](../std-fmt) | `fmt` | | Value to text: JSON, tables, YAML, CSV, XML. Pure. |
83
+ | [`@venn-lang/io`](../std-io) | `io` | `io` | A script's standard input, output and arguments. |
84
+ | [`@venn-lang/mock`](../std-mock) | `mock` | | In-process mocking, feature flags and a virtual clock. |
85
+ | [`@venn-lang/auth`](../std-auth) | `auth` | `net` | Token and header builders, plus an OAuth2 client port. |
86
+ | [`@venn-lang/notify`](../std-notify) | `notify` | `net` | Notification dispatch through the Notifier port. |
87
+ | [`@venn-lang/ws`](../std-ws) | `ws` | `net` | Connect, send, expect and close over a WebSocket. |
88
+ | [`@venn-lang/mqtt`](../std-mqtt) | `mqtt` | `net` | Connect, publish, subscribe and expect over MQTT. |
89
+ | [`@venn-lang/graphql`](../std-graphql) | `gql` | `net` | Query, mutate and subscribe, with matchers on the response. |
90
+ | [`@venn-lang/grpc`](../std-grpc) | `grpc` | `net` | Call, stream and reflect. |
91
+ | [`@venn-lang/mail`](../std-mail) | `mail` | `net` | Inbox verbs over the MailClient port. |
92
+ | [`@venn-lang/db`](../std-db) | `db` | `net` | Table verbs over the DbClient port. |
93
+ | [`@venn-lang/browser`](../std-browser) | `browser` | `net` | Actions, matchers and a browser resource. |
94
+ | [`@venn-lang/load`](../std-load) | `load` | `net` | Load-profile builders and a runner that yields metrics. |
95
+ | [`@venn-lang/artifacts`](../std-artifacts) | `artifacts` | `fs` | Store references to traces, videos, HARs and screenshots. |
96
+
97
+ `requires` is negotiated against the host's capabilities before anything runs. A host that does not
98
+ offer `net` fails to load `@venn-lang/http` with a readable diagnostic, not with a `TypeError` halfway
99
+ through a test.
100
+
101
+ Two tests in this package hold the list to its word: every plugin has a name and a unique namespace,
102
+ every verb carries a signature, and every type reference points at something a plugin actually
103
+ publishes. A dangling reference would otherwise degrade to `dynamic` in silence and the editor would
104
+ simply forget what it knew.
105
+
106
+ ## The port bindings
107
+
108
+ `stdlibPortBindings` binds each port once. Real third-party integrations are out of scope for this
109
+ repository, so most implementations are the test double that ships alongside the port.
110
+
111
+ | Port | Implementation | From |
112
+ | --- | --- | --- |
113
+ | `AuthClientPort` | `createFakeAuthClient()` | [`@venn-lang/auth`](../std-auth) |
114
+ | `HttpServerPort` | `createMemoryServer()` | [`@venn-lang/http`](../std-http) |
115
+ | `CryptoEnginePort` | `createWebCryptoEngine()` | [`@venn-lang/crypto`](../std-crypto) |
116
+ | `NotifierPort` | `createFakeNotifier()` | [`@venn-lang/notify`](../std-notify) |
117
+ | `WsClientPort` | `createFakeWsClient({ incoming: [] })` | [`@venn-lang/ws`](../std-ws) |
118
+ | `MqttClientPort` | `createFakeMqttClient()` | [`@venn-lang/mqtt`](../std-mqtt) |
119
+ | `GqlClientPort` | `createFakeGqlClient()` | [`@venn-lang/graphql`](../std-graphql) |
120
+ | `GrpcClientPort` | `createFakeGrpcClient()` | [`@venn-lang/grpc`](../std-grpc) |
121
+ | `MailClientPort` | `createFakeMailClient()` | [`@venn-lang/mail`](../std-mail) |
122
+ | `DbClientPort` | `createFakeDbClient()` | [`@venn-lang/db`](../std-db) |
123
+ | `BrowserDriverPort` | `createFakeBrowserDriver()` | [`@venn-lang/browser`](../std-browser) |
124
+ | `PreviewProviderPort` | `createNonePreviewProvider()` | [`@venn-lang/browser`](../std-browser) |
125
+ | `LoadRunnerPort` | `createFakeLoadRunner()` | [`@venn-lang/load`](../std-load) |
126
+ | `ArtifactStorePort` | `createMemoryArtifactStore()` | [`@venn-lang/artifacts`](../std-artifacts) |
127
+ | `ConsolePort` | `createMemoryConsole()` | [`@venn-lang/contracts`](../contracts) |
128
+
129
+ Crypto is the exception: it is pure computation rather than a side effect, so the real Web Crypto
130
+ engine is bound and always was.
131
+
132
+ `HttpClientPort` is deliberately absent. The one plugin with a real client leaves the choice to the
133
+ host, so a test can inject a fake and the CLI can inject `fetch`.
134
+
135
+ ### Overriding a binding
136
+
137
+ Bindings are resolved by port id and the last one wins, so a host appends its own after the stdlib's:
138
+
139
+ ```ts
140
+ const ports = [
141
+ { port: HttpClientPort, impl: createFetchClient() },
142
+ ...stdlibPortBindings,
143
+ { port: HttpServerPort, impl: createNodeServer() },
144
+ ];
145
+ ```
146
+
147
+ That is exactly what the CLI does. `venn test` runs with a real HTTP client, a real Node server and a
148
+ real console, and every other port on its fake, which is why the stdlib example above runs offline.
149
+
150
+ ## See also
151
+
152
+ - [`@venn-lang/runtime`](../runtime) executes a document against these plugins and ports.
153
+ - [`@venn-lang/sdk`](../sdk) is how each of these plugins is defined, and how a third-party one is.
154
+ - [`@venn-lang/cli`](../cli) assembles the Node host and picks the real implementations.
@@ -0,0 +1,25 @@
1
+ import { PluginDefinition } from "@venn-lang/sdk";
2
+ import { PortBinding } from "@venn-lang/runtime";
3
+ //#region src/plugins.d.ts
4
+ /**
5
+ * Every plugin the tooling loads, as one list.
6
+ *
7
+ * The CLI runs them; the language server reads their actions and matchers for
8
+ * completion, hover and highlighting. One list, so the two never disagree about
9
+ * what the stdlib is.
10
+ */
11
+ declare const allPlugins: PluginDefinition[];
12
+ //#endregion
13
+ //#region src/port-bindings.d.ts
14
+ /**
15
+ * A fake implementation for every stdlib port.
16
+ *
17
+ * Real third-party integrations are out of scope for this repository, so these
18
+ * stand in for them. Crypto is the exception noted below. `@venn-lang/http`'s client
19
+ * is real too (fetch), but the CLI binds it separately so a test can put a fake
20
+ * in its place.
21
+ */
22
+ declare const stdlibPortBindings: PortBinding[];
23
+ //#endregion
24
+ export { allPlugins, stdlibPortBindings };
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugins.ts","../src/port-bindings.ts"],"mappings":";;;;;;;;;;cA4Ba,YAAY;;;;;;;;;;;cCCZ,oBAAoB"}
package/dist/index.js ADDED
@@ -0,0 +1,125 @@
1
+ import { ArtifactStorePort, artifactsPlugin, createMemoryArtifactStore } from "@venn-lang/artifacts";
2
+ import { assertPlugin } from "@venn-lang/assert";
3
+ import { AuthClientPort, authPlugin, createFakeAuthClient } from "@venn-lang/auth";
4
+ import { BrowserDriverPort, PreviewProviderPort, browserPlugin, createFakeBrowserDriver, createNonePreviewProvider } from "@venn-lang/browser";
5
+ import { CryptoEnginePort, createWebCryptoEngine, cryptoPlugin } from "@venn-lang/crypto";
6
+ import { dataPlugin } from "@venn-lang/data";
7
+ import { DbClientPort, createFakeDbClient, dbPlugin } from "@venn-lang/db";
8
+ import { envPlugin } from "@venn-lang/env";
9
+ import { fmtPlugin } from "@venn-lang/fmt";
10
+ import { GqlClientPort, createFakeClient, gqlPlugin } from "@venn-lang/graphql";
11
+ import { GrpcClientPort, createFakeClient as createFakeClient$1, grpcPlugin } from "@venn-lang/grpc";
12
+ import { HttpServerPort, createMemoryServer, httpPlugin } from "@venn-lang/http";
13
+ import { ioPlugin } from "@venn-lang/io";
14
+ import { LoadRunnerPort, createFakeLoadRunner, loadPlugin } from "@venn-lang/load";
15
+ import { MailClientPort, createFakeMailClient, mailPlugin } from "@venn-lang/mail";
16
+ import { mockPlugin } from "@venn-lang/mock";
17
+ import { MqttClientPort, createFakeMqttClient, mqttPlugin } from "@venn-lang/mqtt";
18
+ import { NotifierPort, createFakeNotifier, notifyPlugin } from "@venn-lang/notify";
19
+ import { WsClientPort, createFakeWsClient, wsPlugin } from "@venn-lang/ws";
20
+ import { ConsolePort, createMemoryConsole } from "@venn-lang/contracts";
21
+ //#region src/plugins.ts
22
+ /**
23
+ * Every plugin the tooling loads, as one list.
24
+ *
25
+ * The CLI runs them; the language server reads their actions and matchers for
26
+ * completion, hover and highlighting. One list, so the two never disagree about
27
+ * what the stdlib is.
28
+ */
29
+ const allPlugins = [
30
+ httpPlugin,
31
+ assertPlugin,
32
+ dataPlugin,
33
+ cryptoPlugin,
34
+ envPlugin,
35
+ fmtPlugin,
36
+ ioPlugin,
37
+ mockPlugin,
38
+ authPlugin,
39
+ notifyPlugin,
40
+ wsPlugin,
41
+ mqttPlugin,
42
+ gqlPlugin,
43
+ grpcPlugin,
44
+ mailPlugin,
45
+ dbPlugin,
46
+ browserPlugin,
47
+ loadPlugin,
48
+ artifactsPlugin
49
+ ];
50
+ //#endregion
51
+ //#region src/port-bindings.ts
52
+ /**
53
+ * A fake implementation for every stdlib port.
54
+ *
55
+ * Real third-party integrations are out of scope for this repository, so these
56
+ * stand in for them. Crypto is the exception noted below. `@venn-lang/http`'s client
57
+ * is real too (fetch), but the CLI binds it separately so a test can put a fake
58
+ * in its place.
59
+ */
60
+ const stdlibPortBindings = [
61
+ {
62
+ port: AuthClientPort,
63
+ impl: createFakeAuthClient()
64
+ },
65
+ {
66
+ port: HttpServerPort,
67
+ impl: createMemoryServer()
68
+ },
69
+ {
70
+ port: CryptoEnginePort,
71
+ impl: createWebCryptoEngine()
72
+ },
73
+ {
74
+ port: NotifierPort,
75
+ impl: createFakeNotifier()
76
+ },
77
+ {
78
+ port: WsClientPort,
79
+ impl: createFakeWsClient({ incoming: [] })
80
+ },
81
+ {
82
+ port: MqttClientPort,
83
+ impl: createFakeMqttClient()
84
+ },
85
+ {
86
+ port: GqlClientPort,
87
+ impl: createFakeClient()
88
+ },
89
+ {
90
+ port: GrpcClientPort,
91
+ impl: createFakeClient$1()
92
+ },
93
+ {
94
+ port: MailClientPort,
95
+ impl: createFakeMailClient()
96
+ },
97
+ {
98
+ port: DbClientPort,
99
+ impl: createFakeDbClient()
100
+ },
101
+ {
102
+ port: BrowserDriverPort,
103
+ impl: createFakeBrowserDriver()
104
+ },
105
+ {
106
+ port: PreviewProviderPort,
107
+ impl: createNonePreviewProvider()
108
+ },
109
+ {
110
+ port: LoadRunnerPort,
111
+ impl: createFakeLoadRunner()
112
+ },
113
+ {
114
+ port: ArtifactStorePort,
115
+ impl: createMemoryArtifactStore()
116
+ },
117
+ {
118
+ port: ConsolePort,
119
+ impl: createMemoryConsole()
120
+ }
121
+ ];
122
+ //#endregion
123
+ export { allPlugins, stdlibPortBindings };
124
+
125
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["createFakeGqlClient","createFakeGrpcClient"],"sources":["../src/plugins.ts","../src/port-bindings.ts"],"sourcesContent":["import { artifactsPlugin } from \"@venn-lang/artifacts\";\nimport { assertPlugin } from \"@venn-lang/assert\";\nimport { authPlugin } from \"@venn-lang/auth\";\nimport { browserPlugin } from \"@venn-lang/browser\";\nimport { cryptoPlugin } from \"@venn-lang/crypto\";\nimport { dataPlugin } from \"@venn-lang/data\";\nimport { dbPlugin } from \"@venn-lang/db\";\nimport { envPlugin } from \"@venn-lang/env\";\nimport { fmtPlugin } from \"@venn-lang/fmt\";\nimport { gqlPlugin } from \"@venn-lang/graphql\";\nimport { grpcPlugin } from \"@venn-lang/grpc\";\nimport { httpPlugin } from \"@venn-lang/http\";\nimport { ioPlugin } from \"@venn-lang/io\";\nimport { loadPlugin } from \"@venn-lang/load\";\nimport { mailPlugin } from \"@venn-lang/mail\";\nimport { mockPlugin } from \"@venn-lang/mock\";\nimport { mqttPlugin } from \"@venn-lang/mqtt\";\nimport { notifyPlugin } from \"@venn-lang/notify\";\nimport type { PluginDefinition } from \"@venn-lang/sdk\";\nimport { wsPlugin } from \"@venn-lang/ws\";\n\n/**\n * Every plugin the tooling loads, as one list.\n *\n * The CLI runs them; the language server reads their actions and matchers for\n * completion, hover and highlighting. One list, so the two never disagree about\n * what the stdlib is.\n */\nexport const allPlugins: PluginDefinition[] = [\n httpPlugin,\n assertPlugin,\n dataPlugin,\n cryptoPlugin,\n envPlugin,\n fmtPlugin,\n ioPlugin,\n mockPlugin,\n authPlugin,\n notifyPlugin,\n wsPlugin,\n mqttPlugin,\n gqlPlugin,\n grpcPlugin,\n mailPlugin,\n dbPlugin,\n browserPlugin,\n loadPlugin,\n artifactsPlugin,\n];\n","import { ArtifactStorePort, createMemoryArtifactStore } from \"@venn-lang/artifacts\";\nimport { AuthClientPort, createFakeAuthClient } from \"@venn-lang/auth\";\nimport {\n BrowserDriverPort,\n createFakeBrowserDriver,\n createNonePreviewProvider,\n PreviewProviderPort,\n} from \"@venn-lang/browser\";\nimport { ConsolePort, createMemoryConsole } from \"@venn-lang/contracts\";\nimport { CryptoEnginePort, createWebCryptoEngine } from \"@venn-lang/crypto\";\nimport { createFakeDbClient, DbClientPort } from \"@venn-lang/db\";\nimport { createFakeClient as createFakeGqlClient, GqlClientPort } from \"@venn-lang/graphql\";\nimport { createFakeClient as createFakeGrpcClient, GrpcClientPort } from \"@venn-lang/grpc\";\nimport { createMemoryServer, HttpServerPort } from \"@venn-lang/http\";\nimport { createFakeLoadRunner, LoadRunnerPort } from \"@venn-lang/load\";\nimport { createFakeMailClient, MailClientPort } from \"@venn-lang/mail\";\nimport { createFakeMqttClient, MqttClientPort } from \"@venn-lang/mqtt\";\nimport { createFakeNotifier, NotifierPort } from \"@venn-lang/notify\";\nimport type { PortBinding } from \"@venn-lang/runtime\";\nimport { createFakeWsClient, WsClientPort } from \"@venn-lang/ws\";\n\n/**\n * A fake implementation for every stdlib port.\n *\n * Real third-party integrations are out of scope for this repository, so these\n * stand in for them. Crypto is the exception noted below. `@venn-lang/http`'s client\n * is real too (fetch), but the CLI binds it separately so a test can put a fake\n * in its place.\n */\nexport const stdlibPortBindings: PortBinding[] = [\n { port: AuthClientPort, impl: createFakeAuthClient() },\n { port: HttpServerPort, impl: createMemoryServer() },\n // Crypto is pure computation, not a side effect, so the real engine always.\n { port: CryptoEnginePort, impl: createWebCryptoEngine() },\n { port: NotifierPort, impl: createFakeNotifier() },\n { port: WsClientPort, impl: createFakeWsClient({ incoming: [] }) },\n { port: MqttClientPort, impl: createFakeMqttClient() },\n { port: GqlClientPort, impl: createFakeGqlClient() },\n { port: GrpcClientPort, impl: createFakeGrpcClient() },\n { port: MailClientPort, impl: createFakeMailClient() },\n { port: DbClientPort, impl: createFakeDbClient() },\n { port: BrowserDriverPort, impl: createFakeBrowserDriver() },\n { port: PreviewProviderPort, impl: createNonePreviewProvider() },\n { port: LoadRunnerPort, impl: createFakeLoadRunner() },\n { port: ArtifactStorePort, impl: createMemoryArtifactStore() },\n // A recording console, so a run without the CLI still has somewhere to write.\n // The CLI binds the real streams over this one.\n { port: ConsolePort, impl: createMemoryConsole() },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,aAAiC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;ACnBA,MAAa,qBAAoC;CAC/C;EAAE,MAAM;EAAgB,MAAM,qBAAqB;CAAE;CACrD;EAAE,MAAM;EAAgB,MAAM,mBAAmB;CAAE;CAEnD;EAAE,MAAM;EAAkB,MAAM,sBAAsB;CAAE;CACxD;EAAE,MAAM;EAAc,MAAM,mBAAmB;CAAE;CACjD;EAAE,MAAM;EAAc,MAAM,mBAAmB,EAAE,UAAU,CAAC,EAAE,CAAC;CAAE;CACjE;EAAE,MAAM;EAAgB,MAAM,qBAAqB;CAAE;CACrD;EAAE,MAAM;EAAe,MAAMA,iBAAoB;CAAE;CACnD;EAAE,MAAM;EAAgB,MAAMC,mBAAqB;CAAE;CACrD;EAAE,MAAM;EAAgB,MAAM,qBAAqB;CAAE;CACrD;EAAE,MAAM;EAAc,MAAM,mBAAmB;CAAE;CACjD;EAAE,MAAM;EAAmB,MAAM,wBAAwB;CAAE;CAC3D;EAAE,MAAM;EAAqB,MAAM,0BAA0B;CAAE;CAC/D;EAAE,MAAM;EAAgB,MAAM,qBAAqB;CAAE;CACrD;EAAE,MAAM;EAAmB,MAAM,0BAA0B;CAAE;CAG7D;EAAE,MAAM;EAAa,MAAM,oBAAoB;CAAE;AACnD"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@venn-lang/stdlib",
3
+ "version": "0.1.0",
4
+ "description": "The one list of standard-library plugins, plus the fake port implementations the tooling runs them with.",
5
+ "keywords": [
6
+ "venn",
7
+ "testing",
8
+ "e2e",
9
+ "stdlib",
10
+ "standard-library"
11
+ ],
12
+ "homepage": "https://github.com/venn-lang/venn/tree/main/packages/stdlib#readme",
13
+ "bugs": "https://github.com/venn-lang/venn/issues",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/venn-lang/venn.git",
17
+ "directory": "packages/stdlib"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Vinicius Borges",
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "exports": {
24
+ ".": {
25
+ "development": "./src/index.ts",
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "src",
34
+ "!src/**/*.test.ts",
35
+ "!src/**/*.suite.ts"
36
+ ],
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "dependencies": {
41
+ "@venn-lang/artifacts": "0.1.0",
42
+ "@venn-lang/assert": "0.1.0",
43
+ "@venn-lang/auth": "0.1.0",
44
+ "@venn-lang/browser": "0.1.0",
45
+ "@venn-lang/contracts": "0.1.0",
46
+ "@venn-lang/data": "0.1.0",
47
+ "@venn-lang/db": "0.1.0",
48
+ "@venn-lang/crypto": "0.1.0",
49
+ "@venn-lang/fmt": "0.1.0",
50
+ "@venn-lang/grpc": "0.1.0",
51
+ "@venn-lang/http": "0.1.0",
52
+ "@venn-lang/graphql": "0.1.0",
53
+ "@venn-lang/io": "0.1.0",
54
+ "@venn-lang/load": "0.1.0",
55
+ "@venn-lang/mail": "0.1.0",
56
+ "@venn-lang/mock": "0.1.0",
57
+ "@venn-lang/mqtt": "0.1.0",
58
+ "@venn-lang/notify": "0.1.0",
59
+ "@venn-lang/runtime": "0.1.0",
60
+ "@venn-lang/types": "0.1.0",
61
+ "@venn-lang/env": "0.1.0",
62
+ "@venn-lang/sdk": "0.1.0",
63
+ "@venn-lang/ws": "0.1.0"
64
+ },
65
+ "devDependencies": {
66
+ "tsdown": "^0.22.14",
67
+ "typescript": "^7.0.2",
68
+ "vitest": "^4.1.10"
69
+ },
70
+ "scripts": {
71
+ "build": "tsdown",
72
+ "test": "vitest run",
73
+ "typecheck": "tsc --noEmit"
74
+ }
75
+ }
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ // The one list of stdlib plugins, plus the fake port bindings they run with.
2
+ // Adding a plugin touches this package and nothing else.
3
+
4
+ export { allPlugins } from "./plugins.js";
5
+ export { stdlibPortBindings } from "./port-bindings.js";
package/src/plugins.ts ADDED
@@ -0,0 +1,49 @@
1
+ import { artifactsPlugin } from "@venn-lang/artifacts";
2
+ import { assertPlugin } from "@venn-lang/assert";
3
+ import { authPlugin } from "@venn-lang/auth";
4
+ import { browserPlugin } from "@venn-lang/browser";
5
+ import { cryptoPlugin } from "@venn-lang/crypto";
6
+ import { dataPlugin } from "@venn-lang/data";
7
+ import { dbPlugin } from "@venn-lang/db";
8
+ import { envPlugin } from "@venn-lang/env";
9
+ import { fmtPlugin } from "@venn-lang/fmt";
10
+ import { gqlPlugin } from "@venn-lang/graphql";
11
+ import { grpcPlugin } from "@venn-lang/grpc";
12
+ import { httpPlugin } from "@venn-lang/http";
13
+ import { ioPlugin } from "@venn-lang/io";
14
+ import { loadPlugin } from "@venn-lang/load";
15
+ import { mailPlugin } from "@venn-lang/mail";
16
+ import { mockPlugin } from "@venn-lang/mock";
17
+ import { mqttPlugin } from "@venn-lang/mqtt";
18
+ import { notifyPlugin } from "@venn-lang/notify";
19
+ import type { PluginDefinition } from "@venn-lang/sdk";
20
+ import { wsPlugin } from "@venn-lang/ws";
21
+
22
+ /**
23
+ * Every plugin the tooling loads, as one list.
24
+ *
25
+ * The CLI runs them; the language server reads their actions and matchers for
26
+ * completion, hover and highlighting. One list, so the two never disagree about
27
+ * what the stdlib is.
28
+ */
29
+ export const allPlugins: PluginDefinition[] = [
30
+ httpPlugin,
31
+ assertPlugin,
32
+ dataPlugin,
33
+ cryptoPlugin,
34
+ envPlugin,
35
+ fmtPlugin,
36
+ ioPlugin,
37
+ mockPlugin,
38
+ authPlugin,
39
+ notifyPlugin,
40
+ wsPlugin,
41
+ mqttPlugin,
42
+ gqlPlugin,
43
+ grpcPlugin,
44
+ mailPlugin,
45
+ dbPlugin,
46
+ browserPlugin,
47
+ loadPlugin,
48
+ artifactsPlugin,
49
+ ];
@@ -0,0 +1,49 @@
1
+ import { ArtifactStorePort, createMemoryArtifactStore } from "@venn-lang/artifacts";
2
+ import { AuthClientPort, createFakeAuthClient } from "@venn-lang/auth";
3
+ import {
4
+ BrowserDriverPort,
5
+ createFakeBrowserDriver,
6
+ createNonePreviewProvider,
7
+ PreviewProviderPort,
8
+ } from "@venn-lang/browser";
9
+ import { ConsolePort, createMemoryConsole } from "@venn-lang/contracts";
10
+ import { CryptoEnginePort, createWebCryptoEngine } from "@venn-lang/crypto";
11
+ import { createFakeDbClient, DbClientPort } from "@venn-lang/db";
12
+ import { createFakeClient as createFakeGqlClient, GqlClientPort } from "@venn-lang/graphql";
13
+ import { createFakeClient as createFakeGrpcClient, GrpcClientPort } from "@venn-lang/grpc";
14
+ import { createMemoryServer, HttpServerPort } from "@venn-lang/http";
15
+ import { createFakeLoadRunner, LoadRunnerPort } from "@venn-lang/load";
16
+ import { createFakeMailClient, MailClientPort } from "@venn-lang/mail";
17
+ import { createFakeMqttClient, MqttClientPort } from "@venn-lang/mqtt";
18
+ import { createFakeNotifier, NotifierPort } from "@venn-lang/notify";
19
+ import type { PortBinding } from "@venn-lang/runtime";
20
+ import { createFakeWsClient, WsClientPort } from "@venn-lang/ws";
21
+
22
+ /**
23
+ * A fake implementation for every stdlib port.
24
+ *
25
+ * Real third-party integrations are out of scope for this repository, so these
26
+ * stand in for them. Crypto is the exception noted below. `@venn-lang/http`'s client
27
+ * is real too (fetch), but the CLI binds it separately so a test can put a fake
28
+ * in its place.
29
+ */
30
+ export const stdlibPortBindings: PortBinding[] = [
31
+ { port: AuthClientPort, impl: createFakeAuthClient() },
32
+ { port: HttpServerPort, impl: createMemoryServer() },
33
+ // Crypto is pure computation, not a side effect, so the real engine always.
34
+ { port: CryptoEnginePort, impl: createWebCryptoEngine() },
35
+ { port: NotifierPort, impl: createFakeNotifier() },
36
+ { port: WsClientPort, impl: createFakeWsClient({ incoming: [] }) },
37
+ { port: MqttClientPort, impl: createFakeMqttClient() },
38
+ { port: GqlClientPort, impl: createFakeGqlClient() },
39
+ { port: GrpcClientPort, impl: createFakeGrpcClient() },
40
+ { port: MailClientPort, impl: createFakeMailClient() },
41
+ { port: DbClientPort, impl: createFakeDbClient() },
42
+ { port: BrowserDriverPort, impl: createFakeBrowserDriver() },
43
+ { port: PreviewProviderPort, impl: createNonePreviewProvider() },
44
+ { port: LoadRunnerPort, impl: createFakeLoadRunner() },
45
+ { port: ArtifactStorePort, impl: createMemoryArtifactStore() },
46
+ // A recording console, so a run without the CLI still has somewhere to write.
47
+ // The CLI binds the real streams over this one.
48
+ { port: ConsolePort, impl: createMemoryConsole() },
49
+ ];