@notionhq/custom-blocks 0.1.34 → 0.1.35
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/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +1 -0
- package/dist/bridge/dataSources/query.d.ts +2 -1
- package/dist/bridge/dataSources/query.d.ts.map +1 -1
- package/dist/bridge/dataSources/query.js +296 -161
- package/dist/protocol/dataSources/propertySchema.d.ts +7 -0
- package/dist/protocol/dataSources/propertySchema.d.ts.map +1 -1
- package/dist/protocol/dataSources/propertySchema.js +17 -0
- package/dist/protocol/messages/queryDataSource.d.ts +15 -0
- package/dist/protocol/messages/queryDataSource.d.ts.map +1 -1
- package/dist/protocol/messages/queryDataSource.js +8 -0
- package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -1
- package/dist/protocol/messages/queryDataSourceResult.d.ts.map +1 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +4 -0
- package/dist/protocol/messages/sandboxToHost.d.ts.map +1 -1
- package/dist/react/useDataSource.d.ts +1 -1
- package/dist/react/useDataSource.js +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/docs/data-sources.md +13 -1
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +1 -0
- package/src/bridge/dataSources/query.ts +394 -170
- package/src/react/useDataSource.ts +1 -1
- package/src/types.ts +8 -0
|
@@ -9,7 +9,7 @@ import { useCustomBlockHost } from "./useHostState.js"
|
|
|
9
9
|
*
|
|
10
10
|
* @param key - The semantic data source key the block is wired to (e.g. `"people"`).
|
|
11
11
|
* @param options - Optional live snapshot options. `limit` defaults to 20 and
|
|
12
|
-
* is capped at 999.
|
|
12
|
+
* is capped at 999. `sorts` are applied in array order.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* const { items, isLoading, hasMore, error } = useDataSource("default", { limit: 25 })
|
package/src/types.ts
CHANGED
|
@@ -154,6 +154,10 @@ export type NotionDataSourcePropertyFilter = NotionDataSourcePropertyAddress &
|
|
|
154
154
|
| { date: NotionDataSourceDateFilterOperator }
|
|
155
155
|
)
|
|
156
156
|
|
|
157
|
+
export type NotionDataSourceSort = NotionDataSourcePropertyAddress & {
|
|
158
|
+
direction: "ascending" | "descending"
|
|
159
|
+
}
|
|
160
|
+
|
|
157
161
|
export type NotionDataSourceFilter =
|
|
158
162
|
| NotionDataSourcePropertyFilter
|
|
159
163
|
| { and: NotionDataSourcePropertyFilter[] }
|
|
@@ -204,6 +208,10 @@ export type UseDataSourceOptions = {
|
|
|
204
208
|
* it sends the query to the host.
|
|
205
209
|
*/
|
|
206
210
|
filter?: NotionDataSourceFilter
|
|
211
|
+
/**
|
|
212
|
+
* Optional property sorts. The host applies them in array order.
|
|
213
|
+
*/
|
|
214
|
+
sorts?: NotionDataSourceSort[]
|
|
207
215
|
}
|
|
208
216
|
|
|
209
217
|
/**
|