sg-widgets-core 0.1.0 → 0.3.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.
@@ -115,6 +115,8 @@ interface RawFieldSchema {
115
115
  editable: RawProperty<boolean>;
116
116
  mandatory: RawProperty<boolean>;
117
117
  unique: RawProperty<boolean>;
118
+ /** `editable` here says whether the site may hide the field (056_stock_vs_custom_field). */
119
+ visible?: RawProperty<boolean>;
118
120
  properties: Record<string, RawProperty<unknown>>;
119
121
  }
120
122
  type RawFieldsResponse = {
@@ -145,6 +147,12 @@ interface FieldSchema {
145
147
  operators?: Operator[];
146
148
  defaultValue?: unknown;
147
149
  description?: string;
150
+ /**
151
+ * `visible.editable`: whether the site may hide the field. False is stock and safe to
152
+ * depend on; true is every custom field and a few stock ones, so a strong hint and not
153
+ * a proof. The `sg_` prefix decides nothing (056_stock_vs_custom_field).
154
+ */
155
+ hideable?: boolean;
148
156
  }
149
157
  /**
150
158
  * Fields the schema types one way and the API answers another, keyed
@@ -380,6 +388,13 @@ interface EntityRow {
380
388
  data: EntityRef | EntityRef[] | null;
381
389
  }>;
382
390
  }
391
+ /** What `read` asks for. */
392
+ interface ReadOptions {
393
+ /** The fields to return. Dotted paths are allowed. */
394
+ fields?: string[];
395
+ /** Read a retired row, which answers 404 otherwise; a live row then answers 404 (get_entity_type_id, 103_batch_delete_revive). */
396
+ retired?: boolean;
397
+ }
383
398
  interface SearchResult {
384
399
  data: EntityRow[];
385
400
  /** True when another page exists. Computed from data length, not `links.next`, which is emitted on empty pages too (probe 006). */
@@ -577,6 +592,57 @@ interface FollowingOptions {
577
592
  entity?: string;
578
593
  projectId?: number;
579
594
  }
595
+ /**
596
+ * One write of a batch, in the shape `POST /entity/_batch` takes. `entity` is the
597
+ * schema name, never the URL slug, and the id key is `record_id` (recipes/002).
598
+ */
599
+ type BatchRequest = {
600
+ request_type: 'create';
601
+ entity: string;
602
+ data: Record<string, unknown>;
603
+ } | {
604
+ request_type: 'update';
605
+ entity: string;
606
+ record_id: number;
607
+ data: Record<string, unknown>;
608
+ } | {
609
+ request_type: 'delete';
610
+ entity: string;
611
+ record_id: number;
612
+ };
613
+ /**
614
+ * One row of a batch answer. A create or an update carries its record under `data`;
615
+ * a delete row is flat, and its `uuid` is generated per request (recipes/002).
616
+ */
617
+ type BatchResult = {
618
+ request_type: 'create';
619
+ data: EntityRow;
620
+ } | {
621
+ request_type: 'update';
622
+ data: EntityRow;
623
+ } | {
624
+ request_type: 'delete';
625
+ type: string;
626
+ id: number;
627
+ uuid: string;
628
+ did_delete: boolean;
629
+ };
630
+ /** A row of the `_batch` answer before it is paired with its request. */
631
+ type RawBatchRow = {
632
+ data: EntityRow;
633
+ } | {
634
+ request_type: 'delete';
635
+ type: string;
636
+ id: number;
637
+ uuid: string;
638
+ did_delete: boolean;
639
+ };
640
+ /**
641
+ * Pair each row of a batch answer with the request at its position. Rows come back
642
+ * one per request in request order, so position is the key: two creates can share a
643
+ * `code` (recipes/002).
644
+ */
645
+ declare function batchResults(requests: readonly BatchRequest[], rows: readonly RawBatchRow[]): BatchResult[];
580
646
  interface SgClient {
581
647
  /** Enabled entity types on the site with their display names. */
582
648
  entityTypes(): Promise<EntityTypeInfo[]>;
@@ -588,6 +654,15 @@ interface SgClient {
588
654
  */
589
655
  fieldWithProject(entityType: string, field: string, projectId: number): Promise<FieldSchema>;
590
656
  search(entityType: string, options: SearchOptions): Promise<SearchResult>;
657
+ /**
658
+ * One row by id, in the `_search` row shape.
659
+ *
660
+ * A row that is not there rejects 404 code 104, and a retired row answers the same
661
+ * 404 unless read with `retired`: only that second read tells the two apart
662
+ * (get_entity_type_id). A batch create with no `project` answers an id this read
663
+ * never reaches (recipes/002).
664
+ */
665
+ read(entityType: string, id: number, options?: ReadOptions): Promise<EntityRow>;
591
666
  /**
592
667
  * Free-text search across several types at once. Every word must match, each as
593
668
  * a case-insensitive substring of the row's name or of the linked row's name
@@ -675,6 +750,32 @@ interface SgClient {
675
750
  * (get_entity_human_users_id_following).
676
751
  */
677
752
  following(userId: number, options?: FollowingOptions): Promise<EntityRef[]>;
753
+ /**
754
+ * Retire one row. It is not erased: it reads 404 and comes back with `revive`.
755
+ * A second delete is 404 (delete_entity_type_id). Deleting a row changes others:
756
+ * a Shot retires its Versions (probe 060), and a Task retires its dependencies and
757
+ * nulls `Version.sg_task` and `PublishedFile.task` without saying so
758
+ * (089_task_delete_side_effects).
759
+ */
760
+ delete(entityType: string, id: number): Promise<void>;
761
+ /**
762
+ * Bring a retired row back with the values it had, and answer whether it was
763
+ * retired: `false` means it was already live (post_entity_type_id). A revived Task
764
+ * gets its links back and its chain rescheduled (089_task_delete_side_effects).
765
+ */
766
+ revive(entityType: string, id: number): Promise<boolean>;
767
+ /**
768
+ * Apply creates, updates and deletes in one atomic call, one result per request in
769
+ * request order.
770
+ *
771
+ * One failing request rolls back every other one and rejects with its status and
772
+ * title. A request cannot point at a row another request of the same batch creates:
773
+ * send one batch per level. A create inside a batch skips the `project` check a
774
+ * single create makes and answers the id of a row no read reaches (report 001), so
775
+ * validate the payload first. A read timeout says nothing about what landed; keep a
776
+ * batch to about 200 requests and make it re-runnable (recipes/002).
777
+ */
778
+ batch(requests: BatchRequest[]): Promise<BatchResult[]>;
678
779
  }
679
780
  /** The node shape `/hierarchy/_expand` answers, before normalising. */
680
781
  interface RawHierarchyNode {
@@ -719,12 +820,16 @@ declare class RestClient implements SgClient {
719
820
  fields(entityType: string, projectId?: number): Promise<Record<string, FieldSchema>>;
720
821
  fieldWithProject(entityType: string, field: string, projectId: number): Promise<FieldSchema>;
721
822
  search(entityType: string, options: SearchOptions): Promise<SearchResult>;
823
+ read(entityType: string, id: number, options?: ReadOptions): Promise<EntityRow>;
722
824
  textSearch(text: string, entityTypes: Record<string, TextSearchFilter>, page?: {
723
825
  size?: number;
724
826
  number?: number;
725
827
  }): Promise<TextSearchRow[]>;
726
828
  update(entityType: string, id: number, patch: Record<string, unknown>): Promise<EntityRow>;
727
829
  create(entityType: string, body: Record<string, unknown>): Promise<EntityRow>;
830
+ delete(entityType: string, id: number): Promise<void>;
831
+ revive(entityType: string, id: number): Promise<boolean>;
832
+ batch(requests: BatchRequest[]): Promise<BatchResult[]>;
728
833
  upload(entityType: string, id: number, file: UploadFile): Promise<UploadResult>;
729
834
  summarize(entityType: string, options?: SummarizeOptions): Promise<SummarizeResult>;
730
835
  threadContents(noteId: number, entityFields?: Record<string, string[]>): Promise<ThreadRow[]>;
@@ -737,4 +842,4 @@ declare class RestClient implements SgClient {
737
842
  /** One `_search` row of `EventLogEntry`, with `meta` decoded as the API returns it. */
738
843
  declare function normalizeEventLogEntry(row: EntityRow): EventLogEntry;
739
844
  //#endregion
740
- export { STOCK_SPRITE_PATH as $, isOperator as $t, hierarchyEntity as A, emptyFilter as At, intersectStatuses as B, DataType as Bt, SummaryType as C, FilterNode as Ct, UploadFile as D, WireCondition as Dt, ThreadRow as E, TextSearchFilter as Et, StatusIcon as F, referencedPaths as Ft, statusLabel as G, TIME_UNITS as Gt, relativeLuminance as H, OPERATORS as Ht, StatusOption as I, toApi3Hash as It, NATIVE_STATUSES as J, ValueShape as Jt, statusPaint as K, TimeUnit as Kt, StatusPaint as L, toFilterArray as Lt, normalizeHierarchyNode as M, group as Mt, Rgb as N, isBlankCondition as Nt, UploadResult as O, WireGroup as Ot, StatusGlyph as P, isEmptyFilter as Pt, STOCK_ICON_KEYS as Q, isNumericType as Qt, StatusRecord as R, walk as Rt, SummaryGrouping as S, FilterGroup as St, ThreadAuthor as T, Scalar as Tt, rgbToCss as U, OPERATORS_BY_TYPE as Ut, parseBgColor as V, NEGATING_OPERATORS as Vt, statusGlyph as W, Operator as Wt, STOCK_ICON_CELLS as X, isFilterable as Xt, NativeStatus as Y, isDataType as Yt, STOCK_ICON_DATA_URLS as Z, isLinkType as Zt, SgClient as _, statusFieldNameFor as _t, EventLogOptions as a, stockIconSource as at, SummaryField as b, EntityRef as bt, HierarchyNode as c, FieldSchema as ct, RawHierarchyNode as d, RawProperty as dt, isTemporalType as en, SpriteCell as et, RestClient as f, displayNameOf as ft, SgApiError as g, statusFieldFor as gt, SearchResult as h, normalizeFields as ht, EventLogEntry as i, spriteStyle as it, normalizeEventLogEntry as j, fromWire as jt, eventLogFilters as k, condition as kt, HierarchyPath as l, RawFieldSchema as lt, SearchOptions as m, normalizeField as mt, EntityRow as n, supportsOperator as nn, isNativeStatus as nt, EventLogResult as o, DISPLAY_NAME_FIELDS as ot, RestClientOptions as p, fieldSchemaOverride as pt, usableStatuses as q, VALUE_SHAPE as qt, EntityTypeInfo as r, nativeStatus as rt, FollowingOptions as s, FIELD_SCHEMA_OVERRIDES as st, EVENT_LOG_FIELDS as t, operatorsFor as tn, StockIconSource as tt, HierarchyRef as u, RawFieldsResponse as ut, SummarizeOptions as v, undeclaredField as vt, TextSearchRow as w, LogicalOperator as wt, SummaryGroup as x, FilterCondition as xt, SummarizeResult as y, ConditionValue as yt, foregroundFor as z, DATA_TYPES as zt };
845
+ export { NATIVE_STATUSES as $, ValueShape as $t, ThreadRow as A, Scalar as At, StatusIcon as B, referencedPaths as Bt, SummarizeResult as C, undeclaredField as Ct, SummaryType as D, FilterGroup as Dt, SummaryGrouping as E, FilterCondition as Et, hierarchyEntity as F, emptyFilter as Ft, intersectStatuses as G, DataType as Gt, StatusPaint as H, toFilterArray as Ht, normalizeEventLogEntry as I, fromWire as It, rgbToCss as J, OPERATORS_BY_TYPE as Jt, parseBgColor as K, NEGATING_OPERATORS as Kt, normalizeHierarchyNode as L, group as Lt, UploadResult as M, WireCondition as Mt, batchResults as N, WireGroup as Nt, TextSearchRow as O, FilterNode as Ot, eventLogFilters as P, condition as Pt, usableStatuses as Q, VALUE_SHAPE as Qt, Rgb as R, isBlankCondition as Rt, SummarizeOptions as S, statusFieldNameFor as St, SummaryGroup as T, EntityRef as Tt, StatusRecord as U, walk as Ut, StatusOption as V, toApi3Hash as Vt, foregroundFor as W, DATA_TYPES as Wt, statusLabel as X, TIME_UNITS as Xt, statusGlyph as Y, Operator as Yt, statusPaint as Z, TimeUnit as Zt, RestClientOptions as _, displayNameOf as _t, EntityTypeInfo as a, isTemporalType as an, SpriteCell as at, SgApiError as b, normalizeFields as bt, EventLogResult as c, nativeStatus as ct, HierarchyPath as d, DISPLAY_NAME_FIELDS as dt, isDataType as en, NativeStatus as et, HierarchyRef as f, FIELD_SCHEMA_OVERRIDES as ft, RestClient as g, RawProperty as gt, ReadOptions as h, RawFieldsResponse as ht, EntityRow as i, isOperator as in, STOCK_SPRITE_PATH as it, UploadFile as j, TextSearchFilter as jt, ThreadAuthor as k, LogicalOperator as kt, FollowingOptions as l, spriteStyle as lt, RawHierarchyNode as m, RawFieldSchema as mt, BatchResult as n, isLinkType as nn, STOCK_ICON_DATA_URLS as nt, EventLogEntry as o, operatorsFor as on, StockIconSource as ot, RawBatchRow as p, FieldSchema as pt, relativeLuminance as q, OPERATORS as qt, EVENT_LOG_FIELDS as r, isNumericType as rn, STOCK_ICON_KEYS as rt, EventLogOptions as s, supportsOperator as sn, isNativeStatus as st, BatchRequest as t, isFilterable as tn, STOCK_ICON_CELLS as tt, HierarchyNode as u, stockIconSource as ut, SearchOptions as v, fieldSchemaOverride as vt, SummaryField as w, ConditionValue as wt, SgClient as x, statusFieldFor as xt, SearchResult as y, normalizeField as yt, StatusGlyph as z, isEmptyFilter as zt };
@@ -452,6 +452,7 @@ function normalizeField(name, raw) {
452
452
  if (defaultValue !== void 0) field.defaultValue = defaultValue;
453
453
  const description = prop(props, "description");
454
454
  if (description) field.description = description;
455
+ if (raw.visible) field.hideable = raw.visible.editable;
455
456
  return {
456
457
  ...field,
457
458
  ...fieldSchemaOverride(field.entityType, name)
@@ -607,6 +608,30 @@ const EVENT_LOG_FIELDS = [
607
608
  "user"
608
609
  ];
609
610
  /**
611
+ * Pair each row of a batch answer with the request at its position. Rows come back
612
+ * one per request in request order, so position is the key: two creates can share a
613
+ * `code` (recipes/002).
614
+ */
615
+ function batchResults(requests, rows) {
616
+ return rows.map((row, i) => {
617
+ const kind = requests[i]?.request_type;
618
+ if (kind === "delete" || !("data" in row)) {
619
+ const flat = row;
620
+ return {
621
+ request_type: "delete",
622
+ type: flat.type,
623
+ id: flat.id,
624
+ uuid: flat.uuid,
625
+ did_delete: flat.did_delete
626
+ };
627
+ }
628
+ return {
629
+ request_type: kind === "update" ? "update" : "create",
630
+ data: row.data
631
+ };
632
+ });
633
+ }
634
+ /**
610
635
  * Normalise one node and the level below it.
611
636
  *
612
637
  * The sample response gives a child a `label`, a `ref` and `has_children` but not
@@ -736,6 +761,13 @@ var RestClient = class {
736
761
  hasMore: res.data.length === size
737
762
  };
738
763
  }
764
+ async read(entityType, id, options = {}) {
765
+ const params = {
766
+ fields: options.fields?.join(","),
767
+ "options[return_only]": options.retired ? "retired" : void 0
768
+ };
769
+ return (await this.request("GET", `/entity/${pluralPath(entityType)}/${id}`, void 0, params)).data;
770
+ }
739
771
  async textSearch(text, entityTypes, page) {
740
772
  const types = {};
741
773
  for (const [t, f] of Object.entries(entityTypes)) types[t] = toHashGroup(f);
@@ -755,6 +787,15 @@ var RestClient = class {
755
787
  async create(entityType, body) {
756
788
  return (await this.request("POST", `/entity/${pluralPath(entityType)}`, body, void 0, "application/json")).data;
757
789
  }
790
+ async delete(entityType, id) {
791
+ await this.request("DELETE", `/entity/${pluralPath(entityType)}/${id}`);
792
+ }
793
+ async revive(entityType, id) {
794
+ return (await this.request("POST", `/entity/${pluralPath(entityType)}/${id}`, void 0, { revive: 1 })).meta?.did_revive === true;
795
+ }
796
+ async batch(requests) {
797
+ return batchResults(requests, (await this.request("POST", "/entity/_batch", { requests }, void 0, "application/json")).data);
798
+ }
758
799
  async upload(entityType, id, file) {
759
800
  const field = file.field === void 0 ? "" : `/${file.field}`;
760
801
  const ticket = await this.request("GET", `/entity/${pluralPath(entityType)}/${id}${field}/_upload`, void 0, { filename: file.filename });
@@ -1012,4 +1053,4 @@ function toStatusIcon(a) {
1012
1053
  }
1013
1054
  }
1014
1055
  //#endregion
1015
- export { OPERATORS as A, operatorsFor as B, isEmptyFilter as C, walk as D, toFilterArray as E, isFilterable as F, isLinkType as I, isNumericType as L, TIME_UNITS as M, VALUE_SHAPE as N, DATA_TYPES as O, isDataType as P, isOperator as R, isBlankCondition as S, toApi3Hash as T, supportsOperator as V, pluralPath as _, hierarchyEntity as a, fromWire as b, DISPLAY_NAME_FIELDS as c, fieldSchemaOverride as d, normalizeField as f, undeclaredField as g, statusFieldNameFor as h, eventLogFilters as i, OPERATORS_BY_TYPE as j, NEGATING_OPERATORS as k, FIELD_SCHEMA_OVERRIDES as l, statusFieldFor as m, RestClient as n, normalizeEventLogEntry as o, normalizeFields as p, SgApiError as r, normalizeHierarchyNode as s, EVENT_LOG_FIELDS as t, displayNameOf as u, condition as v, referencedPaths as w, group as x, emptyFilter as y, isTemporalType as z };
1056
+ export { NEGATING_OPERATORS as A, isTemporalType as B, isBlankCondition as C, toFilterArray as D, toApi3Hash as E, isDataType as F, supportsOperator as H, isFilterable as I, isLinkType as L, OPERATORS_BY_TYPE as M, TIME_UNITS as N, walk as O, VALUE_SHAPE as P, isNumericType as R, group as S, referencedPaths as T, operatorsFor as V, undeclaredField as _, eventLogFilters as a, emptyFilter as b, normalizeHierarchyNode as c, displayNameOf as d, fieldSchemaOverride as f, statusFieldNameFor as g, statusFieldFor as h, batchResults as i, OPERATORS as j, DATA_TYPES as k, DISPLAY_NAME_FIELDS as l, normalizeFields as m, RestClient as n, hierarchyEntity as o, normalizeField as p, SgApiError as r, normalizeEventLogEntry as s, EVENT_LOG_FIELDS as t, FIELD_SCHEMA_OVERRIDES as u, pluralPath as v, isEmptyFilter as w, fromWire as x, condition as y, isOperator as z };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as STOCK_SPRITE_PATH, $t as isOperator, A as hierarchyEntity, At as emptyFilter, B as intersectStatuses, Bt as DataType, C as SummaryType, Ct as FilterNode, D as UploadFile, Dt as WireCondition, E as ThreadRow, Et as TextSearchFilter, F as StatusIcon, Ft as referencedPaths, G as statusLabel, Gt as TIME_UNITS, H as relativeLuminance, Ht as OPERATORS, I as StatusOption, It as toApi3Hash, J as NATIVE_STATUSES, Jt as ValueShape, K as statusPaint, Kt as TimeUnit, L as StatusPaint, Lt as toFilterArray, M as normalizeHierarchyNode, Mt as group, N as Rgb, Nt as isBlankCondition, O as UploadResult, Ot as WireGroup, P as StatusGlyph, Pt as isEmptyFilter, Q as STOCK_ICON_KEYS, Qt as isNumericType, R as StatusRecord, Rt as walk, S as SummaryGrouping, St as FilterGroup, T as ThreadAuthor, Tt as Scalar, U as rgbToCss, Ut as OPERATORS_BY_TYPE, V as parseBgColor, Vt as NEGATING_OPERATORS, W as statusGlyph, Wt as Operator, X as STOCK_ICON_CELLS, Xt as isFilterable, Y as NativeStatus, Yt as isDataType, Z as STOCK_ICON_DATA_URLS, Zt as isLinkType, _ as SgClient, _t as statusFieldNameFor, a as EventLogOptions, at as stockIconSource, b as SummaryField, bt as EntityRef, c as HierarchyNode, ct as FieldSchema, d as RawHierarchyNode, dt as RawProperty, en as isTemporalType, et as SpriteCell, f as RestClient, ft as displayNameOf, g as SgApiError, gt as statusFieldFor, h as SearchResult, ht as normalizeFields, i as EventLogEntry, it as spriteStyle, j as normalizeEventLogEntry, jt as fromWire, k as eventLogFilters, kt as condition, l as HierarchyPath, lt as RawFieldSchema, m as SearchOptions, mt as normalizeField, n as EntityRow, nn as supportsOperator, nt as isNativeStatus, o as EventLogResult, ot as DISPLAY_NAME_FIELDS, p as RestClientOptions, pt as fieldSchemaOverride, q as usableStatuses, qt as VALUE_SHAPE, r as EntityTypeInfo, rt as nativeStatus, s as FollowingOptions, st as FIELD_SCHEMA_OVERRIDES, t as EVENT_LOG_FIELDS, tn as operatorsFor, tt as StockIconSource, u as HierarchyRef, ut as RawFieldsResponse, v as SummarizeOptions, vt as undeclaredField, w as TextSearchRow, wt as LogicalOperator, x as SummaryGroup, xt as FilterCondition, y as SummarizeResult, yt as ConditionValue, z as foregroundFor, zt as DATA_TYPES } from "./client-BhHppzTV.mjs";
1
+ import { $ as NATIVE_STATUSES, $t as ValueShape, A as ThreadRow, At as Scalar, B as StatusIcon, Bt as referencedPaths, C as SummarizeResult, Ct as undeclaredField, D as SummaryType, Dt as FilterGroup, E as SummaryGrouping, Et as FilterCondition, F as hierarchyEntity, Ft as emptyFilter, G as intersectStatuses, Gt as DataType, H as StatusPaint, Ht as toFilterArray, I as normalizeEventLogEntry, It as fromWire, J as rgbToCss, Jt as OPERATORS_BY_TYPE, K as parseBgColor, Kt as NEGATING_OPERATORS, L as normalizeHierarchyNode, Lt as group, M as UploadResult, Mt as WireCondition, N as batchResults, Nt as WireGroup, O as TextSearchRow, Ot as FilterNode, P as eventLogFilters, Pt as condition, Q as usableStatuses, Qt as VALUE_SHAPE, R as Rgb, Rt as isBlankCondition, S as SummarizeOptions, St as statusFieldNameFor, T as SummaryGroup, Tt as EntityRef, U as StatusRecord, Ut as walk, V as StatusOption, Vt as toApi3Hash, W as foregroundFor, Wt as DATA_TYPES, X as statusLabel, Xt as TIME_UNITS, Y as statusGlyph, Yt as Operator, Z as statusPaint, Zt as TimeUnit, _ as RestClientOptions, _t as displayNameOf, a as EntityTypeInfo, an as isTemporalType, at as SpriteCell, b as SgApiError, bt as normalizeFields, c as EventLogResult, ct as nativeStatus, d as HierarchyPath, dt as DISPLAY_NAME_FIELDS, en as isDataType, et as NativeStatus, f as HierarchyRef, ft as FIELD_SCHEMA_OVERRIDES, g as RestClient, gt as RawProperty, h as ReadOptions, ht as RawFieldsResponse, i as EntityRow, in as isOperator, it as STOCK_SPRITE_PATH, j as UploadFile, jt as TextSearchFilter, k as ThreadAuthor, kt as LogicalOperator, l as FollowingOptions, lt as spriteStyle, m as RawHierarchyNode, mt as RawFieldSchema, n as BatchResult, nn as isLinkType, nt as STOCK_ICON_DATA_URLS, o as EventLogEntry, on as operatorsFor, ot as StockIconSource, p as RawBatchRow, pt as FieldSchema, q as relativeLuminance, qt as OPERATORS, r as EVENT_LOG_FIELDS, rn as isNumericType, rt as STOCK_ICON_KEYS, s as EventLogOptions, sn as supportsOperator, st as isNativeStatus, t as BatchRequest, tn as isFilterable, tt as STOCK_ICON_CELLS, u as HierarchyNode, ut as stockIconSource, v as SearchOptions, vt as fieldSchemaOverride, w as SummaryField, wt as ConditionValue, x as SgClient, xt as statusFieldFor, y as SearchResult, yt as normalizeField, z as StatusGlyph, zt as isEmptyFilter } from "./client-CP9sWEVZ.mjs";
2
2
  //#region src/field-icons.d.ts
3
3
  /** The catch-all glyph, used for a data type this build does not know. */
4
4
  export declare const DEFAULT_FIELD_ICON = "file-text";
@@ -1154,6 +1154,11 @@ export interface EntitySource {
1154
1154
  loadMore(): Promise<void>;
1155
1155
  /** Read every page already shown again, keeping the row count. */
1156
1156
  refresh(): Promise<void>;
1157
+ /**
1158
+ * Read these paths as well. The rows already shown are read again when one of them
1159
+ * is new, keeping the row count and the total; otherwise nothing is read.
1160
+ */
1161
+ addFields(paths: readonly string[]): Promise<void>;
1157
1162
  setFilters(filters: SourceFilters): Promise<void>;
1158
1163
  setSort(sort: SortSpec[]): Promise<void>;
1159
1164
  /** Show one page of the set. `pages` mode only. */
@@ -1766,12 +1771,16 @@ export declare class ProxyClient implements SgClient {
1766
1771
  fields(entityType: string, projectId?: number): Promise<Record<string, FieldSchema>>;
1767
1772
  fieldWithProject(entityType: string, field: string, projectId: number): Promise<FieldSchema>;
1768
1773
  search(entityType: string, options: SearchOptions): Promise<SearchResult>;
1774
+ read(entityType: string, id: number, options?: ReadOptions): Promise<EntityRow>;
1769
1775
  textSearch(text: string, entityTypes: Record<string, TextSearchFilter>, page?: {
1770
1776
  size?: number;
1771
1777
  number?: number;
1772
1778
  }): Promise<TextSearchRow[]>;
1773
1779
  statuses(): Promise<StatusRecord[]>;
1774
1780
  create(entityType: string, body: Record<string, unknown>): Promise<EntityRow>;
1781
+ delete(entityType: string, id: number): Promise<void>;
1782
+ revive(entityType: string, id: number): Promise<boolean>;
1783
+ batch(requests: BatchRequest[]): Promise<BatchResult[]>;
1775
1784
  /** The bytes cross the protocol base64-encoded; the handler runs the three calls. */
1776
1785
  upload(entityType: string, id: number, file: UploadFile): Promise<UploadResult>;
1777
1786
  update(entityType: string, id: number, patch: Record<string, unknown>): Promise<EntityRow>;
@@ -1785,7 +1794,7 @@ export declare class ProxyClient implements SgClient {
1785
1794
  //#endregion
1786
1795
  //#region src/proxy-handler.d.ts
1787
1796
  /** The methods the protocol carries, one POST each. */
1788
- export declare const PROXY_METHODS: readonly ['entityTypes', 'fields', 'fieldWithProject', 'search', 'textSearch', 'statuses', 'create', 'update', 'upload', 'hierarchyExpand', 'hierarchySearch', 'summarize', 'threadContents', 'eventLog', 'following'];
1797
+ export declare const PROXY_METHODS: readonly ['entityTypes', 'fields', 'fieldWithProject', 'search', 'read', 'textSearch', 'statuses', 'create', 'update', 'upload', 'hierarchyExpand', 'hierarchySearch', 'summarize', 'threadContents', 'eventLog', 'following', 'delete', 'revive', 'batch'];
1789
1798
  export type ProxyMethod = (typeof PROXY_METHODS)[number];
1790
1799
  /** An error as it crosses the wire. `ProxyClient` rebuilds an `SgApiError` from it. */
1791
1800
  export interface ProxyError {
@@ -2354,6 +2363,94 @@ export declare function collapseStateFrom(state: CollapseState, shut: readonly s
2354
2363
  /** True when two collapse states shut the same groups. */
2355
2364
  export declare function sameCollapse(a: CollapseState, b: CollapseState): boolean;
2356
2365
  //#endregion
2366
+ //#region src/selection.d.ts
2367
+ /** Where a range starts and what it is laid over. */
2368
+ export interface SelectionAnchor {
2369
+ /** The row the range runs from, `Type:id`. */
2370
+ key: string;
2371
+ /** True when the range selects, false when it clears: what the anchor row became. */
2372
+ on: boolean;
2373
+ /** The selection the range is laid over. */
2374
+ base: EntityRef[];
2375
+ /** The selection the last step produced. One that no longer reads this has moved under the anchor. */
2376
+ last: EntityRef[];
2377
+ }
2378
+ /** A selection and the anchor the next Shift gesture ranges from. */
2379
+ export interface SelectionStep {
2380
+ selection: EntityRef[];
2381
+ anchor: SelectionAnchor | null;
2382
+ }
2383
+ /** What a press on a row does: toggle it, or range to it. */
2384
+ export type SelectionGesture = 'toggle' | 'range';
2385
+ /** What a key does to the selection. */
2386
+ export type SelectionKeyIntent = 'toggle' | 'extend-up' | 'extend-down' | 'all';
2387
+ interface Modifiers {
2388
+ shiftKey?: boolean;
2389
+ metaKey?: boolean;
2390
+ ctrlKey?: boolean;
2391
+ altKey?: boolean;
2392
+ }
2393
+ /** Shift ranges; a plain press and Cmd or Ctrl both toggle. */
2394
+ export declare function gestureOf(event: Modifiers): SelectionGesture;
2395
+ /** Space toggles, Shift+ArrowUp and Shift+ArrowDown extend, Cmd or Ctrl+A takes every loaded row. */
2396
+ export declare function selectionKeyIntent(event: Modifiers & {
2397
+ key: string;
2398
+ }): SelectionKeyIntent | null;
2399
+ /** `selection` with every ref of `refs` added, or every one of them dropped. */
2400
+ export declare function setRefs(selection: readonly EntityRef[], refs: readonly EntityRef[], on: boolean): EntityRef[];
2401
+ /** Toggle the row at `index` and anchor on it. A disabled row refuses. */
2402
+ export declare function toggleRow(selection: readonly EntityRef[], anchor: SelectionAnchor | null, rows: readonly EntityRow[], index: number, isRowDisabled?: RowDisabledFn | null): SelectionStep;
2403
+ /**
2404
+ * Range from the anchor to the row at `index`, skipping disabled rows.
2405
+ *
2406
+ * With no anchor among the rows, the row pressed is selected and becomes the anchor.
2407
+ */
2408
+ export declare function extendRange(selection: readonly EntityRef[], anchor: SelectionAnchor | null, rows: readonly EntityRow[], index: number, isRowDisabled?: RowDisabledFn | null): SelectionStep;
2409
+ /**
2410
+ * Shift+arrow: move the far end of the range from row `from` to row `to`. With no
2411
+ * anchor among the rows, the row the cursor leaves becomes one, selecting.
2412
+ */
2413
+ export declare function extendByStep(selection: readonly EntityRef[], anchor: SelectionAnchor | null, rows: readonly EntityRow[], from: number, to: number, isRowDisabled?: RowDisabledFn | null): SelectionStep;
2414
+ /** What the line offering the whole set reads. */
2415
+ export interface MatchingOffer {
2416
+ show: boolean;
2417
+ /** How many rows the set holds, when something counted it. */
2418
+ total: number | null;
2419
+ }
2420
+ /**
2421
+ * Whether to offer every row the filter matches: once every loaded row is picked and
2422
+ * the set holds more than is loaded, until the selection covers a counted set.
2423
+ */
2424
+ export declare function matchingOffer(state: {
2425
+ allLoaded: boolean;
2426
+ loaded: number;
2427
+ selected: number;
2428
+ hasMore: boolean;
2429
+ total: number | null;
2430
+ }): MatchingOffer;
2431
+ //#endregion
2432
+ //#region src/column-choice.d.ts
2433
+ /** Where a choice is kept: the caller's key, or one per entity type. */
2434
+ export declare function columnsStorageKey(entityType: string, key?: string | null): string;
2435
+ /** A stored choice as paths. Null for nothing, an empty list, or anything that is not a list of paths. */
2436
+ export declare function parseColumnChoice(raw: string | null | undefined): string[] | null;
2437
+ /** The string a choice is kept as. */
2438
+ export declare function serializeColumnChoice(paths: readonly string[]): string;
2439
+ /** The paths of a column list, in order. */
2440
+ export declare function columnPaths(columns: readonly CollectionColumn[]): string[];
2441
+ /** True when two path lists name the same columns in the same order. */
2442
+ export declare function sameColumnPaths(a: readonly string[], b: readonly string[]): boolean;
2443
+ /** The paths a source with `fields` does not read yet. */
2444
+ export declare function unreadPaths(fields: readonly string[], paths: readonly string[]): string[];
2445
+ /** The known columns in the order `paths` names them. A path none of them carries is dropped. */
2446
+ export declare function arrangeColumns(paths: readonly string[], known: readonly CollectionColumn[]): CollectionColumn[];
2447
+ /**
2448
+ * A choice as columns: the ones already resolved are kept as they are, the rest are
2449
+ * resolved from the schema, and a path the type does not have is skipped, so a
2450
+ * choice kept before a field was removed still opens.
2451
+ */
2452
+ export declare function resolveColumnChoice(schema: SchemaService, entityType: string, paths: readonly string[], known: readonly CollectionColumn[]): Promise<CollectionColumn[]>;
2453
+ //#endregion
2357
2454
  //#region src/entity-card.d.ts
2358
2455
  export interface EntityCardOptions {
2359
2456
  /** Dotted field paths for the grid, in order. */
@@ -2723,4 +2820,4 @@ export declare function markOverflow(list: HTMLElement | null | undefined): bool
2723
2820
  */
2724
2821
  export declare function watchOverflow(list: HTMLElement | null | undefined): () => void;
2725
2822
  //#endregion
2726
- export { ConditionValue, DATA_TYPES, DISPLAY_NAME_FIELDS, DataType, EVENT_LOG_FIELDS, EntityRef, EntityRow, EntityTypeInfo, EventLogEntry, EventLogOptions, EventLogResult, FIELD_SCHEMA_OVERRIDES, FieldSchema, FilterCondition, FilterGroup, FilterNode, FollowingOptions, HierarchyNode, HierarchyPath, HierarchyRef, LogicalOperator, NATIVE_STATUSES, NEGATING_OPERATORS, NativeStatus, OPERATORS, OPERATORS_BY_TYPE, Operator, RawFieldSchema, RawFieldsResponse, RawHierarchyNode, RawProperty, RestClient, RestClientOptions, Rgb, STOCK_ICON_CELLS, STOCK_ICON_DATA_URLS, STOCK_ICON_KEYS, STOCK_SPRITE_PATH, Scalar, SearchOptions, SearchResult, SgApiError, SgClient, SpriteCell, StatusGlyph, StatusIcon, StatusOption, StatusPaint, StatusRecord, StockIconSource, SummarizeOptions, SummarizeResult, SummaryField, SummaryGroup, SummaryGrouping, SummaryType, TIME_UNITS, TextSearchFilter, TextSearchRow, ThreadAuthor, ThreadRow, TimeUnit, UploadFile, UploadResult, VALUE_SHAPE, ValueShape, WireCondition, WireGroup, condition, displayNameOf, emptyFilter, eventLogFilters, fieldSchemaOverride, foregroundFor, fromWire, group, hierarchyEntity, intersectStatuses, isBlankCondition, isDataType, isEmptyFilter, isFilterable, isLinkType, isNativeStatus, isNumericType, isOperator, isTemporalType, nativeStatus, normalizeEventLogEntry, normalizeField, normalizeFields, normalizeHierarchyNode, operatorsFor, parseBgColor, referencedPaths, relativeLuminance, rgbToCss, spriteStyle, statusFieldFor, statusFieldNameFor, statusGlyph, statusLabel, statusPaint, stockIconSource, supportsOperator, toApi3Hash, toFilterArray, undeclaredField, usableStatuses, walk };
2823
+ export { BatchRequest, BatchResult, ConditionValue, DATA_TYPES, DISPLAY_NAME_FIELDS, DataType, EVENT_LOG_FIELDS, EntityRef, EntityRow, EntityTypeInfo, EventLogEntry, EventLogOptions, EventLogResult, FIELD_SCHEMA_OVERRIDES, FieldSchema, FilterCondition, FilterGroup, FilterNode, FollowingOptions, HierarchyNode, HierarchyPath, HierarchyRef, LogicalOperator, NATIVE_STATUSES, NEGATING_OPERATORS, NativeStatus, OPERATORS, OPERATORS_BY_TYPE, Operator, RawBatchRow, RawFieldSchema, RawFieldsResponse, RawHierarchyNode, RawProperty, ReadOptions, RestClient, RestClientOptions, Rgb, STOCK_ICON_CELLS, STOCK_ICON_DATA_URLS, STOCK_ICON_KEYS, STOCK_SPRITE_PATH, Scalar, SearchOptions, SearchResult, SgApiError, SgClient, SpriteCell, StatusGlyph, StatusIcon, StatusOption, StatusPaint, StatusRecord, StockIconSource, SummarizeOptions, SummarizeResult, SummaryField, SummaryGroup, SummaryGrouping, SummaryType, TIME_UNITS, TextSearchFilter, TextSearchRow, ThreadAuthor, ThreadRow, TimeUnit, UploadFile, UploadResult, VALUE_SHAPE, ValueShape, WireCondition, WireGroup, batchResults, condition, displayNameOf, emptyFilter, eventLogFilters, fieldSchemaOverride, foregroundFor, fromWire, group, hierarchyEntity, intersectStatuses, isBlankCondition, isDataType, isEmptyFilter, isFilterable, isLinkType, isNativeStatus, isNumericType, isOperator, isTemporalType, nativeStatus, normalizeEventLogEntry, normalizeField, normalizeFields, normalizeHierarchyNode, operatorsFor, parseBgColor, referencedPaths, relativeLuminance, rgbToCss, spriteStyle, statusFieldFor, statusFieldNameFor, statusGlyph, statusLabel, statusPaint, stockIconSource, supportsOperator, toApi3Hash, toFilterArray, undeclaredField, usableStatuses, walk };