grantcore 0.0.1 → 0.0.3

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/index.d.ts CHANGED
@@ -1,2 +1,7 @@
1
- /** The first stable surface of the package. */
2
- export declare const grantcore = "0.0.1";
1
+ export interface Grant {
2
+ principalId: string;
3
+ resource: string;
4
+ permissions: readonly string[];
5
+ }
6
+ export declare function createGrant(grant: Grant): Readonly<Grant>;
7
+ export declare function grantsPermission(grant: Grant, permission: string): boolean;
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- /** The first stable surface of the package. */
2
- export const grantcore = "0.0.1";
1
+ function i(e){if(!e.principalId||!e.resource)throw new TypeError("Grant principal and resource are required.");return Object.freeze({...e,permissions:Object.freeze([...new Set(e.permissions)])})}function n(e,r){return e.permissions.includes(r)}export{i as createGrant,n as grantsPermission};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grantcore",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Small, framework-neutral primitives for representing authorization grants.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,19 +12,35 @@
12
12
  "default": "./dist/index.js"
13
13
  }
14
14
  },
15
- "files": ["dist", "README.md"],
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
16
19
  "sideEffects": false,
17
20
  "scripts": {
18
21
  "build": "tsc --project tsconfig.json",
22
+ "postbuild": "npm run dist --prefix \"$npm_config_local_prefix\" -- \"$PWD\"",
23
+ "prepack": "npm run build",
19
24
  "prepublishOnly": "npm run build"
20
25
  },
21
- "keywords": ["auth", "authorization", "grants", "identity"],
26
+ "keywords": [
27
+ "auth",
28
+ "authorization",
29
+ "grants",
30
+ "identity"
31
+ ],
22
32
  "homepage": "https://signway.dev/",
23
33
  "author": "Mosanic <dev@mosanic.io>",
24
34
  "license": "MIT",
25
- "engines": {"node": ">=20"},
26
- "publishConfig": {"access": "public"},
27
- "devDependencies": {"typescript": "^5.9.3"},
35
+ "engines": {
36
+ "node": ">=20"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^5.9.3"
43
+ },
28
44
  "repository": {
29
45
  "type": "git",
30
46
  "url": "git+https://github.com/mosanic/mosa-platform.git",