@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 @@
|
|
|
1
|
+
{"version":3,"file":"one-time-codes.service.js","sourceRoot":"","sources":["../../../src/features/one-time-codes/one-time-codes.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,qCAAuD;AAEvD,oDAAgD;AAChD,mEAAkH;AAClH,2CAOqB;AACrB,kDAAqE;AAQrE;;;;;;;GAOG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACb,QAAQ,CAAa;IAEtC,YAAwC,OAAoB;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,UAAU,CAAC,OAAoB,EAAE,WAAmB,EAAE,KAAgB;QAC1E,MAAM,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AAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,gBAAM,GAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;QACnG,IAAI,CAAC,MAAM,CAAC,QAAQ;YAAE,MAAM,IAAI,sBAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AAtEY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;;GAH5B,mBAAmB,CAsE/B"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { RequestContext } from '../../common/request-context.js';
|
|
2
|
+
import { AccessTokenClaims } from '../sessions/session.types.js';
|
|
3
|
+
import { SettingsService } from '../settings/settings.service.js';
|
|
4
|
+
import { AcceptInvitationInput, ChangeMemberRoleInput, CreateOrganizationInput, InviteMemberInput, SwitchOrganizationInput, UpdateOrganizationInput } from './organizations.dto';
|
|
5
|
+
import { OrganizationsService } from './organizations.service';
|
|
6
|
+
/**
|
|
7
|
+
* Organizations / teams. Every route needs a signed-in user; roles are checked per organization.
|
|
8
|
+
*
|
|
9
|
+
* GET /auth/organizations mine, with my role
|
|
10
|
+
* POST /auth/organizations create (I become owner)
|
|
11
|
+
* POST /auth/organizations/switch work in an organization -> new access token
|
|
12
|
+
* POST /auth/organizations/invitations/accept accept an emailed invitation
|
|
13
|
+
* GET /auth/organizations/:id details
|
|
14
|
+
* PATCH /auth/organizations/:id rename etc. (admin+)
|
|
15
|
+
* DELETE /auth/organizations/:id delete (owner)
|
|
16
|
+
* GET /auth/organizations/:id/members members
|
|
17
|
+
* PATCH /auth/organizations/:id/members/:userId change role (admin+)
|
|
18
|
+
* DELETE /auth/organizations/:id/members/:userId remove member, or leave (own id)
|
|
19
|
+
* GET /auth/organizations/:id/invitations open invitations (admin+)
|
|
20
|
+
* POST /auth/organizations/:id/invitations invite by email (admin+)
|
|
21
|
+
* DELETE /auth/organizations/:id/invitations/:invitationId cancel invitation (admin+)
|
|
22
|
+
*/
|
|
23
|
+
export declare class OrganizationsController {
|
|
24
|
+
private readonly organizations;
|
|
25
|
+
private readonly settingsService;
|
|
26
|
+
constructor(organizations: OrganizationsService, settingsService: SettingsService);
|
|
27
|
+
/**
|
|
28
|
+
* GET /auth/organizations — The organizations the signed-in user belongs to, with their role.
|
|
29
|
+
*
|
|
30
|
+
* @param userId - From the access token.
|
|
31
|
+
* @returns The organizations.
|
|
32
|
+
*/
|
|
33
|
+
listMine(userId: string): Promise<{
|
|
34
|
+
success: boolean;
|
|
35
|
+
organizations: {
|
|
36
|
+
id: any;
|
|
37
|
+
name: any;
|
|
38
|
+
slug: any;
|
|
39
|
+
metadata: any;
|
|
40
|
+
role: import("../../constants.js").OrganizationRole;
|
|
41
|
+
joinedAt: string;
|
|
42
|
+
}[];
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* POST /auth/organizations — Creates an organization; the user becomes its owner.
|
|
46
|
+
* App admins may create one even when `allowUsersToCreate` is off.
|
|
47
|
+
*
|
|
48
|
+
* @param user - The access token's claims (user id and roles).
|
|
49
|
+
* @param body - `{ name, slug }`.
|
|
50
|
+
* @param request - Who is asking.
|
|
51
|
+
* @returns The new organization.
|
|
52
|
+
*/
|
|
53
|
+
create(user: AccessTokenClaims, body: CreateOrganizationInput, request: RequestContext): Promise<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
organization: {
|
|
56
|
+
name: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
metadata: {};
|
|
59
|
+
createdByUserId: string;
|
|
60
|
+
} & import("../..").OrganizationEntity;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* POST /auth/organizations/switch — Works in an organization from now on (or none).
|
|
64
|
+
*
|
|
65
|
+
* @param user - The access token's claims (user id and session id).
|
|
66
|
+
* @param body - `{ organizationId }`, or null for none.
|
|
67
|
+
* @returns A new access token carrying "org_id" and "org_role".
|
|
68
|
+
*/
|
|
69
|
+
switch(user: AccessTokenClaims, body: SwitchOrganizationInput): Promise<{
|
|
70
|
+
success: true;
|
|
71
|
+
accessToken: string;
|
|
72
|
+
expiresIn: number;
|
|
73
|
+
organizationId: string | null;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* POST /auth/organizations/invitations/accept — Accepts an emailed invitation.
|
|
77
|
+
*
|
|
78
|
+
* @param userId - From the access token.
|
|
79
|
+
* @param body - `{ token }` from the invitation link.
|
|
80
|
+
* @param request - Who is asking.
|
|
81
|
+
* @returns The organization joined and the role given.
|
|
82
|
+
*/
|
|
83
|
+
acceptInvitation(userId: string, body: AcceptInvitationInput, request: RequestContext): Promise<{
|
|
84
|
+
success: true;
|
|
85
|
+
organizationId: string;
|
|
86
|
+
role: import("../../constants.js").OrganizationRole;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* GET /auth/organizations/:organizationId — Details of one organization. Members only.
|
|
90
|
+
*
|
|
91
|
+
* @param userId - From the access token.
|
|
92
|
+
* @param organizationId - From the URL.
|
|
93
|
+
* @returns The organization plus `myRole`.
|
|
94
|
+
*/
|
|
95
|
+
get(userId: string, organizationId: string): Promise<{
|
|
96
|
+
success: boolean;
|
|
97
|
+
organization: {
|
|
98
|
+
myRole: import("../../constants.js").OrganizationRole;
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
slug: string;
|
|
102
|
+
metadata: import("../..").JsonObject;
|
|
103
|
+
createdByUserId: string | null;
|
|
104
|
+
createdAt: Date;
|
|
105
|
+
updatedAt: Date;
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* PATCH /auth/organizations/:organizationId — Renames it, changes its slug or metadata. Admins and owners.
|
|
110
|
+
*
|
|
111
|
+
* @param userId - From the access token.
|
|
112
|
+
* @param organizationId - From the URL.
|
|
113
|
+
* @param body - The fields to change.
|
|
114
|
+
* @param request - Who is asking.
|
|
115
|
+
* @returns The updated organization.
|
|
116
|
+
*/
|
|
117
|
+
update(userId: string, organizationId: string, body: UpdateOrganizationInput, request: RequestContext): Promise<{
|
|
118
|
+
success: boolean;
|
|
119
|
+
organization: import("../..").OrganizationEntity;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* DELETE /auth/organizations/:organizationId — Deletes the organization. Owners only.
|
|
123
|
+
*
|
|
124
|
+
* @param userId - From the access token.
|
|
125
|
+
* @param organizationId - From the URL.
|
|
126
|
+
* @param request - Who is asking.
|
|
127
|
+
* @returns `{ success: true }`.
|
|
128
|
+
*/
|
|
129
|
+
delete(userId: string, organizationId: string, request: RequestContext): Promise<{
|
|
130
|
+
success: true;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* GET /auth/organizations/:organizationId/members — Lists members. Members only.
|
|
134
|
+
*
|
|
135
|
+
* @param userId - From the access token.
|
|
136
|
+
* @param organizationId - From the URL.
|
|
137
|
+
* @returns The members.
|
|
138
|
+
*/
|
|
139
|
+
listMembers(userId: string, organizationId: string): Promise<{
|
|
140
|
+
success: boolean;
|
|
141
|
+
members: {
|
|
142
|
+
userId: any;
|
|
143
|
+
email: any;
|
|
144
|
+
firstName: any;
|
|
145
|
+
lastName: any;
|
|
146
|
+
role: import("../../constants.js").OrganizationRole;
|
|
147
|
+
joinedAt: string;
|
|
148
|
+
}[];
|
|
149
|
+
}>;
|
|
150
|
+
/**
|
|
151
|
+
* PATCH /auth/organizations/:organizationId/members/:memberUserId — Changes a member's role.
|
|
152
|
+
*
|
|
153
|
+
* @param userId - From the access token.
|
|
154
|
+
* @param organizationId - From the URL.
|
|
155
|
+
* @param memberUserId - The member whose role changes (from the URL).
|
|
156
|
+
* @param body - `{ role }`.
|
|
157
|
+
* @param request - Who is asking.
|
|
158
|
+
* @returns `{ success: true }`.
|
|
159
|
+
*/
|
|
160
|
+
changeRole(userId: string, organizationId: string, memberUserId: string, body: ChangeMemberRoleInput, request: RequestContext): Promise<{
|
|
161
|
+
success: true;
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* DELETE /auth/organizations/:organizationId/members/:memberUserId — Removes a member,
|
|
165
|
+
* or leaves when `memberUserId` is the signed-in user.
|
|
166
|
+
*
|
|
167
|
+
* @param userId - From the access token.
|
|
168
|
+
* @param organizationId - From the URL.
|
|
169
|
+
* @param memberUserId - The member to remove (from the URL).
|
|
170
|
+
* @param request - Who is asking.
|
|
171
|
+
* @returns `{ success: true }`.
|
|
172
|
+
*/
|
|
173
|
+
removeMember(userId: string, organizationId: string, memberUserId: string, request: RequestContext): Promise<{
|
|
174
|
+
success: true;
|
|
175
|
+
}>;
|
|
176
|
+
/**
|
|
177
|
+
* GET /auth/organizations/:organizationId/invitations — Open invitations. Admins and owners.
|
|
178
|
+
*
|
|
179
|
+
* @param userId - From the access token.
|
|
180
|
+
* @param organizationId - From the URL.
|
|
181
|
+
* @returns The invitations.
|
|
182
|
+
*/
|
|
183
|
+
listInvitations(userId: string, organizationId: string): Promise<{
|
|
184
|
+
success: boolean;
|
|
185
|
+
invitations: {
|
|
186
|
+
id: string;
|
|
187
|
+
organizationId: string;
|
|
188
|
+
email: string;
|
|
189
|
+
role: import("../../constants.js").OrganizationRole;
|
|
190
|
+
invitedByUserId: string;
|
|
191
|
+
expiresAt: Date;
|
|
192
|
+
acceptedAt: Date | null;
|
|
193
|
+
revokedAt: Date | null;
|
|
194
|
+
createdAt: Date;
|
|
195
|
+
}[];
|
|
196
|
+
}>;
|
|
197
|
+
/**
|
|
198
|
+
* POST /auth/organizations/:organizationId/invitations — Emails an invitation. Admins and owners.
|
|
199
|
+
*
|
|
200
|
+
* @param userId - From the access token.
|
|
201
|
+
* @param organizationId - From the URL.
|
|
202
|
+
* @param body - `{ email, role }`.
|
|
203
|
+
* @param request - Who is asking.
|
|
204
|
+
* @returns `{ success: true }`.
|
|
205
|
+
*/
|
|
206
|
+
invite(userId: string, organizationId: string, body: InviteMemberInput, request: RequestContext): Promise<{
|
|
207
|
+
success: true;
|
|
208
|
+
}>;
|
|
209
|
+
/**
|
|
210
|
+
* DELETE /auth/organizations/:organizationId/invitations/:invitationId — Cancels an invitation.
|
|
211
|
+
*
|
|
212
|
+
* @param userId - From the access token.
|
|
213
|
+
* @param organizationId - From the URL.
|
|
214
|
+
* @param invitationId - From the URL.
|
|
215
|
+
* @returns `{ success: true }`.
|
|
216
|
+
*/
|
|
217
|
+
revokeInvitation(userId: string, organizationId: string, invitationId: string): Promise<{
|
|
218
|
+
success: true;
|
|
219
|
+
}>;
|
|
220
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.OrganizationsController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const strict_validation_pipe_1 = require("../../common/strict-validation.pipe.js");
|
|
18
|
+
const request_context_1 = require("../../common/request-context.js");
|
|
19
|
+
const auth_decorators_1 = require("../../guards/auth.decorators.js");
|
|
20
|
+
const settings_service_1 = require("../settings/settings.service.js");
|
|
21
|
+
const organizations_dto_1 = require("./organizations.dto");
|
|
22
|
+
const organizations_service_1 = require("./organizations.service");
|
|
23
|
+
const constants_1 = require("../../constants.js");
|
|
24
|
+
const refresh_token_cookie_1 = require("../../common/refresh-token-cookie.js");
|
|
25
|
+
/**
|
|
26
|
+
* Shorthand for the pipe that rejects route ids that aren't UUIDs (with a 400, before any query runs).
|
|
27
|
+
*
|
|
28
|
+
* @returns A new ParseUUIDPipe.
|
|
29
|
+
*/
|
|
30
|
+
const uuid = () => new common_1.ParseUUIDPipe();
|
|
31
|
+
/**
|
|
32
|
+
* Organizations / teams. Every route needs a signed-in user; roles are checked per organization.
|
|
33
|
+
*
|
|
34
|
+
* GET /auth/organizations mine, with my role
|
|
35
|
+
* POST /auth/organizations create (I become owner)
|
|
36
|
+
* POST /auth/organizations/switch work in an organization -> new access token
|
|
37
|
+
* POST /auth/organizations/invitations/accept accept an emailed invitation
|
|
38
|
+
* GET /auth/organizations/:id details
|
|
39
|
+
* PATCH /auth/organizations/:id rename etc. (admin+)
|
|
40
|
+
* DELETE /auth/organizations/:id delete (owner)
|
|
41
|
+
* GET /auth/organizations/:id/members members
|
|
42
|
+
* PATCH /auth/organizations/:id/members/:userId change role (admin+)
|
|
43
|
+
* DELETE /auth/organizations/:id/members/:userId remove member, or leave (own id)
|
|
44
|
+
* GET /auth/organizations/:id/invitations open invitations (admin+)
|
|
45
|
+
* POST /auth/organizations/:id/invitations invite by email (admin+)
|
|
46
|
+
* DELETE /auth/organizations/:id/invitations/:invitationId cancel invitation (admin+)
|
|
47
|
+
*/
|
|
48
|
+
let OrganizationsController = class OrganizationsController {
|
|
49
|
+
organizations;
|
|
50
|
+
settingsService;
|
|
51
|
+
constructor(organizations, settingsService) {
|
|
52
|
+
this.organizations = organizations;
|
|
53
|
+
this.settingsService = settingsService;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* GET /auth/organizations — The organizations the signed-in user belongs to, with their role.
|
|
57
|
+
*
|
|
58
|
+
* @param userId - From the access token.
|
|
59
|
+
* @returns The organizations.
|
|
60
|
+
*/
|
|
61
|
+
async listMine(userId) {
|
|
62
|
+
return { success: true, organizations: await this.organizations.listMyOrganizations(userId) };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* POST /auth/organizations — Creates an organization; the user becomes its owner.
|
|
66
|
+
* App admins may create one even when `allowUsersToCreate` is off.
|
|
67
|
+
*
|
|
68
|
+
* @param user - The access token's claims (user id and roles).
|
|
69
|
+
* @param body - `{ name, slug }`.
|
|
70
|
+
* @param request - Who is asking.
|
|
71
|
+
* @returns The new organization.
|
|
72
|
+
*/
|
|
73
|
+
async create(user, body, request) {
|
|
74
|
+
const { adminRoles } = (await this.settingsService.getSettings()).admin;
|
|
75
|
+
const isAppAdmin = adminRoles.some((role) => user.roles.includes(role));
|
|
76
|
+
return { success: true, organization: await this.organizations.createOrganization(user.sub, body, isAppAdmin, request) };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* POST /auth/organizations/switch — Works in an organization from now on (or none).
|
|
80
|
+
*
|
|
81
|
+
* @param user - The access token's claims (user id and session id).
|
|
82
|
+
* @param body - `{ organizationId }`, or null for none.
|
|
83
|
+
* @returns A new access token carrying "org_id" and "org_role".
|
|
84
|
+
*/
|
|
85
|
+
switch(user, body) {
|
|
86
|
+
return this.organizations.switchActiveOrganization(user.sub, user.sid, body.organizationId);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* POST /auth/organizations/invitations/accept — Accepts an emailed invitation.
|
|
90
|
+
*
|
|
91
|
+
* @param userId - From the access token.
|
|
92
|
+
* @param body - `{ token }` from the invitation link.
|
|
93
|
+
* @param request - Who is asking.
|
|
94
|
+
* @returns The organization joined and the role given.
|
|
95
|
+
*/
|
|
96
|
+
acceptInvitation(userId, body, request) {
|
|
97
|
+
return this.organizations.acceptInvitation(userId, body.token, request);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* GET /auth/organizations/:organizationId — Details of one organization. Members only.
|
|
101
|
+
*
|
|
102
|
+
* @param userId - From the access token.
|
|
103
|
+
* @param organizationId - From the URL.
|
|
104
|
+
* @returns The organization plus `myRole`.
|
|
105
|
+
*/
|
|
106
|
+
async get(userId, organizationId) {
|
|
107
|
+
return { success: true, organization: await this.organizations.getOrganization(organizationId, userId) };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* PATCH /auth/organizations/:organizationId — Renames it, changes its slug or metadata. Admins and owners.
|
|
111
|
+
*
|
|
112
|
+
* @param userId - From the access token.
|
|
113
|
+
* @param organizationId - From the URL.
|
|
114
|
+
* @param body - The fields to change.
|
|
115
|
+
* @param request - Who is asking.
|
|
116
|
+
* @returns The updated organization.
|
|
117
|
+
*/
|
|
118
|
+
async update(userId, organizationId, body, request) {
|
|
119
|
+
return { success: true, organization: await this.organizations.updateOrganization(organizationId, userId, body, request) };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* DELETE /auth/organizations/:organizationId — Deletes the organization. Owners only.
|
|
123
|
+
*
|
|
124
|
+
* @param userId - From the access token.
|
|
125
|
+
* @param organizationId - From the URL.
|
|
126
|
+
* @param request - Who is asking.
|
|
127
|
+
* @returns `{ success: true }`.
|
|
128
|
+
*/
|
|
129
|
+
delete(userId, organizationId, request) {
|
|
130
|
+
return this.organizations.deleteOrganization(organizationId, userId, request);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* GET /auth/organizations/:organizationId/members — Lists members. Members only.
|
|
134
|
+
*
|
|
135
|
+
* @param userId - From the access token.
|
|
136
|
+
* @param organizationId - From the URL.
|
|
137
|
+
* @returns The members.
|
|
138
|
+
*/
|
|
139
|
+
async listMembers(userId, organizationId) {
|
|
140
|
+
return { success: true, members: await this.organizations.listMembers(organizationId, userId) };
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* PATCH /auth/organizations/:organizationId/members/:memberUserId — Changes a member's role.
|
|
144
|
+
*
|
|
145
|
+
* @param userId - From the access token.
|
|
146
|
+
* @param organizationId - From the URL.
|
|
147
|
+
* @param memberUserId - The member whose role changes (from the URL).
|
|
148
|
+
* @param body - `{ role }`.
|
|
149
|
+
* @param request - Who is asking.
|
|
150
|
+
* @returns `{ success: true }`.
|
|
151
|
+
*/
|
|
152
|
+
changeRole(userId, organizationId, memberUserId, body, request) {
|
|
153
|
+
return this.organizations.changeMemberRole(organizationId, userId, memberUserId, body.role, request);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* DELETE /auth/organizations/:organizationId/members/:memberUserId — Removes a member,
|
|
157
|
+
* or leaves when `memberUserId` is the signed-in user.
|
|
158
|
+
*
|
|
159
|
+
* @param userId - From the access token.
|
|
160
|
+
* @param organizationId - From the URL.
|
|
161
|
+
* @param memberUserId - The member to remove (from the URL).
|
|
162
|
+
* @param request - Who is asking.
|
|
163
|
+
* @returns `{ success: true }`.
|
|
164
|
+
*/
|
|
165
|
+
removeMember(userId, organizationId, memberUserId, request) {
|
|
166
|
+
return this.organizations.removeMember(organizationId, userId, memberUserId, request);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* GET /auth/organizations/:organizationId/invitations — Open invitations. Admins and owners.
|
|
170
|
+
*
|
|
171
|
+
* @param userId - From the access token.
|
|
172
|
+
* @param organizationId - From the URL.
|
|
173
|
+
* @returns The invitations.
|
|
174
|
+
*/
|
|
175
|
+
async listInvitations(userId, organizationId) {
|
|
176
|
+
return { success: true, invitations: await this.organizations.listInvitations(organizationId, userId) };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* POST /auth/organizations/:organizationId/invitations — Emails an invitation. Admins and owners.
|
|
180
|
+
*
|
|
181
|
+
* @param userId - From the access token.
|
|
182
|
+
* @param organizationId - From the URL.
|
|
183
|
+
* @param body - `{ email, role }`.
|
|
184
|
+
* @param request - Who is asking.
|
|
185
|
+
* @returns `{ success: true }`.
|
|
186
|
+
*/
|
|
187
|
+
invite(userId, organizationId, body, request) {
|
|
188
|
+
return this.organizations.inviteMember(organizationId, userId, body.email, body.role, request);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* DELETE /auth/organizations/:organizationId/invitations/:invitationId — Cancels an invitation.
|
|
192
|
+
*
|
|
193
|
+
* @param userId - From the access token.
|
|
194
|
+
* @param organizationId - From the URL.
|
|
195
|
+
* @param invitationId - From the URL.
|
|
196
|
+
* @returns `{ success: true }`.
|
|
197
|
+
*/
|
|
198
|
+
revokeInvitation(userId, organizationId, invitationId) {
|
|
199
|
+
return this.organizations.revokeInvitation(organizationId, userId, invitationId);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
exports.OrganizationsController = OrganizationsController;
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, common_1.Get)(),
|
|
205
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
206
|
+
__metadata("design:type", Function),
|
|
207
|
+
__metadata("design:paramtypes", [String]),
|
|
208
|
+
__metadata("design:returntype", Promise)
|
|
209
|
+
], OrganizationsController.prototype, "listMine", null);
|
|
210
|
+
__decorate([
|
|
211
|
+
(0, common_1.Post)(),
|
|
212
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
213
|
+
__param(0, (0, auth_decorators_1.CurrentUser)()),
|
|
214
|
+
__param(1, (0, common_1.Body)()),
|
|
215
|
+
__param(2, (0, request_context_1.CurrentRequest)()),
|
|
216
|
+
__metadata("design:type", Function),
|
|
217
|
+
__metadata("design:paramtypes", [Object, organizations_dto_1.CreateOrganizationInput, Object]),
|
|
218
|
+
__metadata("design:returntype", Promise)
|
|
219
|
+
], OrganizationsController.prototype, "create", null);
|
|
220
|
+
__decorate([
|
|
221
|
+
(0, common_1.Post)(constants_1.ROUTES.organizations.switch),
|
|
222
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
223
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
224
|
+
__param(0, (0, auth_decorators_1.CurrentUser)()),
|
|
225
|
+
__param(1, (0, common_1.Body)()),
|
|
226
|
+
__metadata("design:type", Function),
|
|
227
|
+
__metadata("design:paramtypes", [Object, organizations_dto_1.SwitchOrganizationInput]),
|
|
228
|
+
__metadata("design:returntype", void 0)
|
|
229
|
+
], OrganizationsController.prototype, "switch", null);
|
|
230
|
+
__decorate([
|
|
231
|
+
(0, common_1.Post)(constants_1.ROUTES.organizations.acceptInvitation),
|
|
232
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
233
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
234
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
235
|
+
__param(1, (0, common_1.Body)()),
|
|
236
|
+
__param(2, (0, request_context_1.CurrentRequest)()),
|
|
237
|
+
__metadata("design:type", Function),
|
|
238
|
+
__metadata("design:paramtypes", [String, organizations_dto_1.AcceptInvitationInput, Object]),
|
|
239
|
+
__metadata("design:returntype", void 0)
|
|
240
|
+
], OrganizationsController.prototype, "acceptInvitation", null);
|
|
241
|
+
__decorate([
|
|
242
|
+
(0, common_1.Get)(constants_1.ROUTES.organizations.organization),
|
|
243
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
244
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
245
|
+
__metadata("design:type", Function),
|
|
246
|
+
__metadata("design:paramtypes", [String, String]),
|
|
247
|
+
__metadata("design:returntype", Promise)
|
|
248
|
+
], OrganizationsController.prototype, "get", null);
|
|
249
|
+
__decorate([
|
|
250
|
+
(0, common_1.Patch)(constants_1.ROUTES.organizations.organization),
|
|
251
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
252
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
253
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
254
|
+
__param(2, (0, common_1.Body)()),
|
|
255
|
+
__param(3, (0, request_context_1.CurrentRequest)()),
|
|
256
|
+
__metadata("design:type", Function),
|
|
257
|
+
__metadata("design:paramtypes", [String, String, organizations_dto_1.UpdateOrganizationInput, Object]),
|
|
258
|
+
__metadata("design:returntype", Promise)
|
|
259
|
+
], OrganizationsController.prototype, "update", null);
|
|
260
|
+
__decorate([
|
|
261
|
+
(0, common_1.Delete)(constants_1.ROUTES.organizations.organization),
|
|
262
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
263
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
264
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
265
|
+
__param(2, (0, request_context_1.CurrentRequest)()),
|
|
266
|
+
__metadata("design:type", Function),
|
|
267
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
268
|
+
__metadata("design:returntype", void 0)
|
|
269
|
+
], OrganizationsController.prototype, "delete", null);
|
|
270
|
+
__decorate([
|
|
271
|
+
(0, common_1.Get)(constants_1.ROUTES.organizations.members),
|
|
272
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
273
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
274
|
+
__metadata("design:type", Function),
|
|
275
|
+
__metadata("design:paramtypes", [String, String]),
|
|
276
|
+
__metadata("design:returntype", Promise)
|
|
277
|
+
], OrganizationsController.prototype, "listMembers", null);
|
|
278
|
+
__decorate([
|
|
279
|
+
(0, common_1.Patch)(constants_1.ROUTES.organizations.member),
|
|
280
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
281
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
282
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
283
|
+
__param(2, (0, common_1.Param)(constants_1.ROUTE_PARAM.memberUserId, uuid())),
|
|
284
|
+
__param(3, (0, common_1.Body)()),
|
|
285
|
+
__param(4, (0, request_context_1.CurrentRequest)()),
|
|
286
|
+
__metadata("design:type", Function),
|
|
287
|
+
__metadata("design:paramtypes", [String, String, String, organizations_dto_1.ChangeMemberRoleInput, Object]),
|
|
288
|
+
__metadata("design:returntype", void 0)
|
|
289
|
+
], OrganizationsController.prototype, "changeRole", null);
|
|
290
|
+
__decorate([
|
|
291
|
+
(0, common_1.Delete)(constants_1.ROUTES.organizations.member),
|
|
292
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
293
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
294
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
295
|
+
__param(2, (0, common_1.Param)(constants_1.ROUTE_PARAM.memberUserId, uuid())),
|
|
296
|
+
__param(3, (0, request_context_1.CurrentRequest)()),
|
|
297
|
+
__metadata("design:type", Function),
|
|
298
|
+
__metadata("design:paramtypes", [String, String, String, Object]),
|
|
299
|
+
__metadata("design:returntype", void 0)
|
|
300
|
+
], OrganizationsController.prototype, "removeMember", null);
|
|
301
|
+
__decorate([
|
|
302
|
+
(0, common_1.Get)(constants_1.ROUTES.organizations.invitations),
|
|
303
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
304
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
305
|
+
__metadata("design:type", Function),
|
|
306
|
+
__metadata("design:paramtypes", [String, String]),
|
|
307
|
+
__metadata("design:returntype", Promise)
|
|
308
|
+
], OrganizationsController.prototype, "listInvitations", null);
|
|
309
|
+
__decorate([
|
|
310
|
+
(0, common_1.Post)(constants_1.ROUTES.organizations.invitations),
|
|
311
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
312
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
313
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
314
|
+
__param(2, (0, common_1.Body)()),
|
|
315
|
+
__param(3, (0, request_context_1.CurrentRequest)()),
|
|
316
|
+
__metadata("design:type", Function),
|
|
317
|
+
__metadata("design:paramtypes", [String, String, organizations_dto_1.InviteMemberInput, Object]),
|
|
318
|
+
__metadata("design:returntype", void 0)
|
|
319
|
+
], OrganizationsController.prototype, "invite", null);
|
|
320
|
+
__decorate([
|
|
321
|
+
(0, common_1.Delete)(constants_1.ROUTES.organizations.invitation),
|
|
322
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
323
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
324
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.organizationId, uuid())),
|
|
325
|
+
__param(2, (0, common_1.Param)(constants_1.ROUTE_PARAM.invitationId, uuid())),
|
|
326
|
+
__metadata("design:type", Function),
|
|
327
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
328
|
+
__metadata("design:returntype", void 0)
|
|
329
|
+
], OrganizationsController.prototype, "revokeInvitation", null);
|
|
330
|
+
exports.OrganizationsController = OrganizationsController = __decorate([
|
|
331
|
+
(0, common_1.Controller)(constants_1.ROUTES.organizations.prefix),
|
|
332
|
+
(0, refresh_token_cookie_1.LibraryController)(),
|
|
333
|
+
(0, common_1.UsePipes)(strict_validation_pipe_1.strictValidationPipe),
|
|
334
|
+
__metadata("design:paramtypes", [organizations_service_1.OrganizationsService,
|
|
335
|
+
settings_service_1.SettingsService])
|
|
336
|
+
], OrganizationsController);
|
|
337
|
+
//# sourceMappingURL=organizations.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizations.controller.js","sourceRoot":"","sources":["../../../src/features/organizations/organizations.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAkI;AAClI,4EAAuE;AACvE,8DAA0E;AAC1E,8DAAoF;AAEpF,2EAAuE;AACvE,2DAO6B;AAC7B,mEAA+D;AAC/D,2CAAkD;AAClD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AAA,+BAAa,GAAE,CAAA;IACf,WAAA,IAAA,cAAK,EAAC,uBAAW,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAA;IACzC,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,gCAAc,GAAE,CAAA;;qDADH,qCAAiB;;qDAIhC;AAYD;IAFC,IAAA,eAAM,EAAC,kBAAM,CAAC,aAAa,CAAC,UAAU,CAAC;IACvC,IAAA,8BAAY,GAAE;IAEZ,WAAA,IAAA,+BAAa,GAAE,CAAA;IACf,WAAA,IAAA,cAAK,EAAC,uBAAW,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAA;IACzC,WAAA,IAAA,cAAK,EAAC,uBAAW,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;;;;+DAGzC;kCApNU,uBAAuB;IAHnC,IAAA,mBAAU,EAAC,kBAAM,CAAC,aAAa,CAAC,MAAM,CAAC;IACvC,IAAA,wCAAiB,GAAE;IACnB,IAAA,iBAAQ,EAAC,6CAAoB,CAAC;qCAGK,4CAAoB;QAClB,kCAAe;GAHxC,uBAAuB,CAqNnC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OrganizationRole } from '../../constants.js';
|
|
2
|
+
import type { JsonObject } from '../../database/entities/json-object.js';
|
|
3
|
+
/** POST /auth/organizations */
|
|
4
|
+
export declare class CreateOrganizationInput {
|
|
5
|
+
name: string;
|
|
6
|
+
/** Unique handle: lowercase letters, digits and dashes, e.g. "acme-india". */
|
|
7
|
+
slug: string;
|
|
8
|
+
}
|
|
9
|
+
/** PATCH /auth/organizations/:organizationId */
|
|
10
|
+
export declare class UpdateOrganizationInput {
|
|
11
|
+
name?: string;
|
|
12
|
+
slug?: string;
|
|
13
|
+
metadata?: JsonObject;
|
|
14
|
+
}
|
|
15
|
+
/** POST /auth/organizations/:organizationId/invitations */
|
|
16
|
+
export declare class InviteMemberInput {
|
|
17
|
+
email: string;
|
|
18
|
+
role: OrganizationRole;
|
|
19
|
+
}
|
|
20
|
+
/** PATCH /auth/organizations/:organizationId/members/:userId */
|
|
21
|
+
export declare class ChangeMemberRoleInput {
|
|
22
|
+
role: OrganizationRole;
|
|
23
|
+
}
|
|
24
|
+
/** POST /auth/organizations/invitations/accept */
|
|
25
|
+
export declare class AcceptInvitationInput {
|
|
26
|
+
token: string;
|
|
27
|
+
}
|
|
28
|
+
/** POST /auth/organizations/switch. Send null to work outside any organization. */
|
|
29
|
+
export declare class SwitchOrganizationInput {
|
|
30
|
+
organizationId: string | null;
|
|
31
|
+
}
|