Skip to content

Commit

Permalink
Merge 1fa57c9 into 9f7a239
Browse files Browse the repository at this point in the history
  • Loading branch information
milosbugarinovic committed Apr 7, 2024
2 parents 9f7a239 + 1fa57c9 commit 993ffc5
Show file tree
Hide file tree
Showing 83 changed files with 15,139 additions and 9,879 deletions.
13 changes: 0 additions & 13 deletions .docker/Dockerfile

This file was deleted.

4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
/!.idea/runConfigurations
/.base-frame-tmp
/coverage
/dist
/lib
/node_modules
/packages
/test/node_modules
/test/dist
*.tsbuildinfo
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ ij_typescript_enforce_trailing_comma = whenmultiline
ij_typescript_use_double_quotes = false
ij_typescript_use_semicolon_after_statement = false
ij_typescript_spaces_within_imports = true

7 changes: 6 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
/.idea
/.semaphore
/coverage
/dist
/lib
/node_modules
/resource
/packages
.*.js
/jest*.config.js
.*.json
package-lock.json
tsconfig*.json
typedoc.json
jest.config*.ts
26 changes: 13 additions & 13 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'ESNext',
project: './tsconfig-eslint.json',
project: './resource/tsconfig/eslint.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'eslint-plugin-import', 'import', 'no-only-tests', 'no-loops', 'jest', 'sort-keys-fix'],
rules: {
// ESLINT
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['**/index'],
message: 'Please use `.../something` instead of ``.../something/index`',
},
],
},
],

// 'no-restricted-imports': [
// 'error',
// {
// patterns: [
// {
// group: ['**/index'],
// message: 'Please use `.../something` instead of ``.../something/index`',
// },
// ],
// },
// ],
'@typescript-eslint/prefer-ts-expect-error': 'off',
'prefer-arrow-callback': 'error',
'no-confusing-arrow': 'error',
'no-constant-condition': 'error',
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set Node.js version
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Install Node.js
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
node-version-file: .nvmrc
cache: "npm"
- run: npm ci
- run: npm run lint
- run: npm run test
- run: npm run test:unit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/packages
/test/node_modules
/test/dist
*.tsbuildinfo
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
6 changes: 3 additions & 3 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"reject": [
"typescript"
]
"reject": [
"semantic-release"
]
}
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.15.0
v20.11.1
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.idea
/.semaphore
/coverage
/dist
/lib
/node_modules
/resource
Expand Down
16 changes: 8 additions & 8 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"printWidth": 130,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": true
"arrowParens": "always",
"bracketSpacing": true,
"printWidth": 130,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": true
}
50 changes: 28 additions & 22 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
{
"branches": "main",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "echo VERSION=${nextRelease.version} > version.txt && npm version ${nextRelease.version}"
}
],
"@semantic-release/changelog",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": ["lib/", "package.json", "package-lock.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
],
"preset": "angular",
"repositoryUrl": "git@github.com:beecode-rs/msh-entity.git"
"branches": "main",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "echo VERSION=${nextRelease.version} > version.txt && npm version ${nextRelease.version}"
}
],
"@semantic-release/changelog",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"dist/",
"lib/",
"package.json",
"package-lock.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
],
"preset": "angular",
"repositoryUrl": "git@github.com:beecode-rs/msh-entity.git"
}
4 changes: 2 additions & 2 deletions .semaphore/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ blocks:
- git remote rm origin
- git remote add origin https://$GH_USER:$GH_TOKEN@github.com/beecode-rs/msh-entity.git
- git checkout tags/v$VERSION -b tmp-alpha-branch
- docker build -f .docker/Dockerfile -t bc-msh-entity-deploy .
- docker run --rm -e CI bc-msh-entity-deploy sh -c "npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN && npm run bump-version $VERSION-alpha && npm publish --access public -tag alpha && git tag v$VERSION-alpha && git push origin --tags"
- docker build -f ./resource/docker/Dockerfile -t bc-msh-entity-deploy .
- docker run --rm -e CI bc-msh-entity-deploy sh -c "npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN && npm run npm-bump-version $VERSION-alpha && npm publish --access public -tag alpha && git tag v$VERSION-alpha && git push origin --tags"
skip:
when: branch != 'main'
2 changes: 1 addition & 1 deletion .semaphore/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ blocks:
- git remote rm origin
- git remote add origin https://$GH_USER:$GH_TOKEN@github.com/beecode-rs/msh-entity.git
- git checkout tags/v$VERSION -b tmp-prod-branch
- docker build -f .docker/Dockerfile -t bc-msh-entity-deploy .
- docker build -f ./resource/docker/Dockerfile -t bc-msh-entity-deploy .
- docker run --rm -e CI bc-msh-entity-deploy sh -c "npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN && npm publish --access public && git tag v$VERSION-prod && git push origin --tags"
skip:
when: branch != 'main'
6 changes: 3 additions & 3 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ blocks:
commands:
- checkout
- echo $DOCKER_PASSWORD | docker login --username "$DOCKER_USERNAME" --password-stdin
- docker build -f .docker/Dockerfile -t bc-msh-entity .
- docker build -f ./resource/docker/Dockerfile -t bc-msh-entity .
- docker save -o bc-msh-entity.tar bc-msh-entity
- cache store bc-msh-entity-docker-image-$SEMAPHORE_GIT_SHA bc-msh-entity.tar

