@lafken/auth 0.10.1

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.
Files changed (51) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +493 -0
  3. package/lib/index.d.ts +2 -0
  4. package/lib/index.js +18 -0
  5. package/lib/main/attribute/attribute.d.ts +86 -0
  6. package/lib/main/attribute/attribute.js +109 -0
  7. package/lib/main/attribute/attribute.types.d.ts +90 -0
  8. package/lib/main/attribute/attribute.types.js +13 -0
  9. package/lib/main/attribute/index.d.ts +2 -0
  10. package/lib/main/attribute/index.js +18 -0
  11. package/lib/main/event/event.d.ts +19 -0
  12. package/lib/main/event/event.js +26 -0
  13. package/lib/main/extension/extension.d.ts +60 -0
  14. package/lib/main/extension/extension.js +74 -0
  15. package/lib/main/extension/extension.types.d.ts +37 -0
  16. package/lib/main/extension/extension.types.js +2 -0
  17. package/lib/main/extension/index.d.ts +1 -0
  18. package/lib/main/extension/index.js +2 -0
  19. package/lib/main/index.d.ts +1 -0
  20. package/lib/main/index.js +17 -0
  21. package/lib/resolver/auth/auth.d.ts +11 -0
  22. package/lib/resolver/auth/auth.js +50 -0
  23. package/lib/resolver/auth/auth.utils.d.ts +2 -0
  24. package/lib/resolver/auth/auth.utils.js +23 -0
  25. package/lib/resolver/auth/user-pool/extension/extension.d.ts +8 -0
  26. package/lib/resolver/auth/user-pool/extension/extension.js +51 -0
  27. package/lib/resolver/auth/user-pool/extension/extension.types.d.ts +6 -0
  28. package/lib/resolver/auth/user-pool/extension/extension.types.js +2 -0
  29. package/lib/resolver/auth/user-pool/external/external.d.ts +14 -0
  30. package/lib/resolver/auth/user-pool/external/external.js +14 -0
  31. package/lib/resolver/auth/user-pool/identity-provider/identity-provider.d.ts +13 -0
  32. package/lib/resolver/auth/user-pool/identity-provider/identity-provider.js +120 -0
  33. package/lib/resolver/auth/user-pool/identity-provider/identity-provider.types.d.ts +6 -0
  34. package/lib/resolver/auth/user-pool/identity-provider/identity-provider.types.js +2 -0
  35. package/lib/resolver/auth/user-pool/internal/internal.d.ts +30 -0
  36. package/lib/resolver/auth/user-pool/internal/internal.js +332 -0
  37. package/lib/resolver/auth/user-pool/user-pool.types.d.ts +263 -0
  38. package/lib/resolver/auth/user-pool/user-pool.types.js +2 -0
  39. package/lib/resolver/auth/user-pool-client/external/external.d.ts +7 -0
  40. package/lib/resolver/auth/user-pool-client/external/external.js +16 -0
  41. package/lib/resolver/auth/user-pool-client/internal/internal.d.ts +14 -0
  42. package/lib/resolver/auth/user-pool-client/internal/internal.js +115 -0
  43. package/lib/resolver/auth/user-pool-client/user-pool-client.types.d.ts +169 -0
  44. package/lib/resolver/auth/user-pool-client/user-pool-client.types.js +2 -0
  45. package/lib/resolver/index.d.ts +1 -0
  46. package/lib/resolver/index.js +17 -0
  47. package/lib/resolver/resolver.d.ts +12 -0
  48. package/lib/resolver/resolver.js +25 -0
  49. package/lib/resolver/resolver.types.d.ts +62 -0
  50. package/lib/resolver/resolver.types.js +2 -0
  51. package/package.json +87 -0
