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

feat(constants): add @gauzy/constants package #8745

Merged
merged 3 commits into from
Jan 23, 2025
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: 2 additions & 0 deletions .deploy/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ COPY --chown=node:node apps/api/package.json ./apps/api/
COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/utils/package.json ./packages/utils/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/constants/package.json ./packages/constants/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
COPY --chown=node:node packages/core/package.json ./packages/core/
Expand Down Expand Up @@ -191,6 +192,7 @@ COPY --chown=node:node apps/api/package.json ./apps/api/
COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/utils/package.json ./packages/utils/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/constants/package.json ./packages/constants/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
COPY --chown=node:node packages/core/package.json ./packages/core/
Expand Down
1 change: 1 addition & 0 deletions .deploy/webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ COPY --chown=node:node apps/gauzy/package.json ./apps/gauzy/
COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/utils/package.json ./packages/utils/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/constants/package.json ./packages/constants/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
COPY --chown=node:node packages/core/package.json ./packages/core/
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"packages": [
"../../../dist/packages/auth",
"../../../dist/packages/common",
"../../../dist/packages/utils",
"../../../dist/packages/config",
"../../../dist/packages/contracts",
"../../../dist/packages/core",
Expand All @@ -45,7 +44,8 @@
"../../../dist/packages/plugins/product-reviews",
"../../../dist/packages/plugins/sentry-tracing",
"../../../dist/packages/plugins/videos",
"../../../dist/packages/ui-config"
"../../../dist/packages/ui-config",
"../../../dist/packages/utils"
]
},
"build": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { filter, tap } from 'rxjs';
import { NbAccordionComponent, NbAccordionItemComponent } from '@nebular/theme';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import * as moment from 'moment';
import { DEFAULT_TIME_FORMATS, IEmployee } from '@gauzy/contracts';
import { DEFAULT_TIME_FORMATS } from '@gauzy/constants';
import { IEmployee } from '@gauzy/contracts';
import { EmployeeStore } from '@gauzy/ui-core/core';

@UntilDestroy({ checkProperties: true })
Expand Down Expand Up @@ -82,7 +83,15 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
private _patchFormValue(employee: IEmployee): void {
if (!employee) return;

const { user, upworkId, linkedInId, allowManualTime, allowDeleteTime, allowModifyTime, allowScreenshotCapture } = employee;
const {
user,
upworkId,
linkedInId,
allowManualTime,
allowDeleteTime,
allowModifyTime,
allowScreenshotCapture
} = employee;
this.form.patchValue({
timeZone: user?.timeZone ?? moment.tz.guess(),
timeFormat: user?.timeFormat,
Expand Down Expand Up @@ -130,7 +139,6 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
});
}


