corebasic 1.0.227 → 1.0.228
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/libs/elabase.js +2 -1
- package/dist/libs/kafka.js +1 -1
- package/libs/cpp.ts +2 -2
- package/libs/elabase.ts +14 -3
- package/libs/kafka.ts +1 -1
- package/libs/session.ts +2 -1
- package/package.json +1 -1
package/dist/libs/elabase.js
CHANGED
|
@@ -450,10 +450,11 @@ function execute(arg) {
|
|
|
450
450
|
return config.useDipper ? dipper(arg)
|
|
451
451
|
: axios
|
|
452
452
|
.post(arg.DIP_URL ?? fullurl, buildHybridRequest({ ...arg, DIP_URL: undefined }), { responseType: 'arraybuffer', timeout: timeout ?? 5000, headers: { "Content-Type": "application/dip" } })
|
|
453
|
-
.then(
|
|
453
|
+
.then(dip_result => {
|
|
454
454
|
// console.log(res.status);
|
|
455
455
|
// console.log(JSON.stringify(res.header, null, 4));
|
|
456
456
|
// console.log(JSON.stringify(res.body, null, 4));
|
|
457
|
+
const result = dip_result;
|
|
457
458
|
result.getSliceAsText = (offset, length) => Cpp.getSliceAsText(result.data, offset, length);
|
|
458
459
|
result.getSliceAsArrayBuffer = (offset, length) => Cpp.getSliceAsArrayBuffer(result.data, offset, length);
|
|
459
460
|
result["Content-Type"] = result.headers["content-type"];
|
package/dist/libs/kafka.js
CHANGED
|
@@ -14,7 +14,7 @@ export const start = (arg) => {
|
|
|
14
14
|
clientId: appName,
|
|
15
15
|
brokers: arg?.brokers ?? ['redpanda-0.redpanda.redpanda.svc.cluster.local:9093'], // ['107.155.108.78:9092'] ['127.0.0.1:29092']
|
|
16
16
|
sasl: arg?.sasl == false ? undefined : {
|
|
17
|
-
mechanism: 'SCRAM-SHA-512'
|
|
17
|
+
mechanism: 'scram-sha-512', // earlier 'SCRAM-SHA-512'
|
|
18
18
|
username: process.env.KAFKA_USERNAME,
|
|
19
19
|
password: process.env.KAFKA_PASSWORD
|
|
20
20
|
},
|
package/libs/cpp.ts
CHANGED
|
@@ -180,7 +180,7 @@ export function arrayBufferToString(buffer) {
|
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
// Matches QString Response::getSliceAsText
|
|
183
|
-
export function getSliceAsText(rawTextBuffer, offset, length) {
|
|
183
|
+
export function getSliceAsText(rawTextBuffer, offset: number, length: number): string {
|
|
184
184
|
// Reuses the identical slice boundary logic from above
|
|
185
185
|
try {
|
|
186
186
|
const slice = getSliceAsArrayBuffer(rawTextBuffer, offset, length);
|
|
@@ -191,7 +191,7 @@ export function getSliceAsText(rawTextBuffer, offset, length) {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
// Matches QByteArray Response::getSliceAsArrayBuffer
|
|
194
|
-
export function getSliceAsArrayBuffer(rawTextBuffer, offset, length) {
|
|
194
|
+
export function getSliceAsArrayBuffer(rawTextBuffer, offset: number, length: number): Buffer {
|
|
195
195
|
const totalSize = rawTextBuffer.length;
|
|
196
196
|
|
|
197
197
|
if (offset < 0 || offset >= totalSize) {
|
package/libs/elabase.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
import axios from 'axios'
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import type { AxiosResponse } from "axios";
|
|
3
5
|
import {default as dipper, shard_stats as ShardStats} from './dipper.ts'
|
|
4
6
|
import * as Utils from './utils.ts'
|
|
5
7
|
import * as Cpp from './cpp.ts'
|
|
@@ -560,13 +562,22 @@ function execute(arg) {
|
|
|
560
562
|
return config.useDipper ? dipper(arg)
|
|
561
563
|
: axios
|
|
562
564
|
.post(arg.DIP_URL ?? fullurl, buildHybridRequest({...arg, DIP_URL: undefined}), { responseType: 'arraybuffer', timeout: timeout ?? 5000, headers: {"Content-Type": "application/dip"} })
|
|
563
|
-
.then(
|
|
565
|
+
.then(dip_result => {
|
|
564
566
|
// console.log(res.status);
|
|
565
567
|
// console.log(JSON.stringify(res.header, null, 4));
|
|
566
568
|
// console.log(JSON.stringify(res.body, null, 4));
|
|
567
569
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
+
type DipResponse = AxiosResponse & {
|
|
571
|
+
body: any;
|
|
572
|
+
getSliceAsText(offset: number, length: number): string;
|
|
573
|
+
getSliceAsArrayBuffer(offset: number, length: number): Buffer;
|
|
574
|
+
"Content-Type"?: string;
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
const result = dip_result as DipResponse
|
|
578
|
+
|
|
579
|
+
result.getSliceAsText = (offset: number, length: number): string => Cpp.getSliceAsText(result.data, offset, length)
|
|
580
|
+
result.getSliceAsArrayBuffer = (offset: number, length: number): Buffer => Cpp.getSliceAsArrayBuffer(result.data, offset, length)
|
|
570
581
|
result["Content-Type"] = result.headers["content-type"]
|
|
571
582
|
result.body = result.data
|
|
572
583
|
if (result.headers["content-type"].includes("application/json"))
|
package/libs/kafka.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const start = (arg) => {
|
|
|
18
18
|
clientId: appName,
|
|
19
19
|
brokers: arg?.brokers ?? ['redpanda-0.redpanda.redpanda.svc.cluster.local:9093'], // ['107.155.108.78:9092'] ['127.0.0.1:29092']
|
|
20
20
|
sasl: arg?.sasl == false ? undefined : {
|
|
21
|
-
mechanism: 'SCRAM-SHA-512'
|
|
21
|
+
mechanism: 'scram-sha-512', // earlier 'SCRAM-SHA-512'
|
|
22
22
|
username: process.env.KAFKA_USERNAME,
|
|
23
23
|
password: process.env.KAFKA_PASSWORD
|
|
24
24
|
},
|
package/libs/session.ts
CHANGED
|
@@ -78,7 +78,8 @@ export const start = (expressApp, allowedUrls) => {
|
|
|
78
78
|
app.post("/refreshToken", (req, res) => {
|
|
79
79
|
try {
|
|
80
80
|
let { userId, clientId, refreshToken } = req.body
|
|
81
|
-
|
|
81
|
+
type Decoded = {userId: string, clientId: string}
|
|
82
|
+
const decoded = jwt.verify(refreshToken, REFRESH_TOKEN_SECRET) as Decoded
|
|
82
83
|
if (decoded.userId === userId && decoded.clientId === clientId) {
|
|
83
84
|
let now = Utils.now()
|
|
84
85
|
let _accessTokenExpiry = new Date(now); _accessTokenExpiry.setDate(_accessTokenExpiry.getDate() + 1);
|