@vibeorm/schema 2.4.0 → 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.
- package/LICENSE +21 -0
- package/dist/capabilities.d.ts +18 -0
- package/dist/database-module.d.ts +2 -0
- package/dist/errors.d.ts +10 -0
- package/dist/index-operator-classes.d.ts +8 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +668 -304
- package/dist/index.js.map +14 -10
- package/dist/ir.d.ts +9 -1
- package/dist/migration-objects.d.ts +7 -0
- package/dist/module-schema.d.ts +8 -0
- package/dist/namespaces.d.ts +30 -0
- package/dist/time-of-day.d.ts +19 -0
- package/package.json +4 -2
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/computed.d.ts.map +0 -1
- package/dist/database-module.d.ts.map +0 -1
- package/dist/default-values.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/exclusion.d.ts.map +0 -1
- package/dist/extension.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/ir.d.ts.map +0 -1
- package/dist/m2m.d.ts.map +0 -1
- package/dist/migration-objects.d.ts.map +0 -1
- package/dist/physical-names.d.ts.map +0 -1
- package/dist/predicate.d.ts.map +0 -1
- package/dist/prisma-literal.d.ts.map +0 -1
- package/dist/reserved.d.ts.map +0 -1
- package/dist/validate.d.ts.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VibeORM contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -34,7 +34,18 @@ export type RowLockStrength = "update" | "noKeyUpdate" | "share" | "keyShare";
|
|
|
34
34
|
export type RowLockWaitPolicy = "wait" | "nowait" | "skipLocked";
|
|
35
35
|
/** Advisory locks are exclusive (one holder) or shared (many readers, no writer). */
|
|
36
36
|
export type AdvisoryLockMode = "exclusive" | "shared";
|
|
37
|
+
/**
|
|
38
|
+
* Time-of-day column types a `DateTime` field can declare: `@db.Time(n)`
|
|
39
|
+
* (`"time"`) and `@db.Timetz(n)` (`"timetz"`, a time with a UTC offset).
|
|
40
|
+
*/
|
|
41
|
+
export type TimeOfDayType = "time" | "timetz";
|
|
37
42
|
export type DialectCapabilities = {
|
|
43
|
+
/** Fixed PostgreSQL model/module placement and namespace ownership. */
|
|
44
|
+
readonly fixedNamespaces: boolean;
|
|
45
|
+
/** Precise exclusions for objects managed by another DDL owner. */
|
|
46
|
+
readonly externalObjects: boolean;
|
|
47
|
+
/** Qualified PostgreSQL index operator classes. */
|
|
48
|
+
readonly indexOperatorClasses: boolean;
|
|
38
49
|
/** Explicit database-normalized CHECK inspection; text-only engines never guess equivalence. */
|
|
39
50
|
/** PostgreSQL GiST exclusion constraints and their shared extension requirement. */
|
|
40
51
|
readonly exclusionConstraints: boolean;
|
|
@@ -85,6 +96,13 @@ export type DialectCapabilities = {
|
|
|
85
96
|
* survives a rollback — so it does not satisfy this capability.
|
|
86
97
|
*/
|
|
87
98
|
readonly advisoryLocks: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Time-of-day column types (`DateTime @db.Time` / `@db.Timetz`) this dialect
|
|
101
|
+
* can hold. A field declaring any other is refused when the schema is
|
|
102
|
+
* validated. Values follow one contract everywhere: the UTC time of day of
|
|
103
|
+
* the `Date` is written, and a read returns that time at `1970-01-01` UTC.
|
|
104
|
+
*/
|
|
105
|
+
readonly timeOfDayTypes: readonly TimeOfDayType[];
|
|
88
106
|
};
|
|
89
107
|
export declare const POSTGRES_CAPABILITIES: DialectCapabilities;
|
|
90
108
|
export declare const SQLITE_CAPABILITIES: DialectCapabilities;
|
|
@@ -4,6 +4,8 @@ export type DatabaseModuleOptions = {
|
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly contract: string;
|
|
6
6
|
readonly revision: string;
|
|
7
|
+
/** Immutable non-public PostgreSQL placement; host binding cannot remap it. */
|
|
8
|
+
readonly namespace?: string;
|
|
7
9
|
};
|
|
8
10
|
/** Runtime artifact compatibility; schemaChecksum is not migration-history readiness. */
|
|
9
11
|
export type DatabaseModuleManifest = DatabaseModuleOptions & {
|
package/dist/errors.d.ts
CHANGED
|
@@ -60,6 +60,16 @@ export declare const VIBE_ERROR_CODES: readonly [
|
|
|
60
60
|
"VIBE_PERMISSION_DENIED",
|
|
61
61
|
/** Driver/connection failure not mapped to a more specific code. */
|
|
62
62
|
"VIBE_ADAPTER",
|
|
63
|
+
/**
|
|
64
|
+
* The adapter was disconnected: `disconnect()` ends an adapter for good, so
|
|
65
|
+
* work it receives after that call refuses instead of opening a new pool or
|
|
66
|
+
* connection. `meta` is fixed — `{ driver, state }`, where `driver` names the
|
|
67
|
+
* adapter (`"pg"`, `"bun"`, `"mysql"`, `"pglite"`, `"sqlite"`,
|
|
68
|
+
* `"better-sqlite3"`) and `state` is `"closing"` (admitted work is still
|
|
69
|
+
* draining) or `"closed"`; never an address. Create a new adapter to connect
|
|
70
|
+
* again.
|
|
71
|
+
*/
|
|
72
|
+
"VIBE_ADAPTER_CLOSED",
|
|
63
73
|
/** Invariant broken inside VibeORM itself — always a bug, please report. */
|
|
64
74
|
"VIBE_INTERNAL"];
|
|
65
75
|
export type VibeErrorCode = (typeof VIBE_ERROR_CODES)[number];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Dialect, SchemaIR } from "./ir.ts";
|
|
2
|
+
/** Validate operator classes before comparison; physical catalogs may retain unsupported unique classes. */
|
|
3
|
+
export declare function assertIndexOperatorClasses(params: {
|
|
4
|
+
schema: SchemaIR;
|
|
5
|
+
dialect: Dialect;
|
|
6
|
+
physical?: true;
|
|
7
|
+
}): void;
|
|
8
|
+
//# sourceMappingURL=index-operator-classes.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
* @vibeorm/schema — canonical Schema IR, validation, dialect/capability types,
|
|
3
3
|
* and the VibeError contract for VibeORM v2.
|
|
4
4
|
*/
|
|
5
|
+
export { SQL_NAMESPACES, assertSqlNamespace, qualifiedSqlName, sqlNamespaceIssue } from "./namespaces.ts";
|
|
6
|
+
export { assertIndexOperatorClasses } from "./index-operator-classes.ts";
|
|
5
7
|
export type { DatabaseModuleOptions, DatabaseModuleManifest, DatabaseModuleArtifact } from "./database-module.ts";
|
|
8
|
+
export { prepareDatabaseModuleSchema } from "./module-schema.ts";
|
|
6
9
|
export type { ExclusionIR, ExclusionSpec, ExclusionKey, ExclusionEndpoint } from "./exclusion.ts";
|
|
7
10
|
export { DIALECTS, ENUM_STORAGES, enumStorageOf, fieldTypeIdentity, isEnumType, providerToDialect } from "./ir.ts";
|
|
8
11
|
export type { CascadeAction, DatasourceIR, DefaultValueIR, Dialect, EnumIR, EnumStorage, ExtensionDeclIR, FieldIR, FieldType, IndexFieldIR, CheckIR, IndexIR, IndexKind, ModelIR, Provider, RelationIR, RelationType, ScalarType, SchemaIR, } from "./ir.ts";
|
|
9
12
|
export { PREDICATE_COMPARISON_OPS, isPredicateFieldRef, predicateFieldNames, predicateKey } from "./predicate.ts";
|
|
10
13
|
export type { PredicateComparisonOp, PredicateFieldRef, PredicateIR, PredicateOperand, PredicateValue } from "./predicate.ts";
|
|
11
|
-
export { assertMigrationObjects, isSqlObjectDefinition, isSqlObjectIdentity, sqlObjectKey } from "./migration-objects.ts";
|
|
14
|
+
export { assertMigrationObjects, isSqlObjectDefinition, isSqlObjectIdentity, sqlObjectKey, sqlObjectNamespace } from "./migration-objects.ts";
|
|
12
15
|
export type { MigrationObjectIR, QualifiedSqlName, SqlObjectDefinition, SqlObjectDefinitionFormat, SqlObjectFacts, SqlObjectIdentity } from "./migration-objects.ts";
|
|
13
|
-
export type { AdvisoryLockMode, DialectCapabilities, FullTextEngine, RowLockStrength, RowLockWaitPolicy, } from "./capabilities.ts";
|
|
16
|
+
export type { AdvisoryLockMode, DialectCapabilities, FullTextEngine, RowLockStrength, RowLockWaitPolicy, TimeOfDayType, } from "./capabilities.ts";
|
|
17
|
+
export { timeOfDayType } from "./time-of-day.ts";
|
|
14
18
|
export { READ_ONLY_REFUSAL_REASONS, ReadOnlyClientError, SCOPED_REFUSAL_REASONS, ScopedQueryError, VIBE_ERROR_CODES, VibeError, internalError, invalidStoredData, unsupportedCapability, } from "./errors.ts";
|
|
15
19
|
export type { ReadOnlyRefusalReason, ScopedRefusalReason, VibeErrorCode } from "./errors.ts";
|
|
16
20
|
export { decodePrismaString, encodePrismaString, exactDecimalLiteral, exactIntegerLiteral } from "./prisma-literal.ts";
|