@intrig/react 1.0.2 → 1.0.7
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 +162 -17
- package/index.esm.js +1815 -627
- package/package.json +3 -3
- package/src/extra/index.d.ts +4 -0
- package/src/extra/useAsNetworkState.d.ts +13 -0
- package/src/extra/useAsPromise.d.ts +59 -0
- package/src/extra/useResolvedCachedValue.d.ts +54 -0
- package/src/extra/useResolvedValue.d.ts +50 -0
- package/src/index.d.ts +2 -0
- package/src/intrig-context.d.ts +1 -1
- package/src/intrig-provider.d.ts +4 -4
- package/src/logger.d.ts +7 -0
- package/src/media-type-utils.d.ts +4 -0
- package/src/network-state.d.ts +39 -9
package/README.md
CHANGED
|
@@ -1,33 +1,178 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./docs/intrig-logo.svg" alt="Intrig Logo" width="200">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
Intrig
|
|
5
|
+
# Intrig
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
Intrig is a powerful API integration and documentation tool designed for frontend developers working with OpenAPI 3. It streamlines API consumption by generating boilerplate code, offering a rich documentation interface, and providing an intuitive way to explore and interact with API endpoints.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
### 🔹 API Documentation & Exploration
|
|
17
|
+
|
|
18
|
+
- Generates structured documentation from OpenAPI 3 specifications.
|
|
19
|
+
- Provides an interactive UI to explore API endpoints, including request and response types.
|
|
20
|
+
- Enables developers to view version history of API definitions.
|
|
21
|
+
|
|
22
|
+
### 🔹 Code Generation
|
|
23
|
+
|
|
24
|
+
- Generates strongly typed hooks for API calls, integrating seamlessly with React applications.
|
|
25
|
+
|
|
26
|
+
- Provides hooks that follow React’s standard state management conventions, resembling `useState` syntax for simplicity and performance.
|
|
27
|
+
|
|
28
|
+
### 🔹 CLI Tooling
|
|
29
|
+
|
|
30
|
+
- Allows automation of API integration workflows.
|
|
31
|
+
- Supports syncing remote OpenAPI specifications.
|
|
32
|
+
- Provides an easy way to manage API configurations.
|
|
6
33
|
|
|
7
|
-
Prerequisites
|
|
8
34
|
|
|
9
|
-
* Node.js v16+.
|
|
10
|
-
* Nx build tool.
|
|
11
35
|
|
|
12
36
|
## Installation
|
|
13
37
|
|
|
14
|
-
|
|
38
|
+
Intrig CLI is published to npx. When you run `npx intrig init`, it adds necessary dependencies to the project, such as `@intrig/next` for Next.js projects or `@intrig/react` for React projects. It also adds `intrig` as a dev dependency to the project.
|
|
15
39
|
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
40
|
+
```sh
|
|
41
|
+
npx intrig init
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### CLI Usage
|
|
47
|
+
|
|
48
|
+
Intrig provides a command-line interface for managing API integrations efficiently. Below are the available commands:
|
|
20
49
|
|
|
50
|
+
#### `init`
|
|
51
|
+
|
|
52
|
+
Initializes a new Intrig configuration and installs necessary dependencies.
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npx intrig init
|
|
21
56
|
```
|
|
22
57
|
|
|
23
|
-
|
|
58
|
+
#### `add`
|
|
59
|
+
|
|
60
|
+
Adds a new API source to the Intrig configuration.
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
intrig add [-s <value>] [-i <value>]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- `-i, --id=<value>`: Unique ID for the API.
|
|
67
|
+
- `-s, --source=<value>`: OpenAPI specification URL.
|
|
68
|
+
|
|
69
|
+
#### `ls`
|
|
70
|
+
|
|
71
|
+
Lists API sources from the Intrig configuration.
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
intrig ls [-d] [-f <value>]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `-d, --detailed`: Show detailed information.
|
|
78
|
+
- `-f, --filter=<value>`: Filter sources by name or ID.
|
|
79
|
+
|
|
80
|
+
#### `baseline`
|
|
81
|
+
|
|
82
|
+
Creates a baseline version for API specifications.
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
intrig baseline -i <value> -v <value> [-f]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- `-i, --id=<value>`: API ID to baseline.
|
|
89
|
+
- `-v, --version=<value>`: Version for the baseline.
|
|
90
|
+
- `-f, --force`: Force baseline if version exists.
|
|
24
91
|
|
|
25
|
-
|
|
92
|
+
#### `sync`
|
|
26
93
|
|
|
27
|
-
|
|
94
|
+
Synchronizes API specifications.
|
|
28
95
|
|
|
29
|
-
|
|
96
|
+
```sh
|
|
97
|
+
intrig sync [-a | -i <value>...]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- `-a, --all`: Sync all APIs.
|
|
101
|
+
- `-i, --ids=<value>...`: Comma-separated list of API IDs to sync.
|
|
102
|
+
|
|
103
|
+
#### `generate`
|
|
104
|
+
|
|
105
|
+
Regenerates code for API integration.
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
intrig generate [-a | -i <value>...]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- `-a, --all`: Sync all APIs.
|
|
112
|
+
- `-i, --ids=<value>...`: Comma-separated list of API IDs to sync.
|
|
113
|
+
|
|
114
|
+
#### `rm`
|
|
115
|
+
|
|
116
|
+
Removes an API source from the Intrig configuration.
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
intrig rm [SOURCE]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- `SOURCE`: ID of the source to remove.
|
|
123
|
+
|
|
124
|
+
#### `insight`
|
|
125
|
+
|
|
126
|
+
Starts the web view for Intrig insight.
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
intrig insight [-p <value>] [-d]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- `-p, --port=<value>`: Port for Next.js server (default: 7007).
|
|
133
|
+
- `-d, --debug`: Enable debug mode for server-side logs.
|
|
134
|
+
|
|
135
|
+
## Configuration
|
|
136
|
+
|
|
137
|
+
Intrig supports project-level configurations via `intrig.config.json`:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"sources": [
|
|
142
|
+
{
|
|
143
|
+
"id": "example-api",
|
|
144
|
+
"name": "Example API Definition",
|
|
145
|
+
"specUrl": "https://example.com/api/openapi.json"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"id": "analytics",
|
|
149
|
+
"name": "Analytics API",
|
|
150
|
+
"specUrl": "https://api.analytics.com/v3/openapi.json"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"generator": "next"
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- **`sources`**: Defines the API sources available for integration.
|
|
158
|
+
- `id`: A unique identifier for the API.
|
|
159
|
+
- `name`: A human-readable name for the API.
|
|
160
|
+
- `specUrl`: The URL of the OpenAPI 3 specification.
|
|
161
|
+
- **`generator`**: Specifies the type of code generation, such as `next` for Next.js projects.
|
|
162
|
+
|
|
163
|
+
## Roadmap
|
|
164
|
+
|
|
165
|
+
- ✅ OpenAPI-based documentation and code generation
|
|
166
|
+
- ✅ CLI tool for API exploration and integration
|
|
167
|
+
- ⏳ Streamline file download feature
|
|
168
|
+
- ⏳ Remix integration
|
|
169
|
+
- ⏳ Vue.js integration
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
We welcome contributions! Please check our issues board and submit pull requests.
|
|
174
|
+
|
|
175
|
+
## License
|
|
30
176
|
|
|
31
|
-
|
|
177
|
+
Apache License 2.0. See `LICENSE` file for details.
|
|
32
178
|
|
|
33
|
-
For questions or feedback, feel free to reach out at [support@intrigsoft.com](mailto\:support@intrigsoft.com).
|