dh-auth-library 1.2.1 → 1.2.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/README.md CHANGED
@@ -6,6 +6,18 @@ it is published an npm package too and should be imported like that
6
6
 
7
7
  ---
8
8
 
9
+ ## How to use this library
10
+
11
+ Install with npm or pnpm
12
+
13
+ npm install dh-auth-library
14
+
15
+ OR
16
+
17
+ pnpm add dh-auth-library
18
+
19
+ ---
20
+
9
21
  ## 📦 Purpose
10
22
 
11
23
  Within DenHaag we will have several different repositories which will all have to use certain
@@ -20,7 +32,7 @@ will take care of all login logic and even maintains the sessions during the tes
20
32
 
21
33
  packages/
22
34
  ├── auth/ # Contains all classes for handling login and sessions
23
- ├── constants/ # Constains accounts and types that can be used
35
+ ├── constants/ # Constains AuthType and TestProfile
24
36
 
25
37
  ---
26
38
 
@@ -33,6 +45,7 @@ Has the authentication logic for api calls for nl-portal
33
45
  # loginhandlers
34
46
 
35
47
  Has all the login handlers that are needed for the nl-portal-playwright-libraries
48
+ The interface LoginHandler is used by the implementation
36
49
 
37
50
  # pages
38
51
 
@@ -1,2 +1,2 @@
1
1
  export * from './apiTokenHelper';
2
- export * from './sessionHandlerResolvers';
2
+ export * from '../getSessionHandler';
@@ -1,3 +1,3 @@
1
1
  import { AuthType } from '../constants/authTypes';
2
- import { LoginHandler } from '../constants/loginHandler';
2
+ import { LoginHandler } from './loginHandler';
3
3
  export declare function getLoginHandler(authType: AuthType): LoginHandler;
@@ -0,0 +1,2 @@
1
+ import { TestProfile } from '../constants';
2
+ export declare function getSessionHandler(testProfile: TestProfile): import("nl-portal-playwright-libraries").SessionHandler;
@@ -1,5 +1,6 @@
1
1
  export { getLoginHandler } from './getLoginHandler';
2
2
  export { createSessionHandler, MAX_SESSION_TIME_IN_MINUTES } from './sessionHandler';
3
+ export { type LoginHandler } from './loginHandler';
3
4
  export * from './api/index';
4
5
  export * from './loginhandlers/index';
