@bian-womp/spark-graph 0.2.92 → 0.2.94

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/lib/cjs/index.cjs CHANGED
@@ -45,7 +45,7 @@ class CategoryRegistry {
45
45
  }
46
46
  }
47
47
  class Registry {
48
- constructor() {
48
+ constructor(id) {
49
49
  this.types = new Map();
50
50
  this.nodes = new Map();
51
51
  this.enums = new Map();
@@ -54,6 +54,7 @@ class Registry {
54
54
  this.coercions = new Map();
55
55
  this.asyncCoercions = new Map();
56
56
  this.resolvedCache = new Map();
57
+ this.id = id ?? `r${Registry.idCounter++}`;
57
58
  }
58
59
  registerType(desc, opts) {
59
60
  this.types.set(desc.id, desc);
@@ -401,6 +402,7 @@ class Registry {
401
402
  return this;
402
403
  }
403
404
  }
405
+ Registry.idCounter = 0;
404
406
 
405
407
  const LOG_LEVEL_VALUES = {
406
408
  debug: 0,
@@ -2479,8 +2481,8 @@ const isJson = (v) => {
2479
2481
  return Object.values(v).every(isJson);
2480
2482
  return false;
2481
2483
  };
2482
- function setupBasicGraphRegistry() {
2483
- const registry = new Registry();
2484
+ function setupBasicGraphRegistry(id) {
2485
+ const registry = new Registry(id);
2484
2486
  registry.categories.register(ComputeCategory);
2485
2487
  registry.registerType({
2486
2488
  id: "base.float",
@@ -3509,8 +3511,8 @@ function makeBasicGraphDefinition() {
3509
3511
  function createSimpleGraphDef() {
3510
3512
  return makeBasicGraphDefinition();
3511
3513
  }
3512
- function createSimpleGraphRegistry() {
3513
- return setupBasicGraphRegistry();
3514
+ function createSimpleGraphRegistry(id) {
3515
+ return setupBasicGraphRegistry(id);
3514
3516
  }
3515
3517
 
3516
3518
  function createAsyncGraphDef() {
@@ -3567,8 +3569,8 @@ function createAsyncGraphDef() {
3567
3569
  };
3568
3570
  return def;
3569
3571
  }
3570
- function createAsyncGraphRegistry() {
3571
- const registry = setupBasicGraphRegistry();
3572
+ function createAsyncGraphRegistry(id) {
3573
+ const registry = setupBasicGraphRegistry(id);
3572
3574
  registerDelayNode(registry);
3573
3575
  return registry;
3574
3576
  }
@@ -3596,8 +3598,8 @@ function createProgressGraphDef() {
3596
3598
  };
3597
3599
  return def;
3598
3600
  }
3599
- function createProgressGraphRegistry() {
3600
- const registry = setupBasicGraphRegistry();
3601
+ function createProgressGraphRegistry(id) {
3602
+ const registry = setupBasicGraphRegistry(id);
3601
3603
  registerProgressNodes(registry);
3602
3604
  return registry;
3603
3605
  }
@@ -3646,8 +3648,8 @@ function createValidationGraphDef() {
3646
3648
  };
3647
3649
  return def;
3648
3650
  }
3649
- function createValidationGraphRegistry() {
3650
- const registry = setupBasicGraphRegistry();
3651
+ function createValidationGraphRegistry(id) {
3652
+ const registry = setupBasicGraphRegistry(id);
3651
3653
  return registry;
3652
3654
  }
3653
3655