@quatronic/qore 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/cli.js +66 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f7b490f6-b0af-5874-9ffa-f8010e3ba137")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2eacac78-c916-5f6b-825a-d5af2c955f32")}catch(e){}}();
4
4
  import { createRequire as __qoreCreateRequire } from "node:module"; const require = __qoreCreateRequire(import.meta.url);
5
5
  import {
6
6
  addSecretValues,
@@ -7530,8 +7530,64 @@ function classifyKeychainError(e, platform) {
7530
7530
  cause: e
7531
7531
  });
7532
7532
  }
7533
- var OsKeychain = class {
7534
- constructor(platform = process.platform) {
7533
+ var MAX_ENTRY_CHARS = 1200;
7534
+ var HEAD2 = /^qore-chunked:v1:(\d+):(\d+)$/;
7535
+ var ChunkedKeychain = class {
7536
+ constructor(store, maxChars = MAX_ENTRY_CHARS) {
7537
+ this.store = store;
7538
+ this.maxChars = maxChars;
7539
+ }
7540
+ store;
7541
+ maxChars;
7542
+ head(raw) {
7543
+ const m = raw === null ? null : HEAD2.exec(raw);
7544
+ return m ? { gen: Number(m[1]), n: Number(m[2]) } : null;
7545
+ }
7546
+ split(value) {
7547
+ const parts = [];
7548
+ for (let i = 0; i < value.length; ) {
7549
+ let end2 = Math.min(i + this.maxChars, value.length);
7550
+ if (end2 < value.length && /[\uD800-\uDBFF]/.test(value[end2 - 1])) end2--;
7551
+ parts.push(value.slice(i, end2));
7552
+ i = end2;
7553
+ }
7554
+ return parts;
7555
+ }
7556
+ async deleteChunks(account, h) {
7557
+ for (let i = 1; i <= h.n; i++) await this.store.delete(`${account}#${h.gen}.${i}`);
7558
+ }
7559
+ async get(account) {
7560
+ const raw = await this.store.get(account);
7561
+ const h = this.head(raw);
7562
+ if (!h) return raw;
7563
+ let value = "";
7564
+ for (let i = 1; i <= h.n; i++) {
7565
+ const part = await this.store.get(`${account}#${h.gen}.${i}`);
7566
+ if (part === null) return null;
7567
+ value += part;
7568
+ }
7569
+ return value;
7570
+ }
7571
+ async set(account, value) {
7572
+ const old = this.head(await this.store.get(account));
7573
+ if (value.length <= this.maxChars) {
7574
+ await this.store.set(account, value);
7575
+ } else {
7576
+ const gen = (old?.gen ?? 0) + 1;
7577
+ const parts = this.split(value);
7578
+ for (const [i, part] of parts.entries()) await this.store.set(`${account}#${gen}.${i + 1}`, part);
7579
+ await this.store.set(account, `qore-chunked:v1:${gen}:${parts.length}`);
7580
+ }
7581
+ if (old) await this.deleteChunks(account, old);
7582
+ }
7583
+ async delete(account) {
7584
+ const old = this.head(await this.store.get(account));
7585
+ await this.store.delete(account);
7586
+ if (old) await this.deleteChunks(account, old);
7587
+ }
7588
+ };
7589
+ var EntryKeychain = class {
7590
+ constructor(platform) {
7535
7591
  this.platform = platform;
7536
7592
  }
7537
7593
  platform;
@@ -7556,6 +7612,11 @@ var OsKeychain = class {
7556
7612
  });
7557
7613
  }
7558
7614
  };
7615
+ var OsKeychain = class extends ChunkedKeychain {
7616
+ constructor(platform = process.platform) {
7617
+ super(new EntryKeychain(platform));
7618
+ }
7619
+ };
7559
7620
 
7560
7621
  // src/platform/lock.ts
7561
7622
  import { mkdir as mkdir5, writeFile as writeFile5 } from "fs/promises";
@@ -7924,7 +7985,7 @@ function systemProxy(platform = process.platform) {
7924
7985
  }
7925
7986
 
7926
7987
  // src/version.ts
7927
- var VERSION = true ? "0.1.9" : "0.0.0-dev";
7988
+ var VERSION = true ? "0.1.10" : "0.0.0-dev";
7928
7989
 
7929
7990
  // src/cli.ts
7930
7991
  if (process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY) setGlobalDispatcher(new EnvHttpProxyAgent());
@@ -8004,4 +8065,4 @@ if (!drained) {
8004
8065
  process.exit();
8005
8066
  }
8006
8067
  //# sourceMappingURL=cli.js.map
8007
- //# debugId=f7b490f6-b0af-5874-9ffa-f8010e3ba137
8068
+ //# debugId=2eacac78-c916-5f6b-825a-d5af2c955f32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatronic/qore",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Qore developer CLI",
5
5
  "type": "module",
6
6
  "bin": {