@mdxui/do 2.1.1 → 3.0.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.
Files changed (71) hide show
  1. package/README.md +253 -266
  2. package/dist/{agents-xcIn2dUB.d.ts → agents-2_r9e9i7.d.ts} +213 -2
  3. package/dist/app/index.d.ts +347 -0
  4. package/dist/app/index.js +13 -0
  5. package/dist/app/index.js.map +1 -0
  6. package/dist/chunk-4KXVN3EQ.js +56 -0
  7. package/dist/chunk-4KXVN3EQ.js.map +1 -0
  8. package/dist/chunk-5AWTQDRF.js +76 -0
  9. package/dist/chunk-5AWTQDRF.js.map +1 -0
  10. package/dist/chunk-EQVOEEQO.js +95 -0
  11. package/dist/chunk-EQVOEEQO.js.map +1 -0
  12. package/dist/chunk-FO3N7SXV.js +469 -0
  13. package/dist/chunk-FO3N7SXV.js.map +1 -0
  14. package/dist/chunk-IESVTECE.js +536 -0
  15. package/dist/chunk-IESVTECE.js.map +1 -0
  16. package/dist/chunk-JWKIONEO.js +234 -0
  17. package/dist/chunk-JWKIONEO.js.map +1 -0
  18. package/dist/chunk-NTSEARBC.js +715 -0
  19. package/dist/chunk-NTSEARBC.js.map +1 -0
  20. package/dist/chunk-OWEAW4U6.js +116 -0
  21. package/dist/chunk-OWEAW4U6.js.map +1 -0
  22. package/dist/chunk-VRLUXCLD.js +31 -0
  23. package/dist/chunk-VRLUXCLD.js.map +1 -0
  24. package/dist/chunk-Y52IEYVM.js +131 -0
  25. package/dist/chunk-Y52IEYVM.js.map +1 -0
  26. package/dist/chunk-YGIBMNRH.js +1991 -0
  27. package/dist/chunk-YGIBMNRH.js.map +1 -0
  28. package/dist/components/index.d.ts +1 -738
  29. package/dist/components/index.js +2 -6
  30. package/dist/config-CmZBQQaT.d.ts +122 -0
  31. package/dist/{do-CaQVueZw.d.ts → do-C-t9UgjT.d.ts} +31 -33
  32. package/dist/errors-B4Oyyj4Z.d.ts +346 -0
  33. package/dist/hooks/index.d.ts +428 -696
  34. package/dist/hooks/index.js +6 -4
  35. package/dist/hooks/things/index.d.ts +298 -0
  36. package/dist/hooks/things/index.js +8 -0
  37. package/dist/hooks/things/index.js.map +1 -0
  38. package/dist/index.d.ts +21 -1010
  39. package/dist/index.js +11 -839
  40. package/dist/index.js.map +1 -1
  41. package/dist/lib/index.d.ts +100 -0
  42. package/dist/lib/index.js +6 -0
  43. package/dist/lib/index.js.map +1 -0
  44. package/dist/providers/index.d.ts +244 -32
  45. package/dist/providers/index.js +3 -2
  46. package/dist/query-keys-BC901wog.d.ts +153 -0
  47. package/dist/schemas/index.d.ts +1 -1
  48. package/dist/schemas/index.js +2 -2
  49. package/dist/schemas/index.js.map +1 -1
  50. package/dist/{thing-DtI25yZh.d.ts → thing-BVhCTzOi.d.ts} +4 -4
  51. package/dist/types/index.d.ts +251 -216
  52. package/dist/types/index.js +1 -2
  53. package/dist/views/index.d.ts +131 -0
  54. package/dist/views/index.js +11 -0
  55. package/dist/views/index.js.map +1 -0
  56. package/package.json +39 -17
  57. package/dist/__test-utils__/index.d.ts +0 -399
  58. package/dist/__test-utils__/index.js +0 -34641
  59. package/dist/__test-utils__/index.js.map +0 -1
  60. package/dist/chunk-EEDMN7UF.js +0 -1351
  61. package/dist/chunk-EEDMN7UF.js.map +0 -1
  62. package/dist/chunk-G3PMV62Z.js +0 -33
  63. package/dist/chunk-G3PMV62Z.js.map +0 -1
  64. package/dist/chunk-NXPXL5NA.js +0 -3789
  65. package/dist/chunk-NXPXL5NA.js.map +0 -1
  66. package/dist/chunk-PC5FJY6M.js +0 -20
  67. package/dist/chunk-PC5FJY6M.js.map +0 -1
  68. package/dist/chunk-XF6LKY2M.js +0 -445
  69. package/dist/chunk-XF6LKY2M.js.map +0 -1
  70. package/dist/magic-string.es-J7BYFTTJ.js +0 -1307
  71. package/dist/magic-string.es-J7BYFTTJ.js.map +0 -1
