Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Oct 2, 2024
1 parent c019147 commit 32b14be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ export type RegistrySearchResult = Pick<
| 'data_streams'
| 'policy_templates'
| 'categories'
| 'owner'
>;

// from /categories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const SettingsPage: React.FC<Props> = memo(
numOfAssets: Object.entries(packageInfo.assets).reduce(
(acc, [serviceName, serviceNameValue]) =>
acc +
Object.entries(serviceNameValue).reduce(
Object.entries(serviceNameValue || {}).reduce(
(acc2, [assetName, assetNameValue]) => acc2 + assetNameValue.length,
0
),
Expand Down
22 changes: 8 additions & 14 deletions x-pack/plugins/fleet/server/types/rest_spec/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const EsAssetReferenceSchema = schema.object({
schema.literal('ml_model'),
]),
deferred: schema.maybe(schema.boolean()),
version: schema.maybe(schema.string()),
});

export const InstallationInfoSchema = schema.object({
Expand Down Expand Up @@ -191,8 +192,8 @@ export const PackageInfoSchema = schema
format_version: schema.maybe(schema.string()),
vars: schema.maybe(schema.arrayOf(schema.recordOf(schema.string(), schema.any()))),
latestVersion: schema.maybe(schema.string()),
// sometimes package list response contains extra properties, e.g. installed_kibana
})
// sometimes package list response contains extra properties, e.g. installed_kibana
.extendsDeep({
unknowns: 'allow',
});
Expand Down Expand Up @@ -323,22 +324,17 @@ export const UpdatePackageResponseSchema = schema.object({
response: schema.maybe(GetPackageInfoSchema.extends({}, { meta: { deprecated: true } })),
});

export const AssetReferenceSchema = schema.object({
id: schema.string(),
type: schema.string(),
originId: schema.maybe(schema.string()),
deferred: schema.maybe(schema.boolean()),
version: schema.maybe(schema.string()),
});
export const AssetReferenceSchema = schema.oneOf([
KibanaAssetReferenceSchema,
EsAssetReferenceSchema,
]);

export const InstallPackageResponseSchema = schema.object({
items: schema.arrayOf(AssetReferenceSchema),
_meta: schema.object({
install_source: schema.string(),
}),
response: schema.maybe(
schema.arrayOf(AssetReferenceSchema.extends({}, { meta: { deprecated: true } }))
),
response: schema.maybe(schema.arrayOf(AssetReferenceSchema, { meta: { deprecated: true } })),
});

export const InstallKibanaAssetsResponseSchema = schema.object({
Expand Down Expand Up @@ -375,9 +371,7 @@ export const BulkInstallPackagesFromRegistryResponseSchema = schema.object({

export const DeletePackageResponseSchema = schema.object({
items: schema.arrayOf(AssetReferenceSchema),
response: schema.maybe(
schema.arrayOf(AssetReferenceSchema.extends({}, { meta: { deprecated: true } }))
),
response: schema.maybe(schema.arrayOf(AssetReferenceSchema, { meta: { deprecated: true } })),
});

export const GetVerificationKeyIdResponseSchema = schema.object({
Expand Down

0 comments on commit 32b14be

Please sign in to comment.