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:
Marcus
2022-11-11 13:37:52 +01:00
committed by GitHub
parent c7133ecd3f
commit 277b6b73c3
13 changed files with 775 additions and 202 deletions

View File

@@ -2674,6 +2674,7 @@ export function getLoadOptionsFunctions(
},
getCurrentNodeParameter: (
parameterPath: string,
options?: IGetNodeParameterOptions,
): NodeParameterValueType | object | undefined => {
const nodeParameters = additionalData.currentNodeParameters;
@@ -2681,7 +2682,25 @@ export function getLoadOptionsFunctions(
parameterPath = `${path.split('.').slice(1, -1).join('.')}.${parameterPath.slice(1)}`;
}
return get(nodeParameters, parameterPath);
let returnData = get(nodeParameters, parameterPath);
// This is outside the try/catch because it throws errors with proper messages
if (options?.extractValue) {
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
if (nodeType === undefined) {
throw new Error(
`Node type "${node.type}" is not known so can not return parameter value!`,
);
}
returnData = extractValue(
returnData,
parameterPath,
node,
nodeType,
) as NodeParameterValueType;
}
return returnData;
},
getCurrentNodeParameters: (): INodeParameters | undefined => {
return additionalData.currentNodeParameters;