@insforge/sdk 1.3.0 → 1.3.1
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/CONTRIBUTING.md +27 -0
- package/README.md +5 -2
- package/SDK-REFERENCE.md +842 -0
- package/dist/{client-CQfw9UsO.d.mts → client-DTNmGqHB.d.mts} +20 -5
- package/dist/{client-CQfw9UsO.d.ts → client-DTNmGqHB.d.ts} +20 -5
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -11
- package/dist/index.mjs.map +1 -1
- package/dist/ssr.d.mts +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +33 -11
- package/dist/ssr.js.map +1 -1
- package/dist/ssr.mjs +33 -11
- package/dist/ssr.mjs.map +1 -1
- package/package.json +5 -3
package/dist/ssr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-
|
|
1
|
+
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-DTNmGqHB.mjs';
|
|
2
2
|
import '@insforge/shared-schemas';
|
|
3
3
|
import '@supabase/postgrest-js';
|
|
4
4
|
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-
|
|
1
|
+
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-DTNmGqHB.js';
|
|
2
2
|
import '@insforge/shared-schemas';
|
|
3
3
|
import '@supabase/postgrest-js';
|
|
4
4
|
|
package/dist/ssr.js
CHANGED
|
@@ -1057,21 +1057,43 @@ var Auth = class {
|
|
|
1057
1057
|
};
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
|
-
|
|
1061
|
-
// OAuth Authentication
|
|
1062
|
-
// ============================================================================
|
|
1063
|
-
/**
|
|
1064
|
-
* Sign in with OAuth provider using PKCE flow
|
|
1065
|
-
*/
|
|
1066
|
-
async signInWithOAuth(options) {
|
|
1060
|
+
async signInWithOAuth(providerOrOptions, options) {
|
|
1067
1061
|
try {
|
|
1068
|
-
|
|
1062
|
+
let signInOptions;
|
|
1063
|
+
if (typeof providerOrOptions === "object") {
|
|
1064
|
+
signInOptions = providerOrOptions;
|
|
1065
|
+
} else if (options) {
|
|
1066
|
+
signInOptions = { provider: providerOrOptions, ...options };
|
|
1067
|
+
} else {
|
|
1068
|
+
return {
|
|
1069
|
+
data: {},
|
|
1070
|
+
error: new InsForgeError(
|
|
1071
|
+
"OAuth sign-in options are required",
|
|
1072
|
+
400,
|
|
1073
|
+
import_shared_schemas.ERROR_CODES.INVALID_INPUT
|
|
1074
|
+
)
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
if (!signInOptions || !signInOptions.redirectTo) {
|
|
1078
|
+
return {
|
|
1079
|
+
data: {},
|
|
1080
|
+
error: new InsForgeError(
|
|
1081
|
+
"Redirect URI is required",
|
|
1082
|
+
400,
|
|
1083
|
+
import_shared_schemas.ERROR_CODES.INVALID_INPUT
|
|
1084
|
+
)
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
const { provider } = signInOptions;
|
|
1069
1088
|
const providerKey = encodeURIComponent(provider.toLowerCase());
|
|
1070
1089
|
const codeVerifier = generateCodeVerifier();
|
|
1071
1090
|
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
|
1072
1091
|
storePkceVerifier(codeVerifier);
|
|
1073
|
-
const params = {
|
|
1074
|
-
|
|
1092
|
+
const params = {
|
|
1093
|
+
...signInOptions.additionalParams ?? {},
|
|
1094
|
+
redirect_uri: signInOptions.redirectTo,
|
|
1095
|
+
code_challenge: codeChallenge
|
|
1096
|
+
};
|
|
1075
1097
|
const isBuiltInProvider = import_shared_schemas.oAuthProvidersSchema.options.includes(
|
|
1076
1098
|
providerKey
|
|
1077
1099
|
);
|
|
@@ -1080,7 +1102,7 @@ var Auth = class {
|
|
|
1080
1102
|
params,
|
|
1081
1103
|
skipAuthRefresh: true
|
|
1082
1104
|
});
|
|
1083
|
-
if (!this.isServerMode() && typeof window !== "undefined" && !skipBrowserRedirect) {
|
|
1105
|
+
if (!this.isServerMode() && typeof window !== "undefined" && !signInOptions.skipBrowserRedirect) {
|
|
1084
1106
|
window.location.href = response.authUrl;
|
|
1085
1107
|
return { data: {}, error: null };
|
|
1086
1108
|
}
|