@stackframe/stack-shared 1.2.0 → 2.0.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.
Files changed (38) hide show
  1. package/dist/helpers/fetch-token.d.ts +0 -1
  2. package/dist/helpers/password.d.ts +0 -1
  3. package/dist/hooks/use-async-external-store.d.ts +0 -1
  4. package/dist/hooks/use-strict-memo.d.ts +0 -1
  5. package/dist/index.d.ts +0 -1
  6. package/dist/interface/adminInterface.d.ts +0 -1
  7. package/dist/interface/clientInterface.d.ts +2 -2
  8. package/dist/interface/clientInterface.d.ts.map +1 -1
  9. package/dist/interface/clientInterface.js +1 -0
  10. package/dist/interface/serverInterface.d.ts +0 -1
  11. package/dist/utils/arrays.d.ts +0 -1
  12. package/dist/utils/bytes.d.ts +0 -1
  13. package/dist/utils/caches.d.ts +0 -1
  14. package/dist/utils/crypto.d.ts +0 -1
  15. package/dist/utils/dates.d.ts +0 -1
  16. package/dist/utils/dom.d.ts +0 -1
  17. package/dist/utils/env.d.ts +0 -1
  18. package/dist/utils/env.d.ts.map +1 -1
  19. package/dist/utils/env.js +8 -0
  20. package/dist/utils/errors.d.ts +0 -1
  21. package/dist/utils/html.d.ts +0 -1
  22. package/dist/utils/json.d.ts +0 -1
  23. package/dist/utils/jwt.d.ts +0 -1
  24. package/dist/utils/maps.d.ts +0 -1
  25. package/dist/utils/math.d.ts +0 -1
  26. package/dist/utils/numbers.d.ts +0 -1
  27. package/dist/utils/objects.d.ts +0 -1
  28. package/dist/utils/password.d.ts +0 -1
  29. package/dist/utils/promises.d.ts +0 -1
  30. package/dist/utils/react.d.ts +2 -3
  31. package/dist/utils/react.d.ts.map +1 -1
  32. package/dist/utils/react.js +7 -4
  33. package/dist/utils/results.d.ts +0 -1
  34. package/dist/utils/stores.d.ts +0 -1
  35. package/dist/utils/strings.d.ts +0 -1
  36. package/dist/utils/types.d.ts +0 -1
  37. package/dist/utils/uuids.d.ts +0 -1
  38. package/package.json +1 -1
@@ -1,2 +1 @@
1
1
  export declare const fetchTokenPrefix = "#stack-auth--if-you-see-this-you-probably-forgot-to-add-an-auth-provider----";
2
- //# sourceMappingURL=fetch-token.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function getPasswordError(password: string): string | null;
2
- //# sourceMappingURL=password.d.ts.map
@@ -2,4 +2,3 @@ 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,4 +4,3 @@
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,4 +2,3 @@ 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 { fetchTokenPrefix } from "./helpers/fetch-token";
5
- //# sourceMappingURL=index.d.ts.map
@@ -76,4 +76,3 @@ 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
@@ -1,3 +1,4 @@
1
+ import * as oauth from 'oauth4webapi';
1
2
  import { SignInErrorCode, SignUpErrorCode, EmailVerificationLinkErrorCode, PasswordResetLinkErrorCode, KnownErrorCode } from "../utils/types";
2
3
  import { Result } from "../utils/results";
3
4
  import { ReadonlyJson } from '../utils/json';
