@nicia-ai/typegraph 0.2.0 → 0.3.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.
- package/README.md +23 -0
- package/dist/{ast-BVyihVbP.d.cts → ast-CXFx6bF6.d.ts} +45 -165
- package/dist/{ast-BVyihVbP.d.ts → ast-D-3bOanX.d.cts} +45 -165
- package/dist/backend/drizzle/index.cjs +20 -20
- package/dist/backend/drizzle/index.d.cts +6 -5
- package/dist/backend/drizzle/index.d.ts +6 -5
- package/dist/backend/drizzle/index.js +8 -8
- package/dist/backend/drizzle/postgres.cjs +9 -9
- package/dist/backend/drizzle/postgres.d.cts +9 -11
- package/dist/backend/drizzle/postgres.d.ts +9 -11
- package/dist/backend/drizzle/postgres.js +6 -6
- package/dist/backend/drizzle/schema/postgres.cjs +10 -10
- package/dist/backend/drizzle/schema/postgres.d.cts +6 -5
- package/dist/backend/drizzle/schema/postgres.d.ts +6 -5
- package/dist/backend/drizzle/schema/postgres.js +3 -3
- package/dist/backend/drizzle/schema/sqlite.cjs +10 -10
- package/dist/backend/drizzle/schema/sqlite.d.cts +6 -5
- package/dist/backend/drizzle/schema/sqlite.d.ts +6 -5
- package/dist/backend/drizzle/schema/sqlite.js +3 -3
- package/dist/backend/drizzle/sqlite.cjs +9 -9
- package/dist/backend/drizzle/sqlite.d.cts +17 -18
- package/dist/backend/drizzle/sqlite.d.ts +17 -18
- package/dist/backend/drizzle/sqlite.js +6 -6
- package/dist/backend/postgres/index.cjs +21 -17
- package/dist/backend/postgres/index.d.cts +8 -7
- package/dist/backend/postgres/index.d.ts +8 -7
- package/dist/backend/postgres/index.js +8 -8
- package/dist/backend/sqlite/index.cjs +27 -21
- package/dist/backend/sqlite/index.cjs.map +1 -1
- package/dist/backend/sqlite/index.d.cts +7 -6
- package/dist/backend/sqlite/index.d.ts +7 -6
- package/dist/backend/sqlite/index.js +18 -12
- package/dist/backend/sqlite/index.js.map +1 -1
- package/dist/{chunk-YM5AL65Y.cjs → chunk-2WVFEIHR.cjs} +29 -3
- package/dist/chunk-2WVFEIHR.cjs.map +1 -0
- package/dist/{chunk-4PIEL2VO.js → chunk-3PURVEA4.js} +36 -5
- package/dist/chunk-3PURVEA4.js.map +1 -0
- package/dist/chunk-4HARSV2G.js +1448 -0
- package/dist/chunk-4HARSV2G.js.map +1 -0
- package/dist/{chunk-IIAT36MI.js → chunk-54WJF3DW.js} +29 -3
- package/dist/chunk-54WJF3DW.js.map +1 -0
- package/dist/chunk-CMHFS34N.cjs +390 -0
- package/dist/chunk-CMHFS34N.cjs.map +1 -0
- package/dist/chunk-DD6ONEBN.cjs +1264 -0
- package/dist/chunk-DD6ONEBN.cjs.map +1 -0
- package/dist/chunk-F2BZSEFE.js +388 -0
- package/dist/chunk-F2BZSEFE.js.map +1 -0
- package/dist/{chunk-DDM2FZRJ.cjs → chunk-JQDWEX6V.cjs} +24 -24
- package/dist/{chunk-DDM2FZRJ.cjs.map → chunk-JQDWEX6V.cjs.map} +1 -1
- package/dist/chunk-NP4G4ZKM.js +1228 -0
- package/dist/chunk-NP4G4ZKM.js.map +1 -0
- package/dist/{chunk-UJAGXJDG.cjs → chunk-NU2XNMVI.cjs} +38 -7
- package/dist/chunk-NU2XNMVI.cjs.map +1 -0
- package/dist/{chunk-JKTO7TW3.js → chunk-O5XPCJLF.js} +25 -3
- package/dist/chunk-O5XPCJLF.js.map +1 -0
- package/dist/{chunk-2QHQ2C4P.js → chunk-OGGLFYFA.js} +36 -5
- package/dist/chunk-OGGLFYFA.js.map +1 -0
- package/dist/{chunk-SV5H3XM5.cjs → chunk-OYL2SGBD.cjs} +26 -2
- package/dist/chunk-OYL2SGBD.cjs.map +1 -0
- package/dist/chunk-SFY2PPOY.cjs +1469 -0
- package/dist/chunk-SFY2PPOY.cjs.map +1 -0
- package/dist/{chunk-JDAET5LO.js → chunk-SMLIWLS7.js} +9 -9
- package/dist/chunk-SMLIWLS7.js.map +1 -0
- package/dist/{chunk-VXRVGFCI.js → chunk-U3452TEU.js} +17 -17
- package/dist/{chunk-VXRVGFCI.js.map → chunk-U3452TEU.js.map} +1 -1
- package/dist/{chunk-MNO33ASC.cjs → chunk-UYMT4LO2.cjs} +9 -8
- package/dist/chunk-UYMT4LO2.cjs.map +1 -0
- package/dist/chunk-V7CS2MDB.cjs +289 -0
- package/dist/chunk-V7CS2MDB.cjs.map +1 -0
- package/dist/chunk-WE5BKYNB.js +287 -0
- package/dist/chunk-WE5BKYNB.js.map +1 -0
- package/dist/{chunk-L642L24T.js → chunk-XDTYTNYL.js} +14 -21
- package/dist/chunk-XDTYTNYL.js.map +1 -0
- package/dist/{chunk-N4AOJ3VF.cjs → chunk-XZL6MCZJ.cjs} +38 -7
- package/dist/chunk-XZL6MCZJ.cjs.map +1 -0
- package/dist/{chunk-DBFCKELK.cjs → chunk-ZJHQZZT2.cjs} +18 -27
- package/dist/chunk-ZJHQZZT2.cjs.map +1 -0
- package/dist/index-Dkicw49A.d.cts +373 -0
- package/dist/index-Dkicw49A.d.ts +373 -0
- package/dist/index.cjs +5915 -3377
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -664
- package/dist/index.d.ts +24 -664
- package/dist/index.js +5781 -3223
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +16 -16
- package/dist/indexes/index.d.cts +5 -4
- package/dist/indexes/index.d.ts +5 -4
- package/dist/indexes/index.js +2 -2
- package/dist/interchange/index.cjs +9 -9
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +5 -3
- package/dist/interchange/index.d.ts +5 -3
- package/dist/interchange/index.js +8 -8
- package/dist/interchange/index.js.map +1 -1
- package/dist/manager-Jc5Btay9.d.cts +493 -0
- package/dist/manager-e9LXthrx.d.ts +493 -0
- package/dist/profiler/index.cjs +2 -8
- package/dist/profiler/index.cjs.map +1 -1
- package/dist/profiler/index.d.cts +9 -161
- package/dist/profiler/index.d.ts +9 -161
- package/dist/profiler/index.js +4 -4
- package/dist/profiler/index.js.map +1 -1
- package/dist/schema/index.cjs +145 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.cts +237 -0
- package/dist/schema/index.d.ts +237 -0
- package/dist/schema/index.js +72 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/{store-BPhjw5S8.d.ts → store-DM3Tk3Pw.d.ts} +874 -1283
- package/dist/{store-DNOOQEm8.d.cts → store-nbBybLWP.d.cts} +874 -1283
- package/dist/{test-helpers-BjyRYJZX.d.ts → test-helpers-CIq1Hhj1.d.ts} +5 -1
- package/dist/{test-helpers-NoQXhleQ.d.cts → test-helpers-DPRFVky4.d.cts} +5 -1
- package/dist/{types-D_3mEv2y.d.ts → types-BL1GyVku.d.cts} +2 -2
- package/dist/{types-DsRfx0yk.d.ts → types-Cdbi4hcx.d.ts} +228 -4
- package/dist/{types-BrSfFSpW.d.cts → types-DCGa53O2.d.ts} +2 -2
- package/dist/{types-aapj0GLz.d.cts → types-DDP0MGBF.d.cts} +228 -4
- package/dist/{types-CX4cLd7M.d.ts → types-DHRsi6j9.d.cts} +4 -3
- package/dist/types-DTJEu_-h.d.cts +158 -0
- package/dist/types-DTJEu_-h.d.ts +158 -0
- package/dist/{types-a5rAxC92.d.cts → types-ZT5mlism.d.ts} +4 -3
- package/package.json +17 -2
- package/dist/chunk-2FURVVAX.cjs +0 -350
- package/dist/chunk-2FURVVAX.cjs.map +0 -1
- package/dist/chunk-2QHQ2C4P.js.map +0 -1
- package/dist/chunk-4PIEL2VO.js.map +0 -1
- package/dist/chunk-DBFCKELK.cjs.map +0 -1
- package/dist/chunk-H7THXVH6.cjs +0 -314
- package/dist/chunk-H7THXVH6.cjs.map +0 -1
- package/dist/chunk-HXAPXPZH.cjs +0 -680
- package/dist/chunk-HXAPXPZH.cjs.map +0 -1
- package/dist/chunk-IIAT36MI.js.map +0 -1
- package/dist/chunk-JDAET5LO.js.map +0 -1
- package/dist/chunk-JKTO7TW3.js.map +0 -1
- package/dist/chunk-L642L24T.js.map +0 -1
- package/dist/chunk-MNO33ASC.cjs.map +0 -1
- package/dist/chunk-N4AOJ3VF.cjs.map +0 -1
- package/dist/chunk-QB3WBMDT.js +0 -646
- package/dist/chunk-QB3WBMDT.js.map +0 -1
- package/dist/chunk-SV5H3XM5.cjs.map +0 -1
- package/dist/chunk-UJAGXJDG.cjs.map +0 -1
- package/dist/chunk-X4EVMBON.js +0 -312
- package/dist/chunk-X4EVMBON.js.map +0 -1
- package/dist/chunk-XZL4NLV6.js +0 -348
- package/dist/chunk-XZL4NLV6.js.map +0 -1
- package/dist/chunk-YM5AL65Y.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
import { N as NodeType, E as EdgeType
|
|
3
|
-
export { A as AnyEdgeType,
|
|
4
|
-
import { I as InferenceType, M as MetaEdge, O as OntologyRelation
|
|
5
|
-
export {
|
|
6
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { N as NodeType, E as EdgeType } from './types-DTJEu_-h.cjs';
|
|
3
|
+
export { A as AnyEdgeType, d as Cardinality, C as Collation, D as DeleteBehavior, f as EdgeProps, b as EdgeRegistration, c as EdgeTypeWithEndpoints, e as EndpointExistence, G as GraphDefaults, g as NodeId, h as NodeProps, a as NodeRegistration, T as TemporalMode, i as UniqueConstraint, U as UniquenessScope, j as isEdgeType, k as isEdgeTypeWithEndpoints, l as isNodeType } from './types-DTJEu_-h.cjs';
|
|
4
|
+
import { I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-DDP0MGBF.cjs';
|
|
5
|
+
export { D as DEFAULT_SQL_SCHEMA, G as GraphBackend, j as MetaEdgeProperties, k as SqlSchema, l as SqlTableNames, T as TransactionBackend, m as createSqlSchema, n as isMetaEdge } from './types-DDP0MGBF.cjs';
|
|
6
|
+
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-nbBybLWP.cjs';
|
|
7
|
+
export { a as AggregateResult, b as CreateEdgeInput, c as CreateNodeInput, d as Edge, e as EdgeAccessor, f as EdgeCollection, g as EmbeddingSchema, h as EmbeddingValue, i as ExecutableAggregateQuery, j as ExecutableQuery, F as FieldAccessor, H as HookContext, N as Node, k as NodeAccessor, l as NodeAlias, m as NodeCollection, n as NodeRef, O as OperationHookContext, P as PaginateOptions, o as PaginatedResult, p as Predicate, q as PreparedQuery, r as PropsAccessor, s as QueryHookContext, t as QueryOptions, R as RecursiveTraversalOptions, u as SelectContext, v as SelectableEdge, w as SelectableNode, S as Store, x as StoreHooks, y as StoreOptions, z as StreamOptions, B as TransactionContext, D as TypedEdgeCollection, G as TypedNodeRef, U as UnionableQuery, I as UpdateEdgeInput, J as UpdateNodeInput, K as createStore, L as createStoreWithSchema, M as embedding, V as exists, W as fieldRef, X as getEmbeddingDimensions, Y as inSubquery, Z as isEmbeddingSchema, _ as isParameterRef, $ as notExists, a0 as notInSubquery, a1 as param } from './store-nbBybLWP.cjs';
|
|
8
|
+
import { G as GraphDef, K as KindRegistry } from './manager-Jc5Btay9.cjs';
|
|
9
|
+
export { A as AllEdgeTypes, l as AllNodeTypes, n as EdgeKinds, o as GetEdgeType, p as GetNodeType, q as NodeKinds, s as defineGraph, t as getEdgeKinds, u as getNodeKinds, v as isGraphDef } from './manager-Jc5Btay9.cjs';
|
|
10
|
+
export { C as CardinalityError, b as CompilerInvariantError, c as ConfigurationError, D as DatabaseOperationError, d as DisjointError, E as EdgeNotFoundError, e as EndpointError, f as EndpointNotFoundError, g as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaMismatchError, T as TypeGraphError, h as TypeGraphErrorOptions, U as UniquenessError, i as UnsupportedPredicateError, a as ValidationError, j as ValidationErrorDetails, V as ValidationIssue, k as VersionConflictError, l as getErrorSuggestion, m as isConstraintError, n as isSystemError, o as isTypeGraphError, p as isUserRecoverable } from './index-Dkicw49A.cjs';
|
|
11
|
+
import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, c as AggregateComparisonPredicate } from './ast-D-3bOanX.cjs';
|
|
12
|
+
export { J as JsonPointer, a as JsonPointerFor, d as JsonPointerInput, e as JsonPointerSegment, f as JsonPointerSegments, b as JsonPointerSegmentsFor, M as MAX_JSON_POINTER_DEPTH, O as OrderSpec, P as ParameterRef, R as ResolveJsonPointer, g as ResolveJsonPointerSegments, S as SortDirection, T as TraversalExpansion, j as joinJsonPointers, h as jsonPointer, n as normalizeJsonPointer, p as parseJsonPointer } from './ast-D-3bOanX.cjs';
|
|
7
13
|
export { S as SqlDialect } from './types-BRzHlhKC.cjs';
|
|
8
14
|
import 'drizzle-orm';
|
|
9
15
|
|
|
@@ -422,501 +428,6 @@ declare const core: {
|
|
|
422
428
|
readonly implies: typeof implies;
|
|
423
429
|
};
|
|
424
430
|
|
|
425
|
-
/**
|
|
426
|
-
* TypeGraph Error Hierarchy
|
|
427
|
-
*
|
|
428
|
-
* All errors extend TypeGraphError with:
|
|
429
|
-
* - `code`: Machine-readable error code for programmatic handling
|
|
430
|
-
* - `category`: Classification for error handling strategies
|
|
431
|
-
* - `suggestion`: Optional recovery guidance for users
|
|
432
|
-
* - `details`: Structured context about the error
|
|
433
|
-
*
|
|
434
|
-
* @example
|
|
435
|
-
* ```typescript
|
|
436
|
-
* try {
|
|
437
|
-
* await store.nodes.Person.create({ name: "" });
|
|
438
|
-
* } catch (error) {
|
|
439
|
-
* if (isTypeGraphError(error)) {
|
|
440
|
-
* console.error(error.toUserMessage());
|
|
441
|
-
* if (isUserRecoverable(error)) {
|
|
442
|
-
* // Show to user for correction
|
|
443
|
-
* }
|
|
444
|
-
* }
|
|
445
|
-
* }
|
|
446
|
-
* ```
|
|
447
|
-
*/
|
|
448
|
-
/**
|
|
449
|
-
* Error category for programmatic handling.
|
|
450
|
-
*
|
|
451
|
-
* - `user`: Caused by invalid input or incorrect usage. Recoverable by fixing input.
|
|
452
|
-
* - `constraint`: Business rule or schema constraint violation. Recoverable by changing data.
|
|
453
|
-
* - `system`: Internal error or infrastructure issue. May require investigation or retry.
|
|
454
|
-
*/
|
|
455
|
-
type ErrorCategory = "user" | "constraint" | "system";
|
|
456
|
-
/**
|
|
457
|
-
* Options for TypeGraphError constructor.
|
|
458
|
-
*/
|
|
459
|
-
type TypeGraphErrorOptions = Readonly<{
|
|
460
|
-
/** Structured context about the error */
|
|
461
|
-
details?: Record<string, unknown>;
|
|
462
|
-
/** Error category for handling strategies */
|
|
463
|
-
category: ErrorCategory;
|
|
464
|
-
/** Recovery guidance for users */
|
|
465
|
-
suggestion?: string;
|
|
466
|
-
/** Underlying cause of the error */
|
|
467
|
-
cause?: unknown;
|
|
468
|
-
}>;
|
|
469
|
-
/**
|
|
470
|
-
* Base error class for all TypeGraph errors.
|
|
471
|
-
*
|
|
472
|
-
* Provides structured error information for both programmatic handling
|
|
473
|
-
* and user-friendly messages.
|
|
474
|
-
*/
|
|
475
|
-
declare class TypeGraphError extends Error {
|
|
476
|
-
/** Machine-readable error code (e.g., "VALIDATION_ERROR") */
|
|
477
|
-
readonly code: string;
|
|
478
|
-
/** Error category for handling strategies */
|
|
479
|
-
readonly category: ErrorCategory;
|
|
480
|
-
/** Structured context about the error */
|
|
481
|
-
readonly details: Readonly<Record<string, unknown>>;
|
|
482
|
-
/** Recovery guidance for users */
|
|
483
|
-
readonly suggestion?: string;
|
|
484
|
-
constructor(message: string, code: string, options: TypeGraphErrorOptions);
|
|
485
|
-
/**
|
|
486
|
-
* Returns a user-friendly error message with suggestion if available.
|
|
487
|
-
*/
|
|
488
|
-
toUserMessage(): string;
|
|
489
|
-
/**
|
|
490
|
-
* Returns a detailed string representation for logging.
|
|
491
|
-
*/
|
|
492
|
-
toLogString(): string;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Validation issue from Zod or custom validation.
|
|
496
|
-
*/
|
|
497
|
-
type ValidationIssue = Readonly<{
|
|
498
|
-
/** Path to the invalid field (e.g., "address.city") */
|
|
499
|
-
path: string;
|
|
500
|
-
/** Human-readable error message */
|
|
501
|
-
message: string;
|
|
502
|
-
/** Zod error code if from Zod validation */
|
|
503
|
-
code?: string;
|
|
504
|
-
}>;
|
|
505
|
-
/**
|
|
506
|
-
* Details for ValidationError.
|
|
507
|
-
*/
|
|
508
|
-
type ValidationErrorDetails = Readonly<{
|
|
509
|
-
/** Type of entity being validated */
|
|
510
|
-
entityType?: "node" | "edge";
|
|
511
|
-
/** Kind/type name of the entity */
|
|
512
|
-
kind?: string;
|
|
513
|
-
/** Operation being performed */
|
|
514
|
-
operation?: "create" | "update";
|
|
515
|
-
/** Entity ID if updating */
|
|
516
|
-
id?: string;
|
|
517
|
-
/** Individual validation issues */
|
|
518
|
-
issues: readonly ValidationIssue[];
|
|
519
|
-
}>;
|
|
520
|
-
/**
|
|
521
|
-
* Thrown when schema validation fails during node or edge operations.
|
|
522
|
-
*
|
|
523
|
-
* @example
|
|
524
|
-
* ```typescript
|
|
525
|
-
* try {
|
|
526
|
-
* await store.nodes.Person.create({ email: "invalid" });
|
|
527
|
-
* } catch (error) {
|
|
528
|
-
* if (error instanceof ValidationError) {
|
|
529
|
-
* console.log(error.details.issues);
|
|
530
|
-
* // [{ path: "email", message: "Invalid email" }]
|
|
531
|
-
* }
|
|
532
|
-
* }
|
|
533
|
-
* ```
|
|
534
|
-
*/
|
|
535
|
-
declare class ValidationError extends TypeGraphError {
|
|
536
|
-
readonly details: ValidationErrorDetails;
|
|
537
|
-
constructor(message: string, details: ValidationErrorDetails, options?: {
|
|
538
|
-
cause?: unknown;
|
|
539
|
-
suggestion?: string;
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Thrown when a node is not found.
|
|
544
|
-
*
|
|
545
|
-
* @example
|
|
546
|
-
* ```typescript
|
|
547
|
-
* try {
|
|
548
|
-
* await store.nodes.Person.get("nonexistent-id");
|
|
549
|
-
* } catch (error) {
|
|
550
|
-
* if (error instanceof NodeNotFoundError) {
|
|
551
|
-
* console.log(error.details.kind, error.details.id);
|
|
552
|
-
* }
|
|
553
|
-
* }
|
|
554
|
-
* ```
|
|
555
|
-
*/
|
|
556
|
-
declare class NodeNotFoundError extends TypeGraphError {
|
|
557
|
-
constructor(kind: string, id: string, options?: {
|
|
558
|
-
cause?: unknown;
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Thrown when an edge is not found.
|
|
563
|
-
*/
|
|
564
|
-
declare class EdgeNotFoundError extends TypeGraphError {
|
|
565
|
-
constructor(kind: string, id: string, options?: {
|
|
566
|
-
cause?: unknown;
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Thrown when a kind is not found in the graph registry.
|
|
571
|
-
*/
|
|
572
|
-
declare class KindNotFoundError extends TypeGraphError {
|
|
573
|
-
constructor(kind: string, type: "node" | "edge", options?: {
|
|
574
|
-
cause?: unknown;
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* Thrown when edge endpoint node does not exist or is deleted.
|
|
579
|
-
*/
|
|
580
|
-
declare class EndpointNotFoundError extends TypeGraphError {
|
|
581
|
-
constructor(details: Readonly<{
|
|
582
|
-
edgeKind: string;
|
|
583
|
-
endpoint: "from" | "to";
|
|
584
|
-
nodeKind: string;
|
|
585
|
-
nodeId: string;
|
|
586
|
-
}>, options?: {
|
|
587
|
-
cause?: unknown;
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* Thrown when edge endpoint has wrong node type.
|
|
592
|
-
*/
|
|
593
|
-
declare class EndpointError extends TypeGraphError {
|
|
594
|
-
constructor(details: Readonly<{
|
|
595
|
-
edgeKind: string;
|
|
596
|
-
endpoint: "from" | "to";
|
|
597
|
-
actualKind: string;
|
|
598
|
-
expectedKinds: readonly string[];
|
|
599
|
-
}>, options?: {
|
|
600
|
-
cause?: unknown;
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Thrown when uniqueness constraint is violated.
|
|
605
|
-
*/
|
|
606
|
-
declare class UniquenessError extends TypeGraphError {
|
|
607
|
-
constructor(details: Readonly<{
|
|
608
|
-
constraintName: string;
|
|
609
|
-
kind: string;
|
|
610
|
-
existingId: string;
|
|
611
|
-
newId: string;
|
|
612
|
-
fields: readonly string[];
|
|
613
|
-
}>, options?: {
|
|
614
|
-
cause?: unknown;
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Thrown when cardinality constraint is violated.
|
|
619
|
-
*/
|
|
620
|
-
declare class CardinalityError extends TypeGraphError {
|
|
621
|
-
constructor(details: Readonly<{
|
|
622
|
-
edgeKind: string;
|
|
623
|
-
fromKind: string;
|
|
624
|
-
fromId: string;
|
|
625
|
-
cardinality: string;
|
|
626
|
-
existingCount: number;
|
|
627
|
-
}>, options?: {
|
|
628
|
-
cause?: unknown;
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Thrown when disjointness constraint is violated.
|
|
633
|
-
*
|
|
634
|
-
* Disjoint types cannot share the same ID - a node cannot be both
|
|
635
|
-
* a Person and an Organization if they are declared disjoint.
|
|
636
|
-
*/
|
|
637
|
-
declare class DisjointError extends TypeGraphError {
|
|
638
|
-
constructor(details: Readonly<{
|
|
639
|
-
nodeId: string;
|
|
640
|
-
attemptedKind: string;
|
|
641
|
-
conflictingKind: string;
|
|
642
|
-
}>, options?: {
|
|
643
|
-
cause?: unknown;
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Thrown when deletion is blocked due to existing edges (restrict behavior).
|
|
648
|
-
*/
|
|
649
|
-
declare class RestrictedDeleteError extends TypeGraphError {
|
|
650
|
-
constructor(details: Readonly<{
|
|
651
|
-
nodeKind: string;
|
|
652
|
-
nodeId: string;
|
|
653
|
-
edgeCount: number;
|
|
654
|
-
edgeKinds: readonly string[];
|
|
655
|
-
}>, options?: {
|
|
656
|
-
cause?: unknown;
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Thrown when optimistic locking detects a concurrent modification.
|
|
661
|
-
*
|
|
662
|
-
* This occurs when two operations try to update the same entity simultaneously.
|
|
663
|
-
* The operation with the stale version fails.
|
|
664
|
-
*/
|
|
665
|
-
declare class VersionConflictError extends TypeGraphError {
|
|
666
|
-
constructor(details: Readonly<{
|
|
667
|
-
kind: string;
|
|
668
|
-
id: string;
|
|
669
|
-
expectedVersion: number;
|
|
670
|
-
actualVersion: number;
|
|
671
|
-
}>, options?: {
|
|
672
|
-
cause?: unknown;
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Thrown when the schema in code doesn't match the schema in the database.
|
|
677
|
-
*/
|
|
678
|
-
declare class SchemaMismatchError extends TypeGraphError {
|
|
679
|
-
constructor(details: Readonly<{
|
|
680
|
-
graphId: string;
|
|
681
|
-
expectedHash: string;
|
|
682
|
-
actualHash: string;
|
|
683
|
-
}>, options?: {
|
|
684
|
-
cause?: unknown;
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Thrown when schema migration fails.
|
|
689
|
-
*/
|
|
690
|
-
declare class MigrationError extends TypeGraphError {
|
|
691
|
-
constructor(message: string, details: Readonly<{
|
|
692
|
-
graphId: string;
|
|
693
|
-
fromVersion: number;
|
|
694
|
-
toVersion: number;
|
|
695
|
-
reason?: string;
|
|
696
|
-
}>, options?: {
|
|
697
|
-
cause?: unknown;
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Thrown when graph configuration is invalid.
|
|
702
|
-
*
|
|
703
|
-
* This includes invalid schema definitions, ontology conflicts,
|
|
704
|
-
* and other configuration issues detected at graph creation time.
|
|
705
|
-
*/
|
|
706
|
-
declare class ConfigurationError extends TypeGraphError {
|
|
707
|
-
constructor(message: string, details?: Record<string, unknown>, options?: {
|
|
708
|
-
cause?: unknown;
|
|
709
|
-
suggestion?: string;
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Thrown when a query predicate cannot be compiled for the target database.
|
|
714
|
-
*/
|
|
715
|
-
declare class UnsupportedPredicateError extends TypeGraphError {
|
|
716
|
-
constructor(message: string, details?: Readonly<Record<string, unknown>>, options?: {
|
|
717
|
-
cause?: unknown;
|
|
718
|
-
suggestion?: string;
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* Type guard for TypeGraphError.
|
|
723
|
-
*
|
|
724
|
-
* @example
|
|
725
|
-
* ```typescript
|
|
726
|
-
* try {
|
|
727
|
-
* await store.nodes.Person.create({});
|
|
728
|
-
* } catch (error) {
|
|
729
|
-
* if (isTypeGraphError(error)) {
|
|
730
|
-
* console.log(error.code, error.category);
|
|
731
|
-
* }
|
|
732
|
-
* }
|
|
733
|
-
* ```
|
|
734
|
-
*/
|
|
735
|
-
declare function isTypeGraphError(error: unknown): error is TypeGraphError;
|
|
736
|
-
/**
|
|
737
|
-
* Check if error is recoverable by user action (user or constraint error).
|
|
738
|
-
*
|
|
739
|
-
* User-recoverable errors can typically be resolved by:
|
|
740
|
-
* - Fixing invalid input data
|
|
741
|
-
* - Using different IDs or values
|
|
742
|
-
* - Deleting conflicting data first
|
|
743
|
-
*
|
|
744
|
-
* @example
|
|
745
|
-
* ```typescript
|
|
746
|
-
* if (isUserRecoverable(error)) {
|
|
747
|
-
* showErrorToUser(error.toUserMessage());
|
|
748
|
-
* } else {
|
|
749
|
-
* logAndAlertOps(error);
|
|
750
|
-
* }
|
|
751
|
-
* ```
|
|
752
|
-
*/
|
|
753
|
-
declare function isUserRecoverable(error: unknown): boolean;
|
|
754
|
-
/**
|
|
755
|
-
* Check if error indicates a system/infrastructure issue.
|
|
756
|
-
*
|
|
757
|
-
* System errors typically require:
|
|
758
|
-
* - Retry logic (for transient failures)
|
|
759
|
-
* - Investigation (for persistent failures)
|
|
760
|
-
* - Ops team notification
|
|
761
|
-
*/
|
|
762
|
-
declare function isSystemError(error: unknown): boolean;
|
|
763
|
-
/**
|
|
764
|
-
* Check if error is a constraint violation.
|
|
765
|
-
*/
|
|
766
|
-
declare function isConstraintError(error: unknown): boolean;
|
|
767
|
-
/**
|
|
768
|
-
* Extract suggestion from error if available.
|
|
769
|
-
*/
|
|
770
|
-
declare function getErrorSuggestion(error: unknown): string | undefined;
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Contextual Validation Utilities
|
|
774
|
-
*
|
|
775
|
-
* Provides Zod validation wrappers that include full context about
|
|
776
|
-
* which entity (node/edge) and operation (create/update) failed.
|
|
777
|
-
*
|
|
778
|
-
* @example
|
|
779
|
-
* ```typescript
|
|
780
|
-
* const props = validateNodeProps(schema, input, {
|
|
781
|
-
* kind: "Person",
|
|
782
|
-
* operation: "create",
|
|
783
|
-
* });
|
|
784
|
-
* ```
|
|
785
|
-
*/
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* Context for validation operations.
|
|
789
|
-
*/
|
|
790
|
-
type ValidationContext = Readonly<{
|
|
791
|
-
/** Type of entity being validated */
|
|
792
|
-
entityType: "node" | "edge";
|
|
793
|
-
/** Kind/type name of the entity */
|
|
794
|
-
kind: string;
|
|
795
|
-
/** Operation being performed */
|
|
796
|
-
operation: "create" | "update";
|
|
797
|
-
/** Entity ID (for updates) */
|
|
798
|
-
id?: string;
|
|
799
|
-
}>;
|
|
800
|
-
/**
|
|
801
|
-
* Validates props with full context for error messages.
|
|
802
|
-
*
|
|
803
|
-
* @param schema - Zod schema to validate against
|
|
804
|
-
* @param props - Properties to validate
|
|
805
|
-
* @param context - Context about the entity and operation
|
|
806
|
-
* @returns Validated and transformed props
|
|
807
|
-
* @throws ValidationError with full context if validation fails
|
|
808
|
-
*
|
|
809
|
-
* @example
|
|
810
|
-
* ```typescript
|
|
811
|
-
* const validatedProps = validateProps(personSchema, input, {
|
|
812
|
-
* entityType: "node",
|
|
813
|
-
* kind: "Person",
|
|
814
|
-
* operation: "create",
|
|
815
|
-
* });
|
|
816
|
-
* ```
|
|
817
|
-
*/
|
|
818
|
-
declare function validateProps<T>(schema: ZodType<T>, props: unknown, context: ValidationContext): T;
|
|
819
|
-
/**
|
|
820
|
-
* Validates node props with full context.
|
|
821
|
-
*
|
|
822
|
-
* Convenience wrapper around validateProps for node operations.
|
|
823
|
-
*
|
|
824
|
-
* @example
|
|
825
|
-
* ```typescript
|
|
826
|
-
* const props = validateNodeProps(schema, input, {
|
|
827
|
-
* kind: "Person",
|
|
828
|
-
* operation: "create",
|
|
829
|
-
* });
|
|
830
|
-
* ```
|
|
831
|
-
*/
|
|
832
|
-
declare function validateNodeProps<T>(schema: ZodType<T>, props: unknown, context: Readonly<{
|
|
833
|
-
kind: string;
|
|
834
|
-
operation: "create" | "update";
|
|
835
|
-
id?: string;
|
|
836
|
-
}>): T;
|
|
837
|
-
/**
|
|
838
|
-
* Validates edge props with full context.
|
|
839
|
-
*
|
|
840
|
-
* Convenience wrapper around validateProps for edge operations.
|
|
841
|
-
*
|
|
842
|
-
* @example
|
|
843
|
-
* ```typescript
|
|
844
|
-
* const props = validateEdgeProps(schema, input, {
|
|
845
|
-
* kind: "worksAt",
|
|
846
|
-
* operation: "create",
|
|
847
|
-
* });
|
|
848
|
-
* ```
|
|
849
|
-
*/
|
|
850
|
-
declare function validateEdgeProps<T>(schema: ZodType<T>, props: unknown, context: Readonly<{
|
|
851
|
-
kind: string;
|
|
852
|
-
operation: "create" | "update";
|
|
853
|
-
id?: string;
|
|
854
|
-
}>): T;
|
|
855
|
-
/**
|
|
856
|
-
* Wraps a Zod error with TypeGraph context.
|
|
857
|
-
*
|
|
858
|
-
* Use this when you've already caught a ZodError and want to
|
|
859
|
-
* convert it to a ValidationError with context.
|
|
860
|
-
*
|
|
861
|
-
* @example
|
|
862
|
-
* ```typescript
|
|
863
|
-
* try {
|
|
864
|
-
* schema.parse(input);
|
|
865
|
-
* } catch (error) {
|
|
866
|
-
* if (error instanceof ZodError) {
|
|
867
|
-
* throw wrapZodError(error, {
|
|
868
|
-
* entityType: "node",
|
|
869
|
-
* kind: "Person",
|
|
870
|
-
* operation: "create",
|
|
871
|
-
* });
|
|
872
|
-
* }
|
|
873
|
-
* throw error;
|
|
874
|
-
* }
|
|
875
|
-
* ```
|
|
876
|
-
*/
|
|
877
|
-
declare function wrapZodError(error: ZodError, context: ValidationContext): ValidationError;
|
|
878
|
-
/**
|
|
879
|
-
* Creates a simple ValidationError without Zod context.
|
|
880
|
-
*
|
|
881
|
-
* Use this for custom validation rules that aren't part of a Zod schema.
|
|
882
|
-
*
|
|
883
|
-
* @example
|
|
884
|
-
* ```typescript
|
|
885
|
-
* if (startDate > endDate) {
|
|
886
|
-
* throw createValidationError(
|
|
887
|
-
* "Start date must be before end date",
|
|
888
|
-
* [{ path: "startDate", message: "Must be before endDate" }],
|
|
889
|
-
* { entityType: "edge", kind: "employment", operation: "create" }
|
|
890
|
-
* );
|
|
891
|
-
* }
|
|
892
|
-
* ```
|
|
893
|
-
*/
|
|
894
|
-
declare function createValidationError(message: string, issues: ValidationIssue[], context?: Partial<ValidationContext>): ValidationError;
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Builder functions for creating KindRegistry from GraphDef.
|
|
898
|
-
*/
|
|
899
|
-
|
|
900
|
-
/**
|
|
901
|
-
* Builds a KindRegistry from a GraphDef.
|
|
902
|
-
*
|
|
903
|
-
* This precomputes all transitive closures for efficient runtime queries.
|
|
904
|
-
*
|
|
905
|
-
* @example
|
|
906
|
-
* ```typescript
|
|
907
|
-
* const graph = defineGraph({
|
|
908
|
-
* id: "my_graph",
|
|
909
|
-
* nodes: { Person: { type: Person }, Company: { type: Company } },
|
|
910
|
-
* edges: { worksAt: { type: worksAt, from: [Person], to: [Company] } },
|
|
911
|
-
* ontology: [subClassOf(Company, Organization)],
|
|
912
|
-
* });
|
|
913
|
-
*
|
|
914
|
-
* const registry = buildKindRegistry(graph);
|
|
915
|
-
* registry.isSubClassOf("Company", "Organization"); // true
|
|
916
|
-
* ```
|
|
917
|
-
*/
|
|
918
|
-
declare function buildKindRegistry<G extends GraphDef>(graph: G): KindRegistry;
|
|
919
|
-
|
|
920
431
|
/**
|
|
921
432
|
* Recursive CTE Compilation
|
|
922
433
|
*
|
|
@@ -925,14 +436,19 @@ declare function buildKindRegistry<G extends GraphDef>(graph: G): KindRegistry;
|
|
|
925
436
|
*/
|
|
926
437
|
|
|
927
438
|
/**
|
|
928
|
-
* Maximum depth for recursive CTE queries.
|
|
439
|
+
* Maximum depth for recursive CTE queries when maxDepth is unlimited (-1).
|
|
929
440
|
*
|
|
930
|
-
* This limit prevents runaway recursion
|
|
931
|
-
*
|
|
932
|
-
* The limit of 100 is sufficient for most graph traversal use cases while
|
|
933
|
-
* preventing database resource exhaustion.
|
|
441
|
+
* This default limit prevents runaway recursion for unbounded traversals while
|
|
442
|
+
* still supporting typical neighborhood/path use-cases.
|
|
934
443
|
*/
|
|
935
444
|
declare const MAX_RECURSIVE_DEPTH = 100;
|
|
445
|
+
/**
|
|
446
|
+
* Maximum depth for explicit maxDepth traversals.
|
|
447
|
+
*
|
|
448
|
+
* Explicit traversal bounds are opt-in and safe to allow at a higher ceiling
|
|
449
|
+
* for stress testing and long-path workloads.
|
|
450
|
+
*/
|
|
451
|
+
declare const MAX_EXPLICIT_RECURSIVE_DEPTH = 1000;
|
|
936
452
|
|
|
937
453
|
/**
|
|
938
454
|
* Aggregate and HAVING Helper Functions
|
|
@@ -993,7 +509,7 @@ declare function min(alias: string, field: string): AggregateExpr;
|
|
|
993
509
|
*/
|
|
994
510
|
declare function max(alias: string, field: string): AggregateExpr;
|
|
995
511
|
/**
|
|
996
|
-
* Creates a field reference for use in
|
|
512
|
+
* Creates a field reference for use in aggregate.
|
|
997
513
|
*
|
|
998
514
|
* @param alias - The node alias
|
|
999
515
|
* @param path - Path to the field. Use "id" for node ID, "kind" for node kind,
|
|
@@ -1179,120 +695,6 @@ declare function offsetFragment<G extends GraphDef>(n: number): QueryFragment<G,
|
|
|
1179
695
|
*/
|
|
1180
696
|
declare function createQueryBuilder<G extends GraphDef>(graphId: string, registry: KindRegistry, options?: CreateQueryBuilderOptions): QueryBuilder<G>;
|
|
1181
697
|
|
|
1182
|
-
/**
|
|
1183
|
-
* Schema deserializer for loading stored schemas.
|
|
1184
|
-
*
|
|
1185
|
-
* Reconstructs runtime objects from SerializedSchema.
|
|
1186
|
-
* Note: Zod schemas cannot be fully reconstructed from JSON Schema,
|
|
1187
|
-
* so this provides access to the serialized data for introspection.
|
|
1188
|
-
*/
|
|
1189
|
-
|
|
1190
|
-
/**
|
|
1191
|
-
* A deserialized schema provides read-only access to schema metadata.
|
|
1192
|
-
*
|
|
1193
|
-
* Note: Unlike the original GraphDef, this does not include Zod schemas
|
|
1194
|
-
* since those cannot be reconstructed from JSON Schema. Use this for
|
|
1195
|
-
* introspection and metadata access only.
|
|
1196
|
-
*/
|
|
1197
|
-
type DeserializedSchema = Readonly<{
|
|
1198
|
-
graphId: string;
|
|
1199
|
-
version: number;
|
|
1200
|
-
generatedAt: string;
|
|
1201
|
-
/** Get node definition by name */
|
|
1202
|
-
getNode: (name: string) => SerializedNodeDef | undefined;
|
|
1203
|
-
/** Get all node names */
|
|
1204
|
-
getNodeNames: () => readonly string[];
|
|
1205
|
-
/** Get edge definition by name */
|
|
1206
|
-
getEdge: (name: string) => SerializedEdgeDef | undefined;
|
|
1207
|
-
/** Get all edge names */
|
|
1208
|
-
getEdgeNames: () => readonly string[];
|
|
1209
|
-
/** Get meta-edge definition by name */
|
|
1210
|
-
getMetaEdge: (name: string) => SerializedMetaEdge | undefined;
|
|
1211
|
-
/** Get all meta-edge names */
|
|
1212
|
-
getMetaEdgeNames: () => readonly string[];
|
|
1213
|
-
/** Get all ontology relations */
|
|
1214
|
-
getRelations: () => readonly SerializedOntologyRelation[];
|
|
1215
|
-
/** Get precomputed closures */
|
|
1216
|
-
getClosures: () => SerializedClosures;
|
|
1217
|
-
/** Get graph defaults */
|
|
1218
|
-
getDefaults: () => SerializedSchema["defaults"];
|
|
1219
|
-
/** Get the raw serialized schema */
|
|
1220
|
-
getRaw: () => SerializedSchema;
|
|
1221
|
-
/** Build a KindRegistry from the closures */
|
|
1222
|
-
buildRegistry: () => KindRegistry;
|
|
1223
|
-
}>;
|
|
1224
|
-
/**
|
|
1225
|
-
* Deserializes a SerializedSchema into a DeserializedSchema.
|
|
1226
|
-
*
|
|
1227
|
-
* @param schema - The serialized schema to deserialize
|
|
1228
|
-
* @returns A deserialized schema with accessor methods
|
|
1229
|
-
*/
|
|
1230
|
-
declare function deserializeSchema(schema: SerializedSchema): DeserializedSchema;
|
|
1231
|
-
|
|
1232
|
-
/**
|
|
1233
|
-
* Serializes a GraphDef to a SerializedSchema.
|
|
1234
|
-
*
|
|
1235
|
-
* @param graph - The graph definition to serialize
|
|
1236
|
-
* @param version - The schema version number
|
|
1237
|
-
* @returns The serialized schema
|
|
1238
|
-
*/
|
|
1239
|
-
declare function serializeSchema<G extends GraphDef>(graph: G, version: number): SerializedSchema;
|
|
1240
|
-
/**
|
|
1241
|
-
* A serialized predicate structure (matches UniqueConstraintPredicate from core/types).
|
|
1242
|
-
*/
|
|
1243
|
-
type SerializedPredicate = Readonly<{
|
|
1244
|
-
__type: "unique_predicate";
|
|
1245
|
-
field: string;
|
|
1246
|
-
op: "isNull" | "isNotNull";
|
|
1247
|
-
}>;
|
|
1248
|
-
/**
|
|
1249
|
-
* Field builder returned by the predicate proxy.
|
|
1250
|
-
*/
|
|
1251
|
-
type FieldPredicateBuilder = Readonly<{
|
|
1252
|
-
isNull: () => SerializedPredicate;
|
|
1253
|
-
isNotNull: () => SerializedPredicate;
|
|
1254
|
-
}>;
|
|
1255
|
-
/**
|
|
1256
|
-
* Predicate builder type for where clause serialization.
|
|
1257
|
-
*/
|
|
1258
|
-
type PredicateBuilder = Readonly<Record<string, FieldPredicateBuilder>>;
|
|
1259
|
-
/**
|
|
1260
|
-
* Deserializes a where predicate JSON back to a predicate function.
|
|
1261
|
-
*
|
|
1262
|
-
* This can be used to reconstruct a UniqueConstraint's where clause
|
|
1263
|
-
* from a serialized schema.
|
|
1264
|
-
*
|
|
1265
|
-
* @param serialized - The JSON string from serialization
|
|
1266
|
-
* @returns A where function that returns the predicate structure
|
|
1267
|
-
*/
|
|
1268
|
-
/**
|
|
1269
|
-
* Unique predicate result type.
|
|
1270
|
-
*/
|
|
1271
|
-
type UniquePredicate = Readonly<{
|
|
1272
|
-
__type: "unique_predicate";
|
|
1273
|
-
field: string;
|
|
1274
|
-
op: "isNull" | "isNotNull";
|
|
1275
|
-
}>;
|
|
1276
|
-
declare function deserializeWherePredicate(serialized: string): (builder: PredicateBuilder) => UniquePredicate;
|
|
1277
|
-
/**
|
|
1278
|
-
* Computes a hash of the schema content for change detection.
|
|
1279
|
-
*
|
|
1280
|
-
* Excludes version and generatedAt since those change on every save.
|
|
1281
|
-
*/
|
|
1282
|
-
declare function computeSchemaHash(schema: SerializedSchema): Promise<SchemaHash>;
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Encodes a Date to an ISO 8601 string for storage.
|
|
1286
|
-
*/
|
|
1287
|
-
declare function encodeDate(date: Date): string;
|
|
1288
|
-
/**
|
|
1289
|
-
* Decodes an ISO 8601 string to a Date.
|
|
1290
|
-
* Validates the string format first.
|
|
1291
|
-
*
|
|
1292
|
-
* @throws ValidationError if not a valid ISO datetime
|
|
1293
|
-
*/
|
|
1294
|
-
declare function decodeDate(isoString: string): Date;
|
|
1295
|
-
|
|
1296
698
|
/**
|
|
1297
699
|
* ID generation utilities.
|
|
1298
700
|
*
|
|
@@ -1320,46 +722,4 @@ type IdConfig = Readonly<{
|
|
|
1320
722
|
edgeIdGenerator: IdGenerator;
|
|
1321
723
|
}>;
|
|
1322
724
|
|
|
1323
|
-
|
|
1324
|
-
* Result type for error handling without exceptions.
|
|
1325
|
-
* Use at service boundaries and for operations that can fail.
|
|
1326
|
-
*/
|
|
1327
|
-
type Result<T, E = Error> = Readonly<{
|
|
1328
|
-
success: true;
|
|
1329
|
-
data: T;
|
|
1330
|
-
}> | Readonly<{
|
|
1331
|
-
success: false;
|
|
1332
|
-
error: E;
|
|
1333
|
-
}>;
|
|
1334
|
-
/**
|
|
1335
|
-
* Creates a successful result.
|
|
1336
|
-
*/
|
|
1337
|
-
declare function ok<T = undefined>(data?: T): Result<T, never>;
|
|
1338
|
-
/**
|
|
1339
|
-
* Creates a failed result.
|
|
1340
|
-
*/
|
|
1341
|
-
declare function err<E>(error: E): Result<never, E>;
|
|
1342
|
-
/**
|
|
1343
|
-
* Unwraps a result, throwing if it's an error.
|
|
1344
|
-
*/
|
|
1345
|
-
declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
1346
|
-
/**
|
|
1347
|
-
* Unwraps a result or returns a default value.
|
|
1348
|
-
*/
|
|
1349
|
-
declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
|
|
1350
|
-
/**
|
|
1351
|
-
* Type guard to check if result is successful.
|
|
1352
|
-
*/
|
|
1353
|
-
declare function isOk<T, E>(result: Result<T, E>): result is {
|
|
1354
|
-
success: true;
|
|
1355
|
-
data: T;
|
|
1356
|
-
};
|
|
1357
|
-
/**
|
|
1358
|
-
* Type guard to check if result is an error.
|
|
1359
|
-
*/
|
|
1360
|
-
declare function isErr<T, E>(result: Result<T, E>): result is {
|
|
1361
|
-
success: false;
|
|
1362
|
-
error: E;
|
|
1363
|
-
};
|
|
1364
|
-
|
|
1365
|
-
export { AliasMap, CardinalityError, ConfigurationError, type DefineEdgeOptions, type DefineNodeOptions, type DeserializedSchema, DisjointError, EdgeNotFoundError, EdgeType, EndpointError, EndpointNotFoundError, type ErrorCategory, type ExternalRefSchema, type ExternalRefValue, FieldRef, type FlexibleQueryFragment, GraphDef, type IdConfig, type IdGenerator, InferenceType, KindNotFoundError, KindRegistry, MAX_RECURSIVE_DEPTH, MetaEdge, type MetaEdgeOptions, MigrationError, NodeNotFoundError, NodeType, OntologyRelation, QueryBuilder, type QueryFragment, RestrictedDeleteError, type Result, SchemaHash, SchemaMismatchError, SerializedClosures, SerializedEdgeDef, SerializedMetaEdge, SerializedNodeDef, SerializedOntologyRelation, SerializedSchema, type TraversalFragment, TypeGraphError, type TypeGraphErrorOptions, UniquenessError, UnsupportedPredicateError, type ValidationContext, ValidationError, type ValidationErrorDetails, type ValidationIssue, VersionConflictError, avg, broader, buildKindRegistry, composeFragments, computeSchemaHash, core, count, countDistinct, createExternalRef, createFragment, createQueryBuilder, createValidationError, decodeDate, defineEdge, defineNode, deserializeSchema, deserializeWherePredicate, differentFrom, disjointWith, encodeDate, equivalentTo, err, externalRef, field, generateId, getErrorSuggestion, getExternalRefTable, hasPart, having, havingEq, havingGt, havingGte, havingLt, havingLte, implies, inverseOf, isConstraintError, isErr, isExternalRefSchema, isOk, isSystemError, isTypeGraphError, isUserRecoverable, limitFragment, max, metaEdge, min, narrower, offsetFragment, ok, orderByFragment, partOf, relatedTo, sameAs, serializeSchema, subClassOf, sum, unwrap, unwrapOr, validateEdgeProps, validateNodeProps, validateProps, wrapZodError };
|
|
725
|
+
export { AliasMap, type DefineEdgeOptions, type DefineNodeOptions, EdgeType, type ExternalRefSchema, type ExternalRefValue, FieldRef, type FlexibleQueryFragment, GraphDef, type IdConfig, type IdGenerator, InferenceType, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, MetaEdge, type MetaEdgeOptions, NodeType, OntologyRelation, QueryBuilder, type QueryFragment, type TraversalFragment, avg, broader, composeFragments, core, count, countDistinct, createExternalRef, createFragment, createQueryBuilder, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, externalRef, field, generateId, getExternalRefTable, hasPart, having, havingEq, havingGt, havingGte, havingLt, havingLte, implies, inverseOf, isExternalRefSchema, limitFragment, max, metaEdge, min, narrower, offsetFragment, orderByFragment, partOf, relatedTo, sameAs, subClassOf, sum };
|