@haex-space/vault-sdk 2.2.5 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-UgMJJ4NT.d.mts → client-BIiJwbdW.d.mts} +2 -216
- package/dist/{client-UgMJJ4NT.d.ts → client-D4hDL-PR.d.ts} +2 -216
- package/dist/config-D_HXjsEV.d.mts +33 -0
- package/dist/config-D_HXjsEV.d.ts +33 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +14 -29
- package/dist/node.d.ts +14 -29
- package/dist/node.js +55 -0
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +55 -1
- package/dist/node.mjs.map +1 -1
- package/dist/react.d.mts +2 -1
- package/dist/react.d.ts +2 -1
- package/dist/react.js +5 -3
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +5 -3
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -1
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -1
- package/dist/runtime/nuxt.plugin.client.js +5 -3
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +5 -3
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/svelte.js +5 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +5 -3
- package/dist/svelte.mjs.map +1 -1
- package/dist/types-FE9ewl3r.d.mts +238 -0
- package/dist/types-FE9ewl3r.d.ts +238 -0
- package/dist/vue.d.mts +2 -1
- package/dist/vue.d.ts +2 -1
- package/dist/vue.js +5 -3
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +5 -3
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node.d.mts
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
build?: {
|
|
12
|
-
distDir?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Source path for migrations directory (relative to project root).
|
|
15
|
-
* If manifest.migrationsDir is set, this directory will be copied
|
|
16
|
-
* to the bundle at the path specified in migrationsDir.
|
|
17
|
-
* Default: "app/{migrationsDir}" (for Nuxt projects)
|
|
18
|
-
* Example: "app/database/migrations" -> copies to "database/migrations" in bundle
|
|
19
|
-
*/
|
|
20
|
-
migrationsSourceDir?: string;
|
|
21
|
-
};
|
|
1
|
+
export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.mjs';
|
|
2
|
+
import { E as ExtensionManifest } from './types-FE9ewl3r.mjs';
|
|
3
|
+
|
|
4
|
+
interface ReadManifestOptions {
|
|
5
|
+
/** Root directory of the project */
|
|
6
|
+
rootDir: string;
|
|
7
|
+
/** Path to manifest.json (if not provided, will use extensionDir) */
|
|
8
|
+
manifestPath?: string;
|
|
9
|
+
/** Directory containing extension files (default: "haextension") */
|
|
10
|
+
extensionDir?: string;
|
|
22
11
|
}
|
|
23
12
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
declare function readHaextensionConfig(rootDir?: string): HaextensionConfig | null;
|
|
28
|
-
/**
|
|
29
|
-
* Get extension directory from config or use default
|
|
13
|
+
* Reads and processes the extension manifest.json file
|
|
14
|
+
* Falls back to package.json version if manifest doesn't specify one
|
|
30
15
|
*/
|
|
31
|
-
declare function
|
|
16
|
+
declare function readManifest(options: ReadManifestOptions): ExtensionManifest | null;
|
|
32
17
|
|
|
33
|
-
export { type
|
|
18
|
+
export { ExtensionManifest, type ReadManifestOptions, readManifest };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
build?: {
|
|
12
|
-
distDir?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Source path for migrations directory (relative to project root).
|
|
15
|
-
* If manifest.migrationsDir is set, this directory will be copied
|
|
16
|
-
* to the bundle at the path specified in migrationsDir.
|
|
17
|
-
* Default: "app/{migrationsDir}" (for Nuxt projects)
|
|
18
|
-
* Example: "app/database/migrations" -> copies to "database/migrations" in bundle
|
|
19
|
-
*/
|
|
20
|
-
migrationsSourceDir?: string;
|
|
21
|
-
};
|
|
1
|
+
export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.js';
|
|
2
|
+
import { E as ExtensionManifest } from './types-FE9ewl3r.js';
|
|
3
|
+
|
|
4
|
+
interface ReadManifestOptions {
|
|
5
|
+
/** Root directory of the project */
|
|
6
|
+
rootDir: string;
|
|
7
|
+
/** Path to manifest.json (if not provided, will use extensionDir) */
|
|
8
|
+
manifestPath?: string;
|
|
9
|
+
/** Directory containing extension files (default: "haextension") */
|
|
10
|
+
extensionDir?: string;
|
|
22
11
|
}
|
|
23
12
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
declare function readHaextensionConfig(rootDir?: string): HaextensionConfig | null;
|
|
28
|
-
/**
|
|
29
|
-
* Get extension directory from config or use default
|
|
13
|
+
* Reads and processes the extension manifest.json file
|
|
14
|
+
* Falls back to package.json version if manifest doesn't specify one
|
|
30
15
|
*/
|
|
31
|
-
declare function
|
|
16
|
+
declare function readManifest(options: ReadManifestOptions): ExtensionManifest | null;
|
|
32
17
|
|
|
33
|
-
export { type
|
|
18
|
+
export { ExtensionManifest, type ReadManifestOptions, readManifest };
|
package/dist/node.js
CHANGED
|
@@ -21,8 +21,63 @@ function getExtensionDir(rootDir = process.cwd()) {
|
|
|
21
21
|
const config = readHaextensionConfig(rootDir);
|
|
22
22
|
return config?.dev?.haextension_dir || "haextension";
|
|
23
23
|
}
|
|
24
|
+
function readManifest(options) {
|
|
25
|
+
const { rootDir, manifestPath, extensionDir = "haextension" } = options;
|
|
26
|
+
const resolvedManifestPath = manifestPath ? path.resolve(rootDir, manifestPath) : path.resolve(rootDir, extensionDir, "manifest.json");
|
|
27
|
+
try {
|
|
28
|
+
const manifestContent = fs.readFileSync(resolvedManifestPath, "utf-8");
|
|
29
|
+
const parsed = JSON.parse(manifestContent);
|
|
30
|
+
let packageJson = {};
|
|
31
|
+
try {
|
|
32
|
+
const packageJsonPath = path.resolve(rootDir, "package.json");
|
|
33
|
+
packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
34
|
+
} catch (pkgError) {
|
|
35
|
+
console.warn(`[@haexhub/sdk] Warning: Could not read package.json`);
|
|
36
|
+
}
|
|
37
|
+
const name = parsed.name ?? packageJson.name;
|
|
38
|
+
const version = parsed.version ?? packageJson.version;
|
|
39
|
+
const author = parsed.author ?? packageJson.author ?? null;
|
|
40
|
+
const homepage = parsed.homepage ?? packageJson.homepage ?? null;
|
|
41
|
+
if (!name) {
|
|
42
|
+
console.warn(`[@haexhub/sdk] Warning: No name found in manifest or package.json`);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (!version) {
|
|
46
|
+
console.warn(`[@haexhub/sdk] Warning: No version found in manifest or package.json`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const manifest = {
|
|
50
|
+
name,
|
|
51
|
+
version,
|
|
52
|
+
author,
|
|
53
|
+
entry: parsed.entry ?? null,
|
|
54
|
+
icon: parsed.icon ?? null,
|
|
55
|
+
publicKey: parsed.publicKey ?? "",
|
|
56
|
+
signature: parsed.signature ?? "",
|
|
57
|
+
permissions: parsed.permissions ?? {
|
|
58
|
+
database: [],
|
|
59
|
+
filesystem: [],
|
|
60
|
+
http: [],
|
|
61
|
+
shell: []
|
|
62
|
+
},
|
|
63
|
+
homepage,
|
|
64
|
+
description: parsed.description ?? null,
|
|
65
|
+
singleInstance: parsed.singleInstance ?? null,
|
|
66
|
+
displayMode: parsed.displayMode ?? null,
|
|
67
|
+
migrationsDir: parsed.migrationsDir ?? null
|
|
68
|
+
};
|
|
69
|
+
console.log(`\u2713 [@haexhub/sdk] Loaded ${resolvedManifestPath}`);
|
|
70
|
+
return manifest;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.warn(
|
|
73
|
+
`[@haexhub/sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`
|
|
74
|
+
);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
24
78
|
|
|
25
79
|
exports.getExtensionDir = getExtensionDir;
|
|
26
80
|
exports.readHaextensionConfig = readHaextensionConfig;
|
|
81
|
+
exports.readManifest = readManifest;
|
|
27
82
|
//# sourceMappingURL=node.js.map
|
|
28
83
|
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts"],"names":["resolve","existsSync","readFileSync"],"mappings":";;;;;;AAiCO,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAAaA,YAAA,CAAQ,OAAA,EAAS,yBAAyB,CAAA;AAE7D,EAAA,IAAI,CAACC,aAAA,CAAW,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAUC,eAAA,CAAa,UAAA,EAAY,OAAO,CAAA;AAChD,IAAA,OAAO,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,EAC3B,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,yCAAA,EAA4C,KAAK,CAAA,CAAE,CAAA;AAChE,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAKO,SAAS,eAAA,CAAgB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAAW;AACvE,EAAA,MAAM,MAAA,GAAS,sBAAsB,OAAO,CAAA;AAC5C,EAAA,OAAO,MAAA,EAAQ,KAAK,eAAA,IAAmB,aAAA;AACzC","file":"node.js","sourcesContent":["/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/manifest.ts"],"names":["resolve","existsSync","readFileSync","resolvePath"],"mappings":";;;;;;AAiCO,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAA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IAAA;AAAA,MACnC,aAAA,EAAe,OAAO,aAAA,IAAiB;AAAA,KACzC;AAEA,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,6BAAA,EAA2B,oBAAoB,CAAA,CAAE,CAAA;AAC7D,IAAA,OAAO,QAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN,sDAAsD,oBAAoB,CAAA,sCAAA;AAAA,KAC5E;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"node.js","sourcesContent":["/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n const parsed: Partial<ExtensionManifest> = JSON.parse(manifestContent);\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch (pkgError) {\n console.warn(`[@haexhub/sdk] Warning: Could not read package.json`);\n }\n\n // Use manifest values with fallback to package.json\n const name = parsed.name ?? packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haexhub/sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haexhub/sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n signature: parsed.signature ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n };\n\n console.log(`✓ [@haexhub/sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch (error) {\n console.warn(\n `[@haexhub/sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n"]}
|
package/dist/node.mjs
CHANGED
|
@@ -19,7 +19,61 @@ function getExtensionDir(rootDir = process.cwd()) {
|
|
|
19
19
|
const config = readHaextensionConfig(rootDir);
|
|
20
20
|
return config?.dev?.haextension_dir || "haextension";
|
|
21
21
|
}
|
|
22
|
+
function readManifest(options) {
|
|
23
|
+
const { rootDir, manifestPath, extensionDir = "haextension" } = options;
|
|
24
|
+
const resolvedManifestPath = manifestPath ? resolve(rootDir, manifestPath) : resolve(rootDir, extensionDir, "manifest.json");
|
|
25
|
+
try {
|
|
26
|
+
const manifestContent = readFileSync(resolvedManifestPath, "utf-8");
|
|
27
|
+
const parsed = JSON.parse(manifestContent);
|
|
28
|
+
let packageJson = {};
|
|
29
|
+
try {
|
|
30
|
+
const packageJsonPath = resolve(rootDir, "package.json");
|
|
31
|
+
packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
32
|
+
} catch (pkgError) {
|
|
33
|
+
console.warn(`[@haexhub/sdk] Warning: Could not read package.json`);
|
|
34
|
+
}
|
|
35
|
+
const name = parsed.name ?? packageJson.name;
|
|
36
|
+
const version = parsed.version ?? packageJson.version;
|
|
37
|
+
const author = parsed.author ?? packageJson.author ?? null;
|
|
38
|
+
const homepage = parsed.homepage ?? packageJson.homepage ?? null;
|
|
39
|
+
if (!name) {
|
|
40
|
+
console.warn(`[@haexhub/sdk] Warning: No name found in manifest or package.json`);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (!version) {
|
|
44
|
+
console.warn(`[@haexhub/sdk] Warning: No version found in manifest or package.json`);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const manifest = {
|
|
48
|
+
name,
|
|
49
|
+
version,
|
|
50
|
+
author,
|
|
51
|
+
entry: parsed.entry ?? null,
|
|
52
|
+
icon: parsed.icon ?? null,
|
|
53
|
+
publicKey: parsed.publicKey ?? "",
|
|
54
|
+
signature: parsed.signature ?? "",
|
|
55
|
+
permissions: parsed.permissions ?? {
|
|
56
|
+
database: [],
|
|
57
|
+
filesystem: [],
|
|
58
|
+
http: [],
|
|
59
|
+
shell: []
|
|
60
|
+
},
|
|
61
|
+
homepage,
|
|
62
|
+
description: parsed.description ?? null,
|
|
63
|
+
singleInstance: parsed.singleInstance ?? null,
|
|
64
|
+
displayMode: parsed.displayMode ?? null,
|
|
65
|
+
migrationsDir: parsed.migrationsDir ?? null
|
|
66
|
+
};
|
|
67
|
+
console.log(`\u2713 [@haexhub/sdk] Loaded ${resolvedManifestPath}`);
|
|
68
|
+
return manifest;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.warn(
|
|
71
|
+
`[@haexhub/sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`
|
|
72
|
+
);
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
22
76
|
|
|
23
|
-
export { getExtensionDir, readHaextensionConfig };
|
|
77
|
+
export { getExtensionDir, readHaextensionConfig, readManifest };
|
|
24
78
|
//# sourceMappingURL=node.mjs.map
|
|
25
79
|
//# sourceMappingURL=node.mjs.map
|
package/dist/node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts"],"names":[],"mappings":";;;;AAiCO,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,OAAA,EAAS,yBAAyB,CAAA;AAE7D,EAAA,IAAI,CAAC,UAAA,CAAW,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAU,YAAA,CAAa,UAAA,EAAY,OAAO,CAAA;AAChD,IAAA,OAAO,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,EAC3B,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,yCAAA,EAA4C,KAAK,CAAA,CAAE,CAAA;AAChE,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAKO,SAAS,eAAA,CAAgB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAAW;AACvE,EAAA,MAAM,MAAA,GAAS,sBAAsB,OAAO,CAAA;AAC5C,EAAA,OAAO,MAAA,EAAQ,KAAK,eAAA,IAAmB,aAAA;AACzC","file":"node.mjs","sourcesContent":["/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/manifest.ts"],"names":["resolvePath","readFileSync"],"mappings":";;;;AAiCO,SAAS,qBAAA,CAAsB,OAAA,GAAk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cAAA,IAAkB,IAAA;AAAA,MACzC,WAAA,EAAa,OAAO,WAAA,IAAe,IAAA;AAAA,MACnC,aAAA,EAAe,OAAO,aAAA,IAAiB;AAAA,KACzC;AAEA,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,6BAAA,EAA2B,oBAAoB,CAAA,CAAE,CAAA;AAC7D,IAAA,OAAO,QAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN,sDAAsD,oBAAoB,CAAA,sCAAA;AAAA,KAC5E;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"node.mjs","sourcesContent":["/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n const parsed: Partial<ExtensionManifest> = JSON.parse(manifestContent);\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch (pkgError) {\n console.warn(`[@haexhub/sdk] Warning: Could not read package.json`);\n }\n\n // Use manifest values with fallback to package.json\n const name = parsed.name ?? packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haexhub/sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haexhub/sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n signature: parsed.signature ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n };\n\n console.log(`✓ [@haexhub/sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch (error) {\n console.warn(\n `[@haexhub/sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n"]}
|
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { H as
|
|
1
|
+
import { H as HaexVaultClient, S as StorageAPI } from './client-BIiJwbdW.mjs';
|
|
2
2
|
import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
|
|
3
|
+
import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-FE9ewl3r.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* React hook for HaexHub SDK
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { H as
|
|
1
|
+
import { H as HaexVaultClient, S as StorageAPI } from './client-D4hDL-PR.js';
|
|
2
2
|
import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
|
|
3
|
+
import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-FE9ewl3r.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* React hook for HaexHub SDK
|
package/dist/react.js
CHANGED
|
@@ -366,6 +366,9 @@ var HAEXTENSION_METHODS = {
|
|
|
366
366
|
// src/types.ts
|
|
367
367
|
var DEFAULT_TIMEOUT = 3e4;
|
|
368
368
|
var TABLE_SEPARATOR = "__";
|
|
369
|
+
function getTableName(publicKey, extensionName, tableName) {
|
|
370
|
+
return `${publicKey}${TABLE_SEPARATOR}${extensionName}${TABLE_SEPARATOR}${tableName}`;
|
|
371
|
+
}
|
|
369
372
|
var HaexHubError = class extends Error {
|
|
370
373
|
constructor(code, messageKey, details) {
|
|
371
374
|
super(messageKey);
|
|
@@ -907,14 +910,13 @@ var HaexVaultClient = class {
|
|
|
907
910
|
}
|
|
908
911
|
this.validateTableName(tableName);
|
|
909
912
|
const { publicKey, name } = this._extensionInfo;
|
|
910
|
-
|
|
911
|
-
return `"${publicKey}${TABLE_SEPARATOR}${extensionName}${TABLE_SEPARATOR}${tableName}"`;
|
|
913
|
+
return `"${getTableName(publicKey, name, tableName)}"`;
|
|
912
914
|
}
|
|
913
915
|
getDependencyTableName(publicKey, extensionName, tableName) {
|
|
914
916
|
this.validatePublicKey(publicKey);
|
|
915
917
|
this.validateExtensionName(extensionName);
|
|
916
918
|
this.validateTableName(tableName);
|
|
917
|
-
return `"${publicKey
|
|
919
|
+
return `"${getTableName(publicKey, extensionName, tableName)}"`;
|
|
918
920
|
}
|
|
919
921
|
parseTableName(fullTableName) {
|
|
920
922
|
let cleanTableName = fullTableName;
|