rotacloud 1.0.22 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/{node.js.yml → publish.yml} +18 -8
- package/README.md +1 -2
- package/dist/cjs/interfaces/location.interface.d.ts +4 -4
- package/dist/cjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
- package/dist/cjs/interfaces/shift.interface.d.ts +1 -1
- package/dist/cjs/models/daily-budgets.model.js +2 -0
- package/dist/cjs/models/location.model.d.ts +8 -1
- package/dist/cjs/models/location.model.js +11 -4
- package/dist/cjs/models/role.model.d.ts +3 -0
- package/dist/cjs/models/role.model.js +4 -0
- package/dist/cjs/models/shift.model.d.ts +4 -1
- package/dist/cjs/models/shift.model.js +5 -2
- package/dist/cjs/rotacloud.d.ts +2 -1
- package/dist/cjs/rotacloud.js +1 -0
- package/dist/cjs/services/daily-budgets.service.d.ts +19 -0
- package/dist/cjs/services/daily-budgets.service.js +99 -0
- package/dist/cjs/services/index.d.ts +1 -0
- package/dist/cjs/services/index.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/location.interface.d.ts +4 -4
- package/dist/mjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
- package/dist/mjs/interfaces/shift.interface.d.ts +1 -1
- package/dist/mjs/models/daily-budgets.model.js +2 -0
- package/dist/mjs/models/location.model.d.ts +8 -1
- package/dist/mjs/models/location.model.js +11 -4
- package/dist/mjs/models/role.model.d.ts +3 -0
- package/dist/mjs/models/role.model.js +4 -0
- package/dist/mjs/models/shift.model.d.ts +4 -1
- package/dist/mjs/models/shift.model.js +5 -2
- package/dist/mjs/rotacloud.d.ts +2 -1
- package/dist/mjs/rotacloud.js +2 -1
- package/dist/mjs/services/daily-budgets.service.d.ts +19 -0
- package/dist/mjs/services/daily-budgets.service.js +39 -0
- package/dist/mjs/services/index.d.ts +1 -0
- package/dist/mjs/services/index.js +1 -0
- package/dist/mjs/version.js +1 -1
- package/package.json +3 -3
- package/src/interfaces/location.interface.ts +4 -4
- package/src/interfaces/query-params/daily-budgets-query-params.interface.ts +2 -2
- package/src/interfaces/shift.interface.ts +1 -1
- package/src/models/daily-budgets.model.ts +2 -0
- package/src/models/location.model.ts +18 -4
- package/src/models/role.model.ts +7 -0
- package/src/models/shift.model.ts +9 -3
- package/src/rotacloud.ts +2 -0
- package/src/services/daily-budgets.service.ts +57 -0
- package/src/services/index.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
2
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
3
|
|
|
4
|
-
name:
|
|
4
|
+
name: Publish
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
8
|
-
branches: [
|
|
8
|
+
branches: [main]
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
|
-
|
|
11
|
+
publish:
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
strategy:
|
|
@@ -17,16 +17,26 @@ jobs:
|
|
|
17
17
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
18
18
|
|
|
19
19
|
steps:
|
|
20
|
-
-
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@v3
|
|
21
22
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
22
23
|
uses: actions/setup-node@v3
|
|
23
24
|
with:
|
|
24
25
|
node-version: ${{ matrix.node-version }}
|
|
25
26
|
cache: 'npm'
|
|
26
27
|
registry-url: https://registry.npmjs.org/
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
- name: Add version number to package
|
|
29
|
+
run: |
|
|
30
|
+
version=$(node -pe "require('./package.json').version")
|
|
31
|
+
echo "Version is $version"
|
|
32
|
+
echo "export const Version = { version: '$version' };" > ./src/version.ts
|
|
33
|
+
- name: Run CI
|
|
34
|
+
run: npm ci
|
|
35
|
+
- name: Lint
|
|
36
|
+
run: npm run lint
|
|
37
|
+
- name: Build
|
|
38
|
+
run: npm run build --if-present
|
|
39
|
+
- name: Publish
|
|
40
|
+
run: npm publish
|
|
31
41
|
env:
|
|
32
42
|
NODE_AUTH_TOKEN: ${{secrets.NPM_ACCESS_TOKEN}}
|
package/README.md
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Contributing
|
|
4
4
|
|
|
5
|
-
Please ensure you perform the
|
|
6
|
-
|
|
5
|
+
Please ensure you perform the `npm run version:bump` command before commiting and pushing your changes to the remote branch.
|
|
7
6
|
|
|
8
7
|
## Configuration
|
|
9
8
|
|
|
@@ -6,8 +6,8 @@ export interface ApiLocation {
|
|
|
6
6
|
address: string;
|
|
7
7
|
location: ApiLocationCoordinate;
|
|
8
8
|
timezone: number;
|
|
9
|
-
users: [];
|
|
10
|
-
managers: [];
|
|
11
|
-
metadata:
|
|
12
|
-
clock_in_ips:
|
|
9
|
+
users: number[];
|
|
10
|
+
managers: number[];
|
|
11
|
+
metadata: object;
|
|
12
|
+
clock_in_ips: string[];
|
|
13
13
|
}
|
|
@@ -5,6 +5,8 @@ class DailyBudgets {
|
|
|
5
5
|
constructor(dailyBudgets) {
|
|
6
6
|
this.date = dailyBudgets.date;
|
|
7
7
|
this.location = dailyBudgets.location;
|
|
8
|
+
this.hours_budget = dailyBudgets.hours_budget;
|
|
9
|
+
this.salary_budget = dailyBudgets.salary_budget;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
exports.DailyBudgets = DailyBudgets;
|
|
@@ -7,6 +7,13 @@ export declare class LatLngObject {
|
|
|
7
7
|
export declare class Location {
|
|
8
8
|
id: number;
|
|
9
9
|
name: string;
|
|
10
|
+
deleted: boolean;
|
|
11
|
+
address: string;
|
|
12
|
+
location: LatLngObject;
|
|
13
|
+
timezone: number;
|
|
10
14
|
users: number[];
|
|
11
|
-
|
|
15
|
+
managers: number[];
|
|
16
|
+
metadata: object;
|
|
17
|
+
clock_in_ips: string[];
|
|
18
|
+
constructor(location: ApiLocation);
|
|
12
19
|
}
|
|
@@ -5,10 +5,17 @@ class LatLngObject {
|
|
|
5
5
|
}
|
|
6
6
|
exports.LatLngObject = LatLngObject;
|
|
7
7
|
class Location {
|
|
8
|
-
constructor(
|
|
9
|
-
this.id =
|
|
10
|
-
this.name =
|
|
11
|
-
this.
|
|
8
|
+
constructor(location) {
|
|
9
|
+
this.id = location.id;
|
|
10
|
+
this.name = location.name;
|
|
11
|
+
this.deleted = location.deleted;
|
|
12
|
+
this.address = location.address;
|
|
13
|
+
this.location = location.location;
|
|
14
|
+
this.timezone = location.timezone;
|
|
15
|
+
this.users = location.users;
|
|
16
|
+
this.managers = location.managers;
|
|
17
|
+
this.metadata = location.metadata;
|
|
18
|
+
this.clock_in_ips = location.clock_in_ips;
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
exports.Location = Location;
|
|
@@ -4,8 +4,12 @@ exports.Role = void 0;
|
|
|
4
4
|
class Role {
|
|
5
5
|
constructor(role) {
|
|
6
6
|
this.id = role.id;
|
|
7
|
+
this.deleted = role.deleted;
|
|
7
8
|
this.name = role.name;
|
|
9
|
+
this.colour = role.colour;
|
|
10
|
+
this.default_break = role.default_break;
|
|
8
11
|
this.users = role.users;
|
|
12
|
+
this.pay_code = role.pay_code;
|
|
9
13
|
}
|
|
10
14
|
}
|
|
11
15
|
exports.Role = Role;
|
|
@@ -2,6 +2,8 @@ import { ApiShift } from '../interfaces/index.js';
|
|
|
2
2
|
export declare class Shift {
|
|
3
3
|
id: number;
|
|
4
4
|
deleted: boolean;
|
|
5
|
+
deleted_at: number | null;
|
|
6
|
+
deleted_by: number | null;
|
|
5
7
|
published: boolean;
|
|
6
8
|
open: boolean;
|
|
7
9
|
start_time: number;
|
|
@@ -11,9 +13,10 @@ export declare class Shift {
|
|
|
11
13
|
location: number;
|
|
12
14
|
role: number | null;
|
|
13
15
|
notes: string | null;
|
|
14
|
-
created_by: number;
|
|
15
16
|
created_at: number;
|
|
17
|
+
created_by: number;
|
|
16
18
|
updated_at: number | null;
|
|
19
|
+
updated_by: number | null;
|
|
17
20
|
claimed: boolean;
|
|
18
21
|
claimed_at: number | null;
|
|
19
22
|
acknowledged: boolean;
|
|
@@ -5,8 +5,10 @@ class Shift {
|
|
|
5
5
|
constructor(shift) {
|
|
6
6
|
this.id = shift.id;
|
|
7
7
|
this.deleted = shift.deleted;
|
|
8
|
-
this.
|
|
8
|
+
this.deleted_at = shift.deleted_at;
|
|
9
|
+
this.deleted_by = shift.deleted_by;
|
|
9
10
|
this.published = shift.published;
|
|
11
|
+
this.open = shift.open;
|
|
10
12
|
this.start_time = shift.start_time;
|
|
11
13
|
this.end_time = shift.end_time;
|
|
12
14
|
this.minutes_break = shift.minutes_break;
|
|
@@ -14,9 +16,10 @@ class Shift {
|
|
|
14
16
|
this.location = shift.location;
|
|
15
17
|
this.role = shift.role;
|
|
16
18
|
this.notes = shift.notes;
|
|
17
|
-
this.created_by = shift.created_by;
|
|
18
19
|
this.created_at = shift.created_at;
|
|
20
|
+
this.created_by = shift.created_by;
|
|
19
21
|
this.updated_at = shift.updated_at;
|
|
22
|
+
this.updated_by = shift.updated_by;
|
|
20
23
|
this.claimed = shift.claimed;
|
|
21
24
|
this.claimed_at = shift.claimed_at;
|
|
22
25
|
this.acknowledged = shift.acknowledged;
|
package/dist/cjs/rotacloud.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
2
2
|
import { SDKConfig } from './interfaces/index.js';
|
|
3
3
|
export declare class RotaCloud {
|
|
4
4
|
static config: SDKConfig;
|
|
@@ -6,6 +6,7 @@ export declare class RotaCloud {
|
|
|
6
6
|
accounts: AccountsService;
|
|
7
7
|
attendance: AttendanceService;
|
|
8
8
|
availability: AvailabilityService;
|
|
9
|
+
dailyBudgets: DailyBudgetsService;
|
|
9
10
|
daysOff: DaysOffService;
|
|
10
11
|
group: GroupsService;
|
|
11
12
|
leaveEmbargoes: LeaveEmbargoesService;
|
package/dist/cjs/rotacloud.js
CHANGED
|
@@ -18,6 +18,7 @@ class RotaCloud {
|
|
|
18
18
|
this.accounts = new index_js_1.AccountsService();
|
|
19
19
|
this.attendance = new index_js_1.AttendanceService();
|
|
20
20
|
this.availability = new index_js_1.AvailabilityService();
|
|
21
|
+
this.dailyBudgets = new index_js_1.DailyBudgetsService();
|
|
21
22
|
this.daysOff = new index_js_1.DaysOffService();
|
|
22
23
|
this.group = new index_js_1.GroupsService();
|
|
23
24
|
this.leaveEmbargoes = new index_js_1.LeaveEmbargoesService();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiDailyBudgets } from '../interfaces/daily-budgets.interface.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
5
|
+
import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
|
|
6
|
+
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
|
+
declare class DailyBudgetsService extends Service {
|
|
8
|
+
private apiPath;
|
|
9
|
+
list(options?: Options<DailyBudgetsQueryParams & InternalQueryParams>): AsyncGenerator<DailyBudgets, void, unknown>;
|
|
10
|
+
listAll(): Promise<DailyBudgets[]>;
|
|
11
|
+
listByPage(options?: Options<DailyBudgetsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiDailyBudgets[], any>, any, unknown>;
|
|
12
|
+
update(id: number, data: Partial<ApiDailyBudgets>): Promise<DailyBudgets>;
|
|
13
|
+
update(id: number, data: Partial<ApiDailyBudgets>, options: {
|
|
14
|
+
rawResponse: true;
|
|
15
|
+
params?: InternalQueryParams;
|
|
16
|
+
}): Promise<AxiosResponse<ApiDailyBudgets, any>>;
|
|
17
|
+
update(id: number, data: Partial<ApiDailyBudgets>, options: Options<InternalQueryParams>): Promise<ApiDailyBudgets>;
|
|
18
|
+
}
|
|
19
|
+
export { DailyBudgetsService };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
+
var m = o[Symbol.asyncIterator], i;
|
|
14
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
+
};
|
|
18
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
19
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
20
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
21
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
22
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
23
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
24
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
25
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
26
|
+
function fulfill(value) { resume("next", value); }
|
|
27
|
+
function reject(value) { resume("throw", value); }
|
|
28
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.DailyBudgetsService = void 0;
|
|
32
|
+
const index_js_1 = require("./index.js");
|
|
33
|
+
const daily_budgets_model_js_1 = require("../models/daily-budgets.model.js");
|
|
34
|
+
const error_response_model_js_1 = require("../models/error-response.model.js");
|
|
35
|
+
class DailyBudgetsService extends index_js_1.Service {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
this.apiPath = '/daily_budgets';
|
|
39
|
+
}
|
|
40
|
+
list(options) {
|
|
41
|
+
const _super = Object.create(null, {
|
|
42
|
+
iterator: { get: () => super.iterator }
|
|
43
|
+
});
|
|
44
|
+
return __asyncGenerator(this, arguments, function* list_1() {
|
|
45
|
+
var e_1, _a;
|
|
46
|
+
try {
|
|
47
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
48
|
+
const res = _c.value;
|
|
49
|
+
yield yield __await(new daily_budgets_model_js_1.DailyBudgets(res));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
53
|
+
finally {
|
|
54
|
+
try {
|
|
55
|
+
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
56
|
+
}
|
|
57
|
+
finally { if (e_1) throw e_1.error; }
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
listAll() {
|
|
62
|
+
var e_2, _a;
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
try {
|
|
65
|
+
const attendance = [];
|
|
66
|
+
try {
|
|
67
|
+
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
68
|
+
const atten = _c.value;
|
|
69
|
+
attendance.push(atten);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
73
|
+
finally {
|
|
74
|
+
try {
|
|
75
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
76
|
+
}
|
|
77
|
+
finally { if (e_2) throw e_2.error; }
|
|
78
|
+
}
|
|
79
|
+
return attendance;
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return err;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
listByPage(options) {
|
|
87
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
88
|
+
}
|
|
89
|
+
update(id, data, options) {
|
|
90
|
+
return super
|
|
91
|
+
.fetch({
|
|
92
|
+
url: `${this.apiPath}/${id}`,
|
|
93
|
+
data,
|
|
94
|
+
method: 'POST',
|
|
95
|
+
})
|
|
96
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new daily_budgets_model_js_1.DailyBudgets(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.DailyBudgetsService = DailyBudgetsService;
|
|
@@ -2,6 +2,7 @@ export * from './service.js';
|
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
4
|
export * from './availability.service.js';
|
|
5
|
+
export * from './daily-budgets.service.js';
|
|
5
6
|
export * from './days-off.service.js';
|
|
6
7
|
export * from './groups.service.js';
|
|
7
8
|
export * from './leave-request.service.js';
|
|
@@ -14,6 +14,7 @@ __exportStar(require("./service.js"), exports);
|
|
|
14
14
|
__exportStar(require("./accounts.service.js"), exports);
|
|
15
15
|
__exportStar(require("./attendance.service.js"), exports);
|
|
16
16
|
__exportStar(require("./availability.service.js"), exports);
|
|
17
|
+
__exportStar(require("./daily-budgets.service.js"), exports);
|
|
17
18
|
__exportStar(require("./days-off.service.js"), exports);
|
|
18
19
|
__exportStar(require("./groups.service.js"), exports);
|
|
19
20
|
__exportStar(require("./leave-request.service.js"), exports);
|
package/dist/cjs/version.js
CHANGED
|
@@ -6,8 +6,8 @@ export interface ApiLocation {
|
|
|
6
6
|
address: string;
|
|
7
7
|
location: ApiLocationCoordinate;
|
|
8
8
|
timezone: number;
|
|
9
|
-
users: [];
|
|
10
|
-
managers: [];
|
|
11
|
-
metadata:
|
|
12
|
-
clock_in_ips:
|
|
9
|
+
users: number[];
|
|
10
|
+
managers: number[];
|
|
11
|
+
metadata: object;
|
|
12
|
+
clock_in_ips: string[];
|
|
13
13
|
}
|
|
@@ -7,6 +7,13 @@ export declare class LatLngObject {
|
|
|
7
7
|
export declare class Location {
|
|
8
8
|
id: number;
|
|
9
9
|
name: string;
|
|
10
|
+
deleted: boolean;
|
|
11
|
+
address: string;
|
|
12
|
+
location: LatLngObject;
|
|
13
|
+
timezone: number;
|
|
10
14
|
users: number[];
|
|
11
|
-
|
|
15
|
+
managers: number[];
|
|
16
|
+
metadata: object;
|
|
17
|
+
clock_in_ips: string[];
|
|
18
|
+
constructor(location: ApiLocation);
|
|
12
19
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export class LatLngObject {
|
|
2
2
|
}
|
|
3
3
|
export class Location {
|
|
4
|
-
constructor(
|
|
5
|
-
this.id =
|
|
6
|
-
this.name =
|
|
7
|
-
this.
|
|
4
|
+
constructor(location) {
|
|
5
|
+
this.id = location.id;
|
|
6
|
+
this.name = location.name;
|
|
7
|
+
this.deleted = location.deleted;
|
|
8
|
+
this.address = location.address;
|
|
9
|
+
this.location = location.location;
|
|
10
|
+
this.timezone = location.timezone;
|
|
11
|
+
this.users = location.users;
|
|
12
|
+
this.managers = location.managers;
|
|
13
|
+
this.metadata = location.metadata;
|
|
14
|
+
this.clock_in_ips = location.clock_in_ips;
|
|
8
15
|
}
|
|
9
16
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export class Role {
|
|
2
2
|
constructor(role) {
|
|
3
3
|
this.id = role.id;
|
|
4
|
+
this.deleted = role.deleted;
|
|
4
5
|
this.name = role.name;
|
|
6
|
+
this.colour = role.colour;
|
|
7
|
+
this.default_break = role.default_break;
|
|
5
8
|
this.users = role.users;
|
|
9
|
+
this.pay_code = role.pay_code;
|
|
6
10
|
}
|
|
7
11
|
}
|
|
@@ -2,6 +2,8 @@ import { ApiShift } from '../interfaces/index.js';
|
|
|
2
2
|
export declare class Shift {
|
|
3
3
|
id: number;
|
|
4
4
|
deleted: boolean;
|
|
5
|
+
deleted_at: number | null;
|
|
6
|
+
deleted_by: number | null;
|
|
5
7
|
published: boolean;
|
|
6
8
|
open: boolean;
|
|
7
9
|
start_time: number;
|
|
@@ -11,9 +13,10 @@ export declare class Shift {
|
|
|
11
13
|
location: number;
|
|
12
14
|
role: number | null;
|
|
13
15
|
notes: string | null;
|
|
14
|
-
created_by: number;
|
|
15
16
|
created_at: number;
|
|
17
|
+
created_by: number;
|
|
16
18
|
updated_at: number | null;
|
|
19
|
+
updated_by: number | null;
|
|
17
20
|
claimed: boolean;
|
|
18
21
|
claimed_at: number | null;
|
|
19
22
|
acknowledged: boolean;
|
|
@@ -2,8 +2,10 @@ export class Shift {
|
|
|
2
2
|
constructor(shift) {
|
|
3
3
|
this.id = shift.id;
|
|
4
4
|
this.deleted = shift.deleted;
|
|
5
|
-
this.
|
|
5
|
+
this.deleted_at = shift.deleted_at;
|
|
6
|
+
this.deleted_by = shift.deleted_by;
|
|
6
7
|
this.published = shift.published;
|
|
8
|
+
this.open = shift.open;
|
|
7
9
|
this.start_time = shift.start_time;
|
|
8
10
|
this.end_time = shift.end_time;
|
|
9
11
|
this.minutes_break = shift.minutes_break;
|
|
@@ -11,9 +13,10 @@ export class Shift {
|
|
|
11
13
|
this.location = shift.location;
|
|
12
14
|
this.role = shift.role;
|
|
13
15
|
this.notes = shift.notes;
|
|
14
|
-
this.created_by = shift.created_by;
|
|
15
16
|
this.created_at = shift.created_at;
|
|
17
|
+
this.created_by = shift.created_by;
|
|
16
18
|
this.updated_at = shift.updated_at;
|
|
19
|
+
this.updated_by = shift.updated_by;
|
|
17
20
|
this.claimed = shift.claimed;
|
|
18
21
|
this.claimed_at = shift.claimed_at;
|
|
19
22
|
this.acknowledged = shift.acknowledged;
|
package/dist/mjs/rotacloud.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
2
2
|
import { SDKConfig } from './interfaces/index.js';
|
|
3
3
|
export declare class RotaCloud {
|
|
4
4
|
static config: SDKConfig;
|
|
@@ -6,6 +6,7 @@ export declare class RotaCloud {
|
|
|
6
6
|
accounts: AccountsService;
|
|
7
7
|
attendance: AttendanceService;
|
|
8
8
|
availability: AvailabilityService;
|
|
9
|
+
dailyBudgets: DailyBudgetsService;
|
|
9
10
|
daysOff: DaysOffService;
|
|
10
11
|
group: GroupsService;
|
|
11
12
|
leaveEmbargoes: LeaveEmbargoesService;
|
package/dist/mjs/rotacloud.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
2
2
|
export class RotaCloud {
|
|
3
3
|
constructor(config) {
|
|
4
4
|
this.defaultAPIURI = 'https://api.rotacloud.com/v1';
|
|
5
5
|
this.accounts = new AccountsService();
|
|
6
6
|
this.attendance = new AttendanceService();
|
|
7
7
|
this.availability = new AvailabilityService();
|
|
8
|
+
this.dailyBudgets = new DailyBudgetsService();
|
|
8
9
|
this.daysOff = new DaysOffService();
|
|
9
10
|
this.group = new GroupsService();
|
|
10
11
|
this.leaveEmbargoes = new LeaveEmbargoesService();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiDailyBudgets } from '../interfaces/daily-budgets.interface.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
5
|
+
import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
|
|
6
|
+
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
|
+
declare class DailyBudgetsService extends Service {
|
|
8
|
+
private apiPath;
|
|
9
|
+
list(options?: Options<DailyBudgetsQueryParams & InternalQueryParams>): AsyncGenerator<DailyBudgets, void, unknown>;
|
|
10
|
+
listAll(): Promise<DailyBudgets[]>;
|
|
11
|
+
listByPage(options?: Options<DailyBudgetsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiDailyBudgets[], any>, any, unknown>;
|
|
12
|
+
update(id: number, data: Partial<ApiDailyBudgets>): Promise<DailyBudgets>;
|
|
13
|
+
update(id: number, data: Partial<ApiDailyBudgets>, options: {
|
|
14
|
+
rawResponse: true;
|
|
15
|
+
params?: InternalQueryParams;
|
|
16
|
+
}): Promise<AxiosResponse<ApiDailyBudgets, any>>;
|
|
17
|
+
update(id: number, data: Partial<ApiDailyBudgets>, options: Options<InternalQueryParams>): Promise<ApiDailyBudgets>;
|
|
18
|
+
}
|
|
19
|
+
export { DailyBudgetsService };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
3
|
+
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
+
class DailyBudgetsService extends Service {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.apiPath = '/daily_budgets';
|
|
8
|
+
}
|
|
9
|
+
async *list(options) {
|
|
10
|
+
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
11
|
+
yield new DailyBudgets(res);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async listAll() {
|
|
15
|
+
try {
|
|
16
|
+
const attendance = [];
|
|
17
|
+
for await (const atten of this.list()) {
|
|
18
|
+
attendance.push(atten);
|
|
19
|
+
}
|
|
20
|
+
return attendance;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return err;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
listByPage(options) {
|
|
27
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
28
|
+
}
|
|
29
|
+
update(id, data, options) {
|
|
30
|
+
return super
|
|
31
|
+
.fetch({
|
|
32
|
+
url: `${this.apiPath}/${id}`,
|
|
33
|
+
data,
|
|
34
|
+
method: 'POST',
|
|
35
|
+
})
|
|
36
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new DailyBudgets(res.data)), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export { DailyBudgetsService };
|
|
@@ -2,6 +2,7 @@ export * from './service.js';
|
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
4
|
export * from './availability.service.js';
|
|
5
|
+
export * from './daily-budgets.service.js';
|
|
5
6
|
export * from './days-off.service.js';
|
|
6
7
|
export * from './groups.service.js';
|
|
7
8
|
export * from './leave-request.service.js';
|
|
@@ -2,6 +2,7 @@ export * from './service.js';
|
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
4
|
export * from './availability.service.js';
|
|
5
|
+
export * from './daily-budgets.service.js';
|
|
5
6
|
export * from './days-off.service.js';
|
|
6
7
|
export * from './groups.service.js';
|
|
7
8
|
export * from './leave-request.service.js';
|
package/dist/mjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const Version = { version: '1.0.
|
|
1
|
+
export const Version = { version: '1.0.25' };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rotacloud",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "The RotaCloud SDK for the RotaCloud API",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=14.17.0"
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"version:bump": "npm --no-git-tag-version version patch",
|
|
18
|
-
"
|
|
19
|
-
"version:all": "npm run version:bump && npm run version:copy",
|
|
18
|
+
"watch": "rm -rf dist/* && concurrently \"tsc -p tsconfig.json --watch\" \"tsc -p tsconfig-cjs.json --watch\" && ./fixup",
|
|
20
19
|
"build": "rm -rf dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./fixup",
|
|
21
20
|
"lint": "eslint src --ext .ts",
|
|
22
21
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -34,6 +33,7 @@
|
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
36
35
|
"@typescript-eslint/parser": "^5.4.0",
|
|
36
|
+
"concurrently": "^7.2.2",
|
|
37
37
|
"eslint": "^8.2.0",
|
|
38
38
|
"eslint-config-airbnb": "^19.0.0",
|
|
39
39
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
@@ -7,8 +7,8 @@ export interface ApiLocation {
|
|
|
7
7
|
address: string;
|
|
8
8
|
location: ApiLocationCoordinate;
|
|
9
9
|
timezone: number;
|
|
10
|
-
users: [];
|
|
11
|
-
managers: [];
|
|
12
|
-
metadata:
|
|
13
|
-
clock_in_ips:
|
|
10
|
+
users: number[];
|
|
11
|
+
managers: number[];
|
|
12
|
+
metadata: object;
|
|
13
|
+
clock_in_ips: string[];
|
|
14
14
|
}
|
|
@@ -9,11 +9,25 @@ export class LatLngObject {
|
|
|
9
9
|
export class Location {
|
|
10
10
|
public id: number;
|
|
11
11
|
public name: string;
|
|
12
|
+
public deleted: boolean;
|
|
13
|
+
public address: string;
|
|
14
|
+
public location: LatLngObject;
|
|
15
|
+
public timezone: number;
|
|
12
16
|
public users: number[];
|
|
17
|
+
public managers: number[];
|
|
18
|
+
public metadata: object;
|
|
19
|
+
public clock_in_ips: string[];
|
|
13
20
|
|
|
14
|
-
constructor(
|
|
15
|
-
this.id =
|
|
16
|
-
this.name =
|
|
17
|
-
this.
|
|
21
|
+
constructor(location: ApiLocation) {
|
|
22
|
+
this.id = location.id;
|
|
23
|
+
this.name = location.name;
|
|
24
|
+
this.deleted = location.deleted;
|
|
25
|
+
this.address = location.address;
|
|
26
|
+
this.location = location.location;
|
|
27
|
+
this.timezone = location.timezone;
|
|
28
|
+
this.users = location.users;
|
|
29
|
+
this.managers = location.managers;
|
|
30
|
+
this.metadata = location.metadata;
|
|
31
|
+
this.clock_in_ips = location.clock_in_ips;
|
|
18
32
|
}
|
|
19
33
|
}
|
package/src/models/role.model.ts
CHANGED
|
@@ -2,13 +2,20 @@ import { ApiRole } from '../interfaces/index.js';
|
|
|
2
2
|
|
|
3
3
|
export class Role {
|
|
4
4
|
public id: number;
|
|
5
|
+
public deleted: boolean;
|
|
5
6
|
public name: string;
|
|
6
7
|
public colour: string;
|
|
8
|
+
public default_break: number;
|
|
7
9
|
public users: number[];
|
|
10
|
+
public pay_code: string;
|
|
8
11
|
|
|
9
12
|
constructor(role: ApiRole) {
|
|
10
13
|
this.id = role.id;
|
|
14
|
+
this.deleted = role.deleted;
|
|
11
15
|
this.name = role.name;
|
|
16
|
+
this.colour = role.colour;
|
|
17
|
+
this.default_break = role.default_break;
|
|
12
18
|
this.users = role.users;
|
|
19
|
+
this.pay_code = role.pay_code;
|
|
13
20
|
}
|
|
14
21
|
}
|
|
@@ -3,6 +3,8 @@ import { ApiShift } from '../interfaces/index.js';
|
|
|
3
3
|
export class Shift {
|
|
4
4
|
public id: number;
|
|
5
5
|
public deleted: boolean;
|
|
6
|
+
public deleted_at: number | null;
|
|
7
|
+
public deleted_by: number | null;
|
|
6
8
|
public published: boolean;
|
|
7
9
|
public open: boolean;
|
|
8
10
|
public start_time: number;
|
|
@@ -12,9 +14,10 @@ export class Shift {
|
|
|
12
14
|
public location: number;
|
|
13
15
|
public role: number | null;
|
|
14
16
|
public notes: string | null;
|
|
15
|
-
public created_by: number;
|
|
16
17
|
public created_at: number;
|
|
18
|
+
public created_by: number;
|
|
17
19
|
public updated_at: number | null;
|
|
20
|
+
public updated_by: number | null;
|
|
18
21
|
public claimed: boolean;
|
|
19
22
|
public claimed_at: number | null;
|
|
20
23
|
public acknowledged: boolean;
|
|
@@ -25,8 +28,10 @@ export class Shift {
|
|
|
25
28
|
constructor(shift: ApiShift) {
|
|
26
29
|
this.id = shift.id;
|
|
27
30
|
this.deleted = shift.deleted;
|
|
28
|
-
this.
|
|
31
|
+
this.deleted_at = shift.deleted_at;
|
|
32
|
+
this.deleted_by = shift.deleted_by;
|
|
29
33
|
this.published = shift.published;
|
|
34
|
+
this.open = shift.open;
|
|
30
35
|
this.start_time = shift.start_time;
|
|
31
36
|
this.end_time = shift.end_time;
|
|
32
37
|
this.minutes_break = shift.minutes_break;
|
|
@@ -34,9 +39,10 @@ export class Shift {
|
|
|
34
39
|
this.location = shift.location;
|
|
35
40
|
this.role = shift.role;
|
|
36
41
|
this.notes = shift.notes;
|
|
37
|
-
this.created_by = shift.created_by;
|
|
38
42
|
this.created_at = shift.created_at;
|
|
43
|
+
this.created_by = shift.created_by;
|
|
39
44
|
this.updated_at = shift.updated_at;
|
|
45
|
+
this.updated_by = shift.updated_by;
|
|
40
46
|
this.claimed = shift.claimed;
|
|
41
47
|
this.claimed_at = shift.claimed_at;
|
|
42
48
|
this.acknowledged = shift.acknowledged;
|
package/src/rotacloud.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
AccountsService,
|
|
3
3
|
AttendanceService,
|
|
4
4
|
AvailabilityService,
|
|
5
|
+
DailyBudgetsService,
|
|
5
6
|
DaysOffService,
|
|
6
7
|
GroupsService,
|
|
7
8
|
LeaveEmbargoesService,
|
|
@@ -21,6 +22,7 @@ export class RotaCloud {
|
|
|
21
22
|
public accounts = new AccountsService();
|
|
22
23
|
public attendance = new AttendanceService();
|
|
23
24
|
public availability = new AvailabilityService();
|
|
25
|
+
public dailyBudgets = new DailyBudgetsService();
|
|
24
26
|
public daysOff = new DaysOffService();
|
|
25
27
|
public group = new GroupsService();
|
|
26
28
|
public leaveEmbargoes = new LeaveEmbargoesService();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiDailyBudgets } from '../interfaces/daily-budgets.interface.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
|
|
5
|
+
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
6
|
+
import { ErrorResponse } from '../models/error-response.model.js';
|
|
7
|
+
import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
|
|
8
|
+
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
9
|
+
|
|
10
|
+
class DailyBudgetsService extends Service {
|
|
11
|
+
private apiPath = '/daily_budgets';
|
|
12
|
+
|
|
13
|
+
async *list(options?: Options<DailyBudgetsQueryParams & InternalQueryParams>) {
|
|
14
|
+
for await (const res of super.iterator<ApiDailyBudgets>({ url: this.apiPath }, options)) {
|
|
15
|
+
yield new DailyBudgets(res);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
listAll(): Promise<DailyBudgets[]>;
|
|
20
|
+
async listAll() {
|
|
21
|
+
try {
|
|
22
|
+
const attendance = [] as DailyBudgets[];
|
|
23
|
+
for await (const atten of this.list()) {
|
|
24
|
+
attendance.push(atten);
|
|
25
|
+
}
|
|
26
|
+
return attendance;
|
|
27
|
+
} catch (err) {
|
|
28
|
+
return err;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
listByPage(options?: Options<DailyBudgetsQueryParams & InternalQueryParams>) {
|
|
33
|
+
return super.iterator<ApiDailyBudgets>({ url: this.apiPath }, options).byPage();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
update(id: number, data: Partial<ApiDailyBudgets>): Promise<DailyBudgets>;
|
|
37
|
+
update(
|
|
38
|
+
id: number,
|
|
39
|
+
data: Partial<ApiDailyBudgets>,
|
|
40
|
+
options: { rawResponse: true; params?: InternalQueryParams }
|
|
41
|
+
): Promise<AxiosResponse<ApiDailyBudgets, any>>;
|
|
42
|
+
update(id: number, data: Partial<ApiDailyBudgets>, options: Options<InternalQueryParams>): Promise<ApiDailyBudgets>;
|
|
43
|
+
update(id: number, data: Partial<ApiDailyBudgets>, options?: Options<InternalQueryParams>) {
|
|
44
|
+
return super
|
|
45
|
+
.fetch<ApiDailyBudgets>({
|
|
46
|
+
url: `${this.apiPath}/${id}`,
|
|
47
|
+
data,
|
|
48
|
+
method: 'POST',
|
|
49
|
+
})
|
|
50
|
+
.then(
|
|
51
|
+
(res) => Promise.resolve(options?.rawResponse ? res : new DailyBudgets(res.data)),
|
|
52
|
+
(err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err))
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { DailyBudgetsService };
|
package/src/services/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './service.js';
|
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
4
|
export * from './availability.service.js';
|
|
5
|
+
export * from './daily-budgets.service.js';
|
|
5
6
|
export * from './days-off.service.js';
|
|
6
7
|
export * from './groups.service.js';
|
|
7
8
|
export * from './leave-request.service.js';
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const Version = { version: '1.0.
|
|
1
|
+
export const Version = { version: '1.0.25' };
|