corebasic 1.0.226 → 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.
@@ -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(result => {
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"];
@@ -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
  },
@@ -50,7 +50,8 @@ export const codes = {
50
50
  label: 'Alland Islands',
51
51
  phone: '358',
52
52
  min: 7,
53
- max: 10
53
+ max: 10,
54
+ phoneLength: [7, 8, 9, 10], // Custom added by me
54
55
  },
55
56
  AZ: { code: 'AZ', label: 'Azerbaijan', phone: '994', phoneLength: 9 },
56
57
  BA: {
@@ -162,7 +163,7 @@ export const codes = {
162
163
  ER: { code: 'ER', label: 'Eritrea', phone: '291', phoneLength: 7 },
163
164
  ES: { code: 'ES', label: 'Spain', phone: '34', phoneLength: 9 },
164
165
  ET: { code: 'ET', label: 'Ethiopia', phone: '251', phoneLength: 9 },
165
- FI: { code: 'FI', label: 'Finland', phone: '358', min: 9, max: 11 },
166
+ FI: { code: 'FI', label: 'Finland', phone: '358', min: 9, max: 11, phoneLength: [9, 10, 11] }, // Custom added by me
166
167
  FJ: { code: 'FJ', label: 'Fiji', phone: '679', phoneLength: 7 },
167
168
  FK: {
168
169
  code: 'FK',
@@ -247,7 +248,7 @@ export const codes = {
247
248
  JE: { code: 'JE', label: 'Jersey', phone: '44', phoneLength: 10 },
248
249
  JM: { code: 'JM', label: 'Jamaica', phone: '1-876', phoneLength: 10 },
249
250
  JO: { code: 'JO', label: 'Jordan', phone: '962', phoneLength: [8, 9] },
250
- JP: { code: 'JP', label: 'Japan', phone: '81', suggested: true },
251
+ JP: { code: 'JP', label: 'Japan', phone: '81', suggested: true, phoneLength: 11 }, // Custom added by me
251
252
  KE: { code: 'KE', label: 'Kenya', phone: '254', phoneLength: 10 },
252
253
  KG: { code: 'KG', label: 'Kyrgyzstan', phone: '996', phoneLength: 9 },
253
254
  KH: { code: 'KH', label: 'Cambodia', phone: '855', phoneLength: 9 },
@@ -324,7 +325,7 @@ export const codes = {
324
325
  phoneLength: 8
325
326
  },
326
327
  ML: { code: 'ML', label: 'Mali', phone: '223', phoneLength: 8 },
327
- MM: { code: 'MM', label: 'Myanmar', phone: '95', min: 7, max: 10 },
328
+ MM: { code: 'MM', label: 'Myanmar', phone: '95', min: 7, max: 10, phoneLength: [7, 8, 9, 10] }, // Custom added by me
328
329
  MN: { code: 'MN', label: 'Mongolia', phone: '976', phoneLength: 8 },
329
330
  MO: { code: 'MO', label: 'Macao', phone: '853', phoneLength: 8 },
330
331
  MP: {
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(result => {
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
- result.getSliceAsText = (offset, length) => Cpp.getSliceAsText(result.data, offset, length)
569
- result.getSliceAsArrayBuffer = (offset, length) => Cpp.getSliceAsArrayBuffer(result.data, offset, length)
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
  },
@@ -55,7 +55,8 @@ export const codes: Record<string, CountryItem> = {
55
55
  label: 'Alland Islands',
56
56
  phone: '358',
57
57
  min: 7,
58
- max: 10
58
+ max: 10,
59
+ phoneLength: [7, 8, 9, 10], // Custom added by me
59
60
  },
60
61
  AZ: { code: 'AZ', label: 'Azerbaijan', phone: '994', phoneLength: 9 },
61
62
  BA: {
@@ -167,7 +168,7 @@ export const codes: Record<string, CountryItem> = {
167
168
  ER: { code: 'ER', label: 'Eritrea', phone: '291', phoneLength: 7 },
168
169
  ES: { code: 'ES', label: 'Spain', phone: '34', phoneLength: 9 },
169
170
  ET: { code: 'ET', label: 'Ethiopia', phone: '251', phoneLength: 9 },
170
- FI: { code: 'FI', label: 'Finland', phone: '358', min: 9, max: 11 },
171
+ FI: { code: 'FI', label: 'Finland', phone: '358', min: 9, max: 11, phoneLength: [9, 10, 11] }, // Custom added by me
171
172
  FJ: { code: 'FJ', label: 'Fiji', phone: '679', phoneLength: 7 },
172
173
  FK: {
173
174
  code: 'FK',
@@ -252,7 +253,7 @@ export const codes: Record<string, CountryItem> = {
252
253
  JE: { code: 'JE', label: 'Jersey', phone: '44', phoneLength: 10 },
253
254
  JM: { code: 'JM', label: 'Jamaica', phone: '1-876', phoneLength: 10 },
254
255
  JO: { code: 'JO', label: 'Jordan', phone: '962', phoneLength: [ 8, 9 ] },
255
- JP: { code: 'JP', label: 'Japan', phone: '81', suggested: true },
256
+ JP: { code: 'JP', label: 'Japan', phone: '81', suggested: true, phoneLength: 11 }, // Custom added by me
256
257
  KE: { code: 'KE', label: 'Kenya', phone: '254', phoneLength: 10 },
257
258
  KG: { code: 'KG', label: 'Kyrgyzstan', phone: '996', phoneLength: 9 },
258
259
  KH: { code: 'KH', label: 'Cambodia', phone: '855', phoneLength: 9 },
@@ -329,7 +330,7 @@ export const codes: Record<string, CountryItem> = {
329
330
  phoneLength: 8
330
331
  },
331
332
  ML: { code: 'ML', label: 'Mali', phone: '223', phoneLength: 8 },
332
- MM: { code: 'MM', label: 'Myanmar', phone: '95', min: 7, max: 10 },
333
+ MM: { code: 'MM', label: 'Myanmar', phone: '95', min: 7, max: 10, phoneLength: [7, 8, 9, 10] }, // Custom added by me
333
334
  MN: { code: 'MN', label: 'Mongolia', phone: '976', phoneLength: 8 },
334
335
  MO: { code: 'MO', label: 'Macao', phone: '853', phoneLength: 8 },
335
336
  MP: {
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
- const decoded = jwt.verify(refreshToken, REFRESH_TOKEN_SECRET)
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);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.226",
4
+ "version": "1.0.228",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "./index.ts",