@weirdfingers/boards 0.4.1 → 0.5.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.
package/dist/index.js CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  GET_GENERATIONS: () => GET_GENERATIONS,
40
40
  GET_GENERATORS: () => GET_GENERATORS,
41
41
  GenerationStatus: () => GenerationStatus,
42
+ GeneratorSelectionProvider: () => GeneratorSelectionProvider,
42
43
  NoAuthProvider: () => NoAuthProvider,
43
44
  REMOVE_BOARD_MEMBER: () => REMOVE_BOARD_MEMBER,
44
45
  RETRY_GENERATION: () => RETRY_GENERATION,
@@ -58,6 +59,7 @@ __export(index_exports, {
58
59
  useBoard: () => useBoard,
59
60
  useBoards: () => useBoards,
60
61
  useGeneration: () => useGeneration,
62
+ useGeneratorSelection: () => useGeneratorSelection,
61
63
  useGenerators: () => useGenerators
62
64
  });
63
65
  module.exports = __toCommonJS(index_exports);
@@ -269,6 +271,240 @@ function useApiConfig() {
269
271
  return context;
270
272
  }
271
273
 
274
+ // src/config/GeneratorSelectionContext.tsx
275
+ var import_react3 = require("react");
276
+
277
+ // src/utils/schemaParser.ts
278
+ function isArtifactReference(property) {
279
+ if (!property || typeof property === "boolean") {
280
+ return false;
281
+ }
282
+ if (property.$ref && property.$ref.includes("Artifact")) {
283
+ return true;
284
+ }
285
+ if (property.type === "array" && property.items && typeof property.items === "object" && !Array.isArray(property.items)) {
286
+ const items = property.items;
287
+ return !!(items.$ref && items.$ref.includes("Artifact"));
288
+ }
289
+ return false;
290
+ }
291
+ function getArtifactType(ref) {
292
+ const match = ref.match(/(Audio|Video|Image|Text)Artifact/);
293
+ if (match) {
294
+ return match[1].toLowerCase();
295
+ }
296
+ return "image";
297
+ }
298
+ function parseArtifactSlot(name, property, required) {
299
+ const title = property.title || name;
300
+ const description = property.description;
301
+ if (property.type === "array" && property.items) {
302
+ const items = typeof property.items === "object" && !Array.isArray(property.items) ? property.items : void 0;
303
+ const artifactType2 = items?.$ref ? getArtifactType(items.$ref) : "image";
304
+ return {
305
+ name: title,
306
+ fieldName: name,
307
+ artifactType: artifactType2,
308
+ required,
309
+ description,
310
+ isArray: true,
311
+ minItems: property.minItems,
312
+ maxItems: property.maxItems
313
+ };
314
+ }
315
+ const artifactType = property.$ref ? getArtifactType(property.$ref) : "image";
316
+ return {
317
+ name: title,
318
+ fieldName: name,
319
+ artifactType,
320
+ required,
321
+ description,
322
+ isArray: false
323
+ };
324
+ }
325
+ function isSlider(property) {
326
+ return (property.type === "number" || property.type === "integer") && property.minimum !== void 0 && property.maximum !== void 0;
327
+ }
328
+ function parseSettingsField(name, property) {
329
+ const title = property.title || name;
330
+ const description = property.description;
331
+ if (property.enum && Array.isArray(property.enum)) {
332
+ const options = property.enum.map((val) => String(val));
333
+ const defaultValue = property.default !== void 0 ? String(property.default) : void 0;
334
+ return {
335
+ type: "dropdown",
336
+ fieldName: name,
337
+ title,
338
+ description,
339
+ options,
340
+ default: defaultValue
341
+ };
342
+ }
343
+ if (isSlider(property)) {
344
+ const isInteger = property.type === "integer";
345
+ return {
346
+ type: "slider",
347
+ fieldName: name,
348
+ title,
349
+ description,
350
+ min: property.minimum,
351
+ max: property.maximum,
352
+ step: property.multipleOf,
353
+ default: property.default !== void 0 ? property.default : void 0,
354
+ isInteger
355
+ };
356
+ }
357
+ if (property.type === "number" || property.type === "integer") {
358
+ const isInteger = property.type === "integer";
359
+ return {
360
+ type: "number",
361
+ fieldName: name,
362
+ title,
363
+ description,
364
+ default: property.default !== void 0 ? property.default : void 0,
365
+ min: property.minimum,
366
+ max: property.maximum,
367
+ isInteger
368
+ };
369
+ }
370
+ if (property.type === "string") {
371
+ return {
372
+ type: "text",
373
+ fieldName: name,
374
+ title,
375
+ description,
376
+ default: property.default !== void 0 ? String(property.default) : void 0,
377
+ pattern: property.pattern
378
+ };
379
+ }
380
+ return null;
381
+ }
382
+ function parseGeneratorSchema(schema) {
383
+ const artifactSlots = [];
384
+ const settingsFields = [];
385
+ let promptField = null;
386
+ if (!schema.properties) {
387
+ return { artifactSlots, promptField, settingsFields };
388
+ }
389
+ const required = schema.required || [];
390
+ for (const [name, propertyDef] of Object.entries(schema.properties)) {
391
+ if (typeof propertyDef === "boolean") {
392
+ continue;
393
+ }
394
+ const property = propertyDef;
395
+ const isRequired = required.includes(name);
396
+ if (isArtifactReference(property)) {
397
+ const slot = parseArtifactSlot(name, property, isRequired);
398
+ artifactSlots.push(slot);
399
+ continue;
400
+ }
401
+ if (name === "prompt" && property.type === "string") {
402
+ promptField = {
403
+ fieldName: name,
404
+ description: property.description,
405
+ required: isRequired,
406
+ default: property.default !== void 0 ? String(property.default) : void 0
407
+ };
408
+ continue;
409
+ }
410
+ const settingsField = parseSettingsField(name, property);
411
+ if (settingsField) {
412
+ settingsFields.push(settingsField);
413
+ }
414
+ }
415
+ return {
416
+ artifactSlots,
417
+ promptField,
418
+ settingsFields
419
+ };
420
+ }
421
+
422
+ // src/config/GeneratorSelectionContext.tsx
423
+ var import_jsx_runtime3 = require("react/jsx-runtime");
424
+ var GeneratorSelectionContext = (0, import_react3.createContext)(null);
425
+ function GeneratorSelectionProvider({
426
+ children
427
+ }) {
428
+ const [selectedGenerator, setSelectedGenerator] = (0, import_react3.useState)(null);
429
+ const [selectedArtifacts, setSelectedArtifacts] = (0, import_react3.useState)(/* @__PURE__ */ new Map());
430
+ const parsedSchema = (0, import_react3.useMemo)(() => {
431
+ if (!selectedGenerator) {
432
+ return null;
433
+ }
434
+ try {
435
+ return parseGeneratorSchema(selectedGenerator.inputSchema);
436
+ } catch (error) {
437
+ console.error("Failed to parse generator schema:", error);
438
+ return null;
439
+ }
440
+ }, [selectedGenerator]);
441
+ const artifactSlots = (0, import_react3.useMemo)(() => {
442
+ if (!parsedSchema) {
443
+ return [];
444
+ }
445
+ return parsedSchema.artifactSlots.map((slot) => ({
446
+ fieldName: slot.fieldName,
447
+ artifactType: slot.artifactType,
448
+ required: slot.required
449
+ }));
450
+ }, [parsedSchema]);
451
+ const canArtifactBeAdded = (0, import_react3.useCallback)((artifactType) => {
452
+ if (!artifactSlots.length) {
453
+ return false;
454
+ }
455
+ return artifactSlots.some(
456
+ (slot) => slot.artifactType.toLowerCase() === artifactType.toLowerCase() && !selectedArtifacts.has(slot.fieldName)
457
+ );
458
+ }, [artifactSlots, selectedArtifacts]);
459
+ const addArtifactToSlot = (0, import_react3.useCallback)((artifact) => {
460
+ if (!artifactSlots.length) {
461
+ return false;
462
+ }
463
+ const compatibleSlot = artifactSlots.find(
464
+ (slot) => slot.artifactType.toLowerCase() === artifact.artifactType.toLowerCase() && !selectedArtifacts.has(slot.fieldName)
465
+ );
466
+ if (!compatibleSlot) {
467
+ return false;
468
+ }
469
+ const newArtifacts = new Map(selectedArtifacts);
470
+ newArtifacts.set(compatibleSlot.fieldName, artifact);
471
+ setSelectedArtifacts(newArtifacts);
472
+ return true;
473
+ }, [artifactSlots, selectedArtifacts]);
474
+ const removeArtifactFromSlot = (0, import_react3.useCallback)((slotName) => {
475
+ const newArtifacts = new Map(selectedArtifacts);
476
+ newArtifacts.delete(slotName);
477
+ setSelectedArtifacts(newArtifacts);
478
+ }, [selectedArtifacts]);
479
+ const clearAllArtifacts = (0, import_react3.useCallback)(() => {
480
+ setSelectedArtifacts(/* @__PURE__ */ new Map());
481
+ }, []);
482
+ const handleSetSelectedGenerator = (0, import_react3.useCallback)((generator) => {
483
+ setSelectedGenerator(generator);
484
+ setSelectedArtifacts(/* @__PURE__ */ new Map());
485
+ }, []);
486
+ const value = {
487
+ selectedGenerator,
488
+ setSelectedGenerator: handleSetSelectedGenerator,
489
+ parsedSchema,
490
+ artifactSlots,
491
+ canArtifactBeAdded,
492
+ selectedArtifacts,
493
+ setSelectedArtifacts,
494
+ addArtifactToSlot,
495
+ removeArtifactFromSlot,
496
+ clearAllArtifacts
497
+ };
498
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GeneratorSelectionContext.Provider, { value, children });
499
+ }
500
+ function useGeneratorSelection() {
501
+ const context = (0, import_react3.useContext)(GeneratorSelectionContext);
502
+ if (!context) {
503
+ throw new Error("useGeneratorSelection must be used within GeneratorSelectionProvider");
504
+ }
505
+ return context;
506
+ }
507
+
272
508
  // src/graphql/client.ts
