rotacloud 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Configuration is simple, just import the core rotacloud.js SDK and supply your API key as necessary.
6
6
 
7
7
  ```typescript
8
- import { Rotacloud } from 'rotacloud';
8
+ import { RotaCloud } from 'rotacloud';
9
9
 
10
10
  const rc = new Rotacloud({
11
11
  apiKey: 'YOUR_API_KEY',
@@ -1,7 +1,7 @@
1
1
  import { AccountsService, AttendanceService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
2
2
  import { SDKConfig } from './interfaces/index.js';
3
3
  import { DaysOffService } from './services/days-off.service.js';
4
- export declare class Rotacloud {
4
+ export declare class RotaCloud {
5
5
  static config: SDKConfig;
6
6
  defaultAPIURI: string;
7
7
  accounts: AccountsService;
package/dist/rotacloud.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AccountsService, AttendanceService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
2
2
  import { DaysOffService } from './services/days-off.service.js';
3
- export class Rotacloud {
3
+ export class RotaCloud {
4
4
  constructor(config) {
5
5
  this.defaultAPIURI = 'https://api.rotacloud.com/v1';
6
6
  this.accounts = new AccountsService();
@@ -19,9 +19,9 @@ export class Rotacloud {
19
19
  this.config = config;
20
20
  }
21
21
  get config() {
22
- return Rotacloud.config;
22
+ return RotaCloud.config;
23
23
  }
24
24
  set config(configVal) {
25
- Rotacloud.config = configVal;
25
+ RotaCloud.config = configVal;
26
26
  }
27
27
  }
@@ -1,6 +1,5 @@
1
1
  import axios from 'axios';
2
- import { Rotacloud } from '../rotacloud.js';
3
- import { Version } from '../version.js';
2
+ import { RotaCloud } from '../rotacloud.js';
4
3
  export class Service {
5
4
  // rate limit tracking could be implemented here statically
6
5
  isLeaveRequest(endpoint) {
@@ -31,11 +30,11 @@ export class Service {
31
30
  }
32
31
  async fetch(httpOptions, options) {
33
32
  const headers = {
34
- Authorization: `Bearer ${Rotacloud.config.apiKey}`,
35
- 'SDK-Version': Version.version,
33
+ Authorization: `Bearer ${RotaCloud.config.apiKey}`,
34
+ // 'SDK-Version': Version.version,
36
35
  };
37
- if (Rotacloud.config.accountId) {
38
- headers.Account = String(Rotacloud.config.accountId);
36
+ if (RotaCloud.config.accountId) {
37
+ headers.Account = String(RotaCloud.config.accountId);
39
38
  }
40
39
  else {
41
40
  // need to convert user field in payload to a header for creating leave_requests when using an API key
@@ -43,7 +42,7 @@ export class Service {
43
42
  }
44
43
  const reqObject = {
45
44
  ...httpOptions,
46
- baseURL: Rotacloud.config.baseUri,
45
+ baseURL: RotaCloud.config.baseUri,
47
46
  headers,
48
47
  params: options?.params,
49
48
  paramsSerializer: (params) => {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const Version = { version: "1.0.4" };
1
+ export const Version = { version: "1.0.5" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rotacloud",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "The RotaCloud SDK for the RotaCloud API",
5
5
  "engines": {
6
6
  "node": ">=14.17.0"
package/src/rotacloud.ts CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  import { SDKConfig } from './interfaces/index.js';
13
13
  import { DaysOffService } from './services/days-off.service.js';
14
14
 
15
- export class Rotacloud {
15
+ export class RotaCloud {
16
16
  public static config: SDKConfig;
17
17
 
18
18
  public defaultAPIURI = 'https://api.rotacloud.com/v1';
@@ -35,10 +35,10 @@ export class Rotacloud {
35
35
  }
36
36
 
37
37
  get config() {
38
- return Rotacloud.config;
38
+ return RotaCloud.config;
39
39
  }
40
40
 
41
41
  set config(configVal: SDKConfig) {
42
- Rotacloud.config = configVal;
42
+ RotaCloud.config = configVal;
43
43
  }
44
44
  }
@@ -1,5 +1,5 @@
1
1
  import axios, { AxiosRequestConfig, AxiosRequestHeaders, AxiosResponse } from 'axios';
2
- import { Rotacloud } from '../rotacloud.js';
2
+ import { RotaCloud } from '../rotacloud.js';
3
3
  import { Version } from '../version.js';
4
4
 
5
5
  export type RequirementsOf<T, K extends keyof T> = Required<Pick<T, K>> & Partial<T>;
@@ -53,11 +53,11 @@ export abstract class Service<ApiResponse = any> {
53
53
 
54
54
  public async fetch<T = ApiResponse>(httpOptions: AxiosRequestConfig, options?): Promise<AxiosResponse<T>> {
55
55
  const headers: AxiosRequestHeaders = {
56
- Authorization: `Bearer ${Rotacloud.config.apiKey}`,
57
- 'SDK-Version': Version.version,
56
+ Authorization: `Bearer ${RotaCloud.config.apiKey}`,
57
+ // 'SDK-Version': Version.version,
58
58
  };
59
- if (Rotacloud.config.accountId) {
60
- headers.Account = String(Rotacloud.config.accountId);
59
+ if (RotaCloud.config.accountId) {
60
+ headers.Account = String(RotaCloud.config.accountId);
61
61
  } else {
62
62
  // need to convert user field in payload to a header for creating leave_requests when using an API key
63
63
  this.isLeaveRequest(httpOptions.url) ? (headers.User = `${httpOptions.data.user}`) : undefined;
@@ -65,7 +65,7 @@ export abstract class Service<ApiResponse = any> {
65
65
 
66
66
  const reqObject: AxiosRequestConfig<T> = {
67
67
  ...httpOptions,
68
- baseURL: Rotacloud.config.baseUri,
68
+ baseURL: RotaCloud.config.baseUri,
69
69
  headers,
70
70
  params: options?.params,
71
71
  paramsSerializer: (params) => {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const Version = { version: "1.0.4" }
1
+ export const Version = { version: "1.0.5" }