@wealthfolio/addon-sdk 1.0.0 → 3.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 +19 -8
- package/README.md +226 -146
- package/dist/{chunk-3OBZP7TN.mjs → chunk-6MGUTH7T.js} +10 -40
- package/dist/chunk-6MGUTH7T.js.map +1 -0
- package/dist/{index.mjs → index.js} +70 -23
- package/dist/index.js.map +1 -0
- package/dist/{permissions.mjs → permissions.js} +2 -2
- package/dist/src/data-types.d.ts +713 -0
- package/dist/src/goal-progress.d.ts +7 -0
- package/dist/src/host-api.d.ts +566 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/manifest.d.ts +176 -0
- package/dist/{permissions.d.mts → src/permissions.d.ts} +16 -18
- package/dist/src/query-keys.d.ts +44 -0
- package/dist/src/types.d.ts +88 -0
- package/dist/src/utils.d.ts +24 -0
- package/dist/src/version.d.ts +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.js +1 -0
- package/package.json +28 -17
- package/dist/chunk-3OBZP7TN.mjs.map +0 -1
- package/dist/index.d.mts +0 -279
- package/dist/index.mjs.map +0 -1
- package/dist/types-CxtChQdm.d.mts +0 -1137
- package/dist/types.d.mts +0 -2
- package/dist/types.mjs +0 -1
- /package/dist/{permissions.mjs.map → permissions.js.map} +0 -0
- /package/dist/{types.mjs.map → types.js.map} +0 -0
package/dist/index.d.mts
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
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 };
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/query-keys.ts","../src/manifest.ts","../package.json","../src/version.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["/**\n * Shared Query Keys for React Query\n * These keys should match the main application's query keys to ensure cache consistency\n */\nexport const QueryKeys = {\n // Account related keys\n ACCOUNTS: 'accounts',\n ACCOUNTS_SUMMARY: 'accounts_summary',\n\n // Activity related keys\n ACTIVITY_DATA: 'activity-data',\n ACTIVITIES: 'activities',\n\n // Portfolio related keys\n HOLDINGS: 'holdings',\n HOLDING: 'holding',\n INCOME_SUMMARY: 'incomeSummary',\n PORTFOLIO_SUMMARY: 'portfolioSummary',\n QUOTE_HISTORY: 'quoteHistory',\n\n // Goals related keys\n GOALS: 'goals',\n GOALS_ALLOCATIONS: 'goals_allocations',\n\n // Settings related keys\n SETTINGS: 'settings',\n EXCHANGE_RATES: 'exchangeRates',\n\n // New keys for exchange rates\n EXCHANGE_RATE_SYMBOLS: 'exchange_rate_symbols',\n QUOTE: 'quote',\n\n CONTRIBUTION_LIMITS: 'contributionLimits',\n CONTRIBUTION_LIMIT_PROGRESS: 'contributionLimitProgress',\n\n ASSET_DATA: 'asset_data',\n IMPORT_MAPPING: 'import_mapping',\n\n PERFORMANCE_SUMMARY: 'performanceSummary',\n PERFORMANCE_HISTORY: 'performanceHistory',\n\n HISTORY_VALUATION: 'historyValuation',\n // Helper function to create account-specific keys\n valuationHistory: (id: string) => [QueryKeys.HISTORY_VALUATION, id],\n\n // Account simple performance\n ACCOUNTS_SIMPLE_PERFORMANCE: 'accountsSimplePerformance',\n accountsSimplePerformance: (accountIds: string[]) => [\n QueryKeys.ACCOUNTS_SIMPLE_PERFORMANCE,\n [...accountIds].sort().join(',') || 'none',\n ],\n\n // Market Data Providers\n MARKET_DATA_PROVIDERS: 'marketDataProviders',\n MARKET_DATA_PROVIDER_SETTINGS: 'marketDataProviderSettings',\n\n transactions: 'transactions',\n latestValuations: 'latest-valuations',\n\n // Market Data\n symbolSearch: 'symbol-search',\n\n ASSET_HISTORY: 'asset-history',\n\n // Addons\n INSTALLED_ADDONS: 'installedAddons',\n ADDON_STORE_LISTINGS: 'addonStoreListings',\n ADDON_AUTO_UPDATE_CHECK: 'addonAutoUpdateCheck',\n\n secrets: {\n apiKey: (providerId: string) => ['secrets', 'apiKey', providerId],\n },\n} as const;\n\nexport type QueryKeys = typeof QueryKeys;\n","/**\n * Addon manifest and metadata types\n */\n\nimport type { Permission } from './permissions';\n\n/**\n * Unified addon manifest structure that handles both development and runtime scenarios\n * This represents both what developers write in their manifest.json and installed addon metadata\n */\nexport interface AddonManifest {\n // Core manifest fields (always present)\n /** Unique addon identifier (lowercase, no spaces, hyphens allowed) */\n id: string;\n /** Human-readable addon name */\n name: string;\n /** Semantic version (e.g., \"1.0.0\") */\n version: string;\n /** Brief description of the addon's functionality */\n description?: string;\n /** Author name or organization */\n author?: string;\n /** Compatible SDK version */\n sdkVersion?: string;\n /** Main entry point file (relative to addon root) */\n main?: string;\n /** Whether the addon is enabled by default */\n enabled?: boolean;\n /** Permission declarations for security review */\n permissions?: Permission[];\n /** Addon homepage or documentation URL */\n homepage?: string;\n /** Support or issues URL */\n repository?: string;\n /** License identifier (e.g., \"MIT\", \"Apache-2.0\") */\n license?: string;\n /** Minimum Wealthfolio version required */\n minWealthfolioVersion?: string;\n /** Keywords for discoverability */\n keywords?: string[];\n /** Addon icon (base64 or relative path) */\n icon?: string;\n \n // Runtime fields (only present after installation)\n /** Installation timestamp in ISO format */\n installedAt?: string;\n /** Last update timestamp */\n updatedAt?: string;\n /** Installation source */\n source?: 'local' | 'store' | 'sideload';\n /** File size in bytes */\n size?: number;\n}\n\n/**\n * Type guard to check if a manifest has been installed (has runtime fields)\n */\nexport function isInstalledManifest(manifest: AddonManifest): manifest is Required<Pick<AddonManifest, 'main' | 'enabled' | 'installedAt'>> & AddonManifest {\n return !!(manifest.installedAt && manifest.main !== undefined && manifest.enabled !== undefined);\n}\n\n/**\n * Helper type for development manifests (without runtime fields)\n */\nexport type DevelopmentManifest = Omit<AddonManifest, 'installedAt' | 'updatedAt' | 'source' | 'size'>;\n\n/**\n * Helper type for installed manifests (with runtime fields)\n */\nexport type InstalledManifest = Required<Pick<AddonManifest, 'main' | 'enabled' | 'installedAt'>> & AddonManifest;\n\n/**\n * Addon file information\n */\nexport interface AddonFile {\n /** File name */\n name: string;\n /** File content */\n content: string;\n /** Whether this is the main entry point */\n is_main: boolean;\n /** File size in bytes */\n size?: number;\n}\n\n/**\n * Extracted addon package\n */\nexport interface ExtractedAddon {\n /** Addon metadata from manifest */\n metadata: AddonManifest;\n /** List of files in the addon package */\n files: AddonFile[];\n}\n\n/**\n * Installed addon information\n */\nexport interface InstalledAddon {\n /** Addon metadata */\n metadata: AddonManifest;\n /** Installation path */\n path?: string;\n /** Whether the addon is currently active */\n active?: boolean;\n}\n\n/**\n * Addon installation result\n */\nexport interface AddonInstallResult {\n /** Whether installation was successful */\n success: boolean;\n /** Error message if installation failed */\n error?: string;\n /** Installed addon metadata */\n addon?: AddonManifest;\n}\n\n/**\n * Addon validation result\n */\nexport interface AddonValidationResult {\n /** Whether the addon is valid */\n valid: boolean;\n /** List of validation errors */\n errors: string[];\n /** List of validation warnings */\n warnings: string[];\n}\n\n/**\n * Addon update information\n */\nexport interface AddonUpdateInfo {\n /** Current installed version */\n currentVersion: string;\n /** Latest available version */\n latestVersion: string;\n /** Whether an update is available */\n updateAvailable: boolean;\n /** Download URL for the update */\n downloadUrl?: string;\n /** Release notes for the latest version */\n releaseNotes?: string;\n /** Release date of the latest version */\n releaseDate?: string;\n /** Changelog URL */\n changelogUrl?: string;\n /** Whether this is a critical security update */\n isCritical?: boolean;\n /** Breaking changes in this update */\n hasBreakingChanges?: boolean;\n /** Minimum Wealthfolio version required for this update */\n minWealthfolioVersion?: string;\n}\n\n/**\n * Addon update check result\n */\nexport interface AddonUpdateCheckResult {\n /** Addon ID */\n addonId: string;\n /** Update information */\n updateInfo: AddonUpdateInfo;\n /** Any errors during update check */\n error?: string;\n}\n\n/**\n * Addon store listing\n */\nexport interface AddonStoreListing {\n /** Addon metadata */\n metadata: AddonManifest;\n /** Download URL */\n downloadUrl: string;\n /** Number of downloads */\n downloads?: number;\n /** Average rating */\n rating?: number;\n /** Number of reviews */\n reviewCount?: number;\n /** Whether it's verified by Wealthfolio team */\n verified?: boolean;\n /** Last update date */\n lastUpdated?: string;\n /** Screenshots or images */\n images?: string[];\n /** Release notes for the latest version */\n releaseNotes?: string;\n /** Changelog URL */\n changelogUrl?: string;\n}\n","{\n \"name\": \"@wealthfolio/addon-sdk\",\n \"version\": \"1.0.0\",\n \"description\": \"TypeScript SDK for building Wealthfolio addons with enhanced functionality and type safety\",\n \"main\": \"dist/index.mjs\",\n \"types\": \"dist/index.d.mts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.mts\"\n },\n \"./types\": {\n \"import\": \"./dist/types.mjs\",\n \"types\": \"./dist/types.d.mts\"\n },\n \"./permissions\": {\n \"import\": \"./dist/permissions.mjs\",\n \"types\": \"./dist/permissions.d.mts\"\n }\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"CHANGELOG.md\"\n ],\n \"keywords\": [\n \"wealthfolio\",\n \"addon\",\n \"plugin\",\n \"sdk\",\n \"typescript\",\n \"financial\",\n \"portfolio\"\n ],\n \"author\": \"Wealthfolio Team\",\n \"license\": \"MIT\",\n \"homepage\": \"https://wealthfolio.app/addons\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/afadil/wealthfolio.git\",\n \"directory\": \"packages/addon-sdk\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/afadil/wealthfolio/issues\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"clean\": \"rm -rf dist\",\n \"lint\": \"tsc --noEmit\",\n \"prepack\": \"npm run build\"\n },\n \"devDependencies\": {\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\"\n },\n \"peerDependencies\": {\n \"react\": \"^18.0.0\"\n },\n \"engines\": {\n \"node\": \">=20.0.0\"\n }\n} ","import packageJson from '../package.json';\n\n/**\n * Current SDK version from package.json\n */\nexport const SDK_VERSION = packageJson.version;\n","/**\n * Utility functions for addon development\n */\n\nimport type { AddonManifest, AddonValidationResult } from './manifest';\nimport { SDK_VERSION } from './version';\n\n/**\n * Validates an addon manifest\n */\nexport function validateManifest(manifest: AddonManifest): AddonValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n\n // Required fields\n if (!manifest.id) {\n errors.push('Addon ID is required');\n } else if (!/^[a-z0-9-]+$/.test(manifest.id)) {\n errors.push('Addon ID must contain only lowercase letters, numbers, and hyphens');\n }\n\n if (!manifest.name) {\n errors.push('Addon name is required');\n }\n\n if (!manifest.version) {\n errors.push('Addon version is required');\n } else if (!/^\\d+\\.\\d+\\.\\d+/.test(manifest.version)) {\n warnings.push('Version should follow semantic versioning (e.g., 1.0.0)');\n }\n\n // Optional but recommended fields\n if (!manifest.description) {\n warnings.push('Description is recommended for better discoverability');\n }\n\n if (!manifest.author) {\n warnings.push('Author information is recommended');\n }\n\n if (!manifest.main) {\n warnings.push('Main entry point not specified, defaulting to \"addon.js\"');\n }\n\n // Validate permissions if present\n if (manifest.permissions) {\n manifest.permissions.forEach((permission, index) => {\n if (!permission.category) {\n errors.push(`Permission ${index}: category is required`);\n }\n if (!permission.functions || permission.functions.length === 0) {\n errors.push(`Permission ${index}: at least one function must be specified`);\n }\n if (!permission.purpose) {\n warnings.push(`Permission ${index}: purpose explanation is recommended`);\n }\n });\n }\n\n return {\n valid: errors.length === 0,\n errors,\n warnings\n };\n}\n\n\n\n/**\n * Checks if an addon version is compatible with the current SDK\n */\nexport function isCompatibleVersion(addonSdkVersion?: string, currentSdkVersion = SDK_VERSION): boolean {\n if (!addonSdkVersion) return true; // Assume compatible if not specified\n \n const [addonMajor, addonMinor] = addonSdkVersion.split('.').map(Number);\n const [currentMajor, currentMinor] = currentSdkVersion.split('.').map(Number);\n \n // Same major version, and addon minor version <= current minor version\n return addonMajor === currentMajor && addonMinor <= currentMinor;\n}\n\n/**\n * Formats addon size in human-readable format\n */\nexport function formatAddonSize(bytes: number): string {\n const sizes = ['B', 'KB', 'MB', 'GB'];\n if (bytes === 0) return '0 B';\n \n const i = Math.floor(Math.log(bytes) / Math.log(1024));\n const size = bytes / Math.pow(1024, i);\n \n return `${size.toFixed(i === 0 ? 0 : 1)} ${sizes[i]}`;\n}\n\n/**\n * Generates a unique addon ID from a name\n */\nexport function generateAddonId(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, '') // Remove special characters\n .replace(/\\s+/g, '-') // Replace spaces with hyphens\n .replace(/-+/g, '-') // Replace multiple hyphens with single\n .replace(/^-|-$/g, ''); // Remove leading/trailing hyphens\n}\n\n/**\n * Type guard to check if an object is a valid addon manifest\n */\nexport function isAddonManifest(obj: any): obj is AddonManifest {\n return (\n typeof obj === 'object' &&\n obj !== null &&\n typeof obj.id === 'string' &&\n typeof obj.name === 'string' &&\n typeof obj.version === 'string'\n );\n}\n","/**\n * @wealthfolio/addon-sdk\n * \n * TypeScript SDK for building Wealthfolio addons with enhanced functionality,\n * type safety, and comprehensive permission management.\n * \n * @version 1.0.0\n * @author Wealthfolio Team\n * @license MIT\n */\n\n// Core types\nexport type {\n AddonContext,\n AddonEnableFunction,\n SidebarItemHandle,\n SidebarItemConfig,\n RouteConfig,\n SidebarManager,\n RouterManager,\n EventCallback,\n UnlistenFn,\n} from './types';\n\n// Host API interface\nexport type { HostAPI } from './host-api';\n\n// Query Client and Keys exports\nexport type { QueryClient } from '@tanstack/react-query';\nexport { QueryKeys } from './query-keys';\n\n// Comprehensive data types\nexport type * from './data-types';\n\n// Manifest and metadata types\nexport type {\n AddonManifest,\n DevelopmentManifest,\n InstalledManifest,\n AddonFile,\n ExtractedAddon,\n InstalledAddon,\n AddonInstallResult,\n AddonValidationResult,\n AddonStoreListing,\n AddonUpdateInfo,\n AddonUpdateCheckResult,\n} from './manifest';\n\nexport {\n isInstalledManifest,\n} from './manifest';\n\n// Permission system\nexport type {\n RiskLevel,\n Permission,\n PermissionCategory,\n FunctionPermission,\n} from './permissions';\n\nexport {\n PERMISSION_CATEGORIES,\n getPermissionCategory,\n getPermissionCategoriesByRisk,\n getFunctionRiskLevel,\n isPermissionRequired,\n} from './permissions';\n\n// Utilities\nexport {\n validateManifest,\n isCompatibleVersion,\n formatAddonSize,\n generateAddonId,\n isAddonManifest,\n} from './utils';\n\n// -----------------------------------------------------------------------------\n// Framework version contract\n// -----------------------------------------------------------------------------\n\n/**\n * React version guaranteed by the host application. Addons may assert against\n * this at runtime if they rely on a particular React feature set.\n */\nexport const ReactVersion = '18.3.1';\n\n/**\n * Addons receive their context as a parameter to the enable() function.\n * Each addon gets its own isolated context with scoped secret storage.\n * \n * Example:\n * export default function enable(ctx: AddonContext) {\n * // Use ctx.api.secrets.set/get/delete for secure storage\n * // Use ctx.sidebar.addItem() to add navigation\n * // Use ctx.router.add() to register routes\n * }\n */ \n\nexport const React = (window as any).React as typeof import('react');\nexport const ReactDOM = (window as any).ReactDOM as typeof import('react-dom'); \n\n// Version\nexport { SDK_VERSION } from './version';"],"mappings":";;;;;;;;;AAIO,IAAM,YAAY;AAAA;AAAA,EAEvB,UAAU;AAAA,EACV,kBAAkB;AAAA;AAAA,EAGlB,eAAe;AAAA,EACf,YAAY;AAAA;AAAA,EAGZ,UAAU;AAAA,EACV,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,eAAe;AAAA;AAAA,EAGf,OAAO;AAAA,EACP,mBAAmB;AAAA;AAAA,EAGnB,UAAU;AAAA,EACV,gBAAgB;AAAA;AAAA,EAGhB,uBAAuB;AAAA,EACvB,OAAO;AAAA,EAEP,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAE7B,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAEhB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EAErB,mBAAmB;AAAA;AAAA,EAEnB,kBAAkB,CAAC,OAAe,CAAC,UAAU,mBAAmB,EAAE;AAAA;AAAA,EAGlE,6BAA6B;AAAA,EAC7B,2BAA2B,CAAC,eAAyB;AAAA,IACnD,UAAU;AAAA,IACV,CAAC,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK;AAAA,EACtC;AAAA;AAAA,EAGA,uBAAuB;AAAA,EACvB,+BAA+B;AAAA,EAE/B,cAAc;AAAA,EACd,kBAAkB;AAAA;AAAA,EAGlB,cAAc;AAAA,EAEd,eAAe;AAAA;AAAA,EAG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