@genesislcap/foundation-state-machine 14.71.1-auth-mf.3 → 14.71.1-auth-mf.4
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/dist/dts/core/actions.d.ts +1 -1
- package/dist/dts/core/actions.d.ts.map +1 -1
- package/dist/dts/core/errors.d.ts +2 -2
- package/dist/dts/core/errors.d.ts.map +1 -1
- package/dist/dts/core/state.d.ts.map +1 -1
- package/dist/dts/machines/fetch/errors.d.ts +15 -3
- package/dist/dts/machines/fetch/errors.d.ts.map +1 -1
- package/dist/esm/core/actions.js +2 -5
- package/dist/esm/core/state.js +18 -6
- package/dist/esm/machines/fetch/errors.js +12 -0
- package/dist/foundation-state-machine.api.json +150 -12
- package/dist/foundation-state-machine.d.ts +19 -6
- package/docs/api/foundation-state-machine.apierror.isunauthorized.md +16 -0
- package/docs/api/foundation-state-machine.apierror.md +6 -0
- package/docs/api/foundation-state-machine.escalateerror.md +1 -1
- package/docs/api/foundation-state-machine.isapierror.md +3 -1
- package/docs/api/foundation-state-machine.isgenesisservererror.md +1 -1
- package/docs/api/foundation-state-machine.ismappingerror.md +1 -1
- package/docs/api/foundation-state-machine.isnetworkerror.md +1 -1
- package/docs/api/foundation-state-machine.isnotfounderror.md +1 -1
- package/docs/api/foundation-state-machine.isunauthorizederror.md +13 -0
- package/docs/api/foundation-state-machine.md +3 -2
- package/docs/api-report.md +13 -6
- package/package.json +6 -6
|
@@ -28,7 +28,7 @@ export declare const setErrorByKey: (key: string) => {
|
|
|
28
28
|
}) => import("xstate").AnyState[];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* Escalate error action.
|
|
31
|
+
* Escalate context error action.
|
|
32
32
|
* @remarks
|
|
33
33
|
* Guard this call with a parent check to avoid warnings when there's no parent.
|
|
34
34
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/core/actions.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;CAOnB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM;;;;;;;CASrC,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/core/actions.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;CAOnB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM;;;;;;;CASrC,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;CAA2C,CAAC"}
|
|
@@ -24,7 +24,7 @@ export declare class GenesisServerError extends Error {
|
|
|
24
24
|
* @param error - An error.
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
export declare const isGenesisServerError: (error: unknown) =>
|
|
27
|
+
export declare const isGenesisServerError: (error: unknown) => error is GenesisServerError;
|
|
28
28
|
/**
|
|
29
29
|
* MappingError.
|
|
30
30
|
* @public
|
|
@@ -37,5 +37,5 @@ export declare class MappingError extends Error {
|
|
|
37
37
|
* @param error - An error.
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
|
-
export declare const isMappingError: (error: unknown) =>
|
|
40
|
+
export declare const isMappingError: (error: unknown) => error is MappingError;
|
|
41
41
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAElC,IAAI,CAAC,EAAE,OAAO;IACd,QAAQ,CAAC,EAAE,OAAO;gBADlB,IAAI,CAAC,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,OAAO,EACzB,OAAO,GAAE,MAAwC;IAOnD;;;;OAIG;IACH,gBAAgB;IAUhB,eAAe;IAMf,eAAe,IAAI,MAAM;IAMzB,YAAY,CAAC,IAAI,EAAE,MAAM;IAMzB,OAAO,CAAC,oBAAoB;CAG7B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,UAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAElC,IAAI,CAAC,EAAE,OAAO;IACd,QAAQ,CAAC,EAAE,OAAO;gBADlB,IAAI,CAAC,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,OAAO,EACzB,OAAO,GAAE,MAAwC;IAOnD;;;;OAIG;IACH,gBAAgB;IAUhB,eAAe;IAMf,eAAe,IAAI,MAAM;IAMzB,YAAY,CAAC,IAAI,EAAE,MAAM;IAMzB,OAAO,CAAC,oBAAoB;CAG7B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,UAAW,OAAO,gCACd,CAAC;AAEtC;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAE5B,GAAG,CAAC,EAAE,OAAO;gBAAb,GAAG,CAAC,EAAE,OAAO,EACpB,OAAO,GAAE,MAAiC;CAM7C;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,UAAW,OAAO,0BACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAC1B,MAAM,gBACG,MAAM,UACb,OAAO,KACb,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CA4BpC,CAAC"}
|
|
@@ -18,22 +18,34 @@ export declare class APIError extends Error {
|
|
|
18
18
|
status: number;
|
|
19
19
|
data?: unknown;
|
|
20
20
|
constructor(status: number, data?: unknown, message?: string);
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
isUnauthorized(): boolean;
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
27
|
+
* isAPIError.
|
|
23
28
|
* @param error - An error.
|
|
24
29
|
* @public
|
|
25
30
|
*/
|
|
26
|
-
export declare const isAPIError: (error: unknown) =>
|
|
31
|
+
export declare const isAPIError: (error: unknown) => error is APIError;
|
|
27
32
|
/**
|
|
28
33
|
* @param error - An error.
|
|
29
34
|
* @public
|
|
30
35
|
*/
|
|
31
|
-
export declare const isNetworkError: (error: unknown) =>
|
|
36
|
+
export declare const isNetworkError: (error: unknown) => error is NetworkError;
|
|
32
37
|
/**
|
|
33
38
|
* @param error - An error.
|
|
34
39
|
* @public
|
|
35
40
|
*/
|
|
36
41
|
export declare const isNotFoundError: (error: {
|
|
37
42
|
status?: number;
|
|
38
|
-
}) =>
|
|
43
|
+
}) => error is APIError;
|
|
44
|
+
/**
|
|
45
|
+
* @param error - An error.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare const isUnauthorizedError: (error: {
|
|
49
|
+
status?: number;
|
|
50
|
+
}) => error is APIError;
|
|
39
51
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/machines/fetch/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAE5B,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM,EAClB,OAAO,GAAE,MAAiC;CAM7C;AAED;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAExB,MAAM,EAAE,MAAM;IACd,IAAI,CAAC,EAAE,OAAO;gBADd,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,EACrB,OAAO,GAAE,MAA6B;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/machines/fetch/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAE5B,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM,EAClB,OAAO,GAAE,MAAiC;CAM7C;AAED;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAExB,MAAM,EAAE,MAAM;IACd,IAAI,CAAC,EAAE,OAAO;gBADd,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,EACrB,OAAO,GAAE,MAA6B;IAOxC;;OAEG;IACH,cAAc;CAGf;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAAW,OAAO,sBAAiD,CAAC;AAE3F;;;GAGG;AACH,eAAO,MAAM,cAAc,UAAW,OAAO,0BAEwB,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAW;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,sBACG,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAW;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,sBACjB,CAAC"}
|
package/dist/esm/core/actions.js
CHANGED
|
@@ -35,12 +35,9 @@ export const setErrorByKey = (key) => assign(({ context, event }) => {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
/**
|
|
38
|
-
* Escalate error action.
|
|
38
|
+
* Escalate context error action.
|
|
39
39
|
* @remarks
|
|
40
40
|
* Guard this call with a parent check to avoid warnings when there's no parent.
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
export const escalateError = escalate(({ context }) =>
|
|
44
|
-
error: context.error,
|
|
45
|
-
data: context.error,
|
|
46
|
-
}));
|
|
43
|
+
export const escalateError = escalate(({ context }) => context.error);
|
package/dist/esm/core/state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setErrorByKey } from './actions';
|
|
1
|
+
import { escalateError, setErrorByKey } from './actions';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an error state node.
|
|
4
4
|
*
|
|
@@ -8,19 +8,31 @@ import { setErrorByKey } from './actions';
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export const createErrorStateNode = (key, metaContent, final = true) => {
|
|
11
|
+
/**
|
|
12
|
+
* Raised question on reuse and dynamic parent detection, regarding error escalation.
|
|
13
|
+
* https://github.com/statelyai/xstate/discussions/4268
|
|
14
|
+
*/
|
|
15
|
+
let hasParentMachine = false;
|
|
16
|
+
let sentToParentMachine = false;
|
|
11
17
|
return {
|
|
12
18
|
tags: ['error', key],
|
|
13
19
|
meta: {
|
|
14
20
|
content: metaContent ? metaContent : `${key} error.`,
|
|
15
21
|
},
|
|
16
|
-
entry: [
|
|
22
|
+
entry: [
|
|
23
|
+
setErrorByKey(`${key}-error`),
|
|
24
|
+
(args) => (hasParentMachine = args.self._parent !== undefined),
|
|
25
|
+
],
|
|
26
|
+
always: [
|
|
27
|
+
{
|
|
28
|
+
guard: () => hasParentMachine && !sentToParentMachine,
|
|
29
|
+
actions: [escalateError, () => (sentToParentMachine = true)],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
17
32
|
/**
|
|
18
33
|
* Provide final output to parent machines.
|
|
19
34
|
*/
|
|
20
35
|
type: final ? 'final' : 'atomic',
|
|
21
|
-
output: ({ context }) =>
|
|
22
|
-
error: context.error,
|
|
23
|
-
data: context.error,
|
|
24
|
-
}),
|
|
36
|
+
output: ({ context }) => context.error,
|
|
25
37
|
};
|
|
26
38
|
};
|
|
@@ -27,8 +27,15 @@ export class APIError extends Error {
|
|
|
27
27
|
this.name = 'APIError';
|
|
28
28
|
Object.setPrototypeOf(this, APIError.prototype);
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
isUnauthorized() {
|
|
34
|
+
return this.status === StatusCodes.UNAUTHORIZED;
|
|
35
|
+
}
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
38
|
+
* isAPIError.
|
|
32
39
|
* @param error - An error.
|
|
33
40
|
* @public
|
|
34
41
|
*/
|
|
@@ -44,3 +51,8 @@ export const isNetworkError = (error) => error instanceof NetworkError ||
|
|
|
44
51
|
* @public
|
|
45
52
|
*/
|
|
46
53
|
export const isNotFoundError = (error) => isAPIError(error) && error.status === StatusCodes.NOT_FOUND;
|
|
54
|
+
/**
|
|
55
|
+
* @param error - An error.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export const isUnauthorizedError = (error) => isAPIError(error) && error.isUnauthorized();
|
|
@@ -1364,6 +1364,37 @@
|
|
|
1364
1364
|
"isProtected": false,
|
|
1365
1365
|
"isAbstract": false
|
|
1366
1366
|
},
|
|
1367
|
+
{
|
|
1368
|
+
"kind": "Method",
|
|
1369
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!APIError#isUnauthorized:member(1)",
|
|
1370
|
+
"docComment": "/**\n * @public\n */\n",
|
|
1371
|
+
"excerptTokens": [
|
|
1372
|
+
{
|
|
1373
|
+
"kind": "Content",
|
|
1374
|
+
"text": "isUnauthorized(): "
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
"kind": "Content",
|
|
1378
|
+
"text": "boolean"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
"kind": "Content",
|
|
1382
|
+
"text": ";"
|
|
1383
|
+
}
|
|
1384
|
+
],
|
|
1385
|
+
"isStatic": false,
|
|
1386
|
+
"returnTypeTokenRange": {
|
|
1387
|
+
"startIndex": 1,
|
|
1388
|
+
"endIndex": 2
|
|
1389
|
+
},
|
|
1390
|
+
"releaseTag": "Public",
|
|
1391
|
+
"isProtected": false,
|
|
1392
|
+
"overloadIndex": 1,
|
|
1393
|
+
"parameters": [],
|
|
1394
|
+
"isOptional": false,
|
|
1395
|
+
"isAbstract": false,
|
|
1396
|
+
"name": "isUnauthorized"
|
|
1397
|
+
},
|
|
1367
1398
|
{
|
|
1368
1399
|
"kind": "Property",
|
|
1369
1400
|
"canonicalReference": "@genesislcap/foundation-state-machine!APIError#status:member",
|
|
@@ -2158,7 +2189,7 @@
|
|
|
2158
2189
|
{
|
|
2159
2190
|
"kind": "Variable",
|
|
2160
2191
|
"canonicalReference": "@genesislcap/foundation-state-machine!escalateError:var",
|
|
2161
|
-
"docComment": "/**\n * Escalate error action.\n *\n * @remarks\n *\n * Guard this call with a parent check to avoid warnings when there's no parent.\n *\n * @public\n */\n",
|
|
2192
|
+
"docComment": "/**\n * Escalate context error action.\n *\n * @remarks\n *\n * Guard this call with a parent check to avoid warnings when there's no parent.\n *\n * @public\n */\n",
|
|
2162
2193
|
"excerptTokens": [
|
|
2163
2194
|
{
|
|
2164
2195
|
"kind": "Content",
|
|
@@ -3410,7 +3441,7 @@
|
|
|
3410
3441
|
{
|
|
3411
3442
|
"kind": "Variable",
|
|
3412
3443
|
"canonicalReference": "@genesislcap/foundation-state-machine!isAPIError:var",
|
|
3413
|
-
"docComment": "/**\n * @param error - An error.\n *\n * @public\n */\n",
|
|
3444
|
+
"docComment": "/**\n * isAPIError.\n *\n * @param error - An error.\n *\n * @public\n */\n",
|
|
3414
3445
|
"excerptTokens": [
|
|
3415
3446
|
{
|
|
3416
3447
|
"kind": "Content",
|
|
@@ -3418,7 +3449,21 @@
|
|
|
3418
3449
|
},
|
|
3419
3450
|
{
|
|
3420
3451
|
"kind": "Content",
|
|
3421
|
-
"text": "(error: unknown) =>
|
|
3452
|
+
"text": "(error: unknown) => "
|
|
3453
|
+
},
|
|
3454
|
+
{
|
|
3455
|
+
"kind": "Reference",
|
|
3456
|
+
"text": "error",
|
|
3457
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~error"
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
"kind": "Content",
|
|
3461
|
+
"text": " is "
|
|
3462
|
+
},
|
|
3463
|
+
{
|
|
3464
|
+
"kind": "Reference",
|
|
3465
|
+
"text": "APIError",
|
|
3466
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!APIError:class"
|
|
3422
3467
|
}
|
|
3423
3468
|
],
|
|
3424
3469
|
"fileUrlPath": "src/machines/fetch/errors.ts",
|
|
@@ -3427,7 +3472,7 @@
|
|
|
3427
3472
|
"name": "isAPIError",
|
|
3428
3473
|
"variableTypeTokenRange": {
|
|
3429
3474
|
"startIndex": 1,
|
|
3430
|
-
"endIndex":
|
|
3475
|
+
"endIndex": 5
|
|
3431
3476
|
}
|
|
3432
3477
|
},
|
|
3433
3478
|
{
|
|
@@ -3650,7 +3695,21 @@
|
|
|
3650
3695
|
},
|
|
3651
3696
|
{
|
|
3652
3697
|
"kind": "Content",
|
|
3653
|
-
"text": "(error: unknown) =>
|
|
3698
|
+
"text": "(error: unknown) => "
|
|
3699
|
+
},
|
|
3700
|
+
{
|
|
3701
|
+
"kind": "Reference",
|
|
3702
|
+
"text": "error",
|
|
3703
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~error"
|
|
3704
|
+
},
|
|
3705
|
+
{
|
|
3706
|
+
"kind": "Content",
|
|
3707
|
+
"text": " is "
|
|
3708
|
+
},
|
|
3709
|
+
{
|
|
3710
|
+
"kind": "Reference",
|
|
3711
|
+
"text": "GenesisServerError",
|
|
3712
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!GenesisServerError:class"
|
|
3654
3713
|
}
|
|
3655
3714
|
],
|
|
3656
3715
|
"fileUrlPath": "src/core/errors.ts",
|
|
@@ -3659,7 +3718,7 @@
|
|
|
3659
3718
|
"name": "isGenesisServerError",
|
|
3660
3719
|
"variableTypeTokenRange": {
|
|
3661
3720
|
"startIndex": 1,
|
|
3662
|
-
"endIndex":
|
|
3721
|
+
"endIndex": 5
|
|
3663
3722
|
}
|
|
3664
3723
|
},
|
|
3665
3724
|
{
|
|
@@ -3673,7 +3732,21 @@
|
|
|
3673
3732
|
},
|
|
3674
3733
|
{
|
|
3675
3734
|
"kind": "Content",
|
|
3676
|
-
"text": "(error: unknown) =>
|
|
3735
|
+
"text": "(error: unknown) => "
|
|
3736
|
+
},
|
|
3737
|
+
{
|
|
3738
|
+
"kind": "Reference",
|
|
3739
|
+
"text": "error",
|
|
3740
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~error"
|
|
3741
|
+
},
|
|
3742
|
+
{
|
|
3743
|
+
"kind": "Content",
|
|
3744
|
+
"text": " is "
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
"kind": "Reference",
|
|
3748
|
+
"text": "MappingError",
|
|
3749
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!MappingError:class"
|
|
3677
3750
|
}
|
|
3678
3751
|
],
|
|
3679
3752
|
"fileUrlPath": "src/core/errors.ts",
|
|
@@ -3682,7 +3755,7 @@
|
|
|
3682
3755
|
"name": "isMappingError",
|
|
3683
3756
|
"variableTypeTokenRange": {
|
|
3684
3757
|
"startIndex": 1,
|
|
3685
|
-
"endIndex":
|
|
3758
|
+
"endIndex": 5
|
|
3686
3759
|
}
|
|
3687
3760
|
},
|
|
3688
3761
|
{
|
|
@@ -3696,7 +3769,21 @@
|
|
|
3696
3769
|
},
|
|
3697
3770
|
{
|
|
3698
3771
|
"kind": "Content",
|
|
3699
|
-
"text": "(error: unknown) =>
|
|
3772
|
+
"text": "(error: unknown) => "
|
|
3773
|
+
},
|
|
3774
|
+
{
|
|
3775
|
+
"kind": "Reference",
|
|
3776
|
+
"text": "error",
|
|
3777
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~error"
|
|
3778
|
+
},
|
|
3779
|
+
{
|
|
3780
|
+
"kind": "Content",
|
|
3781
|
+
"text": " is "
|
|
3782
|
+
},
|
|
3783
|
+
{
|
|
3784
|
+
"kind": "Reference",
|
|
3785
|
+
"text": "NetworkError",
|
|
3786
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!NetworkError:class"
|
|
3700
3787
|
}
|
|
3701
3788
|
],
|
|
3702
3789
|
"fileUrlPath": "src/machines/fetch/errors.ts",
|
|
@@ -3705,7 +3792,7 @@
|
|
|
3705
3792
|
"name": "isNetworkError",
|
|
3706
3793
|
"variableTypeTokenRange": {
|
|
3707
3794
|
"startIndex": 1,
|
|
3708
|
-
"endIndex":
|
|
3795
|
+
"endIndex": 5
|
|
3709
3796
|
}
|
|
3710
3797
|
},
|
|
3711
3798
|
{
|
|
@@ -3719,7 +3806,21 @@
|
|
|
3719
3806
|
},
|
|
3720
3807
|
{
|
|
3721
3808
|
"kind": "Content",
|
|
3722
|
-
"text": "(error: {\n status?: number;\n}) =>
|
|
3809
|
+
"text": "(error: {\n status?: number;\n}) => "
|
|
3810
|
+
},
|
|
3811
|
+
{
|
|
3812
|
+
"kind": "Reference",
|
|
3813
|
+
"text": "error",
|
|
3814
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~error"
|
|
3815
|
+
},
|
|
3816
|
+
{
|
|
3817
|
+
"kind": "Content",
|
|
3818
|
+
"text": " is "
|
|
3819
|
+
},
|
|
3820
|
+
{
|
|
3821
|
+
"kind": "Reference",
|
|
3822
|
+
"text": "APIError",
|
|
3823
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!APIError:class"
|
|
3723
3824
|
}
|
|
3724
3825
|
],
|
|
3725
3826
|
"fileUrlPath": "src/machines/fetch/errors.ts",
|
|
@@ -3728,7 +3829,7 @@
|
|
|
3728
3829
|
"name": "isNotFoundError",
|
|
3729
3830
|
"variableTypeTokenRange": {
|
|
3730
3831
|
"startIndex": 1,
|
|
3731
|
-
"endIndex":
|
|
3832
|
+
"endIndex": 5
|
|
3732
3833
|
}
|
|
3733
3834
|
},
|
|
3734
3835
|
{
|
|
@@ -3777,6 +3878,43 @@
|
|
|
3777
3878
|
"endIndex": 2
|
|
3778
3879
|
}
|
|
3779
3880
|
},
|
|
3881
|
+
{
|
|
3882
|
+
"kind": "Variable",
|
|
3883
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!isUnauthorizedError:var",
|
|
3884
|
+
"docComment": "/**\n * @param error - An error.\n *\n * @public\n */\n",
|
|
3885
|
+
"excerptTokens": [
|
|
3886
|
+
{
|
|
3887
|
+
"kind": "Content",
|
|
3888
|
+
"text": "isUnauthorizedError: "
|
|
3889
|
+
},
|
|
3890
|
+
{
|
|
3891
|
+
"kind": "Content",
|
|
3892
|
+
"text": "(error: {\n status?: number;\n}) => "
|
|
3893
|
+
},
|
|
3894
|
+
{
|
|
3895
|
+
"kind": "Reference",
|
|
3896
|
+
"text": "error",
|
|
3897
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~error"
|
|
3898
|
+
},
|
|
3899
|
+
{
|
|
3900
|
+
"kind": "Content",
|
|
3901
|
+
"text": " is "
|
|
3902
|
+
},
|
|
3903
|
+
{
|
|
3904
|
+
"kind": "Reference",
|
|
3905
|
+
"text": "APIError",
|
|
3906
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!APIError:class"
|
|
3907
|
+
}
|
|
3908
|
+
],
|
|
3909
|
+
"fileUrlPath": "src/machines/fetch/errors.ts",
|
|
3910
|
+
"isReadonly": true,
|
|
3911
|
+
"releaseTag": "Public",
|
|
3912
|
+
"name": "isUnauthorizedError",
|
|
3913
|
+
"variableTypeTokenRange": {
|
|
3914
|
+
"startIndex": 1,
|
|
3915
|
+
"endIndex": 5
|
|
3916
|
+
}
|
|
3917
|
+
},
|
|
3780
3918
|
{
|
|
3781
3919
|
"kind": "Variable",
|
|
3782
3920
|
"canonicalReference": "@genesislcap/foundation-state-machine!logger:var",
|
|
@@ -126,6 +126,10 @@ export declare class APIError extends Error {
|
|
|
126
126
|
status: number;
|
|
127
127
|
data?: unknown;
|
|
128
128
|
constructor(status: number, data?: unknown, message?: string);
|
|
129
|
+
/**
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
isUnauthorized(): boolean;
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
/**
|
|
@@ -240,7 +244,7 @@ export declare const errorWorkflowInput: (key: string) => ({ context }: {
|
|
|
240
244
|
}) => ErrorWorkflowInput;
|
|
241
245
|
|
|
242
246
|
/**
|
|
243
|
-
* Escalate error action.
|
|
247
|
+
* Escalate context error action.
|
|
244
248
|
* @remarks
|
|
245
249
|
* Guard this call with a parent check to avoid warnings when there's no parent.
|
|
246
250
|
* @public
|
|
@@ -429,10 +433,11 @@ export declare const isAbortError: ({ event }: {
|
|
|
429
433
|
export declare const isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent_2<TData>) => event is ErrorEvent_2<TData>;
|
|
430
434
|
|
|
431
435
|
/**
|
|
436
|
+
* isAPIError.
|
|
432
437
|
* @param error - An error.
|
|
433
438
|
* @public
|
|
434
439
|
*/
|
|
435
|
-
export declare const isAPIError: (error: unknown) =>
|
|
440
|
+
export declare const isAPIError: (error: unknown) => error is APIError;
|
|
436
441
|
|
|
437
442
|
/**
|
|
438
443
|
* isDoneInvokeEvent.
|
|
@@ -468,19 +473,19 @@ export declare const isErrorType: <TType extends ErrorConstructor>(type: TType)
|
|
|
468
473
|
* @param error - An error.
|
|
469
474
|
* @public
|
|
470
475
|
*/
|
|
471
|
-
export declare const isGenesisServerError: (error: unknown) =>
|
|
476
|
+
export declare const isGenesisServerError: (error: unknown) => error is GenesisServerError;
|
|
472
477
|
|
|
473
478
|
/**
|
|
474
479
|
* @param error - An error.
|
|
475
480
|
* @public
|
|
476
481
|
*/
|
|
477
|
-
export declare const isMappingError: (error: unknown) =>
|
|
482
|
+
export declare const isMappingError: (error: unknown) => error is MappingError;
|
|
478
483
|
|
|
479
484
|
/**
|
|
480
485
|
* @param error - An error.
|
|
481
486
|
* @public
|
|
482
487
|
*/
|
|
483
|
-
export declare const isNetworkError: (error: unknown) =>
|
|
488
|
+
export declare const isNetworkError: (error: unknown) => error is NetworkError;
|
|
484
489
|
|
|
485
490
|
/**
|
|
486
491
|
* @param error - An error.
|
|
@@ -488,7 +493,7 @@ export declare const isNetworkError: (error: unknown) => boolean;
|
|
|
488
493
|
*/
|
|
489
494
|
export declare const isNotFoundError: (error: {
|
|
490
495
|
status?: number;
|
|
491
|
-
}) =>
|
|
496
|
+
}) => error is APIError;
|
|
492
497
|
|
|
493
498
|
/**
|
|
494
499
|
* isSyntaxError.
|
|
@@ -506,6 +511,14 @@ export declare const isTypeError: ({ event }: {
|
|
|
506
511
|
event: any;
|
|
507
512
|
}) => boolean;
|
|
508
513
|
|
|
514
|
+
/**
|
|
515
|
+
* @param error - An error.
|
|
516
|
+
* @public
|
|
517
|
+
*/
|
|
518
|
+
export declare const isUnauthorizedError: (error: {
|
|
519
|
+
status?: number;
|
|
520
|
+
}) => error is APIError;
|
|
521
|
+
|
|
509
522
|
/**
|
|
510
523
|
* @public
|
|
511
524
|
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [APIError](./foundation-state-machine.apierror.md) > [isUnauthorized](./foundation-state-machine.apierror.isunauthorized.md)
|
|
4
|
+
|
|
5
|
+
## APIError.isUnauthorized() method
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
isUnauthorized(): boolean;
|
|
12
|
+
```
|
|
13
|
+
**Returns:**
|
|
14
|
+
|
|
15
|
+
boolean
|
|
16
|
+
|
|
@@ -30,3 +30,9 @@ Bad server `Response`<!-- -->.
|
|
|
30
30
|
| [data?](./foundation-state-machine.apierror.data.md) | | unknown | _(Optional)_ |
|
|
31
31
|
| [status](./foundation-state-machine.apierror.status.md) | | number | |
|
|
32
32
|
|
|
33
|
+
## Methods
|
|
34
|
+
|
|
35
|
+
| Method | Modifiers | Description |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| [isUnauthorized()](./foundation-state-machine.apierror.isunauthorized.md) | | |
|
|
38
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [isUnauthorizedError](./foundation-state-machine.isunauthorizederror.md)
|
|
4
|
+
|
|
5
|
+
## isUnauthorizedError variable
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
isUnauthorizedError: (error: {
|
|
11
|
+
status?: number;
|
|
12
|
+
}) => error is APIError
|
|
13
|
+
```
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
| [defaultResponseOkChecker](./foundation-state-machine.defaultresponseokchecker.md) | ResponseOkChecker type. |
|
|
51
51
|
| [defaultRetryStatsCodes](./foundation-state-machine.defaultretrystatscodes.md) | Default retry stats codes. |
|
|
52
52
|
| [errorWorkflowInput](./foundation-state-machine.errorworkflowinput.md) | Error workflow input. |
|
|
53
|
-
| [escalateError](./foundation-state-machine.escalateerror.md) | Escalate error action. |
|
|
53
|
+
| [escalateError](./foundation-state-machine.escalateerror.md) | Escalate context error action. |
|
|
54
54
|
| [isAbortError](./foundation-state-machine.isaborterror.md) | isAbortError. |
|
|
55
55
|
| [isActorErrorEvent](./foundation-state-machine.isactorerrorevent.md) | isActorErrorEvent. |
|
|
56
|
-
| [isAPIError](./foundation-state-machine.isapierror.md) |
|
|
56
|
+
| [isAPIError](./foundation-state-machine.isapierror.md) | isAPIError. |
|
|
57
57
|
| [isDoneInvokeEvent](./foundation-state-machine.isdoneinvokeevent.md) | isDoneInvokeEvent. |
|
|
58
58
|
| [isErrorCustomEvent](./foundation-state-machine.iserrorcustomevent.md) | isErrorCustomEvent. |
|
|
59
59
|
| [isErrorEvent](./foundation-state-machine.iserrorevent.md) | isErrorEvent. |
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
| [isNotFoundError](./foundation-state-machine.isnotfounderror.md) | |
|
|
65
65
|
| [isSyntaxError](./foundation-state-machine.issyntaxerror.md) | isSyntaxError. |
|
|
66
66
|
| [isTypeError](./foundation-state-machine.istypeerror.md) | isTypeError. |
|
|
67
|
+
| [isUnauthorizedError](./foundation-state-machine.isunauthorizederror.md) | |
|
|
67
68
|
| [logger](./foundation-state-machine.logger.md) | |
|
|
68
69
|
| [setError](./foundation-state-machine.seterror.md) | Set error action. |
|
|
69
70
|
| [setErrorByKey](./foundation-state-machine.seterrorbykey.md) | Set error by key action. |
|
package/docs/api-report.md
CHANGED
|
@@ -91,6 +91,8 @@ export class APIError extends Error {
|
|
|
91
91
|
// (undocumented)
|
|
92
92
|
data?: unknown;
|
|
93
93
|
// (undocumented)
|
|
94
|
+
isUnauthorized(): boolean;
|
|
95
|
+
// (undocumented)
|
|
94
96
|
status: number;
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -253,8 +255,8 @@ export const isAbortError: ({ event }: {
|
|
|
253
255
|
// @public
|
|
254
256
|
export const isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent_2<TData>) => event is ErrorEvent_2<TData>;
|
|
255
257
|
|
|
256
|
-
// @public
|
|
257
|
-
export const isAPIError: (error: unknown) =>
|
|
258
|
+
// @public
|
|
259
|
+
export const isAPIError: (error: unknown) => error is APIError;
|
|
258
260
|
|
|
259
261
|
// @public
|
|
260
262
|
export const isDoneInvokeEvent: <TData = any>(event: EventObject | DoneInvokeEvent<TData>) => event is DoneInvokeEvent<TData>;
|
|
@@ -269,18 +271,18 @@ export const isErrorEvent: <TData = any>(event: EventObject | ErrorEvent_2<TData
|
|
|
269
271
|
export const isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean;
|
|
270
272
|
|
|
271
273
|
// @public (undocumented)
|
|
272
|
-
export const isGenesisServerError: (error: unknown) =>
|
|
274
|
+
export const isGenesisServerError: (error: unknown) => error is GenesisServerError;
|
|
273
275
|
|
|
274
276
|
// @public (undocumented)
|
|
275
|
-
export const isMappingError: (error: unknown) =>
|
|
277
|
+
export const isMappingError: (error: unknown) => error is MappingError;
|
|
276
278
|
|
|
277
279
|
// @public (undocumented)
|
|
278
|
-
export const isNetworkError: (error: unknown) =>
|
|
280
|
+
export const isNetworkError: (error: unknown) => error is NetworkError;
|
|
279
281
|
|
|
280
282
|
// @public (undocumented)
|
|
281
283
|
export const isNotFoundError: (error: {
|
|
282
284
|
status?: number;
|
|
283
|
-
}) =>
|
|
285
|
+
}) => error is APIError;
|
|
284
286
|
|
|
285
287
|
// @public
|
|
286
288
|
export const isSyntaxError: ({ event }: {
|
|
@@ -292,6 +294,11 @@ export const isTypeError: ({ event }: {
|
|
|
292
294
|
event: any;
|
|
293
295
|
}) => boolean;
|
|
294
296
|
|
|
297
|
+
// @public (undocumented)
|
|
298
|
+
export const isUnauthorizedError: (error: {
|
|
299
|
+
status?: number;
|
|
300
|
+
}) => error is APIError;
|
|
301
|
+
|
|
295
302
|
// @public (undocumented)
|
|
296
303
|
export const logger: Logger;
|
|
297
304
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-state-machine",
|
|
3
3
|
"description": "Genesis Foundation State Machine",
|
|
4
|
-
"version": "14.71.1-auth-mf.
|
|
4
|
+
"version": "14.71.1-auth-mf.4",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test": "genx test"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@genesislcap/foundation-testing": "14.71.1-auth-mf.
|
|
38
|
-
"@genesislcap/genx": "14.71.1-auth-mf.
|
|
37
|
+
"@genesislcap/foundation-testing": "14.71.1-auth-mf.4",
|
|
38
|
+
"@genesislcap/genx": "14.71.1-auth-mf.4",
|
|
39
39
|
"rimraf": "^3.0.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@genesislcap/foundation-comms": "14.71.1-auth-mf.
|
|
43
|
-
"@genesislcap/foundation-utils": "14.71.1-auth-mf.
|
|
42
|
+
"@genesislcap/foundation-comms": "14.71.1-auth-mf.4",
|
|
43
|
+
"@genesislcap/foundation-utils": "14.71.1-auth-mf.4",
|
|
44
44
|
"@microsoft/fast-element": "^1.7.0",
|
|
45
45
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
46
46
|
"cockatiel": "^3.1.1",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "349e46c5dc26cf11b292dc5cc9c24e88908f3333"
|
|
60
60
|
}
|