@@ -0,0 +1,153 @@
1
+ import * as zod from 'zod';
2
+ import { EntityReference } from './schemas/index.js';
3
+ import { c as ThingFilter, d as ThingSort, e as ThingPagination } from './thing-BVhCTzOi.js';
4
+ import { a5 as AgentFilter, a6 as AgentExecutionFilter, B as WorkflowFilter, F as ExecutionFilter, e as RelationshipFilter, G as GraphPattern } from './agents-2_r9e9i7.js';
5
+
6
+ /**
7
+ * Generic pagination parameters for list queries
8
+ */
9
+ interface Pagination {
10
+ page?: number;
11
+ perPage?: number;
12
+ cursor?: string;
13
+ }
14
+ /**
15
+ * Query keys for Things resource
16
+ *
17
+ * Things have a special key structure because:
18
+ * - List queries include filter, sort, and pagination
19
+ * - Detail queries use composite keys (ns, type, id) instead of a single id
20
+ * - Additional sub-queries for versions and type stats
21
+ */
22
+ declare const thingsKeys: {
23
+ all: readonly ["things"];
24
+ lists: () => readonly ["things", "list"];
25
+ list: (filter: ThingFilter, sort?: ThingSort, pagination?: ThingPagination) => readonly ["things", "list", {
26
+ readonly filter: zod.objectOutputType<{
27
+ ns: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
28
+ type: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
29
+ idPattern: zod.ZodOptional<zod.ZodString>;
30
+ nameSearch: zod.ZodOptional<zod.ZodString>;
31
+ createdAfter: zod.ZodOptional<zod.ZodDate>;
32
+ createdBefore: zod.ZodOptional<zod.ZodDate>;
33
+ updatedAfter: zod.ZodOptional<zod.ZodDate>;
34
+ updatedBefore: zod.ZodOptional<zod.ZodDate>;
35
+ includeDeleted: zod.ZodOptional<zod.ZodBoolean>;
36
+ properties: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>;
37
+ variant: zod.ZodOptional<zod.ZodString>;
38
+ }, zod.ZodTypeAny, "passthrough">;
39
+ readonly sort: {
40
+ field: "type" | "name" | "ts" | "createdAt" | "updatedAt";
41
+ order: "asc" | "desc";
42
+ } | undefined;
43
+ readonly pagination: {
44
+ page: number;
45
+ perPage: number;
46
+ } | undefined;
47
+ }];
48
+ details: () => readonly ["things", "detail"];
49
+ detail: (ns: string, type: string, id: string) => readonly ["things", "detail", string, string, string];
50
+ versions: (ns: string, type: string, id: string) => readonly ["things", "detail", string, string, string, "versions"];
51
+ types: () => readonly ["things", "types"];
52
+ typeStats: (ns: string, type: string) => readonly ["things", "types", string, string];
53
+ };
54
+ /**
55
+ * Query keys for Agents resource
56
+ *
57
+ * Includes keys for:
58
+ * - Agent lists and details
59
+ * - Agent metrics (per-agent)
60
+ * - Agent executions (list and detail)
61
+ */
62
+ declare const agentsKeys: {
63
+ all: readonly ["agents"];
64
+ lists: () => readonly ["agents", "list"];
65
+ list: (filter: AgentFilter) => readonly ["agents", "list", AgentFilter];
66
+ details: () => readonly ["agents", "detail"];
67
+ detail: (id: string) => readonly ["agents", "detail", string];
68
+ metrics: (id: string) => readonly ["agents", "detail", string, "metrics"];
69
+ executions: () => readonly ["agents", "executions"];
70
+ executionsList: (filter: AgentExecutionFilter) => readonly ["agents", "executions", "list", AgentExecutionFilter];
71
+ execution: (id: string) => readonly ["agents", "executions", "detail", string];
72
+ };
73
+ /**
74
+ * Query keys for Workflows resource
75
+ *
76
+ * Includes keys for:
77
+ * - Workflow lists and details
78
+ * - Workflow executions (list and detail)
79
+ */
80
+ declare const workflowsKeys: {
81
+ all: readonly ["workflows"];
82
+ lists: () => readonly ["workflows", "list"];
83
+ list: (filter: WorkflowFilter) => readonly ["workflows", "list", WorkflowFilter];
84
+ details: () => readonly ["workflows", "detail"];
85
+ detail: (id: string) => readonly ["workflows", "detail", string];
86
+ executions: () => readonly ["workflows", "executions"];
87
+ executionsList: (filter: ExecutionFilter) => readonly ["workflows", "executions", "list", ExecutionFilter];
88
+ execution: (id: string) => readonly ["workflows", "executions", "detail", string];
89
+ };
90
+ /**
91
+ * Query keys for Relationships resource
92
+ *
93
+ * Includes keys for:
94
+ * - Relationship lists and details
95
+ * - Graph traversal queries
96
+ * - Graph statistics
97
+ */
98
+ declare const relationshipsKeys: {
99
+ all: readonly ["relationships"];
100
+ lists: () => readonly ["relationships", "list"];
101
+ list: (filter: RelationshipFilter) => readonly ["relationships", "list", RelationshipFilter];
102
+ details: () => readonly ["relationships", "detail"];
103
+ detail: (id: string) => readonly ["relationships", "detail", string];
104
+ graph: () => readonly ["relationships", "graph"];
105
+ traverse: (entity: EntityReference, pattern: GraphPattern) => readonly ["relationships", "graph", {
106
+ type: string;
107
+ ns: string;
108
+ id: string;
109
+ semanticId: string;
110
+ name?: string | undefined;
111
+ }, GraphPattern];
112
+ stats: () => readonly ["relationships", "stats"];
113
+ };
114
+ /**
115
+ * Base query keys structure that all resources share
116
+ */
117
+ interface QueryKeys<TFilter = unknown> {
118
+ /** Root key for all queries of this resource */
119
+ all: readonly [string];
120
+ /** Key for all list queries */
121
+ lists: () => readonly [string, 'list'];
122
+ /** Key for a specific list query with filter */
123
+ list: (filter: TFilter) => readonly unknown[];
124
+ /** Key for all detail queries */
125
+ details: () => readonly [string, 'detail'];
126
+ /** Key for a specific detail query */
127
+ detail: (id: string) => readonly [string, 'detail', string];
128
+ }
129
+ /**
130
+ * Create a basic query key factory for a resource
131
+ *
132
+ * @param resource - The resource name (e.g., 'agents', 'workflows')
133
+ * @returns Query key factory with type-safe keys
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * const customKeys = createQueryKeys<CustomFilter>('custom')
138
+ *
139
+ * // All queries
140
+ * customKeys.all // ['custom']
141
+ *
142
+ * // List queries
143
+ * customKeys.lists() // ['custom', 'list']
144
+ * customKeys.list({ status: 'active' }) // ['custom', 'list', { status: 'active' }]
145
+ *
146
+ * // Detail queries
147
+ * customKeys.details() // ['custom', 'detail']
148
+ * customKeys.detail('item-1') // ['custom', 'detail', 'item-1']
149
+ * ```
150
+ */
151
+ declare function createQueryKeys<TFilter = unknown>(resource: string): QueryKeys<TFilter>;
152
+
153
+ export { type Pagination as P, type QueryKeys as Q, agentsKeys as a, createQueryKeys as c, relationshipsKeys as r, thingsKeys as t, workflowsKeys as w };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export { N as Namespace, x as NamespaceSchema, g as SemanticProperty, v as SemanticPropertySchema, S as SemanticType, w as SemanticTypeSchema, T as Thing, b as ThingCreateInput, r as ThingCreateInputSchema, f as ThingData, l as ThingDataSchema, i as ThingDeleteOptions, t as ThingDeleteOptionsSchema, c as ThingFilter, n as ThingFilterSchema, e as ThingPagination, p as ThingPaginationSchema, a as ThingQueryResult, q as ThingQueryResultSchema, m as ThingSchema, d as ThingSort, o as ThingSortSchema, h as ThingUpdateInput, s as ThingUpdateInputSchema, j as ThingVersion, u as ThingVersionSchema, k as TypeStats, y as TypeStatsSchema } from '../thing-DtI25yZh.js';
2
+ export { N as Namespace, x as NamespaceSchema, b as SemanticProperty, v as SemanticPropertySchema, S as SemanticType, w as SemanticTypeSchema, T as Thing, g as ThingCreateInput, r as ThingCreateInputSchema, a as ThingData, l as ThingDataSchema, i as ThingDeleteOptions, t as ThingDeleteOptionsSchema, c as ThingFilter, n as ThingFilterSchema, e as ThingPagination, p as ThingPaginationSchema, f as ThingQueryResult, q as ThingQueryResultSchema, m as ThingSchema, d as ThingSort, o as ThingSortSchema, h as ThingUpdateInput, s as ThingUpdateInputSchema, j as ThingVersion, u as ThingVersionSchema, k as TypeStats, y as TypeStatsSchema } from '../thing-BVhCTzOi.js';
3
3
 
