@adhd/apigen-core-client 0.3.0 → 0.3.1

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/lib/batch.d.ts CHANGED
@@ -45,21 +45,6 @@ export interface BatchKindSchema {
45
45
  /** Present only when ≥2 operations share this kind (a 1-branch `oneOf` is not a union). */
46
46
  discriminator?: InlineDiscriminator;
47
47
  }
48
- /**
49
- * Build the input/output schema pair for one `_batch/<kind>` mount (F1).
50
- *
51
- * - **≥2 ops of that kind:** a real `oneOf` + `InlineDiscriminator` union,
52
- * using the same-document JSON-Pointer mechanism (`morph-walk.ts`), never
53
- * `union.ts`'s $ref/nominal mechanism (§1.1).
54
- * - **Exactly 1 op of that kind:** the single branch's shape directly, no
55
- * `oneOf` wrapper — `detectDiscriminator` itself refuses below 2 variants
56
- * (§1.1's "edge case the 0.0.1 draft missed"), and a one-variant `oneOf`
57
- * is not a union.
58
- *
59
- * Throws if `ops` is empty — callers (mount-building) must never invoke this
60
- * for a kind with zero operations; `groupBatchableOperationsByKind` never
61
- * produces an empty group.
62
- */
63
48
  export declare function buildBatchKindSchema(ops: readonly Operation[]): BatchKindSchema;
64
49
  /**
65
50
  * One synthetic `_batch/<kind>` operation shape, minus `handler` — mounting
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A `require` bound to this module's own location — the ESM-safe replacement
3
+ * for a bare `require(...)` in code bundled to BOTH `dist/index.js` (CJS) and
4
+ * `dist/index.mjs` (ESM). Resolves bare specifiers from this package's
5
+ * `node_modules` exactly as the CJS build's native `require` does, and (like
6
+ * the native `require`) exposes `.resolve`, so it is a drop-in for both
7
+ * `require(x)` and `require.resolve(x)` call sites.
8
+ *
9
+ * The `@ts-ignore` below suppresses TS1343 in DOWNSTREAM packages only.
10
+ * `apigen-core-client` is the base of the apigen family, so every consumer's
11
+ * `vite-plugin-dts` type-check follows this package's SOURCE through the
12
+ * tsconfig path mapping — and each consumer pins `module: commonjs` in its own
13
+ * `tsconfig.json`, where `import.meta` is rejected (TS1343). This file is only
14
+ * ever TYPE-CHECKED downstream, never emitted by it (the consumer emits its
15
+ * own declarations; the JS here is bundled by Rollup, which shims
16
+ * `import.meta.url` per output format) — so suppressing the diagnostic is
17
+ * scoped and safe. `@ts-ignore` (not `@ts-expect-error`) is deliberate: this
18
+ * package's own build runs `module: esnext`, where no diagnostic exists, so an
19
+ * expect-error directive would itself fail as unused. The rule-disable above
20
+ * the `@ts-ignore` is the established repo pattern for this exact suppression
21
+ * (see packages/data/data-query-engine/src/lib/expressions.ts).
22
+ */
23
+ export declare const lazyRequire: NodeRequire;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Detects whether `typeText` (a return type, already `Promise<T> → T`
3
+ * unwrapped by the caller) is one of the recognized streaming wrappers, and
4
+ * if so, returns the unwrapped per-chunk element type's text.
5
+ *
6
+ * Returns `null` when `typeText` is not a full, single streaming-wrapper
7
+ * type — including when it's a union with a stream member (e.g.
8
+ * `AsyncGenerator<T> | null`), since only the outermost `<...>` closing at
9
+ * the very end of the string counts as "fully wrapped" (a union closes its
10
+ * generic early, mid-string).
11
+ *
12
+ * @param typeText - Textual return type, e.g. `'AsyncGenerator<Chunk, void, unknown>'`.
13
+ * @returns The element type text (e.g. `'Chunk'`), or `null` if not streaming.
14
+ */
15
+ export declare function detectStreamElementType(typeText: string): string | null;
package/lib/types.d.ts CHANGED
@@ -35,6 +35,18 @@ export interface PluginInput {
35
35
  importPath: string;
36
36
  fns?: Record<string, (...args: unknown[]) => unknown>;
37
37
  createClient?: (envelope: Record<string, unknown>) => Promise<unknown>;
38
+ /**
39
+ * The real, published version of THIS package (e.g. `package.json`'s own
40
+ * `version`, read fresh — never a compiled-in constant). Optional: most
41
+ * `PluginInput.packages` callers never populate it and every existing
42
+ * construction site across the monorepo remains valid without it.
43
+ * `@adhd/apigen-plugin-mcp`'s `createMcpServer` reads it (falling back to
44
+ * this package's own `apigen-mcp`/`1.0.0` identity when absent) so an MCP
45
+ * client's `initialize` handshake reports which REAL build it is talking
46
+ * to, instead of a hardcoded placeholder identical across every apigen
47
+ * host (MCP handshake identity finding, P5-cli-serve-transport).
48
+ */
49
+ version?: string;
38
50
  }>;
39
51
  outputDir: string;
40
52
  options: Record<string, unknown>;
package/package.json CHANGED
@@ -1,17 +1,40 @@
1
1
  {
2
2
  "name": "@adhd/apigen-core-client",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "dependencies": {
5
5
  "ts-morph": "^23.0.0",
6
6
  "ts-json-schema-generator": "^2.3.0",
7
7
  "pino": "10.3.1",
8
8
  "typescript": "^6.0.3",
9
- "@adhd/apigen-base-logical": "^0.1.1"
9
+ "@adhd/apigen-base-logical": "^0.1.2"
10
10
  },
11
11
  "main": "./index.js",
12
12
  "module": "./index.mjs",
13
13
  "typings": "./index.d.ts",
14
14
  "publishConfig": {
15
15
  "access": "public"
16
+ },
17
+ "description": "Code-first API generation - derive JSON Schemas from TypeScript types and live-mount to HTTP, MCP, CLI, OpenAPI, Python, and Java with zero codegen",
18
+ "keywords": [
19
+ "openapi",
20
+ "typescript",
21
+ "codegen",
22
+ "json-schema",
23
+ "swagger",
24
+ "api",
25
+ "code-first",
26
+ "mcp",
27
+ "grpc",
28
+ "schema"
29
+ ],
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/PseudoSky/adhd.git",
34
+ "directory": "packages/apigen/apigen-core-client"
35
+ },
36
+ "homepage": "https://github.com/PseudoSky/adhd/tree/main/packages/apigen/apigen-core-client#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/PseudoSky/adhd/issues"
16
39
  }
17
40
  }