@pathscale/wss-adapter 1.0.6 → 1.0.7
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/wssAdapter.js +24 -16
- package/package.json +1 -1
- package/wssAdapter.ts +28 -28
package/dist/wssAdapter.js
CHANGED
|
@@ -94,25 +94,33 @@ var sendHandler = function (serviceName, serviceConfig, methodName, params) {
|
|
|
94
94
|
if (!methodCode) {
|
|
95
95
|
throw new Error("method ".concat(methodName, " not available in ").concat(serviceName, " service"));
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
if (params) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
// const purgedParams: Record<string, unknown> = {}
|
|
98
|
+
// if (params) {
|
|
99
|
+
// if (
|
|
100
|
+
// !Object.keys(params).every((param) =>
|
|
101
|
+
// serviceConfig.methods[methodCode].parameters.includes(param)
|
|
102
|
+
// )
|
|
103
|
+
// ) {
|
|
104
|
+
// throw new Error(
|
|
105
|
+
// `method ${methodCode} is being called with missing parameters`
|
|
106
|
+
// )
|
|
107
|
+
// }
|
|
108
|
+
// serviceConfig.methods[methodCode].parameters.forEach((k) => {
|
|
109
|
+
// purgedParams[k] = params[k]
|
|
110
|
+
// })
|
|
111
|
+
// const difference = Object.keys(params).filter(
|
|
112
|
+
// (x) => !serviceConfig.methods[methodCode].parameters.includes(x)
|
|
113
|
+
// )
|
|
114
|
+
// if (difference.length) {
|
|
115
|
+
// throw new Error(
|
|
116
|
+
// `method ${methodCode} is being called with unknow parameters, ${difference}`
|
|
117
|
+
// )
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
112
120
|
var payload = {
|
|
113
121
|
method: Number.parseInt(methodCode),
|
|
114
122
|
seq: store.sequence.getSeq(),
|
|
115
|
-
params:
|
|
123
|
+
params: params,
|
|
116
124
|
};
|
|
117
125
|
console.log("".concat(serviceName, "::").concat(methodName, " sends:"), payload);
|
|
118
126
|
return new Promise(function (resolve, reject) {
|
package/package.json
CHANGED
package/wssAdapter.ts
CHANGED
|
@@ -123,38 +123,38 @@ const sendHandler = (
|
|
|
123
123
|
)
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
const purgedParams: Record<string, unknown> = {}
|
|
127
|
-
|
|
128
|
-
if (params) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
126
|
+
// const purgedParams: Record<string, unknown> = {}
|
|
127
|
+
|
|
128
|
+
// if (params) {
|
|
129
|
+
// if (
|
|
130
|
+
// !Object.keys(params).every((param) =>
|
|
131
|
+
// serviceConfig.methods[methodCode].parameters.includes(param)
|
|
132
|
+
// )
|
|
133
|
+
// ) {
|
|
134
|
+
// throw new Error(
|
|
135
|
+
// `method ${methodCode} is being called with missing parameters`
|
|
136
|
+
// )
|
|
137
|
+
// }
|
|
138
|
+
|
|
139
|
+
// serviceConfig.methods[methodCode].parameters.forEach((k) => {
|
|
140
|
+
// purgedParams[k] = params[k]
|
|
141
|
+
// })
|
|
142
|
+
|
|
143
|
+
// const difference = Object.keys(params).filter(
|
|
144
|
+
// (x) => !serviceConfig.methods[methodCode].parameters.includes(x)
|
|
145
|
+
// )
|
|
146
|
+
|
|
147
|
+
// if (difference.length) {
|
|
148
|
+
// throw new Error(
|
|
149
|
+
// `method ${methodCode} is being called with unknow parameters, ${difference}`
|
|
150
|
+
// )
|
|
151
|
+
// }
|
|
152
|
+
// }
|
|
153
153
|
|
|
154
154
|
const payload = {
|
|
155
155
|
method: Number.parseInt(methodCode),
|
|
156
156
|
seq: store.sequence.getSeq(),
|
|
157
|
-
params:
|
|
157
|
+
params: params,
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
console.log(`${serviceName}::${methodName} sends:`, payload)
|