@wealthfolio/addon-sdk 3.5.1 → 3.6.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/README.md CHANGED
@@ -258,11 +258,11 @@ const enable: AddonEnableFunction = (context) => {
258
258
  const addedItems: Array<{ remove: () => void }> = [];
259
259
 
260
260
  try {
261
- // Add sidebar navigation item with icon from UI library
261
+ // Add sidebar navigation item with a host-supported icon token
262
262
  const sidebarItem = context.sidebar.addItem({
263
263
  id: 'investment-fees-tracker',
264
264
  label: 'Fee Tracker',
265
- icon: <Icons.Invoice className="h-5 w-5" />,
265
+ icon: 'receipt',
266
266
  route: '/addons/investment-fees-tracker',
267
267
  order: 200
268
268
  });
@@ -726,7 +726,8 @@ Add an item to the application sidebar.
726
726
 
727
727
  - `config.id` (string): Unique identifier
728
728
  - `config.label` (string): Display text
729
- - `config.icon` (string | ReactNode): Icon name or component
729
+ - `config.icon` (string): Host-supported icon token, such as `receipt`,
730
+ `chart-bar`, or `calendar-dots`
730
731
  - `config.route` (string): Navigation route
731
732
  - `config.order` (number): Display order (optional)
732
733
  - `config.onClick` (function): Click handler (optional)
@@ -0,0 +1,61 @@
1
+ // src/goal-progress.ts
2
+ function isParticipatingGoal(goal) {
3
+ if (goal.statusLifecycle) {
4
+ return goal.statusLifecycle === "active";
5
+ }
6
+ return true;
7
+ }
8
+ function getFiniteAmount(value) {
9
+ if (value === null || value === void 0 || value === "") {
10
+ return void 0;
11
+ }
12
+ const amount = typeof value === "number" ? value : Number(value);
13
+ return Number.isFinite(amount) ? amount : void 0;
14
+ }
15
+ function toFiniteAmount(value) {
16
+ return getFiniteAmount(value) ?? 0;
17
+ }
18
+ function calculateGoalProgress(accountsValuations, goals, allocations) {
19
+ if (!goals) {
20
+ return [];
21
+ }
22
+ const baseCurrency = accountsValuations?.[0]?.baseCurrency ?? "USD";
23
+ const accountValueMap = /* @__PURE__ */ new Map();
24
+ accountsValuations?.forEach((account) => {
25
+ const valueInBaseCurrency = account.totalValueBase ?? 0;
26
+ accountValueMap.set(account.accountId, valueInBaseCurrency);
27
+ });
28
+ const allocationsByGoal = /* @__PURE__ */ new Map();
29
+ allocations?.forEach((alloc) => {
30
+ const existing = allocationsByGoal.get(alloc.goalId) ?? [];
31
+ allocationsByGoal.set(alloc.goalId, [...existing, alloc]);
32
+ });
33
+ const sortedGoals = [...goals].filter(isParticipatingGoal).sort(
34
+ (a, b) => toFiniteAmount(a.summaryTargetAmount ?? a.targetAmount) - toFiniteAmount(b.summaryTargetAmount ?? b.targetAmount)
35
+ );
36
+ return sortedGoals.map((goal) => {
37
+ const goalAllocations = allocationsByGoal.get(goal.id) ?? [];
38
+ const targetAmount = toFiniteAmount(goal.summaryTargetAmount ?? goal.targetAmount);
39
+ const totalAllocatedValue = goalAllocations.reduce((total, allocation) => {
40
+ const accountValueInBase = accountValueMap.get(allocation.accountId) ?? 0;
41
+ return total + accountValueInBase * allocation.sharePercent / 100;
42
+ }, 0);
43
+ const currentValue = getFiniteAmount(goal.summaryCurrentValue) ?? totalAllocatedValue;
44
+ const progress = getFiniteAmount(goal.summaryProgress) ?? (targetAmount > 0 ? currentValue / targetAmount : 0);
45
+ return {
46
+ goalId: goal.id,
47
+ name: goal.title,
48
+ targetValue: targetAmount,
49
+ currentValue,
50
+ progress,
51
+ currency: goal.currency ?? baseCurrency,
52
+ statusHealth: goal.statusHealth,
53
+ targetDate: goal.targetDate
54
+ };
55
+ });
56
+ }
57
+
58
+ export {
59
+ calculateGoalProgress
60
+ };
61
+ //# sourceMappingURL=chunk-465MB7HT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/goal-progress.ts"],"sourcesContent":["import type { Goal, GoalAllocation, AccountValuation, GoalProgress } from './data-types';\n\nfunction isParticipatingGoal(goal: Goal): boolean {\n if (goal.statusLifecycle) {\n return goal.statusLifecycle === 'active';\n }\n\n return true;\n}\n\nfunction getFiniteAmount(value: unknown): number | undefined {\n if (value === null || value === undefined || value === '') {\n return undefined;\n }\n\n const amount = typeof value === 'number' ? value : Number(value);\n return Number.isFinite(amount) ? amount : undefined;\n}\n\nfunction toFiniteAmount(value: unknown): number {\n return getFiniteAmount(value) ?? 0;\n}\n\n/**\n * Calculate goal progress from goal summaries, falling back to allocations.\n */\nexport function calculateGoalProgress(\n accountsValuations: AccountValuation[],\n goals: Goal[],\n allocations: GoalAllocation[],\n): GoalProgress[] {\n if (!goals) {\n return [];\n }\n\n const baseCurrency = accountsValuations?.[0]?.baseCurrency ?? 'USD';\n\n // accountId -> totalValue in base currency\n const accountValueMap = new Map<string, number>();\n accountsValuations?.forEach((account) => {\n const valueInBaseCurrency = account.totalValueBase ?? 0;\n accountValueMap.set(account.accountId, valueInBaseCurrency);\n });\n\n // goalId -> allocations\n const allocationsByGoal = new Map<string, GoalAllocation[]>();\n allocations?.forEach((alloc) => {\n const existing = allocationsByGoal.get(alloc.goalId) ?? [];\n allocationsByGoal.set(alloc.goalId, [...existing, alloc]);\n });\n\n const sortedGoals = [...goals]\n .filter(isParticipatingGoal)\n .sort(\n (a, b) =>\n toFiniteAmount(a.summaryTargetAmount ?? a.targetAmount) -\n toFiniteAmount(b.summaryTargetAmount ?? b.targetAmount),\n );\n\n return sortedGoals.map((goal) => {\n const goalAllocations = allocationsByGoal.get(goal.id) ?? [];\n const targetAmount = toFiniteAmount(goal.summaryTargetAmount ?? goal.targetAmount);\n\n const totalAllocatedValue = goalAllocations.reduce((total, allocation) => {\n const accountValueInBase = accountValueMap.get(allocation.accountId) ?? 0;\n return total + (accountValueInBase * allocation.sharePercent) / 100;\n }, 0);\n\n const currentValue = getFiniteAmount(goal.summaryCurrentValue) ?? totalAllocatedValue;\n const progress =\n getFiniteAmount(goal.summaryProgress) ??\n (targetAmount > 0 ? currentValue / targetAmount : 0);\n\n return {\n goalId: goal.id,\n name: goal.title,\n targetValue: targetAmount,\n currentValue,\n progress,\n currency: goal.currency ?? baseCurrency,\n statusHealth: goal.statusHealth,\n targetDate: goal.targetD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,YAAY;AAEjF,UAAM,sBAAsB,gBAAgB,OAAO,CAAC,OAAO,eAAe;AACxE,YAAM,qBAAqB,gBAAgB,IAAI,WAAW,SAAS,KAAK;AACxE,aAAO,QAAS,qBAAqB,WAAW,eAAgB;AAAA,IAClE,GAAG,CAAC;AAEJ,UAAM,eAAe,gBAAgB,KAAK,mBAAmB,KAAK;AAClE,UAAM,WACJ,gBAAgB,KAAK,eAAe,MACnC,eAAe,IAAI,eAAe,eAAe;AAEpD,WAAO;AAAA,MACL,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK;AAAA,MACX,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA,UAAU,KAAK,YAAY;AAAA,MAC3B,cAAc,KAAK;AAAA,MACnB,YAAY,KAAK;AAAA,IACnB;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,193 @@
1
+ import {
2
+ HOST_DEPENDENCIES
3
+ } from "./chunk-AAIYUZY5.js";
4
+
5
+ // package.json
6
+ var package_default = {
7
+ name: "@wealthfolio/addon-sdk",
8
+ version: "3.6.0",
9
+ type: "module",
10
+ description: "TypeScript SDK for building Wealthfolio addons with enhanced functionality and type safety",
11
+ main: "dist/index.js",
12
+ types: "dist/src/index.d.ts",
13
+ exports: {
14
+ ".": {
15
+ import: "./dist/index.js",
16
+ types: "./dist/src/index.d.ts"
17
+ },
18
+ "./types": {
19
+ import: "./dist/types.js",
20
+ types: "./dist/src/types.d.ts"
21
+ },
22
+ "./host-api": {
23
+ import: "./dist/host-api.js",
24
+ types: "./dist/src/host-api.d.ts"
25
+ },
26
+ "./host-dependencies": {
27
+ import: "./dist/host-dependencies.js",
28
+ types: "./dist/src/host-dependencies.d.ts"
29
+ },
30
+ "./manifest": {
31
+ import: "./dist/manifest.js",
32
+ types: "./dist/src/manifest.d.ts"
33
+ },
34
+ "./permissions": {
35
+ import: "./dist/permissions.js",
36
+ types: "./dist/src/permissions.d.ts"
37
+ },
38
+ "./query-keys": {
39
+ import: "./dist/query-keys.js",
40
+ types: "./dist/src/query-keys.d.ts"
41
+ },
42
+ "./utils": {
43
+ import: "./dist/utils.js",
44
+ types: "./dist/src/utils.d.ts"
45
+ },
46
+ "./goal-progress": {
47
+ import: "./dist/goal-progress.js",
48
+ types: "./dist/src/goal-progress.d.ts"
49
+ }
50
+ },
51
+ files: [
52
+ "dist",
53
+ "README.md",
54
+ "CHANGELOG.md"
55
+ ],
56
+ keywords: [
57
+ "wealthfolio",
58
+ "addon",
59
+ "plugin",
60
+ "sdk",
61
+ "typescript",
62
+ "financial",
63
+ "portfolio"
64
+ ],
65
+ author: "Wealthfolio Team",
66
+ license: "MIT",
67
+ homepage: "https://wealthfolio.app/addons",
68
+ repository: {
69
+ type: "git",
70
+ url: "https://github.com/wealthfolio/wealthfolio.git",
71
+ directory: "packages/addon-sdk"
72
+ },
73
+ bugs: {
74
+ url: "https://github.com/wealthfolio/wealthfolio/issues"
75
+ },
76
+ scripts: {
77
+ build: "tsup && pnpm run build:types",
78
+ dev: "tsup --watch",
79
+ clean: "rm -rf dist",
80
+ lint: "eslint .",
81
+ "lint:fix": "eslint . --fix",
82
+ "lint:quiet": "eslint . --quiet",
83
+ format: "prettier --write .",
84
+ "format:check": "prettier --check .",
85
+ "type-check": "tsc --noEmit",
86
+ "build:types": "tsc -p tsconfig.json",
87
+ prepack: "npm run build"
88
+ },
89
+ peerDependencies: {
90
+ react: "^19.2.4",
91
+ "react-dom": "^19.2.4"
92
+ },
93
+ devDependencies: {
94
+ "@tanstack/react-query": "^5.90.20",
95
+ "@types/react": "^19.2.13",
96
+ "@types/react-dom": "^19.2.3",
97
+ tsup: "^8.5.1",
98
+ typescript: "^5.9.3"
99
+ },
100
+ engines: {
101
+ node: ">=20.0.0"
102
+ }
103
+ };
104
+
105
+ // src/version.ts
106
+ var SDK_VERSION = package_default.version;
107
+
108
+ // src/utils.ts
109
+ function validateManifest(manifest) {
110
+ const errors = [];
111
+ const warnings = [];
112
+ if (!manifest.id) {
113
+ errors.push("Addon ID is required");
114
+ } else if (!/^[a-z0-9-]+$/.test(manifest.id)) {
115
+ errors.push("Addon ID must contain only lowercase letters, numbers, and hyphens");
116
+ }
117
+ if (!manifest.name) {
118
+ errors.push("Addon name is required");
119
+ }
120
+ if (!manifest.version) {
121
+ errors.push("Addon version is required");
122
+ } else if (!/^\d+\.\d+\.\d+/.test(manifest.version)) {
123
+ warnings.push("Version should follow semantic versioning (e.g., 1.0.0)");
124
+ }
125
+ if (!manifest.description) {
126
+ warnings.push("Description is recommended for better discoverability");
127
+ }
128
+ if (!manifest.author) {
129
+ warnings.push("Author information is recommended");
130
+ }
131
+ if (!manifest.main) {
132
+ warnings.push('Main entry point not specified, defaulting to "addon.js"');
133
+ }
134
+ if (manifest.hostDependencies) {
135
+ Object.entries(manifest.hostDependencies).forEach(([name, version]) => {
136
+ if (!version) {
137
+ errors.push(`Host dependency ${name}: version range is required`);
138
+ }
139
+ if (!Object.prototype.hasOwnProperty.call(HOST_DEPENDENCIES, name)) {
140
+ warnings.push(
141
+ `Host dependency ${name} is not provided by Wealthfolio and should be bundled`
142
+ );
143
+ }
144
+ });
145
+ }
146
+ if (manifest.permissions) {
147
+ manifest.permissions.forEach((permission, index) => {
148
+ if (!permission.category) {
149
+ errors.push(`Permission ${index}: category is required`);
150
+ }
151
+ if (!permission.functions || permission.functions.length === 0) {
152
+ errors.push(`Permission ${index}: at least one function must be specified`);
153
+ }
154
+ if (!permission.purpose) {
155
+ warnings.push(`Permission ${index}: purpose explanation is recommended`);
156
+ }
157
+ });
158
+ }
159
+ return {
160
+ valid: errors.length === 0,
161
+ errors,
162
+ warnings
163
+ };
164
+ }
165
+ function isCompatibleVersion(addonSdkVersion, currentSdkVersion = SDK_VERSION) {
166
+ if (!addonSdkVersion) return true;
167
+ const [addonMajor, addonMinor] = addonSdkVersion.split(".").map(Number);
168
+ const [currentMajor, currentMinor] = currentSdkVersion.split(".").map(Number);
169
+ return addonMajor === currentMajor && addonMinor <= currentMinor;
170
+ }
171
+ function formatAddonSize(bytes) {
172
+ const sizes = ["B", "KB", "MB", "GB"];
173
+ if (bytes === 0) return "0 B";
174
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
175
+ const size = bytes / Math.pow(1024, i);
176
+ return `${size.toFixed(i === 0 ? 0 : 1)} ${sizes[i]}`;
177
+ }
178
+ function generateAddonId(name) {
179
+ return name.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
180
+ }
181
+ function isAddonManifest(obj) {
182
+ return typeof obj === "object" && obj !== null && typeof obj.id === "string" && typeof obj.name === "string" && typeof obj.version === "string";
183
+ }
184
+
185
+ export {
186
+ SDK_VERSION,
187
+ validateManifest,
188
+ isCompatibleVersion,
189
+ formatAddonSize,
190
+ generateAddonId,
191
+ isAddonManifest
192
+ };
193
+ //# sourceMappingURL=chunk-5XUF4TB3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/version.ts","../src/utils.ts"],"sourcesContent":["{\n \"name\": \"@wealthfolio/addon-sdk\",\n \"version\": \"3.6.0\",\n \"type\": \"module\",\n \"description\": \"TypeScript SDK for building Wealthfolio addons with enhanced functionality and type safety\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/src/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"types\": \"./dist/src/index.d.ts\"\n },\n \"./types\": {\n \"import\": \"./dist/types.js\",\n \"types\": \"./dist/src/types.d.ts\"\n },\n \"./host-api\": {\n \"import\": \"./dist/host-api.js\",\n \"types\": \"./dist/src/host-api.d.ts\"\n },\n \"./host-dependencies\": {\n \"import\": \"./dist/host-dependencies.js\",\n \"types\": \"./dist/src/host-dependencies.d.ts\"\n },\n \"./manifest\": {\n \"import\": \"./dist/manifest.js\",\n \"types\": \"./dist/src/manifest.d.ts\"\n },\n \"./permissions\": {\n \"import\": \"./dist/permissions.js\",\n \"types\": \"./dist/src/permissions.d.ts\"\n },\n \"./query-keys\": {\n \"import\": \"./dist/query-keys.js\",\n \"types\": \"./dist/src/query-keys.d.ts\"\n },\n \"./utils\": {\n \"import\": \"./dist/utils.js\",\n \"types\": \"./dist/src/utils.d.ts\"\n },\n \"./goal-progress\": {\n \"import\": \"./dist/goal-progress.js\",\n \"types\": \"./dist/src/goal-progress.d.ts\"\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/wealthfolio/wealthfolio.git\",\n \"directory\": \"packages/addon-sdk\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/wealthfolio/wealthfolio/issues\"\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm run build:types\",\n \"dev\": \"tsup --watch\",\n \"clean\": \"rm -rf dist\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint . --fix\",\n \"lint:quiet\": \"eslint . --quiet\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"type-check\": \"tsc --noEmit\",\n \"build:types\": \"tsc -p tsconfig.json\",\n \"prepack\": \"npm run build\"\n },\n \"peerDependencies\": {\n \"react\": \"^19.2.4\",\n \"react-dom\": \"^19.2.4\"\n },\n \"devDependencies\": {\n \"@tanstack/react-query\": \"^5.90.20\",\n \"@types/react\": \"^19.2.13\",\n \"@types/react-dom\": \"^19.2.3\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5.9.3\"\n },\n \"engines\": {\n \"node\": \">=20.0.0\"\n }\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 { HOST_DEPENDENCIES } from './host-dependencies';\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 if (manifest.hostDependencies) {\n Object.entries(manifest.hostDependencies).forEach(([name, version]) => {\n if (!version) {\n errors.push(`Host dependency ${name}: version range is required`);\n }\n if (!Object.prototype.hasOwnProperty.call(HOST_DEPENDENCIES, name)) {\n warnings.push(\n `Host dependency ${name} is not provided by Wealthfolio and should be bundled`,\n );\n }\n });\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 * Checks if an addon version is compatible with the current SDK\n */\nexport function isCompatibleVersion(\n addonSdkVersion?: string,\n currentSdkVersion = SDK_VERSION,\n): 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: unknown): obj is AddonManifest {\n return (\n typeof obj === 'object' &&\n obj !== null &&\n typeof (obj as Record<string, unknown>).id === 'string' &&\n typeof (obj as Record<string, unknown>).name === 'string' &&\n typeof (obj as Record<string, unknown>).version === 'string'\n );\n}\n"],"mappings":";;;;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,QAAU;AAAA,MACV,OAAS;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACT,QAAU;AAAA,MACV,OAAS;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACZ,QAAU;AAAA,MACV,OAAS;AAAA,IACX;AAAA,IACA,uBAAuB;AAAA,MACrB,QAAU;AAAA,MACV,OAAS;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACZ,QAAU;AAAA,MACV,OAAS;A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H;AAEA,SAAO;AAAA,IACL,OAAO,OAAO,WAAW;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AACF;AAKO,SAAS,oBACd,iBACA,oBAAoB,aACX;AACT,MAAI,CAAC,gBAAiB,QAAO;AAE7B,QAAM,CAAC,YAAY,UAAU,IAAI,gBAAgB,MAAM,GAAG,EAAE,IAAI,MAAM;AACtE,QAAM,CAAC,cAAc,YAAY,IAAI,kBAAkB,MAAM,GAAG,EAAE,IAAI,MAAM;AAG5E,SAAO,eAAe,gBAAgB,cAAc;AACtD;AAKO,SAAS,gBAAgB,OAAuB;AACrD,QAAM,QAAQ,CAAC,KAAK,MAAM,MAAM,IAAI;AACpC,MAAI,UAAU,EAAG,QAAO;AAExB,QAAM,IAAI,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC;AACrD,QAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,CAAC;AAErC,SAAO,GAAG,KAAK,QAAQ,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AACrD;AAKO,SAAS,gBAAgB,MAAsB;AACpD,SAAO,KACJ,YAAY,EACZ,QAAQ,iBAAiB,EAAE,EAC3B,QAAQ,QAAQ,GAAG,EACnB,QAAQ,OAAO,GAAG,EAClB,QAAQ,UAAU,EAAE;AACzB;AAKO,SAAS,gBAAgB,KAAoC;AAClE,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,OAAQ,IAAgC,OAAO,YAC/C,OAAQ,IAAgC,SAAS,YACjD,OAAQ,IAAgC,YAAY;AAExD;","names":[]}
@@ -0,0 +1,16 @@
1
+ // src/host-dependencies.ts
2
+ var HOST_DEPENDENCIES = {
3
+ "@tanstack/react-query": "^5.90.0",
4
+ "@wealthfolio/addon-sdk": "^3.6.0",
5
+ "@wealthfolio/ui": "^3.6.0",
6
+ "date-fns": "^4.1.0",
7
+ "lucide-react": "^0.561.0",
8
+ react: "^19.2.0",
9
+ "react-dom": "^19.2.0",
10
+ recharts: "^3.7.0"
11
+ };
12
+
13
+ export {
14
+ HOST_DEPENDENCIES
15
+ };
16
+ //# sourceMappingURL=chunk-AAIYUZY5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host-dependencies.ts"],"sourcesContent":["export const HOST_DEPENDENCIES = {\n '@tanstack/react-query': '^5.90.0',\n '@wealthfolio/addon-sdk': '^3.6.0',\n '@wealthfolio/ui': '^3.6.0',\n 'date-fns': '^4.1.0',\n 'lucide-react': '^0.561.0',\n react: '^19.2.0',\n 'react-dom': '^19.2.0',\n recharts: '^3.7.0',\n} as const;\n"],"mappings":";AAAO,IAAM,oBAAoB;AAAA,EAC/B,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,UAAU;AACZ;","names":[]}
@@ -0,0 +1,9 @@
1
+ // src/manifest.ts
2
+ function isInstalledManifest(manifest) {
3
+ return !!(manifest.installedAt && manifest.main !== void 0 && manifest.enabled !== void 0);
4
+ }
5
+
6
+ export {
7
+ isInstalledManifest
8
+ };
9
+ //# sourceMappingURL=chunk-O566EAIL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/manifest.ts"],"sourcesContent":["/**\n * Addon manifest and metadata types\n */\n\nimport type { Permission } from './permissions';\n\nexport interface AddonNetworkAccess {\n allowedHosts: string[];\n approvedHosts?: string[];\n}\n\nexport type AddonHostDependencies = Record<string, string>;\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 /** Network hosts this addon may reach through the host broker */\n network?: AddonNetworkAccess;\n /** Host-provided packages this addon imports instead of bundling */\n hostDependencies?: AddonHostDependencies;\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(\n manifest: AddonManifest,\n): manifest is Required<Pick<AddonManifest, 'main' | 'enabled' | 'installedAt'>> &\n AddonManifest {\n return !!(\n manifest.installedAt &&\n manifest.main !== undefined &&\n manifest.enabled !== undefined\n );\n}\n\n/**\n * Helper type for development manifests (without runtime fields)\n */\nexport type DevelopmentManifest = Omit<\n AddonManifest,\n 'installedAt' | 'updatedAt' | 'source' | 'size'\n>;\n\n/**\n * Helper type for installed manifests (with runtime fields)\n */\nexport type InstalledManifest = Required<\n Pick<AddonManifest, 'main' | 'enabled' | 'installedAt'>\n> &\n 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 /** Optional SHA-256 digest for the update package bytes */\n sha256?: 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 /** Optional SHA-256 digest for the package bytes */\n sha256?: 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"],"mappings":";AAoEO,SAAS,oBACd,UAEc;AACd,SAAO,CAAC,EACN,SAAS,eACT,SAAS,SAAS,UAClB,SAAS,YAAY;AAEzB;","names":[]}
@@ -0,0 +1,61 @@
1
+ // src/query-keys.ts
2
+ var QueryKeys = {
3
+ // Account related keys
4
+ ACCOUNTS: "accounts",
5
+ ACCOUNTS_SUMMARY: "accounts_summary",
6
+ // Activity related keys
7
+ ACTIVITY_DATA: "activity-data",
8
+ ACTIVITIES: "activities",
9
+ // Portfolio related keys
10
+ HOLDINGS: "holdings",
11
+ HOLDING: "holding",
12
+ INCOME_SUMMARY: "incomeSummary",
13
+ PORTFOLIO_SUMMARY: "portfolioSummary",
14
+ QUOTE_HISTORY: "quoteHistory",
15
+ // Goals related keys
16
+ GOALS: "goals",
17
+ GOALS_ALLOCATIONS: "goals_allocations",
18
+ // Settings related keys
19
+ SETTINGS: "settings",
20
+ EXCHANGE_RATES: "exchangeRates",
21
+ // New keys for exchange rates
22
+ EXCHANGE_RATE_SYMBOLS: "exchange_rate_symbols",
23
+ QUOTE: "quote",
24
+ CONTRIBUTION_LIMITS: "contributionLimits",
25
+ CONTRIBUTION_LIMIT_PROGRESS: "contributionLimitProgress",
26
+ ASSET_DATA: "asset_data",
27
+ IMPORT_MAPPING: "import_mapping",
28
+ PERFORMANCE_SUMMARY: "performanceSummary",
29
+ PERFORMANCE_HISTORY: "performanceHistory",
30
+ HISTORY_VALUATION: "historyValuation",
31
+ // Helper function to create account-specific keys
32
+ valuationHistory: (id) => [QueryKeys.HISTORY_VALUATION, id],
33
+ // Account simple performance
34
+ ACCOUNTS_SIMPLE_PERFORMANCE: "accountsSimplePerformance",
35
+ accountsSimplePerformance: (accountIds) => [
36
+ QueryKeys.ACCOUNTS_SIMPLE_PERFORMANCE,
37
+ [...accountIds].sort().join(",") || "none"
38
+ ],
39
+ // Market Data Providers
40
+ MARKET_DATA_PROVIDERS: "marketDataProviders",
41
+ MARKET_DATA_PROVIDER_SETTINGS: "marketDataProviderSettings",
42
+ transactions: "transactions",
43
+ latestValuations: "latest-valuations",
44
+ // Market Data
45
+ symbolSearch: "symbol-search",
46
+ ASSET_HISTORY: "asset-history",
47
+ // Addons
48
+ INSTALLED_ADDONS: "installedAddons",
49
+ ADDON_STORE_LISTINGS: "addonStoreListings",
50
+ ADDON_AUTO_UPDATE_CHECK: "addonAutoUpdateCheck",
51
+ SNAPSHOTS: "snapshots",
52
+ snapshots: (accountId) => [QueryKeys.SNAPSHOTS, accountId],
53
+ secrets: {
54
+ apiKey: (providerId) => ["secrets", "apiKey", providerId]
55
+ }
56
+ };
57
+
58
+ export {
59
+ QueryKeys
60
+ };
61
+ //# sourceMappingURL=chunk-PYPEFQCY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/query-keys.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 SNAPSHOTS: 'snapshots',\n snapshots: (accountId: string) => [QueryKeys.SNAPSHOTS, accountId],\n\n secrets: {\n apiKey: (providerId: string) => ['secrets', 'apiKey', providerId],\n },\n} as const;\n\nexport type QueryKeys = typeof QueryKeys;\n"],"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,EAGf,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,yBAAyB;AAAA,EAEzB,WAAW;AAAA,EACX,WAAW,CAAC,cAAsB,CAAC,UAAU,WAAW,SAAS;AAAA,EAEjE,SAAS;AAAA,IACP,QAAQ,CAAC,eAAuB,CAAC,WAAW,UAAU,UAAU;AAAA,EAClE;AACF;","names":[]}
@@ -114,7 +114,7 @@ var PERMISSION_CATEGORIES = [
114
114
  id: "secrets",
115
115
  name: "Secrets Management",
116
116
  description: "Access to secure storage for addon secrets",
117
- functions: ["set", "get", "delete"],
117
+ functions: ["set", "get", "use", "delete"],
118
118
  riskLevel: "high"
119
119
  },
120
120
  {
@@ -147,11 +147,25 @@ var PERMISSION_CATEGORIES = [
147
147
  ],
148
148
  riskLevel: "low"
149
149
  },
150
+ {
151
+ id: "query",
152
+ name: "Query Cache",
153
+ description: "Access to refresh host application data",
154
+ functions: ["invalidateQueries", "refetchQueries"],
155
+ riskLevel: "low"
156
+ },
157
+ {
158
+ id: "network",
159
+ name: "Network Access",
160
+ description: "Access to declared external HTTPS hosts through the host network broker",
161
+ functions: ["request"],
162
+ riskLevel: "high"
163
+ },
150
164
  {
151
165
  id: "ui",
152
166
  name: "User Interface",
153
167
  description: "Access to modify navigation and add UI components",
154
- functions: ["sidebar.addItem", "router.add"],
168
+ functions: ["sidebar.addItem", "router.add", "navigation.navigate", "onDisable"],
155
169
  riskLevel: "low"
156
170
  }
157
171
  ];
@@ -227,4 +241,4 @@ export {
227
241
  addDetectedFunction,
228
242
  markFunctionAsDeclared
229
243
  };
230
- //# sourceMappingURL=chunk-ISD4MMHY.js.map
244
+ //# sourceMappingURL=chunk-SEHD46ND.js.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 * 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: ['searchTicker', 'syncHistory', 'sync', 'getProviders', 'fetchDividends'],\n riskLevel: 'low',\n },\n {\n id: 'assets',\n name: 'Asset Management',\n description: 'Access to asset profiles and data sources',\n functions: ['getProfile', 'updateProfile', 'updateQuoteMode'],\n riskLevel: 'medium',\n },\n {\n id: 'quotes',\n name: 'Quote Management',\n description: 'Access to price quotes and historical data',\n functions: ['update', 'getHistory'],\n riskLevel: 'low',\n },\n {\n id: 'performance',\n name: 'Performance Analytics',\n description: 'Access to performance calculations and metrics',\n functions: ['calculateHistory', 'calculateSummary', 'calculateAccountsSimple'],\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: 'financial-planning',\n name: 'Financial Planning',\n description: 'Access to financial goals and allocations',\n functions: [\n 'getAll',\n 'create',\n 'update',\n 'getFunding',\n 'saveFunding',\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: ['getAll', 'create', 'update', 'calculateDeposits'],\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', 'use', 'delete'],\n riskLevel: 'high',\n },\n {\n id: 'snapshots',\n name: 'Snapshot Management',\n description: 'Access to holdings snapshots for accounts with holdings tracking mode',\n functions: [\n 'getAll',\n 'getByDate',\n 'save',\n 'checkImport',\n 'importSnapshots',\n 'delete',\n ],\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: 'query',\n name: 'Query Cache',\n description: 'Access to refresh host application data',\n functions: ['invalidateQueries', 'refetchQueries'],\n riskLevel: 'low',\n },\n {\n id: 'network',\n name: 'Network Access',\n description:\n 'Access to declared external HTTPS hosts through the host network broker',\n functions: ['request'],\n riskLevel: 'high',\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', 'navigation.navigate', 'onDisable'],\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 = false,\n isDetected = 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(\n riskLevel: RiskLevel,\n): 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.filter((func) => func.isDeclared).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.filter((func) => func.isDetected).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(\n createFunctionPermission(functionName, false, true, 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":";AAsDO,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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,cACA,YACY;AACZ,QAAM,eAAe,WAAW,UAAU,KAAK,CAAC,MAAM,EAAE,SAAS,YAAY;AAE7E,MAAI,cAAc;AAEhB,iBAAa,aAAa;AAC1B,iBAAa,aAAa,eAAc,oBAAI,KAAK,GAAE,YAAY;AAAA,EACjE,OAAO;AAEL,eAAW,UAAU;AAAA,MACnB,yBAAyB,cAAc,OAAO,MAAM,UAAU;AAAA,IAChE;AAAA,EACF;AAEA,SAAO;AACT;AAKO,SAAS,uBACd,YACA,cACY;AACZ,QAAM,eAAe,WAAW,UAAU,KAAK,CAAC,MAAM,EAAE,SAAS,YAAY;AAE7E,MAAI,cAAc;AAChB,iBAAa,aAAa;AAAA,EAC5B,OAAO;AAEL,eAAW,UAAU,KAAK,yBAAyB,cAAc,MAAM,KAAK,CAAC;AAAA,EAC/E;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ calculateGoalProgress
3
+ } from "./chunk-465MB7HT.js";
4
+ export {
5
+ calculateGoalProgress
6
+ };
7
+ //# sourceMappingURL=goal-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=host-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ HOST_DEPENDENCIES
3
+ } from "./chunk-AAIYUZY5.js";
4
+ export {
5
+ HOST_DEPENDENCIES
6
+ };
7
+ //# sourceMappingURL=host-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}