Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions core/ts/core/Decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export const Decorator = {
getOpaqueData(name) {
return opaqueData[name];
},
processOutputModel({privateData}) {
if (privateData) {
const {__privateKey: key, ...privy} = privateData;
if (key) {
const data = Object.values(opaqueData).pop();
data[key]['privateData'] = privy;
}
}
},
maybeDecorateModel(model, particle) {
if (model && !Array.isArray(model)) {
// for each item in model, regardless of key
Expand Down Expand Up @@ -73,7 +82,7 @@ const maybeDecorate = (models, decorator, particle) => {
// we don't want the decorator to have access to mutable globals
const immutableState = Object.freeze(deepCopy(state));
// models become decorous
models = models.map(model => {
models = models.map((model, i) => {
// use previously mutated data or initialize
// TODO(cromwellian): I'd like to do Object.freeze() here, also somehow not mutate the models inplace
// Possibly have setOpaqueData wrap the data so the privateData lives on the wrapper + internal immutable data
Expand All @@ -82,7 +91,7 @@ const maybeDecorate = (models, decorator, particle) => {
const immutableModel = Object.freeze(deepCopy(model));
const decorated = decorator(immutableModel, immutableInputs, immutableState);
// set new privateData from returned
model.privateData = decorated.privateData;
model.privateData = {...decorated.privateData, __privateKey: i};
return { ...decorated, ...model, };
});
// sort (possible that all values undefined)
Expand Down
1 change: 1 addition & 0 deletions core/ts/core/Host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class Host extends EventEmitter {
}
protected output(outputModel, renderModel) {
if (outputModel) {
Decorator.processOutputModel(outputModel);
this.lastOutput = outputModel;
this.arc?.assignOutputs(this, outputModel);
}
Expand Down
15 changes: 13 additions & 2 deletions pkg/Library/Core/arcs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/Library/Core/arcs.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/Library/Core/arcs.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pkg/Library/Core/arcs.min.js.map

Large diffs are not rendered by default.