noblog 0.0.2 → 0.0.4

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 (90) hide show
  1. package/dist/generate.esm.js +240 -0
  2. package/dist/generate.esm.js.map +1 -0
  3. package/dist/generate.js +262 -0
  4. package/dist/generate.js.map +1 -0
  5. package/dist/lib/{cvtmd.d.ts → nomd/format.d.ts} +1 -1
  6. package/dist/lib/nomd/format.d.ts.map +1 -0
  7. package/dist/lib/nomd/nomd.d.ts +7 -1
  8. package/dist/lib/nomd/nomd.d.ts.map +1 -1
  9. package/dist/lib/notion/client.d.ts +1 -0
  10. package/dist/lib/notion/client.d.ts.map +1 -1
  11. package/package.json +44 -28
  12. package/dist/cmds/generate.js +0 -48
  13. package/dist/cmds/generate.js.map +0 -1
  14. package/dist/index.js +0 -18
  15. package/dist/index.js.map +0 -1
  16. package/dist/lib/cvtmd.d.ts.map +0 -1
  17. package/dist/lib/cvtmd.js +0 -111
  18. package/dist/lib/cvtmd.js.map +0 -1
  19. package/dist/lib/nomd/cvter.d.ts +0 -38
  20. package/dist/lib/nomd/cvter.d.ts.map +0 -1
  21. package/dist/lib/nomd/cvter.js +0 -111
  22. package/dist/lib/nomd/cvter.js.map +0 -1
  23. package/dist/lib/nomd/nomd.js +0 -73
  24. package/dist/lib/nomd/nomd.js.map +0 -1
  25. package/dist/lib/nomd.d.ts +0 -8
  26. package/dist/lib/nomd.d.ts.map +0 -1
  27. package/dist/lib/nomd.js +0 -50
  28. package/dist/lib/nomd.js.map +0 -1
  29. package/dist/lib/nosm/default.d.ts +0 -2
  30. package/dist/lib/nosm/default.d.ts.map +0 -1
  31. package/dist/lib/nosm/default.js +0 -2
  32. package/dist/lib/nosm/default.js.map +0 -1
  33. package/dist/lib/nosm/nosm.d.ts +0 -2
  34. package/dist/lib/nosm/nosm.d.ts.map +0 -1
  35. package/dist/lib/nosm/nosm.js +0 -3
  36. package/dist/lib/nosm/nosm.js.map +0 -1
  37. package/dist/lib/notion/client.js +0 -48
  38. package/dist/lib/notion/client.js.map +0 -1
  39. package/dist/lib/notion/object.js +0 -2
  40. package/dist/lib/notion/object.js.map +0 -1
  41. package/dist/lib/notion/request.js +0 -2
  42. package/dist/lib/notion/request.js.map +0 -1
  43. package/output/00097769-2aac-4b6f-8f37-d9b658d46b2e +0 -435
  44. package/output/1707063b-7c0a-4572-9526-f7db2f7bbc49 +0 -162
  45. package/output/1ed588e1-2604-4e33-9685-722b03f66374 +0 -89
  46. package/output/2b1c0d09-40f7-4151-a053-11391f775ece +0 -33
  47. package/output/336b6a5a-f383-4d6c-8fe5-54c9a918c4c0 +0 -264
  48. package/output/37b77a0a-e233-405a-93f5-a60a808eee35 +0 -72
  49. package/output/3ac660cb-9503-4e88-8939-5aee30c98351 +0 -24
  50. package/output/5bc1b19a-8350-48b3-aa19-8073561ad45b +0 -109
  51. package/output/765976b5-7790-497b-8634-4be1d4770e16 +0 -111
  52. package/output/90f2cb44-90ab-40b7-a736-02bfb83a314c +0 -1167
  53. package/output/99a7b0c5-f9de-403c-95ec-eba3d700a195 +0 -49
  54. package/output/c844b66d-0bf3-4f89-bbe1-5974f2de454b +0 -193
  55. package/output/cd6299f7-54bb-4160-8735-16e629422a57 +0 -193
  56. package/output/d462cfca-0a39-4b65-8430-4eae35edbb76 +0 -27
  57. package/output/daafaad2-2570-43da-8e9e-f95a1b29ca17 +0 -12
  58. package/output/e45ef6bf-6c30-4fb2-9efc-a1984e5dc530 +0 -84
  59. package/output/sub/05009ca9-cb39-4356-8f24-c0db39cb4661 +0 -64
  60. package/output/sub/0b903359-2337-4ad9-adef-e77b69142581 +0 -328
  61. package/output/sub/18f0fae1-b7ca-40ea-b725-4e69404429dc +0 -109
  62. package/output/sub/232ae8ce-5ec3-4737-a18e-077774b84b1e +0 -940
  63. package/output/sub/34f4d4af-812e-4e56-a6dd-deb96e7f605c +0 -3
  64. package/output/sub/44331753-a264-40a4-b86f-eafd676b3da0 +0 -509
  65. package/output/sub/4bac355b-24f0-49e7-a317-e4f1cad63c79 +0 -65
  66. package/output/sub/4d6663a2-e93a-402e-89f8-a47cccc0c8cf +0 -76
  67. package/output/sub/5771c956-25bf-4714-bc2e-65959c9156d9 +0 -52
  68. package/output/sub/6ff91a18-494e-4ffc-a33b-b9fd2c36f43f +0 -42
  69. package/output/sub/81e4a2b0-05e2-4013-bd41-14b144979d91 +0 -0
  70. package/output/sub/99ef1497-0b94-490f-b9a0-f54b0e64194d +0 -6
  71. package/output/sub/9a33b8cc-101a-4f6a-9852-115595cd166b +0 -172
  72. package/output/sub/9c060d29-39a2-432b-b06b-b0bd91989a52 +0 -1159
  73. package/output/sub/a45b383c-d894-4480-8322-9c5d028722e3 +0 -9
  74. package/output/sub/b875bfe4-3c1e-4a8f-a56c-27a48ab874ca +0 -438
  75. package/output/sub/b8cbb8f9-f702-4a43-943c-02a6e39683d5 +0 -222
  76. package/output/sub/e339a686-bbb1-41d9-b6b5-18111e72a68c +0 -1392
  77. package/output/sub/e7931a8e-45ca-444a-8d6f-e6fed9415c26 +0 -110
  78. package/output/sub/e859552b-c597-49ed-9ede-fab320fafd87 +0 -150
  79. package/output/sub/f4237e72-fdce-44a4-b62c-659dce24b1ee +0 -107
  80. package/output/sub/ff7ea97c-55ac-471c-902f-b7a7bd101ee6 +0 -0
  81. package/src/cmds/generate.ts +0 -53
  82. package/src/index.ts +0 -22
  83. package/src/lib/nomd/cvter.ts +0 -143
  84. package/src/lib/nomd/nomd.ts +0 -88
  85. package/src/lib/nosm/default.ts +0 -0
  86. package/src/lib/nosm/nosm.ts +0 -3
  87. package/src/lib/notion/client.ts +0 -59
  88. package/src/lib/notion/object.ts +0 -176
  89. package/src/lib/notion/request.ts +0 -42
  90. package/tsconfig.json +0 -35
