@notionhq/apps 0.0.16 → 0.0.18
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/AGENTS.md +27 -0
- package/README.md +86 -36
- package/dist/connections.d.ts +39 -11
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +85 -21
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/notion-as-code/database.d.ts +89 -48
- package/dist/notion-as-code/database.d.ts.map +1 -1
- package/dist/notion-as-code/database.js +132 -45
- package/dist/notion-as-code/database.test.d.ts +2 -0
- package/dist/notion-as-code/database.test.d.ts.map +1 -0
- package/dist/notion-as-code/handles.d.ts +2 -0
- package/dist/notion-as-code/handles.d.ts.map +1 -1
- package/dist/notion-as-code/handles.js +2 -0
- package/dist/notion-as-code/index.d.ts +5 -2
- package/dist/notion-as-code/index.d.ts.map +1 -1
- package/dist/notion-as-code/intents.d.ts +36 -3
- package/dist/notion-as-code/intents.d.ts.map +1 -1
- package/dist/notion-as-code/schema.d.ts +8 -4
- package/dist/notion-as-code/schema.d.ts.map +1 -1
- package/dist/notion-as-code/view.d.ts +12 -0
- package/dist/notion-as-code/view.d.ts.map +1 -0
- package/dist/notion-as-code/view.js +13 -0
- package/dist/notion-as-code/views-types.test.d.ts +2 -0
- package/dist/notion-as-code/views-types.test.d.ts.map +1 -0
- package/dist/notion-as-code/views.d.ts +488 -0
- package/dist/notion-as-code/views.d.ts.map +1 -0
- package/dist/notion-as-code/views.js +0 -0
- package/dist/oauth.d.ts +11 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +26 -0
- package/dist/providers.generated.d.ts +26 -86
- package/dist/providers.generated.d.ts.map +1 -1
- package/dist/providers.generated.js +54 -66
- package/dist/sync.d.ts +33 -15
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +12 -0
- package/dist/triggers.generated.d.ts +3 -3
- package/dist/triggers.generated.d.ts.map +1 -1
- package/dist/workflow-state.d.ts +13 -0
- package/dist/workflow-state.d.ts.map +1 -0
- package/dist/workflow-state.js +107 -0
- package/dist/workflow.d.ts +56 -11
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +123 -10
- package/docs/BUILD.md +96 -0
- package/docs/CONNECTIONS.md +70 -22
- package/package.json +1 -1
- package/skills/connections/SKILL.md +7 -8
- package/skills/notion-as-code/SKILL.md +88 -50
- package/skills/sync/SKILL.md +21 -18
- package/skills/workflow/SKILL.md +52 -3
- package/src/cli/build.test.ts +124 -64
- package/src/connections.test.ts +205 -41
- package/src/connections.ts +144 -38
- package/src/index.ts +2 -0
- package/src/notion-as-code/database.test.ts +661 -0
- package/src/notion-as-code/database.ts +346 -129
- package/src/notion-as-code/handles.ts +2 -0
- package/src/notion-as-code/index.ts +71 -1
- package/src/notion-as-code/intents.ts +41 -4
- package/src/notion-as-code/schema.ts +11 -3
- package/src/notion-as-code/view.ts +23 -0
- package/src/notion-as-code/views-types.test.ts +59 -0
- package/src/notion-as-code/views.ts +573 -0
- package/src/oauth.ts +40 -0
- package/src/providers.generated.ts +68 -163
- package/src/sync.test.ts +295 -0
- package/src/sync.ts +85 -21
- package/src/triggers.generated.ts +4 -4
- package/src/workflow-connections-types.test.ts +16 -10
- package/src/workflow-state.ts +152 -0
- package/src/workflow-types.test.ts +88 -16
- package/src/workflow.test.ts +374 -18
- package/src/workflow.ts +211 -23
|
@@ -5,72 +5,160 @@ import { createPage } from "./page.js";
|
|
|
5
5
|
import { recordIntent } from "./recorder.js";
|
|
6
6
|
import { assertParent, assertUserResourceId } from "./resource.js";
|
|
7
7
|
import { createAppsDatabase } from "./schema.js";
|
|
8
|
-
function database(args) {
|
|
9
|
-
if (args.
|
|
10
|
-
|
|
8
|
+
function database(databaseResourceId, args) {
|
|
9
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) {
|
|
10
|
+
throw new Error("Notion-as-Code database arguments must be an object");
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const parentValue = args.parent;
|
|
13
|
+
if (parentValue !== void 0) {
|
|
14
|
+
assertParent(parentValue);
|
|
15
|
+
}
|
|
16
|
+
const parent = parentValue ?? {
|
|
13
17
|
type: "resourceId",
|
|
14
18
|
resourceId: APPS_WORKSPACE_RESOURCE_ID
|
|
15
19
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
return buildDatabaseHandle(databaseResourceId, args, parent);
|
|
21
|
+
}
|
|
22
|
+
function createChildDatabase(parent) {
|
|
23
|
+
assertParent(parent);
|
|
24
|
+
function addDatabase(databaseResourceId, args) {
|
|
25
|
+
return buildDatabaseHandle(databaseResourceId, args, parent);
|
|
26
|
+
}
|
|
27
|
+
return addDatabase;
|
|
28
|
+
}
|
|
29
|
+
function buildDatabaseHandle(databaseResourceId, args, parent) {
|
|
30
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) {
|
|
31
|
+
throw new Error("Notion-as-Code database arguments must be an object");
|
|
32
|
+
}
|
|
33
|
+
if (typeof databaseResourceId !== "string") {
|
|
34
|
+
throw new Error("Notion-as-Code database resourceId must be a string");
|
|
35
|
+
}
|
|
36
|
+
assertUserResourceId(databaseResourceId);
|
|
37
|
+
const hasSchema = Object.prototype.hasOwnProperty.call(args, "schema");
|
|
38
|
+
const hasDataSources = Object.prototype.hasOwnProperty.call(args, "datasources");
|
|
39
|
+
if (hasSchema && hasDataSources) {
|
|
40
|
+
throw new Error("Specify either schema or datasources, not both");
|
|
41
|
+
}
|
|
42
|
+
if (args.schema !== void 0) {
|
|
21
43
|
const source = {
|
|
22
|
-
resourceId:
|
|
44
|
+
resourceId: args.dataSourceResourceId,
|
|
23
45
|
name: args.name,
|
|
24
|
-
properties
|
|
46
|
+
properties: normalizeProperties(args.schema)
|
|
47
|
+
};
|
|
48
|
+
const handle = recordDatabase(databaseResourceId, args, parent, [
|
|
49
|
+
{ key: "dataSource", schema: args.schema, definition: source }
|
|
50
|
+
]);
|
|
51
|
+
const dataSource = handle.datasources.dataSource;
|
|
52
|
+
if (dataSource === void 0) {
|
|
53
|
+
throw new Error(`Database "${databaseResourceId}" is missing its data source`);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
resourceId: databaseResourceId,
|
|
57
|
+
dataSource,
|
|
58
|
+
addView: handle.addView
|
|
25
59
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
throw new Error(
|
|
60
|
+
}
|
|
61
|
+
if (args.datasources !== void 0) {
|
|
62
|
+
if (typeof args.datasources !== "object" || args.datasources === null || Array.isArray(args.datasources)) {
|
|
63
|
+
throw new Error("Notion-as-Code datasources must be an object");
|
|
30
64
|
}
|
|
31
|
-
|
|
65
|
+
const sourceEntries = Object.entries(args.datasources).map(
|
|
66
|
+
([key, sourceArgs]) => normalizeDataSource(key, sourceArgs)
|
|
67
|
+
);
|
|
68
|
+
return recordDatabase(databaseResourceId, args, parent, sourceEntries);
|
|
32
69
|
}
|
|
33
|
-
return
|
|
70
|
+
return recordDatabase(databaseResourceId, args, parent, []);
|
|
34
71
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
72
|
+
function normalizeDatabaseMetadata(args) {
|
|
73
|
+
const {
|
|
74
|
+
parent: _parent,
|
|
75
|
+
schema: _schema,
|
|
76
|
+
datasources: _datasources,
|
|
77
|
+
dataSourceResourceId: _dataSourceResourceId,
|
|
78
|
+
...metadata
|
|
79
|
+
} = args;
|
|
80
|
+
return metadata;
|
|
81
|
+
}
|
|
82
|
+
function normalizeDataSource(key, sourceArgs) {
|
|
83
|
+
if (typeof sourceArgs !== "object" || sourceArgs === null || Array.isArray(sourceArgs)) {
|
|
84
|
+
throw new Error(`Data source "${key}" must be an object`);
|
|
85
|
+
}
|
|
86
|
+
const { schema, ...sourceMetadata } = sourceArgs;
|
|
87
|
+
return {
|
|
88
|
+
key,
|
|
89
|
+
schema,
|
|
90
|
+
definition: {
|
|
91
|
+
...sourceMetadata,
|
|
92
|
+
name: key,
|
|
93
|
+
properties: normalizeProperties(schema)
|
|
39
94
|
}
|
|
40
|
-
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function normalizeProperties(schema) {
|
|
98
|
+
if (typeof schema !== "object" || schema === null || Array.isArray(schema)) {
|
|
99
|
+
throw new Error("Notion-as-Code schema must be an object");
|
|
41
100
|
}
|
|
42
|
-
|
|
101
|
+
const properties = [];
|
|
102
|
+
for (const [key, propertyConfig] of Object.entries(schema)) {
|
|
103
|
+
if (typeof propertyConfig !== "object" || propertyConfig === null || Array.isArray(propertyConfig)) {
|
|
104
|
+
throw new Error(`Property "${key}" must be an object`);
|
|
105
|
+
}
|
|
106
|
+
if (typeof propertyConfig.resourceId !== "string") {
|
|
107
|
+
throw new Error(`Property "${key}" must specify a resourceId`);
|
|
108
|
+
}
|
|
109
|
+
properties.push({
|
|
110
|
+
...propertyConfig,
|
|
111
|
+
name: key
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return properties;
|
|
43
115
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
116
|
+
function assertSourceOrView(sourceEntries, views) {
|
|
117
|
+
if (views !== void 0 && !Array.isArray(views)) {
|
|
118
|
+
throw new Error("Notion-as-Code database views must be an array");
|
|
119
|
+
}
|
|
120
|
+
if (sourceEntries.length === 0 && (!Array.isArray(views) || views.length === 0)) {
|
|
121
|
+
throw new Error("Notion-as-Code database must define a data source or view");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function recordDatabase(databaseResourceId, args, parent, sourceEntries) {
|
|
125
|
+
const metadata = normalizeDatabaseMetadata(args);
|
|
126
|
+
assertSourceOrView(sourceEntries, metadata.views);
|
|
127
|
+
const intent = {
|
|
128
|
+
...metadata,
|
|
129
|
+
resourceId: databaseResourceId,
|
|
130
|
+
parent,
|
|
131
|
+
dataSources: sourceEntries.map(({ definition }) => definition)
|
|
132
|
+
};
|
|
133
|
+
return createDatabase(intent, sourceEntries);
|
|
134
|
+
}
|
|
135
|
+
function createDatabase(intent, sourceEntries) {
|
|
136
|
+
assertUserResourceId(intent.resourceId);
|
|
47
137
|
const dataSourceIds = /* @__PURE__ */ new Set();
|
|
48
|
-
const handles =
|
|
49
|
-
for (const
|
|
50
|
-
|
|
51
|
-
|
|
138
|
+
const handles = /* @__PURE__ */ Object.create(null);
|
|
139
|
+
for (const { key, schema, definition } of sourceEntries) {
|
|
140
|
+
if (typeof definition.resourceId !== "string") {
|
|
141
|
+
throw new Error(`Data source "${key}" must specify a resourceId`);
|
|
142
|
+
}
|
|
143
|
+
assertUserResourceId(definition.resourceId);
|
|
144
|
+
if (dataSourceIds.has(definition.resourceId)) {
|
|
52
145
|
throw new Error(
|
|
53
|
-
`Database "${
|
|
146
|
+
`Database "${intent.resourceId}" has duplicate data source "${definition.resourceId}"`
|
|
54
147
|
);
|
|
55
148
|
}
|
|
56
|
-
dataSourceIds.add(
|
|
57
|
-
handles[
|
|
149
|
+
dataSourceIds.add(definition.resourceId);
|
|
150
|
+
handles[key] = createDataSourceHandle(definition, schema);
|
|
58
151
|
}
|
|
59
|
-
recordIntent({
|
|
60
|
-
type: "database",
|
|
61
|
-
...args,
|
|
62
|
-
parent,
|
|
63
|
-
dataSources: [...dataSources]
|
|
64
|
-
});
|
|
152
|
+
recordIntent({ ...intent, type: "database" });
|
|
65
153
|
return {
|
|
66
|
-
resourceId:
|
|
67
|
-
|
|
154
|
+
resourceId: intent.resourceId,
|
|
155
|
+
datasources: handles,
|
|
68
156
|
addView(view) {
|
|
69
|
-
recordIntent({ type: "view", databaseResourceId:
|
|
157
|
+
recordIntent({ type: "view", databaseResourceId: intent.resourceId, view });
|
|
70
158
|
}
|
|
71
159
|
};
|
|
72
160
|
}
|
|
73
|
-
function createDataSourceHandle(dataSource) {
|
|
161
|
+
function createDataSourceHandle(dataSource, schema) {
|
|
74
162
|
const propertyResourceIds = /* @__PURE__ */ new Set();
|
|
75
163
|
const propertyNames = /* @__PURE__ */ new Set();
|
|
76
164
|
for (const property of dataSource.properties) {
|
|
@@ -90,7 +178,7 @@ function createDataSourceHandle(dataSource) {
|
|
|
90
178
|
}
|
|
91
179
|
return {
|
|
92
180
|
resourceId: dataSource.resourceId,
|
|
93
|
-
schema
|
|
181
|
+
schema,
|
|
94
182
|
database: createAppsDatabase(dataSource.resourceId, dataSource),
|
|
95
183
|
addPage(pageArgs) {
|
|
96
184
|
return createPage(pageArgs, { type: "resourceId", resourceId: dataSource.resourceId });
|
|
@@ -99,6 +187,5 @@ function createDataSourceHandle(dataSource) {
|
|
|
99
187
|
}
|
|
100
188
|
export {
|
|
101
189
|
createChildDatabase,
|
|
102
|
-
createDatabase,
|
|
103
190
|
database
|
|
104
191
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.test.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/database.test.ts"],"names":[],"mappings":""}
|
|
@@ -3,11 +3,13 @@ import { database } from "./database.js";
|
|
|
3
3
|
import { date, datetime } from "./date.js";
|
|
4
4
|
import { page } from "./page.js";
|
|
5
5
|
import { teamspace } from "./teamspace.js";
|
|
6
|
+
import { view } from "./view.js";
|
|
6
7
|
declare const notionAsCodeFacade: {
|
|
7
8
|
teamspace: typeof teamspace;
|
|
8
9
|
database: typeof database;
|
|
9
10
|
page: typeof page;
|
|
10
11
|
customAgent: typeof customAgent;
|
|
12
|
+
view: typeof view;
|
|
11
13
|
text: (value: string) => string[][];
|
|
12
14
|
number: (value: number) => string[][];
|
|
13
15
|
date: typeof date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/handles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/handles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,QAAA,MAAM,kBAAkB;;;;;;kBAMT,MAAM;oBACJ,MAAM;;;oBAGN,MAAM;oBACN,MAAM;0BACA,SAAS,MAAM,EAAE;sBACrB,OAAO;iBACZ,MAAM;mBACJ,MAAM;mBACN,MAAM;sBACH,MAAM,GAAG,SAAS,MAAM,EAAE;uBACzB,MAAM;;;;CAIzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D,iFAAiF;AACjF,wBAAgB,YAAY,IAAI,kBAAkB,CAEjD"}
|
|
@@ -4,11 +4,13 @@ import { date, datetime } from "./date.js";
|
|
|
4
4
|
import { page } from "./page.js";
|
|
5
5
|
import { assertUserResourceId } from "./resource.js";
|
|
6
6
|
import { teamspace } from "./teamspace.js";
|
|
7
|
+
import { view } from "./view.js";
|
|
7
8
|
const notionAsCodeFacade = {
|
|
8
9
|
teamspace,
|
|
9
10
|
database,
|
|
10
11
|
page,
|
|
11
12
|
customAgent,
|
|
13
|
+
view,
|
|
12
14
|
text: (value) => [[value]],
|
|
13
15
|
number: (value) => [[String(value)]],
|
|
14
16
|
date,
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
export { APPS_RESERVED_RESOURCE_ID_PREFIX, APPS_WORKSPACE_RESOURCE_ID } from "./intents.js";
|
|
2
|
-
export type { DataSourceDefinition, NotionAsCodeProperty, Parent } from "./intents.js";
|
|
2
|
+
export type { DatabaseIntent, DataSourceDefinition, NotionAsCodeIcon, NotionAsCodeProperty, NotionAsCodePropertyConfig, NotionAsCodeSchema, NotionAsCodeSelectOption, NotionAsCodeStatusOption, Parent, ResourceId, } from "./intents.js";
|
|
3
3
|
export type { CustomAgentArgs, CustomAgentHandle } from "./custom-agent.js";
|
|
4
|
-
export type { ChildDatabaseArgs, ChildDatabaseFactory, ChildSingleSourceDatabaseArgs, DataSourceHandle, DatabaseArgs, DatabaseHandle, SingleSourceDatabaseArgs, SingleSourceDatabaseHandle, } from "./database.js";
|
|
4
|
+
export type { ChildDatabaseArgs, ChildDatabaseFactory, ChildMultiSourceDatabaseArgs, ChildSingleSourceDatabaseArgs, DataSourceArgs, DataSourceHandle, DataSourceMap, DatabaseArgs, DatabaseHandle, MultiSourceDatabaseArgs, SingleSourceDatabaseArgs, SingleSourceDatabaseHandle, } from "./database.js";
|
|
5
5
|
export type { ChildPageArgs, PageArgs, PageHandle } from "./page.js";
|
|
6
6
|
export type { TeamspaceArgs, TeamspaceHandle } from "./teamspace.js";
|
|
7
|
+
export type { ViewArgs, ViewHandle } from "./view.js";
|
|
8
|
+
export type { AdvancedFilterSchema, BasePropertyFilter, BaseViewSchema, BoardViewSchema, CalendarViewSchema, CheckboxGroupByFormat, CheckboxPropertyFilter, CoverAspectFormat, CoverFormat, CoverSizeFormat, DatabaseViewSortDirection, DateFilterMode, DateGroupByFormat, DatePropertyFilter, DatePropertyFilterValue, DatePropertyTypes, ExactDatePropertyFilterValue, ExactRangeDatePropertyFilterValue, FeedViewSchema, FilterSchema, FormulaGroupByFormat, GalleryViewSchema, GroupByFormat, GroupByFormatBase, GroupFormat, ListViewSchema, LocationGroupByFormat, MultiSelectPropertyFilter, NumberGroupByFormat, NumberPropertyFilter, PersonGroupByFormat, PersonPropertyFilter, PropertyFilterSchema, PropertyFormat, PropertyViewSortSchema, PropertyVisibility, RelationGroupByFormat, RelationPropertyFilter, RelativeDatePreset, RelativeDatePropertyFilterValue, RelativeDateRangeUnit, RelativeToTodayDatePropertyFilterValue, SelectGroupByFormat, SelectPropertyFilter, StatusGroupByFormat, StatusPropertyFilter, TableViewSchema, TextGroupByFormat, TextPropertyFilter, TimelineViewSchema, ViewSchema, ViewType, } from "./views.js";
|
|
7
9
|
/** Experimental Notion-as-Code facade for Apps SDK project metadata. */
|
|
8
10
|
export declare const notion: {
|
|
9
11
|
teamspace: typeof import("./teamspace.js").teamspace;
|
|
10
12
|
database: typeof import("./database.js").database;
|
|
11
13
|
page: typeof import("./page.js").page;
|
|
12
14
|
customAgent: typeof import("./custom-agent.js").customAgent;
|
|
15
|
+
view: typeof import("./view.js").view;
|
|
13
16
|
text: (value: string) => string[][];
|
|
14
17
|
number: (value: number) => string[][];
|
|
15
18
|
date: typeof import("./date.js").date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC5F,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC5F,YAAY,EACX,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,EACN,UAAU,GACV,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC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7 @@
|
|
|
1
1
|
import type { CustomAgentArgs } from "./custom-agent.js";
|
|
2
|
-
import type { DatabaseArgs } from "./database.js";
|
|
3
2
|
import type { PageArgs } from "./page.js";
|
|
4
3
|
import type { TeamspaceArgs } from "./teamspace.js";
|
|
4
|
+
import type { ViewSchema } from "./views.js";
|
|
5
5
|
/** Apps-specific resource IDs used while declaring Notion-as-Code metadata. */
|
|
6
6
|
/** Synthetic workspace parent for teamspaces declared by an Apps project. */
|
|
7
7
|
export declare const APPS_WORKSPACE_RESOURCE_ID = "__notion_apps_workspace__";
|
|
@@ -43,6 +43,7 @@ type UnsupportedProperty = PropertyBase & {
|
|
|
43
43
|
type: "relation" | "formula" | "rollup" | "created_time" | "last_edited_time" | "created_by" | "last_edited_by" | "auto_increment_id" | "person" | "verification";
|
|
44
44
|
[key: string]: unknown;
|
|
45
45
|
};
|
|
46
|
+
/** A normalized Notion-as-Code property with its resolved display name. */
|
|
46
47
|
export type NotionAsCodeProperty = (PropertyBase & {
|
|
47
48
|
type: "title";
|
|
48
49
|
}) | (PropertyBase & {
|
|
@@ -81,6 +82,24 @@ export type NotionAsCodeProperty = (PropertyBase & {
|
|
|
81
82
|
}) | (PropertyBase & {
|
|
82
83
|
type: "file";
|
|
83
84
|
}) | UnsupportedProperty;
|
|
85
|
+
/**
|
|
86
|
+
* `T extends unknown` applies Omit to each property variant separately, preserving
|
|
87
|
+
* variant-specific fields such as required status options. Plain Omit on the union
|
|
88
|
+
* would retain only shared keys. Pick also restores type/resourceId on the
|
|
89
|
+
* unsupported variant, whose string index signature would otherwise erase them.
|
|
90
|
+
*/
|
|
91
|
+
type DistributivePropertyConfig<T extends NotionAsCodeProperty> = T extends unknown ? Omit<T, "name"> & Pick<T, "type" | "resourceId"> : never;
|
|
92
|
+
/**
|
|
93
|
+
* Authoring properties are keyed by their schema object name. A property-level
|
|
94
|
+
* `name` override would make the key and serialized property diverge, so it is
|
|
95
|
+
* explicitly rejected even for the string-indexed unsupported-property variant.
|
|
96
|
+
*/
|
|
97
|
+
export type NotionAsCodePropertyConfig = DistributivePropertyConfig<NotionAsCodeProperty> & {
|
|
98
|
+
name?: never;
|
|
99
|
+
};
|
|
100
|
+
/** A keyed property schema, with object keys supplying serialized property names. */
|
|
101
|
+
export type NotionAsCodeSchema = Record<string, NotionAsCodePropertyConfig>;
|
|
102
|
+
/** The normalized data-source shape emitted in provisioning artifacts. */
|
|
84
103
|
export type DataSourceDefinition<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = {
|
|
85
104
|
resourceId: ResourceId;
|
|
86
105
|
name: string;
|
|
@@ -91,9 +110,23 @@ export type DataSourceDefinition<Properties extends readonly NotionAsCodePropert
|
|
|
91
110
|
export type TeamspaceIntent = TeamspaceArgs & {
|
|
92
111
|
parent: Parent;
|
|
93
112
|
};
|
|
94
|
-
|
|
113
|
+
/**
|
|
114
|
+
* The normalized database shape emitted in provisioning artifacts.
|
|
115
|
+
*
|
|
116
|
+
* This intentionally does not depend on the authoring argument shape. Authoring
|
|
117
|
+
* accepts keyed schemas and data-source maps; the recorder always stores arrays.
|
|
118
|
+
*/
|
|
119
|
+
export type DatabaseIntent = {
|
|
120
|
+
resourceId: ResourceId;
|
|
95
121
|
parent: Parent;
|
|
96
122
|
dataSources: readonly DataSourceDefinition[];
|
|
123
|
+
views?: readonly ViewSchema[];
|
|
124
|
+
icon?: NotionAsCodeIcon;
|
|
125
|
+
cover?: unknown;
|
|
126
|
+
hideDataSourceTitle?: boolean;
|
|
127
|
+
hideDatabaseTitleIfEmpty?: boolean;
|
|
128
|
+
name?: string;
|
|
129
|
+
description?: string;
|
|
97
130
|
};
|
|
98
131
|
export type PageIntent = PageArgs & {
|
|
99
132
|
parent: Parent;
|
|
@@ -101,7 +134,7 @@ export type PageIntent = PageArgs & {
|
|
|
101
134
|
export type CustomAgentIntent = CustomAgentArgs;
|
|
102
135
|
export type ViewIntent = {
|
|
103
136
|
databaseResourceId: ResourceId;
|
|
104
|
-
view:
|
|
137
|
+
view: ViewSchema;
|
|
105
138
|
};
|
|
106
139
|
export type InfraAsCodeIntent = ({
|
|
107
140
|
type: "teamspace";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/intents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/intents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,+EAA+E;AAC/E,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,kEAAkE;AAClE,eAAO,MAAM,gCAAgC,mBAAmB,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACzB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAE5C,MAAM,MAAM,uBAAuB,GAChC,SAAS,GACT,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ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M,CAAA;CAAE,GAAG,UAAU,CAAC,GAC/B,CAAC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GAAG,iBAAiB,CAAC,GAC9C,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Database } from "../database.js";
|
|
2
2
|
import type { PropertyConfiguration } from "../schema.js";
|
|
3
3
|
import type { SelectOption, StatusGroup } from "../types.js";
|
|
4
|
-
import type { DataSourceDefinition,
|
|
5
|
-
type AppsPropertyFor<Property extends
|
|
4
|
+
import type { DataSourceDefinition, NotionAsCodePropertyConfig, NotionAsCodeSchema } from "./intents.js";
|
|
5
|
+
type AppsPropertyFor<Property extends NotionAsCodePropertyConfig> = Property extends {
|
|
6
6
|
type: "title";
|
|
7
7
|
} ? {
|
|
8
8
|
type: "title";
|
|
@@ -54,8 +54,12 @@ type AppsPropertyFor<Property extends NotionAsCodeProperty> = Property extends {
|
|
|
54
54
|
} ? {
|
|
55
55
|
type: "file";
|
|
56
56
|
} : PropertyConfiguration;
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Map keyed authoring properties to the Apps schema used by sync handlers. The explicit
|
|
59
|
+
* string-key mapping avoids a homomorphic mapped type interfering with `NoInfer` key checks.
|
|
60
|
+
*/
|
|
61
|
+
export type AppsSchemaForSchema<Schema extends NotionAsCodeSchema> = {
|
|
62
|
+
[Property in keyof Schema & string]: AppsPropertyFor<Schema[Property]>;
|
|
59
63
|
};
|
|
60
64
|
/** Convert a Notion-as-Code data source into the Apps database used by sync handlers. */
|
|
61
65
|
export declare function createAppsDatabase(databaseKey: string, dataSource: DataSourceDefinition): Database;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,gB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;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,GACzC,QAAQ,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB,QAAQ,SAAS;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB,QAAQ,SAAS;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf,QAAQ,SAAS;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB,QAAQ,SAAS;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB,QAAQ,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB,qBAAqB,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,kBAAkB,IAAI;KACnE,QAAQ,IAAI,MAAM,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;CACtE,CAAC;AAEF,yFAAyF;AACzF,wBAAgB,kBAAkB,CACjC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,oBAAoB,GAC9B,QAAQ,CAsCV"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResourceId } from "./intents.js";
|
|
2
|
+
import type { ViewSchema } from "./views.js";
|
|
3
|
+
/** Declare a view attached to a database resource. */
|
|
4
|
+
export type ViewArgs = ViewSchema & {
|
|
5
|
+
databaseResourceId: ResourceId;
|
|
6
|
+
};
|
|
7
|
+
export type ViewHandle = {
|
|
8
|
+
readonly resourceId: string;
|
|
9
|
+
};
|
|
10
|
+
/** Record a database view for provisioning without making a Notion API request. */
|
|
11
|
+
export declare function view(args: ViewArgs): ViewHandle;
|
|
12
|
+
//# sourceMappingURL=view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,sDAAsD;AACtD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG;IACnC,kBAAkB,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAO/C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { recordIntent } from "./recorder.js";
|
|
2
|
+
import { assertUserResourceId } from "./resource.js";
|
|
3
|
+
function view(args) {
|
|
4
|
+
assertUserResourceId(args.resourceId);
|
|
5
|
+
assertUserResourceId(args.databaseResourceId);
|
|
6
|
+
assertUserResourceId(args.dataSourceResourceId);
|
|
7
|
+
const { databaseResourceId, ...schema } = args;
|
|
8
|
+
recordIntent({ type: "view", databaseResourceId, view: schema });
|
|
9
|
+
return { resourceId: args.resourceId };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
view
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views-types.test.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/views-types.test.ts"],"names":[],"mappings":""}
|