@bcts/known-values 1.0.0-alpha.17 → 1.0.0-alpha.18
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/README.md +1 -1
- package/data/0_blockchain_commons_registry.json +720 -0
- package/data/100000_community_registry.json +33 -0
- package/data/10000_schema_registry.json +17171 -0
- package/data/1000_community_registry.json +19 -0
- package/data/2000_rdf_registry.json +168 -0
- package/data/2050_rdfs_registry.json +126 -0
- package/data/2100_owl2_registry.json +546 -0
- package/data/2200_dce_registry.json +126 -0
- package/data/2300_dct_registry.json +644 -0
- package/data/2500_foaf_registry.json +546 -0
- package/data/2700_skos_registry.json +245 -0
- package/data/2800_solid_registry.json +252 -0
- package/data/2900_vc_registry.json +217 -0
- package/data/3000_gs1_registry.json +4284 -0
- package/dist/index.cjs +25298 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +50 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +25298 -109
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +25296 -110
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -8
- package/src/bundled-registries.ts +99 -0
- package/src/index.ts +3 -0
- package/src/known-values-registry.ts +124 -110
- package/src/known-values-store.ts +10 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KnownValue } from "./known-value";
|
|
2
|
+
import { loadBundledRegistries } from "./bundled-registries";
|
|
2
3
|
import { KnownValuesStore } from "./known-values-store";
|
|
3
4
|
|
|
4
5
|
// For definitions see: https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2023-002-known-value.md#appendix-a-registry
|
|
@@ -194,7 +195,7 @@ export const PROVENANCE_GENERATOR = new KnownValue(68, "provenanceGenerator");
|
|
|
194
195
|
//
|
|
195
196
|
|
|
196
197
|
export const PRIVILEGE_ALL = new KnownValue(70, "All");
|
|
197
|
-
export const PRIVILEGE_AUTH = new KnownValue(71, "
|
|
198
|
+
export const PRIVILEGE_AUTH = new KnownValue(71, "Authorize");
|
|
198
199
|
export const PRIVILEGE_SIGN = new KnownValue(72, "Sign");
|
|
199
200
|
export const PRIVILEGE_ENCRYPT = new KnownValue(73, "Encrypt");
|
|
200
201
|
export const PRIVILEGE_ELIDE = new KnownValue(74, "Elide");
|
|
@@ -240,9 +241,9 @@ export const MASTER_KEY_TYPE = new KnownValue(203, "MasterKey");
|
|
|
240
241
|
//
|
|
241
242
|
|
|
242
243
|
export const ASSET = new KnownValue(300, "asset");
|
|
243
|
-
export const BITCOIN_VALUE = new KnownValue(301, "
|
|
244
|
-
export const ETHEREUM_VALUE = new KnownValue(302, "
|
|
245
|
-
export const TEZOS_VALUE = new KnownValue(303, "
|
|
244
|
+
export const BITCOIN_VALUE = new KnownValue(301, "Bitcoin");
|
|
245
|
+
export const ETHEREUM_VALUE = new KnownValue(302, "Ethereum");
|
|
246
|
+
export const TEZOS_VALUE = new KnownValue(303, "Tezos");
|
|
246
247
|
// 304-399 *unassigned*
|
|
247
248
|
|
|
248
249
|
//
|
|
@@ -261,8 +262,8 @@ export const TEST_NET_VALUE = new KnownValue(402, "TestNet");
|
|
|
261
262
|
export const BIP32_KEY_TYPE = new KnownValue(500, "BIP32Key");
|
|
262
263
|
export const CHAIN_CODE = new KnownValue(501, "chainCode");
|
|
263
264
|
export const DERIVATION_PATH_TYPE = new KnownValue(502, "DerivationPath");
|
|
264
|
-
export const PARENT_PATH = new KnownValue(503, "
|
|
265
|
-
export const CHILDREN_PATH = new KnownValue(504, "
|
|
265
|
+
export const PARENT_PATH = new KnownValue(503, "parentPath");
|
|
266
|
+
export const CHILDREN_PATH = new KnownValue(504, "childrenPath");
|
|
266
267
|
export const PARENT_FINGERPRINT = new KnownValue(505, "parentFingerprint");
|
|
267
268
|
export const PSBT_TYPE = new KnownValue(506, "PSBT");
|
|
268
269
|
export const OUTPUT_DESCRIPTOR_TYPE = new KnownValue(507, "OutputDescriptor");
|
|
@@ -273,7 +274,7 @@ export const OUTPUT_DESCRIPTOR = new KnownValue(508, "outputDescriptor");
|
|
|
273
274
|
// Graphs
|
|
274
275
|
//
|
|
275
276
|
|
|
276
|
-
export const GRAPH = new KnownValue(600, "
|
|
277
|
+
export const GRAPH = new KnownValue(600, "Graph");
|
|
277
278
|
export const SOURCE_TARGET_GRAPH = new KnownValue(601, "SourceTargetGraph");
|
|
278
279
|
export const PARENT_CHILD_GRAPH = new KnownValue(602, "ParentChildGraph");
|
|
279
280
|
export const DIGRAPH = new KnownValue(603, "Digraph");
|
|
@@ -294,7 +295,9 @@ export const SOURCE = new KnownValue(702, "source");
|
|
|
294
295
|
export const TARGET = new KnownValue(703, "target");
|
|
295
296
|
export const PARENT = new KnownValue(704, "parent");
|
|
296
297
|
export const CHILD = new KnownValue(705, "child");
|
|
297
|
-
|
|
298
|
+
export const SELF_RAW = 706n;
|
|
299
|
+
export const SELF = new KnownValue(706, "Self");
|
|
300
|
+
// 707-... *unassigned*
|
|
298
301
|
|
|
299
302
|
/**
|
|
300
303
|
* A lazily initialized singleton that holds the global registry of known
|
|
@@ -318,108 +321,119 @@ export class LazyKnownValues {
|
|
|
318
321
|
* This method guarantees that initialization occurs exactly once.
|
|
319
322
|
*/
|
|
320
323
|
get(): KnownValuesStore {
|
|
321
|
-
this._data
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
324
|
+
if (this._data === undefined) {
|
|
325
|
+
const store = new KnownValuesStore([
|
|
326
|
+
UNIT,
|
|
327
|
+
IS_A,
|
|
328
|
+
ID,
|
|
329
|
+
SIGNED,
|
|
330
|
+
NOTE,
|
|
331
|
+
HAS_RECIPIENT,
|
|
332
|
+
SSKR_SHARE,
|
|
333
|
+
CONTROLLER,
|
|
334
|
+
KEY,
|
|
335
|
+
DEREFERENCE_VIA,
|
|
336
|
+
ENTITY,
|
|
337
|
+
NAME,
|
|
338
|
+
LANGUAGE,
|
|
339
|
+
ISSUER,
|
|
340
|
+
HOLDER,
|
|
341
|
+
SALT,
|
|
342
|
+
DATE,
|
|
343
|
+
UNKNOWN_VALUE,
|
|
344
|
+
VERSION_VALUE,
|
|
345
|
+
HAS_SECRET,
|
|
346
|
+
DIFF_EDITS,
|
|
347
|
+
VALID_FROM,
|
|
348
|
+
VALID_UNTIL,
|
|
349
|
+
POSITION,
|
|
350
|
+
NICKNAME,
|
|
351
|
+
ATTACHMENT,
|
|
352
|
+
VENDOR,
|
|
353
|
+
CONFORMS_TO,
|
|
354
|
+
ALLOW,
|
|
355
|
+
DENY,
|
|
356
|
+
ENDPOINT,
|
|
357
|
+
DELEGATE,
|
|
358
|
+
PROVENANCE,
|
|
359
|
+
PRIVATE_KEY,
|
|
360
|
+
SERVICE,
|
|
361
|
+
CAPABILITY,
|
|
362
|
+
PROVENANCE_GENERATOR,
|
|
363
|
+
PRIVILEGE_ALL,
|
|
364
|
+
PRIVILEGE_AUTH,
|
|
365
|
+
PRIVILEGE_SIGN,
|
|
366
|
+
PRIVILEGE_ENCRYPT,
|
|
367
|
+
PRIVILEGE_ELIDE,
|
|
368
|
+
PRIVILEGE_ISSUE,
|
|
369
|
+
PRIVILEGE_ACCESS,
|
|
370
|
+
PRIVILEGE_DELEGATE,
|
|
371
|
+
PRIVILEGE_VERIFY,
|
|
372
|
+
PRIVILEGE_UPDATE,
|
|
373
|
+
PRIVILEGE_TRANSFER,
|
|
374
|
+
PRIVILEGE_ELECT,
|
|
375
|
+
PRIVILEGE_BURN,
|
|
376
|
+
PRIVILEGE_REVOKE,
|
|
377
|
+
BODY,
|
|
378
|
+
RESULT,
|
|
379
|
+
ERROR,
|
|
380
|
+
OK_VALUE,
|
|
381
|
+
PROCESSING_VALUE,
|
|
382
|
+
SENDER,
|
|
383
|
+
SENDER_CONTINUATION,
|
|
384
|
+
RECIPIENT_CONTINUATION,
|
|
385
|
+
CONTENT,
|
|
386
|
+
SEED_TYPE,
|
|
387
|
+
PRIVATE_KEY_TYPE,
|
|
388
|
+
PUBLIC_KEY_TYPE,
|
|
389
|
+
MASTER_KEY_TYPE,
|
|
390
|
+
ASSET,
|
|
391
|
+
BITCOIN_VALUE,
|
|
392
|
+
ETHEREUM_VALUE,
|
|
393
|
+
TEZOS_VALUE,
|
|
394
|
+
NETWORK,
|
|
395
|
+
MAIN_NET_VALUE,
|
|
396
|
+
TEST_NET_VALUE,
|
|
397
|
+
BIP32_KEY_TYPE,
|
|
398
|
+
CHAIN_CODE,
|
|
399
|
+
DERIVATION_PATH_TYPE,
|
|
400
|
+
PARENT_PATH,
|
|
401
|
+
CHILDREN_PATH,
|
|
402
|
+
PARENT_FINGERPRINT,
|
|
403
|
+
PSBT_TYPE,
|
|
404
|
+
OUTPUT_DESCRIPTOR_TYPE,
|
|
405
|
+
OUTPUT_DESCRIPTOR,
|
|
406
|
+
GRAPH,
|
|
407
|
+
SOURCE_TARGET_GRAPH,
|
|
408
|
+
PARENT_CHILD_GRAPH,
|
|
409
|
+
DIGRAPH,
|
|
410
|
+
ACYCLIC_GRAPH,
|
|
411
|
+
MULTIGRAPH,
|
|
412
|
+
PSEUDOGRAPH,
|
|
413
|
+
GRAPH_FRAGMENT,
|
|
414
|
+
DAG,
|
|
415
|
+
TREE,
|
|
416
|
+
FOREST,
|
|
417
|
+
COMPOUND_GRAPH,
|
|
418
|
+
HYPERGRAPH,
|
|
419
|
+
DIHYPERGRAPH,
|
|
420
|
+
NODE,
|
|
421
|
+
EDGE,
|
|
422
|
+
SOURCE,
|
|
423
|
+
TARGET,
|
|
424
|
+
PARENT,
|
|
425
|
+
CHILD,
|
|
426
|
+
]);
|
|
427
|
+
|
|
428
|
+
// Load bundled registry values from JSON data files.
|
|
429
|
+
// These are embedded at build time and available in all environments.
|
|
430
|
+
// Matching Rust behavior: later inserts overwrite earlier ones.
|
|
431
|
+
for (const value of loadBundledRegistries()) {
|
|
432
|
+
store.insert(value);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
this._data = store;
|
|
436
|
+
}
|
|
423
437
|
return this._data;
|
|
424
438
|
}
|
|
425
439
|
}
|
|
@@ -318,6 +318,16 @@ export class KnownValuesStore {
|
|
|
318
318
|
* Internal helper method to insert a KnownValue into the store's maps.
|
|
319
319
|
*/
|
|
320
320
|
private _insert(knownValue: KnownValue): void {
|
|
321
|
+
// If there's an existing value with the same codepoint, remove its name
|
|
322
|
+
// from the name index to avoid stale entries
|
|
323
|
+
const existing = this.knownValuesByRawValue.get(knownValue.valueBigInt());
|
|
324
|
+
if (existing !== undefined) {
|
|
325
|
+
const oldName = existing.assignedName();
|
|
326
|
+
if (oldName !== undefined && oldName !== "") {
|
|
327
|
+
this.knownValuesByAssignedName.delete(oldName);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
321
331
|
this.knownValuesByRawValue.set(knownValue.valueBigInt(), knownValue);
|
|
322
332
|
const assignedName = knownValue.assignedName();
|
|
323
333
|
if (assignedName !== undefined && assignedName !== "") {
|