@xmobitea/gn-server 2.0.2 → 2.0.4
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/GN-app-api/service/GenericService.d.ts +1 -1
- package/dist/GN-app-api/service/IGenericService.d.ts +2 -2
- package/dist/index.d.ts +130 -26
- package/dist/index.js +419 -119
- package/gn.sh +28 -19
- package/package.json +1 -1
package/gn.sh
CHANGED
|
@@ -79,7 +79,7 @@ GNconfig.release.json' > .gitignore
|
|
|
79
79
|
|
|
80
80
|
init_create_projectIndexJs() {
|
|
81
81
|
echo 'process.env.ENVIROMENT = "debug";
|
|
82
|
-
require("./index");' > "$PROJECT_NAME"'.index.js'
|
|
82
|
+
require("./dist/index");' > "$PROJECT_NAME"'.index.js'
|
|
83
83
|
echo 'create '"$PROJECT_NAME"'.index.js file success'
|
|
84
84
|
|
|
85
85
|
return
|
|
@@ -179,7 +179,7 @@ import { TestRequestHandler } from "./src/app-api/handler/TestRequestHandler";
|
|
|
179
179
|
import { PostIndex } from "./PostIndex";
|
|
180
180
|
|
|
181
181
|
let ENVIROMENT = process.env.ENVIROMENT || "debug";
|
|
182
|
-
const optionsPath = __dirname + "
|
|
182
|
+
const optionsPath = __dirname + "/./../GNconfig." + ENVIROMENT + ".json";
|
|
183
183
|
console.log("[GN Server] ENVIROMENT [" + ENVIROMENT + "], load the config at " + optionsPath);
|
|
184
184
|
let optionStr = fs.readFileSync(optionsPath).toString();
|
|
185
185
|
let fullOptions = JSON.parse(optionStr);
|
|
@@ -195,7 +195,7 @@ applicationStartup.run(() => {
|
|
|
195
195
|
|
|
196
196
|
let gnServer = applicationStartup.getGNServer();
|
|
197
197
|
|
|
198
|
-
gnServer.
|
|
198
|
+
gnServer.addCustomHandler(new TestRequestHandler(gnServer), false);
|
|
199
199
|
|
|
200
200
|
postIndex.setOptions(options);
|
|
201
201
|
postIndex.setGNServer(gnServer);
|
|
@@ -281,6 +281,7 @@ init_create_srcAppApiHandlerDir() {
|
|
|
281
281
|
StringDataMember,
|
|
282
282
|
GNHashtableDataMember,
|
|
283
283
|
GNArrayDataMember,
|
|
284
|
+
SecretInfo,
|
|
284
285
|
|
|
285
286
|
} from "@xmobitea/gn-server";
|
|
286
287
|
import { TestErrorCode } from "./../../common/constant/errorCode/TestErrorCode";
|
|
@@ -289,19 +290,19 @@ import { TestParameterCode } from "./../../common/constant/parameterCode/TestPar
|
|
|
289
290
|
|
|
290
291
|
class TestOperationRequest extends OperationRequest {
|
|
291
292
|
@BooleanDataMember({ code: TestParameterCode.Boolean, isOptional: true })
|
|
292
|
-
booleanValue
|
|
293
|
+
booleanValue?: boolean;
|
|
293
294
|
|
|
294
295
|
@NumberDataMember({ code: TestParameterCode.Number, isOptional: true })
|
|
295
|
-
numberValue
|
|
296
|
+
numberValue?: number;
|
|
296
297
|
|
|
297
298
|
@StringDataMember({ code: TestParameterCode.String, isOptional: true })
|
|
298
|
-
stringValue
|
|
299
|
+
stringValue?: string;
|
|
299
300
|
|
|
300
301
|
@GNHashtableDataMember({ code: TestParameterCode.GNHashtable, isOptional: true })
|
|
301
|
-
gnHashtableValue
|
|
302
|
+
gnHashtableValue?: GNHashtable;
|
|
302
303
|
|
|
303
304
|
@GNArrayDataMember({ code: TestParameterCode.GNArray, isOptional: true })
|
|
304
|
-
gnArrayValue
|
|
305
|
+
gnArrayValue?: GNArray;
|
|
305
306
|
|
|
306
307
|
public override isValidRequest() {
|
|
307
308
|
return true;
|
|
@@ -319,6 +320,7 @@ export class TestRequestHandler extends RequestHandler {
|
|
|
319
320
|
|
|
320
321
|
public async handle(
|
|
321
322
|
authInfo: AuthInfo,
|
|
323
|
+
secretInfo: SecretInfo,
|
|
322
324
|
operationRequest: OperationRequest
|
|
323
325
|
): Promise<OperationResponse> {
|
|
324
326
|
let request = this.requestConverterService.createTOperationRequest(operationRequest, this.getCommonOperationRequest());
|
|
@@ -327,39 +329,46 @@ export class TestRequestHandler extends RequestHandler {
|
|
|
327
329
|
return this.newInvalidRequestParameters(request);
|
|
328
330
|
}
|
|
329
331
|
|
|
330
|
-
|
|
331
|
-
request.
|
|
332
|
-
request.
|
|
333
|
-
|
|
332
|
+
return this.execute({
|
|
333
|
+
booleanValue: request.booleanValue,
|
|
334
|
+
numberValue: request.numberValue,
|
|
335
|
+
stringValue: request.stringValue,
|
|
336
|
+
gnHashtableValue: request.gnHashtableValue,
|
|
337
|
+
gnArrayValue: request.gnArrayValue,
|
|
338
|
+
}, secretInfo, operationRequest);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
private async execute(request: { booleanValue: boolean, numberValue: number, stringValue: string, gnHashtableValue: GNHashtable, gnArrayValue: GNArray }, secretInfo: SecretInfo, operationRequest: OperationRequest): Promise<OperationResponse> {
|
|
342
|
+
let operationResponse = new OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId());
|
|
334
343
|
operationResponse.setReturnCode(ReturnCode.Ok);
|
|
335
|
-
operationResponse.
|
|
344
|
+
operationResponse.setParameter(
|
|
336
345
|
ParameterCode.ErrorCode,
|
|
337
346
|
TestErrorCode.Ok
|
|
338
347
|
);
|
|
339
348
|
|
|
340
|
-
operationResponse.
|
|
349
|
+
operationResponse.setParameter(
|
|
341
350
|
TestParameterCode.Boolean,
|
|
342
351
|
request.booleanValue
|
|
343
352
|
);
|
|
344
|
-
operationResponse.
|
|
353
|
+
operationResponse.setParameter(
|
|
345
354
|
TestParameterCode.Number,
|
|
346
355
|
request.numberValue
|
|
347
356
|
);
|
|
348
|
-
operationResponse.
|
|
357
|
+
operationResponse.setParameter(
|
|
349
358
|
TestParameterCode.String,
|
|
350
359
|
request.stringValue
|
|
351
360
|
);
|
|
352
|
-
operationResponse.
|
|
361
|
+
operationResponse.setParameter(
|
|
353
362
|
TestParameterCode.GNHashtable,
|
|
354
363
|
request.gnHashtableValue
|
|
355
364
|
);
|
|
356
|
-
operationResponse.
|
|
365
|
+
operationResponse.setParameter(
|
|
357
366
|
TestParameterCode.GNArray,
|
|
358
367
|
request.gnArrayValue
|
|
359
368
|
);
|
|
360
369
|
|
|
361
370
|
return operationResponse;
|
|
362
|
-
|
|
371
|
+
}
|
|
363
372
|
}' > TestRequestHandler.ts
|
|
364
373
|
echo 'create TestRequestHandler.ts file success'
|
|
365
374
|
|