Skip to content

Commit 315366c

Browse files
authored
Merge pull request #116 from aserto-dev/update_deps
update dependencies and remove deprecated packages
2 parents 2cfdda4 + 2e03e7f commit 315366c

File tree

24 files changed

+996
-1116
lines changed

24 files changed

+996
-1116
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ yalc.lock
1818
.early.coverage
1919

2020
tsconfig.tsbuildinfo
21+
.qodo
Lines changed: 292 additions & 291 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ nodeLinker: node-modules
66

77
npmAuthToken: "${NODE_AUTH_TOKEN:-default}"
88

9-
yarnPath: .yarn/releases/yarn-4.6.0.cjs
9+
yarnPath: .yarn/releases/yarn-4.7.0.cjs

__tests__/integration/index.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("Integration", () => {
105105
properties: {
106106
email: "rick@the-citadel.com",
107107
picture:
108-
"https://www.topaz.sh/assets/templates/citadel/img/Rick%20Sanchez.jpg",
108+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Rick%20Sanchez.jpg",
109109
roles: ["admin", "evil_genius"],
110110
status: "USER_STATUS_ACTIVE",
111111
},
@@ -375,7 +375,7 @@ describe("Integration", () => {
375375
properties: {
376376
email: "rick@the-citadel.com",
377377
picture:
378-
"https://www.topaz.sh/assets/templates/citadel/img/Rick%20Sanchez.jpg",
378+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Rick%20Sanchez.jpg",
379379
roles: ["admin", "evil_genius"],
380380
status: "USER_STATUS_ACTIVE",
381381
},
@@ -494,7 +494,7 @@ describe("Integration", () => {
494494
properties: {
495495
email: "rick@the-citadel.com",
496496
picture:
497-
"https://www.topaz.sh/assets/templates/citadel/img/Rick%20Sanchez.jpg",
497+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Rick%20Sanchez.jpg",
498498
roles: ["admin", "evil_genius"],
499499
status: "USER_STATUS_ACTIVE",
500500
},
@@ -885,7 +885,7 @@ describe("Integration", () => {
885885
properties: {
886886
email: "beth@the-smiths.com",
887887
picture:
888-
"https://www.topaz.sh/assets/templates/citadel/img/Beth%20Smith.jpg",
888+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Beth%20Smith.jpg",
889889
roles: ["viewer"],
890890
status: "USER_STATUS_ACTIVE",
891891
},
@@ -913,7 +913,7 @@ describe("Integration", () => {
913913
properties: {
914914
email: "jerry@the-smiths.com",
915915
picture:
916-
"https://www.topaz.sh/assets/templates/citadel/img/Jerry%20Smith.jpg",
916+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Jerry%20Smith.jpg",
917917
roles: ["viewer"],
918918
status: "USER_STATUS_ACTIVE",
919919
},
@@ -930,7 +930,7 @@ describe("Integration", () => {
930930
properties: {
931931
email: "morty@the-citadel.com",
932932
picture:
933-
"https://www.topaz.sh/assets/templates/citadel/img/Morty%20Smith.jpg",
933+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Morty%20Smith.jpg",
934934
roles: ["editor"],
935935
status: "USER_STATUS_ACTIVE",
936936
},
@@ -948,7 +948,7 @@ describe("Integration", () => {
948948
status: "USER_STATUS_ACTIVE",
949949
email: "rick@the-citadel.com",
950950
picture:
951-
"https://www.topaz.sh/assets/templates/citadel/img/Rick%20Sanchez.jpg",
951+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Rick%20Sanchez.jpg",
952952
roles: ["admin", "evil_genius"],
953953
},
954954
createdAt: expect.anything(),
@@ -964,7 +964,7 @@ describe("Integration", () => {
964964
properties: {
965965
email: "summer@the-smiths.com",
966966
picture:
967-
"https://www.topaz.sh/assets/templates/citadel/img/Summer%20Smith.jpg",
967+
"https://www.topaz.sh/assets/templates/v32/citadel/img/Summer%20Smith.jpg",
968968
roles: ["editor"],
969969
status: "USER_STATUS_ACTIVE",
970970
},

eslint.config.mjs

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import simpleImportSort from "eslint-plugin-simple-import-sort";
2-
import typescriptSortKeys from "eslint-plugin-typescript-sort-keys";
1+
import perfectionist from "eslint-plugin-perfectionist";
32
import path from "node:path";
43
import { fileURLToPath } from "node:url";
4+
55
import { fixupConfigRules } from "@eslint/compat";
66
import { FlatCompat } from "@eslint/eslintrc";
77
import js from "@eslint/js";
@@ -10,9 +10,9 @@ import tsParser from "@typescript-eslint/parser";
1010
const __filename = fileURLToPath(import.meta.url);
1111
const __dirname = path.dirname(__filename);
1212
const compat = new FlatCompat({
13+
allConfig: js.configs.all,
1314
baseDirectory: __dirname,
1415
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all,
1616
});
1717

1818
export default [
@@ -27,93 +27,101 @@ export default [
2727
"plugin:prettier/recommended",
2828
),
2929
),
30+
perfectionist.configs["recommended-natural"],
3031
{
31-
plugins: {
32-
"simple-import-sort": simpleImportSort,
33-
"typescript-sort-keys": typescriptSortKeys,
34-
},
35-
3632
languageOptions: {
37-
parser: tsParser,
3833
ecmaVersion: 2018,
34+
parser: tsParser,
3935
sourceType: "module",
4036
},
4137

42-
rules: {
43-
curly: "error",
44-
eqeqeq: ["error", "always"],
45-
"no-console": "warn",
46-
"no-debugger": "warn",
47-
"no-duplicate-case": "error",
48-
"no-use-before-define": "off",
38+
plugins: {},
4939

40+
rules: {
5041
"@typescript-eslint/consistent-type-assertions": [
5142
"error",
5243
{
5344
assertionStyle: "as",
5445
objectLiteralTypeAssertions: "allow-as-parameter",
5546
},
5647
],
57-
5848
"@typescript-eslint/explicit-module-boundary-types": "off",
59-
6049
"@typescript-eslint/naming-convention": [
6150
1,
6251
{
63-
selector: "interface",
6452
format: ["PascalCase"],
53+
selector: "interface",
6554
},
6655
],
67-
6856
"@typescript-eslint/no-empty-function": "off",
69-
"@typescript-eslint/no-inferrable-types": "off",
70-
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
71-
"@typescript-eslint/no-non-null-assertion": "off",
72-
"@typescript-eslint/no-var-requires": "off",
73-
"prettier/prettier": ["error"],
74-
75-
"simple-import-sort/imports": [
76-
"warn",
77-
{
78-
groups: [["^\\u0000"], ["^\\w", "^@"], ["^"], ["^\\."]],
79-
},
80-
],
81-
82-
"typescript-sort-keys/string-enum": [
57+
"@typescript-eslint/no-empty-interface": "off",
58+
"@typescript-eslint/no-explicit-any": [
8359
"error",
84-
"asc",
8560
{
86-
caseSensitive: false,
87-
natural: true,
61+
fixToUnknown: true,
8862
},
8963
],
9064

65+
"@typescript-eslint/no-inferrable-types": "off",
66+
67+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
68+
69+
"@typescript-eslint/no-non-null-assertion": "off",
70+
9171
"@typescript-eslint/no-unused-expressions": [
9272
"error",
9373
{
9474
allowShortCircuit: true,
9575
allowTernary: true,
9676
},
9777
],
98-
99-
"@typescript-eslint/no-empty-interface": "off",
100-
101-
"@typescript-eslint/no-explicit-any": [
102-
"error",
78+
"@typescript-eslint/no-unused-vars": [
79+
"warn",
10380
{
104-
fixToUnknown: true,
81+
argsIgnorePattern: "^_",
82+
varsIgnorePattern: "^_",
10583
},
10684
],
85+
"@typescript-eslint/no-var-requires": "off",
86+
curly: "error",
87+
eqeqeq: ["error", "always"],
88+
"no-console": "warn",
89+
90+
"no-debugger": "warn",
91+
92+
"no-duplicate-case": "error",
10793

10894
"no-unused-vars": "off",
10995

110-
"@typescript-eslint/no-unused-vars": [
96+
"no-use-before-define": "off",
97+
"perfectionist/sort-enums": [
11198
"warn",
11299
{
113-
argsIgnorePattern: "^_",
114-
varsIgnorePattern: "^_",
100+
partitionByComment: true,
101+
partitionByNewLine: true,
102+
},
103+
],
104+
"perfectionist/sort-imports": [
105+
"warn",
106+
{
107+
internalPattern: ["^@"],
108+
specialCharacters: "keep",
115109
},
116110
],
111+
"perfectionist/sort-maps": [
112+
"warn",
113+
{
114+
partitionByComment: true,
115+
partitionByNewLine: true,
116+
},
117+
],
118+
"perfectionist/sort-objects": "off",
119+
"perfectionist/sort-object-types": "off",
120+
"perfectionist/sort-interfaces": "off",
121+
"perfectionist/sort-classes": "off",
122+
"perfectionist/sort-enums": "off",
123+
124+
"prettier/prettier": ["error"],
117125
},
118126
},
119127
];

lib/authorizer/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { readFileSync } from "fs";
2+
23
import {
34
Authorizer as AuthorizerClient,
45
DecisionTreeRequestSchema,

lib/authorizer/mapper/identity/jwt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Request } from "express";
22
import { jwtDecode } from "jwt-decode";
3+
34
import { IdentityContext } from "@aserto/node-authorizer/src/gen/cjs/aserto/authorizer/v2/api/identity_context_pb";
45

56
import { IdentityMapper } from "../../middleware";

lib/authorizer/mapper/identity/sub.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Request } from "express";
22
import { jwtDecode, JwtPayload } from "jwt-decode";
3+
34
import { IdentityContext } from "@aserto/node-authorizer/src/gen/cjs/aserto/authorizer/v2/api/identity_context_pb";
45

56
import { IdentityMapper } from "../../middleware";

lib/authorizer/middleware.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { NextFunction, Request, Response } from "express";
2+
23
import { IdentityContext } from "@aserto/node-authorizer/src/gen/cjs/aserto/authorizer/v2/api/identity_context_pb";
34
import { PolicyContext } from "@aserto/node-authorizer/src/gen/cjs/aserto/authorizer/v2/api/policy_context_pb";
45
import { PolicyInstance } from "@aserto/node-authorizer/src/gen/cjs/aserto/authorizer/v2/api/policy_instance_pb";
56
import { CallOptions } from "@connectrpc/connect";
67

7-
import { errorHandler } from "../errorHandler";
88
import { Authorizer } from ".";
9+
import { errorHandler } from "../errorHandler";
910
import JWTIdentityMapper from "./mapper/identity/jwt";
1011
import PolicyPathMapper from "./mapper/policy/path";
1112
import checkResourceMapper from "./mapper/resource/check";
@@ -14,14 +15,6 @@ import policyContext from "./model/policyContext";
1415
import policyInstance from "./model/policyInstance";
1516
import { ResourceContext } from "./model/resourceContext";
1617

17-
type Policy = {
18-
root: string;
19-
name?: string;
20-
instanceLabel?: string;
21-
decision?: string;
22-
path?: string;
23-
};
24-
2518
export type CheckOptions = {
2619
object?: ObjectMapper;
2720
objectId?: string | StringMapper;
@@ -30,16 +23,24 @@ export type CheckOptions = {
3023
subjectType?: string;
3124
};
3225

33-
export type ResourceMapper =
34-
| ResourceContext
35-
| ((req?: Request) => Promise<ResourceContext>);
36-
3726
export type IdentityMapper = (req: Request) => Promise<IdentityContext>;
27+
3828
export type PolicyMapper = (req?: Request) => Promise<PolicyContext>;
3929

30+
export type ResourceMapper =
31+
| ((req?: Request) => Promise<ResourceContext>)
32+
| ResourceContext;
4033
type ObjectMapper = (
4134
req?: Request,
4235
) => Promise<{ objectId: string; objectType: string }>;
36+
37+
type Policy = {
38+
root: string;
39+
name?: string;
40+
instanceLabel?: string;
41+
decision?: string;
42+
path?: string;
43+
};
4344
type StringMapper = (req?: Request) => Promise<string>;
4445

4546
export class Middleware {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { JsonObject } from "@bufbuild/protobuf";
22

3-
export type ResourceContext = JsonObject;
4-
53
export type CheckResourceContext = {
64
relation: string;
75
object_type: string;
86
object_id: string;
97
subject_type: string;
108
};
9+
10+
export type ResourceContext = JsonObject;

0 commit comments

Comments
 (0)