@genesislcap/foundation-auth 15.94.1-alpha-6f4e61418f.0 → 15.95.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.
|
@@ -75,6 +75,9 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
75
75
|
onDone: ({
|
|
76
76
|
actions: string[];
|
|
77
77
|
target: string;
|
|
78
|
+
} | {
|
|
79
|
+
guard: import("xstate").BooleanGuardDefinition<import("xstate").MachineContext, import("xstate").EventObject>;
|
|
80
|
+
target: string;
|
|
78
81
|
} | {
|
|
79
82
|
guard: string;
|
|
80
83
|
target: string;
|
|
@@ -113,6 +116,10 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
113
116
|
}) => void;
|
|
114
117
|
}[];
|
|
115
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* A 401 here is the normal logged-out answer, so it completes the fetch rather than failing it.
|
|
121
|
+
*/
|
|
122
|
+
private createLoginDetailsFetchEvent;
|
|
116
123
|
}
|
|
117
124
|
/**
|
|
118
125
|
* AuthMachine DI key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAMjB,OAAO,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,IAAI,EASL,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAMjB,OAAO,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,IA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E,MAAM,EAAE,GAAG,KAAK,GAAG,iBAAiB;IAgB3E,SAAS,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;MAwBpB;IAEF,SAAS,CAAC,aAAa;;;MAGpB;IAEH;;OAEG;IACH,SAAS,CAAC,qBAAqB,GAAI,oBAAoB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA0B1D;IAEH;;OAEG;IACH,OAAO,CAAC,4BAA4B;CAUrC;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,mEAA0E,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
|
@@ -3,6 +3,7 @@ import { AbstractMachine, createErrorStateNode, FetchMachine, isDoneInvokeEvent,
|
|
|
3
3
|
import { User } from '@genesislcap/foundation-user';
|
|
4
4
|
import { UUID, LOGIN_DETAILS_URL, LOGIN_URL, ACCEPT_TERMS_URL, LOGOUT_URL, FORGOT_PASSWORD_URL, CHANGE_PASSWORD_URL, RESET_PASSWORD_URL, createErrorMap, } from '@genesislcap/foundation-utils';
|
|
5
5
|
import { DI } from '@microsoft/fast-foundation';
|
|
6
|
+
import { StatusCodes } from 'http-status-codes';
|
|
6
7
|
import { and, assign, createMachine, fromPromise, not, or, raise, sendTo } from 'xstate';
|
|
7
8
|
import { AuthConfig, defaultAuthConfig } from '../config/config';
|
|
8
9
|
import { CredentialManager, CredentialType, } from '../credential';
|
|
@@ -67,7 +68,7 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
67
68
|
src: this.fetchMachine.machine,
|
|
68
69
|
onDone: [
|
|
69
70
|
{
|
|
70
|
-
guard: 'isUnauthorizedError',
|
|
71
|
+
guard: or(['isUnauthorizedResponse', 'isUnauthorizedError']),
|
|
71
72
|
target: unauthorizedTarget,
|
|
72
73
|
},
|
|
73
74
|
{
|
|
@@ -86,7 +87,7 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
86
87
|
},
|
|
87
88
|
],
|
|
88
89
|
},
|
|
89
|
-
entry: [sendTo('loginDetailsFetcher', this.
|
|
90
|
+
entry: [sendTo('loginDetailsFetcher', this.createLoginDetailsFetchEvent())],
|
|
90
91
|
});
|
|
91
92
|
this.machine = createMachine({
|
|
92
93
|
id: 'authMachine',
|
|
@@ -817,6 +818,12 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
817
818
|
}
|
|
818
819
|
return isDoneInvokeEvent(event) ? isUnauthorizedError(event.output) : false;
|
|
819
820
|
},
|
|
821
|
+
isUnauthorizedResponse: ({ event }) => {
|
|
822
|
+
var _a, _b;
|
|
823
|
+
return isDoneInvokeEvent(event)
|
|
824
|
+
? ((_b = (_a = event.output) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.status) === StatusCodes.UNAUTHORIZED
|
|
825
|
+
: false;
|
|
826
|
+
},
|
|
820
827
|
isFetchError: ({ event }) => isDoneInvokeEvent(event) ? event.output instanceof Error : false,
|
|
821
828
|
isAuthenticated: ({ context }) => { var _a; return (_a = context.user) === null || _a === void 0 ? void 0 : _a.isAuthenticated; },
|
|
822
829
|
isBanned: ({ context }) => { var _a; return (_a = context.user) === null || _a === void 0 ? void 0 : _a.isBanned(); },
|
|
@@ -928,6 +935,18 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
928
935
|
},
|
|
929
936
|
};
|
|
930
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* A 401 here is the normal logged-out answer, so it completes the fetch rather than failing it.
|
|
940
|
+
*/
|
|
941
|
+
createLoginDetailsFetchEvent() {
|
|
942
|
+
const event = this.createFetchMachineEvent(LOGIN_DETAILS_URL);
|
|
943
|
+
if (event.type === 'fetch') {
|
|
944
|
+
event.params.fetchConfig = {
|
|
945
|
+
responseOkChecker: (response) => response.ok || response.status === StatusCodes.UNAUTHORIZED,
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
return event;
|
|
949
|
+
}
|
|
931
950
|
};
|
|
932
951
|
DefaultAuthMachine = __decorate([
|
|
933
952
|
__param(0, User),
|
|
@@ -6244,7 +6244,34 @@
|
|
|
6244
6244
|
},
|
|
6245
6245
|
{
|
|
6246
6246
|
"kind": "Content",
|
|
6247
|
-
"text": ">>;\n onDone: ({\n actions: string[];\n target: string;\n } | {\n guard:
|
|
6247
|
+
"text": ">>;\n onDone: ({\n actions: string[];\n target: string;\n } | {\n guard: import(\"xstate\")."
|
|
6248
|
+
},
|
|
6249
|
+
{
|
|
6250
|
+
"kind": "Reference",
|
|
6251
|
+
"text": "BooleanGuardDefinition",
|
|
6252
|
+
"canonicalReference": "xstate!BooleanGuardDefinition:interface"
|
|
6253
|
+
},
|
|
6254
|
+
{
|
|
6255
|
+
"kind": "Content",
|
|
6256
|
+
"text": "<import(\"xstate\")."
|
|
6257
|
+
},
|
|
6258
|
+
{
|
|
6259
|
+
"kind": "Reference",
|
|
6260
|
+
"text": "MachineContext",
|
|
6261
|
+
"canonicalReference": "xstate!MachineContext:type"
|
|
6262
|
+
},
|
|
6263
|
+
{
|
|
6264
|
+
"kind": "Content",
|
|
6265
|
+
"text": ", import(\"xstate\")."
|
|
6266
|
+
},
|
|
6267
|
+
{
|
|
6268
|
+
"kind": "Reference",
|
|
6269
|
+
"text": "EventObject",
|
|
6270
|
+
"canonicalReference": "xstate!EventObject:interface"
|
|
6271
|
+
},
|
|
6272
|
+
{
|
|
6273
|
+
"kind": "Content",
|
|
6274
|
+
"text": ">;\n target: string;\n } | {\n guard: string;\n target: string;\n })[];\n onError: ({\n guard: string;\n target: string;\n } | {\n target: string;\n guard?: undefined;\n })[];\n };\n entry: {\n (_: import(\"xstate\")."
|
|
6248
6275
|
},
|
|
6249
6276
|
{
|
|
6250
6277
|
"kind": "Reference",
|
|
@@ -6572,7 +6599,7 @@
|
|
|
6572
6599
|
"name": "loginDetailsStateNode",
|
|
6573
6600
|
"propertyTypeTokenRange": {
|
|
6574
6601
|
"startIndex": 1,
|
|
6575
|
-
"endIndex":
|
|
6602
|
+
"endIndex": 98
|
|
6576
6603
|
},
|
|
6577
6604
|
"isStatic": false,
|
|
6578
6605
|
"isProtected": true,
|
|
@@ -7,6 +7,7 @@ import { AnyActorRef } from 'xstate';
|
|
|
7
7
|
import { AnyState } from 'xstate';
|
|
8
8
|
import { Assigner } from 'xstate';
|
|
9
9
|
import { BindingObserver } from '@microsoft/fast-element';
|
|
10
|
+
import { BooleanGuardDefinition } from 'xstate';
|
|
10
11
|
import { ComposableStyles } from '@microsoft/fast-element';
|
|
11
12
|
import { Constructable } from '@microsoft/fast-element';
|
|
12
13
|
import { Container } from '@microsoft/fast-foundation';
|
|
@@ -1073,6 +1074,9 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
1073
1074
|
onDone: ({
|
|
1074
1075
|
actions: string[];
|
|
1075
1076
|
target: string;
|
|
1077
|
+
} | {
|
|
1078
|
+
guard: BooleanGuardDefinition<MachineContext_2, EventObject>;
|
|
1079
|
+
target: string;
|
|
1076
1080
|
} | {
|
|
1077
1081
|
guard: string;
|
|
1078
1082
|
target: string;
|
|
@@ -1111,6 +1115,10 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
1111
1115
|
}) => void;
|
|
1112
1116
|
}[];
|
|
1113
1117
|
};
|
|
1118
|
+
/**
|
|
1119
|
+
* A 401 here is the normal logged-out answer, so it completes the fetch rather than failing it.
|
|
1120
|
+
*/
|
|
1121
|
+
private createLoginDetailsFetchEvent;
|
|
1114
1122
|
}
|
|
1115
1123
|
|
|
1116
1124
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-auth",
|
|
3
3
|
"description": "Genesis Foundation Auth",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.95.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-auth.d.ts",
|
|
@@ -129,24 +129,24 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@genesislcap/foundation-testing": "15.
|
|
133
|
-
"@genesislcap/genx": "15.
|
|
134
|
-
"@genesislcap/ts-builder": "15.
|
|
135
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
136
|
-
"@genesislcap/vite-builder": "15.
|
|
137
|
-
"@genesislcap/webpack-builder": "15.
|
|
132
|
+
"@genesislcap/foundation-testing": "15.95.0",
|
|
133
|
+
"@genesislcap/genx": "15.95.0",
|
|
134
|
+
"@genesislcap/ts-builder": "15.95.0",
|
|
135
|
+
"@genesislcap/uvu-playwright-builder": "15.95.0",
|
|
136
|
+
"@genesislcap/vite-builder": "15.95.0",
|
|
137
|
+
"@genesislcap/webpack-builder": "15.95.0"
|
|
138
138
|
},
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@genesislcap/foundation-comms": "15.
|
|
141
|
-
"@genesislcap/foundation-events": "15.
|
|
142
|
-
"@genesislcap/foundation-i18n": "15.
|
|
143
|
-
"@genesislcap/foundation-logger": "15.
|
|
144
|
-
"@genesislcap/foundation-state-machine": "15.
|
|
145
|
-
"@genesislcap/foundation-store": "15.
|
|
146
|
-
"@genesislcap/foundation-ui": "15.
|
|
147
|
-
"@genesislcap/foundation-user": "15.
|
|
148
|
-
"@genesislcap/foundation-utils": "15.
|
|
149
|
-
"@genesislcap/rapid-design-system": "15.
|
|
140
|
+
"@genesislcap/foundation-comms": "15.95.0",
|
|
141
|
+
"@genesislcap/foundation-events": "15.95.0",
|
|
142
|
+
"@genesislcap/foundation-i18n": "15.95.0",
|
|
143
|
+
"@genesislcap/foundation-logger": "15.95.0",
|
|
144
|
+
"@genesislcap/foundation-state-machine": "15.95.0",
|
|
145
|
+
"@genesislcap/foundation-store": "15.95.0",
|
|
146
|
+
"@genesislcap/foundation-ui": "15.95.0",
|
|
147
|
+
"@genesislcap/foundation-user": "15.95.0",
|
|
148
|
+
"@genesislcap/foundation-utils": "15.95.0",
|
|
149
|
+
"@genesislcap/rapid-design-system": "15.95.0",
|
|
150
150
|
"@microsoft/fast-components": "2.30.6",
|
|
151
151
|
"@microsoft/fast-element": "1.14.0",
|
|
152
152
|
"@microsoft/fast-foundation": "2.50.0",
|