@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/dist/registry.js
CHANGED
|
@@ -368,41 +368,4 @@ export default class Registry {
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
/**
|
|
372
|
-
* Convert the registry to a Map of DoctypeMeta objects for use with StonecropClient.
|
|
373
|
-
*
|
|
374
|
-
* This allows passing a Registry instance to StonecropClient by deriving the
|
|
375
|
-
* Map\<string, DoctypeMeta\> that StonecropClient needs for building nested GraphQL queries.
|
|
376
|
-
*
|
|
377
|
-
* @returns Map of doctype metadata keyed by doctype name
|
|
378
|
-
*
|
|
379
|
-
* @example
|
|
380
|
-
* ```typescript
|
|
381
|
-
* const registry = new Registry()
|
|
382
|
-
* registry.addDoctype(Doctype.fromObject(customerSchema))
|
|
383
|
-
* registry.addDoctype(Doctype.fromObject(orderSchema))
|
|
384
|
-
*
|
|
385
|
-
* const client = new StonecropClient({
|
|
386
|
-
* endpoint: '/graphql',
|
|
387
|
-
* registry: registry.toMetaMap(), // Convert once, use with client
|
|
388
|
-
* })
|
|
389
|
-
* ```
|
|
390
|
-
*
|
|
391
|
-
* @public
|
|
392
|
-
*/
|
|
393
|
-
toMetaMap() {
|
|
394
|
-
const map = new Map();
|
|
395
|
-
for (const [slug, doctype] of Object.entries(this.registry)) {
|
|
396
|
-
const fields = doctype.schema ? doctype.schema.toArray() : [];
|
|
397
|
-
const meta = {
|
|
398
|
-
name: doctype.name,
|
|
399
|
-
slug: slug,
|
|
400
|
-
fields: fields,
|
|
401
|
-
links: doctype.links,
|
|
402
|
-
workflow: doctype.workflow,
|
|
403
|
-
};
|
|
404
|
-
map.set(doctype.name, meta);
|
|
405
|
-
}
|
|
406
|
-
return map;
|
|
407
|
-
}
|
|
408
371
|
}
|
package/dist/src/registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@stonecrop/aform';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LinkDeclaration } from '@stonecrop/schema';
|
|
3
3
|
import { Router } from 'vue-router';
|
|
4
4
|
import Doctype from './doctype';
|
|
5
5
|
import { RouteContext } from './types/registry';
|
|
@@ -169,28 +169,5 @@ export default class Registry {
|
|
|
169
169
|
* @internal
|
|
170
170
|
*/
|
|
171
171
|
private _ensureAncestorIndex;
|
|
172
|
-
/**
|
|
173
|
-
* Convert the registry to a Map of DoctypeMeta objects for use with StonecropClient.
|
|
174
|
-
*
|
|
175
|
-
* This allows passing a Registry instance to StonecropClient by deriving the
|
|
176
|
-
* Map\<string, DoctypeMeta\> that StonecropClient needs for building nested GraphQL queries.
|
|
177
|
-
*
|
|
178
|
-
* @returns Map of doctype metadata keyed by doctype name
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```typescript
|
|
182
|
-
* const registry = new Registry()
|
|
183
|
-
* registry.addDoctype(Doctype.fromObject(customerSchema))
|
|
184
|
-
* registry.addDoctype(Doctype.fromObject(orderSchema))
|
|
185
|
-
*
|
|
186
|
-
* const client = new StonecropClient({
|
|
187
|
-
* endpoint: '/graphql',
|
|
188
|
-
* registry: registry.toMetaMap(), // Convert once, use with client
|
|
189
|
-
* })
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* @public
|
|
193
|
-
*/
|
|
194
|
-
toMetaMap(): Map<string, DoctypeMeta>;
|
|
195
172
|
}
|
|
196
173
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names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,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE;IA6ErE;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAoD5D;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI7C;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAUvF;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBtG;;;OAGG;IACH,OAAO,CAAC,oBAAoB;CAgC5B"}
|
package/dist/stonecrop.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { AnyStateNodeConfig } from 'xstate';
|
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
import { ComputedRef } from 'vue';
|
|
4
4
|
import type { DataClient } from '@stonecrop/schema';
|
|
5
|
-
import type { DoctypeMeta } from '@stonecrop/schema';
|
|
6
5
|
import type { LinkDeclaration } from '@stonecrop/schema';
|
|
7
6
|
import { List } from 'immutable';
|
|
8
7
|
import { Map as Map_2 } from 'immutable';
|
|
@@ -1336,29 +1335,6 @@ export declare class Registry {
|
|
|
1336
1335
|
* @internal
|
|
1337
1336
|
*/
|
|
1338
1337
|
private _ensureAncestorIndex;
|
|
1339
|
-
/**
|
|
1340
|
-
* Convert the registry to a Map of DoctypeMeta objects for use with StonecropClient.
|
|
1341
|
-
*
|
|
1342
|
-
* This allows passing a Registry instance to StonecropClient by deriving the
|
|
1343
|
-
* Map\<string, DoctypeMeta\> that StonecropClient needs for building nested GraphQL queries.
|
|
1344
|
-
*
|
|
1345
|
-
* @returns Map of doctype metadata keyed by doctype name
|
|
1346
|
-
*
|
|
1347
|
-
* @example
|
|
1348
|
-
* ```typescript
|
|
1349
|
-
* const registry = new Registry()
|
|
1350
|
-
* registry.addDoctype(Doctype.fromObject(customerSchema))
|
|
1351
|
-
* registry.addDoctype(Doctype.fromObject(orderSchema))
|
|
1352
|
-
*
|
|
1353
|
-
* const client = new StonecropClient({
|
|
1354
|
-
* endpoint: '/graphql',
|
|
1355
|
-
* registry: registry.toMetaMap(), // Convert once, use with client
|
|
1356
|
-
* })
|
|
1357
|
-
* ```
|
|
1358
|
-
*
|
|
1359
|
-
* @public
|
|
1360
|
-
*/
|
|
1361
|
-
toMetaMap(): Map<string, DoctypeMeta>;
|
|
1362
1338
|
}
|
|
1363
1339
|
|
|
1364
1340
|
/**
|
package/dist/stonecrop.js
CHANGED
|
@@ -5754,42 +5754,6 @@ class me {
|
|
|
5754
5754
|
}
|
|
5755
5755
|
}
|
|
5756
5756
|
}
|
|
5757
|
-
/**
|
|
5758
|
-
* Convert the registry to a Map of DoctypeMeta objects for use with StonecropClient.
|
|
5759
|
-
*
|
|
5760
|
-
* This allows passing a Registry instance to StonecropClient by deriving the
|
|
5761
|
-
* Map\<string, DoctypeMeta\> that StonecropClient needs for building nested GraphQL queries.
|
|
5762
|
-
*
|
|
5763
|
-
* @returns Map of doctype metadata keyed by doctype name
|
|
5764
|
-
*
|
|
5765
|
-
* @example
|
|
5766
|
-
* ```typescript
|
|
5767
|
-
* const registry = new Registry()
|
|
5768
|
-
* registry.addDoctype(Doctype.fromObject(customerSchema))
|
|
5769
|
-
* registry.addDoctype(Doctype.fromObject(orderSchema))
|
|
5770
|
-
*
|
|
5771
|
-
* const client = new StonecropClient({
|
|
5772
|
-
* endpoint: '/graphql',
|
|
5773
|
-
* registry: registry.toMetaMap(), // Convert once, use with client
|
|
5774
|
-
* })
|
|
5775
|
-
* ```
|
|
5776
|
-
*
|
|
5777
|
-
* @public
|
|
5778
|
-
*/
|
|
5779
|
-
toMetaMap() {
|
|
5780
|
-
const t = /* @__PURE__ */ new Map();
|
|
5781
|
-
for (const [r, n] of Object.entries(this.registry)) {
|
|
5782
|
-
const i = n.schema ? n.schema.toArray() : [], o = {
|
|
5783
|
-
name: n.name,
|
|
5784
|
-
slug: r,
|
|
5785
|
-
fields: i,
|
|
5786
|
-
links: n.links,
|
|
5787
|
-
workflow: n.workflow
|
|
5788
|
-
};
|
|
5789
|
-
t.set(n.name, o);
|
|
5790
|
-
}
|
|
5791
|
-
return t;
|
|
5792
|
-
}
|
|
5793
5757
|
// TODO: should we allow clearing the registry at all?
|
|
5794
5758
|
// clear() {
|
|
5795
5759
|
// this.registry = {}
|