@notionhq/apps 0.0.17 → 0.0.19

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.
Files changed (67) hide show
  1. package/AGENTS.md +27 -0
  2. package/README.md +77 -35
  3. package/dist/cli/build.d.ts.map +1 -1
  4. package/dist/cli/build.js +12 -7
  5. package/dist/cli/emit-manifest.d.ts +1 -1
  6. package/dist/cli/emit-manifest.d.ts.map +1 -1
  7. package/dist/cli/emit-manifest.js +66 -1
  8. package/dist/index.d.ts +2 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +3 -1
  11. package/dist/notion-as-code/custom-agent.d.ts +1 -0
  12. package/dist/notion-as-code/custom-agent.d.ts.map +1 -1
  13. package/dist/notion-as-code/custom-agent.js +1 -1
  14. package/dist/notion-as-code/database.d.ts +90 -48
  15. package/dist/notion-as-code/database.d.ts.map +1 -1
  16. package/dist/notion-as-code/database.js +135 -45
  17. package/dist/notion-as-code/database.test.d.ts +2 -0
  18. package/dist/notion-as-code/database.test.d.ts.map +1 -0
  19. package/dist/notion-as-code/index.d.ts +2 -2
  20. package/dist/notion-as-code/index.d.ts.map +1 -1
  21. package/dist/notion-as-code/intents.d.ts +34 -2
  22. package/dist/notion-as-code/intents.d.ts.map +1 -1
  23. package/dist/notion-as-code/page.d.ts +1 -0
  24. package/dist/notion-as-code/page.d.ts.map +1 -1
  25. package/dist/notion-as-code/page.js +1 -0
  26. package/dist/notion-as-code/schema.d.ts +8 -4
  27. package/dist/notion-as-code/schema.d.ts.map +1 -1
  28. package/dist/notion-as-code/views.d.ts +29 -10
  29. package/dist/notion-as-code/views.d.ts.map +1 -1
  30. package/dist/sync.d.ts +33 -15
  31. package/dist/sync.d.ts.map +1 -1
  32. package/dist/sync.js +12 -0
  33. package/dist/workflow-access-types.test.d.ts +2 -0
  34. package/dist/workflow-access-types.test.d.ts.map +1 -0
  35. package/dist/workflow-access.d.ts +68 -0
  36. package/dist/workflow-access.d.ts.map +1 -0
  37. package/dist/workflow-access.js +135 -0
  38. package/dist/workflow-state.d.ts +13 -0
  39. package/dist/workflow-state.d.ts.map +1 -0
  40. package/dist/workflow-state.js +107 -0
  41. package/dist/workflow.d.ts +65 -9
  42. package/dist/workflow.d.ts.map +1 -1
  43. package/dist/workflow.js +119 -5
  44. package/docs/BUILD.md +134 -4
  45. package/package.json +1 -1
  46. package/skills/notion-as-code/SKILL.md +89 -49
  47. package/skills/sync/SKILL.md +21 -18
  48. package/skills/workflow/SKILL.md +101 -17
  49. package/src/cli/build.test.ts +148 -64
  50. package/src/cli/build.ts +13 -8
  51. package/src/cli/emit-manifest.ts +107 -0
  52. package/src/index.ts +21 -1
  53. package/src/notion-as-code/custom-agent.ts +2 -1
  54. package/src/notion-as-code/database.test.ts +661 -0
  55. package/src/notion-as-code/database.ts +349 -127
  56. package/src/notion-as-code/index.ts +16 -1
  57. package/src/notion-as-code/intents.ts +39 -2
  58. package/src/notion-as-code/page.ts +2 -0
  59. package/src/notion-as-code/schema.ts +11 -3
  60. package/src/notion-as-code/views.ts +29 -10
  61. package/src/sync.test.ts +295 -0
  62. package/src/sync.ts +85 -21
  63. package/src/workflow-access-types.test.ts +69 -0
  64. package/src/workflow-access.ts +299 -0
  65. package/src/workflow-state.ts +152 -0
  66. package/src/workflow.test.ts +441 -1
  67. package/src/workflow.ts +230 -13
package/AGENTS.md CHANGED
@@ -11,3 +11,30 @@ matching skill:
11
11
 
12
12
  Resolve these links relative to this package directory. Check the installed SDK
13
13
  declarations for current API details.
