@stonecrop/stonecrop 0.11.1 → 0.11.3
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/registry.js +0 -37
- package/dist/src/registry.d.ts +1 -24
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +0 -24
- package/dist/stonecrop.js +0 -36
- package/dist/stonecrop.js.map +1 -1
- package/package.json +5 -5
- package/src/registry.ts +1 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/stonecrop",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"pinia-shared-state": "^1.0.1",
|
|
35
35
|
"pinia-xstate": "^3.0.0",
|
|
36
36
|
"xstate": "^5.25.0",
|
|
37
|
-
"@stonecrop/schema": "0.11.
|
|
37
|
+
"@stonecrop/schema": "0.11.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"pinia": "^3.0.4",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"vue-router": "^5.0.2",
|
|
61
61
|
"vite": "^7.3.1",
|
|
62
62
|
"vitest": "^4.0.18",
|
|
63
|
-
"
|
|
64
|
-
"@stonecrop/
|
|
65
|
-
"stonecrop
|
|
63
|
+
"stonecrop-rig": "0.7.0",
|
|
64
|
+
"@stonecrop/aform": "0.11.3",
|
|
65
|
+
"@stonecrop/atable": "0.11.3"
|
|
66
66
|
},
|
|
67
67
|
"description": "Schema-driven framework with XState workflows and HST state management",
|
|
68
68
|
"publishConfig": {
|
package/src/registry.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SchemaTypes, TableSchema } from '@stonecrop/aform'
|
|
2
|
-
import type {
|
|
2
|
+
import type { LinkDeclaration } from '@stonecrop/schema'
|
|
3
3
|
import { Router } from 'vue-router'
|
|
4
4
|
|
|
5
5
|
import Doctype from './doctype'
|
|
@@ -417,44 +417,6 @@ export default class Registry {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
/**
|
|
421
|
-
* Convert the registry to a Map of DoctypeMeta objects for use with StonecropClient.
|
|
422
|
-
*
|
|
423
|
-
* This allows passing a Registry instance to StonecropClient by deriving the
|
|
424
|
-
* Map\<string, DoctypeMeta\> that StonecropClient needs for building nested GraphQL queries.
|
|
425
|
-
*
|
|
426
|
-
* @returns Map of doctype metadata keyed by doctype name
|
|
427
|
-
*
|
|
428
|
-
* @example
|
|
429
|
-
* ```typescript
|
|
430
|
-
* const registry = new Registry()
|
|
431
|
-
* registry.addDoctype(Doctype.fromObject(customerSchema))
|
|
432
|
-
* registry.addDoctype(Doctype.fromObject(orderSchema))
|
|
433
|
-
*
|
|
434
|
-
* const client = new StonecropClient({
|
|
435
|
-
* endpoint: '/graphql',
|
|
436
|
-
* registry: registry.toMetaMap(), // Convert once, use with client
|
|
437
|
-
* })
|
|
438
|
-
* ```
|
|
439
|
-
*
|
|
440
|
-
* @public
|
|
441
|
-
*/
|
|
442
|
-
toMetaMap(): Map<string, DoctypeMeta> {
|
|
443
|
-
const map = new Map<string, DoctypeMeta>()
|
|
444
|
-
for (const [slug, doctype] of Object.entries(this.registry)) {
|
|
445
|
-
const fields = doctype.schema ? doctype.schema.toArray() : []
|
|
446
|
-
const meta: DoctypeMeta = {
|
|
447
|
-
name: doctype.name,
|
|
448
|
-
slug: slug,
|
|
449
|
-
fields: fields as DoctypeMeta['fields'],
|
|
450
|
-
links: doctype.links,
|
|
451
|
-
workflow: doctype.workflow as DoctypeMeta['workflow'],
|
|
452
|
-
}
|
|
453
|
-
map.set(doctype.name, meta)
|
|
454
|
-
}
|
|
455
|
-
return map
|
|
456
|
-
}
|
|
457
|
-
|
|
458
420
|
// TODO: should we allow clearing the registry at all?
|
|
459
421
|
// clear() {
|
|
460
422
|
// this.registry = {}
|