@tstdl/base 0.85.20 → 0.85.22

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.
@@ -51,6 +51,10 @@ export type TokenResult<AdditionalTokenPayload extends Record = Record<never>> =
51
51
  jsonToken: Token<AdditionalTokenPayload>;
52
52
  refreshToken: string;
53
53
  };
54
+ export type SetCredentialsOptions = {
55
+ /** skip validation for password strength */
56
+ skipValidation?: boolean;
57
+ };
54
58
  type CreateTokenResult<AdditionalTokenPayload extends Record> = {
55
59
  token: string;
56
60
  jsonToken: Token<AdditionalTokenPayload>;
@@ -80,7 +84,7 @@ export declare class AuthenticationService<AdditionalTokenPayload extends Record
80
84
  constructor(credentialsRepository: AuthenticationCredentialsRepository, sessionRepository: AuthenticationSessionRepository, authenticationSecretRequirementsValidator: AuthenticationSecretRequirementsValidator, subjectResolver: AuthenticationSubjectResolver | undefined, tokenPayloadProvider: AuthenticationTokenPayloadProvider<AdditionalTokenPayload, AuthenticationData> | undefined, authenticationResetSecretHandler: AuthenticationSecretResetHandler | undefined, options: AuthenticationServiceOptions);
81
85
  [afterResolve](): Promise<void>;
82
86
  initialize(): Promise<void>;
83
- setCredentials(subject: string, secret: string): Promise<void>;
87
+ setCredentials(subject: string, secret: string, options?: SetCredentialsOptions): Promise<void>;
84
88
  authenticate(subject: string, secret: string): Promise<AuthenticationResult>;
85
89
  getToken(subject: string, authenticationData: AuthenticationData): Promise<TokenResult<AdditionalTokenPayload>>;
86
90
  endSession(sessionId: string): Promise<void>;
@@ -116,9 +116,11 @@ let AuthenticationService = class AuthenticationService2 {
116
116
  this.derivedSecretResetTokenSigningSecret = this.options.secret.secretResetTokenSigningSecret;
117
117
  }
118
118
  }
