@auth0/ai 1.0.1 → 1.0.2
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.
|
@@ -38,7 +38,8 @@ class Auth0Interrupt extends Error {
|
|
|
38
38
|
* @returns - True if the interrupt is of the specified type.
|
|
39
39
|
*/
|
|
40
40
|
static isInterrupt(interrupt) {
|
|
41
|
-
return (interrupt
|
|
41
|
+
return (interrupt &&
|
|
42
|
+
interrupt.name === "AUTH0_AI_INTERRUPT" &&
|
|
42
43
|
(typeof this.code === "undefined" || interrupt.code === this.code));
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth0Interrupt.js","sourceRoot":"","sources":["../../../src/interrupts/Auth0Interrupt.ts"],"names":[],"mappings":";;;AAMa,QAAA,aAAa,GAAG,oBAA6B,CAAC;AAE3D;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJjB,SAAI,GAAG,qBAAa,CAAC;QAKnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,OAAO;YACL,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CACzB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAC/C,CACF;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACM,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS,CAAC,IAAI,KAAK,oBAAoB;YACvC,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CACnE,CAAC;IACJ,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"Auth0Interrupt.js","sourceRoot":"","sources":["../../../src/interrupts/Auth0Interrupt.ts"],"names":[],"mappings":";;;AAMa,QAAA,aAAa,GAAG,oBAA6B,CAAC;AAE3D;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJjB,SAAI,GAAG,qBAAa,CAAC;QAKnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,OAAO;YACL,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CACzB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAC/C,CACF;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACM,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS;YACT,SAAS,CAAC,IAAI,KAAK,oBAAoB;YACvC,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CACnE,CAAC;IACJ,CAAC;CACF;AA/CD,wCA+CC","sourcesContent":["// Define a type alias for the generalized type\nexport type Auth0InterruptData<T extends Auth0Interrupt> = Omit<\n Omit<T, keyof Error>,\n \"toJSON\"\n> & { message: string };\n\nexport const InterruptName = \"AUTH0_AI_INTERRUPT\" as const;\n\n/**\n * Auth0Interrupt is the base class for all interruptions\n * in the Auth0 AI sdk.\n *\n * It is serializable to a JSON object.\n */\nexport class Auth0Interrupt extends Error {\n name = InterruptName;\n code: string;\n\n constructor(message: string, code: string) {\n super(message);\n this.code = code;\n }\n\n /**\n *\n * Serialize the interrupt to a JSON object.\n *\n * @returns - The JSON object representation of the interrupt.\n */\n toJSON(): Auth0InterruptData<this> {\n return {\n ...Object.fromEntries(\n Object.entries(this).filter(\n ([key]) => key !== \"stack\" && key !== \"toJSON\"\n )\n ),\n message: this.message,\n } as Auth0InterruptData<this>;\n }\n\n /**\n *\n * Checks if an interrupt is of a specific type asserting its data component.\n *\n * This method assert the data part of the interrupt.\n *\n * @param clazz - The class of the interrupt to check.\n * @param interrupt - The interrupt to check.\n *\n * @returns - True if the interrupt is of the specified type.\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 interrupt.name === \"AUTH0_AI_INTERRUPT\" &&\n (typeof this.code === \"undefined\" || interrupt.code === this.code)\n );\n }\n}\n"]}
|
|
@@ -35,7 +35,8 @@ export class Auth0Interrupt extends Error {
|
|
|
35
35
|
* @returns - True if the interrupt is of the specified type.
|
|
36
36
|
*/
|
|
37
37
|
static isInterrupt(interrupt) {
|
|
38
|
-
return (interrupt
|
|
38
|
+
return (interrupt &&
|
|
39
|
+
interrupt.name === "AUTH0_AI_INTERRUPT" &&
|
|
39
40
|
(typeof this.code === "undefined" || interrupt.code === this.code));
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth0Interrupt.js","sourceRoot":"","sources":["../../../src/interrupts/Auth0Interrupt.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,aAAa,GAAG,oBAA6B,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJjB,SAAI,GAAG,aAAa,CAAC;QAKnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,OAAO;YACL,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CACzB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAC/C,CACF;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACM,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS,CAAC,IAAI,KAAK,oBAAoB;YACvC,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CACnE,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Define a type alias for the generalized type\nexport type Auth0InterruptData<T extends Auth0Interrupt> = Omit<\n Omit<T, keyof Error>,\n \"toJSON\"\n> & { message: string };\n\nexport const InterruptName = \"AUTH0_AI_INTERRUPT\" as const;\n\n/**\n * Auth0Interrupt is the base class for all interruptions\n * in the Auth0 AI sdk.\n *\n * It is serializable to a JSON object.\n */\nexport class Auth0Interrupt extends Error {\n name = InterruptName;\n code: string;\n\n constructor(message: string, code: string) {\n super(message);\n this.code = code;\n }\n\n /**\n *\n * Serialize the interrupt to a JSON object.\n *\n * @returns - The JSON object representation of the interrupt.\n */\n toJSON(): Auth0InterruptData<this> {\n return {\n ...Object.fromEntries(\n Object.entries(this).filter(\n ([key]) => key !== \"stack\" && key !== \"toJSON\"\n )\n ),\n message: this.message,\n } as Auth0InterruptData<this>;\n }\n\n /**\n *\n * Checks if an interrupt is of a specific type asserting its data component.\n *\n * This method assert the data part of the interrupt.\n *\n * @param clazz - The class of the interrupt to check.\n * @param interrupt - The interrupt to check.\n *\n * @returns - True if the interrupt is of the specified type.\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.name === \"AUTH0_AI_INTERRUPT\" &&\n (typeof this.code === \"undefined\" || interrupt.code === this.code)\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Auth0Interrupt.js","sourceRoot":"","sources":["../../../src/interrupts/Auth0Interrupt.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,aAAa,GAAG,oBAA6B,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJjB,SAAI,GAAG,aAAa,CAAC;QAKnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,OAAO;YACL,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CACzB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAC/C,CACF;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACM,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,CAEhB,SAAc;QAEd,OAAO,CACL,SAAS;YACT,SAAS,CAAC,IAAI,KAAK,oBAAoB;YACvC,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CACnE,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Define a type alias for the generalized type\nexport type Auth0InterruptData<T extends Auth0Interrupt> = Omit<\n Omit<T, keyof Error>,\n \"toJSON\"\n> & { message: string };\n\nexport const InterruptName = \"AUTH0_AI_INTERRUPT\" as const;\n\n/**\n * Auth0Interrupt is the base class for all interruptions\n * in the Auth0 AI sdk.\n *\n * It is serializable to a JSON object.\n */\nexport class Auth0Interrupt extends Error {\n name = InterruptName;\n code: string;\n\n constructor(message: string, code: string) {\n super(message);\n this.code = code;\n }\n\n /**\n *\n * Serialize the interrupt to a JSON object.\n *\n * @returns - The JSON object representation of the interrupt.\n */\n toJSON(): Auth0InterruptData<this> {\n return {\n ...Object.fromEntries(\n Object.entries(this).filter(\n ([key]) => key !== \"stack\" && key !== \"toJSON\"\n )\n ),\n message: this.message,\n } as Auth0InterruptData<this>;\n }\n\n /**\n *\n * Checks if an interrupt is of a specific type asserting its data component.\n *\n * This method assert the data part of the interrupt.\n *\n * @param clazz - The class of the interrupt to check.\n * @param interrupt - The interrupt to check.\n *\n * @returns - True if the interrupt is of the specified type.\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 interrupt.name === \"AUTH0_AI_INTERRUPT\" &&\n (typeof this.code === \"undefined\" || interrupt.code === this.code)\n );\n }\n}\n"]}
|