From 12da041db250f808c241da4496dde8c2d47714ac Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 11:38:44 -0800 Subject: [PATCH 01/13] some progress, need to add apphook support --- .../connect-react/src/components/ComponentForm.tsx | 1 + packages/connect-react/src/components/Control.tsx | 11 +++++++++-- .../connect-react/src/components/ControlInput.tsx | 7 +++++++ .../src/components/InternalComponentForm.tsx | 11 +++++++++-- .../connect-react/src/components/InternalField.tsx | 1 + packages/connect-react/src/hooks/form-context.tsx | 14 ++++++++++++-- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/packages/connect-react/src/components/ComponentForm.tsx b/packages/connect-react/src/components/ComponentForm.tsx index ae2672743ede8..4d6f7e649bf16 100644 --- a/packages/connect-react/src/components/ComponentForm.tsx +++ b/packages/connect-react/src/components/ComponentForm.tsx @@ -2,6 +2,7 @@ import { FormContextProvider, type FormContext, } from "../hooks/form-context"; import type { + ConfigurableProp, ConfigurableProps, ConfiguredProps, V1Component, diff --git a/packages/connect-react/src/components/Control.tsx b/packages/connect-react/src/components/Control.tsx index ba1c0ecddcc31..f44fe73ef5854 100644 --- a/packages/connect-react/src/components/Control.tsx +++ b/packages/connect-react/src/components/Control.tsx @@ -47,7 +47,7 @@ export function Control // TODO just look at registry component repo and look for what we should make sure we support // TODO deal with suspense stuff! if (prop.type.endsWith("[][]")) { - throw new Error("Unsupported property type: " + prop.type); + throw new Error("XXXXUnsupported property type: " + prop.type); } if (prop.type.endsWith("[]")) { @@ -56,6 +56,7 @@ export function Control }} />; } + debugger switch (prop.type) { // problem with this is that it should be the JSON value, but if it is at any point // not a valid json value, it should just be the string so the value is not lost... so it's just very odd @@ -68,10 +69,16 @@ export function Control return ; case "string": case "integer": + case "$.interface.timer": // XXX split into ControlString, ControlInteger, etc? but want to share autoComplet="off", etc functionality in base one return ; + + case "$.service.db": + case "$.interface.http": + break; default: // TODO "not supported prop type should bubble up" - throw new Error("Unsupported property type: " + prop.type); + console.log("helliow worldXXXXXXj"); + throw new Error("12/12Unsupported property type: " + prop.type); } } diff --git a/packages/connect-react/src/components/ControlInput.tsx b/packages/connect-react/src/components/ControlInput.tsx index 3bbf53a08bb81..d5b61f27de079 100644 --- a/packages/connect-react/src/components/ControlInput.tsx +++ b/packages/connect-react/src/components/ControlInput.tsx @@ -36,6 +36,13 @@ export function ControlInput() { ? parseInt(v) : undefined; break; + case "$.service.db": + case "$.interface.http": + inputType = "text"; + break; + case "$.interface.timer": + inputType = "number" + break; default: throw new Error("unexpected prop.type for ControlInput: " + prop.type); } diff --git a/packages/connect-react/src/components/InternalComponentForm.tsx b/packages/connect-react/src/components/InternalComponentForm.tsx index 7e22498929faa..9a2be532ed650 100644 --- a/packages/connect-react/src/components/InternalComponentForm.tsx +++ b/packages/connect-react/src/components/InternalComponentForm.tsx @@ -23,7 +23,7 @@ export function InternalComponentForm() { } = formContext; const { - hideOptionalProps, onSubmit, + hideOptionalProps, onSubmit } = formContextProps; const { @@ -52,16 +52,20 @@ export function InternalComponentForm() { }; const _onSubmit: FormEventHandler = async (e) => { + console.log("clicked") if (onSubmit) { e.preventDefault(); + console.log("in if, isValid == ", isValid) - if (isValid) { + if (isValid || true) { setSubmitting(true); try { await onSubmit(formContext); } finally { setSubmitting(false); } + } else { + console.log(" not valid :(") } } }; @@ -73,6 +77,9 @@ export function InternalComponentForm() { if (prop.hidden) { continue; } + if (["$.service.db", "$.interface.http"].includes(prop.type)) { + continue; + } if (prop.optional) { const enabled = optionalPropIsEnabled(prop); optionalProps.push([ diff --git a/packages/connect-react/src/components/InternalField.tsx b/packages/connect-react/src/components/InternalField.tsx index 047d714914891..9b7bfda669dc2 100644 --- a/packages/connect-react/src/components/InternalField.tsx +++ b/packages/connect-react/src/components/InternalField.tsx @@ -39,6 +39,7 @@ export function InternalField({ idx, value: configuredProps[prop.name], onChange(value) { + console.log("in internalfield onchange", idx, value) setConfiguredProp(idx, value); }, extra: { diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index 374203ca4d8fd..183cd35f605fe 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -59,6 +59,7 @@ export const FormContextProvider = ({ const client = useFrontendClient(); const id = useId(); + const skippable = ["$.service.db", "$.interface.http"] const { component, configuredProps: __configuredProps, propNames, userId, @@ -169,7 +170,8 @@ export const FormContextProvider = ({ const propErrors = (prop: ConfigurableProp, value: unknown): string[] => { const errs: string[] = []; if (value === undefined) { - if (!prop.optional) { + if (prop.optional || prop.hidden || skippable.includes(prop.type)) { + } else { errs.push("required"); } } else if (prop.type === "integer") { // XXX type should be "number"? we don't support floats otherwise... @@ -227,12 +229,14 @@ export const FormContextProvider = ({ const _errors: typeof errors = {}; for (let idx = 0; idx < configurableProps.length; idx++) { const prop = configurableProps[idx]; + console.log("prop: ", prop) const value = configuredProps[prop.name as keyof ConfiguredProps]; const errs = propErrors(prop, value); if (errs.length) { _errors[prop.name] = errs; } } + console.log("errors: ", _errors) setErrors(_errors); }; @@ -242,6 +246,9 @@ export const FormContextProvider = ({ if (prop.hidden) { continue; } + if (skippable.includes(prop.type)) { + continue; + } // if prop.optional and not shown, we skip and do on un-collapse if (prop.optional && !optionalPropIsEnabled(prop)) { continue; @@ -282,6 +289,8 @@ export const FormContextProvider = ({ // maybe should take prop as first arg but for text inputs didn't want to compute index each time const setConfiguredProp = (idx: number, value: unknown) => { + console.log("in set configureable prop") + console.log("configurableProps: ", configurableProps) const prop = configurableProps[idx]; const newConfiguredProps = { ...configuredProps, @@ -307,6 +316,7 @@ export const FormContextProvider = ({ } else { delete newErrors[prop.name]; } + console.log("newErrors: ", newErrors) setErrors(newErrors); }; @@ -331,7 +341,7 @@ export const FormContextProvider = ({ const checkPropsNeedConfiguring = () => { const _propsNeedConfiguring = [] for (const prop of configurableProps) { - if (!prop || prop.optional || prop.hidden) continue + if (!prop || prop.optional || prop.hidden || skippable.includes(prop.type)) continue const value = configuredProps[prop.name as keyof ConfiguredProps] const errors = propErrors(prop, value) if (errors.length) { From a200be9cc5c7dc7092faee4211366caf2a3f02e4 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 13:21:25 -0800 Subject: [PATCH 02/13] cleanup --- .../connect-react/src/components/ComponentForm.tsx | 1 - packages/connect-react/src/components/Control.tsx | 13 ++++++------- .../connect-react/src/components/ControlInput.tsx | 8 ++++---- .../src/components/InternalComponentForm.tsx | 12 ++++-------- .../connect-react/src/components/InternalField.tsx | 1 - packages/connect-react/src/hooks/form-context.tsx | 14 +++++--------- 6 files changed, 19 insertions(+), 30 deletions(-) diff --git a/packages/connect-react/src/components/ComponentForm.tsx b/packages/connect-react/src/components/ComponentForm.tsx index 4d6f7e649bf16..ae2672743ede8 100644 --- a/packages/connect-react/src/components/ComponentForm.tsx +++ b/packages/connect-react/src/components/ComponentForm.tsx @@ -2,7 +2,6 @@ import { FormContextProvider, type FormContext, } from "../hooks/form-context"; import type { - ConfigurableProp, ConfigurableProps, ConfiguredProps, V1Component, diff --git a/packages/connect-react/src/components/Control.tsx b/packages/connect-react/src/components/Control.tsx index f44fe73ef5854..3f51afd7eadb8 100644 --- a/packages/connect-react/src/components/Control.tsx +++ b/packages/connect-react/src/components/Control.tsx @@ -47,7 +47,7 @@ export function Control // TODO just look at registry component repo and look for what we should make sure we support // TODO deal with suspense stuff! if (prop.type.endsWith("[][]")) { - throw new Error("XXXXUnsupported property type: " + prop.type); + throw new Error("Unsupported property type: " + prop.type); } if (prop.type.endsWith("[]")) { @@ -56,7 +56,6 @@ export function Control }} />; } - debugger switch (prop.type) { // problem with this is that it should be the JSON value, but if it is at any point // not a valid json value, it should just be the string so the value is not lost... so it's just very odd @@ -73,12 +72,12 @@ export function Control // XXX split into ControlString, ControlInteger, etc? but want to share autoComplet="off", etc functionality in base one return ; - case "$.service.db": - case "$.interface.http": - break; + // TODO do we need these? + //case "$.service.db": + //case "$.interface.http": + // break; default: // TODO "not supported prop type should bubble up" - console.log("helliow worldXXXXXXj"); - throw new Error("12/12Unsupported property type: " + prop.type); + throw new Error("Unsupported property type: " + prop.type); } } diff --git a/packages/connect-react/src/components/ControlInput.tsx b/packages/connect-react/src/components/ControlInput.tsx index d5b61f27de079..c3c0d8de191d4 100644 --- a/packages/connect-react/src/components/ControlInput.tsx +++ b/packages/connect-react/src/components/ControlInput.tsx @@ -36,10 +36,10 @@ export function ControlInput() { ? parseInt(v) : undefined; break; - case "$.service.db": - case "$.interface.http": - inputType = "text"; - break; + //case "$.service.db": + //case "$.interface.http": + // inputType = "text"; + // break; case "$.interface.timer": inputType = "number" break; diff --git a/packages/connect-react/src/components/InternalComponentForm.tsx b/packages/connect-react/src/components/InternalComponentForm.tsx index 9a2be532ed650..c9928d3992a76 100644 --- a/packages/connect-react/src/components/InternalComponentForm.tsx +++ b/packages/connect-react/src/components/InternalComponentForm.tsx @@ -3,7 +3,7 @@ import type { CSSProperties, FormEventHandler, } from "react"; import { useCustomize } from "../hooks/customization-context"; -import { useFormContext } from "../hooks/form-context"; +import { useFormContext, skippablePropTypes } from "../hooks/form-context"; import { InternalField } from "./InternalField"; import { Alert } from "./Alert"; import { ErrorBoundary } from "./ErrorBoundary"; @@ -23,7 +23,7 @@ export function InternalComponentForm() { } = formContext; const { - hideOptionalProps, onSubmit + hideOptionalProps, onSubmit, } = formContextProps; const { @@ -52,20 +52,16 @@ export function InternalComponentForm() { }; const _onSubmit: FormEventHandler = async (e) => { - console.log("clicked") if (onSubmit) { e.preventDefault(); - console.log("in if, isValid == ", isValid) - if (isValid || true) { + if (isValid) { setSubmitting(true); try { await onSubmit(formContext); } finally { setSubmitting(false); } - } else { - console.log(" not valid :(") } } }; @@ -77,7 +73,7 @@ export function InternalComponentForm() { if (prop.hidden) { continue; } - if (["$.service.db", "$.interface.http"].includes(prop.type)) { + if (skippablePropTypes.includes(prop.type)) { continue; } if (prop.optional) { diff --git a/packages/connect-react/src/components/InternalField.tsx b/packages/connect-react/src/components/InternalField.tsx index 9b7bfda669dc2..047d714914891 100644 --- a/packages/connect-react/src/components/InternalField.tsx +++ b/packages/connect-react/src/components/InternalField.tsx @@ -39,7 +39,6 @@ export function InternalField({ idx, value: configuredProps[prop.name], onChange(value) { - console.log("in internalfield onchange", idx, value) setConfiguredProp(idx, value); }, extra: { diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index 183cd35f605fe..7cbe3f52051bc 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -34,6 +34,8 @@ export type FormContext = { userId: string; }; +export const skippablePropTypes = ["$.service.db", "$.interface.http", "$.interface.apphook"] + export const FormContext = createContext | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any export const useFormContext = () => { @@ -59,7 +61,6 @@ export const FormContextProvider = ({ const client = useFrontendClient(); const id = useId(); - const skippable = ["$.service.db", "$.interface.http"] const { component, configuredProps: __configuredProps, propNames, userId, @@ -170,7 +171,7 @@ export const FormContextProvider = ({ const propErrors = (prop: ConfigurableProp, value: unknown): string[] => { const errs: string[] = []; if (value === undefined) { - if (prop.optional || prop.hidden || skippable.includes(prop.type)) { + if (prop.optional || prop.hidden || skippablePropTypes.includes(prop.type)) { } else { errs.push("required"); } @@ -229,14 +230,12 @@ export const FormContextProvider = ({ const _errors: typeof errors = {}; for (let idx = 0; idx < configurableProps.length; idx++) { const prop = configurableProps[idx]; - console.log("prop: ", prop) const value = configuredProps[prop.name as keyof ConfiguredProps]; const errs = propErrors(prop, value); if (errs.length) { _errors[prop.name] = errs; } } - console.log("errors: ", _errors) setErrors(_errors); }; @@ -246,7 +245,7 @@ export const FormContextProvider = ({ if (prop.hidden) { continue; } - if (skippable.includes(prop.type)) { + if (skippablePropTypes.includes(prop.type)) { continue; } // if prop.optional and not shown, we skip and do on un-collapse @@ -289,8 +288,6 @@ export const FormContextProvider = ({ // maybe should take prop as first arg but for text inputs didn't want to compute index each time const setConfiguredProp = (idx: number, value: unknown) => { - console.log("in set configureable prop") - console.log("configurableProps: ", configurableProps) const prop = configurableProps[idx]; const newConfiguredProps = { ...configuredProps, @@ -316,7 +313,6 @@ export const FormContextProvider = ({ } else { delete newErrors[prop.name]; } - console.log("newErrors: ", newErrors) setErrors(newErrors); }; @@ -341,7 +337,7 @@ export const FormContextProvider = ({ const checkPropsNeedConfiguring = () => { const _propsNeedConfiguring = [] for (const prop of configurableProps) { - if (!prop || prop.optional || prop.hidden || skippable.includes(prop.type)) continue + if (!prop || prop.optional || prop.hidden || skippablePropTypes.includes(prop.type)) continue const value = configuredProps[prop.name as keyof ConfiguredProps] const errors = propErrors(prop, value) if (errors.length) { From 34567a21222ddecfa525db72b8472638c1516152 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 13:29:56 -0800 Subject: [PATCH 03/13] . --- pnpm-lock.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 16f96130ec058..dcdb910c91276 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7620,8 +7620,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/pingone: - specifiers: {} + components/pingone: {} components/pingrabbit: {} From cb00845e4cde8655a1d35926cca7163a427ff9e0 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 13:38:25 -0800 Subject: [PATCH 04/13] remove --- packages/connect-react/src/components/Control.tsx | 5 ----- packages/connect-react/src/components/ControlInput.tsx | 4 ---- 2 files changed, 9 deletions(-) diff --git a/packages/connect-react/src/components/Control.tsx b/packages/connect-react/src/components/Control.tsx index 3f51afd7eadb8..b871144aa85ef 100644 --- a/packages/connect-react/src/components/Control.tsx +++ b/packages/connect-react/src/components/Control.tsx @@ -71,11 +71,6 @@ export function Control case "$.interface.timer": // XXX split into ControlString, ControlInteger, etc? but want to share autoComplet="off", etc functionality in base one return ; - - // TODO do we need these? - //case "$.service.db": - //case "$.interface.http": - // break; default: // TODO "not supported prop type should bubble up" throw new Error("Unsupported property type: " + prop.type); diff --git a/packages/connect-react/src/components/ControlInput.tsx b/packages/connect-react/src/components/ControlInput.tsx index c3c0d8de191d4..8820209afb826 100644 --- a/packages/connect-react/src/components/ControlInput.tsx +++ b/packages/connect-react/src/components/ControlInput.tsx @@ -36,10 +36,6 @@ export function ControlInput() { ? parseInt(v) : undefined; break; - //case "$.service.db": - //case "$.interface.http": - // inputType = "text"; - // break; case "$.interface.timer": inputType = "number" break; From 2fe629e800a730dcbe4c4546228f69d47256e9fe Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 13:48:06 -0800 Subject: [PATCH 05/13] linting --- packages/connect-react/src/components/Control.tsx | 5 ++++- .../src/components/InternalComponentForm.tsx | 5 ++++- packages/connect-react/src/hooks/form-context.tsx | 9 ++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/connect-react/src/components/Control.tsx b/packages/connect-react/src/components/Control.tsx index b871144aa85ef..b4e33fc1e9b54 100644 --- a/packages/connect-react/src/components/Control.tsx +++ b/packages/connect-react/src/components/Control.tsx @@ -1,6 +1,9 @@ import { FormContext } from "../hooks/form-context"; import { FormFieldContext } from "../hooks/form-field-context"; -import { ConfigurableProp, ConfigurableProps } from "@pipedream/sdk"; +import { + ConfigurableProp, + ConfigurableProps, +} from "@pipedream/sdk"; // import { ControlAny } from "./ControlAny" import { ControlApp } from "./ControlApp"; import { ControlBoolean } from "./ControlBoolean"; diff --git a/packages/connect-react/src/components/InternalComponentForm.tsx b/packages/connect-react/src/components/InternalComponentForm.tsx index c9928d3992a76..e890b79adc869 100644 --- a/packages/connect-react/src/components/InternalComponentForm.tsx +++ b/packages/connect-react/src/components/InternalComponentForm.tsx @@ -3,7 +3,10 @@ import type { CSSProperties, FormEventHandler, } from "react"; import { useCustomize } from "../hooks/customization-context"; -import { useFormContext, skippablePropTypes } from "../hooks/form-context"; +import { + useFormContext, + skippablePropTypes, +} from "../hooks/form-context"; import { InternalField } from "./InternalField"; import { Alert } from "./Alert"; import { ErrorBoundary } from "./ErrorBoundary"; diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index 7cbe3f52051bc..fdf9706c89040 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -34,7 +34,11 @@ export type FormContext = { userId: string; }; -export const skippablePropTypes = ["$.service.db", "$.interface.http", "$.interface.apphook"] +export const skippablePropTypes = [ + "$.service.db", + "$.interface.http", + "$.interface.apphook", +] export const FormContext = createContext | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any @@ -171,8 +175,7 @@ export const FormContextProvider = ({ const propErrors = (prop: ConfigurableProp, value: unknown): string[] => { const errs: string[] = []; if (value === undefined) { - if (prop.optional || prop.hidden || skippablePropTypes.includes(prop.type)) { - } else { + if (!prop.optional && !prop.hidden && !skippablePropTypes.includes(prop.type)) { errs.push("required"); } } else if (prop.type === "integer") { // XXX type should be "number"? we don't support floats otherwise... From c36e527e24645ac1a5d16551e125becd1c3bb270 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 16:48:46 -0800 Subject: [PATCH 06/13] package.json --- packages/connect-react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect-react/package.json b/packages/connect-react/package.json index 8b8207854ccd8..150af2804d8e9 100644 --- a/packages/connect-react/package.json +++ b/packages/connect-react/package.json @@ -27,13 +27,13 @@ "author": "Pipedream Engineering", "license": "MIT", "dependencies": { - "@pipedream/sdk": "workspace:^", "@tanstack/react-query": "^5.59.16", "lodash.isequal": "^4.5.0", "react-markdown": "^9.0.1", "react-select": "^5.8.2" }, "devDependencies": { + "@pipedream/sdk": "workspace:^", "@emotion/react": "^11.13.5", "@types/lodash.isequal": "^4.5.8", "@types/react": "^18.3.12", From 9afd627ed83c288dda1d5de8954447cb2b002096 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Fri, 13 Dec 2024 16:49:35 -0800 Subject: [PATCH 07/13] lock --- pnpm-lock.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dcdb910c91276..4f4094cf6864b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12220,9 +12220,6 @@ importers: packages/connect-react: dependencies: - '@pipedream/sdk': - specifier: workspace:^ - version: link:../sdk '@tanstack/react-query': specifier: ^5.59.16 version: 5.61.0(react@18.3.1) @@ -12245,6 +12242,9 @@ importers: '@emotion/react': specifier: ^11.13.5 version: 11.13.5(@types/react@18.3.12)(react@18.3.1) + '@pipedream/sdk': + specifier: workspace:^ + version: link:../sdk '@types/lodash.isequal': specifier: ^4.5.8 version: 4.5.8 @@ -30152,7 +30152,6 @@ snapshots: '@pipedream/connect-react@file:packages/connect-react(@types/react@18.3.12)(react-dom@19.0.0-rc-66855b96-20241106(react@19.0.0-rc-66855b96-20241106))(react@19.0.0-rc-66855b96-20241106)': dependencies: - '@pipedream/sdk': link:packages/sdk '@tanstack/react-query': 5.61.0(react@19.0.0-rc-66855b96-20241106) lodash.isequal: 4.5.0 react: 19.0.0-rc-66855b96-20241106 From 20f2cec3e569cf7ed18167a400e02360265aa320 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Mon, 16 Dec 2024 14:23:17 -0800 Subject: [PATCH 08/13] add timer to skips for now --- packages/connect-react/src/hooks/form-context.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index fdf9706c89040..cb1a32f4c9754 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -37,7 +37,8 @@ export type FormContext = { export const skippablePropTypes = [ "$.service.db", "$.interface.http", - "$.interface.apphook", + "$.interface.timer", // TODO add support for this (cron string and timers) + "$.interface.apphook", // TODO can remove this when the api supports external users on these types of triggers ] export const FormContext = createContext | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any From 505464b64dc8336638ab17b0bc18f010da26014b Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Tue, 17 Dec 2024 11:14:36 -0800 Subject: [PATCH 09/13] don't need to remove apphook --- packages/connect-react/src/hooks/form-context.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index cb1a32f4c9754..838aadc882749 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -37,8 +37,8 @@ export type FormContext = { export const skippablePropTypes = [ "$.service.db", "$.interface.http", + "$.interface.apphook", "$.interface.timer", // TODO add support for this (cron string and timers) - "$.interface.apphook", // TODO can remove this when the api supports external users on these types of triggers ] export const FormContext = createContext | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any From 055b08a1a6d417aa3fdf5eaf584347aaf00de608 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Tue, 17 Dec 2024 11:43:08 -0800 Subject: [PATCH 10/13] changelog and package.json updates --- packages/connect-react/CHANGELOG.md | 4 ++++ packages/connect-react/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/connect-react/CHANGELOG.md b/packages/connect-react/CHANGELOG.md index 288a41af258bc..e59e25cbe6a9a 100644 --- a/packages/connect-react/CHANGELOG.md +++ b/packages/connect-react/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog +# [1.0.0-preview.13] - 2024-12-17 + +- Added skippable prop types to support triggers + # [1.0.0-preview.12] - 2024-12-13 - Don't throw when validating unexpected values from the api diff --git a/packages/connect-react/package.json b/packages/connect-react/package.json index 8def60b12f66c..8a7bbe3a6e202 100644 --- a/packages/connect-react/package.json +++ b/packages/connect-react/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/connect-react", - "version": "1.0.0-preview.12", + "version": "1.0.0-preview.13", "description": "Pipedream Connect library for React", "files": [ "dist" From e84c345a7b74ed5becdbb97b5bb544f8109ac5ff Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Tue, 17 Dec 2024 11:55:33 -0800 Subject: [PATCH 11/13] Don't need this since we're punting on the timer control for now --- packages/connect-react/src/components/Control.tsx | 1 - packages/connect-react/src/components/ControlInput.tsx | 3 --- 2 files changed, 4 deletions(-) diff --git a/packages/connect-react/src/components/Control.tsx b/packages/connect-react/src/components/Control.tsx index b4e33fc1e9b54..23007e459a417 100644 --- a/packages/connect-react/src/components/Control.tsx +++ b/packages/connect-react/src/components/Control.tsx @@ -71,7 +71,6 @@ export function Control return ; case "string": case "integer": - case "$.interface.timer": // XXX split into ControlString, ControlInteger, etc? but want to share autoComplet="off", etc functionality in base one return ; default: diff --git a/packages/connect-react/src/components/ControlInput.tsx b/packages/connect-react/src/components/ControlInput.tsx index 8820209afb826..3bbf53a08bb81 100644 --- a/packages/connect-react/src/components/ControlInput.tsx +++ b/packages/connect-react/src/components/ControlInput.tsx @@ -36,9 +36,6 @@ export function ControlInput() { ? parseInt(v) : undefined; break; - case "$.interface.timer": - inputType = "number" - break; default: throw new Error("unexpected prop.type for ControlInput: " + prop.type); } From 91ae94a1a0501d9ffb221653de3272c5ae361a17 Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Tue, 17 Dec 2024 12:04:13 -0800 Subject: [PATCH 12/13] fix --- packages/connect-react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect-react/package.json b/packages/connect-react/package.json index 8a7bbe3a6e202..3e68e075c80e9 100644 --- a/packages/connect-react/package.json +++ b/packages/connect-react/package.json @@ -27,13 +27,13 @@ "author": "Pipedream Engineering", "license": "MIT", "dependencies": { + "@pipedream/sdk": "workspace:^", "@tanstack/react-query": "^5.59.16", "lodash.isequal": "^4.5.0", "react-markdown": "^9.0.1", "react-select": "^5.8.2" }, "devDependencies": { - "@pipedream/sdk": "workspace:^", "@emotion/react": "^11.13.5", "@types/lodash.isequal": "^4.5.8", "@types/react": "^18.3.12", From 9b4beca44fc28931600512c6b32d596819c8af4e Mon Sep 17 00:00:00 2001 From: Jason Endo Date: Tue, 17 Dec 2024 12:05:28 -0800 Subject: [PATCH 13/13] lock --- pnpm-lock.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7dfd1c8b0494a..7607758c92be1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12254,6 +12254,9 @@ importers: packages/connect-react: dependencies: + '@pipedream/sdk': + specifier: workspace:^ + version: link:../sdk '@tanstack/react-query': specifier: ^5.59.16 version: 5.61.0(react@18.3.1) @@ -12276,9 +12279,6 @@ importers: '@emotion/react': specifier: ^11.13.5 version: 11.13.5(@types/react@18.3.12)(react@18.3.1) - '@pipedream/sdk': - specifier: workspace:^ - version: link:../sdk '@types/lodash.isequal': specifier: ^4.5.8 version: 4.5.8 @@ -30186,6 +30186,7 @@ snapshots: '@pipedream/connect-react@file:packages/connect-react(@types/react@18.3.12)(react-dom@19.0.0-rc-66855b96-20241106(react@19.0.0-rc-66855b96-20241106))(react@19.0.0-rc-66855b96-20241106)': dependencies: + '@pipedream/sdk': link:packages/sdk '@tanstack/react-query': 5.61.0(react@19.0.0-rc-66855b96-20241106) lodash.isequal: 4.5.0 react: 19.0.0-rc-66855b96-20241106