@fhevm/sdk 1.0.0-alpha.2 → 1.0.0-alpha.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.
Files changed (101) hide show
  1. package/_cjs/core/_version.js +1 -1
  2. package/_cjs/core/actions/chain/parseSignedDecryptionPermit.js.map +1 -1
  3. package/_cjs/core/actions/encrypt/generateZkProof.js.map +1 -1
  4. package/_cjs/core/actions/host/getUserDecryptionDelegationExpirationDate.js +12 -14
  5. package/_cjs/core/actions/host/getUserDecryptionDelegationExpirationDate.js.map +1 -1
  6. package/_cjs/core/base/index.js +0 -5
  7. package/_cjs/core/base/index.js.map +1 -1
  8. package/_cjs/core/base/typedValue.js +20 -6
  9. package/_cjs/core/base/typedValue.js.map +1 -1
  10. package/_cjs/core/base/uint.js +23 -0
  11. package/_cjs/core/base/uint.js.map +1 -1
  12. package/_cjs/core/host-contracts/checkDelegation.js +87 -0
  13. package/_cjs/core/host-contracts/checkDelegation.js.map +1 -0
  14. package/_cjs/core/host-contracts/constants.js +5 -0
  15. package/_cjs/core/host-contracts/constants.js.map +1 -0
  16. package/_cjs/core/host-contracts/getUserDecryptionDelegationExpirationDate.js +21 -0
  17. package/_cjs/core/host-contracts/getUserDecryptionDelegationExpirationDate.js.map +1 -0
  18. package/_cjs/core/host-contracts/isHandleDelegatedForUserDecryption-p.js +33 -0
  19. package/_cjs/core/host-contracts/isHandleDelegatedForUserDecryption-p.js.map +1 -0
  20. package/_cjs/core/host-contracts/persistAllowed.js +1 -1
  21. package/_cjs/core/host-contracts/persistAllowed.js.map +1 -1
  22. package/_cjs/core/kms/fetchKmsSignedcryptedShares-p.js +16 -5
  23. package/_cjs/core/kms/fetchKmsSignedcryptedShares-p.js.map +1 -1
  24. package/_esm/core/_version.js +1 -1
  25. package/_esm/core/actions/chain/parseSignedDecryptionPermit.js.map +1 -1
  26. package/_esm/core/actions/encrypt/generateZkProof.js.map +1 -1
  27. package/_esm/core/actions/host/getUserDecryptionDelegationExpirationDate.js +13 -14
  28. package/_esm/core/actions/host/getUserDecryptionDelegationExpirationDate.js.map +1 -1
  29. package/_esm/core/base/index.js +1 -1
  30. package/_esm/core/base/index.js.map +1 -1
  31. package/_esm/core/base/typedValue.js +24 -7
  32. package/_esm/core/base/typedValue.js.map +1 -1
  33. package/_esm/core/base/uint.js +21 -0
  34. package/_esm/core/base/uint.js.map +1 -1
  35. package/_esm/core/host-contracts/checkDelegation.js +95 -0
  36. package/_esm/core/host-contracts/checkDelegation.js.map +1 -0
  37. package/_esm/core/host-contracts/constants.js +2 -0
  38. package/_esm/core/host-contracts/constants.js.map +1 -0
  39. package/_esm/core/host-contracts/getUserDecryptionDelegationExpirationDate.js +19 -0
  40. package/_esm/core/host-contracts/getUserDecryptionDelegationExpirationDate.js.map +1 -0
  41. package/_esm/core/host-contracts/isHandleDelegatedForUserDecryption-p.js +32 -0
  42. package/_esm/core/host-contracts/isHandleDelegatedForUserDecryption-p.js.map +1 -0
  43. package/_esm/core/host-contracts/persistAllowed.js +1 -1
  44. package/_esm/core/host-contracts/persistAllowed.js.map +1 -1
  45. package/_esm/core/kms/fetchKmsSignedcryptedShares-p.js +16 -5
  46. package/_esm/core/kms/fetchKmsSignedcryptedShares-p.js.map +1 -1
  47. package/_types/core/actions/chain/parseSignedDecryptionPermit.d.ts +6 -2
  48. package/_types/core/actions/chain/parseSignedDecryptionPermit.d.ts.map +1 -1
  49. package/_types/core/actions/encrypt/encryptValue.d.ts +5 -2
  50. package/_types/core/actions/encrypt/encryptValue.d.ts.map +1 -1
  51. package/_types/core/actions/encrypt/encryptValues.d.ts +5 -2
  52. package/_types/core/actions/encrypt/encryptValues.d.ts.map +1 -1
  53. package/_types/core/actions/encrypt/generateZkProof.d.ts +4 -2
  54. package/_types/core/actions/encrypt/generateZkProof.d.ts.map +1 -1
  55. package/_types/core/actions/host/getUserDecryptionDelegationExpirationDate.d.ts +5 -2
  56. package/_types/core/actions/host/getUserDecryptionDelegationExpirationDate.d.ts.map +1 -1
  57. package/_types/core/base/errors/InvalidTypeError.d.ts +1 -1
  58. package/_types/core/base/errors/InvalidTypeError.d.ts.map +1 -1
  59. package/_types/core/base/index.d.ts +1 -1
  60. package/_types/core/base/index.d.ts.map +1 -1
  61. package/_types/core/base/typedValue.d.ts +3 -13
  62. package/_types/core/base/typedValue.d.ts.map +1 -1
  63. package/_types/core/base/uint.d.ts +4 -0
  64. package/_types/core/base/uint.d.ts.map +1 -1
  65. package/_types/core/host-contracts/checkDelegation.d.ts +22 -0
  66. package/_types/core/host-contracts/checkDelegation.d.ts.map +1 -0
  67. package/_types/core/host-contracts/constants.d.ts +3 -0
  68. package/_types/core/host-contracts/constants.d.ts.map +1 -0
  69. package/_types/core/host-contracts/getUserDecryptionDelegationExpirationDate.d.ts +19 -0
  70. package/_types/core/host-contracts/getUserDecryptionDelegationExpirationDate.d.ts.map +1 -0
  71. package/_types/core/host-contracts/isHandleDelegatedForUserDecryption-p.d.ts +20 -0
  72. package/_types/core/host-contracts/isHandleDelegatedForUserDecryption-p.d.ts.map +1 -0
  73. package/_types/core/kms/fetchKmsSignedcryptedShares-p.d.ts.map +1 -1
  74. package/_types/core/types/index.d.ts +1 -0
  75. package/_types/core/types/index.d.ts.map +1 -1
  76. package/_types/core/types/kms.d.ts +21 -0
  77. package/_types/core/types/kms.d.ts.map +1 -1
  78. package/_types/core/types/primitives.d.ts +4 -0
  79. package/_types/core/types/primitives.d.ts.map +1 -1
  80. package/core/_version.ts +1 -1
  81. package/core/actions/chain/parseSignedDecryptionPermit.ts +6 -2
  82. package/core/actions/encrypt/encryptValue.ts +2 -2
  83. package/core/actions/encrypt/encryptValues.ts +2 -2
  84. package/core/actions/encrypt/generateZkProof.ts +1 -2
  85. package/core/actions/host/getUserDecryptionDelegationExpirationDate.ts +22 -18
  86. package/core/base/errors/InvalidTypeError.ts +1 -1
  87. package/core/base/index.ts +0 -1
  88. package/core/base/typedValue.ts +32 -25
  89. package/core/base/uint.ts +30 -0
  90. package/core/host-contracts/checkDelegation.ts +129 -0
  91. package/core/host-contracts/constants.ts +3 -0
  92. package/core/host-contracts/getUserDecryptionDelegationExpirationDate.ts +45 -0
  93. package/core/host-contracts/isHandleDelegatedForUserDecryption-p.ts +77 -0
  94. package/core/host-contracts/persistAllowed.ts +1 -1
  95. package/core/kms/fetchKmsSignedcryptedShares-p.ts +15 -5
  96. package/core/types/index.ts +1 -0
  97. package/core/types/kms.ts +19 -0
  98. package/core/types/primitives.ts +4 -0
  99. package/package.json +1 -1
  100. package/tsconfig.json +1 -1
  101. package/vitest.config.ts +17 -0
