@zenstackhq/sdk 0.6.0-pre.1 → 0.6.0-pre.12
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/constants.d.ts +12 -0
- package/constants.js +16 -0
- package/constants.js.map +1 -0
- package/index.d.ts +3 -12
- package/index.js +17 -9
- package/index.js.map +1 -1
- package/package.json +8 -5
- package/types.d.ts +22 -0
- package/types.js +13 -0
- package/types.js.map +1 -0
- package/utils.js +1 -0
- package/utils.js.map +1 -1
package/constants.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auxiliary database field for supporting policy check for nested writes
|
|
3
|
+
*/
|
|
4
|
+
export declare const TRANSACTION_FIELD_NAME = "zenstack_transaction";
|
|
5
|
+
/**
|
|
6
|
+
* Auxiliary database field for building up policy check queries
|
|
7
|
+
*/
|
|
8
|
+
export declare const GUARD_FIELD_NAME = "zenstack_guard";
|
|
9
|
+
/**
|
|
10
|
+
* All Auxiliary fields.
|
|
11
|
+
*/
|
|
12
|
+
export declare const AUXILIARY_FIELDS: string[];
|
package/constants.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUXILIARY_FIELDS = exports.GUARD_FIELD_NAME = exports.TRANSACTION_FIELD_NAME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Auxiliary database field for supporting policy check for nested writes
|
|
6
|
+
*/
|
|
7
|
+
exports.TRANSACTION_FIELD_NAME = 'zenstack_transaction';
|
|
8
|
+
/**
|
|
9
|
+
* Auxiliary database field for building up policy check queries
|
|
10
|
+
*/
|
|
11
|
+
exports.GUARD_FIELD_NAME = 'zenstack_guard';
|
|
12
|
+
/**
|
|
13
|
+
* All Auxiliary fields.
|
|
14
|
+
*/
|
|
15
|
+
exports.AUXILIARY_FIELDS = [exports.TRANSACTION_FIELD_NAME, exports.GUARD_FIELD_NAME];
|
|
16
|
+
//# sourceMappingURL=constants.js.map
|
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D;;GAEG;AACU,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AAEjD;;GAEG;AACU,QAAA,gBAAgB,GAAG,CAAC,8BAAsB,EAAE,wBAAgB,CAAC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export type PluginOptions = {
|
|
5
|
-
provider?: string;
|
|
6
|
-
} & Record<string, OptionValue | OptionValue[]>;
|
|
7
|
-
export type PluginFunction = (model: Model, options: PluginOptions, dmmf?: DMMF.Document) => Promise<string[]> | string[] | Promise<void> | void;
|
|
8
|
-
export declare class PluginError extends Error {
|
|
9
|
-
constructor(message: string);
|
|
10
|
-
}
|
|
11
|
-
export declare const GUARD_FIELD_NAME = "zenstack_guard";
|
|
12
|
-
export declare const TRANSACTION_FIELD_NAME = "zenstack_transaction";
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './utils';
|
package/index.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
|
12
20
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAwB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenstackhq/sdk",
|
|
3
|
-
"version": "0.6.0-pre.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "0.6.0-pre.12",
|
|
4
|
+
"description": "ZenStack plugin development SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"directory": "dist",
|
|
@@ -12,14 +12,17 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@prisma/generator-helper": "^4.7.1",
|
|
15
|
-
"@zenstackhq/language": "
|
|
15
|
+
"@zenstackhq/language": "0.6.0-pre.12"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"rimraf": "^3.0.2",
|
|
18
19
|
"typescript": "^4.9.4"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
|
-
"
|
|
22
|
+
"clean": "rimraf dist",
|
|
23
|
+
"lint": "eslint src --ext ts",
|
|
24
|
+
"build": "pnpm lint && pnpm clean && tsc && cp ./package.json ./README.md dist/",
|
|
22
25
|
"watch": "tsc --watch",
|
|
23
|
-
"publish-dev": "pnpm build && pnpm publish --tag dev
|
|
26
|
+
"publish-dev": "pnpm build && pnpm publish --tag dev"
|
|
24
27
|
}
|
|
25
28
|
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DMMF } from '@prisma/generator-helper';
|
|
2
|
+
import { Model } from '@zenstackhq/language/ast';
|
|
3
|
+
/**
|
|
4
|
+
* Plugin configuration option value type
|
|
5
|
+
*/
|
|
6
|
+
export type OptionValue = string | number | boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Plugin configuration oiptions
|
|
9
|
+
*/
|
|
10
|
+
export type PluginOptions = {
|
|
11
|
+
provider?: string;
|
|
12
|
+
} & Record<string, OptionValue | OptionValue[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Plugin entry point function definition
|
|
15
|
+
*/
|
|
16
|
+
export type PluginFunction = (model: Model, options: PluginOptions, dmmf?: DMMF.Document) => Promise<string[]> | string[] | Promise<void> | void;
|
|
17
|
+
/**
|
|
18
|
+
* Plugin error
|
|
19
|
+
*/
|
|
20
|
+
export declare class PluginError extends Error {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
package/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluginError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Plugin error
|
|
6
|
+
*/
|
|
7
|
+
class PluginError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.PluginError = PluginError;
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAsBA;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK;IAClC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CACJ;AAJD,kCAIC"}
|
package/utils.js
CHANGED
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,kDAAsG;AAEtG,SAAgB,QAAQ,CAAoB,GAAiB;IACzD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;KAC9D;IACD,OAAO,GAAG,CAAC,GAAG,CAAC;AACnB,CAAC;AALD,4BAKC;AAED,8DAA8D;AAC9D,SAAgB,UAAU,CACtB,IAA4B;IAE5B,IAAI,CAAC,IAAA,mBAAa,EAAC,IAAI,CAAC,EAAE;QACtB,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,IAAI,CAAC,KAAU,CAAC;AAC3B,CAAC;AAPD,gCAOC;AAED,SAAgB,QAAQ,CAAC,IAA4B;IACjD,OAAO,IAAA,iBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAFD,4BAEC;AAED,SAAgB,eAAe,CAG7B,IAA4B;IAC1B,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,GAAG,EAAE;QACN,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC;AATD,0CASC"}
|