Skip to content

Commit

Permalink
Release 0.8.0 (#134)
Browse files Browse the repository at this point in the history
* feat: export migration scripts (#113)

* export migration scripts

* export DbConfig from data-model

Export models

* export dist path (#116)

* Feat #120 - Get previous submissions paginated (#121)

* get submission by id

* retrieve submissions by category

* get submission by organization

* relocate submission unit tests

* Add customizable callback for post-commit (#126)

* on finish commit callback

* check record data changes

* fix bytes parsing number (#128)

* Submit data using JSON format (#133)

* remove file reading

* Update types.ts

* fix typescript error & remove deprecated endpoint

* 0.8.0
  • Loading branch information
leoraba authored Mar 3, 2025
1 parent f170a4b commit a422997
Show file tree
Hide file tree
Showing 33 changed files with 812 additions and 1,072 deletions.
1 change: 0 additions & 1 deletion .env.schema
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ ID_USELOCAL=
LECTERN_URL=
LOG_LEVEL=
PORT=3030
UPLOAD_LIMIT=''
PLURALIZE_SCHEMAS_ENABLED=
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,21 @@ Create a `.env` file based on `.env.schema` located on the root folder and set t

The Environment Variables used for this application are listed in the table bellow

| Name | Description | Default |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| `AUDIT_ENABLED` | Ensures that any modifications to the submitted data are logged, providing a way to identify who made changes and when they were made. | true |
| `DB_HOST` | Database Hostname | |
| `DB_NAME` | Database Name | |
| `DB_PASSWORD` | Database Password | |
| `DB_PORT` | Database Port | |
| `DB_USER` | Database User | |
| `ID_CUSTOM_ALPHABET` | Custom Alphabet for local ID generation | '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| `ID_CUSTOM_SIZE` | Custom size of ID for local ID generation | 21 |
| `ID_USELOCAL` | Generate ID locally | true |
| `LECTERN_URL` | Schema Service (Lectern) URL | |
| `LOG_LEVEL` | Log Level | 'info' |
| `PLURALIZE_SCHEMAS_ENABLED` | This feature automatically convert schema names to their plural forms when handling compound documents. Pluralization assumes the words are in English | true |
| `PORT` | Server Port. | 3030 |
| `UPLOAD_LIMIT` | Limit upload file size in string or number. <br>Supported units and abbreviations are as follows and are case-insensitive: <br> - b for bytes<br> - kb for kilobytes<br>- mb for megabytes<br>- gb for gigabytes<br>- tb for terabytes<br>- pb for petabytes<br>Any other text is considered as byte | '10mb' |
| Name | Description | Default |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- |
| `AUDIT_ENABLED` | Ensures that any modifications to the submitted data are logged, providing a way to identify who made changes and when they were made. | true |
| `DB_HOST` | Database Hostname | |
| `DB_NAME` | Database Name | |
| `DB_PASSWORD` | Database Password | |
| `DB_PORT` | Database Port | |
| `DB_USER` | Database User | |
| `ID_CUSTOM_ALPHABET` | Custom Alphabet for local ID generation | '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| `ID_CUSTOM_SIZE` | Custom size of ID for local ID generation | 21 |
| `ID_USELOCAL` | Generate ID locally | true |
| `LECTERN_URL` | Schema Service (Lectern) URL | |
| `LOG_LEVEL` | Log Level | 'info' |
| `PLURALIZE_SCHEMAS_ENABLED` | This feature automatically convert schema names to their plural forms when handling compound documents. Pluralization assumes the words are in English | true |
| `PORT` | Server Port. | 3030 |

## Script commands (Workspace)

Expand Down
1 change: 0 additions & 1 deletion apps/server/.env.schema
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
PORT=3030
UPLOAD_LIMIT=''
DB_HOST=
DB_PORT=
DB_NAME=
Expand Down
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "0.7.0",
"version": "0.8.0",
"description": "Lyric Server",
"engines": {
"node": ">=20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/config/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pkg from '../../package.json' assert { type: 'json' };
import pkg from '../../package.json' with { type: 'json' };

export const { name, version } = pkg;
3 changes: 0 additions & 3 deletions apps/server/src/config/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ export const defaultAppConfig: AppConfig = {
schemaService: {
url: getRequiredConfig('LECTERN_URL'),
},
limits: {
fileSize: process.env.UPLOAD_LIMIT || '10mb',
},
logger: {
level: process.env.LOG_LEVEL || 'info',
},
Expand Down
28 changes: 28 additions & 0 deletions apps/server/swagger/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,34 @@ components:
type: string
description: Organization name
query:
EntityName:
description: The name of the Entity
name: entityName
in: query
schema:
type: string
required: true
OnlyActive:
description: Optional query parameter to filter results to include only active submissions. Default value is false
name: onlyActive
in: query
schema:
type: boolean
required: false
Organization:
description: The name of the Organization
name: organization
in: query
schema:
type: string
required: true
OrganizationFilter:
description: Optional query parameter to filter results to include only submissions associated to an specific organization. By default, returns submissions from all organizations
name: organization
in: query
schema:
type: string
required: false
Page:
name: page
in: query
Expand Down
14 changes: 1 addition & 13 deletions apps/server/swagger/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,27 +414,15 @@ components:
required:
- status
- description
- batchErrors
- inProcessEntities
type: object
properties:
batchErrors:
type: array
description: List of all batch related errors, should be empty on success
items:
$ref: '#/components/schemas/BatchError'
description:
type: string
description: Description of uploading Submission files
inProcessEntities:
type: array
description: Names of the entities that will be processed
items:
type: string
status:
type: string
description: Result of uploading Submission files
enum: ['PROCESSING', 'INVALID_SUBMISSION', 'PARTIAL_SUBMISSION']
enum: ['PROCESSING', 'INVALID_SUBMISSION']
submissionId:
type: string
description: ID of the Submission
Expand Down
74 changes: 17 additions & 57 deletions apps/server/swagger/submission-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
- $ref: '#/components/parameters/query/Page'
- $ref: '#/components/parameters/query/PageSize'
- $ref: '#/components/parameters/query/OnlyActive'
- $ref: '#/components/parameters/query/Organization'
- $ref: '#/components/parameters/query/OrganizationFilter'
responses:
200:
description: Submissions details
Expand All @@ -133,32 +133,6 @@
503:
$ref: '#/components/responses/ServiceUnavailableError'

/submission/category/{categoryId}/organization/{organization}:
get:
summary: Retrieve the Active Submission for a category and organization in this user session
deprecated: true
tags:
- Submission
parameters:
- $ref: '#/components/parameters/path/CategoryId'
- $ref: '#/components/parameters/path/Organization'
responses:
200:
description: Active Submission
content:
application/json:
schema:
$ref: '#/components/schemas/ActiveSubmissionSummaryResult'

401:
$ref: '#/components/responses/UnauthorizedError'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/ServerError'
503:
$ref: '#/components/responses/ServiceUnavailableError'

/submission/category/{categoryId}/commit/{submissionId}:
post:
summary: Commit Active Submission
Expand Down Expand Up @@ -193,26 +167,19 @@
summary: Add new data to a submission for the specified category. Returns an Active Submission containing the newly created records
tags:
- Submission
consumes:
- multipart/form-data
parameters:
- $ref: '#/components/parameters/path/CategoryId'
- $ref: '#/components/parameters/query/EntityName'
- $ref: '#/components/parameters/query/Organization'
requestBody:
description: The JSON payload containing the data to be added to the submission
required: true
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
files:
type: array
items:
type: string
format: binary
organization:
type: string
required:
- files
- organization
type: array
items:
type: object
responses:
200:
description: Submission accepted
Expand All @@ -232,26 +199,19 @@
summary: Modifies existing data for a submission. Returns an Active Submission containing the records that will be updated
tags:
- Submission
consumes:
- multipart/form-data
parameters:
- $ref: '#/components/parameters/path/CategoryId'
- $ref: '#/components/parameters/query/EntityName'
- $ref: '#/components/parameters/query/Organization'
requestBody:
description: The JSON payload containing the data to be added to the submission
required: true
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
files:
type: array
items:
type: string
format: binary
organization:
type: string
required:
- files
- organization
type: array
items:
type: object
responses:
200:
description: Edit Data request accepted
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lyric",
"version": "0.7.0",
"version": "0.8.0",
"description": "Lyric Monorepo",
"scripts": {
"\n================= Build ===============": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/data-model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@overture-stack/lyric-data-model",
"version": "0.7.0",
"version": "0.8.0",
"description": "Data model for Lyric",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
3 changes: 0 additions & 3 deletions packages/data-provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ const appConfig: AppConfig = {
schemaService: {
url: [INSERT_LECTERN_URL],
},
limits: {
fileSize: [INSERT_UPLOAD_LIMIT],
},
logger: {
level: [INSERT_LOG_LEVEL],
},
Expand Down
10 changes: 1 addition & 9 deletions packages/data-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@overture-stack/lyric",
"version": "0.7.0",
"version": "0.8.0",
"description": "Data Submission system",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -37,31 +37,23 @@
"@overture-stack/lectern-client": "2.0.0-beta.3",
"@overture-stack/lyric-data-model": "workspace:^",
"@overture-stack/sqon-builder": "^1.1.0",
"bytes": "^3.1.2",
"csv-parse": "^5.5.6",
"deep-freeze": "^0.0.1",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.29.5",
"express": "^4.19.2",
"firstline": "^2.0.2",
"lodash-es": "^4.17.21",
"multer": "1.4.5-lts.1",
"nanoid": "^5.0.7",
"pg": "^8.12.0",
"plur": "^5.1.0",
"winston": "^3.13.1",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/bytes": "^3.1.4",
"@types/chai-as-promised": "^8.0.1",
"@types/deep-freeze": "^0.1.5",
"@types/express": "^4.17.21",
"@types/express-serve-static-core": "^4.19.5",
"@types/firstline": "^2.0.4",
"@types/lodash": "^4.17.7",
"@types/lodash-es": "^4.17.12",
"@types/multer": "^1.4.11",
"@types/pg": "^8.11.6",
"@types/qs": "^6.9.15",
"chai-as-promised": "^8.0.0",
Expand Down
6 changes: 0 additions & 6 deletions packages/data-provider/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ export type LoggerConfig = {
file?: boolean;
};

export type LimitsConfig = {
fileSize: string;
};

export type IdServiceConfig = {
useLocal: boolean;
customAlphabet: string;
Expand All @@ -46,7 +42,6 @@ export type AppConfig = {
db: DbConfig;
features?: FeaturesConfig;
idService: IdServiceConfig;
limits: LimitsConfig;
logger: LoggerConfig;
schemaService: SchemaServiceConfig;
onFinishCommit?: (resultOnCommit: ResultOnCommit) => void;
Expand All @@ -59,7 +54,6 @@ export interface BaseDependencies {
db: NodePgDatabase<typeof schema>;
features?: FeaturesConfig;
idService: IdServiceConfig;
limits: LimitsConfig;
logger: Logger;
schemaService: SchemaServiceConfig;
onFinishCommit?: (resultOnCommit: ResultOnCommit) => void;
Expand Down
Loading

0 comments on commit a422997

Please sign in to comment.