5
6
  export * from './pages/index';
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
- import { LoginHandler } from '../../constants/loginHandler';
3
+ import { LoginHandler } from '../loginHandler';
4
4
  export declare class ADLoginHandler implements LoginHandler {
5
5
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
- import { LoginHandler } from '../../constants/loginHandler';
3
+ import { LoginHandler } from '../loginHandler';
4
4
  export declare class DigidGemachtigdeLoginHandler implements LoginHandler {
5
5
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
- import { LoginHandler } from '../../constants/loginHandler';
3
+ import { LoginHandler } from '../loginHandler';
4
4
  export declare class DigidLoginHandler implements LoginHandler {
5
5
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
- import { LoginHandler } from '../../constants/loginHandler';
3
+ import { LoginHandler } from '../loginHandler';
4
4
  export declare class EHerkenningBewindvoerderLoginHandler implements LoginHandler {
5
5
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
- import { LoginHandler } from '../../constants/loginHandler';
3
+ import { LoginHandler } from '../loginHandler';
4
4
  export declare class EHerkenningLoginHandler implements LoginHandler {
5
5
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
2
  import { Account } from 'nl-portal-playwright-libraries';
3
- import { LoginHandler } from '../../constants/loginHandler';
3
+ import { LoginHandler } from '../loginHandler';
4
4
  export declare class LocalhostLoginHandler implements LoginHandler {
5
5
  loginAndCreateSessionStorage(page: Page, account: Account, file: string): Promise<void>;
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { Account, SessionHandler } from 'nl-portal-playwright-libraries';
2
- import { LoginHandler } from '../constants/loginHandler';
2
+ import { LoginHandler } from './loginHandler';
3
3
  import { AuthType } from '../constants';
4
4
  export declare const MAX_SESSION_TIME_IN_MINUTES = 10;
5
5
  /**
@@ -1,3 +1,2 @@
1
- export * from './loginHandler';
2
1
  export * from './testProfile';
3
2
  export * from './authTypes';
package/dist/index.cjs.js CHANGED
@@ -539,9 +539,9 @@ function getApiTokenFromSession(baseTest, handler) {
539
539
  });
540
540
  }
541
541
  //#endregion
542
- //#region src/auth/api/sessionHandlerResolvers.ts
543
- function getSessionHandler(authType, account) {
544
- return createSessionHandler(authType, account, getLoginHandler(authType));
542
+ //#region src/auth/getSessionHandler.ts
543
+ function getSessionHandler(testProfile) {
544
+ return createSessionHandler(testProfile.authType, testProfile.account, getLoginHandler(testProfile.authType));
545
545
  }
546
546
  //#endregion
547
547
  exports.ADLoginHandler = ADLoginHandler;
package/dist/index.es.js CHANGED
@@ -515,9 +515,9 @@ function getApiTokenFromSession(baseTest, handler) {
515
515
  });
516
516
  }
517
517
  //#endregion
518
- //#region src/auth/api/sessionHandlerResolvers.ts
519
- function getSessionHandler(authType, account) {
520
- return createSessionHandler(authType, account, getLoginHandler(authType));
518
+ //#region src/auth/getSessionHandler.ts
519
+ function getSessionHandler(testProfile) {
520
+ return createSessionHandler(testProfile.authType, testProfile.account, getLoginHandler(testProfile.authType));
521
521
  }
522
522
  //#endregion
523
523
  export { ADLoginHandler, ADLoginPage, DigidGemachtigdeLoginHandler, DigidLoginHandler, DigidLoginPage, EHerkenningBewindvoerderLoginHandler, EHerkenningLoginHandler, EHerkenningLoginPage, LocalhostLoginHandler, LoginOverzichtPage, MAX_SESSION_TIME_IN_MINUTES, SessionFileHelper, createSessionHandler, getApiTokenFromSession, getLoginHandler, getSessionHandler };
package/package.json CHANGED
@@ -1,55 +1,57 @@
1
- {
2
- "name": "dh-auth-library",
3
- "version": "1.2.1",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/Gemeente-DenHaag/dh-auth-library.git"
7
- },
8
- "description": "Authentication package for all types of login on DH applications",
9
- "license": "MIT",
10
- "main": "dist/index.cjs.js",
11
- "module": "dist/index.es.js",
12
- "types": "dist/index.d.ts",
13
- "exports": {
14
- ".": {
15
- "types": "./dist/index.d.ts",
16
- "import": "./dist/index.es.js",
17
- "require": "./dist/index.cjs.js"
18
- }
19
- },
20
- "files": [
21
- "dist"
22
- ],
23
- "engines": {
24
- "node": ">=22",
25
- "pnpm": "^11"
26
- },
27
- "peerDependencies": {
28
- "@playwright/test": ">=1.60.0"
29
- },
30
- "devDependencies": {
31
- "@eslint/js": "10.0.1",
32
- "@playwright/test": "^1.61.1",
33
- "@types/node": "^25.9.4",
34
- "eslint": "^10.5.0",
35
- "typescript": "^6.0.3",
36
- "typescript-eslint": "8.60.1",
37
- "vite": "^8.1.0",
38
- "vite-tsconfig-paths": "^6.1.1"
39
- },
40
- "dependencies": {
41
- "nl-portal-playwright-libraries": "^1.1.3",
42
- "totp-generator": "^2.0.1"
43
- },
44
- "keywords": [
45
- "playwright",
46
- "testing",
47
- "automation",
48
- "e2e",
49
- "dh-auth"
50
- ],
51
- "scripts": {
52
- "build": "vite build && tsc -p tsconfig.build.json",
53
- "lint": "eslint ."
54
- }
55
- }
1
+ {
2
+ "name": "dh-auth-library",
3
+ "version": "1.2.4",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/Gemeente-DenHaag/dh-auth-library.git"
7
+ },
8
+ "packageManager": "pnpm@11.5.2",
9
+ "description": "Authentication package for all types of login on DH applications",
10
+ "license": "MIT",
11
+ "main": "dist/index.cjs.js",
12
+ "module": "dist/index.es.js",
13
+ "types": "dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.es.js",
18
+ "require": "./dist/index.cjs.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "vite build && tsc -p tsconfig.build.json",
26
+ "prepublishOnly": "pnpm build",
27
+ "lint": "eslint ."
28
+ },
29
+ "engines": {
30
+ "node": ">=22",
31
+ "pnpm": "^11"
32
+ },
33
+ "peerDependencies": {
34
+ "@playwright/test": ">=1.60.0"
35
+ },
36
+ "devDependencies": {
37
+ "@eslint/js": "10.0.1",
38
+ "@playwright/test": "^1.61.1",
39
+ "@types/node": "^25.9.4",
40
+ "eslint": "^10.5.0",
41
+ "typescript": "^6.0.3",
42
+ "typescript-eslint": "8.60.1",
43
+ "vite": "^8.1.0",
44
+ "vite-tsconfig-paths": "^6.1.1"
45
+ },
46
+ "dependencies": {
47
+ "nl-portal-playwright-libraries": "^1.1.3",
48
+ "totp-generator": "^2.0.1"
49
+ },
50
+ "keywords": [
51
+ "playwright",
52
+ "testing",
53
+ "automation",
54
+ "e2e",
55
+ "dh-auth"
56
+ ]
57
+ }
@@ -1,3 +0,0 @@
1
- import { Account } from 'nl-portal-playwright-libraries';
2
- import { AuthType } from '../../constants/authTypes';
3
- export declare function getSessionHandler(authType: AuthType, account: Account): import("nl-portal-playwright-libraries").SessionHandler;
File without changes