exponential-sdk 1.25.0 → 1.27.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).