From 8d7569be27a8578d705177bda52635183539c753 Mon Sep 17 00:00:00 2001 From: Hendrik Bulens Date: Fri, 3 May 2024 16:06:16 +0200 Subject: [PATCH] Export constants in models module (#9) --- package.json | 2 +- samples/express/package.json | 2 +- samples/express/yarn.lock | 6 +++--- samples/pingpong/package.json | 2 +- samples/update-resource-location/bun.lockb | Bin 137464 -> 137464 bytes samples/update-resource-location/package.json | 2 +- src/client.ts | 2 +- src/endpoints/message.ts | 2 +- src/models/actionuri.ts | 2 +- .../appointment/appointmentimportance.ts | 2 +- src/models/connector.ts | 2 +- src/models/constants/schedulingmode.ts | 6 ++++-- src/models/constants/severity.ts | 6 ++++-- src/models/constants/tasktype.ts | 6 ++++-- src/models/index.ts | 18 +++++++++++++++++- src/models/job.ts | 2 +- src/models/message.ts | 5 +++-- src/models/notification.ts | 2 +- src/models/task/task.ts | 2 +- test/actionuri.ts | 3 +-- test/appointment/appointmentimportance.ts | 2 +- test/connector.ts | 3 +-- test/message.ts | 2 +- test/notification.ts | 3 +-- 24 files changed, 52 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 4304924..d5c6b3c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dimescheduler", "description": "The Dime.Scheduler SDK", - "version": "0.4.4", + "version": "0.5.0", "main": "./dist/cjs/index.js", "types": "./dist/types/index.d.ts", "module": "./dist/index.js", diff --git a/samples/express/package.json b/samples/express/package.json index 0925abf..8f2a3cd 100644 --- a/samples/express/package.json +++ b/samples/express/package.json @@ -4,7 +4,7 @@ "main": "index.js", "license": "MIT", "dependencies": { - "dimescheduler": "0.4.4", + "dimescheduler": "0.5.0", "dotenv": "^16.4.5", "express": "^4.19.2" }, diff --git a/samples/express/yarn.lock b/samples/express/yarn.lock index e33f575..7838b48 100644 --- a/samples/express/yarn.lock +++ b/samples/express/yarn.lock @@ -123,9 +123,9 @@ destroy@1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== -dimescheduler@0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/dimescheduler/-/dimescheduler-0.4.4.tgz#be3d39e611551ff0cd4b592d05a5edaff2d0c510" +dimescheduler@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/dimescheduler/-/dimescheduler-0.5.0.tgz#be3d39e611551ff0cd4b592d05a5edaff2d0c510" integrity sha512-Uuj0ef/mkTqgo1jSes28orIhZpE9ijFsYzJrIA63wRrvqJkbWBZt6802UcsSNgQ13lHWgIOm1eugptpm/1kkyg== dependencies: axios "^1.6.8" diff --git a/samples/pingpong/package.json b/samples/pingpong/package.json index e9cab42..78fd06a 100644 --- a/samples/pingpong/package.json +++ b/samples/pingpong/package.json @@ -15,6 +15,6 @@ }, "dependencies": { "commander": "^12.0.0", - "dimescheduler": "^0.4.4" + "dimescheduler": "^0.5.0" } } \ No newline at end of file diff --git a/samples/update-resource-location/bun.lockb b/samples/update-resource-location/bun.lockb index b8de979e786a1c54fd1d55bc15a4516aba941463..6833aeb4cfae68b0408639621b79ed824f7a48bd 100755 GIT binary patch delta 144 zcmV;B0B`^Ju?YCF2#_uycj%#Fu};k!n+L^t8|c!TL-`7LsEt4=o_ yK!BgTGF+1N&)W?P)5az~teMUE!%efzl$PEDH7+o>W^(~|K?5}|Ft^~e0T^V)WkNOp delta 144 zcmV;B0B`^Ju?YCF2#_uyUru2Hg@0AEHsTx){sP%mVHY}xYYE9T_*qm8IxBL-u};Qh0T^UzM?vKP diff --git a/samples/update-resource-location/package.json b/samples/update-resource-location/package.json index 037456b..a1686d6 100644 --- a/samples/update-resource-location/package.json +++ b/samples/update-resource-location/package.json @@ -10,7 +10,7 @@ "preview": "vite preview" }, "dependencies": { - "dimescheduler": "^0.4.4", + "dimescheduler": "^0.5.0", "mapbox-gl": "^3.3.0", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/src/client.ts b/src/client.ts index dbdd5f0..2573b80 100644 --- a/src/client.ts +++ b/src/client.ts @@ -20,7 +20,7 @@ import TimeMarkerEndpoint from './endpoints/timemarker'; import UserEndpoint from './endpoints/user'; import Environment from './environment'; import IImportModel from './models/base/iimportmodel'; -import { Severity } from './models/constants/severity'; +import { Severity } from './models'; class DimeSchedulerClient { private importEndpoint: ImportEndpoint; diff --git a/src/endpoints/message.ts b/src/endpoints/message.ts index 619397b..9927269 100644 --- a/src/endpoints/message.ts +++ b/src/endpoints/message.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import Endpoint from './endpoint'; import Environment from '../environment'; -import { Severity } from '../models/constants/severity'; +import { Severity } from '../models'; class MessageEndpoint extends Endpoint { constructor(env: Environment, apiKey: string) { diff --git a/src/models/actionuri.ts b/src/models/actionuri.ts index 0efd625..3c260f0 100644 --- a/src/models/actionuri.ts +++ b/src/models/actionuri.ts @@ -3,7 +3,7 @@ import CrudType from "./base/action"; import IImportModel from "./base/iimportmodel"; import ImportModel from "./base/importmodel"; import ImportProperty from "./base/importproperty"; -import UriType from "./constants/uritype"; +import { UriType } from "."; export default class ActionUri extends ImportModel implements IImportModel { diff --git a/src/models/appointment/appointmentimportance.ts b/src/models/appointment/appointmentimportance.ts index c471886..45959c3 100644 --- a/src/models/appointment/appointmentimportance.ts +++ b/src/models/appointment/appointmentimportance.ts @@ -3,7 +3,7 @@ import CrudType from "../base/action"; import IImportModel from "../base/iimportmodel"; import ImportModel from "../base/importmodel"; import ImportProperty from "../base/importproperty"; -import Importance from "../constants/importance"; +import { Importance } from ".."; export default class AppointmentImportance extends ImportModel implements IImportModel { diff --git a/src/models/connector.ts b/src/models/connector.ts index 5ca305f..f8c1e1b 100644 --- a/src/models/connector.ts +++ b/src/models/connector.ts @@ -3,7 +3,7 @@ import IImportModel from "./base/iimportmodel"; import ImportModel from "./base/importmodel"; import ImportProperty from "./base/importproperty"; import DeleteProperty from "./base/deleteproperty"; -import BackOfficeSystemType from "./constants/backofficesystemtype"; +import { BackOfficeSystemType } from "."; export default class Connector extends ImportModel implements IImportModel { name?: string; diff --git a/src/models/constants/schedulingmode.ts b/src/models/constants/schedulingmode.ts index d71351d..fc5a39a 100644 --- a/src/models/constants/schedulingmode.ts +++ b/src/models/constants/schedulingmode.ts @@ -1,6 +1,8 @@ -export enum SchedulingMode { +enum SchedulingMode { Normal, FixedDuration, EffortDriven, DynamicAssignment -} \ No newline at end of file +} + +export default SchedulingMode; \ No newline at end of file diff --git a/src/models/constants/severity.ts b/src/models/constants/severity.ts index 6b0f6ba..04b2213 100644 --- a/src/models/constants/severity.ts +++ b/src/models/constants/severity.ts @@ -1,8 +1,10 @@ -export enum Severity { +enum Severity { Verbose, Debug, Info, Warning, Error, Fatal -} \ No newline at end of file +} + +export default Severity; \ No newline at end of file diff --git a/src/models/constants/tasktype.ts b/src/models/constants/tasktype.ts index 53e4262..0361eb1 100644 --- a/src/models/constants/tasktype.ts +++ b/src/models/constants/tasktype.ts @@ -1,4 +1,6 @@ -export enum TaskType { +enum TaskType { Planning = 0, Project = 1 -} \ No newline at end of file +} + +export default TaskType; \ No newline at end of file diff --git a/src/models/index.ts b/src/models/index.ts index bc9dd85..567746e 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -35,6 +35,15 @@ import Container from './container'; import Calendar from './calendar'; import ResourceType from './resourcetype'; +// Constants +import BackOfficeSystemType from './constants/backofficesystemtype'; +import Importance from './constants/importance'; +import NotificationType from './constants/notificationtype'; +import SchedulingMode from './constants/schedulingmode'; +import Severity from './constants/severity'; +import TaskType from './constants/tasktype'; +import UriType from './constants/uritype'; + export { ActionUri, TimeMarker, @@ -71,5 +80,12 @@ export { Notification, Connector, Caption, - Container + Container, + BackOfficeSystemType, + Importance, + NotificationType, + SchedulingMode, + Severity, + TaskType, + UriType }; \ No newline at end of file diff --git a/src/models/job.ts b/src/models/job.ts index 085a612..068b77a 100644 --- a/src/models/job.ts +++ b/src/models/job.ts @@ -3,7 +3,7 @@ import CrudType from "./base/action"; import IImportModel from "./base/iimportmodel"; import ImportModel from "./base/importmodel"; import ImportProperty from "./base/importproperty"; -import Importance from "./constants/importance"; +import { Importance } from "."; class Job extends ImportModel implements IImportModel { diff --git a/src/models/message.ts b/src/models/message.ts index 427aeb8..63eb0bb 100644 --- a/src/models/message.ts +++ b/src/models/message.ts @@ -1,9 +1,10 @@ - +import { Severity } from "."; + export default class Message { text?: string; user?: string; - severity?: number; + severity?: Severity; } \ No newline at end of file diff --git a/src/models/notification.ts b/src/models/notification.ts index 868a464..c63112c 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -4,7 +4,7 @@ import DeleteProperty from "./base/deleteproperty"; import IImportModel from "./base/iimportmodel"; import ImportModel from "./base/importmodel"; import ImportProperty from "./base/importproperty"; -import NotificationType from "./constants/notificationtype"; +import { NotificationType } from "."; export default class Notification extends ImportModel implements IImportModel { diff --git a/src/models/task/task.ts b/src/models/task/task.ts index 8f1ebe7..a0baf77 100644 --- a/src/models/task/task.ts +++ b/src/models/task/task.ts @@ -1,10 +1,10 @@  +import { Importance } from ".."; import CrudType from "../base/action"; import DeleteProperty from "../base/deleteproperty"; import IImportModel from "../base/iimportmodel"; import ImportModel from "../base/importmodel"; import ImportProperty from "../base/importproperty"; -import Importance from "../constants/importance"; export default class Task extends ImportModel implements IImportModel { diff --git a/test/actionuri.ts b/test/actionuri.ts index eb92888..11ec963 100644 --- a/test/actionuri.ts +++ b/test/actionuri.ts @@ -1,7 +1,6 @@ import assert from 'assert'; import DimeSchedulerClient, { Environment } from '../src'; -import { ActionUri } from '../src/models'; -import UriType from '../src/models/constants/uritype'; +import { ActionUri, UriType } from '../src/models'; import { apiKey } from "./testvars"; diff --git a/test/appointment/appointmentimportance.ts b/test/appointment/appointmentimportance.ts index 88243fd..589cca2 100644 --- a/test/appointment/appointmentimportance.ts +++ b/test/appointment/appointmentimportance.ts @@ -3,7 +3,7 @@ import DimeSchedulerClient, { Environment } from '../../src'; import { AppointmentImportance } from '../../src/models'; import { apiKey } from "../testvars"; -import Importance from '../../src/models/constants/importance'; +import { Importance } from "../../src/models"; describe('AppointmentImportance', function () { diff --git a/test/connector.ts b/test/connector.ts index 229a9e5..dbd876c 100644 --- a/test/connector.ts +++ b/test/connector.ts @@ -1,7 +1,6 @@ import assert from 'assert'; import DimeSchedulerClient, { Environment } from '../src'; -import { Connector } from '../src/models'; -import BackOfficeSystemType from '../src/models/constants/backofficesystemtype'; +import { Connector, BackOfficeSystemType } from '../src/models'; import { apiKey } from "./testvars"; diff --git a/test/message.ts b/test/message.ts index 5b5be57..94e6591 100644 --- a/test/message.ts +++ b/test/message.ts @@ -1,7 +1,7 @@ import DimeSchedulerClient, { Environment } from '../src'; import { apiKey } from "./testvars"; -import { Severity } from '../src/models/constants/severity'; +import { Severity } from '../src/models'; describe('Message', function () { describe('#sendMessage()', function () { diff --git a/test/notification.ts b/test/notification.ts index 9a2acf2..55d867d 100644 --- a/test/notification.ts +++ b/test/notification.ts @@ -1,7 +1,6 @@ import assert from 'assert'; import DimeSchedulerClient, { Environment } from '../src'; -import { Notification } from '../src/models'; -import NotificationType from '../src/models/constants/notificationtype'; +import { Notification, NotificationType } from '../src/models'; import { apiKey } from "./testvars";