@gemigo/extension-sdk 0.1.2 → 0.2.1

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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Network API types
3
+ */
4
+ /** HTTP request method */
5
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
6
+ /** Response type */
7
+ export type ResponseType = 'json' | 'text' | 'arraybuffer';
8
+ /** Request options */
9
+ export interface RequestOptions {
10
+ /** HTTP method */
11
+ method?: HttpMethod;
12
+ /** Request headers */
13
+ headers?: Record<string, string>;
14
+ /** Request body */
15
+ body?: string | object;
16
+ /** Response type */
17
+ responseType?: ResponseType;
18
+ }
19
+ /** Request response */
20
+ export interface RequestResponse<T = unknown> {
21
+ /** HTTP status code */
22
+ status: number;
23
+ /** Response data */
24
+ data: T;
25
+ /** Response headers */
26
+ headers: Record<string, string>;
27
+ }
28
+ /** Network API for cross-origin HTTP requests */
29
+ export interface NetworkAPI {
30
+ /**
31
+ * Make an HTTP request (bypasses CORS restrictions)
32
+ * @param url - Request URL
33
+ * @param options - Request options
34
+ * @returns Response with status, data, and headers
35
+ */
36
+ request<T = unknown>(url: string, options?: RequestOptions): Promise<RequestResponse<T>>;
37
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Notify API types
3
+ */
4
+ /** Notification action button */
5
+ export interface NotifyAction {
6
+ id: string;
7
+ label: string;
8
+ }
9
+ /** Notification options */
10
+ export interface NotifyOptions {
11
+ /** Notification title (required) */
12
+ title: string;
13
+ /** Notification body text */
14
+ body?: string;
15
+ /** Icon URL */
16
+ icon?: string;
17
+ /** Action buttons (desktop only) */
18
+ actions?: NotifyAction[];
19
+ }
20
+ /** Notification result */
21
+ export interface NotifyResult {
22
+ success: boolean;
23
+ reason?: string;
24
+ }
25
+ /** Notify API */
26
+ export interface NotifyAPI {
27
+ /**
28
+ * Send a system notification
29
+ * @param options - Notification options
30
+ * @returns Result indicating success or failure
31
+ */
32
+ (options: NotifyOptions): Promise<NotifyResult>;
33
+ }
34
+ /** Notification action handler */
35
+ export type NotificationActionHandler = (actionId: string, callback: () => void) => () => void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Storage API types
3
+ */
4
+ /** Storage API for persistent key-value storage */
5
+ export interface StorageAPI {
6
+ /**
7
+ * Get a stored value
8
+ * @param key - Storage key
9
+ * @returns The stored value or null if not found
10
+ */
11
+ get<T = unknown>(key: string): Promise<T | null>;
12
+ /**
13
+ * Store a value
14
+ * @param key - Storage key
15
+ * @param value - Value to store (will be JSON serialized)
16
+ */
17
+ set(key: string, value: unknown): Promise<void>;
18
+ /**
19
+ * Delete a stored value
20
+ * @param key - Storage key
21
+ */
22
+ delete(key: string): Promise<void>;
23
+ /**
24
+ * Clear all data for the current app
25
+ */
26
+ clear(): Promise<void>;
27
+ }
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@gemigo/extension-sdk",
3
- "version": "0.1.2",
3
+ "private": false,
4
+ "version": "0.2.1",
5
+ "type": "module",
4
6
  "description": "GemiGo Extension SDK for browser extension apps",
5
7
  "main": "dist/gemigo-extension-sdk.umd.js",
6
8
  "module": "dist/gemigo-extension-sdk.es.js",