@superoffice/webapi 11.7.727 → 11.8.788

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.
Files changed (147) hide show
  1. package/LICENSE.md +15 -15
  2. package/README.md +184 -184
  3. package/__tests__/Appointment63-notz.json +1925 -1925
  4. package/__tests__/Appointment63-utctz.json +1925 -1925
  5. package/__tests__/Appointment63.json +1925 -1925
  6. package/__tests__/AppointmentTzTest.ts +115 -115
  7. package/__tests__/AxiosNockTest.ts +28 -28
  8. package/__tests__/ContactDefault.json +699 -699
  9. package/__tests__/ContactEntity.json +272 -272
  10. package/__tests__/ContactRestTest.ts +144 -144
  11. package/__tests__/ContactTest.ts +395 -395
  12. package/__tests__/ConvertersTest.ts +97 -97
  13. package/__tests__/DocumentTest.ts +101 -101
  14. package/__tests__/Person210-notz.json +1932 -1932
  15. package/__tests__/Person210-utctz.json +1932 -1932
  16. package/__tests__/Person210.json +1932 -1932
  17. package/__tests__/PersonImageData.nock +22 -22
  18. package/__tests__/PersonTest.ts +41 -41
  19. package/__tests__/PersonTzTest.ts +113 -113
  20. package/__tests__/RecurrenceInfo.json +55 -55
  21. package/__tests__/ResponseCallbackTest.ts +23 -23
  22. package/__tests__/TableRights.json +441 -441
  23. package/__tests__/WebapiTest.ts +264 -264
  24. package/__tests__/Webhook.json +16 -16
  25. package/__tests__/WebhookTest.ts +209 -209
  26. package/dist/cjs/Carriers.d.ts +367 -4
  27. package/dist/cjs/Carriers.d.ts.map +1 -1
  28. package/dist/cjs/Converters.d.ts +9 -0
  29. package/dist/cjs/Converters.d.ts.map +1 -1
  30. package/dist/cjs/Converters.js +185 -17
  31. package/dist/cjs/Converters.js.map +1 -1
  32. package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
  33. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  34. package/dist/cjs/DiagnosticsAgent.js +91 -0
  35. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  36. package/dist/cjs/Enums.d.ts +18 -0
  37. package/dist/cjs/Enums.d.ts.map +1 -1
  38. package/dist/cjs/Enums.js +20 -1
  39. package/dist/cjs/Enums.js.map +1 -1
  40. package/dist/cjs/ListAgent.d.ts +71 -6
  41. package/dist/cjs/ListAgent.d.ts.map +1 -1
  42. package/dist/cjs/ListAgent.js +157 -0
  43. package/dist/cjs/ListAgent.js.map +1 -1
  44. package/dist/cjs/TicketAgent.d.ts +23 -0
  45. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  46. package/dist/cjs/TicketAgent.js +65 -0
  47. package/dist/cjs/TicketAgent.js.map +1 -1
  48. package/dist/esm/Carriers.d.ts +367 -4
  49. package/dist/esm/Carriers.d.ts.map +1 -1
  50. package/dist/esm/Converters.d.ts +9 -0
  51. package/dist/esm/Converters.d.ts.map +1 -1
  52. package/dist/esm/Converters.js +159 -0
  53. package/dist/esm/Converters.js.map +1 -1
  54. package/dist/esm/DiagnosticsAgent.d.ts +38 -0
  55. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  56. package/dist/esm/DiagnosticsAgent.js +91 -0
  57. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  58. package/dist/esm/Enums.d.ts +18 -0
  59. package/dist/esm/Enums.d.ts.map +1 -1
  60. package/dist/esm/Enums.js +19 -0
  61. package/dist/esm/Enums.js.map +1 -1
  62. package/dist/esm/ListAgent.d.ts +71 -6
  63. package/dist/esm/ListAgent.d.ts.map +1 -1
  64. package/dist/esm/ListAgent.js +157 -0
  65. package/dist/esm/ListAgent.js.map +1 -1
  66. package/dist/esm/TicketAgent.d.ts +23 -0
  67. package/dist/esm/TicketAgent.d.ts.map +1 -1
  68. package/dist/esm/TicketAgent.js +65 -0
  69. package/dist/esm/TicketAgent.js.map +1 -1
  70. package/examples-js/hello.js +12 -12
  71. package/examples-ts/hello.ts +8 -8
  72. package/package.json +93 -93
  73. package/scripts/postbuild.js +22 -22
  74. package/scripts/setVersion.js +44 -44
  75. package/src/AIAgent.ts +1992 -1992
  76. package/src/AppointmentAgent.ts +6263 -6263
  77. package/src/AppointmentRestApi.ts +225 -225
  78. package/src/ArchiveAgent.ts +1950 -1950
  79. package/src/AssociateAgent.ts +422 -422
  80. package/src/AxiosCacheHandler.ts +74 -74
  81. package/src/BLOBAgent.ts +2100 -2100
  82. package/src/Base64.ts +285 -285
  83. package/src/BatchAgent.ts +910 -910
  84. package/src/BulkUpdateAgent.ts +504 -504
  85. package/src/CRMScriptAgent.ts +1390 -1390
  86. package/src/Carriers.ts +52750 -52274
  87. package/src/ChatAgent.ts +1422 -1422
  88. package/src/ConfigurationAgent.ts +2228 -2228
  89. package/src/ContactAgent.ts +1756 -1756
  90. package/src/ContactRestApi.ts +237 -237
  91. package/src/Converters.ts +23271 -23090
  92. package/src/CustomerServiceAgent.ts +1799 -1799
  93. package/src/DashAgent.ts +1674 -1674
  94. package/src/DatabaseAgent.ts +120 -120
  95. package/src/DatabaseTableAgent.ts +534 -534
  96. package/src/Day_js.ts +41 -41
  97. package/src/DiagnosticsAgent.ts +1384 -1240
  98. package/src/DocumentAgent.ts +5079 -5079
  99. package/src/DocumentMigrationAgent.ts +524 -524
  100. package/src/DocumentRestApi.ts +259 -259
  101. package/src/EMailAgent.ts +5328 -5328
  102. package/src/Enums.ts +6936 -6916
  103. package/src/ErpSyncAgent.ts +2658 -2658
  104. package/src/FavouriteAgent.ts +720 -720
  105. package/src/FindAgent.ts +2330 -2330
  106. package/src/ForeignSystemAgent.ts +1710 -1710
  107. package/src/FreeTextAgent.ts +372 -372
  108. package/src/ImportAgent.ts +304 -304
  109. package/src/LicenseAgent.ts +1230 -1230
  110. package/src/ListAgent.ts +11451 -11237
  111. package/src/MDOAgent.ts +748 -748
  112. package/src/MarketingAgent.ts +890 -890
  113. package/src/MessagingAgent.ts +384 -384
  114. package/src/NavigatorAgent.ts +140 -140
  115. package/src/NumberAllocationAgent.ts +296 -296
  116. package/src/PersonAgent.ts +3287 -3287
  117. package/src/PersonRestApi.ts +241 -241
  118. package/src/PhoneListAgent.ts +458 -458
  119. package/src/PocketAgent.ts +780 -780
  120. package/src/PreferenceAgent.ts +1900 -1900
  121. package/src/PreviewsAgent.ts +116 -116
  122. package/src/ProjectAgent.ts +2391 -2391
  123. package/src/ProjectRestApi.ts +239 -239
  124. package/src/QuoteAgent.ts +5159 -5159
  125. package/src/RelationAgent.ts +220 -220
  126. package/src/ReportAgent.ts +154 -154
  127. package/src/ResourceAgent.ts +358 -358
  128. package/src/SaintAgent.ts +601 -601
  129. package/src/SaleAgent.ts +2034 -2034
  130. package/src/SaleRestApi.ts +233 -233
  131. package/src/SelectionAgent.ts +3195 -3195
  132. package/src/SentryAgent.ts +462 -462
  133. package/src/SoApiConstants.ts +8 -8
  134. package/src/TargetsAgent.ts +1104 -1104
  135. package/src/TicketAgent.ts +3708 -3638
  136. package/src/TimeZoneAgent.ts +528 -528
  137. package/src/TooltipsAgent.ts +116 -116
  138. package/src/UserAgent.ts +4856 -4856
  139. package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
  140. package/src/ViewStateAgent.ts +858 -858
  141. package/src/WebApi.ts +872 -872
  142. package/src/WebApiBase.ts +565 -565
  143. package/src/WebhookAgent.ts +388 -388
  144. package/src/WorkflowAgent.ts +1338 -1338
  145. package/tsconfig.esm.json +8 -8
  146. package/tsconfig.jest.json +8 -8
  147. package/tsconfig.json +34 -34
