@driveflux/api-functions 0.0.7-next.2 → 0.0.7-next.20
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/dist/auth/confirm.js +66 -325
- package/dist/auth/emails.js +42 -210
- package/dist/auth/formatter.js +9 -9
- package/dist/auth/otp.js +120 -374
- package/dist/auth/register.js +95 -383
- package/dist/auth/register.js.map +1 -1
- package/dist/auth/tokens.d.ts +3 -3
- package/dist/auth/tokens.js +114 -426
- package/dist/auth/verifications.js +176 -581
- package/dist/constants.js +4 -4
- package/dist/mailjet/calls/manage-contacts-in-list.d.ts +2 -2
- package/dist/mailjet/calls/manage-contacts-in-list.d.ts.map +1 -1
- package/dist/mailjet/calls/manage-contacts-in-list.js +22 -167
- package/dist/mailjet/calls/manage-contacts-in-list.js.map +1 -1
- package/dist/mailjet/calls/manage-subscription-status.d.ts +2 -2
- package/dist/mailjet/calls/manage-subscription-status.d.ts.map +1 -1
- package/dist/mailjet/calls/manage-subscription-status.js +13 -154
- package/dist/mailjet/calls/manage-subscription-status.js.map +1 -1
- package/dist/mailjet/calls/request-service.js +18 -182
- package/dist/mailjet/refresh-email-preferences.js +21 -221
- package/dist/mailjet/set-contact.d.ts +2 -2
- package/dist/mailjet/set-contact.d.ts.map +1 -1
- package/dist/mailjet/set-contact.js +21 -213
- package/dist/mailjet/set-contact.js.map +1 -1
- package/dist/mailjet/types.d.ts +2 -2
- package/dist/mailjet/types.d.ts.map +1 -1
- package/dist/mailjet/utils/convert-to-array.d.ts +1 -1
- package/dist/mailjet/utils/convert-to-array.d.ts.map +1 -1
- package/dist/mailjet/utils/convert-to-array.js +9 -56
- package/dist/mailjet/utils/extract-email-preferences.d.ts +1 -1
- package/dist/mailjet/utils/extract-email-preferences.d.ts.map +1 -1
- package/dist/mailjet/utils/extract-email-preferences.js +37 -214
- package/dist/mailjet/utils/lists.js +28 -248
- package/dist/mailjet/utils/update-email-references.d.ts +2 -2
- package/dist/mailjet/utils/update-email-references.d.ts.map +1 -1
- package/dist/mailjet/utils/update-email-references.js +27 -207
- package/dist/mailjet/utils/update-email-references.js.map +1 -1
- package/dist/notion/client.js +50 -196
- package/dist/notion/helpful.js +25 -169
- package/dist/notion/schemas/block.js +1 -1
- package/dist/notion/schemas/common.js +7 -9
- package/dist/notion/schemas/database.d.ts +1 -1
- package/dist/notion/schemas/database.js +68 -100
- package/dist/notion/schemas/emoji.js +1 -1
- package/dist/notion/schemas/file.js +1 -1
- package/dist/notion/schemas/kb.js +3 -3
- package/dist/notion/schemas/page.d.ts +1 -1
- package/dist/notion/schemas/page.js +69 -103
- package/dist/notion/schemas/parent.js +4 -4
- package/dist/notion/schemas/user.js +2 -2
- package/dist/reservation/agree.d.ts +1 -1
- package/dist/reservation/agree.d.ts.map +1 -1
- package/dist/reservation/agree.js +17 -157
- package/dist/reservation/checks.d.ts +1 -1
- package/dist/reservation/checks.d.ts.map +1 -1
- package/dist/reservation/checks.js +21 -177
- package/dist/reservation/display-vehicle.d.ts +1 -1
- package/dist/reservation/display-vehicle.js +122 -500
- package/dist/reservation/display-vehicle.js.map +1 -1
- package/dist/reservation/fetch-or-create.d.ts +2 -2
- package/dist/reservation/fetch-or-create.d.ts.map +1 -1
- package/dist/reservation/fetch-or-create.js +188 -478
- package/dist/reservation/fetch-or-create.js.map +1 -1
- package/dist/reservation/invoice.d.ts +3 -3
- package/dist/reservation/invoice.d.ts.map +1 -1
- package/dist/reservation/invoice.js +182 -492
- package/dist/reservation/invoice.js.map +1 -1
- package/dist/reservation/payer.d.ts +1 -1
- package/dist/reservation/payer.d.ts.map +1 -1
- package/dist/reservation/payer.js +25 -175
- package/dist/reservation/reserve.d.ts +1 -1
- package/dist/reservation/reserve.d.ts.map +1 -1
- package/dist/reservation/reserve.js +35 -196
- package/dist/reservation/reserve.js.map +1 -1
- package/dist/reservation/types.d.ts +1 -0
- package/dist/reservation/types.d.ts.map +1 -1
- package/dist/reservation/vehicle.d.ts +1 -1
- package/dist/reservation/vehicle.d.ts.map +1 -1
- package/dist/reservation/vehicle.js +23 -188
- package/dist/reservation/vehicle.js.map +1 -1
- package/dist/slack.js +57 -268
- package/dist/validation.js +38 -98
- package/dist/vehicle/vehicle-pricing/constants.d.ts +1 -1
- package/dist/vehicle/vehicle-pricing/constants.d.ts.map +1 -1
- package/dist/vehicle/vehicle-pricing/constants.js +16 -16
- package/dist/vehicle/vehicle-pricing/index.d.ts +1 -1
- package/dist/vehicle/vehicle-pricing/index.d.ts.map +1 -1
- package/dist/vehicle/vehicle-pricing/index.js +87 -259
- package/dist/vehicle/vehicle-pricing/index.js.map +1 -1
- package/package.json +21 -21
package/dist/notion/helpful.js
CHANGED
|
@@ -1,173 +1,29 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _async_to_generator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t, _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function() {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
39
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
41
|
-
return this;
|
|
42
|
-
}), g;
|
|
43
|
-
function verb(n) {
|
|
44
|
-
return function(v) {
|
|
45
|
-
return step([
|
|
46
|
-
n,
|
|
47
|
-
v
|
|
48
|
-
]);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function step(op) {
|
|
52
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
53
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
54
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
55
|
-
if (y = 0, t) op = [
|
|
56
|
-
op[0] & 2,
|
|
57
|
-
t.value
|
|
58
|
-
];
|
|
59
|
-
switch(op[0]){
|
|
60
|
-
case 0:
|
|
61
|
-
case 1:
|
|
62
|
-
t = op;
|
|
63
|
-
break;
|
|
64
|
-
case 4:
|
|
65
|
-
_.label++;
|
|
66
|
-
return {
|
|
67
|
-
value: op[1],
|
|
68
|
-
done: false
|
|
69
|
-
};
|
|
70
|
-
case 5:
|
|
71
|
-
_.label++;
|
|
72
|
-
y = op[1];
|
|
73
|
-
op = [
|
|
74
|
-
0
|
|
75
|
-
];
|
|
76
|
-
continue;
|
|
77
|
-
case 7:
|
|
78
|
-
op = _.ops.pop();
|
|
79
|
-
_.trys.pop();
|
|
80
|
-
continue;
|
|
81
|
-
default:
|
|
82
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
-
_ = 0;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
-
_.label = op[1];
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
-
_.label = t[1];
|
|
92
|
-
t = op;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
if (t && _.label < t[2]) {
|
|
96
|
-
_.label = t[2];
|
|
97
|
-
_.ops.push(op);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (t[2]) _.ops.pop();
|
|
101
|
-
_.trys.pop();
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
op = body.call(thisArg, _);
|
|
105
|
-
} catch (e) {
|
|
106
|
-
op = [
|
|
107
|
-
6,
|
|
108
|
-
e
|
|
109
|
-
];
|
|
110
|
-
y = 0;
|
|
111
|
-
} finally{
|
|
112
|
-
f = t = 0;
|
|
113
|
-
}
|
|
114
|
-
if (op[0] & 5) throw op[1];
|
|
115
|
-
return {
|
|
116
|
-
value: op[0] ? op[1] : void 0,
|
|
117
|
-
done: true
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
1
|
import { getNotion } from '@driveflux/api-functions/notion';
|
|
122
2
|
import { knowledgeBaseRetrievePageSchema } from './schemas/kb.js';
|
|
123
|
-
export
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
false
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
validatedPage = kbPageValidation.data;
|
|
149
|
-
// update helpful/unhelpful number
|
|
150
|
-
return [
|
|
151
|
-
4,
|
|
152
|
-
notion.pages.update({
|
|
153
|
-
page_id: pageId,
|
|
154
|
-
properties: {
|
|
155
|
-
Helpful: {
|
|
156
|
-
number: (validatedPage.properties.Helpful.number || 0) + (hasSubmittedBefore && !isHelpful ? -1 : isHelpful ? 1 : 0)
|
|
157
|
-
},
|
|
158
|
-
Unhelpful: {
|
|
159
|
-
number: (validatedPage.properties.Unhelpful.number || 0) + (hasSubmittedBefore && isHelpful ? -1 : !isHelpful ? 1 : 0)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
})
|
|
163
|
-
];
|
|
164
|
-
case 2:
|
|
165
|
-
_state.sent();
|
|
166
|
-
return [
|
|
167
|
-
2,
|
|
168
|
-
true
|
|
169
|
-
];
|
|
3
|
+
export const processHelpful = async (options)=>{
|
|
4
|
+
const { pageId, isHelpful, hasSubmittedBefore } = options;
|
|
5
|
+
// get original page
|
|
6
|
+
const notion = getNotion();
|
|
7
|
+
const page = await notion.pages.retrieve({
|
|
8
|
+
page_id: pageId
|
|
9
|
+
});
|
|
10
|
+
// validate page
|
|
11
|
+
const kbPageValidation = knowledgeBaseRetrievePageSchema.safeParse(page);
|
|
12
|
+
if (!kbPageValidation.success) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const validatedPage = kbPageValidation.data;
|
|
16
|
+
// update helpful/unhelpful number
|
|
17
|
+
await notion.pages.update({
|
|
18
|
+
page_id: pageId,
|
|
19
|
+
properties: {
|
|
20
|
+
Helpful: {
|
|
21
|
+
number: (validatedPage.properties.Helpful.number || 0) + (hasSubmittedBefore && !isHelpful ? -1 : isHelpful ? 1 : 0)
|
|
22
|
+
},
|
|
23
|
+
Unhelpful: {
|
|
24
|
+
number: (validatedPage.properties.Unhelpful.number || 0) + (hasSubmittedBefore && isHelpful ? -1 : !isHelpful ? 1 : 0)
|
|
170
25
|
}
|
|
171
|
-
}
|
|
172
|
-
})
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return true;
|
|
173
29
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
2
|
+
export const notionDateOrTimeFormat = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|\+\d{2}:\d{2}))?$/);
|
|
3
|
+
export const notionDateFormat = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
|
4
|
+
export const notionTimeFormat = z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/);
|
|
5
|
+
export const notionCommonColorEnum = z.enum([
|
|
6
6
|
'blue',
|
|
7
7
|
'brown',
|
|
8
8
|
'default',
|
|
@@ -14,15 +14,13 @@ export var notionCommonColorEnum = z.enum([
|
|
|
14
14
|
'red',
|
|
15
15
|
'yellow'
|
|
16
16
|
]);
|
|
17
|
-
export
|
|
17
|
+
export const notionDateSchema = z.object({
|
|
18
18
|
start: notionDateOrTimeFormat,
|
|
19
19
|
end: notionDateOrTimeFormat.nullable().optional(),
|
|
20
20
|
time_zone: z.string().nullable().optional()
|
|
21
21
|
});
|
|
22
|
-
export
|
|
23
|
-
return {
|
|
22
|
+
export const commonPropertyValues = (type)=>({
|
|
24
23
|
id: z.string(),
|
|
25
24
|
type: z.literal(type),
|
|
26
25
|
name: z.string().optional()
|
|
27
|
-
};
|
|
28
|
-
};
|
|
26
|
+
});
|
|
@@ -190,8 +190,8 @@ export declare const notionDatabasePropertyRollupSchema: ZodObject<{
|
|
|
190
190
|
type: z.ZodEnum<{
|
|
191
191
|
number: "number";
|
|
192
192
|
date: "date";
|
|
193
|
-
array: "array";
|
|
194
193
|
incomplete: "incomplete";
|
|
194
|
+
array: "array";
|
|
195
195
|
unsupported: "unsupported";
|
|
196
196
|
}>;
|
|
197
197
|
}, z.core.$strip>;
|
|
@@ -1,55 +1,3 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _object_spread(target) {
|
|
15
|
-
for(var i = 1; i < arguments.length; i++){
|
|
16
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
-
var ownKeys = Object.keys(source);
|
|
18
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
ownKeys.forEach(function(key) {
|
|
24
|
-
_define_property(target, key, source[key]);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
}
|
|
29
|
-
function ownKeys(object, enumerableOnly) {
|
|
30
|
-
var keys = Object.keys(object);
|
|
31
|
-
if (Object.getOwnPropertySymbols) {
|
|
32
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
-
if (enumerableOnly) {
|
|
34
|
-
symbols = symbols.filter(function(sym) {
|
|
35
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
keys.push.apply(keys, symbols);
|
|
39
|
-
}
|
|
40
|
-
return keys;
|
|
41
|
-
}
|
|
42
|
-
function _object_spread_props(target, source) {
|
|
43
|
-
source = source != null ? source : {};
|
|
44
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
-
} else {
|
|
47
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return target;
|
|
52
|
-
}
|
|
53
1
|
import { z } from 'zod';
|
|
54
2
|
import { notionRichTextSchema } from './block.js';
|
|
55
3
|
import { commonPropertyValues, notionCommonColorEnum, notionTimeFormat } from './common.js';
|
|
@@ -57,36 +5,46 @@ import { notionEmojiSchema } from './emoji.js';
|
|
|
57
5
|
import { notionFileSchema } from './file.js';
|
|
58
6
|
import { notionWorkspaceParentSchema } from './parent.js';
|
|
59
7
|
import { notionPartialUserSchema } from './user.js';
|
|
60
|
-
export
|
|
8
|
+
export const notionDatabasePropertyCheckboxSchema = z.object({
|
|
9
|
+
...commonPropertyValues('checkbox'),
|
|
61
10
|
checkbox: z.object({})
|
|
62
|
-
})
|
|
63
|
-
export
|
|
11
|
+
});
|
|
12
|
+
export const notionDatabasePropertyCreatedBySchema = z.object({
|
|
13
|
+
...commonPropertyValues('created_by'),
|
|
64
14
|
created_by: z.object({})
|
|
65
|
-
})
|
|
66
|
-
export
|
|
15
|
+
});
|
|
16
|
+
export const notionDatabasePropertyCreatedTimeSchema = z.object({
|
|
17
|
+
...commonPropertyValues('created_time'),
|
|
67
18
|
created_time: z.object({})
|
|
68
|
-
})
|
|
69
|
-
export
|
|
19
|
+
});
|
|
20
|
+
export const notionDatabasePropertyDateSchema = z.object({
|
|
21
|
+
...commonPropertyValues('date'),
|
|
70
22
|
date: z.object({})
|
|
71
|
-
})
|
|
72
|
-
export
|
|
23
|
+
});
|
|
24
|
+
export const notionDatabasePropertyEmailSchema = z.object({
|
|
25
|
+
...commonPropertyValues('email'),
|
|
73
26
|
email: z.object({})
|
|
74
|
-
})
|
|
75
|
-
export
|
|
27
|
+
});
|
|
28
|
+
export const notionDatabasePropertyFilesSchema = z.object({
|
|
29
|
+
...commonPropertyValues('files'),
|
|
76
30
|
files: z.object({})
|
|
77
|
-
})
|
|
78
|
-
export
|
|
31
|
+
});
|
|
32
|
+
export const notionDatabasePropertyFormulaSchema = z.object({
|
|
33
|
+
...commonPropertyValues('formula'),
|
|
79
34
|
formula: z.object({
|
|
80
35
|
expression: z.string()
|
|
81
36
|
})
|
|
82
|
-
})
|
|
83
|
-
export
|
|
37
|
+
});
|
|
38
|
+
export const notionDatabasePropertyLastEditedBySchema = z.object({
|
|
39
|
+
...commonPropertyValues('last_edited_by'),
|
|
84
40
|
last_edited_by: z.object({}).optional()
|
|
85
|
-
})
|
|
86
|
-
export
|
|
41
|
+
});
|
|
42
|
+
export const notionDatabasePropertyLastEditedTimeSchema = z.object({
|
|
43
|
+
...commonPropertyValues('last_edited_time'),
|
|
87
44
|
last_edited_time: z.object({})
|
|
88
|
-
})
|
|
89
|
-
export
|
|
45
|
+
});
|
|
46
|
+
export const notionDatabasePropertyMultiSelectSchema = z.object({
|
|
47
|
+
...commonPropertyValues('multi_select'),
|
|
90
48
|
multi_select: z.object({
|
|
91
49
|
options: z.array(z.object({
|
|
92
50
|
id: z.string(),
|
|
@@ -94,8 +52,9 @@ export var notionDatabasePropertyMultiSelectSchema = z.object(_object_spread_pro
|
|
|
94
52
|
color: notionCommonColorEnum
|
|
95
53
|
}))
|
|
96
54
|
})
|
|
97
|
-
})
|
|
98
|
-
export
|
|
55
|
+
});
|
|
56
|
+
export const notionDatabasePropertyNumberSchema = z.object({
|
|
57
|
+
...commonPropertyValues('number'),
|
|
99
58
|
number: z.object({
|
|
100
59
|
format: z.enum([
|
|
101
60
|
'argentine_peso',
|
|
@@ -140,24 +99,29 @@ export var notionDatabasePropertyNumberSchema = z.object(_object_spread_props(_o
|
|
|
140
99
|
'zloty'
|
|
141
100
|
])
|
|
142
101
|
})
|
|
143
|
-
})
|
|
144
|
-
export
|
|
102
|
+
});
|
|
103
|
+
export const notionDatabasePropertyPeopleSchema = z.object({
|
|
104
|
+
...commonPropertyValues('people'),
|
|
145
105
|
people: z.object({})
|
|
146
|
-
})
|
|
147
|
-
export
|
|
106
|
+
});
|
|
107
|
+
export const notionDatabasePropertyPhoneNumberSchema = z.object({
|
|
108
|
+
...commonPropertyValues('phone_number'),
|
|
148
109
|
phone_number: z.object({})
|
|
149
|
-
})
|
|
150
|
-
export
|
|
110
|
+
});
|
|
111
|
+
export const notionDatabasePropertyRelationSchema = z.object({
|
|
112
|
+
...commonPropertyValues('relation'),
|
|
151
113
|
relation: z.object({
|
|
152
114
|
database_id: z.string(),
|
|
153
115
|
synced_property_name: z.string().optional(),
|
|
154
116
|
synced_property_id: z.string().optional()
|
|
155
117
|
})
|
|
156
|
-
})
|
|
157
|
-
export
|
|
118
|
+
});
|
|
119
|
+
export const notionDatabasePropertyRichTextSchema = z.object({
|
|
120
|
+
...commonPropertyValues('rich_text'),
|
|
158
121
|
rich_text: z.object({})
|
|
159
|
-
})
|
|
160
|
-
export
|
|
122
|
+
});
|
|
123
|
+
export const notionDatabasePropertyRollupSchema = z.object({
|
|
124
|
+
...commonPropertyValues('rollup'),
|
|
161
125
|
rollup: z.object({
|
|
162
126
|
rollup_property_name: z.string(),
|
|
163
127
|
relation_property_name: z.string(),
|
|
@@ -197,8 +161,9 @@ export var notionDatabasePropertyRollupSchema = z.object(_object_spread_props(_o
|
|
|
197
161
|
'unsupported'
|
|
198
162
|
])
|
|
199
163
|
})
|
|
200
|
-
})
|
|
201
|
-
export
|
|
164
|
+
});
|
|
165
|
+
export const notionDatabasePropertySelectSchema = z.object({
|
|
166
|
+
...commonPropertyValues('select'),
|
|
202
167
|
select: z.object({
|
|
203
168
|
options: z.array(z.object({
|
|
204
169
|
id: z.string(),
|
|
@@ -206,8 +171,9 @@ export var notionDatabasePropertySelectSchema = z.object(_object_spread_props(_o
|
|
|
206
171
|
color: notionCommonColorEnum
|
|
207
172
|
}))
|
|
208
173
|
})
|
|
209
|
-
})
|
|
210
|
-
export
|
|
174
|
+
});
|
|
175
|
+
export const notionDatabasePropertyStatusSchema = z.object({
|
|
176
|
+
...commonPropertyValues('status'),
|
|
211
177
|
status: z.object({
|
|
212
178
|
options: z.array(z.object({
|
|
213
179
|
id: z.string(),
|
|
@@ -221,21 +187,24 @@ export var notionDatabasePropertyStatusSchema = z.object(_object_spread_props(_o
|
|
|
221
187
|
option_ids: z.array(z.string())
|
|
222
188
|
})).nullable().optional()
|
|
223
189
|
})
|
|
224
|
-
})
|
|
225
|
-
export
|
|
190
|
+
});
|
|
191
|
+
export const notionDatabasePropertyTitleSchema = z.object({
|
|
192
|
+
...commonPropertyValues('title'),
|
|
226
193
|
title: z.object({})
|
|
227
|
-
})
|
|
228
|
-
export
|
|
194
|
+
});
|
|
195
|
+
export const notionDatabasePropertyUrlSchema = z.object({
|
|
196
|
+
...commonPropertyValues('url'),
|
|
229
197
|
url: z.object({})
|
|
230
|
-
})
|
|
231
|
-
export
|
|
198
|
+
});
|
|
199
|
+
export const notionDatabasePropertyUniqueIdSchema = z.object({
|
|
200
|
+
...commonPropertyValues('unique_id'),
|
|
232
201
|
unique_id: z.object({})
|
|
233
|
-
})
|
|
234
|
-
export
|
|
202
|
+
});
|
|
203
|
+
export const notionDatabasePropertyVerificationSchema = z.object({
|
|
204
|
+
...commonPropertyValues('verification'),
|
|
235
205
|
verification: z.object({})
|
|
236
|
-
})
|
|
237
|
-
export
|
|
238
|
-
return z.object({
|
|
206
|
+
});
|
|
207
|
+
export const notionDatabaseSchema = (properties)=>z.object({
|
|
239
208
|
object: z.literal('database'),
|
|
240
209
|
id: z.string(),
|
|
241
210
|
created_time: notionTimeFormat,
|
|
@@ -246,11 +215,10 @@ export var notionDatabaseSchema = function(properties) {
|
|
|
246
215
|
description: z.array(notionRichTextSchema),
|
|
247
216
|
icon: notionFileSchema.or(notionEmojiSchema),
|
|
248
217
|
cover: notionFileSchema.nullable(),
|
|
249
|
-
properties
|
|
218
|
+
properties,
|
|
250
219
|
parent: notionWorkspaceParentSchema,
|
|
251
220
|
url: z.string().url(),
|
|
252
221
|
archived: z.boolean(),
|
|
253
222
|
is_inline: z.boolean(),
|
|
254
223
|
public_url: z.string().nullable()
|
|
255
224
|
});
|
|
256
|
-
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { notionDatabasePropertyCheckboxSchema, notionDatabasePropertyCreatedBySchema, notionDatabasePropertyCreatedTimeSchema, notionDatabasePropertyDateSchema, notionDatabasePropertyFormulaSchema, notionDatabasePropertyLastEditedBySchema, notionDatabasePropertyLastEditedTimeSchema, notionDatabasePropertyMultiSelectSchema, notionDatabasePropertyNumberSchema, notionDatabasePropertyRelationSchema, notionDatabasePropertySelectSchema, notionDatabasePropertyStatusSchema, notionDatabasePropertyTitleSchema, notionDatabasePropertyUniqueIdSchema, notionDatabaseSchema } from './database.js';
|
|
3
3
|
import { notionPagePropertyCheckboxSchema, notionPagePropertyCreatedBySchema, notionPagePropertyCreatedTimeSchema, notionPagePropertyDateSchema, notionPagePropertyFormulaSchema, notionPagePropertyLastEditedBySchema, notionPagePropertyLastEditedTimeSchema, notionPagePropertyMultiSelectSchema, notionPagePropertyNumberSchema, notionPagePropertyRelationSchema, notionPagePropertyRichTextSchema, notionPagePropertySelectSchema, notionPagePropertyStatusSchema, notionPagePropertyTitleSchema, notionPagePropertyUniqueIdSchema, notionPageSchema, notionPagesSchema } from './page.js';
|
|
4
|
-
export
|
|
4
|
+
export const knowledgeBaseRetrieveDatabaseSchema = notionDatabaseSchema(z.object({
|
|
5
5
|
Title: notionDatabasePropertyTitleSchema,
|
|
6
6
|
Status: notionDatabasePropertyStatusSchema,
|
|
7
7
|
Topic: notionDatabasePropertySelectSchema,
|
|
@@ -24,7 +24,7 @@ export var knowledgeBaseRetrieveDatabaseSchema = notionDatabaseSchema(z.object({
|
|
|
24
24
|
Helpful: notionDatabasePropertyNumberSchema,
|
|
25
25
|
Unhelpful: notionDatabasePropertyNumberSchema
|
|
26
26
|
}));
|
|
27
|
-
export
|
|
27
|
+
export const knowledgeBaseRetrievePageSchema = notionPageSchema(z.object({
|
|
28
28
|
Title: notionPagePropertyTitleSchema,
|
|
29
29
|
'Seo Title': notionPagePropertyRichTextSchema,
|
|
30
30
|
Status: notionPagePropertyStatusSchema,
|
|
@@ -48,7 +48,7 @@ export var knowledgeBaseRetrievePageSchema = notionPageSchema(z.object({
|
|
|
48
48
|
Helpful: notionPagePropertyNumberSchema,
|
|
49
49
|
Unhelpful: notionPagePropertyNumberSchema
|
|
50
50
|
}));
|
|
51
|
-
export
|
|
51
|
+
export const knowledgeBaseQueryDatabaseSchema = notionPagesSchema(z.object({
|
|
52
52
|
Title: notionPagePropertyTitleSchema,
|
|
53
53
|
Status: notionPagePropertyStatusSchema,
|
|
54
54
|
Topic: notionPagePropertySelectSchema,
|
|
@@ -231,8 +231,8 @@ export declare const notionPagePropertyRollupSchema: ZodObject<{
|
|
|
231
231
|
type: z.ZodEnum<{
|
|
232
232
|
number: "number";
|
|
233
233
|
date: "date";
|
|
234
|
-
array: "array";
|
|
235
234
|
incomplete: "incomplete";
|
|
235
|
+
array: "array";
|
|
236
236
|
unsupported: "unsupported";
|
|
237
237
|
}>;
|
|
238
238
|
}, z.core.$strip>;
|