@zveltio/sdk 3.0.0-beta.4 → 3.0.0-beta.68
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/client/Auth.d.ts.map +1 -1
- package/dist/client/Auth.js +3 -0
- package/dist/client/QueryBuilder.d.ts.map +1 -1
- package/dist/client/QueryBuilder.js +4 -0
- package/dist/client/ZveltioClient.d.ts.map +1 -1
- package/dist/client/ZveltioClient.js +5 -0
- package/dist/client.d.ts +4 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +30 -13
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +21 -3
- package/dist/crdt.d.ts.map +1 -1
- package/dist/crdt.js +11 -2
- package/dist/ddl/index.d.ts.map +1 -1
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +124 -0
- package/dist/extension/index.d.ts +419 -19
- package/dist/extension/index.d.ts.map +1 -1
- package/dist/extension/index.js +3 -0
- package/dist/extension/jsonb.d.ts +62 -0
- package/dist/extension/jsonb.d.ts.map +1 -0
- package/dist/extension/jsonb.js +64 -0
- package/dist/extension/multipart.d.ts +58 -0
- package/dist/extension/multipart.d.ts.map +1 -0
- package/dist/extension/multipart.js +61 -0
- package/dist/extension/numeric.d.ts +94 -0
- package/dist/extension/numeric.d.ts.map +1 -0
- package/dist/extension/numeric.js +162 -0
- package/dist/extension/permission-gate.d.ts +15 -0
- package/dist/extension/permission-gate.d.ts.map +1 -1
- package/dist/extension/permission-gate.js +33 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/local-store.d.ts +5 -0
- package/dist/local-store.d.ts.map +1 -1
- package/dist/local-store.js +62 -10
- package/dist/offline/index.d.ts +3 -3
- package/dist/offline/index.js +51 -15
- package/dist/publish/index.d.ts.map +1 -1
- package/dist/publish/index.js +6 -1
- package/dist/realtime.d.ts +9 -1
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +15 -2
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +2 -0
- package/dist/schema-codegen.d.ts +3 -1
- package/dist/schema-codegen.d.ts.map +1 -1
- package/dist/schema-codegen.js +41 -7
- package/dist/schema-watcher.d.ts +1 -1
- package/dist/schema-watcher.js +1 -1
- package/dist/studio/index.d.ts +1 -0
- package/dist/studio/index.d.ts.map +1 -1
- package/dist/studio/index.js +3 -0
- package/dist/studio/slot-owner-registry.d.ts +13 -0
- package/dist/studio/slot-owner-registry.d.ts.map +1 -0
- package/dist/studio/slot-owner-registry.js +21 -0
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.d.ts.map +1 -1
- package/dist/svelte.js +4 -2
- package/dist/sync-manager.d.ts +30 -4
- package/dist/sync-manager.d.ts.map +1 -1
- package/dist/sync-manager.js +101 -15
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +23 -1
- package/dist/testing/with-test-db.d.ts.map +1 -1
- package/dist/testing/with-test-db.js +21 -14
- package/dist/tests/client.test.d.ts +2 -0
- package/dist/tests/client.test.d.ts.map +1 -0
- package/dist/tests/client.test.js +55 -0
- package/dist/tests/crdt-orset.test.d.ts +2 -0
- package/dist/tests/crdt-orset.test.d.ts.map +1 -0
- package/dist/tests/crdt-orset.test.js +23 -0
- package/dist/tests/local-store.test.js +44 -0
- package/dist/tests/multipart.test.d.ts +2 -0
- package/dist/tests/multipart.test.d.ts.map +1 -0
- package/dist/tests/multipart.test.js +37 -0
- package/dist/tests/offline-provider-crdt.test.d.ts +2 -0
- package/dist/tests/offline-provider-crdt.test.d.ts.map +1 -0
- package/dist/tests/offline-provider-crdt.test.js +119 -0
- package/dist/tests/realtime.test.d.ts +2 -0
- package/dist/tests/realtime.test.d.ts.map +1 -0
- package/dist/tests/realtime.test.js +39 -0
- package/dist/tests/sync-manager.test.d.ts +2 -0
- package/dist/tests/sync-manager.test.d.ts.map +1 -0
- package/dist/tests/sync-manager.test.js +65 -0
- package/dist/tests/with-test-db.test.d.ts +2 -0
- package/dist/tests/with-test-db.test.d.ts.map +1 -0
- package/dist/tests/with-test-db.test.js +57 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/validate/index.d.ts +49 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +494 -7
- package/dist/validate/shared-message-keys.d.ts +16 -0
- package/dist/validate/shared-message-keys.d.ts.map +1 -0
- package/dist/validate/shared-message-keys.js +227 -0
- package/package.json +7 -7
- package/dist/generate-types.d.ts +0 -37
- package/dist/generate-types.d.ts.map +0 -1
- package/dist/generate-types.js +0 -157
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
|
-
import type { Kysely } from 'kysely';
|
|
2
|
+
import type { Kysely, RawBuilder } from 'kysely';
|
|
3
3
|
export { permissionGate } from './permission-gate.js';
|
|
4
|
+
export { readMultipart, MULTIPART_REQUIRED } from './multipart.js';
|
|
5
|
+
export { toJsonb } from './jsonb.js';
|
|
6
|
+
export { isStorableNumeric, NumericConversionError, roundMoney, sumNumeric, toNumber, toNumberOrNull, toNumberSafe, } from './numeric.js';
|
|
7
|
+
/**
|
|
8
|
+
* One row-level-security condition, as `getRlsFilters` produces it and
|
|
9
|
+
* `applyRlsFilters` consumes it. Opaque in practice — an extension passes the
|
|
10
|
+
* array straight through rather than reading it.
|
|
11
|
+
*/
|
|
12
|
+
export interface RlsFilter {
|
|
13
|
+
readonly field: string;
|
|
14
|
+
readonly condition: {
|
|
15
|
+
readonly op: string;
|
|
16
|
+
readonly value?: unknown;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The filter operators the engine's query compiler understands — the vocabulary
|
|
21
|
+
* `buildCondition` accepts.
|
|
22
|
+
*
|
|
23
|
+
* Declared here rather than in the engine because this is the file an extension
|
|
24
|
+
* author compiles against, and the engine imports it back (as it already does
|
|
25
|
+
* for `RlsFilter`). One list: a repeated one is how this codebase's dominant
|
|
26
|
+
* defect shape starts.
|
|
27
|
+
*/
|
|
28
|
+
export type FilterOp = 'eq' | 'neq' | 'lt' | 'lte' | 'gt' | 'gte' | 'like' | 'ilike' | 'in' | 'not_in' | 'null' | 'not_null';
|
|
29
|
+
/**
|
|
30
|
+
* The actor a data-path call is made on behalf of.
|
|
31
|
+
*
|
|
32
|
+
* Declared here for the same reason as `RlsFilter` and `FilterOp`: it is part
|
|
33
|
+
* of what `ctx.internals.checkAccess` asks an extension for, and the engine
|
|
34
|
+
* re-exports it rather than keeping a second copy.
|
|
35
|
+
*/
|
|
36
|
+
export interface RequestUser {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
role: string;
|
|
40
|
+
/** Present only for API-key auth — collection/action scopes. */
|
|
41
|
+
scopes?: unknown;
|
|
42
|
+
/** Present for session auth. */
|
|
43
|
+
email?: string;
|
|
44
|
+
/** API-key auth only: this key is exempt from row-level security. */
|
|
45
|
+
rlsBypass?: boolean;
|
|
46
|
+
/** API-key auth only: the `user` row authorship is recorded against. */
|
|
47
|
+
authorUserId?: string | null;
|
|
48
|
+
}
|
|
4
49
|
export interface FieldTypeRegistryAPI {
|
|
5
50
|
register(definition: any): void;
|
|
6
51
|
get(type: string): any;
|
|
@@ -21,6 +66,68 @@ export interface FieldTypeRegistryAPI {
|
|
|
21
66
|
/** Coerce a value FROM its TS shape INTO the database representation. */
|
|
22
67
|
serialize(type: string, value: any): any;
|
|
23
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Object storage settings, handed to extensions that declare the `storage`
|
|
71
|
+
* capability. `undefined` on `ExtensionConfig` means the instance has no object
|
|
72
|
+
* storage configured — degrade (keep metadata, skip the bytes), don't throw.
|
|
73
|
+
*
|
|
74
|
+
* Resolved from the same source the engine uses, which includes the admin's
|
|
75
|
+
* Studio settings. Reading `S3_*` from the environment instead misses that
|
|
76
|
+
* overlay entirely and sees an unconfigured instance.
|
|
77
|
+
*/
|
|
78
|
+
export interface ObjectStorageConfig {
|
|
79
|
+
/** Endpoint origin, no trailing slash. */
|
|
80
|
+
readonly endpoint: string;
|
|
81
|
+
readonly region: string;
|
|
82
|
+
readonly bucket: string;
|
|
83
|
+
/** Public base URL for reads, when the deployment serves one. */
|
|
84
|
+
readonly publicUrl?: string;
|
|
85
|
+
readonly accessKeyId: string;
|
|
86
|
+
readonly secretAccessKey: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The configuration an extension may read — `ctx.config`.
|
|
90
|
+
*
|
|
91
|
+
* Use this instead of `process.env`. An in-process extension reading the
|
|
92
|
+
* environment gets the whole ENGINE environment (database credentials, the auth
|
|
93
|
+
* secret, the field-encryption key), which is both more than any extension
|
|
94
|
+
* needs and a way around the capability gate on `ctx.internals`.
|
|
95
|
+
*
|
|
96
|
+
* Values are live: read them when you need them rather than caching at module
|
|
97
|
+
* scope, because an administrator can change storage settings at runtime.
|
|
98
|
+
*/
|
|
99
|
+
export interface ExtensionConfig {
|
|
100
|
+
/**
|
|
101
|
+
* This extension's own slice of the environment.
|
|
102
|
+
*
|
|
103
|
+
* Everything the deployment set as `ZVELTIO_EXT_<NAME>_<KEY>` appears here as
|
|
104
|
+
* `<KEY>`, and nothing else does. `search` reading `vars.MEILISEARCH_URL` gets
|
|
105
|
+
* `ZVELTIO_EXT_SEARCH_MEILISEARCH_URL`; it cannot see `DATABASE_URL`,
|
|
106
|
+
* `BETTER_AUTH_SECRET`, or another extension's keys.
|
|
107
|
+
*
|
|
108
|
+
* Use this instead of `process.env`, which from inside an in-process extension
|
|
109
|
+
* is the ENGINE's environment in full.
|
|
110
|
+
*
|
|
111
|
+
* Values are strings — coerce at the point of use, and treat a missing key as
|
|
112
|
+
* "not configured" rather than defaulting to something that half-works.
|
|
113
|
+
*/
|
|
114
|
+
readonly vars: Readonly<Record<string, string>>;
|
|
115
|
+
readonly env: 'production' | 'development' | 'test';
|
|
116
|
+
readonly isProduction: boolean;
|
|
117
|
+
/** The engine's public base URL, when the deployment sets one. */
|
|
118
|
+
readonly publicUrl?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the instance has a field-encryption key configured. A boolean by
|
|
121
|
+
* design — to encrypt something use `ctx.internals.encryptSecret`, which is
|
|
122
|
+
* gated by the `secrets` capability. Extensions do not hold key material.
|
|
123
|
+
*/
|
|
124
|
+
readonly encryptionConfigured: boolean;
|
|
125
|
+
readonly crossDomainAuth: boolean;
|
|
126
|
+
/** Permits plaintext LDAP binds. Development only. */
|
|
127
|
+
readonly allowInsecureLdap: boolean;
|
|
128
|
+
/** Present only with the `storage` capability, and only when configured. */
|
|
129
|
+
readonly objectStorage?: ObjectStorageConfig;
|
|
130
|
+
}
|
|
24
131
|
/**
|
|
25
132
|
* Context injected into every extension's `register()` call.
|
|
26
133
|
*
|
|
@@ -33,8 +140,40 @@ export interface ExtensionContext<DB = any> {
|
|
|
33
140
|
/**
|
|
34
141
|
* Kysely database instance (restricted — cannot query zv_* system tables).
|
|
35
142
|
* Typed via the `DB` generic; use `ZveltioExtension<MySchema>` to opt in.
|
|
143
|
+
*
|
|
144
|
+
* TENANT-SCOPED (since H-12): queries run against the current request/job
|
|
145
|
+
* tenant's transaction (so the `zveltio.current_tenant` GUC is set and
|
|
146
|
+
* FORCE-RLS rows are isolated), or the global pool outside any tenant context
|
|
147
|
+
* (boot/migrations). You no longer need `ctx.reqDb(c)` for isolation — `ctx.db`
|
|
148
|
+
* is safe by default. For explicit CROSS-tenant access, see `ctx.adminDb`.
|
|
36
149
|
*/
|
|
37
150
|
db: Kysely<DB>;
|
|
151
|
+
/**
|
|
152
|
+
* Configuration this extension may read. Use it instead of `process.env` —
|
|
153
|
+
* see `ExtensionConfig`.
|
|
154
|
+
*
|
|
155
|
+
* Typed optional so partial/bootstrap contexts type-check; always present on
|
|
156
|
+
* the context the engine hands a loaded extension.
|
|
157
|
+
*/
|
|
158
|
+
config?: ExtensionConfig;
|
|
159
|
+
/**
|
|
160
|
+
* Explicit CROSS-TENANT database handle (the global pool). Present ONLY when
|
|
161
|
+
* the manifest declares the `db:admin` permission — otherwise any query throws.
|
|
162
|
+
* Use for legitimately global operations (platform-wide reporting, backup).
|
|
163
|
+
* Declaring `db:admin` surfaces the cross-tenant access at review + install.
|
|
164
|
+
*/
|
|
165
|
+
adminDb?: Kysely<DB>;
|
|
166
|
+
/**
|
|
167
|
+
* Per-request, tenant-scoped database. Returns the request's tenant
|
|
168
|
+
* transaction (so the `zveltio.current_tenant` GUC is set and FORCE-RLS rows
|
|
169
|
+
* are visible + isolated), wrapped in the same table-restriction guard as
|
|
170
|
+
* `ctx.db`. Pass the route's Hono context: `const db = ctx.reqDb(c)`.
|
|
171
|
+
*
|
|
172
|
+
* Always present on the context the engine hands to a loaded extension; typed
|
|
173
|
+
* optional only so partial/bootstrap contexts type-check. In a data handler
|
|
174
|
+
* use it directly — `ctx.reqDb(c)`.
|
|
175
|
+
*/
|
|
176
|
+
reqDb?: (c: any) => Kysely<DB>;
|
|
38
177
|
/** Better-Auth instance — use `ctx.auth.api.getSession({ headers })` in route handlers. */
|
|
39
178
|
auth: any;
|
|
40
179
|
/** Field type registry — register custom field types here. */
|
|
@@ -87,6 +226,31 @@ export interface ExtensionContext<DB = any> {
|
|
|
87
226
|
* `EntityAccessScope` for an example.
|
|
88
227
|
*/
|
|
89
228
|
entityAccess: EntityAccessScope;
|
|
229
|
+
/**
|
|
230
|
+
* Register a subsystem health check surfaced at `GET /api/health/deep` and
|
|
231
|
+
* `GET /api/health/<name>`. Use it to report the liveness of anything your
|
|
232
|
+
* extension owns (an external API, a worker, a provider):
|
|
233
|
+
*
|
|
234
|
+
* ctx.onHealthCheck('smtp', async () => {
|
|
235
|
+
* const ok = await pingSmtp();
|
|
236
|
+
* return { ok, detail: { host: SMTP_HOST } };
|
|
237
|
+
* });
|
|
238
|
+
*
|
|
239
|
+
* Checks are namespaced `ext:<yourExtension>:<name>` and cleared on reload.
|
|
240
|
+
* Mark `{ critical: true }` only if your extension being down should fail the
|
|
241
|
+
* engine's readiness probe (rarely — most extensions are optional).
|
|
242
|
+
*/
|
|
243
|
+
onHealthCheck?: (name: string, run: () => Promise<{
|
|
244
|
+
ok: boolean;
|
|
245
|
+
error?: string;
|
|
246
|
+
detail?: Record<string, unknown>;
|
|
247
|
+
}> | {
|
|
248
|
+
ok: boolean;
|
|
249
|
+
error?: string;
|
|
250
|
+
detail?: Record<string, unknown>;
|
|
251
|
+
}, opts?: {
|
|
252
|
+
critical?: boolean;
|
|
253
|
+
}) => void;
|
|
90
254
|
/**
|
|
91
255
|
* Register a route on the engine's GLOBAL app, outside the extension's
|
|
92
256
|
* `/ext/<name>/` namespace. Use sparingly — most routes should live on
|
|
@@ -115,46 +279,268 @@ export interface ExtensionContext<DB = any> {
|
|
|
115
279
|
* Engine-internal helpers. Stable across patch versions but may break across
|
|
116
280
|
* minor versions. First-party extensions only.
|
|
117
281
|
*/
|
|
118
|
-
internals: ExtensionInternals
|
|
282
|
+
internals: ExtensionInternals<DB>;
|
|
119
283
|
}
|
|
120
284
|
/**
|
|
121
285
|
* Engine-internal helpers passed via `ctx.internals.*`.
|
|
122
286
|
* Each field is the live engine singleton or function — extensions should never
|
|
123
287
|
* import these directly from `../../../packages/engine/src/...` paths.
|
|
124
288
|
*/
|
|
125
|
-
export interface ExtensionInternals {
|
|
289
|
+
export interface ExtensionInternals<DB = unknown> {
|
|
126
290
|
/** Type-safe insert into a dynamic (user-defined) collection table. */
|
|
127
291
|
dynamicInsert: (db: any, collection: string, values: Record<string, unknown>) => Promise<unknown>;
|
|
292
|
+
/**
|
|
293
|
+
* The three an extension needs to render a collection the way the engine's
|
|
294
|
+
* own data routes do: the access check, the column mask, and the filter
|
|
295
|
+
* compiler. `content/pages` renders arbitrary collections for a portal
|
|
296
|
+
* audience and has to apply exactly the rules `/api/data` applies —
|
|
297
|
+
* reimplementing them would be a second, quietly diverging copy of the
|
|
298
|
+
* authorisation path.
|
|
299
|
+
*/
|
|
300
|
+
checkAccess: (db: Kysely<DB>, user: Pick<RequestUser, 'id' | 'scopes'> & {
|
|
301
|
+
role?: string;
|
|
302
|
+
}, collection: string, action: string) => Promise<boolean>;
|
|
303
|
+
applyColumnAccess: (record: Record<string, unknown>, access: {
|
|
304
|
+
hidden: Set<string>;
|
|
305
|
+
readOnly: Set<string>;
|
|
306
|
+
}) => Record<string, unknown>;
|
|
307
|
+
/**
|
|
308
|
+
* Compile one filter into a SQL condition, over the operators in `FilterOp`.
|
|
309
|
+
*/
|
|
310
|
+
buildCondition: (key: string, condition: {
|
|
311
|
+
op: FilterOp;
|
|
312
|
+
value?: unknown;
|
|
313
|
+
}) => RawBuilder<boolean>;
|
|
128
314
|
/** Introspect a Postgres schema — returns tables, columns, types, indexes, FKs. */
|
|
129
315
|
introspectSchema: (db: any, schemaName?: string, excludePatterns?: string[], dryRun?: boolean) => Promise<any[]>;
|
|
130
|
-
/** Run a data-quality scan over a collection. */
|
|
131
|
-
runQualityScan: (...args: any[]) => Promise<unknown>;
|
|
132
316
|
/** Invalidate the cached validation rules for a collection. */
|
|
133
317
|
invalidateRulesCache: (collection: string) => void;
|
|
318
|
+
/**
|
|
319
|
+
* Evaluate a user-authored validation expression, safely.
|
|
320
|
+
*
|
|
321
|
+
* `refused` is distinct from `failed` on purpose: an expression the engine
|
|
322
|
+
* declines to run has not passed and has not failed, and a rule editor that
|
|
323
|
+
* reports either would be lying to whoever is writing the rule.
|
|
324
|
+
*
|
|
325
|
+
* Use this instead of `new Function` or `eval`. A Function body closes over
|
|
326
|
+
* the global scope, so an expression stored by any tenant admin could reach
|
|
327
|
+
* `process` and `Bun` from inside the engine process.
|
|
328
|
+
*/
|
|
329
|
+
evaluateExpressionRule: (expression: string, value: unknown) => {
|
|
330
|
+
status: 'passed';
|
|
331
|
+
} | {
|
|
332
|
+
status: 'failed';
|
|
333
|
+
} | {
|
|
334
|
+
status: 'refused';
|
|
335
|
+
reason: string;
|
|
336
|
+
};
|
|
337
|
+
/** Vet an expression before storing it. */
|
|
338
|
+
checkValidationExpression: (expression: string) => {
|
|
339
|
+
ok: true;
|
|
340
|
+
} | {
|
|
341
|
+
ok: false;
|
|
342
|
+
reason: string;
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Run a callback inside a tenant transaction, outside any request.
|
|
346
|
+
*
|
|
347
|
+
* `ctx.reqDb(c)` covers request handlers. Background work — scheduled tasks,
|
|
348
|
+
* queue workers, fire-and-forget jobs — has no `c` and so had nothing: it ran
|
|
349
|
+
* on the engine's global pool with no tenant context at all. `data/export`
|
|
350
|
+
* and `data/import` documented that in a comment and called the fix a
|
|
351
|
+
* follow-up.
|
|
352
|
+
*
|
|
353
|
+
* The tenant must come from wherever the work was ENQUEUED; a job has no
|
|
354
|
+
* caller to inherit one from. Inside the callback the handle behaves exactly
|
|
355
|
+
* like a request's: the tenant GUC is set and `SET LOCAL ROLE` applied, so
|
|
356
|
+
* the isolation policies bind.
|
|
357
|
+
*
|
|
358
|
+
* await ctx.internals.withTenantIsolation(tenantId, async (db) => {
|
|
359
|
+
* await db.selectFrom('zvd_things').selectAll().execute();
|
|
360
|
+
* });
|
|
361
|
+
*/
|
|
362
|
+
withTenantIsolation: <T>(tenantId: string, fn: (db: Kysely<DB>) => Promise<T>) => Promise<T>;
|
|
363
|
+
/**
|
|
364
|
+
* The instance's own read policies, so an extension can honour them.
|
|
365
|
+
*
|
|
366
|
+
* `ctx.db` gives an extension the TENANT boundary — the Postgres policies
|
|
367
|
+
* bind, and rows from another company are unreachable. It gives nothing for
|
|
368
|
+
* the two access rules an operator writes inside a tenant: the RLS rules at
|
|
369
|
+
* `/api/rls`, which hide rows from a user, and the column permissions that
|
|
370
|
+
* hide a field from a role. Those live in the engine and, until now, only the
|
|
371
|
+
* engine could read them.
|
|
372
|
+
*
|
|
373
|
+
* So an extension serving the same data as a core route enforced strictly
|
|
374
|
+
* less, and nothing said so. `data/export` is the worked example: the engine's
|
|
375
|
+
* `/api/export` gained both guards, its own copy kept `selectAll()` inside a
|
|
376
|
+
* tenant transaction, and the Studio calls the extension. The fix was
|
|
377
|
+
* impossible to write on that side — not overlooked, unavailable.
|
|
378
|
+
*
|
|
379
|
+
* Ungated, deliberately. Every other guarded member of this bag grants
|
|
380
|
+
* authority; these only ever remove rows and columns from a result. An
|
|
381
|
+
* extension that cannot call them does not become safer, it becomes the
|
|
382
|
+
* loophole.
|
|
383
|
+
*
|
|
384
|
+
* const cols = await ctx.internals.getColumnAccess(coll, role);
|
|
385
|
+
* const q = ctx.internals.applyRlsFilters(base, filters);
|
|
386
|
+
*/
|
|
387
|
+
/**
|
|
388
|
+
* Apply field encryption to a value the operator marked `encrypted: true`.
|
|
389
|
+
* No-op when `isEncrypted` is false, when the value is not a string, or when
|
|
390
|
+
* it is already encrypted.
|
|
391
|
+
*
|
|
392
|
+
* Not `encryptSecret`: that is gated behind the `secrets` capability, which
|
|
393
|
+
* also hands over `decryptSecret`. Writing a row correctly should not cost the
|
|
394
|
+
* power to read every stored secret — and that trade is why `data/import`
|
|
395
|
+
* stored marked columns in PLAINTEXT rather than declaring the capability.
|
|
396
|
+
*
|
|
397
|
+
* Throws when `FIELD_ENCRYPTION_KEY` is unset and the field is marked, which
|
|
398
|
+
* is the engine's posture on the same path: a column an operator marked
|
|
399
|
+
* sensitive is not silently downgraded.
|
|
400
|
+
*/
|
|
401
|
+
maybeEncrypt: (value: unknown, isEncrypted: boolean) => Promise<unknown>;
|
|
402
|
+
/**
|
|
403
|
+
* The other half. Without it an extension can write a secret it cannot read
|
|
404
|
+
* back, so it stores plaintext instead — which is how a signing secret ends
|
|
405
|
+
* up readable by anyone with database access.
|
|
406
|
+
*
|
|
407
|
+
* Passes through values that do not carry the `enc:v1:` prefix, so adopting
|
|
408
|
+
* encryption on an existing column is safe: rows written before keep working,
|
|
409
|
+
* rows written after are encrypted at rest.
|
|
410
|
+
*/
|
|
411
|
+
maybeDecrypt: (value: unknown, isEncrypted: boolean) => Promise<unknown>;
|
|
412
|
+
/**
|
|
413
|
+
* `role` is optional because the engine does not depend on it: the roles a
|
|
414
|
+
* policy matches come from `getUserRoles(user.id)`, and Better-Auth does not
|
|
415
|
+
* populate `role` on a session at all. The engine's own callers cast it in
|
|
416
|
+
* rather than having one. Demanding it here only made every extension invent
|
|
417
|
+
* a value the engine ignores.
|
|
418
|
+
*/
|
|
419
|
+
getRlsFilters: (collection: string, user: {
|
|
420
|
+
id: string;
|
|
421
|
+
email?: string;
|
|
422
|
+
role?: string;
|
|
423
|
+
rlsBypass?: boolean;
|
|
424
|
+
}, authType: 'session' | 'api_key') => Promise<RlsFilter[]>;
|
|
425
|
+
/** Apply what `getRlsFilters` returned to a query builder. */
|
|
426
|
+
applyRlsFilters: <Q>(query: Q, filters: RlsFilter[]) => Q;
|
|
427
|
+
/**
|
|
428
|
+
* Columns this role may not read, and may not write.
|
|
429
|
+
*
|
|
430
|
+
* No db parameter: the host resolves the handle. Column permissions are
|
|
431
|
+
* instance configuration rather than tenant rows, so letting each extension
|
|
432
|
+
* pick a handle would only be a way to get it wrong.
|
|
433
|
+
*/
|
|
434
|
+
getColumnAccess: (collection: string, role: string,
|
|
435
|
+
/**
|
|
436
|
+
* The acting user's id. Optional, and additive — omitting it means no
|
|
437
|
+
* exemption, which is the refusing direction, so an extension written
|
|
438
|
+
* against the two-argument form keeps working and keeps masking.
|
|
439
|
+
*
|
|
440
|
+
* Pass it to have the host resolve `data:view_all_columns` for that
|
|
441
|
+
* identity. That permission is how "god sees everything" is expressed for
|
|
442
|
+
* columns: `checkPermission` returns true for a god user before consulting
|
|
443
|
+
* any policy, and everything else is deny-by-default. Without the id there
|
|
444
|
+
* is no identity to resolve it for, so even a god is masked.
|
|
445
|
+
*/
|
|
446
|
+
userId?: string) => Promise<{
|
|
447
|
+
hidden: Set<string>;
|
|
448
|
+
readOnly: Set<string>;
|
|
449
|
+
}>;
|
|
450
|
+
/** The Casbin role behind a user — what `getColumnAccess` keys on. */
|
|
451
|
+
resolveUserRole: (user: {
|
|
452
|
+
id?: string;
|
|
453
|
+
role?: string;
|
|
454
|
+
}) => Promise<string>;
|
|
455
|
+
/** Is this user an administrator of the current tenant? */
|
|
456
|
+
/**
|
|
457
|
+
* The tenant to add as an explicit `tenant_id =` beside the RLS policy, or
|
|
458
|
+
* `null` when one must not be added.
|
|
459
|
+
*
|
|
460
|
+
* The policy reads `tenant_id = ANY (…)` over an array the planner does not
|
|
461
|
+
* see until execution, so it cannot drive an ordered index scan: a read that
|
|
462
|
+
* filters and orders walks `created_at` and discards whatever the policy
|
|
463
|
+
* excludes. Measured on 300 000 rows: 46 ms, every row discarded to return 25.
|
|
464
|
+
*
|
|
465
|
+
* Performance only — the policy still decides what may be seen, and an
|
|
466
|
+
* equality can only narrow what it already allows. `null` whenever the reach
|
|
467
|
+
* is wider than one tenant, so the safe shape is:
|
|
468
|
+
*
|
|
469
|
+
* const t = ctx.internals.getSingleTenantId();
|
|
470
|
+
* if (t) q = q.where('tenant_id', '=', t);
|
|
471
|
+
*/
|
|
472
|
+
getSingleTenantId: () => string | null;
|
|
473
|
+
/**
|
|
474
|
+
* Display names for a set of user ids, as `{ [id]: name }`. Ids with no row,
|
|
475
|
+
* or with a null name, are absent — render the id instead.
|
|
476
|
+
*
|
|
477
|
+
* Extensions cannot read the Better-Auth `user` table, and rendering "who
|
|
478
|
+
* asked for this" is a real need: `workflow/approvals` had been joining that
|
|
479
|
+
* table directly through a gap in the table guard. This hands over names and
|
|
480
|
+
* nothing else, so printing a name never requires a grant on a table that
|
|
481
|
+
* also holds emails and roles.
|
|
482
|
+
*/
|
|
483
|
+
getUserNames: (userIds: string[]) => Promise<Record<string, string>>;
|
|
484
|
+
isTenantAdmin: (userId: string) => Promise<boolean>;
|
|
485
|
+
/**
|
|
486
|
+
* Instance-level admin, as distinct from admin-within-a-tenant.
|
|
487
|
+
*
|
|
488
|
+
* `checkPermission(userId, 'admin', '*')` is TRUE for a delegated tenant
|
|
489
|
+
* owner inside their own domain — the `tenant_owner` policy is `('*','*','*')`
|
|
490
|
+
* there. That is the right answer for tenant-scoped screens and the wrong one
|
|
491
|
+
* for anything that reaches the instance: raw SQL, schema changes, role
|
|
492
|
+
* grants. Use this for those.
|
|
493
|
+
*/
|
|
494
|
+
requireInstanceAdmin: (userId: string) => Promise<boolean>;
|
|
134
495
|
/** Run an Edge Function in the sandbox (used by developer/edge-functions). */
|
|
135
496
|
runEdgeFunction: (...args: any[]) => Promise<unknown>;
|
|
136
497
|
/** Cross-extension hook registry (e.g. trash purge, scheduled cleanups). */
|
|
137
498
|
extensionRegistry: any;
|
|
138
499
|
/** Queue an HTML→PDF render via the worker pool. */
|
|
139
500
|
generatePDFAsync: (html: string, options?: Record<string, unknown>) => Promise<unknown>;
|
|
140
|
-
/** Synchronous template render with `{{var}}` interpolation. */
|
|
141
|
-
renderTemplate: (template: string, variables: Record<string, unknown>) => string;
|
|
142
|
-
/** Inline HTML→PDF render (blocking). */
|
|
143
|
-
generatePDF: (...args: any[]) => Promise<unknown>;
|
|
144
501
|
/** Move a file to the trash bucket (soft delete with TTL). */
|
|
145
502
|
moveToTrash: (...args: any[]) => Promise<unknown>;
|
|
146
|
-
/** Schedule async indexing for a newly uploaded file. */
|
|
147
|
-
scheduleFileIndexing: (...args: any[]) => Promise<unknown>;
|
|
148
|
-
/** GraphQL DataLoader registry — N+1 query batching. */
|
|
149
|
-
DataLoaderRegistry: any;
|
|
150
|
-
/** Validate GraphQL query depth. Returns an error message if too deep, null otherwise. */
|
|
151
|
-
checkQueryDepth: (query: string, maxDepth?: number) => string | null;
|
|
152
503
|
/** Enqueue an asynchronous DDL job (Ghost Tables, large alters). */
|
|
153
504
|
enqueueDDLJob: (...args: any[]) => Promise<unknown>;
|
|
154
|
-
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
505
|
+
/**
|
|
506
|
+
* Validate that a URL targets a public, non-internal address (SSRF safety).
|
|
507
|
+
* Synchronous — throws on a blocked URL and returns nothing. Safe to call from
|
|
508
|
+
* a sync context such as a zod `superRefine`. This checks only the literal
|
|
509
|
+
* host text; prefer {@link assertPublicUrl} wherever you can await.
|
|
510
|
+
*/
|
|
511
|
+
validatePublicUrl: (url: string) => void;
|
|
512
|
+
/**
|
|
513
|
+
* DNS-aware SSRF check: everything `validatePublicUrl` does, plus rejecting
|
|
514
|
+
* hostnames that RESOLVE into private space (an attacker-owned name with an A
|
|
515
|
+
* record pointing at cloud metadata). MUST be awaited.
|
|
516
|
+
*/
|
|
517
|
+
/**
|
|
518
|
+
* Resolves to the address to connect to, or null when there is nothing to pin
|
|
519
|
+
* (an IP literal, or a name that did not resolve). Ignoring the value keeps
|
|
520
|
+
* the previous behaviour; using it closes the DNS rebinding race, which is
|
|
521
|
+
* what the host's own `safeFetch` does.
|
|
522
|
+
*/
|
|
523
|
+
assertPublicUrl: (url: string) => Promise<string | null>;
|
|
524
|
+
/**
|
|
525
|
+
* `fetch` with the SSRF guard applied where it has to be.
|
|
526
|
+
*
|
|
527
|
+
* Validating a URL before calling `fetch` is not enough on its own: fetch
|
|
528
|
+
* follows redirects, so a public host answering 302 to 169.254.169.254
|
|
529
|
+
* walks past a check performed on the original URL. This re-validates
|
|
530
|
+
* every redirect target, under a hop limit. Prefer it over `fetch` for
|
|
531
|
+
* any URL a user or a stored record can influence.
|
|
532
|
+
*/
|
|
533
|
+
safeFetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
534
|
+
/**
|
|
535
|
+
* SSRF guard for an admin-configured endpoint that is ALLOWED to be
|
|
536
|
+
* self-hosted (local Ollama on `http://localhost:11434`, an internal
|
|
537
|
+
* Meilisearch, on-prem object storage). Permits private ranges but rejects
|
|
538
|
+
* cloud-metadata hosts such as 169.254.169.254. Use this — NOT
|
|
539
|
+
* `validatePublicUrl` / `assertPublicUrl` — for provider "base URL" settings,
|
|
540
|
+
* otherwise every self-hosted deployment breaks. Synchronous; throws when
|
|
541
|
+
* the URL is blocked.
|
|
542
|
+
*/
|
|
543
|
+
assertNonMetadataUrl: (url: string, label?: string) => void;
|
|
158
544
|
/** Send an in-app notification to a user (writes to zv_notifications system table). */
|
|
159
545
|
sendNotification: (db: any, input: {
|
|
160
546
|
user_id: string;
|
|
@@ -193,6 +579,20 @@ export interface ExtensionInternals {
|
|
|
193
579
|
* extensions should refuse the write rather than persist plaintext.
|
|
194
580
|
*/
|
|
195
581
|
encryptSecret: (plaintext: string) => Promise<string>;
|
|
582
|
+
/**
|
|
583
|
+
* HMAC-SHA256 under the instance auth secret, hex encoded. A compatibility
|
|
584
|
+
* surface for `auth/scim`'s stored bearer-token hashes — not a general MAC.
|
|
585
|
+
*/
|
|
586
|
+
deriveTokenHash: (raw: string) => Promise<string>;
|
|
587
|
+
/**
|
|
588
|
+
* Quoted, formula-safe CSV cell. Ungated: a pure string function with no
|
|
589
|
+
* authority. Every extension that exports CSV was writing its own escaping,
|
|
590
|
+
* and quoting alone does not stop a spreadsheet executing a cell that starts
|
|
591
|
+
* with `=`.
|
|
592
|
+
*/
|
|
593
|
+
csvCell: (value: unknown) => string;
|
|
594
|
+
/** Rows → CSV document, using `csvCell` for every cell. */
|
|
595
|
+
recordsToCsv: (records: Record<string, unknown>[]) => string;
|
|
196
596
|
/**
|
|
197
597
|
* Reverse of `encryptSecret`. Returns the plaintext if the value has
|
|
198
598
|
* the `enc:v1:` prefix; otherwise returns the value as-is so reads of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgBtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI,CAAC;IAChC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IACvB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,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kC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;qCACiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;kFAC8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;yEACqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAExC,OAAO,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAEzC,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;IAE7E,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,YAAY,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/extension/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export { permissionGate } from './permission-gate.js';
|
|
2
|
+
export { readMultipart, MULTIPART_REQUIRED } from './multipart.js';
|
|
3
|
+
export { toJsonb } from './jsonb.js';
|
|
4
|
+
export { isStorableNumeric, NumericConversionError, roundMoney, sumNumeric, toNumber, toNumberOrNull, toNumberSafe, } from './numeric.js';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binding a JavaScript value to a `jsonb` column.
|
|
3
|
+
*
|
|
4
|
+
* There is one correct form and three plausible wrong ones. All four were
|
|
5
|
+
* measured against this driver, on a real `jsonb` column:
|
|
6
|
+
*
|
|
7
|
+
* JSON.stringify(v) → a jsonb STRING. `jsonb_typeof` says
|
|
8
|
+
* `string`, `col->>'k'` is NULL and
|
|
9
|
+
* `col ? 'k'` is false.
|
|
10
|
+
*
|
|
11
|
+
* the raw value → correct for an object, WRONG for an
|
|
12
|
+
* array: the driver renders a JS array
|
|
13
|
+
* as a Postgres array literal, so
|
|
14
|
+
* `[{a:1}]` lands as the string
|
|
15
|
+
* `{"[object Object]"}`.
|
|
16
|
+
*
|
|
17
|
+
* JSON.stringify(v) + `::jsonb` → still a jsonb STRING. The obvious
|
|
18
|
+
* repair and a trap: the driver has
|
|
19
|
+
* already encoded the parameter as JSON,
|
|
20
|
+
* so the cast turns a jsonb string into
|
|
21
|
+
* a jsonb string.
|
|
22
|
+
*
|
|
23
|
+
* JSON.stringify(v) + `::text::jsonb` → correct, and correct for EVERY type —
|
|
24
|
+
* object, array, string, number, boolean
|
|
25
|
+
* and null. `::text` forces the parameter
|
|
26
|
+
* to be read as text first, and the
|
|
27
|
+
* second cast parses it.
|
|
28
|
+
*
|
|
29
|
+
* ── Why this lives in the SDK ─────────────────────────────────────
|
|
30
|
+
*
|
|
31
|
+
* Because it had already been written twice. The engine has `lib/jsonb.ts`, and
|
|
32
|
+
* `content/pages` wrote its own after the defect surfaced there in the way that
|
|
33
|
+
* hurts: a popup's `targets` were appended with `jsonb ||`, and the result was
|
|
34
|
+
* an ARRAY CONTAINING THE OLD TEXT, because the old value was text. Seventeen
|
|
35
|
+
* more extensions were writing the same shape with no helper at all.
|
|
36
|
+
*
|
|
37
|
+
* A third copy per extension would be the repository's own dominant bug shape —
|
|
38
|
+
* one rule, written out again somewhere else with a piece missing — so it goes
|
|
39
|
+
* where both sides already compile against: `@zveltio/sdk/extension`.
|
|
40
|
+
*
|
|
41
|
+
* ── Why the defect is invisible until it is not ───────────────────
|
|
42
|
+
*
|
|
43
|
+
* Every reader in both repositories carries `typeof x === 'string' ?
|
|
44
|
+
* JSON.parse(x) : x`, so a string-scalar column reads back correctly and the
|
|
45
|
+
* bug hides. It surfaces the moment SQL treats the column as structured — a
|
|
46
|
+
* `->>`, an index, a `||`, a `jsonb_array_elements`. Two of those have already
|
|
47
|
+
* happened: the `content/pages` popup above, and the engine's flow scheduler,
|
|
48
|
+
* which read `trigger_config.interval_seconds` off a string and therefore ran
|
|
49
|
+
* every cron flow at the default interval instead of its configured one.
|
|
50
|
+
*
|
|
51
|
+
* `scripts/check-jsonb-binding.ts` in the engine repository is the ratchet.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* A value ready to be assigned to a `jsonb` column.
|
|
55
|
+
*
|
|
56
|
+
* Works in `.values()`, in `.set()` and in a `doUpdateSet()` branch — all three
|
|
57
|
+
* are writers of the same column and all three have been wrong at some point.
|
|
58
|
+
*
|
|
59
|
+
* await db.insertInto('zv_forms').values({ fields: toJsonb(fields) }).execute();
|
|
60
|
+
*/
|
|
61
|
+
export declare function toJsonb(value: unknown): import("kysely").RawBuilder<unknown>;
|
|
62
|
+
//# sourceMappingURL=jsonb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonb.d.ts","sourceRoot":"","sources":["../../src/extension/jsonb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAIH;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,wCAErC"}
|