@nauth-toolkit/database-typeorm-mysql 0.1.3
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/LICENSE +90 -0
- package/README.md +78 -0
- package/dist/entities/auth-audit.entity.d.ts +32 -0
- package/dist/entities/auth-audit.entity.d.ts.map +1 -0
- package/dist/entities/auth-audit.entity.js +141 -0
- package/dist/entities/auth-audit.entity.js.map +1 -0
- package/dist/entities/challenge-session.entity.d.ts +20 -0
- package/dist/entities/challenge-session.entity.d.ts.map +1 -0
- package/dist/entities/challenge-session.entity.js +88 -0
- package/dist/entities/challenge-session.entity.js.map +1 -0
- package/dist/entities/index.d.ts +14 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +57 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/login-attempt.entity.d.ts +16 -0
- package/dist/entities/login-attempt.entity.d.ts.map +1 -0
- package/dist/entities/login-attempt.entity.js +70 -0
- package/dist/entities/login-attempt.entity.js.map +1 -0
- package/dist/entities/mfa-device.entity.d.ts +23 -0
- package/dist/entities/mfa-device.entity.d.ts.map +1 -0
- package/dist/entities/mfa-device.entity.js +105 -0
- package/dist/entities/mfa-device.entity.js.map +1 -0
- package/dist/entities/rate-limit.entity.d.ts +10 -0
- package/dist/entities/rate-limit.entity.d.ts.map +1 -0
- package/dist/entities/rate-limit.entity.js +53 -0
- package/dist/entities/rate-limit.entity.js.map +1 -0
- package/dist/entities/session.entity.d.ts +35 -0
- package/dist/entities/session.entity.d.ts.map +1 -0
- package/dist/entities/session.entity.js +158 -0
- package/dist/entities/session.entity.js.map +1 -0
- package/dist/entities/social-account.entity.d.ts +16 -0
- package/dist/entities/social-account.entity.d.ts.map +1 -0
- package/dist/entities/social-account.entity.js +76 -0
- package/dist/entities/social-account.entity.js.map +1 -0
- package/dist/entities/storage-lock.entity.d.ts +9 -0
- package/dist/entities/storage-lock.entity.d.ts.map +1 -0
- package/dist/entities/storage-lock.entity.js +43 -0
- package/dist/entities/storage-lock.entity.js.map +1 -0
- package/dist/entities/trusted-device.entity.d.ts +20 -0
- package/dist/entities/trusted-device.entity.d.ts.map +1 -0
- package/dist/entities/trusted-device.entity.js +94 -0
- package/dist/entities/trusted-device.entity.js.map +1 -0
- package/dist/entities/user.entity.d.ts +43 -0
- package/dist/entities/user.entity.d.ts.map +1 -0
- package/dist/entities/user.entity.js +229 -0
- package/dist/entities/user.entity.js.map +1 -0
- package/dist/entities/verification-token.entity.d.ts +21 -0
- package/dist/entities/verification-token.entity.d.ts.map +1 -0
- package/dist/entities/verification-token.entity.js +90 -0
- package/dist/entities/verification-token.entity.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/1734600000000-Initial.d.ts +7 -0
- package/dist/migrations/1734600000000-Initial.d.ts.map +1 -0
- package/dist/migrations/1734600000000-Initial.js +107 -0
- package/dist/migrations/1734600000000-Initial.js.map +1 -0
- package/dist/migrations/index.d.ts +6 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +6 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/typeorm-cli.datasource.d.ts +5 -0
- package/dist/typeorm-cli.datasource.d.ts.map +1 -0
- package/dist/typeorm-cli.datasource.js +20 -0
- package/dist/typeorm-cli.datasource.js.map +1 -0
- package/dist/utils/run-migrations.d.ts +4 -0
- package/dist/utils/run-migrations.d.ts.map +1 -0
- package/dist/utils/run-migrations.js +28 -0
- package/dist/utils/run-migrations.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Initial1734600000000 = void 0;
|
|
4
|
+
class Initial1734600000000 {
|
|
5
|
+
name = 'Initial1734600000000';
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE \`nauth_users\` (\`id\` int NOT NULL AUTO_INCREMENT, \`sub\` char(36) NOT NULL, \`username\` varchar(255) NULL, \`firstName\` varchar(100) NULL, \`lastName\` varchar(100) NULL, \`email\` varchar(255) NOT NULL, \`phone\` varchar(20) NULL, \`passwordHash\` varchar(255) NULL, \`passwordChangedAt\` timestamp(6) NULL, \`passwordHistory\` json NULL, \`mustChangePassword\` tinyint(1) NOT NULL DEFAULT '0', \`isEmailVerified\` tinyint(1) NOT NULL DEFAULT '0', \`isPhoneVerified\` tinyint(1) NOT NULL DEFAULT '0', \`isActive\` tinyint(1) NOT NULL DEFAULT '1', \`isLocked\` tinyint(1) NOT NULL DEFAULT '0', \`lockReason\` varchar(100) NULL, \`lockedAt\` timestamp(6) NULL, \`lockedUntil\` timestamp(6) NULL, \`failedLoginAttempts\` int NOT NULL DEFAULT '0', \`lastFailedLoginAt\` timestamp(6) NULL, \`lastLoginAt\` timestamp(6) NULL, \`lastLoginIp\` varchar(45) NULL, \`mfaEnabled\` tinyint(1) NOT NULL DEFAULT '0', \`mfaMethods\` json NULL, \`mfaEnforcedAt\` timestamp(6) NULL, \`totpSecret\` text NULL, \`backupCodes\` json NULL, \`preferredMfaMethod\` varchar(20) NULL, \`mfaExempt\` tinyint(1) NOT NULL DEFAULT '0', \`mfaExemptReason\` varchar(500) NULL, \`mfaExemptGrantedAt\` timestamp(6) NULL, \`mfaExemptGrantedBy\` varchar(255) NULL, \`hasSocialAuth\` tinyint(1) NOT NULL DEFAULT '0', \`socialProviders\` json NULL, \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` timestamp(6) NULL, INDEX \`IDX_545148d3ac52c29568490ff064\` (\`hasSocialAuth\`), INDEX \`IDX_79f6834c0c66979cb09b62473b\` (\`isActive\`), INDEX \`IDX_e7f7b3f18dfd026b8fe3ea08c2\` (\`phone\`), UNIQUE INDEX \`IDX_def83cb63b4ad43b92d4244a8e\` (\`username\`), UNIQUE INDEX \`IDX_06127de246f8855cfa2b04a4e5\` (\`email\`), UNIQUE INDEX \`IDX_55109e088d372ba04b3c2868ef\` (\`sub\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
8
|
+
await queryRunner.query(`CREATE TABLE \`nauth_sessions\` (\`id\` int NOT NULL AUTO_INCREMENT, \`version\` int NOT NULL, \`userId\` int NOT NULL, \`accessTokenHash\` varchar(255) NOT NULL, \`refreshTokenHash\` varchar(255) NOT NULL, \`tokenFamily\` varchar(255) NULL, \`deviceId\` varchar(255) NULL, \`deviceName\` varchar(255) NULL, \`deviceType\` varchar(50) NULL, \`deviceFingerprint\` varchar(255) NULL, \`ipAddress\` varchar(45) NULL, \`ipCountry\` varchar(100) NULL, \`ipCity\` varchar(100) NULL, \`ipLatitude\` decimal(10,6) NULL, \`ipLongitude\` decimal(10,6) NULL, \`ipIsp\` varchar(255) NULL, \`userAgent\` text NULL, \`platform\` varchar(50) NULL, \`browser\` varchar(50) NULL, \`authMethod\` varchar(50) NULL, \`isRemembered\` tinyint(1) NOT NULL DEFAULT '0', \`isTrustedDevice\` tinyint(1) NOT NULL DEFAULT '0', \`expiresAt\` timestamp(6) NOT NULL, \`lastActivityAt\` timestamp(6) NULL, \`isRevoked\` tinyint(1) NOT NULL DEFAULT '0', \`revokedAt\` timestamp(6) NULL, \`revokeReason\` varchar(100) NULL, \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_5889ec53efe12d4c0861540351\` (\`tokenFamily\`, \`isRevoked\`), INDEX \`IDX_abfe290f316aaec23c6ab8fe4c\` (\`userId\`, \`ipCountry\`), INDEX \`IDX_82dea1b621a55c1d46f9431c6d\` (\`userId\`, \`ipAddress\`), INDEX \`IDX_f1025cfeb0a432699b35cc9b5a\` (\`userId\`, \`deviceId\`), INDEX \`IDX_394e04ff686168d6b794faab32\` (\`userId\`, \`isRevoked\`, \`expiresAt\`), INDEX \`IDX_640b8b4fb5e34cc462b26c32c7\` (\`userId\`, \`isRevoked\`, \`createdAt\`), INDEX \`IDX_e1116f1740b6f598e409f9b8c8\` (\`userId\`, \`isRevoked\`), INDEX \`IDX_a256330403ded68e658351ea6d\` (\`refreshTokenHash\`, \`isRevoked\`), INDEX \`IDX_d346547e35ce945120bce8d28e\` (\`isRevoked\`), INDEX \`IDX_f7d5f2b5e7d0ed7630f1494a49\` (\`expiresAt\`), INDEX \`IDX_e11df8864e07aa20e0ad54e9a2\` (\`deviceId\`), INDEX \`IDX_83cb51e5982dd6ea8b01de3707\` (\`refreshTokenHash\`), INDEX \`IDX_7b945889632b425fd83e00627c\` (\`accessTokenHash\`), INDEX \`IDX_29a306abd7483eb7e50bfea13d\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
9
|
+
await queryRunner.query(`CREATE TABLE \`nauth_login_attempts\` (\`id\` int NOT NULL AUTO_INCREMENT, \`email\` varchar(255) NULL, \`userId\` int NULL, \`ipAddress\` varchar(45) NULL, \`userAgent\` text NULL, \`success\` tinyint(1) NOT NULL, \`failureReason\` varchar(100) NULL, \`mfaRequired\` tinyint(1) NOT NULL DEFAULT '0', \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_1f72b23ca82eecae26227fe8b4\` (\`ipAddress\`, \`createdAt\`), INDEX \`IDX_ad332e5ca8b7c4f6f4cc7bd39c\` (\`email\`, \`createdAt\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
10
|
+
await queryRunner.query(`CREATE TABLE \`nauth_challenge_sessions\` (\`id\` int NOT NULL AUTO_INCREMENT, \`userId\` int NOT NULL, \`challengeName\` varchar(50) NOT NULL, \`sessionToken\` varchar(255) NOT NULL, \`expiresAt\` timestamp(6) NOT NULL, \`isCompleted\` tinyint(1) NOT NULL DEFAULT '0', \`completedAt\` timestamp(6) NULL, \`attempts\` int NOT NULL DEFAULT '0', \`maxAttempts\` int NOT NULL DEFAULT '3', \`challengeParameters\` json NULL, \`metadata\` json NULL, \`ipAddress\` varchar(45) NULL, \`userAgent\` text NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_e360f85f65e26bedc85eaf4d0d\` (\`userId\`, \`isCompleted\`), INDEX \`IDX_1d8693434fa20d7f7630487f15\` (\`challengeName\`), INDEX \`IDX_12ae307de0750a4dd32471f4e0\` (\`expiresAt\`), INDEX \`IDX_6fc21f5b74c04518123ad1287c\` (\`userId\`), UNIQUE INDEX \`IDX_f439ccf58d5844f715f9eec9cd\` (\`sessionToken\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
11
|
+
await queryRunner.query(`CREATE TABLE \`nauth_verification_tokens\` (\`id\` int NOT NULL AUTO_INCREMENT, \`userId\` int NOT NULL, \`challengeSessionId\` int NULL, \`type\` varchar(20) NOT NULL, \`token\` varchar(255) NOT NULL, \`code\` varchar(10) NULL, \`expiresAt\` timestamp(6) NOT NULL, \`attempts\` int NOT NULL DEFAULT '0', \`usedAt\` timestamp(6) NULL, \`ipAddress\` varchar(45) NULL, \`userAgent\` text NULL, \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_b643b4dde1e5b2a7bccab9af7e\` (\`expiresAt\`), INDEX \`IDX_c5812e0d5be495c141912c9fc3\` (\`token\`), INDEX \`IDX_4e9020601dede5c4350a7694e3\` (\`userId\`, \`type\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
12
|
+
await queryRunner.query(`CREATE TABLE \`nauth_social_accounts\` (\`id\` int NOT NULL AUTO_INCREMENT, \`userId\` int NOT NULL, \`provider\` varchar(50) NOT NULL, \`providerId\` varchar(255) NOT NULL, \`providerEmail\` varchar(255) NULL, \`linkedAt\` timestamp(6) NOT NULL, \`lastUsedAt\` timestamp(6) NULL, \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_bebad32f44dd2f2a373fd609a6\` (\`providerEmail\`), INDEX \`IDX_bcf231c8bee2c37f7713dcbcb8\` (\`userId\`), UNIQUE INDEX \`IDX_850038b86ca465318d5267cec4\` (\`provider\`, \`providerId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
13
|
+
await queryRunner.query(`CREATE TABLE \`nauth_mfa_devices\` (\`id\` int NOT NULL AUTO_INCREMENT, \`userId\` int NOT NULL, \`type\` varchar(20) NOT NULL, \`name\` varchar(255) NOT NULL, \`secret\` text NULL, \`phoneNumber\` varchar(20) NULL, \`credentialId\` text NULL, \`publicKey\` text NULL, \`counter\` int NULL, \`transports\` json NULL, \`isActive\` tinyint(1) NOT NULL DEFAULT '1', \`isPrimary\` tinyint(1) NOT NULL DEFAULT '0', \`lastUsedAt\` timestamp(6) NULL, \`usageCount\` int NOT NULL DEFAULT '0', \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_bb95066fbbcbb404d8a329607f\` (\`isActive\`), INDEX \`IDX_54097fe7cdef07b08b3866934c\` (\`type\`), INDEX \`IDX_7850b00d043a63657522249b81\` (\`userId\`), UNIQUE INDEX \`uq_mfa_device_user_type\` (\`userId\`, \`type\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
14
|
+
await queryRunner.query(`CREATE TABLE \`nauth_auth_audit\` (\`id\` int NOT NULL AUTO_INCREMENT, \`userId\` int NOT NULL, \`eventType\` varchar(50) NOT NULL, \`eventStatus\` varchar(20) NOT NULL, \`riskFactor\` int NULL, \`riskFactors\` json NULL, \`adaptiveMfaTriggered\` tinyint(1) NULL, \`ipAddress\` varchar(45) NULL, \`ipCountry\` varchar(100) NULL, \`ipCity\` varchar(100) NULL, \`ipLatitude\` decimal(10,6) NULL, \`ipLongitude\` decimal(10,6) NULL, \`userAgent\` text NULL, \`platform\` varchar(50) NULL, \`browser\` varchar(50) NULL, \`deviceId\` varchar(255) NULL, \`deviceName\` varchar(255) NULL, \`deviceType\` varchar(50) NULL, \`sessionId\` int NULL, \`challengeSessionId\` int NULL, \`authMethod\` varchar(50) NULL, \`performedBy\` varchar(255) NULL, \`reason\` varchar(500) NULL, \`description\` text NULL, \`metadata\` json NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_58c758ac01b0b9628dcd8da13e\` (\`userId\`, \`ipAddress\`), INDEX \`IDX_9aac36f5d60c47085006e14c86\` (\`userId\`, \`eventType\`, \`createdAt\`), INDEX \`IDX_2a3142225b10cbb2d61c3d7670\` (\`authMethod\`, \`createdAt\`), INDEX \`IDX_9d34a4ba3b16763ba96373bd60\` (\`adaptiveMfaTriggered\`, \`createdAt\`), INDEX \`IDX_efc809a946b92cca2791ad900d\` (\`riskFactor\`, \`createdAt\`), INDEX \`IDX_8ad1870f1c47bc4aea6bf069be\` (\`createdAt\`), INDEX \`IDX_8f3e679bbcea9a0c54cb7fc138\` (\`eventStatus\`, \`createdAt\`), INDEX \`IDX_aee5b503e165b59225e6004bb3\` (\`eventType\`, \`createdAt\`), INDEX \`IDX_d5a6e9fdcb66f2b33bb1420b62\` (\`userId\`, \`createdAt\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
15
|
+
await queryRunner.query(`CREATE TABLE \`nauth_trusted_devices\` (\`id\` int NOT NULL AUTO_INCREMENT, \`userId\` int NOT NULL, \`deviceTokenHash\` varchar(255) NOT NULL, \`deviceId\` varchar(255) NULL, \`deviceName\` varchar(255) NULL, \`deviceType\` varchar(50) NULL, \`ipAddress\` varchar(45) NULL, \`userAgent\` text NULL, \`platform\` varchar(50) NULL, \`browser\` varchar(50) NULL, \`trustedUntil\` timestamp(6) NOT NULL, \`lastUsedAt\` timestamp(6) NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_e1eadc45b91af58ad18626de36\` (\`userId\`, \`deviceTokenHash\`), INDEX \`IDX_7ec93fcdd969044b56966d5b8f\` (\`trustedUntil\`), INDEX \`IDX_4be50a51f46a2110415882ebae\` (\`deviceId\`), INDEX \`IDX_96d642dfb86b07683970edb383\` (\`deviceTokenHash\`), INDEX \`IDX_6b1ebaf31bc726f6c40020a0d2\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
16
|
+
await queryRunner.query(`CREATE TABLE \`nauth_rate_limits\` (\`id\` int NOT NULL AUTO_INCREMENT, \`key\` varchar(255) NOT NULL, \`value\` text NOT NULL, \`expiresAt\` timestamp(6) NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_f97c41c9a490f252b1d0c9367d\` (\`expiresAt\`), UNIQUE INDEX \`IDX_90d96c7c013510b358d30d8144\` (\`key\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
17
|
+
await queryRunner.query(`CREATE TABLE \`nauth_storage_locks\` (\`id\` int NOT NULL AUTO_INCREMENT, \`key\` varchar(255) NOT NULL, \`value\` text NOT NULL, \`expiresAt\` timestamp(6) NULL, \`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_61474f43e24de2af1d8bf88ee1\` (\`expiresAt\`), UNIQUE INDEX \`IDX_24b2bef3e4cfafcecc2ad09df4\` (\`key\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
18
|
+
await queryRunner.query(`ALTER TABLE \`nauth_sessions\` ADD CONSTRAINT \`FK_29a306abd7483eb7e50bfea13d8\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
19
|
+
await queryRunner.query(`ALTER TABLE \`nauth_login_attempts\` ADD CONSTRAINT \`FK_21b1aa08d1cb4c6c5dda7f6fac0\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
|
|
20
|
+
await queryRunner.query(`ALTER TABLE \`nauth_challenge_sessions\` ADD CONSTRAINT \`FK_6fc21f5b74c04518123ad1287cb\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
21
|
+
await queryRunner.query(`ALTER TABLE \`nauth_verification_tokens\` ADD CONSTRAINT \`FK_8ff39e7ffb5e4ffb734ee9e57c5\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
22
|
+
await queryRunner.query(`ALTER TABLE \`nauth_verification_tokens\` ADD CONSTRAINT \`FK_5e34b085fd0bc42216849e53aa3\` FOREIGN KEY (\`challengeSessionId\`) REFERENCES \`nauth_challenge_sessions\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
23
|
+
await queryRunner.query(`ALTER TABLE \`nauth_social_accounts\` ADD CONSTRAINT \`FK_bcf231c8bee2c37f7713dcbcb8a\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
24
|
+
await queryRunner.query(`ALTER TABLE \`nauth_mfa_devices\` ADD CONSTRAINT \`FK_7850b00d043a63657522249b816\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
25
|
+
await queryRunner.query(`ALTER TABLE \`nauth_auth_audit\` ADD CONSTRAINT \`FK_af799e756285b8639985dd09f50\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
26
|
+
await queryRunner.query(`ALTER TABLE \`nauth_trusted_devices\` ADD CONSTRAINT \`FK_6b1ebaf31bc726f6c40020a0d2a\` FOREIGN KEY (\`userId\`) REFERENCES \`nauth_users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
27
|
+
}
|
|
28
|
+
async down(queryRunner) {
|
|
29
|
+
await queryRunner.query(`ALTER TABLE \`nauth_trusted_devices\` DROP FOREIGN KEY \`FK_6b1ebaf31bc726f6c40020a0d2a\``);
|
|
30
|
+
await queryRunner.query(`ALTER TABLE \`nauth_auth_audit\` DROP FOREIGN KEY \`FK_af799e756285b8639985dd09f50\``);
|
|
31
|
+
await queryRunner.query(`ALTER TABLE \`nauth_mfa_devices\` DROP FOREIGN KEY \`FK_7850b00d043a63657522249b816\``);
|
|
32
|
+
await queryRunner.query(`ALTER TABLE \`nauth_social_accounts\` DROP FOREIGN KEY \`FK_bcf231c8bee2c37f7713dcbcb8a\``);
|
|
33
|
+
await queryRunner.query(`ALTER TABLE \`nauth_verification_tokens\` DROP FOREIGN KEY \`FK_5e34b085fd0bc42216849e53aa3\``);
|
|
34
|
+
await queryRunner.query(`ALTER TABLE \`nauth_verification_tokens\` DROP FOREIGN KEY \`FK_8ff39e7ffb5e4ffb734ee9e57c5\``);
|
|
35
|
+
await queryRunner.query(`ALTER TABLE \`nauth_challenge_sessions\` DROP FOREIGN KEY \`FK_6fc21f5b74c04518123ad1287cb\``);
|
|
36
|
+
await queryRunner.query(`ALTER TABLE \`nauth_login_attempts\` DROP FOREIGN KEY \`FK_21b1aa08d1cb4c6c5dda7f6fac0\``);
|
|
37
|
+
await queryRunner.query(`ALTER TABLE \`nauth_sessions\` DROP FOREIGN KEY \`FK_29a306abd7483eb7e50bfea13d8\``);
|
|
38
|
+
await queryRunner.query(`DROP INDEX \`IDX_24b2bef3e4cfafcecc2ad09df4\` ON \`nauth_storage_locks\``);
|
|
39
|
+
await queryRunner.query(`DROP INDEX \`IDX_61474f43e24de2af1d8bf88ee1\` ON \`nauth_storage_locks\``);
|
|
40
|
+
await queryRunner.query(`DROP TABLE \`nauth_storage_locks\``);
|
|
41
|
+
await queryRunner.query(`DROP INDEX \`IDX_90d96c7c013510b358d30d8144\` ON \`nauth_rate_limits\``);
|
|
42
|
+
await queryRunner.query(`DROP INDEX \`IDX_f97c41c9a490f252b1d0c9367d\` ON \`nauth_rate_limits\``);
|
|
43
|
+
await queryRunner.query(`DROP TABLE \`nauth_rate_limits\``);
|
|
44
|
+
await queryRunner.query(`DROP INDEX \`IDX_6b1ebaf31bc726f6c40020a0d2\` ON \`nauth_trusted_devices\``);
|
|
45
|
+
await queryRunner.query(`DROP INDEX \`IDX_96d642dfb86b07683970edb383\` ON \`nauth_trusted_devices\``);
|
|
46
|
+
await queryRunner.query(`DROP INDEX \`IDX_4be50a51f46a2110415882ebae\` ON \`nauth_trusted_devices\``);
|
|
47
|
+
await queryRunner.query(`DROP INDEX \`IDX_7ec93fcdd969044b56966d5b8f\` ON \`nauth_trusted_devices\``);
|
|
48
|
+
await queryRunner.query(`DROP INDEX \`IDX_e1eadc45b91af58ad18626de36\` ON \`nauth_trusted_devices\``);
|
|
49
|
+
await queryRunner.query(`DROP TABLE \`nauth_trusted_devices\``);
|
|
50
|
+
await queryRunner.query(`DROP INDEX \`IDX_d5a6e9fdcb66f2b33bb1420b62\` ON \`nauth_auth_audit\``);
|
|
51
|
+
await queryRunner.query(`DROP INDEX \`IDX_aee5b503e165b59225e6004bb3\` ON \`nauth_auth_audit\``);
|
|
52
|
+
await queryRunner.query(`DROP INDEX \`IDX_8f3e679bbcea9a0c54cb7fc138\` ON \`nauth_auth_audit\``);
|
|
53
|
+
await queryRunner.query(`DROP INDEX \`IDX_8ad1870f1c47bc4aea6bf069be\` ON \`nauth_auth_audit\``);
|
|
54
|
+
await queryRunner.query(`DROP INDEX \`IDX_efc809a946b92cca2791ad900d\` ON \`nauth_auth_audit\``);
|
|
55
|
+
await queryRunner.query(`DROP INDEX \`IDX_9d34a4ba3b16763ba96373bd60\` ON \`nauth_auth_audit\``);
|
|
56
|
+
await queryRunner.query(`DROP INDEX \`IDX_2a3142225b10cbb2d61c3d7670\` ON \`nauth_auth_audit\``);
|
|
57
|
+
await queryRunner.query(`DROP INDEX \`IDX_9aac36f5d60c47085006e14c86\` ON \`nauth_auth_audit\``);
|
|
58
|
+
await queryRunner.query(`DROP INDEX \`IDX_58c758ac01b0b9628dcd8da13e\` ON \`nauth_auth_audit\``);
|
|
59
|
+
await queryRunner.query(`DROP TABLE \`nauth_auth_audit\``);
|
|
60
|
+
await queryRunner.query(`DROP INDEX \`uq_mfa_device_user_type\` ON \`nauth_mfa_devices\``);
|
|
61
|
+
await queryRunner.query(`DROP INDEX \`IDX_7850b00d043a63657522249b81\` ON \`nauth_mfa_devices\``);
|
|
62
|
+
await queryRunner.query(`DROP INDEX \`IDX_54097fe7cdef07b08b3866934c\` ON \`nauth_mfa_devices\``);
|
|
63
|
+
await queryRunner.query(`DROP INDEX \`IDX_bb95066fbbcbb404d8a329607f\` ON \`nauth_mfa_devices\``);
|
|
64
|
+
await queryRunner.query(`DROP TABLE \`nauth_mfa_devices\``);
|
|
65
|
+
await queryRunner.query(`DROP INDEX \`IDX_850038b86ca465318d5267cec4\` ON \`nauth_social_accounts\``);
|
|
66
|
+
await queryRunner.query(`DROP INDEX \`IDX_bcf231c8bee2c37f7713dcbcb8\` ON \`nauth_social_accounts\``);
|
|
67
|
+
await queryRunner.query(`DROP INDEX \`IDX_bebad32f44dd2f2a373fd609a6\` ON \`nauth_social_accounts\``);
|
|
68
|
+
await queryRunner.query(`DROP TABLE \`nauth_social_accounts\``);
|
|
69
|
+
await queryRunner.query(`DROP INDEX \`IDX_4e9020601dede5c4350a7694e3\` ON \`nauth_verification_tokens\``);
|
|
70
|
+
await queryRunner.query(`DROP INDEX \`IDX_c5812e0d5be495c141912c9fc3\` ON \`nauth_verification_tokens\``);
|
|
71
|
+
await queryRunner.query(`DROP INDEX \`IDX_b643b4dde1e5b2a7bccab9af7e\` ON \`nauth_verification_tokens\``);
|
|
72
|
+
await queryRunner.query(`DROP TABLE \`nauth_verification_tokens\``);
|
|
73
|
+
await queryRunner.query(`DROP INDEX \`IDX_f439ccf58d5844f715f9eec9cd\` ON \`nauth_challenge_sessions\``);
|
|
74
|
+
await queryRunner.query(`DROP INDEX \`IDX_6fc21f5b74c04518123ad1287c\` ON \`nauth_challenge_sessions\``);
|
|
75
|
+
await queryRunner.query(`DROP INDEX \`IDX_12ae307de0750a4dd32471f4e0\` ON \`nauth_challenge_sessions\``);
|
|
76
|
+
await queryRunner.query(`DROP INDEX \`IDX_1d8693434fa20d7f7630487f15\` ON \`nauth_challenge_sessions\``);
|
|
77
|
+
await queryRunner.query(`DROP INDEX \`IDX_e360f85f65e26bedc85eaf4d0d\` ON \`nauth_challenge_sessions\``);
|
|
78
|
+
await queryRunner.query(`DROP TABLE \`nauth_challenge_sessions\``);
|
|
79
|
+
await queryRunner.query(`DROP INDEX \`IDX_ad332e5ca8b7c4f6f4cc7bd39c\` ON \`nauth_login_attempts\``);
|
|
80
|
+
await queryRunner.query(`DROP INDEX \`IDX_1f72b23ca82eecae26227fe8b4\` ON \`nauth_login_attempts\``);
|
|
81
|
+
await queryRunner.query(`DROP TABLE \`nauth_login_attempts\``);
|
|
82
|
+
await queryRunner.query(`DROP INDEX \`IDX_29a306abd7483eb7e50bfea13d\` ON \`nauth_sessions\``);
|
|
83
|
+
await queryRunner.query(`DROP INDEX \`IDX_7b945889632b425fd83e00627c\` ON \`nauth_sessions\``);
|
|
84
|
+
await queryRunner.query(`DROP INDEX \`IDX_83cb51e5982dd6ea8b01de3707\` ON \`nauth_sessions\``);
|
|
85
|
+
await queryRunner.query(`DROP INDEX \`IDX_e11df8864e07aa20e0ad54e9a2\` ON \`nauth_sessions\``);
|
|
86
|
+
await queryRunner.query(`DROP INDEX \`IDX_f7d5f2b5e7d0ed7630f1494a49\` ON \`nauth_sessions\``);
|
|
87
|
+
await queryRunner.query(`DROP INDEX \`IDX_d346547e35ce945120bce8d28e\` ON \`nauth_sessions\``);
|
|
88
|
+
await queryRunner.query(`DROP INDEX \`IDX_a256330403ded68e658351ea6d\` ON \`nauth_sessions\``);
|
|
89
|
+
await queryRunner.query(`DROP INDEX \`IDX_e1116f1740b6f598e409f9b8c8\` ON \`nauth_sessions\``);
|
|
90
|
+
await queryRunner.query(`DROP INDEX \`IDX_640b8b4fb5e34cc462b26c32c7\` ON \`nauth_sessions\``);
|
|
91
|
+
await queryRunner.query(`DROP INDEX \`IDX_394e04ff686168d6b794faab32\` ON \`nauth_sessions\``);
|
|
92
|
+
await queryRunner.query(`DROP INDEX \`IDX_f1025cfeb0a432699b35cc9b5a\` ON \`nauth_sessions\``);
|
|
93
|
+
await queryRunner.query(`DROP INDEX \`IDX_82dea1b621a55c1d46f9431c6d\` ON \`nauth_sessions\``);
|
|
94
|
+
await queryRunner.query(`DROP INDEX \`IDX_abfe290f316aaec23c6ab8fe4c\` ON \`nauth_sessions\``);
|
|
95
|
+
await queryRunner.query(`DROP INDEX \`IDX_5889ec53efe12d4c0861540351\` ON \`nauth_sessions\``);
|
|
96
|
+
await queryRunner.query(`DROP TABLE \`nauth_sessions\``);
|
|
97
|
+
await queryRunner.query(`DROP INDEX \`IDX_55109e088d372ba04b3c2868ef\` ON \`nauth_users\``);
|
|
98
|
+
await queryRunner.query(`DROP INDEX \`IDX_06127de246f8855cfa2b04a4e5\` ON \`nauth_users\``);
|
|
99
|
+
await queryRunner.query(`DROP INDEX \`IDX_def83cb63b4ad43b92d4244a8e\` ON \`nauth_users\``);
|
|
100
|
+
await queryRunner.query(`DROP INDEX \`IDX_e7f7b3f18dfd026b8fe3ea08c2\` ON \`nauth_users\``);
|
|
101
|
+
await queryRunner.query(`DROP INDEX \`IDX_79f6834c0c66979cb09b62473b\` ON \`nauth_users\``);
|
|
102
|
+
await queryRunner.query(`DROP INDEX \`IDX_545148d3ac52c29568490ff064\` ON \`nauth_users\``);
|
|
103
|
+
await queryRunner.query(`DROP TABLE \`nauth_users\``);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.Initial1734600000000 = Initial1734600000000;
|
|
107
|
+
//# sourceMappingURL=1734600000000-Initial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1734600000000-Initial.js","sourceRoot":"","sources":["../../src/migrations/1734600000000-Initial.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAC/B,IAAI,GAAG,sBAAsB,CAAC;IAEvB,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,KAAK,CACrB,y5DAAy5D,CAC15D,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,8hEAA8hE,CAC/hE,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,0jBAA0jB,CAC3jB,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,w5BAAw5B,CACz5B,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,wrBAAwrB,CACzrB,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,8rBAA8rB,CAC/rB,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,26BAA26B,CAC56B,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,mjDAAmjD,CACpjD,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CACrB,27BAA27B,CAC57B,CAAC;QACF,MAAM,WAAW,CAAC,KAAK,CAC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A/ID,oDA+IC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,MAAM,MAAM,oBAAoB,GAAG;IAAE,QAAQ,kBAAkB,CAAA;CAAE,CAAC;AAKlE,eAAO,MAAM,UAAU,EAAE,oBAAoB,EAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrations = void 0;
|
|
4
|
+
const _1734600000000_Initial_1 = require("./1734600000000-Initial");
|
|
5
|
+
exports.migrations = [_1734600000000_Initial_1.Initial1734600000000];
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AACA,oEAA+D;AAOlD,QAAA,UAAU,GAA2B,CAAC,6CAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-cli.datasource.d.ts","sourceRoot":"","sources":["../src/typeorm-cli.datasource.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;;AAUrC,wBAYG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("reflect-metadata");
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const entities_1 = require("./entities");
|
|
6
|
+
const migrations_1 = require("./migrations");
|
|
7
|
+
exports.default = new typeorm_1.DataSource({
|
|
8
|
+
type: 'mysql',
|
|
9
|
+
host: process.env.DB_HOST,
|
|
10
|
+
port: parseInt(process.env.DB_PORT || '3306', 10),
|
|
11
|
+
username: process.env.DB_USERNAME,
|
|
12
|
+
password: process.env.DB_PASSWORD,
|
|
13
|
+
database: process.env.DB_DATABASE,
|
|
14
|
+
entities: [...(0, entities_1.getNAuthEntities)(), ...(0, entities_1.getNAuthTransientStorageEntities)()],
|
|
15
|
+
migrations: migrations_1.migrations,
|
|
16
|
+
synchronize: false,
|
|
17
|
+
logging: false,
|
|
18
|
+
timezone: 'Z',
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=typeorm-cli.datasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-cli.datasource.js","sourceRoot":"","sources":["../src/typeorm-cli.datasource.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAC1B,qCAAqC;AACrC,yCAAgF;AAChF,6CAA0C;AAQ1C,kBAAe,IAAI,oBAAU,CAAC;IAC5B,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;IACzB,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,MAAM,EAAE,EAAE,CAAC;IACjD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACjC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACjC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACjC,QAAQ,EAAE,CAAC,GAAG,IAAA,2BAAgB,GAAE,EAAE,GAAG,IAAA,2CAAgC,GAAE,CAAC;IACxE,UAAU,EAAV,uBAAU;IACV,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,GAAG;CACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DataSource } from 'typeorm';
|
|
2
|
+
import type { NAuthConfig, NAuthLogger } from '@nauth-toolkit/core';
|
|
3
|
+
export declare function runNAuthMigrations(dataSource: DataSource, logger: NAuthLogger, config: NAuthConfig): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=run-migrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-migrations.d.ts","sourceRoot":"","sources":["../../src/utils/run-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAgBpE,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CA8Bf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runNAuthMigrations = runNAuthMigrations;
|
|
4
|
+
const migrations_1 = require("../migrations");
|
|
5
|
+
function getMigrationsTableName(config) {
|
|
6
|
+
const tablePrefix = config.tablePrefix ?? 'nauth_';
|
|
7
|
+
return `${tablePrefix}migrations`;
|
|
8
|
+
}
|
|
9
|
+
async function runNAuthMigrations(dataSource, logger, config) {
|
|
10
|
+
const migrationsTableName = getMigrationsTableName(config);
|
|
11
|
+
logger.log(`[nauth-toolkit] Ensuring database schema via migrations (@nauth-toolkit/database-typeorm-mysql)...`);
|
|
12
|
+
const existing = Array.isArray(dataSource.options.migrations) ? dataSource.options.migrations : [];
|
|
13
|
+
const merged = [...existing, ...migrations_1.migrations];
|
|
14
|
+
dataSource.options.migrations = merged;
|
|
15
|
+
dataSource.options.migrationsTableName = migrationsTableName;
|
|
16
|
+
await dataSource.buildMetadatas();
|
|
17
|
+
logger.log(`[nauth-toolkit] Injecting ${migrations_1.migrations.length} NAuth migration(s) into DataSource (existing runtime: ${existing.length})`);
|
|
18
|
+
logger.log('[nauth-toolkit] Checking for pending migrations...');
|
|
19
|
+
const executed = (await dataSource.runMigrations({ transaction: 'all' }));
|
|
20
|
+
if (!executed.length) {
|
|
21
|
+
logger.log('[nauth-toolkit] No pending migrations.');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
logger.log(`[nauth-toolkit] Executed ${executed.length} migration(s):`);
|
|
25
|
+
for (const m of executed)
|
|
26
|
+
logger.log(` ✓ ${m.name}`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=run-migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-migrations.js","sourceRoot":"","sources":["../../src/utils/run-migrations.ts"],"names":[],"mappings":";;AAiBA,gDAkCC;AAjDD,8CAA2C;AAI3C,SAAS,sBAAsB,CAAC,MAAmB;IACjD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC;IACnD,OAAO,GAAG,WAAW,YAAY,CAAC;AACpC,CAAC;AAQM,KAAK,UAAU,kBAAkB,CACtC,UAAsB,EACtB,MAAmB,EACnB,MAAmB;IAEnB,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAE3D,MAAM,CAAC,GAAG,CAAC,oGAAoG,CAAC,CAAC;IAEjH,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACnG,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,uBAAU,CAAC,CAAC;IAI3C,UAAU,CAAC,OAAsC,CAAC,UAAU,GAAG,MAAmB,CAAC;IACnF,UAAU,CAAC,OAA4C,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACnG,MAAO,UAAiE,CAAC,cAAc,EAAE,CAAC;IAE1F,MAAM,CAAC,GAAG,CACR,6BAA6B,uBAAU,CAAC,MAAM,0DAA0D,QAAQ,CAAC,MAAM,GAAG,CAC3H,CAAC;IACF,MAAM,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAEjE,MAAM,QAAQ,GAAG,CAAC,MAAM,UAAU,CAAC,aAAa,CAC9C,EAAE,WAAW,EAAE,KAAK,EAAuC,CAC5D,CAAuB,CAAC;IAEzB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,4BAA4B,QAAQ,CAAC,MAAM,gBAAgB,CAAC,CAAC;IACxE,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nauth-toolkit/database-typeorm-mysql",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "MySQL TypeORM adapter for nauth-toolkit",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -b",
|
|
9
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
10
|
+
"test": "jest --passWithNoTests",
|
|
11
|
+
"lint": "eslint src --ext .ts",
|
|
12
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
13
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
14
|
+
"format:check": "prettier --check \"src/**/*.ts\""
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@nauth-toolkit/core": "^0.1.3",
|
|
18
|
+
"typeorm": "^0.3.20",
|
|
19
|
+
"mysql2": "^2.3.0 || ^3.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/jest": "^29.5.0",
|
|
23
|
+
"@types/node": "^22.0.0",
|
|
24
|
+
"jest": "^29.7.0",
|
|
25
|
+
"ts-jest": "^29.2.0",
|
|
26
|
+
"typescript": "^5.5.0"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.0.0"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"tag": "preview"
|
|
34
|
+
},
|
|
35
|
+
"license": "UNLICENSED",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"nestjs",
|
|
38
|
+
"authentication",
|
|
39
|
+
"typeorm",
|
|
40
|
+
"mysql",
|
|
41
|
+
"database"
|
|
42
|
+
],
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"LICENSE",
|
|
46
|
+
"README.md"
|
|
47
|
+
]
|
|
48
|
+
}
|