@ldsg/forms 0.3.31 → 0.3.33

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 (46) hide show
  1. package/dist/constants.d.ts +3 -3
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +9 -9
  4. package/dist/handler.d.ts +4 -4
  5. package/dist/index.d.ts +5 -5
  6. package/dist/instantiate-resource.d.ts +4 -4
  7. package/dist/instantiate-resource.js +1 -1
  8. package/dist/resource.d.ts +4 -4
  9. package/dist/resource.d.ts.map +1 -1
  10. package/dist/resource.js +8 -6
  11. package/dist/test/__tests__/unit.js +163 -163
  12. package/dist/types/get-form-info.d.ts +3 -3
  13. package/dist/types/index.d.ts +3 -3
  14. package/dist/types/query-types.d.ts +3 -3
  15. package/dist/types/specific-resource-settings.d.ts +1 -1
  16. package/dist/utils/add-query-fields/index.d.ts +2 -2
  17. package/dist/utils/add-query-fields/index.js +1 -1
  18. package/dist/utils/add-query-fields/utils/create-resolvers.d.ts +1 -1
  19. package/dist/utils/add-query-fields/utils/create-resolvers.js +7 -7
  20. package/dist/utils/add-query-fields/utils/create-types.d.ts +1 -1
  21. package/dist/utils/add-query-fields/utils/create-types.js +41 -41
  22. package/dist/utils/add-query-fields/utils/get-json-schema.d.ts +1 -1
  23. package/dist/utils/add-query-fields/utils/get-json-schema.js +13 -13
  24. package/dist/utils/add-query-fields/utils/get-schema-for-formily/constants.d.ts +1 -1
  25. package/dist/utils/add-query-fields/utils/get-schema-for-formily/constants.js +12 -12
  26. package/dist/utils/add-query-fields/utils/get-schema-for-formily/index.d.ts +1 -1
  27. package/dist/utils/add-query-fields/utils/get-schema-for-formily/index.js +2 -2
  28. package/dist/utils/add-query-fields/utils/get-schema-for-formily/utils/process-object-schema.d.ts +1 -1
  29. package/dist/utils/add-query-fields/utils/get-schema-for-formily/utils/process-object-schema.js +6 -6
  30. package/dist/utils/add-query-fields/utils/map-form-info.d.ts +2 -2
  31. package/dist/utils/add-query-fields/utils/map-form-info.d.ts.map +1 -1
  32. package/dist/utils/add-query-fields/utils/map-form-info.js +4 -4
  33. package/dist/utils/handle-form-info-list/index.d.ts +2 -2
  34. package/dist/utils/handle-form-info-list/index.js +2 -2
  35. package/dist/utils/handle-form-info-list/utils/get-field-config-map-definition.d.ts +1 -1
  36. package/dist/utils/handle-form-info-list/utils/get-field-config-map-definition.js +3 -3
  37. package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-common-type.d.ts.map +1 -1
  38. package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-common-type.js +3 -3
  39. package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-type-info.d.ts +1 -1
  40. package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-type-info.d.ts.map +1 -1
  41. package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-type-info.js +2 -2
  42. package/dist/utils/handle-form-info-list/utils/get-input-itc.d.ts +3 -3
  43. package/dist/utils/handle-form-info-list/utils/get-input-itc.js +6 -6
  44. package/dist/utils/handle-form-info-list/utils/get-output-otc.d.ts +3 -3
  45. package/dist/utils/handle-form-info-list/utils/get-output-otc.js +6 -6
  46. package/package.json +21 -16
