@stackables/bridge-stdlib 0.0.1 → 1.5.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/README.md ADDED
@@ -0,0 +1,38 @@
1
+ [![github](https://img.shields.io/badge/github-stackables/bridge-blue?logo=github)](https://github.com/stackables/bridge)
2
+
3
+ # The Bridge standard library
4
+
5
+ The standard library for [The Bridge](https://github.com/stackables/bridge) — a collection of built-in tools: HTTP calls, string manipulation, array operations, audit logging, and input validation.
6
+
7
+ You usually won't install this directly. It comes bundled with both [`@stackables/bridge`](https://www.npmjs.com/package/@stackables/bridge) and [`@stackables/bridge-core`](https://www.npmjs.com/package/@stackables/bridge-core).
8
+
9
+ # Installing
10
+
11
+ You might need to install this separately if you want to use different versions of standard library in your `.bridge` files or customise the http client cache handling.
12
+
13
+ ```bash
14
+ npm install @stackables/bridge-stdlib
15
+ ```
16
+
17
+ ## Customizing httpCall
18
+
19
+ The default `httpCall` uses `globalThis.fetch` and an in-memory LRU cache. If you need to swap in a custom fetch or plug in Redis for caching:
20
+
21
+ ```ts
22
+ import { createHttpCall } from "@stackables/bridge-stdlib";
23
+
24
+ // Use a custom fetch and a Redis-backed cache store
25
+ const httpCall = createHttpCall(myCustomFetch, myRedisCacheStore);
26
+ ```
27
+
28
+ Then pass it to the engine via the `tools` option.
29
+
30
+ ## Part of the Bridge Ecosystem
31
+
32
+ | Package | What it does |
33
+ | ------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
34
+ | [`@stackables/bridge`](https://www.npmjs.com/package/@stackables/bridge) | **The All-in-One** — everything in a single install |
35
+ | [`@stackables/bridge-core`](https://www.npmjs.com/package/@stackables/bridge-core) | **The Engine** — runs pre-compiled bridge instructions |
36
+ | [`@stackables/bridge-compiler`](https://www.npmjs.com/package/@stackables/bridge-compiler) | **The Parser** — turns `.bridge` text into instructions |
37
+ | [`@stackables/bridge-graphql`](https://www.npmjs.com/package/@stackables/bridge-graphql) | **The Adapter** — wires bridges into a GraphQL schema |
38
+ | [`@stackables/bridge-types`](https://www.npmjs.com/package/@stackables/bridge-types) | **Shared Types** — `ToolCallFn`, `ToolMap`, `CacheStore` |
package/build/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @stackables/bridge-stdlib — Bridge standard library tools.
3
3
  *
4
4
  * Contains the `std` namespace tools (httpCall, string helpers, array helpers,
5
- * audit, assert) that ship with Bridge. Referenced in `.bridge` files as
5
+ * audit) that ship with Bridge. Referenced in `.bridge` files as
6
6
  * `std.httpCall`, `std.str.toUpperCase`, etc.
7
7
  *
8
8
  * Separated from core so it can be versioned independently.
@@ -10,13 +10,19 @@
10
10
  import { audit } from "./tools/audit.ts";
11
11
  import * as arrays from "./tools/arrays.ts";
12
12
  import * as strings from "./tools/strings.ts";
13
- import { assert } from "./tools/assert.ts";
13
+ /**
14
+ * Standard library version.
15
+ *
16
+ * The bridge `version X.Y` header declares the minimum compatible std version.
17
+ * At runtime the engine compares this constant against the bridge's declared
18
+ * version to verify compatibility (same major, equal-or-higher minor).
19
+ */
20
+ export declare const STD_VERSION = "1.5.0";
14
21
  export declare const std: {
15
22
  readonly str: typeof strings;
16
23
  readonly arr: typeof arrays;
17
24
  readonly audit: typeof audit;
18
25
  readonly httpCall: import("@stackables/bridge-types").ToolCallFn;
19
- readonly assert: typeof assert;
20
26
  };
21
27
  /**
22
28
  * All known built-in tool names as "namespace.tool" strings.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAS3C,eAAO,MAAM,GAAG;;;;;;CAMN,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAE7C,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AASnC,eAAO,MAAM,GAAG;;;;;CAKN,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAE7C,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
package/build/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @stackables/bridge-stdlib — Bridge standard library tools.
3
3
  *
4
4
  * Contains the `std` namespace tools (httpCall, string helpers, array helpers,
5
- * audit, assert) that ship with Bridge. Referenced in `.bridge` files as
5
+ * audit) that ship with Bridge. Referenced in `.bridge` files as
6
6
  * `std.httpCall`, `std.str.toUpperCase`, etc.
7
7
  *
8
8
  * Separated from core so it can be versioned independently.
@@ -11,7 +11,14 @@ import { audit } from "./tools/audit.js";
11
11
  import { createHttpCall } from "./tools/http-call.js";
12
12
  import * as arrays from "./tools/arrays.js";
13
13
  import * as strings from "./tools/strings.js";
14
- import { assert } from "./tools/assert.js";
14
+ /**
15
+ * Standard library version.
16
+ *
17
+ * The bridge `version X.Y` header declares the minimum compatible std version.
18
+ * At runtime the engine compares this constant against the bridge's declared
19
+ * version to verify compatibility (same major, equal-or-higher minor).
20
+ */
21
+ export const STD_VERSION = "1.5.0";
15
22
  /**
16
23
  * Standard built-in tools — available under the `std` namespace.
17
24
  *
@@ -23,7 +30,6 @@ export const std = {
23
30
  arr: arrays,
24
31
  audit,
25
32
  httpCall: httpCallFn,
26
- assert,
27
33
  };
28
34
  /**
29
35
  * All known built-in tool names as "namespace.tool" strings.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stackables/bridge-stdlib",
3
- "version": "0.0.1",
4
- "description": "Bridge standard library — httpCall, string, array, audit, and assert tools",
3
+ "version": "1.5.0",
4
+ "description": "Bridge standard library — httpCall, string, array, and audit tools",
5
5
  "main": "./build/index.js",
6
6
  "type": "module",
7
7
  "types": "./build/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "lru-cache": "^11.2.6",
26
- "@stackables/bridge-types": "0.0.1"
26
+ "@stackables/bridge-types": "1.0.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^25.3.2",
@@ -34,6 +34,8 @@
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsc -p tsconfig.json",
37
- "test": "node --experimental-transform-types --conditions source --test test/*.test.ts"
37
+ "lint:types": "tsc -p tsconfig.check.json",
38
+ "test": "node --experimental-transform-types --conditions source --test test/*.test.ts",
39
+ "test:coverage": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info --experimental-transform-types --conditions source --test test/*.test.ts"
38
40
  }
39
41
  }
@@ -1,5 +0,0 @@
1
- import type { ToolContext } from "@stackables/bridge-types";
2
- export declare function assert(input: {
3
- in: any;
4
- }, _context?: ToolContext): any;
5
- //# sourceMappingURL=assert.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/tools/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,GAAG,CAAA;CAAE,EAAE,QAAQ,CAAC,EAAE,WAAW,OAKhE"}
@@ -1,6 +0,0 @@
1
- export function assert(input, _context) {
2
- if (!input.in) {
3
- throw new Error("Assertion failed: input is falsy");
4
- }
5
- return input.in;
6
- }