@gzl10/nexus-sdk 0.20.0 → 1.0.0-alpha.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.
@@ -182,7 +182,7 @@ function useImageField(config) {
182
182
  accept = "image/*",
183
183
  maxSize = "1MB",
184
184
  folder,
185
- isPublic,
185
+ visibility,
186
186
  dedupe,
187
187
  required,
188
188
  nullable,
@@ -202,7 +202,7 @@ function useImageField(config) {
202
202
  accept,
203
203
  maxSize: parseFileSize(maxSize),
204
204
  folder,
205
- isPublic,
205
+ visibility,
206
206
  dedupe
207
207
  },
208
208
  meta: {
@@ -218,7 +218,7 @@ function useFileField(config) {
218
218
  accept = "*/*",
219
219
  maxSize = "10MB",
220
220
  folder,
221
- isPublic,
221
+ visibility,
222
222
  dedupe,
223
223
  required,
224
224
  nullable,
@@ -238,7 +238,7 @@ function useFileField(config) {
238
238
  accept,
239
239
  maxSize: parseFileSize(maxSize),
240
240
  folder,
241
- isPublic,
241
+ visibility,
242
242
  dedupe
243
243
  },
244
244
  meta: {
@@ -255,7 +255,7 @@ function useMultiImageField(config) {
255
255
  maxSize = "1MB",
256
256
  maxFiles = 10,
257
257
  folder,
258
- isPublic,
258
+ visibility,
259
259
  dedupe,
260
260
  thumbnails,
261
261
  required,
@@ -277,7 +277,7 @@ function useMultiImageField(config) {
277
277
  maxSize: parseFileSize(maxSize),
278
278
  maxFiles,
279
279
  folder,
280
- isPublic,
280
+ visibility,
281
281
  dedupe,
282
282
  thumbnails
283
283
  },
@@ -295,7 +295,7 @@ function useMultiFileField(config) {
295
295
  maxSize = "10MB",
296
296
  maxFiles = 10,
297
297
  folder,
298
- isPublic,
298
+ visibility,
299
299
  dedupe,
300
300
  required,
301
301
  nullable,
@@ -316,7 +316,7 @@ function useMultiFileField(config) {
316
316
  maxSize: parseFileSize(maxSize),
317
317
  maxFiles,
318
318
  folder,
319
- isPublic,
319
+ visibility,
320
320
  dedupe
321
321
  },
322
322
  meta: {
@@ -527,6 +527,26 @@ function useCodeField(config) {
527
527
  };
528
528
  }
529
529
 
530
+ // src/fields/cron.ts
531
+ function useCronField(config) {
532
+ const { label, hint, required, nullable, defaultValue, placeholder, meta, ...overrides } = config ?? {};
533
+ return {
534
+ label: label ?? { en: "Cron Expression", es: "Expresi\xF3n Cron" },
535
+ input: "cron",
536
+ hint,
537
+ required: required ?? true,
538
+ defaultValue,
539
+ placeholder: placeholder ?? "* * * * *",
540
+ db: {
541
+ type: "string",
542
+ size: 50,
543
+ nullable: nullable ?? !(required ?? true)
544
+ },
545
+ meta,
546
+ ...overrides
547
+ };
548
+ }
549
+
530
550
  // src/fields/json.ts
531
551
  function useJsonField(config) {
532
552
  const { label, hint, required, nullable, meta, ...overrides } = config ?? {};
@@ -615,6 +635,7 @@ function useLocalizedField(config) {
615
635
  return {
616
636
  label: label ?? { en: "Content", es: "Contenido" },
617
637
  input: "text",
638
+ localized: true,
618
639
  hint,
619
640
  required,
620
641
  defaultValue: {},
@@ -740,6 +761,19 @@ function useTagsField(config) {
740
761
  };
741
762
  }
742
763
 
764
+ // src/fields/attachments.ts
765
+ function useAttachmentsField(config) {
766
+ const { label, hint, accept, maxFiles, ...overrides } = config ?? {};
767
+ return {
768
+ label: label ?? { en: "Attachments", es: "Adjuntos" },
769
+ input: "attachments",
770
+ hint,
771
+ storage: accept || maxFiles ? { accept, maxFiles } : void 0,
772
+ meta: { showInDisplay: true, showInForm: true },
773
+ ...overrides
774
+ };
775
+ }
776
+
743
777
  // src/fields/name.ts
744
778
  function useNameField(config) {
745
779
  const {
@@ -967,6 +1001,7 @@ export {
967
1001
  useSelectField,
968
1002
  useTextareaField,
969
1003
  useCodeField,
1004
+ useCronField,
970
1005
  useJsonField,
971
1006
  useDatetimeField,
972
1007
  useNumberField,
@@ -977,6 +1012,7 @@ export {
977
1012
  useCheckboxField,
978
1013
  usePasswordField,
979
1014
  useTagsField,
1015
+ useAttachmentsField,
980
1016
  useNameField,
981
1017
  useDescriptionField,
982
1018
  useMetadataField,
@@ -1,6 +1,7 @@
1
- import { L as LocalizedString, b as FieldDefinition } from '../field-Bs1fIux8.js';
2
- import { d as CollectionEntityDefinition, f as DagEntityDefinition, e as EventEntityDefinition, aL as RolePermission } from '../entity-en_fBKjq.js';
1
+ import { L as LocalizedString, c as FieldDefinition } from '../field-DtWJTIA9.js';
2
+ import { d as CollectionEntityDefinition, f as DagEntityDefinition, e as EventEntityDefinition, aO as RolePermission } from '../entity-DocS_76e.js';
3
3
  import 'knex';
4
+ import 'hono';
4
5
  import 'express';
5
6
  import 'pino';
6
7
 
@@ -67,7 +68,7 @@ type EntityFactory<T> = (config?: CollectionEntityConfig) => T;
67
68
 
68
69
  /**
69
70
  * Default CASL permissions for polymorphic entities.
70
- * - All users can read
71
+ * - All authenticated users can read
71
72
  * - Authenticated users can create (own)
72
73
  * - Users can update/delete their own records
73
74
  * - Admins can manage all
@@ -17,11 +17,11 @@ import {
17
17
  useTextareaField,
18
18
  useUrlField,
19
19
  userIdField
20
- } from "../chunk-WHLUKKQO.js";
20
+ } from "../chunk-JBZMM3WF.js";
21
21
 
22
22
  // src/collection/helpers.ts
23
23
  var polymorphicCaslPermissions = {
24
- "*": { actions: ["read"] },
24
+ "@": { actions: ["read"] },
25
25
  USER: {
26
26
  actions: ["create", "update", "delete"],
27
27
  conditions: { user_id: "${user.id}" }
@@ -215,9 +215,9 @@ var createAttachmentsEntity = createEntityFactory(
215
215
 
216
216
  // src/collection/polymorphic/tags.entity.ts
217
217
  var DEFAULT_TABLE3 = "tags";
218
- var DEFAULT_SUBJECT3 = "NxTag";
218
+ var DEFAULT_SUBJECT3 = "TaxonomyTag";
219
219
  var tagsCaslPermissions = {
220
- "*": { actions: ["read"] },
220
+ "@": { actions: ["read"] },
221
221
  USER: { actions: ["create"] },
222
222
  ADMIN: { actions: ["manage"] }
223
223
  };
@@ -303,7 +303,7 @@ var tagEntitiesEntity = {
303
303
  { columns: ["entity_type", "entity_id"] }
304
304
  ],
305
305
  casl: {
306
- subject: "NxTagEntity",
306
+ subject: "TaxonomyPolymorphicTag",
307
307
  permissions: tagsCaslPermissions
308
308
  }
309
309
  };
@@ -425,7 +425,7 @@ var createFavoritesEntity = createEntityFactory(
425
425
  var DEFAULT_TABLE6 = "ratings";
426
426
  var DEFAULT_SUBJECT6 = "NxRating";
427
427
  var ratingsCaslPermissions = {
428
- "*": { actions: ["read"] },
428
+ "@": { actions: ["read"] },
429
429
  USER: {
430
430
  actions: ["create", "update", "delete"],
431
431
  conditions: { user_id: "${user.id}" }
@@ -488,7 +488,7 @@ var createRatingsEntity = createEntityFactory(
488
488
  var DEFAULT_TABLE7 = "reactions";
489
489
  var DEFAULT_SUBJECT7 = "NxReaction";
490
490
  var reactionsCaslPermissions = {
491
- "*": { actions: ["read"] },
491
+ "@": { actions: ["read"] },
492
492
  USER: {
493
493
  actions: ["create", "delete"],
494
494
  conditions: { user_id: "${user.id}" }
@@ -622,7 +622,7 @@ var createMentionsEntity = createEntityFactory(
622
622
  var DEFAULT_TABLE9 = "options";
623
623
  var DEFAULT_SUBJECT9 = "NxOption";
624
624
  var optionsCaslPermissions = {
625
- "*": { actions: ["read"] },
625
+ "@": { actions: ["read"] },
626
626
  ADMIN: { actions: ["manage"] }
627
627
  };
628
628
  var OPTION_GROUPS = {