package/core/base/uint.ts CHANGED
@@ -444,6 +444,36 @@ export function normalizeUintForType<T extends UintTypeName>(value: Uint, typeNa
444
444
  }
445
445
  }
446
446
 
447
+ const UINT_TYPE_NAMES = [
448
+ 'uint8',
449
+ 'uint16',
450
+ 'uint32',
451
+ 'uint64',
452
+ 'uint128',
453
+ 'uint160',
454
+ 'uint256',
455
+ ] as const satisfies readonly UintTypeName[];
456
+
457
+ export function isUintTypeName(value: unknown): value is UintTypeName {
458
+ return typeof value === 'string' && (UINT_TYPE_NAMES as readonly string[]).includes(value);
459
+ }
460
+
461
+ export function assertIsUintTypeName(
462
+ value: unknown,
463
+ options: { subject?: string } & ErrorMetadataParams = {},
464
+ ): asserts value is UintTypeName {
465
+ if (!isUintTypeName(value)) {
466
+ throw new InvalidTypeError(
467
+ {
468
+ subject: options.subject,
469
+ type: typeof value,
470
+ expectedType: UINT_TYPE_NAMES,
471
+ },
472
+ options,
473
+ );
474
+ }
475
+ }
476
+
447
477
  ////////////////////////////////////////////////////////////////////////////////
