@ruiapp/rapid-core 0.5.5 → 0.5.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/bootstrapApplicationConfig.d.ts +0 -39
- package/dist/index.js +34 -24
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/bootstrapApplicationConfig.ts +1 -1
- package/src/core/request.ts +30 -21
- package/src/plugins/license/LicenseService.ts +6 -0
- package/src/types.ts +1 -1
|
@@ -338,45 +338,6 @@ declare const _default: {
|
|
|
338
338
|
defaultValue?: undefined;
|
|
339
339
|
})[];
|
|
340
340
|
indexes?: undefined;
|
|
341
|
-
} | {
|
|
342
|
-
maintainedBy: string;
|
|
343
|
-
namespace: string;
|
|
344
|
-
name: string;
|
|
345
|
-
code: string;
|
|
346
|
-
singularCode: string;
|
|
347
|
-
pluralCode: string;
|
|
348
|
-
schema: string;
|
|
349
|
-
tableName: string;
|
|
350
|
-
properties: ({
|
|
351
|
-
name: string;
|
|
352
|
-
code: string;
|
|
353
|
-
columnName: string;
|
|
354
|
-
type: "integer";
|
|
355
|
-
required: true;
|
|
356
|
-
autoIncrement: true;
|
|
357
|
-
} | {
|
|
358
|
-
name: string;
|
|
359
|
-
code: string;
|
|
360
|
-
columnName: string;
|
|
361
|
-
type: "text";
|
|
362
|
-
required: true;
|
|
363
|
-
autoIncrement?: undefined;
|
|
364
|
-
} | {
|
|
365
|
-
name: string;
|
|
366
|
-
code: string;
|
|
367
|
-
columnName: string;
|
|
368
|
-
type: "text";
|
|
369
|
-
required: false;
|
|
370
|
-
autoIncrement?: undefined;
|
|
371
|
-
} | {
|
|
372
|
-
name: string;
|
|
373
|
-
code: string;
|
|
374
|
-
columnName: string;
|
|
375
|
-
type: "json";
|
|
376
|
-
required: true;
|
|
377
|
-
autoIncrement?: undefined;
|
|
378
|
-
})[];
|
|
379
|
-
indexes?: undefined;
|
|
380
341
|
})[];
|
|
381
342
|
dataDictionaries: any[];
|
|
382
343
|
routes: {
|
package/dist/index.js
CHANGED
|
@@ -1427,31 +1427,37 @@ class RapidRequest {
|
|
|
1427
1427
|
return;
|
|
1428
1428
|
}
|
|
1429
1429
|
const requestMethod = this.method;
|
|
1430
|
-
if (requestMethod
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
this.#body = {
|
|
1435
|
-
type: "json",
|
|
1436
|
-
value: await req.json(),
|
|
1437
|
-
};
|
|
1438
|
-
}
|
|
1439
|
-
else if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
1440
|
-
const bodyText = await req.text();
|
|
1441
|
-
this.#body = {
|
|
1442
|
-
type: "form",
|
|
1443
|
-
value: qs__default["default"].parse(bodyText),
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
else if (contentType.startsWith("multipart/form-data")) {
|
|
1447
|
-
this.#body = {
|
|
1448
|
-
type: "form-data",
|
|
1449
|
-
value: await parseFormDataBody(req),
|
|
1450
|
-
};
|
|
1451
|
-
}
|
|
1430
|
+
if (requestMethod !== "POST" && requestMethod !== "PUT" && requestMethod !== "PATCH") {
|
|
1431
|
+
this.#body = null;
|
|
1432
|
+
this.#bodyParsed = true;
|
|
1433
|
+
return;
|
|
1452
1434
|
}
|
|
1453
|
-
|
|
1435
|
+
const contentLength = parseInt(this.#headers.get("Content-Length") || "0", 10);
|
|
1436
|
+
if (!contentLength) {
|
|
1454
1437
|
this.#body = null;
|
|
1438
|
+
this.#bodyParsed = true;
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const req = this.#raw;
|
|
1442
|
+
const contentType = this.#headers.get("Content-Type") || "application/json";
|
|
1443
|
+
if (contentType.includes("json")) {
|
|
1444
|
+
this.#body = {
|
|
1445
|
+
type: "json",
|
|
1446
|
+
value: await req.json(),
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
else if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
1450
|
+
const bodyText = await req.text();
|
|
1451
|
+
this.#body = {
|
|
1452
|
+
type: "form",
|
|
1453
|
+
value: qs__default["default"].parse(bodyText),
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
else if (contentType.startsWith("multipart/form-data")) {
|
|
1457
|
+
this.#body = {
|
|
1458
|
+
type: "form-data",
|
|
1459
|
+
value: await parseFormDataBody(req),
|
|
1460
|
+
};
|
|
1455
1461
|
}
|
|
1456
1462
|
this.#bodyParsed = true;
|
|
1457
1463
|
}
|
|
@@ -2063,7 +2069,7 @@ var bootstrapApplicationConfig = {
|
|
|
2063
2069
|
code: "actions",
|
|
2064
2070
|
columnName: "actions",
|
|
2065
2071
|
type: "json",
|
|
2066
|
-
required:
|
|
2072
|
+
required: false,
|
|
2067
2073
|
},
|
|
2068
2074
|
],
|
|
2069
2075
|
},
|
|
@@ -6903,6 +6909,10 @@ class LicenseService {
|
|
|
6903
6909
|
const licenseSettings = await settingService.getSystemSettingValues("license");
|
|
6904
6910
|
const { deployId } = licenseSettings;
|
|
6905
6911
|
const certText = licenseSettings.cert;
|
|
6912
|
+
if (!deployId || !certText) {
|
|
6913
|
+
this.#server.getLogger().warn("License was not loaded properly.");
|
|
6914
|
+
return;
|
|
6915
|
+
}
|
|
6906
6916
|
const certJSON = Buffer.from(certText, "base64").toString();
|
|
6907
6917
|
const cert = JSON.parse(certJSON);
|
|
6908
6918
|
try {
|
package/dist/types.d.ts
CHANGED
|
@@ -382,7 +382,7 @@ export interface RpdRoute {
|
|
|
382
382
|
type: "RESTful";
|
|
383
383
|
method: RpdHttpMethod;
|
|
384
384
|
endpoint: string;
|
|
385
|
-
actions
|
|
385
|
+
actions?: RpdRouteActionConfig[];
|
|
386
386
|
}
|
|
387
387
|
export type RpdHttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
388
388
|
export interface RpdRouteActionConfig {
|
package/package.json
CHANGED
package/src/core/request.ts
CHANGED
|
@@ -36,28 +36,37 @@ export class RapidRequest {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const requestMethod = this.method;
|
|
39
|
-
if (requestMethod
|
|
40
|
-
const req = this.#raw;
|
|
41
|
-
const contentType = this.#headers.get("Content-Type") || "application/json";
|
|
42
|
-
if (contentType.includes("json")) {
|
|
43
|
-
this.#body = {
|
|
44
|
-
type: "json",
|
|
45
|
-
value: await req.json(),
|
|
46
|
-
};
|
|
47
|
-
} else if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
48
|
-
const bodyText = await req.text();
|
|
49
|
-
this.#body = {
|
|
50
|
-
type: "form",
|
|
51
|
-
value: qs.parse(bodyText),
|
|
52
|
-
};
|
|
53
|
-
} else if (contentType.startsWith("multipart/form-data")) {
|
|
54
|
-
this.#body = {
|
|
55
|
-
type: "form-data",
|
|
56
|
-
value: await parseFormDataBody(req),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
39
|
+
if (requestMethod !== "POST" && requestMethod !== "PUT" && requestMethod !== "PATCH") {
|
|
60
40
|
this.#body = null;
|
|
41
|
+
this.#bodyParsed = true;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const contentLength = parseInt(this.#headers.get("Content-Length") || "0", 10);
|
|
46
|
+
if (!contentLength) {
|
|
47
|
+
this.#body = null;
|
|
48
|
+
this.#bodyParsed = true;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const req = this.#raw;
|
|
53
|
+
const contentType = this.#headers.get("Content-Type") || "application/json";
|
|
54
|
+
if (contentType.includes("json")) {
|
|
55
|
+
this.#body = {
|
|
56
|
+
type: "json",
|
|
57
|
+
value: await req.json(),
|
|
58
|
+
};
|
|
59
|
+
} else if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
60
|
+
const bodyText = await req.text();
|
|
61
|
+
this.#body = {
|
|
62
|
+
type: "form",
|
|
63
|
+
value: qs.parse(bodyText),
|
|
64
|
+
};
|
|
65
|
+
} else if (contentType.startsWith("multipart/form-data")) {
|
|
66
|
+
this.#body = {
|
|
67
|
+
type: "form-data",
|
|
68
|
+
value: await parseFormDataBody(req),
|
|
69
|
+
};
|
|
61
70
|
}
|
|
62
71
|
this.#bodyParsed = true;
|
|
63
72
|
}
|
|
@@ -39,6 +39,12 @@ export default class LicenseService {
|
|
|
39
39
|
const licenseSettings = await settingService.getSystemSettingValues("license");
|
|
40
40
|
const { deployId } = licenseSettings as LicenseSettings;
|
|
41
41
|
const certText = licenseSettings.cert;
|
|
42
|
+
|
|
43
|
+
if (!deployId || !certText) {
|
|
44
|
+
this.#server.getLogger().warn("License was not loaded properly.");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
const certJSON = Buffer.from(certText, "base64").toString();
|
|
43
49
|
const cert: RpdCert = JSON.parse(certJSON);
|
|
44
50
|
|
package/src/types.ts
CHANGED
|
@@ -462,7 +462,7 @@ export interface RpdRoute {
|
|
|
462
462
|
type: "RESTful";
|
|
463
463
|
method: RpdHttpMethod;
|
|
464
464
|
endpoint: string;
|
|
465
|
-
actions
|
|
465
|
+
actions?: RpdRouteActionConfig[];
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
export type RpdHttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|