@seamapi/nextlove-sdk-generator 1.10.3 → 1.10.4
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/lib/generate-python-sdk/templates/auth.py.template.js +4 -4
- package/lib/generate-python-sdk/templates/token.py.template.js +10 -10
- package/package.json +1 -1
- package/src/lib/generate-python-sdk/templates/auth.py.template.ts +4 -4
- package/src/lib/generate-python-sdk/templates/token.py.template.ts +10 -10
|
@@ -10,8 +10,8 @@ from seam.token import (
|
|
|
10
10
|
is_client_session_token,
|
|
11
11
|
is_publishable_key,
|
|
12
12
|
is_seam_token,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
TOKEN_PREFIX,
|
|
14
|
+
ACCESS_TOKEN_PREFIX,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
|
|
@@ -66,7 +66,7 @@ def get_auth_headers_for_api_key(api_key: str) -> dict:
|
|
|
66
66
|
|
|
67
67
|
if not is_seam_token(api_key):
|
|
68
68
|
raise SeamHttpInvalidTokenError(
|
|
69
|
-
f"Unknown or invalid api_key format, expected token to start with {
|
|
69
|
+
f"Unknown or invalid api_key format, expected token to start with {TOKEN_PREFIX}"
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
return {"authorization": f"Bearer {api_key}"}
|
|
@@ -92,7 +92,7 @@ def get_auth_headers_for_personal_access_token(
|
|
|
92
92
|
|
|
93
93
|
if not is_access_token(personal_access_token):
|
|
94
94
|
raise SeamHttpInvalidTokenError(
|
|
95
|
-
f"Unknown or invalid personal_access_token format, expected token to start with {
|
|
95
|
+
f"Unknown or invalid personal_access_token format, expected token to start with {ACCESS_TOKEN_PREFIX}"
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
return {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export default () => `
|
|
1
|
+
export default () => `TOKEN_PREFIX = "seam_"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ACCESS_TOKEN_PREFIX = "seam_at"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
JWT_PREFIX = "ey"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
CLIENT_SESSION_TOKEN_PREFIX = "seam_cst"
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
PUBLISHABLE_KEY_TOKEN_PREFIX = "seam_pk"
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def is_access_token(token: str) -> bool:
|
|
13
|
-
|
|
13
|
+
ACCESS_TOKEN_PREFIX)
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def is_jwt(token: str) -> bool:
|
|
17
|
-
return token.startswith(
|
|
17
|
+
return token.startswith(JWT_PREFIX)
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def is_seam_token(token: str) -> bool:
|
|
21
|
-
return token.startswith(
|
|
21
|
+
return token.startswith(TOKEN_PREFIX)
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def is_api_key(token: str) -> bool:
|
|
@@ -32,11 +32,11 @@ def is_api_key(token: str) -> bool:
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def is_client_session_token(token: str) -> bool:
|
|
35
|
-
return token.startswith(
|
|
35
|
+
return token.startswith(CLIENT_SESSION_TOKEN_PREFIX)
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def is_publishable_key(token: str) -> bool:
|
|
39
|
-
return token.startswith(
|
|
39
|
+
return token.startswith(PUBLISHABLE_KEY_TOKEN_PREFIX)
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def is_console_session_token(token: str) -> bool:
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@ from seam.token import (
|
|
|
10
10
|
is_client_session_token,
|
|
11
11
|
is_publishable_key,
|
|
12
12
|
is_seam_token,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
TOKEN_PREFIX,
|
|
14
|
+
ACCESS_TOKEN_PREFIX,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
|
|
@@ -66,7 +66,7 @@ def get_auth_headers_for_api_key(api_key: str) -> dict:
|
|
|
66
66
|
|
|
67
67
|
if not is_seam_token(api_key):
|
|
68
68
|
raise SeamHttpInvalidTokenError(
|
|
69
|
-
f"Unknown or invalid api_key format, expected token to start with {
|
|
69
|
+
f"Unknown or invalid api_key format, expected token to start with {TOKEN_PREFIX}"
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
return {"authorization": f"Bearer {api_key}"}
|
|
@@ -92,7 +92,7 @@ def get_auth_headers_for_personal_access_token(
|
|
|
92
92
|
|
|
93
93
|
if not is_access_token(personal_access_token):
|
|
94
94
|
raise SeamHttpInvalidTokenError(
|
|
95
|
-
f"Unknown or invalid personal_access_token format, expected token to start with {
|
|
95
|
+
f"Unknown or invalid personal_access_token format, expected token to start with {ACCESS_TOKEN_PREFIX}"
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
return {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export default () => `
|
|
1
|
+
export default () => `TOKEN_PREFIX = "seam_"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ACCESS_TOKEN_PREFIX = "seam_at"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
JWT_PREFIX = "ey"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
CLIENT_SESSION_TOKEN_PREFIX = "seam_cst"
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
PUBLISHABLE_KEY_TOKEN_PREFIX = "seam_pk"
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def is_access_token(token: str) -> bool:
|
|
13
|
-
|
|
13
|
+
ACCESS_TOKEN_PREFIX)
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def is_jwt(token: str) -> bool:
|
|
17
|
-
return token.startswith(
|
|
17
|
+
return token.startswith(JWT_PREFIX)
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def is_seam_token(token: str) -> bool:
|
|
21
|
-
return token.startswith(
|
|
21
|
+
return token.startswith(TOKEN_PREFIX)
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def is_api_key(token: str) -> bool:
|
|
@@ -32,11 +32,11 @@ def is_api_key(token: str) -> bool:
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def is_client_session_token(token: str) -> bool:
|
|
35
|
-
return token.startswith(
|
|
35
|
+
return token.startswith(CLIENT_SESSION_TOKEN_PREFIX)
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def is_publishable_key(token: str) -> bool:
|
|
39
|
-
return token.startswith(
|
|
39
|
+
return token.startswith(PUBLISHABLE_KEY_TOKEN_PREFIX)
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def is_console_session_token(token: str) -> bool:
|