mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(Notion (Beta) Node): Use resource locator component for database and page parameters (#4340)
* use resource locator component for database -> get (Notion V1/V2) * getDatabases search function for V1/V2 with url * updated database get list placeholder * get database RLC by url - regex support optional workspace domain names * fixed linting error * listSearch getDatabases support filter query * support extractValue in getCurrentNodeParameter for RLC * RLC for database page create/getAll operation * RLC for database get operation support "By ID" with optional v param. * use RLC in append blocks operation * use RLC in NotionTrigger.nodes.ts * removed unused loadOptions getDatabases * support database RLC in createPage/createDbPage operation * page create operation use RLC for parent page param * page archive operation use RLC for page param * removed unused imports * fixed missing extractPageId in NotionV1.node.ts * database page get operation use RLC for page param * database page update operation use RLC for page param * block getAll children operation use RLC for page param * block append operation use RLC for block param * support databaseId with optional '-' characters * support blockId with optional '-' characters * support pageId with optional '-' characters * improved RLC descriptions and hints * NotionTrigger node support databseId with optional '-' characters * stricter RLC by ID regex rules for uuids * stricter RLC by URL regex rules for uuids * stricter RLC by ID regex rules for uuids (support max length) * RLC regex from URL allow both http and https * RLC by ID only allow uuid v4 with optional dash * removed RLC from URL hint "Use Notion's copy link..." * RLC from URL only allow uuid v4 * DB Status Column: Support Simplify Properties * Notion Credentials: Support custom Notion-Version header Use latest Notion-Version 2022-02-22 if not set * DB Status Column: Support DB Page Create/Update * DB Status Column: Support DB Page GetMany Filters * removed unused paginationToken args * Database Get: RLC by URL improve validation error message
This commit is contained in:
@@ -337,6 +337,12 @@ function getPropertyKeyValue(value: any, type: string, timezone: string, version
|
||||
select: version === 1 ? { id: value.selectValue } : { name: value.selectValue },
|
||||
};
|
||||
break;
|
||||
case 'status':
|
||||
result = {
|
||||
type: 'status',
|
||||
status: { name: value.statusValue },
|
||||
};
|
||||
break;
|
||||
case 'date':
|
||||
const format = getDateFormat(value.includeTime);
|
||||
const timezoneValue = value.timezone === 'default' ? timezone : value.timezone;
|
||||
@@ -542,6 +548,8 @@ function simplifyProperty(property: any) {
|
||||
// tslint:disable-next-line: no-any
|
||||
(file: { type: string; [key: string]: any }) => file[file.type].url,
|
||||
);
|
||||
} else if (['status'].includes(property.type)) {
|
||||
result = property[type].name;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -622,6 +630,7 @@ export function getConditions() {
|
||||
checkbox: 'checkbox',
|
||||
select: 'select',
|
||||
multi_select: 'multi_select',
|
||||
status: 'status',
|
||||
date: 'date',
|
||||
people: 'people',
|
||||
files: 'files',
|
||||
@@ -660,6 +669,7 @@ export function getConditions() {
|
||||
checkbox: ['equals', 'does_not_equal'],
|
||||
select: ['equals', 'does_not_equal', 'is_empty', 'is_not_empty'],
|
||||
multi_select: ['contains', 'does_not_equal', 'is_empty', 'is_not_empty'],
|
||||
status: ['equals', 'does_not_equal'],
|
||||
date: [
|
||||
'equals',
|
||||
'before',
|
||||
@@ -934,3 +944,28 @@ export function validateJSON(json: string | undefined): any {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually extract a richtext's database mention RLC parameter.
|
||||
* @param blockValues the blockUi.blockValues node parameter.
|
||||
*/
|
||||
export function extractDatabaseMentionRLC(blockValues: IDataObject[]) {
|
||||
blockValues.forEach(bv => {
|
||||
if (bv.richText && bv.text) {
|
||||
const texts = (bv.text as { text: [{ textType: string, mentionType: string, database: string | { value: string, mode: string, __rl: boolean, __regex: string } }] }).text;
|
||||
texts.forEach(txt => {
|
||||
if (txt.textType === 'mention' && txt.mentionType === 'database') {
|
||||
if (typeof txt.database === 'object' && txt.database.__rl) {
|
||||
if (txt.database.__regex) {
|
||||
const regex = new RegExp(txt.database.__regex);
|
||||
const extracted = regex.exec(txt.database.value);
|
||||
txt.database = extracted![1];
|
||||
} else {
|
||||
txt.database = txt.database.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user