@backmatter/core 0.0.31 → 0.0.32

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/model.ts +0 -38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backmatter/core",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Experimental Backmatter SDK. APIs will break. Not ready for production.",
5
5
  "type": "module",
6
6
  "publishConfig": {
package/src/model.ts CHANGED
@@ -257,45 +257,7 @@ export function serializeSchema(
257
257
  return snapshot;
258
258
  }
259
259
 
260
- /** Remove `{locale}` path/route segments from rows stored before locale removal. */
261
- export function stripLocaleTemplateSegments(template: string): string {
262
- return template.split("/").filter((part) => part !== "{locale}").join("/");
263
- }
264
-
265
- function migrateLegacySchemaInput(input: unknown): unknown {
266
- if (!input || typeof input !== "object") return input;
267
- const value = input as Record<string, unknown>;
268
- if (!Array.isArray(value.models)) return input;
269
- return {
270
- ...value,
271
- models: value.models.map((raw) => {
272
- if (!raw || typeof raw !== "object") return raw;
273
- const model = raw as Record<string, unknown>;
274
- const next: Record<string, unknown> = { ...model };
275
- if (typeof model.path === "string") {
276
- next.path = stripLocaleTemplateSegments(model.path);
277
- }
278
- if (typeof model.route === "string") {
279
- next.route = stripLocaleTemplateSegments(model.route);
280
- }
281
- if (model.fields && typeof model.fields === "object" && !Array.isArray(model.fields)) {
282
- const fields = { ...(model.fields as Record<string, unknown>) };
283
- for (const [key, snap] of Object.entries(fields)) {
284
- const kind =
285
- snap && typeof snap === "object"
286
- ? (snap as { kind?: string }).kind
287
- : undefined;
288
- if (kind === "locale") delete fields[key];
289
- }
290
- next.fields = fields;
291
- }
292
- return next;
293
- }),
294
- };
295
- }
296
-
297
260
  export function parseSchemaSnapshot(input: unknown): SchemaSnapshot {
298
- input = migrateLegacySchemaInput(input);
299
261
  if (!input || typeof input !== "object") {
300
262
  throw new Error("schema must be an object");
301
263
  }