Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add models build script (#900)

Leendert de Borsteb2c4c1cd3f8
diff --git a/apps/browser-extension/src/utils/shared/models/README.md b/apps/browser-extension/src/utils/shared/models/README.md
new file mode 100644
index 000000000..57e908a5a
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/README.md
@@ -0,0 +1,9 @@
+# ⚠️ Auto-Generated Files
+
+This folder contains the output of the shared `models` module from the `/shared` directory in the AliasVault project.
+
+**Do not edit any of these files manually.**
+
+To make changes:
+1. Update the source files in the `/shared/models/src` directory
+2. Run the `build.sh` script in the module directory to regenerate the outputs and copy them here.
diff --git a/apps/browser-extension/src/utils/shared/models/index.d.mts b/apps/browser-extension/src/utils/shared/models/index.d.mts
new file mode 100644
index 000000000..da562a555
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/index.d.mts
@@ -0,0 +1,27 @@
+/**
+ * Vault type.
+ */
+type Vault = {
+ blob: string;
+ createdAt: string;
+ credentialsCount: number;
+ currentRevisionNumber: number;
+ emailAddressList: string[];
+ privateEmailDomainList: string[];
+ publicEmailDomainList: string[];
+ encryptionPublicKey: string;
+ updatedAt: string;
+ username: string;
+ version: string;
+ client: string;
+};
+
+/**
+ * Vault response type.
+ */
+type VaultResponse = {
+ status: number;
+ vault: Vault;
+};
+
+export type { VaultResponse };
diff --git a/apps/browser-extension/src/utils/shared/models/index.mjs b/apps/browser-extension/src/utils/shared/models/index.mjs
new file mode 100644
index 000000000..dcbf9aae6
--- /dev/null
+++ b/apps/browser-extension/src/utils/shared/models/index.mjs
@@ -0,0 +1,4 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
+//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/shared/models/build.sh b/shared/models/build.sh
new file mode 100755
index 000000000..1c797390d
--- /dev/null
+++ b/shared/models/build.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -e # Stop on error
+set -u # Treat unset variables as errors
+
+# Define output targets for models
+TARGETS=(
+ "../../apps/browser-extension/src/utils/shared/models"
+)
+
+# Build and distribute models
+package_name="models"
+package_path="."
+
+echo "📦 Building $package_name..."
+npm install && npm run lint && npm run build
+
+dist_path="dist"
+files_to_copy=("index.d.mts" "index.mjs")
+
+for target in "${TARGETS[@]}"; do
+ echo "📂 Copying $package_name → $target"
+ mkdir -p "$target"
+
+ # Copy specific build outputs
+ for file in "${files_to_copy[@]}"; do
+ cp "$dist_path/$file" "$target/"
+ done
+
+ # Write README
+ cat > "$target/README.md" <<EOF
+# ⚠️ Auto-Generated Files
+
+This folder contains the output of the shared \`$package_name\` module from the \`/shared\` directory in the AliasVault project.
+
+**Do not edit any of these files manually.**
+
+To make changes:
+1. Update the source files in the \`/shared/models/src\` directory
+2. Run the \`build.sh\` script in the module directory to regenerate the outputs and copy them here.
+EOF
+done
+
+echo "✅ Models build and copy completed."
\ No newline at end of file