Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/[email protected]
- uses: ./.github/actions/setup-test-env
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
uses: CodSpeedHQ/action@v3
with:
run: node --version && pnpm x bench/all.ts
token: ${{ secrets.CODSPEED_TOKEN }}
Expand Down
20 changes: 10 additions & 10 deletions src/class-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export function register<Instance, Klass extends { new (...args: any[]): Instanc
mstType = mstType.volatile((self: any) => initializeVolatiles({}, self, mstVolatiles));
}

klass.snapshottedViews = metadatas.filter((metadata) => metadata.type == "snapshotted-view") as SnapshottedViewMetadata[];
klass.snapshottedViews = metadatas.filter((metadata) => metadata.type == "snapshotted-view");
if (klass.snapshottedViews.length > 0) {
// add a property to the MST type to track changes to a @snapshottedView when none of its model's properties changed
mstType = mstType
Expand Down Expand Up @@ -465,21 +465,21 @@ function initializeVolatiles(result: Record<string, any>, node: Record<string, a
}

function bindToSelf<T extends Record<string, any>>(self: object, inputs: T): T {
const outputs = {} as T;
const descriptors = Object.getOwnPropertyDescriptors(inputs);
for (const key in descriptors) {
const property = descriptors[key];
if (typeof property.value === "function") {
property.value = property.value.bind(self);
const descriptor = descriptors[key];
if (typeof descriptor.value === "function") {
descriptor.value = descriptor.value.bind(self);
}
if (typeof property.get === "function") {
property.get = property.get.bind(self);
if (typeof descriptor.get === "function") {
descriptor.get = descriptor.get.bind(self);
}
if (typeof property.set === "function") {
property.set = property.set.bind(self);
if (typeof descriptor.set === "function") {
descriptor.set = descriptor.set.bind(self);
}
Object.defineProperty(outputs, key, property);
}
const outputs = {} as T;
Object.defineProperties(outputs, descriptors);
return outputs;
}

Expand Down
Loading