@aiqa/sdk 0.0.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/build/sdk.js ADDED
@@ -0,0 +1,37 @@
1
+ // Build script for AiQA SDK
2
+ // Run with: node build-sdk.js
3
+ // Uses global 'io' from socket.io-client CDN loaded in index.html
4
+
5
+ const { execSync } = require('child_process');
6
+ const path = require('path');
7
+ const fs = require('fs');
8
+
9
+ try {
10
+ console.log('Building SDK...');
11
+ // Bundle SDK, marking socket.io-client as external since we use window.io from CDN
12
+ execSync(`npx esbuild sdk-src/index.ts --bundle --format=iife --global-name=AiQaSdk --platform=browser --target=es2020 --external:socket.io-client --outfile=sdk.js`, {
13
+ cwd: __dirname,
14
+ stdio: 'inherit'
15
+ });
16
+
17
+ // Fix the export - replace the module wrapper with direct class export
18
+ const sdkPath = path.join(__dirname, 'sdk.js');
19
+ let sdkContent = fs.readFileSync(sdkPath, 'utf8');
20
+
21
+ // Replace the IIFE that returns a module with one that returns the class directly
22
+ // Find the pattern: var AiQaSdk = (() => { ... return __toCommonJS(index_exports); })();
23
+ // And replace with: var AiQaSdk = (() => { ... return index_default; })();
24
+ sdkContent = sdkContent.replace(
25
+ /return __toCommonJS\(index_exports\);\s*\}\)\(\);/,
26
+ 'return index_default;\n})();'
27
+ );
28
+
29
+ fs.writeFileSync(sdkPath, sdkContent);
30
+
31
+ console.log('SDK built successfully!');
32
+ console.log('Note: socket.io-client must be loaded via CDN before sdk.js (already done in index.html)');
33
+ } catch (error) {
34
+ console.error('Build failed:', error.message);
35
+ process.exit(1);
36
+ }
37
+
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ var aaa = require('./build/index')
2
+
3
+ module.exports = aaa
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} **/
2
+ module.exports = {
3
+ testEnvironment: "node",
4
+ transform: {
5
+ "^.+.tsx?$": ["ts-jest",{}],
6
+ },
7
+ };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@aiqa/sdk",
3
+ "version": "0.0.0",
4
+ "main": "build/index.js",
5
+ "private": false,
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "build": "node build-sdk.js"
9
+ },
10
+ "author": "",
11
+ "description": "",
12
+ "devDependencies": {
13
+ "@jest/globals": "^29.7.0",
14
+ "@types/node": "^22.0.0",
15
+ "jest": "^29.7.0",
16
+ "socket.io": "^4.7.5",
17
+ "ts-jest": "^29.2.3",
18
+ "ts-node": "^10.9.2",
19
+ "typescript": "^5.5.4"
20
+ },
21
+ "dependencies": {
22
+ "socket.io-client": "^4.7.5"
23
+ }
24
+ }