@stackframe/js 2.7.18 → 2.7.20
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 +18 -0
- package/dist/esm/generated/global-css.js +1 -1
- package/dist/esm/generated/global-css.js.map +1 -1
- package/dist/esm/lib/stack-app.js +17 -15
- package/dist/esm/lib/stack-app.js.map +1 -1
- package/dist/generated/global-css.d.mts +1 -1
- package/dist/generated/global-css.d.ts +1 -1
- package/dist/generated/global-css.js +1 -1
- package/dist/generated/global-css.js.map +1 -1
- package/dist/lib/stack-app.d.mts +4 -3
- package/dist/lib/stack-app.d.ts +4 -3
- package/dist/lib/stack-app.js +17 -15
- package/dist/lib/stack-app.js.map +1 -1
- package/package.json +2 -3
package/dist/lib/stack-app.d.ts
CHANGED
|
@@ -14,7 +14,10 @@ type RequestLike = {
|
|
|
14
14
|
get: (name: string) => string | null;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
type RedirectMethod = "window" | "
|
|
17
|
+
type RedirectMethod = "window" | "none" | {
|
|
18
|
+
useNavigate: () => (to: string) => void;
|
|
19
|
+
navigate?: (to: string) => void;
|
|
20
|
+
};
|
|
18
21
|
type TokenStoreInit<HasTokenStore extends boolean = boolean> = HasTokenStore extends true ? ("cookie" | "nextjs-cookie" | "memory" | RequestLike | {
|
|
19
22
|
accessToken: string;
|
|
20
23
|
refreshToken: string;
|
|
@@ -404,7 +407,6 @@ type AdminProjectConfig = {
|
|
|
404
407
|
readonly passkeyEnabled: boolean;
|
|
405
408
|
readonly clientTeamCreationEnabled: boolean;
|
|
406
409
|
readonly clientUserDeletionEnabled: boolean;
|
|
407
|
-
readonly legacyGlobalJwtSigning: boolean;
|
|
408
410
|
readonly allowLocalhost: boolean;
|
|
409
411
|
readonly oauthProviders: AdminOAuthProviderConfig[];
|
|
410
412
|
readonly emailConfig?: AdminEmailConfig;
|
|
@@ -455,7 +457,6 @@ type AdminProjectConfigUpdateOptions = {
|
|
|
455
457
|
allowLocalhost?: boolean;
|
|
456
458
|
createTeamOnSignUp?: boolean;
|
|
457
459
|
emailConfig?: AdminEmailConfig;
|
|
458
|
-
legacyGlobalJwtSigning?: false;
|
|
459
460
|
teamCreatorDefaultPermissions?: {
|
|
460
461
|
id: string;
|
|
461
462
|
}[];
|
package/dist/lib/stack-app.js
CHANGED
|
@@ -44,7 +44,6 @@ var import_production_mode = require("@stackframe/stack-shared/dist/helpers/prod
|
|
|
44
44
|
var import_sessions = require("@stackframe/stack-shared/dist/sessions");
|
|
45
45
|
var import_bytes = require("@stackframe/stack-shared/dist/utils/bytes");
|
|
46
46
|
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
|
47
|
-
var import_compile_time = require("@stackframe/stack-shared/dist/utils/compile-time");
|
|
48
47
|
var import_env = require("@stackframe/stack-shared/dist/utils/env");
|
|
49
48
|
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
|
50
49
|
var import_maps = require("@stackframe/stack-shared/dist/utils/maps");
|
|
@@ -56,13 +55,11 @@ var import_strings = require("@stackframe/stack-shared/dist/utils/strings");
|
|
|
56
55
|
var import_urls = require("@stackframe/stack-shared/dist/utils/urls");
|
|
57
56
|
var import_uuids = require("@stackframe/stack-shared/dist/utils/uuids");
|
|
58
57
|
var cookie = __toESM(require("cookie"));
|
|
59
|
-
var NextNavigationUnscrambled = __toESM(require("next/navigation"));
|
|
60
58
|
var import_url = require("../utils/url");
|
|
61
59
|
var import_auth = require("./auth");
|
|
62
60
|
var import_cookie = require("./cookie");
|
|
63
61
|
var isReactServer = false;
|
|
64
|
-
var
|
|
65
|
-
var clientVersion = "js @stackframe/js@2.7.18";
|
|
62
|
+
var clientVersion = "js @stackframe/js@2.7.20";
|
|
66
63
|
if (clientVersion.startsWith("STACK_COMPILE_TIME")) {
|
|
67
64
|
throw new import_errors.StackAssertionError("Client version was not replaced. Something went wrong during build!");
|
|
68
65
|
}
|
|
@@ -243,7 +240,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
243
240
|
getBaseUrl: () => getBaseUrl(_options.baseUrl),
|
|
244
241
|
projectId: _options.projectId ?? getDefaultProjectId(),
|
|
245
242
|
clientVersion,
|
|
246
|
-
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey()
|
|
243
|
+
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey(),
|
|
244
|
+
prepareRequest: async () => {
|
|
245
|
+
}
|
|
247
246
|
});
|
|
248
247
|
}
|
|
249
248
|
this._tokenStoreInit = _options.tokenStore;
|
|
@@ -854,17 +853,16 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
854
853
|
async _redirectTo(options) {
|
|
855
854
|
if (this._redirectMethod === "none") {
|
|
856
855
|
return;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
NextNavigation.redirect(options.url.toString(), options.replace ? NextNavigation.RedirectType.replace : NextNavigation.RedirectType.push);
|
|
856
|
+
} else if (typeof this._redirectMethod === "object" && this._redirectMethod.navigate) {
|
|
857
|
+
this._redirectMethod.navigate(options.url.toString());
|
|
860
858
|
} else {
|
|
861
859
|
if (options.replace) {
|
|
862
860
|
window.location.replace(options.url);
|
|
863
861
|
} else {
|
|
864
862
|
window.location.assign(options.url);
|
|
865
863
|
}
|
|
866
|
-
await (0, import_promises.wait)(2e3);
|
|
867
864
|
}
|
|
865
|
+
await (0, import_promises.wait)(2e3);
|
|
868
866
|
}
|
|
869
867
|
async _redirectIfTrusted(url, options) {
|
|
870
868
|
if (!await this._isTrusted(url)) {
|
|
@@ -1291,6 +1289,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1291
1289
|
if (!("publishableClientKey" in this._interface.options)) {
|
|
1292
1290
|
throw new import_errors.StackAssertionError("Cannot serialize to JSON from an application without a publishable client key");
|
|
1293
1291
|
}
|
|
1292
|
+
if (typeof this._redirectMethod !== "string") {
|
|
1293
|
+
throw new import_errors.StackAssertionError("Cannot serialize to JSON from an application with a non-string redirect method");
|
|
1294
|
+
}
|
|
1294
1295
|
return {
|
|
1295
1296
|
baseUrl: this._options.baseUrl,
|
|
1296
1297
|
projectId: this.projectId,
|
|
@@ -1298,7 +1299,8 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1298
1299
|
tokenStore: this._tokenStoreInit,
|
|
1299
1300
|
urls: this._urlOptions,
|
|
1300
1301
|
oauthScopesOnSignIn: this._oauthScopesOnSignIn,
|
|
1301
|
-
uniqueIdentifier: this._getUniqueIdentifier()
|
|
1302
|
+
uniqueIdentifier: this._getUniqueIdentifier(),
|
|
1303
|
+
redirectMethod: this._redirectMethod
|
|
1302
1304
|
};
|
|
1303
1305
|
},
|
|
1304
1306
|
setCurrentUser: (userJsonPromise) => {
|
|
@@ -1332,7 +1334,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
|
|
|
1332
1334
|
publishableClientKey: options.publishableClientKey,
|
|
1333
1335
|
tokenStore: options.tokenStore,
|
|
1334
1336
|
urls: options.urls ?? {},
|
|
1335
|
-
oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {}
|
|
1337
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {},
|
|
1338
|
+
redirectMethod: options.redirectMethod
|
|
1336
1339
|
});
|
|
1337
1340
|
// TODO override the client user cache to use the server user cache, so we save some requests
|
|
1338
1341
|
this._currentServerUserCache = createCacheBySession(async (session) => {
|
|
@@ -1747,7 +1750,8 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
|
|
|
1747
1750
|
projectId: options.projectId,
|
|
1748
1751
|
tokenStore: options.tokenStore,
|
|
1749
1752
|
urls: options.urls,
|
|
1750
|
-
oauthScopesOnSignIn: options.oauthScopesOnSignIn
|
|
1753
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn,
|
|
1754
|
+
redirectMethod: options.redirectMethod
|
|
1751
1755
|
});
|
|
1752
1756
|
this._adminProjectCache = createCache(async () => {
|
|
1753
1757
|
return await this._interface.getProject();
|
|
@@ -1796,7 +1800,6 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
|
|
|
1796
1800
|
credentialEnabled: data.config.credential_enabled,
|
|
1797
1801
|
magicLinkEnabled: data.config.magic_link_enabled,
|
|
1798
1802
|
passkeyEnabled: data.config.passkey_enabled,
|
|
1799
|
-
legacyGlobalJwtSigning: data.config.legacy_global_jwt_signing,
|
|
1800
1803
|
clientTeamCreationEnabled: data.config.client_team_creation_enabled,
|
|
1801
1804
|
clientUserDeletionEnabled: data.config.client_user_deletion_enabled,
|
|
1802
1805
|
allowLocalhost: data.config.allow_localhost,
|
|
@@ -2079,8 +2082,7 @@ function adminProjectUpdateOptionsToCrud(options) {
|
|
|
2079
2082
|
client_team_creation_enabled: options.config?.clientTeamCreationEnabled,
|
|
2080
2083
|
client_user_deletion_enabled: options.config?.clientUserDeletionEnabled,
|
|
2081
2084
|
team_creator_default_permissions: options.config?.teamCreatorDefaultPermissions,
|
|
2082
|
-
team_member_default_permissions: options.config?.teamMemberDefaultPermissions
|
|
2083
|
-
legacy_global_jwt_signing: options.config?.legacyGlobalJwtSigning
|
|
2085
|
+
team_member_default_permissions: options.config?.teamMemberDefaultPermissions
|
|
2084
2086
|
}
|
|
2085
2087
|
};
|
|
2086
2088
|
}
|