@arkiv-network/sdk 0.5.0-dev.2 → 0.5.0-dev.4

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 (57) hide show
  1. package/dist/chains/index.cjs +1 -1
  2. package/dist/chains/index.d.cts +33 -33
  3. package/dist/{chains-XCO31x6G.cjs → chains-DVQiGmF6.cjs} +13 -2
  4. package/dist/index.cjs +36 -17
  5. package/dist/index.d.cts +397 -3
  6. package/dist/index.d.cts.map +1 -0
  7. package/dist/index.d.ts +397 -3
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +32 -16
  10. package/dist/index.js.map +1 -1
  11. package/dist/{payload-D3fyOBWn.d.cts → payload-CJN8fTvX.d.cts} +1 -1
  12. package/dist/{payload-D3fyOBWn.d.cts.map → payload-CJN8fTvX.d.cts.map} +1 -1
  13. package/dist/{payload-BI2NXPDf.d.ts → payload-Da9gJMG5.d.ts} +1 -1
  14. package/dist/{payload-BI2NXPDf.d.ts.map → payload-Da9gJMG5.d.ts.map} +1 -1
  15. package/dist/{payload-eB1a8vZH.cjs → payload-vwU3Rc6P.cjs} +0 -1
  16. package/dist/query/index.cjs +1 -4
  17. package/dist/query/index.d.cts +3 -16
  18. package/dist/query/index.d.ts +3 -16
  19. package/dist/query/index.js +2 -2
  20. package/dist/query-C0dwQYxT.d.cts +320 -0
  21. package/dist/query-C0dwQYxT.d.cts.map +1 -0
  22. package/dist/query-DybEplzd.d.ts +320 -0
  23. package/dist/query-DybEplzd.d.ts.map +1 -0
  24. package/dist/{queryBuilder-DNUwJvf0.js → queryBuilder-BkWFLc3Y.js} +121 -5
  25. package/dist/queryBuilder-BkWFLc3Y.js.map +1 -0
  26. package/dist/{queryBuilder-KrdIUVZv.cjs → queryBuilder-BozfXlzA.cjs} +125 -5
  27. package/dist/queryBuilder-DfetMC5Z.d.cts +317 -0
  28. package/dist/queryBuilder-DfetMC5Z.d.cts.map +1 -0
  29. package/dist/queryBuilder-XIln1aIM.d.ts +317 -0
  30. package/dist/queryBuilder-XIln1aIM.d.ts.map +1 -0
  31. package/dist/types/index.d.cts +2 -3
  32. package/dist/types/index.d.ts +2 -3
  33. package/dist/utils/index.cjs +1 -1
  34. package/dist/utils/index.d.cts +1 -1
  35. package/dist/utils/index.d.ts +1 -1
  36. package/package.json +1 -3
  37. package/src/actions/public/getEntity.ts +1 -1
  38. package/src/actions/public/query.ts +12 -1
  39. package/src/clients/decorators/arkivPublic.ts +5 -5
  40. package/src/clients/decorators/arkivWallet.ts +2 -2
  41. package/src/{query/errors.ts → errors.ts} +10 -0
  42. package/src/index.ts +2 -2
  43. package/src/query/index.ts +0 -1
  44. package/src/query/queryResult.test.ts +1 -1
  45. package/src/query/queryResult.ts +1 -1
  46. package/src/types/index.ts +1 -0
  47. package/src/types/rpcSchema.ts +1 -1
  48. package/src/utils/arkivTransactions.ts +31 -13
  49. package/src/utils/logger.ts +202 -5
  50. package/dist/chunk-pbleEpgJ.cjs +0 -44
  51. package/dist/index-B801JxcV.d.ts +0 -1003
  52. package/dist/index-B801JxcV.d.ts.map +0 -1
  53. package/dist/index-DQGx5KZ6.d.cts +0 -1003
  54. package/dist/index-DQGx5KZ6.d.cts.map +0 -1
  55. package/dist/query/index.d.cts.map +0 -1
  56. package/dist/query/index.d.ts.map +0 -1
  57. package/dist/queryBuilder-DNUwJvf0.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { n as stringToPayload, t as jsonToPayload } from "../payload-D3fyOBWn.cjs";
1
+ import { n as stringToPayload, t as jsonToPayload } from "../payload-CJN8fTvX.cjs";
2
2
  export * from "viem/utils";
3
3
 
4
4
  //#region src/utils/expirationTime.d.ts
@@ -1,4 +1,4 @@
1
- import { n as stringToPayload, t as jsonToPayload } from "../payload-BI2NXPDf.js";
1
+ import { n as stringToPayload, t as jsonToPayload } from "../payload-Da9gJMG5.js";
2
2
  export * from "viem/utils";
3
3
 
4
4
  //#region src/utils/expirationTime.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkiv-network/sdk",
3
- "version": "0.5.0-dev.2",
3
+ "version": "0.5.0-dev.4",
4
4
  "description": "TypeScript client library for Arkiv's blockchains interactions",
5
5
  "type": "module",
6
6
  "target": "esnext",
@@ -87,7 +87,6 @@
87
87
  "devDependencies": {
88
88
  "@biomejs/biome": "2.2.4",
89
89
  "@types/bun": "latest",
90
- "@types/debug": "^4.1.12",
91
90
  "rimraf": "^6.0.1",
92
91
  "tsdown": "^0.16.0",
93
92
  "typedoc": "^0.28.14"
@@ -119,7 +118,6 @@
119
118
  "homepage": "https://arkiv.network",
120
119
  "dependencies": {
121
120
  "brotli-wasm": "^3.0.1",
122
- "debug": "^4.3.7",
123
121
  "typedoc-plugin-markdown": "^4.9.0",
124
122
  "viem": "^2.38.2"
125
123
  }
@@ -1,6 +1,6 @@
1
1
  import { bytesToHex, type Hex, hexToBytes } from "viem"
2
2
  import type { ArkivClient } from "../../clients/baseClient"
3
- import { NoEntityFoundError } from "../../query/errors"
3
+ import { NoEntityFoundError } from "../../errors"
4
4
  import { entityFromRpcResult } from "../../utils/entities"
5
5
 
6
6
  export async function getEntity(client: ArkivClient, key: Hex) {
@@ -1,4 +1,5 @@
1
1
  import type { ArkivClient } from "../../clients/baseClient"
2
+ import type { Entity } from "../../types/entity"
2
3
  import type { RpcQueryOptions } from "../../types/rpcSchema"
3
4
  import { entityFromRpcResult } from "../../utils/entities"
4
5
 
@@ -21,6 +22,12 @@ export type QueryOptions = {
21
22
  cursor?: string | undefined
22
23
  }
23
24
 
25
+ export type QueryReturnType = {
26
+ entities: Entity[]
27
+ cursor: string | undefined
28
+ blockNumber: bigint | undefined
29
+ }
30
+
24
31
  export async function query(client: ArkivClient, query: string, queryOptions?: QueryOptions) {
25
32
  const rpcQueryOptions: RpcQueryOptions = {
26
33
  includeData: {
@@ -56,5 +63,9 @@ export async function query(client: ArkivClient, query: string, queryOptions?: Q
56
63
 
57
64
  const entities = await Promise.all(result.data.map((entity) => entityFromRpcResult(entity)))
58
65
 
59
- return entities
66
+ return {
67
+ entities,
68
+ cursor: result.cursor,
69
+ blockNumber: BigInt(result.blockNumber),
70
+ }
60
71
  }
@@ -2,7 +2,7 @@ import type { Account, Chain, Client, Hex, PublicActions, Transport } from "viem
2
2
  import { getBlockTiming } from "../../actions/public/getBlockTiming"
3
3
  import { getEntity } from "../../actions/public/getEntity"
4
4
  import { getEntityCount } from "../../actions/public/getEntityCount"
5
- import { type QueryOptions, query } from "../../actions/public/query"
5
+ import { type QueryOptions, type QueryReturnType, query } from "../../actions/public/query"
6
6
  import { subscribeEntityEvents } from "../../actions/public/subscribeEntityEvents"
7
7
  import { QueryBuilder } from "../../query/queryBuilder"
8
8
  import type { Entity } from "../../types/entity"
@@ -82,7 +82,7 @@ export type PublicArkivActions<
82
82
  * If no query options are provided, all payload is included, but no metadata (like owner, expiredAt, etc.) and attributes.
83
83
  * @param query - The raw query string
84
84
  * @param queryOptions - The optional query options - {@link QueryOptions}
85
- * @returns An array of entities matching the query. {@link Entity}
85
+ * @returns A QueryReturnType instance - {@link QueryReturnType}
86
86
  *
87
87
  * @example
88
88
  * import { createPublicClient, http } from 'arkiv'
@@ -93,7 +93,7 @@ export type PublicArkivActions<
93
93
  * transport: http(),
94
94
  * })
95
95
  * const queryResult = client.query('key = value && $owner = 0x123')
96
- * // queryResult = [{ key: "0x123", value: "0x123" }]
96
+ * // queryResult = { entities: [{ key: "0x123", value: "0x123" }], cursor: undefined, blockNumber: undefined }
97
97
  * const queryResultWithOptions = client.query('key = value && $owner = 0x123', {
98
98
  * includeData: {
99
99
  * attributes: false,
@@ -105,9 +105,9 @@ export type PublicArkivActions<
105
105
  * cursor: undefined,
106
106
  * atBlock: undefined,
107
107
  * })
108
- * // queryResultWithOptions = [{ key: "0x123", value: "0x123" }]
108
+ * // queryResultWithOptions = { entities: [{ key: "0x123", value: "0x123" }], cursor: "...", blockNumber: 32223n }
109
109
  */
110
- query: (query: string, queryOptions?: QueryOptions) => Promise<Entity[]>
110
+ query: (query: string, queryOptions?: QueryOptions) => Promise<QueryReturnType>
111
111
 
112
112
  /**
113
113
  * Returns the number of entities in the DBChain.
@@ -39,10 +39,10 @@ export type WalletArkivActions<
39
39
  Pick<
40
40
  WalletActions<chain, account>,
41
41
  | "addChain"
42
+ | "sendCalls"
43
+ | "waitForCallsStatus"
42
44
  | "sendTransaction"
43
- | "sendTransactionSync"
44
45
  | "sendRawTransaction"
45
- | "sendRawTransactionSync"
46
46
  | "signMessage"
47
47
  | "signTransaction"
48
48
  > & {
@@ -1,17 +1,27 @@
1
+ export class EntityMutationError extends Error {
2
+ constructor(message: string) {
3
+ super(message)
4
+ this.name = "EntityMutationError"
5
+ }
6
+ }
7
+
1
8
  export class NoMoreResultsError extends Error {
2
9
  constructor() {
3
10
  super("No more results")
11
+ this.name = "NoMoreResultsError"
4
12
  }
5
13
  }
6
14
 
7
15
  export class NoCursorOrLimitError extends Error {
8
16
  constructor() {
9
17
  super("Cursor and limit must be defined to fetch next")
18
+ this.name = "NoCursorOrLimitError"
10
19
  }
11
20
  }
12
21
 
13
22
  export class NoEntityFoundError extends Error {
14
23
  constructor() {
15
24
  super("No entity found")
25
+ this.name = "NoEntityFoundError"
16
26
  }
17
27
  }
package/src/index.ts CHANGED
@@ -13,10 +13,10 @@ export type { WalletArkivClient } from "./clients/createWalletClient"
13
13
  export { createWalletClient } from "./clients/createWalletClient"
14
14
  export type { PublicArkivActions } from "./clients/decorators/arkivPublic"
15
15
  export type { WalletArkivActions } from "./clients/decorators/arkivWallet"
16
-
16
+ // re-export errors
17
+ export * from "./errors"
17
18
  // re-export arkiv types in main index file
18
19
  export * from "./types"
19
-
20
20
  // re-export chosen utils
21
21
  export { chainFromName } from "./utils/chains"
22
22
  export { jsonToPayload, stringToPayload } from "./utils/payload"
@@ -1,4 +1,3 @@
1
- export * from "./errors"
2
1
  export * from "./predicate"
3
2
  export * from "./queryBuilder"
4
3
  export * from "./queryResult"
@@ -1,6 +1,6 @@
1
1
  import { beforeEach, describe, expect, jest, test } from "bun:test"
2
+ import { NoCursorOrLimitError, NoMoreResultsError } from "../errors"
2
3
  import { Entity } from "../types/entity"
3
- import { NoCursorOrLimitError, NoMoreResultsError } from "./errors"
4
4
  import type { QueryBuilder } from "./queryBuilder"
5
5
  import { QueryResult } from "./queryResult"
6
6
 
@@ -1,6 +1,6 @@
1
+ import { NoCursorOrLimitError, NoMoreResultsError } from "../errors"
1
2
  import type { Entity } from "../types/entity"
2
3
  import { getLogger } from "../utils/logger"
3
- import { NoCursorOrLimitError, NoMoreResultsError } from "./errors"
4
4
  import type { QueryBuilder } from "./queryBuilder"
5
5
 
6
6
  const logger = getLogger("query:result")
@@ -3,6 +3,7 @@ export type {
3
3
  QueryOptions,
4
4
  QueryOptionsIncludeData,
5
5
  QueryOptionsOrderBy,
6
+ QueryReturnType,
6
7
  } from "../actions/public/query"
7
8
  export type {
8
9
  ChangeOwnershipParameters,
@@ -48,7 +48,7 @@ export type ArkivRpcSchema = [
48
48
  Parameters?: [query: string, queryOptions?: RpcQueryOptions]
49
49
  ReturnType: {
50
50
  data: RpcEntity[]
51
- blockNumber: bigint
51
+ blockNumber: number
52
52
  cursor: string
53
53
  }
54
54
  },
@@ -1,4 +1,4 @@
1
- import { type Hex, toBytes, toHex, toRlp } from "viem"
1
+ import { type Hex, TransactionExecutionError, toBytes, toHex, toRlp } from "viem"
2
2
  import type { ChangeOwnershipParameters } from "../actions/wallet/changeOwnership"
3
3
  import type { CreateEntityParameters } from "../actions/wallet/createEntity"
4
4
  import type { DeleteEntityParameters } from "../actions/wallet/deleteEntity"
@@ -7,6 +7,7 @@ import type { UpdateEntityParameters } from "../actions/wallet/updateEntity"
7
7
  import type { ArkivClient } from "../clients/baseClient"
8
8
  import type { WalletArkivClient } from "../clients/createWalletClient"
9
9
  import { ARKIV_ADDRESS, BLOCK_TIME } from "../consts"
10
+ import { EntityMutationError } from "../errors"
10
11
  import type { TxParams } from "../types"
11
12
  import { compress } from "./compression"
12
13
  import { getLogger } from "./logger"
@@ -85,19 +86,36 @@ export async function sendArkivTransaction(client: ArkivClient, data: Hex, txPar
85
86
  ...txParams,
86
87
  })
87
88
 
88
- const compressed = await compress(toBytes(data))
89
- const txHash = await walletClient.sendTransaction({
90
- account: client.account,
91
- chain: client.chain,
92
- to: ARKIV_ADDRESS,
93
- value: 0n,
94
- data: toHex(compressed),
95
- ...txParams,
96
- })
89
+ try {
90
+ const compressed = await compress(toBytes(data))
91
+ const txHash = await walletClient.sendTransaction({
92
+ account: client.account,
93
+ chain: client.chain,
94
+ to: ARKIV_ADDRESS,
95
+ value: 0n,
96
+ data: toHex(compressed),
97
+ ...txParams,
98
+ })
97
99
 
98
- const receipt = await walletClient.waitForTransactionReceipt({ hash: txHash })
100
+ const receipt = await walletClient.waitForTransactionReceipt({ hash: txHash })
101
+ logger("Tx receipt %o", receipt)
102
+ if (receipt.status === "reverted") {
103
+ logger("Reverted transaction %o", receipt)
104
+ throw new EntityMutationError(
105
+ `Transaction ${receipt.transactionHash} reverted. Please make sure the data for entities doesn't contain invalid characters or invalid data types.`,
106
+ )
107
+ }
99
108
 
100
- logger("Tx receipt %o", receipt)
109
+ return receipt
110
+ } catch (error) {
111
+ let message = "Transaction failed"
112
+ if (error instanceof TransactionExecutionError) {
113
+ message += `: ${error.details}`
114
+ } else if (error instanceof EntityMutationError) {
115
+ throw error
116
+ }
101
117
 
102
- return receipt
118
+ logger("%s Detailed error stack: %o", message, error)
119
+ throw new EntityMutationError(message)
120
+ }
103
121
  }
@@ -1,13 +1,210 @@
1
- import createDebug from "debug"
2
-
3
1
  const ROOT_NAMESPACE = "arkiv"
4
2
 
5
- export const getLogger = (scope: string) => createDebug(`${ROOT_NAMESPACE}:${scope}`)
3
+ // Debug logger type - returns a function that can be called to log messages
4
+ type DebugLogger = (...args: unknown[]) => void
5
+
6
+ // Get DEBUG environment variable (works in both Node.js and browser)
7
+ function getDebugEnv(): string {
8
+ if (typeof process !== "undefined") {
9
+ const debugEnv = process?.env?.DEBUG
10
+ if (debugEnv) {
11
+ return debugEnv
12
+ }
13
+ }
14
+ // Browser: check localStorage
15
+ if (typeof globalThis !== "undefined" && "localStorage" in globalThis) {
16
+ try {
17
+ const storage = (globalThis as { localStorage?: Storage }).localStorage
18
+ return storage?.getItem("DEBUG") || ""
19
+ } catch {
20
+ // localStorage might not be available
21
+ }
22
+ }
23
+ return ""
24
+ }
25
+
26
+ // Parse debug patterns and check if a namespace matches
27
+ function matchesPattern(namespace: string, pattern: string): boolean {
28
+ // Exact match
29
+ if (pattern === namespace) return true
30
+
31
+ // Wildcard match: "arkiv:*" matches "arkiv:query", "arkiv:rpc", etc.
32
+ if (pattern.endsWith("*")) {
33
+ const prefix = pattern.slice(0, -1)
34
+ return namespace.startsWith(prefix)
35
+ }
36
+
37
+ // Negative match: "-arkiv:query" excludes "arkiv:query"
38
+ if (pattern.startsWith("-")) {
39
+ const excludePattern = pattern.slice(1)
40
+ return !matchesPattern(namespace, excludePattern)
41
+ }
42
+
43
+ return false
44
+ }
45
+
46
+ // Check if a namespace is enabled for debugging
47
+ function isEnabled(namespace: string): boolean {
48
+ const debugEnv = getDebugEnv()
49
+ if (!debugEnv) return false
50
+
51
+ // Split by comma/space and check each pattern
52
+ const patterns = debugEnv.split(/[\s,]+/).filter((p) => p.length > 0)
53
+
54
+ // If no patterns, nothing is enabled
55
+ if (patterns.length === 0) return false
56
+
57
+ // Check if any pattern matches (or if explicitly excluded)
58
+ let enabled = false
59
+ for (const pattern of patterns) {
60
+ if (pattern.startsWith("-")) {
61
+ // Exclude pattern - if it matches, disable
62
+ if (matchesPattern(namespace, pattern)) {
63
+ return false
64
+ }
65
+ } else if (matchesPattern(namespace, pattern)) {
66
+ enabled = true
67
+ }
68
+ }
69
+
70
+ return enabled
71
+ }
72
+
73
+ // Store enabled namespaces (for programmatic enable/disable)
74
+ const enabledNamespaces: Set<string> = new Set()
75
+ const disabledNamespaces: Set<string> = new Set()
76
+
77
+ // Color palette for namespace coloring (distinct, readable colors)
78
+ const COLOR_PALETTE = [
79
+ "#0000FF", // blue
80
+ "#008000", // green
81
+ "#FF0000", // red
82
+ "#FF00FF", // magenta
83
+ "#FFA500", // orange
84
+ "#800080", // purple
85
+ "#00CED1", // dark turquoise
86
+ "#FF1493", // deep pink
87
+ "#32CD32", // lime green
88
+ "#1E90FF", // dodger blue
89
+ "#FF4500", // orange red
90
+ "#9370DB", // medium purple
91
+ "#00FA9A", // medium spring green
92
+ "#FFD700", // gold
93
+ "#DC143C", // crimson
94
+ "#00BFFF", // deep sky blue
95
+ "#FF69B4", // hot pink
96
+ "#20B2AA", // light sea green
97
+ "#DA70D6", // orchid
98
+ "#4682B4", // steel blue
99
+ ]
100
+
101
+ // Detect if we're in Node.js (for ANSI colors) or browser (for CSS colors)
102
+ const isNode = typeof process !== "undefined" && process.versions?.node != null
103
+
104
+ // ANSI color codes for Node.js (bright, distinct colors)
105
+ const ANSI_COLORS = [
106
+ "\x1b[94m", // bright blue
107
+ "\x1b[92m", // bright green
108
+ "\x1b[91m", // bright red
109
+ "\x1b[95m", // bright magenta
110
+ "\x1b[93m", // bright yellow
111
+ "\x1b[96m", // bright cyan
112
+ "\x1b[35m", // magenta
113
+ "\x1b[36m", // cyan
114
+ "\x1b[32m", // green
115
+ "\x1b[34m", // blue
116
+ "\x1b[33m", // yellow
117
+ "\x1b[31m", // red
118
+ "\x1b[90m", // bright black (gray)
119
+ "\x1b[37m", // white
120
+ "\x1b[1m", // bold (as a color option)
121
+ ]
122
+
123
+ const ANSI_RESET = "\x1b[0m"
124
+ const ANSI_BOLD = "\x1b[1m"
125
+
126
+ // Cache colors for namespaces (same namespace = same color)
127
+ const namespaceColors = new Map<string, { css: string; ansi: string }>()
128
+
129
+ // Generate a consistent color for a namespace based on its hash
130
+ function getColorForNamespace(namespace: string): { css: string; ansi: string } {
131
+ // Check cache first
132
+ const cachedColor = namespaceColors.get(namespace)
133
+ if (cachedColor) {
134
+ return cachedColor
135
+ }
136
+
137
+ // Simple hash function to convert string to number
138
+ let hash = 0
139
+ for (let i = 0; i < namespace.length; i++) {
140
+ const char = namespace.charCodeAt(i)
141
+ hash = (hash << 5) - hash + char
142
+ hash = hash & hash // Convert to 32-bit integer
143
+ }
144
+
145
+ // Use absolute value and modulo to get index
146
+ const colorIndex = Math.abs(hash) % COLOR_PALETTE.length
147
+ const cssColor = COLOR_PALETTE[colorIndex]
148
+ const ansiColor = ANSI_COLORS[colorIndex % ANSI_COLORS.length]
149
+
150
+ const color = { css: cssColor, ansi: ansiColor }
151
+
152
+ // Cache the color
153
+ namespaceColors.set(namespace, color)
154
+
155
+ return color
156
+ }
157
+
158
+ // Create a debug logger function
159
+ function createDebugLogger(namespace: string): DebugLogger {
160
+ // Get the color for this namespace (consistent across calls)
161
+ const colors = getColorForNamespace(namespace)
162
+
163
+ return (...args: unknown[]) => {
164
+ // Check if enabled via environment variable or programmatically
165
+ const envEnabled = isEnabled(namespace)
166
+ const progEnabled = enabledNamespaces.has(namespace) && !disabledNamespaces.has(namespace)
167
+
168
+ if (envEnabled || progEnabled) {
169
+ if (isNode) {
170
+ // Node.js: use ANSI color codes
171
+ const coloredNamespace = `${ANSI_BOLD}${colors.ansi}${namespace}${ANSI_RESET}`
172
+ console.log(coloredNamespace, ...args)
173
+ } else {
174
+ // Browser: use CSS styling with %c
175
+ // The format is: console.log("%cstyled%cnormal", style1, style2, ...args)
176
+ // This colors the namespace, then resets for the rest
177
+ const style1 = `color: ${colors.css}; font-weight: bold`
178
+ const style2 = "color: inherit; font-weight: normal"
179
+ // Combine namespace with a space, then log with styles
180
+ console.log(`%c${namespace}%c`, style1, style2, ...args)
181
+ }
182
+ }
183
+ }
184
+ }
185
+
186
+ export const getLogger = (scope: string): DebugLogger => {
187
+ const namespace = `${ROOT_NAMESPACE}:${scope}`
188
+ return createDebugLogger(namespace)
189
+ }
6
190
 
7
191
  export const enableDebug = (namespaces: string): void => {
8
- createDebug.enable(namespaces)
192
+ // Parse and add namespaces to enabled set
193
+ const patterns = namespaces.split(/[\s,]+/).filter((p) => p.length > 0)
194
+ for (const pattern of patterns) {
195
+ if (pattern.startsWith("-")) {
196
+ // Remove from enabled, add to disabled
197
+ const namespace = pattern.slice(1)
198
+ enabledNamespaces.delete(namespace)
199
+ disabledNamespaces.add(namespace)
200
+ } else {
201
+ enabledNamespaces.add(pattern)
202
+ disabledNamespaces.delete(pattern)
203
+ }
204
+ }
9
205
  }
10
206
 
11
207
  export const disableDebug = (): void => {
12
- createDebug.disable()
208
+ enabledNamespaces.clear()
209
+ disabledNamespaces.clear()
13
210
  }
@@ -1,44 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (all) => {
9
- let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- return target;
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
- key = keys[i];
19
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
- get: ((k) => from[k]).bind(null, key),
21
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
- });
23
- }
24
- return to;
25
- };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
- value: mod,
28
- enumerable: true
29
- }) : target, mod));
30
-
31
- //#endregion
32
-
33
- Object.defineProperty(exports, '__export', {
34
- enumerable: true,
35
- get: function () {
36
- return __export;
37
- }
38
- });
39
- Object.defineProperty(exports, '__toESM', {
40
- enumerable: true,
41
- get: function () {
42
- return __toESM;
43
- }
44
- });