dragonfly-schema 1.12.1-v10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/helpers/class-validator.ts +94 -0
- package/index.ts +1 -0
- package/models/Building.ts +98 -0
- package/models/BuildingEnergyPropertiesAbridged.ts +65 -0
- package/models/BuildingPropertiesAbridged.ts +73 -0
- package/models/BuildingRadiancePropertiesAbridged.ts +63 -0
- package/models/ContextShade.ts +83 -0
- package/models/ContextShadeEnergyPropertiesAbridged.ts +74 -0
- package/models/ContextShadePropertiesAbridged.ts +73 -0
- package/models/ContextShadeRadiancePropertiesAbridged.ts +63 -0
- package/models/DetailedSkylights.ts +73 -0
- package/models/DetailedWindows.ts +73 -0
- package/models/ExteriorApertureGridParameter.ts +74 -0
- package/models/ExteriorApertureType.ts +8 -0
- package/models/ExteriorFaceGridParameter.ts +82 -0
- package/models/ExteriorFaceType.ts +9 -0
- package/models/ExtrudedBorder.ts +63 -0
- package/models/GriddedSkylightArea.ts +71 -0
- package/models/GriddedSkylightRatio.ts +71 -0
- package/models/LouversByCount.ts +63 -0
- package/models/LouversByDistance.ts +63 -0
- package/models/Model.ts +125 -0
- package/models/ModelEnergyProperties.ts +606 -0
- package/models/ModelProperties.ts +73 -0
- package/models/ModelRadianceProperties.ts +253 -0
- package/models/Overhang.ts +73 -0
- package/models/RectangularWindows.ts +89 -0
- package/models/RepeatingWindowRatio.ts +94 -0
- package/models/RoofSpecification.ts +67 -0
- package/models/Room2D.ts +166 -0
- package/models/Room2DEnergyPropertiesAbridged.ts +123 -0
- package/models/Room2DPropertiesAbridged.ts +73 -0
- package/models/Room2DRadiancePropertiesAbridged.ts +74 -0
- package/models/RoomGridParameter.ts +72 -0
- package/models/RoomRadialGridParameter.ts +80 -0
- package/models/SimpleWindowArea.ts +71 -0
- package/models/SimpleWindowRatio.ts +71 -0
- package/models/SingleWindow.ts +78 -0
- package/models/Story.ts +111 -0
- package/models/StoryEnergyPropertiesAbridged.ts +65 -0
- package/models/StoryPropertiesAbridged.ts +73 -0
- package/models/StoryRadiancePropertiesAbridged.ts +63 -0
- package/models/_GridParameterBase.ts +71 -0
- package/models/_LouversBase.ts +99 -0
- package/models/_OpenAPIGenBaseModel.ts +38 -0
- package/models/_WindowParameterBase.ts +62 -0
- package/models/index.ts +46 -0
- package/package.json +28 -0
- package/tsconfig.json +32 -0
- package/vite.config.ts +14 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
|
|
2
|
+
import { Type, plainToClass, instanceToPlain } from 'class-transformer';
|
|
3
|
+
import { _LouversBase } from "./_LouversBase";
|
|
4
|
+
|
|
5
|
+
/** A series of louvered Shades at a given distance between each louver. */
|
|
6
|
+
export class LouversByDistance extends _LouversBase {
|
|
7
|
+
@IsNumber()
|
|
8
|
+
@IsDefined()
|
|
9
|
+
/** A number for the approximate distance between each louver. */
|
|
10
|
+
distance!: number;
|
|
11
|
+
|
|
12
|
+
@IsString()
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@Matches(/^LouversByDistance$/)
|
|
15
|
+
type?: string;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.type = "LouversByDistance";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
override init(_data?: any) {
|
|
25
|
+
super.init(_data);
|
|
26
|
+
if (_data) {
|
|
27
|
+
const obj = plainToClass(LouversByDistance, _data);
|
|
28
|
+
this.distance = obj.distance;
|
|
29
|
+
this.type = obj.type;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
static override fromJS(data: any): LouversByDistance {
|
|
35
|
+
data = typeof data === 'object' ? data : {};
|
|
36
|
+
|
|
37
|
+
let result = new LouversByDistance();
|
|
38
|
+
result.init(data);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override toJSON(data?: any) {
|
|
43
|
+
data = typeof data === 'object' ? data : {};
|
|
44
|
+
for (var property in this) {
|
|
45
|
+
if (this.hasOwnProperty(property))
|
|
46
|
+
data[property] = this[property];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
data["distance"] = this.distance;
|
|
50
|
+
data["type"] = this.type;
|
|
51
|
+
data = super.toJSON(data);
|
|
52
|
+
return instanceToPlain(data);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async validate(): Promise<boolean> {
|
|
56
|
+
const errors = await validate(this);
|
|
57
|
+
if (errors.length > 0){
|
|
58
|
+
const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
|
|
59
|
+
throw new Error(`Validation failed: ${errorMessages}`);
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
package/models/Model.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { IsInstance, ValidateNested, IsDefined, IsString, IsOptional, Matches, IsArray, IsEnum, IsNumber, Min, validate, ValidationError as TsValidationError } from 'class-validator';
|
|
2
|
+
import { Type, plainToClass, instanceToPlain } from 'class-transformer';
|
|
3
|
+
import { Building } from "./Building";
|
|
4
|
+
import { ContextShade } from "./ContextShade";
|
|
5
|
+
import { IDdBaseModel } from "honeybee-schema";
|
|
6
|
+
import { ModelProperties } from "./ModelProperties";
|
|
7
|
+
import { Units } from "honeybee-schema";
|
|
8
|
+
|
|
9
|
+
/** Base class for all objects requiring a identifiers acceptable for all engines. */
|
|
10
|
+
export class Model extends IDdBaseModel {
|
|
11
|
+
@IsInstance(ModelProperties)
|
|
12
|
+
@Type(() => ModelProperties)
|
|
13
|
+
@ValidateNested()
|
|
14
|
+
@IsDefined()
|
|
15
|
+
/** Extension properties for particular simulation engines (Radiance, EnergyPlus). */
|
|
16
|
+
properties!: ModelProperties;
|
|
17
|
+
|
|
18
|
+
@IsString()
|
|
19
|
+
@IsOptional()
|
|
20
|
+
@Matches(/^Model$/)
|
|
21
|
+
type?: string;
|
|
22
|
+
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsOptional()
|
|
25
|
+
@Matches(/([0-9]+)\.([0-9]+)\.([0-9]+)/)
|
|
26
|
+
/** Text string for the current version of the schema. */
|
|
27
|
+
version?: string;
|
|
28
|
+
|
|
29
|
+
@IsArray()
|
|
30
|
+
@IsInstance(Building, { each: true })
|
|
31
|
+
@Type(() => Building)
|
|
32
|
+
@ValidateNested({ each: true })
|
|
33
|
+
@IsOptional()
|
|
34
|
+
/** A list of Buildings in the model. */
|
|
35
|
+
buildings?: Building [];
|
|
36
|
+
|
|
37
|
+
@IsArray()
|
|
38
|
+
@IsInstance(ContextShade, { each: true })
|
|
39
|
+
@Type(() => ContextShade)
|
|
40
|
+
@ValidateNested({ each: true })
|
|
41
|
+
@IsOptional()
|
|
42
|
+
/** A list of ContextShades in the model. */
|
|
43
|
+
context_shades?: ContextShade [];
|
|
44
|
+
|
|
45
|
+
@IsEnum(Units)
|
|
46
|
+
@Type(() => String)
|
|
47
|
+
@IsOptional()
|
|
48
|
+
/** Text indicating the units in which the model geometry exists. This is used to scale the geometry to the correct units for simulation engines like EnergyPlus, which requires all geometry be in meters. */
|
|
49
|
+
units?: Units;
|
|
50
|
+
|
|
51
|
+
@IsNumber()
|
|
52
|
+
@IsOptional()
|
|
53
|
+
@Min(0)
|
|
54
|
+
/** The maximum difference between x, y, and z values at which vertices are considered equivalent. This value should be in the Model units and is used in a variety of checks and operations. A value of 0 will result in bypassing all checks so it is recommended that this always be a positive number when checks have not already been performed on a Model. The default of 0.01 is suitable for models in meters. */
|
|
55
|
+
tolerance?: number;
|
|
56
|
+
|
|
57
|
+
@IsNumber()
|
|
58
|
+
@IsOptional()
|
|
59
|
+
@Min(0)
|
|
60
|
+
/** The max angle difference in degrees that vertices are allowed to differ from one another in order to consider them colinear. This value is used in a variety of checks and operations that can be performed on geometry. A value of 0 will result in no checks and an inability to perform certain operations so it is recommended that this always be a positive number when checks have not already been performed on a given Model. */
|
|
61
|
+
angle_tolerance?: number;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
constructor() {
|
|
65
|
+
super();
|
|
66
|
+
this.type = "Model";
|
|
67
|
+
this.version = "0.0.0";
|
|
68
|
+
this.units = Units.Meters;
|
|
69
|
+
this.tolerance = 0.01;
|
|
70
|
+
this.angle_tolerance = 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
override init(_data?: any) {
|
|
75
|
+
super.init(_data);
|
|
76
|
+
if (_data) {
|
|
77
|
+
const obj = plainToClass(Model, _data);
|
|
78
|
+
this.properties = obj.properties;
|
|
79
|
+
this.type = obj.type;
|
|
80
|
+
this.version = obj.version;
|
|
81
|
+
this.buildings = obj.buildings;
|
|
82
|
+
this.context_shades = obj.context_shades;
|
|
83
|
+
this.units = obj.units;
|
|
84
|
+
this.tolerance = obj.tolerance;
|
|
85
|
+
this.angle_tolerance = obj.angle_tolerance;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
static override fromJS(data: any): Model {
|
|
91
|
+
data = typeof data === 'object' ? data : {};
|
|
92
|
+
|
|
93
|
+
let result = new Model();
|
|
94
|
+
result.init(data);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
override toJSON(data?: any) {
|
|
99
|
+
data = typeof data === 'object' ? data : {};
|
|
100
|
+
for (var property in this) {
|
|
101
|
+
if (this.hasOwnProperty(property))
|
|
102
|
+
data[property] = this[property];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
data["properties"] = this.properties;
|
|
106
|
+
data["type"] = this.type;
|
|
107
|
+
data["version"] = this.version;
|
|
108
|
+
data["buildings"] = this.buildings;
|
|
109
|
+
data["context_shades"] = this.context_shades;
|
|
110
|
+
data["units"] = this.units;
|
|
111
|
+
data["tolerance"] = this.tolerance;
|
|
112
|
+
data["angle_tolerance"] = this.angle_tolerance;
|
|
113
|
+
data = super.toJSON(data);
|
|
114
|
+
return instanceToPlain(data);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async validate(): Promise<boolean> {
|
|
118
|
+
const errors = await validate(this);
|
|
119
|
+
if (errors.length > 0){
|
|
120
|
+
const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
|
|
121
|
+
throw new Error(`Validation failed: ${errorMessages}`);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}
|