@adminide-stack/yantra-mobile 12.0.141-alpha.1 → 12.0.142-alpha.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/lib/features/agent-chat/NativeAgentChat.js +21 -4
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/chat/ApprovalCard.js +353 -0
- package/lib/features/chat/ApprovalCard.js.map +1 -0
- package/lib/features/chat/AskUserCard.js +9 -2
- package/lib/features/chat/AskUserCard.js.map +1 -1
- package/lib/features/chat/askUser.js +25 -3
- package/lib/features/chat/askUser.js.map +1 -1
- package/lib/features/chat/queuedFollowUpRows.js +13 -0
- package/lib/features/chat/queuedFollowUpRows.js.map +1 -0
- package/lib/features/dictate/DictateExperience.js +59 -7
- package/lib/features/dictate/DictateExperience.js.map +1 -1
- package/lib/features/dictate/components/NoteView.js +227 -12
- package/lib/features/dictate/components/NoteView.js.map +1 -1
- package/lib/features/dictate/dictateClient.js +93 -23
- package/lib/features/dictate/dictateClient.js.map +1 -1
- package/lib/features/dictate/dictatePreference.js +19 -0
- package/lib/features/dictate/dictatePreference.js.map +1 -0
- package/lib/features/dictate/noteText.js +17 -2
- package/lib/features/dictate/noteText.js.map +1 -1
- package/lib/features/dictate/privacy.js +96 -0
- package/lib/features/dictate/privacy.js.map +1 -0
- package/lib/features/dictate/shownNote.js +24 -0
- package/lib/features/dictate/shownNote.js.map +1 -0
- package/lib/features/discover/DiscoverArticle.js +105 -92
- package/lib/features/discover/DiscoverArticle.js.map +1 -1
- package/lib/features/discover/DiscoverFeed.js +97 -48
- package/lib/features/discover/DiscoverFeed.js.map +1 -1
- package/lib/features/discover/DiscoverFollowUp.js +135 -0
- package/lib/features/discover/DiscoverFollowUp.js.map +1 -0
- package/lib/features/discover/DiscoverSidebar.js +555 -0
- package/lib/features/discover/DiscoverSidebar.js.map +1 -0
- package/lib/features/discover/DiscoverSkeletons.js +123 -0
- package/lib/features/discover/DiscoverSkeletons.js.map +1 -0
- package/lib/features/discover/DiscoverStoryCards.js +193 -87
- package/lib/features/discover/DiscoverStoryCards.js.map +1 -1
- package/lib/features/discover/followUpQuery.js +42 -0
- package/lib/features/discover/followUpQuery.js.map +1 -0
- package/lib/features/discover/markets.js +37 -0
- package/lib/features/discover/markets.js.map +1 -0
- package/lib/features/discover/useDiscoverSidebar.js +148 -0
- package/lib/features/discover/useDiscoverSidebar.js.map +1 -0
- package/lib/features/discover/weather.js +42 -0
- package/lib/features/discover/weather.js.map +1 -0
- package/lib/features/expenses/ExpensesAgentChatPane.js +1 -1
- package/lib/features/expenses/ExpensesAgentChatPane.js.map +1 -1
- package/lib/features/inbox/InboxAgentChatPane.js +1 -1
- package/lib/features/inbox/InboxAgentChatPane.js.map +1 -1
- package/lib/features/job-search/JobSearchAgentChatPane.js +1 -0
- package/lib/features/job-search/JobSearchAgentChatPane.js.map +1 -1
- package/lib/features/local-services/LocalServicesAgentChatPane.js +1 -1
- package/lib/features/local-services/LocalServicesAgentChatPane.js.map +1 -1
- package/lib/features/movies/MoviesAgentChatPane.js +1 -1
- package/lib/features/movies/MoviesAgentChatPane.js.map +1 -1
- package/lib/features/notion/NotionBlockSheets.js +206 -0
- package/lib/features/notion/NotionBlockSheets.js.map +1 -0
- package/lib/features/notion/NotionBlockView.js +36 -0
- package/lib/features/notion/NotionBlockView.js.map +1 -0
- package/lib/features/notion/NotionCommentsSheet.js +461 -0
- package/lib/features/notion/NotionCommentsSheet.js.map +1 -0
- package/lib/features/notion/NotionConnectionsSheet.js +244 -0
- package/lib/features/notion/NotionConnectionsSheet.js.map +1 -0
- package/lib/features/notion/NotionHistorySheet.js +439 -0
- package/lib/features/notion/NotionHistorySheet.js.map +1 -0
- package/lib/features/notion/NotionMediaBlocks.js +803 -0
- package/lib/features/notion/NotionMediaBlocks.js.map +1 -0
- package/lib/features/notion/NotionMentionSheet.js +279 -0
- package/lib/features/notion/NotionMentionSheet.js.map +1 -0
- package/lib/features/notion/NotionPageMenu.js +585 -0
- package/lib/features/notion/NotionPageMenu.js.map +1 -0
- package/lib/features/notion/NotionPageTree.js +220 -0
- package/lib/features/notion/NotionPageTree.js.map +1 -0
- package/lib/features/notion/NotionPageView.js +1253 -152
- package/lib/features/notion/NotionPageView.js.map +1 -1
- package/lib/features/notion/NotionShareSheet.js +606 -0
- package/lib/features/notion/NotionShareSheet.js.map +1 -0
- package/lib/features/notion/NotionSheets.js +87 -15
- package/lib/features/notion/NotionSheets.js.map +1 -1
- package/lib/features/notion/NotionSidebarSections.js +492 -0
- package/lib/features/notion/NotionSidebarSections.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceAdmin.js +659 -0
- package/lib/features/notion/NotionWorkspaceAdmin.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceView.js +257 -45
- package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
- package/lib/features/notion/database/DatabaseCells.js +554 -0
- package/lib/features/notion/database/DatabaseCells.js.map +1 -0
- package/lib/features/notion/database/DatabaseDateLayouts.js +792 -0
- package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -0
- package/lib/features/notion/database/DatabaseLayouts.js +461 -0
- package/lib/features/notion/database/DatabaseLayouts.js.map +1 -0
- package/lib/features/notion/database/DatabaseSheets.js +791 -0
- package/lib/features/notion/database/DatabaseSheets.js.map +1 -0
- package/lib/features/notion/database/NotionDatabaseView.js +817 -0
- package/lib/features/notion/database/NotionDatabaseView.js.map +1 -0
- package/lib/features/notion/database/RowPropertiesPanel.js +162 -0
- package/lib/features/notion/database/RowPropertiesPanel.js.map +1 -0
- package/lib/features/notion/database/chartData.js +89 -0
- package/lib/features/notion/database/chartData.js.map +1 -0
- package/lib/features/notion/database/chartView.js +112 -0
- package/lib/features/notion/database/chartView.js.map +1 -0
- package/lib/features/notion/database/connectorButton.js +33 -0
- package/lib/features/notion/database/connectorButton.js.map +1 -0
- package/lib/features/notion/database/databaseCalc.js +208 -0
- package/lib/features/notion/database/databaseCalc.js.map +1 -0
- package/lib/features/notion/database/databaseCalendar.js +157 -0
- package/lib/features/notion/database/databaseCalendar.js.map +1 -0
- package/lib/features/notion/database/databaseCsv.js +98 -0
- package/lib/features/notion/database/databaseCsv.js.map +1 -0
- package/lib/features/notion/database/databaseCsvActions.js +58 -0
- package/lib/features/notion/database/databaseCsvActions.js.map +1 -0
- package/lib/features/notion/database/databaseFilter.js +473 -0
- package/lib/features/notion/database/databaseFilter.js.map +1 -0
- package/lib/features/notion/database/databaseFormula.js +1072 -0
- package/lib/features/notion/database/databaseFormula.js.map +1 -0
- package/lib/features/notion/database/databaseGroup.js +151 -0
- package/lib/features/notion/database/databaseGroup.js.map +1 -0
- package/lib/features/notion/database/databaseRollup.js +58 -0
- package/lib/features/notion/database/databaseRollup.js.map +1 -0
- package/lib/features/notion/database/databaseTimeline.js +156 -0
- package/lib/features/notion/database/databaseTimeline.js.map +1 -0
- package/lib/features/notion/database/databaseView.js +1188 -0
- package/lib/features/notion/database/databaseView.js.map +1 -0
- package/lib/features/notion/database/databaseViews.js +310 -0
- package/lib/features/notion/database/databaseViews.js.map +1 -0
- package/lib/features/notion/database/relationSource.js +92 -0
- package/lib/features/notion/database/relationSource.js.map +1 -0
- package/lib/features/notion/database/uniqueId.js +17 -0
- package/lib/features/notion/database/uniqueId.js.map +1 -0
- package/lib/features/notion/database/useNotionDatabase.js +617 -0
- package/lib/features/notion/database/useNotionDatabase.js.map +1 -0
- package/lib/features/notion/notionAgentRunStatus.js +39 -0
- package/lib/features/notion/notionAgentRunStatus.js.map +1 -0
- package/lib/features/notion/notionCodeLanguages.js +112 -0
- package/lib/features/notion/notionCodeLanguages.js.map +1 -0
- package/lib/features/notion/notionComments.js +86 -0
- package/lib/features/notion/notionComments.js.map +1 -0
- package/lib/features/notion/notionConnections.js +74 -0
- package/lib/features/notion/notionConnections.js.map +1 -0
- package/lib/features/notion/notionDocuments.js +453 -1
- package/lib/features/notion/notionDocuments.js.map +1 -1
- package/lib/features/notion/notionEditorModel.js +142 -7
- package/lib/features/notion/notionEditorModel.js.map +1 -1
- package/lib/features/notion/notionMarkdownShortcuts.js +51 -0
- package/lib/features/notion/notionMarkdownShortcuts.js.map +1 -0
- package/lib/features/notion/notionMedia.js +119 -0
- package/lib/features/notion/notionMedia.js.map +1 -0
- package/lib/features/notion/notionMentionDate.js +32 -0
- package/lib/features/notion/notionMentionDate.js.map +1 -0
- package/lib/features/notion/notionMentionOptions.js +162 -0
- package/lib/features/notion/notionMentionOptions.js.map +1 -0
- package/lib/features/notion/notionNotesAgent.js +445 -0
- package/lib/features/notion/notionNotesAgent.js.map +1 -0
- package/lib/features/notion/notionPageAccess.js +168 -0
- package/lib/features/notion/notionPageAccess.js.map +1 -0
- package/lib/features/notion/notionPageActions.js +138 -0
- package/lib/features/notion/notionPageActions.js.map +1 -0
- package/lib/features/notion/notionPageHistory.js +154 -0
- package/lib/features/notion/notionPageHistory.js.map +1 -0
- package/lib/features/notion/notionPageKinds.js +200 -0
- package/lib/features/notion/notionPageKinds.js.map +1 -0
- package/lib/features/notion/notionRecents.js +48 -0
- package/lib/features/notion/notionRecents.js.map +1 -0
- package/lib/features/notion/notionRichText.js +177 -0
- package/lib/features/notion/notionRichText.js.map +1 -0
- package/lib/features/notion/notionRichTitle.js +336 -0
- package/lib/features/notion/notionRichTitle.js.map +1 -0
- package/lib/features/notion/useNotionWorkspace.js +272 -13
- package/lib/features/notion/useNotionWorkspace.js.map +1 -1
- package/lib/features/notion/usePageActions.js +155 -0
- package/lib/features/notion/usePageActions.js.map +1 -0
- package/lib/features/resume/ResumeAgentChatPane.js +1 -1
- package/lib/features/resume/ResumeAgentChatPane.js.map +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
- package/lib/features/study/StudyAgentChatPane.js +1 -1
- package/lib/features/study/StudyAgentChatPane.js.map +1 -1
- package/lib/features/travel/TravelAgentChatPane.js +1 -1
- package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +40 -8
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +1 -1
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/codeFiles.js +302 -0
- package/lib/features/webbuilder/codeFiles.js.map +1 -0
- package/lib/features/webbuilder/codeHighlight.js +209 -0
- package/lib/features/webbuilder/codeHighlight.js.map +1 -0
- package/lib/features/webbuilder/components/CodeView.js +682 -52
- package/lib/features/webbuilder/components/CodeView.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewScreen.js +59 -38
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +3 -3
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/stepLabels.js +68 -0
- package/lib/features/webbuilder/stepLabels.js.map +1 -0
- package/lib/hooks/useHostChatSteering.js +45 -0
- package/lib/hooks/useHostChatSteering.js.map +1 -0
- package/lib/screens/Chat/index.js +2 -12
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/ExpensesNative/useExpensesHostChat.js +25 -5
- package/lib/screens/ExpensesNative/useExpensesHostChat.js.map +1 -1
- package/lib/screens/InboxNative/useInboxHostChat.js +25 -5
- package/lib/screens/InboxNative/useInboxHostChat.js.map +1 -1
- package/lib/screens/JobSearchNative/useJobSearchHostChat.js +25 -5
- package/lib/screens/JobSearchNative/useJobSearchHostChat.js.map +1 -1
- package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js +25 -5
- package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js.map +1 -1
- package/lib/screens/MoviesNative/useMoviesHostChat.js +25 -5
- package/lib/screens/MoviesNative/useMoviesHostChat.js.map +1 -1
- package/lib/screens/NotionPage/index.js +2 -2
- package/lib/screens/NotionPage/index.js.map +1 -1
- package/lib/screens/ResumeNative/useResumeHostChat.js +25 -5
- package/lib/screens/ResumeNative/useResumeHostChat.js.map +1 -1
- package/lib/screens/ShoppingNative/useShoppingHostChat.js +25 -5
- package/lib/screens/ShoppingNative/useShoppingHostChat.js.map +1 -1
- package/lib/screens/StudyNative/useStudyHostChat.js +25 -5
- package/lib/screens/StudyNative/useStudyHostChat.js.map +1 -1
- package/lib/screens/TravelNative/useTravelHostChat.js +25 -5
- package/lib/screens/TravelNative/useTravelHostChat.js.map +1 -1
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +222 -0
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -0
- package/lib/screens/WebBuilderNative/index.js +1 -1
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js +126 -4
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +120 -11
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
import {useState,useRef,useCallback,useEffect,useMemo}from'react';import {useApolloClient,useQuery,useMutation}from'@apollo/client/index.js';import {NATIVE_NOTION_BLOCK,NATIVE_NOTION_DATABASE_VIEWS,NATIVE_NOTION_UPDATE_BLOCK,NATIVE_NOTION_CREATE_BLOCK,NATIVE_NOTION_DELETE_BLOCK,NATIVE_NOTION_RESTORE_BLOCK,NATIVE_NOTION_CREATE_DATABASE_VIEW,NATIVE_NOTION_UPDATE_DATABASE_VIEW,NATIVE_NOTION_DELETE_DATABASE_VIEW,NATIVE_NOTION_QUERY_DATABASE}from'../notionDocuments.js';import {serverErrorText}from'../notionPageActions.js';import {extraColumnFields,parseViewSorts}from'./databaseView.js';import {parseViewFilter,serializeViewFilter}from'./databaseFilter.js';import {uniqueIdProperties,maxUniqueId}from'./uniqueId.js';import {DEFAULT_VIEW_ID,parseViewSettings,viewLayout}from'./databaseViews.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
const PAGE_SIZE = 200;
|
|
21
|
+
const ROWS_CREATION_ORDER = [{
|
|
22
|
+
timestamp: "createdTime",
|
|
23
|
+
direction: "ascending"
|
|
24
|
+
}];
|
|
25
|
+
const FILTER_SAVE_DELAY = 600;
|
|
26
|
+
function columnsFromSchema(schema) {
|
|
27
|
+
if (!schema) return [];
|
|
28
|
+
return Object.entries(schema).map(([name, def]) => __spreadValues({
|
|
29
|
+
name,
|
|
30
|
+
type: (def == null ? void 0 : def.type) || "text",
|
|
31
|
+
options: (def == null ? void 0 : def.options) || [],
|
|
32
|
+
width: (def == null ? void 0 : def.type) === "title" ? 220 : void 0,
|
|
33
|
+
expression: typeof (def == null ? void 0 : def.expression) === "string" ? def.expression : void 0,
|
|
34
|
+
databaseId: typeof (def == null ? void 0 : def.databaseId) === "string" ? def.databaseId : void 0
|
|
35
|
+
}, extraColumnFields(def)));
|
|
36
|
+
}
|
|
37
|
+
function rowFromBlock(b) {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
return {
|
|
40
|
+
id: b.id,
|
|
41
|
+
type: b.type,
|
|
42
|
+
properties: b.properties || {},
|
|
43
|
+
createdTime: (_a = b.createdTime) != null ? _a : void 0,
|
|
44
|
+
lastEditedTime: (_b = b.lastEditedTime) != null ? _b : void 0,
|
|
45
|
+
createdBy: (_c = b.createdBy) != null ? _c : void 0,
|
|
46
|
+
lastEditedBy: (_d = b.lastEditedBy) != null ? _d : void 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function viewFromRaw(v) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
return {
|
|
52
|
+
id: v.id,
|
|
53
|
+
name: v.name || "Default",
|
|
54
|
+
type: viewLayout(v.type),
|
|
55
|
+
sorts: parseViewSorts(v.sorts),
|
|
56
|
+
conditions: parseViewFilter(v.filter),
|
|
57
|
+
groupBy: (_a = v.groupBy) != null ? _a : null,
|
|
58
|
+
properties: (_b = v.properties) != null ? _b : void 0,
|
|
59
|
+
settings: parseViewSettings(v.settings)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const IMPLICIT_TABLE_VIEW = {
|
|
63
|
+
id: DEFAULT_VIEW_ID,
|
|
64
|
+
name: "Table",
|
|
65
|
+
type: "table",
|
|
66
|
+
sorts: [],
|
|
67
|
+
conditions: [],
|
|
68
|
+
groupBy: null,
|
|
69
|
+
properties: void 0,
|
|
70
|
+
settings: {}
|
|
71
|
+
};
|
|
72
|
+
function databaseTitle(properties) {
|
|
73
|
+
const t = properties == null ? void 0 : properties.title;
|
|
74
|
+
if (typeof t === "string") return t;
|
|
75
|
+
if (Array.isArray(t)) return t.map((rt) => {
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
return (_c = (_b = rt == null ? void 0 : rt.plainText) != null ? _b : (_a = rt == null ? void 0 : rt.text) == null ? void 0 : _a.content) != null ? _c : "";
|
|
78
|
+
}).join("");
|
|
79
|
+
return "";
|
|
80
|
+
}
|
|
81
|
+
function viewInputOf(change) {
|
|
82
|
+
const out = {};
|
|
83
|
+
if (change.name !== void 0) out.name = change.name;
|
|
84
|
+
if (change.type !== void 0) out.type = change.type;
|
|
85
|
+
if (change.sorts !== void 0) out.sorts = change.sorts;
|
|
86
|
+
if (change.conditions !== void 0) out.filter = serializeViewFilter(change.conditions);
|
|
87
|
+
if (change.groupBy !== void 0) out.groupBy = change.groupBy;
|
|
88
|
+
if (change.properties !== void 0) out.properties = change.properties;
|
|
89
|
+
if (change.settings !== void 0) out.settings = change.settings;
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
function useNotionDatabase(blockId) {
|
|
93
|
+
var _a, _b, _c, _d, _e;
|
|
94
|
+
const client = useApolloClient();
|
|
95
|
+
const block = useQuery(NATIVE_NOTION_BLOCK, {
|
|
96
|
+
variables: {
|
|
97
|
+
input: {
|
|
98
|
+
blockId
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
skip: !blockId,
|
|
102
|
+
fetchPolicy: "cache-and-network"
|
|
103
|
+
});
|
|
104
|
+
const viewsQuery = useQuery(NATIVE_NOTION_DATABASE_VIEWS, {
|
|
105
|
+
variables: {
|
|
106
|
+
databaseId: blockId
|
|
107
|
+
},
|
|
108
|
+
skip: !blockId,
|
|
109
|
+
fetchPolicy: "cache-and-network"
|
|
110
|
+
});
|
|
111
|
+
const [updateBlock] = useMutation(NATIVE_NOTION_UPDATE_BLOCK);
|
|
112
|
+
const [createBlock] = useMutation(NATIVE_NOTION_CREATE_BLOCK);
|
|
113
|
+
const [deleteBlock] = useMutation(NATIVE_NOTION_DELETE_BLOCK);
|
|
114
|
+
const [restoreBlock] = useMutation(NATIVE_NOTION_RESTORE_BLOCK);
|
|
115
|
+
const [createView] = useMutation(NATIVE_NOTION_CREATE_DATABASE_VIEW);
|
|
116
|
+
const [updateView] = useMutation(NATIVE_NOTION_UPDATE_DATABASE_VIEW);
|
|
117
|
+
const [deleteView] = useMutation(NATIVE_NOTION_DELETE_DATABASE_VIEW);
|
|
118
|
+
const [rows, setRows] = useState([]);
|
|
119
|
+
const [cursor, setCursor] = useState(null);
|
|
120
|
+
const [hasMore, setHasMore] = useState(false);
|
|
121
|
+
const [totalCount, setTotalCount] = useState(null);
|
|
122
|
+
const [rowsLoading, setRowsLoading] = useState(true);
|
|
123
|
+
const [rowsError, setRowsError] = useState(null);
|
|
124
|
+
const loadSeq = useRef(0);
|
|
125
|
+
const rowsCountRef = useRef(0);
|
|
126
|
+
rowsCountRef.current = rows.length;
|
|
127
|
+
const fetchPage = useCallback(async (startCursor) => {
|
|
128
|
+
var _a2, _b2, _c2;
|
|
129
|
+
const res = await client.query({
|
|
130
|
+
query: NATIVE_NOTION_QUERY_DATABASE,
|
|
131
|
+
variables: {
|
|
132
|
+
input: __spreadValues({
|
|
133
|
+
databaseId: blockId,
|
|
134
|
+
pageSize: PAGE_SIZE,
|
|
135
|
+
sorts: ROWS_CREATION_ORDER
|
|
136
|
+
}, startCursor ? {
|
|
137
|
+
startCursor
|
|
138
|
+
} : {})
|
|
139
|
+
},
|
|
140
|
+
fetchPolicy: "network-only"
|
|
141
|
+
});
|
|
142
|
+
const page = (_a2 = res.data) == null ? void 0 : _a2.queryDatabase;
|
|
143
|
+
return {
|
|
144
|
+
rows: ((_b2 = page == null ? void 0 : page.results) != null ? _b2 : []).filter((b) => !!(b == null ? void 0 : b.id)).map(rowFromBlock),
|
|
145
|
+
cursor: (_c2 = page == null ? void 0 : page.nextCursor) != null ? _c2 : null,
|
|
146
|
+
hasMore: Boolean(page == null ? void 0 : page.hasMore),
|
|
147
|
+
total: typeof (page == null ? void 0 : page.totalCount) === "number" ? page.totalCount : null
|
|
148
|
+
};
|
|
149
|
+
}, [blockId, client]);
|
|
150
|
+
const reloadRows = useCallback(async () => {
|
|
151
|
+
if (!blockId) return;
|
|
152
|
+
const seq = ++loadSeq.current;
|
|
153
|
+
setRowsError(null);
|
|
154
|
+
try {
|
|
155
|
+
const want = Math.max(rowsCountRef.current, 1);
|
|
156
|
+
let page = await fetchPage(null);
|
|
157
|
+
let all = page.rows;
|
|
158
|
+
while (page.hasMore && page.cursor && all.length < want) {
|
|
159
|
+
page = await fetchPage(page.cursor);
|
|
160
|
+
all = all.concat(page.rows);
|
|
161
|
+
}
|
|
162
|
+
if (seq !== loadSeq.current) return;
|
|
163
|
+
setRows(all);
|
|
164
|
+
setCursor(page.cursor);
|
|
165
|
+
setHasMore(page.hasMore);
|
|
166
|
+
setTotalCount(page.total);
|
|
167
|
+
} catch (err) {
|
|
168
|
+
if (seq === loadSeq.current) setRowsError(serverErrorText(err));
|
|
169
|
+
} finally {
|
|
170
|
+
if (seq === loadSeq.current) setRowsLoading(false);
|
|
171
|
+
}
|
|
172
|
+
}, [blockId, fetchPage]);
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
setRowsLoading(true);
|
|
175
|
+
rowsCountRef.current = 0;
|
|
176
|
+
reloadRows();
|
|
177
|
+
}, [reloadRows]);
|
|
178
|
+
const [loadingMore, setLoadingMore] = useState(false);
|
|
179
|
+
const loadMore = useCallback(async () => {
|
|
180
|
+
if (!hasMore || !cursor || loadingMore) return;
|
|
181
|
+
setLoadingMore(true);
|
|
182
|
+
try {
|
|
183
|
+
const page = await fetchPage(cursor);
|
|
184
|
+
setRows((prev) => {
|
|
185
|
+
const seen = new Set(prev.map((r) => r.id));
|
|
186
|
+
return prev.concat(page.rows.filter((r) => !seen.has(r.id)));
|
|
187
|
+
});
|
|
188
|
+
setCursor(page.cursor);
|
|
189
|
+
setHasMore(page.hasMore);
|
|
190
|
+
} catch (err) {
|
|
191
|
+
setRowsError(serverErrorText(err));
|
|
192
|
+
} finally {
|
|
193
|
+
setLoadingMore(false);
|
|
194
|
+
}
|
|
195
|
+
}, [cursor, fetchPage, hasMore, loadingMore]);
|
|
196
|
+
const loadAll = useCallback(async () => {
|
|
197
|
+
let all = rows;
|
|
198
|
+
let next = cursor;
|
|
199
|
+
let more = hasMore;
|
|
200
|
+
for (let i = 0; more && next && i < 100; i += 1) {
|
|
201
|
+
const page = await fetchPage(next);
|
|
202
|
+
const seen = new Set(all.map((r) => r.id));
|
|
203
|
+
all = all.concat(page.rows.filter((r) => !seen.has(r.id)));
|
|
204
|
+
next = page.cursor;
|
|
205
|
+
more = page.hasMore;
|
|
206
|
+
}
|
|
207
|
+
setRows(all);
|
|
208
|
+
setCursor(next);
|
|
209
|
+
setHasMore(more);
|
|
210
|
+
return all;
|
|
211
|
+
}, [cursor, fetchPage, hasMore, rows]);
|
|
212
|
+
const dbBlock = (_b = (_a = block.data) == null ? void 0 : _a.getBlock) != null ? _b : null;
|
|
213
|
+
const [schemaOverride, setSchemaOverride] = useState(null);
|
|
214
|
+
const serverSchema = useMemo(() => {
|
|
215
|
+
var _a2, _b2;
|
|
216
|
+
return (_b2 = (_a2 = dbBlock == null ? void 0 : dbBlock.properties) == null ? void 0 : _a2.schema) != null ? _b2 : {};
|
|
217
|
+
}, [dbBlock]);
|
|
218
|
+
const schema = schemaOverride != null ? schemaOverride : serverSchema;
|
|
219
|
+
const columns = useMemo(() => columnsFromSchema(schema), [schema]);
|
|
220
|
+
const title = databaseTitle(dbBlock == null ? void 0 : dbBlock.properties);
|
|
221
|
+
const icon = (_d = (_c = dbBlock == null ? void 0 : dbBlock.properties) == null ? void 0 : _c.icon) != null ? _d : null;
|
|
222
|
+
const saveSchema = useCallback(async (next) => {
|
|
223
|
+
setSchemaOverride(next);
|
|
224
|
+
try {
|
|
225
|
+
await updateBlock({
|
|
226
|
+
variables: {
|
|
227
|
+
input: {
|
|
228
|
+
id: blockId,
|
|
229
|
+
properties: {
|
|
230
|
+
schema: next
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
errorPolicy: "none"
|
|
235
|
+
});
|
|
236
|
+
return null;
|
|
237
|
+
} catch (err) {
|
|
238
|
+
setSchemaOverride(null);
|
|
239
|
+
return serverErrorText(err);
|
|
240
|
+
}
|
|
241
|
+
}, [blockId, updateBlock]);
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
if (schemaOverride && JSON.stringify(serverSchema) === JSON.stringify(schemaOverride)) {
|
|
244
|
+
setSchemaOverride(null);
|
|
245
|
+
}
|
|
246
|
+
}, [schemaOverride, serverSchema]);
|
|
247
|
+
const renameDatabase = useCallback(async (next) => {
|
|
248
|
+
try {
|
|
249
|
+
await updateBlock({
|
|
250
|
+
variables: {
|
|
251
|
+
input: {
|
|
252
|
+
id: blockId,
|
|
253
|
+
properties: {
|
|
254
|
+
title: [{
|
|
255
|
+
text: {
|
|
256
|
+
content: next
|
|
257
|
+
},
|
|
258
|
+
plainText: next
|
|
259
|
+
}]
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
errorPolicy: "none"
|
|
264
|
+
});
|
|
265
|
+
return null;
|
|
266
|
+
} catch (err) {
|
|
267
|
+
return serverErrorText(err);
|
|
268
|
+
}
|
|
269
|
+
}, [blockId, updateBlock]);
|
|
270
|
+
const updateCell = useCallback(async (rowId, property, value) => {
|
|
271
|
+
let previous;
|
|
272
|
+
setRows((prev) => prev.map((r) => {
|
|
273
|
+
if (r.id !== rowId) return r;
|
|
274
|
+
previous = r.properties[property];
|
|
275
|
+
return __spreadProps(__spreadValues({}, r), {
|
|
276
|
+
properties: __spreadProps(__spreadValues({}, r.properties), {
|
|
277
|
+
[property]: value
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
}));
|
|
281
|
+
try {
|
|
282
|
+
await updateBlock({
|
|
283
|
+
variables: {
|
|
284
|
+
input: {
|
|
285
|
+
id: rowId,
|
|
286
|
+
properties: {
|
|
287
|
+
[property]: value
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
errorPolicy: "none"
|
|
292
|
+
});
|
|
293
|
+
return null;
|
|
294
|
+
} catch (err) {
|
|
295
|
+
setRows((prev) => prev.map((r) => r.id === rowId ? __spreadProps(__spreadValues({}, r), {
|
|
296
|
+
properties: __spreadProps(__spreadValues({}, r.properties), {
|
|
297
|
+
[property]: previous
|
|
298
|
+
})
|
|
299
|
+
}) : r));
|
|
300
|
+
return serverErrorText(err);
|
|
301
|
+
}
|
|
302
|
+
}, [updateBlock]);
|
|
303
|
+
const patchRow = useCallback(async (rowId, patch) => {
|
|
304
|
+
let previous = null;
|
|
305
|
+
setRows((prev) => prev.map((r) => {
|
|
306
|
+
if (r.id !== rowId) return r;
|
|
307
|
+
previous = r.properties;
|
|
308
|
+
return __spreadProps(__spreadValues({}, r), {
|
|
309
|
+
properties: __spreadValues(__spreadValues({}, r.properties), patch)
|
|
310
|
+
});
|
|
311
|
+
}));
|
|
312
|
+
try {
|
|
313
|
+
await updateBlock({
|
|
314
|
+
variables: {
|
|
315
|
+
input: {
|
|
316
|
+
id: rowId,
|
|
317
|
+
properties: patch
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
errorPolicy: "none"
|
|
321
|
+
});
|
|
322
|
+
return null;
|
|
323
|
+
} catch (err) {
|
|
324
|
+
const before = previous;
|
|
325
|
+
if (before) setRows((prev) => prev.map((r) => r.id === rowId ? __spreadProps(__spreadValues({}, r), {
|
|
326
|
+
properties: before
|
|
327
|
+
}) : r));
|
|
328
|
+
return serverErrorText(err);
|
|
329
|
+
}
|
|
330
|
+
}, [updateBlock]);
|
|
331
|
+
const patchRowsLocally = useCallback((fn) => {
|
|
332
|
+
setRows((prev) => prev.map(fn));
|
|
333
|
+
}, []);
|
|
334
|
+
const lastUniqueRef = useRef({});
|
|
335
|
+
const takeUniqueIds = useCallback(async () => {
|
|
336
|
+
var _a2;
|
|
337
|
+
const props = uniqueIdProperties(schema);
|
|
338
|
+
if (!props.length) return {};
|
|
339
|
+
const all = hasMore ? await loadAll() : rows;
|
|
340
|
+
const out = {};
|
|
341
|
+
for (const prop of props) {
|
|
342
|
+
const next = Math.max(maxUniqueId(all, prop), (_a2 = lastUniqueRef.current[prop]) != null ? _a2 : 0) + 1;
|
|
343
|
+
out[prop] = next;
|
|
344
|
+
lastUniqueRef.current[prop] = next;
|
|
345
|
+
}
|
|
346
|
+
return out;
|
|
347
|
+
}, [hasMore, loadAll, rows, schema]);
|
|
348
|
+
const addRow = useCallback(async (initial = {}) => {
|
|
349
|
+
var _a2;
|
|
350
|
+
try {
|
|
351
|
+
const ids = await takeUniqueIds();
|
|
352
|
+
const res = await createBlock({
|
|
353
|
+
variables: {
|
|
354
|
+
input: {
|
|
355
|
+
type: "database_row",
|
|
356
|
+
parent: {
|
|
357
|
+
type: "database",
|
|
358
|
+
id: blockId
|
|
359
|
+
},
|
|
360
|
+
properties: __spreadValues(__spreadValues({
|
|
361
|
+
title: [{
|
|
362
|
+
text: {
|
|
363
|
+
content: ""
|
|
364
|
+
},
|
|
365
|
+
plainText: ""
|
|
366
|
+
}]
|
|
367
|
+
}, initial), ids)
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
errorPolicy: "none"
|
|
371
|
+
});
|
|
372
|
+
const created = (_a2 = res.data) == null ? void 0 : _a2.createBlock;
|
|
373
|
+
if (created == null ? void 0 : created.id) {
|
|
374
|
+
setRows((prev) => prev.concat(rowFromBlock(created)));
|
|
375
|
+
setTotalCount((n) => n == null ? n : n + 1);
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
id: created == null ? void 0 : created.id
|
|
379
|
+
};
|
|
380
|
+
} catch (err) {
|
|
381
|
+
return {
|
|
382
|
+
error: serverErrorText(err)
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
}, [blockId, createBlock, takeUniqueIds]);
|
|
386
|
+
const deleteRows = useCallback(async (ids) => {
|
|
387
|
+
const removed = rows.filter((r) => ids.includes(r.id));
|
|
388
|
+
setRows((prev) => prev.filter((r) => !ids.includes(r.id)));
|
|
389
|
+
const results = await Promise.allSettled(ids.map((id) => deleteBlock({
|
|
390
|
+
variables: {
|
|
391
|
+
blockId: id
|
|
392
|
+
},
|
|
393
|
+
errorPolicy: "none"
|
|
394
|
+
})));
|
|
395
|
+
const failed = ids.filter((_, i) => results[i].status === "rejected");
|
|
396
|
+
if (failed.length) {
|
|
397
|
+
setRows((prev) => prev.concat(removed.filter((r) => failed.includes(r.id))));
|
|
398
|
+
}
|
|
399
|
+
const deleted = ids.filter((id) => !failed.includes(id));
|
|
400
|
+
setTotalCount((n) => n == null ? n : Math.max(0, n - deleted.length));
|
|
401
|
+
const rejection = results.find((r) => r.status === "rejected");
|
|
402
|
+
return {
|
|
403
|
+
deleted,
|
|
404
|
+
error: rejection ? serverErrorText(rejection.reason) : null
|
|
405
|
+
};
|
|
406
|
+
}, [deleteBlock, rows]);
|
|
407
|
+
const restoreRows = useCallback(async (ids) => {
|
|
408
|
+
await Promise.allSettled(ids.map((id) => restoreBlock({
|
|
409
|
+
variables: {
|
|
410
|
+
blockId: id
|
|
411
|
+
}
|
|
412
|
+
})));
|
|
413
|
+
await reloadRows();
|
|
414
|
+
}, [reloadRows, restoreBlock]);
|
|
415
|
+
const serverViews = useMemo(() => {
|
|
416
|
+
var _a2, _b2;
|
|
417
|
+
return ((_b2 = (_a2 = viewsQuery.data) == null ? void 0 : _a2.getDatabaseViews) != null ? _b2 : []).filter((v) => !!(v == null ? void 0 : v.id)).map(viewFromRaw);
|
|
418
|
+
}, [viewsQuery.data]);
|
|
419
|
+
const [overrides, setOverrides] = useState({});
|
|
420
|
+
const views = useMemo(() => {
|
|
421
|
+
const base = serverViews.length ? serverViews : [IMPLICIT_TABLE_VIEW];
|
|
422
|
+
return base.map((v) => {
|
|
423
|
+
var _a2;
|
|
424
|
+
const o = overrides[v.id];
|
|
425
|
+
return o ? __spreadProps(__spreadValues(__spreadValues({}, v), o), {
|
|
426
|
+
settings: (_a2 = o.settings) != null ? _a2 : v.settings
|
|
427
|
+
}) : v;
|
|
428
|
+
});
|
|
429
|
+
}, [overrides, serverViews]);
|
|
430
|
+
const [activeViewId, setActiveViewId] = useState(null);
|
|
431
|
+
const activeView = (_e = views.find((v) => v.id === activeViewId)) != null ? _e : views[0];
|
|
432
|
+
const filterTimers = useRef({});
|
|
433
|
+
useEffect(() => () => {
|
|
434
|
+
Object.values(filterTimers.current).forEach(clearTimeout);
|
|
435
|
+
}, []);
|
|
436
|
+
const persistView = useCallback(async (viewId, change) => {
|
|
437
|
+
try {
|
|
438
|
+
await updateView({
|
|
439
|
+
variables: {
|
|
440
|
+
input: __spreadValues({
|
|
441
|
+
databaseId: blockId,
|
|
442
|
+
viewId
|
|
443
|
+
}, viewInputOf(change))
|
|
444
|
+
},
|
|
445
|
+
errorPolicy: "none"
|
|
446
|
+
});
|
|
447
|
+
return null;
|
|
448
|
+
} catch (err) {
|
|
449
|
+
return serverErrorText(err);
|
|
450
|
+
}
|
|
451
|
+
}, [blockId, updateView]);
|
|
452
|
+
const changeView = useCallback((viewId, change) => {
|
|
453
|
+
setOverrides((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
454
|
+
[viewId]: __spreadValues(__spreadValues({}, prev[viewId]), change)
|
|
455
|
+
}));
|
|
456
|
+
if (viewId === DEFAULT_VIEW_ID) return Promise.resolve(null);
|
|
457
|
+
if (change.conditions && Object.keys(change).length === 1) {
|
|
458
|
+
clearTimeout(filterTimers.current[viewId]);
|
|
459
|
+
return new Promise((resolve) => {
|
|
460
|
+
filterTimers.current[viewId] = setTimeout(() => persistView(viewId, change).then(resolve), FILTER_SAVE_DELAY);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return persistView(viewId, change);
|
|
464
|
+
}, [persistView]);
|
|
465
|
+
const addView = useCallback(async (draft) => {
|
|
466
|
+
var _a2, _b2;
|
|
467
|
+
try {
|
|
468
|
+
if (!serverViews.length) {
|
|
469
|
+
const implicit = views[0];
|
|
470
|
+
await createView({
|
|
471
|
+
variables: {
|
|
472
|
+
input: __spreadValues({
|
|
473
|
+
databaseId: blockId,
|
|
474
|
+
name: implicit.name,
|
|
475
|
+
type: "table"
|
|
476
|
+
}, viewInputOf({
|
|
477
|
+
sorts: implicit.sorts,
|
|
478
|
+
conditions: implicit.conditions,
|
|
479
|
+
properties: implicit.properties,
|
|
480
|
+
settings: implicit.settings
|
|
481
|
+
}))
|
|
482
|
+
},
|
|
483
|
+
errorPolicy: "none"
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
const res = await createView({
|
|
487
|
+
variables: {
|
|
488
|
+
input: __spreadValues({
|
|
489
|
+
databaseId: blockId,
|
|
490
|
+
name: draft.name,
|
|
491
|
+
type: draft.type
|
|
492
|
+
}, draft.groupBy ? {
|
|
493
|
+
groupBy: draft.groupBy
|
|
494
|
+
} : {})
|
|
495
|
+
},
|
|
496
|
+
errorPolicy: "none"
|
|
497
|
+
});
|
|
498
|
+
await viewsQuery.refetch();
|
|
499
|
+
const id = (_b2 = (_a2 = res.data) == null ? void 0 : _a2.createDatabaseView) == null ? void 0 : _b2.id;
|
|
500
|
+
if (id) setActiveViewId(id);
|
|
501
|
+
return null;
|
|
502
|
+
} catch (err) {
|
|
503
|
+
return serverErrorText(err);
|
|
504
|
+
}
|
|
505
|
+
}, [blockId, createView, serverViews.length, views, viewsQuery]);
|
|
506
|
+
const duplicateView = useCallback(async (view, name) => {
|
|
507
|
+
var _a2, _b2;
|
|
508
|
+
try {
|
|
509
|
+
const res = await createView({
|
|
510
|
+
variables: {
|
|
511
|
+
input: __spreadValues({
|
|
512
|
+
databaseId: blockId,
|
|
513
|
+
name,
|
|
514
|
+
type: view.type
|
|
515
|
+
}, viewInputOf({
|
|
516
|
+
sorts: view.sorts,
|
|
517
|
+
conditions: view.conditions,
|
|
518
|
+
groupBy: view.groupBy,
|
|
519
|
+
properties: view.properties,
|
|
520
|
+
settings: view.settings
|
|
521
|
+
}))
|
|
522
|
+
},
|
|
523
|
+
errorPolicy: "none"
|
|
524
|
+
});
|
|
525
|
+
await viewsQuery.refetch();
|
|
526
|
+
const id = (_b2 = (_a2 = res.data) == null ? void 0 : _a2.createDatabaseView) == null ? void 0 : _b2.id;
|
|
527
|
+
if (id) setActiveViewId(id);
|
|
528
|
+
return null;
|
|
529
|
+
} catch (err) {
|
|
530
|
+
return serverErrorText(err);
|
|
531
|
+
}
|
|
532
|
+
}, [blockId, createView, viewsQuery]);
|
|
533
|
+
const removeView = useCallback(async (viewId) => {
|
|
534
|
+
if (viewId === DEFAULT_VIEW_ID) return null;
|
|
535
|
+
try {
|
|
536
|
+
await deleteView({
|
|
537
|
+
variables: {
|
|
538
|
+
databaseId: blockId,
|
|
539
|
+
viewId
|
|
540
|
+
},
|
|
541
|
+
errorPolicy: "none"
|
|
542
|
+
});
|
|
543
|
+
if (activeViewId === viewId) setActiveViewId(null);
|
|
544
|
+
await viewsQuery.refetch();
|
|
545
|
+
return null;
|
|
546
|
+
} catch (err) {
|
|
547
|
+
return serverErrorText(err);
|
|
548
|
+
}
|
|
549
|
+
}, [activeViewId, blockId, deleteView, viewsQuery]);
|
|
550
|
+
const refresh = useCallback(async () => {
|
|
551
|
+
await Promise.allSettled([block.refetch(), viewsQuery.refetch(), reloadRows()]);
|
|
552
|
+
}, [block, reloadRows, viewsQuery]);
|
|
553
|
+
return {
|
|
554
|
+
block: dbBlock,
|
|
555
|
+
title,
|
|
556
|
+
icon,
|
|
557
|
+
schema,
|
|
558
|
+
columns,
|
|
559
|
+
rows,
|
|
560
|
+
totalCount,
|
|
561
|
+
hasMore,
|
|
562
|
+
loadMore,
|
|
563
|
+
loadAll,
|
|
564
|
+
loadingMore,
|
|
565
|
+
loading: block.loading && !dbBlock || rowsLoading,
|
|
566
|
+
error: block.error ? serverErrorText(block.error) : rowsError,
|
|
567
|
+
views,
|
|
568
|
+
hasSavedViews: serverViews.length > 0,
|
|
569
|
+
activeView,
|
|
570
|
+
setActiveViewId,
|
|
571
|
+
changeView,
|
|
572
|
+
addView,
|
|
573
|
+
duplicateView,
|
|
574
|
+
removeView,
|
|
575
|
+
saveSchema,
|
|
576
|
+
renameDatabase,
|
|
577
|
+
updateCell,
|
|
578
|
+
patchRow,
|
|
579
|
+
patchRowsLocally,
|
|
580
|
+
addRow,
|
|
581
|
+
deleteRows,
|
|
582
|
+
restoreRows,
|
|
583
|
+
reloadRows,
|
|
584
|
+
refresh
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
const NEW_DATABASE_PROPERTIES = {
|
|
588
|
+
title: [{
|
|
589
|
+
type: "text",
|
|
590
|
+
text: {
|
|
591
|
+
content: "Untitled database"
|
|
592
|
+
},
|
|
593
|
+
plainText: "Untitled database",
|
|
594
|
+
annotations: {}
|
|
595
|
+
}],
|
|
596
|
+
schema: {
|
|
597
|
+
title: {
|
|
598
|
+
type: "title"
|
|
599
|
+
},
|
|
600
|
+
Status: {
|
|
601
|
+
type: "select",
|
|
602
|
+
options: [{
|
|
603
|
+
name: "To Do",
|
|
604
|
+
color: "gray"
|
|
605
|
+
}, {
|
|
606
|
+
name: "In Progress",
|
|
607
|
+
color: "blue"
|
|
608
|
+
}, {
|
|
609
|
+
name: "Done",
|
|
610
|
+
color: "green"
|
|
611
|
+
}]
|
|
612
|
+
},
|
|
613
|
+
Date: {
|
|
614
|
+
type: "date"
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};export{IMPLICIT_TABLE_VIEW,NEW_DATABASE_PROPERTIES,columnsFromSchema,databaseTitle,rowFromBlock,useNotionDatabase,viewFromRaw};//# sourceMappingURL=useNotionDatabase.js.map
|