@stackframe/stack-shared 2.2.0 → 2.2.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.
Files changed (42) hide show
  1. package/dist/helpers/password.d.ts +1 -0
  2. package/dist/hooks/use-async-callback.d.ts +1 -0
  3. package/dist/hooks/use-async-external-store.d.ts +1 -0
  4. package/dist/hooks/use-strict-memo.d.ts +1 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/interface/adminInterface.d.ts +1 -0
  7. package/dist/interface/clientInterface.d.ts +1 -0
  8. package/dist/interface/clientInterface.js +1 -1
  9. package/dist/interface/serverInterface.d.ts +1 -0
  10. package/dist/known-errors.d.ts +2 -0
  11. package/dist/known-errors.d.ts.map +1 -1
  12. package/dist/known-errors.js +2 -0
  13. package/dist/utils/arrays.d.ts +1 -0
  14. package/dist/utils/bytes.d.ts +1 -0
  15. package/dist/utils/caches.d.ts +1 -0
  16. package/dist/utils/crypto.d.ts +1 -0
  17. package/dist/utils/dates.d.ts +1 -0
  18. package/dist/utils/dom.d.ts +1 -0
  19. package/dist/utils/env.d.ts +1 -0
  20. package/dist/utils/errors.d.ts +3 -0
  21. package/dist/utils/errors.d.ts.map +1 -1
  22. package/dist/utils/errors.js +2 -2
  23. package/dist/utils/functions.d.ts +1 -0
  24. package/dist/utils/html.d.ts +1 -0
  25. package/dist/utils/json.d.ts +1 -0
  26. package/dist/utils/jwt.d.ts +1 -0
  27. package/dist/utils/jwt.d.ts.map +1 -1
  28. package/dist/utils/maps.d.ts +1 -0
  29. package/dist/utils/math.d.ts +1 -0
  30. package/dist/utils/numbers.d.ts +1 -0
  31. package/dist/utils/objects.d.ts +1 -0
  32. package/dist/utils/password.d.ts +1 -0
  33. package/dist/utils/promises.d.ts +1 -0
  34. package/dist/utils/react.d.ts +1 -0
  35. package/dist/utils/results.d.ts +1 -0
  36. package/dist/utils/stores.d.ts +1 -0
  37. package/dist/utils/strings.d.ts +1 -0
  38. package/dist/utils/types.d.ts +1 -4
  39. package/dist/utils/types.d.ts.map +1 -1
  40. package/dist/utils/types.js +1 -4
  41. package/dist/utils/uuids.d.ts +1 -0
  42. package/package.json +1 -1
@@ -1,2 +1,3 @@
1
1
  import { KnownErrors } from "..";
2
2
  export declare function getPasswordError(password: string): KnownErrors["PasswordRequirementsNotMet"] | undefined;
3
+ //# sourceMappingURL=password.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import React from "react";
2
2
  export declare function useAsyncCallback<A extends any[], R>(callback: (...args: A) => Promise<R>, deps: React.DependencyList): [cb: (...args: A) => Promise<R>, loading: boolean, error: unknown | undefined];
3
3
  export declare function useAsyncCallbackWithLoggedError<A extends any[], R>(callback: (...args: A) => Promise<R>, deps: React.DependencyList): [cb: (...args: A) => Promise<R>, loading: boolean];
4
+ //# sourceMappingURL=use-async-callback.d.ts.map
@@ -2,3 +2,4 @@ import { AsyncResult } from "../utils/results";
2
2
  export declare function useAsyncExternalStore<T>(subscribe: (callback: (t: T) => void) => (() => void)): AsyncResult<T, never> & {
3
3
  status: "ok" | "pending";
4
4
  };
5
+ //# sourceMappingURL=use-async-external-store.d.ts.map
@@ -4,3 +4,4 @@
4
4
  * The most recent value will be kept from garbage collection until one of the dependencies becomes unreachable. This may be true even after the component no longer renders. Be wary of memory leaks.
5
5
  */
6
6
  export declare function useStrictMemo<T>(callback: () => T, dependencies: any[]): T;
