@cranberry-money/shared-constants 8.9.1 → 8.9.2
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/api/auth.d.ts +21 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +24 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/config.d.ts +36 -0
- package/dist/api/config.d.ts.map +1 -0
- package/dist/api/config.js +45 -0
- package/dist/api/config.js.map +1 -0
- package/dist/api/endpoints.d.ts +157 -0
- package/dist/api/endpoints.d.ts.map +1 -0
- package/dist/api/endpoints.js +185 -0
- package/dist/api/endpoints.js.map +1 -0
- package/dist/api/http.d.ts +57 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +63 -0
- package/dist/api/http.js.map +1 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +9 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/services.d.ts +9 -0
- package/dist/api/services.d.ts.map +1 -0
- package/dist/api/services.js +9 -0
- package/dist/api/services.js.map +1 -0
- package/dist/business/accounts.d.ts +38 -0
- package/dist/business/accounts.d.ts.map +1 -0
- package/dist/business/accounts.js +54 -0
- package/dist/business/accounts.js.map +1 -0
- package/dist/business/bank-accounts.d.ts +71 -0
- package/dist/business/bank-accounts.d.ts.map +1 -0
- package/dist/business/bank-accounts.js +70 -0
- package/dist/business/bank-accounts.js.map +1 -0
- package/dist/business/banking.d.ts +44 -0
- package/dist/business/banking.d.ts.map +1 -0
- package/dist/business/banking.js +70 -0
- package/dist/business/banking.js.map +1 -0
- package/dist/business/cache.d.ts +9 -0
- package/dist/business/cache.d.ts.map +1 -0
- package/dist/business/cache.js +9 -0
- package/dist/business/cache.js.map +1 -0
- package/dist/business/countries.d.ts +11 -0
- package/dist/business/countries.d.ts.map +1 -0
- package/dist/business/countries.js +12 -0
- package/dist/business/countries.js.map +1 -0
- package/dist/business/documents.d.ts +48 -0
- package/dist/business/documents.d.ts.map +1 -0
- package/dist/business/documents.js +76 -0
- package/dist/business/documents.js.map +1 -0
- package/dist/business/holdings.d.ts +34 -0
- package/dist/business/holdings.d.ts.map +1 -0
- package/dist/business/holdings.js +35 -0
- package/dist/business/holdings.js.map +1 -0
- package/dist/business/index.d.ts +16 -0
- package/dist/business/index.d.ts.map +1 -0
- package/dist/business/index.js +28 -0
- package/dist/business/index.js.map +1 -0
- package/dist/business/industries.d.ts +9 -0
- package/dist/business/industries.d.ts.map +1 -0
- package/dist/business/industries.js +10 -0
- package/dist/business/industries.js.map +1 -0
- package/dist/business/investments.d.ts +87 -0
- package/dist/business/investments.d.ts.map +1 -0
- package/dist/business/investments.js +94 -0
- package/dist/business/investments.js.map +1 -0
- package/dist/business/status/banks.d.ts +29 -0
- package/dist/business/status/banks.d.ts.map +1 -0
- package/dist/business/status/banks.js +36 -0
- package/dist/business/status/banks.js.map +1 -0
- package/dist/business/status/cash-accounts.d.ts +56 -0
- package/dist/business/status/cash-accounts.d.ts.map +1 -0
- package/dist/business/status/cash-accounts.js +63 -0
- package/dist/business/status/cash-accounts.js.map +1 -0
- package/dist/business/status/documents.d.ts +25 -0
- package/dist/business/status/documents.d.ts.map +1 -0
- package/dist/business/status/documents.js +35 -0
- package/dist/business/status/documents.js.map +1 -0
- package/dist/business/status/index.d.ts +11 -0
- package/dist/business/status/index.d.ts.map +1 -0
- package/dist/business/status/index.js +11 -0
- package/dist/business/status/index.js.map +1 -0
- package/dist/business/status/instruments.d.ts +42 -0
- package/dist/business/status/instruments.d.ts.map +1 -0
- package/dist/business/status/instruments.js +56 -0
- package/dist/business/status/instruments.js.map +1 -0
- package/dist/business/status/portfolios.d.ts +18 -0
- package/dist/business/status/portfolios.d.ts.map +1 -0
- package/dist/business/status/portfolios.js +22 -0
- package/dist/business/status/portfolios.js.map +1 -0
- package/dist/business/status/trades.d.ts +89 -0
- package/dist/business/status/trades.d.ts.map +1 -0
- package/dist/business/status/trades.js +131 -0
- package/dist/business/status/trades.js.map +1 -0
- package/dist/business/status/withdrawals.d.ts +104 -0
- package/dist/business/status/withdrawals.d.ts.map +1 -0
- package/dist/business/status/withdrawals.js +154 -0
- package/dist/business/status/withdrawals.js.map +1 -0
- package/dist/business/trading.d.ts +52 -0
- package/dist/business/trading.d.ts.map +1 -0
- package/dist/business/trading.js +69 -0
- package/dist/business/trading.js.map +1 -0
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +2 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/statuses.d.ts +18 -0
- package/dist/common/statuses.d.ts.map +1 -0
- package/dist/common/statuses.js +18 -0
- package/dist/common/statuses.js.map +1 -0
- package/dist/config/defaults.d.ts +68 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +67 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/pagination.d.ts +28 -0
- package/dist/config/pagination.d.ts.map +1 -0
- package/dist/config/pagination.js +41 -0
- package/dist/config/pagination.js.map +1 -0
- package/dist/config/thresholds.d.ts +65 -0
- package/dist/config/thresholds.d.ts.map +1 -0
- package/dist/config/thresholds.js +83 -0
- package/dist/config/thresholds.js.map +1 -0
- package/dist/financial/currency.d.ts +38 -0
- package/dist/financial/currency.d.ts.map +1 -0
- package/dist/financial/currency.js +76 -0
- package/dist/financial/currency.js.map +1 -0
- package/dist/financial/formatting.d.ts +52 -0
- package/dist/financial/formatting.d.ts.map +1 -0
- package/dist/financial/formatting.js +50 -0
- package/dist/financial/formatting.js.map +1 -0
- package/dist/financial/index.d.ts +7 -0
- package/dist/financial/index.d.ts.map +1 -0
- package/dist/financial/index.js +7 -0
- package/dist/financial/index.js.map +1 -0
- package/dist/financial/instruments.d.ts +51 -0
- package/dist/financial/instruments.d.ts.map +1 -0
- package/dist/financial/instruments.js +69 -0
- package/dist/financial/instruments.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/cache.d.ts +47 -0
- package/dist/ui/cache.d.ts.map +1 -0
- package/dist/ui/cache.js +46 -0
- package/dist/ui/cache.js.map +1 -0
- package/dist/ui/chart-config.d.ts +35 -0
- package/dist/ui/chart-config.d.ts.map +1 -0
- package/dist/ui/chart-config.js +34 -0
- package/dist/ui/chart-config.js.map +1 -0
- package/dist/ui/colors.d.ts +53 -0
- package/dist/ui/colors.d.ts.map +1 -0
- package/dist/ui/colors.js +95 -0
- package/dist/ui/colors.js.map +1 -0
- package/dist/ui/display.d.ts +69 -0
- package/dist/ui/display.d.ts.map +1 -0
- package/dist/ui/display.js +81 -0
- package/dist/ui/display.js.map +1 -0
- package/dist/ui/index.d.ts +13 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +13 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/labels/index.d.ts +20 -0
- package/dist/ui/labels/index.d.ts.map +1 -0
- package/dist/ui/labels/index.js +24 -0
- package/dist/ui/labels/index.js.map +1 -0
- package/dist/ui/navigation.d.ts +45 -0
- package/dist/ui/navigation.d.ts.map +1 -0
- package/dist/ui/navigation.js +48 -0
- package/dist/ui/navigation.js.map +1 -0
- package/dist/ui/status-colors-unified.d.ts +91 -0
- package/dist/ui/status-colors-unified.d.ts.map +1 -0
- package/dist/ui/status-colors-unified.js +107 -0
- package/dist/ui/status-colors-unified.js.map +1 -0
- package/dist/ui/timing.d.ts +26 -0
- package/dist/ui/timing.d.ts.map +1 -0
- package/dist/ui/timing.js +25 -0
- package/dist/ui/timing.js.map +1 -0
- package/dist/ui/zIndex.d.ts +80 -0
- package/dist/ui/zIndex.d.ts.map +1 -0
- package/dist/ui/zIndex.js +78 -0
- package/dist/ui/zIndex.js.map +1 -0
- package/dist/utilities/common.d.ts +29 -0
- package/dist/utilities/common.d.ts.map +1 -0
- package/dist/utilities/common.js +29 -0
- package/dist/utilities/common.js.map +1 -0
- package/dist/utilities/defaults.d.ts +52 -0
- package/dist/utilities/defaults.d.ts.map +1 -0
- package/dist/utilities/defaults.js +69 -0
- package/dist/utilities/defaults.js.map +1 -0
- package/dist/utilities/index.d.ts +9 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +9 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/sorting.d.ts +45 -0
- package/dist/utilities/sorting.d.ts.map +1 -0
- package/dist/utilities/sorting.js +52 -0
- package/dist/utilities/sorting.js.map +1 -0
- package/dist/utilities/time.d.ts +53 -0
- package/dist/utilities/time.d.ts.map +1 -0
- package/dist/utilities/time.js +66 -0
- package/dist/utilities/time.js.map +1 -0
- package/dist/utilities/validation.d.ts +57 -0
- package/dist/utilities/validation.d.ts.map +1 -0
- package/dist/utilities/validation.js +66 -0
- package/dist/utilities/validation.js.map +1 -0
- package/dist/validation/index.d.ts +27 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +27 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +17 -15
- package/README.md +0 -146
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sorting-related constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const SORT_DIRECTION: {
|
|
5
|
+
readonly ASC: "asc";
|
|
6
|
+
readonly DESC: "desc";
|
|
7
|
+
};
|
|
8
|
+
export type SortDirection = (typeof SORT_DIRECTION)[keyof typeof SORT_DIRECTION];
|
|
9
|
+
export declare const SORT_FIELDS: {
|
|
10
|
+
readonly CREATED_AT: "created_at";
|
|
11
|
+
readonly UPDATED_AT: "updated_at";
|
|
12
|
+
readonly DATE: "date";
|
|
13
|
+
readonly NAME: "name";
|
|
14
|
+
readonly TITLE: "title";
|
|
15
|
+
readonly AMOUNT: "amount";
|
|
16
|
+
readonly VALUE: "value";
|
|
17
|
+
readonly PRICE: "price";
|
|
18
|
+
readonly QUANTITY: "quantity";
|
|
19
|
+
readonly STATUS: "status";
|
|
20
|
+
readonly PRIORITY: "priority";
|
|
21
|
+
readonly SYMBOL: "symbol";
|
|
22
|
+
readonly TYPE: "type";
|
|
23
|
+
};
|
|
24
|
+
export type SortField = (typeof SORT_FIELDS)[keyof typeof SORT_FIELDS];
|
|
25
|
+
export declare const DEFAULT_SORT_CONFIG: {
|
|
26
|
+
readonly PORTFOLIOS: {
|
|
27
|
+
readonly field: "updated_at";
|
|
28
|
+
readonly direction: "desc";
|
|
29
|
+
};
|
|
30
|
+
readonly TRADES: {
|
|
31
|
+
readonly field: "created_at";
|
|
32
|
+
readonly direction: "desc";
|
|
33
|
+
};
|
|
34
|
+
readonly WITHDRAWALS: {
|
|
35
|
+
readonly field: "created_at";
|
|
36
|
+
readonly direction: "desc";
|
|
37
|
+
};
|
|
38
|
+
readonly TRANSACTIONS: {
|
|
39
|
+
readonly field: "date";
|
|
40
|
+
readonly direction: "desc";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const SORT_DIRECTION_ASC: "asc";
|
|
44
|
+
export declare const SORT_DIRECTION_DESC: "desc";
|
|
45
|
+
//# sourceMappingURL=sorting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../src/utilities/sorting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAGjF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;CAuBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAGvE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;CAiBtB,CAAC;AAGX,eAAO,MAAM,kBAAkB,OAAqB,CAAC;AACrD,eAAO,MAAM,mBAAmB,QAAsB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sorting-related constants
|
|
3
|
+
*/
|
|
4
|
+
// Sort directions
|
|
5
|
+
export const SORT_DIRECTION = {
|
|
6
|
+
ASC: 'asc',
|
|
7
|
+
DESC: 'desc',
|
|
8
|
+
};
|
|
9
|
+
// Common sort fields
|
|
10
|
+
export const SORT_FIELDS = {
|
|
11
|
+
// Time-based
|
|
12
|
+
CREATED_AT: 'created_at',
|
|
13
|
+
UPDATED_AT: 'updated_at',
|
|
14
|
+
DATE: 'date',
|
|
15
|
+
// Name-based
|
|
16
|
+
NAME: 'name',
|
|
17
|
+
TITLE: 'title',
|
|
18
|
+
// Value-based
|
|
19
|
+
AMOUNT: 'amount',
|
|
20
|
+
VALUE: 'value',
|
|
21
|
+
PRICE: 'price',
|
|
22
|
+
QUANTITY: 'quantity',
|
|
23
|
+
// Status-based
|
|
24
|
+
STATUS: 'status',
|
|
25
|
+
PRIORITY: 'priority',
|
|
26
|
+
// Other
|
|
27
|
+
SYMBOL: 'symbol',
|
|
28
|
+
TYPE: 'type',
|
|
29
|
+
};
|
|
30
|
+
// Default sort configurations
|
|
31
|
+
export const DEFAULT_SORT_CONFIG = {
|
|
32
|
+
PORTFOLIOS: {
|
|
33
|
+
field: SORT_FIELDS.UPDATED_AT,
|
|
34
|
+
direction: SORT_DIRECTION.DESC,
|
|
35
|
+
},
|
|
36
|
+
TRADES: {
|
|
37
|
+
field: SORT_FIELDS.CREATED_AT,
|
|
38
|
+
direction: SORT_DIRECTION.DESC,
|
|
39
|
+
},
|
|
40
|
+
WITHDRAWALS: {
|
|
41
|
+
field: SORT_FIELDS.CREATED_AT,
|
|
42
|
+
direction: SORT_DIRECTION.DESC,
|
|
43
|
+
},
|
|
44
|
+
TRANSACTIONS: {
|
|
45
|
+
field: SORT_FIELDS.DATE,
|
|
46
|
+
direction: SORT_DIRECTION.DESC,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
// Blueberry compatibility exports
|
|
50
|
+
export const SORT_DIRECTION_ASC = SORT_DIRECTION.ASC;
|
|
51
|
+
export const SORT_DIRECTION_DESC = SORT_DIRECTION.DESC;
|
|
52
|
+
//# sourceMappingURL=sorting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting.js","sourceRoot":"","sources":["../../src/utilities/sorting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,kBAAkB;AAClB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC;AAIX,qBAAqB;AACrB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,aAAa;IACb,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,MAAM;IAEZ,aAAa;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IAEd,cAAc;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IAEpB,eAAe;IACf,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IAEpB,QAAQ;IACR,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;CACJ,CAAC;AAIX,8BAA8B;AAC9B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE;QACV,KAAK,EAAE,WAAW,CAAC,UAAU;QAC7B,SAAS,EAAE,cAAc,CAAC,IAAI;KAC/B;IACD,MAAM,EAAE;QACN,KAAK,EAAE,WAAW,CAAC,UAAU;QAC7B,SAAS,EAAE,cAAc,CAAC,IAAI;KAC/B;IACD,WAAW,EAAE;QACX,KAAK,EAAE,WAAW,CAAC,UAAU;QAC7B,SAAS,EAAE,cAAc,CAAC,IAAI;KAC/B;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,WAAW,CAAC,IAAI;QACvB,SAAS,EAAE,cAAc,CAAC,IAAI;KAC/B;CACO,CAAC;AAEX,kCAAkC;AAClC,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC,GAAG,CAAC;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-related constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const MILLISECONDS: {
|
|
5
|
+
readonly SECOND: 1000;
|
|
6
|
+
readonly MINUTE: number;
|
|
7
|
+
readonly HOUR: number;
|
|
8
|
+
readonly DAY: number;
|
|
9
|
+
readonly WEEK: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const SECONDS: {
|
|
12
|
+
readonly MINUTE: 60;
|
|
13
|
+
readonly HOUR: number;
|
|
14
|
+
readonly DAY: number;
|
|
15
|
+
readonly WEEK: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const DATE_FORMATS: {
|
|
18
|
+
readonly DISPLAY_DATE: "MMM dd, yyyy";
|
|
19
|
+
readonly DISPLAY_DATE_TIME: "MMM dd, yyyy HH:mm";
|
|
20
|
+
readonly DISPLAY_DATE_TIME_SECONDS: "MMM dd, yyyy HH:mm:ss";
|
|
21
|
+
readonly DISPLAY_SHORT: "MM/dd/yy";
|
|
22
|
+
readonly API_DATE: "yyyy-MM-dd";
|
|
23
|
+
readonly API_DATETIME: "yyyy-MM-dd'T'HH:mm:ss";
|
|
24
|
+
readonly API_DATETIME_WITH_TIMEZONE: "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
|
25
|
+
readonly MONTH_YEAR: "MMM yyyy";
|
|
26
|
+
readonly YEAR: "yyyy";
|
|
27
|
+
readonly TIME: "HH:mm";
|
|
28
|
+
readonly TIME_WITH_SECONDS: "HH:mm:ss";
|
|
29
|
+
};
|
|
30
|
+
export declare const TIME_ZONES: {
|
|
31
|
+
readonly UTC: "UTC";
|
|
32
|
+
readonly EST: "America/New_York";
|
|
33
|
+
readonly PST: "America/Los_Angeles";
|
|
34
|
+
readonly SYDNEY: "Australia/Sydney";
|
|
35
|
+
readonly MELBOURNE: "Australia/Melbourne";
|
|
36
|
+
};
|
|
37
|
+
export type TimeZone = (typeof TIME_ZONES)[keyof typeof TIME_ZONES];
|
|
38
|
+
export declare const SESSION_DURATIONS: {
|
|
39
|
+
readonly DEFAULT: number;
|
|
40
|
+
readonly EXTENDED: number;
|
|
41
|
+
readonly REMEMBER_ME: number;
|
|
42
|
+
};
|
|
43
|
+
export declare const MILLISECONDS_PER_DAY: number;
|
|
44
|
+
export declare const DEFAULT_RECENT_TRANSACTIONS_DAYS = 30;
|
|
45
|
+
export declare const DATE_ISO_TIME_SEPARATOR = "T";
|
|
46
|
+
export type TimeRange = '1W' | '1M' | '6M' | '1Y' | '3Y' | '5Y' | '10Y';
|
|
47
|
+
export interface TimeRangeConfig {
|
|
48
|
+
label: string;
|
|
49
|
+
value: TimeRange;
|
|
50
|
+
days: number;
|
|
51
|
+
}
|
|
52
|
+
export declare const TIME_RANGES: TimeRangeConfig[];
|
|
53
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utilities/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAGX,eAAO,MAAM,OAAO;;;;;CAKV,CAAC;AAGX,eAAO,MAAM,YAAY;;;;;;;;;;;;CAiBf,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAGpE,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAGX,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AAGxD,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAGnD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAG3C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAGxE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,eAAO,MAAM,WAAW,EAAE,eAAe,EAQxC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-related constants
|
|
3
|
+
*/
|
|
4
|
+
// Time conversions in milliseconds
|
|
5
|
+
export const MILLISECONDS = {
|
|
6
|
+
SECOND: 1000,
|
|
7
|
+
MINUTE: 60 * 1000,
|
|
8
|
+
HOUR: 60 * 60 * 1000,
|
|
9
|
+
DAY: 24 * 60 * 60 * 1000,
|
|
10
|
+
WEEK: 7 * 24 * 60 * 60 * 1000,
|
|
11
|
+
};
|
|
12
|
+
// Time conversions in seconds
|
|
13
|
+
export const SECONDS = {
|
|
14
|
+
MINUTE: 60,
|
|
15
|
+
HOUR: 60 * 60,
|
|
16
|
+
DAY: 24 * 60 * 60,
|
|
17
|
+
WEEK: 7 * 24 * 60 * 60,
|
|
18
|
+
};
|
|
19
|
+
// Common date formats
|
|
20
|
+
export const DATE_FORMATS = {
|
|
21
|
+
// Display formats
|
|
22
|
+
DISPLAY_DATE: 'MMM dd, yyyy',
|
|
23
|
+
DISPLAY_DATE_TIME: 'MMM dd, yyyy HH:mm',
|
|
24
|
+
DISPLAY_DATE_TIME_SECONDS: 'MMM dd, yyyy HH:mm:ss',
|
|
25
|
+
DISPLAY_SHORT: 'MM/dd/yy',
|
|
26
|
+
// API formats
|
|
27
|
+
API_DATE: 'yyyy-MM-dd',
|
|
28
|
+
API_DATETIME: "yyyy-MM-dd'T'HH:mm:ss",
|
|
29
|
+
API_DATETIME_WITH_TIMEZONE: "yyyy-MM-dd'T'HH:mm:ss'Z'",
|
|
30
|
+
// Other formats
|
|
31
|
+
MONTH_YEAR: 'MMM yyyy',
|
|
32
|
+
YEAR: 'yyyy',
|
|
33
|
+
TIME: 'HH:mm',
|
|
34
|
+
TIME_WITH_SECONDS: 'HH:mm:ss',
|
|
35
|
+
};
|
|
36
|
+
// Time zones
|
|
37
|
+
export const TIME_ZONES = {
|
|
38
|
+
UTC: 'UTC',
|
|
39
|
+
EST: 'America/New_York',
|
|
40
|
+
PST: 'America/Los_Angeles',
|
|
41
|
+
SYDNEY: 'Australia/Sydney',
|
|
42
|
+
MELBOURNE: 'Australia/Melbourne',
|
|
43
|
+
};
|
|
44
|
+
// Session durations
|
|
45
|
+
export const SESSION_DURATIONS = {
|
|
46
|
+
DEFAULT: 30 * 60 * 1000, // 30 minutes
|
|
47
|
+
EXTENDED: 24 * 60 * 60 * 1000, // 24 hours
|
|
48
|
+
REMEMBER_ME: 30 * 24 * 60 * 60 * 1000, // 30 days
|
|
49
|
+
};
|
|
50
|
+
// Time unit constants (matching Blueberry)
|
|
51
|
+
export const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
52
|
+
// Default time periods
|
|
53
|
+
export const DEFAULT_RECENT_TRANSACTIONS_DAYS = 30;
|
|
54
|
+
// Date format patterns
|
|
55
|
+
export const DATE_ISO_TIME_SEPARATOR = 'T';
|
|
56
|
+
// Time range configurations with labels and day counts
|
|
57
|
+
export const TIME_RANGES = [
|
|
58
|
+
{ label: '1W', value: '1W', days: 7 },
|
|
59
|
+
{ label: '1M', value: '1M', days: 30 },
|
|
60
|
+
{ label: '6M', value: '6M', days: 180 },
|
|
61
|
+
{ label: '1Y', value: '1Y', days: 365 },
|
|
62
|
+
{ label: '3Y', value: '3Y', days: 1095 },
|
|
63
|
+
{ label: '5Y', value: '5Y', days: 1825 },
|
|
64
|
+
{ label: '10Y', value: '10Y', days: 3650 },
|
|
65
|
+
];
|
|
66
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/utilities/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,EAAE,GAAG,IAAI;IACjB,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IACpB,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACxB,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;CACrB,CAAC;AAEX,8BAA8B;AAC9B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE,GAAG,EAAE;IACb,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;IACjB,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;CACd,CAAC;AAEX,sBAAsB;AACtB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,kBAAkB;IAClB,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,oBAAoB;IACvC,yBAAyB,EAAE,uBAAuB;IAClD,aAAa,EAAE,UAAU;IAEzB,cAAc;IACd,QAAQ,EAAE,YAAY;IACtB,YAAY,EAAE,uBAAuB;IACrC,0BAA0B,EAAE,0BAA0B;IAEtD,gBAAgB;IAChB,UAAU,EAAE,UAAU;IACtB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,OAAO;IACb,iBAAiB,EAAE,UAAU;CACrB,CAAC;AAEX,aAAa;AACb,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,qBAAqB;IAC1B,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,qBAAqB;CACxB,CAAC;AAIX,oBAAoB;AACpB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;IACtC,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,WAAW;IAC1C,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,UAAU;CACzC,CAAC;AAEX,2CAA2C;AAC3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAExD,uBAAuB;AACvB,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAEnD,uBAAuB;AACvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAY3C,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE;IACrC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;IACtC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;IACvC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;IACvC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;IACxC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;IACxC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;CAC3C,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation-related constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const REGEX_PATTERNS: {
|
|
5
|
+
readonly EMAIL: RegExp;
|
|
6
|
+
readonly PHONE: RegExp;
|
|
7
|
+
readonly USERNAME: RegExp;
|
|
8
|
+
readonly PASSWORD: RegExp;
|
|
9
|
+
readonly UUID: RegExp;
|
|
10
|
+
readonly NUMERIC: RegExp;
|
|
11
|
+
readonly DECIMAL: RegExp;
|
|
12
|
+
readonly ALPHA_ONLY: RegExp;
|
|
13
|
+
readonly ALPHANUMERIC: RegExp;
|
|
14
|
+
readonly URL: RegExp;
|
|
15
|
+
};
|
|
16
|
+
export declare const VALIDATION_RULES: {
|
|
17
|
+
readonly MIN_USERNAME_LENGTH: 3;
|
|
18
|
+
readonly MAX_USERNAME_LENGTH: 30;
|
|
19
|
+
readonly MIN_PASSWORD_LENGTH: 8;
|
|
20
|
+
readonly MAX_PASSWORD_LENGTH: 128;
|
|
21
|
+
readonly MIN_NAME_LENGTH: 2;
|
|
22
|
+
readonly MAX_NAME_LENGTH: 50;
|
|
23
|
+
readonly MIN_PORTFOLIO_NAME_LENGTH: 3;
|
|
24
|
+
readonly MAX_PORTFOLIO_NAME_LENGTH: 100;
|
|
25
|
+
readonly MIN_PORTFOLIO_DESCRIPTION_LENGTH: 0;
|
|
26
|
+
readonly MAX_PORTFOLIO_DESCRIPTION_LENGTH: 500;
|
|
27
|
+
readonly MIN_TRADE_AMOUNT: 0.01;
|
|
28
|
+
readonly MAX_TRADE_AMOUNT: 1000000;
|
|
29
|
+
readonly MIN_TRADE_QUANTITY: 0.001;
|
|
30
|
+
readonly MAX_TRADE_QUANTITY: 1000000;
|
|
31
|
+
readonly MIN_PRICE: 0.01;
|
|
32
|
+
readonly MAX_PRICE: 1000000;
|
|
33
|
+
readonly MIN_WITHDRAWAL_AMOUNT: 100;
|
|
34
|
+
readonly MAX_WITHDRAWAL_AMOUNT: 1000000;
|
|
35
|
+
readonly MAX_DESCRIPTION_LENGTH: 500;
|
|
36
|
+
readonly MAX_NOTES_LENGTH: 1000;
|
|
37
|
+
readonly MAX_FILE_SIZE_MB: 10;
|
|
38
|
+
readonly MAX_FILE_NAME_LENGTH: 255;
|
|
39
|
+
readonly MIN_ADDRESS_LENGTH: 10;
|
|
40
|
+
readonly MAX_ADDRESS_LENGTH: 200;
|
|
41
|
+
readonly MIN_POSTAL_CODE_LENGTH: 3;
|
|
42
|
+
readonly MAX_POSTAL_CODE_LENGTH: 10;
|
|
43
|
+
};
|
|
44
|
+
export declare const VALIDATION_ERRORS: {
|
|
45
|
+
readonly REQUIRED: "This field is required";
|
|
46
|
+
readonly INVALID_EMAIL: "Please enter a valid email address";
|
|
47
|
+
readonly INVALID_PHONE: "Please enter a valid phone number";
|
|
48
|
+
readonly INVALID_USERNAME: "Username must be 3-30 characters, letters, numbers, underscores, and hyphens only";
|
|
49
|
+
readonly INVALID_PASSWORD: "Password must be at least 8 characters with uppercase, lowercase, and numbers";
|
|
50
|
+
readonly MIN_LENGTH: (field: string, min: number) => string;
|
|
51
|
+
readonly MAX_LENGTH: (field: string, max: number) => string;
|
|
52
|
+
readonly MIN_VALUE: (field: string, min: number) => string;
|
|
53
|
+
readonly MAX_VALUE: (field: string, max: number) => string;
|
|
54
|
+
readonly INVALID_FORMAT: (field: string) => string;
|
|
55
|
+
readonly PASSWORDS_DONT_MATCH: "Passwords do not match";
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utilities/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCnB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;;iCAMR,MAAM,OAAO,MAAM;iCACnB,MAAM,OAAO,MAAM;gCACpB,MAAM,OAAO,MAAM;gCACnB,MAAM,OAAO,MAAM;qCACd,MAAM;;CAEtB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation-related constants
|
|
3
|
+
*/
|
|
4
|
+
// Regular expression patterns
|
|
5
|
+
export const REGEX_PATTERNS = {
|
|
6
|
+
EMAIL: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
7
|
+
PHONE: /^\+?[\d\s-()]+$/,
|
|
8
|
+
USERNAME: /^[a-zA-Z0-9_-]{3,30}$/,
|
|
9
|
+
PASSWORD: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d@$!%*?&]{8,}$/,
|
|
10
|
+
UUID: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
11
|
+
NUMERIC: /^\d+$/,
|
|
12
|
+
DECIMAL: /^\d+(\.\d{1,2})?$/,
|
|
13
|
+
ALPHA_ONLY: /^[a-zA-Z]+$/,
|
|
14
|
+
ALPHANUMERIC: /^[a-zA-Z0-9]+$/,
|
|
15
|
+
URL: /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/,
|
|
16
|
+
};
|
|
17
|
+
// Validation rules
|
|
18
|
+
export const VALIDATION_RULES = {
|
|
19
|
+
// User-related
|
|
20
|
+
MIN_USERNAME_LENGTH: 3,
|
|
21
|
+
MAX_USERNAME_LENGTH: 30,
|
|
22
|
+
MIN_PASSWORD_LENGTH: 8,
|
|
23
|
+
MAX_PASSWORD_LENGTH: 128,
|
|
24
|
+
MIN_NAME_LENGTH: 2,
|
|
25
|
+
MAX_NAME_LENGTH: 50,
|
|
26
|
+
// Portfolio-related
|
|
27
|
+
MIN_PORTFOLIO_NAME_LENGTH: 3,
|
|
28
|
+
MAX_PORTFOLIO_NAME_LENGTH: 100,
|
|
29
|
+
MIN_PORTFOLIO_DESCRIPTION_LENGTH: 0,
|
|
30
|
+
MAX_PORTFOLIO_DESCRIPTION_LENGTH: 500,
|
|
31
|
+
// Trade-related
|
|
32
|
+
MIN_TRADE_AMOUNT: 0.01,
|
|
33
|
+
MAX_TRADE_AMOUNT: 1000000,
|
|
34
|
+
MIN_TRADE_QUANTITY: 0.001,
|
|
35
|
+
MAX_TRADE_QUANTITY: 1000000,
|
|
36
|
+
MIN_PRICE: 0.01,
|
|
37
|
+
MAX_PRICE: 1000000,
|
|
38
|
+
// Withdrawal-related
|
|
39
|
+
MIN_WITHDRAWAL_AMOUNT: 100,
|
|
40
|
+
MAX_WITHDRAWAL_AMOUNT: 1000000,
|
|
41
|
+
// General
|
|
42
|
+
MAX_DESCRIPTION_LENGTH: 500,
|
|
43
|
+
MAX_NOTES_LENGTH: 1000,
|
|
44
|
+
MAX_FILE_SIZE_MB: 10,
|
|
45
|
+
MAX_FILE_NAME_LENGTH: 255,
|
|
46
|
+
// Address-related
|
|
47
|
+
MIN_ADDRESS_LENGTH: 10,
|
|
48
|
+
MAX_ADDRESS_LENGTH: 200,
|
|
49
|
+
MIN_POSTAL_CODE_LENGTH: 3,
|
|
50
|
+
MAX_POSTAL_CODE_LENGTH: 10,
|
|
51
|
+
};
|
|
52
|
+
// Error messages
|
|
53
|
+
export const VALIDATION_ERRORS = {
|
|
54
|
+
REQUIRED: 'This field is required',
|
|
55
|
+
INVALID_EMAIL: 'Please enter a valid email address',
|
|
56
|
+
INVALID_PHONE: 'Please enter a valid phone number',
|
|
57
|
+
INVALID_USERNAME: 'Username must be 3-30 characters, letters, numbers, underscores, and hyphens only',
|
|
58
|
+
INVALID_PASSWORD: 'Password must be at least 8 characters with uppercase, lowercase, and numbers',
|
|
59
|
+
MIN_LENGTH: (field, min) => `${field} must be at least ${min} characters`,
|
|
60
|
+
MAX_LENGTH: (field, max) => `${field} must be no more than ${max} characters`,
|
|
61
|
+
MIN_VALUE: (field, min) => `${field} must be at least ${min}`,
|
|
62
|
+
MAX_VALUE: (field, max) => `${field} must be no more than ${max}`,
|
|
63
|
+
INVALID_FORMAT: (field) => `${field} has an invalid format`,
|
|
64
|
+
PASSWORDS_DONT_MATCH: 'Passwords do not match',
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utilities/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,8BAA8B;AAC9B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,4BAA4B;IACnC,KAAK,EAAE,iBAAiB;IACxB,QAAQ,EAAE,uBAAuB;IACjC,QAAQ,EAAE,uDAAuD;IACjE,IAAI,EAAE,iEAAiE;IACvE,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,mBAAmB;IAC5B,UAAU,EAAE,aAAa;IACzB,YAAY,EAAE,gBAAgB;IAC9B,GAAG,EAAE,uGAAuG;CACpG,CAAC;AAEX,mBAAmB;AACnB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe;IACf,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,EAAE;IACvB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,GAAG;IACxB,eAAe,EAAE,CAAC;IAClB,eAAe,EAAE,EAAE;IAEnB,oBAAoB;IACpB,yBAAyB,EAAE,CAAC;IAC5B,yBAAyB,EAAE,GAAG;IAC9B,gCAAgC,EAAE,CAAC;IACnC,gCAAgC,EAAE,GAAG;IAErC,gBAAgB;IAChB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,OAAO;IACzB,kBAAkB,EAAE,KAAK;IACzB,kBAAkB,EAAE,OAAO;IAC3B,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,OAAO;IAElB,qBAAqB;IACrB,qBAAqB,EAAE,GAAG;IAC1B,qBAAqB,EAAE,OAAO;IAE9B,UAAU;IACV,sBAAsB,EAAE,GAAG;IAC3B,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,EAAE;IACpB,oBAAoB,EAAE,GAAG;IAEzB,kBAAkB;IAClB,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE,GAAG;IACvB,sBAAsB,EAAE,CAAC;IACzB,sBAAsB,EAAE,EAAE;CAClB,CAAC;AAEX,iBAAiB;AACjB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,wBAAwB;IAClC,aAAa,EAAE,oCAAoC;IACnD,aAAa,EAAE,mCAAmC;IAClD,gBAAgB,EAAE,mFAAmF;IACrG,gBAAgB,EAAE,+EAA+E;IACjG,UAAU,EAAE,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,GAAG,KAAK,qBAAqB,GAAG,aAAa;IACzF,UAAU,EAAE,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,GAAG,KAAK,yBAAyB,GAAG,aAAa;IAC7F,SAAS,EAAE,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,GAAG,KAAK,qBAAqB,GAAG,EAAE;IAC7E,SAAS,EAAE,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,GAAG,KAAK,yBAAyB,GAAG,EAAE;IACjF,cAAc,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,KAAK,wBAAwB;IACnE,oBAAoB,EAAE,wBAAwB;CACtC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation constants for the Blueberry platform
|
|
3
|
+
*/
|
|
4
|
+
export declare const PASSWORD_VALIDATION: {
|
|
5
|
+
readonly MIN_LENGTH: 8;
|
|
6
|
+
};
|
|
7
|
+
export declare const EMAIL_CONFIRMATION_VALIDATION: {
|
|
8
|
+
readonly TOKEN_MIN_LENGTH: 6;
|
|
9
|
+
readonly TOKEN_MAX_LENGTH: 20;
|
|
10
|
+
};
|
|
11
|
+
export declare const USER_PROFILE_VALIDATION: {
|
|
12
|
+
readonly MIN_NAME_PARTS: 2;
|
|
13
|
+
readonly MIN_AGE: 13;
|
|
14
|
+
readonly MAX_AGE: 120;
|
|
15
|
+
readonly MIN_ADDRESS_LENGTH: 10;
|
|
16
|
+
readonly MIN_PHONE_LENGTH: 8;
|
|
17
|
+
};
|
|
18
|
+
export declare const INVESTMENT_PREFERENCES_VALIDATION: {
|
|
19
|
+
readonly MIN_INVESTMENT_AMOUNT: 100;
|
|
20
|
+
readonly MAX_INVESTMENT_AMOUNT: 10000000;
|
|
21
|
+
readonly MIN_SOURCE_OF_FUNDS: 1;
|
|
22
|
+
};
|
|
23
|
+
export type PasswordValidation = typeof PASSWORD_VALIDATION;
|
|
24
|
+
export type EmailConfirmationValidation = typeof EMAIL_CONFIRMATION_VALIDATION;
|
|
25
|
+
export type UserProfileValidation = typeof USER_PROFILE_VALIDATION;
|
|
26
|
+
export type InvestmentPreferencesValidation = typeof INVESTMENT_PREFERENCES_VALIDATION;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,mBAAmB;;CAEtB,CAAC;AAGX,eAAO,MAAM,6BAA6B;;;CAGhC,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;;;CAM1B,CAAC;AAGX,eAAO,MAAM,iCAAiC;;;;CAIpC,CAAC;AAGX,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC;AAC5D,MAAM,MAAM,2BAA2B,GAAG,OAAO,6BAA6B,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,OAAO,uBAAuB,CAAC;AACnE,MAAM,MAAM,+BAA+B,GAAG,OAAO,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation constants for the Blueberry platform
|
|
3
|
+
*/
|
|
4
|
+
// ===== PASSWORD VALIDATION =====
|
|
5
|
+
export const PASSWORD_VALIDATION = {
|
|
6
|
+
MIN_LENGTH: 8,
|
|
7
|
+
};
|
|
8
|
+
// ===== EMAIL CONFIRMATION =====
|
|
9
|
+
export const EMAIL_CONFIRMATION_VALIDATION = {
|
|
10
|
+
TOKEN_MIN_LENGTH: 6,
|
|
11
|
+
TOKEN_MAX_LENGTH: 20,
|
|
12
|
+
};
|
|
13
|
+
// ===== USER PROFILE VALIDATION =====
|
|
14
|
+
export const USER_PROFILE_VALIDATION = {
|
|
15
|
+
MIN_NAME_PARTS: 2,
|
|
16
|
+
MIN_AGE: 13,
|
|
17
|
+
MAX_AGE: 120,
|
|
18
|
+
MIN_ADDRESS_LENGTH: 10,
|
|
19
|
+
MIN_PHONE_LENGTH: 8,
|
|
20
|
+
};
|
|
21
|
+
// ===== INVESTMENT PREFERENCES VALIDATION =====
|
|
22
|
+
export const INVESTMENT_PREFERENCES_VALIDATION = {
|
|
23
|
+
MIN_INVESTMENT_AMOUNT: 100,
|
|
24
|
+
MAX_INVESTMENT_AMOUNT: 10000000,
|
|
25
|
+
MIN_SOURCE_OF_FUNDS: 1,
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,kCAAkC;AAClC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE,CAAC;CACL,CAAC;AAEX,iCAAiC;AACjC,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,gBAAgB,EAAE,CAAC;IACnB,gBAAgB,EAAE,EAAE;CACZ,CAAC;AAEX,sCAAsC;AACtC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,cAAc,EAAE,CAAC;IACjB,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,GAAG;IACZ,kBAAkB,EAAE,EAAE;IACtB,gBAAgB,EAAE,CAAC;CACX,CAAC;AAEX,gDAAgD;AAChD,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,qBAAqB,EAAE,GAAG;IAC1B,qBAAqB,EAAE,QAAQ;IAC/B,mBAAmB,EAAE,CAAC;CACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cranberry-money/shared-constants",
|
|
3
|
-
"version": "8.9.
|
|
4
|
-
"description": "Shared constants for
|
|
3
|
+
"version": "8.9.2",
|
|
4
|
+
"description": "Shared constants for Blueberry platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
12
|
-
"require": "./dist/index.cjs"
|
|
11
|
+
"import": "./dist/index.js"
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
14
|
"files": [
|
|
16
15
|
"dist"
|
|
17
16
|
],
|
|
18
17
|
"scripts": {
|
|
19
|
-
"build": "tsc",
|
|
20
|
-
"clean": "rm -rf dist",
|
|
18
|
+
"build": "tsc --build",
|
|
19
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:watch": "jest --watch",
|
|
22
|
+
"test:coverage": "jest --coverage",
|
|
21
23
|
"typecheck": "tsc --noEmit",
|
|
22
24
|
"dev": "tsc --watch",
|
|
23
25
|
"lint": "eslint src",
|
|
24
26
|
"lint:fix": "eslint src --fix",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
+
"format": "prettier --write 'src/**/*.{ts,tsx}'",
|
|
28
|
+
"format:check": "prettier --check 'src/**/*.{ts,tsx}'",
|
|
29
|
+
"prepublishOnly": "npm run clean && npm run typecheck && npm test && npm run build"
|
|
27
30
|
},
|
|
28
31
|
"devDependencies": {
|
|
32
|
+
"@types/jest": "^30.0.0",
|
|
33
|
+
"@types/node": "^20.0.0",
|
|
34
|
+
"jest": "^30.0.5",
|
|
35
|
+
"ts-jest": "^29.4.1",
|
|
29
36
|
"typescript": "^5.0.0"
|
|
30
37
|
},
|
|
31
38
|
"peerDependencies": {
|
|
@@ -37,15 +44,10 @@
|
|
|
37
44
|
"shared",
|
|
38
45
|
"portfolio"
|
|
39
46
|
],
|
|
40
|
-
"author": "
|
|
47
|
+
"author": "Blueberry Team",
|
|
41
48
|
"license": "MIT",
|
|
42
49
|
"publishConfig": {
|
|
43
|
-
"access": "
|
|
50
|
+
"access": "public",
|
|
44
51
|
"registry": "https://registry.npmjs.org/"
|
|
45
|
-
},
|
|
46
|
-
"repository": {
|
|
47
|
-
"type": "git",
|
|
48
|
-
"url": "git+https://github.com/your-org/cranberry.git",
|
|
49
|
-
"directory": "packages/shared-constants"
|
|
50
52
|
}
|
|
51
53
|
}
|
package/README.md
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# @cranberry-money/shared-constants
|
|
2
|
-
|
|
3
|
-
Part of the Cranberry monorepo, this package contains all shared constants for the MyPortfolio platform.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @cranberry-money/shared-constants
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
Constants are organized by category:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import {
|
|
17
|
-
WITHDRAWAL_STATUS,
|
|
18
|
-
CURRENCY_CODES,
|
|
19
|
-
HTTP_STATUS,
|
|
20
|
-
CHART_COLORS
|
|
21
|
-
} from '@cranberry-money/shared-constants';
|
|
22
|
-
|
|
23
|
-
// Use status constants
|
|
24
|
-
if (status === WITHDRAWAL_STATUS.APPROVED) {
|
|
25
|
-
// Handle approved withdrawal
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Use currency constants
|
|
29
|
-
const symbol = CURRENCY_SYMBOLS[CURRENCY_CODES.AUD]; // '$'
|
|
30
|
-
|
|
31
|
-
// Use chart colors
|
|
32
|
-
const color = getChartColor(0); // Returns first color in palette
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Available Categories
|
|
36
|
-
|
|
37
|
-
### API Constants (`/api`)
|
|
38
|
-
- **Endpoints**: All API endpoint definitions with factory functions
|
|
39
|
-
- `PORTFOLIO_ENDPOINTS`, `TRADE_ENDPOINTS`, etc.
|
|
40
|
-
- Factory functions: `PORTFOLIO_ENDPOINTS.DETAIL(uuid)`
|
|
41
|
-
- **HTTP**: Status codes, headers, content types, methods
|
|
42
|
-
- `HTTP_STATUS`, `HTTP_HEADERS`, `CONTENT_TYPES`
|
|
43
|
-
- **Config**: Timeouts, retries, error codes
|
|
44
|
-
- `API_CONFIG`, `API_ERROR_CODES`
|
|
45
|
-
|
|
46
|
-
### Business Constants (`/business`)
|
|
47
|
-
- **Status**: All domain status values
|
|
48
|
-
- `WITHDRAWAL_STATUS`, `TRADE_STATUS`, `DOCUMENT_STATUS`, etc.
|
|
49
|
-
- Includes corresponding label mappings
|
|
50
|
-
- **Accounts**: Account types, source of funds
|
|
51
|
-
- `ACCOUNT_TYPE`, `SOURCE_OF_FUNDS`
|
|
52
|
-
- **Documents**: Document types, categories, formats
|
|
53
|
-
- `DOCUMENT_TYPE`, `DOCUMENT_CATEGORY`
|
|
54
|
-
- **Investments**: Risk tolerance, horizons, experience levels
|
|
55
|
-
- `RISK_TOLERANCE`, `INVESTMENT_HORIZON`, `INVESTMENT_EXPERIENCE`
|
|
56
|
-
- **Banking**: Bank types, institutions, verification methods
|
|
57
|
-
- `BANK_ACCOUNT_TYPE`, `BANKING_INSTITUTION`
|
|
58
|
-
- **Trading**: Execution venues, settlement cycles, fees
|
|
59
|
-
- `EXECUTION_VENUE`, `TRADE_FEE_TYPE`
|
|
60
|
-
|
|
61
|
-
### Financial Constants (`/financial`)
|
|
62
|
-
- **Currency**: ISO codes, symbols, decimal places
|
|
63
|
-
- `CURRENCY_CODES`, `CURRENCY_SYMBOLS`, `CURRENCY_NAMES`
|
|
64
|
-
- **Instruments**: Asset types, classes, market identifiers
|
|
65
|
-
- `INSTRUMENT_TYPE`, `ASSET_CLASS`, `MARKET_IDENTIFIER`
|
|
66
|
-
- **Formatting**: Number formats, locales, thresholds
|
|
67
|
-
- `NUMBER_FORMATS`, `FORMATTING_OPTIONS`
|
|
68
|
-
|
|
69
|
-
### UI Constants (`/ui`)
|
|
70
|
-
- **Colors**: Chart palettes, status colors, semantic colors
|
|
71
|
-
- `CHART_COLORS`, `STATUS_COLORS`, `PERFORMANCE_COLORS`
|
|
72
|
-
- **Display**: Loading states, view types, date ranges
|
|
73
|
-
- `LOADING_STATES`, `DISPLAY_MODE`, `DATE_RANGE_PRESET`
|
|
74
|
-
- **Labels**: All human-readable labels (re-exported from business)
|
|
75
|
-
- All `*_LABELS` constants from business domains
|
|
76
|
-
|
|
77
|
-
### Utility Constants (`/utilities`)
|
|
78
|
-
- **Time**: Milliseconds conversions, date formats, time zones
|
|
79
|
-
- `MILLISECONDS`, `DATE_FORMATS`, `TIME_ZONES`
|
|
80
|
-
- **Defaults**: Default values, pagination, thresholds
|
|
81
|
-
- `DEFAULT_VALUES`, `PAGINATION_DEFAULTS`, `THRESHOLDS`
|
|
82
|
-
- **Sorting**: Sort directions and fields
|
|
83
|
-
- `SORT_DIRECTION`, `SORT_FIELDS`
|
|
84
|
-
- **Validation**: Regex patterns, validation rules, error messages
|
|
85
|
-
- `REGEX_PATTERNS`, `VALIDATION_RULES`, `VALIDATION_ERRORS`
|
|
86
|
-
|
|
87
|
-
## Type Safety
|
|
88
|
-
|
|
89
|
-
All constants use TypeScript's `as const` assertion for type safety and include corresponding type exports:
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
export const TRADE_STATUS = {
|
|
93
|
-
PENDING: 'PENDING',
|
|
94
|
-
EXECUTED: 'EXECUTED',
|
|
95
|
-
// ...
|
|
96
|
-
} as const;
|
|
97
|
-
|
|
98
|
-
export type TradeStatus = typeof TRADE_STATUS[keyof typeof TRADE_STATUS];
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Form Options
|
|
102
|
-
|
|
103
|
-
Many constants include pre-built options arrays for form dropdowns:
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
import { RISK_TOLERANCE_OPTIONS } from '@cranberry-money/shared-constants';
|
|
107
|
-
|
|
108
|
-
// Use directly in select/dropdown components
|
|
109
|
-
<Select options={RISK_TOLERANCE_OPTIONS} />
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Synchronization with Backend
|
|
113
|
-
|
|
114
|
-
Many constants are synchronized with the backend (bilberry). Comments indicate which constants must match backend values:
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
/**
|
|
118
|
-
* Trade status constants
|
|
119
|
-
* These constants should match the backend constants in bilberry/trades/constants.py
|
|
120
|
-
*/
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Platform Compatibility
|
|
124
|
-
|
|
125
|
-
This package is designed to work across:
|
|
126
|
-
- Web applications (React/Vue/Angular)
|
|
127
|
-
- Mobile applications (React Native)
|
|
128
|
-
- Node.js environments
|
|
129
|
-
- TypeScript and JavaScript projects
|
|
130
|
-
|
|
131
|
-
## Development
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
# Build the package
|
|
135
|
-
npm run build
|
|
136
|
-
|
|
137
|
-
# Watch for changes
|
|
138
|
-
npm run dev
|
|
139
|
-
|
|
140
|
-
# Type check
|
|
141
|
-
npm run typecheck
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## License
|
|
145
|
-
|
|
146
|
-
MIT
|