@nx-ddd/notion 0.0.1 → 4.20.6
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/decorators/decorators.d.ts +1 -1
- package/package.json +11 -8
- package/query/query.d.ts +1 -1
- package/repository/repository.js +3 -3
- package/repository/repository.js.map +1 -1
- package/utils.d.ts +15 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const NOTION_ANNOTATIONS = "notion_annotations";
|
|
2
|
-
export
|
|
2
|
+
export type NotionFieldType = 'title' | 'url' | 'rich_text' | 'relation' | 'status' | 'formula' | 'rollup' | 'timestamp' | 'number' | 'created_time' | 'last_edited_time' | 'date' | 'select';
|
|
3
3
|
export interface NotionAnnotation {
|
|
4
4
|
type: NotionFieldType;
|
|
5
5
|
fieldName: string;
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/notion",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.20.6",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
|
-
"dependencies": {
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@notionhq/client": "2.2.2",
|
|
8
|
+
"dayjs": "1.10.7",
|
|
9
|
+
"injection-js": "2.4.0",
|
|
10
|
+
"lodash": "4.17.21",
|
|
11
|
+
"reflect-metadata": "0.1.13"
|
|
12
|
+
},
|
|
7
13
|
"peerDependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"@nx-ddd/
|
|
10
|
-
"
|
|
11
|
-
"injection-js": "^2.4.0",
|
|
12
|
-
"reflect-metadata": "^0.1.13",
|
|
13
|
-
"tslib": "^2.0.0"
|
|
14
|
+
"@nx-ddd/common": "4.20.6",
|
|
15
|
+
"@nx-ddd/core": "4.20.6",
|
|
16
|
+
"tslib": "2.5.0"
|
|
14
17
|
}
|
|
15
18
|
}
|
package/query/query.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Entity } from "@nx-ddd/common/domain/models";
|
|
2
|
-
|
|
2
|
+
type Evaluation = '==' | '>' | '>=' | '<' | '<=' | '!=' | 'in';
|
|
3
3
|
export declare class N {
|
|
4
4
|
static RollupPropQuery(property: string, evaluation: Evaluation, value: string | number): {
|
|
5
5
|
property: string;
|
package/repository/repository.js
CHANGED
|
@@ -9,15 +9,15 @@ const query_builder_1 = require("../query-builder");
|
|
|
9
9
|
exports.NOTION_ACCESS_TOKEN = new di_1.InjectionToken('[@nx-ddd/notion] Notion Access Token');
|
|
10
10
|
exports.NOTION_DATABASE_ID = new di_1.InjectionToken('[@nx-ddd/notion] Notion Database Id');
|
|
11
11
|
let NotionRepository = class NotionRepository extends repository_1.Repository {
|
|
12
|
+
get parent() {
|
|
13
|
+
return { type: 'database_id', database_id: this.databaseId };
|
|
14
|
+
}
|
|
12
15
|
constructor(token) {
|
|
13
16
|
super();
|
|
14
17
|
this.token = token;
|
|
15
18
|
this.client = new client_1.Client({ auth: this.token });
|
|
16
19
|
this.queryBuilder = new query_builder_1.NotionQueryBuilder();
|
|
17
20
|
}
|
|
18
|
-
get parent() {
|
|
19
|
-
return { type: 'database_id', database_id: this.databaseId };
|
|
20
|
-
}
|
|
21
21
|
query(filterQuery, sortQuery) {
|
|
22
22
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/notion/src/lib/repository/repository.ts"],"names":[],"mappings":";;;;AAAA,6CAA0C;AAE1C,iEAA8D;AAC9D,wCAAqE;AAGrE,oDAAsD;AAEzC,QAAA,mBAAmB,GAAG,IAAI,mBAAc,CAAC,sCAAsC,CAAC,CAAC;AACjF,QAAA,kBAAkB,GAAG,IAAI,mBAAc,CAAC,qCAAqC,CAAC,CAAC;AAGrF,IAAe,gBAAgB,GAA/B,MAAe,gBAA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|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
2
|
import { NotionFieldType } from "./decorators";
|
|
3
|
-
|
|
3
|
+
type NotionText = {
|
|
4
4
|
type: 'text';
|
|
5
5
|
text: {
|
|
6
6
|
content: string;
|
|
7
7
|
};
|
|
8
8
|
plain_text: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type NotionArray = {
|
|
11
11
|
type: 'array';
|
|
12
12
|
array: (NotionRichText[] | NotionNumber[]);
|
|
13
13
|
function: 'show_original';
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type NotionTitle = {
|
|
16
16
|
type: 'title';
|
|
17
17
|
title: {
|
|
18
18
|
text: {
|
|
@@ -20,22 +20,22 @@ export declare type NotionTitle = {
|
|
|
20
20
|
};
|
|
21
21
|
}[];
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type NotionUrl = {
|
|
24
24
|
id: string;
|
|
25
25
|
type: 'url';
|
|
26
26
|
url: string | null;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type NotionRichText = {
|
|
29
29
|
id: string;
|
|
30
30
|
type: 'rich_text';
|
|
31
31
|
rich_text: NotionText[];
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type NotionNumber = {
|
|
34
34
|
id: string;
|
|
35
35
|
type: 'number';
|
|
36
36
|
number: number;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type NotionRelation = {
|
|
39
39
|
id: string;
|
|
40
40
|
type: 'relation';
|
|
41
41
|
relation: {
|
|
@@ -43,7 +43,7 @@ export declare type NotionRelation = {
|
|
|
43
43
|
}[];
|
|
44
44
|
has_more: boolean;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export type NotionStatus = {
|
|
47
47
|
id: string;
|
|
48
48
|
type: 'status';
|
|
49
49
|
status: {
|
|
@@ -52,7 +52,7 @@ export declare type NotionStatus = {
|
|
|
52
52
|
color: string;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type NotionFormula = {
|
|
56
56
|
id: string;
|
|
57
57
|
type: 'formula';
|
|
58
58
|
formula: {
|
|
@@ -63,27 +63,27 @@ export declare type NotionFormula = {
|
|
|
63
63
|
number: number;
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
export
|
|
66
|
+
export type NotionRollup = {
|
|
67
67
|
id: string;
|
|
68
68
|
type: 'rollup';
|
|
69
69
|
rollup: NotionArray;
|
|
70
70
|
};
|
|
71
|
-
export
|
|
71
|
+
export type NotionCreatedTime = {
|
|
72
72
|
id: string;
|
|
73
73
|
type: 'created_time';
|
|
74
74
|
created_time: string;
|
|
75
75
|
};
|
|
76
|
-
export
|
|
76
|
+
export type NotionLastEditedTime = {
|
|
77
77
|
id: string;
|
|
78
78
|
type: 'last_edited_time';
|
|
79
79
|
last_edited_time: string;
|
|
80
80
|
};
|
|
81
|
-
export
|
|
81
|
+
export type NotionDate = {
|
|
82
82
|
id: string;
|
|
83
83
|
type: 'date';
|
|
84
84
|
date: any;
|
|
85
85
|
};
|
|
86
|
-
export
|
|
86
|
+
export type NotionSelect = {
|
|
87
87
|
id: string;
|
|
88
88
|
type: 'select';
|
|
89
89
|
select: {
|
|
@@ -92,7 +92,7 @@ export declare type NotionSelect = {
|
|
|
92
92
|
color: string;
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
|
-
export
|
|
95
|
+
export type NotionValue = NotionTitle | NotionUrl | NotionRichText | NotionNumber | NotionRelation | NotionStatus | NotionFormula | NotionRollup | NotionCreatedTime | NotionLastEditedTime | NotionDate | NotionSelect;
|
|
96
96
|
export declare class NotionUtils {
|
|
97
97
|
static toNotionValue(value: any, type: NotionFieldType): void | {
|
|
98
98
|
type: string;
|