feeef 0.8.4 → 0.8.5

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.
@@ -4,6 +4,7 @@ import { ProductRepository } from './repositories/products.js';
4
4
  import { StoreRepository } from './repositories/stores.js';
5
5
  import { UserRepository } from './repositories/users.js';
6
6
  import { AppRepository } from './repositories/apps.js';
7
+ import { OAuthRepository } from './repositories/oauth.js';
7
8
  import { DepositRepository } from './repositories/deposits.js';
8
9
  import { PromoRepository } from './repositories/promos.js';
9
10
  import { TransferRepository } from './repositories/transfers.js';
@@ -92,6 +93,10 @@ export declare class FeeeF {
92
93
  * The repository for managing developer-registered apps (OAuth clients).
93
94
  */
94
95
  apps: AppRepository;
96
+ /**
97
+ * The repository for OAuth2 authorize/token/revoke/introspect operations.
98
+ */
99
+ oauth: OAuthRepository;
95
100
  /**
96
101
  * The repository for managing orders.
97
102
  */
@@ -9,6 +9,8 @@ export interface AppEntity {
9
9
  /** Owner user id. Always present from API. */
10
10
  userId?: string;
11
11
  name: string;
12
+ /** Optional app logo URL for OAuth consent and dashboard UI. */
13
+ logoUrl?: string | null;
12
14
  clientId: string;
13
15
  redirectUris: string[];
14
16
  scopes: string[];
@@ -25,6 +27,8 @@ export interface AppEntity {
25
27
  */
26
28
  export interface AppCreateInput {
27
29
  name: string;
30
+ /** Optional app logo URL. */
31
+ logoUrl?: string;
28
32
  redirectUris: string[];
29
33
  scopes: string[];
30
34
  userId?: string;
@@ -34,6 +38,8 @@ export interface AppCreateInput {
34
38
  */
35
39
  export interface AppUpdateInput {
36
40
  name?: string;
41
+ /** Optional app logo URL; pass null to clear. */
42
+ logoUrl?: string | null;
37
43
  redirectUris?: string[];
38
44
  scopes?: string[];
39
45
  active?: boolean;
@@ -76,6 +82,14 @@ export declare class AppRepository extends ModelRepository<AppEntity, AppCreateI
76
82
  regenerateSecret(id: string): Promise<AppEntity>;
77
83
  /**
78
84
  * Builds the OAuth authorize URL to which the user should be redirected.
85
+ * This is the first step of the authorization-code flow (similar UX to Google OAuth).
86
+ *
87
+ * If the user is not logged in yet, API `GET /oauth/authorize` returns:
88
+ * - `401 login_required`
89
+ * - `login_url` (accounts sign-in URL with `next=...`)
90
+ *
91
+ * The client should navigate to `login_url`, let the user sign in, and then
92
+ * continue by opening the original authorize URL again (or rely on `next`).
79
93
  *
80
94
  * @param params - Parameters for the authorize URL.
81
95
  * @param params.baseUrl - API base URL (e.g. https://api.feeef.org/api/v1).
@@ -0,0 +1,77 @@
1
+ import { AxiosInstance } from 'axios';
2
+ /**
3
+ * OAuth token response from `POST /oauth/token`.
4
+ */
5
+ export interface OAuthTokenResponse {
6
+ access_token: string;
7
+ token_type: string;
8
+ expires_in: number;
9
+ scope: string;
10
+ }
11
+ /**
12
+ * OAuth revoke response from `POST /oauth/revoke`.
13
+ */
14
+ export interface OAuthRevokeResponse {
15
+ revoked: boolean;
16
+ }
17
+ /**
18
+ * OAuth introspection response from `POST /oauth/introspect`.
19
+ */
20
+ export interface OAuthIntrospectResponse {
21
+ active: boolean;
22
+ scope?: string;
23
+ client_id?: string | null;
24
+ username?: string | null;
25
+ token_type?: string;
26
+ exp?: number | null;
27
+ }
28
+ /**
29
+ * Parameters for building the browser authorization URL.
30
+ */
31
+ export interface OAuthAuthorizeUrlParams {
32
+ baseUrl: string;
33
+ clientId: string;
34
+ redirectUri: string;
35
+ scope?: string[];
36
+ state?: string;
37
+ codeChallenge?: string;
38
+ codeChallengeMethod?: 'S256' | 'plain' | string;
39
+ }
40
+ /**
41
+ * Parameters for exchanging authorization code to access token.
42
+ */
43
+ export interface OAuthExchangeCodeParams {
44
+ code: string;
45
+ redirectUri: string;
46
+ clientId: string;
47
+ clientSecret: string;
48
+ codeVerifier?: string;
49
+ }
50
+ /**
51
+ * Repository for Feeef OAuth2 developer endpoints.
52
+ * This exposes typed wrappers for:
53
+ * - `/oauth/authorize` (URL helper)
54
+ * - `/oauth/token`
55
+ * - `/oauth/revoke`
56
+ * - `/oauth/introspect`
57
+ */
58
+ export declare class OAuthRepository {
59
+ client: AxiosInstance;
60
+ constructor(client: AxiosInstance);
61
+ /**
62
+ * Builds the authorize URL for browser redirect.
63
+ */
64
+ static buildAuthorizeUrl(params: OAuthAuthorizeUrlParams): string;
65
+ /**
66
+ * Exchanges an authorization code for an access token.
67
+ */
68
+ exchangeAuthorizationCode(params: OAuthExchangeCodeParams): Promise<OAuthTokenResponse>;
69
+ /**
70
+ * Revokes an OAuth token.
71
+ */
72
+ revokeToken(token: string, tokenTypeHint?: string): Promise<OAuthRevokeResponse>;
73
+ /**
74
+ * Introspects an OAuth token.
75
+ */
76
+ introspectToken(token: string): Promise<OAuthIntrospectResponse>;
77
+ }
@@ -78,7 +78,10 @@ export interface OrderListOptions {
78
78
  page?: number;
79
79
  offset?: number;
80
80
  limit?: number;
81
+ /** Single store (legacy). Ignored when storeIds is non-empty. */
81
82
  storeId?: string;
83
+ /** Multiple stores for unified order list. Takes precedence over storeId when non-empty. */
84
+ storeIds?: string[];
82
85
  status?: OrderStatus | OrderStatus[];
83
86
  deliveryStatus?: DeliveryStatus;
84
87
  paymentStatus?: PaymentStatus;
@@ -62,7 +62,14 @@ export declare class PromoRepository {
62
62
  page?: number;
63
63
  limit?: number;
64
64
  validNow?: boolean;
65
+ filterator?: string;
65
66
  }): Promise<PromoListResponse>;
67
+ /**
68
+ * Fetches a single promo by id.
69
+ */
70
+ find(params: {
71
+ id: string;
72
+ }): Promise<PromoEntity>;
66
73
  /**
67
74
  * Validates a promo code. Returns validation result with discount info or reason.
68
75
  */
@@ -18,6 +18,7 @@ export * from './core/entities/currency.js';
18
18
  export * from './core/entities/feedback.js';
19
19
  export * from './feeef/repositories/repository.js';
20
20
  export * from './feeef/repositories/apps.js';
21
+ export * from './feeef/repositories/oauth.js';
21
22
  export * from './feeef/repositories/deposits.js';
22
23
  export * from './feeef/repositories/promos.js';
23
24
  export * from './feeef/repositories/transfers.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "feeef",
3
3
  "description": "feeef sdk for javascript",
4
- "version": "0.8.4",
4
+ "version": "0.8.5",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
7
7
  "files": [