/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ import * as moment from 'moment';
import { TranslateService } from '@ngx-translate/core';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { NbAccordionComponent, NbAccordionItemComponent, NbThemeService } from '@nebular/theme';
import {
DEFAULT_ACTIVITY_PROOF_DURATIONS,
DEFAULT_DATE_FORMATS,
DEFAULT_INACTIVITY_TIME_LIMITS,
DEFAULT_REVENUE_BASED_BONUS,
DEFAULT_PROFIT_BASED_BONUS,
DEFAULT_SCREENSHOT_FREQUENCY_OPTIONS,
DEFAULT_TIME_FORMATS,
DEFAULT_STANDARD_WORK_HOURS_PER_DAY,
DEFAULT_INVITE_EXPIRY_PERIOD
} from '@gauzy/constants';
import {
AccountingTemplateTypeEnum,
AlignmentOptions,
BonusTypeEnum,
CrudActionEnum,
CurrenciesEnum,
CurrencyPosition,
DEFAULT_ACTIVITY_PROOF_DURATIONS,
DEFAULT_DATE_FORMATS,
DEFAULT_INACTIVITY_TIME_LIMITS,
DEFAULT_INVITE_EXPIRY_PERIOD,
DEFAULT_PROFIT_BASED_BONUS,
DEFAULT_REVENUE_BASED_BONUS,
DEFAULT_TIME_FORMATS,
DEFAULT_TASK_NOTIFY_PERIOD,
DEFAULT_PROOF_COMPLETION_TYPE,
DefaultValueDateTypeEnum,
Expand All @@ -32,9 +36,7 @@ import {
IOrganizationTaskSetting,
TaskProofOfCompletionTypeEnum,
DEFAULT_AUTO_CLOSE_ISSUE_PERIOD,
DEFAULT_AUTO_ARCHIVE_ISSUE_PERIOD,
DEFAULT_SCREENSHOT_FREQUENCY_OPTIONS,
DEFAULT_STANDARD_WORK_HOURS_PER_DAY
DEFAULT_AUTO_ARCHIVE_ISSUE_PERIOD
} from '@gauzy/contracts';
import { isEmpty } from '@gauzy/ui-core/common';
import {
Expand Down Expand Up @@ -83,13 +85,13 @@ export class EditOrganizationOtherSettingsComponent
listOfTimeFormats = DEFAULT_TIME_FORMATS;
listOfInactivityLimits = DEFAULT_INACTIVITY_TIME_LIMITS;
listOfActivityProofDuration = DEFAULT_ACTIVITY_PROOF_DURATIONS;
screenshotFrequencyOptions = DEFAULT_SCREENSHOT_FREQUENCY_OPTIONS;
numberFormats = ['USD', 'BGN', 'ILS'];
numberFormat: string;
weekdays: WeekDaysEnum[] = Object.values(WeekDaysEnum);
regionCodes = Object.keys(RegionsEnum);
regionCode: string;
regions = Object.values(RegionsEnum);
screenshotFrequencyOptions = DEFAULT_SCREENSHOT_FREQUENCY_OPTIONS;
standardWorkHoursPerDayOptions: number[] = Array.from({ length: 24 }, (_, i) => i + 1); // Creates an array from 1 to 24

/*
Expand Down
6 changes: 3 additions & 3 deletions apps/server-api/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"packages": [
"../../../dist/packages/auth",
"../../../dist/packages/common",
"../../../dist/packages/utils",
"../../../dist/packages/config",
"../../../dist/packages/contracts",
"../../../dist/packages/core",
Expand All @@ -34,7 +33,8 @@
"../../../dist/packages/plugin",
"../../../dist/packages/plugins/integration-ai",
"../../../dist/packages/plugins/job-proposal",
"../../../dist/packages/ui-config"
"../../../dist/packages/ui-config",
"../../../dist/packages/utils"
]
},
"build": {
Expand Down Expand Up @@ -135,7 +135,6 @@
"@electron/remote": "^2.0.8",
"@fastify/swagger": "^9.4.0",
"@gauzy/auth": "file:../../../dist/packages/auth",
"@gauzy/utils": "file:../../../dist/packages/utils",
"@gauzy/config": "file:../../../dist/packages/config",
"@gauzy/contracts": "file:../../../dist/packages/contracts",
"@gauzy/core": "file:../../../dist/packages/core",
Expand All @@ -158,6 +157,7 @@
"@gauzy/plugin-sentry": "file:../../../dist/packages/plugins/sentry-tracing",
"@gauzy/plugin-videos": "file:../../../dist/packages/plugins/videos",
"@gauzy/ui-config": "file:../../../dist/packages/ui-config",
"@gauzy/utils": "file:../../../dist/packages/utils",
"@sentry/electron": "^4.18.0",
"@sentry/node": "^7.101.1",
"@sentry/profiling-node": "^7.101.1",
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"packages": [
"../../../dist/packages/auth",
"../../../dist/packages/common",
"../../../dist/packages/utils",
"../../../dist/packages/config",
"../../../dist/packages/contracts",
"../../../dist/packages/core",
Expand All @@ -34,7 +33,8 @@
"../../../dist/packages/plugin",
"../../../dist/packages/plugins/integration-ai",
"../../../dist/packages/plugins/job-proposal",
"../../../dist/packages/ui-config"
"../../../dist/packages/ui-config",
"../../../dist/packages/utils"
]
},
"build": {
Expand Down Expand Up @@ -134,7 +134,6 @@
"@datorama/akita": "^8.0.1",
"@electron/remote": "^2.0.8",
"@gauzy/auth": "file:../../../dist/packages/auth",
"@gauzy/utils": "file:../../../dist/packages/utils",
"@gauzy/config": "file:../../../dist/packages/config",
"@gauzy/contracts": "file:../../../dist/packages/contracts",
"@gauzy/core": "file:../../../dist/packages/core",
Expand All @@ -157,6 +156,7 @@
"@gauzy/plugin-sentry": "file:../../../dist/packages/plugins/sentry-tracing",
"@gauzy/plugin-videos": "file:../../../dist/packages/plugins/videos",
"@gauzy/ui-config": "file:../../../dist/packages/ui-config",
"@gauzy/utils": "file:../../../dist/packages/utils",
"@sentry/electron": "^4.18.0",
"@sentry/node": "^7.101.1",
"@sentry/profiling-node": "^7.101.1",
Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
"build:package:utils": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build utils",
"build:package:utils:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build utils",
"build:package:utils:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build utils",
"build:package:constants": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build constants",
"build:package:constants:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build constants",
"build:package:constants:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build constants",
"build:package:contracts": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build contracts",
"build:package:contracts:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build contracts",
"build:package:contracts:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build contracts",
Expand Down Expand Up @@ -251,15 +254,15 @@
"build:package:plugin:integration-wakatime": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-integration-wakatime",
"build:package:plugin:integration-wakatime:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-integration-wakatime",
"build:package:plugin:integration-wakatime:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-integration-wakatime",
"build:package:all": "yarn run build:package:contracts && yarn run build:package:common && yarn run build:package:utils && yarn run build:package:config && yarn run build:package:plugin && yarn run build:package:auth && yarn run build:package:plugins:pre && yarn run build:package:core && yarn run build:package:plugins:post && yarn run build:package:desktop-lib && yarn run build:package:plugin:integration-wakatime && yarn run build:package:desktop-ui-lib",
"build:package:all:prod": "yarn run build:package:contracts:prod && yarn run build:package:common:prod && yarn run build:package:utils:prod && yarn run build:package:config:prod && yarn run build:package:plugin:prod && yarn run build:package:auth:prod && yarn run build:package:plugins:pre:prod && yarn run build:package:core:prod && yarn run build:package:plugins:post:prod && yarn run build:package:desktop-lib:prod && yarn run build:package:plugin:integration-wakatime:prod && yarn run build:package:desktop-ui-lib:prod",
"build:package:all:docker": "yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker &&yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:plugins:pre:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker && yarn run build:package:desktop-lib:docker && yarn run build:package:plugin:integration-wakatime:docker && yarn run build:package:desktop-ui-lib:docker",
"build:package:api": "yarn run build:package:contracts && yarn run build:package:common && yarn run build:package:utils && yarn run build:package:config && yarn run build:package:plugin && yarn run build:package:auth && yarn run build:package:core && yarn run build:package:plugins:post && yarn run build:package:plugin:integration-wakatime",
"build:package:api:prod": "yarn run build:package:contracts:prod && yarn run build:package:common:prod && yarn run build:package:utils:prod && yarn run build:package:config:prod && yarn run build:package:plugin:prod && yarn run build:package:auth:prod && yarn run build:package:core:prod && yarn run build:package:plugins:post:prod",
"build:package:api:docker": "yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker && yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker",
"build:package:gauzy": "yarn run build:package:contracts && yarn run build:package:common && yarn run build:package:utils && yarn run build:package:config && yarn run build:package:plugin && yarn run build:package:auth && yarn run build:package:plugins:pre && yarn run build:package:core && yarn run build:package:plugins:post",
"build:package:gauzy:prod": "yarn run build:package:contracts:prod && yarn run build:package:common:prod && yarn run build:package:utils:prod && yarn run build:package:config:prod && yarn run build:package:plugin:prod && yarn run build:package:auth:prod && yarn run build:package:plugins:pre:prod && yarn run build:package:core:prod && yarn run build:package:plugins:post:prod",
"build:package:gauzy:docker": "yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker && yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:plugins:pre:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker",
"build:package:all": "yarn run build:package:constants && yarn run build:package:contracts && yarn run build:package:common && yarn run build:package:utils && yarn run build:package:config && yarn run build:package:plugin && yarn run build:package:auth && yarn run build:package:plugins:pre && yarn run build:package:core && yarn run build:package:plugins:post && yarn run build:package:desktop-lib && yarn run build:package:plugin:integration-wakatime && yarn run build:package:desktop-ui-lib",
"build:package:all:prod": "yarn run build:package:constants:prod && yarn run build:package:contracts:prod && yarn run build:package:common:prod && yarn run build:package:utils:prod && yarn run build:package:config:prod && yarn run build:package:plugin:prod && yarn run build:package:auth:prod && yarn run build:package:plugins:pre:prod && yarn run build:package:core:prod && yarn run build:package:plugins:post:prod && yarn run build:package:desktop-lib:prod && yarn run build:package:plugin:integration-wakatime:prod && yarn run build:package:desktop-ui-lib:prod",
"build:package:all:docker": "yarn run build:package:constants:docker && yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker &&yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:plugins:pre:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker && yarn run build:package:desktop-lib:docker && yarn run build:package:plugin:integration-wakatime:docker && yarn run build:package:desktop-ui-lib:docker",
"build:package:api": "yarn run build:package:constants && yarn run build:package:contracts && yarn run build:package:common && yarn run build:package:utils && yarn run build:package:config && yarn run build:package:plugin && yarn run build:package:auth && yarn run build:package:core && yarn run build:package:plugins:post && yarn run build:package:plugin:integration-wakatime",
"build:package:api:prod": "yarn run build:package:constants:prod && yarn run build:package:contracts:prod && yarn run build:package:common:prod && yarn run build:package:utils:prod && yarn run build:package:config:prod && yarn run build:package:plugin:prod && yarn run build:package:auth:prod && yarn run build:package:core:prod && yarn run build:package:plugins:post:prod",
"build:package:api:docker": "yarn run build:package:constants:docker && yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker && yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker",
"build:package:gauzy": "yarn run build:package:constants && yarn run build:package:contracts && yarn run build:package:common && yarn run build:package:utils && yarn run build:package:config && yarn run build:package:plugin && yarn run build:package:auth && yarn run build:package:plugins:pre && yarn run build:package:core && yarn run build:package:plugins:post",
"build:package:gauzy:prod": "yarn run build:package:constants:prod && yarn run build:package:contracts:prod && yarn run build:package:common:prod && yarn run build:package:utils:prod && yarn run build:package:config:prod && yarn run build:package:plugin:prod && yarn run build:package:auth:prod && yarn run build:package:plugins:pre:prod && yarn run build:package:core:prod && yarn run build:package:plugins:post:prod",
"build:package:gauzy:docker": "yarn run build:package:constants:docker && yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker && yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:plugins:pre:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker",
"copy-files-desktop": "copyfiles -f packages/core/src/**/*.gql dist/apps/desktop/data/",
"prepare:desktop-timer": "yarn run postinstall.electron && tsc -p apps/desktop-timer/tsconfig.electron.json",
"build:desktop-timer": "cross-env NODE_ENV=production yarn copy-files-i18n-desktop-timer && yarn run postinstall.electron && yarn run config:prod && yarn run config:desktop-timer:prod && yarn build:package:all:prod && yarn run pack:desktop-timer && yarn run generate:icons:desktop-timer --environment=prod && yarn ng:prod build desktop-timer --base-href=./ && yarn run prepare:desktop-timer && yarn ng:prod build desktop-api --configuration=production --output-path=dist/apps/desktop-timer/desktop-api && yarn run copy-assets-gauzy-timer",
Expand Down
20 changes: 20 additions & 0 deletions packages/constants/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
docker
tmp
README.md
.env

# git

.git
.gitignore
.gitmodules

# dependencies

node_modules

# misc

npm-debug.log
dist
build
6 changes: 6 additions & 0 deletions packages/constants/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# dependencies
node_modules/

# misc
npm-debug.log
dist
4 changes: 4 additions & 0 deletions packages/constants/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .npmignore

src/
node_modules/
3 changes: 3 additions & 0 deletions packages/constants/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog for @gauzy/constants

## [Unreleased]
25 changes: 25 additions & 0 deletions packages/constants/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @gauzy/constants

This library was generated with [Nx](https://nx.dev). It contains constants used internally in different UI/API packages.

## Building

Run `yarn nx build constants` to build the library.

## Running unit tests

Run `yarn nx test constants` to execute the unit tests via [Jest](https://jestjs.io).

## Publishing

After building your library with `yarn nx build constants`, go to the dist folder `dist/packages/constants` and run `npm publish`.

## Installation

Install the Package using your preferred package manager:

```bash
npm install @gauzy/constants
# or
yarn add @gauzy/constants
```
19 changes: 19 additions & 0 deletions packages/constants/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const baseConfig = require('../../.eslintrc.json');

module.exports = [
...baseConfig,
{
files: ['**/*.json'],
rules: {
'@nx/dependency-checks': [
'error',
{
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}']
}
]
},
languageOptions: {
parser: require('jsonc-eslint-parser')
}
}
];
10 changes: 10 additions & 0 deletions packages/constants/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
displayName: 'constants',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }]
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/constants'
};
Loading
Loading