Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.3 kB
3
Indexable
Never
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];
}

Leave a Comment