generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
SOF-7756: generated mixins #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
k0stik
wants to merge
22
commits into
main
Choose a base branch
from
chore/SOF-7756
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
72d2f4d
update: generated mixins
k0stik 5b59e91
update: mixins
k0stik 47f16a5
chore: cleanup mixins/types
k0stik 1c1793b
chore: improve HashedEntity types
k0stik 180eea0
chore: context mixins
k0stik 928f16b
chore: dist
k0stik 156fa74
chore: export types
k0stik e4c1e02
chore: improve types
k0stik 5077e25
chore: improve types
k0stik 2f5206c
chore: improve types
k0stik ead74e8
chore: runtime_items
k0stik 19c904d
chore: dist
k0stik 8d194f5
chore: clenup types
k0stik 5803c54
chore: clenup types
k0stik b51e5b1
chore: improve materials metadata
k0stik 7b362ad
chore: improve materials metadata types
k0stik 143d5bc
chore: new esse types
k0stik 0549a76
fix: hasRepetition
k0stik cd833de
Merge branch 'main' of github.com:Exabyte-io/code into chore/SOF-7756
k0stik cf4115b
chore: merge main
k0stik 4fdf0a5
Merge branch 'main' of github.com:Exabyte-io/code into chore/SOF-7756
k0stik cb3fa59
chore: add TS enums
k0stik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,10 @@ | ||
| import { InMemoryEntity } from "./in_memory"; | ||
| import { ContextAndRenderFieldsMixin } from "./mixins/context"; | ||
| import { RuntimeContextFieldMixin } from "./mixins/context_runtime"; | ||
| import { FlowchartEntityMixin, FlowchartItemMixin } from "./mixins/flowchart"; | ||
| import { HasScopeTrackMixin } from "./mixins/props"; | ||
| import { RuntimeItemsMixin } from "./mixins/runtime_items"; | ||
| import { DefaultableInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, NamedDefaultableRepetitionContextAndRenderInMemoryEntity, NamedDefaultableRepetitionImportantSettingsInMemoryEntity, NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity, NamedInMemoryEntity } from "./other"; | ||
| import { DefaultableInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, NamedInMemoryEntity } from "./other"; | ||
| import { InMemoryEntitySet } from "./set"; | ||
| import { ENTITY_SET_TYPES } from "./set/enums"; | ||
| import { constructEntitySetFactoryByConfig } from "./set/factory"; | ||
| import { InMemoryEntityInSetMixin, InMemoryEntitySetMixin } from "./set/mixins"; | ||
| import { OrderedInMemoryEntityInSetMixin, OrderedInMemoryEntitySetMixin } from "./set/ordered/mixins"; | ||
| import * as selectorsForEntitySet from "./set/selectors"; | ||
| export { InMemoryEntity, NamedInMemoryEntity, DefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, NamedDefaultableRepetitionContextAndRenderInMemoryEntity, NamedDefaultableRepetitionImportantSettingsInMemoryEntity, NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, HasScopeTrackMixin, RuntimeItemsMixin, RuntimeContextFieldMixin, InMemoryEntitySet, ENTITY_SET_TYPES, constructEntitySetFactoryByConfig, selectorsForEntitySet, InMemoryEntitySetMixin, InMemoryEntityInSetMixin, OrderedInMemoryEntitySetMixin, OrderedInMemoryEntityInSetMixin, ContextAndRenderFieldsMixin, FlowchartEntityMixin, FlowchartItemMixin, }; | ||
| export { InMemoryEntity, NamedInMemoryEntity, DefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, RuntimeContextFieldMixin, InMemoryEntitySet, ENTITY_SET_TYPES, constructEntitySetFactoryByConfig, selectorsForEntitySet, InMemoryEntitySetMixin, InMemoryEntityInSetMixin, OrderedInMemoryEntitySetMixin, OrderedInMemoryEntityInSetMixin, }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import type { AnyObject } from "@mat3ra/esse/dist/js/esse/types"; | ||
| import type { InMemoryEntity } from "../in_memory"; | ||
| export type Context = AnyObject; | ||
| export type ContextAndRenderFields = { | ||
| context?: Context; | ||
| updateContext(ctx: Context): void; | ||
| getPersistentContext(): Context | undefined; | ||
| updatePersistentContext(ctx: Context): void; | ||
| getCombinedContext(): Context; | ||
| }; | ||
| type AbstractBase = { | ||
| render(ctx: Context): void; | ||
| }; | ||
| export declare function contextAndRenderFieldsMixin<T extends InMemoryEntity & AbstractBase>(item: T): asserts item is T & ContextAndRenderFields; | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.contextAndRenderFieldsMixin = contextAndRenderFieldsMixin; | ||
| function contextAndRenderFieldsMixin(item) { | ||
| // @ts-expect-error | ||
| const properties = { | ||
| updateContext(ctx) { | ||
| this.context = { ...this.context, ...ctx }; | ||
| }, | ||
| getPersistentContext() { | ||
| return this.prop("context"); | ||
| }, | ||
| updatePersistentContext(ctx) { | ||
| this.setProp("context", { ...ctx }); | ||
| }, | ||
| getCombinedContext() { | ||
| return { ...this.getPersistentContext(), ...this.context }; | ||
| }, | ||
| }; | ||
| Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,9 @@ | ||
| import type { Constructor } from "../../utils/types"; | ||
| import { type DefaultableSchemaMixin } from "../../generated/DefaultableSchemaMixin"; | ||
| import type { AbstractConstructor, Constructor } from "../../utils/types"; | ||
| import { InMemoryEntity } from "../in_memory"; | ||
| export declare function defaultableEntityMixin<T extends InMemoryEntity>(item: T): InMemoryEntity & DefaultableInMemoryEntity; | ||
| export declare function defaultableEntityStaticMixin(Item: Constructor<InMemoryEntity>): DefaultableInMemoryStaticEntity & Constructor<InMemoryEntity> & Constructor<DefaultableInMemoryEntity> & { | ||
| defaultConfig?: object | null; | ||
| }; | ||
| export type DefaultableInMemoryEntity = { | ||
| isDefault: boolean; | ||
| }; | ||
| export type Defaultable = DefaultableSchemaMixin; | ||
| export type DefaultableInMemoryStaticEntity = { | ||
| createDefault: () => InMemoryEntity & DefaultableInMemoryEntity; | ||
| createDefault: () => InMemoryEntity & Defaultable; | ||
| }; | ||
| export type DefaultableInMemoryEntityConstructor = Constructor<DefaultableInMemoryEntity> & DefaultableInMemoryStaticEntity; | ||
| export type DefaultableInMemoryEntityConstructor = Constructor<Defaultable> & DefaultableInMemoryStaticEntity; | ||
| export declare function defaultableEntityMixin(Item: AbstractConstructor<InMemoryEntity>): void; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| import type { ConsistencyCheck } from "@mat3ra/esse/dist/js/types"; | ||
| import { type HasConsistencyChecksSchemaMixin } from "../../generated/HasConsistencyChecksSchemaMixin"; | ||
| import type { Constructor } from "../../utils/types"; | ||
| import { InMemoryEntity } from "../in_memory"; | ||
| export declare function hasConsistencyChecksMixin<T extends InMemoryEntity>(item: T): InMemoryEntity & HasConsistencyChecksInMemoryEntity; | ||
| export type HasConsistencyChecksInMemoryEntity = { | ||
| consistencyChecks: ConsistencyCheck[]; | ||
| type HasConsistencyChecksProperties = { | ||
| addConsistencyChecks: (array: ConsistencyCheck[]) => void; | ||
| }; | ||
| export type HasConsistencyChecksInMemoryEntityConstructor = Constructor<HasConsistencyChecksInMemoryEntity>; | ||
| export type HasConsistencyChecks = HasConsistencyChecksSchemaMixin & HasConsistencyChecksProperties; | ||
| export type HasConsistencyChecksInMemoryEntityConstructor = Constructor<HasConsistencyChecks>; | ||
| export declare function hasConsistencyChecksMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasConsistencyChecks; | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,14 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.hasConsistencyChecksMixin = hasConsistencyChecksMixin; | ||
| const HasConsistencyChecksSchemaMixin_1 = require("../../generated/HasConsistencyChecksSchemaMixin"); | ||
| function hasConsistencyChecksMixin(item) { | ||
| (0, HasConsistencyChecksSchemaMixin_1.hasConsistencyChecksSchemaMixin)(item); | ||
| // @ts-expect-error | ||
| const properties = { | ||
| get consistencyChecks() { | ||
| return this.prop("consistencyChecks", []); | ||
| }, | ||
| set consistencyChecks(array) { | ||
| this.setProp("consistencyChecks", array); | ||
| }, | ||
| addConsistencyChecks(array) { | ||
| this.consistencyChecks = [...(this.consistencyChecks || []), ...array]; | ||
| }, | ||
| }; | ||
| Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); | ||
| return properties; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,3 @@ | ||
| import type { DescriptionSchema } from "@mat3ra/esse/dist/js/types"; | ||
| import type { Constructor } from "../../utils/types"; | ||
| import { InMemoryEntity } from "../in_memory"; | ||
| export declare function hasDescriptionMixin<T extends InMemoryEntity>(item: T): InMemoryEntity & HasDescriptionInMemoryEntity; | ||
| export type HasDescriptionInMemoryEntity = { | ||
| description: string; | ||
| descriptionObject: DescriptionSchema["descriptionObject"]; | ||
| }; | ||
| export type HasDescriptionInMemoryEntityConstructor = Constructor<HasDescriptionInMemoryEntity>; | ||
| import { type HasDescriptionSchemaMixin, hasDescriptionSchemaMixin } from "../../generated/HasDescriptionSchemaMixin"; | ||
| export type HasDescription = HasDescriptionSchemaMixin; | ||
| export declare const hasDescriptionPropertiesMixin: typeof hasDescriptionSchemaMixin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,5 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.hasDescriptionMixin = hasDescriptionMixin; | ||
| function hasDescriptionMixin(item) { | ||
| // @ts-expect-error | ||
| const properties = { | ||
| get description() { | ||
| return this.prop("description", ""); | ||
| }, | ||
| set description(string) { | ||
| this.setProp("description", string); | ||
| }, | ||
| get descriptionObject() { | ||
| return this.prop("descriptionObject"); | ||
| }, | ||
| set descriptionObject(obj) { | ||
| this.setProp("descriptionObject", obj); | ||
| }, | ||
| }; | ||
| Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); | ||
| return properties; | ||
| } | ||
| exports.hasDescriptionPropertiesMixin = void 0; | ||
| const HasDescriptionSchemaMixin_1 = require("../../generated/HasDescriptionSchemaMixin"); | ||
| exports.hasDescriptionPropertiesMixin = HasDescriptionSchemaMixin_1.hasDescriptionSchemaMixin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| import type { MetadataSchema } from "@mat3ra/esse/dist/js/types"; | ||
| import type { Constructor } from "../../utils/types"; | ||
| import { InMemoryEntity } from "../in_memory"; | ||
| export declare function hasMetadataMixin<T extends InMemoryEntity>(item: T): InMemoryEntity & HasMetadataInMemoryEntity; | ||
| export type HasMetadataInMemoryEntity = { | ||
| metadata: object; | ||
| updateMetadata: (object: object) => void; | ||
| type Metadata = MetadataSchema["metadata"]; | ||
| export type HasMetadata<T extends Metadata = Metadata> = { | ||
| metadata?: T; | ||
| updateMetadata: (object: Partial<T>) => void; | ||
| }; | ||
| export type HasMetadataInMemoryEntityConstructor = Constructor<HasMetadataInMemoryEntity>; | ||
| export type HasMetadataInMemoryEntityConstructor<T extends Metadata = Metadata> = Constructor<HasMetadata<T>>; | ||
| export declare function hasMetadataMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasMetadata; | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,21 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.hasMetadataMixin = hasMetadataMixin; | ||
| function hasMetadataMixin(item) { | ||
| function hasMetadataPropertiesMixin(item) { | ||
| // @ts-expect-error | ||
| const properties = { | ||
| get metadata() { | ||
| return this.prop("metadata", {}); | ||
| return this.prop("metadata"); | ||
| }, | ||
| set metadata(object) { | ||
| this.setProp("metadata", object); | ||
| set metadata(value) { | ||
| this.setProp("metadata", value); | ||
| }, | ||
| updateMetadata(object) { | ||
| this.metadata = { ...this.metadata, ...object }; | ||
| this.setProp("metadata", { ...this.metadata, ...object }); | ||
| }, | ||
| }; | ||
| Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); | ||
| return properties; | ||
| } | ||
| function hasMetadataMixin(item) { | ||
| hasMetadataPropertiesMixin(item); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to have these in ESSE. AtomicCoordinateUnits is already there