From 54f8b3997438f284b85d6c4b23fd4c90449670d9 Mon Sep 17 00:00:00 2001 From: Carl Brugger Date: Mon, 6 Nov 2023 17:40:16 -0600 Subject: [PATCH] fix: JSON schema plugin changeset --- .changeset/cyan-oranges-care.md | 2 +- package-lock.json | 2 +- plugins/json-schema/src/setup.factory.ts | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.changeset/cyan-oranges-care.md b/.changeset/cyan-oranges-care.md index 0fe4f9136..81cbd4a94 100644 --- a/.changeset/cyan-oranges-care.md +++ b/.changeset/cyan-oranges-care.md @@ -1,5 +1,5 @@ --- -'@flatfile/plugin-json-schema': patch +'@flatfile/plugin-convert-json-schema': patch --- Introducting the @flatfile/plugin-convert-json-schema plugin to configure a Flatfile Space based on a provided JSON Schema. diff --git a/package-lock.json b/package-lock.json index 0ea09c876..94132e31a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11325,7 +11325,7 @@ }, "plugins/record-hook": { "name": "@flatfile/plugin-record-hook", - "version": "1.1.10", + "version": "1.1.11", "license": "ISC", "dependencies": { "@flatfile/api": "^1.5.34", diff --git a/plugins/json-schema/src/setup.factory.ts b/plugins/json-schema/src/setup.factory.ts index 40805373a..089db551b 100644 --- a/plugins/json-schema/src/setup.factory.ts +++ b/plugins/json-schema/src/setup.factory.ts @@ -56,8 +56,15 @@ export async function generateSetup( export async function generateFields(data: any): Promise { if (!data.properties) return [] - const url = new URL(data.$id) - const origin = url.origin + const getOrigin = (url: string) => { + try { + const url = new URL(data.$id) + return url.origin + } catch (error) { + return '' + } + } + const origin = getOrigin(data.$id) const fields = await Promise.all( Object.keys(data.properties).map((key) =>