Skip to content
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

Feature/workspaces #63

Merged
merged 18 commits into from
Apr 4, 2024
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/test-build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build image
run: docker build . --file ./Server/docker/Dockerfile --tag $IMAGE_NAME
run: docker build . --file ./Server/deploy.Dockerfile --tag $IMAGE_NAME
96 changes: 94 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,97 @@ package-lock.json
/Server/data/postgresql
/Swarm/data/postgresql

# Intellij
.idea/
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

#!.idea/codeStyles // todo potentially comment back in when vscode and intellij configs are supported
#!.idea/runConfigurations // todo potentially comment back in when vscode and intellij configs are supported

# End of https://www.toptal.com/developers/gitignore/api/intellij+all

data
15 changes: 8 additions & 7 deletions 00_Base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"name": "@citrineos/base",
"version": "1.0.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": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"lib"
"dist"
],
"scripts": {
"prepublish": "npx eslint ./src",
"prepare": "npm run build",
thanaParis marked this conversation as resolved.
Show resolved Hide resolved
"build": "tsc",
"generate-interfaces": "node json-schema-processor.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "npm run clean && tsc -p tsconfig.json",
"clean": "rm -rf package-lock.json dist node_modules tsconfig.tsbuildinfo"
},
"keywords": [
"ocpp",
Expand All @@ -37,5 +37,6 @@
"tslog": "^4.9.2",
"uuid": "^9.0.0",
"zod": "^3.22.2"
}
},
"workspace": "../"
ChrisWeissmann marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 3 additions & 1 deletion 00_Base/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,6 @@ export const CALL_RESULT_SCHEMA_MAP: Map<CallAction, object> = new Map<CallActio
[CallAction.UnlockConnector, UnlockConnectorResponseSchema],
[CallAction.UnpublishFirmware, UnpublishFirmwareResponseSchema],
[CallAction.UpdateFirmware, UpdateFirmwareResponseSchema],
]);
]);

export {eventGroupFromString} from './interfaces/messages';
9 changes: 9 additions & 0 deletions 00_Base/src/interfaces/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum MessageOrigin {
}

export enum EventGroup {
All = 'all',
General = 'general',
Certificates = "certificates",
Configuration = "configuration",
Expand All @@ -33,6 +34,14 @@ export enum EventGroup {
Transactions = 'transactions',
}

export const eventGroupFromString = (source: string): EventGroup => {
thanaParis marked this conversation as resolved.
Show resolved Hide resolved
const eventGroup: EventGroup = source as EventGroup;
if (!eventGroup) {
throw new Error(`Invalid event group soruce ${source}"`);
}
return eventGroup;
}

export { IMessage, Message } from "./Message";
export { IMessageHandler } from "./MessageHandler";
export { IMessageSender } from "./MessageSender";
Expand Down
25 changes: 8 additions & 17 deletions 00_Base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"skipLibCheck": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"outDir": "lib",
"strict": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"extends": "../tsconfig.build.json",
"include": [
"src"
"src/**/*.ts",
"src/**/*.json"
],
"exclude": [
"node_modules",
"**/__tests__/*"
]
"compilerOptions": {
"outDir": "./dist/",
"composite": true,
"rootDir": "./src"
}
}
19 changes: 10 additions & 9 deletions 01_Data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
"name": "@citrineos/data",
"version": "1.0.0",
"description": "The OCPP data module which includes all persistence layer implementation.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"lib"
"dist"
],
"scripts": {
"install-base": "cd ../00_Base && npm run build && npm pack && cd ../01_Data && npm install ../00_Base/citrineos-base-1.0.0.tgz",
"prepublish": "npx eslint",
"prepare": "npm run build",
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "npm run clean && tsc -p tsconfig.json",
"clean": "rm -rf package-lock.json dist node_modules tsconfig.tsbuildinfo"
},
"keywords": [
"ocpp",
Expand All @@ -27,7 +26,8 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@citrineos/base": "file:../00_Base/citrineos-base-1.0.0.tgz",
"@citrineos/base": "1.0.0",
"@types/sequelize": "^4.28.20",
"bcrypt": "^5.1.1",
"pg": "^8.11.3",
"pg-hstore": "^2.3.4",
Expand All @@ -37,5 +37,6 @@
},
"engines": {
"node": ">=18"
}
},
"workspace": "../"
}
13 changes: 12 additions & 1 deletion 01_Data/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,15 @@
// SPDX-License-Identifier: Apache 2.0

