Skip to content

Commit 3bbce39

Browse files
committed
fix: typescript randomly removing WebCrypto from global object in Node
1 parent c5ca482 commit 3bbce39

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

apps/api/src/gateway/gateway.service.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { webcrypto } from 'node:crypto';
2+
13
import { HybridCrypto } from '@douglasneuroinformatics/libcrypto';
24
import { LoggingService } from '@douglasneuroinformatics/libnest/logging';
35
import { HttpService } from '@nestjs/axios';
@@ -9,11 +11,8 @@ import type {
911
MutateAssignmentResponseBody,
1012
RemoteAssignment
1113
} from '@opendatacapture/schemas/assignment';
12-
import {
13-
$GatewayHealthcheckSuccessResult,
14-
type GatewayHealthcheckFailureResult,
15-
type GatewayHealthcheckResult
16-
} from '@opendatacapture/schemas/gateway';
14+
import { $GatewayHealthcheckSuccessResult } from '@opendatacapture/schemas/gateway';
15+
import type { GatewayHealthcheckFailureResult, GatewayHealthcheckResult } from '@opendatacapture/schemas/gateway';
1716

1817
import { InstrumentsService } from '@/instruments/instruments.service';
1918

@@ -25,7 +24,10 @@ export class GatewayService {
2524
private readonly loggingService: LoggingService
2625
) {}
2726

28-
async createRemoteAssignment(assignment: Assignment, publicKey: CryptoKey): Promise<MutateAssignmentResponseBody> {
27+
async createRemoteAssignment(
28+
assignment: Assignment,
29+
publicKey: webcrypto.CryptoKey
30+
): Promise<MutateAssignmentResponseBody> {
2931
const instrument = await this.instrumentsService.findBundleById(assignment.instrumentId);
3032
const response = await this.httpService.axiosRef.post(`/api/assignments`, {
3133
...assignment,

0 commit comments

Comments
 (0)