Expand All @@ -29,7 +29,7 @@ blocks:
- checkout
- cache restore bc-msh-entity-docker-image-$SEMAPHORE_GIT_SHA
- docker load -i bc-msh-entity.tar
- docker run --rm -e CODECOV_TOKEN bc-msh-entity sh -c 'npm run test:unit:coverage && npm run test:unit:coverage:publish'
- docker run --rm -e CODECOV_TOKEN bc-msh-entity sh -c 'npm run test-coverage-unit && npm run test-coverage-unit-publish'

- name: Bump Version
task:
Expand All @@ -43,7 +43,7 @@ blocks:
- docker load -i bc-msh-entity.tar
- touch version.txt
- sudo chown -R packer:packer version.txt
- docker run --rm -v ./version.txt:/usr/app/version.txt -e GH_TOKEN -e NPM_TOKEN -e GH_USER -e CI bc-msh-entity npm run semantic-release
- docker run --rm -v ./version.txt:/usr/app/version.txt -e GH_TOKEN -e NPM_TOKEN -e GH_USER -e CI bc-msh-entity npm run npm-semantic-release
- cat version.txt
- cache store bc-msh-entity-version-$SEMAPHORE_GIT_SHA version.txt
skip:
Expand Down
29 changes: 29 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const tsConfig = require('./resource/tsconfig/esm.json')

module.exports = function (api) {
api.cache(true)

const ignore = ['node_modules', ...(tsConfig.exclude ?? [])]
const plugins = [
[
'@babel/plugin-transform-modules-commonjs',
{
strictMode: true,
},
],
[
'@babel/plugin-proposal-decorators',
{
version: '2023-11',
},
],
]

const presets = ['@babel/preset-env', '@babel/preset-typescript']

return {
plugins,
presets,
ignore
}
}
27 changes: 27 additions & 0 deletions dist/entity-cache/memory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Subject } from 'rxjs/internal/Subject';
export type EntityCache<ENTITY> = {
id: string;
entity: ENTITY;
};
export type EntityCacheCallBack<ENTITY> = (cbParams: EntityCache<ENTITY>) => void;
export type EntityCacheSubscription = {
unsubscribe: () => void;
};
export declare class EntityCacheMemory<ENTITY> {
protected _memory: {
[k: string]: {
entity?: ENTITY;
timeoutMs?: number;
};
};
protected _subject: Subject<EntityCache<ENTITY>>;
getById(id: string): {
needToFetch?: boolean;
entity?: ENTITY;
};
set(params: EntityCache<ENTITY>, timeoutOffsetMs?: number): void;
subscribeById(id: string, callback: (par: EntityCache<ENTITY>) => void): EntityCacheSubscription;
protected _calculateTimeout(timeoutOffsetMs?: number): number | undefined;
protected _timeoutExpired(timeoutMs?: number): boolean;
}
//# sourceMappingURL=memory.d.ts.map
1 change: 1 addition & 0 deletions dist/entity-cache/memory.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions dist/entity-cache/memory.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions dist/entity-cache/promise-service.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { EntityCacheCallBack, EntityCacheMemory, EntityCacheSubscription } from '../entity-cache/memory.js';
export declare abstract class EntityCachePromiseService<ENTITY, ID extends string | number = string> {
protected readonly _dao: EntityCacheMemory<ENTITY>;
protected abstract readonly _timeoutOffsetMs?: number;
protected abstract _entityAsync(id: ID): Promise<ENTITY>;
protected constructor(dao?: EntityCacheMemory<ENTITY>);
/**
* Subscribe to entity cache change and retrieve cached value if not undefined
* @param {ID} id - entity unique identifier
* @param {EntityCacheCallBack<ENTITY>} callback -
* @returns {EntityCacheSubscription}
*/
subscribeToEntityChangeById(id: ID, callback: EntityCacheCallBack<ENTITY>): EntityCacheSubscription;
forceRefresh(id: ID): void;
}
//# sourceMappingURL=promise-service.d.ts.map
1 change: 1 addition & 0 deletions dist/entity-cache/promise-service.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 993ffc5

Please sign in to comment.