448
478
  // asUintXX
449
479
  ////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,129 @@
1
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
2
+ import type { Handle } from '../types/encryptedTypes-p.js';
3
+ import type { ChecksummedAddress } from '../types/primitives.js';
4
+ import type { HandleContractPair } from '../types/other-p.js';
5
+ import { AclUserDecryptionError } from '../errors/AclError.js';
6
+ import { isHandleDelegatedForUserDecryption } from './isHandleDelegatedForUserDecryption-p.js';
7
+ import { WILDCARD_DELEGATION_ADDRESS } from './constants.js';
8
+
9
+ ////////////////////////////////////////////////////////////////////////////////
10
+
11
+ type Context = {
12
+ readonly runtime: FhevmRuntime;
13
+ readonly client: NonNullable<object>;
14
+ readonly options: { readonly batchRpcCalls: boolean };
15
+ };
16
+
17
+ type Parameters = {
18
+ readonly address: ChecksummedAddress;
19
+ readonly delegator: ChecksummedAddress;
20
+ readonly delegate: ChecksummedAddress;
21
+ readonly handleContractPairs: ReadonlyArray<{
22
+ readonly handle: Handle;
23
+ readonly contractAddress: ChecksummedAddress;
24
+ }>;
25
+ };
26
+
27
+ ////////////////////////////////////////////////////////////////////////////////
28
+
29
+ export async function checkDelegation(context: Context, parameters: Parameters): Promise<void> {
30
+ const { address, delegator, delegate, handleContractPairs } = parameters;
31
+
32
+ if (handleContractPairs.length === 0) {
33
+ throw new Error('checkDelegation requires at least one (handle, contractAddress) pair');
34
+ }
35
+
36
+ // runtime defensive check, use lowercase
37
+ function getKey(addr: string, handleBytes32Hex: string): string {
38
+ return `${addr}:${handleBytes32Hex}`.toLowerCase();
39
+ }
40
+
41
+ // 1. Verify rule: delegator !== delegate
42
+ if (delegator.toLowerCase() === delegate.toLowerCase()) {
43
+ throw new AclUserDecryptionError({
44
+ contractAddress: address,
45
+ message: `delegator ${delegator} cannot be equal to delegate`,
46
+ });
47
+ }
48
+
49
+ // 2. Verify rule: delegate !== WILDCARD_CONTRACT
50
+ if (delegate.toLowerCase() === WILDCARD_DELEGATION_ADDRESS.toLowerCase()) {
51
+ throw new AclUserDecryptionError({
52
+ contractAddress: address,
53
+ message: `delegate cannot be equal to wildcard contract address`,
54
+ });
55
+ }
56
+ if (delegator.toLowerCase() === WILDCARD_DELEGATION_ADDRESS.toLowerCase()) {
57
+ throw new AclUserDecryptionError({
58
+ contractAddress: address,
59
+ message: `delegator cannot be equal to wildcard contract address`,
60
+ });
61
+ }
62
+
63
+ // 3. Verify rules: delegator !== contractAddress & delegate !== contractAddress
64
+ for (const pair of handleContractPairs) {
65
+ if (delegator.toLowerCase() === pair.contractAddress.toLowerCase()) {
66
+ throw new AclUserDecryptionError({
67
+ contractAddress: address,
68
+ message: `delegator ${delegator} cannot be equal to contractAddress`,
69
+ });
70
+ }
71
+ if (delegate.toLowerCase() === pair.contractAddress.toLowerCase()) {
72
+ throw new AclUserDecryptionError({
73
+ contractAddress: address,
74
+ message: `delegate ${delegate} cannot be equal to contractAddress`,
75
+ });
76
+ }
77
+ }
78
+
79
+ // 4. Collect all unique (contractAddress, handle) pairs to avoid duplicate RPC calls
80
+ const allChecks: HandleContractPair[] = [];
81
+ const seenKeys = new Set<string>();
82
+
83
+ for (const pair of handleContractPairs) {
84
+ // runtime defensive check, use lowercase
85
+ const key = getKey(pair.contractAddress, pair.handle.bytes32Hex);
86
+ if (!seenKeys.has(key)) {
87
+ seenKeys.add(key);
88
+ allChecks.push({
89
+ handle: pair.handle,
90
+ contractAddress: pair.contractAddress,
91
+ });
92
+ }
93
+ }
94
+
95
+ if (allChecks.length === 0) {
96
+ throw new Error('checkDelegation: no delegation checks to perform (unexpected empty dedup result)');
97
+ }
98
+
99
+ // 5. Single batched RPC call for all unique checks
100
+ const allResults = await isHandleDelegatedForUserDecryption(context, {
101
+ address,
102
+ delegator,
103
+ delegate,
104
+ pairs: allChecks,
105
+ });
106
+
107
+ // 6. Build result map for lookup
108
+ const resultMap = new Map<string, boolean>();
109
+ for (const [i, check] of allChecks.entries()) {
110
+ const result = allResults[i];
111
+ // tsc: noUncheckedIndexedAccess
112
+ if (result === undefined) {
113
+ throw new Error(`Missing result at index ${i}`);
114
+ }
115
+ const key = getKey(check.contractAddress, check.handle.bytes32Hex);
116
+ resultMap.set(key, result);
117
+ }
118
+
119
+ // 7. Verify delegation for each requested pair
120
+ for (const pair of handleContractPairs) {
121
+ const key = getKey(pair.contractAddress, pair.handle.bytes32Hex);
122
+ if (resultMap.get(key) !== true) {
123
+ throw new AclUserDecryptionError({
124
+ contractAddress: address,
125
+ message: `Delegate ${delegate} is not delegated by ${delegator} to user decrypt handle ${pair.handle.bytes32Hex} on contract ${pair.contractAddress}!`,
126
+ });
127
+ }
128
+ }
129
+ }
@@ -0,0 +1,3 @@
1
+ import type { ChecksummedAddress } from '../types/primitives.js';
2
+
3
+ export const WILDCARD_DELEGATION_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF' as ChecksummedAddress;
@@ -0,0 +1,45 @@
1
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
2
+ import type { ChecksummedAddress, Uint64BigInt } from '../types/primitives.js';
3
+ import { isUint64 } from '../base/uint.js';
4
+ import { getUserDecryptionDelegationExpirationDateAbi } from '../host-contracts/abi-fragments/fragments.js';
5
+ import { getTrustedClient } from '../runtime/CoreFhevm-p.js';
6
+
7
+ ////////////////////////////////////////////////////////////////////////////////
8
+
9
+ type Context = {
10
+ readonly runtime: FhevmRuntime;
11
+ readonly client: NonNullable<object>;
12
+ readonly options: { readonly batchRpcCalls: boolean };
13
+ };
14
+
15
+ type Parameters = {
16
+ readonly address: ChecksummedAddress;
17
+ readonly delegator: ChecksummedAddress;
18
+ readonly delegate: ChecksummedAddress;
19
+ readonly contractAddress: ChecksummedAddress;
20
+ };
21
+
22
+ type ReturnType = Uint64BigInt;
23
+
24
+ ////////////////////////////////////////////////////////////////////////////////
25
+
26
+ export async function getUserDecryptionDelegationExpirationDate(
27
+ context: Context,
28
+ parameters: Parameters,
29
+ ): Promise<ReturnType> {
30
+ const trustedClient = getTrustedClient(context);
31
+ const address = parameters.address;
32
+
33
+ const res = await context.runtime.ethereum.readContract(trustedClient, {
34
+ address: address,
35
+ abi: getUserDecryptionDelegationExpirationDateAbi,
36
+ args: [parameters.delegator, parameters.delegate, parameters.contractAddress],
37
+ functionName: getUserDecryptionDelegationExpirationDateAbi[0].name,
38
+ });
39
+
40
+ if (!isUint64(res)) {
41
+ throw new Error(`Invalid expiration date.`);
42
+ }
43
+
44
+ return BigInt(res) as Uint64BigInt;
45
+ }
@@ -0,0 +1,77 @@
1
+ import type { ChecksummedAddress } from '../types/primitives.js';
2
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
3
+ import type { Handle } from '../types/encryptedTypes-p.js';
4
+ import type { HandleContractPair } from '../types/other-p.js';
5
+ import { isHandleDelegatedForUserDecryptionAbi } from './abi-fragments/fragments.js';
6
+ import { getTrustedClient } from '../runtime/CoreFhevm-p.js';
7
+ import { executeWithBatching } from '../base/promise.js';
8
+
9
+ ////////////////////////////////////////////////////////////////////////////////
10
+
11
+ type Context = {
12
+ readonly runtime: FhevmRuntime;
13
+ readonly client: NonNullable<object>;
14
+ readonly options: { readonly batchRpcCalls: boolean };
15
+ };
16
+
17
+ type Parameters = {
18
+ readonly address: ChecksummedAddress;
19
+ readonly delegate: ChecksummedAddress;
20
+ readonly delegator: ChecksummedAddress;
21
+ readonly pairs: readonly HandleContractPair[];
22
+ };
23
+
24
+ type ReturnType = boolean[];
25
+
26
+ ////////////////////////////////////////////////////////////////////////////////
27
+
28
+ export async function isHandleDelegatedForUserDecryption(
29
+ context: Context,
30
+ parameters: Parameters,
31
+ ): Promise<ReturnType> {
32
+ const { address, delegate, delegator, pairs } = parameters;
33
+
34
+ const rpcCalls = pairs.map(
35
+ (pair) => () =>
36
+ _isHandleDelegatedForUserDecryption(context, {
37
+ address,
38
+ delegate,
39
+ delegator,
40
+ handle: pair.handle,
41
+ contractAddress: pair.contractAddress,
42
+ }),
43
+ );
44
+
45
+ const results = await executeWithBatching(rpcCalls, context.options.batchRpcCalls);
46
+
47
+ return results;
48
+ }
49
+
50
+ ////////////////////////////////////////////////////////////////////////////////
51
+
52
+ async function _isHandleDelegatedForUserDecryption(
53
+ context: Context,
54
+ parameters: {
55
+ readonly address: ChecksummedAddress;
56
+ readonly delegator: ChecksummedAddress;
57
+ readonly delegate: ChecksummedAddress;
58
+ readonly contractAddress: ChecksummedAddress;
59
+ readonly handle: Handle;
60
+ },
61
+ ): Promise<boolean> {
62
+ const { address, delegator, delegate, contractAddress, handle } = parameters;
63
+ const trustedClient = getTrustedClient(context);
64
+
65
+ const res = await context.runtime.ethereum.readContract(trustedClient, {
66
+ address: address,
67
+ abi: isHandleDelegatedForUserDecryptionAbi,
68
+ args: [delegator, delegate, contractAddress, handle.bytes32Hex],
69
+ functionName: isHandleDelegatedForUserDecryptionAbi[0].name,
70
+ });
71
+
72
+ if (typeof res !== 'boolean') {
73
+ throw new Error(`Invalid isHandleDelegatedForUserDecryptionAbi result.`);
74
+ }
75
+
76
+ return res;
77
+ }
@@ -61,7 +61,7 @@ async function _persistAllowed(
61
61
  });