@@ -0,0 +1,62 @@
1
+ import type { CognitoUserPool } from '@cdktn/provider-aws/lib/cognito-user-pool';
2
+ import type { CognitoUserPoolClient } from '@cdktn/provider-aws/lib/cognito-user-pool-client';
3
+ import type { DataAwsCognitoUserPool } from '@cdktn/provider-aws/lib/data-aws-cognito-user-pool';
4
+ import type { DataAwsCognitoUserPoolClient } from '@cdktn/provider-aws/lib/data-aws-cognito-user-pool-client';
5
+ import type { AuthNames, ClassResource } from '@lafken/common';
6
+ import type { Construct } from 'constructs';
7
+ import type { UserPoolProps } from './auth/user-pool/user-pool.types';
8
+ import type { UserClientProps } from './auth/user-pool-client/user-pool-client.types';
9
+ export interface ExtendProps {
10
+ scope: Construct;
11
+ userPool: CognitoUserPool | DataAwsCognitoUserPool;
12
+ userPoolClient: CognitoUserPoolClient | DataAwsCognitoUserPoolClient;
13
+ }
14
+ export interface AuthOptions<T extends ClassResource> {
15
+ /**
16
+ * Determines the name of the Cognito User Pool and its associated User Client.
17
+ */
18
+ name: AuthNames;
19
+ /**
20
+ * Defines a custom configuration for the Cognito User Pool.
21
+ * This allows specifying properties such as:
22
+ * - Password policies
23
+ * - Lambda triggers
24
+ * - MFA settings
25
+ * - Sign-in aliases
26
+ * @example
27
+ * {
28
+ * userPool: {
29
+ * attributes: AttributeClass,
30
+ * ...
31
+ * }
32
+ * }
33
+ */
34
+ userPool?: UserPoolProps<T>;
35
+ /**
36
+ * Defines a custom configuration for the Cognito User Pool Client.
37
+ * This allows specifying properties such as:
38
+ * - OAuth flows
39
+ * - Callback URLs
40
+ * - Allowed scopes
41
+ * - Token expiration times
42
+ * @example
43
+ * {
44
+ * userClient: {
45
+ * authFlow: ['allow_user_auth'],
46
+ * ...
47
+ * }
48
+ * }
49
+ */
50
+ userClient?: UserClientProps<T>;
51
+ /**
52
+ * Allows extending the Cognito User Pool with custom configurations or resources.
53
+ *
54
+ * @example
55
+ * {
56
+ * extend: ({ userPool }) => {
57
+ * userPool.addCustomDomain('auth.myapp.com');
58
+ * },
59
+ * };
60
+ */
61
+ extend?: (props: ExtendProps) => void;
62
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@lafken/auth",
3
+ "version": "0.10.1",
4
+ "private": false,
5
+ "description": "Define Cognito User Pools using TypeScript decorators - simplified authentication infrastructure with Lafken",
6
+ "keywords": [
7
+ "aws",
8
+ "cognito",
9
+ "auth",
10
+ "authentication",
11
+ "identity",
12
+ "serverless",
13
+ "typescript",
14
+ "decorators",
15
+ "lafken"
16
+ ],
17
+ "homepage": "https://github.com/Hero64/lafken#readme",
18
+ "bugs": "https://github.com/Hero64/lafken/issues",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/Hero64/lafken",
22
+ "directory": "packages/auth"
23
+ },
24
+ "license": "MIT",
25
+ "author": "Aníbal Jorquera",
26
+ "exports": {
27
+ "./main": {
28
+ "types": "./lib/main/index.d.ts",
29
+ "import": "./lib/main/index.js",
30
+ "require": "./lib/main/index.js"
31
+ },
32
+ "./resolver": {
33
+ "types": "./lib/resolver/index.d.ts",
34
+ "import": "./lib/resolver/index.js",
35
+ "require": "./lib/resolver/index.js"
36
+ }
37
+ },
38
+ "typesVersions": {
39
+ "*": {
40
+ "main": [
41
+ "./lib/main/index.d.ts"
42
+ ],
43
+ "resolver": [
44
+ "./lib/resolver/index.d.ts"
45
+ ]
46
+ }
47
+ },
48
+ "files": [
49
+ "lib"
50
+ ],
51
+ "dependencies": {
52
+ "reflect-metadata": "^0.2.2",
53
+ "@lafken/resolver": "0.10.1"
54
+ },
55
+ "devDependencies": {
56
+ "@cdktn/provider-aws": "^23.5.0",
57
+ "@swc/core": "^1.15.21",
58
+ "@swc/helpers": "^0.5.20",
59
+ "@vitest/runner": "^4.1.2",
60
+ "cdktn": "^0.22.1",
61
+ "cdktn-vitest": "^1.0.0",
62
+ "constructs": "^10.6.0",
63
+ "typescript": "6.0.2",
64
+ "unplugin-swc": "^1.5.9",
65
+ "vitest": "^4.1.2",
66
+ "@lafken/common": "0.10.1"
67
+ },
68
+ "peerDependencies": {
69
+ "@cdktn/provider-aws": ">=23.0.0",
70
+ "cdktn": ">=0.22.0",
71
+ "constructs": "^10.4.5",
72
+ "@lafken/common": "0.10.1"
73
+ },
74
+ "engines": {
75
+ "node": ">=20.19"
76
+ },
77
+ "publishConfig": {
78
+ "access": "public"
79
+ },
80
+ "scripts": {
81
+ "build": "pnpm clean && tsc -p ./tsconfig.build.json",
82
+ "check-types": "tsc --noEmit -p ./tsconfig.build.json",
83
+ "clean": "rm -rf ./lib",
84
+ "dev": "tsc -w",
85
+ "test": "vitest"
86
+ }
87
+ }