mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-23 18:41:48 -08:00
⚡ Fix some issues with Zulip
This commit is contained in:
parent
5e4fde6c6a
commit
b445eafccd
|
@ -62,4 +62,3 @@ export function validateJSON(json: string | undefined): any { // tslint:disable-
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ export const messageOperations = [
|
|||
|
||||
export const messageFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:sendPrivate */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:sendPrivate */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'To',
|
||||
name: 'to',
|
||||
|
@ -96,9 +96,9 @@ export const messageFields = [
|
|||
},
|
||||
description: 'The content of the message.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:sendStream */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:sendStream */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Stream',
|
||||
name: 'stream',
|
||||
|
@ -163,9 +163,9 @@ export const messageFields = [
|
|||
},
|
||||
description: 'The content of the message.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Message ID',
|
||||
name: 'messageId',
|
||||
|
@ -241,9 +241,9 @@ export const messageFields = [
|
|||
},
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Message ID',
|
||||
name: 'messageId',
|
||||
|
@ -262,9 +262,9 @@ export const messageFields = [
|
|||
},
|
||||
description: 'Unique identifier for the message.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Message ID',
|
||||
name: 'messageId',
|
||||
|
@ -283,9 +283,9 @@ export const messageFields = [
|
|||
},
|
||||
description: 'Unique identifier for the message.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:updateFile */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:updateFile */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Binary Property',
|
||||
name: 'dataBinaryProperty',
|
||||
|
|
|
@ -13,7 +13,7 @@ export const streamOperations = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a stream.',
|
||||
|
@ -27,17 +27,17 @@ export const streamOperations = [
|
|||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all streams.',
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
name: 'Get Subscribed',
|
||||
value: 'getSubscribed',
|
||||
description: 'Get subscribed streams.',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a stream.',
|
||||
},
|
||||
// {
|
||||
// name: 'Update',
|
||||
// value: 'update',
|
||||
// description: 'Update a stream.',
|
||||
// },
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -45,10 +45,10 @@ export const streamOperations = [
|
|||
] as INodeProperties[];
|
||||
|
||||
export const streamFields = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
name: 'jsonParameters',
|
||||
type: 'boolean',
|
||||
|
@ -86,9 +86,56 @@ export const streamFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
|
||||
description: `JSON format parameters for stream creation.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Subscriptions',
|
||||
name: 'subscriptions',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Subscription Properties',
|
||||
name: 'properties',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Name of Subscription.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Description of Subscription.',
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
|
@ -109,38 +156,39 @@ export const streamFields = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Announce',
|
||||
name: 'announce',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'If announce is True and one of the streams specified in subscriptions has to be created (i.e. doesnt exist to begin with), an announcement will be made notifying that a new stream was created.',
|
||||
},
|
||||
{
|
||||
displayName: 'Authorization Errors Fatal',
|
||||
name: 'authorizationErrorsFatal',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'A boolean specifying whether authorization errors (such as when the requesting user is not authorized to access a private stream) should be considered fatal or not. When True, an authorization error is reported as such. When set to False, the returned JSON payload indicates that there was an authorization error, but the response is still considered a successful one.',
|
||||
},
|
||||
{
|
||||
displayName: 'History Public to Subscribers',
|
||||
name: 'historyPublicToSubscribers',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the streams message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.',
|
||||
},
|
||||
{
|
||||
displayName: 'Invite Only',
|
||||
name: 'inviteOnly',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'A boolean specifying whether the streams specified in subscriptions are invite-only or not.',
|
||||
},
|
||||
{
|
||||
{
|
||||
displayName: 'Announce',
|
||||
name: 'announce',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'If announce is True and one of the streams specified in subscriptions has to be created (i.e. doesnt exist to begin with), an announcement will be made notifying that a new stream was created.',
|
||||
},
|
||||
{
|
||||
displayName: 'Authorization Errors Fatal',
|
||||
name: 'authorizationErrorsFatal',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'A boolean specifying whether authorization errors (such as when the requesting user is not authorized to access a private stream) should be considered fatal or not. When True, an authorization error is reported as such. When set to False, the returned JSON payload indicates that there was an authorization error, but the response is still considered a successful one.',
|
||||
},
|
||||
{
|
||||
displayName: 'History Public to Subscribers',
|
||||
name: 'historyPublicToSubscribers',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the streams message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.',
|
||||
},
|
||||
{
|
||||
displayName: 'Invite Only',
|
||||
name: 'inviteOnly',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'A boolean specifying whether the streams specified in subscriptions are invite-only or not.',
|
||||
},
|
||||
{
|
||||
displayName: 'Principals',
|
||||
name: 'principals',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
description: 'A list of email addresses of the users that will be subscribed/unsubscribed to the streams specified in the subscriptions argument. If not provided, then the requesting user/bot is subscribed.',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
|
@ -161,175 +209,144 @@ export const streamFields = [
|
|||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Subscriptions',
|
||||
name: 'subscriptions',
|
||||
type: 'fixedCollection',
|
||||
required: true,
|
||||
description: '"A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Subscription Properties',
|
||||
name: 'properties',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Name of Subscription.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Description of Subscription.',
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
displayName: 'Stream Post Policy',
|
||||
name: 'streamPostPolicy',
|
||||
type: 'options',
|
||||
default: '',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description: 'Policy for which users can post messages to the stream.',
|
||||
options: [
|
||||
{
|
||||
name: '1',
|
||||
value: 1,
|
||||
description: 'Any user can post.'
|
||||
},
|
||||
{
|
||||
name: '2',
|
||||
value: 2,
|
||||
description: 'Only administrators can post.'
|
||||
},
|
||||
{
|
||||
name: '3',
|
||||
value: 3,
|
||||
description: 'Only new members can post.'
|
||||
},
|
||||
{
|
||||
name: '1',
|
||||
value: 1,
|
||||
description: 'Any user can post.'
|
||||
},
|
||||
{
|
||||
name: '2',
|
||||
value: 2,
|
||||
description: 'Only administrators can post.'
|
||||
},
|
||||
{
|
||||
name: '3',
|
||||
value: 3,
|
||||
description: 'Only new members can post.'
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:get all */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include All Active',
|
||||
name: 'includeAllActive',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all active streams. The user must have administrative privileges to use this parameter.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Default',
|
||||
name: 'includeDefault',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all default streams for the users realm.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Owner Subscribed',
|
||||
name: 'includeOwnersubscribed',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'If the user is a bot, include all streams that the bots owner is subscribed to.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Public',
|
||||
name: 'includePublic',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all public streams.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Subscribed',
|
||||
name: 'includeSubscribed',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all streams that the user is subscribed to.',
|
||||
},
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:get subscribed */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'getSubscribed',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include Subscribers',
|
||||
name: 'includeSubscribers',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether each returned stream object should include a subscribers field containing a list of the user IDs of its subscribers.',
|
||||
}
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Stream ID',
|
||||
name: 'streamId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'ID of stream to update.',
|
||||
},
|
||||
{
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:get all */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include All Active',
|
||||
name: 'includeAllActive',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all active streams. The user must have administrative privileges to use this parameter.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Default',
|
||||
name: 'includeDefault',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all default streams for the users realm.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Owner Subscribed',
|
||||
name: 'includeOwnersubscribed',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'If the user is a bot, include all streams that the bots owner is subscribed to.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Public',
|
||||
name: 'includePublic',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all public streams.',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Subscribed',
|
||||
name: 'includeSubscribed',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Include all streams that the user is subscribed to.',
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:get subscribed */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'getSubscribed',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include Subscribers',
|
||||
name: 'includeSubscribers',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether each returned stream object should include a subscribers field containing a list of the user IDs of its subscribers.',
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Stream ID',
|
||||
name: 'streamId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'ID of stream to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
name: 'jsonParameters',
|
||||
type: 'boolean',
|
||||
|
@ -391,89 +408,89 @@ export const streamFields = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Announcement Only',
|
||||
name: 'isAnnouncementOnly',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the stream is limited to announcements.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The new description for the stream.',
|
||||
placeholder: 'Place of discussion'
|
||||
},
|
||||
{
|
||||
displayName: 'Is Private',
|
||||
name: 'isPrivate',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Change whether the stream is a private stream.',
|
||||
},
|
||||
{
|
||||
displayName: 'History Public to Subscribers',
|
||||
name: 'historyPublicToSubscribers',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the streams message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.',
|
||||
},
|
||||
{
|
||||
displayName: 'New Name',
|
||||
name: 'newName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The new name for the stream.',
|
||||
placeholder: 'Italy'
|
||||
},
|
||||
{
|
||||
{
|
||||
displayName: 'Announcement Only',
|
||||
name: 'isAnnouncementOnly',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the stream is limited to announcements.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The new description for the stream.',
|
||||
placeholder: 'Place of discussion'
|
||||
},
|
||||
{
|
||||
displayName: 'Is Private',
|
||||
name: 'isPrivate',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Change whether the stream is a private stream.',
|
||||
},
|
||||
{
|
||||
displayName: 'History Public to Subscribers',
|
||||
name: 'historyPublicToSubscribers',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the streams message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.',
|
||||
},
|
||||
{
|
||||
displayName: 'New Name',
|
||||
name: 'newName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The new name for the stream.',
|
||||
placeholder: 'Italy'
|
||||
},
|
||||
{
|
||||
displayName: 'Stream Post Policy',
|
||||
name: 'streamPostPolicy',
|
||||
type: 'options',
|
||||
default: '',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description: 'Policy for which users can post messages to the stream.',
|
||||
options: [
|
||||
{
|
||||
name: '1',
|
||||
value: 1,
|
||||
description: 'Any user can post.'
|
||||
},
|
||||
{
|
||||
name: '2',
|
||||
value: 2,
|
||||
description: 'Only administrators can post.'
|
||||
},
|
||||
{
|
||||
name: '3',
|
||||
value: 3,
|
||||
description: 'Only new members can post.'
|
||||
},
|
||||
{
|
||||
name: '1',
|
||||
value: 1,
|
||||
description: 'Any user can post.'
|
||||
},
|
||||
{
|
||||
name: '2',
|
||||
value: 2,
|
||||
description: 'Only administrators can post.'
|
||||
},
|
||||
{
|
||||
name: '3',
|
||||
value: 3,
|
||||
description: 'Only new members can post.'
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Stream ID',
|
||||
name: 'streamId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'ID of stream to delete.',
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* stream:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Stream ID',
|
||||
name: 'streamId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'stream',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'ID of stream to delete.',
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
export interface IStream {
|
||||
subscriptions?: string;
|
||||
invite_only?: boolean;
|
||||
principals?: string;
|
||||
authorization_errors_fatal?: boolean;
|
||||
history_public_to_subscribers?: boolean;
|
||||
stream_post_policy?: number;
|
||||
announce?: boolean;
|
||||
include_public?: boolean;
|
||||
include_subscribed?: boolean;
|
||||
include_all_active?: boolean;
|
||||
include_default?: boolean;
|
||||
include_owner_subscribed?: boolean;
|
||||
include_subscribers?: boolean;
|
||||
description?: string;
|
||||
new_name?: string;
|
||||
is_private?: boolean;
|
||||
is_announcement_only?: boolean;
|
||||
subscriptions?: string;
|
||||
invite_only?: boolean;
|
||||
principals?: string;
|
||||
authorization_errors_fatal?: boolean;
|
||||
history_public_to_subscribers?: boolean;
|
||||
stream_post_policy?: number;
|
||||
announce?: boolean;
|
||||
include_public?: boolean;
|
||||
include_subscribed?: boolean;
|
||||
include_all_active?: boolean;
|
||||
include_default?: boolean;
|
||||
include_owner_subscribed?: boolean;
|
||||
include_subscribers?: boolean;
|
||||
description?: string;
|
||||
new_name?: string;
|
||||
is_private?: boolean;
|
||||
is_announcement_only?: boolean;
|
||||
}
|
||||
|
||||
export interface IPrincipal {
|
||||
email: string;
|
||||
email: string;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export const userOperations = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a user.',
|
||||
|
@ -22,22 +22,22 @@ export const userOperations = [
|
|||
name: 'Deactivate',
|
||||
value: 'deactivate',
|
||||
description: 'Deactivate a user.',
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a user.',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all users.',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a user.',
|
||||
},
|
||||
// {
|
||||
// name: 'Update',
|
||||
// value: 'update',
|
||||
// description: 'Update a user.',
|
||||
// },
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -45,9 +45,9 @@ export const userOperations = [
|
|||
] as INodeProperties[];
|
||||
|
||||
export const userFields = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
|
@ -65,8 +65,8 @@ export const userFields = [
|
|||
},
|
||||
default: '',
|
||||
description: 'The email address of the new user.',
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'fullName',
|
||||
type: 'string',
|
||||
|
@ -83,8 +83,8 @@ export const userFields = [
|
|||
},
|
||||
default: '',
|
||||
description: 'The full name of the new user.',
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
|
@ -101,8 +101,8 @@ export const userFields = [
|
|||
},
|
||||
default: '',
|
||||
description: 'The password of the new user.',
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
displayName: 'Short Name',
|
||||
name: 'shortName',
|
||||
type: 'string',
|
||||
|
@ -119,10 +119,11 @@ export const userFields = [
|
|||
},
|
||||
default: '',
|
||||
description: 'The short name of the new user. Not user-visible.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get / getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get / getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
|
@ -140,103 +141,105 @@ export const userFields = [
|
|||
},
|
||||
default: '',
|
||||
description: 'The ID of user to get.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'get', 'getAll'
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Client Gravatar',
|
||||
name: 'clientGravatar',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the client supports computing gravatars URLs. If enabled, avatar_url will be included in the response only if there is a Zulip avatar, and will be null for users who are using gravatar as their avatar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Profile Fields',
|
||||
name: 'includeCustomProfileFields',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the client wants custom profile field data to be included in the response.',
|
||||
},
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of user to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'update'
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'fullName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The users full name.',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Admin',
|
||||
name: 'isAdmin',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the target user is an administrator.',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Guest',
|
||||
name: 'isGuest',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the target user is a guest.',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'get', 'getAll'
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Client Gravatar',
|
||||
name: 'clientGravatar',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the client supports computing gravatars URLs. If enabled, avatar_url will be included in the response only if there is a Zulip avatar, and will be null for users who are using gravatar as their avatar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Profile Fields',
|
||||
name: 'includeCustomProfileFields',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the client wants custom profile field data to be included in the response.',
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of user to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'update'
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'fullName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The users full name.',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Admin',
|
||||
name: 'isAdmin',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the target user is an administrator.',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Guest',
|
||||
name: 'isGuest',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the target user is a guest.',
|
||||
},
|
||||
{
|
||||
displayName: 'Profile Data',
|
||||
name: 'profileData',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
description: 'A dictionary containing the to be updated custom profile field data for the user.',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
|
@ -265,27 +268,28 @@ export const userFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:deactivate */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'deactivate',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of user to deactivate.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
]
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:deactivate */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'deactivate',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of user to deactivate.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
export interface IUser {
|
||||
client_gravatar?: boolean;
|
||||
include_custom_profile_fields?: boolean;
|
||||
full_name?: string;
|
||||
is_admin?: boolean;
|
||||
is_guest?: boolean;
|
||||
profile_data?: [{}];
|
||||
email?: string;
|
||||
password?: string;
|
||||
short_name?: string;
|
||||
}
|
||||
client_gravatar?: boolean;
|
||||
include_custom_profile_fields?: boolean;
|
||||
full_name?: string;
|
||||
is_admin?: boolean;
|
||||
is_guest?: boolean;
|
||||
profile_data?: [{}];
|
||||
email?: string;
|
||||
password?: string;
|
||||
short_name?: string;
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ export class Zulip implements INodeType {
|
|||
}
|
||||
}
|
||||
};
|
||||
responseData = await zulipApiRequest.call(this, 'POST', '/user_uploads', {}, {}, undefined, { formData } );
|
||||
responseData = await zulipApiRequest.call(this, 'POST', '/user_uploads', {}, {}, undefined, { formData });
|
||||
responseData.uri = `${credentials!.url}${responseData.uri}`;
|
||||
}
|
||||
}
|
||||
|
@ -247,6 +247,7 @@ export class Zulip implements INodeType {
|
|||
}
|
||||
|
||||
responseData = await zulipApiRequest.call(this, 'GET', `/streams`, body);
|
||||
responseData = responseData.streams;
|
||||
}
|
||||
|
||||
if (operation === 'getSubscribed') {
|
||||
|
@ -257,10 +258,10 @@ export class Zulip implements INodeType {
|
|||
}
|
||||
|
||||
responseData = await zulipApiRequest.call(this, 'GET', `/users/me/subscriptions`, body);
|
||||
responseData = responseData.subscriptions;
|
||||
}
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
const jsonParameters = this.getNodeParameter('jsonParameters', i) as boolean;
|
||||
|
||||
if (jsonParameters) {
|
||||
|
@ -278,20 +279,18 @@ export class Zulip implements INodeType {
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
if (additionalFields.subscriptions) {
|
||||
//@ts-ignore
|
||||
body.subscriptions = JSON.stringify(additionalFields.subscriptions.properties);
|
||||
}
|
||||
const subscriptions = this.getNodeParameter('subscriptions', i) as IDataObject;
|
||||
body.subscriptions = JSON.stringify(subscriptions.properties);
|
||||
|
||||
if (additionalFields.inviteOnly) {
|
||||
body.invite_only = additionalFields.inviteOnly as boolean;
|
||||
}
|
||||
if (additionalFields.principals) {
|
||||
const principals : string[] = [];
|
||||
const principals: string[] = [];
|
||||
//@ts-ignore
|
||||
additionalFields.principals.properties.map((principal : IPrincipal) => {
|
||||
additionalFields.principals.properties.map((principal: IPrincipal) => {
|
||||
principals.push(principal.email);
|
||||
});
|
||||
body.principals = JSON.stringify(principals);
|
||||
|
@ -368,7 +367,7 @@ export class Zulip implements INodeType {
|
|||
}
|
||||
|
||||
if (resource === 'user') {
|
||||
const body : IUser = {};
|
||||
const body: IUser = {};
|
||||
|
||||
if (operation === 'get') {
|
||||
const userId = this.getNodeParameter('userId', i) as string;
|
||||
|
@ -396,6 +395,7 @@ export class Zulip implements INodeType {
|
|||
}
|
||||
|
||||
responseData = await zulipApiRequest.call(this, 'GET', `/users`, body);
|
||||
responseData = responseData.members;
|
||||
}
|
||||
|
||||
if (operation === 'create') {
|
||||
|
@ -407,7 +407,7 @@ export class Zulip implements INodeType {
|
|||
responseData = await zulipApiRequest.call(this, 'POST', `/users`, body);
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
if (operation === 'update') {
|
||||
const userId = this.getNodeParameter('userId', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
|
@ -434,19 +434,10 @@ export class Zulip implements INodeType {
|
|||
responseData = await zulipApiRequest.call(this, 'DELETE', `/users/${userId}`, body);
|
||||
}
|
||||
}
|
||||
// Specific checks because API returns multiple objects within 1 object with each key name
|
||||
if (responseData.members) {
|
||||
returnData.push.apply(returnData, responseData.members as IDataObject[]);
|
||||
}
|
||||
|
||||
if (responseData.streams) {
|
||||
returnData.push.apply(returnData, responseData.streams as IDataObject[]);
|
||||
}
|
||||
|
||||
if (responseData.subscriptions) {
|
||||
returnData.push.apply(returnData, responseData.subscriptions as IDataObject[]);
|
||||
}
|
||||
else {
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue