@contember/schema 2.1.0-alpha.9 → 2.1.0-beta.2
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/CLAUDE.md +25 -0
- package/dist/development/src/ProjectRole.cjs.map +1 -1
- package/dist/development/src/ProjectRole.js.map +1 -1
- package/dist/development/src/schema/acl.cjs.map +1 -1
- package/dist/development/src/schema/acl.js.map +1 -1
- package/dist/development/src/schema/input.cjs.map +1 -1
- package/dist/development/src/schema/input.js.map +1 -1
- package/dist/development/src/schema/model.cjs.map +1 -1
- package/dist/development/src/schema/model.js.map +1 -1
- package/dist/development/src/schema/result.cjs.map +1 -1
- package/dist/development/src/schema/result.js.map +1 -1
- package/dist/development/src/schema/validation.cjs.map +1 -1
- package/dist/development/src/schema/validation.js.map +1 -1
- package/dist/production/src/ProjectRole.cjs.map +1 -1
- package/dist/production/src/ProjectRole.js.map +1 -1
- package/dist/production/src/schema/acl.cjs.map +1 -1
- package/dist/production/src/schema/acl.js.map +1 -1
- package/dist/production/src/schema/input.cjs.map +1 -1
- package/dist/production/src/schema/input.js.map +1 -1
- package/dist/production/src/schema/model.cjs.map +1 -1
- package/dist/production/src/schema/model.js.map +1 -1
- package/dist/production/src/schema/result.cjs.map +1 -1
- package/dist/production/src/schema/result.js.map +1 -1
- package/dist/production/src/schema/validation.cjs.map +1 -1
- package/dist/production/src/schema/validation.js.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schema/acl.d.ts +3 -3
- package/dist/types/schema/acl.d.ts.map +1 -1
- package/dist/types/schema/actions.d.ts +1 -0
- package/dist/types/schema/actions.d.ts.map +1 -1
- package/dist/types/schema/actionsPayload.d.ts +13 -0
- package/dist/types/schema/actionsPayload.d.ts.map +1 -1
- package/dist/types/schema/input.d.ts +1 -1
- package/dist/types/schema/input.d.ts.map +1 -1
- package/dist/types/schema/model.d.ts +5 -2
- package/dist/types/schema/model.d.ts.map +1 -1
- package/dist/types/schema/settings.d.ts +4 -0
- package/dist/types/schema/settings.d.ts.map +1 -1
- package/dist/types/schema/validation.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -2
- package/src/index.ts +1 -1
- package/src/schema/acl.ts +10 -12
- package/src/schema/actions.ts +2 -2
- package/src/schema/actionsPayload.ts +14 -1
- package/src/schema/input.ts +20 -18
- package/src/schema/model.ts +93 -10
- package/src/schema/settings.ts +5 -0
- package/src/schema/validation.ts +2 -2
package/src/schema/model.ts
CHANGED
|
@@ -2,13 +2,12 @@ import { Input } from './input'
|
|
|
2
2
|
import { JSONValue } from './json'
|
|
3
3
|
|
|
4
4
|
export namespace Model {
|
|
5
|
-
|
|
6
|
-
export type Entity = {
|
|
5
|
+
export type Entity<Fields extends string = string> = {
|
|
7
6
|
readonly name: string
|
|
8
7
|
readonly primary: string
|
|
9
8
|
readonly primaryColumn: string
|
|
10
9
|
readonly tableName: string
|
|
11
|
-
readonly fields: { readonly [name
|
|
10
|
+
readonly fields: { readonly [name in Fields]: AnyField }
|
|
12
11
|
readonly unique: Uniques
|
|
13
12
|
readonly indexes: Indexes
|
|
14
13
|
readonly view?: View
|
|
@@ -53,7 +52,7 @@ export namespace Model {
|
|
|
53
52
|
readonly columnName: string
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
export type ColumnTypeDefinition<T extends ColumnType = ColumnType>
|
|
55
|
+
export type ColumnTypeDefinition<T extends ColumnType = ColumnType> =
|
|
57
56
|
& Field<T>
|
|
58
57
|
& {
|
|
59
58
|
readonly columnType: string
|
|
@@ -70,13 +69,95 @@ export namespace Model {
|
|
|
70
69
|
|
|
71
70
|
export type Collation =
|
|
72
71
|
// generic
|
|
73
|
-
| 'und-x-icu'
|
|
72
|
+
| 'und-x-icu'
|
|
73
|
+
| 'C'
|
|
74
|
+
| 'ucs_basic'
|
|
75
|
+
| 'unicode'
|
|
76
|
+
| 'POSIX'
|
|
77
|
+
| 'default'
|
|
74
78
|
// some languages
|
|
75
|
-
| 'cs-x-icu'
|
|
79
|
+
| 'cs-x-icu'
|
|
80
|
+
| 'sk-x-icu'
|
|
81
|
+
| 'da-x-icu'
|
|
82
|
+
| 'de-x-icu'
|
|
83
|
+
| 'en-x-icu'
|
|
84
|
+
| 'es-x-icu'
|
|
85
|
+
| 'fr-x-icu'
|
|
86
|
+
| 'it-x-icu'
|
|
87
|
+
| 'ja-x-icu'
|
|
88
|
+
| 'ko-x-icu'
|
|
89
|
+
| 'nl-x-icu'
|
|
90
|
+
| 'pl-x-icu'
|
|
91
|
+
| 'pt-x-icu'
|
|
92
|
+
| 'ru-x-icu'
|
|
93
|
+
| 'sv-x-icu'
|
|
94
|
+
| 'tr-x-icu'
|
|
95
|
+
| 'zh-x-icu'
|
|
96
|
+
| 'hu-x-icu'
|
|
97
|
+
| 'fi-x-icu'
|
|
98
|
+
| 'el-x-icu'
|
|
99
|
+
| 'bg-x-icu'
|
|
100
|
+
| 'hr-x-icu'
|
|
101
|
+
| 'ro-x-icu'
|
|
102
|
+
| 'sl-x-icu'
|
|
103
|
+
| 'sr-x-icu'
|
|
104
|
+
| 'uk-x-icu'
|
|
105
|
+
| 'vi-x-icu'
|
|
106
|
+
| 'th-x-icu'
|
|
107
|
+
| 'ar-x-icu'
|
|
108
|
+
| 'he-x-icu'
|
|
109
|
+
| 'hi-x-icu'
|
|
110
|
+
| 'id-x-icu'
|
|
111
|
+
| 'ms-x-icu'
|
|
112
|
+
| 'fil-x-icu'
|
|
113
|
+
| 'sw-x-icu'
|
|
114
|
+
| 'ta-x-icu'
|
|
115
|
+
| 'te-x-icu'
|
|
116
|
+
| 'ml-x-icu'
|
|
117
|
+
| 'bn-x-icu'
|
|
118
|
+
| 'gu-x-icu'
|
|
119
|
+
| 'kn-x-icu'
|
|
120
|
+
| 'mr-x-icu'
|
|
121
|
+
| 'pa-x-icu'
|
|
122
|
+
| 'ur-x-icu'
|
|
123
|
+
| 'or-x-icu'
|
|
124
|
+
| 'si-x-icu'
|
|
125
|
+
| 'th-x-icu'
|
|
126
|
+
| 'lo-x-icu'
|
|
127
|
+
| 'my-x-icu'
|
|
128
|
+
| 'ka-x-icu'
|
|
129
|
+
| 'am-x-icu'
|
|
130
|
+
| 'ti-x-icu'
|
|
131
|
+
| 'ne-x-icu'
|
|
132
|
+
| 'dz-x-icu'
|
|
133
|
+
| 'kok-x-icu'
|
|
134
|
+
| 'syr-x-icu'
|
|
135
|
+
| 'sd-x-icu'
|
|
136
|
+
| 'bo-x-icu'
|
|
137
|
+
| 'km-x-icu'
|
|
138
|
+
| 'mn-x-icu'
|
|
139
|
+
| 'lo-x-icu'
|
|
140
|
+
| 'gl-x-icu'
|
|
141
|
+
| 'eu-x-icu'
|
|
142
|
+
| 'ca-x-icu'
|
|
143
|
+
| 'af-x-icu'
|
|
144
|
+
| 'is-x-icu'
|
|
145
|
+
| 'mk-x-icu'
|
|
146
|
+
| 'sq-x-icu'
|
|
147
|
+
| 'hy-x-icu'
|
|
148
|
+
| 'mt-x-icu'
|
|
149
|
+
| 'cy-x-icu'
|
|
150
|
+
| 'et-x-icu'
|
|
151
|
+
| 'lv-x-icu'
|
|
152
|
+
| 'lt-x-icu'
|
|
153
|
+
| 'tg-x-icu'
|
|
154
|
+
| 'fa-x-icu'
|
|
155
|
+
| 'ps-x-icu'
|
|
156
|
+
| 'ks-x-icu'
|
|
157
|
+
| 'sd-x'
|
|
76
158
|
// fallback
|
|
77
159
|
| string & {}
|
|
78
160
|
|
|
79
|
-
|
|
80
161
|
export enum RelationType {
|
|
81
162
|
OneHasOne = 'OneHasOne',
|
|
82
163
|
OneHasMany = 'OneHasMany',
|
|
@@ -99,7 +180,7 @@ export namespace Model {
|
|
|
99
180
|
|
|
100
181
|
export type AnyRelation = AnyInverseRelation | AnyOwningRelation
|
|
101
182
|
|
|
102
|
-
export type Relation<T extends RelationType = RelationType
|
|
183
|
+
export type Relation<T extends RelationType = RelationType> =
|
|
103
184
|
& Field<T>
|
|
104
185
|
& {
|
|
105
186
|
readonly name: string
|
|
@@ -230,16 +311,19 @@ export namespace Model {
|
|
|
230
311
|
readonly fields: readonly string[]
|
|
231
312
|
readonly index: true
|
|
232
313
|
readonly nulls?: NullsDistinctBehaviour // empty means distinct
|
|
314
|
+
readonly method?: IndexMethod
|
|
233
315
|
}
|
|
234
316
|
|
|
235
317
|
export type Indexes = readonly Index[]
|
|
236
318
|
|
|
319
|
+
export type IndexMethod = 'btree' | 'gin' | 'gist' | 'hash' | 'brin' | 'spgist'
|
|
320
|
+
|
|
237
321
|
export type Index = {
|
|
238
322
|
readonly fields: readonly string[]
|
|
239
323
|
readonly name?: string
|
|
324
|
+
readonly method?: IndexMethod
|
|
240
325
|
}
|
|
241
326
|
|
|
242
|
-
|
|
243
327
|
export interface ColumnContext {
|
|
244
328
|
entity: Model.Entity
|
|
245
329
|
column: Model.AnyColumn
|
|
@@ -311,7 +395,6 @@ export namespace Model {
|
|
|
311
395
|
targetRelation: Model.OneHasOneInverseRelation | null
|
|
312
396
|
}
|
|
313
397
|
|
|
314
|
-
|
|
315
398
|
export interface ColumnVisitor<T> {
|
|
316
399
|
visitColumn(context: ColumnContext): T
|
|
317
400
|
}
|
package/src/schema/settings.ts
CHANGED
|
@@ -10,9 +10,14 @@ export namespace Settings {
|
|
|
10
10
|
readonly uuidVersion?: 4 | 7
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export type ActionsSettings = {
|
|
14
|
+
readonly returnTriggeredActions?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
export type Schema = {
|
|
14
18
|
readonly tenant?: TenantSettings
|
|
15
19
|
readonly content?: ContentSettings
|
|
20
|
+
readonly actions?: ActionsSettings
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* @deprecated
|
package/src/schema/validation.ts
CHANGED
|
@@ -31,8 +31,8 @@ export namespace Validation {
|
|
|
31
31
|
readonly range: readonly [LiteralArgument<number | null>, LiteralArgument<number | null>]
|
|
32
32
|
readonly equals: readonly [LiteralArgument<JSONValue>]
|
|
33
33
|
readonly not: readonly [ValidatorArgument]
|
|
34
|
-
readonly empty: readonly[]
|
|
35
|
-
readonly defined: readonly[]
|
|
34
|
+
readonly empty: readonly []
|
|
35
|
+
readonly defined: readonly []
|
|
36
36
|
readonly inContext: readonly [PathArgument, ValidatorArgument]
|
|
37
37
|
readonly every: readonly [ValidatorArgument]
|
|
38
38
|
readonly any: readonly [ValidatorArgument]
|