@ldsg/tables 0.3.30 → 0.3.32

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 (31) hide show
  1. package/dist/constants.d.ts +3 -3
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +8 -8
  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 +5 -5
  9. package/dist/resource.js +4 -4
  10. package/dist/types/get-table-info.d.ts +3 -3
  11. package/dist/types/index.d.ts +3 -3
  12. package/dist/types/query-types.d.ts +1 -1
  13. package/dist/types/specific-resource-settings.d.ts +1 -1
  14. package/dist/utils/add-query-fields/index.d.ts +2 -2
  15. package/dist/utils/add-query-fields/index.js +1 -1
  16. package/dist/utils/add-query-fields/utils/create-resolvers.d.ts +1 -1
  17. package/dist/utils/add-query-fields/utils/create-resolvers.js +7 -7
  18. package/dist/utils/add-query-fields/utils/create-types.d.ts +1 -1
  19. package/dist/utils/add-query-fields/utils/create-types.d.ts.map +1 -1
  20. package/dist/utils/add-query-fields/utils/create-types.js +40 -40
  21. package/dist/utils/add-query-fields/utils/get-json-schema.d.ts +1 -1
  22. package/dist/utils/add-query-fields/utils/get-json-schema.js +10 -10
  23. package/dist/utils/add-query-fields/utils/map-table-info.d.ts +2 -2
  24. package/dist/utils/add-query-fields/utils/map-table-info.js +3 -3
  25. package/dist/utils/handle-table-info-list/index.d.ts +3 -3
  26. package/dist/utils/handle-table-info-list/index.js +2 -2
  27. package/dist/utils/handle-table-info-list/utils/get-object-type-composer.d.ts +4 -4
  28. package/dist/utils/handle-table-info-list/utils/get-object-type-composer.d.ts.map +1 -1
  29. package/dist/utils/handle-table-info-list/utils/get-object-type-composer.js +22 -22
  30. package/dist/utils/handle-table-info-list/utils/index.d.ts +1 -1
  31. package/package.json +18 -14
@@ -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"}
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"}
package/dist/constants.js CHANGED
@@ -6,8 +6,8 @@ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINI
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,14 +18,14 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
18
18
  code: `export * from "@ldsg/tables";`,
19
19
  dependencies: [
20
20
  {
21
- name: '@ldsg/tables'
22
- }
23
- ]
21
+ name: "@ldsg/tables",
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: 'tables'
30
+ kind: "tables",
31
31
  };
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 { TablesResource } from './resource';
4
- import { TablesSpecificResourceSettings } from './types';
1
+ import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
2
+ import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
3
+ import { TablesResource } from "./resource";
4
+ import { TablesSpecificResourceSettings } from "./types";
5
5
  export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<TablesSpecificResourceSettings>>, InstantiateResourceRes<TablesResource>>;
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 { TablesResource } from './resource';
4
- import { TablesSpecificResourceSettings } from './types';
1
+ import { HandlerExtendedResourceSettings } from "@ldsg/handler";
2
+ import { InstantiateResource } from "@ldsg/resource";
3
+ import { TablesResource } from "./resource";
4
+ import { TablesSpecificResourceSettings } from "./types";
5
5
  export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<TablesSpecificResourceSettings>, TablesResource>;
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.TablesResource(resourceConstructorParams);
8
8
  const res = {
9
- resource
9
+ resource,
10
10
  };
11
11
  return res;
12
12
  };