273
509
  var import_urql = require("urql");
274
510
  var import_exchange_auth = require("@urql/exchange-auth");
@@ -593,19 +829,19 @@ var ArtifactType = /* @__PURE__ */ ((ArtifactType4) => {
593
829
  })(ArtifactType || {});
594
830
 
595
831
  // src/hooks/useBoards.ts
596
- var import_react3 = require("react");
832
+ var import_react4 = require("react");
597
833
  var import_urql3 = require("urql");
598
834
  function useBoards(options = {}) {
599
835
  const { limit = 50, offset = 0 } = options;
600
- const [searchQuery, setSearchQuery] = (0, import_react3.useState)("");
836
+ const [searchQuery, setSearchQuery] = (0, import_react4.useState)("");
601
837
  const [{ data, fetching, error }, reexecuteQuery] = (0, import_urql3.useQuery)({
602
838
  query: GET_BOARDS,
603
839
  variables: { limit, offset }
604
840
  });
605
841
  const [, createBoardMutation] = (0, import_urql3.useMutation)(CREATE_BOARD);
606
842
  const [, deleteBoardMutation] = (0, import_urql3.useMutation)(DELETE_BOARD);
607
- const boards = (0, import_react3.useMemo)(() => data?.myBoards || [], [data?.myBoards]);
608
- const createBoard = (0, import_react3.useCallback)(
843
+ const boards = (0, import_react4.useMemo)(() => data?.myBoards || [], [data?.myBoards]);
844
+ const createBoard = (0, import_react4.useCallback)(
609
845
  async (input) => {
610
846
  const result = await createBoardMutation({ input });
611
847
  if (result.error) {
@@ -619,7 +855,7 @@ function useBoards(options = {}) {
619
855
  },
620
856
  [createBoardMutation, reexecuteQuery]
621
857
  );
622
- const deleteBoard = (0, import_react3.useCallback)(
858
+ const deleteBoard = (0, import_react4.useCallback)(
623
859
  async (boardId) => {
624
860
  const result = await deleteBoardMutation({ id: boardId });
625
861
  if (result.error) {
@@ -632,7 +868,7 @@ function useBoards(options = {}) {
632
868
  },
633
869
  [deleteBoardMutation, reexecuteQuery]
634
870
  );
635
- const searchBoards = (0, import_react3.useCallback)(
871
+ const searchBoards = (0, import_react4.useCallback)(
636
872
  async (query) => {
637
873
  setSearchQuery(query);
638
874
  return new Promise((resolve) => {
@@ -647,7 +883,7 @@ function useBoards(options = {}) {
647
883
  },
648
884
  [boards]
649
885
  );
650
- const refresh = (0, import_react3.useCallback)(async () => {
886
+ const refresh = (0, import_react4.useCallback)(async () => {
651
887
  await reexecuteQuery({ requestPolicy: "network-only" });
652
888
  }, [reexecuteQuery]);
653
889
  return {
@@ -664,7 +900,7 @@ function useBoards(options = {}) {
664
900
  }
665
901
 
666
902
  // src/hooks/useBoard.ts
667
- var import_react4 = require("react");
903
+ var import_react5 = require("react");
668
904
  var import_urql4 = require("urql");
669
905
  function useBoard(boardId, options) {
670
906
  const { user } = useAuth();
@@ -685,9 +921,9 @@ function useBoard(boardId, options) {
685
921
  const [, addMemberMutation] = (0, import_urql4.useMutation)(ADD_BOARD_MEMBER);
686
922
  const [, updateMemberRoleMutation] = (0, import_urql4.useMutation)(UPDATE_BOARD_MEMBER_ROLE);
687
923
  const [, removeMemberMutation] = (0, import_urql4.useMutation)(REMOVE_BOARD_MEMBER);
688
- const board = (0, import_react4.useMemo)(() => data?.board || null, [data?.board]);
689
- const members = (0, import_react4.useMemo)(() => board?.members || [], [board?.members]);
690
- const permissions = (0, import_react4.useMemo)(() => {
924
+ const board = (0, import_react5.useMemo)(() => data?.board || null, [data?.board]);
925
+ const members = (0, import_react5.useMemo)(() => board?.members || [], [board?.members]);
926
+ const permissions = (0, import_react5.useMemo)(() => {
691
927
  if (!board || !user) {
692
928
  return {
693
929
  canEdit: false,
@@ -716,7 +952,7 @@ function useBoard(boardId, options) {
716
952
  // Even viewers can export
717
953
  };
718
954
  }, [board, user, members]);
719
- const updateBoard = (0, import_react4.useCallback)(
955
+ const updateBoard = (0, import_react5.useCallback)(
720
956
  async (updates) => {
721
957
  if (!boardId) {
722
958
  throw new Error("Board ID is required");
@@ -735,7 +971,7 @@ function useBoard(boardId, options) {
735
971
  },
736
972
  [boardId, updateBoardMutation]
737
973
  );
738
- const deleteBoard = (0, import_react4.useCallback)(async () => {
974
+ const deleteBoard = (0, import_react5.useCallback)(async () => {
739
975
  if (!boardId) {
740
976
  throw new Error("Board ID is required");
741
977
  }
@@ -747,7 +983,7 @@ function useBoard(boardId, options) {
747
983
  throw new Error("Failed to delete board");
748
984
  }
749
985
  }, [boardId, deleteBoardMutation]);
750
- const addMember = (0, import_react4.useCallback)(
986
+ const addMember = (0, import_react5.useCallback)(
751
987
  async (email, role) => {
752
988
  if (!boardId) {
753
989
  throw new Error("Board ID is required");
@@ -768,7 +1004,7 @@ function useBoard(boardId, options) {
768
1004
  },
769
1005
  [boardId, addMemberMutation, reexecuteQuery]
770
1006
  );
771
- const removeMember = (0, import_react4.useCallback)(
1007
+ const removeMember = (0, import_react5.useCallback)(
772
1008
  async (memberId) => {
773
1009
  const result = await removeMemberMutation({ id: memberId });
774
1010
  if (result.error) {
@@ -781,7 +1017,7 @@ function useBoard(boardId, options) {
781
1017
  },
782
1018
  [removeMemberMutation, reexecuteQuery]
783
1019
  );
784
- const updateMemberRole = (0, import_react4.useCallback)(
1020
+ const updateMemberRole = (0, import_react5.useCallback)(
785
1021
  async (memberId, role) => {
786
1022
  const result = await updateMemberRoleMutation({
787
1023
  id: memberId,
@@ -798,19 +1034,19 @@ function useBoard(boardId, options) {
798
1034
  },
799
1035
  [updateMemberRoleMutation, reexecuteQuery]
800
1036
  );
801
- const generateShareLink = (0, import_react4.useCallback)(
1037
+ const generateShareLink = (0, import_react5.useCallback)(
802
1038
  async (_options) => {
803
1039
  throw new Error("Share links not implemented yet");
804
1040
  },
805
1041
  []
806
1042
  );
807
- const revokeShareLink = (0, import_react4.useCallback)(
1043
+ const revokeShareLink = (0, import_react5.useCallback)(
808
1044
  async (_linkId) => {
809
1045
  throw new Error("Share link revocation not implemented yet");
810
1046
  },
811
1047
  []
812
1048
  );
813
- const refresh = (0, import_react4.useCallback)(async () => {
1049
+ const refresh = (0, import_react5.useCallback)(async () => {
814
1050
  await reexecuteQuery({ requestPolicy: "network-only" });
815
1051
  }, [reexecuteQuery]);
816
1052
  return {
@@ -831,22 +1067,22 @@ function useBoard(boardId, options) {
831
1067
  }
832
1068
 
833
1069
  // src/hooks/useGeneration.ts
834
- var import_react5 = require("react");
1070
+ var import_react6 = require("react");
835
1071
  var import_fetch_event_source = require("@microsoft/fetch-event-source");
836
1072
  var import_urql5 = require("urql");
837
1073
  function useGeneration() {
838
- const [progress, setProgress] = (0, import_react5.useState)(null);
839
- const [result, setResult] = (0, import_react5.useState)(null);
840
- const [error, setError] = (0, import_react5.useState)(null);
841
- const [isGenerating, setIsGenerating] = (0, import_react5.useState)(false);
842
- const [history, setHistory] = (0, import_react5.useState)([]);
1074
+ const [progress, setProgress] = (0, import_react6.useState)(null);
1075
+ const [result, setResult] = (0, import_react6.useState)(null);
1076
+ const [error, setError] = (0, import_react6.useState)(null);
1077
+ const [isGenerating, setIsGenerating] = (0, import_react6.useState)(false);
1078
+ const [history, setHistory] = (0, import_react6.useState)([]);
843
1079
  const { apiUrl } = useApiConfig();
844
1080
  const auth = useAuth();
845
- const abortControllers = (0, import_react5.useRef)(/* @__PURE__ */ new Map());
1081
+ const abortControllers = (0, import_react6.useRef)(/* @__PURE__ */ new Map());
846
1082
  const [, createGenerationMutation] = (0, import_urql5.useMutation)(CREATE_GENERATION);
847
1083
  const [, cancelGenerationMutation] = (0, import_urql5.useMutation)(CANCEL_GENERATION);
848
1084
  const [, retryGenerationMutation] = (0, import_urql5.useMutation)(RETRY_GENERATION);
849
- (0, import_react5.useEffect)(() => {
1085
+ (0, import_react6.useEffect)(() => {
850
1086
  return () => {
851
1087
  abortControllers.current.forEach((controller) => {
852
1088
  controller.abort();
@@ -854,7 +1090,7 @@ function useGeneration() {
854
1090
  abortControllers.current.clear();
855
1091
  };
856
1092
  }, []);
857
- const connectToSSE = (0, import_react5.useCallback)(
1093
+ const connectToSSE = (0, import_react6.useCallback)(
858
1094
  async (jobId) => {
859
1095
  const existingController = abortControllers.current.get(jobId);
860
1096
  if (existingController) {
@@ -958,7 +1194,7 @@ function useGeneration() {
958
1194
  },
959
1195
  [apiUrl, auth]
960
1196
  );
961
- const submit = (0, import_react5.useCallback)(
1197
+ const submit = (0, import_react6.useCallback)(
962
1198
  async (request) => {
963
1199
  setError(null);
964
1200
  setProgress(null);
@@ -1010,7 +1246,7 @@ function useGeneration() {
1010
1246
  },
1011
1247
  [createGenerationMutation, connectToSSE]
1012
1248
  );
1013
- const cancel = (0, import_react5.useCallback)(
1249
+ const cancel = (0, import_react6.useCallback)(
1014
1250
  async (jobId) => {
1015
1251
  try {
1016
1252
  const result2 = await cancelGenerationMutation({ id: jobId });
@@ -1032,7 +1268,7 @@ function useGeneration() {
1032
1268
  },
1033
1269
  [cancelGenerationMutation]
1034
1270
  );
1035
- const retry = (0, import_react5.useCallback)(
1271
+ const retry = (0, import_react6.useCallback)(
1036
1272
  async (jobId) => {
1037
1273
  try {
1038
1274
  setError(null);
@@ -1055,7 +1291,7 @@ function useGeneration() {
1055
1291
  },
1056
1292
  [retryGenerationMutation, connectToSSE]
1057
1293
  );
1058
- const clearHistory = (0, import_react5.useCallback)(() => {
1294
+ const clearHistory = (0, import_react6.useCallback)(() => {
1059
1295
  setHistory([]);
1060
1296
  }, []);
1061
1297
  return {
@@ -1072,7 +1308,7 @@ function useGeneration() {
1072
1308
  }
1073
1309
 
1074
1310
  // src/hooks/useGenerators.ts
1075
- var import_react6 = require("react");
1311
+ var import_react7 = require("react");
1076
1312
  var import_urql6 = require("urql");
1077
1313
  function useGenerators(options = {}) {
1078
1314
  const { artifactType } = options;
@@ -1080,7 +1316,7 @@ function useGenerators(options = {}) {
1080
1316
  query: GET_GENERATORS,
1081
1317
  variables: artifactType ? { artifactType } : {}
1082
1318
  });
1083
- const generators = (0, import_react6.useMemo)(() => data?.generators || [], [data?.generators]);
1319
+ const generators = (0, import_react7.useMemo)(() => data?.generators || [], [data?.generators]);
1084
1320
  return {
1085
1321
  generators,
1086
1322
  loading: fetching,
@@ -1088,154 +1324,9 @@ function useGenerators(options = {}) {
1088
1324
  };
1089
1325
  }
1090
1326
 
1091
- // src/utils/schemaParser.ts
1092
- function isArtifactReference(property) {
1093
- if (!property || typeof property === "boolean") {
1094
- return false;
1095
- }
1096
- if (property.$ref && property.$ref.includes("Artifact")) {
1097
- return true;
1098
- }
1099
- if (property.type === "array" && property.items && typeof property.items === "object" && !Array.isArray(property.items)) {
1100
- const items = property.items;
1101
- return !!(items.$ref && items.$ref.includes("Artifact"));
1102
- }
1103
- return false;
1104
- }
1105
- function getArtifactType(ref) {
1106
- const match = ref.match(/(Audio|Video|Image|Text)Artifact/);
1107
- if (match) {
1108
- return match[1].toLowerCase();
1109
- }
1110
- return "image";
1111
- }
1112
- function parseArtifactSlot(name, property, required) {
1113
- const title = property.title || name;
1114
- const description = property.description;
1115
- if (property.type === "array" && property.items) {
1116
- const items = typeof property.items === "object" && !Array.isArray(property.items) ? property.items : void 0;
1117
- const artifactType2 = items?.$ref ? getArtifactType(items.$ref) : "image";
1118
- return {
1119
- name: title,
1120
- fieldName: name,
1121
- artifactType: artifactType2,
1122
- required,
1123
- description,
1124
- isArray: true,
1125
- minItems: property.minItems,
1126
- maxItems: property.maxItems
1127
- };
1128
- }
1129
- const artifactType = property.$ref ? getArtifactType(property.$ref) : "image";
1130
- return {
1131
- name: title,
1132
- fieldName: name,
1133
- artifactType,
1134
- required,
1135
- description,
1136
- isArray: false
1137
- };
1138
- }
1139
- function isSlider(property) {
1140
- return (property.type === "number" || property.type === "integer") && property.minimum !== void 0 && property.maximum !== void 0;
1141
- }
1142
- function parseSettingsField(name, property) {
1143
- const title = property.title || name;
1144
- const description = property.description;
1145
- if (property.enum && Array.isArray(property.enum)) {
1146
- const options = property.enum.map((val) => String(val));
1147
- const defaultValue = property.default !== void 0 ? String(property.default) : void 0;
1148
- return {
1149
- type: "dropdown",
1150
- fieldName: name,
1151
- title,
1152
- description,
1153
- options,
1154
- default: defaultValue
1155
- };
1156
- }
1157
- if (isSlider(property)) {
1158
- const isInteger = property.type === "integer";
1159
- return {
1160
- type: "slider",
1161
- fieldName: name,
1162
- title,
1163
- description,
1164
- min: property.minimum,
1165
- max: property.maximum,
1166
- step: property.multipleOf,
1167
- default: property.default !== void 0 ? property.default : void 0,
1168
- isInteger
1169
- };
1170
- }
1171
- if (property.type === "number" || property.type === "integer") {
1172
- const isInteger = property.type === "integer";
1173
- return {
1174
- type: "number",
1175
- fieldName: name,
1176
- title,
1177
- description,
1178
- default: property.default !== void 0 ? property.default : void 0,
1179
- min: property.minimum,
1180
- max: property.maximum,
1181
- isInteger
1182
- };
1183
- }
1184
- if (property.type === "string") {
1185
- return {
1186
- type: "text",
1187
- fieldName: name,
1188
- title,
1189
- description,
1190
- default: property.default !== void 0 ? String(property.default) : void 0,
1191
- pattern: property.pattern
1192
- };
1193
- }
1194
- return null;
1195
- }
1196
- function parseGeneratorSchema(schema) {
1197
- const artifactSlots = [];
1198
- const settingsFields = [];
1199
- let promptField = null;
1200
- if (!schema.properties) {
1201
- return { artifactSlots, promptField, settingsFields };
1202
- }
1203
- const required = schema.required || [];
1204
- for (const [name, propertyDef] of Object.entries(schema.properties)) {
1205
- if (typeof propertyDef === "boolean") {
1206
- continue;
1207
- }
1208
- const property = propertyDef;
1209
- const isRequired = required.includes(name);
1210
- if (isArtifactReference(property)) {
1211
- const slot = parseArtifactSlot(name, property, isRequired);
1212
- artifactSlots.push(slot);
1213
- continue;
1214
- }
1215
- if (name === "prompt" && property.type === "string") {
1216
- promptField = {
1217
- fieldName: name,
1218
- description: property.description,
1219
- required: isRequired,
1220
- default: property.default !== void 0 ? String(property.default) : void 0
1221
- };
1222
- continue;
1223
- }
1224
- const settingsField = parseSettingsField(name, property);
1225
- if (settingsField) {
1226
- settingsFields.push(settingsField);
1227
- }
1228
- }
1229
- return {
1230
- artifactSlots,
1231
- promptField,
1232
- settingsFields
1233
- };
1234
- }
1235
-
1236
1327
  // src/providers/BoardsProvider.tsx
1237
1328
  var import_urql7 = require("urql");
1238
- var import_jsx_runtime3 = require("react/jsx-runtime");
1329
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1239
1330
  function BoardsProvider({
1240
1331
  children,
1241
1332
  apiUrl,
@@ -1258,7 +1349,7 @@ function BoardsProvider({
1258
1349
  },
1259
1350
  tenantId
1260
1351
  });
1261
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AuthProvider, { provider: authProvider, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ApiConfigProvider, { config: apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_urql7.Provider, { value: client, children }) }) });
1352
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AuthProvider, { provider: authProvider, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ApiConfigProvider, { config: apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_urql7.Provider, { value: client, children }) }) });
1262
1353
  }
1263
1354
 
1264
1355
  // src/index.ts
@@ -1284,6 +1375,7 @@ var VERSION = "0.1.0";
1284
1375
  GET_GENERATIONS,
1285
1376
  GET_GENERATORS,
1286
1377
  GenerationStatus,
1378
+ GeneratorSelectionProvider,
1287
1379
  NoAuthProvider,
1288
1380
  REMOVE_BOARD_MEMBER,
1289
1381
  RETRY_GENERATION,
@@ -1303,6 +1395,7 @@ var VERSION = "0.1.0";
1303
1395
  useBoard,
1304
1396
  useBoards,
1305
1397
  useGeneration,
1398
+ useGeneratorSelection,
1306
1399
  useGenerators
1307
1400
  });
1308
1401
  //# sourceMappingURL=index.js.map