@kintone/data-loader
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.5.5](https://github.com/kintone/js-sdk/compare/@kintone/data-loader@0.5.4...@kintone/data-loader@0.5.5) (2021-06-29) | ||
### Bug Fixes | ||
* **data-loader:** ignore unsupported fields from CSV export ([#954](https://github.com/kintone/js-sdk/issues/954)) ([073a977](https://github.com/kintone/js-sdk/commit/073a977b537b3f42124771eb820742a877cb1952)) | ||
## [0.5.4](https://github.com/kintone/js-sdk/compare/@kintone/data-loader@0.5.3...@kintone/data-loader@0.5.4) (2021-06-22) | ||
@@ -8,0 +19,0 @@ |
@@ -7,2 +7,3 @@ "use strict"; | ||
const subtableFieldsJson = require("./fixtures/subtable_fields.json"); | ||
const unsupportedFieldsJson = require("./fixtures/unsupported_fields.json"); | ||
describe("buildHeaderFields", () => { | ||
@@ -13,7 +14,12 @@ it("should generate fieldCode array without subtable relation field correctly", () => { | ||
}); | ||
it("should generate fieldCode array it contains relation to subtable field correctly", () => { | ||
it("should generate fieldCode array which contains relation to subtable field correctly", () => { | ||
expect(buildHeaderFields_1.buildHeaderFields(subtableFieldsJson.properties).includes(constants_1.PRIMARY_MARK)).toBe(true); | ||
expect(buildHeaderFields_1.buildHeaderFields(subtableFieldsJson.properties)).toHaveLength(18); | ||
}); | ||
it("should generate fieldCode array which doesn't contain unsupported fields", () => { | ||
expect(buildHeaderFields_1.buildHeaderFields(unsupportedFieldsJson.properties).includes("file")).toBe(false); | ||
expect(buildHeaderFields_1.buildHeaderFields(unsupportedFieldsJson.properties).includes("subTableFile")).toBe(false); | ||
expect(buildHeaderFields_1.buildHeaderFields(unsupportedFieldsJson.properties)).toHaveLength(5); | ||
}); | ||
}); | ||
//# sourceMappingURL=buildHeaderFields.test.js.map |
@@ -8,2 +8,4 @@ "use strict"; | ||
const subtableFieldsJson = require("./fixtures/subtable_fields.json"); | ||
const unsupportedRecords = require("./fixtures/unsupported_input.json"); | ||
const unsupportedFieldsJson = require("./fixtures/unsupported_fields.json"); | ||
describe("convertKintoneRecordsToCsv", () => { | ||
@@ -38,3 +40,13 @@ it("should convert kintone records to csv string correctly", () => { | ||
}); | ||
it("should convert kintone records to csv string correctly when unsupported fields included", () => { | ||
const expectedCsv = `"*","recordNumber","subTable","subTableText","singleLineText" | ||
*,"9","537306","text_line1","""single line text""" | ||
,"9","537307","text_line2","""single line text""" | ||
`; | ||
expect(convertKintoneRecordsToCsv_1.convertKintoneRecordsToCsv({ | ||
records: unsupportedRecords, | ||
fieldProperties: unsupportedFieldsJson.properties, | ||
})).toBe(expectedCsv); | ||
}); | ||
}); | ||
//# sourceMappingURL=convertKintoneRecordsToCsv.test.js.map |
@@ -24,2 +24,14 @@ "use strict"; | ||
]; | ||
const supportedFieldTypesInSubtable = [ | ||
"SINGLE_LINE_TEXT", | ||
"RADIO_BUTTON", | ||
"MULTI_LINE_TEXT", | ||
"NUMBER", | ||
"RICH_TEXT", | ||
"LINK", | ||
"DROP_DOWN", | ||
"CALC", | ||
"MULTI_SELECT", | ||
"CHECK_BOX", | ||
]; | ||
const buildHeaderFields = (fieldProperties) => { | ||
@@ -30,4 +42,7 @@ const fields = Object.keys(fieldProperties) | ||
const field = fieldProperties[fieldCode]; | ||
const fieldCodesInSubtable = field.type === "SUBTABLE" ? Object.keys(field.fields) : []; | ||
return ret.concat(fieldCode, ...fieldCodesInSubtable); | ||
if (field.type === "SUBTABLE") { | ||
const fieldCodesInSubtable = Object.keys(field.fields).filter((fieldCodeInSubtable) => supportedFieldTypesInSubtable.includes(field.fields[fieldCodeInSubtable].type)); | ||
return ret.concat(fieldCode, ...fieldCodesInSubtable); | ||
} | ||
return ret.concat(fieldCode); | ||
}, []); | ||
@@ -34,0 +49,0 @@ return hasSubtable_1.hasSubtable(fieldProperties) ? [constants_1.PRIMARY_MARK].concat(fields) : fields; |
{ | ||
"name": "@kintone/data-loader", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"publishConfig": { | ||
@@ -55,10 +55,10 @@ "access": "public" | ||
"cross-env": "^7.0.2", | ||
"pkg": "^5.2.1" | ||
"pkg": "^5.3.0" | ||
}, | ||
"dependencies": { | ||
"@kintone/rest-api-client": "^2.0.7", | ||
"@kintone/rest-api-client": "^2.0.8", | ||
"csv-parse": "^4.16.0", | ||
"yargs": "^17.0.1" | ||
}, | ||
"gitHead": "d4e541b4b23aee9c8725c79fac563813efd573a1" | ||
"gitHead": "9aeda9e9d89de320862a4c8b923907ab1c9e5123" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133298
1722