Skip to content

Commit cc28f64

Browse files
committed
fix: update ESM/CJS module support and constructor args
- Add proper ESM/CJS dual module support - Fix constructor argument order in createMagicLinkService - Add explicit .js extensions for ESM compatibility - Bump version to 0.1.3
1 parent 54f04bb commit cc28f64

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "nostr-dm-magiclink-utils",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "A comprehensive Nostr utility library for magic link authentication via direct messages. Features include NIP-01/04 compliant message encryption, multi-relay support, internationalization (i18n) with RTL support, and TypeScript-first development. Ideal for building secure, user-friendly authentication flows in Nostr applications.",
55
"author": "vveerrgg",
66
"license": "MIT",
77
"type": "module",
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/HumanjavaEnterprises/nostr-dm-magiclink-utils.git"
10+
"url": "git+https://github.com/HumanjavaEnterprises/nostr-dm-magiclink-utils.git"
1111
},
1212
"bugs": {
1313
"url": "https://github.com/HumanjavaEnterprises/nostr-dm-magiclink-utils/issues"
@@ -32,7 +32,7 @@
3232
"exports": {
3333
".": {
3434
"import": "./dist/index.js",
35-
"require": "./dist/index.cjs",
35+
"require": "./dist/cjs/index.js",
3636
"types": "./dist/index.d.ts"
3737
},
3838
"./services/*": {

src/index.ts

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { NostrService } from './services/nostr.service';
2-
import { MagicLinkService } from './services/magiclink.service';
3-
import { NostrMagicLinkConfig } from './types/config';
4-
import { createLogger } from './utils/logger';
1+
import { NostrService } from './services/nostr.service.js';
2+
import { MagicLinkService } from './services/magiclink.service.js';
3+
import { NostrMagicLinkConfig } from './types/config.js';
4+
import { createLogger } from './utils/logger.js';
55

66
const logger = createLogger('nostr-dm-magiclink-utils');
77

@@ -20,25 +20,12 @@ export function createMagicLinkService(config: NostrMagicLinkConfig): MagicLinkS
2020
throw new Error('Verify URL is required');
2121
}
2222

23-
if (!config.nostr.privateKey) {
24-
throw new Error('Nostr private key is required');
25-
}
26-
27-
if (!config.nostr.relayUrls || config.nostr.relayUrls.length === 0) {
28-
throw new Error('At least one relay URL is required');
29-
}
30-
31-
// Create services
23+
logger.info('Creating magic link service');
3224
const nostrService = new NostrService(config.nostr);
33-
const magicLinkService = new MagicLinkService(
34-
nostrService,
35-
config.magicLink
36-
);
37-
38-
logger.info('Magic link service created successfully');
39-
40-
return magicLinkService;
25+
return new MagicLinkService(nostrService, config.magicLink);
4126
}
4227

4328
// Export types
44-
export * from './types';
29+
export * from './types/index.js';
30+
export * from './services/nostr.service.js';
31+
export * from './services/magiclink.service.js';

0 commit comments

Comments
 (0)