@descope/angular-sdk 0.0.0-next-32627c0f-20231228 → 0.0.0-next-a6b67f6a-20231228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +448 -13
- package/dist/README.md +21 -0
- package/dist/environment.d.ts +3 -0
- package/dist/esm2022/descope-angular-sdk.mjs +5 -0
- package/dist/esm2022/environment.mjs +4 -0
- package/dist/esm2022/lib/components/descope/descope.component.mjs +106 -0
- package/dist/esm2022/lib/components/sign-in-flow/sign-in-flow.component.mjs +40 -0
- package/dist/esm2022/lib/components/sign-up-flow/sign-up-flow.component.mjs +40 -0
- package/dist/esm2022/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.mjs +40 -0
- package/dist/esm2022/lib/descope-auth.module.mjs +52 -0
- package/dist/esm2022/lib/services/descope-auth.guard.mjs +15 -0
- package/dist/esm2022/lib/services/descope-auth.service.mjs +139 -0
- package/dist/esm2022/lib/services/descope.interceptor.mjs +51 -0
- package/dist/esm2022/lib/types/types.mjs +6 -0
- package/dist/esm2022/lib/utils/constants.mjs +7 -0
- package/dist/esm2022/lib/utils/helpers.mjs +27 -0
- package/dist/esm2022/public-api.mjs +13 -0
- package/dist/fesm2022/descope-angular-sdk.mjs +500 -0
- package/dist/fesm2022/descope-angular-sdk.mjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/lib/components/descope/descope.component.d.ts +32 -0
- package/dist/lib/components/sign-in-flow/sign-in-flow.component.d.ts +24 -0
- package/dist/lib/components/sign-up-flow/sign-up-flow.component.d.ts +24 -0
- package/dist/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.d.ts +24 -0
- package/dist/lib/descope-auth.module.d.ts +14 -0
- package/dist/lib/services/descope-auth.guard.d.ts +2 -0
- package/dist/lib/services/descope-auth.service.d.ts +38 -0
- package/dist/lib/services/descope.interceptor.d.ts +2 -0
- package/dist/lib/types/types.d.ts +8 -0
- package/dist/lib/utils/constants.d.ts +5 -0
- package/dist/lib/utils/helpers.d.ts +5 -0
- package/dist/package.json +42 -0
- package/dist/public-api.d.ts +9 -0
- package/package.json +80 -41
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ILogger } from '@descope/web-component';
|
|
3
|
+
import { DescopeAuthConfig } from '../../types/types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class SignUpFlowComponent {
|
|
6
|
+
projectId: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
theme: 'light' | 'dark' | 'os';
|
|
9
|
+
tenant: string;
|
|
10
|
+
telemetryKey: string;
|
|
11
|
+
redirectUrl: string;
|
|
12
|
+
autoFocus: true | false | 'skipFirstScreen';
|
|
13
|
+
debug: boolean;
|
|
14
|
+
errorTransformer: (error: {
|
|
15
|
+
text: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}) => string;
|
|
18
|
+
logger: ILogger;
|
|
19
|
+
success: EventEmitter<void>;
|
|
20
|
+
error: EventEmitter<void>;
|
|
21
|
+
constructor(descopeConfig: DescopeAuthConfig);
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SignUpFlowComponent, never>;
|
|
23
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SignUpFlowComponent, "descope-sign-up-flow", never, { "locale": { "alias": "locale"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "tenant": { "alias": "tenant"; "required": false; }; "telemetryKey": { "alias": "telemetryKey"; "required": false; }; "redirectUrl": { "alias": "redirectUrl"; "required": false; }; "autoFocus": { "alias": "autoFocus"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "errorTransformer": { "alias": "errorTransformer"; "required": false; }; "logger": { "alias": "logger"; "required": false; }; }, { "success": "success"; "error": "error"; }, never, never, true, never>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ILogger } from '@descope/web-component';
|
|
3
|
+
import { DescopeAuthConfig } from '../../types/types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class SignUpOrInFlowComponent {
|
|
6
|
+
projectId: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
theme: 'light' | 'dark' | 'os';
|
|
9
|
+
tenant: string;
|
|
10
|
+
telemetryKey: string;
|
|
11
|
+
redirectUrl: string;
|
|
12
|
+
autoFocus: true | false | 'skipFirstScreen';
|
|
13
|
+
debug: boolean;
|
|
14
|
+
errorTransformer: (error: {
|
|
15
|
+
text: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}) => string;
|
|
18
|
+
logger: ILogger;
|
|
19
|
+
success: EventEmitter<void>;
|
|
20
|
+
error: EventEmitter<void>;
|
|
21
|
+
constructor(descopeConfig: DescopeAuthConfig);
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SignUpOrInFlowComponent, never>;
|
|
23
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SignUpOrInFlowComponent, "descope-sign-up-or-in-flow", never, { "locale": { "alias": "locale"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "tenant": { "alias": "tenant"; "required": false; }; "telemetryKey": { "alias": "telemetryKey"; "required": false; }; "redirectUrl": { "alias": "redirectUrl"; "required": false; }; "autoFocus": { "alias": "autoFocus"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "errorTransformer": { "alias": "errorTransformer"; "required": false; }; "logger": { "alias": "logger"; "required": false; }; }, { "success": "success"; "error": "error"; }, never, never, true, never>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { DescopeAuthConfig } from './types/types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "./components/descope/descope.component";
|
|
5
|
+
import * as i2 from "./components/sign-in-flow/sign-in-flow.component";
|
|
6
|
+
import * as i3 from "./components/sign-up-flow/sign-up-flow.component";
|
|
7
|
+
import * as i4 from "./components/sign-up-or-in-flow/sign-up-or-in-flow.component";
|
|
8
|
+
export declare class DescopeAuthModule {
|
|
9
|
+
constructor(parentModule?: DescopeAuthModule);
|
|
10
|
+
static forRoot(config?: DescopeAuthConfig): ModuleWithProviders<DescopeAuthModule>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DescopeAuthModule, [{ optional: true; skipSelf: true; }]>;
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DescopeAuthModule, never, [typeof i1.DescopeComponent, typeof i2.SignInFlowComponent, typeof i3.SignUpFlowComponent, typeof i4.SignUpOrInFlowComponent], [typeof i1.DescopeComponent, typeof i2.SignInFlowComponent, typeof i3.SignUpFlowComponent, typeof i4.SignUpOrInFlowComponent]>;
|
|
13
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DescopeAuthModule>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="core-js-sdk" />
|
|
2
|
+
import type { UserResponse } from '@descope/web-js-sdk';
|
|
3
|
+
import createSdk from '@descope/web-js-sdk';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { Observablefied } from '../utils/helpers';
|
|
6
|
+
import { DescopeAuthConfig } from '../types/types';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
type DescopeSDK = ReturnType<typeof createSdk>;
|
|
9
|
+
type AngularDescopeSDK = Observablefied<DescopeSDK>;
|
|
10
|
+
export interface DescopeSession {
|
|
11
|
+
isAuthenticated: boolean;
|
|
12
|
+
isSessionLoading: boolean;
|
|
13
|
+
sessionToken: string | null;
|
|
14
|
+
}
|
|
15
|
+
export type DescopeUser = {
|
|
16
|
+
user?: UserResponse;
|
|
17
|
+
isUserLoading: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare class DescopeAuthService {
|
|
20
|
+
descopeSdk: AngularDescopeSDK;
|
|
21
|
+
private readonly sessionSubject;
|
|
22
|
+
private readonly userSubject;
|
|
23
|
+
readonly session$: Observable<DescopeSession>;
|
|
24
|
+
readonly user$: Observable<DescopeUser>;
|
|
25
|
+
constructor(config: DescopeAuthConfig);
|
|
26
|
+
refreshSession(): Observable<import("@descope/core-js-sdk").SdkResponse<import("@descope/core-js-sdk").JWTResponse>>;
|
|
27
|
+
refreshUser(): Observable<import("@descope/core-js-sdk").SdkResponse<UserResponse>>;
|
|
28
|
+
getSessionToken(): string | null;
|
|
29
|
+
getRefreshToken(): string | null;
|
|
30
|
+
getJwtPermissions(token?: string | null, tenant?: string): string[];
|
|
31
|
+
getJwtRoles(token?: string | null, tenant?: string): string[];
|
|
32
|
+
isAuthenticated(): boolean;
|
|
33
|
+
private setSession;
|
|
34
|
+
private setUser;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DescopeAuthService, never>;
|
|
36
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DescopeAuthService>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export type Observablefied<T> = {
|
|
3
|
+
[K in keyof T]: T[K] extends (...args: infer Args) => Promise<infer R> ? (...args: Args) => Observable<R> : T[K] extends (...args: infer Args) => infer R ? (...args: Args) => R : T[K] extends object ? Observablefied<T[K]> : T[K];
|
|
4
|
+
};
|
|
5
|
+
export declare function observabilify<T>(value: T): Observablefied<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@descope/angular-sdk",
|
|
3
|
+
"version": "0.0.0-next-a6b67f6a-20231228",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": ">=16.0.0",
|
|
6
|
+
"@angular/core": ">=16.0.0"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^16.14.0 || >=18.10.0",
|
|
14
|
+
"npm": ">= 8.1.0"
|
|
15
|
+
},
|
|
16
|
+
"lint-staged": {
|
|
17
|
+
"+(src|test|examples)/**/*.{js,ts,html}": [
|
|
18
|
+
"npm run lint"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@descope/web-component": "3.0.0",
|
|
23
|
+
"tslib": "^2.3.0"
|
|
24
|
+
},
|
|
25
|
+
"optionalDependencies": {
|
|
26
|
+
"@descope/web-js-sdk": ">=1"
|
|
27
|
+
},
|
|
28
|
+
"module": "fesm2022/descope-angular-sdk.mjs",
|
|
29
|
+
"typings": "index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./package.json": {
|
|
32
|
+
"default": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./index.d.ts",
|
|
36
|
+
"esm2022": "./esm2022/descope-angular-sdk.mjs",
|
|
37
|
+
"esm": "./esm2022/descope-angular-sdk.mjs",
|
|
38
|
+
"default": "./fesm2022/descope-angular-sdk.mjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"sideEffects": false
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './lib/services/descope-auth.service';
|
|
2
|
+
export * from './lib/services/descope-auth.guard';
|
|
3
|
+
export * from './lib/services/descope.interceptor';
|
|
4
|
+
export * from './lib/descope-auth.module';
|
|
5
|
+
export * from './lib/components/descope/descope.component';
|
|
6
|
+
export * from './lib/components/sign-in-flow/sign-in-flow.component';
|
|
7
|
+
export * from './lib/components/sign-up-flow/sign-up-flow.component';
|
|
8
|
+
export * from './lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component';
|
|
9
|
+
export * from './lib/types/types';
|
package/package.json
CHANGED
|
@@ -1,42 +1,81 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
2
|
+
"name": "@descope/angular-sdk",
|
|
3
|
+
"version": "0.0.0-next-a6b67f6a-20231228",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": ">=16.0.0",
|
|
6
|
+
"@angular/core": ">=16.0.0"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^16.14.0 || >=18.10.0",
|
|
14
|
+
"npm": ">= 8.1.0"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"ng": "ng",
|
|
18
|
+
"start": "ng serve",
|
|
19
|
+
"prepare": "husky install",
|
|
20
|
+
"format-lint": "pretty-quick --staged --ignore-path .gitignore && lint-staged",
|
|
21
|
+
"prebuild:ci": "node scripts/setversion/setversion.js",
|
|
22
|
+
"build:ci": "npm run build:lib",
|
|
23
|
+
"build:lib": "cp package.json ./projects/angular-sdk && ng build angular-sdk",
|
|
24
|
+
"build:app": "ng build demo-app",
|
|
25
|
+
"watch": "ng build --watch --configuration development",
|
|
26
|
+
"test": "jest --config jest.config.js",
|
|
27
|
+
"lint": "ng lint",
|
|
28
|
+
"format": "prettier . -w --ignore-path .gitignore",
|
|
29
|
+
"format-check": "prettier . --check --ignore-path .gitignore",
|
|
30
|
+
"prepublishOnly": "npm run build:ci",
|
|
31
|
+
"leaks": "bash ./scripts/gitleaks/gitleaks.sh"
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"+(src|test|examples)/**/*.{js,ts,html}": [
|
|
35
|
+
"npm run lint"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@descope/web-component": "3.0.0",
|
|
40
|
+
"tslib": "^2.3.0"
|
|
41
|
+
},
|
|
42
|
+
"optionalDependencies": {
|
|
43
|
+
"@descope/web-js-sdk": ">=1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@angular-devkit/build-angular": "^16.2.6",
|
|
47
|
+
"@angular-eslint/builder": "16.3.1",
|
|
48
|
+
"@angular-eslint/eslint-plugin": "16.3.1",
|
|
49
|
+
"@angular-eslint/eslint-plugin-template": "16.3.1",
|
|
50
|
+
"@angular-eslint/schematics": "16.3.1",
|
|
51
|
+
"@angular-eslint/template-parser": "16.3.1",
|
|
52
|
+
"@angular/animations": "^16.2.9",
|
|
53
|
+
"@angular/cli": "^16.2.6",
|
|
54
|
+
"@angular/common": "^16.2.9",
|
|
55
|
+
"@angular/compiler": "^16.2.9",
|
|
56
|
+
"@angular/compiler-cli": "^16.2.9",
|
|
57
|
+
"@angular/core": "^16.2.9",
|
|
58
|
+
"@angular/forms": "^16.2.9",
|
|
59
|
+
"@angular/platform-browser": "^16.2.9",
|
|
60
|
+
"@angular/platform-browser-dynamic": "^16.2.9",
|
|
61
|
+
"@angular/router": "^16.2.9",
|
|
62
|
+
"@descope/web-component": "3.0.0",
|
|
63
|
+
"@types/jest": "^29.5.5",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "6.11.0",
|
|
65
|
+
"@typescript-eslint/parser": "6.11.0",
|
|
66
|
+
"eslint": "^8.51.0",
|
|
67
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
68
|
+
"husky": "^8.0.3",
|
|
69
|
+
"jest": "^29.7.0",
|
|
70
|
+
"jest-preset-angular": "^13.1.2",
|
|
71
|
+
"lint-staged": "^15.2.0",
|
|
72
|
+
"ng-mocks": "^14.11.0",
|
|
73
|
+
"ng-packagr": "^16.2.3",
|
|
74
|
+
"prettier": "2.8.8",
|
|
75
|
+
"pretty-quick": "^3.1.3",
|
|
76
|
+
"rxjs": "~7.8.1",
|
|
77
|
+
"tslib": "^2.6.2",
|
|
78
|
+
"typescript": "~5.1.6",
|
|
79
|
+
"zone.js": "~0.13.0"
|
|
80
|
+
}
|
|
81
|
+
}
|