feeef 0.8.2 → 0.8.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.
|
@@ -3,6 +3,7 @@ import { OrderRepository } from './repositories/orders.js';
|
|
|
3
3
|
import { ProductRepository } from './repositories/products.js';
|
|
4
4
|
import { StoreRepository } from './repositories/stores.js';
|
|
5
5
|
import { UserRepository } from './repositories/users.js';
|
|
6
|
+
import { AppRepository } from './repositories/apps.js';
|
|
6
7
|
import { DepositRepository } from './repositories/deposits.js';
|
|
7
8
|
import { TransferRepository } from './repositories/transfers.js';
|
|
8
9
|
import { CategoryRepository } from './repositories/categories.js';
|
|
@@ -86,6 +87,10 @@ export declare class FeeeF {
|
|
|
86
87
|
* The repository for managing users.
|
|
87
88
|
*/
|
|
88
89
|
users: UserRepository;
|
|
90
|
+
/**
|
|
91
|
+
* The repository for managing developer-registered apps (OAuth clients).
|
|
92
|
+
*/
|
|
93
|
+
apps: AppRepository;
|
|
89
94
|
/**
|
|
90
95
|
* The repository for managing orders.
|
|
91
96
|
*/
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository } from './repository.js';
|
|
3
|
+
/**
|
|
4
|
+
* Developer-registered app (OAuth client) returned by the apps API.
|
|
5
|
+
* clientSecret is present only on create and regenerateSecret responses.
|
|
6
|
+
*/
|
|
7
|
+
export interface AppEntity {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
clientId: string;
|
|
11
|
+
redirectUris: string[];
|
|
12
|
+
scopes: string[];
|
|
13
|
+
active: boolean;
|
|
14
|
+
lastUsedAt: string | null;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string | null;
|
|
17
|
+
/** Present only when returned from create or regenerateSecret. Store securely. */
|
|
18
|
+
clientSecret?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Input for creating a new app.
|
|
22
|
+
*/
|
|
23
|
+
export interface AppCreateInput {
|
|
24
|
+
name: string;
|
|
25
|
+
redirectUris: string[];
|
|
26
|
+
scopes: string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Input for updating an existing app.
|
|
30
|
+
*/
|
|
31
|
+
export interface AppUpdateInput {
|
|
32
|
+
name?: string;
|
|
33
|
+
redirectUris?: string[];
|
|
34
|
+
scopes?: string[];
|
|
35
|
+
active?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Repository for developer-registered apps (CRUD and regenerate secret).
|
|
39
|
+
* Requires an authenticated user (Bearer token).
|
|
40
|
+
*
|
|
41
|
+
* Terminology: "app" / "apps" is used consistently for the resource;
|
|
42
|
+
* OAuth is used only for the flow (authorize, token endpoints).
|
|
43
|
+
*/
|
|
44
|
+
export declare class AppRepository extends ModelRepository<AppEntity, AppCreateInput, AppUpdateInput> {
|
|
45
|
+
constructor(client: AxiosInstance);
|
|
46
|
+
/**
|
|
47
|
+
* Regenerates the client secret for the app. Returns the app with
|
|
48
|
+
* clientSecret set once; store it securely.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The app id.
|
|
51
|
+
* @returns The app including clientSecret.
|
|
52
|
+
*/
|
|
53
|
+
regenerateSecret(id: string): Promise<AppEntity>;
|
|
54
|
+
/**
|
|
55
|
+
* Builds the OAuth authorize URL to which the user should be redirected.
|
|
56
|
+
*
|
|
57
|
+
* @param params - Parameters for the authorize URL.
|
|
58
|
+
* @param params.baseUrl - API base URL (e.g. https://api.feeef.org/api/v1).
|
|
59
|
+
* @param params.clientId - The app client id.
|
|
60
|
+
* @param params.redirectUri - Redirect URI registered for the app.
|
|
61
|
+
* @param params.responseType - Must be 'code' for authorization code flow.
|
|
62
|
+
* @param params.scope - Optional list of scopes (space-separated in URL).
|
|
63
|
+
* @param params.state - Optional state for CSRF protection.
|
|
64
|
+
* @param params.codeChallenge - Optional PKCE code challenge.
|
|
65
|
+
* @param params.codeChallengeMethod - Optional 'S256' or 'plain'.
|
|
66
|
+
* @returns The full authorize URL.
|
|
67
|
+
*/
|
|
68
|
+
static buildAuthorizeUrl(params: {
|
|
69
|
+
baseUrl: string;
|
|
70
|
+
clientId: string;
|
|
71
|
+
redirectUri: string;
|
|
72
|
+
responseType: string;
|
|
73
|
+
scope?: string[];
|
|
74
|
+
state?: string;
|
|
75
|
+
codeChallenge?: string;
|
|
76
|
+
codeChallengeMethod?: string;
|
|
77
|
+
}): string;
|
|
78
|
+
}
|
package/build/src/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './core/entities/city.js';
|
|
|
17
17
|
export * from './core/entities/currency.js';
|
|
18
18
|
export * from './core/entities/feedback.js';
|
|
19
19
|
export * from './feeef/repositories/repository.js';
|
|
20
|
+
export * from './feeef/repositories/apps.js';
|
|
20
21
|
export * from './feeef/repositories/deposits.js';
|
|
21
22
|
export * from './feeef/repositories/transfers.js';
|
|
22
23
|
export * from './feeef/repositories/shipping_prices.js';
|
|
@@ -33,6 +34,7 @@ export * from './feeef/repositories/countries.js';
|
|
|
33
34
|
export * from './feeef/repositories/states.js';
|
|
34
35
|
export * from './feeef/repositories/cities.js';
|
|
35
36
|
export * from './feeef/repositories/currencies.js';
|
|
37
|
+
export type { AppEntity, AppCreateInput, AppUpdateInput } from './feeef/repositories/apps.js';
|
|
36
38
|
export type { TransferEntity, TransferCreateInput, TransferUpdateInput, TransferType, TransferListOptions, } from './feeef/repositories/transfers.js';
|
|
37
39
|
export type { DepositEntity, DepositCreateInput, DepositUpdateInput, DepositStatus, DepositListOptions, PayPalOrderResponse, PayPalCaptureResponse, } from './feeef/repositories/deposits.js';
|
|
38
40
|
export * from './core/embadded/address.js';
|