@techelusive/nest-auth 0.0.0-stage → 0.2.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/CHANGELOG.md +64 -0
- package/LICENSE +21 -0
- package/README.md +204 -2
- package/api/openapi.json +4399 -0
- package/api/techelusive-authentication.postman_collection.json +3178 -0
- package/dist/auth-options.d.ts +156 -0
- package/dist/auth-options.js +3 -0
- package/dist/auth-options.js.map +1 -0
- package/dist/auth-options.validation.d.ts +9 -0
- package/dist/auth-options.validation.js +74 -0
- package/dist/auth-options.validation.js.map +1 -0
- package/dist/auth.module.d.ts +38 -0
- package/dist/auth.module.js +173 -0
- package/dist/auth.module.js.map +1 -0
- package/dist/common/auth-error.d.ts +16 -0
- package/dist/common/auth-error.js +23 -0
- package/dist/common/auth-error.js.map +1 -0
- package/dist/common/auth-exception.filter.d.ts +24 -0
- package/dist/common/auth-exception.filter.js +66 -0
- package/dist/common/auth-exception.filter.js.map +1 -0
- package/dist/common/crypto/jwt.d.ts +89 -0
- package/dist/common/crypto/jwt.js +144 -0
- package/dist/common/crypto/jwt.js.map +1 -0
- package/dist/common/crypto/random-secrets.d.ts +78 -0
- package/dist/common/crypto/random-secrets.js +113 -0
- package/dist/common/crypto/random-secrets.js.map +1 -0
- package/dist/common/crypto/remote-public-keys.d.ts +49 -0
- package/dist/common/crypto/remote-public-keys.js +105 -0
- package/dist/common/crypto/remote-public-keys.js.map +1 -0
- package/dist/common/crypto/totp.d.ts +68 -0
- package/dist/common/crypto/totp.js +148 -0
- package/dist/common/crypto/totp.js.map +1 -0
- package/dist/common/encryption.service.d.ts +36 -0
- package/dist/common/encryption.service.js +111 -0
- package/dist/common/encryption.service.js.map +1 -0
- package/dist/common/identifiers.d.ts +48 -0
- package/dist/common/identifiers.js +89 -0
- package/dist/common/identifiers.js.map +1 -0
- package/dist/common/network-safety.d.ts +19 -0
- package/dist/common/network-safety.js +72 -0
- package/dist/common/network-safety.js.map +1 -0
- package/dist/common/rate-limiter.service.d.ts +63 -0
- package/dist/common/rate-limiter.service.js +158 -0
- package/dist/common/rate-limiter.service.js.map +1 -0
- package/dist/common/refresh-token-cookie.d.ts +78 -0
- package/dist/common/refresh-token-cookie.js +185 -0
- package/dist/common/refresh-token-cookie.js.map +1 -0
- package/dist/common/request-context.d.ts +14 -0
- package/dist/common/request-context.js +22 -0
- package/dist/common/request-context.js.map +1 -0
- package/dist/common/strict-validation.pipe.d.ts +8 -0
- package/dist/common/strict-validation.pipe.js +16 -0
- package/dist/common/strict-validation.pipe.js.map +1 -0
- package/dist/common/time.d.ts +15 -0
- package/dist/common/time.js +34 -0
- package/dist/common/time.js.map +1 -0
- package/dist/constants.d.ts +1326 -0
- package/dist/constants.js +1142 -0
- package/dist/constants.js.map +1 -0
- package/dist/database/create-auth-tables.migration.d.ts +26 -0
- package/dist/database/create-auth-tables.migration.js +291 -0
- package/dist/database/create-auth-tables.migration.js.map +1 -0
- package/dist/database/email-change-and-retention.migration.d.ts +25 -0
- package/dist/database/email-change-and-retention.migration.js +54 -0
- package/dist/database/email-change-and-retention.migration.js.map +1 -0
- package/dist/database/entities/api-key.entity.d.ts +17 -0
- package/dist/database/entities/api-key.entity.js +80 -0
- package/dist/database/entities/api-key.entity.js.map +1 -0
- package/dist/database/entities/audit-log.entity.d.ts +13 -0
- package/dist/database/entities/audit-log.entity.js +64 -0
- package/dist/database/entities/audit-log.entity.js.map +1 -0
- package/dist/database/entities/backup-code.entity.d.ts +9 -0
- package/dist/database/entities/backup-code.entity.js +52 -0
- package/dist/database/entities/backup-code.entity.js.map +1 -0
- package/dist/database/entities/index.d.ts +43 -0
- package/dist/database/entities/index.js +82 -0
- package/dist/database/entities/index.js.map +1 -0
- package/dist/database/entities/json-object.d.ts +12 -0
- package/dist/database/entities/json-object.js +3 -0
- package/dist/database/entities/json-object.js.map +1 -0
- package/dist/database/entities/link-token.entity.d.ts +15 -0
- package/dist/database/entities/link-token.entity.js +64 -0
- package/dist/database/entities/link-token.entity.js.map +1 -0
- package/dist/database/entities/one-time-code.entity.d.ts +16 -0
- package/dist/database/entities/one-time-code.entity.js +69 -0
- package/dist/database/entities/one-time-code.entity.js.map +1 -0
- package/dist/database/entities/organization-invitation.entity.d.ts +14 -0
- package/dist/database/entities/organization-invitation.entity.js +73 -0
- package/dist/database/entities/organization-invitation.entity.js.map +1 -0
- package/dist/database/entities/organization-member.entity.d.ts +9 -0
- package/dist/database/entities/organization-member.entity.js +48 -0
- package/dist/database/entities/organization-member.entity.js.map +1 -0
- package/dist/database/entities/organization.entity.d.ts +12 -0
- package/dist/database/entities/organization.entity.js +58 -0
- package/dist/database/entities/organization.entity.js.map +1 -0
- package/dist/database/entities/passkey.entity.d.ts +19 -0
- package/dist/database/entities/passkey.entity.js +78 -0
- package/dist/database/entities/passkey.entity.js.map +1 -0
- package/dist/database/entities/password.entity.d.ts +6 -0
- package/dist/database/entities/password.entity.js +36 -0
- package/dist/database/entities/password.entity.js.map +1 -0
- package/dist/database/entities/refresh-token.entity.d.ts +9 -0
- package/dist/database/entities/refresh-token.entity.js +53 -0
- package/dist/database/entities/refresh-token.entity.js.map +1 -0
- package/dist/database/entities/session.entity.d.ts +20 -0
- package/dist/database/entities/session.entity.js +87 -0
- package/dist/database/entities/session.entity.js.map +1 -0
- package/dist/database/entities/settings.entity.d.ts +7 -0
- package/dist/database/entities/settings.entity.js +41 -0
- package/dist/database/entities/settings.entity.js.map +1 -0
- package/dist/database/entities/sign-in-challenge.entity.d.ts +23 -0
- package/dist/database/entities/sign-in-challenge.entity.js +80 -0
- package/dist/database/entities/sign-in-challenge.entity.js.map +1 -0
- package/dist/database/entities/signing-key.entity.d.ts +11 -0
- package/dist/database/entities/signing-key.entity.js +54 -0
- package/dist/database/entities/signing-key.entity.js.map +1 -0
- package/dist/database/entities/social-account.entity.d.ts +13 -0
- package/dist/database/entities/social-account.entity.js +54 -0
- package/dist/database/entities/social-account.entity.js.map +1 -0
- package/dist/database/entities/two-factor-secret.entity.d.ts +10 -0
- package/dist/database/entities/two-factor-secret.entity.js +48 -0
- package/dist/database/entities/two-factor-secret.entity.js.map +1 -0
- package/dist/database/entities/user.entity.d.ts +34 -0
- package/dist/database/entities/user.entity.js +129 -0
- package/dist/database/entities/user.entity.js.map +1 -0
- package/dist/database/entities/webhook-delivery.entity.d.ts +17 -0
- package/dist/database/entities/webhook-delivery.entity.js +79 -0
- package/dist/database/entities/webhook-delivery.entity.js.map +1 -0
- package/dist/database/entities/webhook.entity.d.ts +12 -0
- package/dist/database/entities/webhook.entity.js +58 -0
- package/dist/database/entities/webhook.entity.js.map +1 -0
- package/dist/database/typeorm-row.d.ts +21 -0
- package/dist/database/typeorm-row.js +29 -0
- package/dist/database/typeorm-row.js.map +1 -0
- package/dist/features/account/account.controller.d.ts +259 -0
- package/dist/features/account/account.controller.js +372 -0
- package/dist/features/account/account.controller.js.map +1 -0
- package/dist/features/account/account.dto.d.ts +16 -0
- package/dist/features/account/account.dto.js +61 -0
- package/dist/features/account/account.dto.js.map +1 -0
- package/dist/features/account/data-export.service.d.ts +85 -0
- package/dist/features/account/data-export.service.js +125 -0
- package/dist/features/account/data-export.service.js.map +1 -0
- package/dist/features/account/health.service.d.ts +30 -0
- package/dist/features/account/health.service.js +59 -0
- package/dist/features/account/health.service.js.map +1 -0
- package/dist/features/admin/admin.controller.d.ts +382 -0
- package/dist/features/admin/admin.controller.js +623 -0
- package/dist/features/admin/admin.controller.js.map +1 -0
- package/dist/features/admin/admin.dto.d.ts +61 -0
- package/dist/features/admin/admin.dto.js +253 -0
- package/dist/features/admin/admin.dto.js.map +1 -0
- package/dist/features/admin/admin.service.d.ts +142 -0
- package/dist/features/admin/admin.service.js +227 -0
- package/dist/features/admin/admin.service.js.map +1 -0
- package/dist/features/api-keys/api-keys.service.d.ts +67 -0
- package/dist/features/api-keys/api-keys.service.js +144 -0
- package/dist/features/api-keys/api-keys.service.js.map +1 -0
- package/dist/features/email-change/email-change.controller.d.ts +38 -0
- package/dist/features/email-change/email-change.controller.js +85 -0
- package/dist/features/email-change/email-change.controller.js.map +1 -0
- package/dist/features/email-change/email-change.dto.d.ts +10 -0
- package/dist/features/email-change/email-change.dto.js +43 -0
- package/dist/features/email-change/email-change.dto.js.map +1 -0
- package/dist/features/email-change/email-change.service.d.ts +74 -0
- package/dist/features/email-change/email-change.service.js +179 -0
- package/dist/features/email-change/email-change.service.js.map +1 -0
- package/dist/features/email-links/email-verification.service.d.ts +46 -0
- package/dist/features/email-links/email-verification.service.js +94 -0
- package/dist/features/email-links/email-verification.service.js.map +1 -0
- package/dist/features/email-links/link-tokens.service.d.ts +44 -0
- package/dist/features/email-links/link-tokens.service.js +122 -0
- package/dist/features/email-links/link-tokens.service.js.map +1 -0
- package/dist/features/events/auth-events.service.d.ts +52 -0
- package/dist/features/events/auth-events.service.js +117 -0
- package/dist/features/events/auth-events.service.js.map +1 -0
- package/dist/features/maintenance/data-retention.service.d.ts +60 -0
- package/dist/features/maintenance/data-retention.service.js +182 -0
- package/dist/features/maintenance/data-retention.service.js.map +1 -0
- package/dist/features/notifications/notifications.service.d.ts +40 -0
- package/dist/features/notifications/notifications.service.js +94 -0
- package/dist/features/notifications/notifications.service.js.map +1 -0
- package/dist/features/one-time-codes/one-time-codes.service.d.ts +40 -0
- package/dist/features/one-time-codes/one-time-codes.service.js +102 -0
- package/dist/features/one-time-codes/one-time-codes.service.js.map +1 -0
- package/dist/features/organizations/organizations.controller.d.ts +220 -0
- package/dist/features/organizations/organizations.controller.js +337 -0
- package/dist/features/organizations/organizations.controller.js.map +1 -0
- package/dist/features/organizations/organizations.dto.d.ts +31 -0
- package/dist/features/organizations/organizations.dto.js +100 -0
- package/dist/features/organizations/organizations.dto.js.map +1 -0
- package/dist/features/organizations/organizations.service.d.ts +274 -0
- package/dist/features/organizations/organizations.service.js +481 -0
- package/dist/features/organizations/organizations.service.js.map +1 -0
- package/dist/features/passkeys/passkeys.controller.d.ts +92 -0
- package/dist/features/passkeys/passkeys.controller.js +183 -0
- package/dist/features/passkeys/passkeys.controller.js.map +1 -0
- package/dist/features/passkeys/passkeys.dto.d.ts +13 -0
- package/dist/features/passkeys/passkeys.dto.js +50 -0
- package/dist/features/passkeys/passkeys.dto.js.map +1 -0
- package/dist/features/passkeys/passkeys.service.d.ts +159 -0
- package/dist/features/passkeys/passkeys.service.js +350 -0
- package/dist/features/passkeys/passkeys.service.js.map +1 -0
- package/dist/features/passwordless/passwordless-auth.service.d.ts +152 -0
- package/dist/features/passwordless/passwordless-auth.service.js +304 -0
- package/dist/features/passwordless/passwordless-auth.service.js.map +1 -0
- package/dist/features/passwordless/passwordless.controller.d.ts +75 -0
- package/dist/features/passwordless/passwordless.controller.js +163 -0
- package/dist/features/passwordless/passwordless.controller.js.map +1 -0
- package/dist/features/passwordless/passwordless.dto.d.ts +29 -0
- package/dist/features/passwordless/passwordless.dto.js +101 -0
- package/dist/features/passwordless/passwordless.dto.js.map +1 -0
- package/dist/features/passwords/password-auth.service.d.ts +154 -0
- package/dist/features/passwords/password-auth.service.js +317 -0
- package/dist/features/passwords/password-auth.service.js.map +1 -0
- package/dist/features/passwords/password-policy.service.d.ts +63 -0
- package/dist/features/passwords/password-policy.service.js +175 -0
- package/dist/features/passwords/password-policy.service.js.map +1 -0
- package/dist/features/passwords/password.controller.d.ts +95 -0
- package/dist/features/passwords/password.controller.js +193 -0
- package/dist/features/passwords/password.controller.js.map +1 -0
- package/dist/features/passwords/password.dto.d.ts +36 -0
- package/dist/features/passwords/password.dto.js +140 -0
- package/dist/features/passwords/password.dto.js.map +1 -0
- package/dist/features/sessions/session.service.d.ts +132 -0
- package/dist/features/sessions/session.service.js +308 -0
- package/dist/features/sessions/session.service.js.map +1 -0
- package/dist/features/sessions/session.types.d.ts +34 -0
- package/dist/features/sessions/session.types.js +3 -0
- package/dist/features/sessions/session.types.js.map +1 -0
- package/dist/features/settings/settings.defaults.d.ts +2 -0
- package/dist/features/settings/settings.defaults.js +7 -0
- package/dist/features/settings/settings.defaults.js.map +1 -0
- package/dist/features/settings/settings.service.d.ts +44 -0
- package/dist/features/settings/settings.service.js +112 -0
- package/dist/features/settings/settings.service.js.map +1 -0
- package/dist/features/settings/settings.types.d.ts +133 -0
- package/dist/features/settings/settings.types.js +3 -0
- package/dist/features/settings/settings.types.js.map +1 -0
- package/dist/features/settings/settings.validation.d.ts +33 -0
- package/dist/features/settings/settings.validation.js +614 -0
- package/dist/features/settings/settings.validation.js.map +1 -0
- package/dist/features/sign-in/sign-in-challenges.service.d.ts +54 -0
- package/dist/features/sign-in/sign-in-challenges.service.js +104 -0
- package/dist/features/sign-in/sign-in-challenges.service.js.map +1 -0
- package/dist/features/sign-in/sign-in.service.d.ts +127 -0
- package/dist/features/sign-in/sign-in.service.js +248 -0
- package/dist/features/sign-in/sign-in.service.js.map +1 -0
- package/dist/features/sign-in/sign-in.types.d.ts +22 -0
- package/dist/features/sign-in/sign-in.types.js +3 -0
- package/dist/features/sign-in/sign-in.types.js.map +1 -0
- package/dist/features/signing-keys/jwks.controller.d.ts +17 -0
- package/dist/features/signing-keys/jwks.controller.js +51 -0
- package/dist/features/signing-keys/jwks.controller.js.map +1 -0
- package/dist/features/signing-keys/signing-keys.service.d.ts +67 -0
- package/dist/features/signing-keys/signing-keys.service.js +142 -0
- package/dist/features/signing-keys/signing-keys.service.js.map +1 -0
- package/dist/features/social/social-auth.service.d.ts +100 -0
- package/dist/features/social/social-auth.service.js +232 -0
- package/dist/features/social/social-auth.service.js.map +1 -0
- package/dist/features/social/social-providers.service.d.ts +97 -0
- package/dist/features/social/social-providers.service.js +214 -0
- package/dist/features/social/social-providers.service.js.map +1 -0
- package/dist/features/social/social.controller.d.ts +54 -0
- package/dist/features/social/social.controller.js +124 -0
- package/dist/features/social/social.controller.js.map +1 -0
- package/dist/features/social/social.dto.d.ts +11 -0
- package/dist/features/social/social.dto.js +38 -0
- package/dist/features/social/social.dto.js.map +1 -0
- package/dist/features/two-factor/two-factor.controller.d.ts +84 -0
- package/dist/features/two-factor/two-factor.controller.js +174 -0
- package/dist/features/two-factor/two-factor.controller.js.map +1 -0
- package/dist/features/two-factor/two-factor.dto.d.ts +10 -0
- package/dist/features/two-factor/two-factor.dto.js +37 -0
- package/dist/features/two-factor/two-factor.dto.js.map +1 -0
- package/dist/features/two-factor/two-factor.service.d.ts +171 -0
- package/dist/features/two-factor/two-factor.service.js +348 -0
- package/dist/features/two-factor/two-factor.service.js.map +1 -0
- package/dist/features/users/sign-in-methods.service.d.ts +40 -0
- package/dist/features/users/sign-in-methods.service.js +81 -0
- package/dist/features/users/sign-in-methods.service.js.map +1 -0
- package/dist/features/users/sign-up-rules.d.ts +12 -0
- package/dist/features/users/sign-up-rules.js +29 -0
- package/dist/features/users/sign-up-rules.js.map +1 -0
- package/dist/features/users/users.service.d.ts +246 -0
- package/dist/features/users/users.service.js +509 -0
- package/dist/features/users/users.service.js.map +1 -0
- package/dist/features/users/users.types.d.ts +24 -0
- package/dist/features/users/users.types.js +3 -0
- package/dist/features/users/users.types.js.map +1 -0
- package/dist/features/webhooks/webhook-delivery.worker.d.ts +55 -0
- package/dist/features/webhooks/webhook-delivery.worker.js +175 -0
- package/dist/features/webhooks/webhook-delivery.worker.js.map +1 -0
- package/dist/features/webhooks/webhook-signature.d.ts +28 -0
- package/dist/features/webhooks/webhook-signature.js +85 -0
- package/dist/features/webhooks/webhook-signature.js.map +1 -0
- package/dist/features/webhooks/webhooks.service.d.ts +144 -0
- package/dist/features/webhooks/webhooks.service.js +238 -0
- package/dist/features/webhooks/webhooks.service.js.map +1 -0
- package/dist/guards/auth.decorators.d.ts +65 -0
- package/dist/guards/auth.decorators.js +68 -0
- package/dist/guards/auth.decorators.js.map +1 -0
- package/dist/guards/auth.guard.d.ts +47 -0
- package/dist/guards/auth.guard.js +132 -0
- package/dist/guards/auth.guard.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/console-email-sender.d.ts +15 -0
- package/dist/integrations/console-email-sender.js +26 -0
- package/dist/integrations/console-email-sender.js.map +1 -0
- package/dist/integrations/msg91-sms-sender.d.ts +28 -0
- package/dist/integrations/msg91-sms-sender.js +46 -0
- package/dist/integrations/msg91-sms-sender.js.map +1 -0
- package/docs/README.md +39 -0
- package/docs/admin-api-keys-webhooks.md +147 -0
- package/docs/api-reference.md +175 -0
- package/docs/architecture.md +119 -0
- package/docs/client-integration.md +192 -0
- package/docs/code-walkthrough.md +273 -0
- package/docs/configuration.md +229 -0
- package/docs/endpoints/README.md +151 -0
- package/docs/endpoints/account.md +363 -0
- package/docs/endpoints/admin.md +422 -0
- package/docs/endpoints/email-password.md +261 -0
- package/docs/endpoints/organizations.md +192 -0
- package/docs/endpoints/passkeys.md +195 -0
- package/docs/endpoints/passwordless.md +214 -0
- package/docs/endpoints/social.md +116 -0
- package/docs/endpoints/two-factor.md +146 -0
- package/docs/error-codes.md +100 -0
- package/docs/events.md +83 -0
- package/docs/getting-started.md +139 -0
- package/docs/manual-testing.md +215 -0
- package/docs/organizations.md +86 -0
- package/docs/production-checklist.md +60 -0
- package/docs/protecting-routes.md +147 -0
- package/docs/security.md +61 -0
- package/docs/sign-in-flows.md +294 -0
- package/package.json +92 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuditLogEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
/** Security history: sign-ins, failures, password changes, admin actions. Never contains secrets. */
|
|
15
|
+
let AuditLogEntity = class AuditLogEntity {
|
|
16
|
+
id;
|
|
17
|
+
userId;
|
|
18
|
+
/** Who did it, when not the user themself: "admin:<id>", "system". */
|
|
19
|
+
performedBy;
|
|
20
|
+
eventName;
|
|
21
|
+
ipAddress;
|
|
22
|
+
userAgent;
|
|
23
|
+
details;
|
|
24
|
+
createdAt;
|
|
25
|
+
};
|
|
26
|
+
exports.AuditLogEntity = AuditLogEntity;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], AuditLogEntity.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Index)(),
|
|
33
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'uuid', nullable: true }),
|
|
34
|
+
__metadata("design:type", Object)
|
|
35
|
+
], AuditLogEntity.prototype, "userId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ name: 'performed_by', type: 'text', nullable: true }),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], AuditLogEntity.prototype, "performedBy", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ name: 'event_name', type: 'text' }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], AuditLogEntity.prototype, "eventName", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ name: 'ip_address', type: 'text', nullable: true }),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], AuditLogEntity.prototype, "ipAddress", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ name: 'user_agent', type: 'text', nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], AuditLogEntity.prototype, "userAgent", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], AuditLogEntity.prototype, "details", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Index)(),
|
|
58
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
59
|
+
__metadata("design:type", Date)
|
|
60
|
+
], AuditLogEntity.prototype, "createdAt", void 0);
|
|
61
|
+
exports.AuditLogEntity = AuditLogEntity = __decorate([
|
|
62
|
+
(0, typeorm_1.Entity)('auth_audit_logs')
|
|
63
|
+
], AuditLogEntity);
|
|
64
|
+
//# sourceMappingURL=audit-log.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.entity.js","sourceRoot":"","sources":["../../../src/database/entities/audit-log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAG1F,qGAAqG;AAE9F,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,EAAE,CAAS;IAIX,MAAM,CAAgB;IAEtB,sEAAsE;IAEtE,WAAW,CAAgB;IAG3B,SAAS,CAAS;IAGlB,SAAS,CAAgB;IAGzB,SAAS,CAAgB;IAGzB,OAAO,CAAa;IAIpB,SAAS,CAAO;CACjB,CAAA;AA3BY,wCAAc;AAEzB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACpB;AAIX;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACpC;AAItB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACpC;AAG3B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAC3B;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACpC;AAGzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACpC;AAGzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;+CACnB;AAIpB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACnD,IAAI;iDAAC;yBA1BL,cAAc;IAD1B,IAAA,gBAAM,EAAC,iBAAiB,CAAC;GACb,cAAc,CA2B1B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BackupCodeEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
/** One-time backup codes for when the user loses their authenticator app. Stored hashed. */
|
|
15
|
+
let BackupCodeEntity = class BackupCodeEntity {
|
|
16
|
+
id;
|
|
17
|
+
userId;
|
|
18
|
+
codeHash;
|
|
19
|
+
salt;
|
|
20
|
+
usedAt;
|
|
21
|
+
createdAt;
|
|
22
|
+
};
|
|
23
|
+
exports.BackupCodeEntity = BackupCodeEntity;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], BackupCodeEntity.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Index)(),
|
|
30
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'uuid' }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], BackupCodeEntity.prototype, "userId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ name: 'code_hash', type: 'text' }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], BackupCodeEntity.prototype, "codeHash", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], BackupCodeEntity.prototype, "salt", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ name: 'used_at', type: 'timestamptz', nullable: true }),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], BackupCodeEntity.prototype, "usedAt", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
47
|
+
__metadata("design:type", Date)
|
|
48
|
+
], BackupCodeEntity.prototype, "createdAt", void 0);
|
|
49
|
+
exports.BackupCodeEntity = BackupCodeEntity = __decorate([
|
|
50
|
+
(0, typeorm_1.Entity)('auth_backup_codes')
|
|
51
|
+
], BackupCodeEntity);
|
|
52
|
+
//# sourceMappingURL=backup-code.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-code.entity.js","sourceRoot":"","sources":["../../../src/database/entities/backup-code.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAE1F,4FAA4F;AAErF,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,EAAE,CAAS;IAIX,MAAM,CAAS;IAGf,QAAQ,CAAS;IAGjB,IAAI,CAAS;IAGb,MAAM,CAAc;IAGpB,SAAS,CAAO;CACjB,CAAA;AAnBY,4CAAgB;AAE3B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACpB;AAIX;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAC3B;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAC3B;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACZ;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC7C;AAGpB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACnD,IAAI;mDAAC;2BAlBL,gBAAgB;IAD5B,IAAA,gBAAM,EAAC,mBAAmB,CAAC;GACf,gBAAgB,CAmB5B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ApiKeyEntity } from './api-key.entity';
|
|
2
|
+
import { AuditLogEntity } from './audit-log.entity';
|
|
3
|
+
import { BackupCodeEntity } from './backup-code.entity';
|
|
4
|
+
import { LinkTokenEntity } from './link-token.entity';
|
|
5
|
+
import { OneTimeCodeEntity } from './one-time-code.entity';
|
|
6
|
+
import { OrganizationInvitationEntity } from './organization-invitation.entity';
|
|
7
|
+
import { OrganizationMemberEntity } from './organization-member.entity';
|
|
8
|
+
import { OrganizationEntity } from './organization.entity';
|
|
9
|
+
import { PasskeyEntity } from './passkey.entity';
|
|
10
|
+
import { PasswordEntity } from './password.entity';
|
|
11
|
+
import { RefreshTokenEntity } from './refresh-token.entity';
|
|
12
|
+
import { SessionEntity } from './session.entity';
|
|
13
|
+
import { SettingsEntity } from './settings.entity';
|
|
14
|
+
import { SignInChallengeEntity } from './sign-in-challenge.entity';
|
|
15
|
+
import { SigningKeyEntity } from './signing-key.entity';
|
|
16
|
+
import { SocialAccountEntity } from './social-account.entity';
|
|
17
|
+
import { TwoFactorSecretEntity } from './two-factor-secret.entity';
|
|
18
|
+
import { UserEntity } from './user.entity';
|
|
19
|
+
import { WebhookDeliveryEntity } from './webhook-delivery.entity';
|
|
20
|
+
import { WebhookEntity } from './webhook.entity';
|
|
21
|
+
export * from './api-key.entity';
|
|
22
|
+
export * from './json-object';
|
|
23
|
+
export * from './audit-log.entity';
|
|
24
|
+
export * from './backup-code.entity';
|
|
25
|
+
export * from './link-token.entity';
|
|
26
|
+
export * from './one-time-code.entity';
|
|
27
|
+
export * from './organization-invitation.entity';
|
|
28
|
+
export * from './organization-member.entity';
|
|
29
|
+
export * from './organization.entity';
|
|
30
|
+
export * from './passkey.entity';
|
|
31
|
+
export * from './password.entity';
|
|
32
|
+
export * from './refresh-token.entity';
|
|
33
|
+
export * from './session.entity';
|
|
34
|
+
export * from './settings.entity';
|
|
35
|
+
export * from './sign-in-challenge.entity';
|
|
36
|
+
export * from './signing-key.entity';
|
|
37
|
+
export * from './social-account.entity';
|
|
38
|
+
export * from './two-factor-secret.entity';
|
|
39
|
+
export * from './user.entity';
|
|
40
|
+
export * from './webhook-delivery.entity';
|
|
41
|
+
export * from './webhook.entity';
|
|
42
|
+
/** Add these to your TypeORM DataSource `entities` list. */
|
|
43
|
+
export declare const AUTH_ENTITIES: (typeof ApiKeyEntity | typeof AuditLogEntity | typeof BackupCodeEntity | typeof LinkTokenEntity | typeof OneTimeCodeEntity | typeof OrganizationInvitationEntity | typeof OrganizationMemberEntity | typeof OrganizationEntity | typeof PasskeyEntity | typeof PasswordEntity | typeof RefreshTokenEntity | typeof SessionEntity | typeof SettingsEntity | typeof SignInChallengeEntity | typeof SigningKeyEntity | typeof SocialAccountEntity | typeof TwoFactorSecretEntity | typeof UserEntity | typeof WebhookDeliveryEntity | typeof WebhookEntity)[];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AUTH_ENTITIES = void 0;
|
|
18
|
+
const api_key_entity_1 = require("./api-key.entity");
|
|
19
|
+
const audit_log_entity_1 = require("./audit-log.entity");
|
|
20
|
+
const backup_code_entity_1 = require("./backup-code.entity");
|
|
21
|
+
const link_token_entity_1 = require("./link-token.entity");
|
|
22
|
+
const one_time_code_entity_1 = require("./one-time-code.entity");
|
|
23
|
+
const organization_invitation_entity_1 = require("./organization-invitation.entity");
|
|
24
|
+
const organization_member_entity_1 = require("./organization-member.entity");
|
|
25
|
+
const organization_entity_1 = require("./organization.entity");
|
|
26
|
+
const passkey_entity_1 = require("./passkey.entity");
|
|
27
|
+
const password_entity_1 = require("./password.entity");
|
|
28
|
+
const refresh_token_entity_1 = require("./refresh-token.entity");
|
|
29
|
+
const session_entity_1 = require("./session.entity");
|
|
30
|
+
const settings_entity_1 = require("./settings.entity");
|
|
31
|
+
const sign_in_challenge_entity_1 = require("./sign-in-challenge.entity");
|
|
32
|
+
const signing_key_entity_1 = require("./signing-key.entity");
|
|
33
|
+
const social_account_entity_1 = require("./social-account.entity");
|
|
34
|
+
const two_factor_secret_entity_1 = require("./two-factor-secret.entity");
|
|
35
|
+
const user_entity_1 = require("./user.entity");
|
|
36
|
+
const webhook_delivery_entity_1 = require("./webhook-delivery.entity");
|
|
37
|
+
const webhook_entity_1 = require("./webhook.entity");
|
|
38
|
+
__exportStar(require("./api-key.entity"), exports);
|
|
39
|
+
__exportStar(require("./json-object"), exports);
|
|
40
|
+
__exportStar(require("./audit-log.entity"), exports);
|
|
41
|
+
__exportStar(require("./backup-code.entity"), exports);
|
|
42
|
+
__exportStar(require("./link-token.entity"), exports);
|
|
43
|
+
__exportStar(require("./one-time-code.entity"), exports);
|
|
44
|
+
__exportStar(require("./organization-invitation.entity"), exports);
|
|
45
|
+
__exportStar(require("./organization-member.entity"), exports);
|
|
46
|
+
__exportStar(require("./organization.entity"), exports);
|
|
47
|
+
__exportStar(require("./passkey.entity"), exports);
|
|
48
|
+
__exportStar(require("./password.entity"), exports);
|
|
49
|
+
__exportStar(require("./refresh-token.entity"), exports);
|
|
50
|
+
__exportStar(require("./session.entity"), exports);
|
|
51
|
+
__exportStar(require("./settings.entity"), exports);
|
|
52
|
+
__exportStar(require("./sign-in-challenge.entity"), exports);
|
|
53
|
+
__exportStar(require("./signing-key.entity"), exports);
|
|
54
|
+
__exportStar(require("./social-account.entity"), exports);
|
|
55
|
+
__exportStar(require("./two-factor-secret.entity"), exports);
|
|
56
|
+
__exportStar(require("./user.entity"), exports);
|
|
57
|
+
__exportStar(require("./webhook-delivery.entity"), exports);
|
|
58
|
+
__exportStar(require("./webhook.entity"), exports);
|
|
59
|
+
/** Add these to your TypeORM DataSource `entities` list. */
|
|
60
|
+
exports.AUTH_ENTITIES = [
|
|
61
|
+
user_entity_1.UserEntity,
|
|
62
|
+
password_entity_1.PasswordEntity,
|
|
63
|
+
social_account_entity_1.SocialAccountEntity,
|
|
64
|
+
passkey_entity_1.PasskeyEntity,
|
|
65
|
+
two_factor_secret_entity_1.TwoFactorSecretEntity,
|
|
66
|
+
backup_code_entity_1.BackupCodeEntity,
|
|
67
|
+
session_entity_1.SessionEntity,
|
|
68
|
+
refresh_token_entity_1.RefreshTokenEntity,
|
|
69
|
+
link_token_entity_1.LinkTokenEntity,
|
|
70
|
+
one_time_code_entity_1.OneTimeCodeEntity,
|
|
71
|
+
sign_in_challenge_entity_1.SignInChallengeEntity,
|
|
72
|
+
signing_key_entity_1.SigningKeyEntity,
|
|
73
|
+
settings_entity_1.SettingsEntity,
|
|
74
|
+
audit_log_entity_1.AuditLogEntity,
|
|
75
|
+
organization_entity_1.OrganizationEntity,
|
|
76
|
+
organization_member_entity_1.OrganizationMemberEntity,
|
|
77
|
+
organization_invitation_entity_1.OrganizationInvitationEntity,
|
|
78
|
+
api_key_entity_1.ApiKeyEntity,
|
|
79
|
+
webhook_entity_1.WebhookEntity,
|
|
80
|
+
webhook_delivery_entity_1.WebhookDeliveryEntity,
|
|
81
|
+
];
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAgD;AAChD,yDAAoD;AACpD,6DAAwD;AACxD,2DAAsD;AACtD,iEAA2D;AAC3D,qFAAgF;AAChF,6EAAwE;AACxE,+DAA2D;AAC3D,qDAAiD;AACjD,uDAAmD;AACnD,iEAA4D;AAC5D,qDAAiD;AACjD,uDAAmD;AACnD,yEAAmE;AACnE,6DAAwD;AACxD,mEAA8D;AAC9D,yEAAmE;AACnE,+CAA2C;AAC3C,uEAAkE;AAClE,qDAAiD;AAEjD,mDAAiC;AACjC,gDAA8B;AAC9B,qDAAmC;AACnC,uDAAqC;AACrC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,+DAA6C;AAC7C,wDAAsC;AACtC,mDAAiC;AACjC,oDAAkC;AAClC,yDAAuC;AACvC,mDAAiC;AACjC,oDAAkC;AAClC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AACxC,6DAA2C;AAC3C,gDAA8B;AAC9B,4DAA0C;AAC1C,mDAAiC;AAEjC,4DAA4D;AAC/C,QAAA,aAAa,GAAG;IAC3B,wBAAU;IACV,gCAAc;IACd,2CAAmB;IACnB,8BAAa;IACb,gDAAqB;IACrB,qCAAgB;IAChB,8BAAa;IACb,yCAAkB;IAClB,mCAAe;IACf,wCAAiB;IACjB,gDAAqB;IACrB,qCAAgB;IAChB,gCAAc;IACd,iCAAc;IACd,wCAAkB;IAClB,qDAAwB;IACxB,6DAA4B;IAC5B,6BAAY;IACZ,8BAAa;IACb,+CAAqB;CACtB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of a value stored in a jsonb column.
|
|
3
|
+
*
|
|
4
|
+
* Spelled out precisely (instead of Record<string, unknown>) for two reasons:
|
|
5
|
+
* - only JSON can be stored, so the compiler should reject Dates, functions or `undefined`;
|
|
6
|
+
* - TypeORM's insert()/update() typing (QueryDeepPartialEntity) accepts exactly these types,
|
|
7
|
+
* but rejects `unknown` and `any` values.
|
|
8
|
+
*/
|
|
9
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
|
|
10
|
+
export interface JsonObject {
|
|
11
|
+
[key: string]: JsonValue;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-object.js","sourceRoot":"","sources":["../../../src/database/entities/json-object.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LinkTokenPurpose } from '../../constants.js';
|
|
2
|
+
export type { LinkTokenPurpose };
|
|
3
|
+
/** Tokens inside emailed links (verify email, reset password, magic sign-in). Single use. */
|
|
4
|
+
export declare class LinkTokenEntity {
|
|
5
|
+
id: string;
|
|
6
|
+
purpose: LinkTokenPurpose;
|
|
7
|
+
/** Set when the link is for an existing user. */
|
|
8
|
+
userId: string | null;
|
|
9
|
+
/** The email the link was sent to (a magic link can create a new account for it). */
|
|
10
|
+
email: string;
|
|
11
|
+
tokenHash: string;
|
|
12
|
+
expiresAt: Date;
|
|
13
|
+
usedAt: Date | null;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LinkTokenEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
/** Tokens inside emailed links (verify email, reset password, magic sign-in). Single use. */
|
|
15
|
+
let LinkTokenEntity = class LinkTokenEntity {
|
|
16
|
+
id;
|
|
17
|
+
purpose;
|
|
18
|
+
/** Set when the link is for an existing user. */
|
|
19
|
+
userId;
|
|
20
|
+
/** The email the link was sent to (a magic link can create a new account for it). */
|
|
21
|
+
email;
|
|
22
|
+
tokenHash;
|
|
23
|
+
expiresAt;
|
|
24
|
+
usedAt;
|
|
25
|
+
createdAt;
|
|
26
|
+
};
|
|
27
|
+
exports.LinkTokenEntity = LinkTokenEntity;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], LinkTokenEntity.prototype, "id", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], LinkTokenEntity.prototype, "purpose", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'uuid', nullable: true }),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], LinkTokenEntity.prototype, "userId", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], LinkTokenEntity.prototype, "email", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Index)({ unique: true }),
|
|
46
|
+
(0, typeorm_1.Column)({ name: 'token_hash', type: 'text' }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], LinkTokenEntity.prototype, "tokenHash", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ name: 'expires_at', type: 'timestamptz' }),
|
|
51
|
+
__metadata("design:type", Date)
|
|
52
|
+
], LinkTokenEntity.prototype, "expiresAt", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ name: 'used_at', type: 'timestamptz', nullable: true }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], LinkTokenEntity.prototype, "usedAt", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
59
|
+
__metadata("design:type", Date)
|
|
60
|
+
], LinkTokenEntity.prototype, "createdAt", void 0);
|
|
61
|
+
exports.LinkTokenEntity = LinkTokenEntity = __decorate([
|
|
62
|
+
(0, typeorm_1.Entity)('auth_link_tokens')
|
|
63
|
+
], LinkTokenEntity);
|
|
64
|
+
//# sourceMappingURL=link-token.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-token.entity.js","sourceRoot":"","sources":["../../../src/database/entities/link-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAK1F,6FAA6F;AAEtF,IAAM,eAAe,GAArB,MAAM,eAAe;IAE1B,EAAE,CAAS;IAGX,OAAO,CAAmB;IAE1B,iDAAiD;IAEjD,MAAM,CAAgB;IAEtB,qFAAqF;IAErF,KAAK,CAAS;IAId,SAAS,CAAS;IAGlB,SAAS,CAAO;IAGhB,MAAM,CAAc;IAGpB,SAAS,CAAO;CACjB,CAAA;AA3BY,0CAAe;AAE1B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;2CACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDACC;AAI1B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACpC;AAItB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACX;AAId;IAFC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAC3B;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACzC,IAAI;kDAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC7C;AAGpB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACnD,IAAI;kDAAC;0BA1BL,eAAe;IAD3B,IAAA,gBAAM,EAAC,kBAAkB,CAAC;GACd,eAAe,CA2B3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CodeChannel } from '../../constants.js';
|
|
2
|
+
export type { CodeChannel };
|
|
3
|
+
/** Short numeric codes sent by email or SMS for passwordless sign-in. */
|
|
4
|
+
export declare class OneTimeCodeEntity {
|
|
5
|
+
id: string;
|
|
6
|
+
channel: CodeChannel;
|
|
7
|
+
/** Email address or E.164 phone number the code was sent to. */
|
|
8
|
+
destination: string;
|
|
9
|
+
codeHash: string;
|
|
10
|
+
salt: string;
|
|
11
|
+
/** Wrong guesses so far; the code stops working after the maximum. */
|
|
12
|
+
failedAttempts: number;
|
|
13
|
+
expiresAt: Date;
|
|
14
|
+
usedAt: Date | null;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OneTimeCodeEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
/** Short numeric codes sent by email or SMS for passwordless sign-in. */
|
|
15
|
+
let OneTimeCodeEntity = class OneTimeCodeEntity {
|
|
16
|
+
id;
|
|
17
|
+
channel;
|
|
18
|
+
/** Email address or E.164 phone number the code was sent to. */
|
|
19
|
+
destination;
|
|
20
|
+
codeHash;
|
|
21
|
+
salt;
|
|
22
|
+
/** Wrong guesses so far; the code stops working after the maximum. */
|
|
23
|
+
failedAttempts;
|
|
24
|
+
expiresAt;
|
|
25
|
+
usedAt;
|
|
26
|
+
createdAt;
|
|
27
|
+
};
|
|
28
|
+
exports.OneTimeCodeEntity = OneTimeCodeEntity;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], OneTimeCodeEntity.prototype, "id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], OneTimeCodeEntity.prototype, "channel", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], OneTimeCodeEntity.prototype, "destination", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ name: 'code_hash', type: 'text' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], OneTimeCodeEntity.prototype, "codeHash", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], OneTimeCodeEntity.prototype, "salt", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ name: 'failed_attempts', type: 'int', default: 0 }),
|
|
51
|
+
__metadata("design:type", Number)
|
|
52
|
+
], OneTimeCodeEntity.prototype, "failedAttempts", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ name: 'expires_at', type: 'timestamptz' }),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], OneTimeCodeEntity.prototype, "expiresAt", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ name: 'used_at', type: 'timestamptz', nullable: true }),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], OneTimeCodeEntity.prototype, "usedAt", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
63
|
+
__metadata("design:type", Date)
|
|
64
|
+
], OneTimeCodeEntity.prototype, "createdAt", void 0);
|
|
65
|
+
exports.OneTimeCodeEntity = OneTimeCodeEntity = __decorate([
|
|
66
|
+
(0, typeorm_1.Entity)('auth_one_time_codes'),
|
|
67
|
+
(0, typeorm_1.Index)(['channel', 'destination'])
|
|
68
|
+
], OneTimeCodeEntity);
|
|
69
|
+
//# sourceMappingURL=one-time-code.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-time-code.entity.js","sourceRoot":"","sources":["../../../src/database/entities/one-time-code.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAK1F,yEAAyE;AAGlE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE5B,EAAE,CAAS;IAGX,OAAO,CAAc;IAErB,gEAAgE;IAEhE,WAAW,CAAS;IAGpB,QAAQ,CAAS;IAGjB,IAAI,CAAS;IAEb,sEAAsE;IAEtE,cAAc,CAAS;IAGvB,SAAS,CAAO;IAGhB,MAAM,CAAc;IAGpB,SAAS,CAAO;CACjB,CAAA;AA7BY,8CAAiB;AAE5B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;6CACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACJ;AAIrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACL;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAC3B;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACZ;AAIb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACtC;AAGvB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACzC,IAAI;oDAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC7C;AAGpB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACnD,IAAI;oDAAC;4BA5BL,iBAAiB;IAF7B,IAAA,gBAAM,EAAC,qBAAqB,CAAC;IAC7B,IAAA,eAAK,EAAC,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;GACrB,iBAAiB,CA6B7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OrganizationRole } from '../../constants.js';
|
|
2
|
+
/** An emailed invitation to join an organization. Single use. */
|
|
3
|
+
export declare class OrganizationInvitationEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
organizationId: string;
|
|
6
|
+
email: string;
|
|
7
|
+
role: OrganizationRole;
|
|
8
|
+
tokenHash: string;
|
|
9
|
+
invitedByUserId: string;
|
|
10
|
+
expiresAt: Date;
|
|
11
|
+
acceptedAt: Date | null;
|
|
12
|
+
revokedAt: Date | null;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OrganizationInvitationEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
/** An emailed invitation to join an organization. Single use. */
|
|
15
|
+
let OrganizationInvitationEntity = class OrganizationInvitationEntity {
|
|
16
|
+
id;
|
|
17
|
+
organizationId;
|
|
18
|
+
email;
|
|
19
|
+
role;
|
|
20
|
+
tokenHash;
|
|
21
|
+
invitedByUserId;
|
|
22
|
+
expiresAt;
|
|
23
|
+
acceptedAt;
|
|
24
|
+
revokedAt;
|
|
25
|
+
createdAt;
|
|
26
|
+
};
|
|
27
|
+
exports.OrganizationInvitationEntity = OrganizationInvitationEntity;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], OrganizationInvitationEntity.prototype, "id", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Index)(),
|
|
34
|
+
(0, typeorm_1.Column)({ name: 'organization_id', type: 'uuid' }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], OrganizationInvitationEntity.prototype, "organizationId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], OrganizationInvitationEntity.prototype, "email", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], OrganizationInvitationEntity.prototype, "role", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Index)({ unique: true }),
|
|
47
|
+
(0, typeorm_1.Column)({ name: 'token_hash', type: 'text' }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], OrganizationInvitationEntity.prototype, "tokenHash", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ name: 'invited_by_user_id', type: 'uuid' }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], OrganizationInvitationEntity.prototype, "invitedByUserId", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({ name: 'expires_at', type: 'timestamptz' }),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], OrganizationInvitationEntity.prototype, "expiresAt", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)({ name: 'accepted_at', type: 'timestamptz', nullable: true }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], OrganizationInvitationEntity.prototype, "acceptedAt", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ name: 'revoked_at', type: 'timestamptz', nullable: true }),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], OrganizationInvitationEntity.prototype, "revokedAt", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
68
|
+
__metadata("design:type", Date)
|
|
69
|
+
], OrganizationInvitationEntity.prototype, "createdAt", void 0);
|
|
70
|
+
exports.OrganizationInvitationEntity = OrganizationInvitationEntity = __decorate([
|
|
71
|
+
(0, typeorm_1.Entity)('auth_organization_invitations')
|
|
72
|
+
], OrganizationInvitationEntity);
|
|
73
|
+
//# sourceMappingURL=organization-invitation.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-invitation.entity.js","sourceRoot":"","sources":["../../../src/database/entities/organization-invitation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAI1F,iEAAiE;AAE1D,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAEvC,EAAE,CAAS;IAIX,cAAc,CAAS;IAGvB,KAAK,CAAS;IAGd,IAAI,CAAmB;IAIvB,SAAS,CAAS;IAGlB,eAAe,CAAS;IAGxB,SAAS,CAAO;IAGhB,UAAU,CAAc;IAGxB,SAAS,CAAc;IAGvB,SAAS,CAAO;CACjB,CAAA;AAhCY,oEAA4B;AAEvC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;wDACpB;AAIX;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oEAC3B;AAGvB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2DACX;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DACF;AAIvB;IAFC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+DAC3B;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qEAC7B;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACzC,IAAI;+DAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gEAC7C;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+DAC7C;AAGvB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACnD,IAAI;+DAAC;uCA/BL,4BAA4B;IADxC,IAAA,gBAAM,EAAC,+BAA+B,CAAC;GAC3B,4BAA4B,CAgCxC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OrganizationRole } from '../../constants.js';
|
|
2
|
+
/** A user's membership in an organization. */
|
|
3
|
+
export declare class OrganizationMemberEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
organizationId: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
role: OrganizationRole;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OrganizationMemberEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
/** A user's membership in an organization. */
|
|
15
|
+
let OrganizationMemberEntity = class OrganizationMemberEntity {
|
|
16
|
+
id;
|
|
17
|
+
organizationId;
|
|
18
|
+
userId;
|
|
19
|
+
role;
|
|
20
|
+
createdAt;
|
|
21
|
+
};
|
|
22
|
+
exports.OrganizationMemberEntity = OrganizationMemberEntity;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], OrganizationMemberEntity.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)({ name: 'organization_id', type: 'uuid' }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], OrganizationMemberEntity.prototype, "organizationId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Index)(),
|
|
33
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'uuid' }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], OrganizationMemberEntity.prototype, "userId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], OrganizationMemberEntity.prototype, "role", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
42
|
+
__metadata("design:type", Date)
|
|
43
|
+
], OrganizationMemberEntity.prototype, "createdAt", void 0);
|
|
44
|
+
exports.OrganizationMemberEntity = OrganizationMemberEntity = __decorate([
|
|
45
|
+
(0, typeorm_1.Entity)('auth_organization_members'),
|
|
46
|
+
(0, typeorm_1.Index)(['organizationId', 'userId'], { unique: true })
|
|
47
|
+
], OrganizationMemberEntity);
|
|
48
|
+
//# sourceMappingURL=organization-member.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-member.entity.js","sourceRoot":"","sources":["../../../src/database/entities/organization-member.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAI1F,8CAA8C;AAGvC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,EAAE,CAAS;IAGX,cAAc,CAAS;IAIvB,MAAM,CAAS;IAGf,IAAI,CAAmB;IAGvB,SAAS,CAAO;CACjB,CAAA;AAhBY,4DAAwB;AAEnC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;oDACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gEAC3B;AAIvB;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAC3B;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACF;AAGvB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACnD,IAAI;2DAAC;mCAfL,wBAAwB;IAFpC,IAAA,gBAAM,EAAC,2BAA2B,CAAC;IACnC,IAAA,eAAK,EAAC,CAAC,gBAAgB,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACzC,wBAAwB,CAgBpC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonObject } from './json-object';
|
|
2
|
+
/** A company or team. Users join organizations with a role (owner, admin, member). */
|
|
3
|
+
export declare class OrganizationEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Unique handle, e.g. "acme-india". */
|
|
7
|
+
slug: string;
|
|
8
|
+
metadata: JsonObject;
|
|
9
|
+
createdByUserId: string | null;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|