cordo 2.2.3 → 2.2.5

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.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "A framework for handling complex discord api interactions",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -17,8 +17,8 @@ export function container(...components: AllowedComponentArray) {
17
17
  spoiler
18
18
  })),
19
19
 
20
- accentColor: (color: string | number) => {
21
- accentColor = color
20
+ accentColor: (color: string | number | null) => {
21
+ accentColor = color ?? undefined
22
22
  return out
23
23
  },
24
24
  spoiler: (value: boolean = true) => {
@@ -4,7 +4,7 @@ import { readModifier, type CordoModifier } from "./modifier"
4
4
  import type { AllowedComponents as ContainerAllowedComponents } from "./builtin/container"
5
5
 
6
6
 
7
- const CordoComponentSymbol = Symbol('CordoComponent')
7
+ const CordoComponentSymbol = Symbol.for('CordoComponent')
8
8
 
9
9
  export const ComponentType = {
10
10
  ActionRow: 1,
@@ -112,7 +112,7 @@ export function renderComponentList(
112
112
 
113
113
  if (!isComponent(item)) {
114
114
  const mod = readModifier(item)
115
- if (!modifiers.some(m => m.name === mod.name))
115
+ if (mod && !modifiers.some(m => m.name === mod.name))
116
116
  modifiers.push(mod)
117
117
  continue
118
118
  }
@@ -1,7 +1,7 @@
1
1
  import type { CordoComponentPayload, renderComponentList, StringComponentType } from "./component"
2
2
 
3
3
 
4
- const CordoModifierSymbol = Symbol('CordoModifier')
4
+ const CordoModifierSymbol = Symbol.for('CordoModifier')
5
5
 
6
6
  export type CordoModifier = {
7
7
  [CordoModifierSymbol]: {
@@ -9,7 +9,7 @@ import { parseFlags as runParseFlags, type FlagOpts as RunFlagOpts } from '../..
9
9
  import { parseFlags as gotoParseFlags, type FlagOpts as GotoFlagOpts } from '../../functions/impl/goto'
10
10
 
11
11
 
12
- const CordoConfigSymbol = Symbol('CordoConfigSymbol')
12
+ const CordoConfigSymbol = Symbol.for('CordoConfig')
13
13
 
14
14
  type HookFor<T, Context = never> = null | ((value: T, context: Context) => Promisable<T | null>)
15
15
  type TransformHookFor<T, Context = never> = null | ((value: T, context: Context) => T)
@@ -2,7 +2,7 @@ import { CordoError } from "../../errors"
2
2
  import type { RouteRequest } from "./route"
3
3
 
4
4
 
5
- const CordoErrorBoundarySymbol = Symbol('CordoErrorBoundary')
5
+ const CordoErrorBoundarySymbol = Symbol.for('CordoErrorBoundary')
6
6
 
7
7
  export type CordoErrorBoundary = {
8
8
  [CordoErrorBoundarySymbol]: typeof CordoErrorBoundarySymbol
@@ -6,7 +6,7 @@ import type { CordoComponent } from "../../components/component"
6
6
  import type { CordoModifier } from "../../components/modifier"
7
7
 
8
8
 
9
- const CordoRouteSymbol = Symbol('CordoRoute')
9
+ const CordoRouteSymbol = Symbol.for('CordoRoute')
10
10
 
11
11
  export type RouteResponse = Array<CordoComponent | CordoModifier>
12
12
 
@@ -133,7 +133,7 @@ export function assertCordoRequest<
133
133
  >(request: RouteRequest, assumptions: {
134
134
  location: Location
135
135
  source: Source
136
- }): request is RouteRequest & (
136
+ }): asserts request is RouteRequest & (
137
137
  Location extends 'guild'
138
138
  ? RouteRequestInGuild
139
139
  : RouteRequestInDM
@@ -148,7 +148,6 @@ export function assertCordoRequest<
148
148
  throw new RouteAssumptionFailedError(request, assumptions)
149
149
  if (assumptions.source && request.source !== assumptions.source)
150
150
  throw new RouteAssumptionFailedError(request, assumptions)
151
- return true
152
151
  }
153
152
 
154
153
  export namespace RouteInternals {
@@ -1,7 +1,7 @@
1
1
  import type { APIInteraction } from "discord-api-types/v10"
2
2
 
3
3
 
4
- const CordoInteractionSymbol = Symbol('CordoInteraction')
4
+ const CordoInteractionSymbol = Symbol.for('CordoInteraction')
5
5
 
6
6
  export type CordoInteraction = {
7
7
  [CordoInteractionSymbol]: {
@@ -3,7 +3,7 @@ import { evalGoto } from "./impl/goto"
3
3
  import { evalRun } from "./impl/run"
4
4
 
5
5
 
6
- const CordoFunctSymbol = Symbol('CordoFunct')
6
+ const CordoFunctSymbol = Symbol.for('CordoFunct')
7
7
 
8
8
  export type CordoFunctRun = CordoFunct[]
9
9