@dxos/keys 0.8.3 → 0.8.4-main.84f28bd

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": "@dxos/keys",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.84f28bd",
4
4
  "description": "Key utils and definitions.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -27,11 +27,11 @@
27
27
  "src"
28
28
  ],
29
29
  "dependencies": {
30
- "effect": "3.14.21",
30
+ "effect": "3.16.13",
31
31
  "ulidx": "^2.3.0",
32
- "@dxos/invariant": "0.8.3",
33
- "@dxos/debug": "0.8.3",
34
- "@dxos/node-std": "0.8.3"
32
+ "@dxos/invariant": "0.8.4-main.84f28bd",
33
+ "@dxos/debug": "0.8.4-main.84f28bd",
34
+ "@dxos/node-std": "0.8.4-main.84f28bd"
35
35
  },
36
36
  "devDependencies": {
37
37
  "base32-decode": "^1.0.0",
package/src/dxn.ts CHANGED
@@ -179,6 +179,35 @@ export class DXN {
179
179
  this.#parts = parts;
180
180
  }
181
181
 
182
+ toString(): DXN.String {
183
+ return `dxn:${this.#kind}:${this.#parts.join(':')}` as DXN.String;
184
+ }
185
+
186
+ toJSON(): string {
187
+ return this.toString();
188
+ }
189
+
190
+ /**
191
+ * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
192
+ */
193
+ [inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect): string {
194
+ const printControlCode = (code: number) => {
195
+ return `\x1b[${code}m`;
196
+ };
197
+
198
+ return (
199
+ printControlCode(inspectFn.colors.blueBright![0]) + this.toString() + printControlCode(inspectFn.colors.reset![0])
200
+ );
201
+ }
202
+
203
+ get [devtoolsFormatter](): DevtoolsFormatter {
204
+ return {
205
+ header: () => {
206
+ return ['span', { style: 'font-weight: bold;' }, this.toString()];
207
+ },
208
+ };
209
+ }
210
+
182
211
  get parts() {
183
212
  return this.#parts;
184
213
  }
@@ -238,31 +267,6 @@ export class DXN {
238
267
  objectId: objectId as string | undefined,
239
268
  };
240
269
  }
241
-
242
- toString(): DXN.String {
243
- return `dxn:${this.#kind}:${this.#parts.join(':')}` as DXN.String;
244
- }
245
-
246
- /**
247
- * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
248
- */
249
- [inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect): string {
250
- const printControlCode = (code: number) => {
251
- return `\x1b[${code}m`;
252
- };
253
-
254
- return (
255
- printControlCode(inspectFn.colors.blueBright![0]) + this.toString() + printControlCode(inspectFn.colors.reset![0])
256
- );
257
- }
258
-
259
- get [devtoolsFormatter](): DevtoolsFormatter {
260
- return {
261
- header: () => {
262
- return ['span', { style: 'font-weight: bold;' }, this.toString()];
263
- },
264
- };
265
- }
266
270
  }
267
271
 
268
272
  // TODO(dmaretskyi): Fluent API: