@nocobase/plugin-ui-schema-storage 0.7.0-alpha.0

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.
Files changed (117) hide show
  1. package/LICENSE +201 -0
  2. package/esm/actions/ui-schema-action.d.ts +16 -0
  3. package/esm/actions/ui-schema-action.js +100 -0
  4. package/esm/actions/ui-schema-action.js.map +1 -0
  5. package/esm/collections/uiSchemaServerHooks.d.ts +3 -0
  6. package/esm/collections/uiSchemaServerHooks.js +27 -0
  7. package/esm/collections/uiSchemaServerHooks.js.map +1 -0
  8. package/esm/collections/uiSchemaTemplates.d.ts +2 -0
  9. package/esm/collections/uiSchemaTemplates.js +39 -0
  10. package/esm/collections/uiSchemaTemplates.js.map +1 -0
  11. package/esm/collections/uiSchemaTreePath.d.ts +3 -0
  12. package/esm/collections/uiSchemaTreePath.js +42 -0
  13. package/esm/collections/uiSchemaTreePath.js.map +1 -0
  14. package/esm/collections/uiSchemas.d.ts +3 -0
  15. package/esm/collections/uiSchemas.js +32 -0
  16. package/esm/collections/uiSchemas.js.map +1 -0
  17. package/esm/dao/ui_schema_dao.d.ts +4 -0
  18. package/esm/dao/ui_schema_dao.js +6 -0
  19. package/esm/dao/ui_schema_dao.js.map +1 -0
  20. package/esm/dao/ui_schema_node_dao.d.ts +22 -0
  21. package/esm/dao/ui_schema_node_dao.js +6 -0
  22. package/esm/dao/ui_schema_node_dao.js.map +1 -0
  23. package/esm/helper.d.ts +0 -0
  24. package/esm/helper.js +1 -0
  25. package/esm/helper.js.map +1 -0
  26. package/esm/index.d.ts +3 -0
  27. package/esm/index.js +4 -0
  28. package/esm/index.js.map +1 -0
  29. package/esm/model.d.ts +6 -0
  30. package/esm/model.js +9 -0
  31. package/esm/model.js.map +1 -0
  32. package/esm/repository.d.ts +72 -0
  33. package/esm/repository.js +858 -0
  34. package/esm/repository.js.map +1 -0
  35. package/esm/server-hooks/hooks/bind-menu-to-role.d.ts +5 -0
  36. package/esm/server-hooks/hooks/bind-menu-to-role.js +26 -0
  37. package/esm/server-hooks/hooks/bind-menu-to-role.js.map +1 -0
  38. package/esm/server-hooks/hooks/factory.d.ts +6 -0
  39. package/esm/server-hooks/hooks/factory.js +8 -0
  40. package/esm/server-hooks/hooks/factory.js.map +1 -0
  41. package/esm/server-hooks/hooks/index.d.ts +6 -0
  42. package/esm/server-hooks/hooks/index.js +12 -0
  43. package/esm/server-hooks/hooks/index.js.map +1 -0
  44. package/esm/server-hooks/hooks/remove-parents-if-no-children.d.ts +6 -0
  45. package/esm/server-hooks/hooks/remove-parents-if-no-children.js +21 -0
  46. package/esm/server-hooks/hooks/remove-parents-if-no-children.js.map +1 -0
  47. package/esm/server-hooks/hooks/remove-schema.d.ts +6 -0
  48. package/esm/server-hooks/hooks/remove-schema.js +29 -0
  49. package/esm/server-hooks/hooks/remove-schema.js.map +1 -0
  50. package/esm/server-hooks/index.d.ts +23 -0
  51. package/esm/server-hooks/index.js +133 -0
  52. package/esm/server-hooks/index.js.map +1 -0
  53. package/esm/server-hooks/model.d.ts +3 -0
  54. package/esm/server-hooks/model.js +4 -0
  55. package/esm/server-hooks/model.js.map +1 -0
  56. package/esm/server.d.ts +10 -0
  57. package/esm/server.js +78 -0
  58. package/esm/server.js.map +1 -0
  59. package/lib/actions/ui-schema-action.d.ts +16 -0
  60. package/lib/actions/ui-schema-action.js +106 -0
  61. package/lib/actions/ui-schema-action.js.map +1 -0
  62. package/lib/collections/uiSchemaServerHooks.d.ts +3 -0
  63. package/lib/collections/uiSchemaServerHooks.js +29 -0
  64. package/lib/collections/uiSchemaServerHooks.js.map +1 -0
  65. package/lib/collections/uiSchemaTemplates.d.ts +2 -0
  66. package/lib/collections/uiSchemaTemplates.js +41 -0
  67. package/lib/collections/uiSchemaTemplates.js.map +1 -0
  68. package/lib/collections/uiSchemaTreePath.d.ts +3 -0
  69. package/lib/collections/uiSchemaTreePath.js +44 -0
  70. package/lib/collections/uiSchemaTreePath.js.map +1 -0
  71. package/lib/collections/uiSchemas.d.ts +3 -0
  72. package/lib/collections/uiSchemas.js +34 -0
  73. package/lib/collections/uiSchemas.js.map +1 -0
  74. package/lib/dao/ui_schema_dao.d.ts +4 -0
  75. package/lib/dao/ui_schema_dao.js +10 -0
  76. package/lib/dao/ui_schema_dao.js.map +1 -0
  77. package/lib/dao/ui_schema_node_dao.d.ts +22 -0
  78. package/lib/dao/ui_schema_node_dao.js +10 -0
  79. package/lib/dao/ui_schema_node_dao.js.map +1 -0
  80. package/lib/helper.d.ts +0 -0
  81. package/lib/helper.js +1 -0
  82. package/lib/helper.js.map +1 -0
  83. package/lib/index.d.ts +3 -0
  84. package/lib/index.js +21 -0
  85. package/lib/index.js.map +1 -0
  86. package/lib/model.d.ts +6 -0
  87. package/lib/model.js +12 -0
  88. package/lib/model.js.map +1 -0
  89. package/lib/repository.d.ts +72 -0
  90. package/lib/repository.js +865 -0
  91. package/lib/repository.js.map +1 -0
  92. package/lib/server-hooks/hooks/bind-menu-to-role.d.ts +5 -0
  93. package/lib/server-hooks/hooks/bind-menu-to-role.js +30 -0
  94. package/lib/server-hooks/hooks/bind-menu-to-role.js.map +1 -0
  95. package/lib/server-hooks/hooks/factory.d.ts +6 -0
  96. package/lib/server-hooks/hooks/factory.js +12 -0
  97. package/lib/server-hooks/hooks/factory.js.map +1 -0
  98. package/lib/server-hooks/hooks/index.d.ts +6 -0
  99. package/lib/server-hooks/hooks/index.js +15 -0
  100. package/lib/server-hooks/hooks/index.js.map +1 -0
  101. package/lib/server-hooks/hooks/remove-parents-if-no-children.d.ts +6 -0
  102. package/lib/server-hooks/hooks/remove-parents-if-no-children.js +25 -0
  103. package/lib/server-hooks/hooks/remove-parents-if-no-children.js.map +1 -0
  104. package/lib/server-hooks/hooks/remove-schema.d.ts +6 -0
  105. package/lib/server-hooks/hooks/remove-schema.js +33 -0
  106. package/lib/server-hooks/hooks/remove-schema.js.map +1 -0
  107. package/lib/server-hooks/index.d.ts +23 -0
  108. package/lib/server-hooks/index.js +137 -0
  109. package/lib/server-hooks/index.js.map +1 -0
  110. package/lib/server-hooks/model.d.ts +3 -0
  111. package/lib/server-hooks/model.js +8 -0
  112. package/lib/server-hooks/model.js.map +1 -0
  113. package/lib/server.d.ts +10 -0
  114. package/lib/server.js +85 -0
  115. package/lib/server.js.map +1 -0
  116. package/package.json +22 -0
  117. package/tsconfig.build.json +9 -0
