@heyatom/bastion-client 0.1.1 → 0.1.2
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/README.md
CHANGED
|
@@ -77,4 +77,4 @@ await http.writeAuditEvent(await tokens.getToken(), { event: 'thing.done' });
|
|
|
77
77
|
|
|
78
78
|
## Release
|
|
79
79
|
|
|
80
|
-
Bump `version`, tag `vX.Y.Z`, push the tag. The workflow runs lint/test/build/DI smoke and publishes
|
|
80
|
+
Bump `version`, tag `vX.Y.Z`, push the tag. The workflow runs lint/test/build/DI smoke and publishes via npm trusted publishing (OIDC, no token; provenance implied).
|
|
@@ -49,8 +49,8 @@ let ServiceClientJwtGuard = class ServiceClientJwtGuard {
|
|
|
49
49
|
if (payload.serviceSlug !== this.options.serviceSlug) {
|
|
50
50
|
throw new common_1.ForbiddenException('Token not issued for this service');
|
|
51
51
|
}
|
|
52
|
-
const required = this.reflector.getAllAndOverride(require_scope_decorator_js_1.REQUIRED_SCOPES_KEY, targets)
|
|
53
|
-
const missing = required.filter((s) => !payload.scopes?.includes(s));
|
|
52
|
+
const required = this.reflector.getAllAndOverride(require_scope_decorator_js_1.REQUIRED_SCOPES_KEY, targets);
|
|
53
|
+
const missing = (Array.isArray(required) ? required : []).filter((s) => !payload.scopes?.includes(s));
|
|
54
54
|
if (missing.length)
|
|
55
55
|
throw new common_1.ForbiddenException(`Missing scope: ${missing.join(', ')}`);
|
|
56
56
|
req.user = payload;
|
|
@@ -19,6 +19,6 @@ export interface BastionModuleOptions {
|
|
|
19
19
|
acceptedRoles?: string[];
|
|
20
20
|
}
|
|
21
21
|
export interface BastionModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
22
|
-
useFactory: (...args:
|
|
22
|
+
useFactory: (...args: any[]) => BastionModuleOptions | Promise<BastionModuleOptions>;
|
|
23
23
|
inject?: unknown[];
|
|
24
24
|
}
|
|
@@ -46,8 +46,8 @@ let ServiceClientJwtGuard = class ServiceClientJwtGuard {
|
|
|
46
46
|
if (payload.serviceSlug !== this.options.serviceSlug) {
|
|
47
47
|
throw new ForbiddenException('Token not issued for this service');
|
|
48
48
|
}
|
|
49
|
-
const required = this.reflector.getAllAndOverride(REQUIRED_SCOPES_KEY, targets)
|
|
50
|
-
const missing = required.filter((s) => !payload.scopes?.includes(s));
|
|
49
|
+
const required = this.reflector.getAllAndOverride(REQUIRED_SCOPES_KEY, targets);
|
|
50
|
+
const missing = (Array.isArray(required) ? required : []).filter((s) => !payload.scopes?.includes(s));
|
|
51
51
|
if (missing.length)
|
|
52
52
|
throw new ForbiddenException(`Missing scope: ${missing.join(', ')}`);
|
|
53
53
|
req.user = payload;
|
|
@@ -19,6 +19,6 @@ export interface BastionModuleOptions {
|
|
|
19
19
|
acceptedRoles?: string[];
|
|
20
20
|
}
|
|
21
21
|
export interface BastionModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
22
|
-
useFactory: (...args:
|
|
22
|
+
useFactory: (...args: any[]) => BastionModuleOptions | Promise<BastionModuleOptions>;
|
|
23
23
|
inject?: unknown[];
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyatom/bastion-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Consumer SDK for the Bastion identity provider: JWKS verification, service-client auth, audit writes, NestJS guards",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Andrea Tombolato <hey@heyatom.dev> (https://heyatom.dev)",
|
|
@@ -37,6 +37,13 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rm -rf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > dist/esm/package.json",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
44
|
+
"prepublishOnly": "pnpm lint && pnpm test && pnpm build && pnpm test:di",
|
|
45
|
+
"test:di": "node scripts/di-smoke.cjs"
|
|
46
|
+
},
|
|
40
47
|
"engines": {
|
|
41
48
|
"node": ">=20.19"
|
|
42
49
|
},
|
|
@@ -80,11 +87,5 @@
|
|
|
80
87
|
"./dist/cjs/core/index.d.ts"
|
|
81
88
|
]
|
|
82
89
|
}
|
|
83
|
-
},
|
|
84
|
-
"scripts": {
|
|
85
|
-
"build": "rm -rf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > dist/esm/package.json",
|
|
86
|
-
"test": "vitest run",
|
|
87
|
-
"lint": "tsc -p tsconfig.json --noEmit",
|
|
88
|
-
"test:di": "node scripts/di-smoke.cjs"
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
|
+
}
|