mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Convert all enums to const object types in nodes-base (no-changelog) (#14131)
This commit is contained in:
@@ -51,18 +51,20 @@ export type PartitionKey = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const enum EAttributeValueType {
|
export const EAttributeValueTypes = {
|
||||||
S = 'S',
|
S: 'S',
|
||||||
SS = 'SS',
|
SS: 'SS',
|
||||||
M = 'M',
|
M: 'M',
|
||||||
L = 'L',
|
L: 'L',
|
||||||
NS = 'NS',
|
NS: 'NS',
|
||||||
N = 'N',
|
N: 'N',
|
||||||
BOOL = 'BOOL',
|
BOOL: 'BOOL',
|
||||||
B = 'B',
|
B: 'B',
|
||||||
BS = 'BS',
|
BS: 'BS',
|
||||||
NULL = 'NULL',
|
NULL: 'NULL',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type EAttributeValueType = (typeof EAttributeValueTypes)[keyof typeof EAttributeValueTypes];
|
||||||
|
|
||||||
export interface IExpressionAttributeValue {
|
export interface IExpressionAttributeValue {
|
||||||
attribute: string;
|
attribute: string;
|
||||||
|
|||||||
@@ -18,17 +18,17 @@ export namespace BrevoNode {
|
|||||||
type BBCEmail = { bbc: Email[] };
|
type BBCEmail = { bbc: Email[] };
|
||||||
type ValidatedEmail = ToEmail | SenderEmail | CCEmail | BBCEmail;
|
type ValidatedEmail = ToEmail | SenderEmail | CCEmail | BBCEmail;
|
||||||
|
|
||||||
const enum OVERRIDE_MAP_VALUES {
|
const OVERRIDE_MAP_VALUES = {
|
||||||
CATEGORY = 'category',
|
CATEGORY: 'category',
|
||||||
NORMAL = 'boolean',
|
NORMAL: 'boolean',
|
||||||
TRANSACTIONAL = 'id',
|
TRANSACTIONAL: 'id',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
const enum OVERRIDE_MAP_TYPE {
|
const OVERRIDE_MAP_TYPE = {
|
||||||
CATEGORY = 'category',
|
CATEGORY: 'category',
|
||||||
NORMAL = 'normal',
|
NORMAL: 'normal',
|
||||||
TRANSACTIONAL = 'transactional',
|
TRANSACTIONAL: 'transactional',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
export const INTERCEPTORS = new Map<string, (body: JsonObject) => void>([
|
export const INTERCEPTORS = new Map<string, (body: JsonObject) => void>([
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import type {
|
|||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||||
|
|
||||||
import { EntryTypeEnum } from './EntryTypeEnum';
|
import type { EntryType } from './EntryType';
|
||||||
|
import { EntryTypes } from './EntryType';
|
||||||
import { clockifyApiRequest } from './GenericFunctions';
|
import { clockifyApiRequest } from './GenericFunctions';
|
||||||
import type { IUserDto } from './UserDtos';
|
import type { IUserDto } from './UserDtos';
|
||||||
import type { IWorkspaceDto } from './WorkpaceInterfaces';
|
import type { IWorkspaceDto } from './WorkpaceInterfaces';
|
||||||
@@ -56,11 +57,11 @@ export class ClockifyTrigger implements INodeType {
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'New Time Entry',
|
name: 'New Time Entry',
|
||||||
value: EntryTypeEnum.NEW_TIME_ENTRY,
|
value: EntryTypes.NEW_TIME_ENTRY,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
default: EntryTypeEnum.NEW_TIME_ENTRY,
|
default: EntryTypes.NEW_TIME_ENTRY,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@@ -89,7 +90,7 @@ export class ClockifyTrigger implements INodeType {
|
|||||||
|
|
||||||
async poll(this: IPollFunctions): Promise<INodeExecutionData[][] | null> {
|
async poll(this: IPollFunctions): Promise<INodeExecutionData[][] | null> {
|
||||||
const webhookData = this.getWorkflowStaticData('node');
|
const webhookData = this.getWorkflowStaticData('node');
|
||||||
const triggerField = this.getNodeParameter('watchField') as EntryTypeEnum;
|
const triggerField = this.getNodeParameter('watchField') as EntryType;
|
||||||
const workspaceId = this.getNodeParameter('workspaceId');
|
const workspaceId = this.getNodeParameter('workspaceId');
|
||||||
|
|
||||||
if (!webhookData.userId) {
|
if (!webhookData.userId) {
|
||||||
@@ -103,7 +104,7 @@ export class ClockifyTrigger implements INodeType {
|
|||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
switch (triggerField) {
|
switch (triggerField) {
|
||||||
case EntryTypeEnum.NEW_TIME_ENTRY:
|
case EntryTypes.NEW_TIME_ENTRY:
|
||||||
default:
|
default:
|
||||||
const workflowTimezone = this.getTimezone();
|
const workflowTimezone = this.getTimezone();
|
||||||
resource = `workspaces/${workspaceId}/user/${webhookData.userId}/time-entries`;
|
resource = `workspaces/${workspaceId}/user/${webhookData.userId}/time-entries`;
|
||||||
|
|||||||
@@ -3,17 +3,21 @@ export interface IHourlyRateDto {
|
|||||||
currency: string;
|
currency: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum MembershipStatusEnum {
|
const MembershipStatuses = {
|
||||||
PENDING = 'PENDING',
|
PENDING: 'PENDING',
|
||||||
ACTIVE = 'ACTIVE',
|
ACTIVE: 'ACTIVE',
|
||||||
DECLINED = 'DECLINED',
|
DECLINED: 'DECLINED',
|
||||||
INACTIVE = 'INACTIVE',
|
INACTIVE: 'INACTIVE',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
const enum TaskStatusEnum {
|
type MembershipStatusEnum = (typeof MembershipStatuses)[keyof typeof MembershipStatuses];
|
||||||
ACTIVE = 'ACTIVE',
|
|
||||||
DONE = 'DONE',
|
const TaskStatuses = {
|
||||||
}
|
ACTIVE: 'ACTIVE',
|
||||||
|
DONE: 'DONE',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
type TaskStatusEnum = (typeof TaskStatuses)[keyof typeof TaskStatuses];
|
||||||
|
|
||||||
export interface IMembershipDto {
|
export interface IMembershipDto {
|
||||||
hourlyRate: IHourlyRateDto;
|
hourlyRate: IHourlyRateDto;
|
||||||
|
|||||||
5
packages/nodes-base/nodes/Clockify/EntryType.ts
Normal file
5
packages/nodes-base/nodes/Clockify/EntryType.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export const EntryTypes = {
|
||||||
|
NEW_TIME_ENTRY: 0,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type EntryType = (typeof EntryTypes)[keyof typeof EntryTypes];
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export const enum EntryTypeEnum {
|
|
||||||
NEW_TIME_ENTRY,
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
import type { IHourlyRateDto, IMembershipDto } from './CommonDtos';
|
import type { IHourlyRateDto, IMembershipDto } from './CommonDtos';
|
||||||
|
|
||||||
const enum EstimateEnum {
|
const Estimates = {
|
||||||
AUTO = 'AUTO',
|
AUTO: 'AUTO',
|
||||||
MANUAL = 'MANUAL',
|
MANUAL: 'MANUAL',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
type EstimateEnum = (typeof Estimates)[keyof typeof Estimates];
|
||||||
|
|
||||||
interface IEstimateDto {
|
interface IEstimateDto {
|
||||||
estimate: string;
|
estimate: string;
|
||||||
@@ -40,10 +42,12 @@ export interface IProjectRequest {
|
|||||||
tasks: ITaskDto;
|
tasks: ITaskDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum TaskStatusEnum {
|
const TaskStatuses = {
|
||||||
ACTIVE = 'ACTIVE',
|
ACTIVE: 'ACTIVE',
|
||||||
DONE = 'DONE',
|
DONE: 'DONE',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
type TaskStatusEnum = (typeof TaskStatuses)[keyof typeof TaskStatuses];
|
||||||
|
|
||||||
export interface ITaskDto {
|
export interface ITaskDto {
|
||||||
assigneeIds: object;
|
assigneeIds: object;
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ import type { IDataObject } from 'n8n-workflow';
|
|||||||
|
|
||||||
import type { IMembershipDto } from './CommonDtos';
|
import type { IMembershipDto } from './CommonDtos';
|
||||||
|
|
||||||
const enum UserStatusEnum {
|
const UserStatuses = {
|
||||||
ACTIVE,
|
ACTIVE: 0,
|
||||||
PENDING_EMAIL_VERIFICATION,
|
PENDING_EMAIL_VERIFICATION: 1,
|
||||||
DELETED,
|
DELETED: 2,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export type UserStatusEnum = (typeof UserStatuses)[keyof typeof UserStatuses];
|
||||||
|
|
||||||
export interface IUserDto {
|
export interface IUserDto {
|
||||||
activeWorkspace: string;
|
activeWorkspace: string;
|
||||||
|
|||||||
@@ -1,32 +1,40 @@
|
|||||||
import type { IHourlyRateDto, IMembershipDto } from './CommonDtos';
|
import type { IHourlyRateDto, IMembershipDto } from './CommonDtos';
|
||||||
|
|
||||||
const enum AdminOnlyPagesEnum {
|
export const AdminOnlyPages = {
|
||||||
PROJECT = 'PROJECT',
|
PROJECT: 'PROJECT',
|
||||||
TEAM = 'TEAM',
|
TEAM: 'TEAM',
|
||||||
REPORTS = 'REPORTS',
|
REPORTS: 'REPORTS',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
const enum DaysOfWeekEnum {
|
export type AdminOnlyPagesEnum = (typeof AdminOnlyPages)[keyof typeof AdminOnlyPages];
|
||||||
MONDAY = 'MONDAY',
|
|
||||||
TUESDAY = 'TUESDAY',
|
|
||||||
WEDNESDAY = 'WEDNESDAY',
|
|
||||||
THURSDAY = 'THURSDAY',
|
|
||||||
FRIDAY = 'FRIDAY',
|
|
||||||
SATURDAY = 'SATURDAY',
|
|
||||||
SUNDAY = 'SUNDAY',
|
|
||||||
}
|
|
||||||
|
|
||||||
const enum DatePeriodEnum {
|
export const DaysOfWeek = {
|
||||||
DAYS = 'DAYS',
|
MONDAY: 'MONDAY',
|
||||||
WEEKS = 'WEEKS',
|
TUESDAY: 'TUESDAY',
|
||||||
MONTHS = 'MONTHS',
|
WEDNESDAY: 'WEDNESDAY',
|
||||||
}
|
THURSDAY: 'THURSDAY',
|
||||||
|
FRIDAY: 'FRIDAY',
|
||||||
|
SATURDAY: 'SATURDAY',
|
||||||
|
SUNDAY: 'SUNDAY',
|
||||||
|
} as const;
|
||||||
|
|
||||||
const enum AutomaticLockTypeEnum {
|
export type DaysOfWeekEnum = (typeof DaysOfWeek)[keyof typeof DaysOfWeek];
|
||||||
WEEKLY = 'WEEKLY',
|
|
||||||
MONTHLY = 'MONTHLY',
|
export const DatePeriods = {
|
||||||
OLDER_THAN = 'OLDER_THAN',
|
DAYS: 'DAYS',
|
||||||
}
|
WEEKS: 'WEEKS',
|
||||||
|
MONTHS: 'MONTHS',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type DatePeriodEnum = (typeof DatePeriods)[keyof typeof DatePeriods];
|
||||||
|
|
||||||
|
export const AutomaticLockTypes = {
|
||||||
|
WEEKLY: 'WEEKLY',
|
||||||
|
MONTHLY: 'MONTHLY',
|
||||||
|
OLDER_THAN: 'OLDER_THAN',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type AutomaticLockTypeEnum = (typeof AutomaticLockTypes)[keyof typeof AutomaticLockTypes];
|
||||||
|
|
||||||
interface IAutomaticLockDto {
|
interface IAutomaticLockDto {
|
||||||
changeDay: DaysOfWeekEnum;
|
changeDay: DaysOfWeekEnum;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { TLP } from './AnalyzerInterface';
|
import { TLPs } from './AnalyzerInterface';
|
||||||
|
|
||||||
export const analyzersOperations: INodeProperties[] = [
|
export const analyzersOperations: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -120,19 +120,19 @@ export const analyzerFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 2,
|
default: 2,
|
||||||
|
|||||||
@@ -1,36 +1,43 @@
|
|||||||
import type { IDataObject } from 'n8n-workflow';
|
import type { IDataObject } from 'n8n-workflow';
|
||||||
|
|
||||||
export const enum JobStatus {
|
export const JobStatuses = {
|
||||||
WAITING = 'Waiting',
|
WAITING: 'Waiting',
|
||||||
INPROGRESS = 'InProgress',
|
INPROGRESS: 'InProgress',
|
||||||
SUCCESS = 'Success',
|
SUCCESS: 'Success',
|
||||||
FAILURE = 'Failure',
|
FAILURE: 'Failure',
|
||||||
DELETED = 'Deleted',
|
DELETED: 'Deleted',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
export const enum TLP {
|
export type JobStatus = (typeof JobStatuses)[keyof typeof JobStatuses];
|
||||||
white,
|
|
||||||
green,
|
export const TLPs = {
|
||||||
amber,
|
white: 0,
|
||||||
red,
|
green: 1,
|
||||||
}
|
amber: 2,
|
||||||
|
red: 3,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type TLP = (typeof TLPs)[keyof typeof TLPs];
|
||||||
|
|
||||||
|
export const ObservableDataTypes = {
|
||||||
|
domain: 'domain',
|
||||||
|
file: 'file',
|
||||||
|
filename: 'filename',
|
||||||
|
fqdn: 'fqdn',
|
||||||
|
hash: 'hash',
|
||||||
|
ip: 'ip',
|
||||||
|
mail: 'mail',
|
||||||
|
mail_subject: 'mail_subject',
|
||||||
|
other: 'other',
|
||||||
|
regexp: 'regexp',
|
||||||
|
registry: 'registry',
|
||||||
|
uri_path: 'uri_path',
|
||||||
|
url: 'url',
|
||||||
|
'user-agent': 'user-agent',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ObservableDataType = (typeof ObservableDataTypes)[keyof typeof ObservableDataTypes];
|
||||||
|
|
||||||
export const enum ObservableDataType {
|
|
||||||
domain = 'domain',
|
|
||||||
file = 'file',
|
|
||||||
filename = 'filename',
|
|
||||||
fqdn = 'fqdn',
|
|
||||||
hash = 'hash',
|
|
||||||
ip = 'ip',
|
|
||||||
mail = 'mail',
|
|
||||||
mail_subject = 'mail_subject',
|
|
||||||
other = 'other',
|
|
||||||
regexp = 'regexp',
|
|
||||||
registry = 'registry',
|
|
||||||
uri_path = 'uri_path',
|
|
||||||
url = 'url',
|
|
||||||
'user-agent' = 'user-agent',
|
|
||||||
}
|
|
||||||
export interface IJob {
|
export interface IJob {
|
||||||
id?: string;
|
id?: string;
|
||||||
organization?: string;
|
organization?: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { TLP } from './AnalyzerInterface';
|
import { TLPs } from './AnalyzerInterface';
|
||||||
|
|
||||||
export const respondersOperations: INodeProperties[] = [
|
export const respondersOperations: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -172,19 +172,19 @@ export const responderFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffic Light Protocol (TLP). Default=Amber.',
|
description: 'Traffic Light Protocol (TLP). Default=Amber.',
|
||||||
@@ -436,19 +436,19 @@ export const responderFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffic Light Protocol (TLP). Default=Amber.',
|
description: 'Traffic Light Protocol (TLP). Default=Amber.',
|
||||||
@@ -621,19 +621,19 @@ export const responderFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffic Light Protocol (TLP). Default=Amber.',
|
description: 'Traffic Light Protocol (TLP). Default=Amber.',
|
||||||
|
|||||||
@@ -39,11 +39,14 @@ export interface IFormstackSubmissionFieldContainer {
|
|||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum FormstackFieldFormat {
|
export const FormstackFieldFormats = {
|
||||||
ID = 'id',
|
ID: 'id',
|
||||||
Label = 'label',
|
Label: 'label',
|
||||||
Name = 'name',
|
Name: 'name',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type FormstackFieldFormat =
|
||||||
|
(typeof FormstackFieldFormats)[keyof typeof FormstackFieldFormats];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make an API request to Formstack
|
* Make an API request to Formstack
|
||||||
|
|||||||
@@ -18,29 +18,35 @@ import {
|
|||||||
// validateJSON,
|
// validateJSON,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
const enum Status {
|
const Statuses = {
|
||||||
Open = 2,
|
Open: 2,
|
||||||
Pending = 3,
|
Pending: 3,
|
||||||
Resolved = 4,
|
Resolved: 4,
|
||||||
Closed = 5,
|
Closed: 5,
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
const enum Priority {
|
type Status = (typeof Statuses)[keyof typeof Statuses];
|
||||||
Low = 1,
|
|
||||||
Medium = 2,
|
|
||||||
High = 3,
|
|
||||||
Urgent = 4,
|
|
||||||
}
|
|
||||||
|
|
||||||
const enum Source {
|
const Priorities = {
|
||||||
Email = 1,
|
Low: 1,
|
||||||
Portal = 2,
|
Medium: 2,
|
||||||
Phone = 3,
|
High: 3,
|
||||||
Chat = 7,
|
Urgent: 4,
|
||||||
Mobihelp = 8,
|
} as const;
|
||||||
FeedbackWidget = 9,
|
|
||||||
OutboundEmail = 10,
|
type Priority = (typeof Priorities)[keyof typeof Priorities];
|
||||||
}
|
|
||||||
|
const Sources = {
|
||||||
|
Email: 1,
|
||||||
|
Portal: 2,
|
||||||
|
Phone: 3,
|
||||||
|
Chat: 7,
|
||||||
|
Mobihelp: 8,
|
||||||
|
FeedbackWidget: 9,
|
||||||
|
OutboundEmail: 10,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
type Source = (typeof Sources)[keyof typeof Sources];
|
||||||
|
|
||||||
interface ICreateTicketBody {
|
interface ICreateTicketBody {
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ export interface IUser {
|
|||||||
type?: Type;
|
type?: Type;
|
||||||
isAnonymous?: boolean;
|
isAnonymous?: boolean;
|
||||||
}
|
}
|
||||||
const enum Type {
|
const Types = {
|
||||||
TYPE_UNSPECIFIED,
|
TYPE_UNSPECIFIED: 0,
|
||||||
HUMAN,
|
HUMAN: 1,
|
||||||
BOT,
|
BOT: 2,
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type Type = (typeof Types)[keyof typeof Types];
|
||||||
|
|
||||||
// // TODO: define other interfaces
|
// // TODO: define other interfaces
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -17,21 +17,21 @@ export type SearchFilter = {
|
|||||||
export const RLC_DRIVE_DEFAULT = 'My Drive';
|
export const RLC_DRIVE_DEFAULT = 'My Drive';
|
||||||
export const RLC_FOLDER_DEFAULT = 'root';
|
export const RLC_FOLDER_DEFAULT = 'root';
|
||||||
|
|
||||||
export const enum DRIVE {
|
export const DRIVE = {
|
||||||
FOLDER = 'application/vnd.google-apps.folder',
|
FOLDER: 'application/vnd.google-apps.folder',
|
||||||
AUDIO = 'application/vnd.google-apps.audio',
|
AUDIO: 'application/vnd.google-apps.audio',
|
||||||
DOCUMENT = 'application/vnd.google-apps.document',
|
DOCUMENT: 'application/vnd.google-apps.document',
|
||||||
SDK = 'application/vnd.google-apps.drive-sdk',
|
SDK: 'application/vnd.google-apps.drive-sdk',
|
||||||
DRAWING = 'application/vnd.google-apps.drawing',
|
DRAWING: 'application/vnd.google-apps.drawing',
|
||||||
FILE = 'application/vnd.google-apps.file',
|
FILE: 'application/vnd.google-apps.file',
|
||||||
FORM = 'application/vnd.google-apps.form',
|
FORM: 'application/vnd.google-apps.form',
|
||||||
FUSIONTABLE = 'application/vnd.google-apps.fusiontable',
|
FUSIONTABLE: 'application/vnd.google-apps.fusiontable',
|
||||||
MAP = 'application/vnd.google-apps.map',
|
MAP: 'application/vnd.google-apps.map',
|
||||||
PHOTO = 'application/vnd.google-apps.photo',
|
PHOTO: 'application/vnd.google-apps.photo',
|
||||||
PRESENTATION = 'application/vnd.google-apps.presentation',
|
PRESENTATION: 'application/vnd.google-apps.presentation',
|
||||||
APP_SCRIPTS = 'application/vnd.google-apps.script',
|
APP_SCRIPTS: 'application/vnd.google-apps.script',
|
||||||
SITES = 'application/vnd.google-apps.sites',
|
SITES: 'application/vnd.google-apps.sites',
|
||||||
SPREADSHEET = 'application/vnd.google-apps.spreadsheet',
|
SPREADSHEET: 'application/vnd.google-apps.spreadsheet',
|
||||||
UNKNOWN = 'application/vnd.google-apps.unknown',
|
UNKNOWN: 'application/vnd.google-apps.unknown',
|
||||||
VIDEO = 'application/vnd.google-apps.video',
|
VIDEO: 'application/vnd.google-apps.video',
|
||||||
}
|
} as const;
|
||||||
|
|||||||
@@ -17,13 +17,15 @@ import {
|
|||||||
validateJSON,
|
validateJSON,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
const enum Status {
|
const Statuses = {
|
||||||
subscribe = 'subscribe',
|
subscribe: 'subscribe',
|
||||||
unsubscribed = 'unsubscribe',
|
unsubscribed: 'unsubscribe',
|
||||||
cleaned = 'cleaned',
|
cleaned: 'cleaned',
|
||||||
pending = 'pending',
|
pending: 'pending',
|
||||||
transactional = 'transactional',
|
transactional: 'transactional',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
type Status = (typeof Statuses)[keyof typeof Statuses];
|
||||||
|
|
||||||
interface ILocation {
|
interface ILocation {
|
||||||
latitude?: number;
|
latitude?: number;
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
export const enum RecipientType {
|
export const RecipientTypes = {
|
||||||
email = 'EMAIL',
|
email: 'EMAIL',
|
||||||
phone = 'PHONE',
|
phone: 'PHONE',
|
||||||
paypalId = 'PAYPAL_ID',
|
paypalId: 'PAYPAL_ID',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
export const enum RecipientWallet {
|
export type RecipientType = (typeof RecipientTypes)[keyof typeof RecipientTypes];
|
||||||
paypal = 'PAYPAL',
|
|
||||||
venmo = 'VENMO',
|
export const RecipientWallets = {
|
||||||
}
|
paypal: 'PAYPAL',
|
||||||
|
venmo: 'VENMO',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type RecipientWallet = (typeof RecipientWallets)[keyof typeof RecipientWallets];
|
||||||
|
|
||||||
export interface IAmount {
|
export interface IAmount {
|
||||||
currency?: string;
|
currency?: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { TLP } from '../interfaces/AlertInterface';
|
import { TLPs } from '../interfaces/AlertInterface';
|
||||||
|
|
||||||
export const alertOperations: INodeProperties[] = [
|
export const alertOperations: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -185,19 +185,19 @@ export const alertFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
@@ -722,19 +722,19 @@ export const alertFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
@@ -891,19 +891,19 @@ export const alertFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { TLP } from '../interfaces/AlertInterface';
|
import { TLPs } from '../interfaces/AlertInterface';
|
||||||
|
|
||||||
export const caseOperations: INodeProperties[] = [
|
export const caseOperations: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -179,19 +179,19 @@ export const caseFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
@@ -578,19 +578,19 @@ export const caseFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
@@ -823,19 +823,19 @@ export const caseFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { TLP } from '../interfaces/AlertInterface';
|
import { TLPs } from '../interfaces/AlertInterface';
|
||||||
|
|
||||||
export const observableOperations: INodeProperties[] = [
|
export const observableOperations: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -177,19 +177,19 @@ export const observableFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
@@ -351,19 +351,19 @@ export const observableFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
@@ -542,19 +542,19 @@ export const observableFields: INodeProperties[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
description: 'Traffict Light Protocol (TLP). Default=Amber.',
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import type { IDataObject } from 'n8n-workflow';
|
import type { IDataObject } from 'n8n-workflow';
|
||||||
export const enum AlertStatus {
|
|
||||||
NEW = 'New',
|
export const AlertStatuses = {
|
||||||
UPDATED = 'Updated',
|
NEW: 'New',
|
||||||
IGNORED = 'Ignored',
|
UPDATED: 'Updated',
|
||||||
IMPORTED = 'Imported',
|
IGNORED: 'Ignored',
|
||||||
}
|
IMPORTED: 'Imported',
|
||||||
export const enum TLP {
|
} as const;
|
||||||
white,
|
|
||||||
green,
|
export type AlertStatus = (typeof AlertStatuses)[keyof typeof AlertStatuses];
|
||||||
amber,
|
|
||||||
red,
|
export const TLPs = {
|
||||||
}
|
white: 0,
|
||||||
|
green: 1,
|
||||||
|
amber: 2,
|
||||||
|
red: 3,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type TLP = (typeof TLPs)[keyof typeof TLPs];
|
||||||
|
|
||||||
export interface IAlert {
|
export interface IAlert {
|
||||||
// Required attributes
|
// Required attributes
|
||||||
|
|||||||
@@ -32,22 +32,29 @@ export interface ICase {
|
|||||||
upadtedAt?: Date;
|
upadtedAt?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum CaseStatus {
|
export const CaseStatuses = {
|
||||||
OPEN = 'Open',
|
OPEN: 'Open',
|
||||||
RESOLVED = 'Resolved',
|
RESOLVED: 'Resolved',
|
||||||
DELETED = 'Deleted',
|
DELETED: 'Deleted',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
export const enum CaseResolutionStatus {
|
export type CaseStatus = (typeof CaseStatuses)[keyof typeof CaseStatuses];
|
||||||
INDETERMINATE = 'Indeterminate',
|
|
||||||
FALSEPOSITIVE = 'FalsePositive',
|
|
||||||
TRUEPOSITIVE = 'TruePositive',
|
|
||||||
OTHER = 'Other',
|
|
||||||
DUPLICATED = 'Duplicated',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const enum CaseImpactStatus {
|
export const CaseResolutionStatuses = {
|
||||||
NOIMPACT = 'NoImpact',
|
INDETERMINATE: 'Indeterminate',
|
||||||
WITHIMPACT = 'WithImpact',
|
FALSEPOSITIVE: 'FalsePositive',
|
||||||
NOTAPPLICABLE = 'NotApplicable',
|
TRUEPOSITIVE: 'TruePositive',
|
||||||
}
|
OTHER: 'Other',
|
||||||
|
DUPLICATED: 'Duplicated',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type CaseResolutionStatus =
|
||||||
|
(typeof CaseResolutionStatuses)[keyof typeof CaseResolutionStatuses];
|
||||||
|
|
||||||
|
export const CaseImpactStatuses = {
|
||||||
|
NOIMPACT: 'NoImpact',
|
||||||
|
WITHIMPACT: 'WithImpact',
|
||||||
|
NOTAPPLICABLE: 'NotApplicable',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type CaseImpactStatus = (typeof CaseImpactStatuses)[keyof typeof CaseImpactStatuses];
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import type { IAttachment } from './ObservableInterface';
|
import type { IAttachment } from './ObservableInterface';
|
||||||
export const enum LogStatus {
|
|
||||||
OK = 'Ok',
|
export const LogStatuses = {
|
||||||
DELETED = 'Deleted',
|
OK: 'Ok',
|
||||||
}
|
DELETED: 'Deleted',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type LogStatus = (typeof LogStatuses)[keyof typeof LogStatuses];
|
||||||
|
|
||||||
export interface ILog {
|
export interface ILog {
|
||||||
// Required attributes
|
// Required attributes
|
||||||
id?: string;
|
id?: string;
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
import type { TLP } from './AlertInterface';
|
import type { TLP } from './AlertInterface';
|
||||||
|
|
||||||
export const enum ObservableStatus {
|
export const ObservableStatuses = {
|
||||||
OK = 'Ok',
|
OK: 'Ok',
|
||||||
DELETED = 'Deleted',
|
DELETED: 'Deleted',
|
||||||
}
|
} as const;
|
||||||
export const enum ObservableDataType {
|
|
||||||
domain = 'domain',
|
export type ObservableStatus = (typeof ObservableStatuses)[keyof typeof ObservableStatuses];
|
||||||
file = 'file',
|
|
||||||
filename = 'filename',
|
export const ObservableDataTypes = {
|
||||||
fqdn = 'fqdn',
|
domain: 'domain',
|
||||||
hash = 'hash',
|
file: 'file',
|
||||||
ip = 'ip',
|
filename: 'filename',
|
||||||
mail = 'mail',
|
fqdn: 'fqdn',
|
||||||
mail_subject = 'mail_subject',
|
hash: 'hash',
|
||||||
other = 'other',
|
ip: 'ip',
|
||||||
regexp = 'regexp',
|
mail: 'mail',
|
||||||
registry = 'registry',
|
mail_subject: 'mail_subject',
|
||||||
uri_path = 'uri_path',
|
other: 'other',
|
||||||
url = 'url',
|
regexp: 'regexp',
|
||||||
'user-agent' = 'user-agent',
|
registry: 'registry',
|
||||||
}
|
uri_path: 'uri_path',
|
||||||
|
url: 'url',
|
||||||
|
'user-agent': 'user-agent',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ObservableDataType = (typeof ObservableDataTypes)[keyof typeof ObservableDataTypes];
|
||||||
|
|
||||||
export interface IAttachment {
|
export interface IAttachment {
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ export interface ITask {
|
|||||||
upadtedAt?: Date;
|
upadtedAt?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum TaskStatus {
|
export const TaskStatuses = {
|
||||||
WAITING = 'Waiting',
|
WAITING: 'Waiting',
|
||||||
INPROGRESS = 'InProgress',
|
INPROGRESS: 'InProgress',
|
||||||
COMPLETED = 'Completed',
|
COMPLETED: 'Completed',
|
||||||
CANCEL = 'Cancel',
|
CANCEL: 'Cancel',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type TaskStatus = (typeof TaskStatuses)[keyof typeof TaskStatuses];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { TLP } from '../helpers/interfaces';
|
import { TLPs } from '../helpers/interfaces';
|
||||||
|
|
||||||
export const returnAllAndLimit: INodeProperties[] = [
|
export const returnAllAndLimit: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -54,19 +54,19 @@ export const tlpOptions: INodeProperties = {
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TLP } from './interfaces';
|
import { TLPs } from './interfaces';
|
||||||
|
|
||||||
export const alertCommonFields = [
|
export const alertCommonFields = [
|
||||||
{
|
{
|
||||||
@@ -98,19 +98,19 @@ export const alertCommonFields = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
removed: true,
|
removed: true,
|
||||||
@@ -122,19 +122,19 @@ export const alertCommonFields = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
removed: true,
|
removed: true,
|
||||||
@@ -241,19 +241,19 @@ export const caseCommonFields = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
removed: false,
|
removed: false,
|
||||||
@@ -265,19 +265,19 @@ export const caseCommonFields = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
removed: false,
|
removed: false,
|
||||||
@@ -451,19 +451,19 @@ export const observableCommonFields = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
removed: false,
|
removed: false,
|
||||||
@@ -475,19 +475,19 @@ export const observableCommonFields = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'White',
|
name: 'White',
|
||||||
value: TLP.white,
|
value: TLPs.white,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Green',
|
name: 'Green',
|
||||||
value: TLP.green,
|
value: TLPs.green,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Amber',
|
name: 'Amber',
|
||||||
value: TLP.amber,
|
value: TLPs.amber,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Red',
|
name: 'Red',
|
||||||
value: TLP.red,
|
value: TLPs.red,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
removed: false,
|
removed: false,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
export const enum TLP {
|
export const TLPs = {
|
||||||
white,
|
white: 0,
|
||||||
green,
|
green: 1,
|
||||||
amber,
|
amber: 2,
|
||||||
red,
|
red: 3,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export type TLP = (typeof TLPs)[keyof typeof TLPs];
|
||||||
|
|
||||||
export type QueryScope = { query: string; id?: string; restrictTo?: string };
|
export type QueryScope = { query: string; id?: string; restrictTo?: string };
|
||||||
|
|||||||
@@ -43,14 +43,16 @@ export interface Command {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum CommandType {
|
export const CommandTypes = {
|
||||||
ITEM_MOVE = 'item_move',
|
ITEM_MOVE: 'item_move',
|
||||||
ITEM_ADD = 'item_add',
|
ITEM_ADD: 'item_add',
|
||||||
ITEM_UPDATE = 'item_update',
|
ITEM_UPDATE: 'item_update',
|
||||||
ITEM_REORDER = 'item_reorder',
|
ITEM_REORDER: 'item_reorder',
|
||||||
ITEM_DELETE = 'item_delete',
|
ITEM_DELETE: 'item_delete',
|
||||||
ITEM_COMPLETE = 'item_complete',
|
ITEM_COMPLETE: 'item_complete',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type CommandType = (typeof CommandTypes)[keyof typeof CommandTypes];
|
||||||
|
|
||||||
async function getLabelNameFromId(ctx: Context, labelIds: number[]): Promise<string[]> {
|
async function getLabelNameFromId(ctx: Context, labelIds: number[]): Promise<string[]> {
|
||||||
const labelList = [];
|
const labelList = [];
|
||||||
@@ -263,7 +265,7 @@ export class MoveHandler implements OperationHandler {
|
|||||||
const body: SyncRequest = {
|
const body: SyncRequest = {
|
||||||
commands: [
|
commands: [
|
||||||
{
|
{
|
||||||
type: CommandType.ITEM_MOVE,
|
type: CommandTypes.ITEM_MOVE,
|
||||||
uuid: uuid(),
|
uuid: uuid(),
|
||||||
args: {
|
args: {
|
||||||
id: taskId,
|
id: taskId,
|
||||||
@@ -339,7 +341,7 @@ export class SyncHandler implements OperationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private requiresProjectId(command: Command) {
|
private requiresProjectId(command: Command) {
|
||||||
return command.type === CommandType.ITEM_ADD;
|
return command.type === CommandTypes.ITEM_ADD;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enrichTempId(command: Command, tempIdMapping: Map<string, string>, projectId: number) {
|
private enrichTempId(command: Command, tempIdMapping: Map<string, string>, projectId: number) {
|
||||||
@@ -350,6 +352,6 @@ export class SyncHandler implements OperationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private requiresTempId(command: Command) {
|
private requiresTempId(command: Command) {
|
||||||
return command.type === CommandType.ITEM_ADD;
|
return command.type === CommandTypes.ITEM_ADD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,14 +44,16 @@ export interface Command {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum CommandType {
|
export const CommandTypes = {
|
||||||
ITEM_MOVE = 'item_move',
|
ITEM_MOVE: 'item_move',
|
||||||
ITEM_ADD = 'item_add',
|
ITEM_ADD: 'item_add',
|
||||||
ITEM_UPDATE = 'item_update',
|
ITEM_UPDATE: 'item_update',
|
||||||
ITEM_REORDER = 'item_reorder',
|
ITEM_REORDER: 'item_reorder',
|
||||||
ITEM_DELETE = 'item_delete',
|
ITEM_DELETE: 'item_delete',
|
||||||
ITEM_COMPLETE = 'item_complete',
|
ITEM_COMPLETE: 'item_complete',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type CommandType = (typeof CommandTypes)[keyof typeof CommandTypes];
|
||||||
|
|
||||||
export class CreateHandler implements OperationHandler {
|
export class CreateHandler implements OperationHandler {
|
||||||
async handleOperation(ctx: Context, itemIndex: number): Promise<TodoistResponse> {
|
async handleOperation(ctx: Context, itemIndex: number): Promise<TodoistResponse> {
|
||||||
@@ -261,7 +263,7 @@ export class MoveHandler implements OperationHandler {
|
|||||||
const body: SyncRequest = {
|
const body: SyncRequest = {
|
||||||
commands: [
|
commands: [
|
||||||
{
|
{
|
||||||
type: CommandType.ITEM_MOVE,
|
type: CommandTypes.ITEM_MOVE,
|
||||||
uuid: uuid(),
|
uuid: uuid(),
|
||||||
args: {
|
args: {
|
||||||
id: taskId,
|
id: taskId,
|
||||||
@@ -351,7 +353,7 @@ export class SyncHandler implements OperationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private requiresProjectId(command: Command) {
|
private requiresProjectId(command: Command) {
|
||||||
return command.type === CommandType.ITEM_ADD;
|
return command.type === CommandTypes.ITEM_ADD;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enrichTempId(command: Command, tempIdMapping: Map<string, string>, projectId: number) {
|
private enrichTempId(command: Command, tempIdMapping: Map<string, string>, projectId: number) {
|
||||||
@@ -362,6 +364,6 @@ export class SyncHandler implements OperationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private requiresTempId(command: Command) {
|
private requiresTempId(command: Command) {
|
||||||
return command.type === CommandType.ITEM_ADD;
|
return command.type === CommandTypes.ITEM_ADD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user