@naturalcycles/nodejs-lib 15.93.0 → 15.94.0

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.
@@ -2,7 +2,7 @@ import type { ErrorData } from '@naturalcycles/js-lib/error';
2
2
  import type { AnyObject, JWTString } from '@naturalcycles/js-lib/types';
3
3
  import type { Algorithm, JwtHeader, SignOptions, VerifyOptions } from 'jsonwebtoken';
4
4
  import jsonwebtoken from 'jsonwebtoken';
5
- import type { AjvSchema } from '../validation/ajv/ajvSchema.js';
5
+ import type { AjvSchema, JSchema } from '../validation/ajv/jSchema.js';
6
6
  export { jsonwebtoken };
7
7
  export type { Algorithm, JwtHeader, SignOptions, VerifyOptions };
8
8
  export interface JWTServiceCfg {
@@ -50,9 +50,9 @@ export interface JWTServiceCfg {
50
50
  export declare class JWTService {
51
51
  cfg: JWTServiceCfg;
52
52
  constructor(cfg: JWTServiceCfg);
53
- sign<T extends AnyObject>(payload: T, schema?: AjvSchema<T>, opt?: SignOptions): JWTString;
54
- verify<T extends AnyObject>(token: JWTString, schema?: AjvSchema<T>, opt?: VerifyOptions, publicKey?: string): T;
55
- decode<T extends AnyObject>(token: JWTString, schema?: AjvSchema<T>): {
53
+ sign<T extends AnyObject>(payload: T, schema?: JSchema<T, any> | AjvSchema<T>, opt?: SignOptions): JWTString;
54
+ verify<T extends AnyObject>(token: JWTString, schema?: JSchema<T, any> | AjvSchema<T>, opt?: VerifyOptions, publicKey?: string): T;
55
+ decode<T extends AnyObject>(token: JWTString, schema?: JSchema<T, any> | AjvSchema<T>): {
56
56
  header: JwtHeader;
57
57
  payload: T;
58
58
  signature: string;
@@ -1,5 +1,5 @@
1
1
  import type { AnyObject } from '@naturalcycles/js-lib/types';
2
- import type { JsonSchema } from '../ajvSchema.js';
2
+ import type { JsonSchema } from '../jSchema.js';
3
3
  /**
4
4
  * Each row must be an object (current limitation).
5
5
  *
@@ -1,5 +1,5 @@
1
- import { Ajv2020 } from 'ajv/dist/2020.js';
2
1
  import type { Options } from 'ajv/dist/2020.js';
2
+ import { Ajv2020 } from 'ajv/dist/2020.js';
3
3
  /**
4
4
  * Return cached instance of Ajv with default (recommended) options.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import Ajv from 'ajv';
2
- export * from './ajvSchema.js';
3
2
  export * from './ajvValidationError.js';
4
3
  export * from './from-data/generateJsonSchemaFromData.js';
5
4
  export * from './getAjv.js';
5
+ export * from './jSchema.js';
6
6
  export { Ajv };
@@ -1,6 +1,6 @@
1
1
  import Ajv from 'ajv';
2
- export * from './ajvSchema.js';
3
2
  export * from './ajvValidationError.js';
4
3
  export * from './from-data/generateJsonSchemaFromData.js';
5
4
  export * from './getAjv.js';
5
+ export * from './jSchema.js';
6
6
  export { Ajv };