@descope/angular-sdk 0.0.0-next-e6e5cd95-20231226

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 (83) hide show
  1. package/.editorconfig +16 -0
  2. package/.eslintrc.json +40 -0
  3. package/.github/workflows/ci.yml +99 -0
  4. package/.github/workflows/publish-next.yml +40 -0
  5. package/.github/workflows/publish.yml +28 -0
  6. package/.github/workflows/release.yml +46 -0
  7. package/.husky/pre-commit +4 -0
  8. package/.prettierrc +8 -0
  9. package/.vscode/extensions.json +4 -0
  10. package/.vscode/launch.json +20 -0
  11. package/.vscode/settings.json +3 -0
  12. package/.vscode/tasks.json +42 -0
  13. package/LICENSE +21 -0
  14. package/README.md +460 -0
  15. package/angular.json +154 -0
  16. package/jest.config.js +17 -0
  17. package/package.json +66 -0
  18. package/projects/angular-sdk/.eslintrc.json +32 -0
  19. package/projects/angular-sdk/README.md +25 -0
  20. package/projects/angular-sdk/ng-package.json +8 -0
  21. package/projects/angular-sdk/package.json +20 -0
  22. package/projects/angular-sdk/src/environment.ts +3 -0
  23. package/projects/angular-sdk/src/lib/components/descope/descope.component.spec.ts +104 -0
  24. package/projects/angular-sdk/src/lib/components/descope/descope.component.ts +114 -0
  25. package/projects/angular-sdk/src/lib/components/sign-in-flow/sign-in-flow.component.html +15 -0
  26. package/projects/angular-sdk/src/lib/components/sign-in-flow/sign-in-flow.component.spec.ts +53 -0
  27. package/projects/angular-sdk/src/lib/components/sign-in-flow/sign-in-flow.component.ts +32 -0
  28. package/projects/angular-sdk/src/lib/components/sign-up-flow/sign-up-flow.component.html +15 -0
  29. package/projects/angular-sdk/src/lib/components/sign-up-flow/sign-up-flow.component.spec.ts +51 -0
  30. package/projects/angular-sdk/src/lib/components/sign-up-flow/sign-up-flow.component.ts +32 -0
  31. package/projects/angular-sdk/src/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.html +15 -0
  32. package/projects/angular-sdk/src/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.spec.ts +53 -0
  33. package/projects/angular-sdk/src/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.ts +32 -0
  34. package/projects/angular-sdk/src/lib/descope-auth.module.ts +46 -0
  35. package/projects/angular-sdk/src/lib/services/descope-auth.guard.spec.ts +76 -0
  36. package/projects/angular-sdk/src/lib/services/descope-auth.guard.ts +16 -0
  37. package/projects/angular-sdk/src/lib/services/descope-auth.service.spec.ts +264 -0
  38. package/projects/angular-sdk/src/lib/services/descope-auth.service.ts +176 -0
  39. package/projects/angular-sdk/src/lib/services/descope.interceptor.spec.ts +102 -0
  40. package/projects/angular-sdk/src/lib/services/descope.interceptor.ts +76 -0
  41. package/projects/angular-sdk/src/lib/types/types.ts +10 -0
  42. package/projects/angular-sdk/src/lib/utils/constants.ts +8 -0
  43. package/projects/angular-sdk/src/lib/utils/helpers.spec.ts +103 -0
  44. package/projects/angular-sdk/src/lib/utils/helpers.ts +36 -0
  45. package/projects/angular-sdk/src/public-api.ts +13 -0
  46. package/projects/angular-sdk/tsconfig.lib.json +12 -0
  47. package/projects/angular-sdk/tsconfig.lib.prod.json +10 -0
  48. package/projects/angular-sdk/tsconfig.spec.json +11 -0
  49. package/projects/demo-app/.eslintrc.json +31 -0
  50. package/projects/demo-app/src/app/app-routing.module.ts +23 -0
  51. package/projects/demo-app/src/app/app.component.html +3 -0
  52. package/projects/demo-app/src/app/app.component.scss +16 -0
  53. package/projects/demo-app/src/app/app.component.spec.ts +37 -0
  54. package/projects/demo-app/src/app/app.component.ts +8 -0
  55. package/projects/demo-app/src/app/app.module.ts +52 -0
  56. package/projects/demo-app/src/app/home/home.component.html +23 -0
  57. package/projects/demo-app/src/app/home/home.component.scss +15 -0
  58. package/projects/demo-app/src/app/home/home.component.spec.ts +44 -0
  59. package/projects/demo-app/src/app/home/home.component.ts +61 -0
  60. package/projects/demo-app/src/app/interceptor/auth.interceptor.ts +20 -0
  61. package/projects/demo-app/src/app/login/login.component.html +12 -0
  62. package/projects/demo-app/src/app/login/login.component.spec.ts +42 -0
  63. package/projects/demo-app/src/app/login/login.component.ts +35 -0
  64. package/projects/demo-app/src/app/protected/protected.component.html +18 -0
  65. package/projects/demo-app/src/app/protected/protected.component.scss +8 -0
  66. package/projects/demo-app/src/app/protected/protected.component.spec.ts +42 -0
  67. package/projects/demo-app/src/app/protected/protected.component.ts +40 -0
  68. package/projects/demo-app/src/assets/.gitkeep +0 -0
  69. package/projects/demo-app/src/environments/conifg.ts +13 -0
  70. package/projects/demo-app/src/environments/environment.ts +19 -0
  71. package/projects/demo-app/src/favicon.ico +0 -0
  72. package/projects/demo-app/src/index.html +17 -0
  73. package/projects/demo-app/src/main.ts +7 -0
  74. package/projects/demo-app/src/styles.scss +21 -0
  75. package/projects/demo-app/tsconfig.app.json +10 -0
  76. package/projects/demo-app/tsconfig.spec.json +10 -0
  77. package/renovate.json +4 -0
  78. package/scripts/gitleaks/.gitleaks.toml +653 -0
  79. package/scripts/gitleaks/gitleaks.sh +34 -0
  80. package/scripts/setversion/setversion.js +20 -0
  81. package/setup-jest.ts +1 -0
  82. package/thirdPartyLicenseCollector_linux_amd64 +0 -0
  83. package/tsconfig.json +35 -0
