@mojaksebastian/allegro-client 1.0.2 → 1.0.3

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.

Potentially problematic release.


This version of @mojaksebastian/allegro-client might be problematic. Click here for more details.

@@ -0,0 +1,55 @@
1
+ /**
2
+ * Authentication Strategies
3
+ */
4
+ export type Tstrategy = "DeviceFlow";
5
+ /**
6
+ * Token related interfaces
7
+ */
8
+ export interface IAllegroTokens {
9
+ accessToken: string;
10
+ refreshToken: string;
11
+ expiresAt: number;
12
+ }
13
+ /**
14
+ * API Response interfaces
15
+ */
16
+ export interface IAllegroTokensResponse {
17
+ access_token: string;
18
+ refresh_token: string;
19
+ expires_in: number;
20
+ error?: string;
21
+ }
22
+ export interface IDeviceCodeResponse {
23
+ device_code: string;
24
+ expires_in: number;
25
+ user_code: string;
26
+ interval: number;
27
+ verification_uri: string;
28
+ verification_uri_complete: string;
29
+ }
30
+ /**
31
+ * Configuration and Credentials
32
+ */
33
+ export interface IAuthCredentials {
34
+ clientId: string;
35
+ clientSecret: string;
36
+ }
37
+ /**
38
+ * Storage and Strategy Interfaces
39
+ */
40
+ export interface ITokenStorage {
41
+ save(tokens: IAllegroTokens): Promise<void>;
42
+ read(): Promise<IAllegroTokens | null>;
43
+ clear(): Promise<void>;
44
+ }
45
+ export interface IAuthStrategy {
46
+ authorize(authUrl: URL, credentials: IAuthCredentials): Promise<IAllegroTokens>;
47
+ }
48
+ export interface IAuthConfig {
49
+ getToken(): Promise<string>;
50
+ clearToken(): Promise<void>;
51
+ }
52
+ export interface IRefreshTokensParameters {
53
+ refresh(refreshUrl: URL, credentials: IAuthCredentials, refreshToken: string): Promise<IAllegroTokens>;
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY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B,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { IAuthCredentials, ITokenStorage, Tstrategy } from "../auth/types.js";
2
+ /**
3
+ * Client Configuration Types
4
+ */
5
+ export type TEnv = "production" | "sandbox";
6
+ export interface IAllegroClientConfig {
7
+ credentials: IAuthCredentials;
8
+ env?: TEnv;
9
+ storage?: ITokenStorage;
10
+ strategy: Tstrategy;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,EACV,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,SAAS,CAAC;AAE5C,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaksebastian/allegro-client",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Allegro REST API Client with automatic token refresh. Fetches tokens from allegro and serves them to the user. Supports both the production and sandbox enviroments",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",