14
+
15
+ ## Pull requests for SDK changes
16
+
17
+ For a change to the public SDK, show the user-facing code change in the pull
18
+ request body. Put a short, complete example near the top:
19
+
20
+ ````md
21
+ ## User code
22
+
23
+ ### Before
24
+
25
+ ```ts
26
+ // Existing app code
27
+ ```
28
+
29
+ ### After
30
+
31
+ ```ts
32
+ // Updated app code
33
+ ```
34
+ ````
35
+
36
+ Use the same small example in both sections so reviewers can compare them
37
+ quickly. Include imports and the call that changed when they matter. Show
38
+ normal app code, not internal types, tests, generated files, or provisioning
39
+ output. Explain any required migration steps in plain language below the
40
+ example.
package/README.md CHANGED
@@ -108,6 +108,23 @@ Use `context.notion` for Notion API calls. Deployed apps receive Notion API
108
108
  credentials automatically, so do not configure or push `NOTION_API_TOKEN`.
109
109
  Local execution needs the token in `.env` before making a Notion API request.
110
110
 
111
+ For a resource declared with Notion as Code, add a named runtime binding with
112
+ `access: { handbook: { resource: handbook, level: "view" } }`. Cloud deployment
113
+ resolves the declaration's NaC `resourceId` to a live ID and exposes it to the
114
+ handler as `context.access.handbook.id`. Deployment also reconciles the declared
115
+ access through the existing Notion-module permissions. Those permissions, not
116
+ the bindings, authorize `context.notion` calls.
117
+
118
+ Resources granted to the workflow in Notion's UI do not need an `access` entry, a
119
+ NaC declaration, or a NaC `resourceId`. Pass the live record ID directly to the
120
+ appropriate `context.notion` call, for example
121
+ `context.notion.pages.retrieve({ page_id: "page-id" })`; the call remains subject
122
+ to the existing workflow permissions. UI grants do not create `context.access`
123
+ aliases. Pages, databases, data sources, and custom agents are supported by
124
+ named bindings. Workflows with nonempty `access` cannot use `--local-build`.
125
+ See the [workflow skill](./skills/workflow/SKILL.md#resources-created-with-the-app)
126
+ for access levels and a complete example.
127
+
111
128
  ## Data-source syncs
112
129
 
113
130
  Declare a database with Notion as Code, then pass one of its data-source handles to `sync`:
@@ -116,22 +133,17 @@ Declare a database with Notion as Code, then pass one of its data-source handles
116
133
  import { database, sync } from "@notionhq/apps";
117
134
  import { Builder } from "@notionhq/apps/builder";
118
135
 
119
- const issues = database({
120
- resourceId: "issues-db",
121
- dataSources: [
122
- {
123
- resourceId: "issues-source",
124
- name: "GitHub Issues",
125
- properties: [
126
- { resourceId: "name", name: "Name", type: "title" },
127
- { resourceId: "github-id", name: "GitHub ID", type: "text" },
128
- ],
129
- },
130
- ],
136
+ const issues = database("issues-db", {
137
+ dataSourceResourceId: "issues-source",
138
+ name: "GitHub Issues",
139
+ schema: {
140
+ Name: { resourceId: "name", type: "title" },
141
+ "GitHub ID": { resourceId: "github-id", type: "text" },
142
+ },
131
143
  });
132
144
 
133
145
  export default sync({
134
- dataSource: issues.dataSources["issues-source"],
146
+ dataSource: issues.dataSource,
135
147
  primaryKey: "GitHub ID",
136
148
  handler: async () => ({
137
149
  changes: [
@@ -146,40 +158,70 @@ export default sync({
146
158
  ```
147
159
 
148
160
  Put each default-exported sync directly in `src/syncs/`. A primary key must be a title
149
- or text property. Do not include that property in an upsert: the SDK fills it from
150
- the change's `key`.
161
+ or text property. Each upsert must include at least one known non-primary-key schema
162
+ property, while any other non-primary-key properties may be omitted; unknown property keys
163
+ are rejected by TypeScript. Do not include the primary-key property in an upsert: the SDK
164
+ fills it from the change's `key`.
151
165
 
152
166
  ## Notion-as-Code databases
153
167
 
154
- Use `properties` to declare a database with one data source:
168
+ Use `schema` and an explicit `dataSourceResourceId` to declare a database with one data source:
155
169
 
156
170
  ```ts
157
171
  import { notion } from "@notionhq/apps/notion-as-code";
158
172
 
159
- const issues = notion.database({
160
- resourceId: "branch-check-issues",
173
+ const singleSourceIssues = notion.database("branch-check-issues", {
174
+ dataSourceResourceId: "branch-check-issues-source",
161
175
  name: "Issues",
162
- properties: [
163
- { resourceId: "issue-title", name: "Name", type: "title" },
164
- { resourceId: "issue-id", name: "ID", type: "text" },
165
- ],
176
+ schema: {
177
+ Name: { resourceId: "issue-title", type: "title" },
178
+ ID: { resourceId: "issue-id", type: "text" },
179
+ },
166
180
  });
167
181
  ```
168
182
 
169
- Pass `issues.dataSource` as the `dataSource` argument to `sync` from `@notionhq/apps`, or use
170
- `issues.dataSource.addPage(...)` to declare a page in the source. The database still exposes
171
- `dataSources` and `addView`.
183
+ Pass `singleSourceIssues.dataSource` as the `dataSource` argument to `sync` from `@notionhq/apps`, or use
184
+ `singleSourceIssues.dataSource.addPage(...)` to declare a page in the source. Both database forms expose `addView`.
172
185
 
173
- For explicit sources, keep using `notion.database({ resourceId, dataSources: [...] })`
174
- and access each source through `handle.dataSources[sourceResourceId]`.
175
- `properties` and `dataSources` are mutually exclusive. Both forms also work with
176
- page and teamspace `addDatabase` helpers.
186
+ For multiple sources, use `datasources` instead of the top-level `schema`:
187
+
188
+ ```ts
189
+ const issues = notion.database("issues-db", {
190
+ datasources: {
191
+ Issues: {
192
+ resourceId: "issues-source",
193
+ schema: {
194
+ Name: { resourceId: "issue-title", type: "title" },
195
+ "GitHub ID": { resourceId: "github-id", type: "text" },
196
+ },
197
+ },
198
+ },
199
+ });
200
+
201
+ issues.datasources.Issues.schema.Name;
202
+ ```
177
203
 
178
- The shorthand emits the existing database intent with one source named after the
179
- database and identified by `${resourceId}-source`. That ID must be globally unique.
180
- When converting an existing explicit declaration, use the shorthand only if its
181
- source already has that ID; changing the source ID creates a different resource.
182
- No top-level `properties` field is added to the database intent.
204
+ `schema` and `datasources` are mutually exclusive. A database declaration must
205
+ include at least one data source or at least one view. A linked-only database
206
+ may omit `datasources`, or use `datasources: {}`, only when `views` is nonempty;
207
+ `{}`, `{ datasources: {} }`, and `{ datasources: {}, views: [] }` are invalid.
208
+ Page and teamspace child helpers accept the same forms through
209
+ `page.addDatabase("database-id", args)` and `teamspace.addDatabase("database-id", args)`.
210
+
211
+ Each `datasources` key is the source's name, and each `schema` key is the
212
+ property's name used for typed access, sync keys, and serialized properties.
213
+ Nested data-source configs and property configs do not accept `name`. The
214
+ top-level database `name` remains supported; in the single-source shorthand it
215
+ supplies both the database and data-source display names. In a multi-source
216
+ declaration, it names the database while each data-source name comes from its key.
217
+
218
+ All database, source, and property IDs remain explicit and must be globally unique.
219
+ No IDs are generated from keys or names. The build emits the existing `dataSources`
220
+ and `properties` arrays with exact IDs and names from those keys; authoring
221
+ `schema`, `datasources`, and database-level `dataSourceResourceId` fields do not
222
+ leak into the serialized database intent. The provisioning JSON envelope and
223
+ server API are unchanged. See [the build guide](docs/BUILD.md#declaring-notion-as-code-databases)
224
+ for complete single-, multi-source, and linked-only examples.
183
225
 
184
226
  Declare database views with `views` or `addView`, or use the top-level `view`
185
227
  function from `@notionhq/apps` (`notion.view` is also available). The standalone
@@ -196,7 +238,7 @@ view({
196
238
  databaseResourceId: issues.resourceId,
197
239
  resourceId: "issues-table",
198
240
  type: "table",
199
- dataSourceResourceId: issues.dataSource.resourceId,
241
+ dataSourceResourceId: issues.datasources.Issues.resourceId,
200
242
  properties: [{ property: "issue-title", visible: true }],
201
243
  sorts: [{ propertyId: "issue-title", direction: "ascending" }],
202
244
  });
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUlD,MAAM,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAwCxE"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUlD,MAAM,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8CxE"}
package/dist/cli/build.js CHANGED
@@ -30,18 +30,23 @@ async function buildApp(projectRoot) {
30
30
  await bundle.close();
31
31
  }
32
32
  const blockConfigs = await buildBlockDeclarations(projectRoot, capabilities);
33
- const manifest = await extractManifest(bundlePath, capabilities, blockConfigs);
34
- const manifestPath = path.join(projectRoot, "dist", "manifest.json");
35
- await fs.promises.writeFile(manifestPath, `${JSON.stringify(manifest, null, " ")}
36
- `);
37
- await emitProvisioningArtifact(
33
+ const entityProvisioning = await buildMetadata(
38
34
  projectRoot,
39
35
  capabilities.filter((capability) => capability.runtime === "worker")
40
36
  );
37
+ const manifest = await extractManifest(
38
+ bundlePath,
39
+ capabilities,
40
+ blockConfigs,
41
+ entityProvisioning
42
+ );
43
+ const manifestPath = path.join(projectRoot, "dist", "manifest.json");
44
+ await fs.promises.writeFile(manifestPath, `${JSON.stringify(manifest, null, " ")}
45
+ `);
46
+ await emitProvisioningArtifact(projectRoot, entityProvisioning);
41
47
  return { manifest, bundlePath, manifestPath };
42
48
  }
43
- async function emitProvisioningArtifact(projectRoot, capabilities) {
44
- const entityProvisioning = await buildMetadata(projectRoot, capabilities);
49
+ async function emitProvisioningArtifact(projectRoot, entityProvisioning) {
45
50
  const provisioningPath = path.join(projectRoot, "dist", "provisioning.json");
46
51
  if (entityProvisioning.intents.length === 0) {
47
52
  await fs.promises.rm(provisioningPath, { force: true });
@@ -2,7 +2,7 @@ import { type RecordedProvisioning } from "../notion-as-code/provisioning.js";
2
2
  import type { AppManifest } from "../manifest.js";
3
3
  import type { DiscoveredCapability } from "./discover.js";
4
4
  /** Extract the app manifest from a built bundle. */
5
- export declare function extractManifest(bundlePath: string, capabilities: readonly DiscoveredCapability[], blockConfigs?: Record<string, unknown>): Promise<AppManifest>;
5
+ export declare function extractManifest(bundlePath: string, capabilities: readonly DiscoveredCapability[], blockConfigs?: Record<string, unknown>, provisioning?: RecordedProvisioning): Promise<AppManifest>;
6
6
  /** Import the metadata bundle and return the provisioning declarations it recorded. */
7
7
  export declare function extractProvisioning(bundlePath: string): Promise<RecordedProvisioning>;
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"emit-manifest.d.ts","sourceRoot":"","sources":["../../src/cli/emit-manifest.ts"],"names":[],"mappings":"AAMA,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,mCAAmC,CAAC;AAC3C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;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAoCjE;AAED,yFAAyF;AACzF,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAE9F"}
@@ -162,7 +162,7 @@ class DatabaseCollector {
162
162
  });
163
163
  }
164
164
  }
165
- async function extractManifest(bundlePath, capabilities, blockConfigs = {}) {
165
+ async function extractManifest(bundlePath, capabilities, blockConfigs = {}, provisioning) {
166
166
  clearRegisteredPacers();
167
167
  const bundle = await importBundle(bundlePath);
168
168
  const registry = getCapabilityRegistry(bundle);
@@ -198,6 +198,9 @@ async function extractManifest(bundlePath, capabilities, blockConfigs = {}) {
198
198
  const { database: _database, ...rest } = config;
199
199
  config = { ...rest, databaseKey };
200
200
  }
201
+ if (capability.type === "workflow") {
202
+ validateWorkflowAccessReferences(config.access, provisioning, capability.sourcePath);
203
+ }
201
204
  assertJsonSafe(config, `${capability.sourcePath} config`);
202
205
  return { type: capability.type, key: capability.key, config };
203
206
  });
@@ -226,6 +229,68 @@ async function extractManifest(bundlePath, capabilities, blockConfigs = {}) {
226
229
  }
227
230
  return manifest;
228
231
  }
232
+ const WORKFLOW_ACCESS_TYPES = {
233
+ page: true,
234
+ database: true,
235
+ dataSource: true,
236
+ customAgent: true
237
+ };
238
+ const WORKFLOW_ACCESS_LEVELS = {
239
+ view: true,
240
+ comment: true,
241
+ edit: true,
242
+ fullAccess: true
243
+ };
244
+ function validateWorkflowAccessReferences(access, provisioning, capabilityPath) {
245
+ if (access === void 0) return;
246
+ if (typeof access !== "object" || access === null || Array.isArray(access) || provisioning === void 0 && Object.keys(access).length > 0) {
247
+ throw new Error(
248
+ `${capabilityPath}: workflow access must reference resources recorded by the current build`
249
+ );
250
+ }
251
+ if (provisioning === void 0) {
252
+ return;
253
+ }
254
+ const accessObject = access;
255
+ const aliases = Object.keys(accessObject);
256
+ if (Reflect.ownKeys(accessObject).length !== aliases.length) {
257
+ throw new Error(`${capabilityPath}: workflow access aliases must be enumerable strings`);
258
+ }
259
+ for (const alias of aliases) {
260
+ if (!/^[a-zA-Z][a-zA-Z0-9_-]{0,127}$/.test(alias) || alias === "__proto__" || alias === "prototype" || alias === "constructor") {
261
+ throw new Error(`${capabilityPath}: invalid workflow access alias "${alias}"`);
262
+ }
263
+ const requirement = accessObject[alias];
264
+ if (typeof requirement !== "object" || requirement === null || Array.isArray(requirement) || Reflect.ownKeys(requirement).length !== 3 || !Object.hasOwn(requirement, "type") || !Object.hasOwn(requirement, "resourceId") || !Object.hasOwn(requirement, "level")) {
265
+ throw new Error(`${capabilityPath}: invalid workflow access requirement "${alias}"`);
266
+ }
267
+ const requirementObject = requirement;
268
+ const type = requirementObject.type;
269
+ const resourceId = requirementObject.resourceId;
270
+ const level = requirementObject.level;
271
+ if (typeof type !== "string" || !Object.hasOwn(WORKFLOW_ACCESS_TYPES, type) || typeof resourceId !== "string" || resourceId.length === 0 || typeof level !== "string" || (type === "customAgent" ? level !== "call" : !Object.hasOwn(WORKFLOW_ACCESS_LEVELS, level))) {
272
+ throw new Error(`${capabilityPath}: invalid workflow access requirement "${alias}"`);
273
+ }
274
+ if (!provisioning.intents.some((intent) => {
275
+ switch (type) {
276
+ case "page":
277
+ return intent.type === "page" && intent.resourceId === resourceId;
278
+ case "database":
279
+ return intent.type === "database" && intent.resourceId === resourceId;
280
+ case "customAgent":
281
+ return intent.type === "custom_agent" && intent.resourceId === resourceId;
282
+ case "dataSource":
283
+ return intent.type === "database" && (intent.dataSources ?? []).some(
284
+ (dataSource) => dataSource.resourceId === resourceId
285
+ );
286
+ }
287
+ })) {
288
+ throw new Error(
289
+ `${capabilityPath}: workflow access "${alias}" references ${type} "${resourceId}" that is not declared by the current build`
290
+ );
291
+ }
292
+ }
293
+ }
229
294
  async function extractProvisioning(bundlePath) {
230
295
  const bundle = await importBundle(bundlePath);
231
296
  if (typeof bundle !== "object" || bundle === null || !("default" in bundle) || !isRecordedProvisioning(bundle.default)) {
package/dist/index.d.ts CHANGED
@@ -5,5 +5,6 @@ export { page } from "./notion-as-code/page.js";
5
5
  export { teamspace } from "./notion-as-code/teamspace.js";
6
6
  export { view } from "./notion-as-code/view.js";
7
7
  export { sync } from "./sync.js";
8
- export { workflow } from "./workflow.js";
8
+ export { workflow, type Workflow, type WorkflowAccess, type WorkflowAccessAgentLevel, type WorkflowAccessBindings, type WorkflowAccessDeclaration, type WorkflowAccessDeclarations, type WorkflowAccessLevel, type WorkflowAccessLevelFor, type WorkflowAccessResource, type WorkflowAccessResourceLevel, type WorkflowAccessResourceType, type WorkflowAccessRequirement, type WorkflowAccessRequirements, type WorkflowAccessValue, type WorkflowConfiguration, type WorkflowContext, type WorkflowTriggerConfiguration, } from "./workflow.js";
9
+ export type { WorkflowState, WorkflowStateValue } from "./workflow-state.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,4BAA4B,GACjC,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -5,7 +5,9 @@ import { page } from "./notion-as-code/page.js";
5
5
  import { teamspace } from "./notion-as-code/teamspace.js";
6
6
  import { view } from "./notion-as-code/view.js";
7
7
  import { sync } from "./sync.js";
8
- import { workflow } from "./workflow.js";
8
+ import {
9
+ workflow
10
+ } from "./workflow.js";
9
11
  export {
10
12
  customAgent,
11
13
  customBlock,
@@ -11,6 +11,7 @@ export type CustomAgentArgs = {
11
11
  triggers?: readonly unknown[];
12
12
  };
13
13
  export type CustomAgentHandle = {
14
+ readonly resourceType: "customAgent";
14
15
  readonly resourceId: string;
15
16
  };
16
17
  /** Declare a custom agent and validate every shared resource reference. */
@@ -1 +1 @@
1
- {"version":3,"file":"custom-agent.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/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;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,iBAAiB,CASpE"}
@@ -6,7 +6,7 @@ function customAgent(args) {
6
6
  assertUserResourceId(resourceId);
7
7
  }
8
8
  recordIntent({ type: "custom_agent", ...args });
9
- return { resourceId: args.resourceId };
9
+ return { resourceType: "customAgent", resourceId: args.resourceId };
10
10
  }
11
11
  export {
12
12
  customAgent
@@ -1,68 +1,110 @@
1
1
  import type { Database } from "../database.js";
2
- import { type DataSourceDefinition, type NotionAsCodeIcon, type NotionAsCodeProperty, type Parent, type ResourceId } from "./intents.js";
2
+ import { type DatabaseIntent, type NotionAsCodeIcon, type NotionAsCodeSchema, type Parent, type ResourceId } from "./intents.js";
3
3
  import { type ChildPageArgs, type PageHandle } from "./page.js";
4
- import { type AppsSchemaForProperties } from "./schema.js";
4
+ import { type AppsSchemaForSchema } from "./schema.js";
5
5
  import type { ViewSchema } from "./views.js";
6
- /** Input for declaring a database and its optional data sources. */
7
- export type DatabaseArgs<DataSources extends readonly DataSourceDefinition[] = readonly DataSourceDefinition[]> = {
6
+ /** Reuse serialized database intent metadata, excluding identity, parent, and sources. */
7
+ type DatabaseMetadata = Omit<DatabaseIntent, "resourceId" | "parent" | "dataSources">;
8
+ type NonEmptyViewSchemas = readonly [ViewSchema, ...ViewSchema[]];
9
+ /** A keyed data-source declaration; the containing map key supplies the serialized source name. */
10
+ export type DataSourceArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
8
11
  resourceId: ResourceId;
9
- /** Omit to create a private top-level database in the Apps workspace. */
10
- parent?: Parent;
11
- dataSources?: DataSources;
12
- views?: readonly ViewSchema[];
12
+ name?: never;
13
+ schema: Schema;
13
14
  icon?: NotionAsCodeIcon;
14
- cover?: unknown;
15
- hideDataSourceTitle?: boolean;
16
- hideDatabaseTitleIfEmpty?: boolean;
17
- name?: string;
18
- description?: string;
19
15
  };
20
- /** Input for adding a database beneath an existing resource. */
21
- export type ChildDatabaseArgs<DataSources extends readonly DataSourceDefinition[] = readonly DataSourceDefinition[]> = Omit<DatabaseArgs<DataSources>, "parent">;
22
- /** Single-source shorthand; the source ID is `${resourceId}-source`. */
23
- export type SingleSourceDatabaseArgs<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = Omit<DatabaseArgs, "dataSources" | "name"> & {
16
+ /** Data sources keyed by the names used to access their handles. */
17
+ export type DataSourceMap = Record<string, DataSourceArgs>;
18
+ /**
19
+ * Single-source inputs require a name for both database and source. `datasources?: never`
20
+ * keeps this form exclusive even when callers pass a predeclared object.
21
+ */
22
+ type SingleSourceDatabaseOptions<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = Omit<DatabaseMetadata, "name"> & {
23
+ dataSourceResourceId: ResourceId;
24
24
  name: string;
25
- properties: Properties;
26
- dataSources?: never;
25
+ schema: Schema;
26
+ datasources?: never;
27
27
  };
28
- export type ChildSingleSourceDatabaseArgs<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = Omit<SingleSourceDatabaseArgs<Properties>, "parent">;
29
- /** Resolves one data source ID to the properties declared for it. */
30
- type DataSourcePropertiesForResourceId<DataSources extends readonly DataSourceDefinition[], ResourceId extends DataSources[number]["resourceId"]> = Extract<DataSources[number], {
31
- resourceId: ResourceId;
32
- }> extends DataSourceDefinition<infer Properties> ? Properties : never;
33
- /** Handle for a data source and the Apps database it backs. */
34
- export type DataSourceHandle<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = {
28
+ /** Top-level single-source inputs may choose a parent; page.addDatabase/teamspace.addDatabase bind it instead. */
29
+ export type SingleSourceDatabaseArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = SingleSourceDatabaseOptions<Schema> & {
30
+ parent?: Parent;
31
+ };
32
+ /**
33
+ * Multi-source inputs preserve source-map keys. The NoInfer guard makes the
34
+ * emptiness check inspect the inferred map instead of widening it to the broad
35
+ * DataSourceMap constraint.
36
+ */
37
+ type MultiSourceDatabaseOptions<DataSources extends DataSourceMap = DataSourceMap> = DatabaseMetadata & {
38
+ datasources: DataSources;
39
+ dataSourceResourceId?: never;
40
+ schema?: never;
41
+ } & (keyof NoInfer<DataSources> extends never ? {
42
+ views: NonEmptyViewSchemas;
43
+ } : {
44
+ views?: readonly ViewSchema[];
45
+ });
46
+ /** Top-level multi-source inputs may choose a parent; page.addDatabase/teamspace.addDatabase bind it instead. */
47
+ export type MultiSourceDatabaseArgs<DataSources extends DataSourceMap = DataSourceMap> = MultiSourceDatabaseOptions<DataSources> & {
48
+ parent?: Parent;
49
+ };
50
+ /** Linked-only databases use a nonempty typed view tuple and no authored source map. */
51
+ type ViewOnlyDatabaseOptions = DatabaseMetadata & {
52
+ datasources?: never;
53
+ dataSourceResourceId?: never;
54
+ schema?: never;
55
+ views: NonEmptyViewSchemas;
56
+ };
57
+ type ViewOnlyDatabaseArgs = ViewOnlyDatabaseOptions & {
58
+ parent?: Parent;
59
+ };
60
+ /** Remove parent because page.addDatabase/teamspace.addDatabase supplies it. */
61
+ export type ChildSingleSourceDatabaseArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = Omit<SingleSourceDatabaseArgs<Schema>, "parent">;
62
+ /** Remove parent because page.addDatabase/teamspace.addDatabase supplies it. */
63
+ export type ChildMultiSourceDatabaseArgs<DataSources extends DataSourceMap = DataSourceMap> = Omit<MultiSourceDatabaseArgs<DataSources>, "parent">;
64
+ /** Input for declaring a database and its data sources. */
65
+ export type DatabaseArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchema, DataSources extends DataSourceMap = DataSourceMap> = SingleSourceDatabaseArgs<Schema> | MultiSourceDatabaseArgs<DataSources> | ViewOnlyDatabaseArgs;
66
+ /**
67
+ * Child inputs omit parent from each union member separately. `page.addDatabase`
68
+ * and `teamspace.addDatabase` use this shape for their shared child factory.
69
+ */
70
+ export type ChildDatabaseArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchema, DataSources extends DataSourceMap = DataSourceMap> = ChildSingleSourceDatabaseArgs<Schema> | ChildMultiSourceDatabaseArgs<DataSources> | Omit<ViewOnlyDatabaseArgs, "parent">;
71
+ /** A source handle retains its keyed authoring schema for sync inference. */
72
+ export type DataSourceHandle<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
73
+ readonly resourceType: "dataSource";
35
74
  readonly resourceId: string;
36
- readonly schema: Properties;
37
- readonly database: Database<AppsSchemaForProperties<Properties>>;
75
+ readonly schema: Schema;
76
+ readonly database: Database<AppsSchemaForSchema<Schema>>;
38
77
  addPage: (args: ChildPageArgs) => PageHandle;
39
78
  };
40
- /** Handle for a database with data sources indexed by resource ID. */
41
- export type DatabaseHandle<DataSources extends readonly DataSourceDefinition[] = readonly DataSourceDefinition[]> = {
79
+ type DatabaseHandleBase = {
80
+ readonly resourceType: "database";
42
81
  readonly resourceId: string;
43
- readonly dataSources: {
44
- readonly [ResourceId in DataSources[number]["resourceId"]]: DataSourceHandle<DataSourcePropertiesForResourceId<DataSources, ResourceId>>;
45
- };
46
82
  addView: (view: ViewSchema) => void;
47
83
  };
48
- /** A database whose sole data source is available without an ID lookup. */
49
- export type SingleSourceDatabaseHandle<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = DatabaseHandle<readonly DataSourceDefinition<Properties>[]> & {
50
- readonly dataSource: DataSourceHandle<Properties>;
84
+ /** Map each authoring source key to a handle backed by that source's own schema. */
85
+ export type DatabaseHandle<DataSources extends DataSourceMap = DataSourceMap> = DatabaseHandleBase & {
86
+ readonly datasources: {
87
+ readonly [DataSourceName in keyof DataSources]: DataSourceHandle<DataSources[DataSourceName]["schema"]>;
88
+ };
89
+ };
90
+ /** A database whose sole data source is available without a key lookup. */
91
+ export type SingleSourceDatabaseHandle<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = DatabaseHandleBase & {
92
+ readonly dataSource: DataSourceHandle<Schema>;
51
93
  };
94
+ /**
95
+ * Overloaded callable used by page.addDatabase/teamspace.addDatabase. Each form
96
+ * returns its matching handle while preserving literal source and schema inference.
97
+ */
52
98
  export type ChildDatabaseFactory = {
53
- <const Properties extends readonly NotionAsCodeProperty[]>(args: ChildSingleSourceDatabaseArgs<Properties>): SingleSourceDatabaseHandle<Properties>;
54
- <const DataSources extends readonly DataSourceDefinition[]>(args: ChildDatabaseArgs<DataSources> & {
55
- properties?: never;
56
- }): DatabaseHandle<DataSources>;
99
+ <const Schema extends NotionAsCodeSchema>(databaseResourceId: ResourceId, args: ChildSingleSourceDatabaseArgs<Schema>): SingleSourceDatabaseHandle<Schema>;
100
+ <const DataSources extends DataSourceMap>(databaseResourceId: ResourceId, args: ChildMultiSourceDatabaseArgs<DataSources>): DatabaseHandle<DataSources>;
101
+ (databaseResourceId: ResourceId, args: Omit<ViewOnlyDatabaseArgs, "parent">): DatabaseHandle<{}>;
57
102
  };
58
- /** Declare a database, defaulting to a private top-level database in the Apps workspace. */
59
- export declare function database<const Properties extends readonly NotionAsCodeProperty[]>(args: SingleSourceDatabaseArgs<Properties>): SingleSourceDatabaseHandle<Properties>;
60
- export declare function database<const DataSources extends readonly DataSourceDefinition[]>(args: DatabaseArgs<DataSources> & {
61
- properties?: never;
62
- }): DatabaseHandle<DataSources>;
63
- /** Bind both database declaration forms to an existing parent. */
103
+ /** Declare a database, defaulting to the Apps workspace. */
104
+ export declare function database<const Schema extends NotionAsCodeSchema>(databaseResourceId: ResourceId, args: SingleSourceDatabaseArgs<Schema>): SingleSourceDatabaseHandle<Schema>;
105
+ export declare function database<const DataSources extends DataSourceMap>(databaseResourceId: ResourceId, args: MultiSourceDatabaseArgs<DataSources>): DatabaseHandle<DataSources>;
106
+ export declare function database(databaseResourceId: ResourceId, args: ViewOnlyDatabaseArgs): DatabaseHandle<{}>;
107
+ /** Bind a parent for page.addDatabase/teamspace.addDatabase. */
64
108
  export declare function createChildDatabase(parent: Parent): ChildDatabaseFactory;
65
- /** Record a database declaration and create handles for each of its data sources. */
66
- export declare function createDatabase(args: DatabaseArgs, parent: Parent): DatabaseHandle;
67
109
  export {};
68
110
  //# sourceMappingURL=database.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAEN,KAAK,oBAAoB,EAEzB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,oEAAoE;AACpE,MAAM,MAAM,YAAY,CACvB,WAAW,SAAS,SAAS,oBAAoB,EAAE,GAAG,SAAS,oBAAoB,EAAE,IAClF;IACH,UAAU,EAAE,UAAU,CAAC;IACvB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,CAC5B,WAAW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