@@ -1,6 +1,6 @@
1
- import { HandlerSpecificResourceSettings } from '@ldsg/handler';
2
- import { ResourceDefinitionSpecificResourceSettings } from '@ldsg/resource-definition';
3
- import { GeneralResourceSettings } from '@ldsg/types';
1
+ import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
+ import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
3
+ import { GeneralResourceSettings } from "@ldsg/types";
4
4
  /**
5
5
  * Instantiate Resource Handler General Resource Settings
6
6
  * 实例化资源处理程序普通资源配置
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAOrE,CAAC;AAEF,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAE5D,CAAC;AAEF,eAAO,MAAM,WAAW,WAAW,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAG1D,CAAC;AAEJ,eAAO,MAAM,WAAW,WAAW,CAAC"}
package/dist/constants.js CHANGED
@@ -6,8 +6,8 @@ exports.FORMS_ROUTE = exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = e
6
6
  * 实例化资源处理程序普通资源配置
7
7
  */
8
8
  exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
9
- title: '表单组实例化资源处理程序',
10
- description: ''
9
+ title: "表单组实例化资源处理程序",
10
+ description: "",
11
11
  };
12
12
  /**
13
13
  * Instantiate Resource Handler Specific Resource Settings
@@ -18,15 +18,15 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
18
18
  code: `export * from "@ldsg/forms";`,
19
19
  dependencies: [
20
20
  {
21
- name: '@ldsg/forms'
22
- }
23
- ]
21
+ name: "@ldsg/forms",
22
+ },
23
+ ],
24
24
  };
25
25
  exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
26
- title: '表单组资源定义',
27
- description: ''
26
+ title: "表单组资源定义",
27
+ description: "",
28
28
  };
29
29
  exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
30
- kind: 'forms'
30
+ kind: "forms",
31
31
  };
32
- exports.FORMS_ROUTE = '/forms';
32
+ exports.FORMS_ROUTE = "/forms";
package/dist/handler.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Handler, HandlerExtendedResourceSettings } from '@ldsg/handler';
2
- import { InstantiateResourceParams, InstantiateResourceRes } from '@ldsg/resource';
3
- import { FormsResource } from './resource';
4
- import { FormsSpecificResourceSettings } from './types';
1
+ import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
2
+ import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
3
+ import { FormsResource } from "./resource";
4
+ import { FormsSpecificResourceSettings } from "./types";
5
5
  export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<FormsSpecificResourceSettings>>, InstantiateResourceRes<FormsResource>>;
6
6
  //# sourceMappingURL=handler.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from './constants';
2
- export * from './handler';
3
- export * from './instantiate-resource';
4
- export * from './resource';
5
- export * from './types';
1
+ export * from "./constants";
2
+ export * from "./handler";
3
+ export * from "./instantiate-resource";
4
+ export * from "./resource";
5
+ export * from "./types";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- import { HandlerExtendedResourceSettings } from '@ldsg/handler';
2
- import { InstantiateResource } from '@ldsg/resource';
3
- import { FormsResource } from './resource';
4
- import { FormsSpecificResourceSettings } from './types';
1
+ import { HandlerExtendedResourceSettings } from "@ldsg/handler";
2
+ import { InstantiateResource } from "@ldsg/resource";
3
+ import { FormsResource } from "./resource";
4
+ import { FormsSpecificResourceSettings } from "./types";
5
5
  export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<FormsSpecificResourceSettings>, FormsResource>;
6
6
  //# sourceMappingURL=instantiate-resource.d.ts.map
@@ -6,7 +6,7 @@ const instantiateResource = (params) => {
6
6
  const { resourceConstructorParams } = params;
7
7
  const resource = new resource_1.FormsResource(resourceConstructorParams);
8
8
  const res = {
9
- resource
9
+ resource,
10
10
  };
11
11
  return res;
12
12
  };
@@ -1,7 +1,7 @@
1
- import { PlatformsParams } from '@ldsg/field-type';
2
- import { ModifyGraphQLSchema } from '@ldsg/graphql';
3
- import { Resource } from '@ldsg/resource';
4
- import { FormInfo, FormsSpecificResourceSettings } from './types';
1
+ import { PlatformsParams } from "@ldsg/field-type";
2
+ import { ModifyGraphQLSchema } from "@ldsg/graphql";
3
+ import { Resource } from "@ldsg/resource";
4
+ import { FormInfo, FormsSpecificResourceSettings } from "./types";
5
5
  interface GetFormInfoListRes {
6
6
  /**
7
7
  * Form Info List
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,6BAA6B,EAAe,MAAM,SAAS,CAAC;AAG/E,UAAU,kBAAkB;IAC1B;;OAEG;IACH,YAAY,EAAE,QAAQ,EAAE,CAAC;CAC1B;AAED,KAAK,eAAe,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,kBAAkB,CAAC;AAExE,qBAAa,aAAc,SAAQ,QAAQ,CAAC,6BAA6B,CAAC;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAE1B,eAAe,EAAE,eAAe,CA4B9B;IAEF,mBAAmB,EAAE,mBAAmB,CAStC;CACH"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,6BAA6B,EAAe,MAAM,SAAS,CAAC;AAG/E,UAAU,kBAAkB;IAC1B;;OAEG;IACH,YAAY,EAAE,QAAQ,EAAE,CAAC;CAC1B;AAED,KAAK,eAAe,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,kBAAkB,CAAC;AAExE,qBAAa,aAAc,SAAQ,QAAQ,CAAC,6BAA6B,CAAC;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAE1B,eAAe,EAAE,eAAe,CA6B9B;IAEF,mBAAmB,EAAE,mBAAmB,CAStC;CACH"}
package/dist/resource.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FormsResource = void 0;
7
+ const apaas_constants_1 = require("@ldsg/apaas-constants");
7
8
  const resource_1 = require("@ldsg/resource");
8
9
  const lodash_1 = __importDefault(require("lodash"));
9
10
  const handle_form_info_list_1 = require("./utils/handle-form-info-list");
@@ -14,19 +15,20 @@ class FormsResource extends resource_1.Resource {
14
15
  const { id, formInfoList: thisFormInfoList, getFilteredResources } = this;
15
16
  let formInfoList = thisFormInfoList;
16
17
  if (!formInfoList) {
17
- const { resources } = getFilteredResources({
18
- parentId: id
18
+ const { resources: formResources } = getFilteredResources({
19
+ kind: apaas_constants_1.ApaasResourceKind.FORM,
20
+ parentId: id,
19
21
  });
20
- const mapRes = resources.map((resource) => {
22
+ const mapRes = formResources.map((formResource) => {
21
23
  var _a;
22
- return (_a = resource.getFormInfo) === null || _a === void 0 ? void 0 : _a.call(resource, params);
24
+ return (_a = formResource.getFormInfo) === null || _a === void 0 ? void 0 : _a.call(formResource, params);
23
25
  });
24
26
  const filterRes = lodash_1.default.filter(mapRes, (value) => !lodash_1.default.isUndefined(value));
25
27
  formInfoList = filterRes;
26
28
  this.formInfoList = formInfoList;
27
29
  }
28
30
  const res = {
29
- formInfoList
31
+ formInfoList,
30
32
  };
31
33
  return res;
32
34
  };
@@ -35,7 +37,7 @@ class FormsResource extends resource_1.Resource {
35
37
  const { formInfoList } = this.getFormInfoList();
36
38
  (0, handle_form_info_list_1.handleFormInfoList)({
37
39
  formInfoList,
38
- schemaComposer
40
+ schemaComposer,
39
41
  });
40
42
  };
41
43
  }
@@ -13,7 +13,7 @@ class MockFormResource extends resource_1.Resource {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  this.getFormInfo = (params) => {
16
- const { id, settings: { title, description, name }, getResourcesFromSettings } = this;
16
+ const { id, settings: { title, description, name }, getResourcesFromSettings, } = this;
17
17
  const { inputObjectResource, outputObjectResource } = getResourcesFromSettings();
18
18
  const { objectInfo: inputObjectInfo } = inputObjectResource.getObjectInfo(params);
19
19
  const { objectInfo: outputObjectInfo } = outputObjectResource.getObjectInfo(params);
@@ -23,156 +23,156 @@ class MockFormResource extends resource_1.Resource {
23
23
  description,
24
24
  name,
25
25
  inputObjectInfo,
26
- outputObjectInfo
26
+ outputObjectInfo,
27
27
  };
28
28
  return res;
29
29
  };
30
30
  }
31
31
  }
32
- test('forms', () => {
32
+ test("forms", () => {
33
33
  const graphqlResource = new graphql_1.GraphqlResource({
34
- id: 'test-graphql',
35
- kind: 'graphql',
36
- parentId: 'test-application',
34
+ id: "test-graphql",
35
+ kind: "graphql",
36
+ parentId: "test-application",
37
37
  settings: {
38
- title: '测试GraphQL',
39
- description: '',
40
- code: '',
41
- dependencies: []
42
- }
38
+ title: "测试GraphQL",
39
+ description: "",
40
+ code: "",
41
+ dependencies: [],
42
+ },
43
43
  });
44
44
  new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
45
45
  new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
46
46
  new object_field_1.ObjectFieldResource({
47
- id: 'test-object-1-field-1',
48
- kind: 'object_field',
49
- parentId: 'test-object-1',
47
+ id: "test-object-1-field-1",
48
+ kind: "object_field",
49
+ parentId: "test-object-1",
50
50
  settings: {
51
- title: '测试对象1测试字段1',
52
- description: '',
53
- name: 'test-1',
51
+ title: "测试对象1测试字段1",
52
+ description: "",
53
+ slug: "test-1",
54
54
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
55
55
  properties: {
56
- max: '10'
57
- }
58
- }
56
+ max: "10",
57
+ },
58
+ },
59
59
  });
60
60
  new object_field_1.ObjectFieldResource({
61
- id: 'test-object-1-field-2',
62
- kind: 'object_field',
63
- parentId: 'test-object-1',
61
+ id: "test-object-1-field-2",
62
+ kind: "object_field",
63
+ parentId: "test-object-1",
64
64
  settings: {
65
- title: '测试对象1测试字段2',
66
- description: '',
67
- name: 'test-2',
65
+ title: "测试对象1测试字段2",
66
+ description: "",
67
+ slug: "test-2",
68
68
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
69
69
  properties: {
70
- max: '10'
71
- }
72
- }
70
+ max: "10",
71
+ },
72
+ },
73
73
  });
74
74
  new object_field_1.ObjectFieldResource({
75
- id: 'test-object-1-field-3',
76
- kind: 'object_field',
77
- parentId: 'test-object-1',
75
+ id: "test-object-1-field-3",
76
+ kind: "object_field",
77
+ parentId: "test-object-1",
78
78
  settings: {
79
- title: '测试对象1测试字段3',
80
- description: '',
81
- name: 'test-3',
79
+ title: "测试对象1测试字段3",
80
+ description: "",
81
+ slug: "test-3",
82
82
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
83
83
  properties: {
84
- max: '10'
85
- }
86
- }
84
+ max: "10",
85
+ },
86
+ },
87
87
  });
88
88
  new object_1.ObjectResource({
89
- id: 'test-object-1',
90
- kind: 'object',
91
- parentId: 'root',
89
+ id: "test-object-1",
90
+ kind: "object",
91
+ parentId: "root",
92
92
  settings: {
93
- title: '测试对象1',
94
- description: '',
95
- name: 'test-object-1'
96
- }
93
+ title: "测试对象1",
94
+ description: "",
95
+ slug: "test-object-1",
96
+ },
97
97
  });
98
98
  new object_field_1.ObjectFieldResource({
99
- id: 'test-object-2-field-1',
100
- kind: 'object_field',
101
- parentId: 'test-object-2',
99
+ id: "test-object-2-field-1",
100
+ kind: "object_field",
101
+ parentId: "test-object-2",
102
102
  settings: {
103
- title: '测试对象2测试字段1',
104
- description: '',
105
- name: 'test-1',
103
+ title: "测试对象2测试字段1",
104
+ description: "",
105
+ slug: "test-1",
106
106
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
107
107
  properties: {
108
- max: '10'
109
- }
110
- }
108
+ max: "10",
109
+ },
110
+ },
111
111
  });
112
112
  new object_1.ObjectResource({
113
- id: 'test-object-2',
114
- kind: 'object',
115
- parentId: 'root',
113
+ id: "test-object-2",
114
+ kind: "object",
115
+ parentId: "root",
116
116
  settings: {
117
- title: '测试对象2',
118
- description: '',
119
- name: 'test-object-2'
120
- }
117
+ title: "测试对象2",
118
+ description: "",
119
+ slug: "test-object-2",
120
+ },
121
121
  });
122
122
  const formsResource = new resource_2.FormsResource({
123
- id: 'test-forms',
124
- kind: 'form',
125
- parentId: 'test-application',
123
+ id: "test-forms",
124
+ kind: "form",
125
+ parentId: "test-application",
126
126
  settings: {
127
- title: '测试表单组',
128
- description: ''
129
- }
127
+ title: "测试表单组",
128
+ description: "",
129
+ },
130
130
  });
131
131
  new workflow_1.WorkflowResource({
132
- id: 'test-workflow-1',
133
- kind: 'workflow',
134
- parentId: 'root',
132
+ id: "test-workflow-1",
133
+ kind: "workflow",
134
+ parentId: "root",
135
135
  settings: {
136
- title: '测试工作流1',
137
- description: '',
138
- startWorkflowNodeResourceId: '',
139
- endWorkflowNodeResourceId: ''
140
- }
136
+ title: "测试工作流1",
137
+ description: "",
138
+ startWorkflowNodeResourceId: "",
139
+ endWorkflowNodeResourceId: "",
140
+ },
141
141
  });
142
142
  new workflow_1.WorkflowResource({
143
- id: 'test-workflow-2',
144
- kind: 'workflow',
145
- parentId: 'root',
143
+ id: "test-workflow-2",
144
+ kind: "workflow",
145
+ parentId: "root",
146
146
  settings: {
147
- title: '测试工作流2',
148
- description: '',
149
- startWorkflowNodeResourceId: '',
150
- endWorkflowNodeResourceId: ''
151
- }
147
+ title: "测试工作流2",
148
+ description: "",
149
+ startWorkflowNodeResourceId: "",
150
+ endWorkflowNodeResourceId: "",
151
+ },
152
152
  });
153
153
  new MockFormResource({
154
- id: 'test-form-1',
155
- kind: 'form',
156
- parentId: 'test-forms',
154
+ id: "test-form-1",
155
+ kind: "form",
156
+ parentId: "test-forms",
157
157
  settings: {
158
- title: '测试表单1',
159
- description: '',
160
- name: 'test-a-1',
161
- inputObjectResourceId: 'test-object-1',
162
- outputObjectResourceId: 'test-object-2'
163
- }
158
+ title: "测试表单1",
159
+ description: "",
160
+ name: "test-a-1",
161
+ inputObjectResourceId: "test-object-1",
162
+ outputObjectResourceId: "test-object-2",
163
+ },
164
164
  });
165
165
  new MockFormResource({
166
- id: 'test-form-2',
167
- kind: 'form',
168
- parentId: 'test-forms',
166
+ id: "test-form-2",
167
+ kind: "form",
168
+ parentId: "test-forms",
169
169
  settings: {
170
- title: '测试表单2',
171
- description: '',
172
- name: 'test-a-2',
173
- inputObjectResourceId: 'test-object-2',
174
- outputObjectResourceId: 'test-object-1'
175
- }
170
+ title: "测试表单2",
171
+ description: "",
172
+ name: "test-a-2",
173
+ inputObjectResourceId: "test-object-2",
174
+ outputObjectResourceId: "test-object-1",
175
+ },
176
176
  });
177
177
  const getFormInfoListRes = formsResource.getFormInfoList();
178
178
  expect(getFormInfoListRes).toMatchSnapshot();
@@ -180,101 +180,101 @@ test('forms', () => {
180
180
  const schemaDSL = (0, graphql_2.printSchema)(schema);
181
181
  expect(schemaDSL).toMatchSnapshot();
182
182
  });
183
- test('form and forms query fields', () => {
183
+ test("form and forms query fields", () => {
184
184
  const graphqlResource = new graphql_1.GraphqlResource({
185
- id: 'test-graphql',
186
- kind: 'graphql',
187
- parentId: 'test-application',
185
+ id: "test-graphql",
186
+ kind: "graphql",
187
+ parentId: "test-application",
188
188
  settings: {
189
- title: '测试GraphQL',
190
- description: '',
191
- code: '',
192
- dependencies: []
193
- }
189
+ title: "测试GraphQL",
190
+ description: "",
191
+ code: "",
192
+ dependencies: [],
193
+ },
194
194
  });
195
195
  new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
196
196
  new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
197
197
  new object_field_1.ObjectFieldResource({
198
- id: 'test-object-1-field-1',
199
- kind: 'object_field',
200
- parentId: 'test-object-1',
198
+ id: "test-object-1-field-1",
199
+ kind: "object_field",
200
+ parentId: "test-object-1",
201
201
  settings: {
202
- title: '测试对象字段',
203
- description: '',
204
- name: 'test_field_1',
202
+ title: "测试对象字段",
203
+ description: "",
204
+ slug: "test_field_1",
205
205
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
206
206
  properties: {
207
- max: '10'
208
- }
209
- }
207
+ max: "10",
208
+ },
209
+ },
210
210
  });
211
211
  new object_1.ObjectResource({
212
- id: 'test-object-1',
213
- kind: 'object',
214
- parentId: 'test-application',
212
+ id: "test-object-1",
213
+ kind: "object",
214
+ parentId: "test-application",
215
215
  settings: {
216
- title: '测试对象1',
217
- description: '',
218
- name: 'test_object_1',
219
- fields: ['test-object-1-field-1']
220
- }
216
+ title: "测试对象1",
217
+ description: "",
218
+ slug: "test_object_1",
219
+ fields: ["test-object-1-field-1"],
220
+ },
221
221
  });
222
222
  new object_1.ObjectResource({
223
- id: 'test-object-2',
224
- kind: 'object',
225
- parentId: 'test-application',
223
+ id: "test-object-2",
224
+ kind: "object",
225
+ parentId: "test-application",
226
226
  settings: {
227
- title: '测试对象2',
228
- description: '',
229
- name: 'test_object_2',
230
- fields: []
231
- }
227
+ title: "测试对象2",
228
+ description: "",
229
+ slug: "test_object_2",
230
+ fields: [],
231
+ },
232
232
  });
233
233
  const formsResource = new resource_2.FormsResource({
234
- id: 'test-forms',
235
- kind: 'forms',
236
- parentId: 'test-application',
234
+ id: "test-forms",
235
+ kind: "forms",
236
+ parentId: "test-application",
237
237
  settings: {
238
- title: '测试表单',
239
- description: ''
240
- }
238
+ title: "测试表单",
239
+ description: "",
240
+ },
241
241
  });
242
242
  new MockFormResource({
243
- id: 'test-form-1',
244
- kind: 'form',
245
- parentId: 'test-forms',
243
+ id: "test-form-1",
244
+ kind: "form",
245
+ parentId: "test-forms",
246
246
  settings: {
247
- title: '测试表单1',
248
- description: 'Test Form 1',
249
- name: 'test-a-1',
250
- inputObjectResourceId: 'test-object-1',
251
- outputObjectResourceId: 'test-object-2'
252
- }
247
+ title: "测试表单1",
248
+ description: "Test Form 1",
249
+ name: "test-a-1",
250
+ inputObjectResourceId: "test-object-1",
251
+ outputObjectResourceId: "test-object-2",
252
+ },
253
253
  });
254
254
  new MockFormResource({
255
- id: 'test-form-2',
256
- kind: 'form',
257
- parentId: 'test-forms',
255
+ id: "test-form-2",
256
+ kind: "form",
257
+ parentId: "test-forms",
258
258
  settings: {
259
- title: '测试表单2',
260
- description: 'Test Form 2',
261
- name: 'test-a-2',
262
- inputObjectResourceId: 'test-object-2',
263
- outputObjectResourceId: 'test-object-1'
264
- }
259
+ title: "测试表单2",
260
+ description: "Test Form 2",
261
+ name: "test-a-2",
262
+ inputObjectResourceId: "test-object-2",
263
+ outputObjectResourceId: "test-object-1",
264
+ },
265
265
  });
266
266
  const { schema } = graphqlResource.getGraphQLSchema();
267
267
  const queryType = schema.getQueryType();
268
268
  expect(queryType).toBeDefined();
269
- const formField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()['form'];
269
+ const formField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()["form"];
270
270
  expect(formField).toBeDefined();
271
- const formsField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()['forms'];
271
+ const formsField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()["forms"];
272
272
  expect(formsField).toBeDefined();
273
273
  const mutationType = schema.getMutationType();
274
274
  expect(mutationType).toBeDefined();
275
275
  // Individual form mutations should still exist
276
- const testA1Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()['testA1'];
276
+ const testA1Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()["testA1"];
277
277
  expect(testA1Field).toBeDefined();
278
- const testA2Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()['testA2'];
278
+ const testA2Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()["testA2"];
279
279
  expect(testA2Field).toBeDefined();
280
280
  });
@@ -1,6 +1,6 @@
1
- import { PlatformsParams } from '@ldsg/field-type';
2
- import { ObjectInfo } from '@ldsg/object';
3
- import { GeneralResourceSettings } from '@ldsg/types';
1
+ import { PlatformsParams } from "@ldsg/field-type";
2
+ import { ObjectInfo } from "@ldsg/object";
3
+ import { GeneralResourceSettings } from "@ldsg/types";
4
4
  export interface FormInfo extends GeneralResourceSettings {
5
5
  /**
6
6
  * Form ID
@@ -1,4 +1,4 @@
1
- export * from './get-form-info';
2
- export * from './query-types';
3
- export * from './specific-resource-settings';
1
+ export * from "./get-form-info";
2
+ export * from "./query-types";
3
+ export * from "./specific-resource-settings";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,12 @@
1
- import { ObjectInfo } from '@ldsg/object';
1
+ import { ObjectInfo } from "@ldsg/object";
2
2
  /**
3
3
  * Extended ObjectInfo with JSON schemas for form queries
4
4
  */
5
- export interface FormObjectInfo extends Omit<ObjectInfo, 'fieldInfoList'> {
5
+ export interface FormObjectInfo extends Omit<ObjectInfo, "fieldInfoList"> {
6
6
  /**
7
7
  * List of field information
8
8
  */
9
- fieldInfoList?: ObjectInfo['fieldInfoList'];
9
+ fieldInfoList?: ObjectInfo["fieldInfoList"];
10
10
  /**
11
11
  * JSON Schema for the object
12
12
  */
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
  export declare const FormsSpecificResourceSettingsSchema: z.ZodObject<{}, z.core.$catchall<z.ZodAny>>;
3
3
  export declare const SpecificResourceSettingsSchema: z.ZodObject<{}, z.core.$catchall<z.ZodAny>>;
4
4
  export type FormsSpecificResourceSettings = z.infer<typeof FormsSpecificResourceSettingsSchema>;