@@ -131,7 +132,7 @@ export declare class StackClientInterface {
131
132
  signInWithCredential(email: string, password: string, tokenStore: TokenStore): Promise<SignInErrorCode | undefined>;
132
133
  signUpWithCredential(email: string, password: string, emailVerificationRedirectUrl: string, tokenStore: TokenStore): Promise<SignUpErrorCode | undefined>;
133
134
  getOAuthUrl(provider: string, redirectUrl: string, codeChallenge: string, state: string): Promise<string>;
134
- callOAuthCallback(oauthParams: URLSearchParams, redirectUri: string, codeVerifier: string, state: string, tokenStore: TokenStore): Promise<void>;
135
+ callOAuthCallback(oauthParams: URLSearchParams, redirectUri: string, codeVerifier: string, state: string, tokenStore: TokenStore): Promise<oauth.OAuth2TokenEndpointResponse>;
135
136
  signOut(tokenStore: TokenStore): Promise<void>;
136
137
  getClientUserByToken(tokenStore: TokenStore): Promise<Result<UserJson>>;
137
138
  getClientProject(): Promise<Result<ClientProjectJson>>;
@@ -140,4 +141,3 @@ export declare class StackClientInterface {
140
141
  createProject(project: Pick<ProjectJson, "displayName" | "description">, tokenStore: TokenStore): Promise<ProjectJson>;
141
142
  }
142
143
  export declare function getProductionModeErrors(project: ProjectJson): ProductionModeError[];
143
- //# sourceMappingURL=clientInterface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientInterface.d.ts","sourceRoot":"","sources":["../../src/interface/clientInterface.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,eAAe,EACf,eAAe,EAKf,8BAA8B,EAG9B,0BAA0B,EAC1B,cAAc,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAa,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGjE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,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,eAAe,EAC5B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,UAAU;IAkDlB,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB9C,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAWvE,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAOtD,6BAA6B,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,UAAU;IAc3F,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAU5D,aAAa,CACjB,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,aAAa,CAAC,EACzD,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,WAAW,CAAC;CAmBxB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,mBAAmB,EAAE,CA0CnF"}
@@ -329,6 +329,7 @@ export class StackClientInterface {
329
329
  accessToken: result.access_token ?? null,
330
330
  refreshToken: result.refresh_token ?? old?.refreshToken ?? null,
331
331
  }));
332
+ return result;
332
333
  }
333
334
  async signOut(tokenStore) {
334
335
  const tokenObj = await tokenStore.getOrWait();
@@ -28,4 +28,3 @@ 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
@@ -8,4 +8,3 @@ 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,3 +1,2 @@
1
1
  export declare function encodeBase32(input: Uint8Array): string;
2
2
  export declare function decodeBase32(input: string): Uint8Array;
3
- //# sourceMappingURL=bytes.d.ts.map
@@ -79,4 +79,3 @@ declare class AsyncValueCache<T> {
79
79
  };
80
80
  }
81
81
  export {};
82
- //# sourceMappingURL=caches.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function generateSecureRandomString(minBitsOfEntropy?: number): string;
2
- //# sourceMappingURL=crypto.d.ts.map
@@ -10,4 +10,3 @@ 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,4 +2,3 @@
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,4 +2,3 @@
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
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.tsx"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUnD"}
package/dist/utils/env.js CHANGED
@@ -1,7 +1,15 @@
1
1
  import { throwErr } from "./errors";
2
+ import { deindent } from "./strings";
2
3
  /**
3
4
  * Returns the environment variable with the given name, throwing an error if it's undefined or the empty string.
4
5
  */
5
6
  export function getEnvVariable(name) {
7
+ if (typeof window !== 'undefined') {
8
+ throw new Error(deindent `
9
+ Can't use getEnvVariable on the client because Next.js transpiles expressions of the kind process.env.XYZ at build-time on the client.
10
+
11
+ Use process.env.XYZ directly instead.
12
+ `);
13
+ }
6
14
  return (process.env[name] ?? throwErr(`Missing environment variable: ${name}`)) || throwErr(`Empty environment variable: ${name}`);
7
15
  }
@@ -182,4 +182,3 @@ export declare class StatusError extends Error {
182
182
  isServerError(): boolean;
183
183
  }
184
184
  export {};
