@napplet/sdk 0.6.0 → 0.7.0

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/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  ### How It Works
13
13
 
14
14
  1. Import `@napplet/shim` in your entry point to install the `window.napplet` global
15
- 2. Import named exports from `@napplet/sdk` -- `relay`, `ifc`, `storage`, `keys`
15
+ 2. Import named exports from `@napplet/sdk` -- `relay`, `inc`, `storage`, `keys`
16
16
  3. Each SDK method delegates to its `window.napplet.*` counterpart at call time
17
17
  4. If `window.napplet` is not installed when a method is called, a descriptive error is thrown
18
18
 
@@ -26,7 +26,7 @@ npm install @napplet/sdk @napplet/shim
26
26
 
27
27
  ```ts
28
28
  import '@napplet/shim';
29
- import { relay, ifc, storage, keys, media, notify, config, resource, type NappletConnect, type NostrEvent } from '@napplet/sdk';
29
+ import { relay, inc, storage, keys, media, notify, config, resource, type NappletConnect, type NostrEvent } from '@napplet/sdk';
30
30
 
31
31
  // Subscribe to kind 1 notes
32
32
  const sub = relay.subscribe(
@@ -43,9 +43,9 @@ const signed = await relay.publish({
43
43
  created_at: Math.floor(Date.now() / 1000),
44
44
  });
45
45
 
46
- // Inter-frame messaging
47
- ifc.emit('chat:message', [], JSON.stringify({ text: 'hi' }));
48
- const ifcSub = ifc.on('bot:response', (payload) => {
46
+ // Inter-napplet messaging
47
+ inc.emit('chat:message', [], JSON.stringify({ text: 'hi' }));
48
+ const incSub = inc.on('bot:response', (payload) => {
49
49
  console.log('Bot says:', payload);
50
50
  });
51
51
 
@@ -109,7 +109,7 @@ if (connectGranted()) {
109
109
 
110
110
  // Clean up
111
111
  sub.close();
112
- ifcSub.close();
112
+ incSub.close();
113
113
  keySub.close();
114
114
  configSub.close();
115
115
  ```
@@ -127,17 +127,23 @@ Relay operations through the shell's relay pool. Mirrors `window.napplet.relay`.
127
127
  | `publishEncrypted(template, recipient, encryption?)` | `Promise<NostrEvent>` | Send event template for encryption, signing, and broadcast |
128
128
  | `query(filters)` | `Promise<NostrEvent[]>` | One-shot query: subscribe, collect until EOSE, resolve |
129
129
 
130
- ### `ifc`
130
+ ### `inc`
131
131
 
132
- Inter-frame communication between napplets. Mirrors `window.napplet.ifc`.
132
+ Inter-napplet communication between napplets. Mirrors `window.napplet.inc`.
133
133
 
134
- Messages are sent as JSON envelope objects (`{ type: 'ifc.emit', topic, payload }`) and received as
135
- (`{ type: 'ifc.event', topic, payload, sender }`).
134
+ Messages are sent as JSON envelope objects (`{ type: 'inc.emit', topic, payload }`) and received as
135
+ (`{ type: 'inc.event', topic, payload, sender }`).
136
136
 
137
137
  | Method | Returns | Description |
138
138
  |--------|---------|-------------|
139
- | `emit(topic, extraTags?, content?)` | `void` | Broadcast an IFC event to other napplets via the shell |
140
- | `on(topic, callback)` | `{ close(): void }` | Subscribe to IFC events on a topic |
139
+ | `emit(topic, extraTags?, content?)` | `void` | Broadcast an INC event to other napplets via the shell |
140
+ | `on(topic, callback)` | `{ close(): void }` | Subscribe to INC events on a topic |
141
+
142
+ Deprecated IFC compatibility exports are available as migration aliases:
143
+ `ifc`, `ifcEmit`, `ifcOn`, `IFC_DOMAIN`, `installIfcShim`, and the `Ifc*`
144
+ message types. They forward to the INC implementation and resolve to the
145
+ canonical `inc` domain; new code should use `inc`, `incEmit`, `incOn`,
146
+ `INC_DOMAIN`, `installIncShim`, and `Inc*` names.
141
147
 
142
148
  ### `storage`
143
149
 
@@ -342,7 +348,7 @@ Namespaced capability query. Access via `window.napplet.shell.supports()` after
342
348
 
343
349
  | Method | Returns | Description |
344
350
  |--------|---------|-------------|
345
- | `supports(capability, protocol?)` | `boolean` | Check shell support for a NAP (`nap:relay`), permission (`perm:popups`), or numbered NAP-NN protocol over an interface (`ifc`, `NAP-01`). Bare NAP names are also accepted (`relay`). |
351
+ | `supports(capability, protocol?)` | `boolean` | Check shell support for a NAP (`nap:relay`), permission (`perm:popups`), or numbered NAP-NN protocol over an interface (`inc`, `NAP-01`). Bare NAP names are also accepted (`relay`). |
346
352
 
347
353
  **Example:**
348
354
 
@@ -357,7 +363,7 @@ if (window.napplet.shell.supports('nap:identity')) { /* ... */ }
357
363
  if (window.napplet.shell.supports('perm:popups')) { /* ... */ }
358
364
 
359
365
  // Numbered NAP-NN message protocols
360
- if (window.napplet.shell.supports('ifc', 'NAP-01')) { /* ... */ }
366
+ if (window.napplet.shell.supports('inc', 'NAP-01')) { /* ... */ }
361
367
  ```
362
368
 
363
369
  ### Namespace Import
@@ -394,7 +400,7 @@ import type {
394
400
  RelayNapMessage,
395
401
  IdentityNapMessage,
396
402
  StorageNapMessage,
397
- IfcNapMessage,
403
+ IncNapMessage,
398
404
  KeysNapMessage,
399
405
  Action,
400
406
  } from '@napplet/sdk';
@@ -424,7 +430,7 @@ handlers in shell implementations or protocol-aware code.
424
430
  | `RelayNapMessage` | `@napplet/nap/relay` | Discriminated union of all relay domain messages |
425
431
  | `IdentityNapMessage` | `@napplet/nap/identity` | Discriminated union of all identity domain messages |
426
432
  | `StorageNapMessage` | `@napplet/nap/storage` | Discriminated union of all storage domain messages |
427
- | `IfcNapMessage` | `@napplet/nap/ifc` | Discriminated union of all IFC domain messages |
433
+ | `IncNapMessage` | `@napplet/nap/inc` | Discriminated union of all INC domain messages |
428
434
  | `KeysNapMessage` | `@napplet/nap/keys` | Discriminated union of all keys domain messages |
429
435
  | `MediaNapMessage` | `@napplet/nap/media` | Discriminated union of all media domain messages |
430
436
  | `NotifyNapMessage` | `@napplet/nap/notify` | Discriminated union of all notify domain messages |
@@ -443,8 +449,8 @@ Individual message types (e.g., `RelaySubscribeMessage`, `IdentityGetPublicKeyMe
443
449
  Each NAP domain has a string constant re-exported from its package:
