@zenstackhq/redwood 0.5.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 ZenStack
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # ZenStack RedwoodJS Integration
2
+
3
+ This package is for integrating ZenStack into [RedwoodJS](https://redwoodjs.com/) projects.
4
+
5
+ Visit [Homepage](https://zenstack.dev) for more details.
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { type AuthUser } from '@zenstackhq/runtime';
2
+ import { type Plugin } from 'graphql-yoga';
3
+ export declare function useZenStack<PrismaClient extends object>(db: PrismaClient): Plugin<{
4
+ currentUser: AuthUser;
5
+ db: PrismaClient;
6
+ }>;
package/index.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useZenStack = void 0;
4
+ const runtime_1 = require("@zenstackhq/runtime");
5
+ function useZenStack(db) {
6
+ return {
7
+ onContextBuilding() {
8
+ return ({ context }) => {
9
+ context.db = (0, runtime_1.enhance)(db, { user: context === null || context === void 0 ? void 0 : context.currentUser });
10
+ };
11
+ },
12
+ };
13
+ }
14
+ exports.useZenStack = useZenStack;
15
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAG7D,SAAgB,WAAW,CACvB,EAAgB;IAEhB,OAAO;QACH,iBAAiB;YACb,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;gBACnB,OAAO,CAAC,EAAE,GAAG,IAAA,iBAAO,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE,CAAC,CAAC;YAC7D,CAAC,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AAVD,kCAUC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@zenstackhq/redwood",
3
+ "displayName": "ZenStack RedwoodJS setup and runtime package",
4
+ "version": "0.5.0",
5
+ "description": "For using ZenStack with RedwoodJS projects.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/zenstackhq/zenstack"
9
+ },
10
+ "main": "index.js",
11
+ "types": "index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "default": "./index.js",
15
+ "types": "./index.d.ts"
16
+ },
17
+ "./setup": {
18
+ "default": "./setup.js"
19
+ },
20
+ "./package.json": {
21
+ "default": "./package.json"
22
+ }
23
+ },
24
+ "publishConfig": {
25
+ "directory": "dist",
26
+ "linkDirectory": true
27
+ },
28
+ "author": {
29
+ "name": "ZenStack Team"
30
+ },
31
+ "homepage": "https://zenstack.dev",
32
+ "license": "MIT",
33
+ "bin": "node setup.js",
34
+ "dependencies": {
35
+ "colors": "1.4.0",
36
+ "@zenstackhq/runtime": "1.4.1"
37
+ },
38
+ "devDependencies": {
39
+ "graphql-yoga": "^5.0.2"
40
+ },
41
+ "scripts": {
42
+ "clean": "rimraf dist",
43
+ "build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ../../LICENSE dist",
44
+ "watch": "concurrently \"tsc --watch\" \"tsup-node --config ./tsup-browser.config.ts --watch\" \"tsup-node --config ./tsup-cross.config.ts --watch\"",
45
+ "lint": "eslint src --ext ts"
46
+ }
47
+ }
package/setup.d.ts ADDED
File without changes
package/setup.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ console.log('Setup redwood');
3
+ //# sourceMappingURL=setup.js.map
package/setup.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC"}