exponential-sdk 1.25.0 → 1.26.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/README.md CHANGED
@@ -187,6 +187,67 @@ const { draftCount, discardedWithoutEvidence } =
187
187
 
188
188
  ---
189
189
 
190
+ ### Databases
191
+
192
+ Typed tables inside pages (ADR-0078). A database is a block in a page's body,
193
+ owned by that page; each row is a page of its own (body, comments, history,
194
+ URL) hidden from the Pages list. **Writes are typed**: every value is checked
195
+ against its property's type and a bad one is refused naming the property
196
+ (`error.data.property`). Reading the holding page with `pages.get` shows the
197
+ table; this API is for the writes and for reading rows as data.
198
+
199
+ ```typescript
200
+ // Create a database on a page, then place its block by appending the marker
201
+ const page = await client.pages.get("page-123");
202
+ const metrics = await client.databases.create({ pageId: page.id, name: "Metrics" });
203
+ await client.pages.update({
204
+ id: page.id,
205
+ body: `${page.body}\n\n${metrics.marker}`,
206
+ baseVersion: page.docVersion,
207
+ note: "Add the Metrics database",
208
+ });
209
+
210
+ // Properties: title exists from creation; add the rest
211
+ await client.databases.addProperty({
212
+ id: metrics.id,
213
+ name: "Status",
214
+ type: "select",
215
+ options: [{ name: "Not measured" }, { name: "Instrumenting" }, { name: "Tracked" }],
216
+ });
217
+ await client.databases.addProperty({ id: metrics.id, name: "Owner", type: "person" });
218
+
219
+ // Rows: values by property name (or id); a select by option name
220
+ const row = await client.databases.createRow(
221
+ metrics.id,
222
+ { Name: "Alert latency", Status: "Tracked", Owner: "user-123" },
223
+ { note: "Imported from the CLEAR page" },
224
+ );
225
+ await client.databases.updateRow(row.id, { Status: "Instrumenting" }, { note: "Re-measuring" });
226
+
227
+ // Read rows through the saved view, or through a view of your own
228
+ const { rows, nextCursor, columns } = await client.databases.listRows(metrics.id, {
229
+ view: { filters: [{ propertyId: "Status", op: "eq", value: "Tracked" }], hiddenPropertyIds: [], propertyOrder: [] },
230
+ });
231
+ ```
232
+
233
+ #### Property types
234
+
235
+ `title` · `text` · `number` · `select` · `multiSelect` · `date` · `checkbox` ·
236
+ `url` · `person` · `relation` (V3), plus read-only `createdTime` ·
237
+ `lastEditedTime` · `createdBy`. Property and option ids are stable: renaming
238
+ never rewrites a row. Stored values: `select` holds the option **id**,
239
+ `multiSelect` and `person` lists, `date` an ISO 8601 string.
240
+
241
+ #### Lifecycle
242
+
243
+ Removing the block from the page **detaches** the database (`detachedAt`);
244
+ its rows stay until `databases.delete`, the page's deletion, or the daily
245
+ purge 30 days later. Writing the marker back re-attaches it. Rows follow the
246
+ holding page for access, placement and publishing — `pages.move`,
247
+ `pages.publish` and sharing on a row page are refused.
248
+
249
+ ---
250
+
190
251
  ### Configuration
191
252
 
192
253
  Credentials are stored persistently using the OS keychain via [`conf`](https://github.com/sindresorhus/conf).
package/dist/index.d.ts CHANGED
@@ -47,6 +47,20 @@ type ProjectUpdateApiInput = {
47
47
  startDate?: Date | null;
48
48
  endDate?: Date | null;
49
49
  };
50
+ /** `database.*` saved view as the server validates it (ADR-0078). */
51
+ type DatabaseViewInput = {
52
+ sort?: {
53
+ propertyId: string;
54
+ direction: 'asc' | 'desc';
55
+ };
56
+ filters: {
57
+ propertyId: string;
58
+ op: string;
59
+ value?: unknown;
60
+ }[];
61
+ hiddenPropertyIds: string[];
62
+ propertyOrder: string[];
63
+ };
50
64
  type ActionStatus$1 = 'ACTIVE' | 'COMPLETED' | 'CANCELLED' | 'DELETED' | 'DRAFT';
51
65
  type ActionKanbanStatus = 'BACKLOG' | 'TODO' | 'IN_PROGRESS' | 'IN_REVIEW' | 'DONE' | 'CANCELLED';
52
66
  type ActionPriority = 'Quick' | 'Scheduled' | '1st Priority' | '2nd Priority' | '3rd Priority' | '4th Priority' | '5th Priority' | 'Errand' | 'Remember' | 'Watch' | 'Someday Maybe';
@@ -979,6 +993,117 @@ interface TrpcClient {
979
993
  }) => Promise<unknown>;
980
994
  };
981
995
  };