185
- //# sourceMappingURL=errors.d.ts.map
@@ -1,3 +1,2 @@
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,4 +8,3 @@ 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,4 +1,3 @@
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
@@ -21,4 +21,3 @@ 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,4 +2,3 @@
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,3 +1,2 @@
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
@@ -16,4 +16,3 @@ export declare function typedAssign<T extends {}, U extends {}>(target: T, sourc
16
16
  export declare function filterUndefined<T extends {}>(obj: T): {
17
17
  [k in keyof T]+?: T[k] & ({} | null);
18
18
  };
19
- //# sourceMappingURL=objects.d.ts.map
@@ -1,3 +1,2 @@
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
@@ -48,4 +48,3 @@ export type RateLimitOptions = {
48
48
  export declare function rateLimited<T>(func: () => Promise<T>, options: RateLimitOptions): () => Promise<T>;
49
49
  export declare function throttled<T, A extends any[]>(func: (...args: A) => Promise<T>, delayMs: number): (...args: A) => Promise<T>;
50
50
  export {};
51
- //# sourceMappingURL=promises.d.ts.map
@@ -7,7 +7,6 @@ export declare function getNodeText(node: React.ReactNode): string;
7
7
  */
8
8
  export declare function suspend(): never;
9
9
  /**
10
- * Use this in a component or a hook to disable SSR.
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
- export declare function suspendIfSsr(): void;
13
- //# sourceMappingURL=react.d.ts.map
12
+ export declare function suspendIfSsr(caller?: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/utils/react.tsx"],"names":[],"mappings":";AAIA,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAczD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,KAAK,CAG/B;AAGD;;GAEG;AACH,wBAAgB,YAAY,SAiB3B"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/utils/react.tsx"],"names":[],"mappings":";AAIA,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAczD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,KAAK,CAG/B;AAGD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,QAoB3C"}
@@ -26,18 +26,21 @@ export function suspend() {
26
26
  throw new Error("Somehow a Promise that never resolves was resolved?");
27
27
  }
28
28
  /**
29
- * Use this in a component or a hook to disable SSR.
29
+ * Use this in a component or a hook to disable SSR. Should be wrapped in a Suspense boundary, or it will throw an error.
30
30
  */
31
- export function suspendIfSsr() {
31
+ export function suspendIfSsr(caller) {
32
32
  if (typeof window === "undefined") {
33
33
  const error = Object.assign(new Error(deindent `
34
- This code path is not supported in SSR. This error should be caught by the closest Suspense boundary, and hence never be thrown on the client. If you still see the error, make sure the component is rendered inside a Suspense boundary.
34
+ ${caller ?? "This code path"} attempted to display a loading indicator during SSR by falling back to the nearest Suspense boundary. If you see this error, it means no Suspense boundary was found, and no loading indicator could be displayed. Make sure you are not catching this error with try-catch, and that the component is rendered inside a Suspense boundary, for example by adding a \`loading.tsx\` file in your app directory.
35
35
 
36
- See: https://react.dev/reference/react/Suspense#providing-a-fallback-for-server-errors-and-client-only-content
36
+ See: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
37
+
38
+ More information on SSR and Suspense boundaries: https://react.dev/reference/react/Suspense#providing-a-fallback-for-server-errors-and-client-only-content
37
39
  `), {
38
40
  // set the digest so nextjs doesn't log the error
39
41
  // https://github.com/vercel/next.js/blob/d01d6d9c35a8c2725b3d74c1402ab76d4779a6cf/packages/next/src/shared/lib/lazy-dynamic/bailout-to-csr.ts#L14
40
42
  digest: "BAILOUT_TO_CLIENT_SIDE_RENDERING",
43
+ reason: caller ?? "suspendIfSsr()",
41
44
  });
42
45
  throw error;
43
46
  }
@@ -71,4 +71,3 @@ 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,4 +55,3 @@ export declare class AsyncStore<T> implements ReadonlyAsyncStore<T> {
55
55
  unsubscribe: () => void;
56
56
  };
57
57
  }
58
- //# sourceMappingURL=stores.d.ts.map
@@ -38,4 +38,3 @@ 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
@@ -28,4 +28,3 @@ export declare class KnownError extends StatusError {
28
28
  readonly errorCode: KnownErrorCode;
29
29
  constructor(errorCode: KnownErrorCode);
30
30
  }
31
- //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1 @@
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": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [