@arkstack/common 0.18.10 → 0.18.12

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.
@@ -41,6 +41,22 @@ declare class Logger {
41
41
  */
42
42
  static twoColumnDetail(name: string, value: string, log?: true, spacer?: string): void;
43
43
  static twoColumnDetail(name: string, value: string, log?: false, spacer?: string): [string, string, string];
44
+ /**
45
+ * Convert absolute paths under current working directory into relative display paths.
46
+ *
47
+ * @param filePath
48
+ * @returns
49
+ */
50
+ static formatPathForLog(filePath: string): string;
51
+ /**
52
+ * Utility to format a value for logging, converting absolute paths under current
53
+ * working directory into relative display paths.
54
+ *
55
+ * @param name
56
+ * @param value
57
+ * @returns
58
+ */
59
+ static splitLogger(name: string, value: string): string;
44
60
  /**
45
61
  * Logs the message in two columns
46
62
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./app.d.ts" />
2
- import { $ as HookPos, A as SealedBox, B as ConfigShape, C as Encryption, D as KeyPair, E as KeyInput, F as ArkstackErrorShape, G as EnvRegistry, H as DotPathValue, I as Choice, J as GlobalConfig, K as EnvReturn, L as Choices, M as SerializedKeyPair, N as AppConfig, O as Keys, P as ArkstackErrorPayload, Q as HookName, R as Concrete, S as DerivedKey, T as FingerprintOptions, U as EnvKey, V as DotPath, W as EnvLookup, X as HookArgs, Y as GlobalEnv, Z as HookFor, _ as ChannelOptions, a as abort, at as LoggerParseSignature, b as Codec, c as getModel, ct as Primitive, d as isClass, dt as PublishFilter, et as HookPositions, f as normalizePositiveInteger, ft as PublishGroup, g as Hash, h as setModelResolver, i as ModelResolver, it as LoggerLog, j as SecureChannel, k as NodeCipher, l as getModelSync, lt as PublishConfirmation, m as resolvePagination, mt as Logger, n as ModelConstructor, nt as IHook, o as abortIf, ot as MergedConfig, p as perPage, pt as UnionToIntersection, q as FileImporter, r as ModelRegistry, rt as LoggerChalk, s as assertFound, st as PaginationOptions, t as AbstractModelConstructor, tt as HookRegistry, u as initializeGlobalContext, ut as PublishEntry, v as Cipher, w as EncryptionKey, x as DeriveOptions, y as CipherOptions, z as ConfigRegistry } from "./helpers-D7et2JwN.js";
2
+ import { $ as HookPos, A as SealedBox, B as ConfigShape, C as Encryption, D as KeyPair, E as KeyInput, F as ArkstackErrorShape, G as EnvRegistry, H as DotPathValue, I as Choice, J as GlobalConfig, K as EnvReturn, L as Choices, M as SerializedKeyPair, N as AppConfig, O as Keys, P as ArkstackErrorPayload, Q as HookName, R as Concrete, S as DerivedKey, T as FingerprintOptions, U as EnvKey, V as DotPath, W as EnvLookup, X as HookArgs, Y as GlobalEnv, Z as HookFor, _ as ChannelOptions, a as abort, at as LoggerParseSignature, b as Codec, c as getModel, ct as Primitive, d as isClass, dt as PublishFilter, et as HookPositions, f as normalizePositiveInteger, ft as PublishGroup, g as Hash, h as setModelResolver, i as ModelResolver, it as LoggerLog, j as SecureChannel, k as NodeCipher, l as getModelSync, lt as PublishConfirmation, m as resolvePagination, mt as Logger, n as ModelConstructor, nt as IHook, o as abortIf, ot as MergedConfig, p as perPage, pt as UnionToIntersection, q as FileImporter, r as ModelRegistry, rt as LoggerChalk, s as assertFound, st as PaginationOptions, t as AbstractModelConstructor, tt as HookRegistry, u as initializeGlobalContext, ut as PublishEntry, v as Cipher, w as EncryptionKey, x as DeriveOptions, y as CipherOptions, z as ConfigRegistry } from "./helpers-CWLBYxS-.js";
3
3
  import { Arkstack } from "@arkstack/contract";
4
4
  import { ForkOptions } from "node:child_process";
5
5
  import pino from "pino";
package/dist/index.js CHANGED
@@ -336,6 +336,30 @@ var Logger = class Logger {
336
336
  value
337
337
  ];
338
338
  }
339
+ /**
340
+ * Convert absolute paths under current working directory into relative display paths.
341
+ *
342
+ * @param filePath
343
+ * @returns
344
+ */
345
+ static formatPathForLog(filePath) {
346
+ const relPath = path.relative(process.cwd(), filePath);
347
+ if (!relPath) return ".";
348
+ if (relPath.startsWith("..")) return filePath;
349
+ return relPath;
350
+ }
351
+ /**
352
+ * Utility to format a value for logging, converting absolute paths under current
353
+ * working directory into relative display paths.
354
+ *
355
+ * @param name
356
+ * @param value
357
+ * @returns
358
+ */
359
+ static splitLogger(name, value) {
360
+ value = value.includes(process.cwd()) ? this.formatPathForLog(value) : value;
361
+ return this.twoColumnDetail(name + " ", " " + value, false).join("");
362
+ }
339
363
  static describe(name, desc, width = 50, log = true) {
340
364
  width = Math.max(width, 30);
341
365
  const dots = Math.max(width - name.replace(/\x1b\[\d+m/g, "").length, 0);
@@ -1,4 +1,4 @@
1
- import { A as SealedBox, C as Encryption, D as KeyPair, E as KeyInput, M as SerializedKeyPair, O as Keys, S as DerivedKey, T as FingerprintOptions, _ as ChannelOptions, a as abort, b as Codec, c as getModel, d as isClass, f as normalizePositiveInteger, g as Hash, h as setModelResolver, i as ModelResolver, j as SecureChannel, k as NodeCipher, l as getModelSync, m as resolvePagination, n as ModelConstructor, o as abortIf, p as perPage, r as ModelRegistry, s as assertFound, t as AbstractModelConstructor, u as initializeGlobalContext, v as Cipher, w as EncryptionKey, x as DeriveOptions, y as CipherOptions } from "../helpers-D7et2JwN.js";
1
+ import { A as SealedBox, C as Encryption, D as KeyPair, E as KeyInput, M as SerializedKeyPair, O as Keys, S as DerivedKey, T as FingerprintOptions, _ as ChannelOptions, a as abort, b as Codec, c as getModel, d as isClass, f as normalizePositiveInteger, g as Hash, h as setModelResolver, i as ModelResolver, j as SecureChannel, k as NodeCipher, l as getModelSync, m as resolvePagination, n as ModelConstructor, o as abortIf, p as perPage, r as ModelRegistry, s as assertFound, t as AbstractModelConstructor, u as initializeGlobalContext, v as Cipher, w as EncryptionKey, x as DeriveOptions, y as CipherOptions } from "../helpers-CWLBYxS-.js";
2
2
  import { Model } from "arkormx";
3
3
  //#region src/utils/traits.d.ts
4
4
  declare const crc32: (str: string) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/common",
3
- "version": "0.18.10",
3
+ "version": "0.18.12",
4
4
  "type": "module",
5
5
  "description": "Core utilities, primitives, and shared infrastructure for the Arkstack ecosystem.",
6
6
  "homepage": "https://arkstack.toneflix.net",
@@ -43,13 +43,13 @@
43
43
  "otpauth": "^9.5.1",
44
44
  "pino": "^10.3.1",
45
45
  "selfsigned": "^2.4.1",
46
- "@arkstack/encryption": "^0.18.10"
46
+ "@arkstack/encryption": "^0.18.12"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@h3ravel/support": "^2.2.7",
50
50
  "arkormx": "^2.12.8",
51
- "@arkstack/contract": "^0.18.10",
52
- "@arkstack/foundry": "^0.18.10"
51
+ "@arkstack/contract": "^0.18.12",
52
+ "@arkstack/foundry": "^0.18.12"
53
53
  },
54
54
  "optionalDependencies": {
55
55
  "@faker-js/faker": "^10.4.0"