@zimbra/api-client 76.0.0 → 78.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zimbra/api-client",
3
3
  "amdName": "zmApiJsClient",
4
- "version": "76.0.0",
4
+ "version": "78.0.0",
5
5
  "description": "Zimbra JS API Client and GraphQL client for making requests against the Zimbra SOAP API.",
6
6
  "main": "dist/zm-api-js-client.js",
7
7
  "source": "index.ts",
@@ -14,7 +14,6 @@
14
14
  "lint:fix": "npm run lint -- --fix",
15
15
  "test:unit": "BABEL_ENV=test mocha --require ./babelRegisterConfig.js test/**/*.js",
16
16
  "test:watch": "npm run test:unit -- --watch",
17
- "test:no-synacor-npm-refs": "node ./scripts/synacor-npm-refs.js",
18
17
  "clean": "rimraf dist",
19
18
  "build": "npm-run-all clean generateSchemaTypes rollup:* -p build:ts minify:* copySchema",
20
19
  "build:ts": "tsc --emitDeclarationOnly --declaration --outDir \"dist\"",
@@ -45,50 +44,49 @@
45
44
  },
46
45
  "dependencies": {
47
46
  "@apollo/client": "^3.4.16",
48
- "dataloader": "^2.0.0",
49
- "graphql": "^15.6.1",
50
- "graphql-tools": "^8.2.0",
47
+ "dataloader": "^2.1.0",
48
+ "graphql": "^15.8.0",
49
+ "graphql-tools": "^8.2.8",
51
50
  "lodash": "^4.17.21",
52
51
  "mitt": "^3.0.0"
53
52
  },
54
53
  "devDependencies": {
55
- "@babel/cli": "^7.15.7",
56
- "@babel/core": "^7.15.8",
57
- "@babel/plugin-proposal-class-properties": "^7.14.5",
58
- "@babel/preset-env": "^7.15.8",
59
- "@babel/preset-typescript": "^7.15.0",
60
- "@babel/register": "^7.15.3",
61
- "@graphql-codegen/cli": "^2.2.0",
62
- "@graphql-codegen/typescript": "^2.2.2",
63
- "@rollup/plugin-babel": "^5.3.0",
64
- "@rollup/plugin-commonjs": "^21.0.0",
65
- "@rollup/plugin-node-resolve": "^13.0.5",
66
- "@rollup/plugin-typescript": "^8.2.5",
54
+ "@babel/cli": "^7.17.10",
55
+ "@babel/core": "^7.17.10",
56
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
57
+ "@babel/preset-env": "^7.17.10",
58
+ "@babel/preset-typescript": "^7.16.7",
59
+ "@babel/register": "^7.17.7",
60
+ "@graphql-codegen/cli": "^2.6.2",
61
+ "@graphql-codegen/typescript": "^2.4.10",
62
+ "@rollup/plugin-babel": "^5.3.1",
63
+ "@rollup/plugin-commonjs": "^22.0.0",
64
+ "@rollup/plugin-node-resolve": "^13.3.0",
65
+ "@rollup/plugin-typescript": "^8.3.2",
67
66
  "@types/graphql": "^14.5.0",
68
- "@types/lodash": "^4.14.178",
69
- "@types/node": "^17.0.8",
67
+ "@types/lodash": "^4.14.182",
68
+ "@types/node": "^17.0.31",
70
69
  "@types/whatwg-fetch": "^0.0.33",
71
- "audit-ci": "^4.1.0",
70
+ "audit-ci": "^6.2.0",
72
71
  "babel-plugin-lodash": "^3.3.4",
73
- "chai": "^4.3.4",
72
+ "chai": "^4.3.6",
74
73
  "copyfiles": "^2.4.1",
75
74
  "cross-var": "^1.1.0",
76
- "file-matcher": "^1.3.0",
77
- "husky": "^7.0.4",
78
- "is-ci": "^3.0.0",
79
- "lint-staged": "^12.1.7",
80
- "mocha": "^9.1.2",
75
+ "husky": "^8.0.0",
76
+ "is-ci": "^3.0.1",
77
+ "lint-staged": "^12.4.1",
78
+ "mocha": "^10.0.0",
81
79
  "npm-run-all": "^4.1.5",
82
- "prettier": "^2.5.1",
80
+ "prettier": "^2.6.2",
83
81
  "rimraf": "^3.0.2",
84
- "rollup": "^2.58.0",
82
+ "rollup": "^2.72.1",
85
83
  "rollup-plugin-graphql": "^0.1.0",
86
84
  "rollup-plugin-local-resolve": "^1.0.7",
87
- "tslib": "^2.3.1",
85
+ "tslib": "^2.4.0",
88
86
  "tslint": "^6.1.3",
89
87
  "tslint-config-prettier": "^1.18.0",
90
88
  "tslint-plugin-prettier": "^2.3.0",
91
- "typescript": "^4.5.4",
92
- "uglify-js": "^3.14.2"
89
+ "typescript": "^4.6.4",
90
+ "uglify-js": "^3.15.4"
93
91
  }
