@vibeorm/schema 4.3.0 → 5.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/dist/capabilities.d.ts +1 -1
- package/dist/errors.d.ts +7 -2
- package/dist/index.js +11 -5
- package/dist/index.js.map +6 -6
- package/package.json +1 -1
package/dist/capabilities.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export type DialectCapabilities = {
|
|
|
82
82
|
readonly nativeEnums: boolean;
|
|
83
83
|
/** Native ILIKE operator. False ⇒ LOWER() LIKE LOWER() strategy. */
|
|
84
84
|
readonly ilike: boolean;
|
|
85
|
-
/** LATERAL JOIN relation strategy ("join") availability. */
|
|
85
|
+
/** LATERAL JOIN relation strategy ("join") availability (mysql: 8.0.14 or later, not MariaDB). */
|
|
86
86
|
readonly lateralJoin: boolean;
|
|
87
87
|
/** Native DISTINCT ON. */
|
|
88
88
|
readonly distinctOn: boolean;
|
package/dist/errors.d.ts
CHANGED
|
@@ -126,8 +126,12 @@ export declare function internalError(params: {
|
|
|
126
126
|
message: string;
|
|
127
127
|
meta?: Record<string, unknown>;
|
|
128
128
|
}): VibeError;
|
|
129
|
-
/**
|
|
130
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Stable lifecycle categories; metadata never includes identity values.
|
|
131
|
+
* `"null-claim"`: a key listed in `nativeRls.refuseNull` is bound to `null` and
|
|
132
|
+
* the operation reaches a model whose rule reads it (or runs raw SQL).
|
|
133
|
+
*/
|
|
134
|
+
export declare const RLS_CONTEXT_REASONS: readonly ["missing", "invalid", "expired", "conflicting", "null-claim"];
|
|
131
135
|
export type RlsContextReason = (typeof RLS_CONTEXT_REASONS)[number];
|
|
132
136
|
/** Native RLS binding/lifecycle failure, distinct from database permissions. */
|
|
133
137
|
export declare class RlsContextError extends VibeError {
|
|
@@ -135,6 +139,7 @@ export declare class RlsContextError extends VibeError {
|
|
|
135
139
|
constructor(params: {
|
|
136
140
|
reason: RlsContextReason;
|
|
137
141
|
key?: string;
|
|
142
|
+
model?: string;
|
|
138
143
|
});
|
|
139
144
|
}
|
|
140
145
|
/**
|
package/dist/index.js
CHANGED
|
@@ -70,7 +70,8 @@ var RLS_CONTEXT_REASONS = Object.freeze([
|
|
|
70
70
|
"missing",
|
|
71
71
|
"invalid",
|
|
72
72
|
"expired",
|
|
73
|
-
"conflicting"
|
|
73
|
+
"conflicting",
|
|
74
|
+
"null-claim"
|
|
74
75
|
]);
|
|
75
76
|
|
|
76
77
|
class RlsContextError extends VibeError {
|
|
@@ -78,8 +79,8 @@ class RlsContextError extends VibeError {
|
|
|
78
79
|
constructor(params) {
|
|
79
80
|
super({
|
|
80
81
|
code: "VIBE_RLS_CONTEXT",
|
|
81
|
-
message: `Native RLS context is ${params.reason}${params.key === undefined ? "" : ` at key ${JSON.stringify(params.key)}`}`,
|
|
82
|
-
meta: { reason: params.reason, ...params.key === undefined ? {} : { key: params.key } }
|
|
82
|
+
message: params.reason === "null-claim" ? `Native RLS context key ${JSON.stringify(params.key)} is null and refused${params.model === undefined ? " for raw SQL" : ` for model ${JSON.stringify(params.model)}`}` : `Native RLS context is ${params.reason}${params.key === undefined ? "" : ` at key ${JSON.stringify(params.key)}`}`,
|
|
83
|
+
meta: { reason: params.reason, ...params.key === undefined ? {} : { key: params.key }, ...params.model === undefined ? {} : { model: params.model } }
|
|
83
84
|
});
|
|
84
85
|
this.name = "RlsContextError";
|
|
85
86
|
this.reason = params.reason;
|
|
@@ -230,6 +231,7 @@ var RESERVED_CLIENT_NAMES = [
|
|
|
230
231
|
"$executeRaw",
|
|
231
232
|
"$executeRawUnsafe",
|
|
232
233
|
"$on",
|
|
234
|
+
"$observe",
|
|
233
235
|
"$extends",
|
|
234
236
|
"$defineView",
|
|
235
237
|
"$withPolicy",
|
|
@@ -517,7 +519,7 @@ var MYSQL_CAPABILITIES = Object.freeze({
|
|
|
517
519
|
scalarArrays: false,
|
|
518
520
|
nativeEnums: true,
|
|
519
521
|
ilike: false,
|
|
520
|
-
lateralJoin:
|
|
522
|
+
lateralJoin: true,
|
|
521
523
|
distinctOn: false,
|
|
522
524
|
partialIndexes: false,
|
|
523
525
|
conflictTargetConstraint: false,
|
|
@@ -2803,8 +2805,11 @@ var RESERVED_ENUM_NAMES = [
|
|
|
2803
2805
|
"ClientContext",
|
|
2804
2806
|
"QueryOperation",
|
|
2805
2807
|
"QueryEvent",
|
|
2808
|
+
"QueryObserver",
|
|
2809
|
+
"QueryObserverFailure",
|
|
2806
2810
|
"Skip",
|
|
2807
2811
|
"TransactionOptions",
|
|
2812
|
+
"CallbackTransactionOptions",
|
|
2808
2813
|
"AdvisoryLockOptions",
|
|
2809
2814
|
"StatementDiagnosticsOptions",
|
|
2810
2815
|
"SchemaIR",
|
|
@@ -2998,6 +3003,7 @@ function validateGeneratedNames(params) {
|
|
|
2998
3003
|
owners.set("RlsContext", "native RLS client");
|
|
2999
3004
|
owners.set("BoundVibeClientInstance", "native RLS client");
|
|
3000
3005
|
owners.set("BoundVibeTransactionClientInstance", "native RLS client");
|
|
3006
|
+
owners.set("OperatorVibeClientInstance", "native RLS client");
|
|
3001
3007
|
}
|
|
3002
3008
|
if (schema.models.some((model) => model.fields.some((field) => isLocalDateField({ field })))) {
|
|
3003
3009
|
for (const name of ["LocalDate", "LocalDateFilter", "LocalDateNullableFilter"])
|
|
@@ -4496,4 +4502,4 @@ export {
|
|
|
4496
4502
|
validatorRefIssue
|
|
4497
4503
|
};
|
|
4498
4504
|
|
|
4499
|
-
//# debugId=
|
|
4505
|
+
//# debugId=BE4A4B85E399756C64756E2164756E21
|