@@ -1,8 +1,8 @@
1
- import { PlatformsParams } from '@ldsg/field-type';
2
- import { ModifyGraphQLSchema } from '@ldsg/graphql';
3
- import { Resource } from '@ldsg/resource';
4
- import { TableInfo, TablesSpecificResourceSettings } from './types';
5
- import { MongooseModels } from './utils/handle-table-info-list';
1
+ import { PlatformsParams } from "@ldsg/field-type";
2
+ import { ModifyGraphQLSchema } from "@ldsg/graphql";
3
+ import { Resource } from "@ldsg/resource";
4
+ import { TableInfo, TablesSpecificResourceSettings } from "./types";
5
+ import { MongooseModels } from "./utils/handle-table-info-list";
6
6
  interface GetTableInfoListRes {
7
7
  /**
8
8
  * Table Info List
package/dist/resource.js CHANGED
@@ -14,7 +14,7 @@ class TablesResource extends resource_1.Resource {
14
14
  this.getTableInfoList = (params) => {
15
15
  const { id, getFilteredResources } = this;
16
16
  const { resources } = getFilteredResources({
17
- parentId: id
17
+ parentId: id,
18
18
  });
19
19
  const mapRes = resources.map((resource) => {
20
20
  var _a;
@@ -22,7 +22,7 @@ class TablesResource extends resource_1.Resource {
22
22
  });
23
23
  const tableInfoList = lodash_1.default.filter(mapRes, (value) => !lodash_1.default.isUndefined(value));
24
24
  const res = {
25
- tableInfoList
25
+ tableInfoList,
26
26
  };
27
27
  return res;
28
28
  };
@@ -31,12 +31,12 @@ class TablesResource extends resource_1.Resource {
31
31
  const { tableInfoList } = this.getTableInfoList();
32
32
  const { mongooseModels } = (0, handle_table_info_list_1.handleTableInfoList)({
33
33
  tableInfoList,
34
- schemaComposer
34
+ schemaComposer,
35
35
  });
36
36
  this.mongooseModels = mongooseModels;
37
37
  (0, add_query_fields_1.addQueryFields)({
38
38
  tableInfoList,
39
- schemaComposer
39
+ schemaComposer,
40
40
  });
41
41
  };
42
42
  }
@@ -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 TableInfo extends GeneralResourceSettings {
5
5
  /**
6
6
  * Table Name
@@ -1,4 +1,4 @@
1
- export * from './get-table-info';
2
- export * from './query-types';
3
- export * from './specific-resource-settings';
1
+ export * from "./get-table-info";
2
+ export * from "./query-types";
3
+ export * from "./specific-resource-settings";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { FieldInfo } from '@ldsg/object';
1
+ import { FieldInfo } from "@ldsg/object";
2
2
  /**
3
3
  * Object information with generated schemas
4
4
  */
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
  export declare const TablesSpecificResourceSettingsSchema: z.ZodObject<{}, z.core.$catchall<z.ZodAny>>;
3
3
  export declare const SpecificResourceSettingsSchema: z.ZodObject<{}, z.core.$catchall<z.ZodAny>>;
4
4
  export type TablesSpecificResourceSettings = z.infer<typeof TablesSpecificResourceSettingsSchema>;
@@ -1,5 +1,5 @@
1
- import { SchemaComposerParams } from '@ldsg/graphql';
2
- import { TableInfo } from '../../types';
1
+ import { SchemaComposerParams } from "@ldsg/graphql";
2
+ import { TableInfo } from "../../types";
3
3
  export interface AddQueryFieldsParams extends SchemaComposerParams {
4
4
  tableInfoList: TableInfo[];
5
5
  }
@@ -21,6 +21,6 @@ function addQueryFields(params) {
21
21
  // Add fields to Query type
22
22
  Query.addFields({
23
23
  table: tableResolver,
24
- tables: tablesResolver
24
+ tables: tablesResolver,
25
25
  });
26
26
  }
@@ -1,4 +1,4 @@
1
- import { TableInfo } from '../../../types';
1
+ import { TableInfo } from "../../../types";
2
2
  /**
3
3
  * Creates a resolver definition for querying a single table by name
4
4
  */
@@ -8,10 +8,10 @@ const map_table_info_1 = require("./map-table-info");
8
8
  */
9
9
  function createTableResolver(tableInfoList) {
10
10
  return {
11
- name: 'table',
12
- type: 'TableDetail',
11
+ name: "table",
12
+ type: "TableDetail",
13
13
  args: {
14
- name: 'String!'
14
+ name: "String!",
15
15
  },
16
16
  resolve: async (_root, args) => {
17
17
  const { name } = args;
@@ -20,7 +20,7 @@ function createTableResolver(tableInfoList) {
20
20
  throw new Error(`Table not found: ${name}`);
21
21
  }
22
22
  return (0, map_table_info_1.mapTableInfoToDetail)(tableInfo);
23
- }
23
+ },
24
24
  };
25
25
  }
