Skip to content

Commit

Permalink
manually apply changes from elastic#187172
Browse files Browse the repository at this point in the history
  • Loading branch information
janmonschke committed Jul 23, 2024
1 parent f7332f9 commit 1e89f25
Show file tree
Hide file tree
Showing 29 changed files with 116 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ import { TimelineType, TimelineResponse } from '../model/components.gen';

export type CleanDraftTimelinesRequestBody = z.infer<typeof CleanDraftTimelinesRequestBody>;
export const CleanDraftTimelinesRequestBody = z.object({
timelineType: TimelineType.optional(),
timelineType: TimelineType,
});
export type CleanDraftTimelinesRequestBodyInput = z.input<typeof CleanDraftTimelinesRequestBody>;

export type CleanDraftTimelinesResponse = z.infer<typeof CleanDraftTimelinesResponse>;
export const CleanDraftTimelinesResponse = z.object({
data: z.object({
persistTimeline: z
.object({
timeline: TimelineResponse.optional(),
})
.optional(),
persistTimeline: z.object({
timeline: TimelineResponse,
}),
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ paths:
application/json:
schema:
type: object
required: [timelineType]
properties:
timelineType:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineType'
Expand All @@ -37,17 +38,18 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
type: object
required: [persistTimeline]
properties:
persistTimeline:
type: object
required: [timeline]
properties:
timeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
required:
- data
'403':
description: Indicates that the user does not have the required permissions to create a draft timeline.
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ export type CreateTimelinesRequestBodyInput = z.input<typeof CreateTimelinesRequ
export type CreateTimelinesResponse = z.infer<typeof CreateTimelinesResponse>;
export const CreateTimelinesResponse = z.object({
data: z.object({
persistTimeline: z
.object({
timeline: TimelineResponse.optional(),
})
.optional(),
persistTimeline: z.object({
timeline: TimelineResponse.optional(),
}),
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
type: object
required: [persistTimeline]
properties:
persistTimeline:
type: object
properties:
timeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
required:
- data
'405':
description: Indicates that there was an error in the timeline creation.
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ paths:
application/json:
schema:
type: object
required:
- savedObjectIds
required: [savedObjectIds]
properties:
savedObjectIds:
type: array
Expand All @@ -47,11 +46,10 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
type: object
properties:
deleteTimeline:
type: boolean
required:
- data
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ExportTimelinesRequestQuery = z.object({
/**
* The name of the file to export
*/
file_name: z.string().optional(),
file_name: z.string(),
});
export type ExportTimelinesRequestQueryInput = z.input<typeof ExportTimelinesRequestQuery>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ paths:
parameters:
- in: query
name: file_name
required: true
schema:
type: string
description: The name of the file to export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@ import { TimelineType, TimelineResponse } from '../model/components.gen';

export type GetDraftTimelinesRequestQuery = z.infer<typeof GetDraftTimelinesRequestQuery>;
export const GetDraftTimelinesRequestQuery = z.object({
timelineType: TimelineType.optional(),
timelineType: TimelineType,
});
export type GetDraftTimelinesRequestQueryInput = z.input<typeof GetDraftTimelinesRequestQuery>;

export type GetDraftTimelinesResponse = z.infer<typeof GetDraftTimelinesResponse>;
export const GetDraftTimelinesResponse = z.object({
data: z
.object({
persistTimeline: z
.object({
timeline: TimelineResponse.optional(),
})
.optional(),
})
.optional(),
data: z.object({
persistTimeline: z.object({
timeline: TimelineResponse,
}),
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ paths:
parameters:
- in: query
name: timelineType
required: true
schema:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineType'
responses:
Expand All @@ -30,12 +31,15 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
type: object
required: [persistTimeline]
properties:
persistTimeline:
type: object
required: [timeline]
properties:
timeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const DocumentIds = z.union([z.array(z.string()), z.string()]);

export type GetNotesRequestQuery = z.infer<typeof GetNotesRequestQuery>;
export const GetNotesRequestQuery = z.object({
documentIds: DocumentIds.optional(),
documentIds: DocumentIds,
page: z.coerce.number().optional(),
perPage: z.coerce.number().optional(),
search: z.string().nullable().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ paths:
x-codegen-enabled: true
operationId: GetNotes
description: Gets notes
summary: Get all notes for a given document.
tags:
- access:securitySolution
parameters:
- name: documentIds
in: query
required: true
schema:
$ref: '#/components/schemas/DocumentIds'
- name: page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export type GetTimelineRequestQueryInput = z.input<typeof GetTimelineRequestQuer
export type GetTimelineResponse = z.infer<typeof GetTimelineResponse>;
export const GetTimelineResponse = z.object({
data: z.object({
getOneTimeline: TimelineResponse.nullable().optional(),
getOneTimeline: TimelineResponse.nullable(),
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
type: object
required: [getOneTimeline]
properties:
getOneTimeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
nullable: true
required:
- data
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export type GetTimelinesRequestQueryInput = z.input<typeof GetTimelinesRequestQu
export type GetTimelinesResponse = z.infer<typeof GetTimelinesResponse>;
export const GetTimelinesResponse = z.object({
data: z.object({
timelines: z.array(TimelineResponse).optional(),
totalCount: z.number().optional(),
timelines: z.array(TimelineResponse),
totalCount: z.number(),
defaultTimelineCount: z.number().optional(),
templateTimelineCount: z.number().optional(),
favoriteCount: z.number().optional(),
elasticTemplateTimelineCount: z.number().optional(),
customTemplateTimelineCount: z.number().optional(),
templateTimelineCount: z.number(),
favoriteCount: z.number(),
elasticTemplateTimelineCount: z.number(),
customTemplateTimelineCount: z.number(),
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,20 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
type: object
required:
[
timelines,
totalCount,
defaultTimelineCoun,
templateTimelineCount,
favoriteCount,
elasticTemplateTimelineCount,
customTemplateTimelineCount,
]
properties:
timelines:
type: array
Expand All @@ -94,8 +105,6 @@ paths:
type: number
customTemplateTimelineCount:
type: number
required:
- data
'400':
description: Bad request. The user supplied invalid data.
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ export type ImportTimelinesRequestBody = z.infer<typeof ImportTimelinesRequestBo
export const ImportTimelinesRequestBody = z.object({
file: Readable.merge(
z.object({
hapi: z
.object({
filename: z.string().optional(),
headers: z.object({}).optional(),
})
.optional(),
hapi: z.object({
filename: z.string(),
headers: z.object({}),
isImmutable: z.enum(['true', 'false']).optional(),
}),
})
),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,32 @@ paths:
allOf:
- $ref: '../model/components.schema.yaml#/components/schemas/Readable'
- type: object
required: [hapi]
properties:
hapi:
type: object
required: [filename, headers]
properties:
filename:
type: string
headers:
type: object
isImmutable:
type: string
enum:
- 'true'
- 'false'
responses:
'200':
description: Indicates the import of timelines was successful.
content:
application/json:
schema:
type: object
required: [data]
properties:
data:
$ref: '../model/components.schema.yaml#/components/schemas/ImportTimelineResult'
required:
- data

'400':
description: Indicates the import of timelines was unsuccessful because of an invalid file extension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export type InstallPrepackedTimelinesRequestBody = z.infer<
typeof InstallPrepackedTimelinesRequestBody
>;
export const InstallPrepackedTimelinesRequestBody = z.object({
timelinesToInstall: z.array(ImportTimelines.nullable()).optional(),
timelinesToUpdate: z.array(ImportTimelines.nullable()).optional(),
prepackagedTimelines: z.array(SavedTimeline).optional(),
timelinesToInstall: z.array(ImportTimelines.nullable()),
timelinesToUpdate: z.array(ImportTimelines.nullable()),
prepackagedTimelines: z.array(SavedTimeline),
});
export type InstallPrepackedTimelinesRequestBodyInput = z.input<
typeof InstallPrepackedTimelinesRequestBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ paths:
application/json:
schema:
type: object
required: [timelinesToInstall, timelinesToUpdate, prepackagedTimelines]
properties:
timelinesToInstall:
type: array
Expand All @@ -47,11 +48,10 @@ paths:
application/json:
schema:
type: object
required: [data]
properties:
data:
$ref: '../model/components.schema.yaml#/components/schemas/ImportTimelineResult'
required:
- data
'500':
description: Indicates the installation of prepackaged timelines was unsuccessful.
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ import { SavedTimeline, TimelineResponse } from '../model/components.gen';

export type PatchTimelineRequestBody = z.infer<typeof PatchTimelineRequestBody>;
export const PatchTimelineRequestBody = z.object({
timelineId: z.string().optional(),
version: z.string().optional(),
timeline: SavedTimeline.optional(),
timelineId: z.string().nullable(),
version: z.string().nullable(),
timeline: SavedTimeline,
});
export type PatchTimelineRequestBodyInput = z.input<typeof PatchTimelineRequestBody>;

export type PatchTimelineResponse = z.infer<typeof PatchTimelineResponse>;
export const PatchTimelineResponse = z.object({
data: z.object({
persistTimeline: z
.object({
timeline: TimelineResponse.optional(),
})
.optional(),
persistTimeline: z.object({
timeline: TimelineResponse.optional(),
}),
}),
});
Loading

0 comments on commit 1e89f25

Please sign in to comment.