94
92
  }
@@ -541,7 +541,7 @@ export class ZimbraBatchClient {
541
541
  },
542
542
  singleRequest: true,
543
543
  namespace: Namespace.Account
544
- }).then(res => normalize(ClientInfoResponse)(res));
544
+ }).then(res => normalize(ClientInfoResponse)(mapValuesDeep(res, coerceStringToBoolean)));
545
545
 
546
546
  public contactAction = (options: ActionOptions) => this.action(ActionType.contact, options);
547
547
 
@@ -819,7 +819,8 @@ export class ZimbraBatchClient {
819
819
  password,
820
820
  authToken,
821
821
  twoFactorCode,
822
- csrfTokenSecured
822
+ csrfTokenSecured,
823
+ ignoreSameSite
823
824
  }: EnableTwoFactorAuthInput) =>
824
825
  this.jsonRequest({
825
826
  name: 'EnableTwoFactorAuth',
@@ -842,12 +843,48 @@ export class ZimbraBatchClient {
842
843
  _content: twoFactorCode
843
844
  }
844
845
  }),
846
+ ...(ignoreSameSite && { ignoreSameSite }),
845
847
  csrfTokenSecured
846
848
  },
847
849
  namespace: Namespace.Account,
848
850
  singleRequest: true
849
851
  });
850
852
 
853
+ public endSessionBeaconRequest = (options: JsonRequestOptions) => {
854
+ const body = {
855
+ Body: {
856
+ EndSessionRequest: {
857
+ _jsns: Namespace.Account
858
+ }
859
+ },
860
+ Header: {
861
+ context: {
862
+ _jsns: Namespace.All,
863
+ csrfToken: this.csrfToken,
864
+ account: {
865
+ by: 'name',
866
+ _content: options.accountName
867
+ },
868
+ session: {
869
+ id: this.sessionId,
870
+ _content: this.sessionId
871
+ },
872
+ userAgent: this.userAgent
873
+ }
874
+ }
875
+ };
876
+
877
+ try {
878
+ const blob = new Blob([JSON.stringify(body)]);
879
+ if (navigator) {
880
+ // In zimbra desktop client navigator is null
881
+ navigator.sendBeacon(`${this.origin}/service/soap`, blob);
882
+ }
883
+ } catch (e) {
884
+ throw new Error('Error on endSessionBeaconRequest request' + e);
885
+ }
886
+ };
887
+
851
888
  public folderAction = (options: ActionOptions) => this.action(ActionType.folder, options);
852
889
 
853
890
  public forwardAppointment = (body: ForwardAppointmentInput) =>
@@ -1324,7 +1361,8 @@ export class ZimbraBatchClient {
1324
1361
  persistAuthTokenCookie,
1325
1362
  twoFactorCode,
1326
1363
  deviceTrusted,
1327
- csrfTokenSecured
1364
+ csrfTokenSecured,
1365
+ ignoreSameSite
1328
1366
  }: LoginOptions) =>
1329
1367
  this.jsonRequest({
1330
1368
  name: 'Auth',
@@ -1337,6 +1375,7 @@ export class ZimbraBatchClient {
1337
1375
  by: 'name',
1338
1376
  _content: username
1339
1377
  },
1378
+ ...(ignoreSameSite && { ignoreSameSite }),
1340
1379
  ...(password && { password }),
1341
1380
  ...(recoveryCode && {
1342
1381
  recoveryCode: {
@@ -244,6 +244,7 @@ export interface ModifyProfileImageOptions {
244
244
  export interface LoginOptions {
245
245
  csrfTokenSecured: boolean;
246
246
  deviceTrusted?: boolean;
247
+ ignoreSameSite?: boolean;
247
248
  password: string;
248
249
  persistAuthTokenCookie?: boolean;
249
250
  recoveryCode?: string;