@nubitio/hydra 0.4.0 → 0.5.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/dist/index.cjs +3 -1
- package/dist/index.d.cts +9 -6
- package/dist/index.d.mts +9 -6
- package/dist/index.mjs +3 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -408,6 +408,7 @@ function parseHydraDoc(doc, entrypointHrefs) {
|
|
|
408
408
|
className,
|
|
409
409
|
apiUrl: urlMap[className] ?? `/api/${pluralize(toDashCase(className))}`,
|
|
410
410
|
fields,
|
|
411
|
+
formLayout: cls["x-crud-layout"],
|
|
411
412
|
searchMappings: extractSearchMappings(cls),
|
|
412
413
|
supportedOperations: Array.from(new Set([...collectionOperationsMap[className] ?? [], ...extractSupportedOperations(cls)]))
|
|
413
414
|
};
|
|
@@ -904,7 +905,8 @@ function useResourceSchema(apiUrl) {
|
|
|
904
905
|
fields: mapHydraSchemaToFields(resourceSchema, (className) => resourceMap[className]?.apiUrl, (className) => resourceMap[className]),
|
|
905
906
|
isLoading: false,
|
|
906
907
|
error: void 0,
|
|
907
|
-
supportedOperations: resourceSchema.supportedOperations ?? []
|
|
908
|
+
supportedOperations: resourceSchema.supportedOperations ?? [],
|
|
909
|
+
formLayout: resourceSchema.formLayout
|
|
908
910
|
};
|
|
909
911
|
}, [
|
|
910
912
|
data,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataRecord, GridData } from "@nubitio/core";
|
|
2
|
-
import { DataRecord as DataRecord$1, Field, ResourceFilterDescriptor, ResourceFilterRule, ResourceLoadOptions, ResourceSchemaResolution, ResourceSortDescriptor, ResourceStore, ResourceStoreFactory, ResourceStoreOptions } from "@nubitio/crud";
|
|
2
|
+
import { DataRecord as DataRecord$1, Field, FormLayout, ResourceFilterDescriptor, ResourceFilterRule, ResourceLoadOptions, ResourceSchemaResolution, ResourceSortDescriptor, ResourceStore, ResourceStoreFactory, ResourceStoreOptions } from "@nubitio/crud";
|
|
3
3
|
import React, { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region packages/hydra/HydraRemoteDataSource.d.ts
|
|
@@ -37,11 +37,6 @@ declare function HydraResourceSchemaProvider({
|
|
|
37
37
|
}: HydraResourceSchemaProviderProps): React.JSX.Element;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region packages/hydra/types.d.ts
|
|
40
|
-
/**
|
|
41
|
-
* TypeScript types that model a Hydra JSON-LD API documentation response.
|
|
42
|
-
*
|
|
43
|
-
* These are pure data types — no React, no hooks, no side effects.
|
|
44
|
-
*/
|
|
45
40
|
interface HydraProperty {
|
|
46
41
|
'@id': string;
|
|
47
42
|
'@type': string;
|
|
@@ -132,6 +127,12 @@ interface HydraClass {
|
|
|
132
127
|
'@type': string;
|
|
133
128
|
title: string;
|
|
134
129
|
supportedProperty: HydraSupportedProperty[];
|
|
130
|
+
/**
|
|
131
|
+
* Class-level UI hints injected by TranslatedDocumentationNormalizer from
|
|
132
|
+
* the ApiResource's extraProperties['x-crud']['formLayout']. Mirrors
|
|
133
|
+
* @nubitio/crud's FormLayout shape.
|
|
134
|
+
*/
|
|
135
|
+
'x-crud-layout'?: FormLayout;
|
|
135
136
|
/**
|
|
136
137
|
* Hydra search template describing server-side filterable query params.
|
|
137
138
|
* Present on collection operations in API Platform JSON-LD responses.
|
|
@@ -204,6 +205,8 @@ interface HydraResourceSchema {
|
|
|
204
205
|
className: string;
|
|
205
206
|
apiUrl: string;
|
|
206
207
|
fields: HydraFieldSchema[];
|
|
208
|
+
/** Backend-declared form layout (sections/tabs), when published. */
|
|
209
|
+
formLayout?: FormLayout;
|
|
207
210
|
/**
|
|
208
211
|
* Filters discoverable from `hydra:search.hydra:mapping` on the collection
|
|
209
212
|
* operation. Absent/empty means no server-side filter info was found.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataRecord, GridData } from "@nubitio/core";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
|
-
import { DataRecord as DataRecord$1, Field, ResourceFilterDescriptor, ResourceFilterRule, ResourceLoadOptions, ResourceSchemaResolution, ResourceSortDescriptor, ResourceStore, ResourceStoreFactory, ResourceStoreOptions } from "@nubitio/crud";
|
|
3
|
+
import { DataRecord as DataRecord$1, Field, FormLayout, ResourceFilterDescriptor, ResourceFilterRule, ResourceLoadOptions, ResourceSchemaResolution, ResourceSortDescriptor, ResourceStore, ResourceStoreFactory, ResourceStoreOptions } from "@nubitio/crud";
|
|
4
4
|
|
|
5
5
|
//#region packages/hydra/HydraRemoteDataSource.d.ts
|
|
6
6
|
type RemoteFilterDescriptor = ResourceFilterDescriptor;
|
|
@@ -37,11 +37,6 @@ declare function HydraResourceSchemaProvider({
|
|
|
37
37
|
}: HydraResourceSchemaProviderProps): React.JSX.Element;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region packages/hydra/types.d.ts
|
|
40
|
-
/**
|
|
41
|
-
* TypeScript types that model a Hydra JSON-LD API documentation response.
|
|
42
|
-
*
|
|
43
|
-
* These are pure data types — no React, no hooks, no side effects.
|
|
44
|
-
*/
|
|
45
40
|
interface HydraProperty {
|
|
46
41
|
'@id': string;
|
|
47
42
|
'@type': string;
|
|
@@ -132,6 +127,12 @@ interface HydraClass {
|
|
|
132
127
|
'@type': string;
|
|
133
128
|
title: string;
|
|
134
129
|
supportedProperty: HydraSupportedProperty[];
|
|
130
|
+
/**
|
|
131
|
+
* Class-level UI hints injected by TranslatedDocumentationNormalizer from
|
|
132
|
+
* the ApiResource's extraProperties['x-crud']['formLayout']. Mirrors
|
|
133
|
+
* @nubitio/crud's FormLayout shape.
|
|
134
|
+
*/
|
|
135
|
+
'x-crud-layout'?: FormLayout;
|
|
135
136
|
/**
|
|
136
137
|
* Hydra search template describing server-side filterable query params.
|
|
137
138
|
* Present on collection operations in API Platform JSON-LD responses.
|
|
@@ -204,6 +205,8 @@ interface HydraResourceSchema {
|
|
|
204
205
|
className: string;
|
|
205
206
|
apiUrl: string;
|
|
206
207
|
fields: HydraFieldSchema[];
|
|
208
|
+
/** Backend-declared form layout (sections/tabs), when published. */
|
|
209
|
+
formLayout?: FormLayout;
|
|
207
210
|
/**
|
|
208
211
|
* Filters discoverable from `hydra:search.hydra:mapping` on the collection
|
|
209
212
|
* operation. Absent/empty means no server-side filter info was found.
|
package/dist/index.mjs
CHANGED
|
@@ -384,6 +384,7 @@ function parseHydraDoc(doc, entrypointHrefs) {
|
|
|
384
384
|
className,
|
|
385
385
|
apiUrl: urlMap[className] ?? `/api/${pluralize(toDashCase(className))}`,
|
|
386
386
|
fields,
|
|
387
|
+
formLayout: cls["x-crud-layout"],
|
|
387
388
|
searchMappings: extractSearchMappings(cls),
|
|
388
389
|
supportedOperations: Array.from(new Set([...collectionOperationsMap[className] ?? [], ...extractSupportedOperations(cls)]))
|
|
389
390
|
};
|
|
@@ -880,7 +881,8 @@ function useResourceSchema(apiUrl) {
|
|
|
880
881
|
fields: mapHydraSchemaToFields(resourceSchema, (className) => resourceMap[className]?.apiUrl, (className) => resourceMap[className]),
|
|
881
882
|
isLoading: false,
|
|
882
883
|
error: void 0,
|
|
883
|
-
supportedOperations: resourceSchema.supportedOperations ?? []
|
|
884
|
+
supportedOperations: resourceSchema.supportedOperations ?? [],
|
|
885
|
+
formLayout: resourceSchema.formLayout
|
|
884
886
|
};
|
|
885
887
|
}, [
|
|
886
888
|
data,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubitio/hydra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Hydra / OpenAPI adapter for @nubitio/crud — automatic schema discovery and data source from API Platform docs.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react": "^19.0.0",
|
|
51
51
|
"react-dom": "^19.0.0",
|
|
52
52
|
"react-i18next": "^14.0.0",
|
|
53
|
-
"@nubitio/core": "^0.
|
|
54
|
-
"@nubitio/crud": "^0.
|
|
53
|
+
"@nubitio/core": "^0.5.0",
|
|
54
|
+
"@nubitio/crud": "^0.5.0"
|
|
55
55
|
}
|
|
56
56
|
}
|