4
4
  /**
5
5
  * Common Zod Schemas - Shared Schema Definitions
@@ -1,6 +1,6 @@
1
- import '../chunk-G3PMV62Z.js';
2
1
  import { z } from 'zod';
3
2
 
3
+ // src/types/schemas/common.ts
4
4
  var DateSchema = z.coerce.date();
5
5
  var OptionalDateSchema = z.union([DateSchema, z.null()]).optional();
6
6
  var EntityReferenceSchema = z.object({
@@ -212,7 +212,7 @@ var SemanticTypeSchema = z.object({
212
212
  /** Human-readable label */
213
213
  label: z.string(),
214
214
  /** Type description */
215
- description: z.string(),
215
+ description: z.string().optional(),
216
216
  /** Parent types (inheritance) */
217
217
  parentTypes: z.array(z.string()),
218
218
  /** Properties defined by this type */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schemas/common.ts","../../src/schemas/thing.ts"],"names":["z"],"mappings":";;;AAqBO,IAAM,UAAA,GAAa,CAAA,CAAE,MAAA,CAAO,IAAA;AAK5B,IAAM,kBAAA,GAAqB,CAAA,CAAE,KAAA,CAAM,CAAC,UAAA,EAAY,EAAE,IAAA,EAAM,CAAC,CAAA,CAAE,QAAA;AAc3D,IAAM,qBAAA,GAAwB,EAAE,MAAA,CAAO;AAAA;AAAA,EAE5C,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA;AAAA,EAEb,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA;AAAA,EAEf,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA;AAAA,EAEb,UAAA,EAAY,EAAE,MAAA,EAAO;AAAA;AAAA,EAErB,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AACnB,CAAC;AAmBM,IAAM,gBAAA,GAAmB,EAAE,MAAA,CAAO;AAAA;AAAA,EAEvC,WAAA,EAAa,EAAE,MAAA,EAAO;AAAA;AAAA,EAEtB,YAAA,EAAc,EAAE,MAAA,EAAO;AAAA;AAAA,EAEvB,WAAA,EAAa,EAAE,MAAA,EAAO;AAAA;AAAA,EAEtB,cAAA,EAAgB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;AAAA,EAEpC,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AACtB,CAAC;AAmBM,IAAM,oBAAA,GAAuB,EAAE,MAAA,CAAO;AAAA;AAAA,EAE3C,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA;AAAA,EAEf,OAAA,EAAS,EAAE,MAAA,EAAO;AAAA;AAAA,EAElB,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;AAAA,EAE3B,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;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,CAAMA,CAAAA,CAAE,QAAQ,CAAA;AAAA;AAAA,EAE5B,QAAA,EAAUA,CAAAA,CAAE,KAAA,CAAM,eAAe,EAAE,QAAA;AACrC,CAAC;AAcM,IAAM,eAAA,GAAkBA,EAAE,MAAA,CAAO;AAAA;AAAA,EAEtC,EAAA,EAAIA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEb,IAAA,EAAMA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEf,WAAA,EAAaA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;AAAA,EAEjC,OAAA,EAASA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;AAAA,EAE7B,KAAA,EAAOA,CAAAA,CAAE,KAAA,CAAMA,CAAAA,CAAE,QAAQ,CAAA;AAAA;AAAA,EAEzB,UAAA,EAAYA,EAAE,MAAA,EAAO;AAAA;AAAA,EAErB,SAAA,EAAW;AACb,CAAC;AAcM,IAAM,eAAA,GAAkBA,EAAE,MAAA,CAAO;AAAA;AAAA,EAEtC,IAAA,EAAMA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEf,EAAA,EAAIA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEb,KAAA,EAAOA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEhB,WAAA,EAAaA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEtB,YAAA,EAAcA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEvB,YAAA,EAAcA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEvB,aAAA,EAAe,WAAW,QAAA,EAAS;AAAA;AAAA,EAEnC,aAAA,EAAe,WAAW,QAAA;AAC5B,CAAC","file":"index.js","sourcesContent":["/**\n * Common Zod Schemas - Shared Schema Definitions\n *\n * This file contains Zod schemas that are used across multiple domains.\n * Types are derived from these schemas to ensure a single source of truth.\n *\n * @remarks\n * Import schemas from here for validation.\n * Import types from here or from domain files for TypeScript types.\n */\n\nimport { z } from 'zod'\n\n// =============================================================================\n// Date Handling\n// =============================================================================\n\n/**\n * Schema for Date fields that can be either Date objects or ISO strings.\n * API responses typically return ISO strings, not Date objects.\n */\nexport const DateSchema = z.coerce.date()\n\n/**\n * Optional nullable date for responses\n */\nexport const OptionalDateSchema = z.union([DateSchema, z.null()]).optional()\n\n// =============================================================================\n// EntityReference\n// =============================================================================\n\n/**\n * Schema for EntityReference - reference to a Thing in the semantic graph.\n *\n * Used by:\n * - Relationships (subject/object in semantic triples)\n * - Events (subject/object in semantic events)\n * - Graph traversal results\n */\nexport const EntityReferenceSchema = z.object({\n /** Namespace */\n ns: z.string(),\n /** Entity type */\n type: z.string(),\n /** Entity ID */\n id: z.string(),\n /** Semantic ID (ns/type/id) */\n semanticId: z.string(),\n /** Display name (if loaded) */\n name: z.string().optional(),\n})\n\n/**\n * Reference to an entity (Thing) in the semantic graph.\n */\nexport type EntityReference = z.infer<typeof EntityReferenceSchema>\n\n// =============================================================================\n// TokenUsage\n// =============================================================================\n\n/**\n * Schema for TokenUsage - token usage metrics for AI operations.\n *\n * Used by:\n * - Agent executions\n * - Function executions (generative/agentic)\n * - Agent trace entries\n */\nexport const TokenUsageSchema = z.object({\n /** Input/prompt tokens */\n inputTokens: z.number(),\n /** Output/completion tokens */\n outputTokens: z.number(),\n /** Total tokens (input + output) */\n totalTokens: z.number(),\n /** Thinking tokens (for reasoning models like o1, Claude with thinking) */\n thinkingTokens: z.number().optional(),\n /** Estimated cost in USD */\n costUsd: z.number().optional(),\n})\n\n/**\n * Token usage metrics for AI operations.\n */\nexport type TokenUsage = z.infer<typeof TokenUsageSchema>\n\n// =============================================================================\n// ExecutionError\n// =============================================================================\n\n/**\n * Schema for ExecutionError - error information for execution failures.\n *\n * Used by:\n * - Workflow executions\n * - Function executions\n * - Step executions\n */\nexport const ExecutionErrorSchema = z.object({\n /** Error code (e.g., 'TIMEOUT', 'VALIDATION_ERROR', 'RATE_LIMITED') */\n code: z.string(),\n /** Human-readable error message */\n message: z.string(),\n /** Stack trace (for debugging) */\n stack: z.string().optional(),\n /** ID of the step that failed (for workflow executions) */\n failedStep: z.string().optional(),\n /** Number of retry attempts made (for function executions) */\n retryCount: z.number().optional(),\n /** Whether this error is retryable (for function executions) */\n retryable: z.boolean().optional(),\n})\n\n/**\n * Error information for execution failures.\n */\nexport type ExecutionError = z.infer<typeof ExecutionErrorSchema>\n\n// =============================================================================\n// SortDirection\n// =============================================================================\n\n/**\n * Schema for SortDirection - sort direction for list queries.\n */\nexport const SortDirectionSchema = z.enum(['asc', 'desc'])\n\n/**\n * Sort direction for list queries.\n */\nexport type SortDirection = z.infer<typeof SortDirectionSchema>\n\n// =============================================================================\n// Pagination Types\n// =============================================================================\n\n/**\n * Schema for Pagination - pagination input parameters for list queries.\n */\nexport const PaginationSchema = z.object({\n /** Page number (1-indexed) */\n page: z.number().int().positive(),\n /** Items per page */\n perPage: z.number().int().positive(),\n})\n\n/**\n * Pagination input parameters for list queries.\n */\nexport type Pagination = z.infer<typeof PaginationSchema>\n\n/**\n * Schema factory for paginated responses.\n */\nexport const PaginatedResponseSchema = <T extends z.ZodTypeAny>(dataSchema: T) =>\n z.object({\n /** Array of items for the current page */\n data: z.array(dataSchema),\n /** Total number of items across all pages */\n total: z.number(),\n /** Current page number (1-indexed) */\n page: z.number(),\n /** Items per page */\n perPage: z.number(),\n /** Total number of pages */\n totalPages: z.number(),\n })\n\n/**\n * Paginated response wrapper for list queries.\n */\nexport interface PaginatedResponse<T> {\n /** Array of items for the current page */\n data: T[]\n /** Total number of items across all pages */\n total: number\n /** Current page number (1-indexed) */\n page: number\n /** Items per page */\n perPage: number\n /** Total number of pages */\n totalPages: number\n}\n","/**\n * Thing Zod Schemas - Semantic Entity Management\n *\n * Things are the core entities in the .do platform, stored in the Things table\n * with ClickHouse's ReplacingMergeTree engine for immutable, versioned storage.\n *\n * All types are derived from Zod schemas to ensure a single source of truth.\n *\n * @remarks\n * Key patterns:\n * - Semantic IDs: `[namespace]/[Name]` (e.g., `schema.org/Person`)\n * - JSON-LD compatible data structure\n * - Full version history via Events table\n * - Soft deletes with deletedAt timestamp\n */\n\nimport { z } from 'zod'\nimport { DateSchema, OptionalDateSchema, SortDirectionSchema } from './common'\n\n// =============================================================================\n// ThingData Schema\n// =============================================================================\n\n/**\n * Schema for ThingData - JSON-LD compatible data structure for Things.\n */\nexport const ThingDataSchema = z\n .object({\n /** JSON-LD context */\n '@context': z.union([z.string(), z.record(z.unknown())]).optional(),\n /** JSON-LD type (should match Thing.type) */\n '@type': z.string().optional(),\n /** JSON-LD identifier */\n '@id': z.string().optional(),\n })\n .passthrough()\n\n/**\n * JSON-LD compatible data structure for Things.\n */\nexport type ThingData = z.infer<typeof ThingDataSchema>\n\n// =============================================================================\n// Thing Schema\n// =============================================================================\n\n/**\n * Schema for Thing - base Thing record from database.\n */\nexport const ThingSchema = z.object({\n /** Namespace (tenant/domain) */\n ns: z.string(),\n /** Entity type (e.g., 'Person', 'Organization', 'Agent') */\n type: z.string(),\n /** Unique identifier within namespace/type */\n id: z.string(),\n /** Version timestamp for deduplication */\n ts: DateSchema,\n /** Display name */\n name: z.string(),\n /** Creation timestamp */\n createdAt: DateSchema,\n /** Last update timestamp */\n updatedAt: DateSchema,\n /** Creator user ID */\n createdBy: z.string().optional(),\n /** Last updater user ID */\n updatedBy: z.string().optional(),\n /** Soft delete timestamp */\n deletedAt: OptionalDateSchema,\n /** A/B test variant */\n variant: z.string().optional(),\n /** JSON-LD data blob */\n data: ThingDataSchema,\n})\n\n/**\n * Base Thing record from database.\n */\nexport type Thing = z.infer<typeof ThingSchema>\n\n// =============================================================================\n// ThingFilter Schema\n// =============================================================================\n\n/**\n * Schema for ThingFilter - query filters for Things.\n */\nexport const ThingFilterSchema = z\n .object({\n /** Filter by namespace - single string or array of strings */\n ns: z.union([z.string(), z.array(z.string())]).optional(),\n /** Filter by type - single string or array of strings */\n type: z.union([z.string(), z.array(z.string())]).optional(),\n /** Filter by ID pattern (supports wildcards) */\n idPattern: z.string().optional(),\n /** Filter by name (case-insensitive search) */\n nameSearch: z.string().optional(),\n /** Filter by creation date range - start */\n createdAfter: z.coerce.date().optional(),\n /** Filter by creation date range - end */\n createdBefore: z.coerce.date().optional(),\n /** Filter by update date range - start */\n updatedAfter: z.coerce.date().optional(),\n /** Filter by update date range - end */\n updatedBefore: z.coerce.date().optional(),\n /** Include soft-deleted things */\n includeDeleted: z.boolean().optional(),\n /** Filter by specific property values in data */\n properties: z.record(z.unknown()).optional(),\n /** Filter by variant */\n variant: z.string().optional(),\n })\n .passthrough()\n\n/**\n * Query filters for Things.\n */\nexport type ThingFilter = z.infer<typeof ThingFilterSchema>\n\n// =============================================================================\n// ThingSort Schema\n// =============================================================================\n\n/**\n * Schema for ThingSort - sort options for Things.\n */\nexport const ThingSortSchema = z.object({\n /** Field to sort by */\n field: z.enum(['name', 'createdAt', 'updatedAt', 'ts', 'type']),\n /** Sort direction */\n order: SortDirectionSchema,\n})\n\n/**\n * Sort options for Things.\n */\nexport type ThingSort = z.infer<typeof ThingSortSchema>\n\n// =============================================================================\n// ThingPagination Schema\n// =============================================================================\n\n/**\n * Schema for ThingPagination - pagination for Things queries.\n */\nexport const ThingPaginationSchema = z.object({\n /** Page number (1-indexed, must be positive) */\n page: z.number().int().positive(),\n /** Items per page (must be positive, max 1000) */\n perPage: z.number().int().positive().max(1000),\n})\n\n/**\n * Pagination for Things queries.\n */\nexport type ThingPagination = z.infer<typeof ThingPaginationSchema>\n\n// =============================================================================\n// ThingQueryResult Schema\n// =============================================================================\n\n/**\n * Schema for ThingQueryResult - result of a Things query.\n */\nexport const ThingQueryResultSchema = z.object({\n /** Matching things */\n data: z.array(ThingSchema),\n /** Total count (without pagination) */\n total: z.number(),\n /** Current page */\n page: z.number(),\n /** Items per page */\n perPage: z.number(),\n /** Total pages */\n totalPages: z.number(),\n})\n\n/**\n * Result of a Things query.\n */\nexport type ThingQueryResult = z.infer<typeof ThingQueryResultSchema>\n\n// =============================================================================\n// ThingCreateInput Schema\n// =============================================================================\n\n/**\n * Schema for ThingCreateInput - thing creation payload.\n */\nexport const ThingCreateInputSchema = z.object({\n /** Namespace (required, non-empty string) */\n ns: z.string().min(1, 'Namespace is required'),\n /** Type (required, non-empty string) */\n type: z.string().min(1, 'Type is required'),\n /** ID (optional, auto-generated if not provided) */\n id: z.string().optional(),\n /** Display name (required, non-empty string) */\n name: z.string().min(1, 'Name is required'),\n /** JSON-LD data */\n data: ThingDataSchema,\n /** Variant for A/B testing */\n variant: z.string().optional(),\n})\n\n/**\n * Thing creation payload.\n */\nexport type ThingCreateInput = z.infer<typeof ThingCreateInputSchema>\n\n// =============================================================================\n// ThingUpdateInput Schema\n// =============================================================================\n\n/**\n * Schema for ThingUpdateInput - thing update payload.\n */\nexport const ThingUpdateInputSchema = z.object({\n /** Updated name */\n name: z.string().min(1, 'Name cannot be empty').optional(),\n /** Updated data (merged with existing) */\n data: ThingDataSchema.partial().optional(),\n /** Updated variant */\n variant: z.string().optional(),\n})\n\n/**\n * Thing update payload.\n */\nexport type ThingUpdateInput = z.infer<typeof ThingUpdateInputSchema>\n\n// =============================================================================\n// ThingDeleteOptions Schema\n// =============================================================================\n\n/**\n * Schema for ThingDeleteOptions - delete options.\n */\nexport const ThingDeleteOptionsSchema = z.object({\n /** Hard delete (permanent) vs soft delete */\n hard: z.boolean().optional(),\n})\n\n/**\n * Thing delete options.\n */\nexport type ThingDeleteOptions = z.infer<typeof ThingDeleteOptionsSchema>\n\n// =============================================================================\n// ThingVersion Schema\n// =============================================================================\n\n/**\n * Schema for ThingVersion - thing version from Events table.\n */\nexport const ThingVersionSchema = z.object({\n /** Event ID */\n eventId: z.string(),\n /** Event type (create, update, delete) */\n eventType: z.enum(['create', 'update', 'delete', 'create_version', 'update_version']),\n /** Version timestamp */\n ts: DateSchema,\n /** User who made the change */\n userId: z.string(),\n /** Full data snapshot at this version */\n data: ThingDataSchema,\n /** Delta from previous version */\n delta: ThingDataSchema.optional(),\n /** Event metadata */\n metadata: z.record(z.unknown()),\n})\n\n/**\n * Thing version from Events table.\n */\nexport type ThingVersion = z.infer<typeof ThingVersionSchema>\n\n// =============================================================================\n// SemanticProperty Schema\n// =============================================================================\n\n/**\n * Schema for SemanticProperty - property definition for semantic types.\n */\nexport const SemanticPropertySchema = z.object({\n /** Property name */\n name: z.string(),\n /** Property label */\n label: z.string(),\n /** Property description */\n description: z.string(),\n /** Expected value types */\n rangeIncludes: z.array(z.string()),\n /** Types that use this property */\n domainIncludes: z.array(z.string()),\n /** Is this property required? */\n required: z.boolean(),\n /** Is this property an array? */\n isArray: z.boolean(),\n /** Default value */\n defaultValue: z.unknown().optional(),\n})\n\n/**\n * Property definition for semantic types.\n */\nexport type SemanticProperty = z.infer<typeof SemanticPropertySchema>\n\n// =============================================================================\n// SemanticType Schema\n// =============================================================================\n\n/**\n * Schema for SemanticType - semantic type definition (like schema.org types).\n */\nexport const SemanticTypeSchema = z.object({\n /** Type namespace (e.g., 'schema.org') */\n namespace: z.string(),\n /** Type name (e.g., 'Person') */\n name: z.string(),\n /** Full semantic ID */\n id: z.string(),\n /** Human-readable label */\n label: z.string(),\n /** Type description */\n description: z.string(),\n /** Parent types (inheritance) */\n parentTypes: z.array(z.string()),\n /** Properties defined by this type */\n properties: z.array(SemanticPropertySchema),\n /** Child types */\n subtypes: z.array(z.string()),\n /** Example instances */\n examples: z.array(ThingDataSchema).optional(),\n})\n\n/**\n * Semantic type definition (like schema.org types).\n */\nexport type SemanticType = z.infer<typeof SemanticTypeSchema>\n\n// =============================================================================\n// Namespace Schema\n// =============================================================================\n\n/**\n * Schema for Namespace - namespace definition (tenant/domain).\n */\nexport const NamespaceSchema = z.object({\n /** Namespace identifier */\n id: z.string(),\n /** Namespace name */\n name: z.string(),\n /** Namespace description */\n description: z.string().optional(),\n /** Base URL for the namespace */\n baseUrl: z.string().optional(),\n /** Available types in this namespace */\n types: z.array(z.string()),\n /** Thing count in this namespace */\n thingCount: z.number(),\n /** Creation timestamp */\n createdAt: DateSchema,\n})\n\n/**\n * Namespace definition (tenant/domain).\n */\nexport type Namespace = z.infer<typeof NamespaceSchema>\n\n// =============================================================================\n// TypeStats Schema\n// =============================================================================\n\n/**\n * Schema for TypeStats - statistics for a type.\n */\nexport const TypeStatsSchema = z.object({\n /** Type name */\n type: z.string(),\n /** Namespace */\n ns: z.string(),\n /** Total count */\n count: z.number(),\n /** Active count (not deleted) */\n activeCount: z.number(),\n /** Created today */\n createdToday: z.number(),\n /** Updated today */\n updatedToday: z.number(),\n /** Most recent creation */\n lastCreatedAt: DateSchema.optional(),\n /** Most recent update */\n lastUpdatedAt: DateSchema.optional(),\n})\n\n/**\n * Statistics for a type.\n */\nexport type TypeStats = z.infer<typeof TypeStatsSchema>\n"]}
