@quiltt/core 3.6.10 → 3.6.11
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 +6 -0
- package/dist/{SubscriptionLink-client-bQ_XR09W.js → SubscriptionLink-client-Be2B_Wkn.js} +2 -2
- package/dist/{index-client-B02K2JNP.js → index-client-1u-DL-7m.js} +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +3 -3
- package/package.json +9 -9
- package/src/JsonWebToken.ts +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @quiltt/core
|
|
2
2
|
|
|
3
|
+
## 3.6.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#271](https://github.com/quiltt/quiltt-js/pull/271) [`a9ea2a7`](https://github.com/quiltt/quiltt-js/commit/a9ea2a7c6592dd5245183996ce0d26ffb53f2ed9) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Add 'rol' to private claims
|
|
8
|
+
|
|
3
9
|
## 3.6.10
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { ApolloLink, Observable as Observable$1 } from '@apollo/client/core/index.js';
|
|
3
3
|
import { print } from 'graphql';
|
|
4
|
-
import { c as createConsumer } from './index-client-
|
|
4
|
+
import { c as createConsumer } from './index-client-1u-DL-7m.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* An error and type safe wrapper for localStorage.
|
|
@@ -203,7 +203,7 @@ import { c as createConsumer } from './index-client-B02K2JNP.js';
|
|
|
203
203
|
*/ const GlobalStorage = new Storage();
|
|
204
204
|
|
|
205
205
|
var name = "@quiltt/core";
|
|
206
|
-
var version$1 = "3.6.
|
|
206
|
+
var version$1 = "3.6.11";
|
|
207
207
|
|
|
208
208
|
const QUILTT_API_INSECURE = (()=>{
|
|
209
209
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -402,11 +402,7 @@ declare const endpointAuth: string;
|
|
|
402
402
|
declare const endpointGraphQL: string;
|
|
403
403
|
declare const endpointWebsockets: string;
|
|
404
404
|
|
|
405
|
-
type
|
|
406
|
-
token: string;
|
|
407
|
-
claims: Claims<T>;
|
|
408
|
-
};
|
|
409
|
-
type Claims<T> = RegisteredClaims & T;
|
|
405
|
+
type AdminRole = 'manager' | 'core' | 'basic';
|
|
410
406
|
type RegisteredClaims = {
|
|
411
407
|
iss: string;
|
|
412
408
|
sub: string;
|
|
@@ -422,6 +418,12 @@ type PrivateClaims = {
|
|
|
422
418
|
cid: string;
|
|
423
419
|
aid: string;
|
|
424
420
|
ver: number;
|
|
421
|
+
rol: AdminRole;
|
|
422
|
+
};
|
|
423
|
+
type Claims<T> = RegisteredClaims & T;
|
|
424
|
+
type JsonWebToken<T> = {
|
|
425
|
+
token: string;
|
|
426
|
+
claims: Claims<T>;
|
|
425
427
|
};
|
|
426
428
|
type QuilttJWT = JsonWebToken<PrivateClaims>;
|
|
427
429
|
declare const JsonWebTokenParse: <T>(token: Maybe<string> | undefined) => Maybe<JsonWebToken<T>> | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloLink, ApolloClient } from '@apollo/client/index.js';
|
|
2
2
|
export { InMemoryCache, gql, useMutation, useQuery, useSubscription } from '@apollo/client/index.js';
|
|
3
|
-
import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-
|
|
4
|
-
export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-
|
|
3
|
+
import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-Be2B_Wkn.js';
|
|
4
|
+
export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-Be2B_Wkn.js';
|
|
5
5
|
import { BatchHttpLink as BatchHttpLink$1 } from '@apollo/client/link/batch-http/index.js';
|
|
6
6
|
import crossfetch from 'cross-fetch';
|
|
7
7
|
import { onError } from '@apollo/client/link/error/index.js';
|
|
@@ -254,7 +254,7 @@ const JsonWebTokenParse = (token)=>{
|
|
|
254
254
|
const [_header, payload, _signature] = token.split('.');
|
|
255
255
|
try {
|
|
256
256
|
return {
|
|
257
|
-
token
|
|
257
|
+
token,
|
|
258
258
|
claims: JSON.parse(atob(payload))
|
|
259
259
|
};
|
|
260
260
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quiltt/core",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.11",
|
|
4
4
|
"description": "Javascript API client and utilities for Quiltt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"quiltt",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@apollo/client": "^3.9.9",
|
|
37
37
|
"cross-fetch": "^4.0.0",
|
|
38
|
-
"graphql": "^16.
|
|
39
|
-
"graphql-ruby-client": "^1.
|
|
38
|
+
"graphql": "^16.9.0",
|
|
39
|
+
"graphql-ruby-client": "^1.14.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@biomejs/biome": "1.8.
|
|
43
|
-
"@types/node": "20.14.
|
|
44
|
-
"@types/react": "18.
|
|
45
|
-
"bunchee": "
|
|
46
|
-
"rimraf": "
|
|
47
|
-
"typescript": "5.
|
|
42
|
+
"@biomejs/biome": "1.8.3",
|
|
43
|
+
"@types/node": "20.14.10",
|
|
44
|
+
"@types/react": "18.3.3",
|
|
45
|
+
"bunchee": "5.2.2",
|
|
46
|
+
"rimraf": "6.0.0",
|
|
47
|
+
"typescript": "5.5.3"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
package/src/JsonWebToken.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { Maybe } from './types'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
token: string // Raw JWT Token
|
|
5
|
-
claims: Claims<T>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type Claims<T> = RegisteredClaims & T
|
|
3
|
+
type AdminRole = 'manager' | 'core' | 'basic'
|
|
9
4
|
|
|
10
5
|
export type RegisteredClaims = {
|
|
11
6
|
iss: string // (issuer): Issuer of the JWT
|
|
@@ -23,6 +18,14 @@ export type PrivateClaims = {
|
|
|
23
18
|
cid: string // Client ID
|
|
24
19
|
aid: string // Administrator ID
|
|
25
20
|
ver: number // Session Token Version
|
|
21
|
+
rol: AdminRole // Administrator Role
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type Claims<T> = RegisteredClaims & T
|
|
25
|
+
|
|
26
|
+
export type JsonWebToken<T> = {
|
|
27
|
+
token: string // Raw JWT Token
|
|
28
|
+
claims: Claims<T>
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export type QuilttJWT = JsonWebToken<PrivateClaims>
|
|
@@ -42,7 +45,7 @@ export const JsonWebTokenParse = <T>(
|
|
|
42
45
|
const [_header, payload, _signature] = token.split('.')
|
|
43
46
|
|
|
44
47
|
try {
|
|
45
|
-
return { token
|
|
48
|
+
return { token, claims: JSON.parse(atob(payload)) }
|
|
46
49
|
} catch (error) {
|
|
47
50
|
console.error(`Invalid Session Token: ${error}`)
|
|
48
51
|
}
|