@stonecrop/stonecrop 0.2.24 → 0.2.26
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/composable.js +36 -0
- package/dist/doctype.js +26 -0
- package/dist/exceptions.js +22 -0
- package/dist/index.js +5 -0
- package/dist/plugins/index.js +18 -0
- package/dist/registry.js +29 -0
- package/dist/router.js +6 -0
- package/dist/src/composable.d.ts +10 -0
- package/dist/src/composable.d.ts.map +1 -0
- package/dist/src/doctype.d.ts +13 -0
- package/dist/src/doctype.d.ts.map +1 -0
- package/dist/src/exceptions.d.ts +15 -0
- package/dist/src/exceptions.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/plugins/index.d.ts +4 -0
- package/dist/src/plugins/index.d.ts.map +1 -0
- package/dist/src/registry.d.ts +12 -0
- package/dist/src/registry.d.ts.map +1 -0
- package/dist/src/router.d.ts +3 -0
- package/dist/src/router.d.ts.map +1 -0
- package/dist/src/stonecrop.d.ts +174 -0
- package/dist/src/stonecrop.d.ts.map +1 -0
- package/dist/src/stores/data.d.ts +11 -0
- package/dist/src/stores/data.d.ts.map +1 -0
- package/dist/src/stores/index.d.ts +3 -0
- package/dist/src/stores/index.d.ts.map +1 -0
- package/dist/src/stores/xstate.d.ts +10 -0
- package/dist/src/stores/xstate.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +26 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/stonecrop/src/tsdoc-metadata.json +11 -0
- package/dist/stonecrop.d.ts +26 -0
- package/dist/stonecrop.js +2831 -4309
- package/dist/stonecrop.js.map +1 -0
- package/dist/stonecrop.tsbuildinfo +1 -0
- package/dist/stonecrop.umd.cjs +34 -5313
- package/dist/stonecrop.umd.cjs.map +1 -0
- package/dist/stores/data.js +7 -0
- package/dist/stores/index.js +11 -0
- package/dist/stores/xstate.js +29 -0
- package/dist/types/index.js +0 -0
- package/package.json +22 -19
- package/src/composable.ts +4 -3
- package/src/doctype.ts +1 -1
- package/src/exceptions.ts +10 -0
- package/src/index.ts +5 -4
- package/src/plugins/index.ts +8 -6
- package/src/stonecrop.ts +6 -6
- package/src/stores/index.ts +1 -1
- package/src/stores/xstate.ts +0 -1
- package/src/types/index.ts +33 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { inject, onBeforeMount, ref } from 'vue';
|
|
2
|
+
import { Stonecrop } from '@/stonecrop';
|
|
3
|
+
import { useDataStore } from '@/stores/data';
|
|
4
|
+
export function useStonecrop(registry) {
|
|
5
|
+
if (!registry) {
|
|
6
|
+
registry = inject('$registry');
|
|
7
|
+
}
|
|
8
|
+
const store = useDataStore();
|
|
9
|
+
const stonecrop = ref(new Stonecrop(registry, store));
|
|
10
|
+
const isReady = ref(false);
|
|
11
|
+
onBeforeMount(async () => {
|
|
12
|
+
const route = registry.router.currentRoute.value;
|
|
13
|
+
const doctypeSlug = route.params.records?.toString().toLowerCase();
|
|
14
|
+
const recordId = route.params.record?.toString().toLowerCase();
|
|
15
|
+
// TODO: handle views other than list and form views?
|
|
16
|
+
if (!doctypeSlug && !recordId) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// setup doctype via registry
|
|
20
|
+
const doctype = await registry.getMeta(doctypeSlug);
|
|
21
|
+
registry.addDoctype(doctype);
|
|
22
|
+
stonecrop.value.setup(doctype);
|
|
23
|
+
if (doctypeSlug) {
|
|
24
|
+
if (recordId) {
|
|
25
|
+
await stonecrop.value.getRecord(doctype, recordId);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
await stonecrop.value.getRecords(doctype);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
stonecrop.value.runAction(doctype, 'LOAD', recordId ? [recordId] : undefined);
|
|
32
|
+
isReady.value = true;
|
|
33
|
+
});
|
|
34
|
+
// @ts-expect-error TODO: fix the type mismatch
|
|
35
|
+
return { stonecrop, isReady };
|
|
36
|
+
}
|
package/dist/doctype.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default class DoctypeMeta {
|
|
2
|
+
doctype;
|
|
3
|
+
schema;
|
|
4
|
+
workflow;
|
|
5
|
+
actions;
|
|
6
|
+
// TODO: allow different components for different views; probably
|
|
7
|
+
// should be defined in the schema instead?
|
|
8
|
+
component;
|
|
9
|
+
constructor(doctype, schema, workflow, actions, component) {
|
|
10
|
+
this.doctype = doctype;
|
|
11
|
+
this.schema = schema;
|
|
12
|
+
this.workflow = workflow;
|
|
13
|
+
this.actions = actions;
|
|
14
|
+
this.component = component;
|
|
15
|
+
}
|
|
16
|
+
get slug() {
|
|
17
|
+
// kebab case
|
|
18
|
+
return this.doctype
|
|
19
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
20
|
+
.replace(/[\s_]+/g, '-')
|
|
21
|
+
.toLowerCase();
|
|
22
|
+
}
|
|
23
|
+
get __typename() {
|
|
24
|
+
return this.doctype;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NotImplementedError
|
|
3
|
+
* @param message {string} - The error message
|
|
4
|
+
* @class
|
|
5
|
+
* @description This error is thrown when a method has not been implemented
|
|
6
|
+
* @example
|
|
7
|
+
* throw new NotImplementedError('Method not implemented')
|
|
8
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export function NotImplementedError(message) {
|
|
12
|
+
this.message = message || '';
|
|
13
|
+
}
|
|
14
|
+
NotImplementedError.prototype = Object.create(Error.prototype, {
|
|
15
|
+
constructor: { value: NotImplementedError },
|
|
16
|
+
name: { value: 'NotImplemented' },
|
|
17
|
+
stack: {
|
|
18
|
+
get: function () {
|
|
19
|
+
return new Error().stack;
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Registry from '@/registry';
|
|
2
|
+
import router from '@/router';
|
|
3
|
+
import { pinia } from '@/stores';
|
|
4
|
+
const plugin = {
|
|
5
|
+
install: (app, options) => {
|
|
6
|
+
const appRouter = options?.router || router;
|
|
7
|
+
const registry = new Registry(appRouter, options?.getMeta);
|
|
8
|
+
app.use(appRouter);
|
|
9
|
+
app.use(pinia);
|
|
10
|
+
app.provide('$registry', registry);
|
|
11
|
+
if (options?.components) {
|
|
12
|
+
for (const [tag, component] of Object.entries(options.components)) {
|
|
13
|
+
app.component(tag, component);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default plugin;
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default class Registry {
|
|
2
|
+
static _root;
|
|
3
|
+
name;
|
|
4
|
+
router;
|
|
5
|
+
registry;
|
|
6
|
+
getMeta;
|
|
7
|
+
constructor(router, getMeta) {
|
|
8
|
+
if (Registry._root) {
|
|
9
|
+
return Registry._root;
|
|
10
|
+
}
|
|
11
|
+
Registry._root = this;
|
|
12
|
+
this.name = 'Registry';
|
|
13
|
+
this.router = router;
|
|
14
|
+
this.registry = {};
|
|
15
|
+
this.getMeta = getMeta;
|
|
16
|
+
}
|
|
17
|
+
addDoctype(doctype) {
|
|
18
|
+
if (!(doctype.doctype in Object.keys(this.registry))) {
|
|
19
|
+
this.registry[doctype.slug] = doctype;
|
|
20
|
+
}
|
|
21
|
+
if (!this.router.hasRoute(doctype.doctype)) {
|
|
22
|
+
this.router.addRoute({
|
|
23
|
+
path: `/${doctype.slug}`,
|
|
24
|
+
name: doctype.slug,
|
|
25
|
+
component: doctype.component,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import Registry from '@/registry';
|
|
3
|
+
import { Stonecrop } from '@/stonecrop';
|
|
4
|
+
type StonecropReturn = {
|
|
5
|
+
stonecrop: Ref<Stonecrop>;
|
|
6
|
+
isReady: Ref<boolean>;
|
|
7
|
+
};
|
|
8
|
+
export declare function useStonecrop(registry?: Registry): StonecropReturn;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=composable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composable.d.ts","sourceRoot":"","sources":["../../src/composable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,GAAG,EAAO,MAAM,KAAK,CAAA;AAErD,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,KAAK,eAAe,GAAG;IACtB,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IACzB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACrB,CAAA;AAED,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,eAAe,CAsCjE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import type { ImmutableDoctype } from '@/types';
|
|
3
|
+
export default class DoctypeMeta {
|
|
4
|
+
readonly doctype: string;
|
|
5
|
+
readonly schema: ImmutableDoctype['schema'];
|
|
6
|
+
readonly workflow: ImmutableDoctype['workflow'];
|
|
7
|
+
readonly actions: ImmutableDoctype['actions'];
|
|
8
|
+
readonly component?: Component;
|
|
9
|
+
constructor(doctype: string, schema: ImmutableDoctype['schema'], workflow: ImmutableDoctype['workflow'], actions: ImmutableDoctype['actions'], component?: Component);
|
|
10
|
+
get slug(): string;
|
|
11
|
+
get __typename(): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=doctype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,MAAM,CAAC,OAAO,OAAO,WAAW;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IAC3C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAC/C,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;IAG7C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;gBAG7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAClC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,EACtC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACpC,SAAS,CAAC,EAAE,SAAS;IAStB,IAAI,IAAI,WAMP;IAED,IAAI,UAAU,WAEb;CACD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NotImplementedError
|
|
3
|
+
* @param message {string} - The error message
|
|
4
|
+
* @class
|
|
5
|
+
* @description This error is thrown when a method has not been implemented
|
|
6
|
+
* @example
|
|
7
|
+
* throw new NotImplementedError('Method not implemented')
|
|
8
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function NotImplementedError(message: string): void;
|
|
12
|
+
export declare namespace NotImplementedError {
|
|
13
|
+
var prototype: any;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/exceptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,QAElD;yBAFe,mBAAmB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useStonecrop } from '@/composable';
|
|
2
|
+
import DoctypeMeta from '@/doctype';
|
|
3
|
+
import Registry from '@/registry';
|
|
4
|
+
import Stonecrop from '@/plugins';
|
|
5
|
+
export type { ImmutableDoctype, MutableDoctype, Schema, InstallOptions } from '@/types';
|
|
6
|
+
export { DoctypeMeta, Registry, Stonecrop, useStonecrop };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,WAAW,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEvF,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,KAAK,CAAA;AAOtC,QAAA,MAAM,MAAM,EAAE,MAeb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Router } from 'vue-router';
|
|
2
|
+
import DoctypeMeta from '@/doctype';
|
|
3
|
+
export default class Registry {
|
|
4
|
+
static _root: Registry;
|
|
5
|
+
name: string;
|
|
6
|
+
router: Router;
|
|
7
|
+
registry: Record<string, DoctypeMeta>;
|
|
8
|
+
getMeta?: (doctype: string) => DoctypeMeta | Promise<DoctypeMeta>;
|
|
9
|
+
constructor(router: Router, getMeta?: (doctype: string) => DoctypeMeta | Promise<DoctypeMeta>);
|
|
10
|
+
addDoctype(doctype: DoctypeMeta): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,WAAW,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACrC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;gBAErD,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAW7F,UAAU,CAAC,OAAO,EAAE,WAAW;CAY/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM,6BAGV,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import DoctypeMeta from '@/doctype';
|
|
2
|
+
import Registry from '@/registry';
|
|
3
|
+
import { useDataStore } from '@/stores/data';
|
|
4
|
+
import type { ImmutableDoctype, Schema } from '@/types';
|
|
5
|
+
export declare class Stonecrop {
|
|
6
|
+
/**
|
|
7
|
+
* @property {Stonecrop} _root
|
|
8
|
+
* @description The root Stonecrop instance
|
|
9
|
+
*/
|
|
10
|
+
static _root: Stonecrop;
|
|
11
|
+
/**
|
|
12
|
+
* @property {string} name
|
|
13
|
+
* @description The name of the Stonecrop instance
|
|
14
|
+
* @example
|
|
15
|
+
* 'Stonecrop'
|
|
16
|
+
*/
|
|
17
|
+
readonly name = "Stonecrop";
|
|
18
|
+
/**
|
|
19
|
+
* @property {Registry} registry
|
|
20
|
+
* @description The registry is an immutable collection of doctypes
|
|
21
|
+
* @example
|
|
22
|
+
* {
|
|
23
|
+
* 'task': {
|
|
24
|
+
* doctype: 'Task',
|
|
25
|
+
* schema: {
|
|
26
|
+
* title: 'string',
|
|
27
|
+
* description: 'string',
|
|
28
|
+
* ...
|
|
29
|
+
* }
|
|
30
|
+
* },
|
|
31
|
+
* ...
|
|
32
|
+
* }
|
|
33
|
+
* @see {@link Registry}
|
|
34
|
+
* @see {@link DoctypeMeta}
|
|
35
|
+
*/
|
|
36
|
+
readonly registry: Registry;
|
|
37
|
+
/**
|
|
38
|
+
* @property {Schema} schema - The Stonecrop schema
|
|
39
|
+
* @description The schema is a subset of the registry
|
|
40
|
+
* @example
|
|
41
|
+
* {
|
|
42
|
+
* doctype: 'Task',
|
|
43
|
+
* schema: {
|
|
44
|
+
* title: 'string',
|
|
45
|
+
* description: 'string',
|
|
46
|
+
* ...
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* @see {@link Registry}
|
|
50
|
+
* @see {@link DoctypeMeta}
|
|
51
|
+
* @see {@link DoctypeMeta.schema}
|
|
52
|
+
*/
|
|
53
|
+
schema: Schema;
|
|
54
|
+
/**
|
|
55
|
+
* @property {ImmutableDoctype['workflow']} workflow
|
|
56
|
+
* @description The workflow is a subset of the registry
|
|
57
|
+
*/
|
|
58
|
+
workflow: ImmutableDoctype['workflow'];
|
|
59
|
+
/**
|
|
60
|
+
* @property {ImmutableDoctype['actions']} actions
|
|
61
|
+
* @description The actions are a subset of the registry
|
|
62
|
+
*/
|
|
63
|
+
actions: ImmutableDoctype['actions'];
|
|
64
|
+
/**
|
|
65
|
+
* @property {ReturnType<typeof useDataStore>} store
|
|
66
|
+
* @description The Pinia store that manages the mutable records
|
|
67
|
+
*/
|
|
68
|
+
store: ReturnType<typeof useDataStore>;
|
|
69
|
+
/**
|
|
70
|
+
* @constructor
|
|
71
|
+
* @param {Registry} registry - The immutable registry
|
|
72
|
+
* @param {ReturnType<typeof useDataStore>} store - The mutable Pinia store
|
|
73
|
+
* @param {Schema} [schema] - (optional) The Stonecrop schema
|
|
74
|
+
* @param {ImmutableDoctype['workflow']} [workflow] - (optional) The Stonecrop workflow
|
|
75
|
+
* @param {ImmutableDoctype['actions']} [actions] - (optional) The Stonecrop actions
|
|
76
|
+
* @returns {Stonecrop} The Stonecrop instance
|
|
77
|
+
* @description The Stonecrop constructor initializes a new Stonecrop instance with the given registry, store, schema, workflow, and actions. If a Stonecrop instance has already been created, it returns the existing instance instead of creating a new one.
|
|
78
|
+
* @example
|
|
79
|
+
* const registry = new Registry()
|
|
80
|
+
* const store = useDataStore()
|
|
81
|
+
* const stonecrop = new Stonecrop(registry, store, schema, workflow, actions)
|
|
82
|
+
*/
|
|
83
|
+
constructor(registry: Registry, store: ReturnType<typeof useDataStore>, schema?: Schema, workflow?: ImmutableDoctype['workflow'], actions?: ImmutableDoctype['actions']);
|
|
84
|
+
/**
|
|
85
|
+
* @method setup
|
|
86
|
+
* @param {DoctypeMeta} doctype - The doctype to setup
|
|
87
|
+
* @returns {void}
|
|
88
|
+
* @description Sets up the Stonecrop instance with the given doctype
|
|
89
|
+
* @example
|
|
90
|
+
* const doctype = await registry.getMeta('Task')
|
|
91
|
+
* stonecrop.setup(doctype)
|
|
92
|
+
*/
|
|
93
|
+
setup(doctype: DoctypeMeta): void;
|
|
94
|
+
/**
|
|
95
|
+
* @method getMeta
|
|
96
|
+
* @param {DoctypeMeta} doctype - The doctype to get meta for
|
|
97
|
+
* @returns {DoctypeMeta}
|
|
98
|
+
* @see {@link DoctypeMeta}
|
|
99
|
+
* @throws NotImplementedError
|
|
100
|
+
* @description Gets the meta for the given doctype
|
|
101
|
+
* @example
|
|
102
|
+
* const doctype = await registry.getMeta('Task')
|
|
103
|
+
* const meta = stonecrop.getMeta(doctype)
|
|
104
|
+
*/
|
|
105
|
+
getMeta(doctype: DoctypeMeta): DoctypeMeta | Promise<DoctypeMeta> | never;
|
|
106
|
+
/**
|
|
107
|
+
* @method getWorkflow
|
|
108
|
+
* @param {DoctypeMeta} doctype - The doctype to get workflow for
|
|
109
|
+
* @returns {void}
|
|
110
|
+
* @description Gets the workflow for the given doctype
|
|
111
|
+
* @example
|
|
112
|
+
* const doctype = await registry.getMeta('Task')
|
|
113
|
+
* stonecrop.getWorkflow(doctype)
|
|
114
|
+
*/
|
|
115
|
+
getWorkflow(doctype: DoctypeMeta): void;
|
|
116
|
+
/**
|
|
117
|
+
* @method getActions
|
|
118
|
+
* @param {DoctypeMeta} doctype - The doctype to get actions for
|
|
119
|
+
* @returns {void}
|
|
120
|
+
* @description Gets the actions for the given doctype
|
|
121
|
+
* @example
|
|
122
|
+
* const doctype = await registry.getMeta('Task')
|
|
123
|
+
* stonecrop.getActions(doctype)
|
|
124
|
+
*/
|
|
125
|
+
getActions(doctype: DoctypeMeta): void;
|
|
126
|
+
/**
|
|
127
|
+
* @method getRecords
|
|
128
|
+
* @param {DoctypeMeta} doctype - The doctype to get records for
|
|
129
|
+
* @param {RequestInit} [filters] - The filters to apply to the records
|
|
130
|
+
* @returns {Promise<void>}
|
|
131
|
+
* @description Gets the records for the given doctype
|
|
132
|
+
* @example
|
|
133
|
+
* const doctype = await registry.getMeta('Task')
|
|
134
|
+
* await stonecrop.getRecords(doctype)
|
|
135
|
+
* @example
|
|
136
|
+
* const doctype = await registry.getMeta('Task')
|
|
137
|
+
* const filters = JSON.stringify({ status: 'Open' })
|
|
138
|
+
* await stonecrop.getRecords(doctype, { body: filters })
|
|
139
|
+
*/
|
|
140
|
+
getRecords(doctype: DoctypeMeta, filters?: RequestInit): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* @method getRecord
|
|
143
|
+
* @param {DoctypeMeta} doctype - The doctype to get record for
|
|
144
|
+
* @param {string} id - The id of the record to get
|
|
145
|
+
* @returns {Promise<void>}
|
|
146
|
+
* @description Gets the record for the given doctype and id
|
|
147
|
+
* @example
|
|
148
|
+
* const doctype = await registry.getMeta('Task')
|
|
149
|
+
* await stonecrop.getRecord(doctype, 'TASK-00001')
|
|
150
|
+
*/
|
|
151
|
+
getRecord(doctype: DoctypeMeta, id: string): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* @method runAction
|
|
154
|
+
* @param {DoctypeMeta} doctype - The doctype to run action for
|
|
155
|
+
* @param {string} action - The action to run
|
|
156
|
+
* @param {string[]} [id] - The id(s) of the record(s) to run action on
|
|
157
|
+
* @returns {void}
|
|
158
|
+
* @description Runs the action for the given doctype and id
|
|
159
|
+
* @example
|
|
160
|
+
* const doctype = await registry.getMeta('Task')
|
|
161
|
+
* stonecrop.runAction(doctype, 'CREATE')
|
|
162
|
+
* @example
|
|
163
|
+
* const doctype = await registry.getMeta('Task')
|
|
164
|
+
* stonecrop.runAction(doctype, 'UPDATE', ['TASK-00001'])
|
|
165
|
+
* @example
|
|
166
|
+
* const doctype = await registry.getMeta('Task')
|
|
167
|
+
* stonecrop.runAction(doctype, 'DELETE', ['TASK-00001'])
|
|
168
|
+
* @example
|
|
169
|
+
* const doctype = await registry.getMeta('Task')
|
|
170
|
+
* stonecrop.runAction(doctype, 'TRANSITION', ['TASK-00001', 'TASK-00002'])
|
|
171
|
+
*/
|
|
172
|
+
runAction(doctype: DoctypeMeta, action: string, id?: string[]): void;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=stonecrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../src/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,WAAW,CAAA;AAEnC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEvD,qBAAa,SAAS;IACrB;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,CAAA;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,eAAc;IAE3B;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAE3B;;;;;;;;;;;;;;;OAeG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAEtC;;;OAGG;IACH,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;IAEpC;;;OAGG;IACH,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;IAEtC;;;;;;;;;;;;;OAaG;gBAEF,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EACtC,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,EACvC,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC;IAatC;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAMjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,KAAK;IAIzE;;;;;;;;OAQG;IACH,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAKvC;;;;;;;;OAQG;IACH,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAKtC;;;;;;;;;;;;;OAaG;IACG,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5E;;;;;;;;;OASG;IACG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;CAiBpE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const useDataStore: import("pinia").StoreDefinition<"data", import("pinia")._UnwrapAll<Pick<{
|
|
2
|
+
records: import("vue").Ref<Record<string, any>[]>;
|
|
3
|
+
record: import("vue").Ref<Record<string, any>>;
|
|
4
|
+
}, "records" | "record">>, Pick<{
|
|
5
|
+
records: import("vue").Ref<Record<string, any>[]>;
|
|
6
|
+
record: import("vue").Ref<Record<string, any>>;
|
|
7
|
+
}, never>, Pick<{
|
|
8
|
+
records: import("vue").Ref<Record<string, any>[]>;
|
|
9
|
+
record: import("vue").Ref<Record<string, any>>;
|
|
10
|
+
}, never>>;
|
|
11
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/stores/data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;UAIvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stores/index.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,KAAK,uBAAgB,CAAA;AAW3B,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const counterMachine: import("xstate").StateMachine<{
|
|
2
|
+
count: number;
|
|
3
|
+
}, any, import("xstate").AnyEventObject, {
|
|
4
|
+
value: any;
|
|
5
|
+
context: {
|
|
6
|
+
count: number;
|
|
7
|
+
};
|
|
8
|
+
}, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("xstate").AnyEventObject, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
9
|
+
export declare const useCounterStore: import("pinia").StoreDefinition<string, {}, {}, {}>;
|
|
10
|
+
//# sourceMappingURL=xstate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xstate.d.ts","sourceRoot":"","sources":["../../../src/stores/xstate.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;0OA0B1B,CAAA;AAGD,eAAO,MAAM,eAAe,qDAAyD,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { List, Map } from 'immutable';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
import { Router } from 'vue-router';
|
|
4
|
+
import { MachineConfig, StateMachine } from 'xstate';
|
|
5
|
+
import AForm from '@stonecrop/aform';
|
|
6
|
+
import DoctypeMeta from '@/doctype';
|
|
7
|
+
export type ImmutableDoctype = Readonly<{
|
|
8
|
+
schema?: List<AForm.SchemaTypes>;
|
|
9
|
+
workflow: StateMachine<unknown, unknown, any>;
|
|
10
|
+
actions?: Map<string, string[]>;
|
|
11
|
+
}>;
|
|
12
|
+
export type MutableDoctype = {
|
|
13
|
+
schema?: AForm.SchemaTypes[];
|
|
14
|
+
workflow: MachineConfig<unknown, unknown, any>;
|
|
15
|
+
actions?: Record<string, string[]>;
|
|
16
|
+
};
|
|
17
|
+
export type Schema = {
|
|
18
|
+
doctype: string;
|
|
19
|
+
schema: List<AForm.SchemaTypes>;
|
|
20
|
+
};
|
|
21
|
+
export type InstallOptions = {
|
|
22
|
+
router?: Router;
|
|
23
|
+
components?: Record<string, Component>;
|
|
24
|
+
getMeta?: (doctype?: string) => DoctypeMeta | Promise<DoctypeMeta>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAEpD,OAAO,KAAK,MAAM,kBAAkB,CAAA;AAEpC,OAAO,WAAW,MAAM,WAAW,CAAA;AAEnC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAEvC,MAAM,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAChC,QAAQ,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;IAC7C,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAC/B,CAAC,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG;IAE5B,MAAM,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAClE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.47.0"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DoctypeMeta from '@/doctype';
|
|
2
|
+
import { ImmutableDoctype } from '@/types';
|
|
3
|
+
import { InstallOptions } from '@/types';
|
|
4
|
+
import { MutableDoctype } from '@/types';
|
|
5
|
+
import Registry from '@/registry';
|
|
6
|
+
import { Schema } from '@/types';
|
|
7
|
+
import Stonecrop from '@/plugins';
|
|
8
|
+
import { useStonecrop } from '@/composable';
|
|
9
|
+
|
|
10
|
+
export { DoctypeMeta }
|
|
11
|
+
|
|
12
|
+
export { ImmutableDoctype }
|
|
13
|
+
|
|
14
|
+
export { InstallOptions }
|
|
15
|
+
|
|
16
|
+
export { MutableDoctype }
|
|
17
|
+
|
|
18
|
+
export { Registry }
|
|
19
|
+
|
|
20
|
+
export { Schema }
|
|
21
|
+
|
|
22
|
+
export { Stonecrop }
|
|
23
|
+
|
|
24
|
+
export { useStonecrop }
|
|
25
|
+
|
|
26
|
+
export { }
|