@stonecrop/nuxt 0.10.5 → 0.10.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 +13 -13
- package/dist/module.json +1 -1
- package/dist/runtime/app/composables/useStonecropRegistry.d.ts +5 -5
- package/dist/runtime/app/composables/useStonecropRegistry.js +1 -1
- package/dist/runtime/app/composables/useStonecropSetup.d.ts +9 -9
- package/dist/runtime/app/composables/useStonecropSetup.js +4 -4
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -110,12 +110,12 @@ import { StonecropClient } from '@stonecrop/graphql-client'
|
|
|
110
110
|
|
|
111
111
|
export default defineNuxtPlugin(() => {
|
|
112
112
|
const { registerClient, registerMeta } = useStonecropSetup()
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
const client = new StonecropClient({ endpoint: '/graphql' })
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
// Register the data client for record fetching
|
|
117
117
|
registerClient(client)
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
// Configure metadata fetching for lazy-loaded doctypes
|
|
120
120
|
// Called by useStonecrop() when it needs doctype metadata
|
|
121
121
|
registerMeta(({ segments }) => {
|
|
@@ -337,7 +337,7 @@ import { StonecropClient } from '@stonecrop/graphql-client'
|
|
|
337
337
|
|
|
338
338
|
export default defineNuxtPlugin(() => {
|
|
339
339
|
const { isReady, registerClient, registerMeta, registerDoctype } = useStonecropSetup()
|
|
340
|
-
|
|
340
|
+
|
|
341
341
|
// Check if Stonecrop is ready (module plugins run before project plugins)
|
|
342
342
|
if (!isReady) {
|
|
343
343
|
console.warn('Stonecrop not ready - ensure @stonecrop/nuxt module is installed')
|
|
@@ -345,19 +345,19 @@ export default defineNuxtPlugin(() => {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
const client = new StonecropClient({ endpoint: '/graphql' })
|
|
348
|
-
|
|
348
|
+
|
|
349
349
|
// Register the data client
|
|
350
350
|
registerClient(client)
|
|
351
|
-
|
|
351
|
+
|
|
352
352
|
// Configure metadata fetching for lazy-loaded doctypes
|
|
353
353
|
registerMeta(({ segments }) => {
|
|
354
354
|
const doctype = segments[0]
|
|
355
355
|
return client.getMeta({ doctype })
|
|
356
356
|
})
|
|
357
|
-
|
|
357
|
+
|
|
358
358
|
// Optionally pre-load doctypes into the Registry
|
|
359
|
-
const
|
|
360
|
-
registerDoctype(
|
|
359
|
+
const planDoctype = Doctype.fromObject({ name: 'plan', fields: [...] })
|
|
360
|
+
registerDoctype(planDoctype)
|
|
361
361
|
})
|
|
362
362
|
```
|
|
363
363
|
|
|
@@ -377,8 +377,8 @@ export default defineNuxtPlugin(() => {
|
|
|
377
377
|
| `isReady` | `boolean` | `true` when both registry and stonecrop are available |
|
|
378
378
|
| `registerClient(client)` | `(client: DataClient) => void` | Set the data client for record fetching. Throws if stonecrop not available. |
|
|
379
379
|
| `getClient()` | `() => DataClient \| undefined` | Get the currently configured client. |
|
|
380
|
-
| `registerMeta(fn)` | `(fn: (ctx) =>
|
|
381
|
-
| `registerDoctype(doctype)` | `(doctype:
|
|
380
|
+
| `registerMeta(fn)` | `(fn: (ctx) => Doctype) => void` | Set the `getMeta` function on the Registry. Throws if registry not available. |
|
|
381
|
+
| `registerDoctype(doctype)` | `(doctype: Doctype) => void` | Pre-load a doctype into the Registry. Throws if registry not available. |
|
|
382
382
|
| `dispatchAction(...)` | `Promise<{ success, data, error }>` | Dispatch an action via the configured client. |
|
|
383
383
|
|
|
384
384
|
## `useStonecropRegistry()` — Using the Framework in Components
|
|
@@ -390,7 +390,7 @@ export default defineNuxtPlugin(() => {
|
|
|
390
390
|
const { registry, stonecrop, dispatchAction } = useStonecropRegistry()
|
|
391
391
|
|
|
392
392
|
// Access doctype metadata
|
|
393
|
-
const
|
|
393
|
+
const plan = registry.getDoctype('plan')
|
|
394
394
|
|
|
395
395
|
// Dispatch actions
|
|
396
396
|
await dispatchAction({ name: 'plan' }, 'SUBMIT', [recordId])
|
|
@@ -404,7 +404,7 @@ await dispatchAction({ name: 'plan' }, 'SUBMIT', [recordId])
|
|
|
404
404
|
|-----------------|------|-------------|
|
|
405
405
|
| `registry` | `Registry` | The Registry instance for doctype management. |
|
|
406
406
|
| `stonecrop` | `Stonecrop` | The Stonecrop instance for HST and operation log access. Throws if not initialized. |
|
|
407
|
-
| `setMeta(fn)` | `(fn: (ctx) =>
|
|
407
|
+
| `setMeta(fn)` | `(fn: (ctx) => Doctype \| Promise<Doctype>) => void` | Sets the `getMeta` function on the Registry. Called by `useStonecrop()` to lazy-load doctype metadata for the current route. `ctx` = `{ path, segments }`. |
|
|
408
408
|
| `setClient(client)` | `(client: DataClient) => void` | Set the data client for record fetching. Throws if stonecrop not available. |
|
|
409
409
|
| `getClient()` | `() => DataClient \| undefined` | Get the currently configured client. |
|
|
410
410
|
| `dispatchAction(doctype, action, args)` | `Promise<{ success, data, error }>` | Dispatch an action via the configured client. Returns error if doctype not found in registry. |
|
package/dist/module.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataClient } from '@stonecrop/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Doctype, Registry, RouteContext, Stonecrop } from '@stonecrop/stonecrop';
|
|
3
3
|
/**
|
|
4
4
|
* Provides a stable, documented API for accessing the configured Stonecrop
|
|
5
5
|
* Registry instance in components and composables.
|
|
@@ -45,7 +45,7 @@ import type { DoctypeMeta, Registry, RouteContext, Stonecrop } from '@stonecrop/
|
|
|
45
45
|
* ↓
|
|
46
46
|
* DoctypeContext ({ doctype: 'Plan', recordId: '123' })
|
|
47
47
|
* ↓
|
|
48
|
-
* DataClient.getMeta() →
|
|
48
|
+
* DataClient.getMeta() → Doctype
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
@@ -54,7 +54,7 @@ import type { DoctypeMeta, Registry, RouteContext, Stonecrop } from '@stonecrop/
|
|
|
54
54
|
* const { registry, stonecrop, dispatchAction } = useStonecropRegistry()
|
|
55
55
|
*
|
|
56
56
|
* // Access the registry
|
|
57
|
-
* const
|
|
57
|
+
* const plan = registry.getDoctype('plan')
|
|
58
58
|
*
|
|
59
59
|
* // Dispatch an action
|
|
60
60
|
* await dispatchAction({ name: 'plan' }, 'SUBMIT', [recordId])
|
|
@@ -137,7 +137,7 @@ export declare function useStonecropRegistry(): {
|
|
|
137
137
|
* })
|
|
138
138
|
* ```
|
|
139
139
|
*
|
|
140
|
-
* @param fn - Function that receives RouteContext and returns
|
|
140
|
+
* @param fn - Function that receives RouteContext and returns Doctype.
|
|
141
141
|
*/
|
|
142
|
-
setMeta(fn: (routeContext: RouteContext) =>
|
|
142
|
+
setMeta(fn: (routeContext: RouteContext) => Doctype | Promise<Doctype>): void;
|
|
143
143
|
};
|
|
@@ -109,7 +109,7 @@ export function useStonecropRegistry() {
|
|
|
109
109
|
* })
|
|
110
110
|
* ```
|
|
111
111
|
*
|
|
112
|
-
* @param fn - Function that receives RouteContext and returns
|
|
112
|
+
* @param fn - Function that receives RouteContext and returns Doctype.
|
|
113
113
|
*/
|
|
114
114
|
setMeta(fn) {
|
|
115
115
|
registry.getMeta = fn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataClient } from '@stonecrop/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Doctype, Registry, RouteContext, Stonecrop } from '@stonecrop/stonecrop';
|
|
3
3
|
/**
|
|
4
4
|
* Composable for Stonecrop initialization in Nuxt plugins.
|
|
5
5
|
*
|
|
@@ -33,8 +33,8 @@ import type { DoctypeMeta, Registry, RouteContext, Stonecrop } from '@stonecrop/
|
|
|
33
33
|
* })
|
|
34
34
|
*
|
|
35
35
|
* // Optionally pre-load doctypes
|
|
36
|
-
* const
|
|
37
|
-
* registerDoctype(
|
|
36
|
+
* const plan = Doctype.fromObject({ name: 'plan', fields: [...] })
|
|
37
|
+
* registerDoctype(plan)
|
|
38
38
|
* })
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
@@ -79,7 +79,7 @@ export declare function useStonecropSetup(): {
|
|
|
79
79
|
* - Extract record ID from `segments` if present (e.g., `segments[1]`)
|
|
80
80
|
* - Pass `DoctypeContext` to your data client
|
|
81
81
|
*
|
|
82
|
-
* @param fn - Function that receives RouteContext and returns
|
|
82
|
+
* @param fn - Function that receives RouteContext and returns Doctype
|
|
83
83
|
* @throws Error if the Registry is not available
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
@@ -90,19 +90,19 @@ export declare function useStonecropSetup(): {
|
|
|
90
90
|
* })
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
registerMeta(fn: (routeContext: RouteContext) =>
|
|
93
|
+
registerMeta(fn: (routeContext: RouteContext) => Doctype | Promise<Doctype>): void;
|
|
94
94
|
/**
|
|
95
95
|
* Load a doctype into the Registry.
|
|
96
96
|
* Convenience method that calls `registry.addDoctype()` if available.
|
|
97
97
|
*
|
|
98
|
-
* @param doctype - The
|
|
98
|
+
* @param doctype - The Doctype instance to register
|
|
99
99
|
* @throws Error if the Registry is not available
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
103
|
-
* const
|
|
104
|
-
* registerDoctype(
|
|
103
|
+
* const plan = Doctype.fromObject({ name: 'plan', fields: [...] })
|
|
104
|
+
* registerDoctype(plan)
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
|
-
registerDoctype(doctype:
|
|
107
|
+
registerDoctype(doctype: Doctype): void;
|
|
108
108
|
};
|
|
@@ -54,7 +54,7 @@ export function useStonecropSetup() {
|
|
|
54
54
|
* - Extract record ID from `segments` if present (e.g., `segments[1]`)
|
|
55
55
|
* - Pass `DoctypeContext` to your data client
|
|
56
56
|
*
|
|
57
|
-
* @param fn - Function that receives RouteContext and returns
|
|
57
|
+
* @param fn - Function that receives RouteContext and returns Doctype
|
|
58
58
|
* @throws Error if the Registry is not available
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
@@ -78,13 +78,13 @@ export function useStonecropSetup() {
|
|
|
78
78
|
* Load a doctype into the Registry.
|
|
79
79
|
* Convenience method that calls `registry.addDoctype()` if available.
|
|
80
80
|
*
|
|
81
|
-
* @param doctype - The
|
|
81
|
+
* @param doctype - The Doctype instance to register
|
|
82
82
|
* @throws Error if the Registry is not available
|
|
83
83
|
*
|
|
84
84
|
* @example
|
|
85
85
|
* ```ts
|
|
86
|
-
* const
|
|
87
|
-
* registerDoctype(
|
|
86
|
+
* const plan = Doctype.fromObject({ name: 'plan', fields: [...] })
|
|
87
|
+
* registerDoctype(plan)
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
registerDoctype(doctype) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/nuxt",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Nuxt module for Stonecrop",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"jiti": "^2.4.2",
|
|
45
45
|
"pathe": "^2.0.3",
|
|
46
46
|
"prompts": "^2.4.2",
|
|
47
|
-
"@stonecrop/aform": "0.10.
|
|
48
|
-
"@stonecrop/atable": "0.10.
|
|
49
|
-
"@stonecrop/casl-middleware": "0.10.
|
|
50
|
-
"@stonecrop/
|
|
51
|
-
"@stonecrop/
|
|
52
|
-
"@stonecrop/nuxt-grafserv": "0.10.
|
|
53
|
-
"@stonecrop/schema": "0.10.
|
|
54
|
-
"@stonecrop/stonecrop": "0.10.
|
|
47
|
+
"@stonecrop/aform": "0.10.7",
|
|
48
|
+
"@stonecrop/atable": "0.10.7",
|
|
49
|
+
"@stonecrop/casl-middleware": "0.10.7",
|
|
50
|
+
"@stonecrop/graphql-middleware": "0.10.7",
|
|
51
|
+
"@stonecrop/node-editor": "0.10.7",
|
|
52
|
+
"@stonecrop/nuxt-grafserv": "0.10.7",
|
|
53
|
+
"@stonecrop/schema": "0.10.7",
|
|
54
|
+
"@stonecrop/stonecrop": "0.10.7"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@eslint/js": "^9.39.2",
|