Skip to content

Commit

Permalink
Merge pull request #230 from citrineos/rc-1.4.0
Browse files Browse the repository at this point in the history
Rc 1.4.0
  • Loading branch information
thanaParis authored Aug 16, 2024
2 parents 7659cea + 9dc06bb commit d4d40af
Show file tree
Hide file tree
Showing 288 changed files with 6,008 additions and 2,489 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

181 changes: 0 additions & 181 deletions .eslintrc.json

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/jest-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Jest Tests

on:
pull_request:

jobs:
jest-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install && npm run build

- name: Run tests
run: npm test
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Clone citrineos-ocpi repository
run: git clone https://github.com/citrineos/citrineos-ocpi.git ../citrineos-ocpi

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/push-release-tagged-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
image:
- name: citrineos-server
context: ../
dockerfile: ./Server/deploy.with.ocpi.Dockerfile
dockerfile: ./Server/deploy.Dockerfile
config: ''
- name: citrineos-directus
context: ./DirectusExtensions
Expand All @@ -27,9 +27,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Clone citrineos-ocpi repository
run: git clone https://github.com/citrineos/citrineos-ocpi.git ../citrineos-ocpi

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test-build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Clone citrineos-ocpi repository
run: git clone https://github.com/citrineos/citrineos-ocpi.git ../citrineos-ocpi

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down Expand Up @@ -55,4 +52,4 @@ jobs:
docker container ls -aq | xargs -I {} docker logs {}
- name: Clean up
run: docker-compose -f ${{ github.workspace }}/Server/docker-compose.yml down
run: docker compose -f ${{ github.workspace }}/Server/docker-compose.yml down
11 changes: 11 additions & 0 deletions 00_Base/json-schema-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
// SPDX-License-Identifier: Apache 2.0
/* eslint-disable */

/**
* execution:
* - cd 00_Base
* - node json-schema-processor.js src/ocpp/model/schemas
*/
const fs = require('fs');
const jsts = require('json-schema-to-typescript');
const prettier = require('prettier');
Expand Down Expand Up @@ -178,6 +183,12 @@ async function processJsonSchema(data, writeToFile = true) {
`import { ${schemaType} } from '../../..';\n` +
ts.substring(index);

// Add null type to all optional properties
// This regex means a string starts with '?:' and ends with ';'
// and contains no '[' or ']' in between
const regex = /(\?:[^;\[\]]*);/g;
ts = ts.replaceAll(regex, '$1 | null;');

if (writeToFile) {
fs.writeFileSync(
`./src/ocpp/model/types/${id}.ts`,
Expand Down
40 changes: 21 additions & 19 deletions 00_Base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@citrineos/base",
"version": "1.3.2",
"version": "1.4.0",
"description": "The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -10,10 +10,7 @@
"scripts": {
"prepublish": "npx eslint ./src",
"generate-interfaces": "node json-schema-processor.js",
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "npm run clean && tsc -p tsconfig.json",
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
"fresh": "rm -rf node_modules package-lock.json && npm run clean"
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ocpp",
Expand All @@ -22,21 +19,26 @@
"author": "S44",
"license": "Apache-2.0",
"devDependencies": {
"@types/uuid": "^9.0.3",
"@types/validator": "^13.11.1",
"eslint": "^8.48.0",
"json-schema-to-typescript": "^12.0.0",
"json-schema-to-zod": "^1.1.1",
"typescript": "5.0.4"
"@types/uuid": "9.0.3",
"@types/validator": "13.11.1",
"eslint": "8.48.0",
"json-schema-to-typescript": "12.0.0",
"json-schema-to-zod": "1.1.1",
"typescript": "5.0.4",
"@types/jest": "29.5.12",
"jest": "29.7.0",
"ts-jest": "29.2.3",
"@faker-js/faker": "8.4.1"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.5.0",
"ajv": "^8.12.0",
"class-transformer": "^0.5.1",
"fastify": "^4.22.2",
"reflect-metadata": "^0.1.13",
"tslog": "^4.9.2",
"uuid": "^9.0.0",
"zod": "^3.22.2"
"@typescript-eslint/eslint-plugin": "6.5.0",
"ajv": "8.17.1",
"class-transformer": "0.5.1",
"fastify": "4.22.2",
"@fastify/auth": "4.6.1",
"reflect-metadata": "0.1.13",
"tslog": "4.9.2",
"uuid": "9.0.0",
"zod": "3.22.2"
}
}
2 changes: 1 addition & 1 deletion 00_Base/src/config/BootConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface BootConfig {
*/
bootRetryInterval?: number;
status: RegistrationStatusEnumType;
statusInfo?: StatusInfoType;
statusInfo?: StatusInfoType | null;
/**
* Also declared in SystemConfig. If absent, SystemConfig value is used.
*/
Expand Down
4 changes: 4 additions & 0 deletions 00_Base/src/config/signedMeterValuesConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export class SignedMeterValuesConfig {
publicKeyFileId!: string;
signingMethod!: string;
}
12 changes: 12 additions & 0 deletions 00_Base/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export const systemConfigInputSchema = z.object({
port: z.number().int().positive().default(8081).optional(),
costUpdatedInterval: z.number().int().positive().default(60).optional(),
sendCostUpdatedOnMeterValue: z.boolean().default(false).optional(),
signedMeterValuesConfiguration: z
.object({
publicKeyFileId: z.string(),
signingMethod: z.enum(['RSASSA-PKCS1-v1_5', 'ECDSA']),
})
.optional(),
}),
}),
data: z.object({
Expand Down Expand Up @@ -334,6 +340,12 @@ export const systemConfigSchema = z
port: z.number().int().positive().optional(),
costUpdatedInterval: z.number().int().positive().optional(),
sendCostUpdatedOnMeterValue: z.boolean().optional(),
signedMeterValuesConfiguration: z
.object({
publicKeyFileId: z.string(),
signingMethod: z.enum(['RSASSA-PKCS1-v1_5', 'ECDSA']),
})
.optional(),
})
.refine(
(obj) =>
Expand Down
Loading

0 comments on commit d4d40af

Please sign in to comment.