cordo 2.12.0 → 2.12.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordo",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
4
4
  "description": "A framework for handling complex discord api interactions",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
package/src/core/hooks.ts CHANGED
@@ -44,7 +44,7 @@ export namespace Hooks {
44
44
  }
45
45
 
46
46
  export function isDefined(name: keyof CordoConfig['hooks']) {
47
- return !!CordoMagic.getConfig()?.hooks[name]
47
+ return !!CordoMagic.getConfig()?.hooks?.[name]
48
48
  }
49
49
 
50
50
  }
@@ -1,7 +1,6 @@
1
1
  import { LockfileInternals } from "../core/files/lockfile"
2
2
  import { CordoMagic } from "../core/magic"
3
3
  import { RoutingResolve } from "../core/routing/resolve"
4
- import { MissingContextError } from "../errors/builtin/missing-context"
5
4
  import { LibIds } from "../lib/ids"
6
5
  import { LibUtils } from "../lib/utils"
7
6
  import { FunctInternals, type CordoFunct } from "./funct"
@@ -67,7 +66,8 @@ export namespace FunctCompiler {
67
66
  // encode arguments
68
67
  const lut = CordoMagic.getLockfile()?.lut
69
68
  if (!lut)
70
- throw new MissingContextError('toCustomId failed, no lockfile found in context.')
69
+ console.warn('toCustomId called without a lockfile.')
70
+ // throw new MissingContextError('toCustomId failed, no lockfile found in context.')
71
71
 
72
72
  let argusStr = ''
73
73
  let counter = -1
@@ -82,7 +82,7 @@ export namespace FunctCompiler {
82
82
  }
83
83
 
84
84
  // check if this argument is part of the lut
85
- const lutIndex = lut.indexOf(arg)
85
+ const lutIndex = lut?.indexOf(arg) ?? -1
86
86
  if (lutIndex >= 0) {
87
87
  argusStr += LutArgumentIndicator + LibIds.stringify(lutIndex, LockfileInternals.Const.idLength)
88
88
  continue
@@ -40,7 +40,7 @@ export function goto(
40
40
  ? FunctInternals.readFunct(path).path
41
41
  : path
42
42
 
43
- const flags = parseFlags(opts, FunctInternals.readFunct(path as any)?.flags ?? CordoMagic.getConfig()?.functDefaultFlags.gotoBits ?? 0)
43
+ const flags = parseFlags(opts, FunctInternals.readFunct(path as any)?.flags ?? CordoMagic.getConfig()?.functDefaultFlags?.gotoBits ?? 0)
44
44
 
45
45
  return FunctInternals.createFunct({
46
46
  type: 'goto',
@@ -57,7 +57,7 @@ export function run(
57
57
  ? FunctInternals.readFunct(path).path
58
58
  : path
59
59
 
60
- const flags = parseFlags(opts, FunctInternals.readFunct(path as any)?.flags ?? CordoMagic.getConfig()?.functDefaultFlags.runBits ?? 0)
60
+ const flags = parseFlags(opts, FunctInternals.readFunct(path as any)?.flags ?? CordoMagic.getConfig()?.functDefaultFlags?.runBits ?? 0)
61
61
 
62
62
  return FunctInternals.createFunct({
63
63
  type: 'run',
@@ -1,4 +1,4 @@
1
- import { expect, test } from "bun:test";
1
+ import { expect, test } from "bun:test"
2
2
  import { LibIds } from "./ids"
3
3
 
4
4
  test("1000 random numbers with parse single", () => {