26
26
  /**
@@ -28,10 +28,10 @@ function createTableResolver(tableInfoList) {
28
28
  */
29
29
  function createTablesResolver(tableInfoList) {
30
30
  return {
31
- name: 'tables',
32
- type: '[TableMetadata!]!',
31
+ name: "tables",
32
+ type: "[TableMetadata!]!",
33
33
  resolve: async () => {
34
34
  return tableInfoList.map((t) => (0, map_table_info_1.mapTableInfoToMetadata)(t));
35
- }
35
+ },
36
36
  };
37
37
  }
@@ -1,4 +1,4 @@
1
- import { ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
1
+ import { ObjectTypeComposer, SchemaComposer } from "graphql-compose";
2
2
  /**
3
3
  * Creates GraphQL type for TableMetadata
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"create-types.d.ts","sourceRoot":"","sources":["../../../../src/utils/add-query-fields/utils/create-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAyCrE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,cAAc,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAsBlG;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,cAAc,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CA4BhG"}
1
+ {"version":3,"file":"create-types.d.ts","sourceRoot":"","sources":["../../../../src/utils/add-query-fields/utils/create-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAyCrE;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,cAAc,GAC7B,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAsB9B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,cAAc,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CA4BhG"}
@@ -6,91 +6,91 @@ exports.createTableDetailTC = createTableDetailTC;
6
6
  * Creates GraphQL type for TableObjectInfo
7
7
  */
8
8
  function createTableObjectInfoTC(schemaComposer) {
9
- if (schemaComposer.has('TableObjectInfo')) {
10
- return schemaComposer.getOTC('TableObjectInfo');
9
+ if (schemaComposer.has("TableObjectInfo")) {
10
+ return schemaComposer.getOTC("TableObjectInfo");
11
11
  }
12
12
  return schemaComposer.createObjectTC({
13
- name: 'TableObjectInfo',
13
+ name: "TableObjectInfo",
14
14
  fields: {
15
15
  name: {
16
- type: 'String',
17
- description: 'Object name'
16
+ type: "String",
17
+ description: "Object name",
18
18
  },
19
19
  title: {
20
- type: 'String',
21
- description: 'Object title'
20
+ type: "String",
21
+ description: "Object title",
22
22
  },
23
23
  description: {
24
- type: 'String',
25
- description: 'Object description'
24
+ type: "String",
25
+ description: "Object description",
26
26
  },
27
27
  fieldInfoList: {
28
- type: 'JSON',
29
- description: 'List of field information'
28
+ type: "JSON",
29
+ description: "List of field information",
30
30
  },
31
31
  jsonSchema: {
32
- type: 'JSON',
33
- description: 'JSON Schema for the object'
32
+ type: "JSON",
33
+ description: "JSON Schema for the object",
34
34
  },
35
35
  mongooseSchema: {
36
- type: 'JSON',
37
- description: 'Mongoose Schema reference'
38
- }
39
- }
36
+ type: "JSON",
37
+ description: "Mongoose Schema reference",
38
+ },
39
+ },
40
40
  });
41
41
  }
42
42
  /**
43
43
  * Creates GraphQL type for TableMetadata
44
44
  */
45
45
  function createTableMetadataTC(schemaComposer) {
46
- if (schemaComposer.has('TableMetadata')) {
47
- return schemaComposer.getOTC('TableMetadata');
46
+ if (schemaComposer.has("TableMetadata")) {
47
+ return schemaComposer.getOTC("TableMetadata");
48
48
  }
49
49
  return schemaComposer.createObjectTC({
50
- name: 'TableMetadata',
50
+ name: "TableMetadata",
51
51
  fields: {
52
52
  name: {
53
- type: 'String!',
54
- description: 'Table name'
53
+ type: "String!",
54
+ description: "Table name",
55
55
  },
56
56
  title: {
57
- type: 'String',
58
- description: 'Human-readable table title'
57
+ type: "String",
58
+ description: "Human-readable table title",
59
59
  },
60
60
  description: {
61
- type: 'String',
62
- description: 'Optional table description'
63
- }
64
- }
61
+ type: "String",
62
+ description: "Optional table description",
63
+ },
64
+ },
65
65
  });