444
450
 
445
451
  ```ts
446
- import { RELAY_DOMAIN, IDENTITY_DOMAIN, STORAGE_DOMAIN, IFC_DOMAIN, THEME_DOMAIN, KEYS_DOMAIN, MEDIA_DOMAIN, NOTIFY_DOMAIN, CONFIG_DOMAIN, RESOURCE_DOMAIN, CONNECT_DOMAIN, CLASS_DOMAIN } from '@napplet/sdk';
447
- // Values: 'relay', 'identity', 'storage', 'ifc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'connect', 'class'
452
+ import { RELAY_DOMAIN, IDENTITY_DOMAIN, STORAGE_DOMAIN, INC_DOMAIN, THEME_DOMAIN, KEYS_DOMAIN, MEDIA_DOMAIN, NOTIFY_DOMAIN, CONFIG_DOMAIN, RESOURCE_DOMAIN, CONNECT_DOMAIN, CLASS_DOMAIN } from '@napplet/sdk';
453
+ // Values: 'relay', 'identity', 'storage', 'inc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'connect', 'class'
448
454
  ```
449
455
 
450
456
  These constants are re-exported from the individual domain packages. Use them with the shell capability query
@@ -504,7 +510,7 @@ This protects against importing `@napplet/sdk` without the side-effect shim impo
504
510
 
505
511
  ```ts
506
512
  import '@napplet/shim'; // required: installs window.napplet
507
- import { relay, ifc, storage, keys, media, notify } from '@napplet/sdk'; // optional: typed API
513
+ import { relay, inc, storage, keys, media, notify } from '@napplet/sdk'; // optional: typed API
508
514
  ```
509
515
 