@@ -1,59 +0,0 @@
1
- import 'dotenv/config'
2
-
3
- import retry from 'async-retry'
4
- import { Client, APIResponseError } from '@notionhq/client'
5
- import type { Page, QueryDatabaseResponse } from './object.js'
6
- import type * as request from './request.ts'
7
-
8
- const NOTION_API_SECRET = process.env.NOTION_API_SECRET ?? ''
9
- const NOBLOG_DATABASE_ID = process.env.NOBLOG_DATABASE_ID ?? ''
10
-
11
- export const client = new Client({
12
- auth: NOTION_API_SECRET,
13
- })
14
-
15
- const numberOfRetry = 2
16
-
17
- export async function GetAllPosts(): Promise<Page[]> {
18
- const params: request.QueryDatabase = {
19
- database_id: NOBLOG_DATABASE_ID,
20
- filter: {
21
- and: [{
22
- property: 'publish',
23
- checkbox: { equals: true, },
24
- }]
25
- },
26
- sorts: [{
27
- property: 'date',
28
- direction: 'descending',
29
- }],
30
- page_size: 100,
31
- }
32
-
33
- let results: Page[] = []
34
- while (true) {
35
- const res = await retry(
36
- async (bail) => {
37
- try {
38
- return (await client.databases.query(
39
- params as any
40
- )) as QueryDatabaseResponse
41
- } catch (error: unknown) {
42
- if (error instanceof APIResponseError) {
43
- if (error.status && error.status >= 400 && error.status < 500) {
44
- bail(error)
45
- }
46
- }
47
- throw error
48
- }
49
- }, { retries: numberOfRetry, }
50
- )
51
-
52
- results = results.concat(res.results)
53
- if (!res.has_more) { break }
54
- params['start_cursor'] = res.next_cursor as string
55
- }
56
-
57
- return results
58
- }
59
-
@@ -1,176 +0,0 @@
1
- // Query a database response
2
- // https://developers.notion.com/reference/post-database-query
3
- export interface QueryDatabaseResponse {
4
- object: string
5
- results: Page[]
6
- next_cursor: null | string
7
- has_more: boolean
8
- type: string
9
- page?: Record<string, never>
10
- }
11
-
12
- interface User {
13
- object: string
14
- id: string
15
- }
16
-
17
- interface External {
18
- url: string
19
- }
20
-
21
- interface File {
22
- type: string
23
- name?: string
24
- external?: External
25
- file?: File
26
- }
27
-
28
- export interface Emoji {
29
- type: string
30
- emoji: string
31
- }
32
-
33
- interface Parent {
34
- type: string
35
- database_id?: string
36
- page_id?: string
37
- }
38
-
39
- interface Annotations {
40
- bold: boolean
41
- italic: boolean
42
- strikethrough: boolean
43
- underline: boolean
44
- code: boolean
45
- color: string
46
- }
47
-
48
- interface Link {
49
- type: string
50
- url: string
51
- }
52
-
53
- interface Text {
54
- content: string
55
- link?: Link
56
- }
57
-
58
- interface Reference {
59
- id: string
60
- }
61
-
62
- interface DateProperty {
63
- start: string
64
- end?: null | string
65
- timezone?: null | string
66
- }
67
-
68
- interface LinkPreview {
69
- url: string
70
- }
71
-
72
- interface Mention {
73
- type: string
74
-
75
- user?: User
76
- page?: Reference
77
- database?: Reference
78
- date?: DateProperty
79
- link_preview?: LinkPreview
80
- }
81
-
82
- interface Equation {
83
- expression: string
84
- }
85
-
86
- export interface RichText {
87
- type: string
88
- plain_text: string
89
- annotations: Annotations
90
- href?: string
91
-
92
- text?: Text
93
- mention?: Mention
94
- equation?: Equation
95
- }
96
-
97
- export interface Page {
98
- object: string
99
- id: string
100
- created_time: string
101
- created_by: User
102
- last_edited_time: string
103
- last_edited_by: User
104
- archived: boolean
105
- icon: File | Emoji | null
106
- cover: File
107
- properties: PageProperties
108
- parent: Parent
109
- url: string
110
- }
111
-
112
- interface PageProperties {
113
- [key: string]: PageProperty
114
- }
115
-
116
-
117
- interface SelectProperty {
118
- id: string
119
- name: string
120
- color: string
121
- }
122
-
123
- interface StatusProperty {
124
- id: string
125
- name: string
126
- color: string
127
- }
128
-
129
- interface FormulaProperty {
130
- type: string
131
-
132
- number?: number
133
- string?: string
134
- boolean?: boolean
135
- date?: DateProperty
136
- }
137
-
138
- interface RelationProperty {
139
- id: string
140
- }
141
-
142
- interface RollupProperty {
143
- type: string
144
- function: string
145
-
146
- number?: number
147
- string?: string
148
- date?: DateProperty
149
- results?: string[]
150
- }
151
-
152
- interface PageProperty {
153
- id: string
154
- type: string
155
-
156
- title?: RichText[]
157
- rich_text?: RichText[]
158
- number?: number
159
- select?: SelectProperty
160
- status?: StatusProperty
161
- multi_select?: SelectProperty[]
162
- date?: DateProperty
163
- formula?: FormulaProperty
164
- relation?: RelationProperty[]
165
- rollup?: RollupProperty
166
- people?: User[]
167
- files?: File[]
168
- checkbox?: boolean
169
- url?: string
170
- email?: string
171
- phone_number?: string
172
- created_time?: string
173
- created_by?: User
174
- last_edited_time?: string
175
- last_edited_by?: User
176
- }
@@ -1,42 +0,0 @@
1
- export interface QueryDatabase {
2
- database_id: string
3
- filter?: PropertyFilterObject | CompoundFilterObject
4
- sorts?: PropertyValueSortObject[]
5
- page_size?: number
6
- start_cursor?: string
7
- }
8
-
9
- export interface PropertyFilterObject {
10
- property: string
11
-
12
- checkbox?: CheckboxFilterCondition
13
-
14
- date?: DateFilterCondition
15
- created_time?: DateFilterCondition
16
- last_edited_time?: DateFilterCondition
17
- }
18
-
19
- export interface CompoundFilterObject {
20
- and?: PropertyFilterObject[]
21
- or?: PropertyFilterObject[]
22
- }
23
-
24
- export interface CheckboxFilterCondition {
25
- equals?: boolean
26
- does_not_equal?: boolean
27
- }
28
-
29
- export interface DateFilterCondition {
30
- equals?: string
31
- before?: string
32
- after?: string
33
- on_or_before?: string
34
- is_empty?: boolean
35
- is_not_empty?: boolean
36
- on_or_after?: string
37
- }
38
-
39
- export interface PropertyValueSortObject {
40
- property: string
41
- direction: string
42
- }
package/tsconfig.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Base Options recommended for all projects
4
- "outDir": "dist",
5
- "strict": true,
6
- "esModuleInterop": true,
7
- "skipLibCheck": true,
8
- "target": "es2022",
9
- "allowJs": true,
10
- "resolveJsonModule": true,
11
- "moduleDetection": "force",
12
- "isolatedModules": true,
13
- "verbatimModuleSyntax": true,
14
- // Enable strict type checking so you can catch bugs early
15
- "noUncheckedIndexedAccess": true,
16
- "noImplicitOverride": true,
17
- "sourceMap": true,
18
- "jsx": "react",
19
- "declaration": true,
20
- "declarationMap": true,
21
- // Transpile our TypeScript code to JavaScript
22
- "module": "NodeNext",
23
- "lib": [
24
- "es2022"
25
- ]
26
- },
27
- // Include the necessary files for your project
28
- "include": [
29
- "src/**/*.ts",
30
- "src/**/*.tsx"
31
- ],
32
- "exclude": [
33
- "node_modules"
34
- ]
35
- }