Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ packages/kbn-sort-package-json @elastic/kibana-operations
src/platform/packages/shared/kbn-sort-predicates @elastic/kibana-visualizations
x-pack/platform/plugins/shared/spaces @elastic/kibana-security
x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin @elastic/kibana-security
src/platform/packages/shared/kbn-spaces-utils @elastic/kibana-security
packages/kbn-spec-to-console @elastic/kibana-management
src/platform/packages/shared/kbn-sse-utils @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-sse-utils-client @elastic/obs-knowledge-team
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@
"@kbn/sort-predicates": "link:src/platform/packages/shared/kbn-sort-predicates",
"@kbn/spaces-plugin": "link:x-pack/platform/plugins/shared/spaces",
"@kbn/spaces-test-plugin": "link:x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin",
"@kbn/spaces-utils": "link:src/platform/packages/shared/kbn-spaces-utils",
"@kbn/sse-utils": "link:src/platform/packages/shared/kbn-sse-utils",
"@kbn/sse-utils-client": "link:src/platform/packages/shared/kbn-sse-utils-client",
"@kbn/sse-utils-server": "link:src/platform/packages/shared/kbn-sse-utils-server",
Expand Down
3 changes: 3 additions & 0 deletions src/platform/packages/shared/kbn-spaces-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/spaces-utils

Package containing utils related to Spaces.
11 changes: 11 additions & 0 deletions src/platform/packages/shared/kbn-spaces-utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export { DEFAULT_SPACE_ID } from './src/common/constants';
export { addSpaceIdToPath, getSpaceIdFromPath } from './src/common/spaces_url_parser';
14 changes: 14 additions & 0 deletions src/platform/packages/shared/kbn-spaces-utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../../..',
roots: ['<rootDir>/src/platform/packages/shared/kbn-spaces-utils'],
};
9 changes: 9 additions & 0 deletions src/platform/packages/shared/kbn-spaces-utils/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/spaces-utils",
"owner": [
"@elastic/kibana-security"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const DEFAULT_SPACE_ID = `default`;
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/*
* 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.
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { addSpaceIdToPath, getSpaceIdFromPath } from './spaces_url_parser';
import { DEFAULT_SPACE_ID } from '../constants';
import { DEFAULT_SPACE_ID } from './constants';

describe('getSpaceIdFromPath', () => {
describe('without a serverBasePath defined', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/*
* 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.
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { DEFAULT_SPACE_ID } from '../constants';
import { DEFAULT_SPACE_ID } from './constants';

const spaceContextRegex = /^\/s\/([a-z0-9_\-]+)/;

Expand Down
17 changes: 17 additions & 0 deletions src/platform/packages/shared/kbn-spaces-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node"
]
},
"include": [
"**/*.ts",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,8 @@
"@kbn/spaces-plugin/*": ["x-pack/platform/plugins/shared/spaces/*"],
"@kbn/spaces-test-plugin": ["x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin"],
"@kbn/spaces-test-plugin/*": ["x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/*"],
"@kbn/spaces-utils": ["src/platform/packages/shared/kbn-spaces-utils"],
"@kbn/spaces-utils/*": ["src/platform/packages/shared/kbn-spaces-utils/*"],
"@kbn/spec-to-console": ["packages/kbn-spec-to-console"],
"@kbn/spec-to-console/*": ["packages/kbn-spec-to-console/*"],
"@kbn/sse-utils": ["src/platform/packages/shared/kbn-sse-utils"],
Expand Down
2 changes: 1 addition & 1 deletion x-pack/platform/plugins/shared/spaces/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export {
DEFAULT_SPACE_ID,
API_VERSIONS,
} from './constants';
export { addSpaceIdToPath, getSpaceIdFromPath } from './lib/spaces_url_parser';
export { addSpaceIdToPath, getSpaceIdFromPath } from '@kbn/spaces-utils';
export type {
Space,
GetAllSpacesOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import type { HttpServiceSetup, KibanaRequest, SavedObjectsRepository } from '@k
import { SavedObjectsErrorHelpers } from '@kbn/core/server';
import { coreMock, httpServerMock } from '@kbn/core/server/mocks';
import { featuresPluginMock } from '@kbn/features-plugin/server/mocks';
import { getSpaceIdFromPath } from '@kbn/spaces-utils';

import { SpacesService } from './spaces_service';
import { DEFAULT_SPACE_ID } from '../../common/constants';
import { getSpaceIdFromPath } from '../../common/lib/spaces_url_parser';
import { spacesConfig } from '../lib/__fixtures__';
import { SpacesClientService } from '../spaces_client';
const createService = (serverBasePath: string = '') => {
Expand Down
1 change: 1 addition & 0 deletions x-pack/platform/plugins/shared/spaces/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@kbn/core-chrome-browser",
"@kbn/core-lifecycle-server",
"@kbn/core-user-profile-browser-mocks",
"@kbn/spaces-utils"
],
"exclude": [
"target/**/*",
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7439,6 +7439,10 @@
version "0.0.0"
uid ""

"@kbn/spaces-utils@link:src/platform/packages/shared/kbn-spaces-utils":
version "0.0.0"
uid ""

"@kbn/spec-to-console@link:packages/kbn-spec-to-console":
version "0.0.0"
uid ""
Expand Down