@interactive-inc/docs-client 0.0.8 → 0.0.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/build/index.d.ts +4 -0
- package/build/index.js +26 -10
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -1348,9 +1348,9 @@ var DocSchemaFieldFactory = class {
|
|
|
1348
1348
|
const baseField = {
|
|
1349
1349
|
type: normalizedType,
|
|
1350
1350
|
required: fieldRequired ?? false,
|
|
1351
|
-
title: fieldTitle,
|
|
1352
|
-
description: fieldDescription,
|
|
1353
|
-
default: fieldDefault
|
|
1351
|
+
title: fieldTitle ?? null,
|
|
1352
|
+
description: fieldDescription ?? null,
|
|
1353
|
+
default: fieldDefault ?? null
|
|
1354
1354
|
};
|
|
1355
1355
|
return {
|
|
1356
1356
|
...baseField,
|
|
@@ -1364,9 +1364,9 @@ var DocSchemaFieldFactory = class {
|
|
|
1364
1364
|
return {
|
|
1365
1365
|
type: "text",
|
|
1366
1366
|
required: false,
|
|
1367
|
-
title:
|
|
1368
|
-
description:
|
|
1369
|
-
default:
|
|
1367
|
+
title: null,
|
|
1368
|
+
description: null,
|
|
1369
|
+
default: null
|
|
1370
1370
|
};
|
|
1371
1371
|
}
|
|
1372
1372
|
/**
|
|
@@ -2109,9 +2109,10 @@ import { parse as parse2, stringify as stringify3 } from "yaml";
|
|
|
2109
2109
|
|
|
2110
2110
|
// lib/values/doc-schema-value.ts
|
|
2111
2111
|
var DocSchemaValue = class _DocSchemaValue {
|
|
2112
|
+
value;
|
|
2112
2113
|
constructor(value) {
|
|
2113
|
-
this.value = value;
|
|
2114
|
-
zDocSchema.parse(value);
|
|
2114
|
+
this.value = _DocSchemaValue.normalizeSchema(value);
|
|
2115
|
+
zDocSchema.parse(this.value);
|
|
2115
2116
|
Object.freeze(this.value);
|
|
2116
2117
|
Object.freeze(this);
|
|
2117
2118
|
}
|
|
@@ -2130,7 +2131,7 @@ var DocSchemaValue = class _DocSchemaValue {
|
|
|
2130
2131
|
return null;
|
|
2131
2132
|
}
|
|
2132
2133
|
const factory = new DocSchemaFieldFactory();
|
|
2133
|
-
return factory.
|
|
2134
|
+
return factory.fromUnknown(name, fieldDef);
|
|
2134
2135
|
}
|
|
2135
2136
|
get fields() {
|
|
2136
2137
|
const factory = new DocSchemaFieldFactory();
|
|
@@ -2139,7 +2140,7 @@ var DocSchemaValue = class _DocSchemaValue {
|
|
|
2139
2140
|
if (!fieldValue) {
|
|
2140
2141
|
throw new Error(`Field ${name} not found in schema`);
|
|
2141
2142
|
}
|
|
2142
|
-
return factory.
|
|
2143
|
+
return factory.fromUnknown(name, fieldValue);
|
|
2143
2144
|
});
|
|
2144
2145
|
}
|
|
2145
2146
|
get relationFields() {
|
|
@@ -2351,6 +2352,21 @@ var DocSchemaValue = class _DocSchemaValue {
|
|
|
2351
2352
|
toJson() {
|
|
2352
2353
|
return this.value;
|
|
2353
2354
|
}
|
|
2355
|
+
/**
|
|
2356
|
+
* スキーマを正規化
|
|
2357
|
+
*/
|
|
2358
|
+
static normalizeSchema(schema) {
|
|
2359
|
+
const normalized = {};
|
|
2360
|
+
const factory = new DocSchemaFieldFactory();
|
|
2361
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
2362
|
+
try {
|
|
2363
|
+
const normalizedField = factory.fromUnknown(key, field);
|
|
2364
|
+
normalized[key] = normalizedField.toJson();
|
|
2365
|
+
} catch {
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
return normalized;
|
|
2369
|
+
}
|
|
2354
2370
|
};
|
|
2355
2371
|
|
|
2356
2372
|
// lib/values/doc-front-matter-index-value.ts
|