@zenstackhq/language 3.0.0-alpha.3 → 3.0.0-alpha.6
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/ast.cjs +12 -2
- package/dist/ast.cjs.map +1 -1
- package/dist/ast.d.cts +63 -62
- package/dist/ast.d.ts +63 -62
- package/dist/ast.js +2 -2
- package/dist/ast.js.map +1 -1
- package/dist/index.cjs +79 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -24
- package/dist/index.js.map +1 -1
- package/package.json +6 -9
- package/res/stdlib.zmodel +11 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenstackhq/language",
|
|
3
3
|
"description": "ZenStack ZModel language specification",
|
|
4
|
-
"version": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ZenStack Team",
|
|
7
7
|
"files": [
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"langium": "
|
|
39
|
+
"langium": "3.5.0",
|
|
40
40
|
"pluralize": "^8.0.0",
|
|
41
|
-
"ts-pattern": "^5.
|
|
41
|
+
"ts-pattern": "^5.7.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^20.0.0",
|
|
45
44
|
"@types/pluralize": "^0.0.33",
|
|
46
|
-
"langium-cli": "
|
|
47
|
-
"
|
|
45
|
+
"langium-cli": "3.5.0",
|
|
46
|
+
"@zenstackhq/eslint-config": "3.0.0-alpha.6",
|
|
47
|
+
"@zenstackhq/typescript-config": "3.0.0-alpha.6"
|
|
48
48
|
},
|
|
49
49
|
"volta": {
|
|
50
50
|
"node": "18.19.1",
|
|
@@ -52,9 +52,6 @@
|
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "pnpm langium:generate && tsup-node",
|
|
55
|
-
"watch": "run-p watch:*",
|
|
56
|
-
"watch:ts": "tsup-node --watch",
|
|
57
|
-
"watch:langium": "langium generate --watch",
|
|
58
55
|
"lint": "eslint src --ext ts",
|
|
59
56
|
"langium:generate": "langium generate",
|
|
60
57
|
"langium:generate:production": "langium generate --mode=production",
|
package/res/stdlib.zmodel
CHANGED
|
@@ -25,7 +25,7 @@ enum ReferentialAction {
|
|
|
25
25
|
* Used with "onUpdate": when updating the identifier of a referenced object, the scalar fields of the referencing objects will be set to NULL.
|
|
26
26
|
*/
|
|
27
27
|
SetNull
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
/**
|
|
30
30
|
* Used with "onDelete": the scalar field of the referencing object will be set to the fields default value.
|
|
31
31
|
* Used with "onUpdate": the scalar field of the referencing object will be set to the fields default value.
|
|
@@ -104,7 +104,7 @@ function ulid(): String {
|
|
|
104
104
|
} @@@expressionContext([DefaultValue])
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Creates a sequence of integers in the underlying database and assign the incremented
|
|
107
|
+
* Creates a sequence of integers in the underlying database and assign the incremented
|
|
108
108
|
* values to the ID values of the created records based on the sequence.
|
|
109
109
|
*/
|
|
110
110
|
function autoincrement(): Int {
|
|
@@ -174,9 +174,9 @@ function isEmpty(field: Any[]): Boolean {
|
|
|
174
174
|
/**
|
|
175
175
|
* The name of the model for which the policy rule is defined. If the rule is
|
|
176
176
|
* inherited to a sub model, this function returns the name of the sub model.
|
|
177
|
-
*
|
|
177
|
+
*
|
|
178
178
|
* @param optional parameter to control the casing of the returned value. Valid
|
|
179
|
-
* values are "original", "upper", "lower", "capitalize", "uncapitalize". Defaults
|
|
179
|
+
* values are "original", "upper", "lower", "capitalize", "uncapitalize". Defaults
|
|
180
180
|
* to "original".
|
|
181
181
|
*/
|
|
182
182
|
function currentModel(casing: String?): String {
|
|
@@ -186,7 +186,7 @@ function currentModel(casing: String?): String {
|
|
|
186
186
|
* The operation for which the policy rule is defined for. Note that a rule with
|
|
187
187
|
* "all" operation is expanded to "create", "read", "update", and "delete" rules,
|
|
188
188
|
* and the function returns corresponding value for each expanded version.
|
|
189
|
-
*
|
|
189
|
+
*
|
|
190
190
|
* @param optional parameter to control the casing of the returned value. Valid
|
|
191
191
|
* values are "original", "upper", "lower", "capitalize", "uncapitalize". Defaults
|
|
192
192
|
* to "original".
|
|
@@ -523,13 +523,13 @@ attribute @@schema(_ name: String) @@@prisma
|
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
525
|
* Indicates that the field is a password field and needs to be hashed before persistence.
|
|
526
|
-
*
|
|
526
|
+
*
|
|
527
527
|
* ZenStack uses `bcryptjs` library to hash password. You can use the `saltLength` parameter
|
|
528
528
|
* to configure the cost of hashing, or use `salt` parameter to provide an explicit salt.
|
|
529
529
|
* By default, salt length of 12 is used.
|
|
530
530
|
*
|
|
531
531
|
* @see https://www.npmjs.com/package/bcryptjs for details
|
|
532
|
-
*
|
|
532
|
+
*
|
|
533
533
|
* @param saltLength: length of salt to use (cost factor for the hash function)
|
|
534
534
|
* @param salt: salt to use (a pregenerated valid salt)
|
|
535
535
|
*/
|
|
@@ -538,8 +538,8 @@ attribute @password(saltLength: Int?, salt: String?) @@@targetField([StringField
|
|
|
538
538
|
|
|
539
539
|
/**
|
|
540
540
|
* Indicates that the field is encrypted when storing in the DB and should be decrypted when read
|
|
541
|
-
*
|
|
542
|
-
* ZenStack uses the Web Crypto API to encrypt and decrypt the field.
|
|
541
|
+
*
|
|
542
|
+
* ZenStack uses the Web Crypto API to encrypt and decrypt the field.
|
|
543
543
|
*/
|
|
544
544
|
attribute @encrypted() @@@targetField([StringField])
|
|
545
545
|
|
|
@@ -665,9 +665,9 @@ function url(field: String): Boolean {
|
|
|
665
665
|
|
|
666
666
|
/**
|
|
667
667
|
* Checks if the current user can perform the given operation on the given field.
|
|
668
|
-
*
|
|
668
|
+
*
|
|
669
669
|
* @param field: The field to check access for
|
|
670
|
-
* @param operation: The operation to check access for. Can be "read", "create", "update", or "delete". If the operation is not provided,
|
|
670
|
+
* @param operation: The operation to check access for. Can be "read", "create", "update", or "delete". If the operation is not provided,
|
|
671
671
|
* it defaults the operation of the containing policy rule.
|
|
672
672
|
*/
|
|
673
673
|
function check(field: Any, operation: String?): Boolean {
|