@aifabrix/miso-client 2.1.0 → 2.1.2

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,58 @@
1
+ /**
2
+ * Express Response Type Extensions
3
+ * Extends Express Response with standardized response helper methods
4
+ *
5
+ * Note: PaginationMeta is inlined to avoid `import type` syntax which
6
+ * causes Jest parsing issues in consuming projects (Jest tries to parse
7
+ * .d.ts files as JavaScript in CommonJS mode).
8
+ */
9
+
10
+ declare global {
11
+ namespace Express {
12
+ interface Response {
13
+ /**
14
+ * Success response with data (200)
15
+ * @param data - Response data
16
+ * @param message - Optional success message
17
+ */
18
+ success: <T>(data: T, message?: string) => Response;
19
+
20
+ /**
21
+ * Created response (201)
22
+ * @param data - Created resource data
23
+ * @param message - Optional success message
24
+ */
25
+ created: <T>(data: T, message?: string) => Response;
26
+
27
+ /**
28
+ * Paginated list response (200)
29
+ * @param items - Array of items
30
+ * @param meta - Pagination metadata (currentPage, pageSize, totalItems, totalPages?, type)
31
+ */
32
+ paginated: <T>(
33
+ items: T[],
34
+ meta: {
35
+ currentPage: number;
36
+ pageSize: number;
37
+ totalItems: number;
38
+ totalPages?: number;
39
+ type: string;
40
+ },
41
+ ) => Response;
42
+
43
+ /**
44
+ * No content response (204)
45
+ */
46
+ noContent: () => Response;
47
+
48
+ /**
49
+ * Accepted response (202)
50
+ * @param data - Optional data about the accepted request
51
+ * @param message - Optional message
52
+ */
53
+ accepted: <T>(data?: T, message?: string) => Response;
54
+ }
55
+ }
56
+ }
57
+
58
+ export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@aifabrix/miso-client",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "AI Fabrix Client SDK - Authentication, authorization, logging, and Express.js utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "build": "tsc",
8
+ "build": "tsc && node -e \"require('fs').copyFileSync('src/express/express.d.ts', 'dist/express/express.d.ts')\"",
9
9
  "test": "node --unhandled-rejections=warn -r ./tests/setup-rejection-handler.js node_modules/jest/bin/jest.js",
10
10
  "test:watch": "node --unhandled-rejections=warn -r ./tests/setup-rejection-handler.js node_modules/jest/bin/jest.js --watch",
11
11
  "test:coverage": "node --unhandled-rejections=warn -r ./tests/setup-rejection-handler.js node_modules/jest/bin/jest.js --coverage",