1
+ {"version":3,"sources":["../../src/types/schemas/common.ts","../../src/types/schemas/thing.ts"],"names":["z"],"mappings":";;;AAqBO,IAAM,UAAA,GAAa,CAAA,CAAE,MAAA,CAAO,IAAA;AAK5B,IAAM,kBAAA,GAAqB,CAAA,CAAE,KAAA,CAAM,CAAC,UAAA,EAAY,EAAE,IAAA,EAAM,CAAC,CAAA,CAAE,QAAA;AAc3D,IAAM,qBAAA,GAAwB,EAAE,MAAA,CAAO;AAAA;AAAA,EAE5C,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA;AAAA,EAEb,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA;AAAA,EAEf,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA;AAAA,EAEb,UAAA,EAAY,EAAE,MAAA,EAAO;AAAA;AAAA,EAErB,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AACnB,CAAC;AAmBM,IAAM,gBAAA,GAAmB,EAAE,MAAA,CAAO;AAAA;AAAA,EAEvC,WAAA,EAAa,EAAE,MAAA,EAAO;AAAA;AAAA,EAEtB,YAAA,EAAc,EAAE,MAAA,EAAO;AAAA;AAAA,EAEvB,WAAA,EAAa,EAAE,MAAA,EAAO;AAAA;AAAA,EAEtB,cAAA,EAAgB,CAAA,CA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,WAAA,EAAaA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEtB,YAAA,EAAcA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEvB,YAAA,EAAcA,EAAE,MAAA,EAAO;AAAA;AAAA,EAEvB,aAAA,EAAe,WAAW,QAAA,EAAS;AAAA;AAAA,EAEnC,aAAA,EAAe,WAAW,QAAA;AAC5B,CAAC","file":"index.js","sourcesContent":["/**\n * Common Zod Schemas - Shared Schema Definitions\n *\n * This file contains Zod schemas that are used across multiple domains.\n * Types are derived from these schemas to ensure a single source of truth.\n *\n * @remarks\n * Import schemas from here for validation.\n * Import types from here or from domain files for TypeScript types.\n */\n\nimport { z } from 'zod'\n\n// =============================================================================\n// Date Handling\n// =============================================================================\n\n/**\n * Schema for Date fields that can be either Date objects or ISO strings.\n * API responses typically return ISO strings, not Date objects.\n */\nexport const DateSchema = z.coerce.date()\n\n/**\n * Optional nullable date for responses\n */\nexport const OptionalDateSchema = z.union([DateSchema, z.null()]).optional()\n\n// =============================================================================\n// EntityReference\n// =============================================================================\n\n/**\n * Schema for EntityReference - reference to a Thing in the semantic graph.\n *\n * Used by:\n * - Relationships (subject/object in semantic triples)\n * - Events (subject/object in semantic events)\n * - Graph traversal results\n */\nexport const EntityReferenceSchema = z.object({\n /** Namespace */\n ns: z.string(),\n /** Entity type */\n type: z.string(),\n /** Entity ID */\n id: z.string(),\n /** Semantic ID (ns/type/id) */\n semanticId: z.string(),\n /** Display name (if loaded) */\n name: z.string().optional(),\n})\n\n/**\n * Reference to an entity (Thing) in the semantic graph.\n */\nexport type EntityReference = z.infer<typeof EntityReferenceSchema>\n\n// =============================================================================\n// TokenUsage\n// =============================================================================\n\n/**\n * Schema for TokenUsage - token usage metrics for AI operations.\n *\n * Used by:\n * - Agent executions\n * - Function executions (generative/agentic)\n * - Agent trace entries\n */\nexport const TokenUsageSchema = z.object({\n /** Input/prompt tokens */\n inputTokens: z.number(),\n /** Output/completion tokens */\n outputTokens: z.number(),\n /** Total tokens (input + output) */\n totalTokens: z.number(),\n /** Thinking tokens (for reasoning models like o1, Claude with thinking) */\n thinkingTokens: z.number().optional(),\n /** Estimated cost in USD */\n costUsd: z.number().optional(),\n})\n\n/**\n * Token usage metrics for AI operations.\n */\nexport type TokenUsage = z.infer<typeof TokenUsageSchema>\n\n// =============================================================================\n// ExecutionError\n// =============================================================================\n\n/**\n * Schema for ExecutionError - error information for execution failures.\n *\n * Used by:\n * - Workflow executions\n * - Function executions\n * - Step executions\n */\nexport const ExecutionErrorSchema = z.object({\n /** Error code (e.g., 'TIMEOUT', 'VALIDATION_ERROR', 'RATE_LIMITED') */\n code: z.string(),\n /** Human-readable error message */\n message: z.string(),\n /** Stack trace (for debugging) */\n stack: z.string().optional(),\n /** ID of the step that failed (for workflow executions) */\n failedStep: z.string().optional(),\n /** Number of retry attempts made (for function executions) */\n retryCount: z.number().optional(),\n /** Whether this error is retryable (for function executions) */\n retryable: z.boolean().optional(),\n})\n\n/**\n * Error information for execution failures.\n */\nexport type ExecutionError = z.infer<typeof ExecutionErrorSchema>\n\n// =============================================================================\n// SortDirection\n// =============================================================================\n\n/**\n * Schema for SortDirection - sort direction for list queries.\n */\nexport const SortDirectionSchema = z.enum(['asc', 'desc'])\n\n/**\n * Sort direction for list queries.\n */\nexport type SortDirection = z.infer<typeof SortDirectionSchema>\n\n// =============================================================================\n// Pagination Types\n// =============================================================================\n\n/**\n * Schema for Pagination - pagination input parameters for list queries.\n */\nexport const PaginationSchema = z.object({\n /** Page number (1-indexed) */\n page: z.number().int().positive(),\n /** Items per page */\n perPage: z.number().int().positive(),\n})\n\n/**\n * Pagination input parameters for list queries.\n */\nexport type Pagination = z.infer<typeof PaginationSchema>\n\n/**\n * Schema factory for paginated responses.\n */\nexport const PaginatedResponseSchema = <T extends z.ZodTypeAny>(dataSchema: T) =>\n z.object({\n /** Array of items for the current page */\n data: z.array(dataSchema),\n /** Total number of items across all pages */\n total: z.number(),\n /** Current page number (1-indexed) */\n page: z.number(),\n /** Items per page */\n perPage: z.number(),\n /** Total number of pages */\n totalPages: z.number(),\n })\n\n/**\n * Paginated response wrapper for list queries.\n */\nexport interface PaginatedResponse<T> {\n /** Array of items for the current page */\n data: T[]\n /** Total number of items across all pages */\n total: number\n /** Current page number (1-indexed) */\n page: number\n /** Items per page */\n perPage: number\n /** Total number of pages */\n totalPages: number\n}\n","/**\n * Thing Zod Schemas - Semantic Entity Management\n *\n * Things are the core entities in the .do platform, stored in the Things table\n * with ClickHouse's ReplacingMergeTree engine for immutable, versioned storage.\n *\n * All types are derived from Zod schemas to ensure a single source of truth.\n *\n * @remarks\n * Key patterns:\n * - Semantic IDs: `[namespace]/[Name]` (e.g., `schema.org/Person`)\n * - JSON-LD compatible data structure\n * - Full version history via Events table\n * - Soft deletes with deletedAt timestamp\n */\n\nimport { z } from 'zod'\nimport { DateSchema, OptionalDateSchema, SortDirectionSchema } from './common'\n\n// =============================================================================\n// ThingData Schema\n// =============================================================================\n\n/**\n * Schema for ThingData - JSON-LD compatible data structure for Things.\n */\nexport const ThingDataSchema = z\n .object({\n /** JSON-LD context */\n '@context': z.union([z.string(), z.record(z.unknown())]).optional(),\n /** JSON-LD type (should match Thing.type) */\n '@type': z.string().optional(),\n /** JSON-LD identifier */\n '@id': z.string().optional(),\n })\n .passthrough()\n\n/**\n * JSON-LD compatible data structure for Things.\n */\nexport type ThingData = z.infer<typeof ThingDataSchema>\n\n// =============================================================================\n// Thing Schema\n// =============================================================================\n\n/**\n * Schema for Thing - base Thing record from database.\n */\nexport const ThingSchema = z.object({\n /** Namespace (tenant/domain) */\n ns: z.string(),\n /** Entity type (e.g., 'Person', 'Organization', 'Agent') */\n type: z.string(),\n /** Unique identifier within namespace/type */\n id: z.string(),\n /** Version timestamp for deduplication */\n ts: DateSchema,\n /** Display name */\n name: z.string(),\n /** Creation timestamp */\n createdAt: DateSchema,\n /** Last update timestamp */\n updatedAt: DateSchema,\n /** Creator user ID */\n createdBy: z.string().optional(),\n /** Last updater user ID */\n updatedBy: z.string().optional(),\n /** Soft delete timestamp */\n deletedAt: OptionalDateSchema,\n /** A/B test variant */\n variant: z.string().optional(),\n /** JSON-LD data blob */\n data: ThingDataSchema,\n})\n\n/**\n * Base Thing record from database.\n */\nexport type Thing = z.infer<typeof ThingSchema>\n\n// =============================================================================\n// ThingFilter Schema\n// =============================================================================\n\n/**\n * Schema for ThingFilter - query filters for Things.\n */\nexport const ThingFilterSchema = z\n .object({\n /** Filter by namespace - single string or array of strings */\n ns: z.union([z.string(), z.array(z.string())]).optional(),\n /** Filter by type - single string or array of strings */\n type: z.union([z.string(), z.array(z.string())]).optional(),\n /** Filter by ID pattern (supports wildcards) */\n idPattern: z.string().optional(),\n /** Filter by name (case-insensitive search) */\n nameSearch: z.string().optional(),\n /** Filter by creation date range - start */\n createdAfter: z.coerce.date().optional(),\n /** Filter by creation date range - end */\n createdBefore: z.coerce.date().optional(),\n /** Filter by update date range - start */\n updatedAfter: z.coerce.date().optional(),\n /** Filter by update date range - end */\n updatedBefore: z.coerce.date().optional(),\n /** Include soft-deleted things */\n includeDeleted: z.boolean().optional(),\n /** Filter by specific property values in data */\n properties: z.record(z.unknown()).optional(),\n /** Filter by variant */\n variant: z.string().optional(),\n })\n .passthrough()\n\n/**\n * Query filters for Things.\n */\nexport type ThingFilter = z.infer<typeof ThingFilterSchema>\n\n// =============================================================================\n// ThingSort Schema\n// =============================================================================\n\n/**\n * Schema for ThingSort - sort options for Things.\n */\nexport const ThingSortSchema = z.object({\n /** Field to sort by */\n field: z.enum(['name', 'createdAt', 'updatedAt', 'ts', 'type']),\n /** Sort direction */\n order: SortDirectionSchema,\n})\n\n/**\n * Sort options for Things.\n */\nexport type ThingSort = z.infer<typeof ThingSortSchema>\n\n// =============================================================================\n// ThingPagination Schema\n// =============================================================================\n\n/**\n * Schema for ThingPagination - pagination for Things queries.\n */\nexport const ThingPaginationSchema = z.object({\n /** Page number (1-indexed, must be positive) */\n page: z.number().int().positive(),\n /** Items per page (must be positive, max 1000) */\n perPage: z.number().int().positive().max(1000),\n})\n\n/**\n * Pagination for Things queries.\n */\nexport type ThingPagination = z.infer<typeof ThingPaginationSchema>\n\n// =============================================================================\n// ThingQueryResult Schema\n// =============================================================================\n\n/**\n * Schema for ThingQueryResult - result of a Things query.\n */\nexport const ThingQueryResultSchema = z.object({\n /** Matching things */\n data: z.array(ThingSchema),\n /** Total count (without pagination) */\n total: z.number(),\n /** Current page */\n page: z.number(),\n /** Items per page */\n perPage: z.number(),\n /** Total pages */\n totalPages: z.number(),\n})\n\n/**\n * Result of a Things query.\n */\nexport type ThingQueryResult = z.infer<typeof ThingQueryResultSchema>\n\n// =============================================================================\n// ThingCreateInput Schema\n// =============================================================================\n\n/**\n * Schema for ThingCreateInput - thing creation payload.\n */\nexport const ThingCreateInputSchema = z.object({\n /** Namespace (required, non-empty string) */\n ns: z.string().min(1, 'Namespace is required'),\n /** Type (required, non-empty string) */\n type: z.string().min(1, 'Type is required'),\n /** ID (optional, auto-generated if not provided) */\n id: z.string().optional(),\n /** Display name (required, non-empty string) */\n name: z.string().min(1, 'Name is required'),\n /** JSON-LD data */\n data: ThingDataSchema,\n /** Variant for A/B testing */\n variant: z.string().optional(),\n})\n\n/**\n * Thing creation payload.\n */\nexport type ThingCreateInput = z.infer<typeof ThingCreateInputSchema>\n\n// =============================================================================\n// ThingUpdateInput Schema\n// =============================================================================\n\n/**\n * Schema for ThingUpdateInput - thing update payload.\n */\nexport const ThingUpdateInputSchema = z.object({\n /** Updated name */\n name: z.string().min(1, 'Name cannot be empty').optional(),\n /** Updated data (merged with existing) */\n data: ThingDataSchema.partial().optional(),\n /** Updated variant */\n variant: z.string().optional(),\n})\n\n/**\n * Thing update payload.\n */\nexport type ThingUpdateInput = z.infer<typeof ThingUpdateInputSchema>\n\n// =============================================================================\n// ThingDeleteOptions Schema\n// =============================================================================\n\n/**\n * Schema for ThingDeleteOptions - delete options.\n */\nexport const ThingDeleteOptionsSchema = z.object({\n /** Hard delete (permanent) vs soft delete */\n hard: z.boolean().optional(),\n})\n\n/**\n * Thing delete options.\n */\nexport type ThingDeleteOptions = z.infer<typeof ThingDeleteOptionsSchema>\n\n// =============================================================================\n// ThingVersion Schema\n// =============================================================================\n\n/**\n * Schema for ThingVersion - thing version from Events table.\n */\nexport const ThingVersionSchema = z.object({\n /** Event ID */\n eventId: z.string(),\n /** Event type (create, update, delete) */\n eventType: z.enum(['create', 'update', 'delete', 'create_version', 'update_version']),\n /** Version timestamp */\n ts: DateSchema,\n /** User who made the change */\n userId: z.string(),\n /** Full data snapshot at this version */\n data: ThingDataSchema,\n /** Delta from previous version */\n delta: ThingDataSchema.optional(),\n /** Event metadata */\n metadata: z.record(z.unknown()),\n})\n\n/**\n * Thing version from Events table.\n */\nexport type ThingVersion = z.infer<typeof ThingVersionSchema>\n\n// =============================================================================\n// SemanticProperty Schema\n// =============================================================================\n\n/**\n * Schema for SemanticProperty - property definition for semantic types.\n */\nexport const SemanticPropertySchema = z.object({\n /** Property name */\n name: z.string(),\n /** Property label */\n label: z.string(),\n /** Property description */\n description: z.string(),\n /** Expected value types */\n rangeIncludes: z.array(z.string()),\n /** Types that use this property */\n domainIncludes: z.array(z.string()),\n /** Is this property required? */\n required: z.boolean(),\n /** Is this property an array? */\n isArray: z.boolean(),\n /** Default value */\n defaultValue: z.unknown().optional(),\n})\n\n/**\n * Property definition for semantic types.\n */\nexport type SemanticProperty = z.infer<typeof SemanticPropertySchema>\n\n// =============================================================================\n// SemanticType Schema\n// =============================================================================\n\n/**\n * Schema for SemanticType - semantic type definition (like schema.org types).\n */\nexport const SemanticTypeSchema = z.object({\n /** Type namespace (e.g., 'schema.org') */\n namespace: z.string(),\n /** Type name (e.g., 'Person') */\n name: z.string(),\n /** Full semantic ID */\n id: z.string(),\n /** Human-readable label */\n label: z.string(),\n /** Type description */\n description: z.string().optional(),\n /** Parent types (inheritance) */\n parentTypes: z.array(z.string()),\n /** Properties defined by this type */\n properties: z.array(SemanticPropertySchema),\n /** Child types */\n subtypes: z.array(z.string()),\n /** Example instances */\n examples: z.array(ThingDataSchema).optional(),\n})\n\n/**\n * Semantic type definition (like schema.org types).\n */\nexport type SemanticType = z.infer<typeof SemanticTypeSchema>\n\n// =============================================================================\n// Namespace Schema\n// =============================================================================\n\n/**\n * Schema for Namespace - namespace definition (tenant/domain).\n */\nexport const NamespaceSchema = z.object({\n /** Namespace identifier */\n id: z.string(),\n /** Namespace name */\n name: z.string(),\n /** Namespace description */\n description: z.string().optional(),\n /** Base URL for the namespace */\n baseUrl: z.string().optional(),\n /** Available types in this namespace */\n types: z.array(z.string()),\n /** Thing count in this namespace */\n thingCount: z.number(),\n /** Creation timestamp */\n createdAt: DateSchema,\n})\n\n/**\n * Namespace definition (tenant/domain).\n */\nexport type Namespace = z.infer<typeof NamespaceSchema>\n\n// =============================================================================\n// TypeStats Schema\n// =============================================================================\n\n/**\n * Schema for TypeStats - statistics for a type.\n */\nexport const TypeStatsSchema = z.object({\n /** Type name */\n type: z.string(),\n /** Namespace */\n ns: z.string(),\n /** Total count */\n count: z.number(),\n /** Active count (not deleted) */\n activeCount: z.number(),\n /** Created today */\n createdToday: z.number(),\n /** Updated today */\n updatedToday: z.number(),\n /** Most recent creation */\n lastCreatedAt: DateSchema.optional(),\n /** Most recent update */\n lastUpdatedAt: DateSchema.optional(),\n})\n\n/**\n * Statistics for a type.\n */\nexport type TypeStats = z.infer<typeof TypeStatsSchema>\n"]}
@@ -694,7 +694,7 @@ declare const SemanticTypeSchema: z.ZodObject<{
694
694
  /** Human-readable label */
695
695
  label: z.ZodString;
696
696
  /** Type description */
697
- description: z.ZodString;
697
+ description: z.ZodOptional<z.ZodString>;
698
698
  /** Parent types (inheritance) */
699
699
  parentTypes: z.ZodArray<z.ZodString, "many">;
700
700
  /** Properties defined by this type */
@@ -773,10 +773,10 @@ declare const SemanticTypeSchema: z.ZodObject<{
773
773
  defaultValue?: unknown;
774
774
  }[];
775
775
  label: string;
776
- description: string;
777
776
  namespace: string;
778
777
  parentTypes: string[];
779
778
  subtypes: string[];
779
+ description?: string | undefined;
780
780
  examples?: z.objectOutputType<{
781
781
  /** JSON-LD context */
782
782
  '@context': z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
@@ -799,10 +799,10 @@ declare const SemanticTypeSchema: z.ZodObject<{
799
799
  defaultValue?: unknown;
800
800
  }[];
801
801
  label: string;
802
- description: string;
803
802
  namespace: string;
804
803
  parentTypes: string[];
805
804
  subtypes: string[];
805
+ description?: string | undefined;
806
806
  examples?: z.objectInputType<{
807
807
  /** JSON-LD context */
808
808
  '@context': z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
@@ -899,4 +899,4 @@ declare const TypeStatsSchema: z.ZodObject<{
899
899
  */
900
900
  type TypeStats = z.infer<typeof TypeStatsSchema>;
901
901
 
902
- export { type Namespace as N, type SemanticType as S, type Thing as T, type ThingQueryResult as a, type ThingCreateInput as b, type ThingFilter as c, type ThingSort as d, type ThingPagination as e, type ThingData as f, type SemanticProperty as g, type ThingUpdateInput as h, type ThingDeleteOptions as i, type ThingVersion as j, type TypeStats as k, ThingDataSchema as l, ThingSchema as m, ThingFilterSchema as n, ThingSortSchema as o, ThingPaginationSchema as p, ThingQueryResultSchema as q, ThingCreateInputSchema as r, ThingUpdateInputSchema as s, ThingDeleteOptionsSchema as t, ThingVersionSchema as u, SemanticPropertySchema as v, SemanticTypeSchema as w, NamespaceSchema as x, TypeStatsSchema as y };
902
+ export { type Namespace as N, type SemanticType as S, type Thing as T, type ThingData as a, type SemanticProperty as b, type ThingFilter as c, type ThingSort as d, type ThingPagination as e, type ThingQueryResult as f, type ThingCreateInput as g, type ThingUpdateInput as h, type ThingDeleteOptions as i, type ThingVersion as j, type TypeStats as k, ThingDataSchema as l, ThingSchema as m, ThingFilterSchema as n, ThingSortSchema as o, ThingPaginationSchema as p, ThingQueryResultSchema as q, ThingCreateInputSchema as r, ThingUpdateInputSchema as s, ThingDeleteOptionsSchema as t, ThingVersionSchema as u, SemanticPropertySchema as v, SemanticTypeSchema as w, NamespaceSchema as x, TypeStatsSchema as y };