62
62
 
63
63
  if (typeof res !== 'boolean') {
64
- throw new Error(`Invalid isAllowedForDecryption result.`);
64
+ throw new Error(`Invalid persistAllowed result.`);
65
65
  }
66
66
 
67
67
  return res;
@@ -15,6 +15,7 @@ import { assertKmsDecryptionBitLimit } from './utils.js';
15
15
  import { checkPersistAllowed } from '../host-contracts/checkPersistAllowed.js';
16
16
  import { assertExtraDataMatchesKmsSingersContext } from '../host-contracts/KmsSignersContext-p.js';
17
17
  import { createKmsEip712Domain } from './createKmsEip712Domain.js';
18
+ import { checkDelegation } from '../host-contracts/checkDelegation.js';
18
19
 
19
20
  /*
20
21
  See: in KMS (eip712Domain)
@@ -118,11 +119,20 @@ export async function fetchKmsSignedcryptedShares(context: Context, parameters:
118
119
  signedPermit.assertNotExpired();
119
120
 
120
121
  // 7. Check: ACL permissions (user is signer or delegatorAddress)
121
- await checkPersistAllowed(context, {
122
- address: context.chain.fhevm.contracts.acl.address as ChecksummedAddress,
123
- userAddress: encryptedDataOwnerAddress,
124
- handleContractPairs,
125
- });
122
+ if (signedPermit.isDelegated) {
123
+ await checkDelegation(context, {
124
+ address: context.chain.fhevm.contracts.acl.address as ChecksummedAddress,
125
+ delegate: signerAddress,
126
+ delegator: encryptedDataOwnerAddress,
127
+ handleContractPairs,
128
+ });
129
+ } else {
130
+ await checkPersistAllowed(context, {
131
+ address: context.chain.fhevm.contracts.acl.address as ChecksummedAddress,
132
+ userAddress: encryptedDataOwnerAddress,
133
+ handleContractPairs,
134
+ });
135
+ }
126
136
 
127
137
  // 8. Verify the EIP712 signature
128
138
  // Not required because a signedPermit is guaranteed to be verified.
@@ -1,2 +1,3 @@
1
1
  export type { TypedValue } from './primitives.js';
2
2
  export type { EncryptedValue, EncryptedValueLike } from './encryptedTypes.js';
3
+ export type { KmsDecryptEip712Like } from './kms.js';
package/core/types/kms.ts CHANGED
@@ -99,6 +99,25 @@ export type KmsPublicDecryptEip712Message = Readonly<{
99
99
  extraData: BytesHex;
100
100
  }>;
101
101
 
102
+ export type KmsDecryptEip712Like = {
103
+ readonly domain: {
104
+ readonly name: string;
105
+ readonly version: string;
106
+ readonly chainId: number | bigint;
107
+ readonly verifyingContract: string;
108
+ };
109
+ readonly primaryType?: string | undefined;
110
+ readonly types: Record<string, ReadonlyArray<{ readonly name: string; readonly type: string }>>;
111
+ readonly message: {
112
+ readonly publicKey: string | Uint8Array;
113
+ readonly contractAddresses: string[];
114
+ readonly startTimestamp: number;
115
+ readonly durationDays: number;
116
+ readonly extraData: string | Uint8Array;
117
+ readonly delegatorAddress?: string | undefined;
118
+ };
119
+ };
120
+
102
121
  export type KmsUserDecryptEip712 = Prettify<{
103
122
  readonly domain: KmsEip712Domain;
104
123
  readonly types: KmsUserDecryptEip712Types;
@@ -631,6 +631,10 @@ type TypedValueLikeMap = Readonly<{
631
631
  address: AddressValueLike;
632
632
  }>;
633
633
 
634
+ export type RawTypedValue = {
635
+ readonly type: string;
636
+ readonly value: boolean | bigint | number | string;
637
+ };
634
638
  export type TypedValueLike = TypedValueLikeMap[ValueTypeName];
635
639
 
636
640
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fhevm/sdk",
3
3
  "description": "TypeScript Interface for FHEVM",
4
- "version": "1.0.0-alpha.2",
4
+ "version": "1.0.0-alpha.4",
5
5
  "type": "module",
6
6
  "main": "./_cjs/index.js",
7
7
  "module": "./_esm/index.js",
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "../tsconfig.base.json",
3
3
  "include": ["./**/*.ts"],
4
- "exclude": ["./**/*.test.ts", "./**/*.test-d.ts", "./**/*.bench.ts", "./**/*.bench-d.ts"],
4
+ "exclude": ["./**/*.test.ts", "./**/*.test-d.ts", "./**/*.bench.ts", "./**/*.bench-d.ts", "./vitest.config.ts"],
5
5
  "compilerOptions": {
6
6
  "composite": true,
7
7
  "noEmit": true
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ['src/**/*.test.ts'],
6
+ exclude: ['src/index.hello.test.ts'],
7
+ reporters: ['verbose'],
8
+ passWithNoTests: false,
9
+ typecheck: { enabled: true },
10
+ coverage: {
11
+ provider: 'v8',
12
+ reporter: ['text'],
13
+ //include: ['src/**/*.ts'],
14
+ //exclude: ['src/**/*.test.ts', 'src/**/*.test-d.ts', 'src/vitest.config.ts'],
15
+ },
16
+ },
17
+ });