2
0

Add NocoDB block (#1365)

#970 #997

Fully integrate NocoDB.

Added all API Functions:

- List Table Records
- Create Table Records
- Update Table Records
- Delete Table Records
- Read Table Record
- Count Table Records
- List Linked Records
- Link Records
- Unlink Records

Optional Todo:
- Save responses of non-get requests in a variable (error validation
try-catch is added and logged so i do not think so it is much needed)

You are free to implement any extra validation/function :D

---------

Co-authored-by: Baptiste Arnaud <baptiste.arnaud95@gmail.com>
This commit is contained in:
Abdullah bin Amir
2024-05-27 12:46:42 +04:00
committed by GitHub
parent 3e4e7531f6
commit a17781dfa6
35 changed files with 1158 additions and 38 deletions

View File

@ -110,18 +110,6 @@ export const option = {
z.enum(values).optional(),
number: z.number().or(variableStringSchema).optional(),
array: <T extends z.ZodTypeAny>(schema: T) => z.array(schema).optional(),
keyValueList: z
.array(
z.object({
key: z.string().optional().layout({
label: 'Key',
}),
value: z.string().optional().layout({
label: 'Value',
}),
})
)
.optional(),
discriminatedUnion: <
T extends string,
J extends [
@ -165,6 +153,49 @@ export const option = {
})
)
.optional(),
filter: ({
operators = defaultFilterOperators,
isJoinerHidden,
}: {
operators?: readonly [string, ...string[]]
isJoinerHidden: (currentObj: Record<string, any>) => boolean
}) =>
z
.object({
comparisons: z.array(
z.object({
input: z.string().optional().layout({ label: 'Enter a field ' }),
operator: z
.enum(operators)
.optional()
.layout({ defaultValue: 'Equal to' }),
value: z
.string()
.optional()
.layout({ placeholder: 'Enter a value' }),
})
),
joiner: z.enum(['AND', 'OR']).optional().layout({
placeholder: 'Select joiner',
isHidden: isJoinerHidden,
}),
})
.optional(),
}
const defaultFilterOperators = [
'Equal to',
'Not equal',
'Contains',
'Does not contain',
'Greater than',
'Less than',
'Is set',
'Is empty',
'Starts with',
'Ends with',
'Matches regex',
'Does not match regex',
] as const
export type * from './types'