@wealthfolio/addon-sdk 1.0.0
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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +1683 -0
- package/dist/chunk-3OBZP7TN.mjs +238 -0
- package/dist/chunk-3OBZP7TN.mjs.map +1 -0
- package/dist/index.d.mts +279 -0
- package/dist/index.mjs +234 -0
- package/dist/index.mjs.map +1 -0
- package/dist/permissions.d.mts +99 -0
- package/dist/permissions.mjs +29 -0
- package/dist/permissions.mjs.map +1 -0
- package/dist/types-CxtChQdm.d.mts +1137 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// src/permissions.ts
|
|
2
|
+
var PERMISSION_CATEGORIES = [
|
|
3
|
+
{
|
|
4
|
+
id: "accounts",
|
|
5
|
+
name: "Account Management",
|
|
6
|
+
description: "Access to account information and settings",
|
|
7
|
+
functions: ["getAll", "create"],
|
|
8
|
+
riskLevel: "high"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "portfolio",
|
|
12
|
+
name: "Portfolio Data",
|
|
13
|
+
description: "Access to holdings, portfolio performance, and account valuations",
|
|
14
|
+
functions: [
|
|
15
|
+
"getHoldings",
|
|
16
|
+
"getHolding",
|
|
17
|
+
"update",
|
|
18
|
+
"recalculate",
|
|
19
|
+
"getIncomeSummary",
|
|
20
|
+
"getHistoricalValuations",
|
|
21
|
+
"getLatestValuations"
|
|
22
|
+
],
|
|
23
|
+
riskLevel: "high"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "activities",
|
|
27
|
+
name: "Transaction History",
|
|
28
|
+
description: "Access to transaction records and activity management",
|
|
29
|
+
functions: [
|
|
30
|
+
"getAll",
|
|
31
|
+
"search",
|
|
32
|
+
"create",
|
|
33
|
+
"update",
|
|
34
|
+
"saveMany",
|
|
35
|
+
"import",
|
|
36
|
+
"checkImport",
|
|
37
|
+
"getImportMapping",
|
|
38
|
+
"saveImportMapping"
|
|
39
|
+
],
|
|
40
|
+
riskLevel: "high"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "market-data",
|
|
44
|
+
name: "Market Data",
|
|
45
|
+
description: "Access to market prices, quotes, and financial data",
|
|
46
|
+
functions: [
|
|
47
|
+
"searchTicker",
|
|
48
|
+
"syncHistory",
|
|
49
|
+
"sync",
|
|
50
|
+
"getProviders"
|
|
51
|
+
],
|
|
52
|
+
riskLevel: "low"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "assets",
|
|
56
|
+
name: "Asset Management",
|
|
57
|
+
description: "Access to asset profiles and data sources",
|
|
58
|
+
functions: [
|
|
59
|
+
"getProfile",
|
|
60
|
+
"updateProfile",
|
|
61
|
+
"updateDataSource"
|
|
62
|
+
],
|
|
63
|
+
riskLevel: "medium"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "quotes",
|
|
67
|
+
name: "Quote Management",
|
|
68
|
+
description: "Access to price quotes and historical data",
|
|
69
|
+
functions: [
|
|
70
|
+
"update",
|
|
71
|
+
"getHistory"
|
|
72
|
+
],
|
|
73
|
+
riskLevel: "low"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "performance",
|
|
77
|
+
name: "Performance Analytics",
|
|
78
|
+
description: "Access to performance calculations and metrics",
|
|
79
|
+
functions: [
|
|
80
|
+
"calculateHistory",
|
|
81
|
+
"calculateSummary",
|
|
82
|
+
"calculateAccountsSimple"
|
|
83
|
+
],
|
|
84
|
+
riskLevel: "medium"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "currency",
|
|
88
|
+
name: "Exchange Rates",
|
|
89
|
+
description: "Access to currency exchange rates and conversion data",
|
|
90
|
+
functions: ["getAll", "update", "add"],
|
|
91
|
+
riskLevel: "low"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "goals",
|
|
95
|
+
name: "Goals Management",
|
|
96
|
+
description: "Access to financial goals and allocations",
|
|
97
|
+
functions: [
|
|
98
|
+
"getAll",
|
|
99
|
+
"create",
|
|
100
|
+
"update",
|
|
101
|
+
"updateAllocations",
|
|
102
|
+
"getAllocations"
|
|
103
|
+
],
|
|
104
|
+
riskLevel: "medium"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "contribution-limits",
|
|
108
|
+
name: "Contribution Limits",
|
|
109
|
+
description: "Access to contribution limits and deposit calculations",
|
|
110
|
+
functions: [
|
|
111
|
+
"getAll",
|
|
112
|
+
"create",
|
|
113
|
+
"update",
|
|
114
|
+
"calculateDeposits"
|
|
115
|
+
],
|
|
116
|
+
riskLevel: "medium"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "settings",
|
|
120
|
+
name: "Application Settings",
|
|
121
|
+
description: "Access to application settings and configuration",
|
|
122
|
+
functions: ["get", "update", "backupDatabase"],
|
|
123
|
+
riskLevel: "medium"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "files",
|
|
127
|
+
name: "File Operations",
|
|
128
|
+
description: "Access to file dialogs and file system operations",
|
|
129
|
+
functions: ["openCsvDialog", "openSaveDialog"],
|
|
130
|
+
riskLevel: "medium"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "secrets",
|
|
134
|
+
name: "Secrets Management",
|
|
135
|
+
description: "Access to secure storage for addon secrets",
|
|
136
|
+
functions: ["set", "get", "delete"],
|
|
137
|
+
riskLevel: "high"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "events",
|
|
141
|
+
name: "Event Listeners",
|
|
142
|
+
description: "Access to application events and notifications",
|
|
143
|
+
functions: [
|
|
144
|
+
"onDropHover",
|
|
145
|
+
"onDrop",
|
|
146
|
+
"onDropCancelled",
|
|
147
|
+
"onUpdateStart",
|
|
148
|
+
"onUpdateComplete",
|
|
149
|
+
"onUpdateError",
|
|
150
|
+
"onSyncStart",
|
|
151
|
+
"onSyncComplete"
|
|
152
|
+
],
|
|
153
|
+
riskLevel: "low"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "ui",
|
|
157
|
+
name: "User Interface",
|
|
158
|
+
description: "Access to modify navigation and add UI components",
|
|
159
|
+
functions: ["sidebar.addItem", "router.add"],
|
|
160
|
+
riskLevel: "low"
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
function createFunctionPermission(name, isDeclared = false, isDetected = false, detectedAt) {
|
|
164
|
+
return {
|
|
165
|
+
name,
|
|
166
|
+
isDeclared,
|
|
167
|
+
isDetected,
|
|
168
|
+
detectedAt: isDetected ? detectedAt || (/* @__PURE__ */ new Date()).toISOString() : void 0
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function getPermissionCategory(id) {
|
|
172
|
+
return PERMISSION_CATEGORIES.find((category) => category.id === id);
|
|
173
|
+
}
|
|
174
|
+
function getPermissionCategoriesByRisk(riskLevel) {
|
|
175
|
+
return PERMISSION_CATEGORIES.filter((category) => category.riskLevel === riskLevel);
|
|
176
|
+
}
|
|
177
|
+
function getFunctionRiskLevel(functionName) {
|
|
178
|
+
const category = PERMISSION_CATEGORIES.find(
|
|
179
|
+
(cat) => cat.functions.includes(functionName)
|
|
180
|
+
);
|
|
181
|
+
return category?.riskLevel;
|
|
182
|
+
}
|
|
183
|
+
function isPermissionRequired(functionName, categoryId) {
|
|
184
|
+
const category = getPermissionCategory(categoryId);
|
|
185
|
+
return category ? category.functions.includes(functionName) : false;
|
|
186
|
+
}
|
|
187
|
+
function getDeclaredFunctions(permission) {
|
|
188
|
+
return permission.functions.filter((func) => func.isDeclared).map((func) => func.name);
|
|
189
|
+
}
|
|
190
|
+
function getDetectedFunctions(permission) {
|
|
191
|
+
return permission.functions.filter((func) => func.isDetected).map((func) => func.name);
|
|
192
|
+
}
|
|
193
|
+
function getUndeclaredDetectedFunctions(permission) {
|
|
194
|
+
return permission.functions.filter((func) => func.isDetected && !func.isDeclared).map((func) => func.name);
|
|
195
|
+
}
|
|
196
|
+
function hasUndeclaredDetectedFunctions(permission) {
|
|
197
|
+
return permission.functions.some((func) => func.isDetected && !func.isDeclared);
|
|
198
|
+
}
|
|
199
|
+
function addDetectedFunction(permission, functionName, detectedAt) {
|
|
200
|
+
const existingFunc = permission.functions.find((f) => f.name === functionName);
|
|
201
|
+
if (existingFunc) {
|
|
202
|
+
existingFunc.isDetected = true;
|
|
203
|
+
existingFunc.detectedAt = detectedAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
204
|
+
} else {
|
|
205
|
+
permission.functions.push(createFunctionPermission(
|
|
206
|
+
functionName,
|
|
207
|
+
false,
|
|
208
|
+
true,
|
|
209
|
+
detectedAt
|
|
210
|
+
));
|
|
211
|
+
}
|
|
212
|
+
return permission;
|
|
213
|
+
}
|
|
214
|
+
function markFunctionAsDeclared(permission, functionName) {
|
|
215
|
+
const existingFunc = permission.functions.find((f) => f.name === functionName);
|
|
216
|
+
if (existingFunc) {
|
|
217
|
+
existingFunc.isDeclared = true;
|
|
218
|
+
} else {
|
|
219
|
+
permission.functions.push(createFunctionPermission(functionName, true, false));
|
|
220
|
+
}
|
|
221
|
+
return permission;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export {
|
|
225
|
+
PERMISSION_CATEGORIES,
|
|
226
|
+
createFunctionPermission,
|
|
227
|
+
getPermissionCategory,
|
|
228
|
+
getPermissionCategoriesByRisk,
|
|
229
|
+
getFunctionRiskLevel,
|
|
230
|
+
isPermissionRequired,
|
|
231
|
+
getDeclaredFunctions,
|
|
232
|
+
getDetectedFunctions,
|
|
233
|
+
getUndeclaredDetectedFunctions,
|
|
234
|
+
hasUndeclaredDetectedFunctions,
|
|
235
|
+
addDetectedFunction,
|
|
236
|
+
markFunctionAsDeclared
|
|
237
|
+
};
|
|
238
|
+
//# sourceMappingURL=chunk-3OBZP7TN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/permissions.ts"],"sourcesContent":["/**\n * Permission system types and constants for Wealthfolio addons\n */\n\n/**\n * Security risk levels for addon operations\n */\nexport type RiskLevel = 'low' | 'medium' | 'high';\n\n/**\n * Function permission details with declaration and detection tracking\n */\nexport interface FunctionPermission {\n /** Function name */\n name: string;\n /** Whether this function was declared by the developer in manifest */\n isDeclared: boolean;\n /** Whether this function was detected by static analysis during installation */\n isDetected: boolean;\n /** ISO timestamp when this function was detected (if isDetected is true) */\n detectedAt?: string;\n}\n\n/**\n * Permission requirement for specific addon functionality\n */\nexport interface Permission {\n /** Permission category identifier */\n category: string;\n /** List of API functions this permission grants access to with their declaration/detection status */\n functions: FunctionPermission[];\n /** Human-readable explanation of why this permission is needed */\n purpose: string;\n}\n\n/**\n * Permission category definition\n */\nexport interface PermissionCategory {\n /** Unique category identifier */\n id: string;\n /** Display name for the category */\n name: string;\n /** Detailed description of what this category covers */\n description: string;\n /** List of API functions in this category */\n functions: string[];\n /** Security risk level for this category */\n riskLevel: RiskLevel;\n}\n\n\n/**\n * Predefined permission categories with their associated functions and risk levels\n */\nexport const PERMISSION_CATEGORIES: PermissionCategory[] = [\n {\n id: 'accounts',\n name: 'Account Management',\n description: 'Access to account information and settings',\n functions: ['getAll', 'create'],\n riskLevel: 'high',\n },\n {\n id: 'portfolio',\n name: 'Portfolio Data',\n description: 'Access to holdings, portfolio performance, and account valuations',\n functions: [\n 'getHoldings',\n 'getHolding',\n 'update',\n 'recalculate',\n 'getIncomeSummary',\n 'getHistoricalValuations',\n 'getLatestValuations',\n ],\n riskLevel: 'high',\n },\n {\n id: 'activities',\n name: 'Transaction History',\n description: 'Access to transaction records and activity management',\n functions: [\n 'getAll',\n 'search',\n 'create',\n 'update',\n 'saveMany',\n 'import',\n 'checkImport',\n 'getImportMapping',\n 'saveImportMapping',\n ],\n riskLevel: 'high',\n },\n {\n id: 'market-data',\n name: 'Market Data',\n description: 'Access to market prices, quotes, and financial data',\n functions: [\n 'searchTicker',\n 'syncHistory',\n 'sync',\n 'getProviders',\n ],\n riskLevel: 'low',\n },\n {\n id: 'assets',\n name: 'Asset Management',\n description: 'Access to asset profiles and data sources',\n functions: [\n 'getProfile',\n 'updateProfile',\n 'updateDataSource',\n ],\n riskLevel: 'medium',\n },\n {\n id: 'quotes',\n name: 'Quote Management',\n description: 'Access to price quotes and historical data',\n functions: [\n 'update',\n 'getHistory',\n ],\n riskLevel: 'low',\n },\n {\n id: 'performance',\n name: 'Performance Analytics',\n description: 'Access to performance calculations and metrics',\n functions: [\n 'calculateHistory',\n 'calculateSummary',\n 'calculateAccountsSimple',\n ],\n riskLevel: 'medium',\n },\n {\n id: 'currency',\n name: 'Exchange Rates',\n description: 'Access to currency exchange rates and conversion data',\n functions: ['getAll', 'update', 'add'],\n riskLevel: 'low',\n },\n {\n id: 'goals',\n name: 'Goals Management',\n description: 'Access to financial goals and allocations',\n functions: [\n 'getAll',\n 'create',\n 'update',\n 'updateAllocations',\n 'getAllocations',\n ],\n riskLevel: 'medium',\n },\n {\n id: 'contribution-limits',\n name: 'Contribution Limits',\n description: 'Access to contribution limits and deposit calculations',\n functions: [\n 'getAll',\n 'create',\n 'update',\n 'calculateDeposits',\n ],\n riskLevel: 'medium',\n },\n {\n id: 'settings',\n name: 'Application Settings',\n description: 'Access to application settings and configuration',\n functions: ['get', 'update', 'backupDatabase'],\n riskLevel: 'medium',\n },\n {\n id: 'files',\n name: 'File Operations',\n description: 'Access to file dialogs and file system operations',\n functions: ['openCsvDialog', 'openSaveDialog'],\n riskLevel: 'medium',\n },\n {\n id: 'secrets',\n name: 'Secrets Management',\n description: 'Access to secure storage for addon secrets',\n functions: ['set', 'get', 'delete'],\n riskLevel: 'high',\n },\n {\n id: 'events',\n name: 'Event Listeners',\n description: 'Access to application events and notifications',\n functions: [\n 'onDropHover',\n 'onDrop',\n 'onDropCancelled',\n 'onUpdateStart',\n 'onUpdateComplete',\n 'onUpdateError',\n 'onSyncStart',\n 'onSyncComplete',\n ],\n riskLevel: 'low',\n },\n {\n id: 'ui',\n name: 'User Interface',\n description: 'Access to modify navigation and add UI components',\n functions: ['sidebar.addItem', 'router.add'],\n riskLevel: 'low',\n },\n];\n\n/**\n * Helper functions for permission management\n */\n\n/**\n * Create a FunctionPermission object\n */\nexport function createFunctionPermission(\n name: string,\n isDeclared: boolean = false,\n isDetected: boolean = false,\n detectedAt?: string\n): FunctionPermission {\n return {\n name,\n isDeclared,\n isDetected,\n detectedAt: isDetected ? (detectedAt || new Date().toISOString()) : undefined\n };\n}\n\n/**\n * Get permission category by ID\n */\nexport function getPermissionCategory(id: string): PermissionCategory | undefined {\n return PERMISSION_CATEGORIES.find(category => category.id === id);\n}\n\n/**\n * Get permission categories by risk level\n */\nexport function getPermissionCategoriesByRisk(riskLevel: RiskLevel): PermissionCategory[] {\n return PERMISSION_CATEGORIES.filter(category => category.riskLevel === riskLevel);\n}\n\n/**\n * Get the risk level for a specific function\n */\nexport function getFunctionRiskLevel(functionName: string): RiskLevel | undefined {\n const category = PERMISSION_CATEGORIES.find(cat => \n cat.functions.includes(functionName)\n );\n return category?.riskLevel;\n}\n\n/**\n * Check if a function requires a specific permission category\n */\nexport function isPermissionRequired(functionName: string, categoryId: string): boolean {\n const category = getPermissionCategory(categoryId);\n return category ? category.functions.includes(functionName) : false;\n}\n\n/**\n * Get all declared functions from a permission\n */\nexport function getDeclaredFunctions(permission: Permission): string[] {\n return permission.functions\n .filter(func => func.isDeclared)\n .map(func => func.name);\n}\n\n/**\n * Get all detected functions from a permission\n */\nexport function getDetectedFunctions(permission: Permission): string[] {\n return permission.functions\n .filter(func => func.isDetected)\n .map(func => func.name);\n}\n\n/**\n * Get functions that were detected but not declared (potential security concern)\n */\nexport function getUndeclaredDetectedFunctions(permission: Permission): string[] {\n return permission.functions\n .filter(func => func.isDetected && !func.isDeclared)\n .map(func => func.name);\n}\n\n/**\n * Check if a permission has any undeclared detected functions\n */\nexport function hasUndeclaredDetectedFunctions(permission: Permission): boolean {\n return permission.functions.some(func => func.isDetected && !func.isDeclared);\n}\n\n/**\n * Add a detected function to a permission\n */\nexport function addDetectedFunction(\n permission: Permission, \n functionName: string, \n detectedAt?: string\n): Permission {\n const existingFunc = permission.functions.find(f => f.name === functionName);\n \n if (existingFunc) {\n // Update existing function to mark as detected\n existingFunc.isDetected = true;\n existingFunc.detectedAt = detectedAt || new Date().toISOString();\n } else {\n // Add new detected function\n permission.functions.push(createFunctionPermission(\n functionName, \n false, \n true, \n detectedAt\n ));\n }\n \n return permission;\n}\n\n/**\n * Mark a function as declared in a permission\n */\nexport function markFunctionAsDeclared(\n permission: Permission, \n functionName: string\n): Permission {\n const existingFunc = permission.functions.find(f => f.name === functionName);\n \n if (existingFunc) {\n existingFunc.isDeclared = true;\n } else {\n // Add new declared function\n permission.functions.push(createFunctionPermission(functionName, true, false));\n }\n \n return permission;\n}\n"],"mappings":";AAuDO,IAAM,wBAA8C;AAAA,EACzD;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW,CAAC,UAAU,QAAQ;AAAA,IAC9B,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW;AAAA,MACT;AAAA,M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WAAW,UACf,OAAO,UAAQ,KAAK,UAAU,EAC9B,IAAI,UAAQ,KAAK,IAAI;AAC1B;AAKO,SAAS,+BAA+B,YAAkC;AAC/E,SAAO,WAAW,UACf,OAAO,UAAQ,KAAK,cAAc,CAAC,KAAK,UAAU,EAClD,IAAI,UAAQ,KAAK,IAAI;AAC1B;AAKO,SAAS,+BAA+B,YAAiC;AAC9E,SAAO,WAAW,UAAU,KAAK,UAAQ,KAAK,cAAc,CAAC,KAAK,UAAU;AAC9E;AAKO,SAAS,oBACd,YACA,cACA,YACY;AACZ,QAAM,eAAe,WAAW,UAAU,KAAK,OAAK,EAAE,SAAS,YAAY;AAE3E,MAAI,cAAc;AAEhB,iBAAa,aAAa;AAC1B,iBAAa,aAAa,eAAc,oBAAI,KAAK,GAAE,YAAY;AAAA,EACjE,OAAO;AAEL,eAAW,UAAU,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAKO,SAAS,uBACd,YACA,cACY;AACZ,QAAM,eAAe,WAAW,UAAU,KAAK,OAAK,EAAE,SAAS,YAAY;AAE3E,MAAI,cAAc;AAChB,iBAAa,aAAa;AAAA,EAC5B,OAAO;AAEL,eAAW,UAAU,KAAK,yBAAyB,cAAc,MAAM,KAAK,CAAC;AAAA,EAC/E;AAEA,SAAO;AACT;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as react_dom from 'react-dom';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
export { a4 as ACTIVITY_TYPE_PREFIX_LENGTH, h as Account, a2 as AccountDeposit, _ as AccountGroup, Y as AccountSummaryView, f as AccountType, X as AccountValuation, i as Activity, l as ActivityCreate, j as ActivityDetails, n as ActivityImport, k as ActivitySearchResponse, e as ActivityType, m as ActivityUpdate, A as AddonContext, a as AddonEnableFunction, x as Asset, p as AssetProfile, v as CashHolding, a0 as ContributionLimit, C as Country, D as DataSource, O as DateRange, a3 as DepositsCalculation, E as EventCallback, $ as ExchangeRate, G as Goal, J as GoalAllocation, K as GoalProgress, w as Holding, g as HoldingType, H as HostAPI, o as ImportMappingData, I as ImportRequiredField, r as ImportValidationResult, N as IncomeSummary, t as Instrument, L as Lot, q as MarketData, M as MarketDataProviderInfo, u as MonetaryValue, a1 as NewContributionLimit, a6 as PerformanceMetrics, P as Position, y as Quote, Q as QuoteSummary, z as QuoteUpdate, a5 as ReturnData, R as RouteConfig, d as RouterManager, s as Sector, B as Settings, F as SettingsContextType, b as SidebarItemConfig, S as SidebarItemHandle, c as SidebarManager, Z as SimplePerformanceMetrics, T as Tag, W as TimePeriod, a8 as TrackedItem, U as UnlistenFn, a7 as UpdateAssetProfile, V as ValidationResult } from './types-CxtChQdm.mjs';
|
|
4
|
+
export { QueryClient } from '@tanstack/react-query';
|
|
5
|
+
import { Permission } from './permissions.mjs';
|
|
6
|
+
export { FunctionPermission, PERMISSION_CATEGORIES, PermissionCategory, RiskLevel, getFunctionRiskLevel, getPermissionCategoriesByRisk, getPermissionCategory, isPermissionRequired } from './permissions.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Shared Query Keys for React Query
|
|
10
|
+
* These keys should match the main application's query keys to ensure cache consistency
|
|
11
|
+
*/
|
|
12
|
+
declare const QueryKeys: {
|
|
13
|
+
readonly ACCOUNTS: "accounts";
|
|
14
|
+
readonly ACCOUNTS_SUMMARY: "accounts_summary";
|
|
15
|
+
readonly ACTIVITY_DATA: "activity-data";
|
|
16
|
+
readonly ACTIVITIES: "activities";
|
|
17
|
+
readonly HOLDINGS: "holdings";
|
|
18
|
+
readonly HOLDING: "holding";
|
|
19
|
+
readonly INCOME_SUMMARY: "incomeSummary";
|
|
20
|
+
readonly PORTFOLIO_SUMMARY: "portfolioSummary";
|
|
21
|
+
readonly QUOTE_HISTORY: "quoteHistory";
|
|
22
|
+
readonly GOALS: "goals";
|
|
23
|
+
readonly GOALS_ALLOCATIONS: "goals_allocations";
|
|
24
|
+
readonly SETTINGS: "settings";
|
|
25
|
+
readonly EXCHANGE_RATES: "exchangeRates";
|
|
26
|
+
readonly EXCHANGE_RATE_SYMBOLS: "exchange_rate_symbols";
|
|
27
|
+
readonly QUOTE: "quote";
|
|
28
|
+
readonly CONTRIBUTION_LIMITS: "contributionLimits";
|
|
29
|
+
readonly CONTRIBUTION_LIMIT_PROGRESS: "contributionLimitProgress";
|
|
30
|
+
readonly ASSET_DATA: "asset_data";
|
|
31
|
+
readonly IMPORT_MAPPING: "import_mapping";
|
|
32
|
+
readonly PERFORMANCE_SUMMARY: "performanceSummary";
|
|
33
|
+
readonly PERFORMANCE_HISTORY: "performanceHistory";
|
|
34
|
+
readonly HISTORY_VALUATION: "historyValuation";
|
|
35
|
+
readonly valuationHistory: (id: string) => string[];
|
|
36
|
+
readonly ACCOUNTS_SIMPLE_PERFORMANCE: "accountsSimplePerformance";
|
|
37
|
+
readonly accountsSimplePerformance: (accountIds: string[]) => string[];
|
|
38
|
+
readonly MARKET_DATA_PROVIDERS: "marketDataProviders";
|
|
39
|
+
readonly MARKET_DATA_PROVIDER_SETTINGS: "marketDataProviderSettings";
|
|
40
|
+
readonly transactions: "transactions";
|
|
41
|
+
readonly latestValuations: "latest-valuations";
|
|
42
|
+
readonly symbolSearch: "symbol-search";
|
|
43
|
+
readonly ASSET_HISTORY: "asset-history";
|
|
44
|
+
readonly INSTALLED_ADDONS: "installedAddons";
|
|
45
|
+
readonly ADDON_STORE_LISTINGS: "addonStoreListings";
|
|
46
|
+
readonly ADDON_AUTO_UPDATE_CHECK: "addonAutoUpdateCheck";
|
|
47
|
+
readonly secrets: {
|
|
48
|
+
readonly apiKey: (providerId: string) => string[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
type QueryKeys = typeof QueryKeys;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Addon manifest and metadata types
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Unified addon manifest structure that handles both development and runtime scenarios
|
|
59
|
+
* This represents both what developers write in their manifest.json and installed addon metadata
|
|
60
|
+
*/
|
|
61
|
+
interface AddonManifest {
|
|
62
|
+
/** Unique addon identifier (lowercase, no spaces, hyphens allowed) */
|
|
63
|
+
id: string;
|
|
64
|
+
/** Human-readable addon name */
|
|
65
|
+
name: string;
|
|
66
|
+
/** Semantic version (e.g., "1.0.0") */
|
|
67
|
+
version: string;
|
|
68
|
+
/** Brief description of the addon's functionality */
|
|
69
|
+
description?: string;
|
|
70
|
+
/** Author name or organization */
|
|
71
|
+
author?: string;
|
|
72
|
+
/** Compatible SDK version */
|
|
73
|
+
sdkVersion?: string;
|
|
74
|
+
/** Main entry point file (relative to addon root) */
|
|
75
|
+
main?: string;
|
|
76
|
+
/** Whether the addon is enabled by default */
|
|
77
|
+
enabled?: boolean;
|
|
78
|
+
/** Permission declarations for security review */
|
|
79
|
+
permissions?: Permission[];
|
|
80
|
+
/** Addon homepage or documentation URL */
|
|
81
|
+
homepage?: string;
|
|
82
|
+
/** Support or issues URL */
|
|
83
|
+
repository?: string;
|
|
84
|
+
/** License identifier (e.g., "MIT", "Apache-2.0") */
|
|
85
|
+
license?: string;
|
|
86
|
+
/** Minimum Wealthfolio version required */
|
|
87
|
+
minWealthfolioVersion?: string;
|
|
88
|
+
/** Keywords for discoverability */
|
|
89
|
+
keywords?: string[];
|
|
90
|
+
/** Addon icon (base64 or relative path) */
|
|
91
|
+
icon?: string;
|
|
92
|
+
/** Installation timestamp in ISO format */
|
|
93
|
+
installedAt?: string;
|
|
94
|
+
/** Last update timestamp */
|
|
95
|
+
updatedAt?: string;
|
|
96
|
+
/** Installation source */
|
|
97
|
+
source?: 'local' | 'store' | 'sideload';
|
|
98
|
+
/** File size in bytes */
|
|
99
|
+
size?: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Type guard to check if a manifest has been installed (has runtime fields)
|
|
103
|
+
*/
|
|
104
|
+
declare function isInstalledManifest(manifest: AddonManifest): manifest is Required<Pick<AddonManifest, 'main' | 'enabled' | 'installedAt'>> & AddonManifest;
|
|
105
|
+
/**
|
|
106
|
+
* Helper type for development manifests (without runtime fields)
|
|
107
|
+
*/
|
|
108
|
+
type DevelopmentManifest = Omit<AddonManifest, 'installedAt' | 'updatedAt' | 'source' | 'size'>;
|
|
109
|
+
/**
|
|
110
|
+
* Helper type for installed manifests (with runtime fields)
|
|
111
|
+
*/
|
|
112
|
+
type InstalledManifest = Required<Pick<AddonManifest, 'main' | 'enabled' | 'installedAt'>> & AddonManifest;
|
|
113
|
+
/**
|
|
114
|
+
* Addon file information
|
|
115
|
+
*/
|
|
116
|
+
interface AddonFile {
|
|
117
|
+
/** File name */
|
|
118
|
+
name: string;
|
|
119
|
+
/** File content */
|
|
120
|
+
content: string;
|
|
121
|
+
/** Whether this is the main entry point */
|
|
122
|
+
is_main: boolean;
|
|
123
|
+
/** File size in bytes */
|
|
124
|
+
size?: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Extracted addon package
|
|
128
|
+
*/
|
|
129
|
+
interface ExtractedAddon {
|
|
130
|
+
/** Addon metadata from manifest */
|
|
131
|
+
metadata: AddonManifest;
|
|
132
|
+
/** List of files in the addon package */
|
|
133
|
+
files: AddonFile[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Installed addon information
|
|
137
|
+
*/
|
|
138
|
+
interface InstalledAddon {
|
|
139
|
+
/** Addon metadata */
|
|
140
|
+
metadata: AddonManifest;
|
|
141
|
+
/** Installation path */
|
|
142
|
+
path?: string;
|
|
143
|
+
/** Whether the addon is currently active */
|
|
144
|
+
active?: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Addon installation result
|
|
148
|
+
*/
|
|
149
|
+
interface AddonInstallResult {
|
|
150
|
+
/** Whether installation was successful */
|
|
151
|
+
success: boolean;
|
|
152
|
+
/** Error message if installation failed */
|
|
153
|
+
error?: string;
|
|
154
|
+
/** Installed addon metadata */
|
|
155
|
+
addon?: AddonManifest;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Addon validation result
|
|
159
|
+
*/
|
|
160
|
+
interface AddonValidationResult {
|
|
161
|
+
/** Whether the addon is valid */
|
|
162
|
+
valid: boolean;
|
|
163
|
+
/** List of validation errors */
|
|
164
|
+
errors: string[];
|
|
165
|
+
/** List of validation warnings */
|
|
166
|
+
warnings: string[];
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Addon update information
|
|
170
|
+
*/
|
|
171
|
+
interface AddonUpdateInfo {
|
|
172
|
+
/** Current installed version */
|
|
173
|
+
currentVersion: string;
|
|
174
|
+
/** Latest available version */
|
|
175
|
+
latestVersion: string;
|
|
176
|
+
/** Whether an update is available */
|
|
177
|
+
updateAvailable: boolean;
|
|
178
|
+
/** Download URL for the update */
|
|
179
|
+
downloadUrl?: string;
|
|
180
|
+
/** Release notes for the latest version */
|
|
181
|
+
releaseNotes?: string;
|
|
182
|
+
/** Release date of the latest version */
|
|
183
|
+
releaseDate?: string;
|
|
184
|
+
/** Changelog URL */
|
|
185
|
+
changelogUrl?: string;
|
|
186
|
+
/** Whether this is a critical security update */
|
|
187
|
+
isCritical?: boolean;
|
|
188
|
+
/** Breaking changes in this update */
|
|
189
|
+
hasBreakingChanges?: boolean;
|
|
190
|
+
/** Minimum Wealthfolio version required for this update */
|
|
191
|
+
minWealthfolioVersion?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Addon update check result
|
|
195
|
+
*/
|
|
196
|
+
interface AddonUpdateCheckResult {
|
|
197
|
+
/** Addon ID */
|
|
198
|
+
addonId: string;
|
|
199
|
+
/** Update information */
|
|
200
|
+
updateInfo: AddonUpdateInfo;
|
|
201
|
+
/** Any errors during update check */
|
|
202
|
+
error?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Addon store listing
|
|
206
|
+
*/
|
|
207
|
+
interface AddonStoreListing {
|
|
208
|
+
/** Addon metadata */
|
|
209
|
+
metadata: AddonManifest;
|
|
210
|
+
/** Download URL */
|
|
211
|
+
downloadUrl: string;
|
|
212
|
+
/** Number of downloads */
|
|
213
|
+
downloads?: number;
|
|
214
|
+
/** Average rating */
|
|
215
|
+
rating?: number;
|
|
216
|
+
/** Number of reviews */
|
|
217
|
+
reviewCount?: number;
|
|
218
|
+
/** Whether it's verified by Wealthfolio team */
|
|
219
|
+
verified?: boolean;
|
|
220
|
+
/** Last update date */
|
|
221
|
+
lastUpdated?: string;
|
|
222
|
+
/** Screenshots or images */
|
|
223
|
+
images?: string[];
|
|
224
|
+
/** Release notes for the latest version */
|
|
225
|
+
releaseNotes?: string;
|
|
226
|
+
/** Changelog URL */
|
|
227
|
+
changelogUrl?: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Utility functions for addon development
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Validates an addon manifest
|
|
236
|
+
*/
|
|
237
|
+
declare function validateManifest(manifest: AddonManifest): AddonValidationResult;
|
|
238
|
+
/**
|
|
239
|
+
* Checks if an addon version is compatible with the current SDK
|
|
240
|
+
*/
|
|
241
|
+
declare function isCompatibleVersion(addonSdkVersion?: string, currentSdkVersion?: string): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Formats addon size in human-readable format
|
|
244
|
+
*/
|
|
245
|
+
declare function formatAddonSize(bytes: number): string;
|
|
246
|
+
/**
|
|
247
|
+
* Generates a unique addon ID from a name
|
|
248
|
+
*/
|
|
249
|
+
declare function generateAddonId(name: string): string;
|
|
250
|
+
/**
|
|
251
|
+
* Type guard to check if an object is a valid addon manifest
|
|
252
|
+
*/
|
|
253
|
+
declare function isAddonManifest(obj: any): obj is AddonManifest;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Current SDK version from package.json
|
|
257
|
+
*/
|
|
258
|
+
declare const SDK_VERSION: string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* React version guaranteed by the host application. Addons may assert against
|
|
262
|
+
* this at runtime if they rely on a particular React feature set.
|
|
263
|
+
*/
|
|
264
|
+
declare const ReactVersion = "18.3.1";
|
|
265
|
+
/**
|
|
266
|
+
* Addons receive their context as a parameter to the enable() function.
|
|
267
|
+
* Each addon gets its own isolated context with scoped secret storage.
|
|
268
|
+
*
|
|
269
|
+
* Example:
|
|
270
|
+
* export default function enable(ctx: AddonContext) {
|
|
271
|
+
* // Use ctx.api.secrets.set/get/delete for secure storage
|
|
272
|
+
* // Use ctx.sidebar.addItem() to add navigation
|
|
273
|
+
* // Use ctx.router.add() to register routes
|
|
274
|
+
* }
|
|
275
|
+
*/
|
|
276
|
+
declare const React: typeof React$1;
|
|
277
|
+
declare const ReactDOM: typeof react_dom;
|
|
278
|
+
|
|
279
|
+
export { type AddonFile, type AddonInstallResult, type AddonManifest, type AddonStoreListing, type AddonUpdateCheckResult, type AddonUpdateInfo, type AddonValidationResult, type DevelopmentManifest, type ExtractedAddon, type InstalledAddon, type InstalledManifest, Permission, QueryKeys, React, ReactDOM, ReactVersion, SDK_VERSION, formatAddonSize, generateAddonId, isAddonManifest, isCompatibleVersion, isInstalledManifest, validateManifest };
|