pg-mvc-service 2.0.57 → 2.0.59

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.
@@ -60,14 +60,23 @@ class ReqResType {
60
60
  property = property.properties;
61
61
  continue;
62
62
  case 'object':
63
- case 'object':
63
+ case 'object?':
64
64
  if (typeof key !== 'string') {
65
65
  throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
66
66
  }
67
67
  property = property.properties[key];
68
68
  continue;
69
+ // case 'dictionary':
70
+ // case 'dictionary?':
71
+ // if (typeof key !== 'string') {
72
+ // throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
73
+ // }
74
+ // property = property.properties[key];
75
+ // continue;
69
76
  default:
70
77
  throw new Error(`getPropertyでarray,object以外のtypeを読み込もうとしている。\nキー一覧:${keys.join(',')} エラーキー:${key}`);
78
+ // property = property[key];
79
+ // continue;
71
80
  }
72
81
  }
73
82
  return property;
@@ -59,18 +59,18 @@ class ResponseType extends ReqResType_1.default {
59
59
  getObject(keys) {
60
60
  let resData = {};
61
61
  const data = this.getData(keys);
62
- console.log("getObject", keys.join(','));
62
+ console.log("getObject-keys", keys.join(','));
63
63
  const objectProperty = this.getProperty(keys);
64
64
  if (objectProperty.type !== 'object' && objectProperty.type !== 'object?') {
65
65
  throw new Error(`getObjectメソッドでObject型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
66
66
  }
67
- console.log("getObject", objectProperty);
68
67
  for (const key of Object.keys(objectProperty.properties)) {
69
- console.log("getObject : ", key);
68
+ console.log("getObject-key : ", key);
70
69
  if (key in data === false || data[key] === undefined) {
71
70
  continue;
72
71
  }
73
72
  const property = objectProperty.properties[key];
73
+ console.log("getObject-props : ", property);
74
74
  if (data[key] === null || (property.type.replace("?", "") !== "string" && data[key] === "")) {
75
75
  resData[key] = property.type.endsWith('?') ? null : undefined;
76
76
  continue;
@@ -78,6 +78,7 @@ class ResponseType extends ReqResType_1.default {
78
78
  switch (property.type) {
79
79
  case 'object':
80
80
  case 'object?':
81
+ console.log("getObject-next-keys : ", [...keys, key]);
81
82
  resData[key] = this.getObject([...keys, key]);
82
83
  break;
83
84
  case 'array':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.57",
3
+ "version": "2.0.59",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -97,14 +97,23 @@ export default class ReqResType {
97
97
  property = property.properties;
98
98
  continue;
99
99
  case 'object':
100
- case 'object':
100
+ case 'object?':
101
101
  if (typeof key !== 'string') {
102
102
  throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
103
103
  }
104
104
  property = property.properties[key];
105
105
  continue;
106
+ // case 'dictionary':
107
+ // case 'dictionary?':
108
+ // if (typeof key !== 'string') {
109
+ // throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
110
+ // }
111
+ // property = property.properties[key];
112
+ // continue;
106
113
  default:
107
114
  throw new Error(`getPropertyでarray,object以外のtypeを読み込もうとしている。\nキー一覧:${keys.join(',')} エラーキー:${key}`);
115
+ // property = property[key];
116
+ // continue;
108
117
  }
109
118
  }
110
119
 
@@ -60,20 +60,20 @@ export class ResponseType extends ReqResType {
60
60
  let resData: {[key: string]: any} = {};
61
61
  const data = this.getData(keys);
62
62
 
63
- console.log("getObject", keys.join(','))
63
+ console.log("getObject-keys", keys.join(','))
64
64
  const objectProperty = this.getProperty(keys);
65
65
  if (objectProperty.type !== 'object' && objectProperty.type !== 'object?') {
66
66
  throw new Error(`getObjectメソッドでObject型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
67
67
  }
68
68
 
69
- console.log("getObject", objectProperty);
70
69
  for (const key of Object.keys(objectProperty.properties)) {
71
- console.log("getObject : ", key);
70
+ console.log("getObject-key : ", key);
72
71
  if (key in data === false || data[key] === undefined) {
73
72
  continue;
74
73
  }
75
74
 
76
75
  const property = objectProperty.properties[key];
76
+ console.log("getObject-props : ", property);
77
77
  if (data[key] === null || (property.type.replace("?", "") !== "string" && data[key] === "")) {
78
78
  resData[key] = property.type.endsWith('?') ? null : undefined;
79
79
  continue;
@@ -82,6 +82,7 @@ export class ResponseType extends ReqResType {
82
82
  switch (property.type) {
83
83
  case 'object':
84
84
  case 'object?':
85
+ console.log("getObject-next-keys : ", [...keys, key]);
85
86
  resData[key] = this.getObject([...keys, key]);
86
87
  break;
87
88
  case 'array':