66
66
  }
67
67
  /**
68
68
  * Creates GraphQL type for TableDetail
69
69
  */
70
70
  function createTableDetailTC(schemaComposer) {
71
- if (schemaComposer.has('TableDetail')) {
72
- return schemaComposer.getOTC('TableDetail');
71
+ if (schemaComposer.has("TableDetail")) {
72
+ return schemaComposer.getOTC("TableDetail");
73
73
  }
74
74
  const tableObjectInfoTC = createTableObjectInfoTC(schemaComposer);
75
75
  return schemaComposer.createObjectTC({
76
- name: 'TableDetail',
76
+ name: "TableDetail",
77
77
  fields: {
78
78
  name: {
79
- type: 'String!',
80
- description: 'Table name'
79
+ type: "String!",
80
+ description: "Table name",
81
81
  },
82
82
  title: {
83
- type: 'String',
84
- description: 'Human-readable table title'
83
+ type: "String",
84
+ description: "Human-readable table title",
85
85
  },
86
86
  description: {
87
- type: 'String',
88
- description: 'Optional table description'
87
+ type: "String",
88
+ description: "Optional table description",
89
89
  },
90
90
  objectInfo: {
91
91
  type: tableObjectInfoTC,
92
- description: 'Object information'
93
- }
94
- }
92
+ description: "Object information",
93
+ },
94
+ },
95
95
  });
96
96
  }
@@ -1,4 +1,4 @@
1
- import { FieldInfo } from '@ldsg/object';
1
+ import { FieldInfo } from "@ldsg/object";
2
2
  /**
3
3
  * Generates JSON Schema for an object from its field info list
4
4
  */
@@ -17,19 +17,19 @@ function getJsonSchemaForField(fieldInfo) {
17
17
  const commonType = platformToTypeMap[field_type_1.FieldTypeBasePlatform.COMMON];
18
18
  if (!commonType) {
19
19
  return {
20
- type: 'string',
21
- title: fieldInfo.title || fieldInfo.name
20
+ type: "string",
21
+ title: fieldInfo.title || fieldInfo.name,
22
22
  };
23
23
  }
24
24
  // Basic type mapping
25
25
  const typeMap = {
26
- string: { type: 'string', title: fieldInfo.title || fieldInfo.name },
27
- number: { type: 'number', title: fieldInfo.title || fieldInfo.name },
28
- boolean: { type: 'boolean', title: fieldInfo.title || fieldInfo.name },
29
- array: { type: 'array', title: fieldInfo.title || fieldInfo.name },
30
- object: { type: 'object', title: fieldInfo.title || fieldInfo.name }
26
+ string: { type: "string", title: fieldInfo.title || fieldInfo.name },
27
+ number: { type: "number", title: fieldInfo.title || fieldInfo.name },
28
+ boolean: { type: "boolean", title: fieldInfo.title || fieldInfo.name },
29
+ array: { type: "array", title: fieldInfo.title || fieldInfo.name },
30
+ object: { type: "object", title: fieldInfo.title || fieldInfo.name },
31
31
  };
32
- return typeMap[commonType] || { type: 'string', title: fieldInfo.title || fieldInfo.name };
32
+ return typeMap[commonType] || { type: "string", title: fieldInfo.title || fieldInfo.name };
33
33
  }
34
34
  /**
35
35
  * Generates JSON Schema for an object from its field info list
@@ -46,7 +46,7 @@ function getJsonSchemaByFieldInfoList(fieldInfoList) {
46
46
  }
47
47
  });
48
48
  return {
49
- type: 'object',
50
- properties
49
+ type: "object",
50
+ properties,
51
51
  };
52
52
  }
@@ -1,5 +1,5 @@
1
- import { TableInfo } from '../../../types';
2
- import { TableDetail, TableMetadata } from '../../../types/query-types';
1
+ import { TableInfo } from "../../../types";
2
+ import { TableDetail, TableMetadata } from "../../../types/query-types";
3
3
  /**
4
4
  * Maps TableInfo to TableMetadata (lightweight version without schemas)
5
5
  */