@@ -0,0 +1,72 @@
1
+ import { Repository, TransactionAble } from '@nocobase/database';
2
+ import { Transaction } from 'sequelize';
3
+ import { ChildOptions, SchemaNode } from './dao/ui_schema_node_dao';
4
+ interface GetJsonSchemaOptions {
5
+ includeAsyncNode?: boolean;
6
+ transaction?: Transaction;
7
+ }
8
+ declare type BreakRemoveOnType = {
9
+ [key: string]: any;
10
+ };
11
+ export interface removeParentOptions extends TransactionAble {
12
+ removeParentsIfNoChildren?: boolean;
13
+ breakRemoveOn?: BreakRemoveOnType;
14
+ }
15
+ interface InsertAdjacentOptions extends removeParentOptions {
16
+ wrap?: any;
17
+ }
18
+ export declare class UiSchemaRepository extends Repository {
19
+ tableNameAdapter(tableName: any): any;
20
+ get uiSchemasTableName(): any;
21
+ get uiSchemaTreePathTableName(): any;
22
+ sqlAdapter(sql: string): string;
23
+ static schemaToSingleNodes(schema: any, carry?: SchemaNode[], childOptions?: ChildOptions): SchemaNode[];
24
+ getProperties(uid: string, options?: TransactionAble): Promise<Partial<{
25
+ "x-uid": any;
26
+ "x-async": boolean;
27
+ }>>;
28
+ getJsonSchema(uid: string, options?: GetJsonSchemaOptions): Promise<any>;
29
+ private ignoreSchemaProperties;
30
+ nodesToSchema(nodes: any, rootUid: any): {
31
+ "x-uid": any;
32
+ "x-async": boolean;
33
+ };
34
+ clearAncestor(uid: string, options?: TransactionAble): Promise<void>;
35
+ patch(newSchema: any, options?: any): Promise<void>;
36
+ updateNode(uid: string, schema: any, transaction?: Transaction): Promise<void>;
37
+ protected childrenCount(uid: any, transaction: any): Promise<number>;
38
+ protected isLeafNode(uid: any, transaction: any): Promise<boolean>;
39
+ findParentUid(uid: any, transaction?: any): Promise<string>;
40
+ protected findNodeSchemaWithParent(uid: any, transaction: any): Promise<{
41
+ parentUid: string;
42
+ schema: import("@nocobase/database").Model<any, any>;
43
+ }>;
44
+ protected isSingleChild(uid: any, transaction: any): Promise<import("@nocobase/database").Model<any, any>>;
45
+ removeEmptyParents(options: TransactionAble & {
46
+ uid: string;
47
+ breakRemoveOn?: BreakRemoveOnType;
48
+ }): Promise<void>;
49
+ private breakOnMatched;
50
+ recursivelyRemoveIfNoChildren(options: TransactionAble & {
51
+ uid: string;
52
+ breakRemoveOn?: BreakRemoveOnType;
53
+ }): Promise<void>;
54
+ remove(uid: string, options?: TransactionAble & removeParentOptions): Promise<void>;
55
+ insertBeside(targetUid: string, schema: any, side: 'before' | 'after', options?: InsertAdjacentOptions): Promise<any>;
56
+ insertInner(targetUid: string, schema: any, position: 'first' | 'last', options?: InsertAdjacentOptions): Promise<any>;
57
+ private schemaExists;
58
+ insertAdjacent(position: 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd', target: string, schema: any, options?: InsertAdjacentOptions): Promise<any>;
59
+ protected insertAfterBegin(targetUid: string, schema: any, options?: InsertAdjacentOptions): Promise<any>;
60
+ protected insertBeforeEnd(targetUid: string, schema: any, options?: InsertAdjacentOptions): Promise<any>;
61
+ protected insertBeforeBegin(targetUid: string, schema: any, options?: InsertAdjacentOptions): Promise<any>;
62
+ protected insertAfterEnd(targetUid: string, schema: any, options?: InsertAdjacentOptions): Promise<any>;
63
+ insertNodes(nodes: SchemaNode[], options?: TransactionAble): Promise<any[]>;
64
+ insert(schema: any, options?: TransactionAble): Promise<any>;
65
+ insertNewSchema(schema: any, options?: TransactionAble & {
66
+ returnNode?: boolean;
67
+ }): Promise<any>;
68
+ private insertSchemaRecord;
69
+ private prepareSingleNodeForInsert;
70
+ insertSingleNode(schema: SchemaNode, options: TransactionAble & removeParentOptions): Promise<any>;
71
+ }
72
+ export default UiSchemaRepository;