feeef 0.5.38-dev.2 → 0.5.38-dev.4
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.
- package/build/index.js +897 -42
- package/build/index.js.map +1 -1
- package/build/src/core/entities/city.d.ts +17 -0
- package/build/src/core/entities/country.d.ts +17 -0
- package/build/src/core/entities/currency.d.ts +21 -0
- package/build/src/core/entities/order.d.ts +1 -0
- package/build/src/core/entities/product.d.ts +1 -0
- package/build/src/core/entities/shipping_price.d.ts +120 -0
- package/build/src/core/entities/state.d.ts +17 -0
- package/build/src/core/entities/store.d.ts +1 -0
- package/build/src/core/entities/user.d.ts +155 -0
- package/build/src/feeef/feeef.d.ts +30 -0
- package/build/src/feeef/repositories/cities.d.ts +78 -0
- package/build/src/feeef/repositories/countries.d.ts +20 -0
- package/build/src/feeef/repositories/currencies.d.ts +20 -0
- package/build/src/feeef/repositories/shipping_prices.d.ts +28 -0
- package/build/src/feeef/repositories/states.d.ts +62 -0
- package/build/src/feeef/repositories/transfers.d.ts +38 -0
- package/build/src/feeef/repositories/users.d.ts +124 -12
- package/build/src/feeef/services/cart.d.ts +46 -5
- package/build/src/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* City Entity
|
|
3
|
+
*
|
|
4
|
+
* Represents a city with composite key (countryCode + stateCode + name).
|
|
5
|
+
*/
|
|
6
|
+
export interface CityEntity {
|
|
7
|
+
/** Country code (part of composite primary key) */
|
|
8
|
+
countryCode: string;
|
|
9
|
+
/** State code (part of composite primary key) */
|
|
10
|
+
stateCode: string;
|
|
11
|
+
/** City name (part of composite primary key) */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Additional metadata as key-value pairs */
|
|
14
|
+
metadata: Record<string, any>;
|
|
15
|
+
/** Creation timestamp */
|
|
16
|
+
createdAt: any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Country Entity
|
|
3
|
+
*
|
|
4
|
+
* Represents a country with ISO 3166-1 alpha-2 country code.
|
|
5
|
+
*/
|
|
6
|
+
export interface CountryEntity {
|
|
7
|
+
/** ISO 3166-1 alpha-2 country code (e.g., US, DZ, SA) */
|
|
8
|
+
code: string;
|
|
9
|
+
/** Country name (e.g., United States, Algeria, Saudi Arabia) */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Phone country code without + (e.g., 1, 213, 966) */
|
|
12
|
+
phone: string;
|
|
13
|
+
/** Additional metadata as key-value pairs */
|
|
14
|
+
metadata: Record<string, any>;
|
|
15
|
+
/** Creation timestamp */
|
|
16
|
+
createdAt: any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency Entity
|
|
3
|
+
*
|
|
4
|
+
* Represents a currency with ISO 4217 code.
|
|
5
|
+
*/
|
|
6
|
+
export interface CurrencyEntity {
|
|
7
|
+
/** ISO 4217 currency code (e.g., USD, EUR, SAR) */
|
|
8
|
+
code: string;
|
|
9
|
+
/** Currency name (e.g., US Dollar, Euro, Saudi Riyal) */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Currency symbol (e.g., $, €, ﷼) */
|
|
12
|
+
symbol?: string;
|
|
13
|
+
/** Number of decimal places */
|
|
14
|
+
decimals: number;
|
|
15
|
+
/** Exchange rate relative to base currency */
|
|
16
|
+
rate: number;
|
|
17
|
+
/** Additional metadata as key-value pairs */
|
|
18
|
+
metadata?: Record<string, any>;
|
|
19
|
+
/** Creation timestamp */
|
|
20
|
+
createdAt: any;
|
|
21
|
+
}
|
|
@@ -33,6 +33,7 @@ export interface OrderEntity {
|
|
|
33
33
|
shippingAddress?: string | null;
|
|
34
34
|
shippingCity?: string | null;
|
|
35
35
|
shippingState?: string | null;
|
|
36
|
+
shippingCountry?: string | null;
|
|
36
37
|
shippingMethodId?: string | null;
|
|
37
38
|
shippingType: ShippingType;
|
|
38
39
|
trackingCode: string | null;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shipping Price Entity
|
|
3
|
+
*
|
|
4
|
+
* A simplified, country-aware shipping pricing system that replaces
|
|
5
|
+
* the legacy array-based shipping rates with a structured approach.
|
|
6
|
+
*
|
|
7
|
+
* Key features:
|
|
8
|
+
* - Country codes as keys (ISO 3166-1 alpha-2)
|
|
9
|
+
* - State codes as keys (no fragile array indexes)
|
|
10
|
+
* - Named price types for extensibility
|
|
11
|
+
* - Gradual migration path from legacy system
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const prices: ShippingPriceRates = {
|
|
16
|
+
* "DZ": {
|
|
17
|
+
* "01": { home: 800, desk: 400, pickup: 0 },
|
|
18
|
+
* "16": { home: 600, desk: 300, pickup: 0 }
|
|
19
|
+
* },
|
|
20
|
+
* "IQ": {
|
|
21
|
+
* "01": { home: 15000, desk: 10000, pickup: 5000 }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Individual state shipping rates with named price types.
|
|
28
|
+
* Using named properties instead of array indexes for clarity and extensibility.
|
|
29
|
+
*/
|
|
30
|
+
export interface ShippingStateRates {
|
|
31
|
+
/** Price for home delivery (nullable if unavailable) */
|
|
32
|
+
home: number | null;
|
|
33
|
+
/** Price for desk/office pickup (nullable if unavailable) */
|
|
34
|
+
desk: number | null;
|
|
35
|
+
/** Price for store pickup (nullable if unavailable) */
|
|
36
|
+
pickup: number | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Shipping rates organized by country code and state code.
|
|
40
|
+
* Structure: { [countryCode]: { [stateCode]: ShippingStateRates } }
|
|
41
|
+
*/
|
|
42
|
+
export type ShippingPriceRates = Record<string, Record<string, ShippingStateRates>>;
|
|
43
|
+
/**
|
|
44
|
+
* Status of the shipping price configuration.
|
|
45
|
+
*/
|
|
46
|
+
export declare enum ShippingPriceStatus {
|
|
47
|
+
/** Not yet published, only visible to store owner */
|
|
48
|
+
draft = "draft",
|
|
49
|
+
/** Active and used for shipping calculations */
|
|
50
|
+
published = "published"
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Shipping Price Entity
|
|
54
|
+
*
|
|
55
|
+
* Represents a shipping pricing configuration for a store.
|
|
56
|
+
* Supports multi-country operations with state-level pricing.
|
|
57
|
+
*/
|
|
58
|
+
export interface ShippingPriceEntity {
|
|
59
|
+
/** Unique identifier (24-char string) */
|
|
60
|
+
id: string;
|
|
61
|
+
/** Display name for this pricing configuration */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Optional logo URL for branding */
|
|
64
|
+
logoUrl: string | null;
|
|
65
|
+
/** Store this pricing belongs to */
|
|
66
|
+
storeId: string;
|
|
67
|
+
/**
|
|
68
|
+
* Pricing data structured by country and state codes.
|
|
69
|
+
* @see ShippingPriceRates
|
|
70
|
+
*/
|
|
71
|
+
prices: ShippingPriceRates;
|
|
72
|
+
/** Publication status */
|
|
73
|
+
status: ShippingPriceStatus;
|
|
74
|
+
/** Creation timestamp */
|
|
75
|
+
createdAt: any;
|
|
76
|
+
/** Last update timestamp */
|
|
77
|
+
updatedAt: any;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Shipping type enumeration for order shipping type.
|
|
81
|
+
* Maps to the pricing structure keys.
|
|
82
|
+
*/
|
|
83
|
+
export type ShippingPriceType = keyof ShippingStateRates;
|
|
84
|
+
/**
|
|
85
|
+
* Helper function to get shipping price from rates.
|
|
86
|
+
*
|
|
87
|
+
* @param prices - The shipping price rates object
|
|
88
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
89
|
+
* @param stateCode - State/province code
|
|
90
|
+
* @param type - Shipping type (home, desk, pickup)
|
|
91
|
+
* @returns The price or null if not available
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const price = getShippingPrice(shippingPrice.prices, 'DZ', '16', 'home')
|
|
96
|
+
* // Returns 600 or null
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function getShippingPrice(prices: ShippingPriceRates, countryCode: string, stateCode: string, type: ShippingPriceType): number | null;
|
|
100
|
+
/**
|
|
101
|
+
* Helper function to check if shipping is available for a location.
|
|
102
|
+
*
|
|
103
|
+
* @param prices - The shipping price rates object
|
|
104
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
105
|
+
* @param stateCode - State/province code
|
|
106
|
+
* @returns True if any shipping type is available for this location
|
|
107
|
+
*/
|
|
108
|
+
export declare function isShippingAvailable(prices: ShippingPriceRates, countryCode: string, stateCode: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to get all available shipping types for a location.
|
|
111
|
+
*
|
|
112
|
+
* @param prices - The shipping price rates object
|
|
113
|
+
* @param countryCode - ISO 3166-1 alpha-2 country code
|
|
114
|
+
* @param stateCode - State/province code
|
|
115
|
+
* @returns Array of available shipping types with their prices
|
|
116
|
+
*/
|
|
117
|
+
export declare function getAvailableShippingTypes(prices: ShippingPriceRates, countryCode: string, stateCode: string): Array<{
|
|
118
|
+
type: ShippingPriceType;
|
|
119
|
+
price: number;
|
|
120
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State/Province Entity
|
|
3
|
+
*
|
|
4
|
+
* Represents a state or province with composite key (countryCode + code).
|
|
5
|
+
*/
|
|
6
|
+
export interface StateEntity {
|
|
7
|
+
/** Country code (part of composite primary key) */
|
|
8
|
+
countryCode: string;
|
|
9
|
+
/** State/province code (part of composite primary key) */
|
|
10
|
+
code: string;
|
|
11
|
+
/** State/province name */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Additional metadata as key-value pairs */
|
|
14
|
+
metadata: Record<string, any>;
|
|
15
|
+
/** Creation timestamp */
|
|
16
|
+
createdAt: any;
|
|
17
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a user entity in the system.
|
|
3
|
+
*/
|
|
1
4
|
export interface UserEntity {
|
|
2
5
|
id: string;
|
|
3
6
|
name: string | null;
|
|
@@ -14,10 +17,16 @@ export interface UserEntity {
|
|
|
14
17
|
metadata: Record<string, any>;
|
|
15
18
|
wallet: EmbaddedWallet;
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents an embedded wallet in a user entity.
|
|
22
|
+
*/
|
|
17
23
|
export interface EmbaddedWallet {
|
|
18
24
|
currency: 'DZD' | 'USD' | 'EUR';
|
|
19
25
|
balance: number;
|
|
20
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents an authentication token.
|
|
29
|
+
*/
|
|
21
30
|
export interface AuthToken {
|
|
22
31
|
type: string;
|
|
23
32
|
name: string | null;
|
|
@@ -26,3 +35,149 @@ export interface AuthToken {
|
|
|
26
35
|
lastUsedAt: any;
|
|
27
36
|
expiresAt: any;
|
|
28
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Options for creating a user (admin panel)
|
|
40
|
+
*/
|
|
41
|
+
export interface CreateUserOptions {
|
|
42
|
+
name: string;
|
|
43
|
+
email: string;
|
|
44
|
+
phone?: string;
|
|
45
|
+
password: string;
|
|
46
|
+
photoUrl?: string;
|
|
47
|
+
metadata?: Record<string, any>;
|
|
48
|
+
emailVerifiedAt?: string | Date;
|
|
49
|
+
phoneVerifiedAt?: string | Date;
|
|
50
|
+
verifiedAt?: string | Date;
|
|
51
|
+
blockedAt?: string | Date;
|
|
52
|
+
createdByAdmin?: boolean;
|
|
53
|
+
initialBalance?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Options for updating a user
|
|
57
|
+
*/
|
|
58
|
+
export interface UpdateUserOptions {
|
|
59
|
+
name?: string;
|
|
60
|
+
email?: string;
|
|
61
|
+
phone?: string;
|
|
62
|
+
password?: string;
|
|
63
|
+
password_confirmation?: string;
|
|
64
|
+
photoUrl?: string;
|
|
65
|
+
metadata?: Record<string, any>;
|
|
66
|
+
emailVerifiedAt?: string | Date;
|
|
67
|
+
phoneVerifiedAt?: string | Date;
|
|
68
|
+
verifiedAt?: string | Date;
|
|
69
|
+
blockedAt?: string | Date;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Represents an access token (returned from tokens endpoint).
|
|
73
|
+
*/
|
|
74
|
+
export interface AccessToken {
|
|
75
|
+
id: string;
|
|
76
|
+
type: string;
|
|
77
|
+
name: string | null;
|
|
78
|
+
token: string;
|
|
79
|
+
abilities: string[];
|
|
80
|
+
lastUsedAt: any | null;
|
|
81
|
+
expiresAt: any | null;
|
|
82
|
+
createdAt: any;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Credentials for signing in.
|
|
86
|
+
*/
|
|
87
|
+
export interface SigninCredentials {
|
|
88
|
+
email: string;
|
|
89
|
+
password: string;
|
|
90
|
+
fcmToken?: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Credentials for signing up.
|
|
94
|
+
*/
|
|
95
|
+
export interface SignupCredentials {
|
|
96
|
+
referral?: string | null;
|
|
97
|
+
name: string;
|
|
98
|
+
email: string;
|
|
99
|
+
phone?: string;
|
|
100
|
+
password: string;
|
|
101
|
+
photoUrl?: string;
|
|
102
|
+
fcmToken?: string | null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Options for updating user profile.
|
|
106
|
+
*/
|
|
107
|
+
export interface UserUpdate {
|
|
108
|
+
name?: string;
|
|
109
|
+
email?: string;
|
|
110
|
+
phone?: string;
|
|
111
|
+
photoUrl?: string;
|
|
112
|
+
oldPassword?: string;
|
|
113
|
+
newPassword?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Options for transferring money between users.
|
|
117
|
+
*/
|
|
118
|
+
export interface TransferMoneyOptions {
|
|
119
|
+
recipientId?: string;
|
|
120
|
+
recipientEmail?: string;
|
|
121
|
+
recipientPhone?: string;
|
|
122
|
+
amount: number;
|
|
123
|
+
note?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Response from a money transfer operation.
|
|
127
|
+
*/
|
|
128
|
+
export interface TransferMoneyResponse {
|
|
129
|
+
success: boolean;
|
|
130
|
+
sender: UserEntity;
|
|
131
|
+
recipient: UserEntity;
|
|
132
|
+
amount: number;
|
|
133
|
+
currency: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Options for linking a social account.
|
|
137
|
+
*/
|
|
138
|
+
export interface LinkSocialAccountOptions {
|
|
139
|
+
provider: 'google' | 'github' | 'apple';
|
|
140
|
+
code: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Options for signing in with a social provider.
|
|
144
|
+
*/
|
|
145
|
+
export interface SigninWithSocialOptions {
|
|
146
|
+
code: string;
|
|
147
|
+
fcmToken?: string | null;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Options for passkey registration start.
|
|
151
|
+
*/
|
|
152
|
+
export interface StartPasskeyRegistrationOptions {
|
|
153
|
+
deviceName?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Options for finishing passkey registration.
|
|
157
|
+
*/
|
|
158
|
+
export interface FinishPasskeyRegistrationOptions {
|
|
159
|
+
registrationResponse: Record<string, any>;
|
|
160
|
+
deviceName?: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Options for starting passkey authentication.
|
|
164
|
+
*/
|
|
165
|
+
export interface StartPasskeyAuthenticationOptions {
|
|
166
|
+
email?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Options for finishing passkey authentication.
|
|
170
|
+
*/
|
|
171
|
+
export interface FinishPasskeyAuthenticationOptions {
|
|
172
|
+
authenticationResponse: Record<string, any>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Represents a passkey entry.
|
|
176
|
+
*/
|
|
177
|
+
export interface Passkey {
|
|
178
|
+
id: string;
|
|
179
|
+
name: string;
|
|
180
|
+
deviceName?: string;
|
|
181
|
+
createdAt: any;
|
|
182
|
+
lastUsedAt: any | null;
|
|
183
|
+
}
|
|
@@ -4,7 +4,13 @@ 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 { DepositRepository } from './repositories/deposits.js';
|
|
7
|
+
import { TransferRepository } from './repositories/transfers.js';
|
|
7
8
|
import { CategoryRepository } from './repositories/categories.js';
|
|
9
|
+
import { CountryRepository } from './repositories/countries.js';
|
|
10
|
+
import { StateRepository } from './repositories/states.js';
|
|
11
|
+
import { CityRepository } from './repositories/cities.js';
|
|
12
|
+
import { CurrencyRepository } from './repositories/currencies.js';
|
|
13
|
+
import { ShippingPriceRepository } from './repositories/shipping_prices.js';
|
|
8
14
|
import { CartService } from './services/cart.js';
|
|
9
15
|
import { ActionsService } from './services/actions.js';
|
|
10
16
|
/**
|
|
@@ -63,10 +69,34 @@ export declare class FeeeF {
|
|
|
63
69
|
* The repository for managing deposits.
|
|
64
70
|
*/
|
|
65
71
|
deposits: DepositRepository;
|
|
72
|
+
/**
|
|
73
|
+
* The repository for managing transfers.
|
|
74
|
+
*/
|
|
75
|
+
transfers: TransferRepository;
|
|
66
76
|
/**
|
|
67
77
|
* The repository for managing categories.
|
|
68
78
|
*/
|
|
69
79
|
categories: CategoryRepository;
|
|
80
|
+
/**
|
|
81
|
+
* The repository for managing countries.
|
|
82
|
+
*/
|
|
83
|
+
countries: CountryRepository;
|
|
84
|
+
/**
|
|
85
|
+
* The repository for managing states.
|
|
86
|
+
*/
|
|
87
|
+
states: StateRepository;
|
|
88
|
+
/**
|
|
89
|
+
* The repository for managing cities.
|
|
90
|
+
*/
|
|
91
|
+
cities: CityRepository;
|
|
92
|
+
/**
|
|
93
|
+
* The repository for managing currencies.
|
|
94
|
+
*/
|
|
95
|
+
currencies: CurrencyRepository;
|
|
96
|
+
/**
|
|
97
|
+
* The repository for managing shipping prices.
|
|
98
|
+
*/
|
|
99
|
+
shippingPrices: ShippingPriceRepository;
|
|
70
100
|
/**
|
|
71
101
|
* The cart service for managing the cart.
|
|
72
102
|
*/
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository, ModelListOptions } from './repository.js';
|
|
3
|
+
import { CityEntity } from '../../core/entities/city.js';
|
|
4
|
+
/**
|
|
5
|
+
* Repository for managing City entities.
|
|
6
|
+
* Cities have composite keys (countryCode + stateCode + name) and are nested under states.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CityRepository extends ModelRepository<CityEntity, any, any> {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new CityRepository instance.
|
|
11
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
12
|
+
*/
|
|
13
|
+
constructor(client: AxiosInstance);
|
|
14
|
+
/**
|
|
15
|
+
* Lists cities, optionally filtered by country code and/or state code.
|
|
16
|
+
* @param options - The options for listing cities, including filters.
|
|
17
|
+
* @returns A Promise that resolves to a list of City entities.
|
|
18
|
+
*/
|
|
19
|
+
list(options?: ModelListOptions & {
|
|
20
|
+
countryCode?: string;
|
|
21
|
+
stateCode?: string;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Lists cities for a specific country and state (nested route).
|
|
25
|
+
* @param countryCode - The country code.
|
|
26
|
+
* @param stateCode - The state code.
|
|
27
|
+
* @param options - Optional list options.
|
|
28
|
+
* @returns A Promise that resolves to a list of City entities.
|
|
29
|
+
*/
|
|
30
|
+
listByState(countryCode: string, stateCode: string, options?: ModelListOptions): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Finds a city by country code, state code, and city name.
|
|
33
|
+
* @param countryCode - The country code.
|
|
34
|
+
* @param stateCode - The state code.
|
|
35
|
+
* @param cityName - The city name.
|
|
36
|
+
* @param params - Optional query parameters.
|
|
37
|
+
* @returns A Promise that resolves to the found City entity.
|
|
38
|
+
*/
|
|
39
|
+
findByName(countryCode: string, stateCode: string, cityName: string, params?: Record<string, any>): Promise<CityEntity>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new city (nested under country/state).
|
|
42
|
+
* @param countryCode - The country code.
|
|
43
|
+
* @param stateCode - The state code.
|
|
44
|
+
* @param data - The city data.
|
|
45
|
+
* @param params - Optional query parameters.
|
|
46
|
+
* @returns A Promise that resolves to the created City entity.
|
|
47
|
+
*/
|
|
48
|
+
createByState(countryCode: string, stateCode: string, data: any, params?: Record<string, any>): Promise<CityEntity>;
|
|
49
|
+
/**
|
|
50
|
+
* Updates a city (nested under country/state).
|
|
51
|
+
* @param countryCode - The country code.
|
|
52
|
+
* @param stateCode - The state code.
|
|
53
|
+
* @param cityName - The city name.
|
|
54
|
+
* @param data - The update data.
|
|
55
|
+
* @param params - Optional query parameters.
|
|
56
|
+
* @returns A Promise that resolves to the updated City entity.
|
|
57
|
+
*/
|
|
58
|
+
updateByState(countryCode: string, stateCode: string, cityName: string, data: any, params?: Record<string, any>): Promise<CityEntity>;
|
|
59
|
+
/**
|
|
60
|
+
* Deletes a city (nested under country/state).
|
|
61
|
+
* @param countryCode - The country code.
|
|
62
|
+
* @param stateCode - The state code.
|
|
63
|
+
* @param cityName - The city name.
|
|
64
|
+
* @param params - Optional query parameters.
|
|
65
|
+
* @returns A Promise that resolves when the city is deleted.
|
|
66
|
+
*/
|
|
67
|
+
deleteByState(countryCode: string, stateCode: string, cityName: string, params?: Record<string, any>): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Searches cities by name (autocomplete).
|
|
70
|
+
* @param query - The search query.
|
|
71
|
+
* @param options - Optional filters (countryCode, stateCode).
|
|
72
|
+
* @returns A Promise that resolves to a list of matching City entities.
|
|
73
|
+
*/
|
|
74
|
+
search(query: string, options?: {
|
|
75
|
+
countryCode?: string;
|
|
76
|
+
stateCode?: string;
|
|
77
|
+
}): Promise<CityEntity[]>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository } from './repository.js';
|
|
3
|
+
import { CountryEntity } from '../../core/entities/country.js';
|
|
4
|
+
/**
|
|
5
|
+
* Repository for managing Country entities.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CountryRepository extends ModelRepository<CountryEntity, any, any> {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new CountryRepository instance.
|
|
10
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
11
|
+
*/
|
|
12
|
+
constructor(client: AxiosInstance);
|
|
13
|
+
/**
|
|
14
|
+
* Finds a country by its code (ID is the country code).
|
|
15
|
+
* @param code - The country code (ISO 3166-1 alpha-2).
|
|
16
|
+
* @param params - Optional query parameters.
|
|
17
|
+
* @returns A Promise that resolves to the found Country entity.
|
|
18
|
+
*/
|
|
19
|
+
findByCode(code: string, params?: Record<string, any>): Promise<CountryEntity>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository } from './repository.js';
|
|
3
|
+
import { CurrencyEntity } from '../../core/entities/currency.js';
|
|
4
|
+
/**
|
|
5
|
+
* Repository for managing Currency entities.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CurrencyRepository extends ModelRepository<CurrencyEntity, any, any> {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new CurrencyRepository instance.
|
|
10
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
11
|
+
*/
|
|
12
|
+
constructor(client: AxiosInstance);
|
|
13
|
+
/**
|
|
14
|
+
* Finds a currency by its code (ID is the currency code).
|
|
15
|
+
* @param code - The currency code (ISO 4217, e.g., USD, EUR).
|
|
16
|
+
* @param params - Optional query parameters.
|
|
17
|
+
* @returns A Promise that resolves to the found Currency entity.
|
|
18
|
+
*/
|
|
19
|
+
findByCode(code: string, params?: Record<string, any>): Promise<CurrencyEntity>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository, ModelCreateOptions } from './repository.js';
|
|
3
|
+
import { ShippingPriceEntity } from '../../core/entities/shipping_price.js';
|
|
4
|
+
/**
|
|
5
|
+
* Repository for managing ShippingPrice entities.
|
|
6
|
+
*
|
|
7
|
+
* ShippingPrice is the new geo-based shipping system that replaces
|
|
8
|
+
* the legacy array-based ShippingMethod rates.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ShippingPriceRepository extends ModelRepository<ShippingPriceEntity, any, any> {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new ShippingPriceRepository instance.
|
|
13
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
14
|
+
*/
|
|
15
|
+
constructor(client: AxiosInstance);
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new ShippingPrice entity.
|
|
18
|
+
* @param options The options for creating the ShippingPrice entity.
|
|
19
|
+
* @returns A Promise that resolves to the created ShippingPrice entity.
|
|
20
|
+
*/
|
|
21
|
+
create(options: ModelCreateOptions<any>): Promise<ShippingPriceEntity>;
|
|
22
|
+
/**
|
|
23
|
+
* Finds a ShippingPrice by store ID.
|
|
24
|
+
* @param storeId The store ID to search for.
|
|
25
|
+
* @returns A Promise that resolves to the ShippingPrice entities for the store.
|
|
26
|
+
*/
|
|
27
|
+
listByStore(storeId: string): Promise<ShippingPriceEntity[]>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository, ModelListOptions } from './repository.js';
|
|
3
|
+
import { StateEntity } from '../../core/entities/state.js';
|
|
4
|
+
/**
|
|
5
|
+
* Repository for managing State entities.
|
|
6
|
+
* States have composite keys (countryCode + code) and can be nested under countries.
|
|
7
|
+
*/
|
|
8
|
+
export declare class StateRepository extends ModelRepository<StateEntity, any, any> {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new StateRepository instance.
|
|
11
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
12
|
+
*/
|
|
13
|
+
constructor(client: AxiosInstance);
|
|
14
|
+
/**
|
|
15
|
+
* Lists states, optionally filtered by country code.
|
|
16
|
+
* @param options - The options for listing states, including countryCode filter.
|
|
17
|
+
* @returns A Promise that resolves to a list of State entities.
|
|
18
|
+
*/
|
|
19
|
+
list(options?: ModelListOptions & {
|
|
20
|
+
countryCode?: string;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Lists states for a specific country (nested route).
|
|
24
|
+
* @param countryCode - The country code.
|
|
25
|
+
* @param options - Optional list options.
|
|
26
|
+
* @returns A Promise that resolves to a list of State entities.
|
|
27
|
+
*/
|
|
28
|
+
listByCountry(countryCode: string, options?: ModelListOptions): Promise<any>;
|
|
29
|
+
/**
|
|
30
|
+
* Finds a state by country code and state code.
|
|
31
|
+
* @param countryCode - The country code.
|
|
32
|
+
* @param stateCode - The state code.
|
|
33
|
+
* @param params - Optional query parameters.
|
|
34
|
+
* @returns A Promise that resolves to the found State entity.
|
|
35
|
+
*/
|
|
36
|
+
findByCode(countryCode: string, stateCode: string, params?: Record<string, any>): Promise<StateEntity>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new state (nested under country).
|
|
39
|
+
* @param countryCode - The country code.
|
|
40
|
+
* @param data - The state data.
|
|
41
|
+
* @param params - Optional query parameters.
|
|
42
|
+
* @returns A Promise that resolves to the created State entity.
|
|
43
|
+
*/
|
|
44
|
+
createByCountry(countryCode: string, data: any, params?: Record<string, any>): Promise<StateEntity>;
|
|
45
|
+
/**
|
|
46
|
+
* Updates a state (nested under country).
|
|
47
|
+
* @param countryCode - The country code.
|
|
48
|
+
* @param stateCode - The state code.
|
|
49
|
+
* @param data - The update data.
|
|
50
|
+
* @param params - Optional query parameters.
|
|
51
|
+
* @returns A Promise that resolves to the updated State entity.
|
|
52
|
+
*/
|
|
53
|
+
updateByCountry(countryCode: string, stateCode: string, data: any, params?: Record<string, any>): Promise<StateEntity>;
|
|
54
|
+
/**
|
|
55
|
+
* Deletes a state (nested under country).
|
|
56
|
+
* @param countryCode - The country code.
|
|
57
|
+
* @param stateCode - The state code.
|
|
58
|
+
* @param params - Optional query parameters.
|
|
59
|
+
* @returns A Promise that resolves when the state is deleted.
|
|
60
|
+
*/
|
|
61
|
+
deleteByCountry(countryCode: string, stateCode: string, params?: Record<string, any>): Promise<void>;
|
|
62
|
+
}
|