@insforge/sdk 1.2.10 → 1.3.0-ssr.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.
- package/README.md +60 -14
- package/dist/client-B8ykVESe.d.mts +1121 -0
- package/dist/client-B8ykVESe.d.ts +1121 -0
- package/dist/index.d.mts +4 -1113
- package/dist/index.d.ts +4 -1113
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -7
- package/dist/index.mjs.map +1 -1
- package/dist/ssr.d.mts +93 -0
- package/dist/ssr.d.ts +93 -0
- package/dist/ssr.js +3158 -0
- package/dist/ssr.js.map +1 -0
- package/dist/ssr.mjs +3119 -0
- package/dist/ssr.mjs.map +1 -0
- package/package.json +7 -2
package/dist/index.mjs
CHANGED
|
@@ -886,7 +886,7 @@ function cleanUrlParams(...params) {
|
|
|
886
886
|
}
|
|
887
887
|
|
|
888
888
|
// src/modules/auth/auth.ts
|
|
889
|
-
import { oAuthProvidersSchema } from "@insforge/shared-schemas";
|
|
889
|
+
import { ERROR_CODES, oAuthProvidersSchema } from "@insforge/shared-schemas";
|
|
890
890
|
var Auth = class {
|
|
891
891
|
constructor(http, tokenManager, options = {}) {
|
|
892
892
|
this.http = http;
|
|
@@ -1131,8 +1131,11 @@ var Auth = class {
|
|
|
1131
1131
|
* Browser mode:
|
|
1132
1132
|
* - Uses httpOnly refresh cookie and optional CSRF header.
|
|
1133
1133
|
*
|
|
1134
|
-
*
|
|
1134
|
+
* Legacy server mode (`isServerMode: true`):
|
|
1135
1135
|
* - Uses mobile auth flow and requires `refreshToken` in request body.
|
|
1136
|
+
*
|
|
1137
|
+
* SSR apps should prefer `createRefreshAuthRouter()` / `refreshAuth()` from
|
|
1138
|
+
* `@insforge/sdk/ssr`.
|
|
1136
1139
|
*/
|
|
1137
1140
|
async refreshSession(options) {
|
|
1138
1141
|
try {
|
|
@@ -1142,7 +1145,7 @@ var Auth = class {
|
|
|
1142
1145
|
error: new InsForgeError(
|
|
1143
1146
|
"refreshToken is required when refreshing session in server mode",
|
|
1144
1147
|
400,
|
|
1145
|
-
|
|
1148
|
+
ERROR_CODES.AUTH_UNAUTHORIZED
|
|
1146
1149
|
)
|
|
1147
1150
|
};
|
|
1148
1151
|
}
|
|
@@ -1604,10 +1607,23 @@ var StorageBucket = class {
|
|
|
1604
1607
|
*/
|
|
1605
1608
|
async download(path) {
|
|
1606
1609
|
try {
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1610
|
+
const encodedKey = encodeURIComponent(path);
|
|
1611
|
+
let strategyResponse;
|
|
1612
|
+
try {
|
|
1613
|
+
strategyResponse = await this.http.get(
|
|
1614
|
+
`/api/storage/buckets/${this.bucketName}/download-strategy/objects/${encodedKey}`
|
|
1615
|
+
);
|
|
1616
|
+
} catch (err) {
|
|
1617
|
+
const status = err instanceof InsForgeError ? err.statusCode : void 0;
|
|
1618
|
+
if (status === 404 || status === 405) {
|
|
1619
|
+
strategyResponse = await this.http.post(
|
|
1620
|
+
`/api/storage/buckets/${this.bucketName}/objects/${encodedKey}/download-strategy`,
|
|
1621
|
+
{}
|
|
1622
|
+
);
|
|
1623
|
+
} else {
|
|
1624
|
+
throw err;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1611
1627
|
const downloadUrl = strategyResponse.url;
|
|
1612
1628
|
const headers = {};
|
|
1613
1629
|
if (strategyResponse.method === "direct") {
|