kintone-migrator 0.35.8 → 0.35.9
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/dist/index.mjs +15 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1386,16 +1386,6 @@ function sanitizeForDisplay$1(s) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
//#endregion
|
|
1388
1388
|
//#region src/core/domain/formSchema/valueObject.ts
|
|
1389
|
-
const LookupRelatedApp = {
|
|
1390
|
-
/**
|
|
1391
|
-
* kintone returns `code: ""` for a related app without an app code, while a
|
|
1392
|
-
* schema leaves `code` out for the same app. Both build a related app
|
|
1393
|
-
* without `code`, so only a non-empty `code` is kept.
|
|
1394
|
-
*/
|
|
1395
|
-
create: (app, code) => code === void 0 || code === "" ? { app } : {
|
|
1396
|
-
app,
|
|
1397
|
-
code
|
|
1398
|
-
} };
|
|
1399
1389
|
function hasInvalidFieldCodeChars(code) {
|
|
1400
1390
|
if (hasControlChars(code)) return true;
|
|
1401
1391
|
for (let i = 0; i < code.length; i++) {
|
|
@@ -1500,12 +1490,15 @@ function readKintoneQueryClause(value, fieldPath) {
|
|
|
1500
1490
|
assertString(value, fieldPath);
|
|
1501
1491
|
return value;
|
|
1502
1492
|
}
|
|
1493
|
+
/** Reads `relatedApp` by its app ID; the returned `code` is dropped. */
|
|
1494
|
+
function fromKintoneRelatedApp(value, fieldPath) {
|
|
1495
|
+
assertRecord(value, fieldPath);
|
|
1496
|
+
assertString(value.app, `${fieldPath}.app`);
|
|
1497
|
+
return { app: value.app };
|
|
1498
|
+
}
|
|
1503
1499
|
function fromKintoneLookup(value, fieldPath) {
|
|
1504
1500
|
assertRecord(value, fieldPath);
|
|
1505
|
-
|
|
1506
|
-
const { app, code } = value.relatedApp;
|
|
1507
|
-
assertString(app, `${fieldPath}.relatedApp.app`);
|
|
1508
|
-
if (code !== void 0) assertString(code, `${fieldPath}.relatedApp.code`);
|
|
1501
|
+
const relatedApp = fromKintoneRelatedApp(value.relatedApp, `${fieldPath}.relatedApp`);
|
|
1509
1502
|
assertString(value.relatedKeyField, `${fieldPath}.relatedKeyField`);
|
|
1510
1503
|
const fieldMappings = readKintoneLookupList(value.fieldMappings, `${fieldPath}.fieldMappings`).map((mapping, i) => {
|
|
1511
1504
|
const mappingPath = `${fieldPath}.fieldMappings[${i}]`;
|
|
@@ -1520,7 +1513,7 @@ function fromKintoneLookup(value, fieldPath) {
|
|
|
1520
1513
|
const lookupPickerFields = readKintoneLookupList(value.lookupPickerFields, `${fieldPath}.lookupPickerFields`);
|
|
1521
1514
|
assertStringArray(lookupPickerFields, `${fieldPath}.lookupPickerFields`);
|
|
1522
1515
|
return {
|
|
1523
|
-
relatedApp
|
|
1516
|
+
relatedApp,
|
|
1524
1517
|
relatedKeyField: value.relatedKeyField,
|
|
1525
1518
|
fieldMappings,
|
|
1526
1519
|
lookupPickerFields,
|
|
@@ -1558,13 +1551,11 @@ function fromKintoneProperty(prop) {
|
|
|
1558
1551
|
assertString(condition.relatedField, "REFERENCE_TABLE.referenceTable.condition.relatedField");
|
|
1559
1552
|
assertStringArray(rt.displayFields, "REFERENCE_TABLE.referenceTable.displayFields");
|
|
1560
1553
|
const displayFields = rt.displayFields.map((f) => FieldCode.create(f));
|
|
1561
|
-
assertRecord(rt.relatedApp, "REFERENCE_TABLE.referenceTable.relatedApp");
|
|
1562
|
-
assertString(rt.relatedApp.app, "REFERENCE_TABLE.referenceTable.relatedApp.app");
|
|
1563
1554
|
return {
|
|
1564
1555
|
...base,
|
|
1565
1556
|
type: "REFERENCE_TABLE",
|
|
1566
1557
|
properties: { referenceTable: {
|
|
1567
|
-
relatedApp:
|
|
1558
|
+
relatedApp: fromKintoneRelatedApp(rt.relatedApp, "REFERENCE_TABLE.referenceTable.relatedApp"),
|
|
1568
1559
|
condition: {
|
|
1569
1560
|
field: FieldCode.create(condition.field),
|
|
1570
1561
|
relatedField: FieldCode.create(condition.relatedField)
|
|
@@ -6335,6 +6326,10 @@ function optionalLookupList(code, key, value) {
|
|
|
6335
6326
|
if (list === void 0) throw invalidLookup(code, `must have a "${key}" array`);
|
|
6336
6327
|
return list;
|
|
6337
6328
|
}
|
|
6329
|
+
/** Reads `relatedApp` by its app ID; a written `code` is dropped. */
|
|
6330
|
+
function parseRelatedApp(raw) {
|
|
6331
|
+
return { app: String(raw.app ?? "") };
|
|
6332
|
+
}
|
|
6338
6333
|
function parseLookup(code, raw) {
|
|
6339
6334
|
if (!isRecord(raw)) throw invalidLookup(code, "must be an object");
|
|
6340
6335
|
if (!isRecord(raw.relatedApp)) throw invalidLookup(code, "must have a \"relatedApp\" object");
|
|
@@ -6348,7 +6343,7 @@ function parseLookup(code, raw) {
|
|
|
6348
6343
|
};
|
|
6349
6344
|
});
|
|
6350
6345
|
return {
|
|
6351
|
-
relatedApp:
|
|
6346
|
+
relatedApp: parseRelatedApp(raw.relatedApp),
|
|
6352
6347
|
relatedKeyField: String(raw.relatedKeyField ?? ""),
|
|
6353
6348
|
fieldMappings,
|
|
6354
6349
|
lookupPickerFields,
|
|
@@ -6364,7 +6359,6 @@ function parseReferenceTableField(raw, code, base) {
|
|
|
6364
6359
|
if (!Array.isArray(refTable.displayFields)) throw new BusinessRuleError(FormSchemaErrorCode.FsInvalidSchemaStructure, `Field "${code}" of type REFERENCE_TABLE must have "referenceTable.displayFields" array`);
|
|
6365
6360
|
const condition = refTable.condition;
|
|
6366
6361
|
const displayFields = refTable.displayFields.map((f) => FieldCode.create(f));
|
|
6367
|
-
const relatedApp = refTable.relatedApp;
|
|
6368
6362
|
const conditionField = String(condition.field ?? "");
|
|
6369
6363
|
const conditionRelatedField = String(condition.relatedField ?? "");
|
|
6370
6364
|
const size = optionalString(refTable.size);
|
|
@@ -6374,7 +6368,7 @@ function parseReferenceTableField(raw, code, base) {
|
|
|
6374
6368
|
...base,
|
|
6375
6369
|
type: "REFERENCE_TABLE",
|
|
6376
6370
|
properties: { referenceTable: {
|
|
6377
|
-
relatedApp:
|
|
6371
|
+
relatedApp: parseRelatedApp(refTable.relatedApp),
|
|
6378
6372
|
condition: {
|
|
6379
6373
|
field: FieldCode.create(conditionField),
|
|
6380
6374
|
relatedField: FieldCode.create(conditionRelatedField)
|