@@ -10,7 +10,7 @@ function mapTableInfoToMetadata(tableInfo) {
10
10
  return {
11
11
  name: tableInfo.name,
12
12
  title: tableInfo.title,
13
- description: tableInfo.description
13
+ description: tableInfo.description,
14
14
  };
15
15
  }
16
16
  /**
@@ -26,7 +26,7 @@ function mapTableInfoToDetail(tableInfo) {
26
26
  description: tableInfo.description,
27
27
  objectInfo: {
28
28
  ...objectInfo,
29
- jsonSchema
30
- }
29
+ jsonSchema,
30
+ },
31
31
  };
32
32
  }
@@ -1,6 +1,6 @@
1
- import { SchemaComposerParams } from '@ldsg/graphql';
2
- import mongoose from 'mongoose';
3
- import { TableInfo } from '../../types';
1
+ import { SchemaComposerParams } from "@ldsg/graphql";
2
+ import mongoose from "mongoose";
3
+ import { TableInfo } from "../../types";
4
4
  interface HandleTableInfoListParams extends SchemaComposerParams {
5
5
  tableInfoList: TableInfo[];
6
6
  }
@@ -14,12 +14,12 @@ const handleTableInfoList = (params) => {
14
14
  const { modelName, mongooseModel } = (0, utils_1.getObjectTC)({
15
15
  tableName,
16
16
  objectInfo,
17
- schemaComposer
17
+ schemaComposer,
18
18
  });
19
19
  mongooseModels[modelName] = mongooseModel;
20
20
  });
21
21
  const res = {
22
- mongooseModels
22
+ mongooseModels,
23
23
  };
24
24
  return res;
25
25
  };
@@ -1,7 +1,7 @@
1
- import { ObjectInfo } from '@ldsg/object';
2
- import { SchemaComposer } from 'graphql-compose';
3
- import { ObjectTypeComposerWithMongooseResolvers } from 'graphql-compose-mongoose';
4
- import mongoose from 'mongoose';
1
+ import { ObjectInfo } from "@ldsg/object";
2
+ import { SchemaComposer } from "graphql-compose";
3
+ import { ObjectTypeComposerWithMongooseResolvers } from "graphql-compose-mongoose";
4
+ import mongoose from "mongoose";
5
5
  interface GetObjectTCParams {
6
6
  tableName: string;
7
7
  objectInfo: ObjectInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"get-object-type-composer.d.ts","sourceRoot":"","sources":["../../../../src/utils/handle-table-info-list/utils/get-object-type-composer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,uCAAuC,EAExC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,QAA8B,MAAM,UAAU,CAAC;AAiBtD,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,kBAAkB,EAAE,uCAAuC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;CACpG;AAED,KAAK,WAAW,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,cAAc,CAAC;AA8BjE,eAAO,MAAM,WAAW,EAAE,WAgHzB,CAAC"}
1
+ {"version":3,"file":"get-object-type-composer.d.ts","sourceRoot":"","sources":["../../../../src/utils/handle-table-info-list/utils/get-object-type-composer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,uCAAuC,EAExC,MAAM,0BAA0B,CAAC;AAMlC,OAAO,QAA8B,MAAM,UAAU,CAAC;AAiBtD,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,kBAAkB,EAAE,uCAAuC,CACzD,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAChC,GAAG,CACJ,CAAC;CACH;AAED,KAAK,WAAW,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,cAAc,CAAC;AAiCjE,eAAO,MAAM,WAAW,EAAE,WAkHzB,CAAC"}
@@ -8,27 +8,27 @@ const graphql_compose_mongoose_1 = require("graphql-compose-mongoose");
8
8
  const lodash_1 = __importDefault(require("lodash"));
9
9
  const mongoose_1 = __importDefault(require("mongoose"));
10
10
  const sortHelperArgsOpts = {
11
- multi: true
11
+ multi: true,
12
12
  };
13
13
  const filterHelperArgsOpts = {
14
14
  onlyIndexed: false,
15
- operators: true
15
+ operators: true,
16
16
  };
17
17
  const countOpts = {
18
- filter: filterHelperArgsOpts
18
+ filter: filterHelperArgsOpts,
19
19
  };
20
20
  const buildNestedSchemaDefinition = (fieldInfoList, schemaDefinition) => {
21
21
  lodash_1.default.each(fieldInfoList, (fieldInfo) => {
22
- const { name, typeInfo: { platformToTypeMap }, fieldInfoList: nestedFieldInfoList } = fieldInfo;
22
+ const { name, typeInfo: { platformToTypeMap }, fieldInfoList: nestedFieldInfoList, } = fieldInfo;
23
23
  const { COMMON, MONGOOSE } = platformToTypeMap;
24
24
  const type = MONGOOSE !== null && MONGOOSE !== void 0 ? MONGOOSE : COMMON;
25
25
  const fieldName = lodash_1.default.camelCase(name);
26
- if ((type === null || type === void 0 ? void 0 : type.type) === 'object' && nestedFieldInfoList) {
26
+ if ((type === null || type === void 0 ? void 0 : type.type) === "object" && nestedFieldInfoList) {
27
27
  const subDef = {};
28
28
  buildNestedSchemaDefinition(nestedFieldInfoList, subDef);
29
29
  schemaDefinition[fieldName] = new mongoose_1.default.Schema(subDef, { _id: false });
30
30
  }
31
- else if ((type === null || type === void 0 ? void 0 : type.type) === 'array' && nestedFieldInfoList) {
31
+ else if ((type === null || type === void 0 ? void 0 : type.type) === "array" && nestedFieldInfoList) {
32
32
  const subDef = {};
33
33
  buildNestedSchemaDefinition(nestedFieldInfoList, subDef);
34
34
  schemaDefinition[fieldName] = [new mongoose_1.default.Schema(subDef, { _id: false })];
@@ -45,7 +45,7 @@ const getObjectTC = (params) => {
45
45
  buildNestedSchemaDefinition(fieldInfoList, mongooseSchemaDefinition);
46
46
  const collectionName = lodash_1.default.snakeCase(tableName);
47
47
  const mongooseSchema = new mongoose_1.default.Schema(mongooseSchemaDefinition, {
48
- collection: collectionName
48
+ collection: collectionName,
49
49
  });
50
50
  const modelName = tableName;
51
51
  const mongooseModel = mongoose_1.default.models[modelName]
@@ -53,7 +53,7 @@ const getObjectTC = (params) => {
53
53
  : mongoose_1.default.model(modelName, mongooseSchema);
54
54
  const customizationOptions = {
55
55
  schemaComposer: schemaComposer,
56
- schema: mongooseSchema
56
+ schema: mongooseSchema,
57
57
  };
58
58
  const objectTypeComposer = (0, graphql_compose_mongoose_1.composeMongoose)(mongooseModel, customizationOptions);
59
59
  const mongooseResolverKeys = lodash_1.default.keys(objectTypeComposer.mongooseResolvers);
@@ -61,43 +61,43 @@ const getObjectTC = (params) => {
61
61
  const mongooseResolver = objectTypeComposer.mongooseResolvers[key];
62
62
  let mongooseResolverOpts;
63
63
  switch (key) {
64
- case 'findMany':
65
- case 'findOne': {
64
+ case "findMany":
65
+ case "findOne": {
66
66
  mongooseResolverOpts = {
67
67
  filter: filterHelperArgsOpts,
68
- sort: sortHelperArgsOpts
68
+ sort: sortHelperArgsOpts,
69
69
  };
70
70
  break;
71
71
  }
72
- case 'updateOne':
73
- case 'removeOne': {
72
+ case "updateOne":
73
+ case "removeOne": {
74
74
  mongooseResolverOpts = { filter: filterHelperArgsOpts };
75
75
  break;
76
76
  }
77
- case 'updateMany':
78
- case 'removeMany': {
77
+ case "updateMany":
78
+ case "removeMany": {
79
79
  mongooseResolverOpts = {
80
80
  filter: filterHelperArgsOpts,
81
- sort: sortHelperArgsOpts
81
+ sort: sortHelperArgsOpts,
82
82
  };
83
83
  break;
84
84
  }
85
- case 'count': {
85
+ case "count": {
86
86
  mongooseResolverOpts = { filter: filterHelperArgsOpts };
87
87
  break;
88
88
  }
89
- case 'connection': {
89
+ case "connection": {
90
90
  const findManyOpts = {
91
91
  filter: filterHelperArgsOpts,
92
- sort: sortHelperArgsOpts
92
+ sort: sortHelperArgsOpts,
93
93
  };
94
94
  mongooseResolverOpts = { findManyOpts, countOpts };
95
95
  break;
96
96
  }
97
- case 'pagination': {
97
+ case "pagination": {
98
98
  const findManyOpts = {
99
99
  filter: filterHelperArgsOpts,
100
- sort: sortHelperArgsOpts
100
+ sort: sortHelperArgsOpts,
101
101
  };
102
102
  mongooseResolverOpts = { findManyOpts, countOpts };
103
103
  break;
@@ -112,7 +112,7 @@ const getObjectTC = (params) => {
112
112
  const res = {
113
113
  modelName,
114
114
  mongooseModel,
115
- objectTypeComposer
115
+ objectTypeComposer,
116
116
  };
117
117
  return res;
118
118
  };
@@ -1,2 +1,2 @@
1
- export * from './get-object-type-composer';
1
+ export * from "./get-object-type-composer";
2
2
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldsg/tables",
3
- "version": "0.3.30",
3
+ "version": "0.3.32",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -11,38 +11,42 @@
11
11
  "dist/"
12
12
  ],
13
13
  "dependencies": {
14
- "graphql-compose-mongoose": "^10.0.0",
14
+ "graphql-compose-mongoose": "10.1.0",
15
15
  "lodash": "^4.17.21",
16
16
  "mongoose": "^8.14.3",
17
17
  "zod": "^4.1.11",
18
- "@ldsg/field-type": "0.3.30",
19
- "@ldsg/handler": "0.3.30",
20
- "@ldsg/resource": "0.3.30",
21
- "@ldsg/resource-definition": "0.3.30"
18
+ "@ldsg/field-type": "0.3.32",
19
+ "@ldsg/resource": "0.3.32",
20
+ "@ldsg/handler": "0.3.32",
21
+ "@ldsg/resource-definition": "0.3.32"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/jest": "^29.5.2",
25
25
  "@types/lodash": "^4.14.202",
26
26
  "@types/supertest": "^6.0.0",
27
27
  "graphql": "16.11.0",
28
- "graphql-compose": "^9.1.0",
28
+ "graphql-compose": "9.1.0",
29
29
  "jest": "^29.5.0",
30
+ "oxfmt": "latest",
31
+ "oxlint": "latest",
30
32
  "supertest": "^6.3.4",
31
33
  "ts-jest": "^29.1.5",
32
34
  "ts-node": "^10.9.2",
33
35
  "typescript": "^5.8.3",
34
- "@ldsg/application": "0.3.30",
35
- "@ldsg/graphql": "0.3.30",
36
- "@ldsg/object": "0.3.30",
37
- "@ldsg/object-field": "0.3.30",
38
- "@ldsg/types": "0.3.30",
39
- "@ldsg/workflow": "0.3.30"
36
+ "@ldsg/application": "0.3.32",
37
+ "@ldsg/graphql": "0.3.32",
38
+ "@ldsg/object": "0.3.32",
39
+ "@ldsg/object-field": "0.3.32",
40
+ "@ldsg/types": "0.3.32",
41
+ "@ldsg/workflow": "0.3.32"
40
42
  },
41
43
  "publishConfig": {
42
44
  "access": "public"
43
45
  },
44
46
  "scripts": {
45
47
  "build": "tsc --project tsconfig.build.json",
46
- "clean": "rm -rf dist"
48
+ "clean": "rm -rf dist",
49
+ "format": "oxfmt --write src/",
50
+ "lint": "oxlint src/"
47
51
  }
48
52
  }