export * as sequelize from "./layers/sequelize";
export * from "./interfaces";
export * from "./interfaces";
export {
Boot,
Component,
DeviceModelRepository,
MeterValue,
Subscription,
Tariff,
Transaction,
Variable,
VariableAttribute
} from "./layers/sequelize"; // todo export better as these seem to be used in other modules
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
//
// SPDX-License-Identifier: Apache 2.0

import { Namespace, CustomDataType } from "@citrineos/base";
import { StatusInfoType } from "@citrineos/base/lib/ocpp/model/types/SetVariablesResponse";
import { Table, Model, BelongsTo, Column, DataType, ForeignKey } from "sequelize-typescript";
import { VariableAttribute } from "./VariableAttribute";
import {CustomDataType, Namespace, StatusInfoType} from "@citrineos/base";
import {BelongsTo, Column, DataType, ForeignKey, Model, Table} from "sequelize-typescript";
import {VariableAttribute} from "./VariableAttribute";

@Table
export class VariableStatus extends Model {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache 2.0

import {CustomDataType, Namespace} from "@citrineos/base";
import {StatusInfoType} from "@citrineos/base/lib/ocpp/model/types/SetVariableMonitoringResponse";
import {StatusInfoType} from "@citrineos/base";
import {BelongsTo, Column, DataType, ForeignKey, Model, Table} from "sequelize-typescript";
import {VariableMonitoring} from "./VariableMonitoring";

Expand Down
27 changes: 12 additions & 15 deletions 01_Data/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"outDir": "lib",
"strict": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"extends": "../tsconfig.build.json",
"include": [
"src"
"src/**/*.ts",
"src/**/*.json"
],
"exclude": [
"node_modules",
"**/__tests__/*"
"compilerOptions": {
"outDir": "./dist/",
"composite": true,
"rootDir": "./src"
},
"references": [
{
"path": "../00_Base"
}
ChrisWeissmann marked this conversation as resolved.
Show resolved Hide resolved
]
}
21 changes: 10 additions & 11 deletions 02_Util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
"name": "@citrineos/util",
"version": "1.0.0",
"description": "The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"lib"
"dist"
],
"scripts": {
"prepublish": "npx eslint ./src",
"prepare": "npm run build",
"build": "tsc",
"install-base": "cd ../00_Base && npm run build && npm pack && cd ../02_Util && npm install ../00_Base/citrineos-base-1.0.0.tgz",
"install-data": "cd ../01_Data && npm run build && npm pack && cd ../02_Util && npm install ../01_Data/citrineos-data-1.0.0.tgz",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "npm run clean && tsc -p tsconfig.json",
"clean": "rm -rf package-lock.json dist node_modules tsconfig.tsbuildinfo"
},
"keywords": [
"ocpp",
Expand All @@ -35,8 +33,8 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@citrineos/base": "file:../00_Base/citrineos-base-1.0.0.tgz",
"@citrineos/data": "file:../01_Data/citrineos-data-1.0.0.tgz",
"@citrineos/base": "1.0.0",
"@citrineos/data": "1.0.0",
"@directus/sdk": "^15.0.3",
"@fastify/swagger": "^8.10.1",
"@fastify/swagger-ui": "^1.9.3",
Expand All @@ -51,5 +49,6 @@
"redis": "^4.6.6",
"tslog": "^4.8.2",
"uuid": "^9.0.0"
}
},
"workspace": "../"
}
Loading