@wfgraph/plugins 0.3.0 → 2.0.0

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.
@@ -1,4 +1,4 @@
1
- import { i as readTwilioError, n as describeTwilioFailure, r as fetchTwilioAccount } from "./client-DJGI9f53.js";
1
+ import { i as readTwilioError, n as describeTwilioFailure, r as fetchTwilioAccount } from "./client-LRwmIiPU.js";
2
2
  import { callExternalAsync } from "@wfgraph/core/plugin";
3
3
  //#region src/twilio/test.ts
4
4
  async function testTwilio(credentials) {
package/dist/ui.d.ts CHANGED
@@ -1,9 +1,4 @@
1
1
  import { ComponentType } from "react";
2
- //#region src/acuity/icon.d.ts
3
- declare function AcuityIcon({ className }: {
4
- className?: string;
5
- }): import("react").JSX.Element;
6
- //#endregion
7
2
  //#region src/clerk/components/user-card.d.ts
8
3
  declare function UserCard({ output }: ResultComponentProps): import("react").JSX.Element | null;
9
4
  //#endregion
@@ -45,9 +40,6 @@ type IntegrationUi = {
45
40
  outputComponents?: Record<string, ComponentType<ResultComponentProps>>;
46
41
  };
47
42
  declare const integrationUi: {
48
- acuity: {
49
- icon: typeof AcuityIcon;
50
- };
51
43
  clerk: {
52
44
  icon: typeof ClerkIcon;
53
45
  outputComponents: {
package/dist/ui.js CHANGED
@@ -2,6 +2,29 @@ import { Option, Schema, SchemaTransformation } from "effect";
2
2
  import { compact } from "es-toolkit/array";
3
3
  //#region \0rolldown/runtime.js
4
4
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
5
+ Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.trim())).check(Schema.isMinLength(1));
6
+ Schema.Record(Schema.String, Schema.Unknown);
7
+ /**
8
+ * Reads a value that arrived from outside the program, answering `undefined`
9
+ * when it is not what `schema` describes.
10
+ *
11
+ * This is the repo's replacement for Zod's `.catch(undefined)`. Effect Schema
12
+ * has no such combinator on a struct field, and a struct is the wrong tool for
13
+ * a hostile document anyway: `Schema.Struct` looks a key up with `Object.hasOwn`,
14
+ * so a member an SDK error class defines as a prototype getter is invisible to
15
+ * it, and one wrong-typed field sinks the decode of every sibling beside it.
16
+ * Reading one leaf at a time fixes both; `getErrorMessage` in `utils.ts` walks a
17
+ * thrown value that way and finishes each walk here.
18
+ *
19
+ * `undefined` is this function's answer for "not what the schema describes", so
20
+ * a schema that admits `undefined` as a value would make a successful read
21
+ * indistinguishable from a failed one. The parameter type turns such a schema
22
+ * away where it is written rather than letting the collapse happen at runtime.
23
+ */
24
+ function readAs(schema) {
25
+ const decode = Schema.decodeUnknownOption(schema);
26
+ return (value) => Option.getOrUndefined(decode(value));
27
+ }
5
28
  //#endregion
6
29
  //#region ../../node_modules/.pnpm/react@19.2.8/node_modules/react/cjs/react-jsx-runtime.production.js
7
30
  /**
@@ -1378,69 +1401,11 @@ var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((expo
1378
1401
  })();
1379
1402
  }));
1380
1403
  //#endregion
1381
- //#region src/acuity/icon.tsx
1404
+ //#region src/clerk/components/user-card.tsx
1382
1405
  var import_jsx_runtime = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
1383
1406
  if (process.env.NODE_ENV === "production") module.exports = require_react_jsx_runtime_production();
1384
1407
  else module.exports = require_react_jsx_runtime_development();
1385
1408
  })))();
1386
- function AcuityIcon({ className }) {
1387
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
1388
- "aria-hidden": "true",
1389
- className,
1390
- fill: "none",
1391
- viewBox: "0 0 24 24",
1392
- xmlns: "http://www.w3.org/2000/svg",
1393
- children: [
1394
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
1395
- height: "17",
1396
- rx: "3",
1397
- stroke: "currentColor",
1398
- strokeWidth: "1.8",
1399
- width: "18",
1400
- x: "3",
1401
- y: "4"
1402
- }),
1403
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
1404
- d: "M8 2.8v3.4M16 2.8v3.4M3.8 9.2h16.4",
1405
- stroke: "currentColor",
1406
- strokeLinecap: "round",
1407
- strokeWidth: "1.8"
1408
- }),
1409
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
1410
- d: "M12 13.2 10.2 16h3.6L12 13.2ZM9.4 13.2H7.9L10.6 9h2.8l2.7 4.2h-1.5",
1411
- stroke: "currentColor",
1412
- strokeLinecap: "round",
1413
- strokeLinejoin: "round",
1414
- strokeWidth: "1.5"
1415
- })
1416
- ]
1417
- });
1418
- }
1419
- Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.trim())).check(Schema.isMinLength(1));
1420
- Schema.Record(Schema.String, Schema.Unknown);
1421
- /**
1422
- * Reads a value that arrived from outside the program, answering `undefined`
1423
- * when it is not what `schema` describes.
1424
- *
1425
- * This is the repo's replacement for Zod's `.catch(undefined)`. Effect Schema
1426
- * has no such combinator on a struct field, and a struct is the wrong tool for
1427
- * a hostile document anyway: `Schema.Struct` looks a key up with `Object.hasOwn`,
1428
- * so a member an SDK error class defines as a prototype getter is invisible to
1429
- * it, and one wrong-typed field sinks the decode of every sibling beside it.
1430
- * Reading one leaf at a time fixes both; `getErrorMessage` in `utils.ts` walks a
1431
- * thrown value that way and finishes each walk here.
1432
- *
1433
- * `undefined` is this function's answer for "not what the schema describes", so
1434
- * a schema that admits `undefined` as a value would make a successful read
1435
- * indistinguishable from a failed one. The parameter type turns such a schema
1436
- * away where it is written rather than letting the collapse happen at runtime.
1437
- */
1438
- function readAs(schema) {
1439
- const decode = Schema.decodeUnknownOption(schema);
1440
- return (value) => Option.getOrUndefined(decode(value));
1441
- }
1442
- //#endregion
1443
- //#region src/clerk/components/user-card.tsx
1444
1409
  const readClerkUserData = readAs(Schema.Struct({
1445
1410
  id: Schema.String,
1446
1411
  firstName: Schema.NullOr(Schema.String),
@@ -1613,7 +1578,6 @@ function TwilioIcon({ className }) {
1613
1578
  //#endregion
1614
1579
  //#region src/ui.ts
1615
1580
  const integrationUi = {
1616
- acuity: { icon: AcuityIcon },
1617
1581
  clerk: {
1618
1582
  icon: ClerkIcon,
1619
1583
  outputComponents: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wfgraph/plugins",
3
- "version": "0.3.0",
4
- "description": "The six built-in Workflow Graph integrations, plus the icons and output renderers the editor draws them with",
3
+ "version": "2.0.0",
4
+ "description": "The five built-in Workflow Graph integrations, plus the icons and output renderers the editor draws them with",
5
5
  "keywords": [
6
6
  "automation",
7
7
  "clerk",
@@ -37,7 +37,6 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@clerk/backend": "^2.33.6",
40
- "@fountain-bio/acuity": "^0.1.0",
41
40
  "@linear/sdk": "^75.0.0",
42
41
  "effect": "4.0.0-rc.108",
43
42
  "es-toolkit": "^1.50.0"
@@ -45,8 +44,8 @@
45
44
  "devDependencies": {
46
45
  "@types/react": "^19.2.18",
47
46
  "react": "19.2.8",
48
- "@wfgraph/core": "0.3.0",
49
- "@wfgraph/shared": "0.3.0"
47
+ "@wfgraph/shared": "2.0.0",
48
+ "@wfgraph/core": "2.0.0"
50
49
  },
51
50
  "peerDependencies": {
52
51
  "@wfgraph/core": "*"
@@ -1,50 +0,0 @@
1
- import { StepFailure, getErrorMessage } from "@wfgraph/core/plugin";
2
- import { Effect } from "effect";
3
- import { Acuity, AcuityError } from "@fountain-bio/acuity";
4
- //#region src/acuity/client.ts
5
- /** Production SDK construction from stored credentials. */
6
- function createAcuitySdk(userId, apiKey) {
7
- return new Acuity({
8
- userId,
9
- apiKey
10
- });
11
- }
12
- /**
13
- * The Acuity SDK, built from the step's own credentials, or the failure that
14
- * says which of them is missing.
15
- *
16
- * It takes the handler's whole bag rather than the credentials, so fetching them
17
- * is part of the one line every handler opens with. Every step starts here, which
18
- * is what makes the check on them written once and reported the same way.
19
- *
20
- * A store that could not be read is passed on rather than turned into a
21
- * `StepFailure`: that failure is the one a step is retried for.
22
- */
23
- function createAcuityClient(bag, createSdk) {
24
- return Effect.flatMap(bag.credentials, (credentials) => {
25
- const userId = credentials.ACUITY_USER_ID?.trim();
26
- const apiKey = credentials.ACUITY_API_KEY?.trim();
27
- return userId && apiKey ? Effect.succeed(createSdk(userId, apiKey)) : Effect.fail(new StepFailure({ message: "ACUITY_USER_ID and ACUITY_API_KEY are required. Add them in Project Integrations." }));
28
- });
29
- }
30
- /**
31
- * One call to Acuity, with the sentence that says what went wrong if it did.
32
- *
33
- * The SDK throws, and what it throws is an `AcuityError` carrying the API's own
34
- * message when Acuity answered and something more general when it did not, so
35
- * the fallback each step passes names the thing that step was doing.
36
- */
37
- function callAcuity(fallback, call) {
38
- return Effect.tryPromise({
39
- try: call,
40
- catch: (error) => new StepFailure({ message: getAcuityErrorMessage(error, fallback) })
41
- });
42
- }
43
- function getAcuityErrorMessage(error, fallback) {
44
- if (error instanceof AcuityError) return error.message;
45
- const message = getErrorMessage(error);
46
- if (message && message !== "Unknown error") return message;
47
- return fallback;
48
- }
49
- //#endregion
50
- export { getAcuityErrorMessage as i, createAcuityClient as n, createAcuitySdk as r, callAcuity as t };
@@ -1,35 +0,0 @@
1
- import { i as getAcuityErrorMessage } from "./client-DkPUX0ps.js";
2
- import { AcuityError } from "@fountain-bio/acuity";
3
- //#region src/acuity/test.ts
4
- async function testAcuity(credentials, createSdk) {
5
- try {
6
- const userId = credentials.ACUITY_USER_ID?.trim();
7
- const apiKey = credentials.ACUITY_API_KEY?.trim();
8
- if (!(userId && apiKey)) return {
9
- success: false,
10
- error: "ACUITY_USER_ID and ACUITY_API_KEY are required"
11
- };
12
- await createSdk(userId, apiKey).appointments.types();
13
- return { success: true };
14
- } catch (error) {
15
- const message = getAcuityErrorMessage(error, error instanceof Error ? error.message : String(error));
16
- const details = { message: error instanceof Error ? error.message : String(error) };
17
- if (error instanceof AcuityError) {
18
- details.status = error.status;
19
- details.code = error.code;
20
- details.payload = error.payload;
21
- }
22
- if (message.toLowerCase().includes("unauthorized")) return {
23
- success: false,
24
- error: "Invalid Acuity credentials. Please check your User ID and API key.",
25
- details
26
- };
27
- return {
28
- success: false,
29
- error: message,
30
- details
31
- };
32
- }
33
- }
34
- //#endregion
35
- export { testAcuity };
@@ -1,7 +1,7 @@
1
1
  import { callExternal, parsePayload } from "@wfgraph/core/plugin";
2
- import { Schema } from "effect";
3
2
  import { omitBy } from "es-toolkit/object";
4
3
  import { isNil } from "es-toolkit/predicate";
4
+ import { Schema } from "effect";
5
5
  //#region src/twilio/client.ts
6
6
  const TWILIO_API_BASE = "https://api.twilio.com/2010-04-01";
7
7
  /** Twilio's error body, the same shape on every endpoint. */