@aippy/runtime 0.1.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 ADDED
@@ -0,0 +1,117 @@
1
+ # @aippy/runtime
2
+
3
+ Runtime SDK for Aippy projects providing device functionality, platform detection, and utility functions.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @aippy/runtime
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Core
14
+
15
+ ```typescript
16
+ import { AippyConfig, mergeConfig } from '@aippy/runtime/core';
17
+
18
+ const config = mergeConfig({
19
+ debug: true,
20
+ apiBaseUrl: 'https://api.example.com'
21
+ });
22
+ ```
23
+
24
+ ### Device APIs
25
+
26
+ ```typescript
27
+ import { camera, geolocation, sensors, fileSystem } from '@aippy/runtime/device';
28
+
29
+ // Camera
30
+ const stream = await camera.getStream();
31
+ const photo = await camera.capturePhoto({ quality: 'high' });
32
+
33
+ // Geolocation
34
+ const position = await geolocation.getCurrentPosition();
35
+ const watchId = geolocation.watchPosition((pos) => {
36
+ console.log('Position:', pos);
37
+ });
38
+
39
+ // Sensors
40
+ const orientation = await sensors.getOrientation();
41
+ const cleanup = sensors.watchOrientation((data) => {
42
+ console.log('Orientation:', data);
43
+ });
44
+
45
+ // File System
46
+ const files = await fileSystem.openFile({ multiple: true });
47
+ await fileSystem.saveFile(blob, 'filename.txt');
48
+ ```
49
+
50
+ ### Utils
51
+
52
+ ```typescript
53
+ import { platform, performanceMonitor, pwa } from '@aippy/runtime/utils';
54
+
55
+ // Platform detection
56
+ const info = platform.getPlatformInfo();
57
+ const capabilities = platform.getCapabilities();
58
+
59
+ // Performance monitoring
60
+ const metrics = await performanceMonitor.getCoreWebVitals();
61
+ const timing = performanceMonitor.getNavigationTiming();
62
+
63
+ // PWA utilities
64
+ const pwaInfo = pwa.getPWAInfo();
65
+ await pwa.registerServiceWorker('/sw.js');
66
+ await pwa.sendNotification('Hello!');
67
+ ```
68
+
69
+ ## Packages
70
+
71
+ - `@aippy/runtime/core` - Core types and configuration
72
+ - `@aippy/runtime/device` - Device APIs (camera, geolocation, sensors, file system)
73
+ - `@aippy/runtime/utils` - Platform detection, performance monitoring, PWA utilities
74
+
75
+ ## Publishing
76
+
77
+ This package is published to the npm public registry. The build process ensures that only compiled JavaScript files and TypeScript declarations are included in the published package - no source code is exposed.
78
+
79
+ ### Build Process
80
+
81
+ - Compiles TypeScript to JavaScript
82
+ - Generates TypeScript declaration files
83
+ - Removes source maps to protect source code
84
+ - Only includes `dist/` directory and `README.md` in the published package
85
+
86
+ ## Development
87
+
88
+ ```bash
89
+ # Install dependencies
90
+ pnpm install
91
+
92
+ # Build
93
+ pnpm run build
94
+
95
+ # Type check
96
+ pnpm run type-check
97
+
98
+ # Lint
99
+ pnpm run lint
100
+
101
+ # Format
102
+ pnpm run format
103
+
104
+ # Publish (for maintainers)
105
+ pnpm run publish:patch # 0.0.0 -> 0.0.1
106
+ pnpm run publish:minor # 0.0.0 -> 0.1.0
107
+ pnpm run publish:major # 0.0.0 -> 1.0.0
108
+ ```
109
+
110
+ ## Support
111
+
112
+ - **Homepage**: [https://aippy.ai](https://aippy.ai)
113
+ - **Support**: [Discord Community](https://discord.com/invite/G94ZAx6gVq)
114
+
115
+ ## License
116
+
117
+ UNLICENSED - This is a proprietary SDK. All rights reserved.
@@ -0,0 +1,13 @@
1
+ import { AippyConfig } from './types';
2
+ /**
3
+ * Default configuration
4
+ */
5
+ export declare const DEFAULT_CONFIG: AippyConfig;
6
+ /**
7
+ * Get configuration from environment variables
8
+ */
9
+ export declare function getConfigFromEnv(): Partial<AippyConfig>;
10
+ /**
11
+ * Merge configuration with defaults
12
+ */
13
+ export declare function mergeConfig(userConfig?: Partial<AippyConfig>): AippyConfig;
@@ -0,0 +1,23 @@
1
+ import { AippyError } from './types';
2
+ /**
3
+ * Custom error class
4
+ */
5
+ export declare class AippyRuntimeError extends Error implements AippyError {
6
+ readonly code: string;
7
+ readonly context?: Record<string, unknown>;
8
+ constructor(message: string, code?: string, context?: Record<string, unknown>);
9
+ }
10
+ /**
11
+ * Common error codes
12
+ */
13
+ export declare const ERROR_CODES: {
14
+ readonly NOT_SUPPORTED: "NOT_SUPPORTED";
15
+ readonly PERMISSION_DENIED: "PERMISSION_DENIED";
16
+ readonly INVALID_CONFIG: "INVALID_CONFIG";
17
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
18
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
19
+ };
20
+ /**
21
+ * Create a standardized error
22
+ */
23
+ export declare function createError(message: string, code?: keyof typeof ERROR_CODES, context?: Record<string, unknown>): AippyRuntimeError;
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './config';
3
+ export * from './errors';
4
+ export * from './version';
@@ -0,0 +1,59 @@
1
+ import { A, E, c } from "../errors-DAz5_jDJ.js";
2
+ const DEFAULT_CONFIG = {
3
+ mode: "development",
4
+ debug: false,
5
+ apiBaseUrl: void 0,
6
+ headers: {}
7
+ };
8
+ function getConfigFromEnv() {
9
+ const config = {};
10
+ if (typeof process !== "undefined" && process.env) {
11
+ if (process.env.NODE_ENV) {
12
+ config.mode = process.env.NODE_ENV;
13
+ }
14
+ if (process.env.AIPPY_DEBUG) {
15
+ config.debug = process.env.AIPPY_DEBUG === "true";
16
+ }
17
+ if (process.env.AIPPY_API_BASE_URL) {
18
+ config.apiBaseUrl = process.env.AIPPY_API_BASE_URL;
19
+ }
20
+ }
21
+ return config;
22
+ }
23
+ function mergeConfig(userConfig) {
24
+ const envConfig = getConfigFromEnv();
25
+ return {
26
+ ...DEFAULT_CONFIG,
27
+ ...envConfig,
28
+ ...userConfig,
29
+ headers: {
30
+ ...DEFAULT_CONFIG.headers,
31
+ ...envConfig.headers,
32
+ ...userConfig?.headers
33
+ }
34
+ };
35
+ }
36
+ const version = "0.1.0";
37
+ const packageJson = {
38
+ version
39
+ };
40
+ const VERSION = packageJson.version;
41
+ const SDK_NAME = "@aippy/runtime";
42
+ function getVersionInfo() {
43
+ return {
44
+ name: SDK_NAME,
45
+ version: VERSION,
46
+ buildTime: (/* @__PURE__ */ new Date()).toISOString()
47
+ };
48
+ }
49
+ export {
50
+ A as AippyRuntimeError,
51
+ DEFAULT_CONFIG,
52
+ E as ERROR_CODES,
53
+ SDK_NAME,
54
+ VERSION,
55
+ c as createError,
56
+ getConfigFromEnv,
57
+ getVersionInfo,
58
+ mergeConfig
59
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Core types and interfaces
3
+ */
4
+ export interface AippyConfig {
5
+ /** Environment mode */
6
+ mode: 'development' | 'production' | 'test';
7
+ /** Debug mode */
8
+ debug: boolean;
9
+ /** API base URL */
10
+ apiBaseUrl?: string;
11
+ /** Custom headers */
12
+ headers?: Record<string, string>;
13
+ }
14
+ export interface AippyRuntimeOptions {
15
+ /** Configuration object */
16
+ config?: Partial<AippyConfig>;
17
+ /** Custom error handler */
18
+ onError?: (error: Error) => void;
19
+ }
20
+ export interface DeviceCapabilities {
21
+ /** Camera support */
22
+ camera: boolean;
23
+ /** Geolocation support */
24
+ geolocation: boolean;
25
+ /** File system access support */
26
+ fileSystem: boolean;
27
+ /** Device orientation support */
28
+ orientation: boolean;
29
+ /** Vibration support */
30
+ vibration: boolean;
31
+ }
32
+ export interface PlatformInfo {
33
+ /** Platform name */
34
+ name: 'ios' | 'android' | 'windows' | 'macos' | 'linux' | 'unknown';
35
+ /** Platform version */
36
+ version?: string;
37
+ /** Browser name */
38
+ browser: 'chrome' | 'firefox' | 'safari' | 'edge' | 'unknown';
39
+ /** Browser version */
40
+ browserVersion?: string;
41
+ /** Is mobile device */
42
+ isMobile: boolean;
43
+ /** Is desktop device */
44
+ isDesktop: boolean;
45
+ }
46
+ export interface AippyError extends Error {
47
+ /** Error code */
48
+ code: string;
49
+ /** Error context */
50
+ context?: Record<string, unknown>;
51
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Version information
3
+ */
4
+ export declare const VERSION: string;
5
+ export declare const SDK_NAME = "@aippy/runtime";
6
+ /**
7
+ * Get SDK version info
8
+ */
9
+ export declare function getVersionInfo(): {
10
+ name: string;
11
+ version: string;
12
+ buildTime: string;
13
+ };
package/dist/core.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './core/index'
2
+ export {}
@@ -0,0 +1,27 @@
1
+ import { CameraOptions, CameraResult } from './types';
2
+ /**
3
+ * Camera functionality wrapper
4
+ */
5
+ export declare class CameraAPI {
6
+ private stream;
7
+ /**
8
+ * Check if camera is supported
9
+ */
10
+ isSupported(): boolean;
11
+ /**
12
+ * Get camera stream
13
+ */
14
+ getStream(options?: CameraOptions): Promise<MediaStream>;
15
+ /**
16
+ * Capture photo from stream
17
+ */
18
+ capturePhoto(options?: CameraOptions): Promise<CameraResult>;
19
+ /**
20
+ * Stop camera stream
21
+ */
22
+ stopStream(): void;
23
+ }
24
+ /**
25
+ * Camera API instance
26
+ */
27
+ export declare const camera: CameraAPI;
@@ -0,0 +1,42 @@
1
+ import { FileSystemOptions, FileSystemResult } from './types';
2
+ /**
3
+ * File system functionality wrapper
4
+ */
5
+ export declare class FileSystemAPI {
6
+ /**
7
+ * Check if file system access is supported
8
+ */
9
+ isSupported(): boolean;
10
+ /**
11
+ * Check if legacy file input is supported
12
+ */
13
+ isLegacySupported(): boolean;
14
+ /**
15
+ * Open file picker (modern API)
16
+ */
17
+ openFilePicker(options?: FileSystemOptions): Promise<FileSystemResult>;
18
+ /**
19
+ * Open file picker (legacy fallback)
20
+ */
21
+ openFilePickerLegacy(options?: FileSystemOptions): Promise<FileSystemResult>;
22
+ /**
23
+ * Open file picker with fallback
24
+ */
25
+ openFile(options?: FileSystemOptions): Promise<FileSystemResult>;
26
+ /**
27
+ * Save file
28
+ */
29
+ saveFile(blob: Blob, filename: string): Promise<void>;
30
+ /**
31
+ * Read file as text
32
+ */
33
+ readAsText(file: File): Promise<string>;
34
+ /**
35
+ * Read file as data URL
36
+ */
37
+ readAsDataURL(file: File): Promise<string>;
38
+ }
39
+ /**
40
+ * File system API instance
41
+ */
42
+ export declare const fileSystem: FileSystemAPI;
@@ -0,0 +1,26 @@
1
+ import { GeolocationOptions, GeolocationResult } from './types';
2
+ /**
3
+ * Geolocation functionality wrapper
4
+ */
5
+ export declare class GeolocationAPI {
6
+ /**
7
+ * Check if geolocation is supported
8
+ */
9
+ isSupported(): boolean;
10
+ /**
11
+ * Get current position
12
+ */
13
+ getCurrentPosition(options?: GeolocationOptions): Promise<GeolocationResult>;
14
+ /**
15
+ * Watch position changes
16
+ */
17
+ watchPosition(callback: (position: GeolocationResult) => void, options?: GeolocationOptions): number;
18
+ /**
19
+ * Clear position watch
20
+ */
21
+ clearWatch(watchId: number): void;
22
+ }
23
+ /**
24
+ * Geolocation API instance
25
+ */
26
+ export declare const geolocation: GeolocationAPI;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Haptic feedback functionality for device vibration
3
+ */
4
+ interface AippyMessage {
5
+ command: string;
6
+ parameters: number | number[];
7
+ }
8
+ interface WebKitMessageHandlers {
9
+ aippyListener: {
10
+ postMessage: (data: AippyMessage) => void;
11
+ };
12
+ }
13
+ interface WebKit {
14
+ messageHandlers: WebKitMessageHandlers;
15
+ }
16
+ declare global {
17
+ interface Window {
18
+ webkit?: WebKit;
19
+ }
20
+ }
21
+ /**
22
+ * Vibrate the device with the specified pattern
23
+ * @param pattern - Vibration pattern (number for duration, or array of numbers for pattern)
24
+ * @returns Promise that resolves when vibration is complete
25
+ */
26
+ export declare function vibrate(pattern: number | number[]): Promise<void>;
27
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './camera';
2
+ export * from './geolocation';
3
+ export * from './sensors';
4
+ export * from './file-system';
5
+ export * from './haptics';
6
+ export * from './types';