diff --git a/.gitignore b/.gitignore
index ea06d899..47d221c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,4 +29,5 @@ schemas_nested/
schemas_final/
temp/
-!/extra/admin-api/Utilities/Spacebar.AdminApi.TestClient/wwwroot/lib/bootstrap/dist/
\ No newline at end of file
+!/extra/admin-api/Utilities/Spacebar.AdminApi.TestClient/wwwroot/lib/bootstrap/dist/
+*.qcow2
\ No newline at end of file
diff --git a/assets/openapi.json b/assets/openapi.json
index efd3a4cd..fbadb7ab 100644
--- a/assets/openapi.json
+++ b/assets/openapi.json
@@ -16291,6 +16291,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16374,6 +16380,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16457,6 +16469,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16540,6 +16558,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16623,6 +16647,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16706,6 +16736,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16789,6 +16825,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16872,6 +16914,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -16955,6 +17003,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
@@ -17038,6 +17092,12 @@
},
"tags": [
"reporting"
+ ],
+ "x-badges": [
+ {
+ "label": "Spacebar-only",
+ "color": "red"
+ }
]
}
},
diff --git a/default.nix b/default.nix
index 7763d61c..8f4280d8 100644
--- a/default.nix
+++ b/default.nix
@@ -41,7 +41,7 @@ pkgs.buildNpmPackage {
npmDeps = pkgs.importNpmLock { npmRoot = filteredSrc; };
npmConfigHook = pkgs.importNpmLock.npmConfigHook;
- npmBuildScript = "build:src";
+ npmBuildScript = "build:src:tsgo";
makeCacheWritable = true;
nativeBuildInputs = with pkgs; [
(pkgs.python3.withPackages (ps: with ps; [ setuptools ]))
diff --git a/flake.lock b/flake.lock
index 1805babf..5a9df819 100644
--- a/flake.lock
+++ b/flake.lock
@@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1767892417,
- "narHash": "sha256-dhhvQY67aboBk8b0/u0XB6vwHdgbROZT3fJAjyNh5Ww=",
+ "lastModified": 1768564909,
+ "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
+ "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github"
},
"original": {
diff --git a/nix/modules/default/default.nix b/nix/modules/default/default.nix
index e3a65fb7..d39919c3 100644
--- a/nix/modules/default/default.nix
+++ b/nix/modules/default/default.nix
@@ -235,6 +235,7 @@ in
serviceConfig = {
ExecStart = "${cfg.package}/bin/apply-migrations";
Type = "oneshot";
+ RemainAfterExit = true;
};
};
diff --git a/nix/tests/test-bundle-starts.nix b/nix/tests/test-bundle-starts.nix
index 421517bc..daebe5a1 100644
--- a/nix/tests/test-bundle-starts.nix
+++ b/nix/tests/test-bundle-starts.nix
@@ -24,16 +24,50 @@ in
cdnEndpoint = sb.mkEndpoint "cdn.sb.localhost" 3003 false;
nginx.enable = true;
serverName = "sb.localhost";
+ extraEnvironment = {
+ DATABASE = "postgres://postgres:postgres@127.0.0.1/spacebar";
+ LOG_REQUESTS = "-"; # Log all requests
+ LOG_VALIDATION_ERRORS = true;
+ };
};
in
lib.trace ("Testing with config: " + builtins.toJSON cfg) cfg;
services.nginx.enable = true;
+ services.postgresql = {
+ enable = true;
+ initdbArgs = [
+ "--encoding=UTF8"
+ "--locale=C.UTF-8"
+ "--data-checksums"
+ "--allow-group-access"
+ ];
+ enableTCPIP = true;
+ authentication = pkgs.lib.mkOverride 10 ''
+ # TYPE, DATABASE, USER, ADDRESS, METHOD
+ local all all trust
+ host all all 127.0.0.1/32 trust
+ host all all ::1/128 trust
+ host all all 0.0.0.0/0 md5
+ '';
+ initialScript = pkgs.writeText "backend-initScript" ''
+ CREATE ROLE spacebar WITH LOGIN PASSWORD 'spacebar' CREATEDB;
+ CREATE DATABASE spacebar;
+ GRANT ALL PRIVILEGES ON DATABASE spacebar TO spacebar;
+ '';
+ };
};
testScript = ''
+ machine.wait_for_unit("spacebar-apply-migrations")
machine.wait_for_unit("spacebar-api")
machine.wait_for_unit("spacebar-cdn")
machine.wait_for_unit("spacebar-gateway")
- # machine.succeed("curl -f http://api.sb.localhost/.well-known/spacebar/client")
+ # Wait for unit doesn't mean the service is actually ready to accept connections
+ machine.wait_for_open_port(80)
+ machine.wait_for_open_port(3001)
+ machine.wait_for_open_port(3002)
+ machine.wait_for_open_port(3003)
+ # If well known works, its probably fine(tm)?
+ machine.succeed("curl -f http://api.sb.localhost/.well-known/spacebar/client")
'';
}
diff --git a/nix/trimNodeModules.sh b/nix/trimNodeModules.sh
index debb2738..db057b11 100755
--- a/nix/trimNodeModules.sh
+++ b/nix/trimNodeModules.sh
@@ -1,5 +1,9 @@
# shellcheck shell=bash
+# We don't care about CLI scripts:
+for f in ./node_modules/.bin/*; do
+ rm -f "$(realpath $f)" $f
+done
# sources
echo "Removing source files..."
find ./node_modules -name '*.ts' -type f -delete
@@ -30,17 +34,15 @@ find ./node_modules -name '*.ar-file-list' -type f -delete
find ./node_modules -name '*.stamp' -type f -delete
find ./node_modules -name '*musl.node' -type f -delete
rm -rf ./node_modules/typescript
+rm -rf ./node_modules/@typescript/native-preview
rm -rf ./node_modules/ts-node
rm -rf ./node_modules/node-gyp
+rm -rf ./node_modules/node-gyp-build-optional-packages
rm -rf ./node_modules/discord-protos/{discord_protos,scripts}
-# We don't care about CLI scripts:
-for f in ./node_modules/.bin/*; do
- rm -vf "$(realpath $f)" $f
-done
# rm -rf ./node_modules/typescript-json-schema
rm -rf ./node_modules/node-gyp
-find ./node_modules -name '@types' -type d -exec rm -rfv {} +
+find ./node_modules -name '@types' -type d -exec rm -rf {} +
echo "Removing random common files..."
find ./node_modules -name 'test' -type d -exec rm -rf {} +
@@ -117,4 +119,5 @@ if false; then
fi
echo "Removing empty directories..."
-find node_modules -maxdepth 1 -type d -empty -delete
\ No newline at end of file
+find node_modules -maxdepth 1 -type d -empty -delete
+echo "Trimming complete."
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 4bc76d8b..ae5e5825 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -74,6 +74,7 @@
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.51.0",
"@typescript-eslint/parser": "^8.51.0",
+ "@typescript/native-preview": "^7.0.0-dev.20260119.1",
"eslint": "^9.39.2",
"globals": "^16.5.0",
"husky": "^9.1.7",
@@ -3308,6 +3309,123 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/@typescript/native-preview": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-Tf74TdJVJlLRMN0W9VXK8jc0Gor9+wFRm40qTLt2JeHiPpSF5TEN/pHPjlf4Id1wDSJXH9p5/U1wFS3s5TS2PQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsgo": "bin/tsgo.js"
+ },
+ "optionalDependencies": {
+ "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260119.1",
+ "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260119.1",
+ "@typescript/native-preview-linux-arm": "7.0.0-dev.20260119.1",
+ "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260119.1",
+ "@typescript/native-preview-linux-x64": "7.0.0-dev.20260119.1",
+ "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260119.1",
+ "@typescript/native-preview-win32-x64": "7.0.0-dev.20260119.1"
+ }
+ },
+ "node_modules/@typescript/native-preview-darwin-arm64": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-siuRD9Shh5gVrgYG5HEWxFxG/dkZa4ndupGWKMfM4DwMG7zLeFayi6sB9yiwpD0d203ts01D7uTnTCALdiWXmQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@typescript/native-preview-darwin-x64": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-ivqxCrbLXUqZU1OMojVRCnVx5gC/twgi7gKzBXMBLGOgfTkhajbHk/71J3OQhJwzR3T2ISG6FTfXKHhQMtgkkg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@typescript/native-preview-linux-arm": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-Bev1d6NCgCmcGOgmdFG514tWRt2lNUSFjQ9RVnN86tSm+bl5p9Lv6TQjc38Ow9vY11J71IZs9HNN1AKWfBCj2Q==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@typescript/native-preview-linux-arm64": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-ttNri2Ui1CzlLnPJN0sQ4XBgrCMq4jjtxouitRGh7+YlToG561diLERjOwIhNfTzPDKRMS7XO090WoepbvzFpA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@typescript/native-preview-linux-x64": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-mwsjGZqUKju3SKPzlDuKhKgt9Ht8seA5OBhorvRZk2B5lwlH0gDsApGK4t50TcnzjpbWI85FVxI6wTq1T36dMg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@typescript/native-preview-win32-arm64": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-463QnUaRCUhY/Flj/XinORTbBYuxoMthgJiBU1vu7mipLo2Yaipkkgn1ArGHkV9mjWBa7QIPCWg/V2KIEoVdcA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@typescript/native-preview-win32-x64": {
+ "version": "7.0.0-dev.20260119.1",
+ "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260119.1.tgz",
+ "integrity": "sha512-039WAg5xJjqrRYVHMR9Y2y83dYSLofbyx/22Gc6ur3b/nR8u1wdErK9uwrguL3lxpKDo6qdhnkGlbX8FP0Bz+g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
"node_modules/@yarnpkg/lockfile": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
diff --git a/package.json b/package.json
index d2fee294..9f71997d 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,8 @@
"start:gateway": "node --enable-source-maps dist/gateway/start.js",
"build": "npm run build:src && npm run generate:schema && npm run generate:openapi",
"build:src": "tsc -b -v",
+ "build:tsgo": "npm run build:src:tsgo && npm run generate:schema && npm run generate:openapi",
+ "build:src:tsgo": "rm -rf dist/* && tsgo -b -v && mv -v dist/src/* dist/ && rm -rfv dist/src",
"watch": "tsc -w -b .",
"test": "node scripts/test.js",
"lint": "eslint .",
@@ -62,6 +64,7 @@
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.51.0",
"@typescript-eslint/parser": "^8.51.0",
+ "@typescript/native-preview": "^7.0.0-dev.20260119.1",
"eslint": "^9.39.2",
"globals": "^16.5.0",
"husky": "^9.1.7",
diff --git a/src/apply-migrations.ts b/src/apply-migrations.ts
index 5c806024..94f86320 100644
--- a/src/apply-migrations.ts
+++ b/src/apply-migrations.ts
@@ -11,5 +11,7 @@ process.env.DB_LOGGING = "true";
import { closeDatabase, initDatabase } from "@spacebar/util";
initDatabase().then(() => {
- closeDatabase().then((r) => {});
+ closeDatabase().then((r) => {
+ console.log("Successfully applied migrations!");
+ });
});
|