sg-widgets-core 0.3.1 → 0.4.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 +85 -68
- package/dist/index.mjs +181 -5
- package/dist/mock.d.mts +39 -1
- package/dist/mock.mjs +267 -2
- package/dist/{client-CP9sWEVZ.d.mts → proxy-handler-C6XB6gss.d.mts} +311 -65
- package/dist/{client-izKszX7l.mjs → schema-write-D_WfMYW8.mjs} +384 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as SummaryField, $t as STOCK_SPRITE_PATH, A as BatchRequest, An as isFilterable, At as toApi3Hash, B as HierarchyPath, Bt as intersectStatuses, C as SchemaProxyMethod, Cn as OPERATORS_BY_TYPE, Ct as condition, D as toSchemaProperties, Dn as VALUE_SHAPE, Dt as isBlankCondition, E as isSchemaProxyMethod, En as TimeUnit, Et as group, F as EventLogEntry, Fn as operatorsFor, Ft as StatusIcon, G as RestClient, Gt as statusLabel, H as RawBatchRow, Ht as relativeLuminance, I as EventLogOptions, In as supportsOperator, It as StatusOption, J as SearchResult, Jt as NATIVE_STATUSES, K as RestClientOptions, Kt as statusPaint, L as EventLogResult, Lt as StatusPaint, M as EVENT_LOG_FIELDS, Mn as isNumericType, Mt as walk, N as EntityRow, Nn as isOperator, Nt as Rgb, O as ProxyClient, On as ValueShape, Ot as isEmptyFilter, P as EntityTypeInfo, Pn as isTemporalType, Pt as StatusGlyph, Q as SummarizeResult, Qt as STOCK_ICON_KEYS, R as FollowingOptions, Rt as StatusRecord, S as SchemaProperty, Sn as OPERATORS, St as WireGroup, T as fieldFromRaw, Tn as TIME_UNITS, Tt as fromWire, U as RawHierarchyNode, Ut as rgbToCss, V as HierarchyRef, Vt as parseBgColor, W as ReadOptions, Wt as statusGlyph, X as SgClient, Xt as STOCK_ICON_CELLS, Y as SgApiError, Yt as NativeStatus, Z as SummarizeOptions, Zt as STOCK_ICON_DATA_URLS, _ as ReviveFieldResult, _n as statusFieldNameFor, _t as FilterNode, a as ProxyHandlerOptions, an as stockIconSource, at as ThreadRow, b as SchemaClient, bn as DataType, bt as TextSearchFilter, c as base64ToBytes, cn as FieldSchema, ct as batchResults, d as isProxyMethod, dn as RawProperty, dt as normalizeEventLogEntry, en as SpriteCell, et as SummaryGroup, f as CreateFieldInput, fn as displayNameOf, ft as normalizeHierarchyNode, g as RestSchemaClient, gn as statusFieldFor, gt as FilterGroup, h as ProxySchemaClient, hn as normalizeFields, ht as FilterCondition, i as ProxyHandler, in as spriteStyle, it as ThreadAuthor, j as BatchResult, jn as isLinkType, jt as toFilterArray, k as ProxyClientOptions, kn as isDataType, kt as referencedPaths, l as bytesToBase64, ln as RawFieldSchema, lt as eventLogFilters, m as FieldReadResult, mn as normalizeField, mt as EntityRef, n as ProxyBody, nn as isNativeStatus, nt as SummaryType, o as ProxyMethod, on as DISPLAY_NAME_FIELDS, ot as UploadFile, p as CreatedField, pn as fieldSchemaOverride, pt as ConditionValue, q as SearchOptions, qt as usableStatuses, r as ProxyError, rn as nativeStatus, rt as TextSearchRow, s as ProxyResult, sn as FIELD_SCHEMA_OVERRIDES, st as UploadResult, t as PROXY_METHODS, tn as StockIconSource, tt as SummaryGrouping, u as createProxyHandler, un as RawFieldsResponse, ut as hierarchyEntity, v as SCHEMA_PROXY_METHODS, vn as undeclaredField, vt as LogicalOperator, w as createSchemaProxyHandler, wn as Operator, wt as emptyFilter, x as SchemaProperties, xn as NEGATING_OPERATORS, xt as WireCondition, y as SchemaApiError, yn as DATA_TYPES, yt as Scalar, z as HierarchyNode, zt as foregroundFor } from "./proxy-handler-C6XB6gss.mjs";
|
|
2
|
+
//#region src/field-name.d.ts
|
|
3
|
+
/** The prefix the server puts in front of every custom field it creates. */
|
|
4
|
+
export declare const CUSTOM_FIELD_PREFIX = "sg_";
|
|
5
|
+
/**
|
|
6
|
+
* Whether a display name holds a character outside ASCII. The server discards such a name
|
|
7
|
+
* whole when it derives the programmatic name (findings/117_field_types_and_names).
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasNonAscii(displayName: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The programmatic name the server derives from a display name, or null when it cannot be
|
|
12
|
+
* predicted: a blank display name, or a non-ASCII one without its data type.
|
|
13
|
+
*
|
|
14
|
+
* An ASCII display name gives the prefix, then the name lowercased with each character
|
|
15
|
+
* outside `[a-z0-9_]` replaced by one underscore. Nothing is trimmed, collapsed or cut, a
|
|
16
|
+
* leading digit stays, and a prefix already there is doubled (findings/019_create_fields,
|
|
17
|
+
* findings/117_field_types_and_names).
|
|
18
|
+
*
|
|
19
|
+
* One non-ASCII character anywhere and the server ignores the display name: the field is
|
|
20
|
+
* `sg_<data_type>`. That is measured on a `currency` field and inferred for the other types.
|
|
21
|
+
* A name already taken comes back suffixed `_1`, `_2`, and a name a retired field holds is
|
|
22
|
+
* refused; neither is predicted here.
|
|
23
|
+
*/
|
|
24
|
+
export declare function predictFieldName(displayName: string, dataType?: string): string | null;
|
|
25
|
+
//#endregion
|
|
2
26
|
//#region src/field-icons.d.ts
|
|
3
27
|
/** The catch-all glyph, used for a data type this build does not know. */
|
|
4
28
|
export declare const DEFAULT_FIELD_ICON = "file-text";
|
|
@@ -7,6 +31,19 @@ export declare function iconNameFor(dataType: string): string;
|
|
|
7
31
|
/** Every icon name this module can return, for a UI package's name-to-component map. */
|
|
8
32
|
export declare const FIELD_ICON_NAMES: readonly string[];
|
|
9
33
|
//#endregion
|
|
34
|
+
//#region src/data-type-labels.d.ts
|
|
35
|
+
export declare const DATA_TYPE_LABELS: Readonly<Record<DataType, string>>;
|
|
36
|
+
/** The label of a data type: the caller's, else this build's, else the name as given. */
|
|
37
|
+
export declare function dataTypeLabel(dataType: string, labels?: Readonly<Record<string, string>>): string;
|
|
38
|
+
export interface DataTypeOptionsConfig {
|
|
39
|
+
/** The held type. Outside the set, it is kept as a last option, since a row may hold it. */
|
|
40
|
+
value?: string | null;
|
|
41
|
+
/** Labels of the caller's own, which win over this build's. */
|
|
42
|
+
labels?: Readonly<Record<string, string>>;
|
|
43
|
+
}
|
|
44
|
+
/** The options a picker offers for a set of data types, in the order given, each once. */
|
|
45
|
+
export declare function dataTypeOptions(types: readonly string[], config?: DataTypeOptionsConfig): StatusOption[];
|
|
46
|
+
//#endregion
|
|
10
47
|
//#region src/filter-ux.d.ts
|
|
11
48
|
/** One label per raw operator, for a type that has no wording of its own. */
|
|
12
49
|
export declare const OPERATOR_LABELS: Readonly<Record<Operator, string>>;
|
|
@@ -1753,75 +1790,40 @@ export declare function scrollHighlightedIntoView(list: Element | null | undefin
|
|
|
1753
1790
|
*/
|
|
1754
1791
|
export declare function watchHighlight(list: Element | null | undefined): () => void;
|
|
1755
1792
|
//#endregion
|
|
1756
|
-
//#region src/
|
|
1757
|
-
export interface
|
|
1758
|
-
/**
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
export declare
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
}): Promise<TextSearchRow[]>;
|
|
1779
|
-
statuses(): Promise<StatusRecord[]>;
|
|
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[]>;
|
|
1784
|
-
/** The bytes cross the protocol base64-encoded; the handler runs the three calls. */
|
|
1785
|
-
upload(entityType: string, id: number, file: UploadFile): Promise<UploadResult>;
|
|
1786
|
-
update(entityType: string, id: number, patch: Record<string, unknown>): Promise<EntityRow>;
|
|
1787
|
-
hierarchySearch(rootPath: string, entity: EntityRef): Promise<HierarchyPath[]>;
|
|
1788
|
-
hierarchyExpand(path: string): Promise<HierarchyNode>;
|
|
1789
|
-
summarize(entityType: string, options?: SummarizeOptions): Promise<SummarizeResult>;
|
|
1790
|
-
threadContents(noteId: number, entityFields?: Record<string, string[]>): Promise<ThreadRow[]>;
|
|
1791
|
-
eventLog(options?: EventLogOptions): Promise<EventLogResult>;
|
|
1792
|
-
following(userId: number, options?: FollowingOptions): Promise<EntityRef[]>;
|
|
1793
|
-
}
|
|
1794
|
-
//#endregion
|
|
1795
|
-
//#region src/proxy-handler.d.ts
|
|
1796
|
-
/** The methods the protocol carries, one POST each. */
|
|
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'];
|
|
1798
|
-
export type ProxyMethod = (typeof PROXY_METHODS)[number];
|
|
1799
|
-
/** An error as it crosses the wire. `ProxyClient` rebuilds an `SgApiError` from it. */
|
|
1800
|
-
export interface ProxyError {
|
|
1801
|
-
status: number;
|
|
1802
|
-
message: string;
|
|
1803
|
-
body: unknown;
|
|
1804
|
-
}
|
|
1805
|
-
export type ProxyBody = {
|
|
1806
|
-
data: unknown;
|
|
1807
|
-
} | {
|
|
1808
|
-
error: ProxyError;
|
|
1809
|
-
};
|
|
1810
|
-
export interface ProxyResult {
|
|
1811
|
-
/** HTTP status the wrapper writes. */
|
|
1812
|
-
status: number;
|
|
1813
|
-
body: ProxyBody;
|
|
1793
|
+
//#region src/valid-values.d.ts
|
|
1794
|
+
export interface ListValueOptions {
|
|
1795
|
+
/** Keep the first of a repeated value and drop the rest. Off: a repeat is kept. */
|
|
1796
|
+
unique?: boolean;
|
|
1797
|
+
}
|
|
1798
|
+
/** The values trimmed, the blank ones dropped, in the order given. */
|
|
1799
|
+
export declare function normalizeListValues(values: readonly string[], options?: ListValueOptions): string[];
|
|
1800
|
+
/** One value per line of a typed or pasted text. */
|
|
1801
|
+
export declare function splitListValues(text: string, options?: ListValueOptions): string[];
|
|
1802
|
+
/**
|
|
1803
|
+
* The list with the value at `index` rewritten as `text`. A blank text removes it, a
|
|
1804
|
+
* text of several lines puts each line in its place, and the index past the end appends.
|
|
1805
|
+
*/
|
|
1806
|
+
export declare function replaceListValue(values: readonly string[], index: number, text: string, options?: ListValueOptions): string[];
|
|
1807
|
+
/** The list with every line of `text` appended. */
|
|
1808
|
+
export declare function addListValues(values: readonly string[], text: string, options?: ListValueOptions): string[];
|
|
1809
|
+
/** The list with the value at `from` moved to `to`. A place outside the list leaves it alone. */
|
|
1810
|
+
export declare function moveListValue(values: readonly string[], from: number, to: number): string[];
|
|
1811
|
+
/** One row of the editor: a value, and a key that outlives an edit and a move. */
|
|
1812
|
+
export interface ListRow {
|
|
1813
|
+
key: string;
|
|
1814
|
+
value: string;
|
|
1814
1815
|
}
|
|
1815
|
-
export type ProxyHandler = (method: string, body: unknown) => Promise<ProxyResult>;
|
|
1816
|
-
export declare function isProxyMethod(value: string): value is ProxyMethod;
|
|
1817
1816
|
/**
|
|
1818
|
-
*
|
|
1819
|
-
*
|
|
1817
|
+
* The rows for `values`, keeping the keys of `rows` wherever a row is still there.
|
|
1818
|
+
*
|
|
1819
|
+
* Values may repeat, so a value cannot be its row's key. A row is matched where it
|
|
1820
|
+
* stands, then by its value wherever it went, then by its place when its value was
|
|
1821
|
+
* edited; what is left is new and takes a key no row holds. Unchanged values answer
|
|
1822
|
+
* the rows as given.
|
|
1820
1823
|
*/
|
|
1821
|
-
export declare function
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
export declare function createProxyHandler(client: SgClient): ProxyHandler;
|
|
1824
|
+
export declare function syncListRows(rows: readonly ListRow[], values: readonly string[]): ListRow[];
|
|
1825
|
+
/** Every status of the site as an option: its code, and its name as the label. */
|
|
1826
|
+
export declare function statusTableOptions(records: readonly StatusRecord[]): StatusOption[];
|
|
1825
1827
|
//#endregion
|
|
1826
1828
|
//#region src/session-auth.d.ts
|
|
1827
1829
|
export interface SessionTokenAuthOptions {
|
|
@@ -2128,6 +2130,21 @@ export declare function resolveFieldPathOptions(schema: Pick<SchemaService, 'res
|
|
|
2128
2130
|
/** Rows matching the search box, read on what the row shows and on the path behind it. */
|
|
2129
2131
|
export declare function searchFieldPathOptions(options: readonly FieldPathOption[], query: string): FieldPathOption[];
|
|
2130
2132
|
//#endregion
|
|
2133
|
+
//#region src/project-eligibility.d.ts
|
|
2134
|
+
/** The Project checkboxes eligibility reads; request them with the projects. */
|
|
2135
|
+
export declare const PROJECT_ELIGIBILITY_FIELDS: readonly ['is_template', 'archived', 'is_demo'];
|
|
2136
|
+
/** A project row holding the eligibility checkboxes by programmatic name. */
|
|
2137
|
+
export type EligibilityFlags = { readonly [K in (typeof PROJECT_ELIGIBILITY_FIELDS)[number]]?: unknown; };
|
|
2138
|
+
/**
|
|
2139
|
+
* Whether a project is eligible for field visibility: not a template, not archived, not
|
|
2140
|
+
* a demo project. Status is never read: `sg_status` is null on most working projects
|
|
2141
|
+
* (findings/018_project_listing). Only a flag that is `true` excludes; the probed site
|
|
2142
|
+
* never returned a null checkbox.
|
|
2143
|
+
*/
|
|
2144
|
+
export declare function isEligibleProject<T extends EligibilityFlags>(project: T): boolean;
|
|
2145
|
+
/** The eligible projects, in their order. */
|
|
2146
|
+
export declare function eligibleProjects<T extends EligibilityFlags>(projects: readonly T[]): T[];
|
|
2147
|
+
//#endregion
|
|
2131
2148
|
//#region src/sortable.d.ts
|
|
2132
2149
|
/**
|
|
2133
2150
|
* Ordered lists that reorder by pointer and by keyboard.
|
|
@@ -2825,4 +2842,4 @@ export declare function markOverflow(list: HTMLElement | null | undefined): bool
|
|
|
2825
2842
|
*/
|
|
2826
2843
|
export declare function watchOverflow(list: HTMLElement | null | undefined): () => void;
|
|
2827
2844
|
//#endregion
|
|
2828
|
-
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 };
|
|
2845
|
+
export { BatchRequest, BatchResult, ConditionValue, CreateFieldInput, CreatedField, DATA_TYPES, DISPLAY_NAME_FIELDS, DataType, EVENT_LOG_FIELDS, EntityRef, EntityRow, EntityTypeInfo, EventLogEntry, EventLogOptions, EventLogResult, FIELD_SCHEMA_OVERRIDES, FieldReadResult, FieldSchema, FilterCondition, FilterGroup, FilterNode, FollowingOptions, HierarchyNode, HierarchyPath, HierarchyRef, LogicalOperator, NATIVE_STATUSES, NEGATING_OPERATORS, NativeStatus, OPERATORS, OPERATORS_BY_TYPE, Operator, PROXY_METHODS, ProxyBody, ProxyClient, ProxyClientOptions, ProxyError, ProxyHandler, ProxyHandlerOptions, ProxyMethod, ProxyResult, ProxySchemaClient, RawBatchRow, RawFieldSchema, RawFieldsResponse, RawHierarchyNode, RawProperty, ReadOptions, RestClient, RestClientOptions, RestSchemaClient, ReviveFieldResult, Rgb, SCHEMA_PROXY_METHODS, STOCK_ICON_CELLS, STOCK_ICON_DATA_URLS, STOCK_ICON_KEYS, STOCK_SPRITE_PATH, Scalar, SchemaApiError, SchemaClient, SchemaProperties, SchemaProperty, SchemaProxyMethod, 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, base64ToBytes, batchResults, bytesToBase64, condition, createProxyHandler, createSchemaProxyHandler, displayNameOf, emptyFilter, eventLogFilters, fieldFromRaw, fieldSchemaOverride, foregroundFor, fromWire, group, hierarchyEntity, intersectStatuses, isBlankCondition, isDataType, isEmptyFilter, isFilterable, isLinkType, isNativeStatus, isNumericType, isOperator, isProxyMethod, isSchemaProxyMethod, isTemporalType, nativeStatus, normalizeEventLogEntry, normalizeField, normalizeFields, normalizeHierarchyNode, operatorsFor, parseBgColor, referencedPaths, relativeLuminance, rgbToCss, spriteStyle, statusFieldFor, statusFieldNameFor, statusGlyph, statusLabel, statusPaint, stockIconSource, supportsOperator, toApi3Hash, toFilterArray, toSchemaProperties, undeclaredField, usableStatuses, walk };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { $ as supportsOperator, A as group, B as DATA_TYPES, C as statusFieldFor, D as condition, F as toFilterArray, G as VALUE_SHAPE, H as OPERATORS, I as walk, J as isLinkType, K as isDataType, L as CUSTOM_FIELD_PREFIX, M as isEmptyFilter, N as referencedPaths, O as emptyFilter, P as toApi3Hash, Q as operatorsFor, R as hasNonAscii, S as normalizeFields, T as undeclaredField, U as OPERATORS_BY_TYPE, V as NEGATING_OPERATORS, W as TIME_UNITS, X as isOperator, Y as isNumericType, Z as isTemporalType, _ as DISPLAY_NAME_FIELDS, a as createSchemaProxyHandler, b as fieldSchemaOverride, c as toSchemaProperties, d as SgApiError, f as batchResults, g as normalizeHierarchyNode, h as normalizeEventLogEntry, i as SchemaApiError, j as isBlankCondition, k as fromWire, l as EVENT_LOG_FIELDS, m as hierarchyEntity, n as RestSchemaClient, o as fieldFromRaw, p as eventLogFilters, q as isFilterable, r as SCHEMA_PROXY_METHODS, s as isSchemaProxyMethod, t as ProxySchemaClient, u as RestClient, v as FIELD_SCHEMA_OVERRIDES, w as statusFieldNameFor, x as normalizeField, y as displayNameOf, z as predictFieldName } from "./schema-write-D_WfMYW8.mjs";
|
|
2
2
|
//#region src/field-icons.ts
|
|
3
3
|
const ICONS = {
|
|
4
4
|
text: "type",
|
|
@@ -38,6 +38,52 @@ function iconNameFor(dataType) {
|
|
|
38
38
|
/** Every icon name this module can return, for a UI package's name-to-component map. */
|
|
39
39
|
const FIELD_ICON_NAMES = [.../* @__PURE__ */ new Set([...Object.values(ICONS), DEFAULT_FIELD_ICON])].sort();
|
|
40
40
|
//#endregion
|
|
41
|
+
//#region src/data-type-labels.ts
|
|
42
|
+
const DATA_TYPE_LABELS = {
|
|
43
|
+
text: "Text",
|
|
44
|
+
number: "Number",
|
|
45
|
+
float: "Float",
|
|
46
|
+
percent: "Percent",
|
|
47
|
+
currency: "Currency",
|
|
48
|
+
duration: "Duration",
|
|
49
|
+
timecode: "Timecode",
|
|
50
|
+
footage: "Footage",
|
|
51
|
+
checkbox: "Checkbox",
|
|
52
|
+
date: "Date",
|
|
53
|
+
date_time: "Date and time",
|
|
54
|
+
list: "List",
|
|
55
|
+
status_list: "Status list",
|
|
56
|
+
entity: "Entity",
|
|
57
|
+
multi_entity: "Multi-entity",
|
|
58
|
+
tag_list: "Tag list",
|
|
59
|
+
entity_type: "Entity type",
|
|
60
|
+
image: "Image",
|
|
61
|
+
url: "URL",
|
|
62
|
+
color: "Color",
|
|
63
|
+
uuid: "UUID",
|
|
64
|
+
jsonb: "JSON",
|
|
65
|
+
calculated: "Calculated",
|
|
66
|
+
summary: "Summary",
|
|
67
|
+
serializable: "Serializable",
|
|
68
|
+
password: "Password",
|
|
69
|
+
pivot_column: "Pivot column"
|
|
70
|
+
};
|
|
71
|
+
/** The label of a data type: the caller's, else this build's, else the name as given. */
|
|
72
|
+
function dataTypeLabel(dataType, labels) {
|
|
73
|
+
if (labels && Object.hasOwn(labels, dataType)) return labels[dataType];
|
|
74
|
+
return Object.hasOwn(DATA_TYPE_LABELS, dataType) ? DATA_TYPE_LABELS[dataType] : dataType;
|
|
75
|
+
}
|
|
76
|
+
/** The options a picker offers for a set of data types, in the order given, each once. */
|
|
77
|
+
function dataTypeOptions(types, config = {}) {
|
|
78
|
+
const codes = new Set(types);
|
|
79
|
+
if (config.value) codes.add(config.value);
|
|
80
|
+
codes.delete("");
|
|
81
|
+
return [...codes].map((code) => ({
|
|
82
|
+
code,
|
|
83
|
+
label: dataTypeLabel(code, config.labels)
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
41
87
|
//#region src/filter-ux.ts
|
|
42
88
|
/** One label per raw operator, for a type that has no wording of its own. */
|
|
43
89
|
const OPERATOR_LABELS = {
|
|
@@ -4712,6 +4758,94 @@ function createStatusService(client) {
|
|
|
4712
4758
|
};
|
|
4713
4759
|
}
|
|
4714
4760
|
//#endregion
|
|
4761
|
+
//#region src/valid-values.ts
|
|
4762
|
+
/** The values trimmed, the blank ones dropped, in the order given. */
|
|
4763
|
+
function normalizeListValues(values, options = {}) {
|
|
4764
|
+
const kept = [];
|
|
4765
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4766
|
+
for (const raw of values) {
|
|
4767
|
+
const value = raw.trim();
|
|
4768
|
+
if (value === "") continue;
|
|
4769
|
+
if (options.unique && seen.has(value)) continue;
|
|
4770
|
+
seen.add(value);
|
|
4771
|
+
kept.push(value);
|
|
4772
|
+
}
|
|
4773
|
+
return kept;
|
|
4774
|
+
}
|
|
4775
|
+
/** One value per line of a typed or pasted text. */
|
|
4776
|
+
function splitListValues(text, options = {}) {
|
|
4777
|
+
return normalizeListValues(text.split(/\r\n|\r|\n/), options);
|
|
4778
|
+
}
|
|
4779
|
+
/**
|
|
4780
|
+
* The list with the value at `index` rewritten as `text`. A blank text removes it, a
|
|
4781
|
+
* text of several lines puts each line in its place, and the index past the end appends.
|
|
4782
|
+
*/
|
|
4783
|
+
function replaceListValue(values, index, text, options = {}) {
|
|
4784
|
+
if (index < 0 || index > values.length) return [...values];
|
|
4785
|
+
const next = [...values];
|
|
4786
|
+
next.splice(index, 1, ...splitListValues(text));
|
|
4787
|
+
return normalizeListValues(next, options);
|
|
4788
|
+
}
|
|
4789
|
+
/** The list with every line of `text` appended. */
|
|
4790
|
+
function addListValues(values, text, options = {}) {
|
|
4791
|
+
return replaceListValue(values, values.length, text, options);
|
|
4792
|
+
}
|
|
4793
|
+
/** The list with the value at `from` moved to `to`. A place outside the list leaves it alone. */
|
|
4794
|
+
function moveListValue(values, from, to) {
|
|
4795
|
+
const next = [...values];
|
|
4796
|
+
if (from < 0 || from >= next.length || to < 0 || to >= next.length || from === to) return next;
|
|
4797
|
+
const [moved] = next.splice(from, 1);
|
|
4798
|
+
next.splice(to, 0, moved);
|
|
4799
|
+
return next;
|
|
4800
|
+
}
|
|
4801
|
+
/**
|
|
4802
|
+
* The rows for `values`, keeping the keys of `rows` wherever a row is still there.
|
|
4803
|
+
*
|
|
4804
|
+
* Values may repeat, so a value cannot be its row's key. A row is matched where it
|
|
4805
|
+
* stands, then by its value wherever it went, then by its place when its value was
|
|
4806
|
+
* edited; what is left is new and takes a key no row holds. Unchanged values answer
|
|
4807
|
+
* the rows as given.
|
|
4808
|
+
*/
|
|
4809
|
+
function syncListRows(rows, values) {
|
|
4810
|
+
if (rows.length === values.length && rows.every((row, index) => row.value === values[index])) return rows;
|
|
4811
|
+
const keys = values.map(() => void 0);
|
|
4812
|
+
const used = /* @__PURE__ */ new Set();
|
|
4813
|
+
const take = (at, from) => {
|
|
4814
|
+
keys[at] = rows[from].key;
|
|
4815
|
+
used.add(from);
|
|
4816
|
+
};
|
|
4817
|
+
values.forEach((value, at) => {
|
|
4818
|
+
if (rows[at]?.value === value) take(at, at);
|
|
4819
|
+
});
|
|
4820
|
+
values.forEach((value, at) => {
|
|
4821
|
+
if (keys[at] !== void 0) return;
|
|
4822
|
+
const from = rows.findIndex((row, index) => !used.has(index) && row.value === value);
|
|
4823
|
+
if (from >= 0) take(at, from);
|
|
4824
|
+
});
|
|
4825
|
+
values.forEach((_, at) => {
|
|
4826
|
+
if (keys[at] === void 0 && at < rows.length && !used.has(at)) take(at, at);
|
|
4827
|
+
});
|
|
4828
|
+
let minted = rows.reduce((most, row) => Math.max(most, Number(row.key.slice(1)) || 0), 0);
|
|
4829
|
+
return values.map((value, at) => ({
|
|
4830
|
+
key: keys[at] ?? `r${++minted}`,
|
|
4831
|
+
value
|
|
4832
|
+
}));
|
|
4833
|
+
}
|
|
4834
|
+
/** Every status of the site as an option: its code, and its name as the label. */
|
|
4835
|
+
function statusTableOptions(records) {
|
|
4836
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4837
|
+
const options = [];
|
|
4838
|
+
for (const record of records) {
|
|
4839
|
+
if (record.code === "" || seen.has(record.code)) continue;
|
|
4840
|
+
seen.add(record.code);
|
|
4841
|
+
options.push({
|
|
4842
|
+
code: record.code,
|
|
4843
|
+
label: record.name || record.code
|
|
4844
|
+
});
|
|
4845
|
+
}
|
|
4846
|
+
return options;
|
|
4847
|
+
}
|
|
4848
|
+
//#endregion
|
|
4715
4849
|
//#region src/proxy-handler.ts
|
|
4716
4850
|
/** The methods the protocol carries, one POST each. */
|
|
4717
4851
|
const PROXY_METHODS = [
|
|
@@ -4815,8 +4949,10 @@ function fail(status, message, body = null) {
|
|
|
4815
4949
|
};
|
|
4816
4950
|
}
|
|
4817
4951
|
/** Wraps a client so a host app can expose it over its own HTTP endpoints. */
|
|
4818
|
-
function createProxyHandler(client) {
|
|
4952
|
+
function createProxyHandler(client, options = {}) {
|
|
4953
|
+
const schema = options.schema ? createSchemaProxyHandler(options.schema) : null;
|
|
4819
4954
|
return async function handle(method, body) {
|
|
4955
|
+
if (schema && isSchemaProxyMethod(method)) return schema(method, body);
|
|
4820
4956
|
if (!isProxyMethod(method)) return fail(404, `Unknown method '${method}'`);
|
|
4821
4957
|
if (body !== void 0 && body !== null && typeof body !== "object") return fail(400, "Body must be a JSON object");
|
|
4822
4958
|
const p = body ?? {};
|
|
@@ -6014,6 +6150,27 @@ function searchFieldPathOptions(options, query) {
|
|
|
6014
6150
|
return options.filter((option) => matchesEveryWord(haystack(option.label, option.path), query));
|
|
6015
6151
|
}
|
|
6016
6152
|
//#endregion
|
|
6153
|
+
//#region src/project-eligibility.ts
|
|
6154
|
+
/** The Project checkboxes eligibility reads; request them with the projects. */
|
|
6155
|
+
const PROJECT_ELIGIBILITY_FIELDS = [
|
|
6156
|
+
"is_template",
|
|
6157
|
+
"archived",
|
|
6158
|
+
"is_demo"
|
|
6159
|
+
];
|
|
6160
|
+
/**
|
|
6161
|
+
* Whether a project is eligible for field visibility: not a template, not archived, not
|
|
6162
|
+
* a demo project. Status is never read: `sg_status` is null on most working projects
|
|
6163
|
+
* (findings/018_project_listing). Only a flag that is `true` excludes; the probed site
|
|
6164
|
+
* never returned a null checkbox.
|
|
6165
|
+
*/
|
|
6166
|
+
function isEligibleProject(project) {
|
|
6167
|
+
return PROJECT_ELIGIBILITY_FIELDS.every((field) => project[field] !== true);
|
|
6168
|
+
}
|
|
6169
|
+
/** The eligible projects, in their order. */
|
|
6170
|
+
function eligibleProjects(projects) {
|
|
6171
|
+
return projects.filter(isEligibleProject);
|
|
6172
|
+
}
|
|
6173
|
+
//#endregion
|
|
6017
6174
|
//#region src/sortable.ts
|
|
6018
6175
|
/** The attribute carrying an item's id. It is what the controller walks the list by. */
|
|
6019
6176
|
const SORTABLE_ID_ATTRIBUTE = "data-sortable-id";
|
|
@@ -6385,6 +6542,22 @@ function createSortableController(options) {
|
|
|
6385
6542
|
window.removeEventListener("keydown", onDragKey, true);
|
|
6386
6543
|
}
|
|
6387
6544
|
let keyboard = null;
|
|
6545
|
+
/**
|
|
6546
|
+
* A move is drawn after the key that made it, and a row moved in the document
|
|
6547
|
+
* loses the focus it held. That is the redraw, not the caret leaving: a carry
|
|
6548
|
+
* goes on, and the grip takes the focus back once the list is drawn, unless
|
|
6549
|
+
* the caret has gone somewhere else by then.
|
|
6550
|
+
*/
|
|
6551
|
+
function holdThroughRedraw(handle) {
|
|
6552
|
+
const carried = keyboard;
|
|
6553
|
+
if (carried) carried.redrawing = true;
|
|
6554
|
+
setTimeout(() => {
|
|
6555
|
+
if (carried) carried.redrawing = false;
|
|
6556
|
+
if (keyboard !== carried || !container.contains(handle)) return;
|
|
6557
|
+
const active = handle.ownerDocument.activeElement;
|
|
6558
|
+
if (active === null || active === handle.ownerDocument.body) handle.focus({ preventScroll: true });
|
|
6559
|
+
}, 0);
|
|
6560
|
+
}
|
|
6388
6561
|
function endKeyboard() {
|
|
6389
6562
|
keyboard = null;
|
|
6390
6563
|
clearMarks();
|
|
@@ -6402,7 +6575,8 @@ function createSortableController(options) {
|
|
|
6402
6575
|
event.preventDefault();
|
|
6403
6576
|
keyboard = {
|
|
6404
6577
|
id,
|
|
6405
|
-
origin: [...order()]
|
|
6578
|
+
origin: [...order()],
|
|
6579
|
+
redrawing: false
|
|
6406
6580
|
};
|
|
6407
6581
|
item.setAttribute("data-dragging", "true");
|
|
6408
6582
|
setActive(id);
|
|
@@ -6416,6 +6590,7 @@ function createSortableController(options) {
|
|
|
6416
6590
|
const next = held.keyboardMove(id, event.key === "ArrowUp" ? "up" : "down");
|
|
6417
6591
|
const to = next.indexOf(id);
|
|
6418
6592
|
if (to === held.indexOf(id)) return;
|
|
6593
|
+
holdThroughRedraw(handle);
|
|
6419
6594
|
onOrderChange(next, id);
|
|
6420
6595
|
say(held.movedTo(id, to));
|
|
6421
6596
|
handle.scrollIntoView({ block: "nearest" });
|
|
@@ -6432,13 +6607,14 @@ function createSortableController(options) {
|
|
|
6432
6607
|
event.stopPropagation();
|
|
6433
6608
|
const restored = keyboard.origin;
|
|
6434
6609
|
endKeyboard();
|
|
6610
|
+
holdThroughRedraw(handle);
|
|
6435
6611
|
onOrderChange([...restored], id);
|
|
6436
6612
|
say(sortableAnnouncements.cancel());
|
|
6437
6613
|
}
|
|
6438
6614
|
}
|
|
6439
6615
|
/** Focus leaving the list drops what it was carrying rather than stranding it. */
|
|
6440
6616
|
function onFocusOut(event) {
|
|
6441
|
-
if (!keyboard) return;
|
|
6617
|
+
if (!keyboard || keyboard.redrawing) return;
|
|
6442
6618
|
const next = event.relatedTarget;
|
|
6443
6619
|
if (next instanceof Node && container.contains(next)) return;
|
|
6444
6620
|
say(model().dropped(keyboard.id));
|
|
@@ -8195,4 +8371,4 @@ function watchOverflow(list) {
|
|
|
8195
8371
|
};
|
|
8196
8372
|
}
|
|
8197
8373
|
//#endregion
|
|
8198
|
-
export { AppSessionError, COLOR_SENTINEL, DATA_TYPES, DEFAULT_FIELD_ICON, DISPLAY_NAME_FIELDS, ELLIPSIS_CHIPS, ERROR_LABEL, EVENT_LOG_FIELDS, FIELD_ICON_NAMES, FIELD_SCHEMA_OVERRIDES, FLOAT_PRECISION, HIERARCHY_LEAF_LIMIT, INT32_MAX, INT32_MIN, LOADING_LABEL, NAME_HUES, NATIVE_STATUSES, NEGATING_OPERATORS, NOTHING_CHOSEN_LABEL, NO_MATCH_LABEL, NO_ROWS_LABEL, OPERATORS, OPERATORS_BY_TYPE, OPERATOR_LABELS, OVERFLOW_END_VAR, OVERFLOW_START_VAR, PATH_SEPARATOR, PRESS_WINDOW_MS, PROJECT_PICKER_FIELDS, PROXY_METHODS, ProxyClient, RestClient, SCROLL_THRESHOLD, SEARCHING_LABEL, SEARCH_DEBOUNCE_MS, SEARCH_PAGE_SIZE, SORTABLE_HANDLE_ATTRIBUTE, SORTABLE_ID_ATTRIBUTE, STOCK_ICON_CELLS, STOCK_ICON_DATA_URLS, STOCK_ICON_KEYS, STOCK_SPRITE_PATH, SgApiError, THUMBNAIL_PENDING_PATH, TIME_UNITS, TIME_UNIT_LABELS, TREE_STATUS_FIELDS, UNRESOLVED_PATH_LABEL, USER_PICKER_FIELDS, VALUE_SHAPE, appendAt, applyPreset, arrangeColumns, asCollapseState, asFilterGroup, base64ToBytes, batchResults, breadcrumb, bytesToBase64, canLoadNext, cellValue, clearableForField, collapseAll, collapseStateFrom, collapsedKeys, collectionBottom, collectionView, colorToHex, columnPaths, columnsStorageKey, condition, conditionArity, conditionList, conditionParts, conditionValues, contextFromClient, countActiveConditions, countConditions, countLine, createEntitySearch, createEntitySource, createProxyHandler, createQueryCache, createSchemaService, createSessionTokenAuth, createSgContext, createSortable, createSortableController, createStatusService, createTree, currentPlatform, currentType, defaultCondition, defaultValueFor, deriveFieldOptions, describeCondition, describeEntityCard, describePaging, displayNameOf, editorKindFor, editorNeedsContext, editorPlacementFor, emptyFilter, emptyValueFor, entityCardFields, entityCardSlot, entityDetailUrl, entityKey, entityTypeOptions, errorText, eventLogFilters, expandAll, extendByStep, extendRange, facetCounts, facetLists, facetPresets, facetScopes, facetShape, facetValues, facetValuesFromGroups, fieldOperators, fieldPathOf, fieldSchemaOverride, fieldText, fileHref, fileNameFromUrl, filterEntityTypes, filterableFields, findCondition, findFacet, firstEnabledIndex, fitChips, flattenRow, focusChip, foregroundFor, formatCurrency, formatDate, formatDateTime, formatDuration, formatFloat, formatNumberInput, formatPercent, formatTimecode, friendlyFieldPath, fromApiDateTime, fromSortString, fromWire, gestureOf, group, groupKeyText, groupRows, groupRowsKeyed, hasFailedPage, hasMorePage, hierarchyEntity, hierarchyLoader, hierarchySearcher, hydrate, iconNameFor, idsForRefs, imageState, initialsOf, intersectStatuses, isBareRef, isBlankCondition, isCollapsed, isDataType, isEditableType, isEmptyFilter, isEmptyValue, isFilterable, isGroupingRefusal, isHiddenPath, isLinkType, isNativeStatus, isNumericType, isOperator, isParseError, isPinned, isProxyMethod, isSortable, isTemporalType, isValidListValue, isoDay, isoDayParts, listStatus, loadEntityCard, loadsOnArrowDown, markOverflow, matchRuns, matchesEveryWord, matchingOffer, measureSortable, mergeFilters, moveAt, moveFieldPath, nameColorIndex, nameHue, nameSearchFilter, nativeStatus, nextEnabledIndex, nodeAt, normalizeEventLogEntry, normalizeField, normalizeFields, normalizeHierarchyNode, normalizeSiteUrl, numberDigits, numberDraft, numberSteps, numberWire, operatorLabel, operatorMenu, operatorsFor, overflowEdges, parseBgColor, parseColorInput, parseColumnChoice, parseDurationInput, parseFloatInput, parseInteger, parseNumberInput, parseTextInput, parseTimecodeInput, parseUrlInput, pathLabel, pathOf, pathRefs, pathTypes, pickerKeyIntent, placeholderName, playSortableFlip, pollAppSession, preferencesOf, prependRecent, presetById, presetIdOf, presetsFor, pressGate, projectOfPath, projectPickerFilters, pruneFilterToFields, queryPlan, reachedEnd, referencedPaths, refsForIds, relativeFrom, relativeLuminance, relativeOperator, relativeValue, relativeWindow, removeAt, renderKindFor, repeatedLabels, replaceAt, requestAppSession, requestGate, resolveColumnChoice, resolveColumns, resolveFieldPathOptions, resolveRowFields, resolveTreeFields, rgbToCss, rowCode, rowFields, rowIdOf, rowIsDisabled, rowKey, rowSecondary, rowSubLabel, rowThumbnail, sameCollapse, sameColumnPaths, sameFilters, sameIds, sameRefs, sameSort, scopeToProject, scrollHighlightedIntoView, searchFieldOptions, searchFieldPathOptions, searchKeyIntent, searchTypeMap, searchView, searchWords, secondaryType, selectableRefs, selectionKeyIntent, selectionState, serializeColumnChoice, serializeSort, setFacet, setFacetPreset, setRefs, settleStep, shouldLoadNext, sortableAnnouncements, sortableDropIndex, sortableFields, sortableScrollStep, sortableStride, sourceModeFor, spriteStyle, stateLine, statusFieldFor, statusFieldNameFor, statusGlyph, statusLabel, statusPaint, stepNumber, stockIconSource, storedNumber, subLabelType, summariseSelection, supportsEmpty, supportsOperator, thumbnailField, timeUnitField, timeUnitLabel, timeZoneName, toApi3Hash, toApiDate, toApiDateTime, toApiFloat, toColumn, toFilterArray, toRef, toSearchHit, toSortKeys, toSortSpecs, toSortString, toWireGroup, toggleCollapsed, toggleFieldPath, toggleId, toggleRef, toggleRow, traversalTargets, undeclaredField, unformatNumberInput, unreadPaths, urlLink, usableStatuses, userPickerFilters, userPickerSearchFields, userPickerSubLabel, userPickerTypes, userSearchFields, validateCondition, valueArity, valueEditorFor, walk, watchHighlight, watchOverflow, withAddedListValue, withListValue, withRelativeWindow, withSelectedPinned, withoutListValue, withoutPaths };
|
|
8374
|
+
export { AppSessionError, COLOR_SENTINEL, CUSTOM_FIELD_PREFIX, DATA_TYPES, DATA_TYPE_LABELS, DEFAULT_FIELD_ICON, DISPLAY_NAME_FIELDS, ELLIPSIS_CHIPS, ERROR_LABEL, EVENT_LOG_FIELDS, FIELD_ICON_NAMES, FIELD_SCHEMA_OVERRIDES, FLOAT_PRECISION, HIERARCHY_LEAF_LIMIT, INT32_MAX, INT32_MIN, LOADING_LABEL, NAME_HUES, NATIVE_STATUSES, NEGATING_OPERATORS, NOTHING_CHOSEN_LABEL, NO_MATCH_LABEL, NO_ROWS_LABEL, OPERATORS, OPERATORS_BY_TYPE, OPERATOR_LABELS, OVERFLOW_END_VAR, OVERFLOW_START_VAR, PATH_SEPARATOR, PRESS_WINDOW_MS, PROJECT_ELIGIBILITY_FIELDS, PROJECT_PICKER_FIELDS, PROXY_METHODS, ProxyClient, ProxySchemaClient, RestClient, RestSchemaClient, SCHEMA_PROXY_METHODS, SCROLL_THRESHOLD, SEARCHING_LABEL, SEARCH_DEBOUNCE_MS, SEARCH_PAGE_SIZE, SORTABLE_HANDLE_ATTRIBUTE, SORTABLE_ID_ATTRIBUTE, STOCK_ICON_CELLS, STOCK_ICON_DATA_URLS, STOCK_ICON_KEYS, STOCK_SPRITE_PATH, SchemaApiError, SgApiError, THUMBNAIL_PENDING_PATH, TIME_UNITS, TIME_UNIT_LABELS, TREE_STATUS_FIELDS, UNRESOLVED_PATH_LABEL, USER_PICKER_FIELDS, VALUE_SHAPE, addListValues, appendAt, applyPreset, arrangeColumns, asCollapseState, asFilterGroup, base64ToBytes, batchResults, breadcrumb, bytesToBase64, canLoadNext, cellValue, clearableForField, collapseAll, collapseStateFrom, collapsedKeys, collectionBottom, collectionView, colorToHex, columnPaths, columnsStorageKey, condition, conditionArity, conditionList, conditionParts, conditionValues, contextFromClient, countActiveConditions, countConditions, countLine, createEntitySearch, createEntitySource, createProxyHandler, createQueryCache, createSchemaProxyHandler, createSchemaService, createSessionTokenAuth, createSgContext, createSortable, createSortableController, createStatusService, createTree, currentPlatform, currentType, dataTypeLabel, dataTypeOptions, defaultCondition, defaultValueFor, deriveFieldOptions, describeCondition, describeEntityCard, describePaging, displayNameOf, editorKindFor, editorNeedsContext, editorPlacementFor, eligibleProjects, emptyFilter, emptyValueFor, entityCardFields, entityCardSlot, entityDetailUrl, entityKey, entityTypeOptions, errorText, eventLogFilters, expandAll, extendByStep, extendRange, facetCounts, facetLists, facetPresets, facetScopes, facetShape, facetValues, facetValuesFromGroups, fieldFromRaw, fieldOperators, fieldPathOf, fieldSchemaOverride, fieldText, fileHref, fileNameFromUrl, filterEntityTypes, filterableFields, findCondition, findFacet, firstEnabledIndex, fitChips, flattenRow, focusChip, foregroundFor, formatCurrency, formatDate, formatDateTime, formatDuration, formatFloat, formatNumberInput, formatPercent, formatTimecode, friendlyFieldPath, fromApiDateTime, fromSortString, fromWire, gestureOf, group, groupKeyText, groupRows, groupRowsKeyed, hasFailedPage, hasMorePage, hasNonAscii, hierarchyEntity, hierarchyLoader, hierarchySearcher, hydrate, iconNameFor, idsForRefs, imageState, initialsOf, intersectStatuses, isBareRef, isBlankCondition, isCollapsed, isDataType, isEditableType, isEligibleProject, isEmptyFilter, isEmptyValue, isFilterable, isGroupingRefusal, isHiddenPath, isLinkType, isNativeStatus, isNumericType, isOperator, isParseError, isPinned, isProxyMethod, isSchemaProxyMethod, isSortable, isTemporalType, isValidListValue, isoDay, isoDayParts, listStatus, loadEntityCard, loadsOnArrowDown, markOverflow, matchRuns, matchesEveryWord, matchingOffer, measureSortable, mergeFilters, moveAt, moveFieldPath, moveListValue, nameColorIndex, nameHue, nameSearchFilter, nativeStatus, nextEnabledIndex, nodeAt, normalizeEventLogEntry, normalizeField, normalizeFields, normalizeHierarchyNode, normalizeListValues, normalizeSiteUrl, numberDigits, numberDraft, numberSteps, numberWire, operatorLabel, operatorMenu, operatorsFor, overflowEdges, parseBgColor, parseColorInput, parseColumnChoice, parseDurationInput, parseFloatInput, parseInteger, parseNumberInput, parseTextInput, parseTimecodeInput, parseUrlInput, pathLabel, pathOf, pathRefs, pathTypes, pickerKeyIntent, placeholderName, playSortableFlip, pollAppSession, predictFieldName, preferencesOf, prependRecent, presetById, presetIdOf, presetsFor, pressGate, projectOfPath, projectPickerFilters, pruneFilterToFields, queryPlan, reachedEnd, referencedPaths, refsForIds, relativeFrom, relativeLuminance, relativeOperator, relativeValue, relativeWindow, removeAt, renderKindFor, repeatedLabels, replaceAt, replaceListValue, requestAppSession, requestGate, resolveColumnChoice, resolveColumns, resolveFieldPathOptions, resolveRowFields, resolveTreeFields, rgbToCss, rowCode, rowFields, rowIdOf, rowIsDisabled, rowKey, rowSecondary, rowSubLabel, rowThumbnail, sameCollapse, sameColumnPaths, sameFilters, sameIds, sameRefs, sameSort, scopeToProject, scrollHighlightedIntoView, searchFieldOptions, searchFieldPathOptions, searchKeyIntent, searchTypeMap, searchView, searchWords, secondaryType, selectableRefs, selectionKeyIntent, selectionState, serializeColumnChoice, serializeSort, setFacet, setFacetPreset, setRefs, settleStep, shouldLoadNext, sortableAnnouncements, sortableDropIndex, sortableFields, sortableScrollStep, sortableStride, sourceModeFor, splitListValues, spriteStyle, stateLine, statusFieldFor, statusFieldNameFor, statusGlyph, statusLabel, statusPaint, statusTableOptions, stepNumber, stockIconSource, storedNumber, subLabelType, summariseSelection, supportsEmpty, supportsOperator, syncListRows, thumbnailField, timeUnitField, timeUnitLabel, timeZoneName, toApi3Hash, toApiDate, toApiDateTime, toApiFloat, toColumn, toFilterArray, toRef, toSchemaProperties, toSearchHit, toSortKeys, toSortSpecs, toSortString, toWireGroup, toggleCollapsed, toggleFieldPath, toggleId, toggleRef, toggleRow, traversalTargets, undeclaredField, unformatNumberInput, unreadPaths, urlLink, usableStatuses, userPickerFilters, userPickerSearchFields, userPickerSubLabel, userPickerTypes, userSearchFields, validateCondition, valueArity, valueEditorFor, walk, watchHighlight, watchOverflow, withAddedListValue, withListValue, withRelativeWindow, withSelectedPinned, withoutListValue, withoutPaths };
|
package/dist/mock.d.mts
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as BatchRequest, B as HierarchyPath, I as EventLogOptions, J as SearchResult, L as EventLogResult, N as EntityRow, P as EntityTypeInfo, Q as SummarizeResult, R as FollowingOptions, Rt as StatusRecord, W as ReadOptions, X as SgClient, Z as SummarizeOptions, _ as ReviveFieldResult, at as ThreadRow, b as SchemaClient, bt as TextSearchFilter, cn as FieldSchema, f as CreateFieldInput, j as BatchResult, ln as RawFieldSchema, m as FieldReadResult, mt as EntityRef, ot as UploadFile, p as CreatedField, q as SearchOptions, rt as TextSearchRow, st as UploadResult, x as SchemaProperties, z as HierarchyNode } from "./proxy-handler-C6XB6gss.mjs";
|
|
2
|
+
//#region src/schema-write-mock.d.ts
|
|
3
|
+
export interface MockSchemaFailure {
|
|
4
|
+
/** HTTP status. Default 500. */
|
|
5
|
+
status?: number;
|
|
6
|
+
/** `errors[0].title`. */
|
|
7
|
+
message?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MockSchemaClientOptions {
|
|
10
|
+
/** Where the fields this client did not create are read from. Without one, only its own fields exist. */
|
|
11
|
+
client?: Pick<SgClient, 'fields'>;
|
|
12
|
+
/** Arm a failure for the very first call. */
|
|
13
|
+
failNext?: MockSchemaFailure | null;
|
|
14
|
+
}
|
|
15
|
+
export declare class MockSchemaClient implements SchemaClient {
|
|
16
|
+
private readonly base;
|
|
17
|
+
/** Fields this client created or wrote, by `Type.field`. */
|
|
18
|
+
private readonly live;
|
|
19
|
+
/** Retired fields. The name stays taken and no read lists it (040_field_revive). */
|
|
20
|
+
private readonly retired;
|
|
21
|
+
/** Writes made at a project's scope, by `Type.field@project`. */
|
|
22
|
+
private readonly scoped;
|
|
23
|
+
private pendingFailure;
|
|
24
|
+
constructor(options?: MockSchemaClientOptions);
|
|
25
|
+
/** Make the next call reject with a `SchemaApiError`. Pass `null` to disarm. */
|
|
26
|
+
failNext(failure?: MockSchemaFailure | null): void;
|
|
27
|
+
private gate;
|
|
28
|
+
/** The base client's fields of a type; an unknown type is its 404. */
|
|
29
|
+
private baseFields;
|
|
30
|
+
/** Every live record of a type at a scope, this client's writes over the base client's fields. */
|
|
31
|
+
private records;
|
|
32
|
+
readField(entityType: string, field: string, projectId?: number): Promise<FieldReadResult>;
|
|
33
|
+
readRawFields(entityType: string, projectId?: number): Promise<Record<string, RawFieldSchema>>;
|
|
34
|
+
createField(entityType: string, input: CreateFieldInput): Promise<CreatedField>;
|
|
35
|
+
updateField(entityType: string, field: string, properties: SchemaProperties, projectId?: number): Promise<RawFieldSchema | null>;
|
|
36
|
+
retireField(entityType: string, field: string): Promise<void>;
|
|
37
|
+
reviveField(entityType: string, field: string): Promise<ReviveFieldResult>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
2
40
|
//#region src/mock.d.ts
|
|
3
41
|
/** What the next call should throw instead of answering. */
|
|
4
42
|
export interface MockFailure {
|