Untitled

 avatar
unknown
plain_text
2 years ago
1.3 kB
6
Indexable
Implementing RefCols and PopulateRefs:
I'll add methods to set/get refCols and populateRefs. These methods will ensure that references are correctly managed and that data is populated from the references as needed.

Set and Get RefCols
static setRefCols(blueprintName, id, refData) {
  const blueprint = this.getBlueprint(blueprintName);
  if (!blueprint) {
    throw new Error(`Blueprint ${blueprintName} not found`);
  }
  blueprint.refCols = blueprint.refCols || {};
  blueprint.refCols[id] = refData;
}

static getRefCols(blueprintName, id) {
  const blueprint = this.getBlueprint(blueprintName);
  if (!blueprint || !blueprint.refCols) {
    return null;
  }
  return blueprint.refCols[id];
}

Set and Get PopulateRefs:

static setPopulateRefs(blueprintName, id, populateData) {
  const blueprint = this.getBlueprint(blueprintName);
  if (!blueprint) {
    throw new Error(`Blueprint ${blueprintName} not found`);
  }
  blueprint.populateRefs = blueprint.populateRefs || {};
  blueprint.populateRefs[id] = populateData;
}

static getPopulateRefs(blueprintName, id) {
  const blueprint = this.getBlueprint(blueprintName);
  if (!blueprint || !blueprint.populateRefs) {
    return null;
  }
  return blueprint.populateRefs[id];
}

Editor is loading...
Leave a Comment