510
516
  If you are writing a vanilla napplet with no build step, use `window.napplet.*` directly after importing the shim -- the SDK is not required.
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { DOMAIN as MEDIA_DOMAIN, MediaAction, MediaArtwork, MediaCapabilitiesMes
5
5
  export { DOMAIN as RELAY_DOMAIN, RelayCloseMessage, RelayClosedMessage, RelayEoseMessage, RelayEventMessage, RelayInboundMessage, RelayMessage, RelayNapMessage, RelayOutboundMessage, RelayPublishEncryptedMessage, RelayPublishEncryptedResultMessage, RelayPublishMessage, RelayPublishResultMessage, RelayQueryMessage, RelayQueryResultMessage, RelaySubscribeMessage, installRelayShim, relayPublish, relayPublishEncrypted, relayQuery, relaySubscribe } from '@napplet/nap/relay';
6
6
  export { Badge, DOMAIN as IDENTITY_DOMAIN, IdentityChangedMessage, IdentityGetBadgesMessage, IdentityGetBadgesResultMessage, IdentityGetBlockedMessage, IdentityGetBlockedResultMessage, IdentityGetFollowsMessage, IdentityGetFollowsResultMessage, IdentityGetListMessage, IdentityGetListResultMessage, IdentityGetMutesMessage, IdentityGetMutesResultMessage, IdentityGetProfileMessage, IdentityGetProfileResultMessage, IdentityGetPublicKeyMessage, IdentityGetPublicKeyResultMessage, IdentityGetRelaysMessage, IdentityGetRelaysResultMessage, IdentityGetZapsMessage, IdentityGetZapsResultMessage, IdentityMessage, IdentityNapMessage, RelayPermission as IdentityRelayPermission, IdentityRequestMessage, IdentityResultMessage, ProfileData, ZapReceipt, identityGetBadges, identityGetBlocked, identityGetFollows, identityGetList, identityGetMutes, identityGetProfile, identityGetPublicKey, identityGetRelays, identityGetZaps, identityOnChanged, installIdentityShim } from '@napplet/nap/identity';
7
7
  export { DOMAIN as STORAGE_DOMAIN, StorageGetMessage, StorageGetResultMessage, StorageKeysMessage, StorageKeysResultMessage, StorageMessage, StorageNapMessage, StorageRemoveMessage, StorageRemoveResultMessage, StorageRequestMessage, StorageResultMessage, StorageSetMessage, StorageSetResultMessage, installStorageShim, storageGetItem, storageKeys, storageRemoveItem, storageSetItem } from '@napplet/nap/storage';
8
+ export { DOMAIN as INC_DOMAIN, IncChannelBroadcastMessage, IncChannelCloseMessage, IncChannelClosedMessage, IncChannelEmitMessage, IncChannelEventMessage, IncChannelListMessage, IncChannelListResultMessage, IncChannelMessage, IncChannelOpenMessage, IncChannelOpenResultMessage, IncEmitMessage, IncEventMessage, IncInboundMessage, IncMessage, IncNapMessage, IncOutboundMessage, IncSubscribeMessage, IncSubscribeResultMessage, IncTopicMessage, IncUnsubscribeMessage, incEmit, incOn, installIncShim } from '@napplet/nap/inc';
8
9
  export { DOMAIN as IFC_DOMAIN, IfcChannelBroadcastMessage, IfcChannelCloseMessage, IfcChannelClosedMessage, IfcChannelEmitMessage, IfcChannelEventMessage, IfcChannelListMessage, IfcChannelListResultMessage, IfcChannelMessage, IfcChannelOpenMessage, IfcChannelOpenResultMessage, IfcEmitMessage, IfcEventMessage, IfcInboundMessage, IfcMessage, IfcNapMessage, IfcOutboundMessage, IfcSubscribeMessage, IfcSubscribeResultMessage, IfcTopicMessage, IfcUnsubscribeMessage, ifcEmit, ifcOn, installIfcShim } from '@napplet/nap/ifc';
9
10
  export { DOMAIN as THEME_DOMAIN, Theme, ThemeBackground, ThemeChangedMessage, ThemeColors, ThemeFont, ThemeGetMessage, ThemeGetResultMessage, ThemeMessage, ThemeNapMessage, ThemeRequestMessage, ThemeResultMessage } from '@napplet/nap/theme';
10
11
  export { Action, DOMAIN as KEYS_DOMAIN, KeyBinding, KeysActionMessage, KeysBindingsMessage, KeysForwardMessage, KeysMessage, KeysNapMessage, KeysRegisterActionMessage, KeysRegisterActionResultMessage, KeysRequestMessage, KeysResultMessage, KeysUnregisterActionMessage, RegisterResult, installKeysShim, keysOnAction, keysRegister, keysRegisterAction, keysUnregisterAction } from '@napplet/nap/keys';
@@ -17,12 +18,12 @@ export { DOMAIN as CLASS_DOMAIN, ClassAssignedMessage, ClassMessage, ClassNapMes
17
18
  /**
18
19
  * @napplet/sdk -- Typed named exports wrapping window.napplet.
19
20
  *
20
- * Provides `relay`, `ifc`, `storage`, and `keys` objects that delegate
21
+ * Provides `relay`, `inc`, `storage`, and `keys` objects that delegate
21
22
  * to `window.napplet.*` at call time. Developers using a bundler can import
22
23
  * individual namespaces without depending on the shim's side-effect install:
23
24
  *
24
25
  * ```ts
25
- * import { relay, ifc } from '@napplet/sdk';
26
+ * import { relay, inc } from '@napplet/sdk';
26
27
  * ```
27
28
  *
28
29
  * The shim must still be imported somewhere in the application to install
@@ -92,29 +93,49 @@ declare const relay: {
92
93
  query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]>;
93
94
  };
94
95
  /**
95
- * Inter-frame pubsub: broadcast and receive IFC-PEER events through the shell.
96
+ * Inter-napplet pubsub: broadcast and receive INC-PEER events through the shell.
96
97
  *
97
98
  * @example
98
99
  * ```ts
99
- * import { ifc } from '@napplet/sdk';
100
+ * import { inc } from '@napplet/sdk';
100
101
  *
101
- * ifc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));
102
+ * inc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));
102
103
  *
103
- * const sub = ifc.on('profile:open', (payload) => {
104
+ * const sub = inc.on('profile:open', (payload) => {
104
105
  * console.log('Profile requested:', payload);
105
106
  * });
106
107
  * ```
107
108
  */
109
+ declare const inc: {
110
+ /**
111
+ * Broadcast an INC-PEER event to other napplets via the shell.
112
+ * @param topic The 't' tag value (e.g., 'profile:open')
113
+ * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])
114
+ * @param content Event content (default: empty string)
115
+ */
116
+ emit(topic: string, extraTags?: string[][], content?: string): void;
117
+ /**
118
+ * Subscribe to INC-PEER events on a specific topic.
119
+ * @param topic The 't' tag value to listen for
120
+ * @param callback Called with `(payload, event)` for each matching event
121
+ * @returns A Subscription handle with a `close()` method
122
+ */
123
+ on(topic: string, callback: (payload: unknown, event: NostrEvent) => void): Subscription;
124
+ };
125
+ /**
126
+ * @deprecated Use {@link inc}. NAP-IFC was renamed to NAP-INC; this package
127
+ * alias is kept only to ease downstream migration.
128
+ */
108
129
  declare const ifc: {
109
130
  /**
110
- * Broadcast an IFC-PEER event to other napplets via the shell.
131
+ * Broadcast an INC-PEER event to other napplets via the shell.
111
132
  * @param topic The 't' tag value (e.g., 'profile:open')
112
133
  * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])
113
134
  * @param content Event content (default: empty string)
114
135
  */
115
136
  emit(topic: string, extraTags?: string[][], content?: string): void;
116
137
  /**
117
- * Subscribe to IFC-PEER events on a specific topic.
138
+ * Subscribe to INC-PEER events on a specific topic.
118
139
  * @param topic The 't' tag value to listen for
119
140
  * @param callback Called with `(payload, event)` for each matching event
120
141
  * @returns A Subscription handle with a `close()` method
@@ -592,4 +613,4 @@ declare const resource: {
592
613
  };
593
614
  };
594
615
 
595
- export { config, identity, ifc, keys, media, notify, relay, resource, storage };
616
+ export { config, identity, ifc, inc, keys, media, notify, relay, resource, storage };
package/dist/index.js CHANGED
@@ -3,18 +3,20 @@ import { NAP_DOMAINS } from "@napplet/core";
3
3
  import { DOMAIN } from "@napplet/nap/relay";
4
4
  import { DOMAIN as DOMAIN2 } from "@napplet/nap/identity";
5
5
  import { DOMAIN as DOMAIN3 } from "@napplet/nap/storage";
6
- import { DOMAIN as DOMAIN4 } from "@napplet/nap/ifc";
7
- import { DOMAIN as DOMAIN5 } from "@napplet/nap/theme";
8
- import { DOMAIN as DOMAIN6 } from "@napplet/nap/keys";
9
- import { DOMAIN as DOMAIN7 } from "@napplet/nap/media";
10
- import { DOMAIN as DOMAIN8 } from "@napplet/nap/notify";
11
- import { DOMAIN as DOMAIN9 } from "@napplet/nap/config";
12
- import { DOMAIN as DOMAIN10 } from "@napplet/nap/resource";
13
- import { DOMAIN as DOMAIN11 } from "@napplet/nap/connect";
14
- import { DOMAIN as DOMAIN12 } from "@napplet/nap/class";
6
+ import { DOMAIN as DOMAIN4 } from "@napplet/nap/inc";
7
+ import { DOMAIN as DOMAIN5 } from "@napplet/nap/ifc";
8
+ import { DOMAIN as DOMAIN6 } from "@napplet/nap/theme";
9
+ import { DOMAIN as DOMAIN7 } from "@napplet/nap/keys";
10
+ import { DOMAIN as DOMAIN8 } from "@napplet/nap/media";
11
+ import { DOMAIN as DOMAIN9 } from "@napplet/nap/notify";
12
+ import { DOMAIN as DOMAIN10 } from "@napplet/nap/config";
13
+ import { DOMAIN as DOMAIN11 } from "@napplet/nap/resource";
14
+ import { DOMAIN as DOMAIN12 } from "@napplet/nap/connect";
15
+ import { DOMAIN as DOMAIN13 } from "@napplet/nap/class";
15
16
  import { installRelayShim } from "@napplet/nap/relay";
16
17
  import { installIdentityShim } from "@napplet/nap/identity";
17
18
  import { installStorageShim } from "@napplet/nap/storage";
19
+ import { installIncShim } from "@napplet/nap/inc";
18
20
  import { installIfcShim } from "@napplet/nap/ifc";
19
21
  import { installKeysShim } from "@napplet/nap/keys";
20
22
  import { installMediaShim } from "@napplet/nap/media";
@@ -37,6 +39,7 @@ import {
37
39
  identityGetBadges
38
40
  } from "@napplet/nap/identity";
39
41
  import { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from "@napplet/nap/storage";
42
+ import { incEmit, incOn } from "@napplet/nap/inc";
40
43
  import { ifcEmit, ifcOn } from "@napplet/nap/ifc";
41
44
  import { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from "@napplet/nap/keys";
42
45
  import { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from "@napplet/nap/media";
@@ -91,26 +94,27 @@ var relay = {
91
94
  return requireNapplet().relay.query(filters);
92
95
  }
93
96
  };
94
- var ifc = {
97
+ var inc = {
95
98
  /**
96
- * Broadcast an IFC-PEER event to other napplets via the shell.
99
+ * Broadcast an INC-PEER event to other napplets via the shell.
97
100
  * @param topic The 't' tag value (e.g., 'profile:open')
98
101
  * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])
99
102
  * @param content Event content (default: empty string)
100
103
  */
101
104
  emit(topic, extraTags, content) {
102
- requireNapplet().ifc.emit(topic, extraTags, content);
105
+ requireNapplet().inc.emit(topic, extraTags, content);
103
106
  },
104
107
  /**
105
- * Subscribe to IFC-PEER events on a specific topic.
108
+ * Subscribe to INC-PEER events on a specific topic.
106
109
  * @param topic The 't' tag value to listen for
107
110
  * @param callback Called with `(payload, event)` for each matching event
108
111
  * @returns A Subscription handle with a `close()` method
109
112
  */
110
113
  on(topic, callback) {
111
- return requireNapplet().ifc.on(topic, callback);
114
+ return requireNapplet().inc.on(topic, callback);
112
115
  }
113
116
  };
117
+ var ifc = inc;
114
118
  var storage = {
115
119
  /**
116
120
  * Retrieve a stored value by key. Returns null if the key does not exist.
@@ -506,19 +510,20 @@ var resource = {
506
510
  }
507
511
  };
508
512
  export {
509
- DOMAIN12 as CLASS_DOMAIN,
510
- DOMAIN9 as CONFIG_DOMAIN,
511
- DOMAIN11 as CONNECT_DOMAIN,
513
+ DOMAIN13 as CLASS_DOMAIN,
514
+ DOMAIN10 as CONFIG_DOMAIN,
515
+ DOMAIN12 as CONNECT_DOMAIN,
512
516
  DOMAIN2 as IDENTITY_DOMAIN,
513
- DOMAIN4 as IFC_DOMAIN,
514
- DOMAIN6 as KEYS_DOMAIN,
515
- DOMAIN7 as MEDIA_DOMAIN,
517
+ DOMAIN5 as IFC_DOMAIN,
518
+ DOMAIN4 as INC_DOMAIN,
519
+ DOMAIN7 as KEYS_DOMAIN,
520
+ DOMAIN8 as MEDIA_DOMAIN,
516
521
  NAP_DOMAINS,
517
- DOMAIN8 as NOTIFY_DOMAIN,
522
+ DOMAIN9 as NOTIFY_DOMAIN,
518
523
  DOMAIN as RELAY_DOMAIN,
519
- DOMAIN10 as RESOURCE_DOMAIN,
524
+ DOMAIN11 as RESOURCE_DOMAIN,
520
525
  DOMAIN3 as STORAGE_DOMAIN,
521
- DOMAIN5 as THEME_DOMAIN,
526
+ DOMAIN6 as THEME_DOMAIN,
522
527
  config,
523
528
  connectGranted,
524
529
  connectOrigins,
@@ -537,11 +542,15 @@ export {
537
542
  ifc,
538
543
  ifcEmit,
539
544
  ifcOn,
545
+ inc,
546
+ incEmit,
547
+ incOn,
540
548
  installClassShim,
541
549
  installConfigShim,
542
550
  installConnectShim,
543
551
  installIdentityShim,
544
552
  installIfcShim,
553
+ installIncShim,
545
554
  installKeysShim,
546
555
  installMediaShim,
547
556
  installNotifyShim,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Typed named exports wrapping window.napplet.\n *\n * Provides `relay`, `ifc`, `storage`, and `keys` objects that delegate\n * to `window.napplet.*` at call time. Developers using a bundler can import\n * individual namespaces without depending on the shim's side-effect install:\n *\n * ```ts\n * import { relay, ifc } from '@napplet/sdk';\n * ```\n *\n * The shim must still be imported somewhere in the application to install\n * the `window.napplet` global. The SDK only wraps it -- it does not install it.\n *\n * Domain-specific SDK helpers are also available directly from NAP packages:\n * ```ts\n * import { relaySubscribe } from '@napplet/nap/relay';\n * import { storageGetItem } from '@napplet/nap/storage';\n * ```\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n NostrEvent,\n NostrFilter,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nfunction requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n/**\n * Inter-frame pubsub: broadcast and receive IFC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { ifc } from '@napplet/sdk';\n *\n * ifc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = ifc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const ifc = {\n /**\n * Broadcast an IFC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().ifc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to IFC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().ifc.on(topic, callback);\n },\n};\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n};\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * owner: 'napplet',\n * metadata: { title: 'My Song', artist: 'The Artist' },\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param options Ownership-aware session options\n * @returns The shell result with canonical sessionId and owner, or error\n */\n createSession(options: MediaSessionCreate): Promise<MediaSessionResult> {\n return requireNapplet().media.createSession(options);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: Partial<MediaMetadata>): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: MediaState): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: MediaAction[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Send a command to the current playback owner.\n * @param sessionId The session to control\n * @param action The media action to request\n * @param value Optional value for seek/volume\n */\n sendCommand(sessionId: string, action: MediaAction, value?: number): void {\n requireNapplet().media.sendCommand(sessionId, action, value);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: MediaAction, value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported playback state for shell-owned sessions.\n * @param sessionId The session to listen for state on\n * @param callback Called with playback state\n * @returns A Subscription with `close()` to stop listening\n */\n onState(\n sessionId: string,\n callback: (state: MediaState) => void,\n ): Subscription {\n return requireNapplet().media.onState(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported capabilities for shell-owned sessions.\n * @param sessionId The session to listen for capabilities on\n * @param callback Called with available actions\n * @returns A Subscription with `close()` to stop listening\n */\n onCapabilities(\n sessionId: string,\n callback: (actions: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onCapabilities(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Listen for shell-pushed user identity changes.\n * @param handler Called with a hex pubkey, or \"\" when no user/signer is connected\n * @returns Subscription with close() to detach the handler\n */\n onChanged(handler: (pubkey: string) => void): Subscription {\n return requireNapplet().identity.onChanged(handler);\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n};\n\n/**\n * Per-napplet declarative configuration (NAP-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n/**\n * Browser-enforced byte-fetching primitive: napplets request bytes by URL,\n * shell fetches and returns a Blob. URL space is scheme-pluggable\n * (`data:`, `https:`, `blossom:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('https://example.com/avatar.png');\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource = {\n /**\n * Fetch bytes for a URL through the shell's resource pipeline.\n * @param url URL identifying the resource (any registered scheme).\n * @returns Promise resolving to the fetched bytes as a Blob.\n */\n bytes(url: string): Promise<Blob> {\n return requireNapplet().resource.bytes(url);\n },\n\n /**\n * Fetch bytes and return a managed object URL handle.\n * Call `revoke()` to release the underlying Blob URL.\n * @param url URL identifying the resource.\n * @returns Synchronous handle `{ url, revoke }`.\n */\n bytesAsObjectURL(url: string): { url: string; revoke: () => void } {\n return requireNapplet().resource.bytesAsObjectURL(url);\n },\n};\n\nexport type { NostrEvent } from '@napplet/core';\nexport type { NostrFilter } from '@napplet/core';\nexport type { Subscription } from '@napplet/core';\nexport type { EventTemplate } from '@napplet/core';\n\nexport type {\n NappletMessage,\n NapDomain,\n NamespacedCapability,\n NapProtocolId,\n ProtocolId,\n ShellSupports,\n} from '@napplet/core';\nexport { NAP_DOMAINS } from '@napplet/core';\n\n// Relay NAP\nexport type {\n RelayMessage,\n RelaySubscribeMessage,\n RelayCloseMessage,\n RelayPublishMessage,\n RelayPublishEncryptedMessage,\n RelayQueryMessage,\n RelayEventMessage,\n RelayEoseMessage,\n RelayClosedMessage,\n RelayPublishResultMessage,\n RelayPublishEncryptedResultMessage,\n RelayQueryResultMessage,\n RelayOutboundMessage,\n RelayInboundMessage,\n RelayNapMessage,\n} from '@napplet/nap/relay';\n\n// Identity NAP\nexport type {\n ProfileData,\n ZapReceipt,\n Badge,\n RelayPermission as IdentityRelayPermission,\n IdentityMessage,\n IdentityGetPublicKeyMessage,\n IdentityGetRelaysMessage,\n IdentityGetProfileMessage,\n IdentityGetFollowsMessage,\n IdentityGetListMessage,\n IdentityGetZapsMessage,\n IdentityGetMutesMessage,\n IdentityGetBlockedMessage,\n IdentityGetBadgesMessage,\n IdentityGetPublicKeyResultMessage,\n IdentityGetRelaysResultMessage,\n IdentityGetProfileResultMessage,\n IdentityGetFollowsResultMessage,\n IdentityGetListResultMessage,\n IdentityGetZapsResultMessage,\n IdentityGetMutesResultMessage,\n IdentityGetBlockedResultMessage,\n IdentityGetBadgesResultMessage,\n IdentityChangedMessage,\n IdentityRequestMessage,\n IdentityResultMessage,\n IdentityNapMessage,\n} from '@napplet/nap/identity';\n\n// Storage NAP\nexport type {\n StorageMessage,\n StorageGetMessage,\n StorageSetMessage,\n StorageRemoveMessage,\n StorageKeysMessage,\n StorageGetResultMessage,\n StorageSetResultMessage,\n StorageRemoveResultMessage,\n StorageKeysResultMessage,\n StorageRequestMessage,\n StorageResultMessage,\n StorageNapMessage,\n} from '@napplet/nap/storage';\n\n// IFC NAP\nexport type {\n IfcMessage,\n IfcEmitMessage,\n IfcSubscribeMessage,\n IfcSubscribeResultMessage,\n IfcUnsubscribeMessage,\n IfcEventMessage,\n IfcChannelOpenMessage,\n IfcChannelOpenResultMessage,\n IfcChannelEmitMessage,\n IfcChannelEventMessage,\n IfcChannelBroadcastMessage,\n IfcChannelListMessage,\n IfcChannelListResultMessage,\n IfcChannelCloseMessage,\n IfcChannelClosedMessage,\n IfcTopicMessage,\n IfcChannelMessage,\n IfcOutboundMessage,\n IfcInboundMessage,\n IfcNapMessage,\n} from '@napplet/nap/ifc';\n\n// Theme NAP\nexport type {\n ThemeColors,\n ThemeFont,\n ThemeBackground,\n Theme,\n ThemeMessage,\n ThemeGetMessage,\n ThemeGetResultMessage,\n ThemeChangedMessage,\n ThemeRequestMessage,\n ThemeResultMessage,\n ThemeNapMessage,\n} from '@napplet/nap/theme';\n\n// Keys NAP\nexport type {\n Action,\n RegisterResult,\n KeyBinding,\n KeysMessage,\n KeysForwardMessage,\n KeysRegisterActionMessage,\n KeysRegisterActionResultMessage,\n KeysUnregisterActionMessage,\n KeysBindingsMessage,\n KeysActionMessage,\n KeysRequestMessage,\n KeysResultMessage,\n KeysNapMessage,\n} from '@napplet/nap/keys';\n\n// Media NAP\nexport type {\n MediaMetadata,\n MediaArtwork,\n MediaPlaybackOwner,\n MediaSourceRef,\n MediaSessionCreate,\n MediaSessionResult,\n MediaState,\n MediaAction,\n MediaMessage,\n MediaSessionCreateMessage,\n MediaSessionCreateResultMessage,\n MediaSessionUpdateMessage,\n MediaSessionDestroyMessage,\n MediaStateMessage,\n MediaCapabilitiesMessage,\n MediaCommandMessage,\n MediaControlsMessage,\n MediaRequestMessage,\n MediaResultMessage,\n MediaNapMessage,\n} from '@napplet/nap/media';\n\n// Notify NAP\nexport type {\n NotificationPriority,\n NotificationAction,\n NotificationChannel,\n NotifyControl,\n NotifyMessage,\n NotifySendMessage,\n NotifySendResultMessage,\n NotifyDismissMessage,\n NotifyBadgeMessage,\n NotifyChannelRegisterMessage,\n NotifyPermissionRequestMessage,\n NotifyPermissionResultMessage,\n NotifyActionMessage,\n NotifyClickedMessage,\n NotifyDismissedMessage,\n NotifyControlsMessage,\n NotifyRequestMessage,\n NotifyResultMessage,\n NotifyNapMessage,\n} from '@napplet/nap/notify';\n\n// Config NAP\nexport type {\n NappletConfigSchema,\n ConfigSchema,\n ConfigValues,\n ConfigSchemaErrorCode,\n NappletConfigSchemaExtensions,\n ConfigMessage,\n ConfigRegisterSchemaMessage,\n ConfigGetMessage,\n ConfigSubscribeMessage,\n ConfigUnsubscribeMessage,\n ConfigOpenSettingsMessage,\n ConfigRegisterSchemaResultMessage,\n ConfigValuesMessage,\n ConfigSchemaErrorMessage,\n ConfigRequestMessage,\n ConfigResultMessage,\n ConfigNapMessage,\n} from '@napplet/nap/config';\n\n// Resource NAP\nexport type {\n ResourceErrorCode,\n ResourceScheme,\n ResourceMessage,\n ResourceBytesMessage,\n ResourceCancelMessage,\n ResourceBytesResultMessage,\n ResourceBytesErrorMessage,\n ResourceSidecarEntry,\n ResourceRequestMessage,\n ResourceResultMessage,\n ResourceNapMessage,\n} from '@napplet/nap/resource';\n\n// Connect NAP\nexport type {\n NappletConnect,\n} from '@napplet/nap/connect';\n\n// Class NAP\nexport type {\n ClassMessage,\n ClassAssignedMessage,\n NappletClass,\n ClassNapMessage,\n} from '@napplet/nap/class';\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nap/relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nap/identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nap/storage';\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nap/ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nap/theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nap/keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nap/media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nap/notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nap/config';\nexport { DOMAIN as RESOURCE_DOMAIN } from '@napplet/nap/resource';\nexport { DOMAIN as CONNECT_DOMAIN } from '@napplet/nap/connect';\nexport { DOMAIN as CLASS_DOMAIN } from '@napplet/nap/class';\n\nexport { installRelayShim } from '@napplet/nap/relay';\nexport { installIdentityShim } from '@napplet/nap/identity';\nexport { installStorageShim } from '@napplet/nap/storage';\nexport { installIfcShim } from '@napplet/nap/ifc';\nexport { installKeysShim } from '@napplet/nap/keys';\nexport { installMediaShim } from '@napplet/nap/media';\nexport { installNotifyShim } from '@napplet/nap/notify';\nexport { installConfigShim } from '@napplet/nap/config';\nexport { installResourceShim } from '@napplet/nap/resource';\nexport { installConnectShim } from '@napplet/nap/connect';\nexport { installClassShim } from '@napplet/nap/class';\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nap/relay';\nexport {\n identityGetPublicKey,\n identityOnChanged,\n identityGetRelays,\n identityGetProfile,\n identityGetFollows,\n identityGetList,\n identityGetZaps,\n identityGetMutes,\n identityGetBlocked,\n identityGetBadges,\n} from '@napplet/nap/identity';\nexport { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from '@napplet/nap/storage';\nexport { ifcEmit, ifcOn } from '@napplet/nap/ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nap/keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from '@napplet/nap/media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nap/notify';\nexport { resourceBytes, resourceBytesAsObjectURL } from '@napplet/nap/resource';\nexport { connectGranted, connectOrigins, normalizeConnectOrigin } from '@napplet/nap/connect';\nexport { getClass } from '@napplet/nap/class';\n"],"mappings":";AAwxBA,SAAS,mBAAmB;AA4N5B,SAAmB,cAAoB;AACvC,SAAmB,UAAVA,eAAiC;AAC1C,SAAmB,UAAVA,eAAgC;AACzC,SAAmB,UAAVA,eAA4B;AACrC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA6B;AACtC,SAAmB,UAAV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\n *\n * Provides `relay`, `inc`, `storage`, and `keys` objects that delegate\n * to `window.napplet.*` at call time. Developers using a bundler can import\n * individual namespaces without depending on the shim's side-effect install:\n *\n * ```ts\n * import { relay, inc } from '@napplet/sdk';\n * ```\n *\n * The shim must still be imported somewhere in the application to install\n * the `window.napplet` global. The SDK only wraps it -- it does not install it.\n *\n * Domain-specific SDK helpers are also available directly from NAP packages:\n * ```ts\n * import { relaySubscribe } from '@napplet/nap/relay';\n * import { storageGetItem } from '@napplet/nap/storage';\n * ```\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n NostrEvent,\n NostrFilter,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nfunction requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n/**\n * Inter-napplet pubsub: broadcast and receive INC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { inc } from '@napplet/sdk';\n *\n * inc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = inc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const inc = {\n /**\n * Broadcast an INC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().inc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to INC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().inc.on(topic, callback);\n },\n};\n\n/**\n * @deprecated Use {@link inc}. NAP-IFC was renamed to NAP-INC; this package\n * alias is kept only to ease downstream migration.\n */\nexport const ifc = inc;\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n};\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * owner: 'napplet',\n * metadata: { title: 'My Song', artist: 'The Artist' },\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param options Ownership-aware session options\n * @returns The shell result with canonical sessionId and owner, or error\n */\n createSession(options: MediaSessionCreate): Promise<MediaSessionResult> {\n return requireNapplet().media.createSession(options);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: Partial<MediaMetadata>): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: MediaState): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: MediaAction[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Send a command to the current playback owner.\n * @param sessionId The session to control\n * @param action The media action to request\n * @param value Optional value for seek/volume\n */\n sendCommand(sessionId: string, action: MediaAction, value?: number): void {\n requireNapplet().media.sendCommand(sessionId, action, value);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: MediaAction, value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported playback state for shell-owned sessions.\n * @param sessionId The session to listen for state on\n * @param callback Called with playback state\n * @returns A Subscription with `close()` to stop listening\n */\n onState(\n sessionId: string,\n callback: (state: MediaState) => void,\n ): Subscription {\n return requireNapplet().media.onState(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported capabilities for shell-owned sessions.\n * @param sessionId The session to listen for capabilities on\n * @param callback Called with available actions\n * @returns A Subscription with `close()` to stop listening\n */\n onCapabilities(\n sessionId: string,\n callback: (actions: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onCapabilities(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Listen for shell-pushed user identity changes.\n * @param handler Called with a hex pubkey, or \"\" when no user/signer is connected\n * @returns Subscription with close() to detach the handler\n */\n onChanged(handler: (pubkey: string) => void): Subscription {\n return requireNapplet().identity.onChanged(handler);\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n};\n\n/**\n * Per-napplet declarative configuration (NAP-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n/**\n * Browser-enforced byte-fetching primitive: napplets request bytes by URL,\n * shell fetches and returns a Blob. URL space is scheme-pluggable\n * (`data:`, `https:`, `blossom:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('https://example.com/avatar.png');\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource = {\n /**\n * Fetch bytes for a URL through the shell's resource pipeline.\n * @param url URL identifying the resource (any registered scheme).\n * @returns Promise resolving to the fetched bytes as a Blob.\n */\n bytes(url: string): Promise<Blob> {\n return requireNapplet().resource.bytes(url);\n },\n\n /**\n * Fetch bytes and return a managed object URL handle.\n * Call `revoke()` to release the underlying Blob URL.\n * @param url URL identifying the resource.\n * @returns Synchronous handle `{ url, revoke }`.\n */\n bytesAsObjectURL(url: string): { url: string; revoke: () => void } {\n return requireNapplet().resource.bytesAsObjectURL(url);\n },\n};\n\nexport type { NostrEvent } from '@napplet/core';\nexport type { NostrFilter } from '@napplet/core';\nexport type { Subscription } from '@napplet/core';\nexport type { EventTemplate } from '@napplet/core';\n\nexport type {\n NappletMessage,\n NapDomain,\n NamespacedCapability,\n NapProtocolId,\n ProtocolId,\n ShellSupports,\n} from '@napplet/core';\nexport { NAP_DOMAINS } from '@napplet/core';\n\n// Relay NAP\nexport type {\n RelayMessage,\n RelaySubscribeMessage,\n RelayCloseMessage,\n RelayPublishMessage,\n RelayPublishEncryptedMessage,\n RelayQueryMessage,\n RelayEventMessage,\n RelayEoseMessage,\n RelayClosedMessage,\n RelayPublishResultMessage,\n RelayPublishEncryptedResultMessage,\n RelayQueryResultMessage,\n RelayOutboundMessage,\n RelayInboundMessage,\n RelayNapMessage,\n} from '@napplet/nap/relay';\n\n// Identity NAP\nexport type {\n ProfileData,\n ZapReceipt,\n Badge,\n RelayPermission as IdentityRelayPermission,\n IdentityMessage,\n IdentityGetPublicKeyMessage,\n IdentityGetRelaysMessage,\n IdentityGetProfileMessage,\n IdentityGetFollowsMessage,\n IdentityGetListMessage,\n IdentityGetZapsMessage,\n IdentityGetMutesMessage,\n IdentityGetBlockedMessage,\n IdentityGetBadgesMessage,\n IdentityGetPublicKeyResultMessage,\n IdentityGetRelaysResultMessage,\n IdentityGetProfileResultMessage,\n IdentityGetFollowsResultMessage,\n IdentityGetListResultMessage,\n IdentityGetZapsResultMessage,\n IdentityGetMutesResultMessage,\n IdentityGetBlockedResultMessage,\n IdentityGetBadgesResultMessage,\n IdentityChangedMessage,\n IdentityRequestMessage,\n IdentityResultMessage,\n IdentityNapMessage,\n} from '@napplet/nap/identity';\n\n// Storage NAP\nexport type {\n StorageMessage,\n StorageGetMessage,\n StorageSetMessage,\n StorageRemoveMessage,\n StorageKeysMessage,\n StorageGetResultMessage,\n StorageSetResultMessage,\n StorageRemoveResultMessage,\n StorageKeysResultMessage,\n StorageRequestMessage,\n StorageResultMessage,\n StorageNapMessage,\n} from '@napplet/nap/storage';\n\n// INC NAP\nexport type {\n IncMessage,\n IncEmitMessage,\n IncSubscribeMessage,\n IncSubscribeResultMessage,\n IncUnsubscribeMessage,\n IncEventMessage,\n IncChannelOpenMessage,\n IncChannelOpenResultMessage,\n IncChannelEmitMessage,\n IncChannelEventMessage,\n IncChannelBroadcastMessage,\n IncChannelListMessage,\n IncChannelListResultMessage,\n IncChannelCloseMessage,\n IncChannelClosedMessage,\n IncTopicMessage,\n IncChannelMessage,\n IncOutboundMessage,\n IncInboundMessage,\n IncNapMessage,\n} from '@napplet/nap/inc';\n\n// Deprecated IFC compatibility aliases\nexport type {\n IfcMessage,\n IfcEmitMessage,\n IfcSubscribeMessage,\n IfcSubscribeResultMessage,\n IfcUnsubscribeMessage,\n IfcEventMessage,\n IfcChannelOpenMessage,\n IfcChannelOpenResultMessage,\n IfcChannelEmitMessage,\n IfcChannelEventMessage,\n IfcChannelBroadcastMessage,\n IfcChannelListMessage,\n IfcChannelListResultMessage,\n IfcChannelCloseMessage,\n IfcChannelClosedMessage,\n IfcTopicMessage,\n IfcChannelMessage,\n IfcOutboundMessage,\n IfcInboundMessage,\n IfcNapMessage,\n} from '@napplet/nap/ifc';\n\n// Theme NAP\nexport type {\n ThemeColors,\n ThemeFont,\n ThemeBackground,\n Theme,\n ThemeMessage,\n ThemeGetMessage,\n ThemeGetResultMessage,\n ThemeChangedMessage,\n ThemeRequestMessage,\n ThemeResultMessage,\n ThemeNapMessage,\n} from '@napplet/nap/theme';\n\n// Keys NAP\nexport type {\n Action,\n RegisterResult,\n KeyBinding,\n KeysMessage,\n KeysForwardMessage,\n KeysRegisterActionMessage,\n KeysRegisterActionResultMessage,\n KeysUnregisterActionMessage,\n KeysBindingsMessage,\n KeysActionMessage,\n KeysRequestMessage,\n KeysResultMessage,\n KeysNapMessage,\n} from '@napplet/nap/keys';\n\n// Media NAP\nexport type {\n MediaMetadata,\n MediaArtwork,\n MediaPlaybackOwner,\n MediaSourceRef,\n MediaSessionCreate,\n MediaSessionResult,\n MediaState,\n MediaAction,\n MediaMessage,\n MediaSessionCreateMessage,\n MediaSessionCreateResultMessage,\n MediaSessionUpdateMessage,\n MediaSessionDestroyMessage,\n MediaStateMessage,\n MediaCapabilitiesMessage,\n MediaCommandMessage,\n MediaControlsMessage,\n MediaRequestMessage,\n MediaResultMessage,\n MediaNapMessage,\n} from '@napplet/nap/media';\n\n// Notify NAP\nexport type {\n NotificationPriority,\n NotificationAction,\n NotificationChannel,\n NotifyControl,\n NotifyMessage,\n NotifySendMessage,\n NotifySendResultMessage,\n NotifyDismissMessage,\n NotifyBadgeMessage,\n NotifyChannelRegisterMessage,\n NotifyPermissionRequestMessage,\n NotifyPermissionResultMessage,\n NotifyActionMessage,\n NotifyClickedMessage,\n NotifyDismissedMessage,\n NotifyControlsMessage,\n NotifyRequestMessage,\n NotifyResultMessage,\n NotifyNapMessage,\n} from '@napplet/nap/notify';\n\n// Config NAP\nexport type {\n NappletConfigSchema,\n ConfigSchema,\n ConfigValues,\n ConfigSchemaErrorCode,\n NappletConfigSchemaExtensions,\n ConfigMessage,\n ConfigRegisterSchemaMessage,\n ConfigGetMessage,\n ConfigSubscribeMessage,\n ConfigUnsubscribeMessage,\n ConfigOpenSettingsMessage,\n ConfigRegisterSchemaResultMessage,\n ConfigValuesMessage,\n ConfigSchemaErrorMessage,\n ConfigRequestMessage,\n ConfigResultMessage,\n ConfigNapMessage,\n} from '@napplet/nap/config';\n\n// Resource NAP\nexport type {\n ResourceErrorCode,\n ResourceScheme,\n ResourceMessage,\n ResourceBytesMessage,\n ResourceCancelMessage,\n ResourceBytesResultMessage,\n ResourceBytesErrorMessage,\n ResourceSidecarEntry,\n ResourceRequestMessage,\n ResourceResultMessage,\n ResourceNapMessage,\n} from '@napplet/nap/resource';\n\n// Connect NAP\nexport type {\n NappletConnect,\n} from '@napplet/nap/connect';\n\n// Class NAP\nexport type {\n ClassMessage,\n ClassAssignedMessage,\n NappletClass,\n ClassNapMessage,\n} from '@napplet/nap/class';\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nap/relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nap/identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nap/storage';\nexport { DOMAIN as INC_DOMAIN } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link INC_DOMAIN}. This compatibility export resolves to\n * the canonical `inc` domain string.\n */\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nap/ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nap/theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nap/keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nap/media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nap/notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nap/config';\nexport { DOMAIN as RESOURCE_DOMAIN } from '@napplet/nap/resource';\nexport { DOMAIN as CONNECT_DOMAIN } from '@napplet/nap/connect';\nexport { DOMAIN as CLASS_DOMAIN } from '@napplet/nap/class';\n\nexport { installRelayShim } from '@napplet/nap/relay';\nexport { installIdentityShim } from '@napplet/nap/identity';\nexport { installStorageShim } from '@napplet/nap/storage';\nexport { installIncShim } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link installIncShim}.\n */\nexport { installIfcShim } from '@napplet/nap/ifc';\nexport { installKeysShim } from '@napplet/nap/keys';\nexport { installMediaShim } from '@napplet/nap/media';\nexport { installNotifyShim } from '@napplet/nap/notify';\nexport { installConfigShim } from '@napplet/nap/config';\nexport { installResourceShim } from '@napplet/nap/resource';\nexport { installConnectShim } from '@napplet/nap/connect';\nexport { installClassShim } from '@napplet/nap/class';\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nap/relay';\nexport {\n identityGetPublicKey,\n identityOnChanged,\n identityGetRelays,\n identityGetProfile,\n identityGetFollows,\n identityGetList,\n identityGetZaps,\n identityGetMutes,\n identityGetBlocked,\n identityGetBadges,\n} from '@napplet/nap/identity';\nexport { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from '@napplet/nap/storage';\nexport { incEmit, incOn } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link incEmit} and {@link incOn}.\n */\nexport { ifcEmit, ifcOn } from '@napplet/nap/ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nap/keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from '@napplet/nap/media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nap/notify';\nexport { resourceBytes, resourceBytesAsObjectURL } from '@napplet/nap/resource';\nexport { connectGranted, connectOrigins, normalizeConnectOrigin } from '@napplet/nap/connect';\nexport { getClass } from '@napplet/nap/class';\n"],"mappings":";AA8xBA,SAAS,mBAAmB;AAoP5B,SAAmB,cAAoB;AACvC,SAAmB,UAAVA,eAAiC;AAC1C,SAAmB,UAAVA,eAAgC;AACzC,SAAmB,UAAVA,eAA4B;AAKrC,SAAmB,UAAVA,eAA4B;AACrC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA6B;AACtC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA+B;AACxC,SAAmB,UAAVA,gBAA+B;AACxC,SAAmB,UAAVA,gBAAiC;AAC1C,SAAmB,UAAVA,gBAAgC;AACzC,SAAmB,UAAVA,gBAA8B;AAEvC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAI/B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,S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AO,IAAI;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,UACE,UACc;AACd,WAAO,eAAe,EAAE,OAAO,UAAU,QAAQ;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,SAAsC;AACjD,mBAAe,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eACE,QACA,SACe;AACf,WAAO,eAAe,EAAE,OAAO,eAAe,QAAQ,OAAO;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cACE,UACY;AACZ,WAAO,eAAe,EAAE,OAAO,cAAc,QAAQ;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,SAAyC;AAC3C,WAAO,eAAe,EAAE,OAAO;AAAA,EACjC;AACF;AAiBO,IAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,MAAM,KAA4B;AAChC,WAAO,eAAe,EAAE,SAAS,MAAM,GAAG;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,KAAkD;AACjE,WAAO,eAAe,EAAE,SAAS,iBAAiB,GAAG;AAAA,EACvD;AACF;","names":["DOMAIN"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napplet/sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Typed named exports wrapping window.napplet for bundler-consuming napplet developers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,8 +20,8 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@napplet/core": "0.6.0",
24
- "@napplet/nap": "0.6.0"
23
+ "@napplet/core": "0.7.0",
24
+ "@napplet/nap": "0.7.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsup": "^8.5.0",