@luxexchange/sessions 1.0.1 → 1.0.3
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/.depcheckrc +20 -0
- package/.eslintrc.js +21 -0
- package/README.md +1 -0
- package/env.d.ts +12 -0
- package/package.json +3 -4
- package/project.json +2 -8
- package/src/challenge-solvers/createChallengeSolverService.ts +5 -5
- package/src/challenge-solvers/createHashcashMockSolver.ts +1 -1
- package/src/challenge-solvers/createHashcashSolver.test.ts +10 -10
- package/src/challenge-solvers/createHashcashSolver.ts +22 -7
- package/src/challenge-solvers/createNoneMockSolver.ts +1 -1
- package/src/challenge-solvers/createTurnstileMockSolver.ts +1 -1
- package/src/challenge-solvers/createTurnstileSolver.ts +12 -8
- package/src/challenge-solvers/hashcash/core.native.ts +3 -3
- package/src/challenge-solvers/hashcash/core.test.ts +10 -10
- package/src/challenge-solvers/hashcash/core.ts +3 -3
- package/src/challenge-solvers/hashcash/core.web.ts +4 -4
- package/src/challenge-solvers/hashcash/createWorkerHashcashSolver.test.ts +7 -7
- package/src/challenge-solvers/hashcash/createWorkerHashcashSolver.ts +4 -4
- package/src/challenge-solvers/hashcash/worker/createHashcashMultiWorkerChannel.native.ts +1 -1
- package/src/challenge-solvers/hashcash/worker/createHashcashMultiWorkerChannel.ts +1 -1
- package/src/challenge-solvers/hashcash/worker/createHashcashMultiWorkerChannel.web.ts +2 -2
- package/src/challenge-solvers/hashcash/worker/createHashcashWorkerChannel.native.ts +1 -1
- package/src/challenge-solvers/hashcash/worker/createHashcashWorkerChannel.ts +1 -1
- package/src/challenge-solvers/hashcash/worker/createHashcashWorkerChannel.web.ts +2 -2
- package/src/challenge-solvers/hashcash/worker/hashcash.worker.ts +3 -3
- package/src/challenge-solvers/hashcash/worker/types.ts +1 -1
- package/src/challenge-solvers/turnstileErrors.ts +1 -1
- package/src/challenge-solvers/turnstileScriptLoader.ts +2 -2
- package/src/challenge-solvers/turnstileSolver.integration.test.ts +4 -4
- package/src/challenge-solvers/types.ts +2 -2
- package/src/challengeFlow.integration.test.ts +49 -49
- package/src/device-id/createDeviceIdService.ts +1 -1
- package/src/index.ts +50 -48
- package/src/oauth-service/createOAuthService.ts +2 -2
- package/src/oauth-service/types.ts +1 -1
- package/src/performance/createNoopPerformanceTracker.ts +2 -2
- package/src/performance/createPerformanceTracker.ts +1 -1
- package/src/performance/index.ts +3 -3
- package/src/session-initialization/createSessionInitializationService.test.ts +4 -4
- package/src/session-initialization/createSessionInitializationService.ts +32 -41
- package/src/session-repository/createSessionClient.ts +1 -1
- package/src/session-repository/createSessionRepository.test.ts +5 -5
- package/src/session-repository/createSessionRepository.ts +14 -14
- package/src/session-repository/errors.ts +1 -1
- package/src/session-repository/types.ts +1 -1
- package/src/session-service/createNoopSessionService.ts +2 -2
- package/src/session-service/createSessionService.test.ts +29 -29
- package/src/session-service/createSessionService.ts +8 -8
- package/src/session-service/types.ts +3 -3
- package/src/session-storage/createSessionStorage.ts +1 -1
- package/src/session.integration.test.ts +130 -94
- package/src/sessionLifecycle.integration.test.ts +22 -22
- package/src/test-utils/createLocalCookieTransport.ts +1 -1
- package/src/test-utils/createLocalHeaderTransport.ts +1 -1
- package/src/test-utils/mocks.ts +3 -3
- package/src/test-utils.ts +24 -24
- package/src/uniswap-identifier/createUniswapIdentifierService.ts +19 -0
- package/src/uniswap-identifier/types.ts +11 -0
- package/src/uniswap-identifier/uniswapIdentifierQuery.ts +20 -0
- package/tsconfig.json +10 -3
- package/tsconfig.lint.json +8 -0
- package/tsconfig.spec.json +8 -0
- package/vitest.config.ts +20 -0
- package/vitest.integration.config.ts +14 -0
- package/src/lux-identifier/createLuxIdentifierService.ts +0 -19
- package/src/lux-identifier/luxIdentifierQuery.ts +0 -20
- package/src/lux-identifier/types.ts +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uniswap Identifier provider interface
|
|
3
|
+
* Platform-specific implementations handle uniswap identifier persistence
|
|
4
|
+
*/
|
|
5
|
+
interface LxIdentifierService {
|
|
6
|
+
getLxIdentifier(): Promise<string | null>
|
|
7
|
+
setLxIdentifier(identifier: string): Promise<void>
|
|
8
|
+
removeLxIdentifier(): Promise<void>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { LxIdentifierService }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query'
|
|
2
|
+
import type { LxIdentifierService } from '@luxexchange/sessions/src/uniswap-identifier/types'
|
|
3
|
+
import { ReactQueryCacheKey } from 'utilities/src/reactQuery/cache'
|
|
4
|
+
import type { QueryOptionsResult } from 'utilities/src/reactQuery/queryOptions'
|
|
5
|
+
|
|
6
|
+
type LxIdentifierQueryOptions = QueryOptionsResult<
|
|
7
|
+
string | null,
|
|
8
|
+
Error,
|
|
9
|
+
string | null,
|
|
10
|
+
[ReactQueryCacheKey.LxIdentifier]
|
|
11
|
+
>
|
|
12
|
+
|
|
13
|
+
export function lxIdentifierQuery(getService: () => LxIdentifierService): LxIdentifierQueryOptions {
|
|
14
|
+
return queryOptions({
|
|
15
|
+
queryKey: [ReactQueryCacheKey.LxIdentifier],
|
|
16
|
+
queryFn: async () => getService().getLxIdentifier(),
|
|
17
|
+
staleTime: Infinity,
|
|
18
|
+
gcTime: Infinity,
|
|
19
|
+
})
|
|
20
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../config/tsconfig/app.json",
|
|
3
3
|
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json", "env.d.ts"],
|
|
4
|
-
"exclude": [
|
|
4
|
+
"exclude": [
|
|
5
|
+
"src/**/*.spec.ts",
|
|
6
|
+
"src/**/*.spec.tsx",
|
|
7
|
+
"src/**/*.test.ts",
|
|
8
|
+
"src/**/*.test.tsx"
|
|
9
|
+
],
|
|
5
10
|
"compilerOptions": {
|
|
6
11
|
"emitDeclarationOnly": true,
|
|
7
12
|
"noEmit": false,
|
|
8
13
|
"paths": {
|
|
9
|
-
"@
|
|
10
|
-
"@luxdex/client-platform-service/*": ["../../node_modules/@uniswap/client-platform-service/*"]
|
|
14
|
+
"@luxexchange/sessions/*": ["./src/*"]
|
|
11
15
|
},
|
|
12
16
|
"types": ["chrome", "node"]
|
|
13
17
|
},
|
|
14
18
|
"references": [
|
|
15
19
|
{
|
|
16
20
|
"path": "../utilities"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "../eslint-config"
|
|
17
24
|
}
|
|
18
25
|
]
|
|
19
26
|
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
watch: false,
|
|
6
|
+
environment: 'edge-runtime',
|
|
7
|
+
exclude: [
|
|
8
|
+
'**/node_modules/**',
|
|
9
|
+
'**/dist/**',
|
|
10
|
+
// Exclude real backend integration tests - these run in a separate optional CI workflow
|
|
11
|
+
'**/session.integration.test.ts',
|
|
12
|
+
],
|
|
13
|
+
coverage: {
|
|
14
|
+
exclude: ['**/__generated__/**', '**/node_modules/**', '**/dist/**', '**/*.config.*', '**/scripts/**'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
resolve: {
|
|
18
|
+
extensions: ['.web.ts', '.web.tsx', '.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
19
|
+
},
|
|
20
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
watch: false,
|
|
6
|
+
environment: 'edge-runtime',
|
|
7
|
+
include: ['**/session.integration.test.ts'],
|
|
8
|
+
testTimeout: 60000,
|
|
9
|
+
hookTimeout: 60000,
|
|
10
|
+
},
|
|
11
|
+
resolve: {
|
|
12
|
+
extensions: ['.web.ts', '.web.tsx', '.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { LuxIdentifierService } from '@luxfi/sessions/src/lux-identifier/types'
|
|
2
|
-
|
|
3
|
-
function createLuxIdentifierService(ctx: {
|
|
4
|
-
getLuxIdentifier: () => Promise<string | null>
|
|
5
|
-
setLuxIdentifier: (identifier: string) => Promise<void>
|
|
6
|
-
removeLuxIdentifier: () => Promise<void>
|
|
7
|
-
}): LuxIdentifierService {
|
|
8
|
-
const getLuxIdentifier = ctx.getLuxIdentifier
|
|
9
|
-
const setLuxIdentifier = ctx.setLuxIdentifier
|
|
10
|
-
const removeLuxIdentifier = ctx.removeLuxIdentifier
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
getLuxIdentifier,
|
|
14
|
-
setLuxIdentifier,
|
|
15
|
-
removeLuxIdentifier,
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { createLuxIdentifierService }
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { queryOptions } from '@tanstack/react-query'
|
|
2
|
-
import type { LuxIdentifierService } from '@universe/sessions/src/lux-identifier/types'
|
|
3
|
-
import { ReactQueryCacheKey } from 'utilities/src/reactQuery/cache'
|
|
4
|
-
import type { QueryOptionsResult } from 'utilities/src/reactQuery/queryOptions'
|
|
5
|
-
|
|
6
|
-
type LuxIdentifierQueryOptions = QueryOptionsResult<
|
|
7
|
-
string | null,
|
|
8
|
-
Error,
|
|
9
|
-
string | null,
|
|
10
|
-
[ReactQueryCacheKey.LuxIdentifier]
|
|
11
|
-
>
|
|
12
|
-
|
|
13
|
-
export function luxIdentifierQuery(getService: () => LuxIdentifierService): LuxIdentifierQueryOptions {
|
|
14
|
-
return queryOptions({
|
|
15
|
-
queryKey: [ReactQueryCacheKey.LuxIdentifier],
|
|
16
|
-
queryFn: async () => getService().getLuxIdentifier(),
|
|
17
|
-
staleTime: Infinity,
|
|
18
|
-
gcTime: Infinity,
|
|
19
|
-
})
|
|
20
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lux Identifier provider interface
|
|
3
|
-
* Platform-specific implementations handle lux identifier persistence
|
|
4
|
-
*/
|
|
5
|
-
interface LuxIdentifierService {
|
|
6
|
-
getLuxIdentifier(): Promise<string | null>
|
|
7
|
-
setLuxIdentifier(identifier: string): Promise<void>
|
|
8
|
-
removeLuxIdentifier(): Promise<void>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type { LuxIdentifierService }
|