@nubitio/hydra 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Johan Guerreros
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @nubitio/hydra
2
+
3
+ Hydra / OpenAPI adapter for [`@nubitio/crud`](https://www.npmjs.com/package/@nubitio/crud): automatic schema discovery and remote data sources from API Platform docs.
4
+
5
+ Point it at an API Platform backend and it derives CRUD field definitions, filters, and pagination from the published Hydra/OpenAPI documentation — no hand-written schemas.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @nubitio/hydra @nubitio/crud @nubitio/core
11
+ ```
12
+
13
+ ## Peer dependencies
14
+
15
+ ```json
16
+ "@nubitio/core": "^0.1.0",
17
+ "@nubitio/crud": "^0.1.0",
18
+ "@tanstack/react-query": "^5",
19
+ "i18next": "^23",
20
+ "react": "^19",
21
+ "react-dom": "^19",
22
+ "react-i18next": "^14"
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ Requires `CoreConfigProvider` from `@nubitio/core` in the provider tree so data loading uses the right base URL, locale, and timezone.
28
+
29
+ ```tsx
30
+ import { CoreConfigProvider } from '@nubitio/core';
31
+ import { SchemaProvider, useResourceSchema, HydraRemoteDataSource } from '@nubitio/hydra';
32
+
33
+ export function App() {
34
+ return (
35
+ <CoreConfigProvider apiBaseUrl="https://api.example.com" locale="es" timezone="America/Lima">
36
+ <SchemaProvider>
37
+ {/* CRUD pages that call useResourceSchema('products') */}
38
+ </SchemaProvider>
39
+ </CoreConfigProvider>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ## Exports
45
+
46
+ - `SchemaProvider` / `useSchemaContext` / `useResourceSchema` — schema discovery from API docs
47
+ - `HydraRemoteDataSource` / `createHydraResourceStore` — paginated, filterable data sources
48
+ - `useHydraMetadata` — raw access to the parsed API doc
49
+ - `parseHydraDoc` / `parseOpenApiDoc` / `mapHydraSchemaToFields` — low-level parsing utilities
50
+
51
+ ## License
52
+
53
+ MIT