@palbase/backend 7.0.0 → 8.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/db/index.d.cts +2 -2
- package/dist/db/index.d.ts +2 -2
- package/dist/{endpoint-BFgsOTiL.d.cts → endpoint-cDQyI6jH.d.cts} +33 -4
- package/dist/{endpoint-BFgsOTiL.d.ts → endpoint-cDQyI6jH.d.ts} +33 -4
- package/dist/{index-CE31P7Dt.d.cts → index-B-FNCK84.d.cts} +1 -1
- package/dist/{index-E7CMoir3.d.ts → index-BfnIO5G-.d.ts} +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/test/index.d.cts +1 -1
- package/dist/test/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/db/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-
|
|
1
|
+
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-B-FNCK84.cjs';
|
|
2
2
|
import './env.cjs';
|
|
3
|
-
import '../endpoint-
|
|
3
|
+
import '../endpoint-cDQyI6jH.cjs';
|
|
4
4
|
import 'zod';
|
package/dist/db/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-
|
|
1
|
+
export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-BfnIO5G-.js';
|
|
2
2
|
import './env.js';
|
|
3
|
-
import '../endpoint-
|
|
3
|
+
import '../endpoint-cDQyI6jH.js';
|
|
4
4
|
import 'zod';
|
|
@@ -97,9 +97,15 @@ declare class PalError extends HttpError {
|
|
|
97
97
|
declare abstract class NamedHttpError extends HttpError {
|
|
98
98
|
protected constructor(status: number, defaultCode: string, name: string, message?: string, code?: string, data?: unknown);
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* 400 — the request was malformed or failed validation. Carries a fixed typed
|
|
102
|
+
* payload: `new BadRequest({ fields: [{ field: "email", message: "invalid" }] })`.
|
|
103
|
+
* The shape is declared once in the SDK so codegen surfaces `error.data.fields`
|
|
104
|
+
* typed on the client.
|
|
105
|
+
*/
|
|
101
106
|
declare class BadRequest extends NamedHttpError {
|
|
102
|
-
|
|
107
|
+
readonly data: BadRequestData;
|
|
108
|
+
constructor(data: BadRequestData, message?: string);
|
|
103
109
|
}
|
|
104
110
|
/** 401 — the caller is not authenticated. */
|
|
105
111
|
declare class Unauthorized extends NamedHttpError {
|
|
@@ -117,9 +123,32 @@ declare class NotFound extends NamedHttpError {
|
|
|
117
123
|
declare class Conflict extends NamedHttpError {
|
|
118
124
|
constructor(message?: string, code?: string, data?: unknown);
|
|
119
125
|
}
|
|
120
|
-
/**
|
|
126
|
+
/** A single field-level validation failure carried by {@link BadRequest}. */
|
|
127
|
+
interface FieldError {
|
|
128
|
+
/** The offending field's name (dotted path for nested fields). */
|
|
129
|
+
field: string;
|
|
130
|
+
/** Human-readable reason the field failed. */
|
|
131
|
+
message: string;
|
|
132
|
+
}
|
|
133
|
+
/** The fixed, typed payload {@link BadRequest} ships. */
|
|
134
|
+
interface BadRequestData {
|
|
135
|
+
/** The fields that failed validation. */
|
|
136
|
+
fields: FieldError[];
|
|
137
|
+
}
|
|
138
|
+
/** The fixed, typed payload {@link TooManyRequests} ships. */
|
|
139
|
+
interface TooManyRequestsData {
|
|
140
|
+
/** Seconds the caller should wait before retrying. */
|
|
141
|
+
retryAfter: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 429 — the caller has exceeded the rate limit. Carries a fixed typed payload:
|
|
145
|
+
* `new TooManyRequests({ retryAfter: 30 })`. The shape is declared once in the
|
|
146
|
+
* SDK (error-registry pre-seed) so codegen surfaces `error.data.retryAfter`
|
|
147
|
+
* typed on the client — no per-project definition needed.
|
|
148
|
+
*/
|
|
121
149
|
declare class TooManyRequests extends NamedHttpError {
|
|
122
|
-
|
|
150
|
+
readonly data: TooManyRequestsData;
|
|
151
|
+
constructor(data: TooManyRequestsData, message?: string);
|
|
123
152
|
}
|
|
124
153
|
|
|
125
154
|
/**
|
|
@@ -97,9 +97,15 @@ declare class PalError extends HttpError {
|
|
|
97
97
|
declare abstract class NamedHttpError extends HttpError {
|
|
98
98
|
protected constructor(status: number, defaultCode: string, name: string, message?: string, code?: string, data?: unknown);
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* 400 — the request was malformed or failed validation. Carries a fixed typed
|
|
102
|
+
* payload: `new BadRequest({ fields: [{ field: "email", message: "invalid" }] })`.
|
|
103
|
+
* The shape is declared once in the SDK so codegen surfaces `error.data.fields`
|
|
104
|
+
* typed on the client.
|
|
105
|
+
*/
|
|
101
106
|
declare class BadRequest extends NamedHttpError {
|
|
102
|
-
|
|
107
|
+
readonly data: BadRequestData;
|
|
108
|
+
constructor(data: BadRequestData, message?: string);
|
|
103
109
|
}
|
|
104
110
|
/** 401 — the caller is not authenticated. */
|
|
105
111
|
declare class Unauthorized extends NamedHttpError {
|
|
@@ -117,9 +123,32 @@ declare class NotFound extends NamedHttpError {
|
|
|
117
123
|
declare class Conflict extends NamedHttpError {
|
|
118
124
|
constructor(message?: string, code?: string, data?: unknown);
|
|
119
125
|
}
|
|
120
|
-
/**
|
|
126
|
+
/** A single field-level validation failure carried by {@link BadRequest}. */
|
|
127
|
+
interface FieldError {
|
|
128
|
+
/** The offending field's name (dotted path for nested fields). */
|
|
129
|
+
field: string;
|
|
130
|
+
/** Human-readable reason the field failed. */
|
|
131
|
+
message: string;
|
|
132
|
+
}
|
|
133
|
+
/** The fixed, typed payload {@link BadRequest} ships. */
|
|
134
|
+
interface BadRequestData {
|
|
135
|
+
/** The fields that failed validation. */
|
|
136
|
+
fields: FieldError[];
|
|
137
|
+
}
|
|
138
|
+
/** The fixed, typed payload {@link TooManyRequests} ships. */
|
|
139
|
+
interface TooManyRequestsData {
|
|
140
|
+
/** Seconds the caller should wait before retrying. */
|
|
141
|
+
retryAfter: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 429 — the caller has exceeded the rate limit. Carries a fixed typed payload:
|
|
145
|
+
* `new TooManyRequests({ retryAfter: 30 })`. The shape is declared once in the
|
|
146
|
+
* SDK (error-registry pre-seed) so codegen surfaces `error.data.retryAfter`
|
|
147
|
+
* typed on the client — no per-project definition needed.
|
|
148
|
+
*/
|
|
121
149
|
declare class TooManyRequests extends NamedHttpError {
|
|
122
|
-
|
|
150
|
+
readonly data: TooManyRequestsData;
|
|
151
|
+
constructor(data: TooManyRequestsData, message?: string);
|
|
123
152
|
}
|
|
124
153
|
|
|
125
154
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tables, TableTypes } from './db/env.cjs';
|
|
2
|
-
import { D as DBClient } from './endpoint-
|
|
2
|
+
import { D as DBClient } from './endpoint-cDQyI6jH.cjs';
|
|
3
3
|
|
|
4
4
|
/** On delete action for foreign key references. */
|
|
5
5
|
type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tables, TableTypes } from './db/env.js';
|
|
2
|
-
import { D as DBClient } from './endpoint-
|
|
2
|
+
import { D as DBClient } from './endpoint-cDQyI6jH.js';
|
|
3
3
|
|
|
4
4
|
/** On delete action for foreign key references. */
|
|
5
5
|
type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
package/dist/index.cjs
CHANGED
|
@@ -981,8 +981,8 @@ function defaultMessage(name) {
|
|
|
981
981
|
return spaced.charAt(0).toUpperCase() + spaced.slice(1).toLowerCase();
|
|
982
982
|
}
|
|
983
983
|
var BadRequest = class extends NamedHttpError {
|
|
984
|
-
constructor(
|
|
985
|
-
super(400, "bad_request", "BadRequest", message,
|
|
984
|
+
constructor(data, message) {
|
|
985
|
+
super(400, "bad_request", "BadRequest", message, void 0, data);
|
|
986
986
|
}
|
|
987
987
|
};
|
|
988
988
|
var Unauthorized = class extends NamedHttpError {
|
|
@@ -1006,8 +1006,8 @@ var Conflict = class extends NamedHttpError {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
};
|
|
1008
1008
|
var TooManyRequests = class extends NamedHttpError {
|
|
1009
|
-
constructor(
|
|
1010
|
-
super(429, "too_many_requests", "TooManyRequests", message,
|
|
1009
|
+
constructor(data, message) {
|
|
1010
|
+
super(429, "too_many_requests", "TooManyRequests", message, void 0, data);
|
|
1011
1011
|
}
|
|
1012
1012
|
};
|
|
1013
1013
|
|
|
@@ -1016,6 +1016,12 @@ var import_zod_to_openapi = require("@asteasolutions/zod-to-openapi");
|
|
|
1016
1016
|
var import_zod = require("zod");
|
|
1017
1017
|
(0, import_zod_to_openapi.extendZodWithOpenApi)(import_zod.z);
|
|
1018
1018
|
var ERROR_REGISTRY = /* @__PURE__ */ Symbol.for("palbase.backend.errorRegistry");
|
|
1019
|
+
var BUILTIN_DATA_SCHEMAS = {
|
|
1020
|
+
bad_request: import_zod.z.object({
|
|
1021
|
+
fields: import_zod.z.array(import_zod.z.object({ field: import_zod.z.string(), message: import_zod.z.string() }))
|
|
1022
|
+
}),
|
|
1023
|
+
too_many_requests: import_zod.z.object({ retryAfter: import_zod.z.number().int() })
|
|
1024
|
+
};
|
|
1019
1025
|
function getErrorRegistry() {
|
|
1020
1026
|
const g = globalThis;
|
|
1021
1027
|
if (!g[ERROR_REGISTRY]) {
|
|
@@ -1028,7 +1034,14 @@ function getErrorRegistry() {
|
|
|
1028
1034
|
["conflict", 409, "Conflict"],
|
|
1029
1035
|
["too_many_requests", 429, "TooManyRequests"]
|
|
1030
1036
|
]) {
|
|
1031
|
-
|
|
1037
|
+
const dataSchema = BUILTIN_DATA_SCHEMAS[code];
|
|
1038
|
+
m.set(code, {
|
|
1039
|
+
code,
|
|
1040
|
+
status,
|
|
1041
|
+
className,
|
|
1042
|
+
builtin: true,
|
|
1043
|
+
...dataSchema ? { dataSchema, dataDigest: digestOf(code, dataSchema) } : {}
|
|
1044
|
+
});
|
|
1032
1045
|
}
|
|
1033
1046
|
g[ERROR_REGISTRY] = m;
|
|
1034
1047
|
}
|