@superwall/server 0.1.1 → 0.1.2
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/.turbo/turbo-test.log +53 -53
- package/package.json +3 -3
package/.turbo/turbo-test.log
CHANGED
|
@@ -2,72 +2,72 @@ $ bun test
|
|
|
2
2
|
bun test v1.3.11 (af24e281)
|
|
3
3
|
|
|
4
4
|
src/requires.test.ts:
|
|
5
|
-
(pass) sw.requires() > calls next() when entitled [
|
|
6
|
-
(pass) sw.requires() > default 403 when not entitled [0.
|
|
7
|
-
(pass) sw.requires() > fail-closed when no userId can be extracted [0.
|
|
8
|
-
(pass) sw.requires() > allowAnonymous lets the handler decide [0.
|
|
9
|
-
(pass) sw.requires() > onUnauthorized override [
|
|
10
|
-
(pass) sw.requires() > per-route userId override wins [
|
|
11
|
-
(pass) sw.requires() > network errors pass to next(err) [0.
|
|
12
|
-
(pass) sw.requires() > multiple-AND spec rejects when any missing [0.
|
|
13
|
-
(pass) sw.requires() > ANY spec passes when one active [0.
|
|
14
|
-
(pass) sw.requires() > normalizes spec at registration time (fails loud) [0.
|
|
5
|
+
(pass) sw.requires() > calls next() when entitled [1.40ms]
|
|
6
|
+
(pass) sw.requires() > default 403 when not entitled [0.13ms]
|
|
7
|
+
(pass) sw.requires() > fail-closed when no userId can be extracted [0.06ms]
|
|
8
|
+
(pass) sw.requires() > allowAnonymous lets the handler decide [0.05ms]
|
|
9
|
+
(pass) sw.requires() > onUnauthorized override [1.02ms]
|
|
10
|
+
(pass) sw.requires() > per-route userId override wins [0.24ms]
|
|
11
|
+
(pass) sw.requires() > network errors pass to next(err) [0.14ms]
|
|
12
|
+
(pass) sw.requires() > multiple-AND spec rejects when any missing [0.07ms]
|
|
13
|
+
(pass) sw.requires() > ANY spec passes when one active [0.06ms]
|
|
14
|
+
(pass) sw.requires() > normalizes spec at registration time (fails loud) [0.04ms]
|
|
15
15
|
|
|
16
16
|
src/cache.test.ts:
|
|
17
|
-
(pass) InMemoryCache > get returns null on miss
|
|
18
|
-
(pass) InMemoryCache > set + get returns the entry [0.
|
|
19
|
-
(pass) InMemoryCache > expired entry is dropped on read [0.
|
|
20
|
-
(pass) InMemoryCache > delete removes the entry [0.
|
|
21
|
-
(pass) InMemoryCache > clear empties the cache [0.
|
|
22
|
-
(pass) InMemoryCache > LRU evicts oldest when maxEntries exceeded [0.
|
|
23
|
-
(pass) InMemoryCache > read refreshes LRU position so recent reads survive eviction [0.
|
|
17
|
+
(pass) InMemoryCache > get returns null on miss
|
|
18
|
+
(pass) InMemoryCache > set + get returns the entry [0.08ms]
|
|
19
|
+
(pass) InMemoryCache > expired entry is dropped on read [0.04ms]
|
|
20
|
+
(pass) InMemoryCache > delete removes the entry [0.03ms]
|
|
21
|
+
(pass) InMemoryCache > clear empties the cache [0.03ms]
|
|
22
|
+
(pass) InMemoryCache > LRU evicts oldest when maxEntries exceeded [0.12ms]
|
|
23
|
+
(pass) InMemoryCache > read refreshes LRU position so recent reads survive eviction [0.04ms]
|
|
24
24
|
|
|
25
25
|
src/superwall.test.ts:
|
|
26
|
-
(pass) Superwall() factory > rejects missing apiKey [0.
|
|
27
|
-
(pass) Superwall() factory > getEntitlements returns parsed bucket [0.
|
|
28
|
-
(pass) Superwall() factory > userHas (string) returns true when entitlement is active [0.
|
|
29
|
-
(pass) Superwall() factory > userHas (string) returns false when entitlement is inactive
|
|
30
|
-
(pass) Superwall() factory > userHas (array) requires all [0.
|
|
31
|
-
(pass) Superwall() factory > userHas ({ any }) returns true when any active [0.
|
|
32
|
-
(pass) Superwall() factory > caches subsequent reads for the same userId [0.
|
|
33
|
-
(pass) Superwall() factory > invalidate forces a refetch [0.
|
|
34
|
-
(pass) Superwall() factory > invalidateAll clears every entry [0.
|
|
35
|
-
(pass) Superwall() factory > TTL expiry forces a refetch [
|
|
36
|
-
(pass) Superwall() factory > onRequest fires with cache hit info [
|
|
26
|
+
(pass) Superwall() factory > rejects missing apiKey [0.06ms]
|
|
27
|
+
(pass) Superwall() factory > getEntitlements returns parsed bucket [0.29ms]
|
|
28
|
+
(pass) Superwall() factory > userHas (string) returns true when entitlement is active [0.06ms]
|
|
29
|
+
(pass) Superwall() factory > userHas (string) returns false when entitlement is inactive
|
|
30
|
+
(pass) Superwall() factory > userHas (array) requires all [0.15ms]
|
|
31
|
+
(pass) Superwall() factory > userHas ({ any }) returns true when any active [0.11ms]
|
|
32
|
+
(pass) Superwall() factory > caches subsequent reads for the same userId [0.05ms]
|
|
33
|
+
(pass) Superwall() factory > invalidate forces a refetch [0.09ms]
|
|
34
|
+
(pass) Superwall() factory > invalidateAll clears every entry [0.09ms]
|
|
35
|
+
(pass) Superwall() factory > TTL expiry forces a refetch [5.91ms]
|
|
36
|
+
(pass) Superwall() factory > onRequest fires with cache hit info [0.15ms]
|
|
37
37
|
(pass) Superwall() factory > onRequest throwing does not break the request [0.07ms]
|
|
38
38
|
|
|
39
39
|
src/fetcher.test.ts:
|
|
40
|
-
(pass) fetchEntitlements > parses customerInfo.entitlements envelope [0.
|
|
41
|
-
(pass) fetchEntitlements > parses top-level entitlements array [0.
|
|
42
|
-
(pass) fetchEntitlements > encodes the userId in the URL path [
|
|
43
|
-
(pass) fetchEntitlements > includes Authorization and X-App-User-ID headers [0.
|
|
44
|
-
(pass) fetchEntitlements > 401 → SuperwallAuthError [0.
|
|
45
|
-
(pass) fetchEntitlements > 403 → SuperwallAuthError [0.
|
|
46
|
-
(pass) fetchEntitlements > 404 → SuperwallNotFoundError [0.
|
|
47
|
-
(pass) fetchEntitlements > 500 → SuperwallNetworkError with status [0.
|
|
48
|
-
(pass) fetchEntitlements > fetch throw → SuperwallNetworkError [0.
|
|
49
|
-
(pass) fetchEntitlements > AbortError → SuperwallTimeoutError [6.
|
|
50
|
-
(pass) fetchEntitlements > malformed JSON → SuperwallDecodingError [0.
|
|
51
|
-
(pass) fetchEntitlements > uses the configured environment for the host [0.
|
|
40
|
+
(pass) fetchEntitlements > parses customerInfo.entitlements envelope [0.28ms]
|
|
41
|
+
(pass) fetchEntitlements > parses top-level entitlements array [0.10ms]
|
|
42
|
+
(pass) fetchEntitlements > encodes the userId in the URL path [0.16ms]
|
|
43
|
+
(pass) fetchEntitlements > includes Authorization and X-App-User-ID headers [0.25ms]
|
|
44
|
+
(pass) fetchEntitlements > 401 → SuperwallAuthError [0.14ms]
|
|
45
|
+
(pass) fetchEntitlements > 403 → SuperwallAuthError [0.10ms]
|
|
46
|
+
(pass) fetchEntitlements > 404 → SuperwallNotFoundError [0.07ms]
|
|
47
|
+
(pass) fetchEntitlements > 500 → SuperwallNetworkError with status [0.13ms]
|
|
48
|
+
(pass) fetchEntitlements > fetch throw → SuperwallNetworkError [0.12ms]
|
|
49
|
+
(pass) fetchEntitlements > AbortError → SuperwallTimeoutError [6.50ms]
|
|
50
|
+
(pass) fetchEntitlements > malformed JSON → SuperwallDecodingError [0.16ms]
|
|
51
|
+
(pass) fetchEntitlements > uses the configured environment for the host [0.05ms]
|
|
52
52
|
|
|
53
53
|
src/spec.test.ts:
|
|
54
54
|
(pass) normalizeSpec > string [0.02ms]
|
|
55
55
|
(pass) normalizeSpec > array → all
|
|
56
|
-
(pass) normalizeSpec > { all }
|
|
57
|
-
(pass) normalizeSpec > { any } [0.
|
|
58
|
-
(pass) normalizeSpec > rejects empty string [0.
|
|
59
|
-
(pass) normalizeSpec > rejects empty array
|
|
60
|
-
(pass) normalizeSpec > rejects empty all
|
|
61
|
-
(pass) normalizeSpec > rejects empty any
|
|
62
|
-
(pass) normalizeSpec > rejects malformed object [0.
|
|
63
|
-
(pass) findMissing (mode: all) > returns empty when all entitlements active [0.
|
|
56
|
+
(pass) normalizeSpec > { all } [0.02ms]
|
|
57
|
+
(pass) normalizeSpec > { any } [0.02ms]
|
|
58
|
+
(pass) normalizeSpec > rejects empty string [0.03ms]
|
|
59
|
+
(pass) normalizeSpec > rejects empty array [0.03ms]
|
|
60
|
+
(pass) normalizeSpec > rejects empty all [0.02ms]
|
|
61
|
+
(pass) normalizeSpec > rejects empty any [0.02ms]
|
|
62
|
+
(pass) normalizeSpec > rejects malformed object [0.04ms]
|
|
63
|
+
(pass) findMissing (mode: all) > returns empty when all entitlements active [0.07ms]
|
|
64
64
|
(pass) findMissing (mode: all) > returns the missing entitlement
|
|
65
|
-
(pass) findMissing (mode: all) > ignores extra active entitlements
|
|
66
|
-
(pass) findMissing (mode: all) > inactive entitlements are not counted
|
|
67
|
-
(pass) findMissing (mode: any) > returns empty when any one is active
|
|
68
|
-
(pass) findMissing (mode: any) > returns all listed when none active
|
|
65
|
+
(pass) findMissing (mode: all) > ignores extra active entitlements [0.03ms]
|
|
66
|
+
(pass) findMissing (mode: all) > inactive entitlements are not counted [0.03ms]
|
|
67
|
+
(pass) findMissing (mode: any) > returns empty when any one is active [0.03ms]
|
|
68
|
+
(pass) findMissing (mode: any) > returns all listed when none active [0.02ms]
|
|
69
69
|
|
|
70
70
|
56 pass
|
|
71
71
|
0 fail
|
|
72
72
|
84 expect() calls
|
|
73
|
-
Ran 56 tests across 5 files. [
|
|
73
|
+
Ran 56 tests across 5 files. [42.00ms]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"clean": "rm -rf node_modules .turbo *.tsbuildinfo"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@superwall/core": "0.
|
|
24
|
-
"@superwall/verify": "0.
|
|
23
|
+
"@superwall/core": "0.1.1",
|
|
24
|
+
"@superwall/verify": "0.1.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/bun": "latest",
|