@dxos/keys 0.8.4-main.e098934 → 0.8.4-main.ead640a
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 +165 -43
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +165 -43
- 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 +1 -1
- package/dist/types/src/dxn.d.ts.map +1 -1
- package/dist/types/src/object-id.d.ts +50 -1
- package/dist/types/src/object-id.d.ts.map +1 -1
- package/dist/types/src/prng.d.ts +32 -0
- package/dist/types/src/prng.d.ts.map +1 -0
- 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 +5 -5
- package/src/dxn.ts +1 -1
- package/src/object-id.ts +92 -3
- package/src/prng.ts +54 -0
- package/src/space-id.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"inject-globals:@inject-globals":{"bytes":324,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/object-id.ts":{"bytes":
|
|
1
|
+
{"inputs":{"inject-globals:@inject-globals":{"bytes":324,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/object-id.ts":{"bytes":13008,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"ulidx","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js":{"bytes":1217,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"cjs"},"../../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js":{"bytes":410,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js":{"bytes":1266,"imports":[{"path":"../../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js","kind":"import-statement","original":"to-data-view"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/random-bytes.ts":{"bytes":1746,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true},{"path":"@dxos/node-std/crypto","kind":"require-call","external":true}],"format":"esm"},"src/space-id.ts":{"bytes":6355,"imports":[{"path":"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js","kind":"import-statement","original":"base32-decode"},{"path":"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js","kind":"import-statement","original":"base32-encode"},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/dxn.ts":{"bytes":34793,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/object-id.ts","kind":"import-statement","original":"./object-id"},{"path":"src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/identity-did.ts":{"bytes":5438,"imports":[{"path":"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js","kind":"import-statement","original":"base32-decode"},{"path":"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js","kind":"import-statement","original":"base32-encode"},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/public-key.ts":{"bytes":31530,"imports":[{"path":"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js","kind":"import-statement","original":"base32-decode"},{"path":"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js","kind":"import-statement","original":"base32-encode"},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":849,"imports":[{"path":"src/dxn.ts","kind":"import-statement","original":"./dxn"},{"path":"src/identity-did.ts","kind":"import-statement","original":"./identity-did"},{"path":"src/object-id.ts","kind":"import-statement","original":"./object-id"},{"path":"src/public-key.ts","kind":"import-statement","original":"./public-key"},{"path":"src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":48996},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"ulidx","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/crypto","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["DXN","DXN_ECHO_REGEXP","IdentityDid","LOCAL_SPACE_TAG","ObjectId","PUBLIC_KEY_LENGTH","PublicKey","QueueSubspaceTags","SECRET_KEY_LENGTH","SimplePRNG","SpaceId"],"entryPoint":"src/index.ts","inputs":{"inject-globals:@inject-globals":{"bytesInOutput":171},"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js":{"bytesInOutput":1590},"src/index.ts":{"bytesInOutput":23},"src/dxn.ts":{"bytesInOutput":9799},"src/object-id.ts":{"bytesInOutput":4932},"src/space-id.ts":{"bytesInOutput":1930},"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js":{"bytesInOutput":1229},"../../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js":{"bytesInOutput":418},"src/random-bytes.ts":{"bytesInOutput":237},"src/identity-did.ts":{"bytesInOutput":1557},"src/public-key.ts":{"bytesInOutput":8409}},"bytes":32902}}}
|
|
@@ -82,18 +82,82 @@ var require_base32_decode = __commonJS({
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
// src/dxn.ts
|
|
85
|
-
import
|
|
85
|
+
import * as Schema3 from "effect/Schema";
|
|
86
86
|
import { devtoolsFormatter, inspectCustom } from "@dxos/debug";
|
|
87
87
|
import { assertArgument, invariant as invariant2 } from "@dxos/invariant";
|
|
88
88
|
|
|
89
89
|
// src/object-id.ts
|
|
90
|
-
import
|
|
91
|
-
import {
|
|
90
|
+
import * as Schema from "effect/Schema";
|
|
91
|
+
import { monotonicFactory } from "ulidx";
|
|
92
|
+
function _check_private_redeclaration(obj, privateCollection) {
|
|
93
|
+
if (privateCollection.has(obj)) {
|
|
94
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function _class_apply_descriptor_get(receiver, descriptor) {
|
|
98
|
+
if (descriptor.get) {
|
|
99
|
+
return descriptor.get.call(receiver);
|
|
100
|
+
}
|
|
101
|
+
return descriptor.value;
|
|
102
|
+
}
|
|
103
|
+
function _class_apply_descriptor_set(receiver, descriptor, value) {
|
|
104
|
+
if (descriptor.set) {
|
|
105
|
+
descriptor.set.call(receiver, value);
|
|
106
|
+
} else {
|
|
107
|
+
if (!descriptor.writable) {
|
|
108
|
+
throw new TypeError("attempted to set read only private field");
|
|
109
|
+
}
|
|
110
|
+
descriptor.value = value;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function _class_check_private_static_field_descriptor(descriptor, action) {
|
|
114
|
+
if (descriptor === void 0) {
|
|
115
|
+
throw new TypeError("attempted to " + action + " private static field before its declaration");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function _class_extract_field_descriptor(receiver, privateMap, action) {
|
|
119
|
+
if (!privateMap.has(receiver)) {
|
|
120
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
121
|
+
}
|
|
122
|
+
return privateMap.get(receiver);
|
|
123
|
+
}
|
|
124
|
+
function _class_private_field_get(receiver, privateMap) {
|
|
125
|
+
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
|
|
126
|
+
return _class_apply_descriptor_get(receiver, descriptor);
|
|
127
|
+
}
|
|
128
|
+
function _class_private_field_init(obj, privateMap, value) {
|
|
129
|
+
_check_private_redeclaration(obj, privateMap);
|
|
130
|
+
privateMap.set(obj, value);
|
|
131
|
+
}
|
|
132
|
+
function _class_private_field_set(receiver, privateMap, value) {
|
|
133
|
+
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
|
|
134
|
+
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
function _class_static_private_field_spec_get(receiver, classConstructor, descriptor) {
|
|
138
|
+
_class_check_private_static_access(receiver, classConstructor);
|
|
139
|
+
_class_check_private_static_field_descriptor(descriptor, "get");
|
|
140
|
+
return _class_apply_descriptor_get(receiver, descriptor);
|
|
141
|
+
}
|
|
142
|
+
function _class_static_private_field_spec_set(receiver, classConstructor, descriptor, value) {
|
|
143
|
+
_class_check_private_static_access(receiver, classConstructor);
|
|
144
|
+
_class_check_private_static_field_descriptor(descriptor, "set");
|
|
145
|
+
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
function _class_check_private_static_access(receiver, classConstructor) {
|
|
149
|
+
if (receiver !== classConstructor) {
|
|
150
|
+
throw new TypeError("Private static access of wrong provenance");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
var _class;
|
|
154
|
+
var _factory;
|
|
155
|
+
var _seedTime;
|
|
92
156
|
var ObjectIdSchema = Schema.String.pipe(Schema.pattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i)).annotations({
|
|
93
157
|
description: "A Universally Unique Lexicographically Sortable Identifier",
|
|
94
158
|
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$"
|
|
95
159
|
});
|
|
96
|
-
var ObjectId = class extends ObjectIdSchema {
|
|
160
|
+
var ObjectId = (_class = class extends ObjectIdSchema {
|
|
97
161
|
static isValid(id) {
|
|
98
162
|
try {
|
|
99
163
|
Schema.decodeSync(ObjectId)(id);
|
|
@@ -103,8 +167,65 @@ var ObjectId = class extends ObjectIdSchema {
|
|
|
103
167
|
}
|
|
104
168
|
}
|
|
105
169
|
static random() {
|
|
106
|
-
return
|
|
170
|
+
return _class_static_private_field_spec_get(this, _class, _factory).call(_class, _class_static_private_field_spec_get(this, _class, _seedTime));
|
|
171
|
+
}
|
|
172
|
+
static dangerouslyDisableRandomness() {
|
|
173
|
+
_class_static_private_field_spec_set(this, _class, _factory, monotonicFactory(makeTestPRNG()));
|
|
174
|
+
_class_static_private_field_spec_set(this, _class, _seedTime, (/* @__PURE__ */ new Date("2025-01-01")).getTime());
|
|
175
|
+
}
|
|
176
|
+
}, _factory = {
|
|
177
|
+
writable: true,
|
|
178
|
+
value: monotonicFactory()
|
|
179
|
+
}, _seedTime = {
|
|
180
|
+
writable: true,
|
|
181
|
+
value: void 0
|
|
182
|
+
}, _class);
|
|
183
|
+
var makeTestPRNG = () => {
|
|
184
|
+
const rng = new SimplePRNG();
|
|
185
|
+
return () => {
|
|
186
|
+
return rng.next();
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
var _seed = /* @__PURE__ */ new WeakMap();
|
|
190
|
+
var SimplePRNG = class _SimplePRNG {
|
|
191
|
+
/**
|
|
192
|
+
* Generates the next pseudo-random number in the range [0, 1).
|
|
193
|
+
* @returns A pseudo-random number between 0 (inclusive) and 1 (exclusive).
|
|
194
|
+
*/
|
|
195
|
+
next() {
|
|
196
|
+
_class_private_field_set(this, _seed, (_class_static_private_field_spec_get(_SimplePRNG, _SimplePRNG, _a) * _class_private_field_get(this, _seed) + _class_static_private_field_spec_get(_SimplePRNG, _SimplePRNG, _c)) % _class_static_private_field_spec_get(_SimplePRNG, _SimplePRNG, _m));
|
|
197
|
+
return _class_private_field_get(this, _seed) / _class_static_private_field_spec_get(_SimplePRNG, _SimplePRNG, _m);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Resets the generator with a new seed.
|
|
201
|
+
* @param seed - New seed value.
|
|
202
|
+
*/
|
|
203
|
+
reset(seed) {
|
|
204
|
+
_class_private_field_set(this, _seed, seed);
|
|
107
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Creates a new PRNG instance.
|
|
208
|
+
* @param seed - Initial seed value. If not provided, uses 0.
|
|
209
|
+
*/
|
|
210
|
+
constructor(seed = 0) {
|
|
211
|
+
_class_private_field_init(this, _seed, {
|
|
212
|
+
writable: true,
|
|
213
|
+
value: void 0
|
|
214
|
+
});
|
|
215
|
+
_class_private_field_set(this, _seed, seed);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var _a = {
|
|
219
|
+
writable: true,
|
|
220
|
+
value: 1664525
|
|
221
|
+
};
|
|
222
|
+
var _c = {
|
|
223
|
+
writable: true,
|
|
224
|
+
value: 1013904223
|
|
225
|
+
};
|
|
226
|
+
var _m = {
|
|
227
|
+
writable: true,
|
|
228
|
+
value: Math.pow(2, 32)
|
|
108
229
|
};
|
|
109
230
|
|
|
110
231
|
// src/space-id.ts
|
|
@@ -170,7 +291,7 @@ function base32Encode(data, variant, options) {
|
|
|
170
291
|
}
|
|
171
292
|
|
|
172
293
|
// src/space-id.ts
|
|
173
|
-
import
|
|
294
|
+
import * as Schema2 from "effect/Schema";
|
|
174
295
|
import { invariant } from "@dxos/invariant";
|
|
175
296
|
|
|
176
297
|
// src/random-bytes.ts
|
|
@@ -196,19 +317,19 @@ function _define_property(obj, key, value) {
|
|
|
196
317
|
return obj;
|
|
197
318
|
}
|
|
198
319
|
var _Schema_String_pipe;
|
|
199
|
-
var
|
|
320
|
+
var _class2;
|
|
200
321
|
var __dxlog_file = "/__w/dxos/dxos/packages/common/keys/src/space-id.ts";
|
|
201
322
|
var MULTIBASE_PREFIX = "B";
|
|
202
323
|
var ENCODED_LENGTH = 33;
|
|
203
324
|
var isValid = (value) => {
|
|
204
325
|
return typeof value === "string" && value.startsWith(MULTIBASE_PREFIX) && value.length === ENCODED_LENGTH;
|
|
205
326
|
};
|
|
206
|
-
var SpaceId = (
|
|
207
|
-
}, _define_property(
|
|
327
|
+
var SpaceId = (_class2 = class extends (_Schema_String_pipe = Schema2.String.pipe(Schema2.filter(isValid))) {
|
|
328
|
+
}, _define_property(_class2, "byteLength", 20), _define_property(_class2, "encode", (value) => {
|
|
208
329
|
invariant(value instanceof Uint8Array, "Invalid type", {
|
|
209
330
|
F: __dxlog_file,
|
|
210
331
|
L: 43,
|
|
211
|
-
S:
|
|
332
|
+
S: _class2,
|
|
212
333
|
A: [
|
|
213
334
|
"value instanceof Uint8Array",
|
|
214
335
|
"'Invalid type'"
|
|
@@ -217,41 +338,41 @@ var SpaceId = (_class = class extends (_Schema_String_pipe = Schema2.String.pipe
|
|
|
217
338
|
invariant(value.length === SpaceId.byteLength, "Invalid length", {
|
|
218
339
|
F: __dxlog_file,
|
|
219
340
|
L: 44,
|
|
220
|
-
S:
|
|
341
|
+
S: _class2,
|
|
221
342
|
A: [
|
|
222
343
|
"value.length === SpaceId.byteLength",
|
|
223
344
|
"'Invalid length'"
|
|
224
345
|
]
|
|
225
346
|
});
|
|
226
347
|
return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
|
|
227
|
-
}), _define_property(
|
|
348
|
+
}), _define_property(_class2, "decode", (value) => {
|
|
228
349
|
invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
|
|
229
350
|
F: __dxlog_file,
|
|
230
351
|
L: 49,
|
|
231
|
-
S:
|
|
352
|
+
S: _class2,
|
|
232
353
|
A: [
|
|
233
354
|
"value.startsWith(MULTIBASE_PREFIX)",
|
|
234
355
|
"'Invalid multibase32 encoding'"
|
|
235
356
|
]
|
|
236
357
|
});
|
|
237
358
|
return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
|
|
238
|
-
}), _define_property(
|
|
359
|
+
}), _define_property(_class2, "isValid", isValid), _define_property(_class2, "random", () => {
|
|
239
360
|
return SpaceId.encode(randomBytes(SpaceId.byteLength));
|
|
240
|
-
}),
|
|
361
|
+
}), _class2);
|
|
241
362
|
|
|
242
363
|
// src/dxn.ts
|
|
243
|
-
function
|
|
364
|
+
function _check_private_redeclaration2(obj, privateCollection) {
|
|
244
365
|
if (privateCollection.has(obj)) {
|
|
245
366
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
246
367
|
}
|
|
247
368
|
}
|
|
248
|
-
function
|
|
369
|
+
function _class_apply_descriptor_get2(receiver, descriptor) {
|
|
249
370
|
if (descriptor.get) {
|
|
250
371
|
return descriptor.get.call(receiver);
|
|
251
372
|
}
|
|
252
373
|
return descriptor.value;
|
|
253
374
|
}
|
|
254
|
-
function
|
|
375
|
+
function _class_apply_descriptor_set2(receiver, descriptor, value) {
|
|
255
376
|
if (descriptor.set) {
|
|
256
377
|
descriptor.set.call(receiver, value);
|
|
257
378
|
} else {
|
|
@@ -261,23 +382,23 @@ function _class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
261
382
|
descriptor.value = value;
|
|
262
383
|
}
|
|
263
384
|
}
|
|
264
|
-
function
|
|
385
|
+
function _class_extract_field_descriptor2(receiver, privateMap, action) {
|
|
265
386
|
if (!privateMap.has(receiver)) {
|
|
266
387
|
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
267
388
|
}
|
|
268
389
|
return privateMap.get(receiver);
|
|
269
390
|
}
|
|
270
|
-
function
|
|
271
|
-
var descriptor =
|
|
272
|
-
return
|
|
391
|
+
function _class_private_field_get2(receiver, privateMap) {
|
|
392
|
+
var descriptor = _class_extract_field_descriptor2(receiver, privateMap, "get");
|
|
393
|
+
return _class_apply_descriptor_get2(receiver, descriptor);
|
|
273
394
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
395
|
+
function _class_private_field_init2(obj, privateMap, value) {
|
|
396
|
+
_check_private_redeclaration2(obj, privateMap);
|
|
276
397
|
privateMap.set(obj, value);
|
|
277
398
|
}
|
|
278
|
-
function
|
|
279
|
-
var descriptor =
|
|
280
|
-
|
|
399
|
+
function _class_private_field_set2(receiver, privateMap, value) {
|
|
400
|
+
var descriptor = _class_extract_field_descriptor2(receiver, privateMap, "set");
|
|
401
|
+
_class_apply_descriptor_set2(receiver, descriptor, value);
|
|
281
402
|
return value;
|
|
282
403
|
}
|
|
283
404
|
function _define_property2(obj, key, value) {
|
|
@@ -399,7 +520,7 @@ var DXN = class _DXN {
|
|
|
399
520
|
]);
|
|
400
521
|
}
|
|
401
522
|
toString() {
|
|
402
|
-
return `dxn:${
|
|
523
|
+
return `dxn:${_class_private_field_get2(this, _kind)}:${_class_private_field_get2(this, _parts).join(":")}`;
|
|
403
524
|
}
|
|
404
525
|
toJSON() {
|
|
405
526
|
return this.toString();
|
|
@@ -427,14 +548,14 @@ var DXN = class _DXN {
|
|
|
427
548
|
};
|
|
428
549
|
}
|
|
429
550
|
get kind() {
|
|
430
|
-
return
|
|
551
|
+
return _class_private_field_get2(this, _kind);
|
|
431
552
|
}
|
|
432
553
|
get parts() {
|
|
433
|
-
return
|
|
554
|
+
return _class_private_field_get2(this, _parts);
|
|
434
555
|
}
|
|
435
556
|
// TODO(burdon): Should getters fail?
|
|
436
557
|
get typename() {
|
|
437
|
-
invariant2(
|
|
558
|
+
invariant2(_class_private_field_get2(this, _kind) === _DXN.kind.TYPE, void 0, {
|
|
438
559
|
F: __dxlog_file2,
|
|
439
560
|
L: 250,
|
|
440
561
|
S: this,
|
|
@@ -443,22 +564,22 @@ var DXN = class _DXN {
|
|
|
443
564
|
""
|
|
444
565
|
]
|
|
445
566
|
});
|
|
446
|
-
return
|
|
567
|
+
return _class_private_field_get2(this, _parts)[0];
|
|
447
568
|
}
|
|
448
569
|
equals(other) {
|
|
449
570
|
return _DXN.equals(this, other);
|
|
450
571
|
}
|
|
451
572
|
hasTypenameOf(typename) {
|
|
452
|
-
return
|
|
573
|
+
return _class_private_field_get2(this, _kind) === _DXN.kind.TYPE && _class_private_field_get2(this, _parts).length === 1 && _class_private_field_get2(this, _parts)[0] === typename;
|
|
453
574
|
}
|
|
454
575
|
isLocalObjectId() {
|
|
455
|
-
return
|
|
576
|
+
return _class_private_field_get2(this, _kind) === _DXN.kind.ECHO && _class_private_field_get2(this, _parts)[0] === LOCAL_SPACE_TAG && _class_private_field_get2(this, _parts).length === 2;
|
|
456
577
|
}
|
|
457
578
|
asTypeDXN() {
|
|
458
579
|
if (this.kind !== _DXN.kind.TYPE) {
|
|
459
580
|
return void 0;
|
|
460
581
|
}
|
|
461
|
-
const [type, version] =
|
|
582
|
+
const [type, version] = _class_private_field_get2(this, _parts);
|
|
462
583
|
return {
|
|
463
584
|
// TODO(wittjosiah): Should be `typename` for consistency.
|
|
464
585
|
type,
|
|
@@ -469,7 +590,7 @@ var DXN = class _DXN {
|
|
|
469
590
|
if (this.kind !== _DXN.kind.ECHO) {
|
|
470
591
|
return void 0;
|
|
471
592
|
}
|
|
472
|
-
const [spaceId, echoId] =
|
|
593
|
+
const [spaceId, echoId] = _class_private_field_get2(this, _parts);
|
|
473
594
|
return {
|
|
474
595
|
spaceId: spaceId === LOCAL_SPACE_TAG ? void 0 : spaceId,
|
|
475
596
|
// TODO(burdon): objectId.
|
|
@@ -480,7 +601,7 @@ var DXN = class _DXN {
|
|
|
480
601
|
if (this.kind !== _DXN.kind.QUEUE) {
|
|
481
602
|
return void 0;
|
|
482
603
|
}
|
|
483
|
-
const [subspaceTag, spaceId, queueId, objectId] =
|
|
604
|
+
const [subspaceTag, spaceId, queueId, objectId] = _class_private_field_get2(this, _parts);
|
|
484
605
|
if (typeof queueId !== "string") {
|
|
485
606
|
return void 0;
|
|
486
607
|
}
|
|
@@ -495,17 +616,17 @@ var DXN = class _DXN {
|
|
|
495
616
|
* Produces a new DXN with the given parts appended.
|
|
496
617
|
*/
|
|
497
618
|
extend(parts) {
|
|
498
|
-
return new _DXN(
|
|
499
|
-
...
|
|
619
|
+
return new _DXN(_class_private_field_get2(this, _kind), [
|
|
620
|
+
..._class_private_field_get2(this, _parts),
|
|
500
621
|
...parts
|
|
501
622
|
]);
|
|
502
623
|
}
|
|
503
624
|
constructor(kind, parts) {
|
|
504
|
-
|
|
625
|
+
_class_private_field_init2(this, _kind, {
|
|
505
626
|
writable: true,
|
|
506
627
|
value: void 0
|
|
507
628
|
});
|
|
508
|
-
|
|
629
|
+
_class_private_field_init2(this, _parts, {
|
|
509
630
|
writable: true,
|
|
510
631
|
value: void 0
|
|
511
632
|
});
|
|
@@ -523,8 +644,8 @@ var DXN = class _DXN {
|
|
|
523
644
|
}
|
|
524
645
|
break;
|
|
525
646
|
}
|
|
526
|
-
|
|
527
|
-
|
|
647
|
+
_class_private_field_set2(this, _kind, kind);
|
|
648
|
+
_class_private_field_set2(this, _parts, parts);
|
|
528
649
|
}
|
|
529
650
|
};
|
|
530
651
|
_define_property2(DXN, "Schema", Schema3.NonEmptyString.pipe(
|
|
@@ -927,6 +1048,7 @@ export {
|
|
|
927
1048
|
PublicKey,
|
|
928
1049
|
QueueSubspaceTags,
|
|
929
1050
|
SECRET_KEY_LENGTH,
|
|
1051
|
+
SimplePRNG,
|
|
930
1052
|
SpaceId
|
|
931
1053
|
};
|
|
932
1054
|
//# sourceMappingURL=index.mjs.map
|