@objectstack/plugin-security 4.1.0 → 4.2.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.d.mts CHANGED
@@ -847,7 +847,7 @@ declare const securityObjects: ((Omit<{
847
847
  addRecord?: {
848
848
  enabled: boolean;
849
849
  position: "top" | "bottom" | "both";
850
- mode: "modal" | "inline" | "form";
850
+ mode: "modal" | "form" | "inline";
851
851
  formView?: string | undefined;
852
852
  } | undefined;
853
853
  showRecordCount?: boolean | undefined;
@@ -895,6 +895,7 @@ declare const securityObjects: ((Omit<{
895
895
  debounceMs?: number | undefined;
896
896
  } | undefined;
897
897
  }> | undefined;
898
+ defaultDetailForm?: string | undefined;
898
899
  search?: {
899
900
  fields: string[];
900
901
  displayFields?: string[] | undefined;
@@ -918,7 +919,7 @@ declare const securityObjects: ((Omit<{
918
919
  actions?: {
919
920
  name: string;
920
921
  label: string;
921
- type: "url" | "flow" | "api" | "script" | "modal";
922
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
922
923
  refreshAfter: boolean;
923
924
  objectName?: string | undefined;
924
925
  icon?: string | undefined;
@@ -3192,7 +3193,7 @@ declare const securityObjects: ((Omit<{
3192
3193
  addRecord?: {
3193
3194
  enabled: boolean;
3194
3195
  position: "top" | "bottom" | "both";
3195
- mode: "modal" | "inline" | "form";
3196
+ mode: "modal" | "form" | "inline";
3196
3197
  formView?: string | undefined;
3197
3198
  } | undefined;
3198
3199
  showRecordCount?: boolean | undefined;
@@ -3240,6 +3241,7 @@ declare const securityObjects: ((Omit<{
3240
3241
  debounceMs?: number | undefined;
3241
3242
  } | undefined;
3242
3243
  }> | undefined;
3244
+ defaultDetailForm?: string | undefined;
3243
3245
  search?: {
3244
3246
  fields: string[];
3245
3247
  displayFields?: string[] | undefined;
@@ -3263,7 +3265,7 @@ declare const securityObjects: ((Omit<{
3263
3265
  actions?: {
3264
3266
  name: string;
3265
3267
  label: string;
3266
- type: "url" | "flow" | "api" | "script" | "modal";
3268
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
3267
3269
  refreshAfter: boolean;
3268
3270
  objectName?: string | undefined;
3269
3271
  icon?: string | undefined;
@@ -5515,7 +5517,7 @@ declare const securityObjects: ((Omit<{
5515
5517
  addRecord?: {
5516
5518
  enabled: boolean;
5517
5519
  position: "top" | "bottom" | "both";
5518
- mode: "modal" | "inline" | "form";
5520
+ mode: "modal" | "form" | "inline";
5519
5521
  formView?: string | undefined;
5520
5522
  } | undefined;
5521
5523
  showRecordCount?: boolean | undefined;
@@ -5563,6 +5565,7 @@ declare const securityObjects: ((Omit<{
5563
5565
  debounceMs?: number | undefined;
5564
5566
  } | undefined;
5565
5567
  }> | undefined;
5568
+ defaultDetailForm?: string | undefined;
5566
5569
  search?: {
5567
5570
  fields: string[];
5568
5571
  displayFields?: string[] | undefined;
@@ -5586,7 +5589,7 @@ declare const securityObjects: ((Omit<{
5586
5589
  actions?: {
5587
5590
  name: string;
5588
5591
  label: string;
5589
- type: "url" | "flow" | "api" | "script" | "modal";
5592
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
5590
5593
  refreshAfter: boolean;
5591
5594
  objectName?: string | undefined;
5592
5595
  icon?: string | undefined;
@@ -7428,7 +7431,7 @@ declare const securityObjects: ((Omit<{
7428
7431
  addRecord?: {
7429
7432
  enabled: boolean;
7430
7433
  position: "top" | "bottom" | "both";
7431
- mode: "modal" | "inline" | "form";
7434
+ mode: "modal" | "form" | "inline";
7432
7435
  formView?: string | undefined;
7433
7436
  } | undefined;
7434
7437
  showRecordCount?: boolean | undefined;
@@ -7476,6 +7479,7 @@ declare const securityObjects: ((Omit<{
7476
7479
  debounceMs?: number | undefined;
7477
7480
  } | undefined;
7478
7481
  }> | undefined;
7482
+ defaultDetailForm?: string | undefined;
7479
7483
  search?: {
7480
7484
  fields: string[];
7481
7485
  displayFields?: string[] | undefined;
@@ -7499,7 +7503,7 @@ declare const securityObjects: ((Omit<{
7499
7503
  actions?: {
7500
7504
  name: string;
7501
7505
  label: string;
7502
- type: "url" | "flow" | "api" | "script" | "modal";
7506
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
7503
7507
  refreshAfter: boolean;
7504
7508
  objectName?: string | undefined;
7505
7509
  icon?: string | undefined;
package/dist/index.d.ts CHANGED
@@ -847,7 +847,7 @@ declare const securityObjects: ((Omit<{
847
847
  addRecord?: {
848
848
  enabled: boolean;
849
849
  position: "top" | "bottom" | "both";
850
- mode: "modal" | "inline" | "form";
850
+ mode: "modal" | "form" | "inline";
851
851
  formView?: string | undefined;
852
852
  } | undefined;
853
853
  showRecordCount?: boolean | undefined;
@@ -895,6 +895,7 @@ declare const securityObjects: ((Omit<{
895
895
  debounceMs?: number | undefined;
896
896
  } | undefined;
897
897
  }> | undefined;
898
+ defaultDetailForm?: string | undefined;
898
899
  search?: {
899
900
  fields: string[];
900
901
  displayFields?: string[] | undefined;
@@ -918,7 +919,7 @@ declare const securityObjects: ((Omit<{
918
919
  actions?: {
919
920
  name: string;
920
921
  label: string;
921
- type: "url" | "flow" | "api" | "script" | "modal";
922
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
922
923
  refreshAfter: boolean;
923
924
  objectName?: string | undefined;
924
925
  icon?: string | undefined;
@@ -3192,7 +3193,7 @@ declare const securityObjects: ((Omit<{
3192
3193
  addRecord?: {
3193
3194
  enabled: boolean;
3194
3195
  position: "top" | "bottom" | "both";
3195
- mode: "modal" | "inline" | "form";
3196
+ mode: "modal" | "form" | "inline";
3196
3197
  formView?: string | undefined;
3197
3198
  } | undefined;
3198
3199
  showRecordCount?: boolean | undefined;
@@ -3240,6 +3241,7 @@ declare const securityObjects: ((Omit<{
3240
3241
  debounceMs?: number | undefined;
3241
3242
  } | undefined;
3242
3243
  }> | undefined;
3244
+ defaultDetailForm?: string | undefined;
3243
3245
  search?: {
3244
3246
  fields: string[];
3245
3247
  displayFields?: string[] | undefined;
@@ -3263,7 +3265,7 @@ declare const securityObjects: ((Omit<{
3263
3265
  actions?: {
3264
3266
  name: string;
3265
3267
  label: string;
3266
- type: "url" | "flow" | "api" | "script" | "modal";
3268
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
3267
3269
  refreshAfter: boolean;
3268
3270
  objectName?: string | undefined;
3269
3271
  icon?: string | undefined;
@@ -5515,7 +5517,7 @@ declare const securityObjects: ((Omit<{
5515
5517
  addRecord?: {
5516
5518
  enabled: boolean;
5517
5519
  position: "top" | "bottom" | "both";
5518
- mode: "modal" | "inline" | "form";
5520
+ mode: "modal" | "form" | "inline";
5519
5521
  formView?: string | undefined;
5520
5522
  } | undefined;
5521
5523
  showRecordCount?: boolean | undefined;
@@ -5563,6 +5565,7 @@ declare const securityObjects: ((Omit<{
5563
5565
  debounceMs?: number | undefined;
5564
5566
  } | undefined;
5565
5567
  }> | undefined;
5568
+ defaultDetailForm?: string | undefined;
5566
5569
  search?: {
5567
5570
  fields: string[];
5568
5571
  displayFields?: string[] | undefined;
@@ -5586,7 +5589,7 @@ declare const securityObjects: ((Omit<{
5586
5589
  actions?: {
5587
5590
  name: string;
5588
5591
  label: string;
5589
- type: "url" | "flow" | "api" | "script" | "modal";
5592
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
5590
5593
  refreshAfter: boolean;
5591
5594
  objectName?: string | undefined;
5592
5595
  icon?: string | undefined;
@@ -7428,7 +7431,7 @@ declare const securityObjects: ((Omit<{
7428
7431
  addRecord?: {
7429
7432
  enabled: boolean;
7430
7433
  position: "top" | "bottom" | "both";
7431
- mode: "modal" | "inline" | "form";
7434
+ mode: "modal" | "form" | "inline";
7432
7435
  formView?: string | undefined;
7433
7436
  } | undefined;
7434
7437
  showRecordCount?: boolean | undefined;
@@ -7476,6 +7479,7 @@ declare const securityObjects: ((Omit<{
7476
7479
  debounceMs?: number | undefined;
7477
7480
  } | undefined;
7478
7481
  }> | undefined;
7482
+ defaultDetailForm?: string | undefined;
7479
7483
  search?: {
7480
7484
  fields: string[];
7481
7485
  displayFields?: string[] | undefined;
@@ -7499,7 +7503,7 @@ declare const securityObjects: ((Omit<{
7499
7503
  actions?: {
7500
7504
  name: string;
7501
7505
  label: string;
7502
- type: "url" | "flow" | "api" | "script" | "modal";
7506
+ type: "url" | "flow" | "api" | "script" | "modal" | "form";
7503
7507
  refreshAfter: boolean;
7504
7508
  objectName?: string | undefined;
7505
7509
  icon?: string | undefined;
package/dist/index.js CHANGED
@@ -692,8 +692,18 @@ function genId2(prefix) {
692
692
  const ts = Date.now().toString(36);
693
693
  return `${prefix}_${ts}${rand}`;
694
694
  }
695
- function slugify(input) {
696
- return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "workspace";
695
+ function slugify(input, fallback = "workspace") {
696
+ const cleaned = input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
697
+ return cleaned || fallback;
698
+ }
699
+ function deriveSlugFallback(user) {
700
+ if (user.email) {
701
+ const local = user.email.split("@")[0] ?? "";
702
+ const localSlug = local.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
703
+ if (localSlug) return localSlug;
704
+ }
705
+ const idTail = user.id.replace(/[^a-z0-9]/gi, "").slice(-8).toLowerCase();
706
+ return idTail ? `user-${idTail}` : "user";
697
707
  }
698
708
  function deriveBaseName(user) {
699
709
  if (user.name && user.name.trim()) return user.name.trim();
@@ -724,7 +734,8 @@ async function ensureUserHasOrganization(ql, user, options = {}) {
724
734
  }
725
735
  const base = deriveBaseName(user);
726
736
  const orgName = `${base}'s Workspace`;
727
- const baseSlug = slugify(base);
737
+ const slugFallback = deriveSlugFallback(user);
738
+ const baseSlug = slugify(base, slugFallback);
728
739
  let slug = `${baseSlug}-workspace`;
729
740
  for (let attempt = 1; attempt <= 5; attempt += 1) {
730
741
  const collision = await tryFind2(ql, "sys_organization", { slug }, 1);