@appweaver/core 1.0.2 → 1.0.4

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 CHANGED
@@ -1 +1,21 @@
1
- UNLICENSED
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luka Matosevic
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 CHANGED
@@ -1,7 +1,31 @@
1
1
  # Appweaver - Core
2
2
 
3
- > Simple, fast, and reliable web application builder tool.
3
+ ![npm](https://img.shields.io/npm/v/@appweaver/core)
4
+ ![NPM License](https://img.shields.io/npm/l/@appweaver/core)
5
+ ![npm](https://img.shields.io/npm/dw/@appweaver/core)
6
+ ![npm](https://img.shields.io/badge/build-passing-brightgreen)
7
+
8
+ > The backend framework for AI-assisted development. Scaffold, extend, and ship APIs with any agent.
9
+
10
+ Appweaver is a batteries-included framework built on top of **Fastify** and **Prisma**, designed from the ground up to
11
+ be developed with AI agents. Instead of writing backend boilerplate from scratch, you describe resources using concise
12
+ factory functions and let the framework handle routing, validation, database, auth, migrations, so you can focus
13
+ on business logic instead of boilerplate.
14
+
15
+ ### Why Appweaver for agentic development?
16
+
17
+ - **80% fewer tokens** → Appweaver's conventions and factory API eliminate the boilerplate that dominates most backend
18
+ codebases. Your agent reads and writes only the code that matters, not hundreds of lines of scaffolding.
19
+ - **Zero-code configuration** → every framework behavior like server, database, auth, queues, mailer, storage is
20
+ controlled through `appweaver.json` config files or environment variables. No code changes are needed to reconfigure
21
+ the app for a different environment.
22
+ - **Agent-first conventions** → a consistent, predictable project structure means agents always know where to find and
23
+ place code: models, services, routes, and policies each live in their own file under `src/resources/<name>/`.
24
+ - **Built-in skill files** → every scaffolded project ships with agent-readable skill files that give your agent harness
25
+ a complete map of the framework's API, conventions, and CLI, which means no hallucination, and no trial-and-error.
26
+ - **Works with any agent harness** → Claude Code, Cursor, Codex, Copilot Workspace, or any coding assistant that can
27
+ read project files. Point your agent at the skill files, and it has everything it needs.
4
28
 
5
29
  ## License
6
30
 
7
- UNLICENSED
31
+ Appweaver is [MIT licensed](LICENSE).
@@ -8,6 +8,7 @@ const node_path_1 = __importDefault(require("node:path"));
8
8
  const common_1 = require("@appweaver/common");
9
9
  const context_1 = require("../context");
10
10
  const resource_1 = require("../resource");
11
+ const security_1 = require("../security");
11
12
  function createService(config, override = false) {
12
13
  const name = (0, common_1.capitalize)(config.modelName || node_path_1.default.basename(node_path_1.default.dirname(__dirname)));
13
14
  class Service extends resource_1.ResourceService {
@@ -65,21 +66,24 @@ function createService(config, override = false) {
65
66
  async readRestrictions(action, data) {
66
67
  const policy = (0, context_1.injectPolicy)(name);
67
68
  if (policy.readRestrictions) {
68
- return policy.readRestrictions(action, data) ?? {};
69
+ const user = (0, security_1.currentAuthUser)() ?? null;
70
+ return policy.readRestrictions(user, data, action) ?? {};
69
71
  }
70
72
  return super.readRestrictions(action, data);
71
73
  }
72
74
  async writeRestrictions(action, data) {
73
75
  const policy = (0, context_1.injectPolicy)(name);
74
76
  if (policy.writeRestrictions) {
75
- return policy.writeRestrictions(action, data) ?? {};
77
+ const user = (0, security_1.currentAuthUser)() ?? null;
78
+ return policy.writeRestrictions(user, data, action) ?? {};
76
79
  }
77
80
  return super.writeRestrictions(action, data);
78
81
  }
79
82
  async checkAccess(action, resource) {
80
83
  const policy = (0, context_1.injectPolicy)(name);
81
84
  if (policy?.checkAccess) {
82
- return policy.checkAccess(action, resource);
85
+ const user = (0, security_1.currentAuthUser)() ?? null;
86
+ return policy.checkAccess(user, resource, action);
83
87
  }
84
88
  return super.checkAccess(action, resource);
85
89
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@appweaver/core",
3
- "version": "1.0.2",
4
- "description": "Appweaver - simple, fast, and reliable web application builder tool (@core)",
3
+ "version": "1.0.4",
4
+ "description": "Appweaver - the backend framework for AI-assisted development (@core)",
5
5
  "author": "Luka Matosevic",
6
- "license": "UNLICENSED",
6
+ "license": "MIT",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "repository": {
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const common_1 = require("@appweaver/common");
4
- const factory_1 = require("../../../factory");
5
4
  const helper_1 = require("../../helper");
5
+ const factory_1 = require("../../../factory");
6
6
  function authModelField() {
7
7
  return (0, common_1.uncapitalize)((0, helper_1.resourceAuthModel)().name);
8
8
  }
9
9
  exports.default = common_1.config.SECURITY_API_KEY_ENABLED
10
10
  ? (0, factory_1.createPolicy)({
11
11
  modelName: 'ApiKey',
12
- checkAccess: (action, resource) => {
12
+ checkAccess: (user, resource, action) => {
13
13
  const authFieldName = authModelField();
14
- const currentAuthId = (0, helper_1.currentAuthUser)().id;
14
+ const currentAuthId = user.id;
15
15
  if (action === 'create') {
16
16
  return resource[authFieldName].id === currentAuthId;
17
17
  }
@@ -19,8 +19,8 @@ exports.default = common_1.config.SECURITY_API_KEY_ENABLED
19
19
  return resource[`${authFieldName}Id`] === currentAuthId;
20
20
  }
21
21
  },
22
- readRestrictions: () => {
23
- return { [authModelField()]: { id: (0, helper_1.currentAuthUser)().id } };
22
+ readRestrictions: (user) => {
23
+ return { [authModelField()]: { id: user.id } };
24
24
  }
25
25
  })
26
26
  : undefined;