119
- async setCredentials(subject, secret) {
119
+ async setCredentials(subject, secret, options) {
120
120
  const actualSubject = await this.resolveSubject(subject);
121
- await this.authenticationSecretRequirementsValidator.validateSecretRequirements(secret);
121
+ if (options?.skipValidation != true) {
122
+ await this.authenticationSecretRequirementsValidator.validateSecretRequirements(secret);
123
+ }
122
124
  const salt = (0, import_random.getRandomBytes)(32);
123
125
  const hash = await this.getHash(secret, salt);
124
126
  const credentials = {
@@ -21,6 +21,8 @@ export declare class ElementController<T extends Locator | ElementHandle = Locat
21
21
  readonly locatorOrHandle: T;
22
22
  readonly options: ElementControllerOptions;
23
23
  constructor(locatorOrHandle: T, options?: ElementControllerOptions);
24
+ getAll(): Promise<ElementController<Locator>[]>;
25
+ getAllHandles(): Promise<ElementController<ElementHandle>[]>;
24
26
  /**
25
27
  * Wait for element state
26
28
  * @param state some states may only be usable for either locator or handle
@@ -32,6 +32,20 @@ class ElementController {
32
32
  this.locatorOrHandle = locatorOrHandle;
33
33
  this.options = options;
34
34
  }
35
+ async getAll() {
36
+ if (!(0, import_utils.isLocator)(this.locatorOrHandle)) {
37
+ throw new Error("getAll only works with Locator");
38
+ }
39
+ const locators = await this.locatorOrHandle.all();
40
+ return locators.map((locator) => new ElementController(locator));
41
+ }
42
+ async getAllHandles() {
43
+ if (!(0, import_utils.isLocator)(this.locatorOrHandle)) {
44
+ throw new Error("getAllHandles only works with Locator");
45
+ }
46
+ const handles = await this.locatorOrHandle.elementHandles();
47
+ return handles.map((handle) => new ElementController(handle));
48
+ }
35
49
  /**
36
50
  * Wait for element state
37
51
  * @param state some states may only be usable for either locator or handle
@@ -52,7 +66,10 @@ class ElementController {
52
66
  try {
53
67
  await this.waitFor(options?.state ?? "visible", { timeout: options?.timeout ?? 250 });
54
68
  return true;
55
- } catch {
69
+ } catch (error) {
70
+ if (error instanceof Error && error.message.includes("violation")) {
71
+ throw error;
72
+ }
56
73
  return false;
57
74
  }
58
75
  }
@@ -5,7 +5,7 @@ import { EntityRepository } from '../../database/index.js';
5
5
  import type { Logger } from '../../logger/index.js';
6
6
  import type { Collection } from './classes.js';
7
7
  import { MongoBaseRepository } from './mongo-base.repository.js';
8
- import type { TypedIndexDescription } from './types.js';
8
+ import type { Filter, TypedIndexDescription, UpdateFilter } from './types.js';
9
9
  export type MongoEntityRepositoryOptions<T extends Entity<any>> = {
10
10
  logger: Logger;
11
11
  indexes?: TypedIndexDescription<T>[];
@@ -93,6 +93,6 @@ export declare class MongoEntityRepository<T extends Entity<any>, TDb extends En
93
93
  deleteManyById(ids: string[]): Promise<number>;
94
94
  deleteByFilter<U extends T = T>(filter: Query<U>): Promise<boolean>;
95
95
  deleteManyByFilter<U extends T = T>(filter: Query<U>): Promise<number>;
96
- private transformFilter;
97
- private transformPatch;
96
+ transformFilter<U extends T = T>(filter: Query<U>): Filter<TDb>;
97
+ transformPatch<U extends T = T>(patch: EntityPatch<U>): UpdateFilter<TDb>;
98
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.85.20",
3
+ "version": "0.85.22",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,10 +20,10 @@
20
20
  "tsc-alias:watch": "tsc-alias --watch"
21
21
  },
22
22
  "dependencies": {
23
- "luxon": "^3.3",
23
+ "luxon": "^3.4",
24
24
  "reflect-metadata": "^0.1",
25
25
  "rxjs": "^7.8",
26
- "type-fest": "^4.0"
26
+ "type-fest": "^4.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/chroma-js": "2.4",
@@ -33,13 +33,13 @@
33
33
  "@types/mjml": "4.7",
34
34
  "@types/node": "20",
35
35
  "@types/nodemailer": "6.4",
36
- "@typescript-eslint/eslint-plugin": "6.2",
37
- "@typescript-eslint/parser": "6.2",
36
+ "@typescript-eslint/eslint-plugin": "6.4",
37
+ "@typescript-eslint/parser": "6.4",
38
38
  "concurrently": "8.2",
39
- "esbuild": "0.18",
40
- "eslint": "8.45",
41
- "eslint-import-resolver-typescript": "3.5",
42
- "eslint-plugin-import": "2.27",
39
+ "esbuild": "0.19",
40
+ "eslint": "8.47",
41
+ "eslint-import-resolver-typescript": "3.6",
42
+ "eslint-plugin-import": "2.28",
43
43
  "tsc-alias": "1.8",
44
44
  "typedoc": "0.24",
45
45
  "typescript": "5.1"
@@ -60,10 +60,10 @@
60
60
  "mjml": "^4.14",
61
61
  "mongodb": "^5.7",
62
62
  "nodemailer": "^6.9",
63
- "playwright": "^1.36",
64
- "preact": "^10.16",
63
+ "playwright": "^1.37",
64
+ "preact": "^10.17",
65
65
  "preact-render-to-string": "^6.2",
66
- "undici": "^5.22",
66
+ "undici": "^5.23",
67
67
  "urlpattern-polyfill": "^9.0"
68
68
  },
69
69
  "peerDependenciesMeta": {