sg-widgets-core 0.2.0 → 0.3.1

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/mock.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as UploadFile, At as TextSearchFilter, D as TextSearchRow, H as StatusRecord, S as SummarizeResult, _ as SearchOptions, a as EntityTypeInfo, b as SgClient, c as EventLogResult, d as HierarchyPath, ft as FieldSchema, i as EntityRow, j as UploadResult, k as ThreadRow, l as FollowingOptions, n as BatchResult, s as EventLogOptions, t as BatchRequest, u as HierarchyNode, v as SearchResult, wt as EntityRef, x as SummarizeOptions } from "./client-B2PCySg9.mjs";
1
+ import { A as ThreadRow, C as SummarizeResult, M as UploadResult, O as TextSearchRow, S as SummarizeOptions, Tt as EntityRef, U as StatusRecord, a as EntityTypeInfo, c as EventLogResult, d as HierarchyPath, h as ReadOptions, i as EntityRow, j as UploadFile, jt as TextSearchFilter, l as FollowingOptions, n as BatchResult, pt as FieldSchema, s as EventLogOptions, t as BatchRequest, u as HierarchyNode, v as SearchOptions, x as SgClient, y as SearchResult } from "./client-CP9sWEVZ.mjs";
2
2
  //#region src/mock.d.ts
3
3
  /** What the next call should throw instead of answering. */
4
4
  export interface MockFailure {
@@ -38,6 +38,10 @@ export declare class MockClient implements SgClient {
38
38
  private readonly retired;
39
39
  /** Rows a batch created with no `project`: no read reaches them, a delete does (report 001). */
40
40
  private readonly unreadable;
41
+ /** What a Task delete did to other rows, by `Task:id`, for its revive to undo (089_task_delete_side_effects). */
42
+ private readonly cascades;
43
+ /** The highest id handed out per type, so an erased row's id is never reused. */
44
+ private readonly issued;
41
45
  private deletes;
42
46
  constructor(options?: MockClientOptions);
43
47
  /**
@@ -53,6 +57,7 @@ export declare class MockClient implements SgClient {
53
57
  fields(entityType: string, projectId?: number): Promise<Record<string, FieldSchema>>;
54
58
  fieldWithProject(entityType: string, field: string, projectId: number): Promise<FieldSchema>;
55
59
  search(entityType: string, options: SearchOptions): Promise<SearchResult>;
60
+ read(entityType: string, id: number, options?: ReadOptions): Promise<EntityRow>;
56
61
  textSearch(text: string, entityTypes: Record<string, TextSearchFilter>, page?: {
57
62
  size?: number;
58
63
  number?: number;
@@ -118,13 +123,50 @@ export declare class MockClient implements SgClient {
118
123
  private createRow;
119
124
  /**
120
125
  * Retire one row: reads skip it and a second delete is 404 (delete_entity_type_id).
121
- * The mock retires only the row; what a delete does to rows that link to it
122
- * (probe 060, 089_task_delete_side_effects) is not modelled.
126
+ * A Task takes its TaskDependency rows with it and leaves `Version.sg_task` and
127
+ * `PublishedFile.task` null until its revive (089_task_delete_side_effects), alone or
128
+ * in a batch (103_batch_delete_revive). A TaskTemplate retires its tasks
129
+ * (entity_types/TaskTemplate). What a Shot delete does to its Versions (probe 060)
130
+ * is not modelled.
123
131
  */
124
132
  delete(entityType: string, id: number): Promise<void>;
125
133
  private deleteRow;
126
- /** Bring a retired row back with its values; `false` for a row that is already live (post_entity_type_id). */
134
+ /**
135
+ * Bring a retired row back with its values; `false` for a row that is already live
136
+ * (post_entity_type_id). A Task gets back what its delete took (089_task_delete_side_effects).
137
+ * A TaskDependency whose pair is linked again refuses, the pair being a unique index
138
+ * (095_dependency_remove_undo). A TaskTemplate's tasks stay retired: unmeasured.
139
+ */
127
140
  revive(entityType: string, id: number): Promise<boolean>;
141
+ private retire;
142
+ private unretire;
143
+ /** Remove a row for good: no read reaches it and no revive brings it back. */
144
+ private erase;
145
+ private live;
146
+ /** The live TaskDependency rows with this Task at either end. */
147
+ private edgesOf;
148
+ /** Whether a live row already links this row's pair. */
149
+ private pairTaken;
150
+ /** Whether `from` depends on `target`, directly or through other Tasks. */
151
+ private dependsOn;
152
+ /**
153
+ * The checks a TaskDependency create makes: one of four types, one row per pair, and
154
+ * no loop of any length (085_task_dependency_types, 107_dependency_three_task_loop).
155
+ */
156
+ private checkEdge;
157
+ /**
158
+ * A write to `upstream_tasks` or `downstream_tasks`: a new neighbour gets a row of the
159
+ * default type and no offset, a dropped one's row is erased, not retired
160
+ * (086_batch_tasks_with_dependencies, 095_dependency_remove_undo).
161
+ */
162
+ private writeEdges;
163
+ /** Where the written field is one side of a two-sided link, make the other side agree. */
164
+ private mirror;
165
+ /**
166
+ * What the server derives from other rows: a Task's two edge lists from the
167
+ * TaskDependency rows, their ids and name, and a template's task count, a string.
168
+ */
169
+ private derive;
128
170
  /**
129
171
  * Apply the requests in order, and undo all of them when one fails (recipes/002).
130
172
  * A create or update row carries the record under `data`; a delete row is flat.
@@ -147,6 +189,13 @@ export declare class MockClient implements SgClient {
147
189
  * missing key (field_types/entity).
148
190
  */
149
191
  private checkLink;
192
+ /**
193
+ * Values the server checks beyond their shape. A status code must be in the site-wide
194
+ * `valid_values`, hidden ones included, and a create or any batch request wraps the
195
+ * refusal (field_types/status_list, recipes/002, 094_permission_preflight). A
196
+ * TaskTemplate's `entity_type` must name a type (entity_types/TaskTemplate).
197
+ */
198
+ private checkValue;
150
199
  /** The next free id of a type, which is what a create takes. */
151
200
  private nextId;
152
201
  /** The reverse view of a link the server fills in: a Reply lands in `Note.replies`. */