@elqnt/entity 1.0.8 → 2.0.5

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
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
2
 
3
3
 
4
4
 
@@ -73,14 +73,6 @@
73
73
 
74
74
  var _chunk4GC36G4Djs = require('./chunk-4GC36G4D.js');
75
75
 
76
- // context/entity-definition-context.tsx
77
- var _react = require('react');
78
-
79
- // hooks/use-entity-definition.ts
80
-
81
- var _reactredux = require('react-redux');
82
- var _nats = require('@elqnt/nats');
83
-
84
76
  // store/entity-definition-slice.ts
85
77
  var _toolkit = require('@reduxjs/toolkit');
86
78
  var initialState = {
@@ -187,364 +179,6 @@ var {
187
179
  } = entityDefinitionSlice.actions;
188
180
  var entityDefinitionReducer = entityDefinitionSlice.reducer;
189
181
 
190
- // hooks/use-entity-definition.ts
191
- function useEntityDefinition(orgId, entityName, options = {}) {
192
- const { autoLoad, module } = options;
193
- const { natsConnected, request } = _nats.useNatsContext.call(void 0, );
194
- const dispatch = _reactredux.useDispatch.call(void 0, );
195
- const definitions = _reactredux.useSelector.call(void 0,
196
- (state) => state.entityDefinition.definitions
197
- );
198
- const selectedDefinition = _reactredux.useSelector.call(void 0,
199
- (state) => state.entityDefinition.selectedDefinition
200
- );
201
- const views = _reactredux.useSelector.call(void 0,
202
- (state) => state.entityDefinition.views
203
- );
204
- const selectedView = _reactredux.useSelector.call(void 0,
205
- (state) => state.entityDefinition.selectedView
206
- );
207
- const isLoading = _reactredux.useSelector.call(void 0,
208
- (state) => state.entityDefinition.isLoading
209
- );
210
- const loadingStates = _reactredux.useSelector.call(void 0,
211
- (state) => state.entityDefinition.loadingStates
212
- );
213
- const error = _reactredux.useSelector.call(void 0,
214
- (state) => state.entityDefinition.error
215
- );
216
- const createOrgSchema = _react.useCallback.call(void 0,
217
- async (targetOrgId) => {
218
- if (!natsConnected) {
219
- throw new Error("Not connected to NATS");
220
- }
221
- dispatch(setOperationLoading({ operation: "createOrgSchema", loading: true }));
222
- try {
223
- const response = await request(_chunk4GC36G4Djs.EntityOrgSchemaCreate, { orgId: targetOrgId });
224
- if (response instanceof Error) {
225
- throw response;
226
- }
227
- return response;
228
- } finally {
229
- dispatch(setOperationLoading({ operation: "createOrgSchema", loading: false }));
230
- }
231
- },
232
- [natsConnected, dispatch, request]
233
- );
234
- const dropOrgSchema = _react.useCallback.call(void 0,
235
- async (targetOrgId) => {
236
- if (!natsConnected) {
237
- throw new Error("Not connected to NATS");
238
- }
239
- dispatch(setOperationLoading({ operation: "dropOrgSchema", loading: true }));
240
- try {
241
- const response = await request(_chunk4GC36G4Djs.EntityOrgSchemaDrop, { orgId: targetOrgId });
242
- if (response instanceof Error) {
243
- throw response;
244
- }
245
- return response;
246
- } finally {
247
- dispatch(setOperationLoading({ operation: "dropOrgSchema", loading: false }));
248
- }
249
- },
250
- [natsConnected, dispatch, request]
251
- );
252
- const loadDefinitions = _react.useCallback.call(void 0, async () => {
253
- if (!natsConnected || !orgId) return;
254
- const loadingKey = "loadDefinitions";
255
- if (loadingStates[loadingKey]) return;
256
- dispatch(setOperationLoading({ operation: loadingKey, loading: true }));
257
- try {
258
- const response = await request(_chunk4GC36G4Djs.EntityDefinitionList, { orgId, module });
259
- if (response instanceof Error) {
260
- dispatch(setError(response.message));
261
- } else {
262
- dispatch(setDefinitions(_nullishCoalesce(_optionalChain([response, 'optionalAccess', _9 => _9.definitions]), () => ( []))));
263
- }
264
- } catch (err) {
265
- dispatch(setError(err instanceof Error ? err.message : "Unknown error"));
266
- } finally {
267
- dispatch(setOperationLoading({ operation: loadingKey, loading: false }));
268
- }
269
- }, [natsConnected, orgId, options.module, dispatch, request]);
270
- _react.useEffect.call(void 0, () => {
271
- let mounted = true;
272
- if (autoLoad && natsConnected && orgId && mounted) {
273
- loadDefinitions();
274
- }
275
- return () => {
276
- mounted = false;
277
- };
278
- }, [autoLoad, natsConnected, orgId]);
279
- const loadDefinition = _react.useCallback.call(void 0,
280
- async (name) => {
281
- if (!natsConnected || !orgId) return;
282
- dispatch(
283
- setOperationLoading({ operation: `load_${name}`, loading: true })
284
- );
285
- try {
286
- const response = await request(_chunk4GC36G4Djs.EntityDefinitionGet, { entityName: name, orgId }, {});
287
- if (response instanceof Error) {
288
- dispatch(setError(response.message));
289
- return;
290
- }
291
- dispatch(setSelectedDefinition(response.definition));
292
- } finally {
293
- dispatch(
294
- setOperationLoading({ operation: `load_${name}`, loading: false })
295
- );
296
- }
297
- },
298
- [natsConnected, orgId, dispatch, request]
299
- );
300
- _react.useEffect.call(void 0, () => {
301
- if (natsConnected && orgId && entityName) {
302
- loadDefinition(entityName);
303
- }
304
- }, [natsConnected, orgId, entityName, loadDefinition]);
305
- const createDefinition = async (definition) => {
306
- if (!natsConnected || !orgId) {
307
- throw new Error("Not connected or missing orgId");
308
- }
309
- dispatch(setOperationLoading({ operation: "create", loading: true }));
310
- try {
311
- const response = await request(_chunk4GC36G4Djs.EntityDefinitionCreate, { definition, orgId }, {});
312
- if (response instanceof Error) {
313
- console.error("createDefinition error", response);
314
- throw response;
315
- }
316
- if (response.metadata.success) {
317
- dispatch(addDefinition(response.definition));
318
- }
319
- return response;
320
- } finally {
321
- dispatch(setOperationLoading({ operation: "create", loading: false }));
322
- }
323
- };
324
- const updateDefinitionById = async (name, definition) => {
325
- if (!natsConnected || !orgId) {
326
- throw new Error("Not connected or missing orgId");
327
- }
328
- dispatch(
329
- setOperationLoading({ operation: `update_${name}`, loading: true })
330
- );
331
- try {
332
- const response = await request(
333
- _chunk4GC36G4Djs.EntityDefinitionUpdate,
334
- {
335
- entityName: name,
336
- definition,
337
- orgId
338
- },
339
- {}
340
- );
341
- if (response instanceof Error) {
342
- throw response;
343
- }
344
- if (response.metadata.success) {
345
- dispatch(updateDefinition(response.definition));
346
- }
347
- return response;
348
- } finally {
349
- dispatch(
350
- setOperationLoading({ operation: `update_${name}`, loading: false })
351
- );
352
- }
353
- };
354
- const deleteDefinition = async (name) => {
355
- if (!natsConnected || !orgId) {
356
- throw new Error("Not connected or missing orgId");
357
- }
358
- dispatch(
359
- setOperationLoading({ operation: `delete_${name}`, loading: true })
360
- );
361
- try {
362
- const response = await request(_chunk4GC36G4Djs.EntityDefinitionDelete, { entityName: name, orgId }, {});
363
- if (response instanceof Error) {
364
- throw response;
365
- }
366
- dispatch(removeDefinition(name));
367
- return response;
368
- } finally {
369
- dispatch(
370
- setOperationLoading({ operation: `delete_${name}`, loading: false })
371
- );
372
- }
373
- };
374
- const loadViews = _react.useCallback.call(void 0,
375
- async (entityName2) => {
376
- if (!natsConnected || !orgId) return;
377
- const loadingKey = `loadViews_${entityName2}`;
378
- if (loadingStates[loadingKey]) return;
379
- dispatch(setOperationLoading({ operation: loadingKey, loading: true }));
380
- try {
381
- const response = await request(
382
- _chunk4GC36G4Djs.EntityViewList,
383
- { entityName: entityName2, orgId },
384
- {}
385
- );
386
- console.log("loadViews response", response);
387
- if (response instanceof Error) {
388
- dispatch(setError(response.message));
389
- return;
390
- }
391
- dispatch(setViews({ entityName: entityName2, views: response.views }));
392
- } catch (err) {
393
- dispatch(
394
- setError(err instanceof Error ? err.message : "Unknown error")
395
- );
396
- } finally {
397
- dispatch(
398
- setOperationLoading({ operation: loadingKey, loading: false })
399
- );
400
- }
401
- },
402
- [natsConnected, orgId, loadingStates, dispatch, request]
403
- );
404
- const createView = async (entityName2, view) => {
405
- if (!natsConnected || !orgId) {
406
- throw new Error("Not connected or missing orgId");
407
- }
408
- dispatch(setOperationLoading({ operation: "create_view", loading: true }));
409
- try {
410
- const response = await request(
411
- _chunk4GC36G4Djs.EntityViewCreate,
412
- { entityName: entityName2, view, orgId },
413
- {}
414
- );
415
- if (response instanceof Error) {
416
- throw response;
417
- }
418
- dispatch(addView({ entityName: entityName2, view: response.view }));
419
- return response.view;
420
- } finally {
421
- dispatch(
422
- setOperationLoading({ operation: "create_view", loading: false })
423
- );
424
- }
425
- };
426
- const updateViewById = async (entityName2, view) => {
427
- if (!natsConnected || !orgId || !view.id) {
428
- throw new Error("Not connected, missing orgId, or invalid view");
429
- }
430
- dispatch(
431
- setOperationLoading({
432
- operation: `update_view_${view.id}`,
433
- loading: true
434
- })
435
- );
436
- try {
437
- const response = await request(
438
- _chunk4GC36G4Djs.EntityViewUpdate,
439
- { view, orgId },
440
- {}
441
- );
442
- if (response instanceof Error) {
443
- throw response;
444
- }
445
- dispatch(updateView({ entityName: entityName2, view: response.view }));
446
- return response.view;
447
- } finally {
448
- dispatch(
449
- setOperationLoading({
450
- operation: `update_view_${view.id}`,
451
- loading: false
452
- })
453
- );
454
- }
455
- };
456
- const deleteView = async (entityName2, viewId) => {
457
- if (!natsConnected || !orgId) {
458
- throw new Error("Not connected or missing orgId");
459
- }
460
- dispatch(
461
- setOperationLoading({ operation: `delete_view_${viewId}`, loading: true })
462
- );
463
- try {
464
- const response = await request(
465
- _chunk4GC36G4Djs.EntityViewDelete,
466
- { viewId, orgId },
467
- {}
468
- );
469
- if (response instanceof Error) {
470
- throw response;
471
- }
472
- dispatch(removeView({ entityName: entityName2, viewId }));
473
- return response;
474
- } finally {
475
- dispatch(
476
- setOperationLoading({
477
- operation: `delete_view_${viewId}`,
478
- loading: false
479
- })
480
- );
481
- }
482
- };
483
- const refresh = _react.useCallback.call(void 0, () => {
484
- if (!natsConnected || !orgId) return;
485
- if (entityName) {
486
- loadDefinition(entityName);
487
- } else {
488
- dispatch(setLoading(true));
489
- loadDefinitions().finally(() => dispatch(setLoading(false)));
490
- }
491
- }, [natsConnected, orgId, entityName, loadDefinition, dispatch]);
492
- return {
493
- // State
494
- definitions,
495
- selectedDefinition,
496
- views,
497
- selectedView,
498
- isLoading,
499
- loadingStates,
500
- error,
501
- // Organization operations
502
- createOrgSchema,
503
- dropOrgSchema,
504
- // Definition operations
505
- loadDefinitions,
506
- loadDefinition,
507
- createDefinition,
508
- updateDefinition: updateDefinitionById,
509
- deleteDefinition,
510
- // View operations
511
- loadViews,
512
- createView,
513
- updateView: updateViewById,
514
- deleteView,
515
- // Utilities
516
- refresh
517
- };
518
- }
519
-
520
- // hooks/use-entity-definition-details.ts
521
-
522
- function useEntityDefinitionDetails(entityName) {
523
- const context = useEntityDefinitionContext();
524
- const definition = context.definitions[entityName];
525
- const loadDefinitionDetails = _react.useCallback.call(void 0, async () => {
526
- return context.loadDefinition(entityName);
527
- }, [context, entityName]);
528
- _react.useEffect.call(void 0, () => {
529
- if (entityName && !definition) {
530
- loadDefinitionDetails();
531
- }
532
- }, [definition, entityName, loadDefinitionDetails]);
533
- return {
534
- definition,
535
- isLoading: context.loadingStates[`load_${entityName}`],
536
- error: context.error,
537
- updateDefinition: (updatedDef) => context.updateDefinition(entityName, updatedDef),
538
- deleteDefinition: () => context.deleteDefinition(entityName),
539
- refresh: loadDefinitionDetails
540
- };
541
- }
542
-
543
- // hooks/use-entity-record.ts
544
-
545
-
546
-
547
-
548
182
  // store/entity-record-slice.ts
549
183
 
550
184
  var initialState2 = {
@@ -638,343 +272,6 @@ var {
638
272
  } = entityRecordSlice.actions;
639
273
  var entityRecordReducer = entityRecordSlice.reducer;
640
274
 
641
- // hooks/use-entity-record.ts
642
- var defaultQuery = {
643
- filters: {},
644
- page: 1,
645
- pageSize: 25,
646
- sortBy: "metadata.createdAt",
647
- sortOrder: -1
648
- };
649
- function useEntityRecord(orgId, entityName, options = {}) {
650
- const { autoLoad = true } = options;
651
- const { natsConnected, request } = _nats.useNatsContext.call(void 0, );
652
- const dispatch = _reactredux.useDispatch.call(void 0, );
653
- const recordState = _reactredux.useSelector.call(void 0,
654
- (state) => state.entityRecord.records[entityName] || {
655
- items: {},
656
- params: defaultQuery,
657
- meta: {
658
- items: [],
659
- totalCount: 0,
660
- currentPage: 1,
661
- pageSize: 25,
662
- totalPages: 0
663
- },
664
- selected: []
665
- }
666
- );
667
- const selectedRecord = _reactredux.useSelector.call(void 0,
668
- (state) => state.entityRecord.selectedRecord
669
- );
670
- const isLoading = _reactredux.useSelector.call(void 0,
671
- (state) => state.entityRecord.isLoading
672
- );
673
- const loadingStates = _reactredux.useSelector.call(void 0,
674
- (state) => state.entityRecord.loadingStates
675
- );
676
- const error = _reactredux.useSelector.call(void 0,
677
- (state) => state.entityRecord.error
678
- );
679
- const loadRecords = _react.useCallback.call(void 0,
680
- async (params) => {
681
- if (!natsConnected || !orgId) return;
682
- const loadingKey = `load_${entityName}`;
683
- if (loadingStates[loadingKey]) return;
684
- dispatch(setOperationLoading2({ operation: loadingKey, loading: true }));
685
- try {
686
- const queryParams = { ...recordState.params, ...params };
687
- const response = await request(
688
- _chunk4GC36G4Djs.EntityRecordQuery,
689
- {
690
- orgId,
691
- entityName,
692
- query: queryParams
693
- }
694
- );
695
- if (response instanceof Error) {
696
- dispatch(setError2(response.message));
697
- } else if (response.records) {
698
- dispatch(
699
- setRecords({
700
- entityName,
701
- records: response.records,
702
- params: queryParams
703
- })
704
- );
705
- }
706
- } catch (err) {
707
- dispatch(
708
- setError2(err instanceof Error ? err.message : "Unknown error")
709
- );
710
- } finally {
711
- dispatch(
712
- setOperationLoading2({ operation: loadingKey, loading: false })
713
- );
714
- }
715
- },
716
- [natsConnected, orgId, entityName, recordState.params, dispatch, request]
717
- );
718
- const loadRecord = _react.useCallback.call(void 0,
719
- async (recordId) => {
720
- if (!natsConnected || !orgId) return;
721
- const loadingKey = `load_${recordId}`;
722
- if (loadingStates[loadingKey]) return;
723
- dispatch(setOperationLoading2({ operation: loadingKey, loading: true }));
724
- try {
725
- const response = await request(_chunk4GC36G4Djs.EntityRecordGet, { entityName, recordId, orgId }, {});
726
- if (response instanceof Error) {
727
- dispatch(setError2(response.message));
728
- return;
729
- }
730
- dispatch(setSelectedRecord({ record: response.record }));
731
- } finally {
732
- dispatch(
733
- setOperationLoading2({ operation: loadingKey, loading: false })
734
- );
735
- }
736
- },
737
- [natsConnected, orgId, entityName, recordState.params, dispatch, request]
738
- );
739
- const createRecord = async (record) => {
740
- if (!natsConnected || !orgId) {
741
- throw new Error("Not connected or missing orgId");
742
- }
743
- dispatch(
744
- setOperationLoading2({ operation: "create_record", loading: true })
745
- );
746
- try {
747
- const response = await request(
748
- _chunk4GC36G4Djs.EntityRecordCreate,
749
- {
750
- orgId,
751
- entityName,
752
- record
753
- }
754
- );
755
- if (response instanceof Error) {
756
- throw response;
757
- }
758
- if (response.metadata.success) {
759
- dispatch(addRecord({ entityName, record: response.record }));
760
- }
761
- loadRecords();
762
- return response;
763
- } finally {
764
- dispatch(
765
- setOperationLoading2({ operation: "create_record", loading: false })
766
- );
767
- }
768
- };
769
- const updateRecordById = async (record) => {
770
- if (!natsConnected || !orgId) {
771
- throw new Error("Not connected or missing orgId");
772
- }
773
- dispatch(
774
- setOperationLoading2({ operation: `update_${record.id}`, loading: true })
775
- );
776
- try {
777
- const response = await request(
778
- _chunk4GC36G4Djs.EntityRecordUpdate,
779
- {
780
- orgId,
781
- entityName,
782
- record,
783
- recordId: record.id
784
- }
785
- );
786
- if (response instanceof Error) {
787
- throw response;
788
- }
789
- dispatch(updateRecord({ entityName, record: response.record }));
790
- return response;
791
- } finally {
792
- dispatch(
793
- setOperationLoading2({
794
- operation: `update_${record.id}`,
795
- loading: false
796
- })
797
- );
798
- }
799
- };
800
- const deleteRecordById = async (recordId) => {
801
- if (!natsConnected || !orgId) {
802
- throw new Error("Not connected or missing orgId");
803
- }
804
- dispatch(
805
- setOperationLoading2({ operation: `delete_${recordId}`, loading: true })
806
- );
807
- try {
808
- const response = await request(
809
- _chunk4GC36G4Djs.EntityRecordDelete,
810
- {
811
- orgId,
812
- entityName,
813
- recordId
814
- }
815
- );
816
- if (response instanceof Error) {
817
- throw response;
818
- }
819
- dispatch(removeRecord({ entityName, recordId }));
820
- return response;
821
- } finally {
822
- dispatch(
823
- setOperationLoading2({ operation: `delete_${recordId}`, loading: false })
824
- );
825
- }
826
- };
827
- const countRecords = async (filters) => {
828
- if (!natsConnected || !orgId) {
829
- throw new Error("Not connected or missing orgId");
830
- }
831
- try {
832
- const response = await request(
833
- _chunk4GC36G4Djs.EntityRecordCount,
834
- {
835
- orgId,
836
- entityName,
837
- filters: filters || {}
838
- }
839
- );
840
- if (response instanceof Error) {
841
- throw response;
842
- }
843
- if (!_optionalChain([response, 'access', _10 => _10.metadata, 'optionalAccess', _11 => _11.success])) {
844
- throw new Error(_optionalChain([response, 'access', _12 => _12.metadata, 'optionalAccess', _13 => _13.error]) || "Failed to count records");
845
- }
846
- return response.count || 0;
847
- } catch (err) {
848
- console.error("Error counting records:", err);
849
- return 0;
850
- }
851
- };
852
- const getEntityRecordById = async (recordId) => {
853
- if (!natsConnected || !orgId) {
854
- throw new Error("Not connected or missing orgId");
855
- }
856
- try {
857
- const response = await request(_chunk4GC36G4Djs.EntityRecordGet, { entityName, recordId, orgId }, {});
858
- if (response instanceof Error) {
859
- console.error("Error fetching record:", response.message);
860
- return null;
861
- }
862
- return response.record || null;
863
- } catch (error2) {
864
- console.error("Error in getEntityRecordById:", error2);
865
- return null;
866
- }
867
- };
868
- const selectRecords = (ids) => {
869
- dispatch(setSelected({ entityName, ids }));
870
- };
871
- const clearSelection = () => {
872
- dispatch(setSelected({ entityName, ids: [] }));
873
- };
874
- const updateParams = (params) => {
875
- console.log("updating query params", params);
876
- dispatch(updateQueryParams({ entityName, params }));
877
- loadRecords(params);
878
- };
879
- const refresh = _react.useCallback.call(void 0, () => {
880
- loadRecords();
881
- }, [loadRecords]);
882
- _react.useEffect.call(void 0, () => {
883
- let mounted = true;
884
- if (autoLoad && natsConnected && orgId && mounted) {
885
- loadRecords();
886
- }
887
- return () => {
888
- mounted = false;
889
- };
890
- }, [autoLoad, natsConnected, orgId]);
891
- return {
892
- // State
893
- records: recordState.items,
894
- params: recordState.params,
895
- selected: recordState.selected,
896
- selectedRecord,
897
- isLoading,
898
- loadingStates,
899
- error,
900
- // Operations
901
- loadRecords,
902
- createRecord,
903
- updateRecord: updateRecordById,
904
- deleteRecord: deleteRecordById,
905
- loadRecord,
906
- countRecords,
907
- getEntityRecordById,
908
- // Selection
909
- selectRecords,
910
- clearSelection,
911
- // Query
912
- updateParams,
913
- refresh
914
- };
915
- }
916
-
917
- // hooks/use-debounce.ts
918
-
919
- function useDebounce(callback, delay) {
920
- const timerRef = _react.useRef.call(void 0, null);
921
- return _react.useCallback.call(void 0, (...args) => {
922
- if (timerRef.current) {
923
- clearTimeout(timerRef.current);
924
- }
925
- timerRef.current = setTimeout(() => {
926
- callback(...args);
927
- }, delay);
928
- }, [callback, delay]);
929
- }
930
-
931
- // context/entity-definition-context.tsx
932
- var _jsxruntime = require('react/jsx-runtime');
933
- var EntityDefinitionContext = _react.createContext.call(void 0, void 0);
934
- function EntityDefinitionProvider({
935
- children,
936
- orgId,
937
- entityName,
938
- options = {}
939
- }) {
940
- const hookValue = useEntityDefinition(orgId, entityName, options);
941
- const value = _react.useMemo.call(void 0, () => hookValue, [hookValue]);
942
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EntityDefinitionContext.Provider, { value, children });
943
- }
944
- function useEntityDefinitionContext() {
945
- const context = _react.useContext.call(void 0, EntityDefinitionContext);
946
- if (!context) {
947
- throw new Error(
948
- "useEntityDefinitionContext must be used within an EntityDefinitionProvider"
949
- );
950
- }
951
- return context;
952
- }
953
-
954
- // context/entity-record-context.tsx
955
-
956
-
957
- var EntityRecordContext = _react.createContext.call(void 0, void 0);
958
- function EntityRecordProvider({
959
- children,
960
- orgId,
961
- entityName,
962
- options = {}
963
- }) {
964
- const hookValue = useEntityRecord(orgId, entityName, options);
965
- const value = _react.useMemo.call(void 0, () => hookValue, [hookValue]);
966
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EntityRecordContext.Provider, { value, children });
967
- }
968
- function useEntityRecordContext() {
969
- const context = _react.useContext.call(void 0, EntityRecordContext);
970
- if (!context) {
971
- throw new Error(
972
- "useEntityRecordContext must be used within an EntityRecordProvider"
973
- );
974
- }
975
- return context;
976
- }
977
-
978
275
  // consts/colors.ts
979
276
  var PREDEFINED_COLORS = [
980
277
  { value: "#EF4444", name: "Red" },
@@ -1061,15 +358,5 @@ var PREDEFINED_COLORS = [
1061
358
 
1062
359
 
1063
360
 
1064
-
1065
-
1066
-
1067
-
1068
-
1069
-
1070
-
1071
-
1072
-
1073
-
1074
- exports.EntityDefinitionContext = EntityDefinitionContext; exports.EntityDefinitionCreate = _chunk4GC36G4Djs.EntityDefinitionCreate; exports.EntityDefinitionCreated = _chunk4GC36G4Djs.EntityDefinitionCreated; exports.EntityDefinitionDelete = _chunk4GC36G4Djs.EntityDefinitionDelete; exports.EntityDefinitionDeleted = _chunk4GC36G4Djs.EntityDefinitionDeleted; exports.EntityDefinitionGet = _chunk4GC36G4Djs.EntityDefinitionGet; exports.EntityDefinitionGetServer = _chunk4GC36G4Djs.EntityDefinitionGetServer; exports.EntityDefinitionList = _chunk4GC36G4Djs.EntityDefinitionList; exports.EntityDefinitionProvider = EntityDefinitionProvider; exports.EntityDefinitionUpdate = _chunk4GC36G4Djs.EntityDefinitionUpdate; exports.EntityDefinitionUpdated = _chunk4GC36G4Djs.EntityDefinitionUpdated; exports.EntityFieldTypeBool = _chunk4GC36G4Djs.EntityFieldTypeBool; exports.EntityFieldTypeCurrency = _chunk4GC36G4Djs.EntityFieldTypeCurrency; exports.EntityFieldTypeDate = _chunk4GC36G4Djs.EntityFieldTypeDate; exports.EntityFieldTypeDateTime = _chunk4GC36G4Djs.EntityFieldTypeDateTime; exports.EntityFieldTypeDropdown = _chunk4GC36G4Djs.EntityFieldTypeDropdown; exports.EntityFieldTypeEmail = _chunk4GC36G4Djs.EntityFieldTypeEmail; exports.EntityFieldTypeFile = _chunk4GC36G4Djs.EntityFieldTypeFile; exports.EntityFieldTypeFloat = _chunk4GC36G4Djs.EntityFieldTypeFloat; exports.EntityFieldTypeImage = _chunk4GC36G4Djs.EntityFieldTypeImage; exports.EntityFieldTypeInt = _chunk4GC36G4Djs.EntityFieldTypeInt; exports.EntityFieldTypeJSON = _chunk4GC36G4Djs.EntityFieldTypeJSON; exports.EntityFieldTypeLookup = _chunk4GC36G4Djs.EntityFieldTypeLookup; exports.EntityFieldTypeMultiLookup = _chunk4GC36G4Djs.EntityFieldTypeMultiLookup; exports.EntityFieldTypeMultiSelect = _chunk4GC36G4Djs.EntityFieldTypeMultiSelect; exports.EntityFieldTypePhone = _chunk4GC36G4Djs.EntityFieldTypePhone; exports.EntityFieldTypeString = _chunk4GC36G4Djs.EntityFieldTypeString; exports.EntityFieldTypeStringMultiline = _chunk4GC36G4Djs.EntityFieldTypeStringMultiline; exports.EntityFieldTypeText = _chunk4GC36G4Djs.EntityFieldTypeText; exports.EntityFieldTypeURL = _chunk4GC36G4Djs.EntityFieldTypeURL; exports.EntityFieldTypes = _chunk4GC36G4Djs.EntityFieldTypes; exports.EntityFilterOperators = _chunk4GC36G4Djs.EntityFilterOperators; exports.EntityOrgSchemaCreate = _chunk4GC36G4Djs.EntityOrgSchemaCreate; exports.EntityOrgSchemaDrop = _chunk4GC36G4Djs.EntityOrgSchemaDrop; exports.EntityRecordContext = EntityRecordContext; exports.EntityRecordCount = _chunk4GC36G4Djs.EntityRecordCount; exports.EntityRecordCreate = _chunk4GC36G4Djs.EntityRecordCreate; exports.EntityRecordCreated = _chunk4GC36G4Djs.EntityRecordCreated; exports.EntityRecordDelete = _chunk4GC36G4Djs.EntityRecordDelete; exports.EntityRecordDeleted = _chunk4GC36G4Djs.EntityRecordDeleted; exports.EntityRecordGet = _chunk4GC36G4Djs.EntityRecordGet; exports.EntityRecordProvider = EntityRecordProvider; exports.EntityRecordQuery = _chunk4GC36G4Djs.EntityRecordQuery; exports.EntityRecordUpdate = _chunk4GC36G4Djs.EntityRecordUpdate; exports.EntityRecordUpdated = _chunk4GC36G4Djs.EntityRecordUpdated; exports.EntityRecordsBulkCreate = _chunk4GC36G4Djs.EntityRecordsBulkCreate; exports.EntityRecordsBulkCreated = _chunk4GC36G4Djs.EntityRecordsBulkCreated; exports.EntityRecordsBulkDelete = _chunk4GC36G4Djs.EntityRecordsBulkDelete; exports.EntityRecordsBulkDeleted = _chunk4GC36G4Djs.EntityRecordsBulkDeleted; exports.EntityRecordsBulkUpdate = _chunk4GC36G4Djs.EntityRecordsBulkUpdate; exports.EntityRecordsBulkUpdated = _chunk4GC36G4Djs.EntityRecordsBulkUpdated; exports.EntityViewCreate = _chunk4GC36G4Djs.EntityViewCreate; exports.EntityViewCreated = _chunk4GC36G4Djs.EntityViewCreated; exports.EntityViewDelete = _chunk4GC36G4Djs.EntityViewDelete; exports.EntityViewDeleted = _chunk4GC36G4Djs.EntityViewDeleted; exports.EntityViewList = _chunk4GC36G4Djs.EntityViewList; exports.EntityViewUpdate = _chunk4GC36G4Djs.EntityViewUpdate; exports.EntityViewUpdated = _chunk4GC36G4Djs.EntityViewUpdated; exports.OperatorBetween = _chunk4GC36G4Djs.OperatorBetween; exports.OperatorContains = _chunk4GC36G4Djs.OperatorContains; exports.OperatorEmpty = _chunk4GC36G4Djs.OperatorEmpty; exports.OperatorEndsWith = _chunk4GC36G4Djs.OperatorEndsWith; exports.OperatorEq = _chunk4GC36G4Djs.OperatorEq; exports.OperatorExists = _chunk4GC36G4Djs.OperatorExists; exports.OperatorGt = _chunk4GC36G4Djs.OperatorGt; exports.OperatorGte = _chunk4GC36G4Djs.OperatorGte; exports.OperatorIn = _chunk4GC36G4Djs.OperatorIn; exports.OperatorLt = _chunk4GC36G4Djs.OperatorLt; exports.OperatorLte = _chunk4GC36G4Djs.OperatorLte; exports.OperatorNe = _chunk4GC36G4Djs.OperatorNe; exports.OperatorNin = _chunk4GC36G4Djs.OperatorNin; exports.OperatorStartsWith = _chunk4GC36G4Djs.OperatorStartsWith; exports.PREDEFINED_COLORS = PREDEFINED_COLORS; exports.RecordChangeActionCreated = _chunk4GC36G4Djs.RecordChangeActionCreated; exports.RecordChangeActionDeleted = _chunk4GC36G4Djs.RecordChangeActionDeleted; exports.RecordChangeActionUpdated = _chunk4GC36G4Djs.RecordChangeActionUpdated; exports.entityDefinitionReducer = entityDefinitionReducer; exports.entityRecordReducer = entityRecordReducer; exports.useDebounce = useDebounce; exports.useEntityDefinition = useEntityDefinition; exports.useEntityDefinitionContext = useEntityDefinitionContext; exports.useEntityDefinitionDetails = useEntityDefinitionDetails; exports.useEntityRecord = useEntityRecord; exports.useEntityRecordContext = useEntityRecordContext;
361
+ exports.EntityDefinitionCreate = _chunk4GC36G4Djs.EntityDefinitionCreate; exports.EntityDefinitionCreated = _chunk4GC36G4Djs.EntityDefinitionCreated; exports.EntityDefinitionDelete = _chunk4GC36G4Djs.EntityDefinitionDelete; exports.EntityDefinitionDeleted = _chunk4GC36G4Djs.EntityDefinitionDeleted; exports.EntityDefinitionGet = _chunk4GC36G4Djs.EntityDefinitionGet; exports.EntityDefinitionGetServer = _chunk4GC36G4Djs.EntityDefinitionGetServer; exports.EntityDefinitionList = _chunk4GC36G4Djs.EntityDefinitionList; exports.EntityDefinitionUpdate = _chunk4GC36G4Djs.EntityDefinitionUpdate; exports.EntityDefinitionUpdated = _chunk4GC36G4Djs.EntityDefinitionUpdated; exports.EntityFieldTypeBool = _chunk4GC36G4Djs.EntityFieldTypeBool; exports.EntityFieldTypeCurrency = _chunk4GC36G4Djs.EntityFieldTypeCurrency; exports.EntityFieldTypeDate = _chunk4GC36G4Djs.EntityFieldTypeDate; exports.EntityFieldTypeDateTime = _chunk4GC36G4Djs.EntityFieldTypeDateTime; exports.EntityFieldTypeDropdown = _chunk4GC36G4Djs.EntityFieldTypeDropdown; exports.EntityFieldTypeEmail = _chunk4GC36G4Djs.EntityFieldTypeEmail; exports.EntityFieldTypeFile = _chunk4GC36G4Djs.EntityFieldTypeFile; exports.EntityFieldTypeFloat = _chunk4GC36G4Djs.EntityFieldTypeFloat; exports.EntityFieldTypeImage = _chunk4GC36G4Djs.EntityFieldTypeImage; exports.EntityFieldTypeInt = _chunk4GC36G4Djs.EntityFieldTypeInt; exports.EntityFieldTypeJSON = _chunk4GC36G4Djs.EntityFieldTypeJSON; exports.EntityFieldTypeLookup = _chunk4GC36G4Djs.EntityFieldTypeLookup; exports.EntityFieldTypeMultiLookup = _chunk4GC36G4Djs.EntityFieldTypeMultiLookup; exports.EntityFieldTypeMultiSelect = _chunk4GC36G4Djs.EntityFieldTypeMultiSelect; exports.EntityFieldTypePhone = _chunk4GC36G4Djs.EntityFieldTypePhone; exports.EntityFieldTypeString = _chunk4GC36G4Djs.EntityFieldTypeString; exports.EntityFieldTypeStringMultiline = _chunk4GC36G4Djs.EntityFieldTypeStringMultiline; exports.EntityFieldTypeText = _chunk4GC36G4Djs.EntityFieldTypeText; exports.EntityFieldTypeURL = _chunk4GC36G4Djs.EntityFieldTypeURL; exports.EntityFieldTypes = _chunk4GC36G4Djs.EntityFieldTypes; exports.EntityFilterOperators = _chunk4GC36G4Djs.EntityFilterOperators; exports.EntityOrgSchemaCreate = _chunk4GC36G4Djs.EntityOrgSchemaCreate; exports.EntityOrgSchemaDrop = _chunk4GC36G4Djs.EntityOrgSchemaDrop; exports.EntityRecordCount = _chunk4GC36G4Djs.EntityRecordCount; exports.EntityRecordCreate = _chunk4GC36G4Djs.EntityRecordCreate; exports.EntityRecordCreated = _chunk4GC36G4Djs.EntityRecordCreated; exports.EntityRecordDelete = _chunk4GC36G4Djs.EntityRecordDelete; exports.EntityRecordDeleted = _chunk4GC36G4Djs.EntityRecordDeleted; exports.EntityRecordGet = _chunk4GC36G4Djs.EntityRecordGet; exports.EntityRecordQuery = _chunk4GC36G4Djs.EntityRecordQuery; exports.EntityRecordUpdate = _chunk4GC36G4Djs.EntityRecordUpdate; exports.EntityRecordUpdated = _chunk4GC36G4Djs.EntityRecordUpdated; exports.EntityRecordsBulkCreate = _chunk4GC36G4Djs.EntityRecordsBulkCreate; exports.EntityRecordsBulkCreated = _chunk4GC36G4Djs.EntityRecordsBulkCreated; exports.EntityRecordsBulkDelete = _chunk4GC36G4Djs.EntityRecordsBulkDelete; exports.EntityRecordsBulkDeleted = _chunk4GC36G4Djs.EntityRecordsBulkDeleted; exports.EntityRecordsBulkUpdate = _chunk4GC36G4Djs.EntityRecordsBulkUpdate; exports.EntityRecordsBulkUpdated = _chunk4GC36G4Djs.EntityRecordsBulkUpdated; exports.EntityViewCreate = _chunk4GC36G4Djs.EntityViewCreate; exports.EntityViewCreated = _chunk4GC36G4Djs.EntityViewCreated; exports.EntityViewDelete = _chunk4GC36G4Djs.EntityViewDelete; exports.EntityViewDeleted = _chunk4GC36G4Djs.EntityViewDeleted; exports.EntityViewList = _chunk4GC36G4Djs.EntityViewList; exports.EntityViewUpdate = _chunk4GC36G4Djs.EntityViewUpdate; exports.EntityViewUpdated = _chunk4GC36G4Djs.EntityViewUpdated; exports.OperatorBetween = _chunk4GC36G4Djs.OperatorBetween; exports.OperatorContains = _chunk4GC36G4Djs.OperatorContains; exports.OperatorEmpty = _chunk4GC36G4Djs.OperatorEmpty; exports.OperatorEndsWith = _chunk4GC36G4Djs.OperatorEndsWith; exports.OperatorEq = _chunk4GC36G4Djs.OperatorEq; exports.OperatorExists = _chunk4GC36G4Djs.OperatorExists; exports.OperatorGt = _chunk4GC36G4Djs.OperatorGt; exports.OperatorGte = _chunk4GC36G4Djs.OperatorGte; exports.OperatorIn = _chunk4GC36G4Djs.OperatorIn; exports.OperatorLt = _chunk4GC36G4Djs.OperatorLt; exports.OperatorLte = _chunk4GC36G4Djs.OperatorLte; exports.OperatorNe = _chunk4GC36G4Djs.OperatorNe; exports.OperatorNin = _chunk4GC36G4Djs.OperatorNin; exports.OperatorStartsWith = _chunk4GC36G4Djs.OperatorStartsWith; exports.PREDEFINED_COLORS = PREDEFINED_COLORS; exports.RecordChangeActionCreated = _chunk4GC36G4Djs.RecordChangeActionCreated; exports.RecordChangeActionDeleted = _chunk4GC36G4Djs.RecordChangeActionDeleted; exports.RecordChangeActionUpdated = _chunk4GC36G4Djs.RecordChangeActionUpdated; exports.entityDefinitionReducer = entityDefinitionReducer; exports.entityRecordReducer = entityRecordReducer;
1075
362
  //# sourceMappingURL=index.js.map