okmodel 0.1.0 → 0.2.1
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 +237 -19
- package/dist/adapters/capabilities.d.ts +34 -0
- package/dist/adapters/pg/bunsql-extra.d.ts +17 -0
- package/dist/adapters/pg/bunsql.d.ts +60 -0
- package/dist/adapters/pg/call.d.ts +2 -12
- package/dist/adapters/pg/nodepostgres-extra.d.ts +18 -0
- package/dist/adapters/pg/nodepostgres.d.ts +57 -0
- package/dist/adapters/pg/postgres-extra.d.ts +50 -1
- package/dist/adapters/pg/postgresjs.d.ts +0 -4
- package/dist/adapters/pg/session.d.ts +94 -0
- package/dist/adapters/pg/watch.d.ts +18 -0
- package/dist/contracts/catalog/object.d.ts +1 -0
- package/dist/contracts/catalog/types.d.ts +15 -8
- package/dist/contracts/connection.d.ts +13 -0
- package/dist/contracts/driver.d.ts +18 -5
- package/dist/contracts/error.d.ts +17 -1
- package/dist/contracts/generator.d.ts +63 -0
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/internal.js +11 -9
- package/dist/contracts/location.d.ts +24 -0
- package/dist/contracts/rows.d.ts +15 -0
- package/dist/dialects/pg/archive-bind.d.ts +22 -0
- package/dist/dialects/pg/column.d.ts +126 -9
- package/dist/dialects/pg/compile.d.ts +1 -0
- package/dist/dialects/pg/custom.d.ts +6 -0
- package/dist/dialects/pg/filter-parse.d.ts +19 -0
- package/dist/dialects/pg/filters.d.ts +19 -0
- package/dist/dialects/pg/index.d.ts +11 -2
- package/dist/dialects/pg/index.js +159 -1063
- package/dist/dialects/pg/keys.d.ts +19 -3
- package/dist/dialects/pg/model.d.ts +223 -2
- package/dist/dialects/pg/operator-fit.d.ts +86 -0
- package/dist/dialects/pg/operators.d.ts +39 -1
- package/dist/dialects/pg/ops/arr-append.d.ts +9 -0
- package/dist/dialects/pg/ops/arr-ns.d.ts +7 -0
- package/dist/dialects/pg/ops/arr-remove.d.ts +9 -0
- package/dist/dialects/pg/ops/containedBy.d.ts +9 -0
- package/dist/dialects/pg/ops/contains.d.ts +8 -4
- package/dist/dialects/pg/ops/hasAnyKey.d.ts +8 -0
- package/dist/dialects/pg/ops/hasKey.d.ts +8 -0
- package/dist/dialects/pg/ops/json-ns.d.ts +6 -0
- package/dist/dialects/pg/ops/json-set.d.ts +12 -0
- package/dist/dialects/pg/ops/matches.d.ts +16 -0
- package/dist/dialects/pg/ops/overlaps.d.ts +9 -0
- package/dist/dialects/pg/ops/path.d.ts +13 -0
- package/dist/dialects/pg/preset.d.ts +76 -0
- package/dist/dialects/pg/relations.d.ts +59 -2
- package/dist/dialects/pg/schema.d.ts +109 -5
- package/dist/dialects/pg/table.d.ts +130 -11
- package/dist/dialects/pg/temporal.d.ts +9 -7
- package/dist/dialects/pg/tenancy.d.ts +94 -0
- package/dist/dialects/pg/through.d.ts +21 -0
- package/dist/dialects/pg/trait.d.ts +141 -0
- package/dist/dialects/pg/where.d.ts +37 -0
- package/dist/runtime/aggregate.d.ts +25 -0
- package/dist/runtime/archive-handle.d.ts +18 -0
- package/dist/runtime/archive-rules.d.ts +12 -0
- package/dist/runtime/archive.d.ts +73 -0
- package/dist/runtime/batch.d.ts +20 -0
- package/dist/runtime/client.d.ts +114 -5
- package/dist/runtime/conflict.d.ts +2 -1
- package/dist/runtime/exposure.d.ts +27 -0
- package/dist/runtime/hookm.d.ts +39 -0
- package/dist/runtime/ids/index.d.ts +11 -0
- package/dist/runtime/ids/index.js +193 -0
- package/dist/runtime/ids/okid-extended.d.ts +19 -0
- package/dist/runtime/ids/okid-generator.d.ts +21 -0
- package/dist/runtime/ids/okid-shared.d.ts +89 -0
- package/dist/runtime/ids/okid.d.ts +24 -0
- package/dist/runtime/ids/uuid.d.ts +21 -0
- package/dist/runtime/lock.d.ts +22 -0
- package/dist/runtime/operator-sql.d.ts +8 -0
- package/dist/runtime/page.d.ts +25 -0
- package/dist/runtime/pg/bun.d.ts +30 -0
- package/dist/runtime/pg/bun.js +52 -0
- package/dist/runtime/pg/pg.d.ts +29 -0
- package/dist/runtime/pg/pg.js +52 -0
- package/dist/runtime/pg/pglite.js +16 -17
- package/dist/runtime/pg/postgresjs.js +14 -24
- package/dist/runtime/plan.d.ts +146 -7
- package/dist/runtime/preset-stack.d.ts +17 -0
- package/dist/runtime/presets.d.ts +48 -0
- package/dist/runtime/read-stream.d.ts +26 -0
- package/dist/runtime/safety/index.d.ts +159 -0
- package/dist/runtime/safety/index.js +294 -0
- package/dist/runtime/safety-hook.d.ts +42 -0
- package/dist/runtime/server-check.d.ts +34 -0
- package/dist/runtime/tenancy/index.d.ts +37 -0
- package/dist/runtime/tenancy/index.js +365 -0
- package/dist/runtime/trait-read.d.ts +30 -0
- package/dist/runtime/traits/index.d.ts +128 -0
- package/dist/runtime/traits/index.js +509 -0
- package/dist/runtime/transaction.d.ts +19 -0
- package/dist/runtime/tx.d.ts +22 -7
- package/dist/runtime/types.d.ts +390 -25
- package/dist/runtime/validate/bind.d.ts +11 -0
- package/dist/runtime/validate/closed.d.ts +16 -0
- package/dist/runtime/validate/engine.d.ts +41 -0
- package/dist/runtime/validate/hook.d.ts +17 -0
- package/dist/runtime/validate/index.d.ts +21 -0
- package/dist/runtime/validate/index.js +175 -0
- package/dist/runtime/validate/load.d.ts +13 -0
- package/dist/runtime/validate/places.d.ts +41 -0
- package/dist/runtime/validate/rules.d.ts +108 -0
- package/dist/runtime/validate/surface.d.ts +102 -0
- package/dist/runtime/write.d.ts +30 -5
- package/dist/shared/{fgqgsb5z.js → 0qkxbm1f.js} +2 -2
- package/dist/shared/0v1g424p.js +26 -0
- package/dist/shared/10tjenmd.js +210 -0
- package/dist/shared/{tb4ze1tr.js → 1dp5knt7.js} +95 -10
- package/dist/shared/38crxbgn.js +229 -0
- package/dist/shared/3a5ne750.js +158 -0
- package/dist/shared/4b9da9d7.js +138 -0
- package/dist/shared/4e4c6vq2.js +62 -0
- package/dist/shared/{ckb1p0a4.js → 4jzzghr6.js} +416 -83
- package/dist/shared/{ycwz42az.js → 52szzakm.js} +6 -26
- package/dist/shared/{kynx7vbm.js → 5z4q2zda.js} +604 -21
- package/dist/shared/672t5vym.js +12 -0
- package/dist/shared/7m88x3e9.js +45 -0
- package/dist/shared/7mht49yd.js +1091 -0
- package/dist/shared/{mtkwv8wx.js → 7p2wbz7f.js} +1 -1
- package/dist/shared/83eaefwr.js +10 -0
- package/dist/shared/96ps4g1z.js +32 -0
- package/dist/shared/97g2jnrw.js +76 -0
- package/dist/shared/{xy79j5hq.js → 9k6vetvf.js} +25 -36
- package/dist/shared/{w8samvk1.js → a1gdp7j9.js} +1 -1
- package/dist/shared/a5sxz52y.js +13 -0
- package/dist/shared/{dynq16vb.js → b066g80h.js} +8 -6
- package/dist/shared/cstgkzdx.js +154 -0
- package/dist/shared/{ax16zpvm.js → d04j53v8.js} +6 -5
- package/dist/shared/{y9m15dfv.js → d2whjz4k.js} +15 -9
- package/dist/shared/dd4f8mnx.js +307 -0
- package/dist/shared/e6wg00wd.js +164 -0
- package/dist/shared/e7a268fy.js +195 -0
- package/dist/shared/{vkm3q4x1.js → eaxwrgby.js} +4 -3
- package/dist/shared/{7ck0dtry.js → ecdzej21.js} +160 -81
- package/dist/shared/{px90pf9p.js → edwqqryd.js} +21 -16
- package/dist/shared/{g2v6gnc8.js → eqmtn1bj.js} +57 -5
- package/dist/shared/g1b5zzj9.js +75 -0
- package/dist/shared/g9f0zqce.js +376 -0
- package/dist/shared/ge03bfca.js +64 -0
- package/dist/shared/{79ggp945.js → jns2wx4t.js} +55 -12
- package/dist/shared/k3ted12y.js +33 -0
- package/dist/shared/k7dwkhvq.js +31 -0
- package/dist/shared/{hd293j9g.js → kyxb62mc.js} +14 -2
- package/dist/shared/m9tv7xn7.js +404 -0
- package/dist/shared/mrq77sgw.js +55 -0
- package/dist/shared/mxmcdsh5.js +450 -0
- package/dist/shared/n442h54c.js +14 -0
- package/dist/shared/n47rd821.js +442 -0
- package/dist/shared/n4jqhpqz.js +27 -0
- package/dist/shared/{mkjmqjv4.js → nfzc5z0w.js} +2 -104
- package/dist/shared/nsva2a6b.js +42 -0
- package/dist/shared/ps43134h.js +69 -0
- package/dist/shared/{8b04d28c.js → py3nh7jy.js} +2 -2
- package/dist/shared/qa5dsc7z.js +86 -0
- package/dist/shared/{g5fhqmwe.js → qxa0yb9j.js} +6 -4
- package/dist/shared/r6nwkxnt.js +86 -0
- package/dist/shared/{4j72449d.js → rtnaqre0.js} +3 -3
- package/dist/shared/rwmrejjz.js +26 -0
- package/dist/shared/{zhc5vmgf.js → s6gqfn5j.js} +2 -2
- package/dist/shared/sacqha1y.js +70 -0
- package/dist/shared/{qk3hxfja.js → sfh4pk75.js} +5 -5
- package/dist/shared/{j5cn2963.js → t4tbsy9h.js} +13 -64
- package/dist/shared/{ngk8gj61.js → tbszx8mz.js} +15 -1
- package/dist/shared/v18jva5b.js +90 -0
- package/dist/shared/x9v1qgeb.js +201 -0
- package/dist/shared/xatfg0gn.js +193 -0
- package/dist/shared/xkz8g6by.js +225 -0
- package/dist/shared/{f5thc1s0.js → xrfnq5k8.js} +237 -418
- package/dist/shared/ytg3xf9p.js +149 -0
- package/dist/shared/yw5c610b.js +48 -0
- package/dist/shared/zd93g3rq.js +31 -0
- package/dist/shared/zt8y0wzb.js +132 -0
- package/dist/shared/{p0cbr3g2.js → zwmqxb0g.js} +1 -1
- package/dist/tooling/cli.js +14 -10
- package/dist/tooling/migrate/commands.d.ts +10 -0
- package/dist/tooling/migrate/engine.d.ts +36 -0
- package/package.json +56 -4
- package/dist/shared/gk7cs7sp.js +0 -566
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns an allowlisted request object into `where` and `orderBy`.
|
|
3
|
+
*
|
|
4
|
+
* Loaded the first time `parse()` is called. `filters()` validates the spec
|
|
5
|
+
* before this module exists.
|
|
6
|
+
*/
|
|
7
|
+
import type { ParsedFilters } from "./table.js";
|
|
8
|
+
/**
|
|
9
|
+
* Reads one request object.
|
|
10
|
+
*
|
|
11
|
+
* A plain value is equality when `eq` is allowlisted. `sort` is a field name
|
|
12
|
+
* from the sort list. JSON cannot add an operator.
|
|
13
|
+
*
|
|
14
|
+
* @param allow - Fields and the operators each one accepts
|
|
15
|
+
* @param sort - Fields a caller may sort by
|
|
16
|
+
* @param query - One request object
|
|
17
|
+
* @returns Filters a caller can spread into `find`
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseQuery(allow: Readonly<Record<string, readonly string[]>>, sort: readonly string[], query: unknown): ParsedFilters;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowlisted filters. The checks run when `filters()` is called.
|
|
3
|
+
*
|
|
4
|
+
* A hidden field in `allow`, `sort`, or `relations` is OKM1123. The parser
|
|
5
|
+
* loads on the first `parse()`.
|
|
6
|
+
*/
|
|
7
|
+
import type { FilterSpec, ParsedFilters } from "./table.js";
|
|
8
|
+
/**
|
|
9
|
+
* Checks an allowlist and returns `parse`.
|
|
10
|
+
*
|
|
11
|
+
* @param table - Table the filters belong to
|
|
12
|
+
* @param relations - Relation calls stored on the table, when it has any
|
|
13
|
+
* @param spec - Allow, sort, and relation fields
|
|
14
|
+
* @param hiddenFields - `table.field` keys recorded while tables were defined
|
|
15
|
+
* @returns A parser for one request object
|
|
16
|
+
*/
|
|
17
|
+
export declare function openFilters(table: string, relations: unknown, spec: FilterSpec, hiddenFields: ReadonlySet<string>): {
|
|
18
|
+
parse(query: unknown): Promise<ParsedFilters>;
|
|
19
|
+
};
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { schema, type BuiltSchema, type SchemaCodecs, type SchemaInput, type SchemaRequires, } from "./schema.js";
|
|
8
8
|
export { index, sql, table, type AnyTable, type ColumnHandle, type IndexCall, type SqlText, type SqlValue, type Table, type TableOptions, } from "./table.js";
|
|
9
|
+
export type { PresetQuery } from "./preset.js";
|
|
9
10
|
export { custom } from "./custom.js";
|
|
10
11
|
export { ColumnBuilder } from "./column.js";
|
|
11
12
|
export type { ArrayOf, ColumnFlags, ColumnInsert, ColumnInsertOf, ColumnRow, ColumnRowOf, ColumnUpdate, ColumnUpdateOf, FlagTrue, IdFlags, IdentityFlags, PlainFlags, ReferenceModifier, ReferenceOptions, SqlForm, ValidateModifier, WithGenerated, } from "./column.js";
|
|
12
13
|
export { bigint, identity, integer, smallint, type BigintAs, type BigintValue } from "./integer.js";
|
|
13
14
|
export { double, numeric, real, type NumericAs, type NumericValue } from "./decimal.js";
|
|
14
15
|
export { boolean, bytea } from "./bool.js";
|
|
15
|
-
export {
|
|
16
|
+
export { jsonb, jsonReplacer } from "./json.js";
|
|
16
17
|
export { id, uuid } from "./keys.js";
|
|
17
18
|
export { char, citext, text, varchar } from "./text.js";
|
|
18
19
|
export { date, interval, time, timestamp, timestamptz, timetz } from "./time.js";
|
|
@@ -23,7 +24,10 @@ export { line, point, type Line, type Point } from "./geometry.js";
|
|
|
23
24
|
export { ltree, tsvector } from "./search.js";
|
|
24
25
|
export { domain, enumColumn as enum } from "./enum.js";
|
|
25
26
|
export { t } from "./namespace.js";
|
|
27
|
+
export * as arr from "./ops/arr-ns.js";
|
|
28
|
+
export * as json from "./ops/json-ns.js";
|
|
26
29
|
export { between } from "./ops/between.js";
|
|
30
|
+
export { containedBy } from "./ops/containedBy.js";
|
|
27
31
|
export { contains } from "./ops/contains.js";
|
|
28
32
|
export { endsWith } from "./ops/endsWith.js";
|
|
29
33
|
export { eq } from "./ops/eq.js";
|
|
@@ -32,14 +36,19 @@ export { gt } from "./ops/gt.js";
|
|
|
32
36
|
export { inc } from "./ops/inc.js";
|
|
33
37
|
export { gte } from "./ops/gte.js";
|
|
34
38
|
export { has } from "./ops/has.js";
|
|
39
|
+
export { hasAnyKey } from "./ops/hasAnyKey.js";
|
|
40
|
+
export { hasKey } from "./ops/hasKey.js";
|
|
35
41
|
export { ilike } from "./ops/ilike.js";
|
|
36
42
|
export { inList } from "./ops/inList.js";
|
|
37
43
|
export { like } from "./ops/like.js";
|
|
44
|
+
export { matches } from "./ops/matches.js";
|
|
38
45
|
export { lt } from "./ops/lt.js";
|
|
39
46
|
export { lte } from "./ops/lte.js";
|
|
40
47
|
export { none } from "./ops/none.js";
|
|
41
48
|
export { not } from "./ops/not.js";
|
|
42
49
|
export { notIn } from "./ops/notIn.js";
|
|
43
50
|
export { or } from "./ops/or.js";
|
|
51
|
+
export { overlaps } from "./ops/overlaps.js";
|
|
52
|
+
export { path } from "./ops/path.js";
|
|
44
53
|
export { startsWith } from "./ops/startsWith.js";
|
|
45
|
-
export { many, one, type ManyRelation, type OneRelation, type RelationCall } from "./relations.js";
|
|
54
|
+
export { many, manyThrough, one, type ManyRelation, type ManyThroughRelation, type OneRelation, type RelationCall, } from "./relations.js";
|