@@ -1,23 +1,23 @@
1
- [{
2
- "scope": "http://localhost:80",
3
- "method": "post",
4
- "path": "/api/v1/Agents/Person/GetPersonImage",
5
- "body": {
6
- "personId": 147
7
- },
8
- "status": 200,
9
- "response": "ffd8ffe000104a46494600010101004800480000ffdb004300140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817cffdb0043011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc00011080046004d03012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00eb7bd2d277aa9a9de0b2b42f901db85a43dc2ef5182d0ed76dcffdd5edf5ac5baf1348188b6850e32373126b22e66791d94f7f98e4fe35674cd3229943c80be7b13d2a398d144af16bb7e495baba720f70001fa5596bc9ad5c4ab2cc09e4156dc0fb62a5bed1e245cc28149e719e0d65448d6eaca5498c8c8534ae3e5b1d768dad43a98319fdddc28e508c6e1ea2b52bcf2c6e552759a13e5c8a7d6bb6b0d4e2bbda8c424c47ddecdf4ab4c868bd451453246e6b91f10dff0099a8b479f9613b71fa935d5b481159cf21416fcabcdaea792eaf9c29f9e6948271ea6a594896490925b39673b8807f4ae9f4b80c16c9e602188ddcf6cd61cf60b02a9670aab8dcec29cf770b9db6f35f79aaa58e4e463d71e951b9b2d0e9e6dac00241c735897d6a6424c4ac57be38c54a1667d19e42cc65048040ac82f1870b72b7923baee5c360639edf85095c6d915ddaa901e5063603ef6319ab9a2cc1a78e166665debf37be72307b53d50dc69f222bb48a1494320e47b1acad29cc33abe59a3661b954e3bd3466cf4d0770ce3145436d711dcc2b2c67e53c7d3daa5cd6864404af3bc80b8f9b3d877af3ab7c1d410a81febc60faaf635dc6a0a64b674deaa08c7cc7e5fa9ae5ad2d019c4aa418e393191d0e2a5b2e2ae7430c6922fceaa73ea2a4b88e18a32cc493d81354d27d8719e951bcf14be61b96545c630c7a0accdd036a369145343248a483ce0f19abb6ab04c80a91b875d8dc1f7ac22ba30ceddcc07a2139f7ab76d3db2c68b6522b053c2e79a617352e153cb200c76ae1e126399f03f8b803eb5d649333b01d31cd67e9da415d443b90d186f30e7bf3c0a6889f73a3d1607b6b1c48486772f83d871815a20d5646cd4a0d6860529b0c0ab0041ec457217d773dbea6464a441c071c608e3fa575b21ae7bc416ea2da598292ec464e7381498d326326d7209e41fcea796d6daf23dcf6eae4f7e4106b243bc31425f249404e6a78b523183838279fa5676364cbeb6aa155041940303e63c5491d8410a9616f1c6c7f880e6ab0d6e30bf7067d8d579755331c28c53b14e4ac4af2112124f00e79a9744b8f3124dc58b13bb9f43dab2ae9e575896320195f6f3e95b969188630a001df8aa48c64ee6aa3d4c0f155233d2ac02715641564ef552750ff00238041ec7a1a28a40663c41a1c1eaa700d674917520d14567d4dba10e08e01e2a6897a514530346d80f336e3ee2eec9f5ad38bb514552d8ca5b9722e956074a28aa11fffd9",
10
- "rawHeaders": [
11
- "Content-Type",
12
- "application/octet-stream",
13
- "Content-Length",
14
- "1520"
15
- ],
16
- "reqheaders": {
17
- "accept": "application/octet-stream",
18
- "content-type": "application/json",
19
- "content-length": 16
20
- },
21
- "responseIsBinary": true
22
- }
1
+ [{
2
+ "scope": "http://localhost:80",
3
+ "method": "post",
4
+ "path": "/api/v1/Agents/Person/GetPersonImage",
5
+ "body": {
6
+ "personId": 147
7
+ },
8
+ "status": 200,
9
+ "response": "ffd8ffe000104a46494600010101004800480000ffdb004300140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817cffdb0043011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc00011080046004d03012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00eb7bd2d277aa9a9de0b2b42f901db85a43dc2ef5182d0ed76dcffdd5edf5ac5baf1348188b6850e32373126b22e66791d94f7f98e4fe35674cd3229943c80be7b13d2a398d144af16bb7e495baba720f70001fa5596bc9ad5c4ab2cc09e4156dc0fb62a5bed1e245cc28149e719e0d65448d6eaca5498c8c8534ae3e5b1d768dad43a98319fdddc28e508c6e1ea2b52bcf2c6e552759a13e5c8a7d6bb6b0d4e2bbda8c424c47ddecdf4ab4c868bd451453246e6b91f10dff0099a8b479f9613b71fa935d5b481159cf21416fcabcdaea792eaf9c29f9e6948271ea6a594896490925b39673b8807f4ae9f4b80c16c9e602188ddcf6cd61cf60b02a9670aab8dcec29cf770b9db6f35f79aaa58e4e463d71e951b9b2d0e9e6dac00241c735897d6a6424c4ac57be38c54a1667d19e42cc65048040ac82f1870b72b7923baee5c360639edf85095c6d915ddaa901e5063603ef6319ab9a2cc1a78e166665debf37be72307b53d50dc69f222bb48a1494320e47b1acad29cc33abe59a3661b954e3bd3466cf4d0770ce3145436d711dcc2b2c67e53c7d3daa5cd6864404af3bc80b8f9b3d877af3ab7c1d410a81febc60faaf635dc6a0a64b674deaa08c7cc7e5fa9ae5ad2d019c4aa418e393191d0e2a5b2e2ae7430c6922fceaa73ea2a4b88e18a32cc493d81354d27d8719e951bcf14be61b96545c630c7a0accdd036a369145343248a483ce0f19abb6ab04c80a91b875d8dc1f7ac22ba30ceddcc07a2139f7ab76d3db2c68b6522b053c2e79a617352e153cb200c76ae1e126399f03f8b803eb5d649333b01d31cd67e9da415d443b90d186f30e7bf3c0a6889f73a3d1607b6b1c48486772f83d871815a20d5646cd4a0d6860529b0c0ab0041ec457217d773dbea6464a441c071c608e3fa575b21ae7bc416ea2da598292ec464e7381498d326326d7209e41fcea796d6daf23dcf6eae4f7e4106b243bc31425f249404e6a78b523183838279fa5676364cbeb6aa155041940303e63c5491d8410a9616f1c6c7f880e6ab0d6e30bf7067d8d579755331c28c53b14e4ac4af2112124f00e79a9744b8f3124dc58b13bb9f43dab2ae9e575896320195f6f3e95b969188630a001df8aa48c64ee6aa3d4c0f155233d2ac02715641564ef552750ff00238041ec7a1a28a40663c41a1c1eaa700d674917520d14567d4dba10e08e01e2a6897a514530346d80f336e3ee2eec9f5ad38bb514552d8ca5b9722e956074a28aa11fffd9",
10
+ "rawHeaders": [
11
+ "Content-Type",
12
+ "application/octet-stream",
13
+ "Content-Length",
14
+ "1520"
15
+ ],
16
+ "reqheaders": {
17
+ "accept": "application/octet-stream",
18
+ "content-type": "application/json",
19
+ "content-length": 16
20
+ },
21
+ "responseIsBinary": true
22
+ }
23
23
  ]
@@ -1,41 +1,41 @@
1
- // import {expect} from 'chai'
2
- import * as assert from "assert";
3
- import axios from "axios";
4
- import nock from 'nock'
5
- import { PersonAgent } from "../src/PersonAgent";
6
-
7
- const host = "http://localhost/";
8
-
9
- axios.defaults.baseURL = host;
10
-
11
- describe("WebAPI Person tests", () => {
12
- it("Can get a person image using a request object", done => {
13
- let scopes = nock.load(__dirname + "/PersonImageData.nock");
14
- // let scope = nock(host)
15
- // .post('/api/v1/Agents/Person/GetPersonImage')
16
- // .reply(200, "0xbadbeef");
17
-
18
- let agent = new PersonAgent(host);
19
- agent.getPersonImageAsync({ personId: 147 }).then(response => {
20
- assert.notEqual(null, response);
21
- response = response as ArrayBuffer;
22
- assert.equal(response.byteLength, 1520);
23
- done();
24
- });
25
- });
26
-
27
- it("Can get a person image using a parameter", done => {
28
- let scopes = nock.load(__dirname + "/PersonImageData.nock");
29
- // let scope = nock(host)
30
- // .post('/api/v1/Agents/Person/GetPersonImage')
31
- // .reply(200, "0xbadbeef");
32
-
33
- let agent = new PersonAgent(host);
34
- agent.getPersonImageAsync(147).then(response => {
35
- assert.notEqual(null, response);
36
- response = response as ArrayBuffer;
37
- assert.equal(response.byteLength, 1520);
38
- done();
39
- });
40
- });
41
- });
1
+ // import {expect} from 'chai'
2
+ import * as assert from "assert";
3
+ import axios from "axios";
4
+ import nock from 'nock'
5
+ import { PersonAgent } from "../src/PersonAgent";
6
+
7
+ const host = "http://localhost/";
8
+
9
+ axios.defaults.baseURL = host;
10
+
11
+ describe("WebAPI Person tests", () => {
12
+ it("Can get a person image using a request object", done => {
13
+ let scopes = nock.load(__dirname + "/PersonImageData.nock");
14
+ // let scope = nock(host)
15
+ // .post('/api/v1/Agents/Person/GetPersonImage')
16
+ // .reply(200, "0xbadbeef");
17
+
18
+ let agent = new PersonAgent(host);
19
+ agent.getPersonImageAsync({ personId: 147 }).then(response => {
20
+ assert.notEqual(null, response);
21
+ response = response as ArrayBuffer;
22
+ assert.equal(response.byteLength, 1520);
23
+ done();
24
+ });
25
+ });
26
+
27
+ it("Can get a person image using a parameter", done => {
28
+ let scopes = nock.load(__dirname + "/PersonImageData.nock");
29
+ // let scope = nock(host)
30
+ // .post('/api/v1/Agents/Person/GetPersonImage')
31
+ // .reply(200, "0xbadbeef");
32
+
33
+ let agent = new PersonAgent(host);
34
+ agent.getPersonImageAsync(147).then(response => {
35
+ assert.notEqual(null, response);
36
+ response = response as ArrayBuffer;
37
+ assert.equal(response.byteLength, 1520);
38
+ done();
39
+ });
40
+ });
41
+ });
@@ -1,113 +1,113 @@
1
- import * as assert from "assert";
2
- import axios, { AxiosRequestConfig } from "axios";
3
- import nock from "nock";
4
- import { WebApiStatus } from "../src/WebApiBase";
5
- import { PersonEntity } from "../src/Carriers";
6
- import { PersonAgent } from "../src/PersonAgent";
7
- import { WebApiRequestOptions } from "../src/WebApi";
8
- import { HEADER_NAME_TIMEZONE } from "../src/SoApiConstants";
9
-
10
- const host: string = "http://localhost/";
11
- const defaultPerson = require("./Person210.json");
12
- const utcPerson = require("./Person210-utctz.json");
13
- const noPerson = require("./Person210-notz.json");
14
-
15
- axios.defaults.baseURL = host;
16
-
17
- describe("WebAPI Person timezone tests", () => {
18
- it("Get person 210 without timezone header", done => {
19
- let scope = nock(host)
20
- .post("/api/v1/Agents/Person/GetPersonEntity?personEntityId=210")
21
- .reply(200, defaultPerson)
22
- // \"UpdatedDate\":\"2019-12-19T10:55:14.000Z\",\"CreatedDate\":\"2019-12-19T09:44:12.000Z\",\"BirthDate\":\"1999-05-13T00:00:00.000Z\",
23
- .post("/api/v1/Agents/Person/SavePersonEntity", /1999-05-13T00:00:00.000Z/)
24
- .reply(200, defaultPerson);
25
-
26
- let agent = new PersonAgent(host);
27
- agent.getPersonEntityAsync(210).then(response => {
28
- assert.equal(response.personId, 210);
29
- assert.equal(response.firstname, "Steve");
30
- assert.equal(response.lastname, "Fishmann");
31
- assert.equal(response.description, "This is awsome guy that will sell you fish in London");
32
- assert.equal(response.contact?.contactId, 124);
33
- assert.equal(response.birthDate?.getFullYear(), 1999)
34
- assert.equal(response.birthDate?.getMonth(), 5-1) // 0-11
35
- assert.equal(response.birthDate?.getDate(), 13)
36
- assert.equal(response.createdDate?.getFullYear(), 2019)
37
- assert.equal(response.createdDate?.getMonth(), 12-1) // 0-11
38
- assert.equal(response.createdDate?.getDate(), 19)
39
- assert.equal(response.createdDate?.getHours(), 10)
40
- assert.equal(response.createdDate?.getMinutes(), 44)
41
-
42
- agent.savePersonEntityAsync(response, {}).then( response => {
43
- assert.equal(response.description, "This is awsome guy that will sell you fish in London");
44
- assert.equal(response.contact?.contactId, 124);
45
- assert.equal(response.createdDate?.getDate(), 19)
46
- done();
47
- });
48
- });
49
- });
50
-
51
- it("Get person 210 with utc timezone header", done => {
52
- let scope = nock(host)
53
- .post("/api/v1/Agents/Person/GetPersonEntity?personEntityId=210")
54
- .reply(200, utcPerson)
55
- // \"UpdatedDate\":\"2019-12-19T10:55:14.000Z\",\"CreatedDate\":\"2019-12-19T09:44:12.000Z\",\"BirthDate\":\"1999-05-13T00:00:00.000Z\",
56
- .post("/api/v1/Agents/Person/SavePersonEntity", /1999-05-13T00:00:00.000Z/)
57
- .reply(200, defaultPerson);
58
-
59
- let agent = new PersonAgent(host);
60
- agent.getPersonEntityAsync(210, {timezone: 'utc', timezoneInclude: true }).then(response => {
61
- assert.equal(response.personId, 210);
62
- assert.equal(response.firstname, "Steve");
63
- assert.equal(response.lastname, "Fishmann");
64
- assert.equal(response.description, "This is awsome guy that will sell you fish in London");
65
- assert.equal(response.contact?.contactId, 124);
66
- assert.equal(response.birthDate?.getFullYear(), 1999)
67
- assert.equal(response.birthDate?.getMonth(), 5-1); // zero-based 0-11
68
- assert.equal(response.birthDate?.getDate(), 13)
69
- assert.equal(response.createdDate?.getFullYear(), 2019)
70
- assert.equal(response.createdDate?.getMonth(), 12-1); // zero-based 0-11
71
- assert.equal(response.createdDate?.getDate(), 19)
72
- assert.equal(response.createdDate?.getHours(), 10)
73
- assert.equal(response.createdDate?.getMinutes(), 44)
74
- agent.savePersonEntityAsync(response, {timezone: 'utc', timezoneInclude: true}).then( response => {
75
- assert.equal(response.contact?.contactId, 124);
76
- assert.equal(response.createdDate?.getDate(), 19)
77
- done();
78
- });
79
- });
80
- });
81
-
82
- it("Get person 210 with NOR timezone header", done => {
83
- let scope = nock(host)
84
- .post("/api/v1/Agents/Person/GetPersonEntity?personEntityId=210")
85
- .reply(200, noPerson)
86
- // \"UpdatedDate\":\"2019-12-19T10:55:14.000Z\",\"CreatedDate\":\"2019-12-19T09:44:12.000Z\",\"BirthDate\":\"1999-05-13T00:00:00.000Z\",
87
- .post("/api/v1/Agents/Person/SavePersonEntity", /1999-05-13T00:00:00.000Z/)
88
- .reply(200, defaultPerson);
89
-
90
- let agent = new PersonAgent(host);
91
- agent.getPersonEntityAsync(210, { timezone: 'no', timezoneInclude: true }).then(response => {
92
- assert.equal(response.personId, 210);
93
- assert.equal(response.firstname, "Steve");
94
- assert.equal(response.lastname, "Fishmann");
95
- assert.equal(response.description, "This is awsome guy that will sell you fish in London");
96
- assert.equal(response.contact?.contactId, 124);
97
- assert.equal(response.birthDate?.getFullYear(), 1999)
98
- assert.equal(response.birthDate?.getMonth(), 5-1)
99
- assert.equal(response.birthDate?.getDate(), 13)
100
- assert.equal(response.createdDate?.getFullYear(), 2019)
101
- assert.equal(response.createdDate?.getMonth(), 12-1)
102
- assert.equal(response.createdDate?.getDate(), 19)
103
- assert.equal(response.createdDate?.getHours(), 10)
104
- assert.equal(response.createdDate?.getMinutes(), 44)
105
- agent.savePersonEntityAsync(response, {timezone: 'no', timezoneInclude: true}).then( response => {
106
- assert.equal(response.contact?.contactId, 124);
107
- assert.equal(response.createdDate?.getDate(), 19)
108
- done();
109
- });
110
- });
111
- });
112
-
113
- });
1
+ import * as assert from "assert";
2
+ import axios, { AxiosRequestConfig } from "axios";
3
+ import nock from "nock";
4
+ import { WebApiStatus } from "../src/WebApiBase";
5
+ import { PersonEntity } from "../src/Carriers";
6
+ import { PersonAgent } from "../src/PersonAgent";
7
+ import { WebApiRequestOptions } from "../src/WebApi";
8
+ import { HEADER_NAME_TIMEZONE } from "../src/SoApiConstants";
9
+
10
+ const host: string = "http://localhost/";
11
+ const defaultPerson = require("./Person210.json");
12
+ const utcPerson = require("./Person210-utctz.json");
13
+ const noPerson = require("./Person210-notz.json");
14
+
15
+ axios.defaults.baseURL = host;
16
+
17
+ describe("WebAPI Person timezone tests", () => {
18
+ it("Get person 210 without timezone header", done => {
19
+ let scope = nock(host)
20
+ .post("/api/v1/Agents/Person/GetPersonEntity?personEntityId=210")
21
+ .reply(200, defaultPerson)
22
+ // \"UpdatedDate\":\"2019-12-19T10:55:14.000Z\",\"CreatedDate\":\"2019-12-19T09:44:12.000Z\",\"BirthDate\":\"1999-05-13T00:00:00.000Z\",
23
+ .post("/api/v1/Agents/Person/SavePersonEntity", /1999-05-13T00:00:00.000Z/)
24
+ .reply(200, defaultPerson);
25
+
26
+ let agent = new PersonAgent(host);
27
+ agent.getPersonEntityAsync(210).then(response => {
28
+ assert.equal(response.personId, 210);
29
+ assert.equal(response.firstname, "Steve");
30
+ assert.equal(response.lastname, "Fishmann");
31
+ assert.equal(response.description, "This is awsome guy that will sell you fish in London");
32
+ assert.equal(response.contact?.contactId, 124);
33
+ assert.equal(response.birthDate?.getFullYear(), 1999)
34
+ assert.equal(response.birthDate?.getMonth(), 5-1) // 0-11
35
+ assert.equal(response.birthDate?.getDate(), 13)
36
+ assert.equal(response.createdDate?.getFullYear(), 2019)
37
+ assert.equal(response.createdDate?.getMonth(), 12-1) // 0-11
38
+ assert.equal(response.createdDate?.getDate(), 19)
39
+ assert.equal(response.createdDate?.getHours(), 10)
40
+ assert.equal(response.createdDate?.getMinutes(), 44)
41
+
42
+ agent.savePersonEntityAsync(response, {}).then( response => {
43
+ assert.equal(response.description, "This is awsome guy that will sell you fish in London");
44
+ assert.equal(response.contact?.contactId, 124);
45
+ assert.equal(response.createdDate?.getDate(), 19)
46
+ done();
47
+ });
48
+ });
49
+ });
50
+
51
+ it("Get person 210 with utc timezone header", done => {
52
+ let scope = nock(host)
53
+ .post("/api/v1/Agents/Person/GetPersonEntity?personEntityId=210")
54
+ .reply(200, utcPerson)
55
+ // \"UpdatedDate\":\"2019-12-19T10:55:14.000Z\",\"CreatedDate\":\"2019-12-19T09:44:12.000Z\",\"BirthDate\":\"1999-05-13T00:00:00.000Z\",
56
+ .post("/api/v1/Agents/Person/SavePersonEntity", /1999-05-13T00:00:00.000Z/)
57
+ .reply(200, defaultPerson);
58
+
59
+ let agent = new PersonAgent(host);
60
+ agent.getPersonEntityAsync(210, {timezone: 'utc', timezoneInclude: true }).then(response => {
61
+ assert.equal(response.personId, 210);
62
+ assert.equal(response.firstname, "Steve");
63
+ assert.equal(response.lastname, "Fishmann");
64
+ assert.equal(response.description, "This is awsome guy that will sell you fish in London");
65
+ assert.equal(response.contact?.contactId, 124);
66
+ assert.equal(response.birthDate?.getFullYear(), 1999)
67
+ assert.equal(response.birthDate?.getMonth(), 5-1); // zero-based 0-11
68
+ assert.equal(response.birthDate?.getDate(), 13)
69
+ assert.equal(response.createdDate?.getFullYear(), 2019)
70
+ assert.equal(response.createdDate?.getMonth(), 12-1); // zero-based 0-11
71
+ assert.equal(response.createdDate?.getDate(), 19)
72
+ assert.equal(response.createdDate?.getHours(), 10)
73
+ assert.equal(response.createdDate?.getMinutes(), 44)
74
+ agent.savePersonEntityAsync(response, {timezone: 'utc', timezoneInclude: true}).then( response => {
75
+ assert.equal(response.contact?.contactId, 124);
76
+ assert.equal(response.createdDate?.getDate(), 19)
77
+ done();
78
+ });
79
+ });
80
+ });
81
+
82
+ it("Get person 210 with NOR timezone header", done => {
83
+ let scope = nock(host)
84
+ .post("/api/v1/Agents/Person/GetPersonEntity?personEntityId=210")
85
+ .reply(200, noPerson)
86
+ // \"UpdatedDate\":\"2019-12-19T10:55:14.000Z\",\"CreatedDate\":\"2019-12-19T09:44:12.000Z\",\"BirthDate\":\"1999-05-13T00:00:00.000Z\",
87
+ .post("/api/v1/Agents/Person/SavePersonEntity", /1999-05-13T00:00:00.000Z/)
88
+ .reply(200, defaultPerson);
89
+
90
+ let agent = new PersonAgent(host);
91
+ agent.getPersonEntityAsync(210, { timezone: 'no', timezoneInclude: true }).then(response => {
92
+ assert.equal(response.personId, 210);
93
+ assert.equal(response.firstname, "Steve");
94
+ assert.equal(response.lastname, "Fishmann");
95
+ assert.equal(response.description, "This is awsome guy that will sell you fish in London");
96
+ assert.equal(response.contact?.contactId, 124);
97
+ assert.equal(response.birthDate?.getFullYear(), 1999)
98
+ assert.equal(response.birthDate?.getMonth(), 5-1)
99
+ assert.equal(response.birthDate?.getDate(), 13)
100
+ assert.equal(response.createdDate?.getFullYear(), 2019)
101
+ assert.equal(response.createdDate?.getMonth(), 12-1)
102
+ assert.equal(response.createdDate?.getDate(), 19)
103
+ assert.equal(response.createdDate?.getHours(), 10)
104
+ assert.equal(response.createdDate?.getMinutes(), 44)
105
+ agent.savePersonEntityAsync(response, {timezone: 'no', timezoneInclude: true}).then( response => {
106
+ assert.equal(response.contact?.contactId, 124);
107
+ assert.equal(response.createdDate?.getDate(), 19)
108
+ done();
109
+ });
110
+ });
111
+ });
112
+
113
+ });
@@ -1,55 +1,55 @@
1
- {
2
- "RecurrenceId": 3,
3
- "StartDate": "2019-02-15T00:00:00",
4
- "EndDate": "2019-02-22T00:00:00",
5
- "RecurrenceEndType": "EndDate",
6
- "Pattern": "Weekly",
7
- "DayPattern": { "Cycle": 1, "Pattern": "EveryCyclicDay" },
8
- "WeekPattern": { "Cycle": 1, "Weekdays": "Monday, Wednesday, Friday" },
9
- "MonthPattern": {
10
- "Cycle": 1,
11
- "Day": 15,
12
- "Weekday": "Monday, Friday",
13
- "WeekOfMonth": "Third",
14
- "Pattern": "DayOfMonth"
15
- },
16
- "YearPattern": {
17
- "Cycle": 2,
18
- "Day": 15,
19
- "Weekday": "Friday",
20
- "WeekOfMonth": "Third",
21
- "Pattern": "DayOfMonth"
22
- },
23
- "Dates": [
24
- {
25
- "Date": "2019-02-15T00:00:00",
26
- "IsConflict": true,
27
- "Description": null,
28
- "DescriptionStyleHint": "conflict",
29
- "Tooltip": "{conflict_id=116&conflict_id=121&conflict_id=124}"
30
- },
31
- {
32
- "Date": "2019-02-18T00:00:00",
33
- "IsConflict": false,
34
- "Description": null,
35
- "DescriptionStyleHint": "",
36
- "Tooltip": null
37
- },
38
- {
39
- "Date": "2019-02-20T00:00:00",
40
- "IsConflict": false,
41
- "Description": null,
42
- "DescriptionStyleHint": "",
43
- "Tooltip": null
44
- },
45
- {
46
- "Date": "2019-02-22T00:00:00",
47
- "IsConflict": false,
48
- "Description": null,
49
- "DescriptionStyleHint": "",
50
- "Tooltip": null
51
- }
52
- ],
53
- "RecurrenceCounter": 1,
54
- "IsRecurrence": true
55
- }
1
+ {
2
+ "RecurrenceId": 3,
3
+ "StartDate": "2019-02-15T00:00:00",
4
+ "EndDate": "2019-02-22T00:00:00",
5
+ "RecurrenceEndType": "EndDate",
6
+ "Pattern": "Weekly",
7
+ "DayPattern": { "Cycle": 1, "Pattern": "EveryCyclicDay" },
8
+ "WeekPattern": { "Cycle": 1, "Weekdays": "Monday, Wednesday, Friday" },
9
+ "MonthPattern": {
10
+ "Cycle": 1,
11
+ "Day": 15,
12
+ "Weekday": "Monday, Friday",
13
+ "WeekOfMonth": "Third",
14
+ "Pattern": "DayOfMonth"
15
+ },
16
+ "YearPattern": {
17
+ "Cycle": 2,
18
+ "Day": 15,
19
+ "Weekday": "Friday",
20
+ "WeekOfMonth": "Third",
21
+ "Pattern": "DayOfMonth"
22
+ },
23
+ "Dates": [
24
+ {
25
+ "Date": "2019-02-15T00:00:00",
26
+ "IsConflict": true,
27
+ "Description": null,
28
+ "DescriptionStyleHint": "conflict",
29
+ "Tooltip": "{conflict_id=116&conflict_id=121&conflict_id=124}"
30
+ },
31
+ {
32
+ "Date": "2019-02-18T00:00:00",
33
+ "IsConflict": false,
34
+ "Description": null,
35
+ "DescriptionStyleHint": "",
36
+ "Tooltip": null
37
+ },
38
+ {
39
+ "Date": "2019-02-20T00:00:00",
40
+ "IsConflict": false,
41
+ "Description": null,
42
+ "DescriptionStyleHint": "",
43
+ "Tooltip": null
44
+ },
45
+ {
46
+ "Date": "2019-02-22T00:00:00",
47
+ "IsConflict": false,
48
+ "Description": null,
49
+ "DescriptionStyleHint": "",
50
+ "Tooltip": null
51
+ }
52
+ ],
53
+ "RecurrenceCounter": 1,
54
+ "IsRecurrence": true
55
+ }
@@ -1,23 +1,23 @@
1
- import nock from "nock";
2
- import axios from "axios";
3
- import { DashAgent } from "../src/DashAgent";
4
-
5
- const host: string = "http://localhost/";
6
-
7
- axios.defaults.baseURL = host;
8
-
9
- describe("ResponseCallback tests", () => {
10
- it("Calls responseCallback when specified", done => {
11
- const dbStats = "implementationMS=512&Calls=7&Read=123";
12
- const scope = nock(host)
13
- .post("/api/v1/Agents/Dash/CreateDefaultDash")
14
- .reply(200, { Dashboard: null }, { "x-db-stats": dbStats });
15
-
16
- new DashAgent(host).createDefaultDashAsync({
17
- responseCallback: response => {
18
- expect(response.headers["x-db-stats"]).toBe(dbStats);
19
- done();
20
- }
21
- });
22
- });
23
- });
1
+ import nock from "nock";
2
+ import axios from "axios";
3
+ import { DashAgent } from "../src/DashAgent";
4
+
5
+ const host: string = "http://localhost/";
6
+
7
+ axios.defaults.baseURL = host;
8
+
9
+ describe("ResponseCallback tests", () => {
10
+ it("Calls responseCallback when specified", done => {
11
+ const dbStats = "implementationMS=512&Calls=7&Read=123";
12
+ const scope = nock(host)
13
+ .post("/api/v1/Agents/Dash/CreateDefaultDash")
14
+ .reply(200, { Dashboard: null }, { "x-db-stats": dbStats });
15
+
16
+ new DashAgent(host).createDefaultDashAsync({
17
+ responseCallback: response => {
18
+ expect(response.headers["x-db-stats"]).toBe(dbStats);
19
+ done();
20
+ }
21
+ });
22
+ });
23
+ });