@code0-tech/triangulum 0.28.0 → 0.30.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.
@@ -0,0 +1,18 @@
1
+ import { Schema } from 'ts-json-schema-generator';
2
+ import { DataType } from '@code0-tech/sagittarius-graphql-types';
3
+ /** A generated JSON Schema, as produced by {@link generateJsonSchemas}. */
4
+ export type JsonSchema = Schema;
5
+ /**
6
+ * Generates JSON schemas for a batch of named TypeScript type expressions.
7
+ *
8
+ * The type strings (e.g. `"{ item: { test: number } }"` or `"NUMBER"`) are
9
+ * resolved through the same shared data-type declarations the rest of the
10
+ * library uses, then handed to `ts-json-schema-generator` for the actual JSON
11
+ * Schema generation — no schema shape is hand-built here.
12
+ *
13
+ * @param typeExpressions - Map of alias name to TypeScript type expression
14
+ * @param dataTypes - Data type definitions used to resolve named types/generics
15
+ * @returns Map of the same alias names to their generated JSON schema; an alias
16
+ * that fails to generate maps to the open schema `{}`
17
+ */
18
+ export declare const generateJsonSchemas: (typeExpressions: Record<string, string>, dataTypes?: DataType[]) => Record<string, JsonSchema>;
@@ -1,5 +1,27 @@
1
1
  import { default as ts, FunctionDeclaration } from 'typescript';
2
2
  import { FunctionDefinition, LiteralValue, NodeFunction, ReferenceValue, SubFlowValue } from '@code0-tech/sagittarius-graphql-types';
3
+ /**
4
+ * Maps a data type identifier to a dedicated input kind.
5
+ *
6
+ * These are semantic data types whose underlying (structural) type does not by
7
+ * itself convey the custom input they need — e.g. DATE is a number underneath
8
+ * but should render a date picker. The mapping is keyed on the identifier alone:
9
+ * the resulting schema carries only the input kind (plus the usual type and
10
+ * suggestions), nothing derived from the structure.
11
+ *
12
+ * Adding a new mapping is a one-line change here. The rest of the pipeline reads
13
+ * from this registry: the declaration layer brands each identifier so its alias
14
+ * name survives type resolution (see {@link getSharedTypeDeclarations}), the
15
+ * schema layer surfaces the mapped input, and the value/inference layers treat
16
+ * it as its underlying type.
17
+ */
18
+ export declare const CUSTOM_INPUT_IDENTIFIERS: {
19
+ readonly DATE: "date";
20
+ };
21
+ /** A data type identifier that maps to a custom input. */
22
+ export type CustomInputIdentifier = keyof typeof CUSTOM_INPUT_IDENTIFIERS;
23
+ /** Returns true if the given identifier maps to a custom input. */
24
+ export declare const isCustomInputIdentifier: (identifier: string | null | undefined) => identifier is CustomInputIdentifier;
3
25
  /**
4
26
  * Base interface for all input types.
5
27
  * Provides common properties for suggestions and input metadata.
@@ -37,6 +59,14 @@ export interface SubFlowInput extends Input {
37
59
  export interface PrimitiveInput extends Input {
38
60
  input?: "boolean" | "number" | "text" | "select";
39
61
  }
62
+ /**
63
+ * Represents a date input type.
64
+ * Emitted for the DATE data type so the UI can render a dedicated date picker
65
+ * instead of the plain number input its underlying type would otherwise produce.
66
+ */
67
+ export interface DateInput extends Input {
68
+ input?: "date";
69
+ }
40
70
  /**
41
71
  * Represents a data object input type with structured properties.
42
72
  * Includes property definitions and required field tracking.
@@ -72,7 +102,7 @@ export interface TypeInput extends Input {
72
102
  * Union type representing all possible schema input types.
73
103
  * Discriminated union based on the 'input' field.
74
104
  */
75
- export type Schema = PrimitiveInput | DataInput | ListInput | TypeInput | SubFlowInput | GenericInput;
105
+ export type Schema = PrimitiveInput | DateInput | DataInput | ListInput | TypeInput | SubFlowInput | GenericInput;
76
106
  /**
77
107
  * Generates a schema definition for a given TypeScript type.
78
108
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code0-tech/triangulum",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/code0-tech/triangulum#readme",
6
6
  "bugs": {
@@ -23,19 +23,21 @@
23
23
  "build": "vite build"
24
24
  },
25
25
  "devDependencies": {
26
- "@code0-tech/sagittarius-graphql-types": "0.0.0-experimental-2705887128-b8e126d1674035ed0f869775b533d7093e8aedbd",
26
+ "@code0-tech/sagittarius-graphql-types": "0.0.0-experimental-2744343400-55133b9bb6062772c50f83d945a22a531a6e48e2",
27
27
  "@types/node": "^25.6.0",
28
28
  "@typescript/vfs": "^1.6.4",
29
+ "lossless-json": "^4.3.0",
30
+ "ts-json-schema-generator": "^2.9.0",
29
31
  "typescript": "^6.0.3",
30
32
  "vite": "^8.0.16",
31
33
  "vite-plugin-dts": "^4.5.4",
32
- "vitest": "^4.1.8",
33
- "lossless-json": "^4.3.0"
34
+ "vitest": "^4.1.8"
34
35
  },
35
36
  "peerDependencies": {
36
- "@code0-tech/sagittarius-graphql-types": "0.0.0-experimental-2705887128-b8e126d1674035ed0f869775b533d7093e8aedbd",
37
+ "@code0-tech/sagittarius-graphql-types": "0.0.0-experimental-2744343400-55133b9bb6062772c50f83d945a22a531a6e48e2",
37
38
  "@typescript/vfs": "^1.6.4",
38
- "typescript": "^5.9.3 || ^6.0.2",
39
- "lossless-json": "^4.3.0"
39
+ "lossless-json": "^4.3.0",
40
+ "ts-json-schema-generator": "^2.9.0",
41
+ "typescript": "^5.9.3 || ^6.0.2"
40
42
  }
41
43
  }