monday-sdk-js 0.4.9 → 0.4.11
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/package.json +1 -1
- package/src/constants-test.js +75 -39
- package/src/constants.js +3 -1
- package/types/client-sdk.interface.ts +5 -0
- package/types/index.d.ts +2 -15
- package/types/server-sdk.interface.ts +11 -0
package/package.json
CHANGED
package/src/constants-test.js
CHANGED
|
@@ -5,6 +5,7 @@ describe("constants", () => {
|
|
|
5
5
|
//setup
|
|
6
6
|
beforeEach(() => {
|
|
7
7
|
process.env.NODE_ENV = "development";
|
|
8
|
+
process.env.MONDAY_DOMAIN = undefined;
|
|
8
9
|
process.env.MONDAY_COM_PROTOCOL = undefined;
|
|
9
10
|
process.env.MONDAY_COM_DOMAIN = undefined;
|
|
10
11
|
process.env.MONDAY_SUBDOMAIN_API = undefined;
|
|
@@ -35,44 +36,79 @@ describe("constants", () => {
|
|
|
35
36
|
expect(constants.MONDAY_OAUTH_TOKEN_URL).to.eq(MONDAY_OAUTH_TOKEN_URL);
|
|
36
37
|
});
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
39
|
+
describe("check that constants are correct when NODE_ENV is development", () => {
|
|
40
|
+
it("MONDAY_DOMAIN should be correct", () => {
|
|
41
|
+
expect(constants.MONDAY_DOMAIN).to.eq("monday.com");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("MONDAY_PROTOCOL should be correct", () => {
|
|
45
|
+
expect(constants.MONDAY_PROTOCOL).to.eq("https");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("MONDAY_API_URL should be correct", () => {
|
|
49
|
+
expect(constants.MONDAY_API_URL).to.eq("https://api.monday.com/v2");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("MONDAY_OAUTH_URL should be correct", () => {
|
|
53
|
+
expect(constants.MONDAY_OAUTH_URL).to.eq("https://auth.monday.com/oauth2/authorize");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("MONDAY_OAUTH_TOKEN_URL should be correct", () => {
|
|
57
|
+
expect(constants.MONDAY_OAUTH_TOKEN_URL).to.eq("https://auth.monday.com/oauth2/token");
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe("check that constants are correct when NODE_ENV is undefined", () => {
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
process.env.NODE_ENV = undefined;
|
|
64
|
+
process.env.MONDAY_COM_DOMAIN = "should not be used";
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("MONDAY_DOMAIN should be correct", () => {
|
|
68
|
+
expect(constants.MONDAY_DOMAIN).to.eq("monday.com");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("MONDAY_PROTOCOL should be correct", () => {
|
|
72
|
+
expect(constants.MONDAY_PROTOCOL).to.eq("https");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("MONDAY_API_URL should be correct", () => {
|
|
76
|
+
expect(constants.MONDAY_API_URL).to.eq("https://api.monday.com/v2");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("MONDAY_OAUTH_URL should be correct", () => {
|
|
80
|
+
expect(constants.MONDAY_OAUTH_URL).to.eq("https://auth.monday.com/oauth2/authorize");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("MONDAY_OAUTH_TOKEN_URL should be correct", () => {
|
|
84
|
+
expect(constants.MONDAY_OAUTH_TOKEN_URL).to.eq("https://auth.monday.com/oauth2/token");
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe("check that constants are correct when NODE_ENV is undefined", () => {
|
|
89
|
+
beforeEach(() => {
|
|
90
|
+
process.env.NODE_ENV = "production";
|
|
91
|
+
process.env.MONDAY_COM_DOMAIN = "should not be used";
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("MONDAY_DOMAIN should be correct", () => {
|
|
95
|
+
expect(constants.MONDAY_DOMAIN).to.eq("monday.com");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("MONDAY_PROTOCOL should be correct", () => {
|
|
99
|
+
expect(constants.MONDAY_PROTOCOL).to.eq("https");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("MONDAY_API_URL should be correct", () => {
|
|
103
|
+
expect(constants.MONDAY_API_URL).to.eq("https://api.monday.com/v2");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("MONDAY_OAUTH_URL should be correct", () => {
|
|
107
|
+
expect(constants.MONDAY_OAUTH_URL).to.eq("https://auth.monday.com/oauth2/authorize");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("MONDAY_OAUTH_TOKEN_URL should be correct", () => {
|
|
111
|
+
expect(constants.MONDAY_OAUTH_TOKEN_URL).to.eq("https://auth.monday.com/oauth2/token");
|
|
112
|
+
});
|
|
77
113
|
});
|
|
78
114
|
});
|
package/src/constants.js
CHANGED
|
@@ -7,7 +7,9 @@ function isNodeDevStageEnv() {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const getEnvOrDefault = (key, defaultVal) => {
|
|
10
|
-
return isNodeDevStageEnv() && process.env[key] !== "undefined"
|
|
10
|
+
return isNodeDevStageEnv() && process.env[key] !== "undefined" && process.env[key] !== undefined
|
|
11
|
+
? process.env[key]
|
|
12
|
+
: defaultVal;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
const MONDAY_PROTOCOL = () => getEnvOrDefault("MONDAY_COM_PROTOCOL", "https");
|
package/types/index.d.ts
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
// Original Definitions were contributed by: Josh Parnham <https://github.com/josh->
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ClientApi, APIOptions } from './client-api.interface';
|
|
2
|
+
import { MondayClientSdk } from './client-sdk.interface';
|
|
3
|
+
import { MondayServerSdk } from './server-sdk.interface';
|
|
5
4
|
|
|
6
5
|
export as namespace mondaySdk;
|
|
7
6
|
|
|
8
|
-
type MondayClientSdk = ClientData & ClientExecute & ClientApi;
|
|
9
|
-
|
|
10
|
-
interface MondayServerSdk {
|
|
11
|
-
setToken(token: string): void;
|
|
12
|
-
|
|
13
|
-
setApiVersion(version: string): void;
|
|
14
|
-
|
|
15
|
-
api(query: string, options?: APIOptions): Promise<any>;
|
|
16
|
-
|
|
17
|
-
oauthToken(code: string, clientId: string, clientSecret: string): Promise<any>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
7
|
declare function init(
|
|
21
8
|
config?: Partial<{
|
|
22
9
|
clientId: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { APIOptions } from './client-api.interface';
|
|
2
|
+
|
|
3
|
+
export interface MondayServerSdk {
|
|
4
|
+
setToken(token: string): void;
|
|
5
|
+
|
|
6
|
+
setApiVersion(version: string): void;
|
|
7
|
+
|
|
8
|
+
api(query: string, options?: APIOptions): Promise<any>;
|
|
9
|
+
|
|
10
|
+
oauthToken(code: string, clientId: string, clientSecret: string): Promise<any>;
|
|
11
|
+
}
|