@jeromefitz/notion 5.1.12 → 5.1.13-canary.2
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/LICENSE +1 -1
- package/chunk-pm2C21R4.mjs +1 -0
- package/constants/index.d.mts +129 -0
- package/constants/index.d.mts.map +1 -0
- package/constants/index.mjs +2 -0
- package/constants/index.mjs.map +1 -0
- package/getTypes-C_NXtnf-.mjs +2 -0
- package/getTypes-C_NXtnf-.mjs.map +1 -0
- package/index-CvmUSReI.d.mts +245 -0
- package/index-CvmUSReI.d.mts.map +1 -0
- package/index.d.mts +119 -0
- package/index.d.mts.map +1 -0
- package/index.mjs +2 -0
- package/index.mjs.map +1 -0
- package/package.json +52 -14
- package/queries/getBlocksByIdChildren/index.d.mts +11 -0
- package/queries/getBlocksByIdChildren/index.d.mts.map +1 -0
- package/queries/getBlocksByIdChildren/index.mjs +2 -0
- package/queries/getBlocksByIdChildren/index.mjs.map +1 -0
- package/queries/getDatabasesByIdQuery/index.d.mts +17 -0
- package/queries/getDatabasesByIdQuery/index.d.mts.map +1 -0
- package/queries/getDatabasesByIdQuery/index.mjs +2 -0
- package/queries/getDatabasesByIdQuery/index.mjs.map +1 -0
- package/queries/getDeepFetchAllChildren/index.d.mts +11 -0
- package/queries/getDeepFetchAllChildren/index.d.mts.map +1 -0
- package/queries/getDeepFetchAllChildren/index.mjs +2 -0
- package/queries/getDeepFetchAllChildren/index.mjs.map +1 -0
- package/queries/getInfoType/index.d.mts +22 -0
- package/queries/getInfoType/index.d.mts.map +1 -0
- package/queries/getInfoType/index.mjs +2 -0
- package/queries/getInfoType/index.mjs.map +1 -0
- package/queries/getNotionListing/index.d.mts +29 -0
- package/queries/getNotionListing/index.d.mts.map +1 -0
- package/queries/getNotionListing/index.mjs +2 -0
- package/queries/getNotionListing/index.mjs.map +1 -0
- package/queries/getNotionListingByDate/index.d.mts +26 -0
- package/queries/getNotionListingByDate/index.d.mts.map +1 -0
- package/queries/getNotionListingByDate/index.mjs +2 -0
- package/queries/getNotionListingByDate/index.mjs.map +1 -0
- package/queries/getNotionSlug/index.d.mts +36 -0
- package/queries/getNotionSlug/index.d.mts.map +1 -0
- package/queries/getNotionSlug/index.mjs +2 -0
- package/queries/getNotionSlug/index.mjs.map +1 -0
- package/queries/getNotionSlugByRoute/index.d.mts +26 -0
- package/queries/getNotionSlugByRoute/index.d.mts.map +1 -0
- package/queries/getNotionSlugByRoute/index.mjs +2 -0
- package/queries/getNotionSlugByRoute/index.mjs.map +1 -0
- package/queries/getPagesById/index.d.mts +11 -0
- package/queries/getPagesById/index.d.mts.map +1 -0
- package/queries/getPagesById/index.mjs +2 -0
- package/queries/getPagesById/index.mjs.map +1 -0
- package/queries/getPathVariables/index.d.mts +22 -0
- package/queries/getPathVariables/index.d.mts.map +1 -0
- package/queries/getPathVariables/index.mjs +2 -0
- package/queries/getPathVariables/index.mjs.map +1 -0
- package/queries/getQuery/index.d.mts +13 -0
- package/queries/getQuery/index.d.mts.map +1 -0
- package/queries/getQuery/index.mjs +2 -0
- package/queries/getQuery/index.mjs.map +1 -0
- package/queries/index.d.mts +12 -0
- package/queries/index.mjs +1 -0
- package/schema/index.d.mts +2 -0
- package/schema/index.mjs +1 -0
- package/utils/addTime/index.d.mts +5 -0
- package/utils/addTime/index.d.mts.map +1 -0
- package/utils/addTime/index.mjs +2 -0
- package/utils/addTime/index.mjs.map +1 -0
- package/utils/dataNormalized/index.d.mts +20 -0
- package/utils/dataNormalized/index.d.mts.map +1 -0
- package/utils/dataNormalized/index.mjs +1 -0
- package/utils/dataNormalizedResults/index.d.mts +19 -0
- package/utils/dataNormalizedResults/index.d.mts.map +1 -0
- package/utils/dataNormalizedResults/index.mjs +1 -0
- package/utils/getDataType/{index.d.ts → index.d.mts} +12 -6
- package/utils/getDataType/index.d.mts.map +1 -0
- package/utils/getDataType/index.mjs +2 -0
- package/utils/getDataType/index.mjs.map +1 -0
- package/utils/getTitle/{index.d.ts → index.d.mts} +3 -1
- package/utils/getTitle/index.d.mts.map +1 -0
- package/utils/getTitle/index.mjs +2 -0
- package/utils/getTitle/index.mjs.map +1 -0
- package/utils/getTypes/_unsupported.d.mts +6 -0
- package/utils/getTypes/_unsupported.d.mts.map +1 -0
- package/utils/getTypes/_unsupported.mjs +2 -0
- package/utils/getTypes/_unsupported.mjs.map +1 -0
- package/utils/getTypes/checkbox.d.mts +5 -0
- package/utils/getTypes/checkbox.d.mts.map +1 -0
- package/utils/getTypes/checkbox.mjs +2 -0
- package/utils/getTypes/checkbox.mjs.map +1 -0
- package/utils/getTypes/date.d.mts +5 -0
- package/utils/getTypes/date.d.mts.map +1 -0
- package/utils/getTypes/date.mjs +2 -0
- package/utils/getTypes/date.mjs.map +1 -0
- package/utils/getTypes/email.d.mts +5 -0
- package/utils/getTypes/email.d.mts.map +1 -0
- package/utils/getTypes/email.mjs +2 -0
- package/utils/getTypes/email.mjs.map +1 -0
- package/utils/getTypes/files.d.mts +5 -0
- package/utils/getTypes/files.d.mts.map +1 -0
- package/utils/getTypes/files.mjs +2 -0
- package/utils/getTypes/files.mjs.map +1 -0
- package/utils/getTypes/index.d.mts +28 -0
- package/utils/getTypes/index.d.mts.map +1 -0
- package/utils/getTypes/index.mjs +1 -0
- package/utils/getTypes/multi_select.d.mts +5 -0
- package/utils/getTypes/multi_select.d.mts.map +1 -0
- package/utils/getTypes/multi_select.mjs +2 -0
- package/utils/getTypes/multi_select.mjs.map +1 -0
- package/utils/getTypes/number.d.mts +5 -0
- package/utils/getTypes/number.d.mts.map +1 -0
- package/utils/getTypes/number.mjs +2 -0
- package/utils/getTypes/number.mjs.map +1 -0
- package/utils/getTypes/people.d.mts +5 -0
- package/utils/getTypes/people.d.mts.map +1 -0
- package/utils/getTypes/people.mjs +2 -0
- package/utils/getTypes/people.mjs.map +1 -0
- package/utils/getTypes/phone_number.d.mts +5 -0
- package/utils/getTypes/phone_number.d.mts.map +1 -0
- package/utils/getTypes/phone_number.mjs +2 -0
- package/utils/getTypes/phone_number.mjs.map +1 -0
- package/utils/getTypes/relation.d.mts +5 -0
- package/utils/getTypes/relation.d.mts.map +1 -0
- package/utils/getTypes/relation.mjs +1 -0
- package/utils/getTypes/rich_text.d.mts +5 -0
- package/utils/getTypes/rich_text.d.mts.map +1 -0
- package/utils/getTypes/rich_text.mjs +2 -0
- package/utils/getTypes/rich_text.mjs.map +1 -0
- package/utils/getTypes/rollup.d.mts +5 -0
- package/utils/getTypes/rollup.d.mts.map +1 -0
- package/utils/getTypes/rollup.mjs +1 -0
- package/utils/getTypes/select.d.mts +7 -0
- package/utils/getTypes/select.d.mts.map +1 -0
- package/utils/getTypes/select.mjs +2 -0
- package/utils/getTypes/select.mjs.map +1 -0
- package/utils/getTypes/title.d.mts +5 -0
- package/utils/getTypes/title.d.mts.map +1 -0
- package/utils/getTypes/title.mjs +2 -0
- package/utils/getTypes/title.mjs.map +1 -0
- package/utils/getTypes/url.d.mts +5 -0
- package/utils/getTypes/url.d.mts.map +1 -0
- package/utils/getTypes/url.mjs +2 -0
- package/utils/getTypes/url.mjs.map +1 -0
- package/utils/index.d.mts +7 -0
- package/utils/index.mjs +1 -0
- package/utils-CyUrB6XV.mjs +2 -0
- package/utils-CyUrB6XV.mjs.map +1 -0
- package/constants/index.d.ts +0 -127
- package/constants/index.js +0 -1
- package/index.d.ts +0 -117
- package/index.js +0 -1
- package/queries/getBlocksByIdChildren/index.d.ts +0 -6
- package/queries/getBlocksByIdChildren/index.js +0 -1
- package/queries/getDatabasesByIdQuery/index.d.ts +0 -10
- package/queries/getDatabasesByIdQuery/index.js +0 -1
- package/queries/getDeepFetchAllChildren/index.d.ts +0 -6
- package/queries/getDeepFetchAllChildren/index.js +0 -1
- package/queries/getInfoType/index.d.ts +0 -13
- package/queries/getInfoType/index.js +0 -1
- package/queries/getNotionListing/index.d.ts +0 -20
- package/queries/getNotionListing/index.js +0 -1
- package/queries/getNotionListingByDate/index.d.ts +0 -16
- package/queries/getNotionListingByDate/index.js +0 -1
- package/queries/getNotionSlug/index.d.ts +0 -26
- package/queries/getNotionSlug/index.js +0 -1
- package/queries/getNotionSlugByRoute/index.d.ts +0 -16
- package/queries/getNotionSlugByRoute/index.js +0 -1
- package/queries/getPagesById/index.d.ts +0 -6
- package/queries/getPagesById/index.js +0 -1
- package/queries/getPathVariables/index.d.ts +0 -17
- package/queries/getPathVariables/index.js +0 -1
- package/queries/getQuery/index.d.ts +0 -7
- package/queries/getQuery/index.js +0 -1
- package/queries/index.d.ts +0 -12
- package/queries/index.js +0 -1
- package/schema/index.d.ts +0 -243
- package/schema/index.js +0 -0
- package/utils/addTime/index.d.ts +0 -3
- package/utils/addTime/index.js +0 -1
- package/utils/dataNormalized/index.d.ts +0 -13
- package/utils/dataNormalized/index.js +0 -1
- package/utils/dataNormalizedResults/index.d.ts +0 -13
- package/utils/dataNormalizedResults/index.js +0 -1
- package/utils/getDataType/index.js +0 -1
- package/utils/getTitle/index.js +0 -1
- package/utils/getTypes/_unsupported.d.ts +0 -3
- package/utils/getTypes/_unsupported.js +0 -1
- package/utils/getTypes/checkbox.d.ts +0 -3
- package/utils/getTypes/checkbox.js +0 -1
- package/utils/getTypes/date.d.ts +0 -3
- package/utils/getTypes/date.js +0 -1
- package/utils/getTypes/email.d.ts +0 -3
- package/utils/getTypes/email.js +0 -1
- package/utils/getTypes/files.d.ts +0 -3
- package/utils/getTypes/files.js +0 -1
- package/utils/getTypes/index.d.ts +0 -26
- package/utils/getTypes/index.js +0 -1
- package/utils/getTypes/multi_select.d.ts +0 -3
- package/utils/getTypes/multi_select.js +0 -1
- package/utils/getTypes/number.d.ts +0 -3
- package/utils/getTypes/number.js +0 -1
- package/utils/getTypes/people.d.ts +0 -3
- package/utils/getTypes/people.js +0 -1
- package/utils/getTypes/phone_number.d.ts +0 -3
- package/utils/getTypes/phone_number.js +0 -1
- package/utils/getTypes/relation.d.ts +0 -3
- package/utils/getTypes/relation.js +0 -1
- package/utils/getTypes/rich_text.d.ts +0 -3
- package/utils/getTypes/rich_text.js +0 -1
- package/utils/getTypes/rollup.d.ts +0 -3
- package/utils/getTypes/rollup.js +0 -1
- package/utils/getTypes/select.d.ts +0 -5
- package/utils/getTypes/select.js +0 -1
- package/utils/getTypes/title.d.ts +0 -3
- package/utils/getTypes/title.js +0 -1
- package/utils/getTypes/url.d.ts +0 -3
- package/utils/getTypes/url.js +0 -1
- package/utils/index.d.ts +0 -7
- package/utils/index.js +0 -1
package/index.d.mts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { r as DataTypes } from "./index-CvmUSReI.mjs";
|
|
2
|
+
import { DATA_TYPES } from "./constants/index.mjs";
|
|
3
|
+
import { Client as Client$1 } from "@notionhq/client";
|
|
4
|
+
|
|
5
|
+
//#region src/index.d.ts
|
|
6
|
+
type ClientProps = {
|
|
7
|
+
custom: CustomProps;
|
|
8
|
+
dataTypes: DataTypesProps;
|
|
9
|
+
};
|
|
10
|
+
type CredentialProps = {
|
|
11
|
+
auth: string;
|
|
12
|
+
config: any;
|
|
13
|
+
};
|
|
14
|
+
type CustomProps = {
|
|
15
|
+
getBlocksByIdChildren: any;
|
|
16
|
+
getDatabasesByIdQuery: any;
|
|
17
|
+
getDeepFetchAllChildren: any;
|
|
18
|
+
getInfoType: any;
|
|
19
|
+
getPagesById: any;
|
|
20
|
+
getPathVariables: any;
|
|
21
|
+
getQuery: any;
|
|
22
|
+
};
|
|
23
|
+
type DataTypesProps = {
|
|
24
|
+
LISTING: any;
|
|
25
|
+
LISTING_BY_DATE: any;
|
|
26
|
+
SLUG: any;
|
|
27
|
+
SLUG_BY_ROUTE: any;
|
|
28
|
+
};
|
|
29
|
+
declare class Client extends Client$1 {
|
|
30
|
+
#private;
|
|
31
|
+
readonly custom: {
|
|
32
|
+
getBlocksByIdChildren: (props: any) => Promise<any>;
|
|
33
|
+
getDatabasesByIdQuery: (props: any) => Promise<any>;
|
|
34
|
+
getDeepFetchAllChildren: (props: any) => Promise<any[]>;
|
|
35
|
+
getInfoType: (props: any) => {
|
|
36
|
+
as: string;
|
|
37
|
+
date: string;
|
|
38
|
+
href: string;
|
|
39
|
+
slug: any;
|
|
40
|
+
};
|
|
41
|
+
getPagesById: (props: any) => Promise<any>;
|
|
42
|
+
getPathVariables: (props: any) => {
|
|
43
|
+
dataType: DataTypes;
|
|
44
|
+
hasMeta: boolean;
|
|
45
|
+
isIndex: boolean;
|
|
46
|
+
isPage: boolean;
|
|
47
|
+
meta: unknown[];
|
|
48
|
+
routeType: any;
|
|
49
|
+
slug: any;
|
|
50
|
+
url: string;
|
|
51
|
+
};
|
|
52
|
+
getQuery: (props: any) => Promise<any>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* @info details at: ../../utils/getDataType
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
readonly dataTypes: {
|
|
59
|
+
[DATA_TYPES.LISTING]: (props: {
|
|
60
|
+
pathVariables: any;
|
|
61
|
+
routeType: any;
|
|
62
|
+
slug?: any;
|
|
63
|
+
}) => Promise<{
|
|
64
|
+
content?: undefined;
|
|
65
|
+
images?: undefined;
|
|
66
|
+
info?: undefined;
|
|
67
|
+
items?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
content: any;
|
|
70
|
+
images: {};
|
|
71
|
+
info: any;
|
|
72
|
+
items: Pick<any, string | number | symbol>;
|
|
73
|
+
}>;
|
|
74
|
+
[DATA_TYPES.LISTING_BY_DATE]: (props: {
|
|
75
|
+
pathVariables: any;
|
|
76
|
+
routeType: any;
|
|
77
|
+
slug: any;
|
|
78
|
+
}) => Promise<{
|
|
79
|
+
content: any;
|
|
80
|
+
images: {};
|
|
81
|
+
info: any;
|
|
82
|
+
items: Pick<Pick<any, string | number | symbol>, string | number | symbol>;
|
|
83
|
+
}>;
|
|
84
|
+
[DATA_TYPES.SLUG]: (props: {
|
|
85
|
+
pathVariables: any;
|
|
86
|
+
routeType: any;
|
|
87
|
+
slug: any;
|
|
88
|
+
}) => Promise<{
|
|
89
|
+
content: {};
|
|
90
|
+
images: {};
|
|
91
|
+
info: {};
|
|
92
|
+
items: {};
|
|
93
|
+
} | {
|
|
94
|
+
content?: undefined;
|
|
95
|
+
images?: undefined;
|
|
96
|
+
info?: undefined;
|
|
97
|
+
items?: undefined;
|
|
98
|
+
} | {
|
|
99
|
+
content: any[];
|
|
100
|
+
images: {};
|
|
101
|
+
info: Pick<any, string | number | symbol>;
|
|
102
|
+
items: {};
|
|
103
|
+
}>;
|
|
104
|
+
[DATA_TYPES.SLUG_BY_ROUTE]: (props: {
|
|
105
|
+
pathVariables: any;
|
|
106
|
+
routeType: any;
|
|
107
|
+
slug: any;
|
|
108
|
+
}) => Promise<{
|
|
109
|
+
content: any;
|
|
110
|
+
images: {};
|
|
111
|
+
info: Pick<any, string | number | symbol>;
|
|
112
|
+
items: {};
|
|
113
|
+
}>;
|
|
114
|
+
};
|
|
115
|
+
constructor(options?: any);
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { Client, type ClientProps, type CredentialProps };
|
|
119
|
+
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;KAkBK,WAAA;EACH,MAAA,EAAQ,WAAA;EACR,SAAA,EAAW,cAAA;AAAA;AAAA,KAIR,eAAA;EACH,IAAA;EACA,MAAA;AAAA;AAAA,KAIG,WAAA;EACH,qBAAA;EACA,qBAAA;EACA,uBAAA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;EACA,QAAA;AAAA;AAAA,KAIG,cAAA;EACH,OAAA;EACA,eAAA;EACA,IAAA;EACA,aAAA;AAAA;AAAA,cAGI,MAAA,SAAe,QAAA;EAAA;WAIH,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;WAyCA,SAAA;IAAA,CACb,UAAA,CAAW,OAAA,IAAQ,KAAA;MAClB,aAAA;MACA,SAAA;MACA,IAAA;IAAA,MACD,OAAA;;;;;;;;;;;KAWA,UAAA,CAAW,eAAA,IAAgB,KAAA;MAC1B,aAAA;MACA,SAAA;MACA,IAAA;IAAA,MACD,OAAA;;;;;;KAWA,UAAA,CAAW,IAAA,IAAK,KAAA;MACf,aAAA;MACA,SAAA;MACA,IAAA;IAAA,MACD,OAAA;;;;;;;;;;;;;;;;KAWA,UAAA,CAAW,aAAA,IAAc,KAAA;MACxB,aAAA;MACA,SAAA;MACA,IAAA;IAAA,MACD,OAAA;;;;;;;cAagB,OAAA;AAAA"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-pm2C21R4.mjs";import{DATA_TYPES as e}from"./constants/index.mjs";import t from"./queries/getBlocksByIdChildren/index.mjs";import n from"./queries/getDatabasesByIdQuery/index.mjs";import r from"./queries/getDeepFetchAllChildren/index.mjs";import i from"./queries/getInfoType/index.mjs";import"./utils-CyUrB6XV.mjs";import"./getTypes-C_NXtnf-.mjs";import a from"./queries/getNotionListing/index.mjs";import o from"./queries/getNotionListingByDate/index.mjs";import s from"./queries/getNotionSlug/index.mjs";import c from"./queries/getNotionSlugByRoute/index.mjs";import l from"./queries/getPagesById/index.mjs";import u from"./queries/getPathVariables/index.mjs";import d from"./queries/getQuery/index.mjs";import"./queries/index.mjs";import{Client as f}from"@notionhq/client";var p=class extends f{#e;custom={getBlocksByIdChildren:async e=>await t({...e,getBlocksChildrenList:this.blocks.children.list}),getDatabasesByIdQuery:async e=>await n({...e,getDatabasesQuery:this.databases.query}),getDeepFetchAllChildren:async e=>await r({...e,getBlocksChildrenList:this.blocks.children.list}),getInfoType:e=>i({...e,config:this.#e}),getPagesById:async e=>await l({...e,getPagesRetrieve:this.pages.retrieve}),getPathVariables:e=>u({...e,config:this.#e}),getQuery:async e=>await d({...e,config:this.#e,notionDatabasesQuery:this.databases.query})};dataTypes={[e.LISTING]:async e=>await a({...e,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById}),[e.LISTING_BY_DATE]:async e=>await o({...e,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById}),[e.SLUG]:async e=>await s({...e,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren}),[e.SLUG_BY_ROUTE]:async e=>await c({...e,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getQuery:this.custom.getQuery})};constructor(e){super(e),this.#e=e?.config}};export{p as Client};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["_Client","#config"],"sources":["../src/index.ts"],"sourcesContent":["import { Client as _Client } from '@notionhq/client'\n\nimport { DATA_TYPES } from './constants/index.js'\nimport {\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getDeepFetchAllChildren,\n getInfoType,\n getNotionListing,\n getNotionListingByDate,\n getNotionSlug,\n getNotionSlugByRoute,\n getPagesById,\n getPathVariables,\n getQuery,\n} from './queries/index.js'\n\n// biome-ignore lint/style/useConsistentTypeDefinitions: migrate\ntype ClientProps = {\n custom: CustomProps\n dataTypes: DataTypesProps\n}\n\n// biome-ignore lint/style/useConsistentTypeDefinitions: migrate\ntype CredentialProps = {\n auth: string\n config: any\n}\n\n// biome-ignore lint/style/useConsistentTypeDefinitions: migrate\ntype CustomProps = {\n getBlocksByIdChildren: any\n getDatabasesByIdQuery: any\n getDeepFetchAllChildren: any\n getInfoType: any\n getPagesById: any\n getPathVariables: any\n getQuery: any\n}\n\n// biome-ignore lint/style/useConsistentTypeDefinitions: migrate\ntype DataTypesProps = {\n LISTING: any\n LISTING_BY_DATE: any\n SLUG: any\n SLUG_BY_ROUTE: any\n}\n\nclass Client extends _Client {\n #config?: any\n\n // @todo(notion) throw error if `config` is not passed\n public readonly custom = {\n getBlocksByIdChildren: async (props) =>\n await getBlocksByIdChildren({\n ...props,\n getBlocksChildrenList: this.blocks.children.list,\n }),\n\n getDatabasesByIdQuery: async (props) =>\n await getDatabasesByIdQuery({\n ...props,\n getDatabasesQuery: this.databases.query,\n }),\n\n getDeepFetchAllChildren: async (props) =>\n await getDeepFetchAllChildren({\n ...props,\n getBlocksChildrenList: this.blocks.children.list,\n }),\n\n getInfoType: (props) => {\n return getInfoType({ ...props, config: this.#config })\n },\n\n getPagesById: async (props) =>\n await getPagesById({ ...props, getPagesRetrieve: this.pages.retrieve }),\n\n getPathVariables: (props) =>\n getPathVariables({ ...props, config: this.#config }),\n\n getQuery: async (props) =>\n await getQuery({\n ...props,\n config: this.#config,\n notionDatabasesQuery: this.databases.query,\n }),\n }\n\n /**\n * @info details at: ../../utils/getDataType\n *\n */\n public readonly dataTypes = {\n [DATA_TYPES.LISTING]: async (props: {\n pathVariables: any\n routeType: any\n slug?: any\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING}`)\n return await getNotionListing({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getPagesById: this.custom.getPagesById,\n })\n },\n\n [DATA_TYPES.LISTING_BY_DATE]: async (props: {\n pathVariables: any\n routeType: any\n slug: any\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING_BY_DATE}`)\n return await getNotionListingByDate({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getPagesById: this.custom.getPagesById,\n })\n },\n\n [DATA_TYPES.SLUG]: async (props: {\n pathVariables: any\n routeType: any\n slug: any\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG}`)\n return await getNotionSlug({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getDeepFetchAllChildren: this.custom.getDeepFetchAllChildren,\n })\n },\n\n [DATA_TYPES.SLUG_BY_ROUTE]: async (props: {\n pathVariables: any\n routeType: any\n slug: any\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG_BY_ROUTE}`)\n return await getNotionSlugByRoute({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getQuery: this.custom.getQuery,\n })\n },\n }\n\n // public constructor(options?: ClientOptions) {\n public constructor(options?: any) {\n super(options)\n this.#config = options?.config\n }\n}\n\nexport type { ClientProps, CredentialProps }\nexport { Client }\n"],"mappings":"sxBAgDA,IAAM,EAAN,cAAqBA,CAAQ,CAC3B,GAGA,OAAyB,CACvB,sBAAuB,KAAO,IAC5B,MAAM,EAAsB,CAC1B,GAAG,EACH,sBAAuB,KAAK,OAAO,SAAS,KAC7C,CAAC,CAEJ,sBAAuB,KAAO,IAC5B,MAAM,EAAsB,CAC1B,GAAG,EACH,kBAAmB,KAAK,UAAU,MACnC,CAAC,CAEJ,wBAAyB,KAAO,IAC9B,MAAM,EAAwB,CAC5B,GAAG,EACH,sBAAuB,KAAK,OAAO,SAAS,KAC7C,CAAC,CAEJ,YAAc,GACL,EAAY,CAAE,GAAG,EAAO,OAAQ,MAAA,EAAc,CAAC,CAGxD,aAAc,KAAO,IACnB,MAAM,EAAa,CAAE,GAAG,EAAO,iBAAkB,KAAK,MAAM,SAAU,CAAC,CAEzE,iBAAmB,GACjB,EAAiB,CAAE,GAAG,EAAO,OAAQ,MAAA,EAAc,CAAC,CAEtD,SAAU,KAAO,IACf,MAAM,EAAS,CACb,GAAG,EACH,OAAQ,MAAA,EACR,qBAAsB,KAAK,UAAU,MACtC,CAAC,CACL,CAMD,UAA4B,EACzB,EAAW,SAAU,KAAO,IAMpB,MAAM,EAAiB,CAC5B,GAAG,EACH,OAAQ,MAAA,EACR,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,aAAc,KAAK,OAAO,aAC3B,CAAC,EAGH,EAAW,iBAAkB,KAAO,IAM5B,MAAM,EAAuB,CAClC,GAAG,EACH,OAAQ,MAAA,EACR,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,aAAc,KAAK,OAAO,aAC3B,CAAC,EAGH,EAAW,MAAO,KAAO,IAMjB,MAAM,EAAc,CACzB,GAAG,EACH,OAAQ,MAAA,EACR,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,wBAAyB,KAAK,OAAO,wBACtC,CAAC,EAGH,EAAW,eAAgB,KAAO,IAM1B,MAAM,EAAqB,CAChC,GAAG,EACH,OAAQ,MAAA,EACR,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,SAAU,KAAK,OAAO,SACvB,CAAC,CAEL,CAGD,YAAmB,EAAe,CAChC,MAAM,EAAQ,CACd,MAAA,EAAe,GAAS"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeromefitz/notion",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.13-canary.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Notion: Custom Client for jeromefitzgerald.com",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/JeromeFitz/packages.git"
|
|
9
|
+
},
|
|
7
10
|
"author": {
|
|
8
11
|
"name": "Jerome Fitzgerald",
|
|
9
12
|
"email": "j@jeromefitzgerald.com",
|
|
@@ -12,11 +15,47 @@
|
|
|
12
15
|
"license": "MIT",
|
|
13
16
|
"private": false,
|
|
14
17
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
18
|
+
"node": ">=24"
|
|
16
19
|
},
|
|
17
20
|
"exports": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
21
|
+
".": "./index.mjs",
|
|
22
|
+
"./constants": "./dist/constants/index.mjs",
|
|
23
|
+
"./queries": "./dist/queries/index.mjs",
|
|
24
|
+
"./queries/getBlocksByIdChildren": "./dist/queries/getBlocksByIdChildren/index.mjs",
|
|
25
|
+
"./queries/getDatabasesByIdQuery": "./dist/queries/getDatabasesByIdQuery/index.mjs",
|
|
26
|
+
"./queries/getDeepFetchAllChildren": "./dist/queries/getDeepFetchAllChildren/index.mjs",
|
|
27
|
+
"./queries/getInfoType": "./dist/queries/getInfoType/index.mjs",
|
|
28
|
+
"./queries/getNotionListing": "./dist/queries/getNotionListing/index.mjs",
|
|
29
|
+
"./queries/getNotionListingByDate": "./dist/queries/getNotionListingByDate/index.mjs",
|
|
30
|
+
"./queries/getNotionSlug": "./dist/queries/getNotionSlug/index.mjs",
|
|
31
|
+
"./queries/getNotionSlugByRoute": "./dist/queries/getNotionSlugByRoute/index.mjs",
|
|
32
|
+
"./queries/getPagesById": "./dist/queries/getPagesById/index.mjs",
|
|
33
|
+
"./queries/getPathVariables": "./dist/queries/getPathVariables/index.mjs",
|
|
34
|
+
"./queries/getQuery": "./dist/queries/getQuery/index.mjs",
|
|
35
|
+
"./schema": "./dist/schema/index.mjs",
|
|
36
|
+
"./utils": "./dist/utils/index.mjs",
|
|
37
|
+
"./utils/addTime": "./dist/utils/addTime/index.mjs",
|
|
38
|
+
"./utils/dataNormalized": "./dist/utils/dataNormalized/index.mjs",
|
|
39
|
+
"./utils/dataNormalizedResults": "./dist/utils/dataNormalizedResults/index.mjs",
|
|
40
|
+
"./utils/getDataType": "./dist/utils/getDataType/index.mjs",
|
|
41
|
+
"./utils/getTitle": "./dist/utils/getTitle/index.mjs",
|
|
42
|
+
"./utils/getTypes": "./dist/utils/getTypes/index.mjs",
|
|
43
|
+
"./utils/getTypes/_unsupported": "./dist/utils/getTypes/_unsupported.mjs",
|
|
44
|
+
"./utils/getTypes/checkbox": "./dist/utils/getTypes/checkbox.mjs",
|
|
45
|
+
"./utils/getTypes/date": "./dist/utils/getTypes/date.mjs",
|
|
46
|
+
"./utils/getTypes/email": "./dist/utils/getTypes/email.mjs",
|
|
47
|
+
"./utils/getTypes/files": "./dist/utils/getTypes/files.mjs",
|
|
48
|
+
"./utils/getTypes/multi_select": "./dist/utils/getTypes/multi_select.mjs",
|
|
49
|
+
"./utils/getTypes/number": "./dist/utils/getTypes/number.mjs",
|
|
50
|
+
"./utils/getTypes/people": "./dist/utils/getTypes/people.mjs",
|
|
51
|
+
"./utils/getTypes/phone_number": "./dist/utils/getTypes/phone_number.mjs",
|
|
52
|
+
"./utils/getTypes/relation": "./dist/utils/getTypes/relation.mjs",
|
|
53
|
+
"./utils/getTypes/rich_text": "./dist/utils/getTypes/rich_text.mjs",
|
|
54
|
+
"./utils/getTypes/rollup": "./dist/utils/getTypes/rollup.mjs",
|
|
55
|
+
"./utils/getTypes/select": "./dist/utils/getTypes/select.mjs",
|
|
56
|
+
"./utils/getTypes/title": "./dist/utils/getTypes/title.mjs",
|
|
57
|
+
"./utils/getTypes/url": "./dist/utils/getTypes/url.mjs",
|
|
58
|
+
"./package.json": "./package.json"
|
|
20
59
|
},
|
|
21
60
|
"keywords": [
|
|
22
61
|
"next",
|
|
@@ -24,15 +63,13 @@
|
|
|
24
63
|
"notion"
|
|
25
64
|
],
|
|
26
65
|
"scripts": {
|
|
27
|
-
"build": "
|
|
66
|
+
"build": "tsdown",
|
|
28
67
|
"clean": "rm -rf .turbo && rm -rf dist",
|
|
29
68
|
"clean:install": "pnpm run clean && rm -rf node_modules",
|
|
30
69
|
"copy": "mkdir -p ./dist && ./scripts/copy.sh",
|
|
31
|
-
"dev": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"lint": "pnpm run format:prettier --check && pnpm run lint:eslint",
|
|
35
|
-
"lint:eslint": "eslint ./src --max-warnings=0",
|
|
70
|
+
"dev": "tsdown --watch",
|
|
71
|
+
"lint": "pnpm run lint:typescript",
|
|
72
|
+
"lint:typescript": "tsc --noEmit --declaration",
|
|
36
73
|
"semantic-release": "semantic-release",
|
|
37
74
|
"semantic-release:dry": "semantic-release --dry-run"
|
|
38
75
|
},
|
|
@@ -47,11 +84,12 @@
|
|
|
47
84
|
},
|
|
48
85
|
"devDependencies": {
|
|
49
86
|
"@jeromefitz/utils": "workspace:*",
|
|
50
|
-
"@types/lodash": "4.17.
|
|
51
|
-
"lodash": "4.17.
|
|
87
|
+
"@types/lodash": "4.17.24",
|
|
88
|
+
"lodash": "4.17.23"
|
|
52
89
|
},
|
|
53
90
|
"publishConfig": {
|
|
54
|
-
"registry": "https://registry.npmjs.org/"
|
|
91
|
+
"registry": "https://registry.npmjs.org/",
|
|
92
|
+
"provenance": true
|
|
55
93
|
},
|
|
56
94
|
"sideEffects": false
|
|
57
95
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/queries/getBlocksByIdChildren/index.d.ts
|
|
2
|
+
declare const getBlocksByIdChildren: ({
|
|
3
|
+
block_id,
|
|
4
|
+
getBlocksChildrenList
|
|
5
|
+
}: {
|
|
6
|
+
block_id: any;
|
|
7
|
+
getBlocksChildrenList: any;
|
|
8
|
+
}) => Promise<any>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getBlocksByIdChildren as default };
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getBlocksByIdChildren/index.ts"],"mappings":";cAGM,qBAAA;EAA+B,QAAA;EAAA;AAAA;;;MAAmC,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getBlocksByIdChildren/index.ts"],"sourcesContent":["import { avoidRateLimit, isUndefined } from '@jeromefitz/utils'\n\n// @todo(types)\nconst getBlocksByIdChildren = async ({ block_id, getBlocksChildrenList }) => {\n if (isUndefined(block_id)) return []\n await avoidRateLimit(0)\n return await getBlocksChildrenList({\n block_id,\n })\n}\n\nexport default getBlocksByIdChildren\n"],"mappings":"qGAGA,MAAM,EAAwB,MAAO,CAAE,WAAU,2BAC3C,EAAY,EAAS,CAAS,EAAE,EACpC,MAAM,EAAe,EAAE,CAChB,MAAM,EAAsB,CACjC,WACD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { O as SortItem } from "../../index-CvmUSReI.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/queries/getDatabasesByIdQuery/index.d.ts
|
|
4
|
+
declare const getDatabasesByIdQuery: ({
|
|
5
|
+
database_id,
|
|
6
|
+
filter,
|
|
7
|
+
getDatabasesQuery,
|
|
8
|
+
sorts
|
|
9
|
+
}: {
|
|
10
|
+
database_id: any;
|
|
11
|
+
filter?: any[] | undefined;
|
|
12
|
+
getDatabasesQuery: any;
|
|
13
|
+
sorts?: SortItem[] | undefined;
|
|
14
|
+
}) => Promise<any>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getDatabasesByIdQuery as default };
|
|
17
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getDatabasesByIdQuery/index.ts"],"mappings":";;;cAcM,qBAAA;EAA+B,WAAA;EAAA,MAAA;EAAA,iBAAA;EAAA;AAAA;;;;UAAA,QAAA;AAAA,MAKpC,OAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";import{PROPERTIES as e}from"../../constants/index.mjs";const t={sorts:[{direction:`ascending`,property:e.slug.notion}]},n=async({database_id:e,filter:n=t?.filter,getDatabasesQuery:r,sorts:i=t?.sorts})=>e?await r({database_id:e,filter:n,sorts:i}):[];export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getDatabasesByIdQuery/index.ts"],"sourcesContent":["import type { SortMock } from '../../schema/index.js'\n\nimport { PROPERTIES } from '../../constants/index.js'\n\nconst sortDefault: SortMock = {\n sorts: [\n {\n direction: 'ascending',\n property: PROPERTIES.slug.notion,\n },\n ],\n}\n\n// @todo(types)\nconst getDatabasesByIdQuery = async ({\n database_id,\n filter = sortDefault?.filter,\n getDatabasesQuery,\n sorts = sortDefault?.sorts,\n}) => {\n if (!database_id) return []\n return await getDatabasesQuery({\n database_id,\n filter,\n sorts,\n })\n}\n\nexport default getDatabasesByIdQuery\n"],"mappings":"wFAIA,MAAM,EAAwB,CAC5B,MAAO,CACL,CACE,UAAW,YACX,SAAU,EAAW,KAAK,OAC3B,CACF,CACF,CAGK,EAAwB,MAAO,CACnC,cACA,SAAS,GAAa,OACtB,oBACA,QAAQ,GAAa,SAEhB,EACE,MAAM,EAAkB,CAC7B,cACA,SACA,QACD,CAAC,CALuB,EAAE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/queries/getDeepFetchAllChildren/index.d.ts
|
|
2
|
+
declare const getDeepFetchAllChildren: ({
|
|
3
|
+
blocks,
|
|
4
|
+
getBlocksChildrenList
|
|
5
|
+
}: {
|
|
6
|
+
blocks: any;
|
|
7
|
+
getBlocksChildrenList: any;
|
|
8
|
+
}) => Promise<Array<any | any[]>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getDeepFetchAllChildren as default };
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getDeepFetchAllChildren/index.ts"],"mappings":";cAAM,uBAAA;EAAiC,MAAA;EAAA;AAAA;;;MAGnC,OAAA,CAAQ,KAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";const e=async({blocks:t,getBlocksChildrenList:n})=>{if(t==null)return t;let r=t.filter(e=>e.has_children).map(e=>{let{id:t}=e;return{parent_block:e,promise:n({block_id:t,page_size:100})}}),i=await Promise.all(r.map(e=>e.promise));for(let t=0;t<i.length;t++){let a=i[t].results;if(await e({blocks:a,getBlocksChildrenList:n}),r[t]){let e=r[t].parent_block;e[e.type].children=a}}return t};export{e as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getDeepFetchAllChildren/index.ts"],"sourcesContent":["const getDeepFetchAllChildren = async ({\n blocks,\n getBlocksChildrenList,\n}): Promise<Array<any | any[]>> => {\n if (blocks === null || blocks === undefined) return blocks\n const fetchChildrenMap = blocks\n .filter((block: { has_children: any }) => block.has_children)\n .map((parent_block: { id: string }) => {\n const { id: block_id } = parent_block\n return {\n parent_block,\n promise: getBlocksChildrenList({\n block_id,\n page_size: 100,\n }),\n }\n })\n\n const results = await Promise.all<any>(\n fetchChildrenMap.map((value) => value.promise),\n )\n\n for (let i = 0; i < results.length; i++) {\n const blocks = results[i].results\n await getDeepFetchAllChildren({\n blocks,\n getBlocksChildrenList,\n })\n if (fetchChildrenMap[i]) {\n const parent: any = fetchChildrenMap[i].parent_block\n parent[parent.type].children = blocks\n }\n }\n return blocks\n}\n\nexport default getDeepFetchAllChildren\n"],"mappings":"iCAAA,MAAM,EAA0B,MAAO,CACrC,SACA,2BACiC,CACjC,GAAI,GAAW,KAA8B,OAAO,EACpD,IAAM,EAAmB,EACtB,OAAQ,GAAiC,EAAM,aAAa,CAC5D,IAAK,GAAiC,CACrC,GAAM,CAAE,GAAI,GAAa,EACzB,MAAO,CACL,eACA,QAAS,EAAsB,CAC7B,WACA,UAAW,IACZ,CAAC,CACH,EACD,CAEE,EAAU,MAAM,QAAQ,IAC5B,EAAiB,IAAK,GAAU,EAAM,QAAQ,CAC/C,CAED,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,OAAQ,IAAK,CACvC,IAAM,EAAS,EAAQ,GAAG,QAK1B,GAJA,MAAM,EAAwB,CAC5B,SACA,wBACD,CAAC,CACE,EAAiB,GAAI,CACvB,IAAM,EAAc,EAAiB,GAAG,aACxC,EAAO,EAAO,MAAM,SAAW,GAGnC,OAAO"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/queries/getInfoType/index.d.ts
|
|
2
|
+
/** biome-ignore-all lint/correctness/noSwitchDeclarations: migrate */
|
|
3
|
+
/** biome-ignore-all lint/correctness/noUnsafeOptionalChaining: migrate */
|
|
4
|
+
declare const getInfoType: ({
|
|
5
|
+
config,
|
|
6
|
+
item,
|
|
7
|
+
meta,
|
|
8
|
+
routeType
|
|
9
|
+
}: {
|
|
10
|
+
config: any;
|
|
11
|
+
item: any;
|
|
12
|
+
meta: any;
|
|
13
|
+
routeType: any;
|
|
14
|
+
}) => {
|
|
15
|
+
as: string;
|
|
16
|
+
date: string;
|
|
17
|
+
href: string;
|
|
18
|
+
slug: any;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getInfoType as default };
|
|
22
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getInfoType/index.ts"],"mappings":";;;cAEM,WAAA;EAAe,MAAA;EAAA,IAAA;EAAA,IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";const e=({config:e,item:t,meta:n,routeType:r})=>{let{NOTION:i}=e,a=``,o=t.properties?.slug,s=``;switch(r){case i.BLOG.routeType:case i.EVENTS.routeType:a=t.properties[i[r.toUpperCase()].infoType.key]?.start.slice(0,10);let[e,c,l]=a?.split(`-`);s=`/${r}/${e}/${c}/${l}/${o}`;break;case i.EPISODES.routeType:s=`/${n?.join(`/`)}/${o}`;break;default:s=`/${r}/${o}`;break}return s=s.replace(`//`,`/`),{as:s,date:a,href:`/[...catchAll]`,slug:o}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getInfoType/index.ts"],"sourcesContent":["/** biome-ignore-all lint/correctness/noSwitchDeclarations: migrate */\n/** biome-ignore-all lint/correctness/noUnsafeOptionalChaining: migrate */\nconst getInfoType = ({ config, item, meta, routeType }) => {\n const { NOTION } = config\n\n let date = ''\n const slug = item.properties?.slug\n\n let as = ''\n const href = `/[...catchAll]`\n\n switch (routeType) {\n case NOTION.BLOG.routeType:\n case NOTION.EVENTS.routeType:\n date = item.properties[\n NOTION[routeType.toUpperCase()].infoType.key\n ]?.start.slice(0, 10)\n const [year, month, day] = date?.split('-')\n as = `/${routeType}/${year}/${month}/${day}/${slug}`\n break\n case NOTION.EPISODES.routeType:\n as = `/${meta?.join('/')}/${slug}`\n break\n // case NOTION.PODCASTS.routeType:\n // case NOTION.PEOPLE.routeType:\n // case NOTION.SHOWS.routeType:\n // case NOTION.VENUES.routeType:\n default:\n as = `/${routeType}/${slug}`\n break\n }\n\n as = as.replace('//', '/')\n\n return {\n as,\n date,\n href,\n slug,\n }\n}\n\nexport default getInfoType\n"],"mappings":"iCAEA,MAAM,GAAe,CAAE,SAAQ,OAAM,OAAM,eAAgB,CACzD,GAAM,CAAE,UAAW,EAEf,EAAO,GACL,EAAO,EAAK,YAAY,KAE1B,EAAK,GAGT,OAAQ,EAAR,CACE,KAAK,EAAO,KAAK,UACjB,KAAK,EAAO,OAAO,UACjB,EAAO,EAAK,WACV,EAAO,EAAU,aAAa,EAAE,SAAS,MACxC,MAAM,MAAM,EAAG,GAAG,CACrB,GAAM,CAAC,EAAM,EAAO,GAAO,GAAM,MAAM,IAAI,CAC3C,EAAK,IAAI,EAAU,GAAG,EAAK,GAAG,EAAM,GAAG,EAAI,GAAG,IAC9C,MACF,KAAK,EAAO,SAAS,UACnB,EAAK,IAAI,GAAM,KAAK,IAAI,CAAC,GAAG,IAC5B,MAKF,QACE,EAAK,IAAI,EAAU,GAAG,IACtB,MAKJ,MAFA,GAAK,EAAG,QAAQ,KAAM,IAAI,CAEnB,CACL,KACA,OACA,sBACA,OACD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/queries/getNotionListing/index.d.ts
|
|
2
|
+
declare const getNotionListing: ({
|
|
3
|
+
config,
|
|
4
|
+
getBlocksByIdChildren,
|
|
5
|
+
getDatabasesByIdQuery,
|
|
6
|
+
getPagesById,
|
|
7
|
+
pathVariables,
|
|
8
|
+
routeType
|
|
9
|
+
}: {
|
|
10
|
+
config: any;
|
|
11
|
+
getBlocksByIdChildren: any;
|
|
12
|
+
getDatabasesByIdQuery: any;
|
|
13
|
+
getPagesById: any;
|
|
14
|
+
pathVariables: any;
|
|
15
|
+
routeType: any;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
content?: undefined;
|
|
18
|
+
images?: undefined;
|
|
19
|
+
info?: undefined;
|
|
20
|
+
items?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
content: any;
|
|
23
|
+
images: {};
|
|
24
|
+
info: any;
|
|
25
|
+
items: Pick<any, string | number | symbol>;
|
|
26
|
+
}>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getNotionListing as default };
|
|
29
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getNotionListing/index.ts"],"mappings":";cAQM,gBAAA;EAA0B,MAAA;EAAA,qBAAA;EAAA,qBAAA;EAAA,YAAA;EAAA,aAAA;EAAA;AAAA;;;;;;;MAO/B,OAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";import{PROPERTIES as e}from"../../constants/index.mjs";import{n as t}from"../../utils-CyUrB6XV.mjs";import"../../getTypes-C_NXtnf-.mjs";import n from"lodash/map.js";import{sortObject as r}from"@jeromefitz/utils";import i from"lodash/omit.js";const a=async({config:a,getBlocksByIdChildren:o,getDatabasesByIdQuery:s,getPagesById:c,pathVariables:l,routeType:u})=>{let{NOTION:d}=a,f={},p=d[u.toUpperCase()].page_id__seo,m=await c({page_id:p});if(!m)return{};m?.object===`page`&&(f=i(m,`properties`),f.properties=r(t({config:a,data:m,pageId:f.id,pathVariables:l})));let h=d[u.toUpperCase()].infoType.notion??e.datePublished.notion,g=h===e.datePublished.notion?new Date(`2020-01-01`).toISOString():new Date().toISOString(),_=await o({block_id:f.id}),v=await s({database_id:d[u.toUpperCase()].database_id,filter:{and:[{date:{on_or_after:g},property:h}]}}),y=[];n(v.results,e=>{let n=e;n=i(n,`properties`),n.properties=r(t({config:a,data:e,pageId:e.id,pathVariables:l})),y.push(n)});let b=i(v,`results`);return b.results=y,{content:_,images:{},info:f,items:b}};export{a as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getNotionListing/index.ts"],"sourcesContent":["import { sortObject } from '@jeromefitz/utils'\n\nimport _map from 'lodash/map.js'\nimport _omit from 'lodash/omit.js'\n\nimport { PROPERTIES } from '../../constants/index.js'\nimport { dataNormalized } from '../../utils/index.js'\n\nconst getNotionListing = async ({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getPagesById,\n pathVariables,\n routeType,\n}) => {\n const { NOTION } = config\n\n let info: any = {}\n\n const page_id = NOTION[routeType.toUpperCase()].page_id__seo\n const _info = await getPagesById({\n page_id,\n })\n // @refactor(404)\n if (!_info) {\n return {}\n }\n if (_info?.object === 'page') {\n info = _omit(_info, 'properties')\n info.properties = sortObject(\n dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),\n )\n }\n\n const property =\n NOTION[routeType.toUpperCase()].infoType.notion ??\n PROPERTIES.datePublished.notion\n\n /**\n * @todo Can we make the date dynamic?\n * This can be considered the date you want to go back in time to on build.\n * Can be construed as the website creation date, too I guess.\n *\n * For those routeTypes that do not go off of datePublished,\n * we want to get their listing by the current date.\n *\n * ex) /events => Only want events that are in the future.\n *\n */\n const timestamp =\n property === PROPERTIES.datePublished.notion\n ? new Date('2020-01-01').toISOString()\n : new Date().toISOString()\n\n const content = await getBlocksByIdChildren({ block_id: info.id })\n const _items: any = await getDatabasesByIdQuery({\n database_id: NOTION[routeType.toUpperCase()].database_id,\n filter: {\n and: [\n {\n date: {\n on_or_after: timestamp,\n },\n property,\n },\n ],\n },\n })\n const results: any[] = []\n _map(_items.results, (item) => {\n let itemInit = item\n itemInit = _omit(itemInit, 'properties')\n itemInit.properties = sortObject(\n dataNormalized({ config, data: item, pageId: item.id, pathVariables }),\n )\n results.push(itemInit)\n // console.dir(`> last_edited_time`)\n // console.dir(item.id)\n // console.dir(item.last_edited_time)\n // console.dir(`---`)\n })\n const items = _omit(_items, 'results')\n items.results = results\n\n /**\n * @note(plaiceholder)\n *\n * Pass empty `images` object for SSR/API takeover\n */\n return { content, images: {}, info, items }\n}\n\nexport default getNotionListing\n"],"mappings":"mRAQA,MAAM,EAAmB,MAAO,CAC9B,SACA,wBACA,wBACA,eACA,gBACA,eACI,CACJ,GAAM,CAAE,UAAW,EAEf,EAAY,EAAE,CAEZ,EAAU,EAAO,EAAU,aAAa,EAAE,aAC1C,EAAQ,MAAM,EAAa,CAC/B,UACD,CAAC,CAEF,GAAI,CAAC,EACH,MAAO,EAAE,CAEP,GAAO,SAAW,SACpB,EAAO,EAAM,EAAO,aAAa,CACjC,EAAK,WAAa,EAChB,EAAe,CAAE,SAAQ,KAAM,EAAO,OAAQ,EAAK,GAAI,gBAAe,CAAC,CACxE,EAGH,IAAM,EACJ,EAAO,EAAU,aAAa,EAAE,SAAS,QACzC,EAAW,cAAc,OAarB,EACJ,IAAa,EAAW,cAAc,OAClC,IAAI,KAAK,aAAa,CAAC,aAAa,CACpC,IAAI,MAAM,CAAC,aAAa,CAExB,EAAU,MAAM,EAAsB,CAAE,SAAU,EAAK,GAAI,CAAC,CAC5D,EAAc,MAAM,EAAsB,CAC9C,YAAa,EAAO,EAAU,aAAa,EAAE,YAC7C,OAAQ,CACN,IAAK,CACH,CACE,KAAM,CACJ,YAAa,EACd,CACD,WACD,CACF,CACF,CACF,CAAC,CACI,EAAiB,EAAE,CACzB,EAAK,EAAO,QAAU,GAAS,CAC7B,IAAI,EAAW,EACf,EAAW,EAAM,EAAU,aAAa,CACxC,EAAS,WAAa,EACpB,EAAe,CAAE,SAAQ,KAAM,EAAM,OAAQ,EAAK,GAAI,gBAAe,CAAC,CACvE,CACD,EAAQ,KAAK,EAAS,EAKtB,CACF,IAAM,EAAQ,EAAM,EAAQ,UAAU,CAQtC,MAPA,GAAM,QAAU,EAOT,CAAE,UAAS,OAAQ,EAAE,CAAE,OAAM,QAAO"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/queries/getNotionListingByDate/index.d.ts
|
|
2
|
+
declare const getNotionListingByDate: ({
|
|
3
|
+
config,
|
|
4
|
+
getBlocksByIdChildren,
|
|
5
|
+
getDatabasesByIdQuery,
|
|
6
|
+
getPagesById,
|
|
7
|
+
pathVariables,
|
|
8
|
+
routeType,
|
|
9
|
+
slug
|
|
10
|
+
}: {
|
|
11
|
+
config: any;
|
|
12
|
+
getBlocksByIdChildren: any;
|
|
13
|
+
getDatabasesByIdQuery: any;
|
|
14
|
+
getPagesById: any;
|
|
15
|
+
pathVariables: any;
|
|
16
|
+
routeType: any;
|
|
17
|
+
slug: any;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
content: any;
|
|
20
|
+
images: {};
|
|
21
|
+
info: any;
|
|
22
|
+
items: Pick<Pick<any, string | number | symbol>, string | number | symbol>;
|
|
23
|
+
}>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getNotionListingByDate as default };
|
|
26
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getNotionListingByDate/index.ts"],"mappings":";cAsIM,sBAAA;EAAgC,MAAA;EAAA,qBAAA;EAAA,qBAAA;EAAA,YAAA;EAAA,aAAA;EAAA,SAAA;EAAA;AAAA;;;;;;;;MAQrC,OAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";import{PROPERTIES as e,QUERIES as t}from"../../constants/index.mjs";import n from"../../utils/addTime/index.mjs";import{n as r}from"../../utils-CyUrB6XV.mjs";import"../../getTypes-C_NXtnf-.mjs";import i from"lodash/map.js";import{sortObject as a}from"@jeromefitz/utils";import o from"lodash/omit.js";import s from"lodash/size.js";const c=({config:r,pathVariables:i,routeType:a,slug:o})=>{let{NOTION:c}=r,{meta:l}=i,[u,d,f]=l,p=s(l),m=new Date().toISOString(),h=new Date(`${u||m.slice(0,4)}-${d||`01`}-${f||`01`}`),g=c[a.toUpperCase()]?.infoType?.notion??e.datePublished.notion;switch(p){case 1:return{and:[{date:{on_or_after:n(h,``)},property:g},{date:{before:n(h,`year`)},property:g}]};case 2:return{and:[{date:{on_or_after:n(h,``)},property:g},{date:{before:n(h,`month`)},property:g}]};case 3:return{and:[{date:{on_or_after:n(h,``)},property:g},{date:{before:n(h,`day`)},property:g}]};default:return{and:[{date:{on_or_after:n(h,``)},property:g},{date:{before:n(h,`day`)},property:g},{...t.slug,rich_text:{equals:o}}]}}},l=async({config:t,getBlocksByIdChildren:n,getDatabasesByIdQuery:s,getPagesById:l,pathVariables:u,routeType:d,slug:f})=>{let{NOTION:p}=t,m={},h={},g=p[d.toUpperCase()].page_id__seo,_=await l({page_id:g});_.object===`page`&&(h=o(_,`properties`),h.properties=a(r({config:t,data:_,pageId:_.id,pathVariables:u}))),m=await n({block_id:h.id});let v=[{direction:`descending`,property:e.datePublished.notion}],y=c({config:t,pathVariables:u,routeType:d,slug:f}),b=p[d.toUpperCase()].database_id,x=await s({database_id:b,filter:y,sorts:v}),S=[];i(x.results,e=>{let n=o(e,`properties`);n.properties=a(r({config:t,data:e,pageId:n.id,pathVariables:u})),n&&S.push(n)});let C=o(x,`results`);C.results=S;let w=o(C,`data`);return{content:m,images:{},info:h,items:w}};export{l as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getNotionListingByDate/index.ts"],"sourcesContent":["import type { SortItem } from '../../schema/index.js'\n\nimport { sortObject } from '@jeromefitz/utils'\n\nimport _map from 'lodash/map.js'\nimport _omit from 'lodash/omit.js'\nimport _size from 'lodash/size.js'\n\nimport { PROPERTIES, QUERIES } from '../../constants/index.js'\nimport { addTime, dataNormalized } from '../../utils/index.js'\n\nconst getNotionListingByDate__getFilter = ({\n config,\n pathVariables,\n routeType,\n slug,\n}) => {\n const { NOTION } = config\n const { meta } = pathVariables\n const [year, month, day] = meta\n const metaCount = _size(meta)\n // @hack nothing to see here, haha\n const dateTimestamp = new Date().toISOString()\n const timestampQuery = new Date(\n `${year ? year : dateTimestamp.slice(0, 4)}-${month ? month : '01'}-${\n day ? day : '01'\n }`,\n )\n\n /**\n * @filter\n * @note metaCount breakdown:\n * 1 = yyyy\n * 2 = yyyy/mm\n * 3 = yyyy/mm/dd\n * ? = yyyy/mm/dd/slug (SLUG_BY_ROUTE takes this over)\n */\n const property =\n NOTION[routeType.toUpperCase()]?.infoType?.notion ??\n PROPERTIES.datePublished.notion\n\n switch (metaCount) {\n /**\n * @note yyyy\n */\n case 1:\n return {\n and: [\n {\n date: {\n on_or_after: addTime(timestampQuery, ''),\n },\n property,\n },\n {\n date: {\n before: addTime(timestampQuery, 'year'),\n },\n property,\n },\n ],\n }\n\n /**\n * @note yyyy/mm\n */\n case 2:\n return {\n and: [\n {\n date: {\n on_or_after: addTime(timestampQuery, ''),\n },\n property,\n },\n {\n date: {\n before: addTime(timestampQuery, 'month'),\n },\n property,\n },\n ],\n }\n\n /**\n * @note yyyy/mm/dd\n */\n case 3:\n return {\n and: [\n {\n date: {\n on_or_after: addTime(timestampQuery, ''),\n },\n property,\n },\n {\n date: {\n before: addTime(timestampQuery, 'day'),\n },\n property,\n },\n ],\n }\n\n /**\n * @note yyyy/mm/dd/slug\n *\n * Technically this is picked up by `getNotionSlugByRoute` SLUG_BY_ROUTE\n */\n default:\n return {\n and: [\n {\n date: {\n on_or_after: addTime(timestampQuery, ''),\n },\n property,\n },\n {\n date: {\n before: addTime(timestampQuery, 'day'),\n },\n property,\n },\n {\n ...QUERIES.slug,\n rich_text: { equals: slug },\n },\n ],\n }\n }\n}\n\nconst getNotionListingByDate = async ({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getPagesById,\n pathVariables,\n routeType,\n slug,\n}) => {\n const { NOTION } = config\n\n let content: any = {},\n info: any = {}\n\n const page_id = NOTION[routeType.toUpperCase()].page_id__seo\n const _info = await getPagesById({\n page_id,\n })\n if (_info.object === 'page') {\n info = _omit(_info, 'properties')\n info.properties = sortObject(\n dataNormalized({ config, data: _info, pageId: _info.id, pathVariables }),\n )\n }\n\n content = await getBlocksByIdChildren({ block_id: info.id })\n\n const sorts: SortItem[] = [\n {\n direction: 'descending',\n property: PROPERTIES.datePublished.notion,\n },\n ]\n const filter = getNotionListingByDate__getFilter({\n config,\n pathVariables,\n routeType,\n slug,\n })\n\n const database_id = NOTION[routeType.toUpperCase()].database_id\n\n const ___items: any = await getDatabasesByIdQuery({\n database_id,\n filter,\n sorts,\n })\n const __items: any[] = []\n _map(___items.results, (i) => {\n const item = _omit(i, 'properties')\n item.properties = sortObject(\n dataNormalized({ config, data: i, pageId: item.id, pathVariables }),\n )\n !!item && __items.push(item)\n })\n const _items = _omit(___items, 'results')\n _items.results = __items\n const items = _omit(_items, 'data')\n\n /**\n * @note(plaiceholder)\n *\n * Pass empty `images` object for SSR/API takeover\n */\n return { content, images: {}, info, items }\n}\n\nexport default getNotionListingByDate\n"],"mappings":"2WAWA,MAAM,GAAqC,CACzC,SACA,gBACA,YACA,UACI,CACJ,GAAM,CAAE,UAAW,EACb,CAAE,QAAS,EACX,CAAC,EAAM,EAAO,GAAO,EACrB,EAAY,EAAM,EAAK,CAEvB,EAAgB,IAAI,MAAM,CAAC,aAAa,CACxC,EAAiB,IAAI,KACzB,GAAG,GAAc,EAAc,MAAM,EAAG,EAAE,CAAC,GAAG,GAAgB,KAAK,GACjE,GAAY,OAEf,CAUK,EACJ,EAAO,EAAU,aAAa,GAAG,UAAU,QAC3C,EAAW,cAAc,OAE3B,OAAQ,EAAR,CAIE,IAAK,GACH,MAAO,CACL,IAAK,CACH,CACE,KAAM,CACJ,YAAa,EAAQ,EAAgB,GAAG,CACzC,CACD,WACD,CACD,CACE,KAAM,CACJ,OAAQ,EAAQ,EAAgB,OAAO,CACxC,CACD,WACD,CACF,CACF,CAKH,IAAK,GACH,MAAO,CACL,IAAK,CACH,CACE,KAAM,CACJ,YAAa,EAAQ,EAAgB,GAAG,CACzC,CACD,WACD,CACD,CACE,KAAM,CACJ,OAAQ,EAAQ,EAAgB,QAAQ,CACzC,CACD,WACD,CACF,CACF,CAKH,IAAK,GACH,MAAO,CACL,IAAK,CACH,CACE,KAAM,CACJ,YAAa,EAAQ,EAAgB,GAAG,CACzC,CACD,WACD,CACD,CACE,KAAM,CACJ,OAAQ,EAAQ,EAAgB,MAAM,CACvC,CACD,WACD,CACF,CACF,CAOH,QACE,MAAO,CACL,IAAK,CACH,CACE,KAAM,CACJ,YAAa,EAAQ,EAAgB,GAAG,CACzC,CACD,WACD,CACD,CACE,KAAM,CACJ,OAAQ,EAAQ,EAAgB,MAAM,CACvC,CACD,WACD,CACD,CACE,GAAG,EAAQ,KACX,UAAW,CAAE,OAAQ,EAAM,CAC5B,CACF,CACF,GAID,EAAyB,MAAO,CACpC,SACA,wBACA,wBACA,eACA,gBACA,YACA,UACI,CACJ,GAAM,CAAE,UAAW,EAEf,EAAe,EAAE,CACnB,EAAY,EAAE,CAEV,EAAU,EAAO,EAAU,aAAa,EAAE,aAC1C,EAAQ,MAAM,EAAa,CAC/B,UACD,CAAC,CACE,EAAM,SAAW,SACnB,EAAO,EAAM,EAAO,aAAa,CACjC,EAAK,WAAa,EAChB,EAAe,CAAE,SAAQ,KAAM,EAAO,OAAQ,EAAM,GAAI,gBAAe,CAAC,CACzE,EAGH,EAAU,MAAM,EAAsB,CAAE,SAAU,EAAK,GAAI,CAAC,CAE5D,IAAM,EAAoB,CACxB,CACE,UAAW,aACX,SAAU,EAAW,cAAc,OACpC,CACF,CACK,EAAS,EAAkC,CAC/C,SACA,gBACA,YACA,OACD,CAAC,CAEI,EAAc,EAAO,EAAU,aAAa,EAAE,YAE9C,EAAgB,MAAM,EAAsB,CAChD,cACA,SACA,QACD,CAAC,CACI,EAAiB,EAAE,CACzB,EAAK,EAAS,QAAU,GAAM,CAC5B,IAAM,EAAO,EAAM,EAAG,aAAa,CACnC,EAAK,WAAa,EAChB,EAAe,CAAE,SAAQ,KAAM,EAAG,OAAQ,EAAK,GAAI,gBAAe,CAAC,CACpE,CACC,GAAQ,EAAQ,KAAK,EAAK,EAC5B,CACF,IAAM,EAAS,EAAM,EAAU,UAAU,CACzC,EAAO,QAAU,EACjB,IAAM,EAAQ,EAAM,EAAQ,OAAO,CAOnC,MAAO,CAAE,UAAS,OAAQ,EAAE,CAAE,OAAM,QAAO"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/queries/getNotionSlug/index.d.ts
|
|
2
|
+
declare const getNotionSlug: ({
|
|
3
|
+
config,
|
|
4
|
+
getBlocksByIdChildren,
|
|
5
|
+
getDatabasesByIdQuery,
|
|
6
|
+
getDeepFetchAllChildren,
|
|
7
|
+
pathVariables,
|
|
8
|
+
routeType,
|
|
9
|
+
slug
|
|
10
|
+
}: {
|
|
11
|
+
config: any;
|
|
12
|
+
getBlocksByIdChildren: any;
|
|
13
|
+
getDatabasesByIdQuery: any;
|
|
14
|
+
getDeepFetchAllChildren: any;
|
|
15
|
+
pathVariables: any;
|
|
16
|
+
routeType: any;
|
|
17
|
+
slug: any;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
content: {};
|
|
20
|
+
images: {};
|
|
21
|
+
info: {};
|
|
22
|
+
items: {};
|
|
23
|
+
} | {
|
|
24
|
+
content?: undefined;
|
|
25
|
+
images?: undefined;
|
|
26
|
+
info?: undefined;
|
|
27
|
+
items?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
content: any[];
|
|
30
|
+
images: {};
|
|
31
|
+
info: Pick<any, string | number | symbol>;
|
|
32
|
+
items: {};
|
|
33
|
+
}>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { getNotionSlug as default };
|
|
36
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getNotionSlug/index.ts"],"mappings":";cAQM,aAAA;EAAuB,MAAA;EAAA,qBAAA;EAAA,qBAAA;EAAA,uBAAA;EAAA,aAAA;EAAA,SAAA;EAAA;AAAA;;;;;;;;MAQ5B,OAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";import{QUERIES as e}from"../../constants/index.mjs";import{n as t}from"../../utils-CyUrB6XV.mjs";import"../../getTypes-C_NXtnf-.mjs";import{sortObject as n}from"@jeromefitz/utils";import r from"lodash/omit.js";const i=async({config:i,getBlocksByIdChildren:a,getDatabasesByIdQuery:o,getDeepFetchAllChildren:s,pathVariables:c,routeType:l,slug:u})=>{let{NOTION:d}=i,f=l?.toUpperCase();if(!Object.keys(d).includes(f))return{content:{},images:{},info:{},items:{}};let p=await o({database_id:d[f].database_id,filter:{and:[{...e.slug,rich_text:{equals:u}}]}}),m=p?.object===`list`&&p.results[0];if(!m)return{};let h=r(m,`properties`);return h.properties=n(t({config:i,data:m,pageId:h.id,pathVariables:c})),{content:[...await s({blocks:(await a({block_id:h.id})).results})],images:{},info:h,items:{}}};export{i as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getNotionSlug/index.ts"],"sourcesContent":["// import _filter from 'lodash/filter.js'\nimport { sortObject } from '@jeromefitz/utils'\n\nimport _omit from 'lodash/omit.js'\n\nimport { QUERIES } from '../../constants/index.js'\nimport { dataNormalized } from '../../utils/index.js'\n\nconst getNotionSlug = async ({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getDeepFetchAllChildren,\n pathVariables,\n routeType,\n slug,\n}) => {\n const { NOTION } = config\n\n const DB_TYPE = routeType?.toUpperCase()\n const isValid = Object.keys(NOTION).includes(DB_TYPE)\n\n if (!isValid) return { content: {}, images: {}, info: {}, items: {} }\n\n const __info: any = await getDatabasesByIdQuery({\n database_id: NOTION[DB_TYPE].database_id,\n filter: {\n and: [\n {\n ...QUERIES.slug,\n rich_text: { equals: slug },\n },\n ],\n },\n })\n\n const _info = __info?.object === 'list' && __info.results[0]\n // @refactor(404)\n if (!_info) {\n return {}\n }\n\n const info = _omit(_info, 'properties')\n info.properties = sortObject(\n dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),\n )\n\n const _content = await getBlocksByIdChildren({ block_id: info.id })\n const blocks = [...(await getDeepFetchAllChildren({ blocks: _content.results }))]\n const content = blocks\n\n /**\n * @question if this is reached, there are no `items`\n */\n // const items: any = {}\n // items.results = _filter(items?.results, { properties: { isPublished: true } })\n\n /**\n * @note(plaiceholder)\n *\n * Pass empty `images` object for SSR/API takeover\n */\n return { content, images: {}, info, items: {} }\n}\n\nexport default getNotionSlug\n"],"mappings":"mPAQA,MAAM,EAAgB,MAAO,CAC3B,SACA,wBACA,wBACA,0BACA,gBACA,YACA,UACI,CACJ,GAAM,CAAE,UAAW,EAEb,EAAU,GAAW,aAAa,CAGxC,GAAI,CAFY,OAAO,KAAK,EAAO,CAAC,SAAS,EAAQ,CAEvC,MAAO,CAAE,QAAS,EAAE,CAAE,OAAQ,EAAE,CAAE,KAAM,EAAE,CAAE,MAAO,EAAE,CAAE,CAErE,IAAM,EAAc,MAAM,EAAsB,CAC9C,YAAa,EAAO,GAAS,YAC7B,OAAQ,CACN,IAAK,CACH,CACE,GAAG,EAAQ,KACX,UAAW,CAAE,OAAQ,EAAM,CAC5B,CACF,CACF,CACF,CAAC,CAEI,EAAQ,GAAQ,SAAW,QAAU,EAAO,QAAQ,GAE1D,GAAI,CAAC,EACH,MAAO,EAAE,CAGX,IAAM,EAAO,EAAM,EAAO,aAAa,CAoBvC,MAnBA,GAAK,WAAa,EAChB,EAAe,CAAE,SAAQ,KAAM,EAAO,OAAQ,EAAK,GAAI,gBAAe,CAAC,CACxE,CAiBM,CAAE,QAdM,CAAC,GAAI,MAAM,EAAwB,CAAE,QADnC,MAAM,EAAsB,CAAE,SAAU,EAAK,GAAI,CAAC,EACE,QAAS,CAAC,CAAE,CAc/D,OAAQ,EAAE,CAAE,OAAM,MAAO,EAAE,CAAE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/queries/getNotionSlugByRoute/index.d.ts
|
|
2
|
+
declare const getNotionSlugByRoute: ({
|
|
3
|
+
config,
|
|
4
|
+
getBlocksByIdChildren,
|
|
5
|
+
getDatabasesByIdQuery,
|
|
6
|
+
getQuery,
|
|
7
|
+
pathVariables,
|
|
8
|
+
routeType,
|
|
9
|
+
slug
|
|
10
|
+
}: {
|
|
11
|
+
config: any;
|
|
12
|
+
getBlocksByIdChildren: any;
|
|
13
|
+
getDatabasesByIdQuery: any;
|
|
14
|
+
getQuery: any;
|
|
15
|
+
pathVariables: any;
|
|
16
|
+
routeType: any;
|
|
17
|
+
slug: any;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
content: any;
|
|
20
|
+
images: {};
|
|
21
|
+
info: Pick<any, string | number | symbol>;
|
|
22
|
+
items: {};
|
|
23
|
+
}>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getNotionSlugByRoute as default };
|
|
26
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getNotionSlugByRoute/index.ts"],"mappings":";cA8JM,oBAAA;EAA8B,MAAA;EAAA,qBAAA;EAAA,qBAAA;EAAA,QAAA;EAAA,aAAA;EAAA,SAAA;EAAA;AAAA;;;;;;;;MAQnC,OAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../chunk-pm2C21R4.mjs";import{DATA_TYPES as e,PROPERTIES as t,QUERIES as n}from"../../constants/index.mjs";import r from"../../utils/addTime/index.mjs";import{n as i}from"../../utils-CyUrB6XV.mjs";import"../../getTypes-C_NXtnf-.mjs";import{sortObject as a}from"@jeromefitz/utils";import o from"lodash/omit.js";import s from"lodash/size.js";const c=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:c,pathVariables:l,routeType:u})=>{let{NOTION:d}=e,{meta:f}=l,p=u.toUpperCase(),[m,h]=f,g=s(f)===2,_=d[p]?.hasChild?.toUpperCase(),v=await r({database_id:d[g?d[_].routeType.toUpperCase():p].database_id,filter:{and:[{...n.slug,rich_text:{equals:g?h:m}}]}}),y=v?.object===`list`&&v.results[0];if(!y)return{content:{},images:{},info:{},items:{}};let b=o(y,`properties`);b.properties=a(i({config:e,data:y,pageId:b.id,pathVariables:l}));let x=await t({block_id:b.id}),S={};return g||(S=await c({config:e,reqQuery:{databaseType:d[_].routeType.toUpperCase(),podcasts:b.id}})),{content:x,images:{},info:b,items:S}},l=async({config:e,getBlocksByIdChildren:s,getDatabasesByIdQuery:c,pathVariables:l,routeType:u,slug:d})=>{let f=new Date().toISOString(),{NOTION:p}=e,{meta:m}=l,[h,g,_]=m,v=new Date(`${h||f.slice(0,4)}-${g||`01`}-${_||`01`}`),y=p[u.toUpperCase()]?.infoType?.notion??t.datePublished.notion,b=await c({database_id:p[u.toUpperCase()].database_id,filter:{and:[{date:{on_or_after:r(v,``)},property:y},{date:{before:r(v,`day`)},property:y},{...n.slug,rich_text:{equals:d}}]}}),x=b?.object===`list`&&b.results[0];if(!x)return{content:{},images:{},info:{},items:{}};let S=o(x,`properties`);return S.properties=a(i({config:e,data:x,pageId:S.id,pathVariables:l})),{content:await s({block_id:S.id}),images:{},info:S,items:{}}},u=async({config:t,getBlocksByIdChildren:n,getDatabasesByIdQuery:r,getQuery:i,pathVariables:a,routeType:o,slug:s})=>{let{NOTION:u,ROUTE_TYPES_BY_DATA_TYPES:d}=t;return u[o?.toUpperCase()]?.hasChild?await c({config:t,getBlocksByIdChildren:n,getDatabasesByIdQuery:r,getQuery:i,pathVariables:a,routeType:o}):d[e.LISTING_BY_DATE].includes(o.toUpperCase())?await l({config:t,getBlocksByIdChildren:n,getDatabasesByIdQuery:r,pathVariables:a,routeType:o,slug:s}):{content:{},images:{},info:{},items:{}}};export{u as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getNotionSlugByRoute/index.ts"],"sourcesContent":["import { sortObject } from '@jeromefitz/utils'\n\nimport _omit from 'lodash/omit.js'\nimport _size from 'lodash/size.js'\n\nimport { DATA_TYPES, PROPERTIES, QUERIES } from '../../constants/index.js'\nimport { addTime, dataNormalized } from '../../utils/index.js'\n\n/**\n * @note Determine if PARENT|CHILD should be returned:\n *\n * PARENT\n * - /[parent-routeType]/[slug]\n * - /podcasts/jer-and-ky-and-guest\n *\n * CHILD\n * - /[parent-routeType]/[child-routeType]/[slug]\n * - /podcasts/jer-and-ky-and-guest/am-i-dracula-greg-gillotti\n\n *\n */\nconst getNotionSlugByRoute__getDataByParentRouteType = async ({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getQuery,\n pathVariables,\n routeType,\n // slug,\n}) => {\n const { NOTION } = config\n const { meta } = pathVariables\n\n const ROUTE_TYPE = routeType.toUpperCase()\n\n const [parentSlug, slug] = meta\n const isChild = _size(meta) === 2\n\n const CHILD = NOTION[ROUTE_TYPE]?.hasChild?.toUpperCase()\n\n const __info: any = await getDatabasesByIdQuery({\n database_id:\n NOTION[isChild ? NOTION[CHILD].routeType.toUpperCase() : ROUTE_TYPE]\n .database_id,\n filter: {\n and: [\n {\n ...QUERIES.slug,\n rich_text: { equals: isChild ? slug : parentSlug },\n },\n ],\n },\n })\n\n const _info = __info?.object === 'list' && __info.results[0]\n // @refactor(404)\n if (!_info) {\n return { content: {}, images: {}, info: {}, items: {} }\n }\n const info = _omit(_info, 'properties')\n info.properties = sortObject(\n dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),\n )\n const content = await getBlocksByIdChildren({ block_id: info.id })\n let items = {}\n\n /**\n * @note if PARENT then get CHILDREN via `items`\n */\n if (!isChild) {\n items = await getQuery({\n config,\n reqQuery: {\n databaseType: NOTION[CHILD].routeType.toUpperCase(),\n podcasts: info.id,\n },\n })\n }\n\n return { content, images: {}, info, items }\n}\n\n/**\n * @note This is unique because the following are different:\n *\n * - /events/2020/05/01/jerome-and\n * - /events/2020/05/08/jerome-and\n * - /[routeType]/[yyyy/mm/dd]/[slug]\n *\n * We actually _do_ use the date for this.\n *\n */\nconst getNotionSlugByRoute__getDataByListingDate = async ({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n // getQuery,\n pathVariables,\n routeType,\n slug,\n}) => {\n const dateTimestamp = new Date().toISOString()\n\n const { NOTION } = config\n const { meta } = pathVariables\n\n const [year, month, day] = meta\n /**\n * @hack uh... nothing to see here, haha\n */\n const timestampQuery = new Date(\n `${year ? year : dateTimestamp.slice(0, 4)}-${month ? month : '01'}-${\n day ? day : '01'\n }`,\n )\n const property =\n NOTION[routeType.toUpperCase()]?.infoType?.notion ??\n PROPERTIES.datePublished.notion\n\n const __info: any = await getDatabasesByIdQuery({\n database_id: NOTION[routeType.toUpperCase()].database_id,\n filter: {\n and: [\n {\n date: {\n on_or_after: addTime(timestampQuery, ''),\n },\n property,\n },\n {\n date: {\n before: addTime(timestampQuery, 'day'),\n },\n property,\n },\n {\n ...QUERIES.slug,\n rich_text: { equals: slug },\n },\n ],\n },\n })\n\n const _info = __info?.object === 'list' && __info.results[0]\n // @refactor(404)\n if (!_info) {\n return { content: {}, images: {}, info: {}, items: {} }\n }\n\n const info = _omit(_info, 'properties')\n info.properties = sortObject(\n dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),\n )\n const content = await getBlocksByIdChildren({ block_id: info.id })\n\n return { content, images: {}, info, items: {} }\n}\n\nconst getNotionSlugByRoute = async ({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getQuery,\n pathVariables,\n routeType,\n slug,\n}) => {\n const { NOTION, ROUTE_TYPES_BY_DATA_TYPES } = config\n\n /**\n * @custom (notion) DATA_TYPES.SLUG_BY_ROUTE -- but customized:\n * Determine if `routeType` is a parent|child\n *\n * // @todo(next-notion) move to `isChild`\n *\n */\n if (NOTION[routeType?.toUpperCase()]?.hasChild) {\n return await getNotionSlugByRoute__getDataByParentRouteType({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getQuery,\n pathVariables,\n routeType,\n // slug,\n })\n }\n\n /**\n * @custom (notion) DATA_TYPES.LISTING_BY_DATE\n *\n */\n if (\n ROUTE_TYPES_BY_DATA_TYPES[DATA_TYPES.LISTING_BY_DATE].includes(\n routeType.toUpperCase(),\n )\n ) {\n return await getNotionSlugByRoute__getDataByListingDate({\n config,\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n // getQuery,\n pathVariables,\n routeType,\n slug,\n })\n }\n\n return { content: {}, images: {}, info: {}, items: {} }\n}\n\nexport default getNotionSlugByRoute\n"],"mappings":"8VAqBA,MAAM,EAAiD,MAAO,CAC5D,SACA,wBACA,wBACA,WACA,gBACA,eAEI,CACJ,GAAM,CAAE,UAAW,EACb,CAAE,QAAS,EAEX,EAAa,EAAU,aAAa,CAEpC,CAAC,EAAY,GAAQ,EACrB,EAAU,EAAM,EAAK,GAAK,EAE1B,EAAQ,EAAO,IAAa,UAAU,aAAa,CAEnD,EAAc,MAAM,EAAsB,CAC9C,YACE,EAAO,EAAU,EAAO,GAAO,UAAU,aAAa,CAAG,GACtD,YACL,OAAQ,CACN,IAAK,CACH,CACE,GAAG,EAAQ,KACX,UAAW,CAAE,OAAQ,EAAU,EAAO,EAAY,CACnD,CACF,CACF,CACF,CAAC,CAEI,EAAQ,GAAQ,SAAW,QAAU,EAAO,QAAQ,GAE1D,GAAI,CAAC,EACH,MAAO,CAAE,QAAS,EAAE,CAAE,OAAQ,EAAE,CAAE,KAAM,EAAE,CAAE,MAAO,EAAE,CAAE,CAEzD,IAAM,EAAO,EAAM,EAAO,aAAa,CACvC,EAAK,WAAa,EAChB,EAAe,CAAE,SAAQ,KAAM,EAAO,OAAQ,EAAK,GAAI,gBAAe,CAAC,CACxE,CACD,IAAM,EAAU,MAAM,EAAsB,CAAE,SAAU,EAAK,GAAI,CAAC,CAC9D,EAAQ,EAAE,CAed,OAVK,IACH,EAAQ,MAAM,EAAS,CACrB,SACA,SAAU,CACR,aAAc,EAAO,GAAO,UAAU,aAAa,CACnD,SAAU,EAAK,GAChB,CACF,CAAC,EAGG,CAAE,UAAS,OAAQ,EAAE,CAAE,OAAM,QAAO,EAavC,EAA6C,MAAO,CACxD,SACA,wBACA,wBAEA,gBACA,YACA,UACI,CACJ,IAAM,EAAgB,IAAI,MAAM,CAAC,aAAa,CAExC,CAAE,UAAW,EACb,CAAE,QAAS,EAEX,CAAC,EAAM,EAAO,GAAO,EAIrB,EAAiB,IAAI,KACzB,GAAG,GAAc,EAAc,MAAM,EAAG,EAAE,CAAC,GAAG,GAAgB,KAAK,GACjE,GAAY,OAEf,CACK,EACJ,EAAO,EAAU,aAAa,GAAG,UAAU,QAC3C,EAAW,cAAc,OAErB,EAAc,MAAM,EAAsB,CAC9C,YAAa,EAAO,EAAU,aAAa,EAAE,YAC7C,OAAQ,CACN,IAAK,CACH,CACE,KAAM,CACJ,YAAa,EAAQ,EAAgB,GAAG,CACzC,CACD,WACD,CACD,CACE,KAAM,CACJ,OAAQ,EAAQ,EAAgB,MAAM,CACvC,CACD,WACD,CACD,CACE,GAAG,EAAQ,KACX,UAAW,CAAE,OAAQ,EAAM,CAC5B,CACF,CACF,CACF,CAAC,CAEI,EAAQ,GAAQ,SAAW,QAAU,EAAO,QAAQ,GAE1D,GAAI,CAAC,EACH,MAAO,CAAE,QAAS,EAAE,CAAE,OAAQ,EAAE,CAAE,KAAM,EAAE,CAAE,MAAO,EAAE,CAAE,CAGzD,IAAM,EAAO,EAAM,EAAO,aAAa,CAMvC,MALA,GAAK,WAAa,EAChB,EAAe,CAAE,SAAQ,KAAM,EAAO,OAAQ,EAAK,GAAI,gBAAe,CAAC,CACxE,CAGM,CAAE,QAFO,MAAM,EAAsB,CAAE,SAAU,EAAK,GAAI,CAAC,CAEhD,OAAQ,EAAE,CAAE,OAAM,MAAO,EAAE,CAAE,EAG3C,EAAuB,MAAO,CAClC,SACA,wBACA,wBACA,WACA,gBACA,YACA,UACI,CACJ,GAAM,CAAE,SAAQ,6BAA8B,EAyC9C,OAhCI,EAAO,GAAW,aAAa,GAAG,SAC7B,MAAM,EAA+C,CAC1D,SACA,wBACA,wBACA,WACA,gBACA,YAED,CAAC,CAQF,EAA0B,EAAW,iBAAiB,SACpD,EAAU,aAAa,CACxB,CAEM,MAAM,EAA2C,CACtD,SACA,wBACA,wBAEA,gBACA,YACA,OACD,CAAC,CAGG,CAAE,QAAS,EAAE,CAAE,OAAQ,EAAE,CAAE,KAAM,EAAE,CAAE,MAAO,EAAE,CAAE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/queries/getPagesById/index.d.ts
|
|
2
|
+
declare const getPagesById: ({
|
|
3
|
+
getPagesRetrieve,
|
|
4
|
+
page_id
|
|
5
|
+
}: {
|
|
6
|
+
getPagesRetrieve: any;
|
|
7
|
+
page_id: any;
|
|
8
|
+
}) => Promise<any>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getPagesById as default };
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/queries/getPagesById/index.ts"],"mappings":";cAGM,YAAA;EAAsB,gBAAA;EAAA;AAAA;;;MAA6B,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/queries/getPagesById/index.ts"],"sourcesContent":["import { avoidRateLimit, isUndefined } from '@jeromefitz/utils'\n\n// @todo(types)\nconst getPagesById = async ({ getPagesRetrieve, page_id }) => {\n if (isUndefined(page_id)) return []\n await avoidRateLimit(0)\n return await getPagesRetrieve({\n page_id,\n })\n}\n\nexport default getPagesById\n"],"mappings":"qGAGA,MAAM,EAAe,MAAO,CAAE,mBAAkB,aAC1C,EAAY,EAAQ,CAAS,EAAE,EACnC,MAAM,EAAe,EAAE,CAChB,MAAM,EAAiB,CAC5B,UACD,CAAC"}
|