@gobing-ai/ts-runtime 0.4.66 → 0.4.68

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 CHANGED
@@ -181,7 +181,7 @@ import { createRuntimeContextFromFactory } from '@gobing-ai/ts-runtime';
181
181
  const ctx = await createRuntimeContextFromFactory();
182
182
  // ctx.runtimeName → 'node-bun' (auto-detected)
183
183
  // ctx.capabilities → { hasFilesystem: true, hasProcessExecution: true }
184
- // ctx.require('fileSystem') → NodeFileSystem
184
+ // ctx.require('fileSystem') → canonical FileSystem (createNodeFileSystem)
185
185
  // ctx.require('config') → Config from config.yaml
186
186
  ```
187
187
 
@@ -435,8 +435,9 @@ if (fs.realPath) {
435
435
 
436
436
  Both are optional — CF Workers stubs omit them. The JSONL importer falls back to `readFile` + split when `readFileStream` is absent; the extension loader skips the symlink check when `realPath` is absent.
437
437
 
438
- The old `getFs()` / `setFileSystem` global swap and `SyncFileSystem` are marked `@deprecated` —
439
- use `createNodeFileSystem()` or `ctx.require('fileSystem')` instead.
438
+ The legacy `getFs()` / `setFileSystem()` global swap, `SyncFileSystem`, and the old filesystem
439
+ classes were removed in ADR-019. Use `createNodeFileSystem()`, `createCfFileSystem()`, or
440
+ `ctx.require('fileSystem')` instead.
440
441
 
441
442
  ### 8. Database adapter (`createDbAdapter`)
442
443
 
package/dist/config.d.ts CHANGED
@@ -45,17 +45,17 @@ export declare class ConfigLoadError extends Error {
45
45
  readonly issues: ZodIssue[];
46
46
  constructor(message: string, issues?: ZodIssue[]);
47
47
  }
48
- /** Returns the value of `process.env.NODE_ENV`, or `"development"` as default. Node/Bun only. */
48
+ /** Returns the value of `NODE_ENV`, or `"development"` as default. Node/Bun only. */
49
49
  export declare function getNodeEnv(): string;
50
50
  /** Returns `true` when `NODE_ENV` is `"test"`. Node/Bun only. */
51
51
  export declare function isTestEnv(): boolean;
52
- /** Returns `process.env` as a plain object. Node/Bun only. */
52
+ /** Returns the live environment as a plain object. Node/Bun only. */
53
53
  export declare function getProcessEnv(): Record<string, string | undefined>;
54
- /** Returns `process.env.DATABASE_URL`, or `undefined` if not set. Node/Bun only. */
54
+ /** Returns `DATABASE_URL`, or `undefined` if not set. Node/Bun only. */
55
55
  export declare function getDatabaseUrl(): string | undefined;
56
56
  /** Returns the user's home directory (`HOME`, falling back to `USERPROFILE` on Windows), or `undefined` if unset. Node/Bun only. */
57
57
  export declare function getHomeDir(): string | undefined;
58
- /** Node-bun only: interpolates `${VAR}` from `process.env` (see note above). */
58
+ /** Node-bun only: interpolates `${VAR}` from the environment (see note above). */
59
59
  export declare function interpolateEnv(value: string): string;
60
60
  /** Recursively interpolates `${VAR}` environment variables in all string leaves of a nested object or array. Node/Bun only. */
61
61
  export declare function interpolateTree(value: unknown): unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEvC,uHAAuH;AACvH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsBvB,CAAC;AAEH,uGAAuG;AACvG,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,CAAC;AAInD,kEAAkE;AAClE,qBAAa,cAAe,SAAQ,KAAK;IAGjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO;gBAD7B,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,EAAE,OAAO,YAAA;CAKpC;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAerE;AAED,iDAAiD;AACjD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAE1E;AAED,4GAA4G;AAC5G,qBAAa,eAAgB,SA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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAO,GAC9C,MAAM,CAUR;AACD,yGAAyG;AACzG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzE;AACD,yHAAyH;AACzH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAO,GAAG,MAAM,CAE3G"}
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { deepMerge } from '@gobing-ai/ts-utils';
1
+ import { deepMerge, getEnvVar, getEnvVars } from '@gobing-ai/ts-utils';
2
2
  import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
3
3
  import { z } from 'zod';
4
4
  /** Zod schema for the application configuration object, providing defaults for app, database, and logging sections. */
@@ -64,31 +64,34 @@ export class ConfigLoadError extends Error {
64
64
  this.issues = issues;
65
65
  }
66
66
  }
67
- // These accessors read `process.env` directly and are node-bun only (ADR-008). On
68
- // `cloudflare-workers` there is no `process`; inject config explicitly rather than calling these.
69
- /** Returns the value of `process.env.NODE_ENV`, or `"development"` as default. Node/Bun only. */
67
+ // Environment access funnels through the `@gobing-ai/ts-utils` gateway
68
+ // (`getEnvVar` / `getEnvVars`); direct environment access is banned by the
69
+ // `boundary/env-var-hygiene` rule. These accessors are node-bun only (ADR-008):
70
+ // on `cloudflare-workers` there is no `process`; inject config explicitly rather
71
+ // than calling them.
72
+ /** Returns the value of `NODE_ENV`, or `"development"` as default. Node/Bun only. */
70
73
  export function getNodeEnv() {
71
- return process.env.NODE_ENV ?? 'development';
74
+ return getEnvVar('NODE_ENV') ?? 'development';
72
75
  }
73
76
  /** Returns `true` when `NODE_ENV` is `"test"`. Node/Bun only. */
74
77
  export function isTestEnv() {
75
78
  return getNodeEnv() === 'test';
76
79
  }
77
- /** Returns `process.env` as a plain object. Node/Bun only. */
80
+ /** Returns the live environment as a plain object. Node/Bun only. */
78
81
  export function getProcessEnv() {
79
- return process.env;
82
+ return getEnvVars();
80
83
  }
81
- /** Returns `process.env.DATABASE_URL`, or `undefined` if not set. Node/Bun only. */
84
+ /** Returns `DATABASE_URL`, or `undefined` if not set. Node/Bun only. */
82
85
  export function getDatabaseUrl() {
83
- return process.env.DATABASE_URL;
86
+ return getEnvVar('DATABASE_URL');
84
87
  }
85
88
  /** Returns the user's home directory (`HOME`, falling back to `USERPROFILE` on Windows), or `undefined` if unset. Node/Bun only. */
86
89
  export function getHomeDir() {
87
- return process.env.HOME ?? process.env.USERPROFILE;
90
+ return getEnvVar('HOME') ?? getEnvVar('USERPROFILE');
88
91
  }
89
- /** Node-bun only: interpolates `${VAR}` from `process.env` (see note above). */
92
+ /** Node-bun only: interpolates `${VAR}` from the environment (see note above). */
90
93
  export function interpolateEnv(value) {
91
- return value.replace(ENV_INTERPOLATION_RE, (_match, name) => process.env[name] ?? `\${${name}}`);
94
+ return value.replace(ENV_INTERPOLATION_RE, (_match, name) => getEnvVar(name) ?? `\${${name}}`);
92
95
  }
93
96
  /** Recursively interpolates `${VAR}` environment variables in all string leaves of a nested object or array. Node/Bun only. */
94
97
  export function interpolateTree(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/ts-runtime",
3
- "version": "0.4.66",
3
+ "version": "0.4.68",
4
4
  "description": "@gobing-ai/ts-runtime — Runtime abstractions for Bun, Node, and Cloudflare Workers.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -58,17 +58,17 @@
58
58
  "release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-runtime-v<version> && git push --tags' && exit 1"
59
59
  },
60
60
  "dependencies": {
61
- "@gobing-ai/ts-utils": "^0.4.66",
61
+ "@gobing-ai/ts-utils": "^0.4.68",
62
62
  "execa": "^9.5.0",
63
63
  "yaml": "^2.7.0",
64
64
  "zod": "^4.1.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@gobing-ai/ts-db": "^0.4.66",
67
+ "@gobing-ai/ts-db": "^0.4.68",
68
68
  "@types/bun": "1.3.14"
69
69
  },
70
70
  "peerDependencies": {
71
- "@gobing-ai/ts-db": "^0.4.66"
71
+ "@gobing-ai/ts-db": "^0.4.68"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@gobing-ai/ts-db": {
package/src/config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { deepMerge } from '@gobing-ai/ts-utils';
1
+ import { deepMerge, getEnvVar, getEnvVars } from '@gobing-ai/ts-utils';
2
2
  import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
3
3
  import { type ZodIssue, z } from 'zod';
4
4
 
@@ -77,36 +77,39 @@ export class ConfigLoadError extends Error {
77
77
  }
78
78
  }
79
79
 
80
- // These accessors read `process.env` directly and are node-bun only (ADR-008). On
81
- // `cloudflare-workers` there is no `process`; inject config explicitly rather than calling these.
80
+ // Environment access funnels through the `@gobing-ai/ts-utils` gateway
81
+ // (`getEnvVar` / `getEnvVars`); direct environment access is banned by the
82
+ // `boundary/env-var-hygiene` rule. These accessors are node-bun only (ADR-008):
83
+ // on `cloudflare-workers` there is no `process`; inject config explicitly rather
84
+ // than calling them.
82
85
 
83
- /** Returns the value of `process.env.NODE_ENV`, or `"development"` as default. Node/Bun only. */
86
+ /** Returns the value of `NODE_ENV`, or `"development"` as default. Node/Bun only. */
84
87
  export function getNodeEnv(): string {
85
- return process.env.NODE_ENV ?? 'development';
88
+ return getEnvVar('NODE_ENV') ?? 'development';
86
89
  }
87
90
  /** Returns `true` when `NODE_ENV` is `"test"`. Node/Bun only. */
88
91
  export function isTestEnv(): boolean {
89
92
  return getNodeEnv() === 'test';
90
93
  }
91
94
 
92
- /** Returns `process.env` as a plain object. Node/Bun only. */
95
+ /** Returns the live environment as a plain object. Node/Bun only. */
93
96
  export function getProcessEnv(): Record<string, string | undefined> {
94
- return process.env;
97
+ return getEnvVars();
95
98
  }
96
99
 
97
- /** Returns `process.env.DATABASE_URL`, or `undefined` if not set. Node/Bun only. */
100
+ /** Returns `DATABASE_URL`, or `undefined` if not set. Node/Bun only. */
98
101
  export function getDatabaseUrl(): string | undefined {
99
- return process.env.DATABASE_URL;
102
+ return getEnvVar('DATABASE_URL');
100
103
  }
101
104
 
102
105
  /** Returns the user's home directory (`HOME`, falling back to `USERPROFILE` on Windows), or `undefined` if unset. Node/Bun only. */
103
106
  export function getHomeDir(): string | undefined {
104
- return process.env.HOME ?? process.env.USERPROFILE;
107
+ return getEnvVar('HOME') ?? getEnvVar('USERPROFILE');
105
108
  }
106
109
 
107
- /** Node-bun only: interpolates `${VAR}` from `process.env` (see note above). */
110
+ /** Node-bun only: interpolates `${VAR}` from the environment (see note above). */
108
111
  export function interpolateEnv(value: string): string {
109
- return value.replace(ENV_INTERPOLATION_RE, (_match, name: string) => process.env[name] ?? `\${${name}}`);
112
+ return value.replace(ENV_INTERPOLATION_RE, (_match, name: string) => getEnvVar(name) ?? `\${${name}}`);
110
113
  }
111
114
 
112
115
  /** Recursively interpolates `${VAR}` environment variables in all string leaves of a nested object or array. Node/Bun only. */