Skip to content
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
548e2ed
Add entry zod schemas
flops Jun 30, 2025
ca6789f
Merge branch 'main' of github.com:datalens-tech/datalens-ui into CHAR…
flops Jun 30, 2025
cf9a3b7
Merge branch 'main' of github.com:datalens-tech/datalens-ui into CHAR…
flops Jul 2, 2025
7b96f7b
Merge branch 'main' of github.com:datalens-tech/datalens-ui into CHAR…
flops Jul 15, 2025
6e16468
Merge branch 'main' of github.com:datalens-tech/datalens-ui into CHAR…
flops Jul 17, 2025
0efbbd7
Merge branch 'main' of github.com:datalens-tech/datalens-ui into CHAR…
flops Jul 21, 2025
f6b1eb1
Added public-api export
flops Jul 23, 2025
9f50ea3
Swagger
flops Jul 31, 2025
0b20b13
Add wizard api hanlers
flops Aug 4, 2025
d6a4680
Wizard Hierarchy fix
flops Aug 4, 2025
c7eb299
Wizard update and create
flops Aug 4, 2025
08a08a1
Fix types and comment
flops Aug 4, 2025
5356131
Added actions
flops Aug 6, 2025
fafce39
Dash descriptions
flops Aug 8, 2025
33915fb
Merge branch 'main' of github.com:datalens-tech/datalens-ui into CHAR…
flops Aug 12, 2025
9e87f79
Public api features (#2800)
stepanenkoxx Aug 29, 2025
d6830ef
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 3, 2025
8fcbfd2
Split api and public api (#2839)
stepanenkoxx Sep 7, 2025
b88c016
Add packages
stepanenkoxx Sep 8, 2025
2f1bd24
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 8, 2025
2242111
Fixes
stepanenkoxx Sep 8, 2025
23e96e0
Fixes
stepanenkoxx Sep 8, 2025
d98cb39
Fixes
stepanenkoxx Sep 8, 2025
f99ffe7
Fixes
stepanenkoxx Sep 9, 2025
eafd00f
Fixes
stepanenkoxx Sep 9, 2025
2c62320
Fixes
stepanenkoxx Sep 9, 2025
f05fe9a
Fixes
stepanenkoxx Sep 10, 2025
c1926b0
Fixes
stepanenkoxx Sep 10, 2025
ef227f1
Fixes
stepanenkoxx Sep 10, 2025
fc03943
Fixes
stepanenkoxx Sep 10, 2025
b71dffb
Fixes
stepanenkoxx Sep 10, 2025
d6bc6ce
Fixes
stepanenkoxx Sep 11, 2025
90f164b
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 11, 2025
ee32104
Fixes
stepanenkoxx Sep 11, 2025
4c1a1b4
Fixes
stepanenkoxx Sep 11, 2025
c409620
Fixes
stepanenkoxx Sep 11, 2025
b2c46d8
Fixes
stepanenkoxx Sep 11, 2025
1f6a310
Fixes
stepanenkoxx Sep 11, 2025
d84109f
Fixes
stepanenkoxx Sep 15, 2025
d4a8348
Review fixes
stepanenkoxx Sep 15, 2025
dfacf28
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 15, 2025
20c64a6
Remove not ready schemas
stepanenkoxx Sep 15, 2025
4dee5d0
Remove not ready schemas
stepanenkoxx Sep 15, 2025
5c2d0ce
Fix ts
stepanenkoxx Sep 15, 2025
74cc9c0
Fixes
stepanenkoxx Sep 15, 2025
eef7f52
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 15, 2025
2a29f46
Fix dataset schemas
stepanenkoxx Sep 15, 2025
2afa7fe
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 15, 2025
ecf4bf0
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 16, 2025
eea7c21
Review fixes
stepanenkoxx Sep 17, 2025
e061d0d
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 17, 2025
e2ea3e1
Review fixes
stepanenkoxx Sep 17, 2025
5aa1996
Merge branch 'main' into CHARTS-11469-schema
stepanenkoxx Sep 17, 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
1 change: 1 addition & 0 deletions api/server/app-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export {
isDatalensMode,
isFullMode,
isApiMode,
isPublicApiMode,
} from '../../src/server/app-env';
9 changes: 9 additions & 0 deletions api/server/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ export {
} from '../../src/server/components/charts-engine';

export {renderHTML} from '../../src/server/components/charts-engine/components/markdown';

export {initPublicApiSwagger} from '../../src/server/components/public-api';

export {PUBLIC_API_PROXY_MAP, PUBLIC_API_ROUTE} from '../../src/server/components/public-api';
export type {
PublicApiRpcMap,
PublicApiConfig,
PublicApiSecuritySchemes,
} from '../../src/server/components/public-api/types';
1 change: 1 addition & 0 deletions api/server/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export {SERVICE_NAME_DATALENS} from '../../src/server/constants';
export {IPV6_AXIOS_OPTIONS} from '../../src/server/constants/axios';
export {PUBLIC_API_ORG_ID_HEADER} from '../../src/server/constants/public-api';
1 change: 1 addition & 0 deletions api/server/controllers.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export {ping} from '../../src/server/controllers/ping';
export {chartsController} from '../../src/server/components/charts-engine/controllers/charts';
export {createPublicApiController} from '../../src/server/controllers';
100 changes: 89 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"author": "DataLens Team <https://github.com/datalens-tech>",
"license": "Apache-2.0",
"dependencies": {
"@asteasolutions/zod-to-openapi": "^7.3.4",
"@braintree/sanitize-url": "^6.0.0",
"@datalens-tech/ui-sandbox-modules": "^0.36.0",
"@datalens-tech/xlsx": "^0.20.1",
Expand Down Expand Up @@ -118,7 +119,9 @@
"request-ip": "^3.3.0",
"request-promise-native": "^1.0.9",
"set-cookie-parser": "^2.7.1",
"workerpool": "^9.1.1"
"swagger-ui-express": "^5.0.1",
"workerpool": "^9.1.1",
"zod": "^3.25.64"
},
"devDependencies": {
"@floating-ui/react": "^0.27.13",
Expand Down Expand Up @@ -181,6 +184,7 @@
"@types/request-ip": "^0.0.41",
"@types/request-promise-native": "^1.0.21",
"@types/set-cookie-parser": "^2.4.10",
"@types/swagger-ui-express": "^4.1.8",
"@types/uuid": "^9.0.8",
"@types/webpack-env": "^1.16.0",
"bem-cn-lite": "^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/server/app-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export const isFullMode = mode === AppMode.Full;
export const isDatalensMode = mode === AppMode.Datalens;
export const isChartsMode = mode === AppMode.Charts;
export const isApiMode = mode === AppMode.Api;
export const isPublicApiMode = mode === AppMode.PublicApi;

export const isOpensourceInstallation = appInstallation === AppInstallation.Opensource;
1 change: 1 addition & 0 deletions src/server/components/api-docs/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CONTENT_TYPE_JSON = 'application/json';
1 change: 1 addition & 0 deletions src/server/components/api-docs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type {SecuritySchemeObject} from './types';
14 changes: 14 additions & 0 deletions src/server/components/api-docs/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copied from @asteasolutions/zod-to-openapi
export type Method = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace';

export type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';

export type SecuritySchemeObject = {
type: SecuritySchemeType;
description?: string;
name?: string;
in?: string;
scheme?: string;
bearerFormat?: string;
openIdConnectUrl?: string;
};
87 changes: 87 additions & 0 deletions src/server/components/public-api/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import {OpenAPIRegistry} from '@asteasolutions/zod-to-openapi';

import type {PublicApiRpcMap} from './types';

export const publicApiOpenApiRegistry = new OpenAPIRegistry();

export const PUBLIC_API_HTTP_METHOD = 'POST';
export const PUBLIC_API_URL = '/rpc/:version/:action';
export const PUBLIC_API_ROUTE = `${PUBLIC_API_HTTP_METHOD} ${PUBLIC_API_URL}`;

enum ApiTag {
Connection = 'Connection',
Dataset = 'Dataset',
Wizard = 'Wizard',
Editor = 'Editor',
Dashboard = 'Dashboard',
}

export const PUBLIC_API_PROXY_MAP = {
v0: {
// Connection
deleteConnection: {
resolve: (api) => api.bi.deleteConnection,
openApi: {
summary: 'Delete connection',
tags: [ApiTag.Connection],
},
},

// Dataset
getDataset: {
resolve: (api) => api.bi.getDatasetByVersion,
openApi: {
summary: 'Get dataset',
tags: [ApiTag.Dataset],
},
},
updateDataset: {
resolve: (api) => api.bi.updateDataset,
openApi: {
summary: 'Update dataset',
tags: [ApiTag.Dataset],
},
},
createDataset: {
resolve: (api) => api.bi.createDataset,
openApi: {
summary: 'Create dataset',
tags: [ApiTag.Dataset],
},
},
deleteDataset: {
resolve: (api) => api.bi.deleteDataset,
openApi: {
summary: 'Delete dataset',
tags: [ApiTag.Dataset],
},
},

// Wizard
deleteWizardChart: {
resolve: (api) => api.mix.__deleteWizardChart__,
openApi: {
summary: 'Delete wizard chart',
tags: [ApiTag.Wizard],
},
},

// Editor
deleteEditorChart: {
resolve: (api) => api.mix.__deleteEditorChart__,
openApi: {
summary: 'Delete editor chart',
tags: [ApiTag.Editor],
},
},

// Dashboard
deleteDashboard: {
resolve: (api) => api.mix.__deleteDashboard__,
openApi: {
summary: 'Delete dashboard',
tags: [ApiTag.Dashboard],
},
},
},
} satisfies PublicApiRpcMap;
7 changes: 7 additions & 0 deletions src/server/components/public-api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export {
PUBLIC_API_PROXY_MAP,
PUBLIC_API_HTTP_METHOD,
PUBLIC_API_ROUTE,
PUBLIC_API_URL,
} from './constants';
export {initPublicApiSwagger, registerActionToOpenApi} from './utils';
29 changes: 29 additions & 0 deletions src/server/components/public-api/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type {Request, Response} from '@gravity-ui/expresskit';
import type {ApiWithRoot, GatewayActionUnaryResponse, SchemasByScope} from '@gravity-ui/gateway';

import type {DatalensGatewaySchemas} from '../../types/gateway';
import type {SecuritySchemeObject} from '../api-docs';

export type PublicApiRpcMap<TSchema extends SchemasByScope = DatalensGatewaySchemas> = Record<
string,
Record<
string,
{
resolve: (
api: ApiWithRoot<TSchema, Request['ctx'], Request, Response>,
) => (params: any) => Promise<GatewayActionUnaryResponse<unknown>>;
openApi: {
summary: string;
tags?: string[];
};
}
>
>;

export type PublicApiSecuritySchemes = Record<string, SecuritySchemeObject>;

export type PublicApiConfig<TSchema extends SchemasByScope = DatalensGatewaySchemas> = {
proxyMap: PublicApiRpcMap<TSchema>;
securitySchemes: PublicApiSecuritySchemes;
securityTypes: string[];
};
2 changes: 2 additions & 0 deletions src/server/components/public-api/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {initPublicApiSwagger} from './init-public-api-swagger';
export {registerActionToOpenApi} from './register-action-to-open-api';
Loading
Loading