@orsetra/shared-types 1.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/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # @orsetra/shared-types
2
+
3
+ Shared TypeScript type definitions for Orsetra platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @orsetra/shared-types
9
+ # or
10
+ pnpm add @orsetra/shared-types
11
+ # or
12
+ yarn add @orsetra/shared-types
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import type { User, ApiResponse, PaginatedData } from '@orsetra/shared-types'
19
+
20
+ // Use the types in your code
21
+ const user: User = {
22
+ id: '123',
23
+ email: 'user@example.com',
24
+ name: 'John Doe',
25
+ }
26
+
27
+ const response: ApiResponse<User> = {
28
+ success: true,
29
+ data: user,
30
+ }
31
+ ```
32
+
33
+ ## Available Types
34
+
35
+ ### Common Types
36
+
37
+ - **User** - User entity type
38
+ - **ApiResponse<T>** - Generic API response wrapper
39
+ - **PaginatedData<T>** - Paginated data structure
40
+ - **ErrorResponse** - Error response structure
41
+
42
+ ### Import Specific Types
43
+
44
+ ```typescript
45
+ import type { User } from '@orsetra/shared-types/types/common'
46
+ ```
47
+
48
+ ## Type Safety
49
+
50
+ All types are strictly typed and provide full IntelliSense support in modern IDEs.
51
+
52
+ ```typescript
53
+ import type { ApiResponse } from '@orsetra/shared-types'
54
+
55
+ function handleResponse(response: ApiResponse<User>) {
56
+ if (response.success) {
57
+ // TypeScript knows response.data is User
58
+ console.log(response.data.email)
59
+ } else {
60
+ // TypeScript knows response.error exists
61
+ console.error(response.error)
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Extending Types
67
+
68
+ You can extend the shared types in your own projects:
69
+
70
+ ```typescript
71
+ import type { User } from '@orsetra/shared-types'
72
+
73
+ interface ExtendedUser extends User {
74
+ customField: string
75
+ }
76
+ ```
77
+
78
+ ## License
79
+
80
+ MIT
81
+
82
+ ## Repository
83
+
84
+ [GitHub](https://github.com/orsetra/console-ui/tree/main/packages/shared-types)
package/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Shared types across all micro-frontends
2
+ export * from './types/common'
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@orsetra/shared-types",
3
+ "version": "1.0.0",
4
+ "description": "Shared TypeScript types for Orsetra platform",
5
+ "main": "./index.ts",
6
+ "types": "./index.ts",
7
+ "exports": {
8
+ ".": "./index.ts",
9
+ "./types/*": "./types/*.ts"
10
+ },
11
+ "files": [
12
+ "index.ts",
13
+ "types",
14
+ "README.md"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/orsetra/console-ui.git",
22
+ "directory": "packages/shared-types"
23
+ },
24
+ "keywords": [
25
+ "typescript",
26
+ "types",
27
+ "orsetra"
28
+ ],
29
+ "devDependencies": {
30
+ "typescript": "^5"
31
+ }
32
+ }
@@ -0,0 +1,12 @@
1
+ // Common types
2
+ export interface User {
3
+ id: string
4
+ email: string
5
+ name: string
6
+ }
7
+
8
+ export interface ApiResponse<T> {
9
+ data: T
10
+ error?: string
11
+ status: number
12
+ }