@quiltt/core 3.6.10 → 3.6.12
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 +12 -0
- package/dist/{SubscriptionLink-client-bQ_XR09W.js → SubscriptionLink-client-CGUaoxuA.js} +2 -2
- package/dist/{index-client-B02K2JNP.js → index-client-AzYaJaCS.js} +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +3 -3
- package/package.json +9 -9
- package/src/JsonWebToken.ts +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @quiltt/core
|
|
2
2
|
|
|
3
|
+
## 3.6.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#274](https://github.com/quiltt/quiltt-js/pull/274) [`d684ade`](https://github.com/quiltt/quiltt-js/commit/d684ade520689d6207c699cea0681a9331f06069) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Update 'rol' types in PrivateClaims
|
|
8
|
+
|
|
9
|
+
## 3.6.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
|
|
3
15
|
## 3.6.10
|
|
4
16
|
|
|
5
17
|
### 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-AzYaJaCS.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.12";
|
|
207
207
|
|
|
208
208
|
const QUILTT_API_INSECURE = (()=>{
|
|
209
209
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -402,11 +402,6 @@ declare const endpointAuth: string;
|
|
|
402
402
|
declare const endpointGraphQL: string;
|
|
403
403
|
declare const endpointWebsockets: string;
|
|
404
404
|
|
|
405
|
-
type JsonWebToken<T> = {
|
|
406
|
-
token: string;
|
|
407
|
-
claims: Claims<T>;
|
|
408
|
-
};
|
|
409
|
-
type Claims<T> = RegisteredClaims & T;
|
|
410
405
|
type RegisteredClaims = {
|
|
411
406
|
iss: string;
|
|
412
407
|
sub: string;
|
|
@@ -422,6 +417,12 @@ type PrivateClaims = {
|
|
|
422
417
|
cid: string;
|
|
423
418
|
aid: string;
|
|
424
419
|
ver: number;
|
|
420
|
+
rol: 'basic' | 'core' | 'manager' | 'super-admin';
|
|
421
|
+
};
|
|
422
|
+
type Claims<T> = RegisteredClaims & T;
|
|
423
|
+
type JsonWebToken<T> = {
|
|
424
|
+
token: string;
|
|
425
|
+
claims: Claims<T>;
|
|
425
426
|
};
|
|
426
427
|
type QuilttJWT = JsonWebToken<PrivateClaims>;
|
|
427
428
|
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-CGUaoxuA.js';
|
|
4
|
+
export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-CGUaoxuA.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.12",
|
|
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,12 +1,5 @@
|
|
|
1
1
|
import type { Maybe } from './types'
|
|
2
2
|
|
|
3
|
-
export type JsonWebToken<T> = {
|
|
4
|
-
token: string // Raw JWT Token
|
|
5
|
-
claims: Claims<T>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type Claims<T> = RegisteredClaims & T
|
|
9
|
-
|
|
10
3
|
export type RegisteredClaims = {
|
|
11
4
|
iss: string // (issuer): Issuer of the JWT
|
|
12
5
|
sub: string // (subject): Subject of the JWT (Person ID)
|
|
@@ -23,6 +16,14 @@ export type PrivateClaims = {
|
|
|
23
16
|
cid: string // Client ID
|
|
24
17
|
aid: string // Administrator ID
|
|
25
18
|
ver: number // Session Token Version
|
|
19
|
+
rol: 'basic' | 'core' | 'manager' | 'super-admin' // Administrator Role
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Claims<T> = RegisteredClaims & T
|
|
23
|
+
|
|
24
|
+
export type JsonWebToken<T> = {
|
|
25
|
+
token: string // Raw JWT Token
|
|
26
|
+
claims: Claims<T>
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export type QuilttJWT = JsonWebToken<PrivateClaims>
|
|
@@ -42,7 +43,7 @@ export const JsonWebTokenParse = <T>(
|
|
|
42
43
|
const [_header, payload, _signature] = token.split('.')
|
|
43
44
|
|
|
44
45
|
try {
|
|
45
|
-
return { token
|
|
46
|
+
return { token, claims: JSON.parse(atob(payload)) }
|
|
46
47
|
} catch (error) {
|
|
47
48
|
console.error(`Invalid Session Token: ${error}`)
|
|
48
49
|
}
|