Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
edecbca
[Streams] Introduce GroupedStream
simianhacker Jan 23, 2025
b1100eb
Include api into index for grouped models
simianhacker Jan 23, 2025
ee9027a
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 23, 2025
8b39702
Fixing type errors
simianhacker Jan 23, 2025
64ea60b
fixing type error
simianhacker Jan 23, 2025
1d7ecf3
refactoring getStream to be more async/await
simianhacker Jan 27, 2025
46c482d
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 27, 2025
06e58f2
Fixing type errors
simianhacker Jan 27, 2025
1a987b0
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 27, 2025
9a30bb4
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jan 27, 2025
c74f83f
Fixing types
simianhacker Jan 27, 2025
fa65dd7
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 28, 2025
682c29b
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 29, 2025
56d64ac
two-types storage adapter
flash1293 Jan 29, 2025
15f2b2b
Merge branch 'streams/grouped' of github.com:simianhacker/kibana into…
flash1293 Jan 29, 2025
33bd797
renaming UnWired to Unwired
simianhacker Jan 29, 2025
2e3ed33
Adding appropriate type checks and assertions
simianhacker Jan 29, 2025
20c2aa1
Fixing spelling error
simianhacker Jan 29, 2025
d7061de
Fixign merge type issues
simianhacker Jan 29, 2025
b9090c3
Renaming from GroupedStream to GroupStream
simianhacker Jan 29, 2025
b386d07
attempt to fix types
flash1293 Jan 30, 2025
3e6610a
fix types
flash1293 Jan 30, 2025
8f734f8
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 30, 2025
5f4370a
Fixing some overlooked renames
simianhacker Jan 30, 2025
7095389
Fixing naming
simianhacker Jan 30, 2025
eebc7e6
Fixing naming
simianhacker Jan 30, 2025
d45df43
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 30, 2025
c43c6f8
fixing missing import
simianhacker Jan 31, 2025
b50af78
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 31, 2025
a0068c3
Fixing name chagnes that didn't get picked up in a merge conflict
simianhacker Jan 31, 2025
2daf0e8
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Jan 31, 2025
b069684
Update x-pack/solutions/observability/packages/utils_server/es/storag…
simianhacker Feb 3, 2025
09c7a7b
Update x-pack/solutions/observability/plugins/streams/server/lib/stre…
simianhacker Feb 3, 2025
bc2adcd
ensure response matches the type definitions
simianhacker Feb 3, 2025
c0d2930
Renaming validateGroupStream to assertVaildGroupMembers
simianhacker Feb 3, 2025
d5fd6b5
moving the Zod type closer to the manual type
simianhacker Feb 3, 2025
c631b1f
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Feb 3, 2025
3198e5b
Fixing tests to match response from GET /api/streams/{id}
simianhacker Feb 3, 2025
3f4dd69
Merge branch 'main' of github.com:elastic/kibana into streams/grouped
simianhacker Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api_docs/kbn_streams_schema.devdocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1593,10 +1593,10 @@
},
{
"parentPluginId": "@kbn/streams-schema",
"id": "def-common.isUnWiredStreamGetResponse",
"id": "def-common.isUnwiredStreamGetResponse",
"type": "Function",
"tags": [],
"label": "isUnWiredStreamGetResponse",
"label": "isUnwiredStreamGetResponse",
"description": [],
"signature": [
"<TValue extends ",
Expand Down Expand Up @@ -1624,7 +1624,7 @@
"children": [
{
"parentPluginId": "@kbn/streams-schema",
"id": "def-common.isUnWiredStreamGetResponse.$1",
"id": "def-common.isUnwiredStreamGetResponse.$1",
"type": "Uncategorized",
"tags": [],
"label": "value",
Expand Down Expand Up @@ -5016,4 +5016,4 @@
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,55 @@

import { z } from '@kbn/zod';
import {
ingestStreamGetResponseSchema,
ingestStreamUpsertRequestSchema,
unwiredStreamGetResponseSchema,
wiredStreamGetResponseSchema,
type IngestStreamGetResponse,
type IngestStreamUpsertRequest,
} from './ingest';
import {
GroupStreamGetResponse,
groupStreamGetResponseSchema,
GroupStreamUpsertRequest,
groupStreamUpsertRequestSchema,
} from './group';
import { createAsSchemaOrThrow, createIsNarrowSchema } from '../helpers';

export const streamGetResponseSchema: z.Schema<StreamGetResponse> = z.union([
ingestStreamGetResponseSchema,
groupStreamGetResponseSchema,
]);

export const streamUpsertRequestSchema: z.Schema<StreamUpsertRequest> = z.union([
ingestStreamUpsertRequestSchema,
groupStreamUpsertRequestSchema,
]);

export const isWiredStreamGetResponse = createIsNarrowSchema(
streamGetResponseSchema,
wiredStreamGetResponseSchema
);

export const isUnwiredStreamGetResponse = createIsNarrowSchema(
streamGetResponseSchema,
unwiredStreamGetResponseSchema
);

export const asWiredStreamGetResponse = createAsSchemaOrThrow(
streamGetResponseSchema,
wiredStreamGetResponseSchema
);

export const asUnwiredStreamGetResponse = createAsSchemaOrThrow(
streamGetResponseSchema,
unwiredStreamGetResponseSchema
);

export const streamUpsertRequestSchema: z.Schema<StreamUpsertRequest> =
ingestStreamUpsertRequestSchema;
export const asIngestStreamGetResponse = createAsSchemaOrThrow(
streamGetResponseSchema,
ingestStreamGetResponseSchema
);

export type StreamGetResponse = IngestStreamGetResponse;
export type StreamUpsertRequest = IngestStreamUpsertRequest;
export type StreamGetResponse = IngestStreamGetResponse | GroupStreamGetResponse;
export type StreamUpsertRequest = IngestStreamUpsertRequest | GroupStreamUpsertRequest;
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
import { z } from '@kbn/zod';
import { createIsNarrowSchema } from '../helpers';
import { IngestStreamDefinition, ingestStreamDefinitionSchema } from './ingest';
import { GroupStreamDefinition, groupStreamDefinitionSchema } from './group';

export type StreamDefinition = IngestStreamDefinition;
export type StreamDefinition = IngestStreamDefinition | GroupStreamDefinition;

export const streamDefinitionSchema: z.Schema<StreamDefinition> = ingestStreamDefinitionSchema;
export const streamDefinitionSchema: z.Schema<StreamDefinition> = z.union([
ingestStreamDefinitionSchema,
groupStreamDefinitionSchema,
]);

export const isStreamDefinition = createIsNarrowSchema(z.unknown(), streamDefinitionSchema);
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { z } from '@kbn/zod';
import {
StreamGetResponseBase,
streamGetResponseSchemaBase,
StreamUpsertRequestBase,
streamUpsertRequestSchemaBase,
} from '../base/api';
import { GroupStreamDefinitionBase, groupStreamDefinitionBaseSchema } from './base';

/**
* Group get response
*/
interface GroupStreamGetResponse extends StreamGetResponseBase {
stream: GroupStreamDefinitionBase;
}

const groupStreamGetResponseSchema: z.Schema<GroupStreamGetResponse> = z.intersection(
streamGetResponseSchemaBase,
z.object({
stream: groupStreamDefinitionBaseSchema,
})
);

/**
* Group upsert request
*/
interface GroupStreamUpsertRequest extends StreamUpsertRequestBase {
stream: GroupStreamDefinitionBase;
}

const groupStreamUpsertRequestSchema: z.Schema<GroupStreamUpsertRequest> = z.intersection(
streamUpsertRequestSchemaBase,
z.object({
stream: groupStreamDefinitionBaseSchema,
})
);

export {
type GroupStreamGetResponse,
type GroupStreamUpsertRequest,
groupStreamGetResponseSchema,
groupStreamUpsertRequestSchema,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { z } from '@kbn/zod';
import { NonEmptyString } from '@kbn/zod-helpers';
import { StreamDefinitionBase } from '../base';

interface GroupBase {
description?: string;
members: string[];
}

const groupBaseSchema: z.Schema<GroupBase> = z.object({
description: z.optional(z.string()),
members: z.array(NonEmptyString),
});

interface GroupStreamDefinitionBase {
group: GroupBase;
}

const groupStreamDefinitionBaseSchema: z.Schema<GroupStreamDefinitionBase> = z.object({
group: groupBaseSchema,
});

type GroupStreamDefinition = StreamDefinitionBase & GroupStreamDefinitionBase;

const groupStreamDefinitionSchema: z.Schema<GroupStreamDefinition> = z.intersection(
z.object({ name: NonEmptyString }),
groupStreamDefinitionBaseSchema
);

export {
type GroupBase,
type GroupStreamDefinitionBase,
type GroupStreamDefinition,
groupBaseSchema,
groupStreamDefinitionBaseSchema,
groupStreamDefinitionSchema,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export * from './base';
export * from './api';
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { createIsNarrowSchema } from '../helpers';
import { z } from '@kbn/zod';
import { createAsSchemaOrThrow, createIsNarrowSchema } from '../helpers';
import { streamDefinitionSchema } from './core';
import { groupStreamDefinitionBaseSchema, groupStreamDefinitionSchema } from './group';
import {
ingestStreamDefinitionSchema,
unwiredStreamDefinitionSchema,
Expand All @@ -23,11 +24,31 @@ export const isWiredStreamDefinition = createIsNarrowSchema(
wiredStreamDefinitionSchema
);

export const asIngestStreamDefinition = createAsSchemaOrThrow(
streamDefinitionSchema,
ingestStreamDefinitionSchema
);

export const asWiredStreamDefinition = createAsSchemaOrThrow(
streamDefinitionSchema,
wiredStreamDefinitionSchema
);

export const isUnwiredStreamDefinition = createIsNarrowSchema(
streamDefinitionSchema,
unwiredStreamDefinitionSchema
);

export const isGroupStreamDefinition = createIsNarrowSchema(
streamDefinitionSchema,
groupStreamDefinitionSchema
);

export const isGroupStreamDefinitionBase = createIsNarrowSchema(
z.unknown(),
groupStreamDefinitionBaseSchema
);

export const isRootStreamDefinition = createIsNarrowSchema(
streamDefinitionSchema,
wiredStreamDefinitionSchema.refine((stream) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export * from './legacy';
export * from './api';
export * from './core';
export * from './helpers';
export * from './group';
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
wiredStreamDefinitionSchemaBase,
} from './base';
import { ElasticsearchAsset, elasticsearchAssetSchema } from './common';
import { createIsNarrowSchema, createAsSchemaOrThrow } from '../../helpers';
import {
UnwiredIngestStreamEffectiveLifecycle,
WiredIngestStreamEffectiveLifecycle,
Expand Down Expand Up @@ -146,33 +145,12 @@ const ingestStreamGetResponseSchema: z.Schema<IngestStreamGetResponse> = z.union
unwiredStreamGetResponseSchema,
]);

const isWiredStreamGetResponse = createIsNarrowSchema(
ingestStreamGetResponseSchema,
wiredStreamGetResponseSchema
);

const isUnWiredStreamGetResponse = createIsNarrowSchema(
ingestStreamGetResponseSchema,
unwiredStreamGetResponseSchema
);

const asWiredStreamGetResponse = createAsSchemaOrThrow(
ingestStreamGetResponseSchema,
wiredStreamGetResponseSchema
);

const asUnwiredStreamGetResponse = createAsSchemaOrThrow(
ingestStreamGetResponseSchema,
unwiredStreamGetResponseSchema
);

export {
ingestStreamUpsertRequestSchema,
ingestUpsertRequestSchema,
isWiredStreamGetResponse,
isUnWiredStreamGetResponse,
asWiredStreamGetResponse,
asUnwiredStreamGetResponse,
ingestStreamGetResponseSchema,
wiredStreamGetResponseSchema,
unwiredStreamGetResponseSchema,
type IngestGetResponse,
type IngestStreamGetResponse,
type IngestStreamUpsertRequest,
Expand Down
Loading