@go-mondo/nextjs-auth 0.1.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.
- package/README.md +462 -0
- package/dist/access-token-UIlXwi3X.d.cts +27 -0
- package/dist/access-token-UIlXwi3X.d.ts +27 -0
- package/dist/client.cjs +1324 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +201 -0
- package/dist/client.d.ts +201 -0
- package/dist/client.js +1301 -0
- package/dist/client.js.map +1 -0
- package/dist/config.cjs +4 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +90 -0
- package/dist/config.d.ts +90 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.cjs +189 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +178 -0
- package/dist/errors.d.ts +178 -0
- package/dist/errors.js +178 -0
- package/dist/errors.js.map +1 -0
- package/dist/hooks.cjs +236 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +146 -0
- package/dist/hooks.d.ts +146 -0
- package/dist/hooks.js +230 -0
- package/dist/hooks.js.map +1 -0
- package/dist/oauth.cjs +10 -0
- package/dist/oauth.cjs.map +1 -0
- package/dist/oauth.d.cts +55 -0
- package/dist/oauth.d.ts +55 -0
- package/dist/oauth.js +8 -0
- package/dist/oauth.js.map +1 -0
- package/dist/session.cjs +45 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +71 -0
- package/dist/session.d.ts +71 -0
- package/dist/session.js +43 -0
- package/dist/session.js.map +1 -0
- package/dist/types-CbrOw4QQ.d.cts +108 -0
- package/dist/types-CbrOw4QQ.d.ts +108 -0
- package/package.json +146 -0
package/dist/errors.cjs
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/errors/auth.ts
|
|
4
|
+
function appendCause(errorMessage, cause) {
|
|
5
|
+
if (!cause) return errorMessage;
|
|
6
|
+
const separator = errorMessage.endsWith(".") ? "" : ".";
|
|
7
|
+
return `${errorMessage}${separator} CAUSE: ${cause.message}`;
|
|
8
|
+
}
|
|
9
|
+
var AuthError = class extends Error {
|
|
10
|
+
/**
|
|
11
|
+
* A machine-readable error code that remains stable within a major version of the SDK. You
|
|
12
|
+
* should rely on this error code to handle errors. In contrast, the error message is not part of
|
|
13
|
+
* the API and can change anytime. Do **not** parse or otherwise rely on the error message to
|
|
14
|
+
* handle errors.
|
|
15
|
+
*/
|
|
16
|
+
code;
|
|
17
|
+
/**
|
|
18
|
+
* The error class name.
|
|
19
|
+
*/
|
|
20
|
+
name;
|
|
21
|
+
/**
|
|
22
|
+
* The underlying error, if any.
|
|
23
|
+
*
|
|
24
|
+
* **IMPORTANT** When this error is from the Identity Provider ({@link IdentityProviderError}) it can contain user
|
|
25
|
+
* input and is only escaped using basic escaping for putting untrusted data directly into the HTML body.
|
|
26
|
+
*
|
|
27
|
+
* You should **not** render this error without using a templating engine that will properly escape it for other
|
|
28
|
+
* HTML contexts first.
|
|
29
|
+
*/
|
|
30
|
+
cause;
|
|
31
|
+
/**
|
|
32
|
+
* The HTTP status code, if any.
|
|
33
|
+
*/
|
|
34
|
+
status;
|
|
35
|
+
/**
|
|
36
|
+
* @param options - Error metadata used by SDK-specific subclasses.
|
|
37
|
+
*/
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super(appendCause(options.message, options.cause));
|
|
40
|
+
this.code = options.code;
|
|
41
|
+
this.name = options.name;
|
|
42
|
+
this.cause = options.cause;
|
|
43
|
+
this.status = options.status;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/errors/access-token.ts
|
|
48
|
+
var AccessTokenErrorCode = /* @__PURE__ */ ((AccessTokenErrorCode2) => {
|
|
49
|
+
AccessTokenErrorCode2["MISSING_SESSION"] = "ERR_MISSING_SESSION";
|
|
50
|
+
AccessTokenErrorCode2["MISSING_ACCESS_TOKEN"] = "ERR_MISSING_ACCESS_TOKEN";
|
|
51
|
+
AccessTokenErrorCode2["MISSING_REFRESH_TOKEN"] = "ERR_MISSING_REFRESH_TOKEN";
|
|
52
|
+
AccessTokenErrorCode2["EXPIRED_ACCESS_TOKEN"] = "ERR_EXPIRED_ACCESS_TOKEN";
|
|
53
|
+
AccessTokenErrorCode2["INSUFFICIENT_SCOPE"] = "ERR_INSUFFICIENT_SCOPE";
|
|
54
|
+
AccessTokenErrorCode2["FAILED_REFRESH_GRANT"] = "ERR_FAILED_REFRESH_GRANT";
|
|
55
|
+
return AccessTokenErrorCode2;
|
|
56
|
+
})(AccessTokenErrorCode || {});
|
|
57
|
+
var AccessTokenError = class _AccessTokenError extends AuthError {
|
|
58
|
+
/**
|
|
59
|
+
* @param code - Stable machine-readable error code.
|
|
60
|
+
* @param message - Human-readable diagnostic message.
|
|
61
|
+
* @param cause - Optional lower-level error.
|
|
62
|
+
*/
|
|
63
|
+
constructor(code, message, cause) {
|
|
64
|
+
super({ code, message, name: "AccessTokenError", cause });
|
|
65
|
+
Error.captureStackTrace(this, this.constructor);
|
|
66
|
+
Object.setPrototypeOf(this, _AccessTokenError.prototype);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/errors/config.ts
|
|
71
|
+
var ConfigError = class _ConfigError extends AuthError {
|
|
72
|
+
static code = "ERR_CONFIG_VALIDATION";
|
|
73
|
+
/**
|
|
74
|
+
* Standard Schema validation issues for the invalid configuration.
|
|
75
|
+
*/
|
|
76
|
+
issues;
|
|
77
|
+
/**
|
|
78
|
+
* @param issues - Standard Schema validation issues.
|
|
79
|
+
*/
|
|
80
|
+
constructor(issues) {
|
|
81
|
+
super({
|
|
82
|
+
code: _ConfigError.code,
|
|
83
|
+
message: `Invalid @go-mondo/nextjs-auth configuration:
|
|
84
|
+
${formatIssues(
|
|
85
|
+
issues
|
|
86
|
+
)}`,
|
|
87
|
+
name: "ConfigError"
|
|
88
|
+
});
|
|
89
|
+
this.issues = issues;
|
|
90
|
+
Error.captureStackTrace(this, this.constructor);
|
|
91
|
+
Object.setPrototypeOf(this, _ConfigError.prototype);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
function formatIssues(issues) {
|
|
95
|
+
return issues.map((issue) => {
|
|
96
|
+
const path = issue.path?.length ? issue.path.map(formatPathSegment).join(".") : "config";
|
|
97
|
+
return `- ${path}: ${issue.message}`;
|
|
98
|
+
}).join("\n");
|
|
99
|
+
}
|
|
100
|
+
function formatPathSegment(segment) {
|
|
101
|
+
return typeof segment === "object" && segment !== null && "key" in segment ? String(segment.key) : String(segment);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/errors/handlers.ts
|
|
105
|
+
var HandlerError = class extends AuthError {
|
|
106
|
+
constructor(options) {
|
|
107
|
+
let status;
|
|
108
|
+
if ("status" in options.cause) status = options.cause.status;
|
|
109
|
+
super({ ...options, status });
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var CallbackHandlerError = class _CallbackHandlerError extends HandlerError {
|
|
113
|
+
static code = "ERR_CALLBACK_HANDLER_FAILURE";
|
|
114
|
+
constructor(cause) {
|
|
115
|
+
super({
|
|
116
|
+
code: _CallbackHandlerError.code,
|
|
117
|
+
message: "Callback handler failed.",
|
|
118
|
+
name: "CallbackHandlerError",
|
|
119
|
+
cause
|
|
120
|
+
});
|
|
121
|
+
Object.setPrototypeOf(this, _CallbackHandlerError.prototype);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var LoginHandlerError = class _LoginHandlerError extends HandlerError {
|
|
125
|
+
static code = "ERR_LOGIN_HANDLER_FAILURE";
|
|
126
|
+
constructor(cause) {
|
|
127
|
+
super({
|
|
128
|
+
code: _LoginHandlerError.code,
|
|
129
|
+
message: "Login handler failed.",
|
|
130
|
+
name: "LoginHandlerError",
|
|
131
|
+
cause
|
|
132
|
+
});
|
|
133
|
+
Object.setPrototypeOf(this, _LoginHandlerError.prototype);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var LogoutHandlerError = class _LogoutHandlerError extends HandlerError {
|
|
137
|
+
static code = "ERR_LOGOUT_HANDLER_FAILURE";
|
|
138
|
+
constructor(cause) {
|
|
139
|
+
super({
|
|
140
|
+
code: _LogoutHandlerError.code,
|
|
141
|
+
message: "Logout handler failed.",
|
|
142
|
+
name: "LogoutHandlerError",
|
|
143
|
+
cause
|
|
144
|
+
});
|
|
145
|
+
Object.setPrototypeOf(this, _LogoutHandlerError.prototype);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// src/errors/state.ts
|
|
150
|
+
var MissingStateParamError = class _MissingStateParamError extends Error {
|
|
151
|
+
static message = "Missing state parameter in Authorization Response.";
|
|
152
|
+
status = 400;
|
|
153
|
+
statusCode = 400;
|
|
154
|
+
constructor() {
|
|
155
|
+
super(_MissingStateParamError.message);
|
|
156
|
+
Object.setPrototypeOf(this, _MissingStateParamError.prototype);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var MalformedStateCookieError = class _MalformedStateCookieError extends Error {
|
|
160
|
+
static message = "Your state cookie is not valid JSON.";
|
|
161
|
+
status = 400;
|
|
162
|
+
statusCode = 400;
|
|
163
|
+
constructor() {
|
|
164
|
+
super(_MalformedStateCookieError.message);
|
|
165
|
+
Object.setPrototypeOf(this, _MalformedStateCookieError.prototype);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var MissingStateCookieError = class _MissingStateCookieError extends Error {
|
|
169
|
+
static message = "Missing state cookie from login request (check login URL, callback URL and cookie config).";
|
|
170
|
+
status = 400;
|
|
171
|
+
statusCode = 400;
|
|
172
|
+
constructor() {
|
|
173
|
+
super(_MissingStateCookieError.message);
|
|
174
|
+
Object.setPrototypeOf(this, _MissingStateCookieError.prototype);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
exports.AccessTokenError = AccessTokenError;
|
|
179
|
+
exports.AccessTokenErrorCode = AccessTokenErrorCode;
|
|
180
|
+
exports.AuthError = AuthError;
|
|
181
|
+
exports.CallbackHandlerError = CallbackHandlerError;
|
|
182
|
+
exports.ConfigError = ConfigError;
|
|
183
|
+
exports.LoginHandlerError = LoginHandlerError;
|
|
184
|
+
exports.LogoutHandlerError = LogoutHandlerError;
|
|
185
|
+
exports.MalformedStateCookieError = MalformedStateCookieError;
|
|
186
|
+
exports.MissingStateCookieError = MissingStateCookieError;
|
|
187
|
+
exports.MissingStateParamError = MissingStateParamError;
|
|
188
|
+
//# sourceMappingURL=errors.cjs.map
|
|
189
|
+
//# sourceMappingURL=errors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/auth.ts","../src/errors/access-token.ts","../src/errors/config.ts","../src/errors/handlers.ts","../src/errors/state.ts"],"names":["AccessTokenErrorCode"],"mappings":";;;AAAA,SAAS,WAAA,CAAY,cAAsB,KAAA,EAAuB;AAChE,EAAA,IAAI,CAAC,OAAO,OAAO,YAAA;AACnB,EAAA,MAAM,SAAA,GAAY,YAAA,CAAa,QAAA,CAAS,GAAG,IAAI,EAAA,GAAK,GAAA;AACpD,EAAA,OAAO,GAAG,YAAY,CAAA,EAAG,SAAS,CAAA,QAAA,EAAW,MAAM,OAAO,CAAA,CAAA;AAC5D;AAgBO,IAAe,SAAA,GAAf,cAAiC,KAAA,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO5B,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,KAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA;AAAA;AAAA;AAAA,EAKhB,YAAY,OAAA,EAA2B;AAErC,IAAA,KAAA,CAAM,WAAA,CAAY,OAAA,CAAQ,OAAA,EAAS,OAAA,CAAQ,KAAK,CAAC,CAAA;AACjD,IAAA,IAAA,CAAK,OAAO,OAAA,CAAQ,IAAA;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AAA,EACT,UAAA,GAAa,GAAA;AAAA,EAEb,WAAA,GAAc;AAEZ,IAAA,KAAA,CAAM,wBAAuB,OAAO,CAAA;AACpC,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,uBAAA,CAAuB,SAAS,CAAA;AAAA,EAC9D;AACF;AAKO,IAAM,yBAAA,GAAN,MAAM,0BAAA,SAAkC,KAAA,CAAM;AAAA,EACnD,OAAO,OAAA,GAAU,sCAAA;AAAA,EACjB,MAAA,GAAS,GAAA;AAAA,EACT,UAAA,GAAa,GAAA;AAAA,EAEb,WAAA,GAAc;AAEZ,IAAA,KAAA,CAAM,2BAA0B,OAAO,CAAA;AACvC,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,0BAAA,CAA0B,SAAS,CAAA;AAAA,EACjE;AACF;AAKO,IAAM,uBAAA,GAAN,MAAM,wBAAA,SAAgC,KAAA,CAAM;AAAA,EACjD,OAAO,OAAA,GACL,4FAAA;AAAA,EACF,MAAA,GAAS,GAAA;AAAA,EACT,UAAA,GAAa,GAAA;AAAA,EAEb,WAAA,GAAc;AAEZ,IAAA,KAAA,CAAM,yBAAwB,OAAO,CAAA;AACrC,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,wBAAA,CAAwB,SAAS,CAAA;AAAA,EAC/D;AACF","file":"errors.cjs","sourcesContent":["function appendCause(errorMessage: string, cause?: Error): string {\n if (!cause) return errorMessage;\n const separator = errorMessage.endsWith('.') ? '' : '.';\n return `${errorMessage}${separator} CAUSE: ${cause.message}`;\n}\n\ntype AuthErrorOptions = {\n code: string;\n message: string;\n name: string;\n cause?: Error;\n status?: number;\n};\n\n/**\n * The base class for all SDK errors.\n *\n * Subclasses expose stable machine-readable codes for application-level error\n * handling.\n */\nexport abstract class AuthError extends Error {\n /**\n * A machine-readable error code that remains stable within a major version of the SDK. You\n * should rely on this error code to handle errors. In contrast, the error message is not part of\n * the API and can change anytime. Do **not** parse or otherwise rely on the error message to\n * handle errors.\n */\n public readonly code: string;\n\n /**\n * The error class name.\n */\n public readonly name: string;\n\n /**\n * The underlying error, if any.\n *\n * **IMPORTANT** When this error is from the Identity Provider ({@link IdentityProviderError}) it can contain user\n * input and is only escaped using basic escaping for putting untrusted data directly into the HTML body.\n *\n * You should **not** render this error without using a templating engine that will properly escape it for other\n * HTML contexts first.\n */\n public readonly cause?: Error;\n\n /**\n * The HTTP status code, if any.\n */\n public readonly status?: number;\n\n /**\n * @param options - Error metadata used by SDK-specific subclasses.\n */\n constructor(options: AuthErrorOptions) {\n /* c8 ignore next */\n super(appendCause(options.message, options.cause));\n this.code = options.code;\n this.name = options.name;\n this.cause = options.cause;\n this.status = options.status;\n }\n}\n","import { AuthError } from './auth';\n\n/**\n * Error codes for {@link AccessTokenError}.\n */\nexport enum AccessTokenErrorCode {\n /** No valid session was available. */\n MISSING_SESSION = 'ERR_MISSING_SESSION',\n\n /** Session exists but does not contain an access token. */\n MISSING_ACCESS_TOKEN = 'ERR_MISSING_ACCESS_TOKEN',\n\n /** Refresh was required but no refresh token was stored. */\n MISSING_REFRESH_TOKEN = 'ERR_MISSING_REFRESH_TOKEN',\n\n /** Access token is expired and cannot be returned as-is. */\n EXPIRED_ACCESS_TOKEN = 'ERR_EXPIRED_ACCESS_TOKEN',\n\n /** Access token does not include the requested scopes. */\n INSUFFICIENT_SCOPE = 'ERR_INSUFFICIENT_SCOPE',\n\n /** Refresh token grant failed or returned an invalid response. */\n FAILED_REFRESH_GRANT = 'ERR_FAILED_REFRESH_GRANT',\n}\n\n/**\n * Error thrown when an access token cannot be returned or refreshed.\n *\n * Use {@link AccessTokenError.code} for stable error handling.\n */\nexport class AccessTokenError extends AuthError {\n /**\n * @param code - Stable machine-readable error code.\n * @param message - Human-readable diagnostic message.\n * @param cause - Optional lower-level error.\n */\n constructor(code: AccessTokenErrorCode, message: string, cause?: Error) {\n /* c8 ignore next */\n super({ code: code, message: message, name: 'AccessTokenError', cause });\n\n Error.captureStackTrace(this, this.constructor);\n Object.setPrototypeOf(this, AccessTokenError.prototype);\n }\n}\n","import { AuthError } from './auth';\n\n/**\n * Standard Schema V1 path segment shape.\n */\nexport interface ConfigIssuePathSegment {\n readonly key: PropertyKey;\n}\n\n/**\n * Standard Schema V1 issue shape returned by configuration validation.\n */\nexport interface ConfigIssue {\n readonly message: string;\n readonly path?: readonly (PropertyKey | ConfigIssuePathSegment)[] | undefined;\n}\n\n/**\n * Error thrown when auth configuration validation fails.\n */\nexport class ConfigError extends AuthError {\n public static readonly code = 'ERR_CONFIG_VALIDATION';\n\n /**\n * Standard Schema validation issues for the invalid configuration.\n */\n public readonly issues: readonly ConfigIssue[];\n\n /**\n * @param issues - Standard Schema validation issues.\n */\n constructor(issues: readonly ConfigIssue[]) {\n super({\n code: ConfigError.code,\n message: `Invalid @go-mondo/nextjs-auth configuration:\\n${formatIssues(\n issues,\n )}`,\n name: 'ConfigError',\n });\n\n this.issues = issues;\n\n Error.captureStackTrace(this, this.constructor);\n Object.setPrototypeOf(this, ConfigError.prototype);\n }\n}\n\nfunction formatIssues(issues: readonly ConfigIssue[]): string {\n return issues\n .map((issue) => {\n const path = issue.path?.length\n ? issue.path.map(formatPathSegment).join('.')\n : 'config';\n return `- ${path}: ${issue.message}`;\n })\n .join('\\n');\n}\n\nfunction formatPathSegment(\n segment: NonNullable<ConfigIssue['path']>[number],\n): string {\n return typeof segment === 'object' && segment !== null && 'key' in segment\n ? String(segment.key)\n : String(segment);\n}\n","import { AuthError } from './auth';\n\n/**\n * Error shape used by lower-level HTTP libraries.\n */\ninterface HttpError extends Error {\n status: number;\n statusCode: number;\n}\n\n/**\n * Supported causes for route-handler errors.\n */\nexport type HandlerErrorCause = Error | AuthError | HttpError;\n\ntype HandlerErrorOptions = {\n code: string;\n message: string;\n name: string;\n cause: HandlerErrorCause;\n};\n\n/**\n * Base class for errors thrown by route handlers.\n */\nclass HandlerError extends AuthError {\n constructor(options: HandlerErrorOptions) {\n let status: number | undefined;\n if ('status' in options.cause) status = options.cause.status;\n /* c8 ignore next */\n super({ ...options, status });\n }\n}\n\n/**\n * Error thrown when callback handling fails.\n */\nexport class CallbackHandlerError extends HandlerError {\n public static readonly code: string = 'ERR_CALLBACK_HANDLER_FAILURE';\n\n constructor(cause: HandlerErrorCause) {\n super({\n code: CallbackHandlerError.code,\n message: 'Callback handler failed.',\n name: 'CallbackHandlerError',\n cause,\n }); /* c8 ignore next */\n Object.setPrototypeOf(this, CallbackHandlerError.prototype);\n }\n}\n\n/**\n * Error thrown when login handling fails.\n */\nexport class LoginHandlerError extends HandlerError {\n public static readonly code: string = 'ERR_LOGIN_HANDLER_FAILURE';\n\n constructor(cause: HandlerErrorCause) {\n super({\n code: LoginHandlerError.code,\n message: 'Login handler failed.',\n name: 'LoginHandlerError',\n cause,\n }); /* c8 ignore next */\n Object.setPrototypeOf(this, LoginHandlerError.prototype);\n }\n}\n\n/**\n * Error thrown when logout handling fails.\n */\nexport class LogoutHandlerError extends HandlerError {\n public static readonly code: string = 'ERR_LOGOUT_HANDLER_FAILURE';\n\n constructor(cause: HandlerErrorCause) {\n super({\n code: LogoutHandlerError.code,\n message: 'Logout handler failed.',\n name: 'LogoutHandlerError',\n cause,\n }); /* c8 ignore next */\n Object.setPrototypeOf(this, LogoutHandlerError.prototype);\n }\n}\n","/**\n * Error used when the callback response is missing a `state` parameter.\n */\nexport class MissingStateParamError extends Error {\n static message = 'Missing state parameter in Authorization Response.';\n status = 400;\n statusCode = 400;\n\n constructor() {\n /* c8 ignore next */\n super(MissingStateParamError.message);\n Object.setPrototypeOf(this, MissingStateParamError.prototype);\n }\n}\n\n/**\n * Error used when transaction state exists but cannot be parsed.\n */\nexport class MalformedStateCookieError extends Error {\n static message = 'Your state cookie is not valid JSON.';\n status = 400;\n statusCode = 400;\n\n constructor() {\n /* c8 ignore next */\n super(MalformedStateCookieError.message);\n Object.setPrototypeOf(this, MalformedStateCookieError.prototype);\n }\n}\n\n/**\n * Error used when the callback cannot find the login transaction cookie.\n */\nexport class MissingStateCookieError extends Error {\n static message =\n 'Missing state cookie from login request (check login URL, callback URL and cookie config).';\n status = 400;\n statusCode = 400;\n\n constructor() {\n /* c8 ignore next */\n super(MissingStateCookieError.message);\n Object.setPrototypeOf(this, MissingStateCookieError.prototype);\n }\n}\n"]}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
type AuthErrorOptions = {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
name: string;
|
|
5
|
+
cause?: Error;
|
|
6
|
+
status?: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The base class for all SDK errors.
|
|
10
|
+
*
|
|
11
|
+
* Subclasses expose stable machine-readable codes for application-level error
|
|
12
|
+
* handling.
|
|
13
|
+
*/
|
|
14
|
+
declare abstract class AuthError extends Error {
|
|
15
|
+
/**
|
|
16
|
+
* A machine-readable error code that remains stable within a major version of the SDK. You
|
|
17
|
+
* should rely on this error code to handle errors. In contrast, the error message is not part of
|
|
18
|
+
* the API and can change anytime. Do **not** parse or otherwise rely on the error message to
|
|
19
|
+
* handle errors.
|
|
20
|
+
*/
|
|
21
|
+
readonly code: string;
|
|
22
|
+
/**
|
|
23
|
+
* The error class name.
|
|
24
|
+
*/
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/**
|
|
27
|
+
* The underlying error, if any.
|
|
28
|
+
*
|
|
29
|
+
* **IMPORTANT** When this error is from the Identity Provider ({@link IdentityProviderError}) it can contain user
|
|
30
|
+
* input and is only escaped using basic escaping for putting untrusted data directly into the HTML body.
|
|
31
|
+
*
|
|
32
|
+
* You should **not** render this error without using a templating engine that will properly escape it for other
|
|
33
|
+
* HTML contexts first.
|
|
34
|
+
*/
|
|
35
|
+
readonly cause?: Error;
|
|
36
|
+
/**
|
|
37
|
+
* The HTTP status code, if any.
|
|
38
|
+
*/
|
|
39
|
+
readonly status?: number;
|
|
40
|
+
/**
|
|
41
|
+
* @param options - Error metadata used by SDK-specific subclasses.
|
|
42
|
+
*/
|
|
43
|
+
constructor(options: AuthErrorOptions);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Error codes for {@link AccessTokenError}.
|
|
48
|
+
*/
|
|
49
|
+
declare enum AccessTokenErrorCode {
|
|
50
|
+
/** No valid session was available. */
|
|
51
|
+
MISSING_SESSION = "ERR_MISSING_SESSION",
|
|
52
|
+
/** Session exists but does not contain an access token. */
|
|
53
|
+
MISSING_ACCESS_TOKEN = "ERR_MISSING_ACCESS_TOKEN",
|
|
54
|
+
/** Refresh was required but no refresh token was stored. */
|
|
55
|
+
MISSING_REFRESH_TOKEN = "ERR_MISSING_REFRESH_TOKEN",
|
|
56
|
+
/** Access token is expired and cannot be returned as-is. */
|
|
57
|
+
EXPIRED_ACCESS_TOKEN = "ERR_EXPIRED_ACCESS_TOKEN",
|
|
58
|
+
/** Access token does not include the requested scopes. */
|
|
59
|
+
INSUFFICIENT_SCOPE = "ERR_INSUFFICIENT_SCOPE",
|
|
60
|
+
/** Refresh token grant failed or returned an invalid response. */
|
|
61
|
+
FAILED_REFRESH_GRANT = "ERR_FAILED_REFRESH_GRANT"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Error thrown when an access token cannot be returned or refreshed.
|
|
65
|
+
*
|
|
66
|
+
* Use {@link AccessTokenError.code} for stable error handling.
|
|
67
|
+
*/
|
|
68
|
+
declare class AccessTokenError extends AuthError {
|
|
69
|
+
/**
|
|
70
|
+
* @param code - Stable machine-readable error code.
|
|
71
|
+
* @param message - Human-readable diagnostic message.
|
|
72
|
+
* @param cause - Optional lower-level error.
|
|
73
|
+
*/
|
|
74
|
+
constructor(code: AccessTokenErrorCode, message: string, cause?: Error);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Standard Schema V1 path segment shape.
|
|
79
|
+
*/
|
|
80
|
+
interface ConfigIssuePathSegment {
|
|
81
|
+
readonly key: PropertyKey;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Standard Schema V1 issue shape returned by configuration validation.
|
|
85
|
+
*/
|
|
86
|
+
interface ConfigIssue {
|
|
87
|
+
readonly message: string;
|
|
88
|
+
readonly path?: readonly (PropertyKey | ConfigIssuePathSegment)[] | undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Error thrown when auth configuration validation fails.
|
|
92
|
+
*/
|
|
93
|
+
declare class ConfigError extends AuthError {
|
|
94
|
+
static readonly code = "ERR_CONFIG_VALIDATION";
|
|
95
|
+
/**
|
|
96
|
+
* Standard Schema validation issues for the invalid configuration.
|
|
97
|
+
*/
|
|
98
|
+
readonly issues: readonly ConfigIssue[];
|
|
99
|
+
/**
|
|
100
|
+
* @param issues - Standard Schema validation issues.
|
|
101
|
+
*/
|
|
102
|
+
constructor(issues: readonly ConfigIssue[]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Error shape used by lower-level HTTP libraries.
|
|
107
|
+
*/
|
|
108
|
+
interface HttpError extends Error {
|
|
109
|
+
status: number;
|
|
110
|
+
statusCode: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Supported causes for route-handler errors.
|
|
114
|
+
*/
|
|
115
|
+
type HandlerErrorCause = Error | AuthError | HttpError;
|
|
116
|
+
type HandlerErrorOptions = {
|
|
117
|
+
code: string;
|
|
118
|
+
message: string;
|
|
119
|
+
name: string;
|
|
120
|
+
cause: HandlerErrorCause;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Base class for errors thrown by route handlers.
|
|
124
|
+
*/
|
|
125
|
+
declare class HandlerError extends AuthError {
|
|
126
|
+
constructor(options: HandlerErrorOptions);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when callback handling fails.
|
|
130
|
+
*/
|
|
131
|
+
declare class CallbackHandlerError extends HandlerError {
|
|
132
|
+
static readonly code: string;
|
|
133
|
+
constructor(cause: HandlerErrorCause);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Error thrown when login handling fails.
|
|
137
|
+
*/
|
|
138
|
+
declare class LoginHandlerError extends HandlerError {
|
|
139
|
+
static readonly code: string;
|
|
140
|
+
constructor(cause: HandlerErrorCause);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Error thrown when logout handling fails.
|
|
144
|
+
*/
|
|
145
|
+
declare class LogoutHandlerError extends HandlerError {
|
|
146
|
+
static readonly code: string;
|
|
147
|
+
constructor(cause: HandlerErrorCause);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Error used when the callback response is missing a `state` parameter.
|
|
152
|
+
*/
|
|
153
|
+
declare class MissingStateParamError extends Error {
|
|
154
|
+
static message: string;
|
|
155
|
+
status: number;
|
|
156
|
+
statusCode: number;
|
|
157
|
+
constructor();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Error used when transaction state exists but cannot be parsed.
|
|
161
|
+
*/
|
|
162
|
+
declare class MalformedStateCookieError extends Error {
|
|
163
|
+
static message: string;
|
|
164
|
+
status: number;
|
|
165
|
+
statusCode: number;
|
|
166
|
+
constructor();
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Error used when the callback cannot find the login transaction cookie.
|
|
170
|
+
*/
|
|
171
|
+
declare class MissingStateCookieError extends Error {
|
|
172
|
+
static message: string;
|
|
173
|
+
status: number;
|
|
174
|
+
statusCode: number;
|
|
175
|
+
constructor();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { AccessTokenError, AccessTokenErrorCode, AuthError, CallbackHandlerError, ConfigError, type ConfigIssue, type ConfigIssuePathSegment, type HandlerErrorCause, LoginHandlerError, LogoutHandlerError, MalformedStateCookieError, MissingStateCookieError, MissingStateParamError };
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
type AuthErrorOptions = {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
name: string;
|
|
5
|
+
cause?: Error;
|
|
6
|
+
status?: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The base class for all SDK errors.
|
|
10
|
+
*
|
|
11
|
+
* Subclasses expose stable machine-readable codes for application-level error
|
|
12
|
+
* handling.
|
|
13
|
+
*/
|
|
14
|
+
declare abstract class AuthError extends Error {
|
|
15
|
+
/**
|
|
16
|
+
* A machine-readable error code that remains stable within a major version of the SDK. You
|
|
17
|
+
* should rely on this error code to handle errors. In contrast, the error message is not part of
|
|
18
|
+
* the API and can change anytime. Do **not** parse or otherwise rely on the error message to
|
|
19
|
+
* handle errors.
|
|
20
|
+
*/
|
|
21
|
+
readonly code: string;
|
|
22
|
+
/**
|
|
23
|
+
* The error class name.
|
|
24
|
+
*/
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/**
|
|
27
|
+
* The underlying error, if any.
|
|
28
|
+
*
|
|
29
|
+
* **IMPORTANT** When this error is from the Identity Provider ({@link IdentityProviderError}) it can contain user
|
|
30
|
+
* input and is only escaped using basic escaping for putting untrusted data directly into the HTML body.
|
|
31
|
+
*
|
|
32
|
+
* You should **not** render this error without using a templating engine that will properly escape it for other
|
|
33
|
+
* HTML contexts first.
|
|
34
|
+
*/
|
|
35
|
+
readonly cause?: Error;
|
|
36
|
+
/**
|
|
37
|
+
* The HTTP status code, if any.
|
|
38
|
+
*/
|
|
39
|
+
readonly status?: number;
|
|
40
|
+
/**
|
|
41
|
+
* @param options - Error metadata used by SDK-specific subclasses.
|
|
42
|
+
*/
|
|
43
|
+
constructor(options: AuthErrorOptions);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Error codes for {@link AccessTokenError}.
|
|
48
|
+
*/
|
|
49
|
+
declare enum AccessTokenErrorCode {
|
|
50
|
+
/** No valid session was available. */
|
|
51
|
+
MISSING_SESSION = "ERR_MISSING_SESSION",
|
|
52
|
+
/** Session exists but does not contain an access token. */
|
|
53
|
+
MISSING_ACCESS_TOKEN = "ERR_MISSING_ACCESS_TOKEN",
|
|
54
|
+
/** Refresh was required but no refresh token was stored. */
|
|
55
|
+
MISSING_REFRESH_TOKEN = "ERR_MISSING_REFRESH_TOKEN",
|
|
56
|
+
/** Access token is expired and cannot be returned as-is. */
|
|
57
|
+
EXPIRED_ACCESS_TOKEN = "ERR_EXPIRED_ACCESS_TOKEN",
|
|
58
|
+
/** Access token does not include the requested scopes. */
|
|
59
|
+
INSUFFICIENT_SCOPE = "ERR_INSUFFICIENT_SCOPE",
|
|
60
|
+
/** Refresh token grant failed or returned an invalid response. */
|
|
61
|
+
FAILED_REFRESH_GRANT = "ERR_FAILED_REFRESH_GRANT"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Error thrown when an access token cannot be returned or refreshed.
|
|
65
|
+
*
|
|
66
|
+
* Use {@link AccessTokenError.code} for stable error handling.
|
|
67
|
+
*/
|
|
68
|
+
declare class AccessTokenError extends AuthError {
|
|
69
|
+
/**
|
|
70
|
+
* @param code - Stable machine-readable error code.
|
|
71
|
+
* @param message - Human-readable diagnostic message.
|
|
72
|
+
* @param cause - Optional lower-level error.
|
|
73
|
+
*/
|
|
74
|
+
constructor(code: AccessTokenErrorCode, message: string, cause?: Error);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Standard Schema V1 path segment shape.
|
|
79
|
+
*/
|
|
80
|
+
interface ConfigIssuePathSegment {
|
|
81
|
+
readonly key: PropertyKey;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Standard Schema V1 issue shape returned by configuration validation.
|
|
85
|
+
*/
|
|
86
|
+
interface ConfigIssue {
|
|
87
|
+
readonly message: string;
|
|
88
|
+
readonly path?: readonly (PropertyKey | ConfigIssuePathSegment)[] | undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Error thrown when auth configuration validation fails.
|
|
92
|
+
*/
|
|
93
|
+
declare class ConfigError extends AuthError {
|
|
94
|
+
static readonly code = "ERR_CONFIG_VALIDATION";
|
|
95
|
+
/**
|
|
96
|
+
* Standard Schema validation issues for the invalid configuration.
|
|
97
|
+
*/
|
|
98
|
+
readonly issues: readonly ConfigIssue[];
|
|
99
|
+
/**
|
|
100
|
+
* @param issues - Standard Schema validation issues.
|
|
101
|
+
*/
|
|
102
|
+
constructor(issues: readonly ConfigIssue[]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Error shape used by lower-level HTTP libraries.
|
|
107
|
+
*/
|
|
108
|
+
interface HttpError extends Error {
|
|
109
|
+
status: number;
|
|
110
|
+
statusCode: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Supported causes for route-handler errors.
|
|
114
|
+
*/
|
|
115
|
+
type HandlerErrorCause = Error | AuthError | HttpError;
|
|
116
|
+
type HandlerErrorOptions = {
|
|
117
|
+
code: string;
|
|
118
|
+
message: string;
|
|
119
|
+
name: string;
|
|
120
|
+
cause: HandlerErrorCause;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Base class for errors thrown by route handlers.
|
|
124
|
+
*/
|
|
125
|
+
declare class HandlerError extends AuthError {
|
|
126
|
+
constructor(options: HandlerErrorOptions);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when callback handling fails.
|
|
130
|
+
*/
|
|
131
|
+
declare class CallbackHandlerError extends HandlerError {
|
|
132
|
+
static readonly code: string;
|
|
133
|
+
constructor(cause: HandlerErrorCause);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Error thrown when login handling fails.
|
|
137
|
+
*/
|
|
138
|
+
declare class LoginHandlerError extends HandlerError {
|
|
139
|
+
static readonly code: string;
|
|
140
|
+
constructor(cause: HandlerErrorCause);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Error thrown when logout handling fails.
|
|
144
|
+
*/
|
|
145
|
+
declare class LogoutHandlerError extends HandlerError {
|
|
146
|
+
static readonly code: string;
|
|
147
|
+
constructor(cause: HandlerErrorCause);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Error used when the callback response is missing a `state` parameter.
|
|
152
|
+
*/
|
|
153
|
+
declare class MissingStateParamError extends Error {
|
|
154
|
+
static message: string;
|
|
155
|
+
status: number;
|
|
156
|
+
statusCode: number;
|
|
157
|
+
constructor();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Error used when transaction state exists but cannot be parsed.
|
|
161
|
+
*/
|
|
162
|
+
declare class MalformedStateCookieError extends Error {
|
|
163
|
+
static message: string;
|
|
164
|
+
status: number;
|
|
165
|
+
statusCode: number;
|
|
166
|
+
constructor();
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Error used when the callback cannot find the login transaction cookie.
|
|
170
|
+
*/
|
|
171
|
+
declare class MissingStateCookieError extends Error {
|
|
172
|
+
static message: string;
|
|
173
|
+
status: number;
|
|
174
|
+
statusCode: number;
|
|
175
|
+
constructor();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { AccessTokenError, AccessTokenErrorCode, AuthError, CallbackHandlerError, ConfigError, type ConfigIssue, type ConfigIssuePathSegment, type HandlerErrorCause, LoginHandlerError, LogoutHandlerError, MalformedStateCookieError, MissingStateCookieError, MissingStateParamError };
|