7
+ //# sourceMappingURL=use-strict-memo.d.ts.map
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { StackClientInterface, UserJson as UserJson, UserCustomizableJson, Clien
2
2
  export { StackServerInterface, ServerUserJson, ServerUserCustomizableJson, } from "./interface/serverInterface";
3
3
  export { StackAdminInterface, ApiKeySetBaseJson, ApiKeySetFirstViewJson, ApiKeySetJson, } from "./interface/adminInterface";
4
4
  export { KnownError, KnownErrors, } from "./known-errors";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -76,3 +76,4 @@ export declare class StackAdminInterface extends StackServerInterface {
76
76
  revokeApiKeySetById(id: string): Promise<void>;
77
77
  getApiKeySet(id: string, tokenStore: TokenStore): Promise<ApiKeySetJson>;
78
78
  }
79
+ //# sourceMappingURL=adminInterface.d.ts.map
@@ -138,3 +138,4 @@ export declare class StackClientInterface {
138
138
  createProject(project: Pick<ProjectJson, "displayName" | "description">, tokenStore: TokenStore): Promise<ProjectJson>;
139
139
  }
140
140
  export declare function getProductionModeErrors(project: ProjectJson): ProductionModeError[];
141
+ //# sourceMappingURL=clientInterface.d.ts.map
@@ -154,7 +154,7 @@ export class StackClientInterface {
154
154
  const processedRes = await this._processResponse(rawRes);
155
155
  if (processedRes.status === "error") {
156
156
  // If the access token is expired, reset it and retry
157
- if (processedRes.error instanceof KnownErrors.AccessTokenExpired) {
157
+ if (processedRes.error instanceof KnownErrors.InvalidAccessToken) {
158
158
  tokenStore.set({
159
159
  accessToken: null,
160
160
  refreshToken: tokenObj.refreshToken,
@@ -28,3 +28,4 @@ export declare class StackServerInterface extends StackClientInterface {
28
28
  setServerUserCustomizableData(userId: string, update: Partial<ServerUserCustomizableJson>): Promise<void>;
29
29
  deleteServerUser(userId: string): Promise<void>;
30
30
  }
31
+ //# sourceMappingURL=serverInterface.d.ts.map
@@ -17,6 +17,7 @@ export declare abstract class KnownError extends StatusError {
17
17
  readonly statusCode: number;
18
18
  readonly humanReadableMessage: string;
19
19
  readonly details?: Json | undefined;
20
+ name: string;
20
21
  constructor(statusCode: number, humanReadableMessage: string, details?: Json | undefined);
21
22
  getBody(): Uint8Array;
22
23
  getHeaders(): Record<string, string[]>;
@@ -200,3 +201,4 @@ export declare const KnownErrors: {
200
201
  };
201
202
  };
202
203
  export {};
204
+ //# sourceMappingURL=known-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"known-errors.d.ts","sourceRoot":"","sources":["../src/known-errors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MA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EAAE,MAAM;aAC5B,OAAO,CAAC;IALnB,IAAI,SAAgB;gBAGT,UAAU,EAAE,MAAM,EAClB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,CAAC,kBAAM;IAQhB,OAAO,IAAI,UAAU;IAQrB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAOtD,IAAI,SAAS,IAAI,MAAM,CAEtB;WAEa,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,qBAAqB,CAAC,OAAO,UAAU,CAAC;WAQvF,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU;CAYzD;AAED,QAAA,MAAM,sCAAsC,eAAmD,CAAC;AAChG;;GAEG;AACH,KAAK,eAAe,CAAC,SAAS,SAAS,MAAM,IAAI;IAC/C;;;;OAIG;IACH,CAAC,sCAAsC,CAAC,EAAE;SACvC,CAAC,IAAI,SAAS,GAAG,IAAI;KACvB,CAAC;CACH,CAAC;AA+hBF,MAAM,MAAM,WAAW,GAAG;KACvB,CAAC,IAAI,MAAM,OAAO,WAAW,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDmC,CAAC"}
@@ -4,6 +4,7 @@ export class KnownError extends StatusError {
4
4
  statusCode;
5
5
  humanReadableMessage;
6
6
  details;
7
+ name = "KnownError";
7
8
  constructor(statusCode, humanReadableMessage, details) {
8
9
  super(statusCode, humanReadableMessage);
9
10
  this.statusCode = statusCode;
@@ -51,6 +52,7 @@ function createKnownErrorConstructor(SuperClass, errorCode, create, constructorA
51
52
  // @ts-expect-error this is not a mixin, but TS detects it as one
52
53
  class KnownErrorImpl extends SuperClass {
53
54
  static errorCode = errorCode;
55
+ name = `KnownError<${errorCode}>`;
54
56
  constructor(...args) {
55
57
  // @ts-expect-error
56
58
  super(...createFn(...args));
@@ -8,3 +8,4 @@ export declare function range(startInclusive: number, endExclusive: number, step
8
8
  export declare function rotateLeft(arr: readonly any[], n: number): any[];
9
9
  export declare function rotateRight(arr: readonly any[], n: number): any[];
10
10
  export declare function shuffle<T>(arr: readonly T[]): T[];
11
+ //# sourceMappingURL=arrays.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export declare function encodeBase32(input: Uint8Array): string;
2
2
  export declare function decodeBase32(input: string): Uint8Array;
3
+ //# sourceMappingURL=bytes.d.ts.map
@@ -82,3 +82,4 @@ declare class AsyncValueCache<T> {
82
82
  };
83
83
  }
84
84
  export {};
85
+ //# sourceMappingURL=caches.d.ts.map
@@ -3,3 +3,4 @@
3
3
  * random number generator.
4
4
  */
5
5
  export declare function generateSecureRandomString(minBitsOfEntropy?: number): string;
6
+ //# sourceMappingURL=crypto.d.ts.map
@@ -10,3 +10,4 @@ export declare function fromNowDetailed(date: Date): {
10
10
  * Returns a string representation of the given date in the format expected by the `datetime-local` input type.
11
11
  */
12
12
  export declare function getInputDatetimeLocalString(date: Date): string;
13
+ //# sourceMappingURL=dates.d.ts.map
@@ -2,3 +2,4 @@
2
2
  * https://n2d4.github.io/frontend-starter/guides/advanced-concepts#clickable-parents
3
3
  */
4
4
  export declare function hasClickableParent(element: HTMLElement): boolean;
5
+ //# sourceMappingURL=dom.d.ts.map
@@ -2,3 +2,4 @@
2
2
  * Returns the environment variable with the given name, throwing an error if it's undefined or the empty string.
3
3
  */
4
4
  export declare function getEnvVariable(name: string): string;
5
+ //# sourceMappingURL=env.d.ts.map
@@ -4,6 +4,7 @@ export declare function throwErr(error: Error): never;
4
4
  export declare function throwErr(...args: StatusErrorConstructorParameters): never;
5
5
  export declare class StackAssertionError extends Error {
6
6
  readonly extraData?: Record<string, any> | undefined;
7
+ name: string;
7
8
  constructor(message: string, extraData?: Record<string, any> | undefined, options?: ErrorOptions);
8
9
  }
9
10
  export declare function throwStackErr(message: string, extraData?: any): never;
@@ -18,6 +19,7 @@ type StatusErrorConstructorParameters = [
18
19
  message?: string
19
20
  ];
20
21
  export declare class StatusError extends Error {
22
+ name: string;
21
23
  readonly statusCode: number;
22
24
  static BadRequest: {
23
25
  statusCode: number;
@@ -188,3 +190,4 @@ export declare class StatusError extends Error {
188
190
  toHttpJson(): Json;
189
191
  }
190
192
  export {};
193
+ //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC;AACtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;AAC9C,wBAAgB,QAAQ,CAAC,GAAG,IAAI,EAAE,gCAAgC,GAAG,KAAK,CAAC;AAa3E,qBAAa,mBAAoB,SAAQ,KAAK;aACC,SAAS,CAAC;gBAA3C,OAAO,EAAE,MAAM,EAAkB,SAAS,CAAC,iCAAqB,EAAE,OAAO,CAAC,EAAE,YAAY;CAGrG;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,KAAK,CAErE;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAOxF;AAGD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAInE;AAGD,KAAK,MAAM,GAAG;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF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F,OAAc,mBAAmB;;;MAAwD;IACzF,OAAc,YAAY;;;MAAiD;IAC3E,OAAc,WAAW;;;MAAgD;IACzE,OAAc,6BAA6B;;;MAAmE;gBAGlG,GAAG,IAAI,EAAE,gCAAgC;IAc9C,aAAa;IAIb,aAAa;IAIb,aAAa,IAAI,MAAM;IAIvB,OAAO,IAAI,UAAU;IAIrB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAMtC,UAAU,IAAI,IAAI;CAO1B"}
@@ -12,6 +12,7 @@ export function throwErr(...args) {
12
12
  }
13
13
  export class StackAssertionError extends Error {
14
14
  extraData;
15
+ name = "StackAssertionError";
15
16
  constructor(message, extraData, options) {
16
17
  super(`${message}\n\nThis is likely an error in Stack. Please report it.`, options);
17
18
  this.extraData = extraData;
@@ -23,10 +24,8 @@ export function throwStackErr(message, extraData) {
23
24
  const errorSinks = new Set();
24
25
  export function registerErrorSink(sink) {
25
26
  if (errorSinks.has(sink)) {
26
- console.log("Error sink already registered", sink);
27
27
  return;
28
28
  }
29
- console.log("Registering error sink", sink);
30
29
  errorSinks.add(sink);
31
30
  }
32
31
  registerErrorSink((location, ...args) => console.error(`Error in ${location}:`, ...args));
@@ -36,6 +35,7 @@ export function captureError(location, error) {
36
35
  }
37
36
  }
38
37
  export class StatusError extends Error {
38
+ name = "StatusError";
39
39
  statusCode;
40
40
  static BadRequest = { statusCode: 400, message: "Bad Request" };
41
41
  static Unauthorized = { statusCode: 401, message: "Unauthorized" };
@@ -1,2 +1,3 @@
1
1
  export declare function identity<T>(t: T): T;
2
2
  export declare function identityArgs<T extends any[]>(...args: T): T;
3
+ //# sourceMappingURL=functions.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export declare function escapeHtml(unsafe: string): string;
2
2
  export declare function html(strings: TemplateStringsArray, ...values: any[]): string;
3
+ //# sourceMappingURL=html.d.ts.map
@@ -8,3 +8,4 @@ export type ReadonlyJson = null | boolean | number | string | readonly ReadonlyJ
8
8
  export declare function isJson(value: unknown): value is Json;
9
9
  export declare function parseJson(json: string): Result<Json>;
10
10
  export declare function stringifyJson(json: Json): Result<string>;
11
+ //# sourceMappingURL=json.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import * as jose from "jose";
2
2
  export declare function encryptJWT(payload: any, expirationTime?: string): Promise<string>;
3
3
  export declare function decryptJWT(jwt: string): Promise<jose.JWTPayload>;
4
+ //# sourceMappingURL=jwt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/utils/jwt.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAK7B,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,SAAO,mBAMnE;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,4BAK3C"}
1
+ {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/utils/jwt.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAM7B,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,SAAO,mBAMnE;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,4BAK3C"}
@@ -21,3 +21,4 @@ export declare class DependenciesMap<K extends any[], V> {
21
21
  clear(): void;
22
22
  [Symbol.toStringTag]: string;
23
23
  }
24
+ //# sourceMappingURL=maps.d.ts.map
@@ -2,3 +2,4 @@
2
2
  * Similar to the modulo operator, but always returns a positive number (even when the input is negative).
3
3
  */
4
4
  export declare function remainder(n: number, d: number): number;
5
+ //# sourceMappingURL=math.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export declare function prettyPrintWithMagnitudes(num: number): string;
2
2
  export declare function toFixedMax(num: number, maxDecimals: number): string;
3
+ //# sourceMappingURL=numbers.d.ts.map
@@ -21,3 +21,4 @@ export declare function filterUndefined<T extends {}>(obj: T): {
21
21
  };
22
22
  export declare function pick<T extends {}, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
23
23
  export declare function omit<T extends {}, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
24
+ //# sourceMappingURL=objects.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export declare function hashPassword(password: string): Promise<string>;
2
2
  export declare function comparePassword(password: string, hash: string): Promise<boolean>;
3
+ //# sourceMappingURL=password.d.ts.map
@@ -50,3 +50,4 @@ export type RateLimitOptions = {
50
50
  export declare function rateLimited<T>(func: () => Promise<T>, options: RateLimitOptions): () => Promise<T>;
51
51
  export declare function throttled<T, A extends any[]>(func: (...args: A) => Promise<T>, delayMs: number): (...args: A) => Promise<T>;
52
52
  export {};
53
+ //# sourceMappingURL=promises.d.ts.map
@@ -10,3 +10,4 @@ export declare function suspend(): never;
10
10
  * Use this in a component or a hook to disable SSR. Should be wrapped in a Suspense boundary, or it will throw an error.
11
11
  */
12
12
  export declare function suspendIfSsr(caller?: string): void;
13
+ //# sourceMappingURL=react.d.ts.map
@@ -71,3 +71,4 @@ declare function retry<T>(fn: () => Result<T> | Promise<Result<T>>, retries: num
71
71
  exponentialDelayBase?: number | undefined;
72
72
  }): Promise<Result<T, RetryError>>;
73
73
  export {};
74
+ //# sourceMappingURL=results.d.ts.map
@@ -55,3 +55,4 @@ export declare class AsyncStore<T> implements ReadonlyAsyncStore<T> {
55
55
  unsubscribe: () => void;
56
56
  };
57
57
  }
58
+ //# sourceMappingURL=stores.d.ts.map
@@ -38,3 +38,4 @@ export declare function trimLines(s: string): string;
38
38
  export declare function templateIdentity(strings: TemplateStringsArray | readonly string[], ...values: any[]): string;
39
39
  export declare function deindent(code: string): string;
40
40
  export declare function deindent(strings: TemplateStringsArray | readonly string[], ...values: any[]): string;
41
+ //# sourceMappingURL=strings.d.ts.map
@@ -14,8 +14,7 @@ export declare const EmailVerificationLinkUsedErrorCode = "EMAIL_VERIFICATION_LI
14
14
  export declare const PasswordResetLinkInvalidErrorCode = "PASSWORD_RESET_LINK_INVALID";
15
15
  export declare const PasswordResetLinkExpiredErrorCode = "PASSWORD_RESET_LINK_EXPIRED";
16
16
  export declare const PasswordResetLinkUsedErrorCode = "PASSWORD_RESET_LINK_USED";
17
- export declare const WrongPasswordErrorCode = "WRONG_PASSWORD";
18
- export declare const KnownErrorCodes: readonly ["ACCESS_TOKEN_EXPIRED", "GRANT_INVALID", "USER_ALREADY_EXIST", "USER_NOT_EXIST", "USER_NOT_VERIFIED", "EMAIL_PASSWORD_MISS_MATCH", "REDIRECT_URL_INVALID", "PASSWORD_FORMAT_INVALID", "PROJECT_ID_OR_KEY_INVALID", "EMAIL_VERIFICATION_LINK_INVALID", "EMAIL_VERIFICATION_LINK_EXPIRED", "EMAIL_VERIFICATION_LINK_USED", "PASSWORD_RESET_LINK_INVALID", "PASSWORD_RESET_LINK_EXPIRED", "PASSWORD_RESET_LINK_USED", "WRONG_PASSWORD"];
17
+ export declare const KnownErrorCodes: readonly ["ACCESS_TOKEN_EXPIRED", "GRANT_INVALID", "USER_ALREADY_EXIST", "USER_NOT_EXIST", "USER_NOT_VERIFIED", "EMAIL_PASSWORD_MISS_MATCH", "REDIRECT_URL_INVALID", "PASSWORD_FORMAT_INVALID", "PROJECT_ID_OR_KEY_INVALID", "EMAIL_VERIFICATION_LINK_INVALID", "EMAIL_VERIFICATION_LINK_EXPIRED", "EMAIL_VERIFICATION_LINK_USED", "PASSWORD_RESET_LINK_INVALID", "PASSWORD_RESET_LINK_EXPIRED", "PASSWORD_RESET_LINK_USED"];
19
18
  export type KnownErrorCode = typeof KnownErrorCodes[number];
20
19
  export declare const SignUpErrorCodes: readonly ["USER_ALREADY_EXIST"];
21
20
  export type SignUpErrorCode = typeof SignUpErrorCodes[number];
@@ -25,8 +24,6 @@ export declare const EmailVerificationLinkErrorCodes: readonly ["EMAIL_VERIFICAT
25
24
  export type EmailVerificationLinkErrorCode = typeof EmailVerificationLinkErrorCodes[number];
26
25
  export declare const PasswordResetLinkErrorCodes: readonly ["PASSWORD_RESET_LINK_INVALID", "PASSWORD_RESET_LINK_EXPIRED", "PASSWORD_RESET_LINK_USED"];
27
26
  export type PasswordResetLinkErrorCode = typeof PasswordResetLinkErrorCodes[number];
28
- export declare const PasswordUpdateErrorCodes: readonly ["WRONG_PASSWORD", "PASSWORD_FORMAT_INVALID"];
29
- export type PasswordUpdateErrorCode = typeof PasswordUpdateErrorCodes[number];
30
27
  export declare class KnownError extends StatusError {
31
28
  readonly errorCode: KnownErrorCode;
32
29
  constructor(errorCode: KnownErrorCode);
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AACrD,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAC9D,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAC5D,eAAO,MAAM,+BAA+B,8BAA8B,CAAC;AAC3E,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AACxE,eAAO,MAAM,8BAA8B,8BAA8B,CAAC;AAC1E,eAAO,MAAM,qCAAqC,oCAAoC,CAAC;AACvF,eAAO,MAAM,qCAAqC,oCAAoC,CAAC;AACvF,eAAO,MAAM,kCAAkC,iCAAiC,CAAC;AACjF,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAC/E,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAC/E,eAAO,MAAM,8BAA8B,6BAA6B,CAAC;AACzE,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AAEvD,eAAO,MAAM,eAAe,gbAiBlB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE5D,eAAO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AAkC,iCAAiC,CAAC;AACjF,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAC/E,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAC/E,eAAO,MAAM,8BAA8B,6BAA6B,CAAC;AAEzE,eAAO,MAAM,eAAe,8ZAgBlB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,gBAAgB,iCAAuC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB,0DAGnB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,+BAA+B,iHAIlC,CAAC;AACX,MAAM,MAAM,8BAA8B,GAAG,OAAO,+BAA+B,CAAC,MAAM,CAAC,CAAA;AAE3F,eAAO,MAAM,2BAA2B,qGAI9B,CAAC;AACX,MAAM,MAAM,0BAA0B,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAA;AAEnF,qBAAa,UAAW,SAAQ,WAAW;aACb,SAAS,EAAE,cAAc;gBAAzB,SAAS,EAAE,cAAc;CAatD"}
@@ -14,7 +14,6 @@ export const EmailVerificationLinkUsedErrorCode = "EMAIL_VERIFICATION_LINK_USED"
14
14
  export const PasswordResetLinkInvalidErrorCode = "PASSWORD_RESET_LINK_INVALID";
15
15
  export const PasswordResetLinkExpiredErrorCode = "PASSWORD_RESET_LINK_EXPIRED";
16
16
  export const PasswordResetLinkUsedErrorCode = "PASSWORD_RESET_LINK_USED";
17
- export const WrongPasswordErrorCode = "WRONG_PASSWORD";
18
17
  export const KnownErrorCodes = [
19
18
  AccessTokenExpiredErrorCode,
20
19
  GrantInvalidErrorCode,
@@ -31,7 +30,6 @@ export const KnownErrorCodes = [
31
30
  PasswordResetLinkInvalidErrorCode,
32
31
  PasswordResetLinkExpiredErrorCode,
33
32
  PasswordResetLinkUsedErrorCode,
34
- WrongPasswordErrorCode
35
33
  ];
36
34
  export const SignUpErrorCodes = [UserAlreadyExistErrorCode];
37
35
  export const SignInErrorCodes = [
@@ -48,7 +46,6 @@ export const PasswordResetLinkErrorCodes = [
48
46
  PasswordResetLinkExpiredErrorCode,
49
47
  PasswordResetLinkUsedErrorCode
50
48
  ];
51
- export const PasswordUpdateErrorCodes = [WrongPasswordErrorCode, PasswordFormatInvalidErrorCode];
52
49
  export class KnownError extends StatusError {
53
50
  errorCode;
54
51
  constructor(errorCode) {
@@ -56,7 +53,7 @@ export class KnownError extends StatusError {
56
53
  error_code: errorCode,
57
54
  }), {
58
55
  headers: {
59
- "content-type": ["application/json"],
56
+ "content-type": "application/json",
60
57
  },
61
58
  });
62
59
  this.errorCode = errorCode;
@@ -1 +1,2 @@
1
1
  export declare function generateUuid(): string;
2
+ //# sourceMappingURL=uuids.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-shared",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [