@objectstack/objectql 6.7.1 → 6.8.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.ts CHANGED
@@ -356,6 +356,132 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
356
356
  }>;
357
357
  getMetaTypes(): Promise<{
358
358
  types: string[];
359
+ entries: {
360
+ type: string;
361
+ schemaId: string;
362
+ allowOrgOverride: boolean;
363
+ overrideSource: "env" | "registry";
364
+ schema: Record<string, unknown>;
365
+ form: {
366
+ type: "split" | "modal" | "drawer" | "simple" | "tabbed" | "wizard";
367
+ data?: {
368
+ provider: "object";
369
+ object: string;
370
+ } | {
371
+ provider: "api";
372
+ read?: {
373
+ url: string;
374
+ method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
375
+ headers?: Record<string, string> | undefined;
376
+ params?: Record<string, unknown> | undefined;
377
+ body?: unknown;
378
+ } | undefined;
379
+ write?: {
380
+ url: string;
381
+ method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
382
+ headers?: Record<string, string> | undefined;
383
+ params?: Record<string, unknown> | undefined;
384
+ body?: unknown;
385
+ } | undefined;
386
+ } | {
387
+ provider: "value";
388
+ items: unknown[];
389
+ } | {
390
+ provider: "schema";
391
+ schemaId: string;
392
+ schema?: Record<string, unknown> | undefined;
393
+ } | undefined;
394
+ sections?: {
395
+ collapsible: boolean;
396
+ collapsed: boolean;
397
+ columns: 1 | 2 | 3 | 4;
398
+ fields: any[];
399
+ label?: string | undefined;
400
+ description?: string | undefined;
401
+ visibleOn?: {
402
+ dialect: "cel" | "js" | "cron" | "template";
403
+ source?: string | undefined;
404
+ ast?: unknown;
405
+ meta?: {
406
+ rationale?: string | undefined;
407
+ generatedBy?: string | undefined;
408
+ } | undefined;
409
+ } | {
410
+ dialect: "cel" | "js" | "cron" | "template";
411
+ source?: string | undefined;
412
+ ast?: unknown;
413
+ meta?: {
414
+ rationale?: string | undefined;
415
+ generatedBy?: string | undefined;
416
+ } | undefined;
417
+ } | undefined;
418
+ }[] | undefined;
419
+ groups?: {
420
+ collapsible: boolean;
421
+ collapsed: boolean;
422
+ columns: 1 | 2 | 3 | 4;
423
+ fields: any[];
424
+ label?: string | undefined;
425
+ description?: string | undefined;
426
+ visibleOn?: {
427
+ dialect: "cel" | "js" | "cron" | "template";
428
+ source?: string | undefined;
429
+ ast?: unknown;
430
+ meta?: {
431
+ rationale?: string | undefined;
432
+ generatedBy?: string | undefined;
433
+ } | undefined;
434
+ } | {
435
+ dialect: "cel" | "js" | "cron" | "template";
436
+ source?: string | undefined;
437
+ ast?: unknown;
438
+ meta?: {
439
+ rationale?: string | undefined;
440
+ generatedBy?: string | undefined;
441
+ } | undefined;
442
+ } | undefined;
443
+ }[] | undefined;
444
+ defaultSort?: {
445
+ field: string;
446
+ order: "asc" | "desc";
447
+ }[] | undefined;
448
+ sharing?: {
449
+ enabled: boolean;
450
+ allowAnonymous: boolean;
451
+ publicLink?: string | undefined;
452
+ password?: string | undefined;
453
+ allowedDomains?: string[] | undefined;
454
+ expiresAt?: string | undefined;
455
+ } | undefined;
456
+ submitBehavior?: {
457
+ kind: "thank-you";
458
+ title?: string | undefined;
459
+ message?: string | undefined;
460
+ } | {
461
+ kind: "redirect";
462
+ url: string;
463
+ delayMs?: number | undefined;
464
+ } | {
465
+ kind: "continue";
466
+ } | {
467
+ kind: "next-record";
468
+ } | undefined;
469
+ aria?: {
470
+ ariaLabel?: string | undefined;
471
+ ariaDescribedBy?: string | undefined;
472
+ role?: string | undefined;
473
+ } | undefined;
474
+ };
475
+ label: string;
476
+ filePatterns: string[];
477
+ supportsOverlay: boolean;
478
+ allowRuntimeCreate: boolean;
479
+ supportsVersioning: boolean;
480
+ executionPinned: boolean;
481
+ loadOrder: number;
482
+ domain: "system" | "data" | "ui" | "automation" | "ai" | "security";
483
+ description?: string | undefined;
484
+ }[];
359
485
  }>;
360
486
  getMetaItems(request: {
361
487
  type: string;
@@ -375,6 +501,33 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
375
501
  name: string;
376
502
  item: unknown;
377
503
  }>;
504
+ /**
505
+ * Phase 3a-layered-get: return the 3 layers of a metadata item
506
+ * separately — `code` (artifact-loaded baseline), `overlay` (per-org
507
+ * customisation row, if any), and `effective` (what `getMetaItem`
508
+ * would return, i.e. overlay-wins merge).
509
+ *
510
+ * Drives the "Code default vs Overlay vs Effective" diff tab in the
511
+ * generic Metadata Resource Edit page. Admins can see exactly what
512
+ * was customised and reset selectively.
513
+ *
514
+ * `code` is null if no artifact baseline exists; `overlay` is null if
515
+ * no sys_metadata row exists for the requested scope; `effective` is
516
+ * never null when either layer exists.
517
+ */
518
+ getMetaItemLayered(request: {
519
+ type: string;
520
+ name: string;
521
+ packageId?: string;
522
+ organizationId?: string;
523
+ }): Promise<{
524
+ type: string;
525
+ name: string;
526
+ code: unknown | null;
527
+ overlay: unknown | null;
528
+ overlayScope: 'org' | 'env' | null;
529
+ effective: unknown | null;
530
+ }>;
378
531
  getUiView(request: {
379
532
  object: string;
380
533
  type: 'list' | 'form';
@@ -407,7 +560,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
407
560
  label: string | undefined;
408
561
  required: boolean;
409
562
  readonly: boolean;
410
- type: "number" | "boolean" | "tags" | "date" | "file" | "code" | "datetime" | "signature" | "progress" | "url" | "text" | "textarea" | "email" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "lookup" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "json" | "color" | "rating" | "slider" | "qrcode" | "vector";
563
+ type: "number" | "boolean" | "tags" | "date" | "file" | "code" | "datetime" | "signature" | "progress" | "url" | "text" | "textarea" | "email" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "lookup" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "composite" | "repeater" | "location" | "address" | "json" | "color" | "rating" | "slider" | "qrcode" | "vector";
411
564
  colSpan: number;
412
565
  }[];
413
566
  }[];
@@ -589,6 +742,21 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
589
742
  * checklist.
590
743
  */
591
744
  private static readonly OVERLAY_ALLOWED_TYPES;
745
+ /**
746
+ * Phase 3a-env-writable: parse `OBJECTSTACK_METADATA_WRITABLE` once.
747
+ * Comma-separated singular type names. When the env var is set, the
748
+ * listed types get treated as `allowOrgOverride: true` regardless of
749
+ * their static registry entry. This is the runtime escape hatch admins
750
+ * use to enable Studio-side editing of types whose protocol-level flag
751
+ * is still false (object, field, permission, …).
752
+ *
753
+ * Memoised at first call. Tests can override by clearing the cache via
754
+ * {@link ObjectStackProtocolImplementation.resetEnvWritableCache}.
755
+ */
756
+ private static _envWritableTypes;
757
+ private static envWritableTypes;
758
+ /** Test hook — clear the memoised env-writable cache. */
759
+ static resetEnvWritableCache(): void;
592
760
  /** Normalize plural→singular before consulting the allow-list. */
593
761
  private static isOverlayAllowed;
594
762
  /**
@@ -609,6 +777,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
609
777
  organizationId?: string;
610
778
  parentVersion?: string | null;
611
779
  actor?: string;
780
+ force?: boolean;
612
781
  }): Promise<{
613
782
  success: boolean;
614
783
  version: string;
@@ -670,6 +839,30 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
670
839
  loaded: number;
671
840
  errors: number;
672
841
  }>;
842
+ /**
843
+ * Scan all loaded metadata for references pointing at the given
844
+ * `{type, name}` target. Returns one row per referring artifact with
845
+ * the path that produced the hit, so the admin UI can render an
846
+ * "Used by" panel before destructive actions (rename / delete /
847
+ * type-narrowing).
848
+ *
849
+ * Coverage is driven by the hand-curated {@link REFERENCE_PATHS}
850
+ * registry. Types not present in the registry simply return no hits
851
+ * — the engine never throws.
852
+ */
853
+ findReferencesToMeta(request: {
854
+ type: string;
855
+ name: string;
856
+ organizationId?: string;
857
+ }): Promise<{
858
+ references: Array<{
859
+ type: string;
860
+ name: string;
861
+ label?: string;
862
+ path: string;
863
+ kind: string;
864
+ }>;
865
+ }>;
673
866
  listFeed(request: any): Promise<any>;
674
867
  createFeedItem(request: any): Promise<any>;
675
868
  updateFeedItem(request: any): Promise<any>;