@objectstack/types 17.0.0-rc.0 → 17.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/node.ts
21
+ var node_exports = {};
22
+ __export(node_exports, {
23
+ createHostImporter: () => createHostImporter,
24
+ createHostRequire: () => createHostRequire
25
+ });
26
+ module.exports = __toCommonJS(node_exports);
27
+ var import_node_module = require("module");
28
+ var import_node_path = require("path");
29
+ var import_node_url = require("url");
30
+ function createHostRequire(hostRoot = process.cwd()) {
31
+ return (0, import_node_module.createRequire)((0, import_node_path.join)(hostRoot, "package.json"));
32
+ }
33
+ function createHostImporter(hostRequire = createHostRequire()) {
34
+ return async (pkg) => {
35
+ let resolved;
36
+ try {
37
+ resolved = hostRequire.resolve(pkg);
38
+ } catch {
39
+ return import(
40
+ /* webpackIgnore: true */
41
+ pkg
42
+ );
43
+ }
44
+ return import((0, import_node_url.pathToFileURL)(resolved).href);
45
+ };
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ createHostImporter,
50
+ createHostRequire
51
+ });
52
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/node.ts"],"sourcesContent":["// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * `@objectstack/types/node` — the **node-only** slice of the shared utilities.\n *\n * WHY A SUBPATH AND NOT THE ROOT EXPORT. `@objectstack/types` is a dependency of\n * `@objectstack/hono`, whose whole reason to exist is \"edge-compatible REST API\n * server for Cloudflare Workers, Deno, Bun, and Node\" — and of the plugin/service\n * layer a `LiteKernel` boots on Workers. The root entry (`src/index.ts`) reaches\n * **zero** `node:` builtins today, and that is a property those consumers depend\n * on: a Workers bundle that pulls in `node:module` fails to build (or dies at\n * first call) even when nothing ever invokes it. Everything here needs\n * `node:module` / `node:url` by definition — it exists to drive Node's own\n * resolver — so it lives behind its own entry point instead.\n *\n * The isolation is structural, not conventional: `tsup` builds `src/index.ts` and\n * `src/node.ts` as separate entries with `splitting: false`, so the root bundle\n * contains no reference to this file, and `node-isolation.test.ts` fails the\n * build if anything reachable from the root ever imports a `node:` builtin. Same\n * arrangement `@objectstack/metadata` already ships for `./node`.\n *\n * ── What lives here ──────────────────────────────────────────────────────────\n *\n * Resolving optional packages from the **host app**, not from the framework\n * package doing the importing.\n *\n * Node ESM resolves a bare `import('pkg')` against the **importer's own\n * realpath**. Framework packages (the CLI, `@objectstack/verify`,\n * `@objectstack/dogfood`) are reached through `link:`/workspace dependencies, so\n * their realpath is inside the *framework* workspace — a bare import from any of\n * them can only ever see packages installed in the framework's own\n * `node_modules`. Every package that lives OUTSIDE that workspace and is supplied\n * by the app being served, verified or tested — a cloud-private package such as\n * `@objectstack/organizations` or `@objectstack/service-ai-studio`, or anything a\n * customer installs into their own project — is therefore invisible to a bare\n * import, no matter what the host app declares in its `package.json`\n * (cloud#1013: `objectstack serve` could never load the enterprise multi-org\n * runtime, so every self-hosted walled-posture deployment hit the ADR-0093 D5\n * fail-fast and exited 1; framework#4700: `bootStack({ multiTenant: true })` told\n * apps to install a package they had already installed, and the dogfood\n * multi-org probes were constant-false).\n *\n * The fix is to resolve from the host app's root and import the resolved\n * absolute path. The importing package's own resolution stays as the fallback,\n * for the framework-owned packages it depends on and the host does not declare.\n *\n * Resolution failure is the ONLY thing that falls back. A package the host\n * resolves but that throws while it evaluates is a genuine crash and propagates\n * unchanged: re-importing it bare would replace the real cause with a\n * `MODULE_NOT_FOUND`, which every caller here classifies as \"not installed\" —\n * turning a broken package into a silent skip (or, on the organizations path,\n * into a fatal message telling the operator to install what is already there).\n */\n\nimport { createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\n/**\n * Imports a package as the host app would see it.\n *\n * `any` is the module namespace of a package this repo does not compile against\n * (it is not a dependency of the importing package at all) — every call site\n * reads an export off it dynamically, exactly as the bare `import()` it replaces\n * did.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type HostImporter = (pkg: string) => Promise<any>;\n\n/**\n * A `require` anchored at the **host app's** `package.json` — i.e. the project\n * `objectstack serve` was invoked in, or the app `bootStack` is verifying, whose\n * `node_modules` carries the packages it declares.\n *\n * @param hostRoot Directory holding the host app's `package.json` (default: the\n * process CWD, which is where the CLI reads `objectstack.config.ts` from too).\n */\nexport function createHostRequire(hostRoot: string = process.cwd()): NodeRequire {\n return createRequire(join(hostRoot, 'package.json'));\n}\n\n/**\n * Build an importer that resolves from the host app first, then falls back to\n * the importing package's own resolution.\n *\n * @param hostRequire Reuse an existing host `require` (callers usually also need\n * it to read the host `package.json`); defaults to one anchored at the CWD.\n */\nexport function createHostImporter(\n hostRequire: NodeRequire = createHostRequire(),\n): HostImporter {\n return async (pkg: string): Promise<any> => {\n let resolved: string;\n try {\n resolved = hostRequire.resolve(pkg);\n } catch {\n // Invisible to the host app — try the importing package's own\n // dependencies. A package neither can see throws MODULE_NOT_FOUND from\n // here, which is what the callers' \"missing vs crashed\" classification\n // expects.\n return import(/* webpackIgnore: true */ pkg);\n }\n return import(pathToFileURL(resolved).href);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDA,yBAA8B;AAC9B,uBAAqB;AACrB,sBAA8B;AAqBvB,SAAS,kBAAkB,WAAmB,QAAQ,IAAI,GAAgB;AAC/E,aAAO,sCAAc,uBAAK,UAAU,cAAc,CAAC;AACrD;AASO,SAAS,mBACd,cAA2B,kBAAkB,GAC/B;AACd,SAAO,OAAO,QAA8B;AAC1C,QAAI;AACJ,QAAI;AACF,iBAAW,YAAY,QAAQ,GAAG;AAAA,IACpC,QAAQ;AAKN,aAAO;AAAA;AAAA,QAAiC;AAAA;AAAA,IAC1C;AACA,WAAO,WAAO,+BAAc,QAAQ,EAAE;AAAA,EACxC;AACF;","names":[]}
package/dist/node.mjs ADDED
@@ -0,0 +1,26 @@
1
+ // src/node.ts
2
+ import { createRequire } from "module";
3
+ import { join } from "path";
4
+ import { pathToFileURL } from "url";
5
+ function createHostRequire(hostRoot = process.cwd()) {
6
+ return createRequire(join(hostRoot, "package.json"));
7
+ }
8
+ function createHostImporter(hostRequire = createHostRequire()) {
9
+ return async (pkg) => {
10
+ let resolved;
11
+ try {
12
+ resolved = hostRequire.resolve(pkg);
13
+ } catch {
14
+ return import(
15
+ /* webpackIgnore: true */
16
+ pkg
17
+ );
18
+ }
19
+ return import(pathToFileURL(resolved).href);
20
+ };
21
+ }
22
+ export {
23
+ createHostImporter,
24
+ createHostRequire
25
+ };
26
+ //# sourceMappingURL=node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/node.ts"],"sourcesContent":["// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * `@objectstack/types/node` — the **node-only** slice of the shared utilities.\n *\n * WHY A SUBPATH AND NOT THE ROOT EXPORT. `@objectstack/types` is a dependency of\n * `@objectstack/hono`, whose whole reason to exist is \"edge-compatible REST API\n * server for Cloudflare Workers, Deno, Bun, and Node\" — and of the plugin/service\n * layer a `LiteKernel` boots on Workers. The root entry (`src/index.ts`) reaches\n * **zero** `node:` builtins today, and that is a property those consumers depend\n * on: a Workers bundle that pulls in `node:module` fails to build (or dies at\n * first call) even when nothing ever invokes it. Everything here needs\n * `node:module` / `node:url` by definition — it exists to drive Node's own\n * resolver — so it lives behind its own entry point instead.\n *\n * The isolation is structural, not conventional: `tsup` builds `src/index.ts` and\n * `src/node.ts` as separate entries with `splitting: false`, so the root bundle\n * contains no reference to this file, and `node-isolation.test.ts` fails the\n * build if anything reachable from the root ever imports a `node:` builtin. Same\n * arrangement `@objectstack/metadata` already ships for `./node`.\n *\n * ── What lives here ──────────────────────────────────────────────────────────\n *\n * Resolving optional packages from the **host app**, not from the framework\n * package doing the importing.\n *\n * Node ESM resolves a bare `import('pkg')` against the **importer's own\n * realpath**. Framework packages (the CLI, `@objectstack/verify`,\n * `@objectstack/dogfood`) are reached through `link:`/workspace dependencies, so\n * their realpath is inside the *framework* workspace — a bare import from any of\n * them can only ever see packages installed in the framework's own\n * `node_modules`. Every package that lives OUTSIDE that workspace and is supplied\n * by the app being served, verified or tested — a cloud-private package such as\n * `@objectstack/organizations` or `@objectstack/service-ai-studio`, or anything a\n * customer installs into their own project — is therefore invisible to a bare\n * import, no matter what the host app declares in its `package.json`\n * (cloud#1013: `objectstack serve` could never load the enterprise multi-org\n * runtime, so every self-hosted walled-posture deployment hit the ADR-0093 D5\n * fail-fast and exited 1; framework#4700: `bootStack({ multiTenant: true })` told\n * apps to install a package they had already installed, and the dogfood\n * multi-org probes were constant-false).\n *\n * The fix is to resolve from the host app's root and import the resolved\n * absolute path. The importing package's own resolution stays as the fallback,\n * for the framework-owned packages it depends on and the host does not declare.\n *\n * Resolution failure is the ONLY thing that falls back. A package the host\n * resolves but that throws while it evaluates is a genuine crash and propagates\n * unchanged: re-importing it bare would replace the real cause with a\n * `MODULE_NOT_FOUND`, which every caller here classifies as \"not installed\" —\n * turning a broken package into a silent skip (or, on the organizations path,\n * into a fatal message telling the operator to install what is already there).\n */\n\nimport { createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\n/**\n * Imports a package as the host app would see it.\n *\n * `any` is the module namespace of a package this repo does not compile against\n * (it is not a dependency of the importing package at all) — every call site\n * reads an export off it dynamically, exactly as the bare `import()` it replaces\n * did.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type HostImporter = (pkg: string) => Promise<any>;\n\n/**\n * A `require` anchored at the **host app's** `package.json` — i.e. the project\n * `objectstack serve` was invoked in, or the app `bootStack` is verifying, whose\n * `node_modules` carries the packages it declares.\n *\n * @param hostRoot Directory holding the host app's `package.json` (default: the\n * process CWD, which is where the CLI reads `objectstack.config.ts` from too).\n */\nexport function createHostRequire(hostRoot: string = process.cwd()): NodeRequire {\n return createRequire(join(hostRoot, 'package.json'));\n}\n\n/**\n * Build an importer that resolves from the host app first, then falls back to\n * the importing package's own resolution.\n *\n * @param hostRequire Reuse an existing host `require` (callers usually also need\n * it to read the host `package.json`); defaults to one anchored at the CWD.\n */\nexport function createHostImporter(\n hostRequire: NodeRequire = createHostRequire(),\n): HostImporter {\n return async (pkg: string): Promise<any> => {\n let resolved: string;\n try {\n resolved = hostRequire.resolve(pkg);\n } catch {\n // Invisible to the host app — try the importing package's own\n // dependencies. A package neither can see throws MODULE_NOT_FOUND from\n // here, which is what the callers' \"missing vs crashed\" classification\n // expects.\n return import(/* webpackIgnore: true */ pkg);\n }\n return import(pathToFileURL(resolved).href);\n };\n}\n"],"mappings":";AAsDA,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAqBvB,SAAS,kBAAkB,WAAmB,QAAQ,IAAI,GAAgB;AAC/E,SAAO,cAAc,KAAK,UAAU,cAAc,CAAC;AACrD;AASO,SAAS,mBACd,cAA2B,kBAAkB,GAC/B;AACd,SAAO,OAAO,QAA8B;AAC1C,QAAI;AACJ,QAAI;AACF,iBAAW,YAAY,QAAQ,GAAG;AAAA,IACpC,QAAQ;AAKN,aAAO;AAAA;AAAA,QAAiC;AAAA;AAAA,IAC1C;AACA,WAAO,OAAO,cAAc,QAAQ,EAAE;AAAA,EACxC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@objectstack/types",
3
- "version": "17.0.0-rc.0",
3
+ "version": "17.0.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Shared interfaces describing the ObjectStack Runtime environment",
6
6
  "main": "dist/index.js",
@@ -10,10 +10,15 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.mjs",
12
12
  "require": "./dist/index.js"
13
+ },
14
+ "./node": {
15
+ "types": "./dist/node.d.ts",
16
+ "import": "./dist/node.mjs",
17
+ "require": "./dist/node.js"
13
18
  }
14
19
  },
15
20
  "dependencies": {
16
- "@objectstack/spec": "17.0.0-rc.0"
21
+ "@objectstack/spec": "17.0.0-rc.2"
17
22
  },
18
23
  "devDependencies": {
19
24
  "typescript": "^6.0.3",
@@ -38,13 +43,15 @@
38
43
  },
39
44
  "files": [
40
45
  "dist",
41
- "README.md"
46
+ "README.md",
47
+ "CHANGELOG.md"
42
48
  ],
43
49
  "engines": {
44
50
  "node": ">=22.0.0"
45
51
  },
46
52
  "scripts": {
47
- "build": "tsup --config ../../tsup.config.ts",
53
+ "build": "tsup",
54
+ "typecheck": "tsc --noEmit",
48
55
  "test": "vitest run"
49
56
  }
50
57
  }