@dxos/keys 0.8.4-main.406dc2a → 0.8.4-main.59c2e9b
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/dist/lib/browser/index.mjs +149 -313
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +149 -313
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/dxn.d.ts +3 -3
- package/dist/types/src/dxn.d.ts.map +1 -1
- package/dist/types/src/space-id.d.ts +1 -1
- package/dist/types/src/space-id.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -6
- package/src/dxn.ts +5 -5
- package/src/space-id.ts +2 -2
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/keys",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.59c2e9b",
|
|
4
4
|
"description": "Key utils and definitions.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": false,
|
|
@@ -25,15 +29,18 @@
|
|
|
25
29
|
"src"
|
|
26
30
|
],
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"effect": "3.18.3",
|
|
29
32
|
"ulidx": "^2.3.0",
|
|
30
|
-
"@dxos/debug": "0.8.4-main.
|
|
31
|
-
"@dxos/node-std": "0.8.4-main.
|
|
32
|
-
"@dxos/invariant": "0.8.4-main.
|
|
33
|
+
"@dxos/debug": "0.8.4-main.59c2e9b",
|
|
34
|
+
"@dxos/node-std": "0.8.4-main.59c2e9b",
|
|
35
|
+
"@dxos/invariant": "0.8.4-main.59c2e9b"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
38
|
"base32-decode": "^1.0.0",
|
|
36
|
-
"base32-encode": "^2.0.0"
|
|
39
|
+
"base32-encode": "^2.0.0",
|
|
40
|
+
"effect": "3.19.11"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"effect": "3.19.11"
|
|
37
44
|
},
|
|
38
45
|
"publishConfig": {
|
|
39
46
|
"access": "public"
|
package/src/dxn.ts
CHANGED
|
@@ -57,7 +57,7 @@ export class DXN {
|
|
|
57
57
|
static Schema = Schema.NonEmptyString.pipe(
|
|
58
58
|
Schema.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
|
|
59
59
|
// TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
|
|
60
|
-
// FormatAnnotation.set(
|
|
60
|
+
// FormatAnnotation.set(TypeFormat.DXN),
|
|
61
61
|
Schema.annotations({
|
|
62
62
|
title: 'DXN',
|
|
63
63
|
description: 'DXN URI',
|
|
@@ -140,14 +140,14 @@ export class DXN {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* @example `dxn:type:example.com/type/
|
|
143
|
+
* @example `dxn:type:example.com/type/Person`
|
|
144
144
|
*/
|
|
145
145
|
static fromTypename(typename: string): DXN {
|
|
146
146
|
return new DXN(DXN.kind.TYPE, [typename]);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* @example `dxn:type:example.com/type/
|
|
150
|
+
* @example `dxn:type:example.com/type/Person:0.1.0`
|
|
151
151
|
*/
|
|
152
152
|
// TODO(dmaretskyi): Consider using @ as the version separator.
|
|
153
153
|
static fromTypenameAndVersion(typename: string, version: string): DXN {
|
|
@@ -300,7 +300,7 @@ export class DXN {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
return {
|
|
303
|
-
subspaceTag,
|
|
303
|
+
subspaceTag: subspaceTag as QueueSubspaceTag,
|
|
304
304
|
spaceId: spaceId as SpaceId,
|
|
305
305
|
queueId,
|
|
306
306
|
objectId: objectId as string | undefined,
|
|
@@ -338,7 +338,7 @@ export declare namespace DXN {
|
|
|
338
338
|
};
|
|
339
339
|
|
|
340
340
|
export type QueueDXN = {
|
|
341
|
-
subspaceTag:
|
|
341
|
+
subspaceTag: QueueSubspaceTag;
|
|
342
342
|
spaceId: SpaceId;
|
|
343
343
|
queueId: string; // TODO(dmaretskyi): ObjectId.
|
|
344
344
|
objectId?: string; // TODO(dmaretskyi): ObjectId.
|
package/src/space-id.ts
CHANGED
|
@@ -17,7 +17,7 @@ const MULTIBASE_PREFIX = 'B';
|
|
|
17
17
|
|
|
18
18
|
const ENCODED_LENGTH = 33;
|
|
19
19
|
|
|
20
|
-
const isValid = (value:
|
|
20
|
+
const isValid = (value: unknown): value is SpaceId => {
|
|
21
21
|
return typeof value === 'string' && value.startsWith(MULTIBASE_PREFIX) && value.length === ENCODED_LENGTH;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -33,7 +33,7 @@ export const SpaceId: Schema.Schema<SpaceId, string> & {
|
|
|
33
33
|
byteLength: number;
|
|
34
34
|
encode: (value: Uint8Array) => SpaceId;
|
|
35
35
|
decode: (value: SpaceId) => Uint8Array;
|
|
36
|
-
isValid: (value:
|
|
36
|
+
isValid: (value: unknown) => value is SpaceId;
|
|
37
37
|
make: (value: string) => SpaceId;
|
|
38
38
|
random: () => SpaceId;
|
|
39
39
|
} = class extends Schema.String.pipe(Schema.filter(isValid)) {
|