@cranberry-money/shared-services 10.0.4 → 10.0.6
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/dist/banks.d.ts +10 -0
- package/dist/banks.d.ts.map +1 -0
- package/dist/banks.js +49 -0
- package/dist/banks.js.map +1 -0
- package/dist/cashAccountTransactions.d.ts +16 -0
- package/dist/cashAccountTransactions.d.ts.map +1 -0
- package/dist/cashAccountTransactions.js +67 -0
- package/dist/cashAccountTransactions.js.map +1 -0
- package/dist/cashAccounts.d.ts +13 -0
- package/dist/cashAccounts.d.ts.map +1 -0
- package/dist/cashAccounts.js +46 -0
- package/dist/cashAccounts.js.map +1 -0
- package/dist/countries.d.ts +24 -0
- package/dist/countries.d.ts.map +1 -0
- package/dist/countries.js +46 -0
- package/dist/countries.js.map +1 -0
- package/dist/documents.d.ts +58 -0
- package/dist/documents.d.ts.map +1 -0
- package/dist/documents.js +130 -0
- package/dist/documents.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/industries.d.ts +24 -0
- package/dist/industries.d.ts.map +1 -0
- package/dist/industries.js +57 -0
- package/dist/industries.js.map +1 -0
- package/dist/instruments.d.ts +36 -0
- package/dist/instruments.d.ts.map +1 -0
- package/dist/instruments.js +95 -0
- package/dist/instruments.js.map +1 -0
- package/dist/investmentPreferences.d.ts +14 -0
- package/dist/investmentPreferences.d.ts.map +1 -0
- package/dist/investmentPreferences.js +32 -0
- package/dist/investmentPreferences.js.map +1 -0
- package/dist/portfolioAllocations.d.ts +12 -0
- package/dist/portfolioAllocations.d.ts.map +1 -0
- package/dist/portfolioAllocations.js +34 -0
- package/dist/portfolioAllocations.js.map +1 -0
- package/dist/portfolioHoldings.d.ts +13 -0
- package/dist/portfolioHoldings.d.ts.map +1 -0
- package/dist/portfolioHoldings.js +67 -0
- package/dist/portfolioHoldings.js.map +1 -0
- package/dist/portfolioTemplates.d.ts +14 -0
- package/dist/portfolioTemplates.d.ts.map +1 -0
- package/dist/portfolioTemplates.js +28 -0
- package/dist/portfolioTemplates.js.map +1 -0
- package/dist/portfolios.d.ts +15 -0
- package/dist/portfolios.d.ts.map +1 -0
- package/dist/portfolios.js +33 -0
- package/dist/portfolios.js.map +1 -0
- package/dist/sectors.d.ts +19 -0
- package/dist/sectors.d.ts.map +1 -0
- package/dist/sectors.js +45 -0
- package/dist/sectors.js.map +1 -0
- package/dist/stockExchanges.d.ts +9 -0
- package/dist/stockExchanges.d.ts.map +1 -0
- package/dist/stockExchanges.js +39 -0
- package/dist/stockExchanges.js.map +1 -0
- package/dist/targetTradeSheets.d.ts +14 -0
- package/dist/targetTradeSheets.d.ts.map +1 -0
- package/dist/targetTradeSheets.js +58 -0
- package/dist/targetTradeSheets.js.map +1 -0
- package/dist/targetTrades.d.ts +11 -0
- package/dist/targetTrades.d.ts.map +1 -0
- package/dist/targetTrades.js +54 -0
- package/dist/targetTrades.js.map +1 -0
- package/dist/taxResidencies.d.ts +11 -0
- package/dist/taxResidencies.d.ts.map +1 -0
- package/dist/taxResidencies.js +33 -0
- package/dist/taxResidencies.js.map +1 -0
- package/dist/tradeSheets.d.ts +8 -0
- package/dist/tradeSheets.d.ts.map +1 -0
- package/dist/tradeSheets.js +19 -0
- package/dist/tradeSheets.js.map +1 -0
- package/dist/trades.d.ts +8 -0
- package/dist/trades.d.ts.map +1 -0
- package/dist/trades.js +62 -0
- package/dist/trades.js.map +1 -0
- package/dist/users.d.ts +10 -0
- package/dist/users.d.ts.map +1 -0
- package/dist/users.js +25 -0
- package/dist/users.js.map +1 -0
- package/dist/withdrawalLiquidations.d.ts +10 -0
- package/dist/withdrawalLiquidations.d.ts.map +1 -0
- package/dist/withdrawalLiquidations.js +72 -0
- package/dist/withdrawalLiquidations.js.map +1 -0
- package/dist/withdrawalRequests.d.ts +9 -0
- package/dist/withdrawalRequests.d.ts.map +1 -0
- package/dist/withdrawalRequests.js +60 -0
- package/dist/withdrawalRequests.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic industries service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { Industry, IndustryQueryParams, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configureIndustries: (apiClient: AxiosInstance) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Get list of industries with optional filtering
|
|
10
|
+
*/
|
|
11
|
+
export declare const getIndustries: (params?: IndustryQueryParams) => Promise<import("axios").AxiosResponse<PaginatedResponse<Industry>, any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get industry details by UUID
|
|
14
|
+
*/
|
|
15
|
+
export declare const getIndustryByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<Industry, any>>;
|
|
16
|
+
/**
|
|
17
|
+
* Search industries by name
|
|
18
|
+
*/
|
|
19
|
+
export declare const searchIndustries: (searchTerm: string, params?: Omit<IndustryQueryParams, "name">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Industry>, any>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get industries by sector
|
|
22
|
+
*/
|
|
23
|
+
export declare const getIndustriesBySector: (sectorUuid: string, params?: Omit<IndustryQueryParams, "sector">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Industry>, any>>;
|
|
24
|
+
//# sourceMappingURL=industries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"industries.d.ts","sourceRoot":"","sources":["../src/industries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAKtG,eAAO,MAAM,mBAAmB,GAAI,WAAW,aAAa,KAAG,IAE9D,CAAC;AAWF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,mBAAmB,6EAUzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,0DAE7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAY,MAAM,EAAE,SAAS,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,6EAK9F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,EAAE,SAAS,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,6EAKrG,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic industries service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { INDUSTRY_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
6
|
+
let configuredApiClient = null;
|
|
7
|
+
export const configureIndustries = (apiClient) => {
|
|
8
|
+
configuredApiClient = apiClient;
|
|
9
|
+
};
|
|
10
|
+
const getConfiguredClient = () => {
|
|
11
|
+
if (!configuredApiClient) {
|
|
12
|
+
throw new Error('Industries service not configured. Call configureIndustries(apiClient) before using industry functions.');
|
|
13
|
+
}
|
|
14
|
+
return configuredApiClient;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Get list of industries with optional filtering
|
|
18
|
+
*/
|
|
19
|
+
export const getIndustries = (params) => {
|
|
20
|
+
const queryParams = {};
|
|
21
|
+
if (params?.name)
|
|
22
|
+
queryParams.name = params.name;
|
|
23
|
+
if (params?.sector)
|
|
24
|
+
queryParams.sector = params.sector;
|
|
25
|
+
if (params?.order_by)
|
|
26
|
+
queryParams.order_by = params.order_by;
|
|
27
|
+
if (params?.page)
|
|
28
|
+
queryParams.page = params.page.toString();
|
|
29
|
+
if (params?.page_size)
|
|
30
|
+
queryParams.page_size = params.page_size.toString();
|
|
31
|
+
return getConfiguredClient().get(INDUSTRY_ENDPOINTS.BASE, { params: queryParams });
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Get industry details by UUID
|
|
35
|
+
*/
|
|
36
|
+
export const getIndustryByUuid = (uuid) => {
|
|
37
|
+
return getConfiguredClient().get(`${INDUSTRY_ENDPOINTS.BASE}${uuid}/`);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Search industries by name
|
|
41
|
+
*/
|
|
42
|
+
export const searchIndustries = (searchTerm, params) => {
|
|
43
|
+
return getIndustries({
|
|
44
|
+
...params,
|
|
45
|
+
name: searchTerm,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get industries by sector
|
|
50
|
+
*/
|
|
51
|
+
export const getIndustriesBySector = (sectorUuid, params) => {
|
|
52
|
+
return getIndustries({
|
|
53
|
+
...params,
|
|
54
|
+
sector: sectorUuid,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=industries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"industries.js","sourceRoot":"","sources":["../src/industries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,IAAI,mBAAmB,GAAyB,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAwB,EAAQ,EAAE;IACpE,mBAAmB,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAkB,EAAE;IAC9C,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,yGAAyG,CAC1G,CAAC;IACJ,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAA4B,EAAE,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 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic instruments service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { Instrument, InstrumentSnapshot, InstrumentsQueryParams, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configureInstruments: (apiClient: AxiosInstance) => void;
|
|
8
|
+
export declare const getInstruments: (params?: InstrumentsQueryParams) => Promise<import("axios").AxiosResponse<PaginatedResponse<Instrument>, any>>;
|
|
9
|
+
export declare const getInstrumentByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<Instrument, any>>;
|
|
10
|
+
export declare const getInstrumentSnapshots: (instrumentUuid: string) => Promise<import("axios").AxiosResponse<InstrumentSnapshot[], any>>;
|
|
11
|
+
export declare const getInstrumentSnapshotsFiltered: (instrumentUuid: string, params?: {
|
|
12
|
+
start_date?: string;
|
|
13
|
+
end_date?: string;
|
|
14
|
+
min_price?: number;
|
|
15
|
+
max_price?: number;
|
|
16
|
+
}) => Promise<import("axios").AxiosResponse<InstrumentSnapshot[], any>>;
|
|
17
|
+
/**
|
|
18
|
+
* Batch fetch snapshots for multiple instruments with date filtering
|
|
19
|
+
* This optimizes API calls by using Promise.all with proper error handling
|
|
20
|
+
*/
|
|
21
|
+
export declare const getBatchInstrumentSnapshots: (requests: Array<{
|
|
22
|
+
instrumentUuid: string;
|
|
23
|
+
start_date?: string;
|
|
24
|
+
end_date?: string;
|
|
25
|
+
min_price?: number;
|
|
26
|
+
max_price?: number;
|
|
27
|
+
}>) => Promise<Array<{
|
|
28
|
+
instrumentUuid: string;
|
|
29
|
+
data?: InstrumentSnapshot[];
|
|
30
|
+
error?: string;
|
|
31
|
+
}>>;
|
|
32
|
+
export declare const searchInstruments: (searchTerm: string, params?: Omit<InstrumentsQueryParams, "search">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Instrument>, any>>;
|
|
33
|
+
export declare const getInstrumentsByExchange: (exchangeUuid: string, params?: Omit<InstrumentsQueryParams, "exchange_uuid">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Instrument>, any>>;
|
|
34
|
+
export declare const getETFs: (params?: Omit<InstrumentsQueryParams, "is_etf">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Instrument>, any>>;
|
|
35
|
+
export declare const getFunds: (params?: Omit<InstrumentsQueryParams, "is_fund">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Instrument>, any>>;
|
|
36
|
+
//# sourceMappingURL=instruments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruments.d.ts","sourceRoot":"","sources":["../src/instruments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAKvC,eAAO,MAAM,oBAAoB,GAAI,WAAW,aAAa,KAAG,IAE/D,CAAC;AAWF,eAAO,MAAM,cAAc,GAAI,SAAS,sBAAsB,+EAsB7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,4DAE/C,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,sEAE5D,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,gBAAgB,MAAM,EACtB,SAAS;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,sEAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,UAAU,KAAK,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,KACD,OAAO,CACR,KAAK,CAAC;IACJ,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAmBH,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,EAAE,SAAS,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,+EAKpG,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,cAAc,MAAM,EACpB,SAAS,IAAI,CAAC,sBAAsB,EAAE,eAAe,CAAC,+EAMvD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,SAAS,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,+EAKtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,SAAS,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,+EAKxE,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic instruments service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { INSTRUMENT_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
6
|
+
let configuredApiClient = null;
|
|
7
|
+
export const configureInstruments = (apiClient) => {
|
|
8
|
+
configuredApiClient = apiClient;
|
|
9
|
+
};
|
|
10
|
+
const getConfiguredClient = () => {
|
|
11
|
+
if (!configuredApiClient) {
|
|
12
|
+
throw new Error('Instruments service not configured. Call configureInstruments(apiClient) before using instrument functions.');
|
|
13
|
+
}
|
|
14
|
+
return configuredApiClient;
|
|
15
|
+
};
|
|
16
|
+
export const getInstruments = (params) => {
|
|
17
|
+
const transformedParams = { ...params };
|
|
18
|
+
if (params?.is_etf !== undefined) {
|
|
19
|
+
transformedParams.is_etf = params.is_etf;
|
|
20
|
+
}
|
|
21
|
+
if (params?.is_fund !== undefined) {
|
|
22
|
+
transformedParams.is_fund = params.is_fund;
|
|
23
|
+
}
|
|
24
|
+
const apiParams = {
|
|
25
|
+
...transformedParams,
|
|
26
|
+
};
|
|
27
|
+
if (params?.min_price !== undefined) {
|
|
28
|
+
apiParams.min_price = params.min_price.toString();
|
|
29
|
+
}
|
|
30
|
+
if (params?.max_price !== undefined) {
|
|
31
|
+
apiParams.max_price = params.max_price.toString();
|
|
32
|
+
}
|
|
33
|
+
return getConfiguredClient().get(INSTRUMENT_ENDPOINTS.BASE, {
|
|
34
|
+
params: apiParams,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export const getInstrumentByUuid = (uuid) => {
|
|
38
|
+
return getConfiguredClient().get(`${INSTRUMENT_ENDPOINTS.BASE}${uuid}/`);
|
|
39
|
+
};
|
|
40
|
+
export const getInstrumentSnapshots = (instrumentUuid) => {
|
|
41
|
+
return getConfiguredClient().get(`${INSTRUMENT_ENDPOINTS.BASE}${instrumentUuid}/snapshots/`);
|
|
42
|
+
};
|
|
43
|
+
export const getInstrumentSnapshotsFiltered = (instrumentUuid, params) => {
|
|
44
|
+
return getConfiguredClient().get(`${INSTRUMENT_ENDPOINTS.BASE}${instrumentUuid}/snapshots/`, {
|
|
45
|
+
params,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Batch fetch snapshots for multiple instruments with date filtering
|
|
50
|
+
* This optimizes API calls by using Promise.all with proper error handling
|
|
51
|
+
*/
|
|
52
|
+
export const getBatchInstrumentSnapshots = async (requests) => {
|
|
53
|
+
const promises = requests.map(async ({ instrumentUuid, ...params }) => {
|
|
54
|
+
try {
|
|
55
|
+
const response = await getInstrumentSnapshotsFiltered(instrumentUuid, params);
|
|
56
|
+
return {
|
|
57
|
+
instrumentUuid,
|
|
58
|
+
data: response.data,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error(`Failed to fetch snapshots for instrument ${instrumentUuid}:`, error);
|
|
63
|
+
return {
|
|
64
|
+
instrumentUuid,
|
|
65
|
+
error: error instanceof Error ? error.message : 'Failed to fetch data',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return Promise.all(promises);
|
|
70
|
+
};
|
|
71
|
+
export const searchInstruments = (searchTerm, params) => {
|
|
72
|
+
return getInstruments({
|
|
73
|
+
...params,
|
|
74
|
+
search: searchTerm,
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
export const getInstrumentsByExchange = (exchangeUuid, params) => {
|
|
78
|
+
return getInstruments({
|
|
79
|
+
...params,
|
|
80
|
+
exchange_uuid: exchangeUuid,
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export const getETFs = (params) => {
|
|
84
|
+
return getInstruments({
|
|
85
|
+
...params,
|
|
86
|
+
is_etf: true,
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export const getFunds = (params) => {
|
|
90
|
+
return getInstruments({
|
|
91
|
+
...params,
|
|
92
|
+
is_fund: true,
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=instruments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruments.js","sourceRoot":"","sources":["../src/instruments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,IAAI,mBAAmB,GAAyB,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAwB,EAAQ,EAAE;IACrE,mBAAmB,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAkB,EAAE;IAC9C,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,6GAA6G,CAC9G,CAAC;IACJ,CAAC;IACD,OAAO,m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aAAa,EAAE,YAAY;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAA+C,EAAE,EAAE;IACzE,OAAO,cAAc,CAAC;QACpB,GAAG,MAAM;QACT,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAgD,EAAE,EAAE;IAC3E,OAAO,cAAc,CAAC;QACpB,GAAG,MAAM;QACT,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic investment preferences service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { InvestmentPreference, CreateInvestmentPreference, UpdateInvestmentPreference, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configureInvestmentPreferences: (apiClient: AxiosInstance) => void;
|
|
8
|
+
type PaginatedInvestmentPreferences = PaginatedResponse<InvestmentPreference>;
|
|
9
|
+
export declare const createInvestmentPreference: (data: CreateInvestmentPreference) => Promise<import("axios").AxiosResponse<InvestmentPreference, any>>;
|
|
10
|
+
export declare const updateInvestmentPreference: (uuid: string, data: UpdateInvestmentPreference) => Promise<import("axios").AxiosResponse<InvestmentPreference, any>>;
|
|
11
|
+
export declare const deleteInvestmentPreference: (uuid: string) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
12
|
+
export declare const getInvestmentPreferences: () => Promise<import("axios").AxiosResponse<PaginatedInvestmentPreferences, any>>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=investmentPreferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investmentPreferences.d.ts","sourceRoot":"","sources":["../src/investmentPreferences.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,8BAA8B,GAAI,WAAW,aAAa,KAAG,IAEzE,CAAC;AAWF,KAAK,8BAA8B,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAG9E,eAAO,MAAM,0BAA0B,GAAI,MAAM,0BAA0B,sEAE1E,CAAC;AAGF,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,EAAE,MAAM,0BAA0B,sEAExF,CAAC;AAGF,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,sDAEtD,CAAC;AAGF,eAAO,MAAM,wBAAwB,mFAEpC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic investment preferences service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { INVESTMENT_PREFERENCES_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
6
|
+
let configuredApiClient = null;
|
|
7
|
+
export const configureInvestmentPreferences = (apiClient) => {
|
|
8
|
+
configuredApiClient = apiClient;
|
|
9
|
+
};
|
|
10
|
+
const getConfiguredClient = () => {
|
|
11
|
+
if (!configuredApiClient) {
|
|
12
|
+
throw new Error('Investment preferences service not configured. Call configureInvestmentPreferences(apiClient) before using investment preferences functions.');
|
|
13
|
+
}
|
|
14
|
+
return configuredApiClient;
|
|
15
|
+
};
|
|
16
|
+
// Create a new investment preference
|
|
17
|
+
export const createInvestmentPreference = (data) => {
|
|
18
|
+
return getConfiguredClient().post(INVESTMENT_PREFERENCES_ENDPOINTS.BASE, data);
|
|
19
|
+
};
|
|
20
|
+
// Update an existing investment preference
|
|
21
|
+
export const updateInvestmentPreference = (uuid, data) => {
|
|
22
|
+
return getConfiguredClient().patch(INVESTMENT_PREFERENCES_ENDPOINTS.DETAIL(uuid), data);
|
|
23
|
+
};
|
|
24
|
+
// Delete an investment preference
|
|
25
|
+
export const deleteInvestmentPreference = (uuid) => {
|
|
26
|
+
return getConfiguredClient().delete(INVESTMENT_PREFERENCES_ENDPOINTS.DETAIL(uuid));
|
|
27
|
+
};
|
|
28
|
+
// Get all investment preferences for the current user
|
|
29
|
+
export const getInvestmentPreferences = () => {
|
|
30
|
+
return getConfiguredClient().get(INVESTMENT_PREFERENCES_ENDPOINTS.BASE);
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=investmentPreferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investmentPreferences.js","sourceRoot":"","sources":["../src/investmentPreferences.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAQrF,IAAI,mBAAmB,GAAyB,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,SAAwB,EAAQ,EAAE;IAC/E,mBAAmB,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAkB,EAAE;IAC9C,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,8IAA8I,CAC/I,CAAC;IACJ,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAIF,qCAAqC;AACrC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAgC,EAAE,EAAE;IAC7E,OAAO,mBAAmB,EAAE,CAAC,IAAI,CAAuB,gCAAgC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvG,CAAC,CAAC;AAEF,2CAA2C;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,IAAgC,EAAE,EAAE;IAC3F,OAAO,mBAAmB,EAAE,CAAC,KAAK,CAAuB,gCAAgC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AAChH,CAAC,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,EAAE;IACzD,OAAO,mBAAmB,EAAE,CAAC,MAAM,CAAO,gCAAgC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3F,CAAC,CAAC;AAEF,sDAAsD;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO,mBAAmB,EAAE,CAAC,GAAG,CAAiC,gCAAgC,CAAC,IAAI,CAAC,CAAC;AAC1G,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolio allocations service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { AssetAllocation, CreateAssetAllocation, UpdateAssetAllocation } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configurePortfolioAllocations: (apiClient: AxiosInstance) => void;
|
|
8
|
+
export declare const getPortfolioAllocations: (portfolioUuid: string) => Promise<import("axios").AxiosResponse<AssetAllocation[], any>>;
|
|
9
|
+
export declare const createAssetAllocation: (data: CreateAssetAllocation) => Promise<import("axios").AxiosResponse<AssetAllocation, any>>;
|
|
10
|
+
export declare const updateAssetAllocation: (uuid: string, data: UpdateAssetAllocation) => Promise<import("axios").AxiosResponse<AssetAllocation, any>>;
|
|
11
|
+
export declare const deleteAssetAllocation: (uuid: string) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
12
|
+
//# sourceMappingURL=portfolioAllocations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolioAllocations.d.ts","sourceRoot":"","sources":["../src/portfolioAllocations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAInH,eAAO,MAAM,6BAA6B,GAAI,WAAW,aAAa,KAAG,IAExE,CAAC;AAcF,eAAO,MAAM,uBAAuB,GAAI,eAAe,MAAM,mEAK5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,qBAAqB,iEAEhE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,MAAM,qBAAqB,iEAE9E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,sDAEjD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolio allocations service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { PORTFOLIO_ENDPOINTS, ASSET_ALLOCATION_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
6
|
+
import { ORDER_BY_CREATED_AT, QUERY_PARAM_ORDER_BY } from '@cranberry-money/shared-constants';
|
|
7
|
+
let configuredApiClient = null;
|
|
8
|
+
export const configurePortfolioAllocations = (apiClient) => {
|
|
9
|
+
configuredApiClient = apiClient;
|
|
10
|
+
};
|
|
11
|
+
const getConfiguredClient = () => {
|
|
12
|
+
if (!configuredApiClient) {
|
|
13
|
+
throw new Error('Portfolio allocations service not configured. Call configurePortfolioAllocations(apiClient) before using portfolio allocation functions.');
|
|
14
|
+
}
|
|
15
|
+
return configuredApiClient;
|
|
16
|
+
};
|
|
17
|
+
// ASSET ALLOCATIONS API FUNCTIONS
|
|
18
|
+
// Fetch allocations for a specific portfolio
|
|
19
|
+
export const getPortfolioAllocations = (portfolioUuid) => {
|
|
20
|
+
// Always sort by created_at to show allocations in their creation order
|
|
21
|
+
return getConfiguredClient().get(`${PORTFOLIO_ENDPOINTS.BASE}${portfolioUuid}/allocations/`, {
|
|
22
|
+
params: { [QUERY_PARAM_ORDER_BY]: ORDER_BY_CREATED_AT },
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const createAssetAllocation = (data) => {
|
|
26
|
+
return getConfiguredClient().post(ASSET_ALLOCATION_ENDPOINTS.BASE, data);
|
|
27
|
+
};
|
|
28
|
+
export const updateAssetAllocation = (uuid, data) => {
|
|
29
|
+
return getConfiguredClient().patch(`${ASSET_ALLOCATION_ENDPOINTS.BASE}${uuid}/`, data);
|
|
30
|
+
};
|
|
31
|
+
export const deleteAssetAllocation = (uuid) => {
|
|
32
|
+
return getConfiguredClient().delete(`${ASSET_ALLOCATION_ENDPOINTS.BASE}${uuid}/`);
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=portfolioAllocations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolioAllocations.js","sourceRoot":"","sources":["../src/portfolioAllocations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAG9F,IAAI,mBAAmB,GAAyB,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,SAAwB,EAAQ,EAAE;IAC9E,mBAAmB,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAkB,EAAE;IAC9C,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,0IAA0I,CAC3I,CAAC;IACJ,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAEF,kCAAkC;AAElC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,aAAqB,EAAE,EAAE;IAC/D,wEAAwE;IACxE,OAAO,mBAAmB,EAAE,CAAC,GAAG,CAAoB,GAAG,mBAAmB,CAAC,IAAI,GAAG,aAAa,eAAe,EAAE;QAC9G,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,mBAAmB,EAAE;KACxD,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAA2B,EAAE,EAAE;IACnE,OAAO,mBAAmB,EAAE,CAAC,IAAI,CAAkB,0BAA0B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,IAA2B,EAAE,EAAE;IACjF,OAAO,mBAAmB,EAAE,CAAC,KAAK,CAAkB,GAAG,0BAA0B,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC;AAC1G,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,EAAE;IACpD,OAAO,mBAAmB,EAAE,CAAC,MAAM,CAAO,GAAG,0BAA0B,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;AAC1F,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolio holdings service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { AssetHolding, AssetHoldingSnapshot, AssetHoldingFilters, AssetHoldingSnapshotFilters, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configurePortfolioHoldings: (apiClient: AxiosInstance) => void;
|
|
8
|
+
export declare const getAssetHoldings: (filters?: AssetHoldingFilters) => Promise<import("axios").AxiosResponse<PaginatedResponse<AssetHolding>, any>>;
|
|
9
|
+
export declare const getPortfolioHoldings: (portfolioUuid: string, order_by?: string) => Promise<import("axios").AxiosResponse<AssetHolding[], any>>;
|
|
10
|
+
export declare const getAssetHoldingByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<AssetHolding, any>>;
|
|
11
|
+
export declare const getAssetHoldingSnapshots: (filters?: AssetHoldingSnapshotFilters) => Promise<import("axios").AxiosResponse<PaginatedResponse<AssetHoldingSnapshot>, any>>;
|
|
12
|
+
export declare const getAssetHoldingSnapshotById: (id: number) => Promise<import("axios").AxiosResponse<AssetHoldingSnapshot, any>>;
|
|
13
|
+
//# sourceMappingURL=portfolioHoldings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolioHoldings.d.ts","sourceRoot":"","sources":["../src/portfolioHoldings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAMtC,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,0BAA0B,GAAI,WAAW,aAAa,KAAG,IAErE,CAAC;AAcF,eAAO,MAAM,gBAAgB,GAAI,UAAU,mBAAmB,iFAW7D,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,eAAe,MAAM,EAAE,WAAW,MAAM,gEAK5E,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,8DAEjD,CAAC;AAKF,eAAO,MAAM,wBAAwB,GAAI,UAAU,2BAA2B,yFAW7E,CAAC;AAGF,eAAO,MAAM,2BAA2B,GAAI,IAAI,MAAM,sEAErD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolio holdings service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { PORTFOLIO_ENDPOINTS, ASSET_HOLDING_ENDPOINTS, ASSET_HOLDING_SNAPSHOT_ENDPOINTS, } from '@cranberry-money/shared-constants';
|
|
6
|
+
let configuredApiClient = null;
|
|
7
|
+
export const configurePortfolioHoldings = (apiClient) => {
|
|
8
|
+
configuredApiClient = apiClient;
|
|
9
|
+
};
|
|
10
|
+
const getConfiguredClient = () => {
|
|
11
|
+
if (!configuredApiClient) {
|
|
12
|
+
throw new Error('Portfolio holdings service not configured. Call configurePortfolioHoldings(apiClient) before using portfolio holdings functions.');
|
|
13
|
+
}
|
|
14
|
+
return configuredApiClient;
|
|
15
|
+
};
|
|
16
|
+
// ASSET HOLDINGS API FUNCTIONS
|
|
17
|
+
// Fetch asset holdings with optional filtering
|
|
18
|
+
export const getAssetHoldings = (filters) => {
|
|
19
|
+
const params = {};
|
|
20
|
+
if (filters?.portfolio_id)
|
|
21
|
+
params.portfolio_id = filters.portfolio_id;
|
|
22
|
+
if (filters?.portfolio_uuid)
|
|
23
|
+
params.portfolio_uuid = filters.portfolio_uuid;
|
|
24
|
+
if (filters?.instrument)
|
|
25
|
+
params.instrument = filters.instrument;
|
|
26
|
+
if (filters?.min_quantity)
|
|
27
|
+
params.min_quantity = filters.min_quantity.toString();
|
|
28
|
+
if (filters?.max_quantity)
|
|
29
|
+
params.max_quantity = filters.max_quantity.toString();
|
|
30
|
+
if (filters?.order_by)
|
|
31
|
+
params.order_by = filters.order_by;
|
|
32
|
+
return getConfiguredClient().get(ASSET_HOLDING_ENDPOINTS.BASE, { params });
|
|
33
|
+
};
|
|
34
|
+
// Fetch holdings for a specific portfolio
|
|
35
|
+
export const getPortfolioHoldings = (portfolioUuid, order_by) => {
|
|
36
|
+
const params = {};
|
|
37
|
+
if (order_by)
|
|
38
|
+
params.order_by = order_by;
|
|
39
|
+
return getConfiguredClient().get(`${PORTFOLIO_ENDPOINTS.BASE}${portfolioUuid}/holdings/`, { params });
|
|
40
|
+
};
|
|
41
|
+
// Get asset holding by UUID
|
|
42
|
+
export const getAssetHoldingByUuid = (uuid) => {
|
|
43
|
+
return getConfiguredClient().get(`${ASSET_HOLDING_ENDPOINTS.BASE}${uuid}/`);
|
|
44
|
+
};
|
|
45
|
+
// ASSET HOLDING SNAPSHOTS API FUNCTIONS
|
|
46
|
+
// Fetch asset holding snapshots with optional filtering
|
|
47
|
+
export const getAssetHoldingSnapshots = (filters) => {
|
|
48
|
+
const params = {};
|
|
49
|
+
if (filters?.asset_holding_id)
|
|
50
|
+
params.asset_holding_id = filters.asset_holding_id;
|
|
51
|
+
if (filters?.portfolio_id)
|
|
52
|
+
params.portfolio_id = filters.portfolio_id;
|
|
53
|
+
if (filters?.reason)
|
|
54
|
+
params.reason = filters.reason;
|
|
55
|
+
if (filters?.start_date)
|
|
56
|
+
params.start_date = filters.start_date;
|
|
57
|
+
if (filters?.end_date)
|
|
58
|
+
params.end_date = filters.end_date;
|
|
59
|
+
if (filters?.order_by)
|
|
60
|
+
params.order_by = filters.order_by;
|
|
61
|
+
return getConfiguredClient().get(ASSET_HOLDING_SNAPSHOT_ENDPOINTS.BASE, { params });
|
|
62
|
+
};
|
|
63
|
+
// Get asset holding snapshot by ID
|
|
64
|
+
export const getAssetHoldingSnapshotById = (id) => {
|
|
65
|
+
return getConfiguredClient().get(`${ASSET_HOLDING_SNAPSHOT_ENDPOINTS.BASE}${id}/`);
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=portfolioHoldings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolioHoldings.js","sourceRoot":"","sources":["../src/portfolioHoldings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,mCAAmC,CAAC;AAS3C,IAAI,mBAAmB,GAAyB,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,SAAwB,EAAQ,EAAE;IAC3E,mBAAmB,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAkB,EAAE;IAC9C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
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolio templates service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { PortfolioTemplate, TargetAssetAllocation, ApplyTemplateResponse, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configurePortfolioTemplates: (apiClient: AxiosInstance) => void;
|
|
8
|
+
type PaginatedPortfolioTemplates = PaginatedResponse<PortfolioTemplate>;
|
|
9
|
+
export declare const getPortfolioTemplates: () => Promise<import("axios").AxiosResponse<PaginatedPortfolioTemplates, any>>;
|
|
10
|
+
export declare const getRecommendedPortfolioTemplate: () => Promise<import("axios").AxiosResponse<PortfolioTemplate, any>>;
|
|
11
|
+
export declare const getPortfolioTemplateAllocations: (templateUuid: string) => Promise<import("axios").AxiosResponse<TargetAssetAllocation[], any>>;
|
|
12
|
+
export declare const applyPortfolioTemplate: (templateUuid: string) => Promise<import("axios").AxiosResponse<ApplyTemplateResponse, any>>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=portfolioTemplates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolioTemplates.d.ts","sourceRoot":"","sources":["../src/portfolioTemplates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,2BAA2B,GAAI,WAAW,aAAa,KAAG,IAEtE,CAAC;AAWF,KAAK,2BAA2B,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AAExE,eAAO,MAAM,qBAAqB,gFAEjC,CAAC;AAEF,eAAO,MAAM,+BAA+B,sEAE3C,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,cAAc,MAAM,yEAEnE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,cAAc,MAAM,uEAE1D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolio templates service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { PORTFOLIO_TEMPLATE_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
6
|
+
let configuredApiClient = null;
|
|
7
|
+
export const configurePortfolioTemplates = (apiClient) => {
|
|
8
|
+
configuredApiClient = apiClient;
|
|
9
|
+
};
|
|
10
|
+
const getConfiguredClient = () => {
|
|
11
|
+
if (!configuredApiClient) {
|
|
12
|
+
throw new Error('Portfolio templates service not configured. Call configurePortfolioTemplates(apiClient) before using portfolio template functions.');
|
|
13
|
+
}
|
|
14
|
+
return configuredApiClient;
|
|
15
|
+
};
|
|
16
|
+
export const getPortfolioTemplates = () => {
|
|
17
|
+
return getConfiguredClient().get(PORTFOLIO_TEMPLATE_ENDPOINTS.BASE);
|
|
18
|
+
};
|
|
19
|
+
export const getRecommendedPortfolioTemplate = () => {
|
|
20
|
+
return getConfiguredClient().get(PORTFOLIO_TEMPLATE_ENDPOINTS.RECOMMENDED);
|
|
21
|
+
};
|
|
22
|
+
export const getPortfolioTemplateAllocations = (templateUuid) => {
|
|
23
|
+
return getConfiguredClient().get(`${PORTFOLIO_TEMPLATE_ENDPOINTS.BASE}${templateUuid}/allocations/`);
|
|
24
|
+
};
|
|
25
|
+
export const applyPortfolioTemplate = (templateUuid) => {
|
|
26
|
+
return getConfiguredClient().post(`${PORTFOLIO_TEMPLATE_ENDPOINTS.BASE}${templateUuid}/apply/`, {});
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=portfolioTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolioTemplates.js","sourceRoot":"","sources":["../src/portfolioT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
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import type { Portfolio, CreatePortfolio, UpdatePortfolio, BlueberryRebalancingTradesGenerationResponse as RebalancingTradesGenerationResponse, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
7
|
+
export declare const configurePortfolios: (apiClient: AxiosInstance) => void;
|
|
8
|
+
type PaginatedPortfolios = PaginatedResponse<Portfolio>;
|
|
9
|
+
export declare const getPortfolios: () => Promise<import("axios").AxiosResponse<PaginatedPortfolios, any>>;
|
|
10
|
+
export declare const createPortfolio: (data: CreatePortfolio) => Promise<import("axios").AxiosResponse<Portfolio, any>>;
|
|
11
|
+
export declare const updatePortfolio: (uuid: string, data: UpdatePortfolio) => Promise<import("axios").AxiosResponse<Portfolio, any>>;
|
|
12
|
+
export declare const getPortfolioByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<Portfolio, any>>;
|
|
13
|
+
export declare const generateRebalancingTrades: (portfolioUuid: string) => Promise<import("axios").AxiosResponse<RebalancingTradesGenerationResponse, any>>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=portfolios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../src/portfolios.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,eAAe,EACf,4CAA4C,IAAI,mCAAmC,EACnF,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,mBAAmB,GAAI,WAAW,aAAa,KAAG,IAE9D,CAAC;AAWF,KAAK,mBAAmB,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAGxD,eAAO,MAAM,aAAa,wEAEzB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,eAAe,2DAEpD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,MAAM,eAAe,2DAElE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,2DAE9C,CAAC;AAGF,eAAO,MAAM,yBAAyB,GAAI,eAAe,MAAM,qFAI9D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic portfolios service functions.
|
|
3
|
+
* Works with any axios-compatible API client.
|
|
4
|
+
*/
|
|
5
|
+
import { PORTFOLIO_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
6
|
+
let configuredApiClient = null;
|
|
7
|
+
export const configurePortfolios = (apiClient) => {
|
|
8
|
+
configuredApiClient = apiClient;
|
|
9
|
+
};
|
|
10
|
+
const getConfiguredClient = () => {
|
|
11
|
+
if (!configuredApiClient) {
|
|
12
|
+
throw new Error('Portfolios service not configured. Call configurePortfolios(apiClient) before using portfolio functions.');
|
|
13
|
+
}
|
|
14
|
+
return configuredApiClient;
|
|
15
|
+
};
|
|
16
|
+
// Portfolio CRUD operations
|
|
17
|
+
export const getPortfolios = () => {
|
|
18
|
+
return getConfiguredClient().get(PORTFOLIO_ENDPOINTS.BASE);
|
|
19
|
+
};
|
|
20
|
+
export const createPortfolio = (data) => {
|
|
21
|
+
return getConfiguredClient().post(PORTFOLIO_ENDPOINTS.BASE, data);
|
|
22
|
+
};
|
|
23
|
+
export const updatePortfolio = (uuid, data) => {
|
|
24
|
+
return getConfiguredClient().patch(`${PORTFOLIO_ENDPOINTS.BASE}${uuid}/`, data);
|
|
25
|
+
};
|
|
26
|
+
export const getPortfolioByUuid = (uuid) => {
|
|
27
|
+
return getConfiguredClient().get(`${PORTFOLIO_ENDPOINTS.BASE}${uuid}/`);
|
|
28
|
+
};
|
|
29
|
+
// Portfolio rebalancing operations
|
|
30
|
+
export const generateRebalancingTrades = (portfolioUuid) => {
|
|
31
|
+
return getConfiguredClient().post(`${PORTFOLIO_ENDPOINTS.BASE}${portfolioUuid}/generate-rebalancing-tr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I,GAAG,IAAI,GAAG,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,mCAAmC;AACnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,aAAqB,EAAE,EAAE;IACjE,OAAO,mBAAmB,EAAE,CAAC,IAAI,CAC/B,GAAG,mBAAmB,CAAC,IAAI,GAAG,aAAa,+BAA+B,CAC3E,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sector API service functions.
|
|
3
|
+
*/
|
|
4
|
+
import { AxiosInstance } from 'axios';
|
|
5
|
+
import type { Sector, SectorQueryParams, PaginatedResponse } from '@cranberry-money/shared-types';
|
|
6
|
+
export declare const configureSectors: (apiClient: AxiosInstance) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Get list of sectors with optional filtering
|
|
9
|
+
*/
|
|
10
|
+
export declare const getSectors: (params?: SectorQueryParams) => Promise<import("axios").AxiosResponse<PaginatedResponse<Sector>, any>>;
|
|
11
|
+
/**
|
|
12
|
+
* Get sector details by UUID
|
|
13
|
+
*/
|
|
14
|
+
export declare const getSectorByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<Sector, any>>;
|
|
15
|
+
/**
|
|
16
|
+
* Search sectors by name
|
|
17
|
+
*/
|
|
18
|
+
export declare const searchSectors: (searchTerm: string, params?: Omit<SectorQueryParams, "name">) => Promise<import("axios").AxiosResponse<PaginatedResponse<Sector>, any>>;
|
|
19
|
+
//# sourceMappingURL=sectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sectors.d.ts","sourceRoot":"","sources":["../src/sectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAKlG,eAAO,MAAM,gBAAgB,GAAI,WAAW,aAAa,KAAG,IAE3D,CAAC;AAWF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,iBAAiB,2EASpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,wDAE3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,YAAY,MAAM,EAAE,SAAS,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,2EAKzF,CAAC"}
|
package/dist/sectors.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sector API service functions.
|
|
3
|
+
*/
|
|
4
|
+
import { SECTOR_ENDPOINTS } from '@cranberry-money/shared-constants';
|
|
5
|
+
let configuredApiClient = null;
|
|
6
|
+
export const configureSectors = (apiClient) => {
|
|
7
|
+
configuredApiClient = apiClient;
|
|
8
|
+
};
|
|
9
|
+
const getConfiguredClient = () => {
|
|
10
|
+
if (!configuredApiClient) {
|
|
11
|
+
throw new Error('Sectors service not configured. Call configureSectors(apiClient) before using sectors functions.');
|
|
12
|
+
}
|
|
13
|
+
return configuredApiClient;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Get list of sectors with optional filtering
|
|
17
|
+
*/
|
|
18
|
+
export const getSectors = (params) => {
|
|
19
|
+
const queryParams = {};
|
|
20
|
+
if (params?.name)
|
|
21
|
+
queryParams.name = params.name;
|
|
22
|
+
if (params?.order_by)
|
|
23
|
+
queryParams.order_by = params.order_by;
|
|
24
|
+
if (params?.page)
|
|
25
|
+
queryParams.page = params.page.toString();
|
|
26
|
+
if (params?.page_size)
|
|
27
|
+
queryParams.page_size = params.page_size.toString();
|
|
28
|
+
return getConfiguredClient().get(SECTOR_ENDPOINTS.BASE, { params: queryParams });
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Get sector details by UUID
|
|
32
|
+
*/
|
|
33
|
+
export const getSectorByUuid = (uuid) => {
|
|
34
|
+
return getConfiguredClient().get(`${SECTOR_ENDPOINTS.BASE}${uuid}/`);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Search sectors by name
|
|
38
|
+
*/
|
|
39
|
+
export const searchSectors = (searchTerm, params) => {
|
|
40
|
+
return getSectors({
|
|
41
|
+
...params,
|
|
42
|
+
name: searchTerm,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=sectors.js.map
|