@pikku/core 0.12.120 → 0.12.121

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.12.121
2
+
3
+ ### Patch Changes
4
+
5
+ - e84abd0: Add CredentialRejectedError: an upstream refused the stored per-user credential, so the user must sign in again or reconnect it.
6
+
1
7
  ## 0.12.120
2
8
 
3
9
  ### Patch Changes
@@ -28,6 +28,14 @@ export declare class MissingCredentialError extends PikkuError {
28
28
  };
29
29
  constructor(credentialName: string, credentialType: 'oauth2' | 'apikey', connectUrl?: string);
30
30
  }
31
+ export declare class CredentialRejectedError extends PikkuError {
32
+ payload: {
33
+ error: 'credential_rejected';
34
+ credentialName: string;
35
+ reauth: 'sign-in' | 'connect';
36
+ };
37
+ constructor(credentialName: string, reauth: 'sign-in' | 'connect', message?: string);
38
+ }
31
39
  export declare class MissingScopeError extends PikkuError {
32
40
  payload: {
33
41
  error: 'missing_scope';
@@ -73,6 +73,20 @@ addError(MissingCredentialError, {
73
73
  status: 403,
74
74
  message: 'A required credential is not configured.',
75
75
  });
76
+ export class CredentialRejectedError extends PikkuError {
77
+ payload;
78
+ constructor(credentialName, reauth, message) {
79
+ super(message ??
80
+ (reauth === 'sign-in'
81
+ ? `${credentialName} rejected the stored session — sign in again`
82
+ : `${credentialName} rejected the stored credential — reconnect it`));
83
+ this.payload = { error: 'credential_rejected', credentialName, reauth };
84
+ }
85
+ }
86
+ addError(CredentialRejectedError, {
87
+ status: 403,
88
+ message: 'The upstream service rejected the stored credential; the user has to sign in again or reconnect it.',
89
+ });
76
90
  export class MissingScopeError extends PikkuError {
77
91
  payload;
78
92
  constructor(scope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/core",
3
- "version": "0.12.120",
3
+ "version": "0.12.121",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pikkujs/pikku.git",
@@ -371,6 +371,7 @@
371
371
  "BadGatewayError",
372
372
  "BadRequestError",
373
373
  "ConflictError",
374
+ "CredentialRejectedError",
374
375
  "ExpectationFailedError",
375
376
  "FeatureUnavailableError",
376
377
  "ForbiddenError",