996
+ database: {
997
+ create: {
998
+ mutate: (input: {
999
+ pageId: string;
1000
+ name: string;
1001
+ }) => Promise<unknown>;
1002
+ };
1003
+ get: {
1004
+ query: (input: {
1005
+ id: string;
1006
+ }) => Promise<unknown>;
1007
+ };
1008
+ list: {
1009
+ query: (input: {
1010
+ pageId: string;
1011
+ }) => Promise<unknown[]>;
1012
+ };
1013
+ update: {
1014
+ mutate: (input: {
1015
+ id: string;
1016
+ name?: string;
1017
+ view?: DatabaseViewInput;
1018
+ }) => Promise<unknown>;
1019
+ };
1020
+ delete: {
1021
+ mutate: (input: {
1022
+ id: string;
1023
+ }) => Promise<unknown>;
1024
+ };
1025
+ addProperty: {
1026
+ mutate: (input: {
1027
+ id: string;
1028
+ name: string;
1029
+ type: string;
1030
+ description?: string;
1031
+ options?: {
1032
+ id?: string;
1033
+ name: string;
1034
+ color?: string;
1035
+ }[];
1036
+ }) => Promise<unknown>;
1037
+ };
1038
+ updateProperty: {
1039
+ mutate: (input: {
1040
+ id: string;
1041
+ propertyId: string;
1042
+ name?: string;
1043
+ description?: string | null;
1044
+ type?: string;
1045
+ options?: {
1046
+ id?: string;
1047
+ name: string;
1048
+ color?: string;
1049
+ }[];
1050
+ }) => Promise<unknown>;
1051
+ };
1052
+ removeProperty: {
1053
+ mutate: (input: {
1054
+ id: string;
1055
+ propertyId: string;
1056
+ }) => Promise<unknown>;
1057
+ };
1058
+ reorderProperties: {
1059
+ mutate: (input: {
1060
+ id: string;
1061
+ propertyIds: string[];
1062
+ }) => Promise<unknown>;
1063
+ };
1064
+ listRows: {
1065
+ query: (input: {
1066
+ id: string;
1067
+ view?: DatabaseViewInput;
1068
+ limit?: number;
1069
+ cursor?: string;
1070
+ }) => Promise<unknown>;
1071
+ };
1072
+ createRow: {
1073
+ mutate: (input: {
1074
+ id: string;
1075
+ values?: Record<string, unknown>;
1076
+ note?: string;
1077
+ }) => Promise<unknown>;
1078
+ };
1079
+ updateRow: {
1080
+ mutate: (input: {
1081
+ rowId: string;
1082
+ values: Record<string, unknown>;
1083
+ note?: string;
1084
+ }) => Promise<unknown>;
1085
+ };
1086
+ deleteRow: {
1087
+ mutate: (input: {
1088
+ rowId: string;
1089
+ }) => Promise<unknown>;
1090
+ };
1091
+ previewCsv: {
1092
+ mutate: (input: {
1093
+ id: string;
1094
+ csv: string;
1095
+ mapping?: Record<string, unknown>;
1096
+ }) => Promise<unknown>;
1097
+ };
1098
+ commitCsv: {
1099
+ mutate: (input: {
1100
+ id: string;
1101
+ csv: string;
1102
+ mapping: Record<string, unknown>;
1103
+ note?: string;
1104
+ }) => Promise<unknown>;
1105
+ };
1106
+ };
982
1107
  resource: {
983
1108
  list: {
984
1109
  query: (input: {
@@ -4380,6 +4505,331 @@ declare class PagesApi {
4380
4505
  }>;
4381
4506
  }
4382
4507
 
4508
+ type PropertyType = 'title' | 'text' | 'number' | 'select' | 'multiSelect' | 'date' | 'checkbox' | 'url' | 'person' | 'relation' | 'createdTime' | 'lastEditedTime' | 'createdBy';
4509
+ /** Select-option colours are palette names, never hex. */
4510
+ type PillColor = 'gray' | 'red' | 'pink' | 'grape' | 'violet' | 'indigo' | 'blue' | 'cyan' | 'teal' | 'green' | 'lime' | 'yellow' | 'orange';
4511
+ type RelationTargetKind = 'ROW' | 'TICKET' | 'PROJECT' | 'FEATURE' | 'GOAL' | 'KEY_RESULT' | 'PAGE';
4512
+ interface SelectOption {
4513
+ /** Stable: a renamed option keeps its id, so rows never need rewriting. */
4514
+ id: string;
4515
+ name: string;
4516
+ color: PillColor;
4517
+ }
4518
+ interface RelationConfig {
4519
+ targetKind: RelationTargetKind;
4520
+ /** The other database, for `ROW` targets. */
4521
+ targetDatabaseId?: string;
4522
+ /** Set on the auto-created reverse column of a two-way database relation. */
4523
+ inverseOf?: {
4524
+ databaseId: string;
4525
+ propertyId: string;
4526
+ };
4527
+ many: boolean;
4528
+ }
4529
+ /** One column of a database. Ids are stable; names are free to change. */
4530
+ interface PropertyDef {
4531
+ id: string;
4532
+ name: string;
4533
+ type: PropertyType;
4534
+ description?: string;
4535
+ /** `select` / `multiSelect` only. */
4536
+ options?: SelectOption[];
4537
+ /** `relation` only (written from V3). */
4538
+ relation?: RelationConfig;
4539
+ }
4540
+ type FilterOp = 'eq' | 'neq' | 'contains' | 'isEmpty' | 'isNotEmpty' | 'gt' | 'lt' | 'before' | 'after' | 'anyOf';
4541
+ interface DatabaseFilter {
4542
+ propertyId: string;
4543
+ op: FilterOp;
4544
+ /**
4545
+ * Checked against the property like a written value: a select may be
4546
+ * named by option name or id; `anyOf` takes a list (or a comma-separated
4547
+ * string); `gt`/`lt` a number; `before`/`after` an ISO date.
4548
+ */
4549
+ value?: unknown;
4550
+ }
4551
+ /** The one table view saved on the block: sort, filters, hidden columns, column order. */
4552
+ interface DatabaseView {
4553
+ sort?: {
4554
+ propertyId: string;
4555
+ direction: 'asc' | 'desc';
4556
+ };
4557
+ filters: DatabaseFilter[];
4558
+ hiddenPropertyIds: string[];
4559
+ /** Column order by property id; properties missing here follow in definition order. */
4560
+ propertyOrder: string[];
4561
+ }
4562
+ interface Database {
4563
+ id: string;
4564
+ /** The page whose body holds the block, and which decides access to every row. */
4565
+ pageId: string;
4566
+ workspaceId: string;
4567
+ name: string;
4568
+ properties: PropertyDef[];
4569
+ view: DatabaseView;
4570
+ /** The id of the `title` property; its value is each row page's title. */
4571
+ titlePropertyId: string;
4572
+ /**
4573
+ * Set while the block is out of the page body. A detached database keeps
4574
+ * its rows until it is deleted, its page is deleted, or the daily purge
4575
+ * takes it after 30 days; writing its marker back into the body re-attaches it.
4576
+ */
4577
+ detachedAt: Date | null;
4578
+ createdById: string;
4579
+ createdAt: Date;
4580
+ updatedAt: Date;
4581
+ page: {
4582
+ id: string;
4583
+ title: string;
4584
+ };
4585
+ /**
4586
+ * The marker line that stands for the block in the page's Markdown body:
4587
+ * `<!-- database:<id> -->`. Append it to the body (through `pages.update`)
4588
+ * to place a database you created; reads expand it into the table.
4589
+ */
4590
+ marker?: string;
4591
+ /** Present on `get` and `list`. */
4592
+ rowCount?: number;
4593
+ }
4594
+ /**
4595
+ * A stored cell value: `title`/`text`/`url` a string, `number` a number,
4596
+ * `select` an option id, `multiSelect` option ids, `date` an ISO 8601 string,
4597
+ * `checkbox` a boolean, `person` user ids.
4598
+ */
4599
+ type PropertyValue = string | number | boolean | string[];
4600
+ /** A row: a page of the database with its typed values keyed by property id. */
4601
+ interface DatabaseRow {
4602
+ id: string;
4603
+ /** The title property's value — the row page's title. */
4604
+ title: string;
4605
+ databaseId: string | null;
4606
+ /** Values keyed by **property id** (not name); the title is not among them. */
4607
+ values: Record<string, PropertyValue | null>;
4608
+ createdById: string;
4609
+ createdAt: Date;
4610
+ updatedAt: Date;
4611
+ }
4612
+ interface DatabaseRowsPage {
4613
+ rows: DatabaseRow[];
4614
+ /** Pass back as `cursor` for the next page; null on the last one. */
4615
+ nextCursor: string | null;
4616
+ /** The visible property ids in view order. Rows still carry hidden values. */
4617
+ columns: string[];
4618
+ }
4619
+ /**
4620
+ * Why a write was refused: the property it names and the reason, in plain
4621
+ * words. Arrives as `error.data.property` on a `BAD_REQUEST`.
4622
+ */
4623
+ interface PropertyRejection {
4624
+ /** Null when the write named a property that does not exist. */
4625
+ propertyId: string | null;
4626
+ propertyName: string;
4627
+ reason: string;
4628
+ }
4629
+ interface DeletedDatabase {
4630
+ id: string;
4631
+ /** Rows deleted with it. */
4632
+ rowCount: number;
4633
+ }
4634
+ /** Where one CSV column lands: skipped, an existing property (by id), or a new property. */
4635
+ type CsvColumnTarget = {
4636
+ kind: 'skip';
4637
+ } | {
4638
+ kind: 'property';
4639
+ propertyId: string;
4640
+ } | {
4641
+ kind: 'new';
4642
+ name: string;
4643
+ type: PropertyType;
4644
+ };
4645
+ /** Column header (as in the file) → target. Headers left out are skipped. */
4646
+ type CsvMapping = Record<string, CsvColumnTarget>;
4647
+ /** A cell the property's type refused: where it sits and why. */
4648
+ interface CsvCellError {
4649
+ header: string;
4650
+ propertyName: string;
4651
+ reason: string;
4652
+ }
4653
+ /** One file row, typed. `values` are keyed by property id, or `new:<name>` for a column not created yet. */
4654
+ interface CsvPreviewRow {
4655
+ /** 0-based among the data rows (the header line is not counted). */
4656
+ index: number;
4657
+ title: string | undefined;
4658
+ values: Record<string, PropertyValue | null>;
4659
+ /** Empty when the row would be created. */
4660
+ errors: CsvCellError[];
4661
+ }
4662
+ interface CsvPreviewColumn {
4663
+ header: string;
4664
+ target: CsvColumnTarget;
4665
+ propertyName: string | null;
4666
+ type: PropertyType | null;
4667
+ }
4668
+ interface CsvPreview {
4669
+ headers: string[];
4670
+ /** The mapping used — the one passed, or the suggestion by header name. Pass it back to `commitCsv`. */
4671
+ mapping: CsvMapping;
4672
+ columns: CsvPreviewColumn[];
4673
+ rows: CsvPreviewRow[];
4674
+ total: number;
4675
+ /** Rows with no cell error — what a commit creates. */
4676
+ importable: number;
4677
+ /**
4678
+ * Select / multi-select option names the file uses that the property
4679
+ * lacks, by column definition id (`new:<name>` for a new column). The
4680
+ * commit creates them; cells naming them hold the name until then.
4681
+ */
4682
+ newOptions: Record<string, string[]>;
4683
+ }
4684
+ interface CsvCommitResult {
4685
+ /** The new row ids, in file order. */
4686
+ created: string[];
4687
+ /** Rows left uncreated, each with the cells that did not fit. */
4688
+ skipped: {
4689
+ index: number;
4690
+ errors: CsvCellError[];
4691
+ }[];
4692
+ /** Properties the import added (the `new` columns), with their minted ids. */
4693
+ properties: PropertyDef[];
4694
+ total: number;
4695
+ }
4696
+
4697
+ interface DatabaseCreateInput {
4698
+ /** The page whose body will hold the block; you need edit access to it. */
4699
+ pageId: string;
4700
+ name: string;
4701
+ }
4702
+ interface DatabaseUpdateInput {
4703
+ id: string;
4704
+ name?: string;
4705
+ /** Replaces the saved view whole — send the full view, not a patch. */
4706
+ view?: DatabaseView;
4707
+ }
4708
+ /** A select option to add or keep. Pass `id` to rename or recolour an existing one. */
4709
+ interface SelectOptionInput {
4710
+ id?: string;
4711
+ name: string;
4712
+ /** Defaults to the next palette colour. */
4713
+ color?: PillColor;
4714
+ }
4715
+ /** Types a property can be added as or changed to: everything but `title` (one per database) and `relation` (V3). */
4716
+ type AddablePropertyType = Exclude<PropertyType, 'title' | 'relation'>;
4717
+ interface PropertyAddInput {
4718
+ /** The database. */
4719
+ id: string;
4720
+ name: string;
4721
+ type: AddablePropertyType;
4722
+ description?: string;
4723
+ /** `select` / `multiSelect` only. */
4724
+ options?: SelectOptionInput[];
4725
+ }
4726
+ interface PropertyUpdateInput {
4727
+ /** The database. */
4728
+ id: string;
4729
+ /** The property, by id or by (unique, case-insensitive) name. */
4730
+ propertyId: string;
4731
+ name?: string;
4732
+ /** Null clears it. */
4733
+ description?: string | null;
4734
+ type?: AddablePropertyType;
4735
+ /**
4736
+ * The full option list: options left out are removed (rows keep the old
4737
+ * id, which then reads as its raw text). Options with an `id` keep it.
4738
+ */
4739
+ options?: SelectOptionInput[];
4740
+ }
4741
+ interface RowListOptions {
4742
+ /**
4743
+ * A whole view to read through instead of the saved one — for example a
4744
+ * single filter. Every property it names must exist.
4745
+ */
4746
+ view?: DatabaseView;
4747
+ /** Rows per page (1–200, server default 50). */
4748
+ limit?: number;
4749
+ /** `nextCursor` from the previous page. */
4750
+ cursor?: string;
4751
+ }
4752
+ /**
4753
+ * Cell values to write, keyed by property **id or name** (the CLI's
4754
+ * `--set Status=Tracked` is a name). Each is checked against the property's
4755
+ * type: a select takes an option name or id, a multiSelect a list (or a
4756
+ * comma-separated string), a date an ISO string, a checkbox a boolean or
4757
+ * "yes"/"no", a person a user id or list of them. `null` clears a cell.
4758
+ * The title property's value becomes the row page's title.
4759
+ */
4760
+ type RowValuesInput = Record<string, unknown>;
4761
+ interface RowWriteOptions {
4762
+ /** Why — recorded on the row page's revision. Always send one from an agent. */
4763
+ note?: string;
4764
+ }
4765
+ interface DatabasePropertyResult {
4766
+ property: PropertyDef;
4767
+ database: Database;
4768
+ }
4769
+ /**
4770
+ * Databases (ADR-0078): typed tables inside pages. The database is a block in
4771
+ * a page's body, owned by that page; each row is a page of its own, hidden
4772
+ * from the Pages list and reached through the database.
4773
+ *
4774
+ * **Writes are typed.** Values are checked against the property's type and a
4775
+ * bad one is refused naming the property (`error.data.property`). Reads of
4776
+ * the holding page (`pages.get`) show the table; this API is for the writes
4777
+ * and for reading rows as data. Values in responses are keyed by property id;
4778
+ * writes accept names too.
4779
+ *
4780
+ * Not a work tracker: a database may point at a Ticket, Project, Feature,
4781
+ * Goal, Key result or Page (relations, V3) but never stands in for one.
4782
+ */
4783
+ declare class DatabasesApi {
4784
+ private client;
4785
+ constructor(client: TrpcClient);
4786
+ /**
4787
+ * Create a database on a page with a title property. Then put its
4788
+ * `marker` into the page body (`pages.update` with the body plus the
4789
+ * marker on its own line) so the page shows it.
4790
+ */
4791
+ create(input: DatabaseCreateInput): Promise<Database>;
4792
+ /** One database: definition, view, row count and holding page. */
4793
+ get(id: string): Promise<Database>;
4794
+ /** The databases a page holds, detached ones included, with row counts. */
4795
+ list(pageId: string): Promise<Database[]>;
4796
+ /** Rename, or replace the saved view whole. */
4797
+ update(input: DatabaseUpdateInput): Promise<Database>;
4798
+ /** Delete the database and every row with it. Removing the block from the page only detaches; this is the delete. */
4799
+ delete(id: string): Promise<DeletedDatabase>;
4800
+ /** Add a property. New select options get ids and palette colours; the column goes last in the view. */
4801
+ addProperty(input: PropertyAddInput): Promise<DatabasePropertyResult>;
4802
+ /** Rename, describe, retype or re-option a property. Ids stay; no row is rewritten. */
4803
+ updateProperty(input: PropertyUpdateInput): Promise<DatabasePropertyResult>;
4804
+ /** Remove a property (by id or name) from the schema and view. Never the title. */
4805
+ removeProperty(databaseId: string, propertyId: string): Promise<Database>;
4806
+ /** Set the column order; `propertyIds` must name every property exactly once. */
4807
+ reorderProperties(databaseId: string, propertyIds: string[]): Promise<Database>;
4808
+ /** The rows through the saved view (or `options.view`), paged by cursor. */
4809
+ listRows(databaseId: string, options?: RowListOptions): Promise<DatabaseRowsPage>;
4810
+ /** Add a row with typed values. Placed where the holding page is. */
4811
+ createRow(databaseId: string, values?: RowValuesInput, options?: RowWriteOptions): Promise<DatabaseRow>;
4812
+ /** Write some of a row's values; cells not named are kept, `null` clears one. Records a revision on the row page. */
4813
+ updateRow(rowId: string, values: RowValuesInput, options?: RowWriteOptions): Promise<DatabaseRow>;
4814
+ /** Delete a row — the page and its search chunks. */
4815
+ deleteRow(rowId: string): Promise<{
4816
+ id: string;
4817
+ databaseId: string;
4818
+ }>;
4819
+ /**
4820
+ * Type a CSV against the database before anything is created: columns
4821
+ * resolved through `mapping` (or suggested by header name), every row
4822
+ * checked, each cell that does not fit named. Writes nothing.
4823
+ */
4824
+ previewCsv(databaseId: string, csv: string, mapping?: CsvMapping): Promise<CsvPreview>;
4825
+ /**
4826
+ * Import a CSV: new columns become properties, then every row with no
4827
+ * cell error becomes a row with a `create` revision; the rest are reported
4828
+ * and left uncreated. Up to 2,000 rows a time.
4829
+ */
4830
+ commitCsv(databaseId: string, csv: string, mapping: CsvMapping, options?: RowWriteOptions): Promise<CsvCommitResult>;
4831
+ }
4832
+
4383
4833
  type ResourceContentType = 'web_page' | 'document' | 'pdf' | 'bookmark' | 'note';
4384
4834
  /** Has the owner consumed this Resource yet? Orthogonal to archiving. */
4385
4835
  type ReadStatus = 'to_read' | 'reading' | 'read';
@@ -5048,6 +5498,8 @@ declare class ExponentialClient {
5048
5498
  areas: AreasApi;
5049
5499
  meetings: MeetingsApi;
5050
5500
  pages: PagesApi;
5501
+ /** Databases — typed tables inside pages (ADR-0078). */
5502
+ databases: DatabasesApi;
5051
5503
  resources: ResourcesApi;
5052
5504
  requirements: RequirementsApi;
5053
5505
  scopes: ScopesApi;
@@ -5062,4 +5514,4 @@ declare class ExponentialClient {
5062
5514
  });
5063
5515
  }
5064
5516
 
5065
- export { type Action, type ActionComment, type ActionCommentAddInput, type ActionCommentUpdateInput, type ActionCreateInput, type ActionOutput, type ActionStatus, type ActionUpdateInput, type ActionUpsertBySourceInput, type ActionUpsertBySourceResult, type ActionsListOutput, type AddInteractionInput, type AgentRunStatus, AgentRunsApi, type AppendEventsResult, type Area, type AreaCreateInput, type AreaListOptions, type ClaimedRun, type CommentAuthor, type Contact, type ContactCreateInput, type ContactInteraction, type ContactListOutput, type ContactUpdateInput, type ContactsListOptions, type ConversationMessage, DEFAULT_GAP_MINUTES, type DayReport, type DayReportActionRow, type DayReportEntry, type DayReportProductRow, type Deal, type DealActivity, type DealCreateInput, type DealMoveInput, type DealUpdateInput, type Decision, type DecisionAdrRef, type DecisionChainRef, type DecisionCreateInput, type DecisionDecider, type DecisionDeciderInput, type DecisionEvidenceTurn, type DecisionFeatureRef, type DecisionLink, type DecisionListOptions, type DecisionListRow, type DecisionMeetingRef, type DecisionOccurrenceRef, type DecisionProductRef, type DecisionProjectRef, type DecisionReviewState, type DecisionSetStatusInput, type DecisionSource, type DecisionStatus, type DecisionTicketRef, type DecisionUpdateInput, type DecisionUserRef, type DraftDecisionsResult, type EnrichContactResult, type Epic, type EpicCreateInput, type EpicListOptions, type EpicPriority, type EpicStatus, type EpicUpdateInput, ExponentialClient, type ExponentialConfig, type Feature, type FeatureComment, type FeatureCommentCreateInput, type FeatureCommentReplyInput, type FeatureCommentThreadInput, type FeatureCommentUpdateInput, type FeatureCreateInput, type FeatureKeyResultLink, type FeatureLinkPageInput, type FeatureListOptions, type FeatureScope, type FeatureScopeStatus, type FeatureStatus, type FeatureUpdateInput, type FinishInput, type FinishResult, type GlobalSearchOptions, type GlobalSearchOutput, type Goal, type GoalChildSummary, type GoalComment, type GoalCommentAddInput, type GoalCommentUpdateInput, type GoalCreateInput, type GoalHealth, type GoalKeyResultSummary, type GoalLifeDomain, type GoalListOptions, type GoalPeriod, type GoalProjectSummary, type GoalSetParentInput, type GoalSetStatusInput, type GoalStats, type GoalStatsOptions, type GoalStatus, type GoalTreeNode, type GoalTreeOptions, type GoalUpdateInput, type GoalUserSummary, type GoalWritableStatus, type HeartbeatResult, type InteractionDirection, type InteractionType, type KanbanStatus, type KeyResult, type KeyResultByObjectiveOptions, type KeyResultCheckIn, type KeyResultCheckInInput, type KeyResultCreateInput, type KeyResultFeatureLink, type KeyResultListOptions, type KeyResultProjectLink, type KeyResultStatus, type KeyResultUnit, type KeyResultUpdateInput, type KnowledgePage, type KnowledgeSearchOptions, type KnowledgeSearchOutput, type KnowledgeSearchResult, type KnowledgeSourceType, type LabelCreateInput, type LabelListOptions, type ListForEntityInput, type Meeting, type MeetingActionSummary, type MeetingCreateInput, type MeetingDecisions, type MeetingListOptions, type MeetingParticipant, type MeetingParticipantInput, type MeetingProjectRef, type MeetingSourceIntegration, type MeetingTypeFilter, type MeetingUpdateInput, type MeetingWorkspaceRef, type ObjectiveWithKeyResults, type Organization, type OrganizationCreateInput, type OrganizationListOutput, type OrganizationSize, type OrganizationsListOptions, type OverdueCohort, type OverdueTriage, type OverdueTriageRow, type PageComment, type PageCommentCreateInput, type PageCommentUpdateInput, type PageCreateInput, type PageDiff, type PageDiffOptions, type PageDiffSide, type PageGetFormat, type PageGetOptions, type PageHistory, type PageHistoryOptions, type PageListOptions, type PageOutlineEntry, type PageRestoreOptions, type PageRevision, type PageRevisionAuthor, type PageRevisionDetail, type PageRevisionKind, type PageSearchOptions, type PageSearchOutput, type PageSearchResult, type PageUpdateInput, type Pipeline, type PipelineStage, type Priority, type Product, type ProductCreateInput, type ProductUpdateInput, type Project, type ProjectDetail, type ProjectKeyResultLink, type ProjectOutput, type ProjectPriority, type ProjectStatus, type ProjectUpdateInput, type ProjectsListOptions, type ProjectsListOutput, ROUND_MINUTES, type ReadStatus, type Requirement, type RequirementCreateInput, type RequirementKind, type RequirementListOptions, type Resource, type ResourceContentType, type ResourceCreateInput, type ResourceListOptions, type ResourceListResult, type ResourceReadState, type ResourceUpdateInput, type RunMessage, type RunnerEvent, type RunnerEventKind, type ScopeCreateInput, type ScopeListOptions, type ScopeUpdateInput, type SearchResult, type SearchResultType, type SearchResultWorkspace, type SetEntityTagsInput, type SetEntityTagsResult, type Tag, type TagEntityType, type TagListResult, type Ticket, type TicketAssignee, type TicketComment, type TicketCommentAddInput, type TicketCommentUpdateInput, type TicketCreateInput, type TicketDependencyEdge, type TicketDetail, type TicketListOptions, type TicketSearchOptions, type TicketStatus, type TicketType, type TicketUpdateInput, TimeApi, type TimeConfirmDayResult, type TimeEntry, type TimeEntrySource, type TimeEntryStatus, type TimeLogBatchResult, type TimeLogInput, type TimeLogOutcome, type TimeLogResult, type TodaysActionRow, type TodaysActions, type TodaysActionsGroup, type UserStory, type UserStoryCreateInput, type UserStoryListOptions, type UserStoryUpdateInput, type WorklogSegment, type Workspace, type WorkspaceMember, type WorkspaceOutput, type WorkspacesListOutput, clearConfig, createConfigStore, getConfigPath, isAuthenticated, isTRPCError, loadConfig, saveConfig, segmentConversation };
5517
+ export { type Action, type ActionComment, type ActionCommentAddInput, type ActionCommentUpdateInput, type ActionCreateInput, type ActionOutput, type ActionStatus, type ActionUpdateInput, type ActionUpsertBySourceInput, type ActionUpsertBySourceResult, type ActionsListOutput, type AddInteractionInput, type AddablePropertyType, type AgentRunStatus, AgentRunsApi, type AppendEventsResult, type Area, type AreaCreateInput, type AreaListOptions, type ClaimedRun, type CommentAuthor, type Contact, type ContactCreateInput, type ContactInteraction, type ContactListOutput, type ContactUpdateInput, type ContactsListOptions, type ConversationMessage, type CsvCellError, type CsvColumnTarget, type CsvCommitResult, type CsvMapping, type CsvPreview, type CsvPreviewColumn, type CsvPreviewRow, DEFAULT_GAP_MINUTES, type Database, type DatabaseCreateInput, type DatabaseFilter, type DatabasePropertyResult, type DatabaseRow, type DatabaseRowsPage, type DatabaseUpdateInput, type DatabaseView, type DayReport, type DayReportActionRow, type DayReportEntry, type DayReportProductRow, type Deal, type DealActivity, type DealCreateInput, type DealMoveInput, type DealUpdateInput, type Decision, type DecisionAdrRef, type DecisionChainRef, type DecisionCreateInput, type DecisionDecider, type DecisionDeciderInput, type DecisionEvidenceTurn, type DecisionFeatureRef, type DecisionLink, type DecisionListOptions, type DecisionListRow, type DecisionMeetingRef, type DecisionOccurrenceRef, type DecisionProductRef, type DecisionProjectRef, type DecisionReviewState, type DecisionSetStatusInput, type DecisionSource, type DecisionStatus, type DecisionTicketRef, type DecisionUpdateInput, type DecisionUserRef, type DeletedDatabase, type DraftDecisionsResult, type EnrichContactResult, type Epic, type EpicCreateInput, type EpicListOptions, type EpicPriority, type EpicStatus, type EpicUpdateInput, ExponentialClient, type ExponentialConfig, type Feature, type FeatureComment, type FeatureCommentCreateInput, type FeatureCommentReplyInput, type FeatureCommentThreadInput, type FeatureCommentUpdateInput, type FeatureCreateInput, type FeatureKeyResultLink, type FeatureLinkPageInput, type FeatureListOptions, type FeatureScope, type FeatureScopeStatus, type FeatureStatus, type FeatureUpdateInput, type FilterOp, type FinishInput, type FinishResult, type GlobalSearchOptions, type GlobalSearchOutput, type Goal, type GoalChildSummary, type GoalComment, type GoalCommentAddInput, type GoalCommentUpdateInput, type GoalCreateInput, type GoalHealth, type GoalKeyResultSummary, type GoalLifeDomain, type GoalListOptions, type GoalPeriod, type GoalProjectSummary, type GoalSetParentInput, type GoalSetStatusInput, type GoalStats, type GoalStatsOptions, type GoalStatus, type GoalTreeNode, type GoalTreeOptions, type GoalUpdateInput, type GoalUserSummary, type GoalWritableStatus, type HeartbeatResult, type InteractionDirection, type InteractionType, type KanbanStatus, type KeyResult, type KeyResultByObjectiveOptions, type KeyResultCheckIn, type KeyResultCheckInInput, type KeyResultCreateInput, type KeyResultFeatureLink, type KeyResultListOptions, type KeyResultProjectLink, type KeyResultStatus, type KeyResultUnit, type KeyResultUpdateInput, type KnowledgePage, type KnowledgeSearchOptions, type KnowledgeSearchOutput, type KnowledgeSearchResult, type KnowledgeSourceType, type LabelCreateInput, type LabelListOptions, type ListForEntityInput, type Meeting, type MeetingActionSummary, type MeetingCreateInput, type MeetingDecisions, type MeetingListOptions, type MeetingParticipant, type MeetingParticipantInput, type MeetingProjectRef, type MeetingSourceIntegration, type MeetingTypeFilter, type MeetingUpdateInput, type MeetingWorkspaceRef, type ObjectiveWithKeyResults, type Organization, type OrganizationCreateInput, type OrganizationListOutput, type OrganizationSize, type OrganizationsListOptions, type OverdueCohort, type OverdueTriage, type OverdueTriageRow, type PageComment, type PageCommentCreateInput, type PageCommentUpdateInput, type PageCreateInput, type PageDiff, type PageDiffOptions, type PageDiffSide, type PageGetFormat, type PageGetOptions, type PageHistory, type PageHistoryOptions, type PageListOptions, type PageOutlineEntry, type PageRestoreOptions, type PageRevision, type PageRevisionAuthor, type PageRevisionDetail, type PageRevisionKind, type PageSearchOptions, type PageSearchOutput, type PageSearchResult, type PageUpdateInput, type PillColor, type Pipeline, type PipelineStage, type Priority, type Product, type ProductCreateInput, type ProductUpdateInput, type Project, type ProjectDetail, type ProjectKeyResultLink, type ProjectOutput, type ProjectPriority, type ProjectStatus, type ProjectUpdateInput, type ProjectsListOptions, type ProjectsListOutput, type PropertyAddInput, type PropertyDef, type PropertyRejection, type PropertyType, type PropertyUpdateInput, type PropertyValue, ROUND_MINUTES, type ReadStatus, type RelationConfig, type RelationTargetKind, type Requirement, type RequirementCreateInput, type RequirementKind, type RequirementListOptions, type Resource, type ResourceContentType, type ResourceCreateInput, type ResourceListOptions, type ResourceListResult, type ResourceReadState, type ResourceUpdateInput, type RowListOptions, type RowValuesInput, type RowWriteOptions, type RunMessage, type RunnerEvent, type RunnerEventKind, type ScopeCreateInput, type ScopeListOptions, type ScopeUpdateInput, type SearchResult, type SearchResultType, type SearchResultWorkspace, type SelectOption, type SelectOptionInput, type SetEntityTagsInput, type SetEntityTagsResult, type Tag, type TagEntityType, type TagListResult, type Ticket, type TicketAssignee, type TicketComment, type TicketCommentAddInput, type TicketCommentUpdateInput, type TicketCreateInput, type TicketDependencyEdge, type TicketDetail, type TicketListOptions, type TicketSearchOptions, type TicketStatus, type TicketType, type TicketUpdateInput, TimeApi, type TimeConfirmDayResult, type TimeEntry, type TimeEntrySource, type TimeEntryStatus, type TimeLogBatchResult, type TimeLogInput, type TimeLogOutcome, type TimeLogResult, type TodaysActionRow, type TodaysActions, type TodaysActionsGroup, type UserStory, type UserStoryCreateInput, type UserStoryListOptions, type UserStoryUpdateInput, type WorklogSegment, type Workspace, type WorkspaceMember, type WorkspaceOutput, type WorkspacesListOutput, clearConfig, createConfigStore, getConfigPath, isAuthenticated, isTRPCError, loadConfig, saveConfig, segmentConversation };
package/dist/index.js CHANGED
@@ -1137,6 +1137,88 @@ var PagesApi = class {
1137
1137
  }
1138
1138
  };
1139
1139
 
1140
+ // src/databases.ts
1141
+ var DatabasesApi = class {
1142
+ constructor(client) {
1143
+ this.client = client;
1144
+ }
1145
+ /**
1146
+ * Create a database on a page with a title property. Then put its
1147
+ * `marker` into the page body (`pages.update` with the body plus the
1148
+ * marker on its own line) so the page shows it.
1149
+ */
1150
+ async create(input) {
1151
+ return await this.client.database.create.mutate(input);
1152
+ }
1153
+ /** One database: definition, view, row count and holding page. */
1154
+ async get(id) {
1155
+ return await this.client.database.get.query({ id });
1156
+ }
1157
+ /** The databases a page holds, detached ones included, with row counts. */
1158
+ async list(pageId) {
1159
+ return await this.client.database.list.query({ pageId });
1160
+ }
1161
+ /** Rename, or replace the saved view whole. */
1162
+ async update(input) {
1163
+ return await this.client.database.update.mutate(input);
1164
+ }
1165
+ /** Delete the database and every row with it. Removing the block from the page only detaches; this is the delete. */
1166
+ async delete(id) {
1167
+ return await this.client.database.delete.mutate({ id });
1168
+ }
1169
+ // ── Properties ─────────────────────────────────────────────────────────────
1170
+ /** Add a property. New select options get ids and palette colours; the column goes last in the view. */
1171
+ async addProperty(input) {
1172
+ return await this.client.database.addProperty.mutate(input);
1173
+ }
1174
+ /** Rename, describe, retype or re-option a property. Ids stay; no row is rewritten. */
1175
+ async updateProperty(input) {
1176
+ return await this.client.database.updateProperty.mutate(input);
1177
+ }
1178
+ /** Remove a property (by id or name) from the schema and view. Never the title. */
1179
+ async removeProperty(databaseId, propertyId) {
1180
+ return await this.client.database.removeProperty.mutate({ id: databaseId, propertyId });
1181
+ }
1182
+ /** Set the column order; `propertyIds` must name every property exactly once. */
1183
+ async reorderProperties(databaseId, propertyIds) {
1184
+ return await this.client.database.reorderProperties.mutate({ id: databaseId, propertyIds });
1185
+ }
1186
+ // ── Rows ───────────────────────────────────────────────────────────────────
1187
+ /** The rows through the saved view (or `options.view`), paged by cursor. */
1188
+ async listRows(databaseId, options = {}) {
1189
+ return await this.client.database.listRows.query({ id: databaseId, ...options });
1190
+ }
1191
+ /** Add a row with typed values. Placed where the holding page is. */
1192
+ async createRow(databaseId, values = {}, options = {}) {
1193
+ return await this.client.database.createRow.mutate({ id: databaseId, values, ...options });
1194
+ }
1195
+ /** Write some of a row's values; cells not named are kept, `null` clears one. Records a revision on the row page. */
1196
+ async updateRow(rowId, values, options = {}) {
1197
+ return await this.client.database.updateRow.mutate({ rowId, values, ...options });
1198
+ }
1199
+ /** Delete a row — the page and its search chunks. */
1200
+ async deleteRow(rowId) {
1201
+ return await this.client.database.deleteRow.mutate({ rowId });
1202
+ }
1203
+ // ── CSV import ─────────────────────────────────────────────────────────────
1204
+ /**
1205
+ * Type a CSV against the database before anything is created: columns
1206
+ * resolved through `mapping` (or suggested by header name), every row
1207
+ * checked, each cell that does not fit named. Writes nothing.
1208
+ */
1209
+ async previewCsv(databaseId, csv, mapping) {
1210
+ return await this.client.database.previewCsv.mutate({ id: databaseId, csv, ...mapping ? { mapping } : {} });
1211
+ }
1212
+ /**
1213
+ * Import a CSV: new columns become properties, then every row with no
1214
+ * cell error becomes a row with a `create` revision; the rest are reported
1215
+ * and left uncreated. Up to 2,000 rows a time.
1216
+ */
1217
+ async commitCsv(databaseId, csv, mapping, options = {}) {
1218
+ return await this.client.database.commitCsv.mutate({ id: databaseId, csv, mapping, ...options });
1219
+ }
1220
+ };
1221
+
1140
1222
  // src/resources.ts
1141
1223
  var ResourcesApi = class {
1142
1224
  constructor(client) {
@@ -1566,6 +1648,7 @@ var ExponentialClient = class {
1566
1648
  this.areas = new AreasApi(this.client);
1567
1649
  this.meetings = new MeetingsApi(this.client);
1568
1650
  this.pages = new PagesApi(this.client);
1651
+ this.databases = new DatabasesApi(this.client);
1569
1652
  this.resources = new ResourcesApi(this.client);
1570
1653
  this.requirements = new RequirementsApi(this.client);
1571
1654
  this.scopes = new ScopesApi(this.client);
@@ -1597,6 +1680,8 @@ var ExponentialClient = class {
1597
1680
  areas;
1598
1681
  meetings;
1599
1682
  pages;
1683
+ /** Databases — typed tables inside pages (ADR-0078). */
1684
+ databases;
1600
1685
  resources;
1601
1686
  requirements;
1602
1687
  scopes;