@visus-io/notion-sdk-ts 3.0.2 → 3.1.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.
Files changed (91) hide show
  1. package/README.md +7 -6
  2. package/dist/api/asyncTasks.api.d.ts +70 -0
  3. package/dist/api/asyncTasks.api.js +68 -0
  4. package/dist/api/base.api.js +1 -0
  5. package/dist/api/blocks.api.d.ts +433 -73
  6. package/dist/api/blocks.api.js +39 -0
  7. package/dist/api/comments.api.d.ts +40 -5
  8. package/dist/api/comments.api.js +43 -1
  9. package/dist/api/customEmojis.api.d.ts +36 -0
  10. package/dist/api/customEmojis.api.js +36 -0
  11. package/dist/api/dataSources.api.d.ts +62 -11
  12. package/dist/api/dataSources.api.js +22 -0
  13. package/dist/api/databases.api.d.ts +40 -6
  14. package/dist/api/fileUploads.api.d.ts +1 -1
  15. package/dist/api/index.d.ts +3 -0
  16. package/dist/api/index.js +7 -1
  17. package/dist/api/pages.api.d.ts +142 -10
  18. package/dist/api/pages.api.js +64 -0
  19. package/dist/api/search.api.d.ts +10 -2
  20. package/dist/api/users.api.d.ts +1 -0
  21. package/dist/api/views.api.d.ts +284 -0
  22. package/dist/api/views.api.js +169 -0
  23. package/dist/client.js +3 -3
  24. package/dist/errors.d.ts +5 -1
  25. package/dist/errors.js +6 -0
  26. package/dist/helpers/block.helpers.d.ts +38 -1
  27. package/dist/helpers/block.helpers.js +45 -3
  28. package/dist/helpers/file.helpers.d.ts +36 -1
  29. package/dist/helpers/file.helpers.js +26 -4
  30. package/dist/helpers/filter.helpers.d.ts +6 -6
  31. package/dist/helpers/index.d.ts +3 -2
  32. package/dist/helpers/index.js +5 -1
  33. package/dist/helpers/pagination.helpers.d.ts +56 -0
  34. package/dist/helpers/pagination.helpers.js +86 -0
  35. package/dist/helpers/property.helpers.d.ts +29 -0
  36. package/dist/helpers/property.helpers.js +27 -0
  37. package/dist/helpers/webhook.helpers.d.ts +52 -0
  38. package/dist/helpers/webhook.helpers.js +81 -0
  39. package/dist/models/asyncTask.model.d.ts +59 -0
  40. package/dist/models/asyncTask.model.js +89 -0
  41. package/dist/models/block.model.js +4 -1
  42. package/dist/models/customEmoji.model.d.ts +28 -0
  43. package/dist/models/customEmoji.model.js +42 -0
  44. package/dist/models/dataSource.model.d.ts +3 -3
  45. package/dist/models/dataSource.model.js +1 -1
  46. package/dist/models/database.model.d.ts +7 -3
  47. package/dist/models/database.model.js +7 -1
  48. package/dist/models/index.d.ts +3 -0
  49. package/dist/models/index.js +7 -1
  50. package/dist/models/page.model.d.ts +2 -0
  51. package/dist/models/page.model.js +6 -0
  52. package/dist/models/view.model.d.ts +79 -0
  53. package/dist/models/view.model.js +119 -0
  54. package/dist/notion.d.ts +26 -7
  55. package/dist/notion.js +19 -3
  56. package/dist/schemas/asyncTask.schema.d.ts +42 -0
  57. package/dist/schemas/asyncTask.schema.js +83 -0
  58. package/dist/schemas/block.schema.d.ts +378 -72
  59. package/dist/schemas/block.schema.js +33 -7
  60. package/dist/schemas/comment.schema.d.ts +8 -3
  61. package/dist/schemas/customEmoji.schema.d.ts +13 -0
  62. package/dist/schemas/customEmoji.schema.js +48 -0
  63. package/dist/schemas/dataSource.schema.d.ts +68 -10
  64. package/dist/schemas/dataSource.schema.js +22 -4
  65. package/dist/schemas/database.schema.d.ts +38 -6
  66. package/dist/schemas/database.schema.js +3 -2
  67. package/dist/schemas/fileUpload.schema.d.ts +1 -1
  68. package/dist/schemas/icon.schema.d.ts +92 -0
  69. package/dist/schemas/icon.schema.js +88 -0
  70. package/dist/schemas/index.d.ts +6 -0
  71. package/dist/schemas/index.js +6 -0
  72. package/dist/schemas/meetingNotesQuery.schema.d.ts +4187 -0
  73. package/dist/schemas/meetingNotesQuery.schema.js +62 -0
  74. package/dist/schemas/page.schema.d.ts +46 -9
  75. package/dist/schemas/page.schema.js +4 -2
  76. package/dist/schemas/pageMarkdown.schema.d.ts +59 -0
  77. package/dist/schemas/pageMarkdown.schema.js +65 -0
  78. package/dist/schemas/pageProperties.schema.d.ts +30 -18
  79. package/dist/schemas/pageProperties.schema.js +2 -3
  80. package/dist/schemas/pagination.schema.d.ts +30 -3
  81. package/dist/schemas/pagination.schema.js +18 -1
  82. package/dist/schemas/parent.schema.d.ts +10 -1
  83. package/dist/schemas/parent.schema.js +9 -3
  84. package/dist/schemas/propertyObjects.schema.d.ts +12 -12
  85. package/dist/schemas/richText.schema.d.ts +8 -6
  86. package/dist/schemas/richText.schema.js +1 -1
  87. package/dist/schemas/user.schema.d.ts +2 -0
  88. package/dist/schemas/user.schema.js +2 -1
  89. package/dist/schemas/view.schema.d.ts +1077 -0
  90. package/dist/schemas/view.schema.js +115 -0
  91. package/package.json +2 -2
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.viewQueryResponseSchema = exports.viewDeleteResponseSchema = exports.viewSchema = exports.viewConfigurationSchema = exports.VIEW_TYPES = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const parent_schema_1 = require("./parent.schema");
39
+ const page_schema_1 = require("./page.schema");
40
+ const pagination_schema_1 = require("./pagination.schema");
41
+ const shared_schema_1 = require("./shared.schema");
42
+ const user_schema_1 = require("./user.schema");
43
+ /**
44
+ * View object schema.
45
+ *
46
+ * Views control how a database/data source's rows are displayed (table, board,
47
+ * calendar, etc.). As of API version 2025-09-03, views have their own endpoints.
48
+ *
49
+ * Notion API reference:
50
+ * https://developers.notion.com/guides/data-apis/working-with-views
51
+ */
52
+ exports.VIEW_TYPES = [
53
+ 'table',
54
+ 'board',
55
+ 'list',
56
+ 'calendar',
57
+ 'timeline',
58
+ 'gallery',
59
+ 'form',
60
+ 'chart',
61
+ 'map',
62
+ 'dashboard',
63
+ ];
64
+ /**
65
+ * Per-layout view configuration. Exact per-type fields (e.g. table column order, board
66
+ * group-by property) haven't been confirmed against a live response, so this is kept
67
+ * permissive -- tagged on `type`, with all other fields passed through unmodeled -- so
68
+ * unknown fields round-trip instead of being stripped or rejected.
69
+ */
70
+ exports.viewConfigurationSchema = z
71
+ .object({
72
+ type: z.enum(exports.VIEW_TYPES),
73
+ })
74
+ .catchall(z.unknown());
75
+ exports.viewSchema = z.object({
76
+ object: z.literal('view'),
77
+ id: z.uuid(),
78
+ parent: parent_schema_1.databaseParentSchema,
79
+ data_source_id: z.uuid().nullable(),
80
+ name: z.string().trim(),
81
+ type: z.enum(exports.VIEW_TYPES),
82
+ filter: z.record(z.string(), z.unknown()).nullish(),
83
+ sorts: z.array(z.record(z.string(), z.unknown())).nullish(),
84
+ quick_filters: z.record(z.string(), z.unknown()).nullish(),
85
+ configuration: exports.viewConfigurationSchema.optional(),
86
+ created_time: shared_schema_1.notionDateStringSchema,
87
+ last_edited_time: shared_schema_1.notionDateStringSchema,
88
+ created_by: user_schema_1.userSchema,
89
+ last_edited_by: user_schema_1.userSchema,
90
+ url: z.url(),
91
+ // Widget/dashboard views only.
92
+ dashboard_view_id: z.uuid().optional(),
93
+ });
94
+ /** Delete-a-view returns a partial object: only object/id/parent/type. */
95
+ exports.viewDeleteResponseSchema = z.object({
96
+ object: z.literal('view'),
97
+ id: z.uuid(),
98
+ parent: parent_schema_1.databaseParentSchema,
99
+ type: z.enum(exports.VIEW_TYPES),
100
+ });
101
+ /**
102
+ * View query response schema. Non-standard pagination shape: `object: "view_query"`,
103
+ * plus `expires_at`/`total_count`; queries expire roughly 15 minutes after creation.
104
+ */
105
+ exports.viewQueryResponseSchema = z.object({
106
+ object: z.literal('view_query'),
107
+ id: z.uuid(),
108
+ view_id: z.uuid(),
109
+ expires_at: shared_schema_1.notionDateStringSchema,
110
+ total_count: z.number(),
111
+ results: z.array(page_schema_1.pageSchema),
112
+ next_cursor: z.string().trim().nullable(),
113
+ has_more: z.boolean(),
114
+ request_status: pagination_schema_1.requestStatusSchema.optional(),
115
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visus-io/notion-sdk-ts",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK for the Notion API",
6
6
  "keywords": [
@@ -68,7 +68,7 @@
68
68
  "@types/node": "^25.2.1",
69
69
  "@vitest/coverage-v8": "^4.0.18",
70
70
  "eslint": "^10.0.0",
71
- "eslint-plugin-zod": "4.8.0",
71
+ "eslint-plugin-zod": "4.9.0",
72
72
  "husky": "^9.1.7",
73
73
  "lint-staged": "^16.2.7",
74
74
  "msw": "2.15.0",