@skaldapp/shared 1.2.27 → 1.2.29

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.d.ts CHANGED
@@ -19,15 +19,13 @@ export type TPage = FromSchema<typeof Page> & {
19
19
  siblings: TPage[];
20
20
  to?: string;
21
21
  };
22
- export declare const fetching: (input: string) => Promise<any>, sharedStore: {
22
+ export declare const sharedStore: {
23
+ kvNodes: Record<string, TPage>;
24
+ nodes: TPage[];
23
25
  add: (pId: string) => string | undefined;
24
26
  addChild: (pId: string) => string | undefined;
25
27
  down: (pId: string) => string | undefined;
26
- kvNodes: {
27
- [k: string]: import("@skaldapp/flat-json-tree").unObject;
28
- } & Record<string, TPage>;
29
28
  left: (pId: string) => string | undefined;
30
- nodes: import("@skaldapp/flat-json-tree").unObject[] & TPage[];
31
29
  remove: (pId: string) => string | undefined;
32
30
  right: (pId: string) => string | undefined;
33
31
  up: (pId: string) => string | undefined;
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import useFlatJsonTree from "@skaldapp/flat-json-tree";
2
2
  import AJV from "ajv";
3
3
  import dynamicDefaults from "ajv-keywords/dist/definitions/dynamicDefaults.js";
4
- import { consola } from "consola/browser";
5
- import { ofetch } from "ofetch";
6
4
  import { generateSlug } from "random-word-slugs";
7
5
  import { reactive, ref, toRef, watch } from "vue";
8
6
  import Credential from "./schemas/credential.js";
@@ -16,7 +14,7 @@ const schemas = [Nodes, Page], ajv = new AJV({
16
14
  removeAdditional: true,
17
15
  schemas,
18
16
  useDefaults: true,
19
- }), immediate = true, nodes = "nodes", properties = {
17
+ }), immediate = true, properties = {
20
18
  $children: {
21
19
  get() {
22
20
  return this.children.filter(({ frontmatter: { hidden } }) => !hidden);
@@ -58,20 +56,15 @@ const schemas = [Nodes, Page], ajv = new AJV({
58
56
  return this.path?.replace(/^\/?/, "/").replace(/\/?$/, "/");
59
57
  },
60
58
  },
61
- }, tree = ref([]), validate = Object.fromEntries(schemas.map(({ $id }) => [$id, ajv.getSchema($id)]));
62
- export const fetching = async (input) => {
63
- try {
64
- return await ofetch(input);
65
- }
66
- catch (error) {
67
- consola.error(error);
68
- }
69
- }, sharedStore = reactive({
59
+ }, tree = ref([]), validate = Object.fromEntries(schemas.map(({ $id }) => [$id, ajv.getSchema($id)])), { kvNodes, nodes, ...flatJsonTree } = useFlatJsonTree(tree);
60
+ export const sharedStore = reactive({
70
61
  tree,
71
- ...useFlatJsonTree(tree),
62
+ ...flatJsonTree,
63
+ kvNodes: kvNodes,
64
+ nodes: nodes,
72
65
  });
73
- watch(toRef(sharedStore, nodes), async (value) => {
74
- if (!(await validate[nodes]?.(value)))
66
+ watch(toRef(sharedStore, "nodes"), async (value) => {
67
+ if (!(await validate["nodes"]?.(value)))
75
68
  tree.value = [{}];
76
69
  else
77
70
  value.forEach((element) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package",
3
3
  "name": "@skaldapp/shared",
4
- "version": "1.2.27",
4
+ "version": "1.2.29",
5
5
  "description": "A TypeScript library providing reactive data structures, JSON schema validation, and tree utilities for Vue-based applications in the skald ecosystem.",
6
6
  "keywords": [
7
7
  "vue",
@@ -33,17 +33,15 @@
33
33
  },
34
34
  "prettier": "@skaldapp/configs/prettierrc",
35
35
  "dependencies": {
36
- "@skaldapp/flat-json-tree": "^2.2.18",
36
+ "@skaldapp/flat-json-tree": "^2.2.20",
37
37
  "ajv": "^8.17.1",
38
38
  "ajv-keywords": "^5.1.0",
39
- "consola": "^3.4.2",
40
39
  "json-schema-to-ts": "^3.1.1",
41
- "ofetch": "^1.5.1",
42
40
  "random-word-slugs": "^0.1.7",
43
41
  "vue": "^3.5.26"
44
42
  },
45
43
  "devDependencies": {
46
- "@skaldapp/configs": "^1.2.43",
44
+ "@skaldapp/configs": "^1.2.45",
47
45
  "eslint": "^9.39.2"
48
46
  }
49
47
  }