package/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ # Editor configuration, see https://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.ts]
12
+ quote_type = single
13
+
14
+ [*.md]
15
+ max_line_length = off
16
+ trim_trailing_whitespace = false
package/.eslintrc.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "root": true,
3
+ "ignorePatterns": ["projects/**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts"],
7
+ "extends": [
8
+ "eslint:recommended",
9
+ "plugin:@typescript-eslint/recommended",
10
+ "plugin:@angular-eslint/recommended",
11
+ "plugin:@angular-eslint/template/process-inline-templates"
12
+ ],
13
+ "rules": {
14
+ "@angular-eslint/directive-selector": [
15
+ "error",
16
+ {
17
+ "type": "attribute",
18
+ "prefix": "lib",
19
+ "style": "camelCase"
20
+ }
21
+ ],
22
+ "@angular-eslint/component-selector": [
23
+ "error",
24
+ {
25
+ "type": "element",
26
+ "style": "kebab-case"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "files": ["*.html"],
33
+ "extends": [
34
+ "plugin:@angular-eslint/template/recommended",
35
+ "plugin:@angular-eslint/template/accessibility"
36
+ ],
37
+ "rules": {}
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,99 @@
1
+ name: 🎛️ CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ - init # TODO: remove this branch
9
+
10
+ env:
11
+ NODE_VERSION: 20
12
+
13
+ jobs:
14
+ build:
15
+ name: 👷 Build
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+ - uses: actions/setup-node@v4
21
+ with:
22
+ node-version: ${{ env.NODE_VERSION }}
23
+ registry-url: https://npm.pkg.github.com/
24
+ - name: Install dependencies
25
+ run: npm ci
26
+ - name: Building Lib
27
+ run: npm run build:lib
28
+ - name: Building Demo App
29
+ run: npm run build:app
30
+
31
+ lint:
32
+ name: 🪥 Lint
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - name: Checkout code
36
+ uses: actions/checkout@v4
37
+ - uses: actions/setup-node@v4
38
+ with:
39
+ node-version: ${{ env.NODE_VERSION }}
40
+ registry-url: https://npm.pkg.github.com/
41
+ - name: Install dependencies
42
+ run: npm ci
43
+ - name: Linting
44
+ run: npm run lint
45
+ - name: Format check
46
+ run: npm run format-check
47
+
48
+ gitleaks:
49
+ name: 🔒 Run Git leaks
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - name: Checkout code
53
+ uses: actions/checkout@v4
54
+ - uses: actions/setup-node@v4
55
+ with:
56
+ node-version: ${{ env.NODE_VERSION }}
57
+ - name: Install dependencies
58
+ run: npm ci
59
+ - name: Gitleaks
60
+ run: npm run leaks
61
+ shell: bash
62
+
63
+ testing:
64
+ name: 👔 Test
65
+ runs-on: ubuntu-latest
66
+ steps:
67
+ - name: Checkout code
68
+ uses: actions/checkout@v4
69
+ - uses: actions/setup-node@v4
70
+ with:
71
+ node-version: ${{ env.NODE_VERSION }}
72
+ registry-url: https://npm.pkg.github.com/
73
+ - name: Install dependencies
74
+ run: npm ci
75
+ - name: Testing
76
+ run: npm run test
77
+ - name: Coverage check
78
+ uses: devmasx/coverage-check-action@v1.2.0
79
+ with:
80
+ type: lcov
81
+ min_coverage: 72.19
82
+ result_path: coverage/lcov.info
83
+ token: ${{ github.token }}
84
+
85
+ license-validation:
86
+ name: 🪪 License Validation
87
+ runs-on: ubuntu-latest
88
+ steps:
89
+ - name: Checkout code
90
+ uses: actions/checkout@v4
91
+ - uses: actions/setup-node@v4
92
+ with:
93
+ node-version: ${{ env.NODE_VERSION }}
94
+ registry-url: https://npm.pkg.github.com/
95
+ - name: Install dependencies
96
+ run: npm ci
97
+ - name: License validation
98
+ shell: bash
99
+ run: ./thirdPartyLicenseCollector_linux_amd64 -npm-project ./projects/angular-sdk -npm-node-modules .
@@ -0,0 +1,40 @@
1
+ name: 📢 Publish Next
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - init # TODO: remove this branch
8
+
9
+ env:
10
+ NODE_VERSION: 20
11
+
12
+ jobs:
13
+ publish:
14
+ name: 📢 Publish Next
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: ${{ env.NODE_VERSION }}
22
+ registry-url: https://registry.npmjs.org/
23
+ - name: Get Short SHA
24
+ run: echo "SHORT_SHA=`echo ${{ github.sha }} | cut -c1-8`" >> $GITHUB_ENV
25
+ - name: Get Next Version
26
+ run: |
27
+ current_date=$(date +'%Y%m%d')
28
+ echo "NEW_VERSION=0.0.0-next-${SHORT_SHA}-${current_date}" >> $GITHUB_ENV
29
+ - name: Use Next Version
30
+ run: |
31
+ git config --global user.email "info@descope.com"
32
+ git config --global user.name "Descope"
33
+ yarn version --new-version ${NEW_VERSION}
34
+ cat package.json
35
+ - name: Install dependencies
36
+ run: npm ci
37
+ - name: Publish to NPM Package Registry
38
+ run: npm publish --access=public --tag next
39
+ env:
40
+ NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_REGISTRY }}
@@ -0,0 +1,28 @@
1
+ name: 📢 publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "release/**"
7
+
8
+ env:
9
+ NODE_VERSION: 20
10
+
11
+ jobs:
12
+ publish:
13
+ name: 📢 Publish
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: ${{ env.NODE_VERSION }}
21
+ registry-url: https://registry.npmjs.org/
22
+ - name: Install dependencies
23
+ run: npm ci
24
+ - name: Publish to NPM Package Registry
25
+ run: npm publish --access=public
26
+ env:
27
+ CI: true
28
+ NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_REGISTRY }}
@@ -0,0 +1,46 @@
1
+ name: 👊 Bump Version & Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - init # TODO: remove this branch
8
+
9
+ jobs:
10
+ bump-version:
11
+ name: 👊 Bump Version & Release
12
+ runs-on: ubuntu-latest
13
+ # this workflow will run only if commit message ends with "RELEASE"
14
+ if: "contains(github.event.head_commit.message, 'RELEASE')"
15
+ steps:
16
+ - name: Checkout source code
17
+ uses: actions/checkout@v4
18
+ with:
19
+ persist-credentials: false
20
+ ref: ${{ github.ref }}
21
+
22
+ - name: cat package.json
23
+ run: cat ./package.json
24
+
25
+ - name: Get token
26
+ id: get_token
27
+ uses: tibdex/github-app-token@v1
28
+ with:
29
+ private_key: ${{ secrets.RELEASE_APP_PEM }}
30
+ app_id: ${{ secrets.RELEASE_APP_ID }}
31
+
32
+ - name: Automated Version Bump
33
+ id: version-bump
34
+ uses: phips28/gh-action-bump-version@master
35
+ with:
36
+ tag-prefix: release/v
37
+ major-wording: 'MAJOR'
38
+ minor-wording: 'MINOR'
39
+ env:
40
+ GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
41
+ - name: cat package.json
42
+ run: cat ./package.json
43
+ - name: Output Step
44
+ env:
45
+ NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
46
+ run: echo "new tag $NEW_TAG"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npm run format-lint
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "useTabs": true,
4
+ "semi": true,
5
+ "singleQuote": true,
6
+ "trailingComma": "none",
7
+ "printWidth": 80
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3
+ "recommendations": ["angular.ng-template"]
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3
+ "version": "0.2.0",
4
+ "configurations": [
5
+ {
6
+ "name": "ng serve",
7
+ "type": "chrome",
8
+ "request": "launch",
9
+ "preLaunchTask": "npm: start",
10
+ "url": "http://localhost:4200/"
11
+ },
12
+ {
13
+ "name": "ng test",
14
+ "type": "chrome",
15
+ "request": "launch",
16
+ "preLaunchTask": "npm: test",
17
+ "url": "http://localhost:9876/debug.html"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "cSpell.words": ["setversion"]
3
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
+ "version": "2.0.0",
4
+ "tasks": [
5
+ {
6
+ "type": "npm",
7
+ "script": "start",
8
+ "isBackground": true,
9
+ "problemMatcher": {
10
+ "owner": "typescript",
11
+ "pattern": "$tsc",
12
+ "background": {
13
+ "activeOnStart": true,
14
+ "beginsPattern": {
15
+ "regexp": "(.*?)"
16
+ },
17
+ "endsPattern": {
18
+ "regexp": "bundle generation complete"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ {
24
+ "type": "npm",
25
+ "script": "test",
26
+ "isBackground": true,
27
+ "problemMatcher": {
28
+ "owner": "typescript",
29
+ "pattern": "$tsc",
30
+ "background": {
31
+ "activeOnStart": true,
32
+ "beginsPattern": {
33
+ "regexp": "(.*?)"
34
+ },
35
+ "endsPattern": {
36
+ "regexp": "bundle generation complete"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Descope <help@descope.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.