@ecogood/e-calculator-schemas 2.0.0 → 2.2.0
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/LICENSE +20 -20
- package/README.md +26 -26
- package/dist/balance.sheet.dto.d.ts +12 -0
- package/dist/balance.sheet.dto.js +2 -0
- package/dist/shared.schemas.d.ts +1 -0
- package/dist/shared.schemas.js +4 -1
- package/package.json +52 -52
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Michael Rudolph
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Michael Rudolph
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# E-Calculator Schemas
|
|
2
|
-
|
|
3
|
-
This project contains the data transfer objects which are used by the [E-Calculator REST API](https://git.ecogood.org/services/balance-sheet-calculator)
|
|
4
|
-
and the [E-Calculator Frontend](https://git.ecogood.org/services/e-calculator-frontend).
|
|
5
|
-
|
|
6
|
-
## Install
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install e-calculator-schemas
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
import { RegionResponseBodySchema } from 'e-calculator-schemas/dist/region.dto';
|
|
16
|
-
const regionJson = {
|
|
17
|
-
countryCode: 'DEU',
|
|
18
|
-
countryName: 'Germany',
|
|
19
|
-
};
|
|
20
|
-
RegionResponseBodySchema.parse(regionJson);
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Publish
|
|
24
|
-
```bash
|
|
25
|
-
npm publish
|
|
26
|
-
```
|
|
1
|
+
# E-Calculator Schemas
|
|
2
|
+
|
|
3
|
+
This project contains the data transfer objects which are used by the [E-Calculator REST API](https://git.ecogood.org/services/balance-sheet-calculator)
|
|
4
|
+
and the [E-Calculator Frontend](https://git.ecogood.org/services/e-calculator-frontend).
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install e-calculator-schemas
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { RegionResponseBodySchema } from 'e-calculator-schemas/dist/region.dto';
|
|
16
|
+
const regionJson = {
|
|
17
|
+
countryCode: 'DEU',
|
|
18
|
+
countryName: 'Germany',
|
|
19
|
+
};
|
|
20
|
+
RegionResponseBodySchema.parse(regionJson);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Publish
|
|
24
|
+
```bash
|
|
25
|
+
npm publish
|
|
26
|
+
```
|
|
@@ -733,15 +733,27 @@ export declare const BalanceSheetResponseBodySchema: z.ZodObject<{
|
|
|
733
733
|
}>;
|
|
734
734
|
export declare const BalanceSheetItemResponseSchema: z.ZodObject<{
|
|
735
735
|
id: z.ZodNumber;
|
|
736
|
+
version: z.ZodNativeEnum<typeof BalanceSheetVersion>;
|
|
737
|
+
type: z.ZodNativeEnum<typeof BalanceSheetType>;
|
|
736
738
|
}, "strip", z.ZodTypeAny, {
|
|
739
|
+
type: BalanceSheetType;
|
|
737
740
|
id: number;
|
|
741
|
+
version: BalanceSheetVersion;
|
|
738
742
|
}, {
|
|
743
|
+
type: BalanceSheetType;
|
|
739
744
|
id: number;
|
|
745
|
+
version: BalanceSheetVersion;
|
|
740
746
|
}>;
|
|
741
747
|
export declare const BalanceSheetItemsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
742
748
|
id: z.ZodNumber;
|
|
749
|
+
version: z.ZodNativeEnum<typeof BalanceSheetVersion>;
|
|
750
|
+
type: z.ZodNativeEnum<typeof BalanceSheetType>;
|
|
743
751
|
}, "strip", z.ZodTypeAny, {
|
|
752
|
+
type: BalanceSheetType;
|
|
744
753
|
id: number;
|
|
754
|
+
version: BalanceSheetVersion;
|
|
745
755
|
}, {
|
|
756
|
+
type: BalanceSheetType;
|
|
746
757
|
id: number;
|
|
758
|
+
version: BalanceSheetVersion;
|
|
747
759
|
}>, "many">;
|
|
@@ -28,5 +28,7 @@ exports.BalanceSheetResponseBodySchema = zod_1.z.object({
|
|
|
28
28
|
});
|
|
29
29
|
exports.BalanceSheetItemResponseSchema = zod_1.z.object({
|
|
30
30
|
id: zod_1.z.number(),
|
|
31
|
+
version: zod_1.z.nativeEnum(shared_schemas_1.BalanceSheetVersion),
|
|
32
|
+
type: zod_1.z.nativeEnum(shared_schemas_1.BalanceSheetType),
|
|
31
33
|
});
|
|
32
34
|
exports.BalanceSheetItemsResponseSchema = exports.BalanceSheetItemResponseSchema.array();
|
package/dist/shared.schemas.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export declare const isWeight: z.ZodEffects<z.ZodNumber, number, number>;
|
|
|
16
16
|
export declare const isWeightOptional: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
17
17
|
export declare const isNumberWithDefaultZero: z.ZodDefault<z.ZodNumber>;
|
|
18
18
|
export declare const isPositiveNumber: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
export declare const isPositiveNumberNotZero: z.ZodDefault<z.ZodNumber>;
|
|
19
20
|
export declare const isPercentage: z.ZodNumber;
|
package/dist/shared.schemas.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPercentage = exports.isPositiveNumber = exports.isNumberWithDefaultZero = exports.isWeightOptional = exports.isWeight = exports.WEIGHT_VALUES = exports.BalanceSheetVersion = exports.BalanceSheetType = exports.isIndustryCode = exports.isCountryCode = void 0;
|
|
3
|
+
exports.isPercentage = exports.isPositiveNumberNotZero = exports.isPositiveNumber = exports.isNumberWithDefaultZero = exports.isWeightOptional = exports.isWeight = exports.WEIGHT_VALUES = exports.BalanceSheetVersion = exports.BalanceSheetType = exports.isIndustryCode = exports.isCountryCode = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.isCountryCode = zod_1.z.string().min(3).max(3);
|
|
6
6
|
exports.isIndustryCode = zod_1.z.string().min(1).max(4);
|
|
@@ -31,6 +31,9 @@ exports.isNumberWithDefaultZero = isNumberCustomError.default(0);
|
|
|
31
31
|
exports.isPositiveNumber = isNumberCustomError
|
|
32
32
|
.nonnegative('Number should be positive')
|
|
33
33
|
.default(0);
|
|
34
|
+
exports.isPositiveNumberNotZero = isNumberCustomError
|
|
35
|
+
.gt(0, 'Number should be positive and greater than zero')
|
|
36
|
+
.default(0);
|
|
34
37
|
exports.isPercentage = zod_1.z
|
|
35
38
|
.number({
|
|
36
39
|
invalid_type_error: 'Percentage expected',
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ecogood/e-calculator-schemas",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "A package providing the schemas for the e-calculator application.",
|
|
5
|
-
"main": "dist/e-calculator-schemas",
|
|
6
|
-
"types": "dist/e-calculator-schemas",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"test": "jest --watch --runInBand",
|
|
10
|
-
"test:ci": "jest --runInBand",
|
|
11
|
-
"format": "prettier --write .",
|
|
12
|
-
"lint": "eslint .",
|
|
13
|
-
"lint-fix": "eslint . --fix",
|
|
14
|
-
"update:to:latest": "ncu -u && yarn update && yarn install && yarn audit fix",
|
|
15
|
-
"prepare": "rm -r dist || true && yarn run build && yarn run test:ci && yarn run lint"
|
|
16
|
-
},
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"LICENSE",
|
|
23
|
-
"README.md"
|
|
24
|
-
],
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "https://git.ecogood.org/services/e-calculator-schemas"
|
|
28
|
-
},
|
|
29
|
-
"keywords": [
|
|
30
|
-
"version",
|
|
31
|
-
"compare"
|
|
32
|
-
],
|
|
33
|
-
"author": "Michael Rudolph",
|
|
34
|
-
"license": "MIT",
|
|
35
|
-
"bugs": {
|
|
36
|
-
"url": "https://git.ecogood.org/services/e-calculator-schemas/issues"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@eslint/js": "^9.4.0",
|
|
40
|
-
"@types/eslint__js": "^8.42.3",
|
|
41
|
-
"@types/jest": "^28.1.6",
|
|
42
|
-
"eslint": "^9.4.0",
|
|
43
|
-
"jest": "^29.5.0",
|
|
44
|
-
"prettier": "2.3.2",
|
|
45
|
-
"ts-jest": "^29.0.5",
|
|
46
|
-
"typescript": "^5.4.5",
|
|
47
|
-
"typescript-eslint": "^7.13.0"
|
|
48
|
-
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"zod": "^3.23.8"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@ecogood/e-calculator-schemas",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "A package providing the schemas for the e-calculator application.",
|
|
5
|
+
"main": "dist/e-calculator-schemas",
|
|
6
|
+
"types": "dist/e-calculator-schemas",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "jest --watch --runInBand",
|
|
10
|
+
"test:ci": "jest --runInBand",
|
|
11
|
+
"format": "prettier --write .",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"lint-fix": "eslint . --fix",
|
|
14
|
+
"update:to:latest": "ncu -u && yarn update && yarn install && yarn audit fix",
|
|
15
|
+
"prepare": "rm -r dist || true && yarn run build && yarn run test:ci && yarn run lint"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://git.ecogood.org/services/e-calculator-schemas"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"version",
|
|
31
|
+
"compare"
|
|
32
|
+
],
|
|
33
|
+
"author": "Michael Rudolph",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://git.ecogood.org/services/e-calculator-schemas/issues"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@eslint/js": "^9.4.0",
|
|
40
|
+
"@types/eslint__js": "^8.42.3",
|
|
41
|
+
"@types/jest": "^28.1.6",
|
|
42
|
+
"eslint": "^9.4.0",
|
|
43
|
+
"jest": "^29.5.0",
|
|
44
|
+
"prettier": "2.3.2",
|
|
45
|
+
"ts-jest": "^29.0.5",
|
|
46
|
+
"typescript": "^5.4.5",
|
|
47
|
+
"typescript-eslint": "^7.13.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"zod": "^3.23.8"
|
|
51
|
+
}
|
|
52
|
+
}
|