@l.x/sessions 1.0.3 → 1.0.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/.depcheckrc +20 -0
- package/.eslintrc.js +21 -0
- package/README.md +1 -0
- package/env.d.ts +12 -0
- package/package.json +49 -1
- package/project.json +36 -0
- package/src/challenge-solvers/createChallengeSolverService.ts +64 -0
- package/src/challenge-solvers/createHashcashMockSolver.ts +39 -0
- package/src/challenge-solvers/createHashcashSolver.test.ts +385 -0
- package/src/challenge-solvers/createHashcashSolver.ts +270 -0
- package/src/challenge-solvers/createNoneMockSolver.ts +11 -0
- package/src/challenge-solvers/createTurnstileMockSolver.ts +30 -0
- package/src/challenge-solvers/createTurnstileSolver.ts +357 -0
- package/src/challenge-solvers/hashcash/core.native.ts +34 -0
- package/src/challenge-solvers/hashcash/core.test.ts +314 -0
- package/src/challenge-solvers/hashcash/core.ts +35 -0
- package/src/challenge-solvers/hashcash/core.web.ts +123 -0
- package/src/challenge-solvers/hashcash/createWorkerHashcashSolver.test.ts +195 -0
- package/src/challenge-solvers/hashcash/createWorkerHashcashSolver.ts +120 -0
- package/src/challenge-solvers/hashcash/shared.ts +70 -0
- package/src/challenge-solvers/hashcash/worker/createHashcashMultiWorkerChannel.native.ts +22 -0
- package/src/challenge-solvers/hashcash/worker/createHashcashMultiWorkerChannel.ts +22 -0
- package/src/challenge-solvers/hashcash/worker/createHashcashMultiWorkerChannel.web.ts +212 -0
- package/src/challenge-solvers/hashcash/worker/createHashcashWorkerChannel.native.ts +16 -0
- package/src/challenge-solvers/hashcash/worker/createHashcashWorkerChannel.ts +16 -0
- package/src/challenge-solvers/hashcash/worker/createHashcashWorkerChannel.web.ts +97 -0
- package/src/challenge-solvers/hashcash/worker/hashcash.worker.ts +91 -0
- package/src/challenge-solvers/hashcash/worker/types.ts +69 -0
- package/src/challenge-solvers/turnstileErrors.ts +49 -0
- package/src/challenge-solvers/turnstileScriptLoader.ts +325 -0
- package/src/challenge-solvers/turnstileSolver.integration.test.ts +331 -0
- package/src/challenge-solvers/types.ts +55 -0
- package/src/challengeFlow.integration.test.ts +627 -0
- package/src/device-id/createDeviceIdService.ts +19 -0
- package/src/device-id/types.ts +11 -0
- package/src/index.ts +139 -0
- package/src/oauth-service/createOAuthService.ts +125 -0
- package/src/oauth-service/types.ts +104 -0
- package/src/performance/createNoopPerformanceTracker.ts +12 -0
- package/src/performance/createPerformanceTracker.ts +43 -0
- package/src/performance/index.ts +7 -0
- package/src/performance/types.ts +11 -0
- package/src/session-initialization/createSessionInitializationService.test.ts +557 -0
- package/src/session-initialization/createSessionInitializationService.ts +184 -0
- package/src/session-initialization/sessionErrors.ts +32 -0
- package/src/session-repository/createSessionClient.ts +10 -0
- package/src/session-repository/createSessionRepository.test.ts +313 -0
- package/src/session-repository/createSessionRepository.ts +242 -0
- package/src/session-repository/errors.ts +22 -0
- package/src/session-repository/types.ts +289 -0
- package/src/session-service/createNoopSessionService.ts +24 -0
- package/src/session-service/createSessionService.test.ts +388 -0
- package/src/session-service/createSessionService.ts +61 -0
- package/src/session-service/types.ts +59 -0
- package/src/session-storage/createSessionStorage.ts +28 -0
- package/src/session-storage/types.ts +15 -0
- package/src/session.integration.test.ts +516 -0
- package/src/sessionLifecycle.integration.test.ts +264 -0
- package/src/test-utils/createLocalCookieTransport.ts +52 -0
- package/src/test-utils/createLocalHeaderTransport.ts +45 -0
- package/src/test-utils/mocks.ts +122 -0
- package/src/test-utils.ts +200 -0
- 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 +26 -0
- 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/index.d.ts +0 -1
- package/index.js +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LxIdentifierService } from '@l.x/sessions/src/lx-identifier/types'
|
|
2
|
+
|
|
3
|
+
function createLxIdentifierService(ctx: {
|
|
4
|
+
getLxIdentifier: () => Promise<string | null>
|
|
5
|
+
setLxIdentifier: (identifier: string) => Promise<void>
|
|
6
|
+
removeLxIdentifier: () => Promise<void>
|
|
7
|
+
}): LxIdentifierService {
|
|
8
|
+
const getLxIdentifier = ctx.getLxIdentifier
|
|
9
|
+
const setLxIdentifier = ctx.setLxIdentifier
|
|
10
|
+
const removeLxIdentifier = ctx.removeLxIdentifier
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
getLxIdentifier,
|
|
14
|
+
setLxIdentifier,
|
|
15
|
+
removeLxIdentifier,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { createLxIdentifierService }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lx Identifier provider interface
|
|
3
|
+
* Platform-specific implementations handle lx 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 '@l.x/sessions/src/lx-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
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../config/tsconfig/app.json",
|
|
3
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json", "env.d.ts"],
|
|
4
|
+
"exclude": [
|
|
5
|
+
"src/**/*.spec.ts",
|
|
6
|
+
"src/**/*.spec.tsx",
|
|
7
|
+
"src/**/*.test.ts",
|
|
8
|
+
"src/**/*.test.tsx"
|
|
9
|
+
],
|
|
10
|
+
"compilerOptions": {
|
|
11
|
+
"emitDeclarationOnly": true,
|
|
12
|
+
"noEmit": false,
|
|
13
|
+
"paths": {
|
|
14
|
+
"@l.x/sessions/*": ["./src/*"]
|
|
15
|
+
},
|
|
16
|
+
"types": ["chrome", "node"]
|
|
17
|
+
},
|
|
18
|
+
"references": [
|
|
19
|
+
{
|
|
20
|
+
"path": "../utilities"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "../eslint-config"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
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
|
+
})
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@luxexchange/sessions';
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@luxexchange/sessions');
|