@auth0/ai 5.0.0 → 5.0.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.
- package/dist/cjs/interrupts/AsyncAuthorizationInterrupt.js +7 -7
- package/dist/cjs/interrupts/AsyncAuthorizationInterrupt.js.map +1 -1
- package/dist/cjs/interrupts/TokenVaultInterrupt.js +1 -1
- package/dist/cjs/interrupts/TokenVaultInterrupt.js.map +1 -1
- package/dist/esm/interrupts/AsyncAuthorizationInterrupt.js +7 -7
- package/dist/esm/interrupts/AsyncAuthorizationInterrupt.js.map +1 -1
- package/dist/esm/interrupts/TokenVaultInterrupt.d.ts +1 -1
- package/dist/esm/interrupts/TokenVaultInterrupt.js +1 -1
- package/dist/esm/interrupts/TokenVaultInterrupt.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ class AsyncAuthorizationInterrupt extends Auth0Interrupt_1.Auth0Interrupt {
|
|
|
14
14
|
Auth0Interrupt_1.Auth0Interrupt.isInterrupt(interrupt) &&
|
|
15
15
|
typeof interrupt.code === "string" &&
|
|
16
16
|
(this.code === interrupt.code ||
|
|
17
|
-
(!this.code && interrupt.code.startsWith("
|
|
17
|
+
(!this.code && interrupt.code.startsWith("ASYNC_AUTHORIZATION_"))));
|
|
18
18
|
}
|
|
19
19
|
static hasRequestData(interrupt) {
|
|
20
20
|
return AsyncAuthorizationInterrupt.isInterrupt(interrupt) && "request" in interrupt;
|
|
@@ -31,7 +31,7 @@ class AccessDeniedInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.AccessDeniedInterrupt = AccessDeniedInterrupt;
|
|
34
|
-
AccessDeniedInterrupt.code = "
|
|
34
|
+
AccessDeniedInterrupt.code = "ASYNC_AUTHORIZATION_ACCESS_DENIED";
|
|
35
35
|
/**
|
|
36
36
|
* An interrupt that is thrown when the user does not have push notifications enabled.
|
|
37
37
|
*/
|
|
@@ -41,7 +41,7 @@ class UserDoesNotHavePushNotificationsInterrupt extends AsyncAuthorizationInterr
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.UserDoesNotHavePushNotificationsInterrupt = UserDoesNotHavePushNotificationsInterrupt;
|
|
44
|
-
UserDoesNotHavePushNotificationsInterrupt.code = "
|
|
44
|
+
UserDoesNotHavePushNotificationsInterrupt.code = "ASYNC_AUTHORIZATION_USER_DOES_NOT_HAVE_PUSH_NOTIFICATIONS";
|
|
45
45
|
/**
|
|
46
46
|
* An interrupt that is thrown when the authorization request has expired.
|
|
47
47
|
*/
|
|
@@ -52,7 +52,7 @@ class AuthorizationRequestExpiredInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
exports.AuthorizationRequestExpiredInterrupt = AuthorizationRequestExpiredInterrupt;
|
|
55
|
-
AuthorizationRequestExpiredInterrupt.code = "
|
|
55
|
+
AuthorizationRequestExpiredInterrupt.code = "ASYNC_AUTHORIZATION_AUTHORIZATION_REQUEST_EXPIRED";
|
|
56
56
|
/**
|
|
57
57
|
* An interrupt that is thrown when the authorization is still pending
|
|
58
58
|
* and the Authorizer is in `mode: interrupt`.
|
|
@@ -70,7 +70,7 @@ class AuthorizationPendingInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.AuthorizationPendingInterrupt = AuthorizationPendingInterrupt;
|
|
73
|
-
AuthorizationPendingInterrupt.code = "
|
|
73
|
+
AuthorizationPendingInterrupt.code = "ASYNC_AUTHORIZATION_AUTHORIZATION_PENDING";
|
|
74
74
|
/**
|
|
75
75
|
* An interrupt that is thrown when the authorization polling fails.
|
|
76
76
|
*/
|
|
@@ -88,7 +88,7 @@ class AuthorizationPollingInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
exports.AuthorizationPollingInterrupt = AuthorizationPollingInterrupt;
|
|
91
|
-
AuthorizationPollingInterrupt.code = "
|
|
91
|
+
AuthorizationPollingInterrupt.code = "ASYNC_AUTHORIZATION_AUTHORIZATION_POLLING_ERROR";
|
|
92
92
|
/**
|
|
93
93
|
* An interrupt that is thrown when the authorization polling fails.
|
|
94
94
|
*/
|
|
@@ -99,5 +99,5 @@ class InvalidGrantInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
exports.InvalidGrantInterrupt = InvalidGrantInterrupt;
|
|
102
|
-
InvalidGrantInterrupt.code = "
|
|
102
|
+
InvalidGrantInterrupt.code = "ASYNC_AUTHORIZATION_INVALID_GRANT";
|
|
103
103
|
//# sourceMappingURL=AsyncAuthorizationInterrupt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncAuthorizationInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/AsyncAuthorizationInterrupt.ts"],"names":[],"mappings":";;;AACA,qDAAsE;AAMtE;;GAEG;AACH,MAAa,2BAA4B,SAAQ,+BAAc;IAC7D,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS;YACT,+BAAc,CAAC,WAAW,CAAC,SAAS,CAAC;YACrC,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;YAClC,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;gBAC3B,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"AsyncAuthorizationInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/AsyncAuthorizationInterrupt.ts"],"names":[],"mappings":";;;AACA,qDAAsE;AAMtE;;GAEG;AACH,MAAa,2BAA4B,SAAQ,+BAAc;IAC7D,YAAY,OAAe,EAA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Q,2BAA2B;IAInC,YACE,OAAe,EACC,OAAkC;QAElD,KAAK,CAAC,OAAO,EAAE,6BAA6B,CAAC,IAAI,CAAC,CAAC;QAFnC,YAAO,GAAP,OAAO,CAA2B;IAGpD,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,CAAC;;AAjBH,sEAkBC;AAde,kCAAI,GAAW,2CAAoD,CAAC;AAgBpF;;GAEG;AACH,MAAa,6BACX,SAAQ,2BAA2B;IAInC,YACE,OAAe,EACC,OAAkC,EAClC,UAAkB;QAElC,KAAK,CAAC,OAAO,EAAE,6BAA6B,CAAC,IAAI,CAAC,CAAC;QAHnC,YAAO,GAAP,OAAO,CAA2B;QAClC,eAAU,GAAV,UAAU,CAAQ;IAGpC,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAClD,CAAC;;AAlBH,sEAmBC;AAfe,kCAAI,GAAW,iDAA0D,CAAC;AAiB1F;;GAEG;AACH,MAAa,qBACX,SAAQ,2BAA2B;IAInC,YACE,OAAe,EACC,OAAkC;QAElD,KAAK,CAAC,OAAO,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAF3B,YAAO,GAAP,OAAO,CAA2B;IAGpD,CAAC;;AAVH,sDAWC;AAPe,0BAAI,GAAW,mCAA4C,CAAC","sourcesContent":["import { AsyncAuthorizationRequest } from \"../authorizers/async-authorization/AsyncAuthorizationRequest\";\nimport { Auth0Interrupt, Auth0InterruptData } from \"./Auth0Interrupt\";\n\nexport interface WithRequestData {\n request: AsyncAuthorizationRequest;\n}\n\n/**\n * Base class for Async Authorization interrupts.\n */\nexport class AsyncAuthorizationInterrupt extends Auth0Interrupt {\n constructor(message: string, code: string) {\n super(message, code);\n }\n\n static isInterrupt<T extends abstract new (...args: any) => any>(\n this: T & { code?: string },\n interrupt: any\n ): interrupt is Auth0InterruptData<InstanceType<T>> {\n return (\n interrupt &&\n Auth0Interrupt.isInterrupt(interrupt) &&\n typeof interrupt.code === \"string\" &&\n (this.code === interrupt.code ||\n (!this.code && interrupt.code.startsWith(\"ASYNC_AUTHORIZATION_\")))\n );\n }\n\n static hasRequestData(interrupt: any): interrupt is WithRequestData {\n return AsyncAuthorizationInterrupt.isInterrupt(interrupt) && \"request\" in interrupt;\n }\n}\n\n/**\n * An interrupt that is thrown when the user denies the authorization request.\n */\nexport class AccessDeniedInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_ACCESS_DENIED\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, AccessDeniedInterrupt.code);\n }\n}\n\n/**\n * An interrupt that is thrown when the user does not have push notifications enabled.\n */\nexport class UserDoesNotHavePushNotificationsInterrupt extends AsyncAuthorizationInterrupt {\n public static code: string =\n \"ASYNC_AUTHORIZATION_USER_DOES_NOT_HAVE_PUSH_NOTIFICATIONS\" as const;\n constructor(message: string) {\n super(message, UserDoesNotHavePushNotificationsInterrupt.code);\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization request has expired.\n */\nexport class AuthorizationRequestExpiredInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_AUTHORIZATION_REQUEST_EXPIRED\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, AuthorizationRequestExpiredInterrupt.code);\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization is still pending\n * and the Authorizer is in `mode: interrupt`.\n */\nexport class AuthorizationPendingInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_AUTHORIZATION_PENDING\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, AuthorizationPendingInterrupt.code);\n }\n\n /**\n * Returns the interval in seconds to wait until the next polling attempt.\n */\n public nextRetryInterval(): number {\n return this.request.interval;\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization polling fails.\n */\nexport class AuthorizationPollingInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_AUTHORIZATION_POLLING_ERROR\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest,\n public readonly retryAfter: number\n ) {\n super(message, AuthorizationPollingInterrupt.code);\n }\n\n /**\n * Returns the interval in seconds to wait until the next polling attempt.\n */\n public nextRetryInterval(): number {\n return this.retryAfter || this.request.interval;\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization polling fails.\n */\nexport class InvalidGrantInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_INVALID_GRANT\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, InvalidGrantInterrupt.code);\n }\n}\n"]}
|
|
@@ -17,7 +17,7 @@ class TokenVaultInterrupt extends Auth0Interrupt_1.Auth0Interrupt {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.TokenVaultInterrupt = TokenVaultInterrupt;
|
|
20
|
-
TokenVaultInterrupt.code = "
|
|
20
|
+
TokenVaultInterrupt.code = "TOKEN_VAULT_ERROR";
|
|
21
21
|
/**
|
|
22
22
|
* Error thrown when a tool call requires an access token for an external service.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenVaultInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/TokenVaultInterrupt.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,+BAAc;IAsBrD,YACE,OAAe,EACf,UAAkB,EAClB,MAAgB,EAChB,cAAwB,EACxB,WAAgC,QAAQ;QAExC,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;;AAlCH,kDAmCC;AAfe,wBAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"TokenVaultInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/TokenVaultInterrupt.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,+BAAc;IAsBrD,YACE,OAAe,EACf,UAAkB,EAClB,MAAgB,EAChB,cAAwB,EACxB,WAAgC,QAAQ;QAExC,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;;AAlCH,kDAmCC;AAfe,wBAAI,GAAG,mBAA4B,CAAC;AAiBpD;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAJD,0CAIC","sourcesContent":["import { Auth0Interrupt } from \"./Auth0Interrupt\";\n\n/**\n * Error thrown when a tool call requires an access token for an external service.\n *\n * Throw this error if the service returns Unauthorized for the current access token.\n */\nexport class TokenVaultInterrupt extends Auth0Interrupt {\n public behavior: \"resume\" | \"reload\";\n\n /**\n * The auth0 connection name.\n */\n public readonly connection: string;\n\n /**\n * The scopes required to access the external service as stated\n * in the authorizer.\n */\n public readonly scopes: string[];\n\n /**\n * The union between the current scopes of the Access Token plus the required scopes.\n * This is the list of scopes that will be used to request a new Access Token.\n */\n public readonly requiredScopes: string[];\n\n public static code = \"TOKEN_VAULT_ERROR\" as const;\n\n constructor(\n message: string,\n connection: string,\n scopes: string[],\n requiredScopes: string[],\n behavior: \"resume\" | \"reload\" = \"resume\"\n ) {\n super(message, TokenVaultInterrupt.code);\n this.behavior = behavior;\n this.connection = connection;\n this.scopes = scopes;\n this.requiredScopes = requiredScopes;\n }\n}\n\n/**\n * Error thrown when a tool call requires an access token for an external service.\n *\n * The authorizer will automatically convert this class of error to TokenVaultInterrupt.\n */\nexport class TokenVaultError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"]}
|
|
@@ -11,7 +11,7 @@ export class AsyncAuthorizationInterrupt extends Auth0Interrupt {
|
|
|
11
11
|
Auth0Interrupt.isInterrupt(interrupt) &&
|
|
12
12
|
typeof interrupt.code === "string" &&
|
|
13
13
|
(this.code === interrupt.code ||
|
|
14
|
-
(!this.code && interrupt.code.startsWith("
|
|
14
|
+
(!this.code && interrupt.code.startsWith("ASYNC_AUTHORIZATION_"))));
|
|
15
15
|
}
|
|
16
16
|
static hasRequestData(interrupt) {
|
|
17
17
|
return AsyncAuthorizationInterrupt.isInterrupt(interrupt) && "request" in interrupt;
|
|
@@ -26,7 +26,7 @@ export class AccessDeniedInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
26
26
|
this.request = request;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
AccessDeniedInterrupt.code = "
|
|
29
|
+
AccessDeniedInterrupt.code = "ASYNC_AUTHORIZATION_ACCESS_DENIED";
|
|
30
30
|
/**
|
|
31
31
|
* An interrupt that is thrown when the user does not have push notifications enabled.
|
|
32
32
|
*/
|
|
@@ -35,7 +35,7 @@ export class UserDoesNotHavePushNotificationsInterrupt extends AsyncAuthorizatio
|
|
|
35
35
|
super(message, UserDoesNotHavePushNotificationsInterrupt.code);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
UserDoesNotHavePushNotificationsInterrupt.code = "
|
|
38
|
+
UserDoesNotHavePushNotificationsInterrupt.code = "ASYNC_AUTHORIZATION_USER_DOES_NOT_HAVE_PUSH_NOTIFICATIONS";
|
|
39
39
|
/**
|
|
40
40
|
* An interrupt that is thrown when the authorization request has expired.
|
|
41
41
|
*/
|
|
@@ -45,7 +45,7 @@ export class AuthorizationRequestExpiredInterrupt extends AsyncAuthorizationInte
|
|
|
45
45
|
this.request = request;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
AuthorizationRequestExpiredInterrupt.code = "
|
|
48
|
+
AuthorizationRequestExpiredInterrupt.code = "ASYNC_AUTHORIZATION_AUTHORIZATION_REQUEST_EXPIRED";
|
|
49
49
|
/**
|
|
50
50
|
* An interrupt that is thrown when the authorization is still pending
|
|
51
51
|
* and the Authorizer is in `mode: interrupt`.
|
|
@@ -62,7 +62,7 @@ export class AuthorizationPendingInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
62
62
|
return this.request.interval;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
AuthorizationPendingInterrupt.code = "
|
|
65
|
+
AuthorizationPendingInterrupt.code = "ASYNC_AUTHORIZATION_AUTHORIZATION_PENDING";
|
|
66
66
|
/**
|
|
67
67
|
* An interrupt that is thrown when the authorization polling fails.
|
|
68
68
|
*/
|
|
@@ -79,7 +79,7 @@ export class AuthorizationPollingInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
79
79
|
return this.retryAfter || this.request.interval;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
AuthorizationPollingInterrupt.code = "
|
|
82
|
+
AuthorizationPollingInterrupt.code = "ASYNC_AUTHORIZATION_AUTHORIZATION_POLLING_ERROR";
|
|
83
83
|
/**
|
|
84
84
|
* An interrupt that is thrown when the authorization polling fails.
|
|
85
85
|
*/
|
|
@@ -89,5 +89,5 @@ export class InvalidGrantInterrupt extends AsyncAuthorizationInterrupt {
|
|
|
89
89
|
this.request = request;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
InvalidGrantInterrupt.code = "
|
|
92
|
+
InvalidGrantInterrupt.code = "ASYNC_AUTHORIZATION_INVALID_GRANT";
|
|
93
93
|
//# sourceMappingURL=AsyncAuthorizationInterrupt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncAuthorizationInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/AsyncAuthorizationInterrupt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAMtE;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,cAAc;IAC7D,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS;YACT,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC;YACrC,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;YAClC,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;gBAC3B,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"AsyncAuthorizationInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/AsyncAuthorizationInterrupt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAMtE;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,cAAc;IAC7D,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS;YACT,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC;YACrC,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;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kCAAI,GAAW,2CAAoD,CAAC;AAgBpF;;GAEG;AACH,MAAM,OAAO,6BACX,SAAQ,2BAA2B;IAInC,YACE,OAAe,EACC,OAAkC,EAClC,UAAkB;QAElC,KAAK,CAAC,OAAO,EAAE,6BAA6B,CAAC,IAAI,CAAC,CAAC;QAHnC,YAAO,GAAP,OAAO,CAA2B;QAClC,eAAU,GAAV,UAAU,CAAQ;IAGpC,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAClD,CAAC;;AAda,kCAAI,GAAW,iDAA0D,CAAC;AAiB1F;;GAEG;AACH,MAAM,OAAO,qBACX,SAAQ,2BAA2B;IAInC,YACE,OAAe,EACC,OAAkC;QAElD,KAAK,CAAC,OAAO,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAF3B,YAAO,GAAP,OAAO,CAA2B;IAGpD,CAAC;;AANa,0BAAI,GAAW,mCAA4C,CAAC","sourcesContent":["import { AsyncAuthorizationRequest } from \"../authorizers/async-authorization/AsyncAuthorizationRequest\";\nimport { Auth0Interrupt, Auth0InterruptData } from \"./Auth0Interrupt\";\n\nexport interface WithRequestData {\n request: AsyncAuthorizationRequest;\n}\n\n/**\n * Base class for Async Authorization interrupts.\n */\nexport class AsyncAuthorizationInterrupt extends Auth0Interrupt {\n constructor(message: string, code: string) {\n super(message, code);\n }\n\n static isInterrupt<T extends abstract new (...args: any) => any>(\n this: T & { code?: string },\n interrupt: any\n ): interrupt is Auth0InterruptData<InstanceType<T>> {\n return (\n interrupt &&\n Auth0Interrupt.isInterrupt(interrupt) &&\n typeof interrupt.code === \"string\" &&\n (this.code === interrupt.code ||\n (!this.code && interrupt.code.startsWith(\"ASYNC_AUTHORIZATION_\")))\n );\n }\n\n static hasRequestData(interrupt: any): interrupt is WithRequestData {\n return AsyncAuthorizationInterrupt.isInterrupt(interrupt) && \"request\" in interrupt;\n }\n}\n\n/**\n * An interrupt that is thrown when the user denies the authorization request.\n */\nexport class AccessDeniedInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_ACCESS_DENIED\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, AccessDeniedInterrupt.code);\n }\n}\n\n/**\n * An interrupt that is thrown when the user does not have push notifications enabled.\n */\nexport class UserDoesNotHavePushNotificationsInterrupt extends AsyncAuthorizationInterrupt {\n public static code: string =\n \"ASYNC_AUTHORIZATION_USER_DOES_NOT_HAVE_PUSH_NOTIFICATIONS\" as const;\n constructor(message: string) {\n super(message, UserDoesNotHavePushNotificationsInterrupt.code);\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization request has expired.\n */\nexport class AuthorizationRequestExpiredInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_AUTHORIZATION_REQUEST_EXPIRED\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, AuthorizationRequestExpiredInterrupt.code);\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization is still pending\n * and the Authorizer is in `mode: interrupt`.\n */\nexport class AuthorizationPendingInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_AUTHORIZATION_PENDING\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, AuthorizationPendingInterrupt.code);\n }\n\n /**\n * Returns the interval in seconds to wait until the next polling attempt.\n */\n public nextRetryInterval(): number {\n return this.request.interval;\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization polling fails.\n */\nexport class AuthorizationPollingInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_AUTHORIZATION_POLLING_ERROR\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest,\n public readonly retryAfter: number\n ) {\n super(message, AuthorizationPollingInterrupt.code);\n }\n\n /**\n * Returns the interval in seconds to wait until the next polling attempt.\n */\n public nextRetryInterval(): number {\n return this.retryAfter || this.request.interval;\n }\n}\n\n/**\n * An interrupt that is thrown when the authorization polling fails.\n */\nexport class InvalidGrantInterrupt\n extends AsyncAuthorizationInterrupt\n implements WithRequestData\n{\n public static code: string = \"ASYNC_AUTHORIZATION_INVALID_GRANT\" as const;\n constructor(\n message: string,\n public readonly request: AsyncAuthorizationRequest\n ) {\n super(message, InvalidGrantInterrupt.code);\n }\n}\n"]}
|
|
@@ -20,7 +20,7 @@ export declare class TokenVaultInterrupt extends Auth0Interrupt {
|
|
|
20
20
|
* This is the list of scopes that will be used to request a new Access Token.
|
|
21
21
|
*/
|
|
22
22
|
readonly requiredScopes: string[];
|
|
23
|
-
static code: "
|
|
23
|
+
static code: "TOKEN_VAULT_ERROR";
|
|
24
24
|
constructor(message: string, connection: string, scopes: string[], requiredScopes: string[], behavior?: "resume" | "reload");
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -13,7 +13,7 @@ export class TokenVaultInterrupt extends Auth0Interrupt {
|
|
|
13
13
|
this.requiredScopes = requiredScopes;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
TokenVaultInterrupt.code = "
|
|
16
|
+
TokenVaultInterrupt.code = "TOKEN_VAULT_ERROR";
|
|
17
17
|
/**
|
|
18
18
|
* Error thrown when a tool call requires an access token for an external service.
|
|
19
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenVaultInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/TokenVaultInterrupt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IAsBrD,YACE,OAAe,EACf,UAAkB,EAClB,MAAgB,EAChB,cAAwB,EACxB,WAAgC,QAAQ;QAExC,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;;AAda,wBAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"TokenVaultInterrupt.js","sourceRoot":"","sources":["../../../src/interrupts/TokenVaultInterrupt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IAsBrD,YACE,OAAe,EACf,UAAkB,EAClB,MAAgB,EAChB,cAAwB,EACxB,WAAgC,QAAQ;QAExC,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;;AAda,wBAAI,GAAG,mBAA4B,CAAC;AAiBpD;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { Auth0Interrupt } from \"./Auth0Interrupt\";\n\n/**\n * Error thrown when a tool call requires an access token for an external service.\n *\n * Throw this error if the service returns Unauthorized for the current access token.\n */\nexport class TokenVaultInterrupt extends Auth0Interrupt {\n public behavior: \"resume\" | \"reload\";\n\n /**\n * The auth0 connection name.\n */\n public readonly connection: string;\n\n /**\n * The scopes required to access the external service as stated\n * in the authorizer.\n */\n public readonly scopes: string[];\n\n /**\n * The union between the current scopes of the Access Token plus the required scopes.\n * This is the list of scopes that will be used to request a new Access Token.\n */\n public readonly requiredScopes: string[];\n\n public static code = \"TOKEN_VAULT_ERROR\" as const;\n\n constructor(\n message: string,\n connection: string,\n scopes: string[],\n requiredScopes: string[],\n behavior: \"resume\" | \"reload\" = \"resume\"\n ) {\n super(message, TokenVaultInterrupt.code);\n this.behavior = behavior;\n this.connection = connection;\n this.scopes = scopes;\n this.requiredScopes = requiredScopes;\n }\n}\n\n/**\n * Error thrown when a tool call requires an access token for an external service.\n *\n * The authorizer will automatically convert this class of error to TokenVaultInterrupt.\n */\nexport class TokenVaultError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"]}
|