@raytio/decrypt-helper 4.0.0 → 5.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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 5.0.0 (2022-07-12)
11
+
12
+ - 💥 BREAKING CHANGE: !185 use `accessToken` instead of `idToken` when communicating with the Raytio API
13
+ - 💥 BREAKING CHANGE: !185 Improve how quotes (`"`) are escaped in the csv format to be compliant with [RFC-4180](https://datatracker.ietf.org/doc/html/rfc4180#section-2)
14
+ - !185 embed language into pdf
15
+
10
16
  ## 4.0.0 (2022-07-08)
11
17
 
12
18
  - 💥 BREAKING CHANGE: !170 [json] [csv] changed the format of badges, the fields `$verified` and `$safeHarbour` have been replaced with `$badges`
@@ -48,7 +48,7 @@ function signIn(CONFIG, envConfig) {
48
48
  throw new Error(`The configured account (${CONFIG.RAYTIO_USERNAME}) has two factor authentication enabled. You must disable 2FA or use a different account`);
49
49
  }
50
50
  const user = yield auth_1.Auth.currentAuthenticatedUser();
51
- const apiToken = (_b = (_a = user.signInUserSession) === null || _a === void 0 ? void 0 : _a.idToken) === null || _b === void 0 ? void 0 : _b.jwtToken;
51
+ const apiToken = (_b = (_a = user.signInUserSession) === null || _a === void 0 ? void 0 : _a.accessToken) === null || _b === void 0 ? void 0 : _b.jwtToken;
52
52
  const cognitoAttributes = yield auth_1.Auth.userAttributes(user);
53
53
  return { apiToken, cognitoAttributes };
54
54
  });
@@ -17,7 +17,7 @@ function deepJsonToCsv(json) {
17
17
  const flatJson = (0, exports.flattenObj)(json);
18
18
  const [headerRow, values] = (0, ramda_1.transpose)(Object.entries(flatJson));
19
19
  const toCsvRow = (row) => row
20
- .map((field) => typeof field === "string" ? `"${field.replace(/"/g, '\\"')}"` : field)
20
+ .map((field) => typeof field === "string" ? `"${field.replace(/"/g, '""')}"` : field)
21
21
  .join(",");
22
22
  return `${toCsvRow(headerRow)}\n${toCsvRow(values)}`;
23
23
  }
@@ -34,7 +34,9 @@ const Report = ({ data, files, config, aId, clientUrl, envConfig, version, }) =>
34
34
  creator: appName,
35
35
  producer: "Raytio",
36
36
  subject: version,
37
- }, ownerPassword: randomToken, permissions: {
37
+ },
38
+ // @ts-expect-error -- waiting on bpampuch/pdfmake#2453
39
+ lang: global.lang, ownerPassword: randomToken, permissions: {
38
40
  printing: "highResolution",
39
41
  copying: true, // allow copy/paste
40
42
  }, pageSize: "A4", styles: style_1.classes, images: {
@@ -29,7 +29,6 @@ const generatePDF = () => (data) => __awaiter(void 0, void 0, void 0, function*
29
29
  console.log("Generating PDF Report...");
30
30
  const { DATE_FORMAT = "en-nz", TIMEZONE = "Pacific/Auckland" } = process.env;
31
31
  const pkg = JSON.parse(yield fs_1.promises.readFile((0, path_1.join)(__dirname, "../../package.json"), "utf8"));
32
- const version = `node:${process.version} pkg:${pkg.version}`;
33
32
  if (data.envConfig.logo_url) {
34
33
  // there is a white labelling URL, so fetch it and write it to disk, overriding the default logo
35
34
  const arrayBuf = yield (0, node_fetch_1.default)(data.envConfig.logo_url).then((r) => r.arrayBuffer());
@@ -44,9 +43,10 @@ const generatePDF = () => (data) => __awaiter(void 0, void 0, void 0, function*
44
43
  console.warn(`The specified PDF_LANGUAGE is language is invalid (${customLang})`);
45
44
  }
46
45
  }
46
+ const subject = `node:${process.version} pkg:${pkg.version} lang:${global.lang}`;
47
47
  return new Promise((resolve) => {
48
48
  const printer = new pdfmake_1.default(style_1.fonts);
49
- const pdfDoc = printer.createPdfKitDocument(generatePdfJson(data, DATE_FORMAT, TIMEZONE, version));
49
+ const pdfDoc = printer.createPdfKitDocument(generatePdfJson(data, DATE_FORMAT, TIMEZONE, subject));
50
50
  const chunks = [];
51
51
  pdfDoc.on("data", (chunk) => chunks.push(chunk));
52
52
  pdfDoc.on("end", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/decrypt-helper",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "author": "Raytio",
5
5
  "description": "A helper to decrypt data shared by Raytio users",
6
6
  "main": "dist",
@@ -36,24 +36,24 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@raytio/react-intl-manager": "^6.3.0",
39
- "@types/jest": "^28.1.4",
39
+ "@types/jest": "^28.1.6",
40
40
  "@types/jest-image-snapshot": "^5.1.0",
41
41
  "@types/jsx-pdf": "^2.2.2",
42
42
  "@types/mime-types": "^2.1.1",
43
- "@types/node": "^16.11.43",
43
+ "@types/node": "^16.11.45",
44
44
  "@types/node-fetch": "^2.5.12",
45
45
  "@types/pdfmake": "^0.2.0",
46
- "@types/ramda": "^0.28.14",
46
+ "@types/ramda": "^0.28.15",
47
47
  "babel-preset-react-app": "^10.0.1",
48
48
  "dotenv": "^16.0.1",
49
- "eslint": "^8.19.0",
50
- "eslint-config-kyle": "^8.38.0",
51
- "jest": "^28.1.2",
49
+ "eslint": "^8.20.0",
50
+ "eslint-config-kyle": "^8.40.0",
51
+ "jest": "^28.1.3",
52
52
  "jest-image-snapshot": "^5.1.0",
53
53
  "jest-junit": "^14.0.0",
54
54
  "pdf-to-img": "^1.2.0",
55
- "ts-jest": "^28.0.5",
56
- "ts-node": "^10.8.2",
55
+ "ts-jest": "^28.0.7",
56
+ "ts-node": "^10.9.1",
57
57
  "typescript": "^4.7.4"
58
58
  },
59
59
  "eslintConfig": {