@stackframe/stack-shared 2.4.9 → 2.4.10

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @stackframe/stack-shared
2
2
 
3
+ ## 2.4.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Bug fixes
8
+ - Updated dependencies
9
+ - @stackframe/stack-sc@1.5.5
10
+
3
11
  ## 2.4.9
4
12
 
5
13
  ### Patch Changes
@@ -183,7 +183,18 @@ export class StackClientInterface {
183
183
  cache: "no-store",
184
184
  },
185
185
  };
186
- const rawRes = await fetch(url, params);
186
+ let rawRes;
187
+ try {
188
+ rawRes = await fetch(url, params);
189
+ }
190
+ catch (e) {
191
+ if (e instanceof TypeError) {
192
+ // Network error, retry
193
+ console.log("Stack detected a network error, retrying.", e);
194
+ return Result.error(e);
195
+ }
196
+ throw e;
197
+ }
187
198
  const processedRes = await this._processResponse(rawRes);
188
199
  if (processedRes.status === "error") {
189
200
  // If the access token is expired, reset it and retry
@@ -23,7 +23,7 @@ export declare const currentUserCrud: {
23
23
  primaryEmail: undefined;
24
24
  primaryEmailVerified: undefined;
25
25
  displayName: undefined;
26
- clientMetadata: {};
26
+ clientMetadata: undefined;
27
27
  selectedTeamId: undefined;
28
28
  profileImageUrl: undefined;
29
29
  signedUpAtMillis: undefined;
@@ -31,7 +31,7 @@ export declare const currentUserCrud: {
31
31
  hasPassword: undefined;
32
32
  authWithEmail: undefined;
33
33
  oauthProviders: undefined;
34
- serverMetadata: {};
34
+ serverMetadata: undefined;
35
35
  }, "">;
36
36
  updateSchema: yup.ObjectSchema<{
37
37
  displayName: string | undefined;
@@ -70,7 +70,7 @@ export declare const currentUserCrud: {
70
70
  primaryEmail: undefined;
71
71
  primaryEmailVerified: undefined;
72
72
  displayName: undefined;
73
- clientMetadata: {};
73
+ clientMetadata: undefined;
74
74
  selectedTeamId: undefined;
75
75
  profileImageUrl: undefined;
76
76
  signedUpAtMillis: undefined;
@@ -78,7 +78,7 @@ export declare const currentUserCrud: {
78
78
  hasPassword: undefined;
79
79
  authWithEmail: undefined;
80
80
  oauthProviders: undefined;
81
- serverMetadata: {};
81
+ serverMetadata: undefined;
82
82
  }, "">;
83
83
  updateSchema: yup.ObjectSchema<{
84
84
  displayName: string | undefined;
@@ -120,7 +120,7 @@ export declare const currentUserCrud: {
120
120
  primaryEmail: undefined;
121
121
  primaryEmailVerified: undefined;
122
122
  displayName: undefined;
123
- clientMetadata: {};
123
+ clientMetadata: undefined;
124
124
  selectedTeamId: undefined;
125
125
  profileImageUrl: undefined;
126
126
  signedUpAtMillis: undefined;
@@ -128,7 +128,7 @@ export declare const currentUserCrud: {
128
128
  hasPassword: undefined;
129
129
  authWithEmail: undefined;
130
130
  oauthProviders: undefined;
131
- serverMetadata: {};
131
+ serverMetadata: undefined;
132
132
  }, "">;
133
133
  updateSchema: yup.ObjectSchema<{
134
134
  displayName: string | undefined;
@@ -36,7 +36,7 @@ export declare const usersCrudServerReadSchema: yup.ObjectSchema<{
36
36
  primaryEmail: undefined;
37
37
  primaryEmailVerified: undefined;
38
38
  displayName: undefined;
39
- clientMetadata: {};
39
+ clientMetadata: undefined;
40
40
  selectedTeamId: undefined;
41
41
  profileImageUrl: undefined;
42
42
  signedUpAtMillis: undefined;
@@ -44,7 +44,7 @@ export declare const usersCrudServerReadSchema: yup.ObjectSchema<{
44
44
  hasPassword: undefined;
45
45
  authWithEmail: undefined;
46
46
  oauthProviders: undefined;
47
- serverMetadata: {};
47
+ serverMetadata: undefined;
48
48
  }, "">;
49
49
  export declare const usersCrud: {
50
50
  client: {
@@ -76,7 +76,7 @@ export declare const usersCrud: {
76
76
  primaryEmail: undefined;
77
77
  primaryEmailVerified: undefined;
78
78
  displayName: undefined;
79
- clientMetadata: {};
79
+ clientMetadata: undefined;
80
80
  selectedTeamId: undefined;
81
81
  profileImageUrl: undefined;
82
82
  signedUpAtMillis: undefined;
@@ -84,7 +84,7 @@ export declare const usersCrud: {
84
84
  hasPassword: undefined;
85
85
  authWithEmail: undefined;
86
86
  oauthProviders: undefined;
87
- serverMetadata: {};
87
+ serverMetadata: undefined;
88
88
  }, "">;
89
89
  updateSchema: yup.ObjectSchema<{
90
90
  displayName: string | undefined;
@@ -102,7 +102,9 @@ export declare const usersCrud: {
102
102
  selectedTeamId: undefined;
103
103
  }, "">;
104
104
  deleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
105
- };
105
+ }; /**
106
+ * not used anymore, for backwards compatibility
107
+ */
106
108
  admin: {
107
109
  createSchema: undefined;
108
110
  readSchema: yup.ObjectSchema<{
@@ -126,7 +128,7 @@ export declare const usersCrud: {
126
128
  primaryEmail: undefined;
127
129
  primaryEmailVerified: undefined;
128
130
  displayName: undefined;
129
- clientMetadata: {};
131
+ clientMetadata: undefined;
130
132
  selectedTeamId: undefined;
131
133
  profileImageUrl: undefined;
132
134
  signedUpAtMillis: undefined;
@@ -134,7 +136,7 @@ export declare const usersCrud: {
134
136
  hasPassword: undefined;
135
137
  authWithEmail: undefined;
136
138
  oauthProviders: undefined;
137
- serverMetadata: {};
139
+ serverMetadata: undefined;
138
140
  }, "">;
139
141
  updateSchema: yup.ObjectSchema<{
140
142
  displayName: string | undefined;
@@ -1,5 +1,6 @@
1
1
  import { createCrud } from "../../crud";
2
2
  import * as yup from "yup";
3
+ import { yupJson } from "../../utils/yup";
3
4
  export const usersCrudServerUpdateSchema = yup.object({
4
5
  displayName: yup.string().optional(),
5
6
  clientMetadata: yup.object().optional(),
@@ -14,7 +15,7 @@ export const usersCrudServerReadSchema = yup.object({
14
15
  primaryEmail: yup.string().nullable().defined(),
15
16
  primaryEmailVerified: yup.boolean().required(),
16
17
  displayName: yup.string().nullable().defined(),
17
- clientMetadata: yup.object().nullable().defined().transform((value) => JSON.parse(JSON.stringify(value))),
18
+ clientMetadata: yupJson,
18
19
  selectedTeamId: yup.string().nullable().defined(),
19
20
  profileImageUrl: yup.string().nullable().defined(),
20
21
  signedUpAtMillis: yup.number().required(),
@@ -25,7 +26,7 @@ export const usersCrudServerReadSchema = yup.object({
25
26
  hasPassword: yup.boolean().required(),
26
27
  authWithEmail: yup.boolean().required(),
27
28
  oauthProviders: yup.array(yup.string().required()).required(),
28
- serverMetadata: yup.object().nullable().defined().transform((value) => JSON.parse(JSON.stringify(value))),
29
+ serverMetadata: yupJson,
29
30
  }).required();
30
31
  const serverDeleteSchema = yup.mixed();
31
32
  export const usersCrud = createCrud({
@@ -0,0 +1,2 @@
1
+ import * as yup from "yup";
2
+ export declare const yupJson: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
@@ -0,0 +1,2 @@
1
+ import * as yup from "yup";
2
+ export const yupJson = yup.mixed().nullable().defined().transform((value) => JSON.parse(JSON.stringify(value)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-shared",
3
- "version": "2.4.9",
3
+ "version": "2.4.10",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -26,7 +26,7 @@
26
26
  "jose": "^5.2.2",
27
27
  "oauth4webapi": "^2.10.3",
28
28
  "uuid": "^9.0.1",
29
- "@stackframe/stack-sc": "1.5.4"
29
+ "@stackframe/stack-sc": "1.5.5"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/bcrypt": "^5.0.2",