@harnessio/react-dbops-service-client 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/dbops-service/src/index.d.ts +6 -0
- package/dist/dbops-service/src/index.js +10 -0
- package/dist/dbops-service/src/services/helpers.d.ts +14 -0
- package/dist/dbops-service/src/services/helpers.js +1 -0
- package/dist/dbops-service/src/services/hooks/useCreateV1StepPluginInputsMutation.d.ts +20 -0
- package/dist/dbops-service/src/services/hooks/useCreateV1StepPluginInputsMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1CreateProjDbSchemaInstanceMutation.d.ts +25 -0
- package/dist/dbops-service/src/services/hooks/useV1CreateProjDbSchemaInstanceMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1CreateProjDbSchemaMutation.d.ts +24 -0
- package/dist/dbops-service/src/services/hooks/useV1CreateProjDbSchemaMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1DeleteProjDbSchemaInstanceMutation.d.ts +22 -0
- package/dist/dbops-service/src/services/hooks/useV1DeleteProjDbSchemaInstanceMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1DeleteProjDbSchemaMutation.d.ts +21 -0
- package/dist/dbops-service/src/services/hooks/useV1DeleteProjDbSchemaMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1GetDbinstanceLogQuery.d.ts +21 -0
- package/dist/dbops-service/src/services/hooks/useV1GetDbinstanceLogQuery.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1GetProjDbSchemaInstanceQuery.d.ts +23 -0
- package/dist/dbops-service/src/services/hooks/useV1GetProjDbSchemaInstanceQuery.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1GetProjDbSchemaQuery.d.ts +22 -0
- package/dist/dbops-service/src/services/hooks/useV1GetProjDbSchemaQuery.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1IngestLogsMutation.d.ts +23 -0
- package/dist/dbops-service/src/services/hooks/useV1IngestLogsMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1ListProjDbSchemaInstanceQuery.d.ts +37 -0
- package/dist/dbops-service/src/services/hooks/useV1ListProjDbSchemaInstanceQuery.js +20 -0
- package/dist/dbops-service/src/services/hooks/useV1ListProjDbSchemaQuery.d.ts +36 -0
- package/dist/dbops-service/src/services/hooks/useV1ListProjDbSchemaQuery.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1UpdateProjDbSchemaInstanceMutation.d.ts +26 -0
- package/dist/dbops-service/src/services/hooks/useV1UpdateProjDbSchemaInstanceMutation.js +14 -0
- package/dist/dbops-service/src/services/hooks/useV1UpdateProjDbSchemaMutation.d.ts +25 -0
- package/dist/dbops-service/src/services/hooks/useV1UpdateProjDbSchemaMutation.js +14 -0
- package/dist/dbops-service/src/services/index.d.ts +48 -0
- package/dist/dbops-service/src/services/index.js +13 -0
- package/dist/dbops-service/src/services/requestBodies/DbInstanceCreateRequestRequestBody.d.ts +2 -0
- package/dist/dbops-service/src/services/requestBodies/DbInstanceCreateRequestRequestBody.js +1 -0
- package/dist/dbops-service/src/services/requestBodies/DbInstanceUpdateRequestRequestBody.d.ts +25 -0
- package/dist/dbops-service/src/services/requestBodies/DbInstanceUpdateRequestRequestBody.js +4 -0
- package/dist/dbops-service/src/services/requestBodies/DbSchemaCreateRequestRequestBody.d.ts +2 -0
- package/dist/dbops-service/src/services/requestBodies/DbSchemaCreateRequestRequestBody.js +1 -0
- package/dist/dbops-service/src/services/requestBodies/DbSchemaUpdateRequestRequestBody.d.ts +35 -0
- package/dist/dbops-service/src/services/requestBodies/DbSchemaUpdateRequestRequestBody.js +4 -0
- package/dist/dbops-service/src/services/requestBodies/LogIngestRequestRequestBody.d.ts +1 -0
- package/dist/dbops-service/src/services/requestBodies/LogIngestRequestRequestBody.js +1 -0
- package/dist/dbops-service/src/services/requestBodies/PluginStepInputsRequestRequestBody.d.ts +19 -0
- package/dist/dbops-service/src/services/requestBodies/PluginStepInputsRequestRequestBody.js +1 -0
- package/dist/dbops-service/src/services/responses/DbInstanceListResponseResponse.d.ts +5 -0
- package/dist/dbops-service/src/services/responses/DbInstanceListResponseResponse.js +1 -0
- package/dist/dbops-service/src/services/responses/DbInstanceResponseResponse.d.ts +2 -0
- package/dist/dbops-service/src/services/responses/DbInstanceResponseResponse.js +1 -0
- package/dist/dbops-service/src/services/responses/DbSchemaListResponseResponse.d.ts +5 -0
- package/dist/dbops-service/src/services/responses/DbSchemaListResponseResponse.js +1 -0
- package/dist/dbops-service/src/services/responses/DbSchemaResponseResponse.d.ts +2 -0
- package/dist/dbops-service/src/services/responses/DbSchemaResponseResponse.js +1 -0
- package/dist/dbops-service/src/services/responses/ErrorResponseResponse.d.ts +2 -0
- package/dist/dbops-service/src/services/responses/ErrorResponseResponse.js +1 -0
- package/dist/dbops-service/src/services/responses/ParsedLogResponseResponse.d.ts +2 -0
- package/dist/dbops-service/src/services/responses/ParsedLogResponseResponse.js +1 -0
- package/dist/dbops-service/src/services/responses/PluginInputsResponseResponse.d.ts +6 -0
- package/dist/dbops-service/src/services/responses/PluginInputsResponseResponse.js +4 -0
- package/dist/dbops-service/src/services/schemas/Changelog.d.ts +16 -0
- package/dist/dbops-service/src/services/schemas/Changelog.js +4 -0
- package/dist/dbops-service/src/services/schemas/Command.d.ts +4 -0
- package/dist/dbops-service/src/services/schemas/Command.js +4 -0
- package/dist/dbops-service/src/services/schemas/DbInstanceIn.d.ts +34 -0
- package/dist/dbops-service/src/services/schemas/DbInstanceIn.js +4 -0
- package/dist/dbops-service/src/services/schemas/DbInstanceOut.d.ts +41 -0
- package/dist/dbops-service/src/services/schemas/DbInstanceOut.js +4 -0
- package/dist/dbops-service/src/services/schemas/DbSchemaIn.d.ts +27 -0
- package/dist/dbops-service/src/services/schemas/DbSchemaIn.js +1 -0
- package/dist/dbops-service/src/services/schemas/DbSchemaOut.d.ts +35 -0
- package/dist/dbops-service/src/services/schemas/DbSchemaOut.js +1 -0
- package/dist/dbops-service/src/services/schemas/Error.d.ts +9 -0
- package/dist/dbops-service/src/services/schemas/Error.js +4 -0
- package/dist/dbops-service/src/services/schemas/ParsedLogOut.d.ts +4 -0
- package/dist/dbops-service/src/services/schemas/ParsedLogOut.js +4 -0
- package/dist/fetcher/index.d.ts +17 -0
- package/dist/fetcher/index.js +65 -0
- package/package.json +31 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This code is autogenerated using @harnessio/oats-cli.
|
|
3
|
+
// Please do not modify this code directly.
|
|
4
|
+
import { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function v1UpdateProjDbSchema(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/v1/orgs/${props.org}/projects/${props.project}/dbschema/${props.dbschema}`, method: 'PUT' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Update a database schema
|
|
11
|
+
*/
|
|
12
|
+
export function useV1UpdateProjDbSchemaMutation(options) {
|
|
13
|
+
return useMutation((mutateProps) => v1UpdateProjDbSchema(mutateProps), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type { GetPathParamsType, ResponseWithPagination } from './helpers';
|
|
2
|
+
export type { CreateV1StepPluginInputsErrorResponse, CreateV1StepPluginInputsOkResponse, CreateV1StepPluginInputsProps, CreateV1StepPluginInputsRequestBody, } from './hooks/useCreateV1StepPluginInputsMutation';
|
|
3
|
+
export { createV1StepPluginInputs, useCreateV1StepPluginInputsMutation, } from './hooks/useCreateV1StepPluginInputsMutation';
|
|
4
|
+
export type { V1CreateProjDbSchemaInstanceErrorResponse, V1CreateProjDbSchemaInstanceMutationPathParams, V1CreateProjDbSchemaInstanceOkResponse, V1CreateProjDbSchemaInstanceProps, V1CreateProjDbSchemaInstanceRequestBody, } from './hooks/useV1CreateProjDbSchemaInstanceMutation';
|
|
5
|
+
export { useV1CreateProjDbSchemaInstanceMutation, v1CreateProjDbSchemaInstance, } from './hooks/useV1CreateProjDbSchemaInstanceMutation';
|
|
6
|
+
export type { V1CreateProjDbSchemaErrorResponse, V1CreateProjDbSchemaMutationPathParams, V1CreateProjDbSchemaOkResponse, V1CreateProjDbSchemaProps, V1CreateProjDbSchemaRequestBody, } from './hooks/useV1CreateProjDbSchemaMutation';
|
|
7
|
+
export { useV1CreateProjDbSchemaMutation, v1CreateProjDbSchema, } from './hooks/useV1CreateProjDbSchemaMutation';
|
|
8
|
+
export type { V1DeleteProjDbSchemaInstanceErrorResponse, V1DeleteProjDbSchemaInstanceMutationPathParams, V1DeleteProjDbSchemaInstanceOkResponse, V1DeleteProjDbSchemaInstanceProps, } from './hooks/useV1DeleteProjDbSchemaInstanceMutation';
|
|
9
|
+
export { useV1DeleteProjDbSchemaInstanceMutation, v1DeleteProjDbSchemaInstance, } from './hooks/useV1DeleteProjDbSchemaInstanceMutation';
|
|
10
|
+
export type { V1DeleteProjDbSchemaErrorResponse, V1DeleteProjDbSchemaMutationPathParams, V1DeleteProjDbSchemaOkResponse, V1DeleteProjDbSchemaProps, } from './hooks/useV1DeleteProjDbSchemaMutation';
|
|
11
|
+
export { useV1DeleteProjDbSchemaMutation, v1DeleteProjDbSchema, } from './hooks/useV1DeleteProjDbSchemaMutation';
|
|
12
|
+
export type { V1GetDbinstanceLogErrorResponse, V1GetDbinstanceLogOkResponse, V1GetDbinstanceLogProps, V1GetDbinstanceLogQueryPathParams, } from './hooks/useV1GetDbinstanceLogQuery';
|
|
13
|
+
export { useV1GetDbinstanceLogQuery, v1GetDbinstanceLog } from './hooks/useV1GetDbinstanceLogQuery';
|
|
14
|
+
export type { V1GetProjDbSchemaInstanceErrorResponse, V1GetProjDbSchemaInstanceOkResponse, V1GetProjDbSchemaInstanceProps, V1GetProjDbSchemaInstanceQueryPathParams, } from './hooks/useV1GetProjDbSchemaInstanceQuery';
|
|
15
|
+
export { useV1GetProjDbSchemaInstanceQuery, v1GetProjDbSchemaInstance, } from './hooks/useV1GetProjDbSchemaInstanceQuery';
|
|
16
|
+
export type { V1GetProjDbSchemaErrorResponse, V1GetProjDbSchemaOkResponse, V1GetProjDbSchemaProps, V1GetProjDbSchemaQueryPathParams, } from './hooks/useV1GetProjDbSchemaQuery';
|
|
17
|
+
export { useV1GetProjDbSchemaQuery, v1GetProjDbSchema } from './hooks/useV1GetProjDbSchemaQuery';
|
|
18
|
+
export type { V1IngestLogsErrorResponse, V1IngestLogsMutationPathParams, V1IngestLogsOkResponse, V1IngestLogsProps, V1IngestLogsRequestBody, } from './hooks/useV1IngestLogsMutation';
|
|
19
|
+
export { useV1IngestLogsMutation, v1IngestLogs } from './hooks/useV1IngestLogsMutation';
|
|
20
|
+
export type { V1ListProjDbSchemaInstanceErrorResponse, V1ListProjDbSchemaInstanceOkResponse, V1ListProjDbSchemaInstanceProps, V1ListProjDbSchemaInstanceQueryPathParams, V1ListProjDbSchemaInstanceQueryQueryParams, } from './hooks/useV1ListProjDbSchemaInstanceQuery';
|
|
21
|
+
export { useV1ListProjDbSchemaInstanceQuery, v1ListProjDbSchemaInstance, } from './hooks/useV1ListProjDbSchemaInstanceQuery';
|
|
22
|
+
export type { V1ListProjDbSchemaErrorResponse, V1ListProjDbSchemaOkResponse, V1ListProjDbSchemaProps, V1ListProjDbSchemaQueryPathParams, V1ListProjDbSchemaQueryQueryParams, } from './hooks/useV1ListProjDbSchemaQuery';
|
|
23
|
+
export { useV1ListProjDbSchemaQuery, v1ListProjDbSchema } from './hooks/useV1ListProjDbSchemaQuery';
|
|
24
|
+
export type { V1UpdateProjDbSchemaInstanceErrorResponse, V1UpdateProjDbSchemaInstanceMutationPathParams, V1UpdateProjDbSchemaInstanceOkResponse, V1UpdateProjDbSchemaInstanceProps, V1UpdateProjDbSchemaInstanceRequestBody, } from './hooks/useV1UpdateProjDbSchemaInstanceMutation';
|
|
25
|
+
export { useV1UpdateProjDbSchemaInstanceMutation, v1UpdateProjDbSchemaInstance, } from './hooks/useV1UpdateProjDbSchemaInstanceMutation';
|
|
26
|
+
export type { V1UpdateProjDbSchemaErrorResponse, V1UpdateProjDbSchemaMutationPathParams, V1UpdateProjDbSchemaOkResponse, V1UpdateProjDbSchemaProps, V1UpdateProjDbSchemaRequestBody, } from './hooks/useV1UpdateProjDbSchemaMutation';
|
|
27
|
+
export { useV1UpdateProjDbSchemaMutation, v1UpdateProjDbSchema, } from './hooks/useV1UpdateProjDbSchemaMutation';
|
|
28
|
+
export type { DbInstanceCreateRequestRequestBody } from './requestBodies/DbInstanceCreateRequestRequestBody';
|
|
29
|
+
export type { DbInstanceUpdateRequestRequestBody } from './requestBodies/DbInstanceUpdateRequestRequestBody';
|
|
30
|
+
export type { DbSchemaCreateRequestRequestBody } from './requestBodies/DbSchemaCreateRequestRequestBody';
|
|
31
|
+
export type { DbSchemaUpdateRequestRequestBody } from './requestBodies/DbSchemaUpdateRequestRequestBody';
|
|
32
|
+
export type { LogIngestRequestRequestBody } from './requestBodies/LogIngestRequestRequestBody';
|
|
33
|
+
export type { PluginStepInputsRequestRequestBody } from './requestBodies/PluginStepInputsRequestRequestBody';
|
|
34
|
+
export type { DbInstanceListResponseResponse } from './responses/DbInstanceListResponseResponse';
|
|
35
|
+
export type { DbInstanceResponseResponse } from './responses/DbInstanceResponseResponse';
|
|
36
|
+
export type { DbSchemaListResponseResponse } from './responses/DbSchemaListResponseResponse';
|
|
37
|
+
export type { DbSchemaResponseResponse } from './responses/DbSchemaResponseResponse';
|
|
38
|
+
export type { ErrorResponseResponse } from './responses/ErrorResponseResponse';
|
|
39
|
+
export type { ParsedLogResponseResponse } from './responses/ParsedLogResponseResponse';
|
|
40
|
+
export type { PluginInputsResponseResponse } from './responses/PluginInputsResponseResponse';
|
|
41
|
+
export type { Changelog } from './schemas/Changelog';
|
|
42
|
+
export type { Command } from './schemas/Command';
|
|
43
|
+
export type { DbInstanceIn } from './schemas/DbInstanceIn';
|
|
44
|
+
export type { DbInstanceOut } from './schemas/DbInstanceOut';
|
|
45
|
+
export type { DbSchemaIn } from './schemas/DbSchemaIn';
|
|
46
|
+
export type { DbSchemaOut } from './schemas/DbSchemaOut';
|
|
47
|
+
export type { Error } from './schemas/Error';
|
|
48
|
+
export type { ParsedLogOut } from './schemas/ParsedLogOut';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createV1StepPluginInputs, useCreateV1StepPluginInputsMutation, } from './hooks/useCreateV1StepPluginInputsMutation';
|
|
2
|
+
export { useV1CreateProjDbSchemaInstanceMutation, v1CreateProjDbSchemaInstance, } from './hooks/useV1CreateProjDbSchemaInstanceMutation';
|
|
3
|
+
export { useV1CreateProjDbSchemaMutation, v1CreateProjDbSchema, } from './hooks/useV1CreateProjDbSchemaMutation';
|
|
4
|
+
export { useV1DeleteProjDbSchemaInstanceMutation, v1DeleteProjDbSchemaInstance, } from './hooks/useV1DeleteProjDbSchemaInstanceMutation';
|
|
5
|
+
export { useV1DeleteProjDbSchemaMutation, v1DeleteProjDbSchema, } from './hooks/useV1DeleteProjDbSchemaMutation';
|
|
6
|
+
export { useV1GetDbinstanceLogQuery, v1GetDbinstanceLog } from './hooks/useV1GetDbinstanceLogQuery';
|
|
7
|
+
export { useV1GetProjDbSchemaInstanceQuery, v1GetProjDbSchemaInstance, } from './hooks/useV1GetProjDbSchemaInstanceQuery';
|
|
8
|
+
export { useV1GetProjDbSchemaQuery, v1GetProjDbSchema } from './hooks/useV1GetProjDbSchemaQuery';
|
|
9
|
+
export { useV1IngestLogsMutation, v1IngestLogs } from './hooks/useV1IngestLogsMutation';
|
|
10
|
+
export { useV1ListProjDbSchemaInstanceQuery, v1ListProjDbSchemaInstance, } from './hooks/useV1ListProjDbSchemaInstanceQuery';
|
|
11
|
+
export { useV1ListProjDbSchemaQuery, v1ListProjDbSchema } from './hooks/useV1ListProjDbSchemaQuery';
|
|
12
|
+
export { useV1UpdateProjDbSchemaInstanceMutation, v1UpdateProjDbSchemaInstance, } from './hooks/useV1UpdateProjDbSchemaInstanceMutation';
|
|
13
|
+
export { useV1UpdateProjDbSchemaMutation, v1UpdateProjDbSchema, } from './hooks/useV1UpdateProjDbSchemaMutation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface DbInstanceUpdateRequestRequestBody {
|
|
2
|
+
/**
|
|
3
|
+
* branch where the instance is stored
|
|
4
|
+
*/
|
|
5
|
+
branch?: string;
|
|
6
|
+
/**
|
|
7
|
+
* DB Connector
|
|
8
|
+
*/
|
|
9
|
+
connector?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Liquibase context
|
|
12
|
+
*/
|
|
13
|
+
context?: string;
|
|
14
|
+
/**
|
|
15
|
+
* name of the database instance
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Database instance tags
|
|
21
|
+
*/
|
|
22
|
+
tags?: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface DbSchemaUpdateRequestRequestBody {
|
|
2
|
+
/**
|
|
3
|
+
* location of the changelog file containing schema changes in a git repository
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
changelog?: {
|
|
7
|
+
/**
|
|
8
|
+
* identifier of the harness git connector
|
|
9
|
+
* @example "harness_git"
|
|
10
|
+
*/
|
|
11
|
+
connector?: string;
|
|
12
|
+
/**
|
|
13
|
+
* path to the change log file
|
|
14
|
+
* @example "folder/changelog.yaml"
|
|
15
|
+
*/
|
|
16
|
+
location?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* name of the database schema
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
name?: string;
|
|
23
|
+
/**
|
|
24
|
+
* harness service corresponding to database schema
|
|
25
|
+
*
|
|
26
|
+
* @example "harness_service"
|
|
27
|
+
*/
|
|
28
|
+
service?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Database Schema tags
|
|
31
|
+
*/
|
|
32
|
+
tags?: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type LogIngestRequestRequestBody = unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Command } from '../schemas/Command';
|
|
2
|
+
export interface PluginStepInputsRequestRequestBody {
|
|
3
|
+
command: Command;
|
|
4
|
+
/**
|
|
5
|
+
* db instance identifier
|
|
6
|
+
* @example "myschema/prod-1-instance"
|
|
7
|
+
*/
|
|
8
|
+
dbInstance: string;
|
|
9
|
+
metadata?: {
|
|
10
|
+
plan_execution?: string;
|
|
11
|
+
step_identifier?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Tags to associate with the schema changes
|
|
15
|
+
*/
|
|
16
|
+
tags?: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* location of the changelog file containing schema changes in a git repository
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export interface Changelog {
|
|
6
|
+
/**
|
|
7
|
+
* identifier of the harness git connector
|
|
8
|
+
* @example "harness_git"
|
|
9
|
+
*/
|
|
10
|
+
connector: string;
|
|
11
|
+
/**
|
|
12
|
+
* path to the change log file
|
|
13
|
+
* @example "folder/changelog.yaml"
|
|
14
|
+
*/
|
|
15
|
+
location: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Instance Request
|
|
3
|
+
*/
|
|
4
|
+
export interface DbInstanceIn {
|
|
5
|
+
/**
|
|
6
|
+
* branch where the instance is stored
|
|
7
|
+
*
|
|
8
|
+
* @example "main"
|
|
9
|
+
*/
|
|
10
|
+
branch: string;
|
|
11
|
+
/**
|
|
12
|
+
* DB Connector
|
|
13
|
+
* @example "postgres-connector"
|
|
14
|
+
*/
|
|
15
|
+
connector: string;
|
|
16
|
+
/**
|
|
17
|
+
* Liquibase context
|
|
18
|
+
*/
|
|
19
|
+
context?: string;
|
|
20
|
+
/**
|
|
21
|
+
* identifier of the database instance
|
|
22
|
+
*/
|
|
23
|
+
identifier: string;
|
|
24
|
+
/**
|
|
25
|
+
* name of the database instance
|
|
26
|
+
*/
|
|
27
|
+
name?: string;
|
|
28
|
+
/**
|
|
29
|
+
* tags attached to the database instance
|
|
30
|
+
*/
|
|
31
|
+
tags?: {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Instance Response
|
|
3
|
+
*/
|
|
4
|
+
export interface DbInstanceOut {
|
|
5
|
+
/**
|
|
6
|
+
* branch where the instance is stored
|
|
7
|
+
*/
|
|
8
|
+
branch: string;
|
|
9
|
+
/**
|
|
10
|
+
* DB Connector
|
|
11
|
+
*/
|
|
12
|
+
connector: string;
|
|
13
|
+
/**
|
|
14
|
+
* Liquibase context
|
|
15
|
+
*/
|
|
16
|
+
context?: string;
|
|
17
|
+
/**
|
|
18
|
+
* epoch seconds when the database instance was created
|
|
19
|
+
* @format int64
|
|
20
|
+
*/
|
|
21
|
+
created: number;
|
|
22
|
+
/**
|
|
23
|
+
* identifier of the database instance
|
|
24
|
+
*/
|
|
25
|
+
identifier: string;
|
|
26
|
+
/**
|
|
27
|
+
* name of the database instance
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* tags attached to the database instance
|
|
32
|
+
*/
|
|
33
|
+
tags?: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* epoch seconds when the database instance was last updated
|
|
38
|
+
* @format int64
|
|
39
|
+
*/
|
|
40
|
+
updated?: number;
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Changelog } from '../schemas/Changelog';
|
|
2
|
+
/**
|
|
3
|
+
* Database Schema Request
|
|
4
|
+
*/
|
|
5
|
+
export interface DbSchemaIn {
|
|
6
|
+
changelog: Changelog;
|
|
7
|
+
/**
|
|
8
|
+
* identifier of the database schema
|
|
9
|
+
*/
|
|
10
|
+
identifier: string;
|
|
11
|
+
/**
|
|
12
|
+
* name of the database schema
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* harness service corresponding to database schema
|
|
17
|
+
*
|
|
18
|
+
* @example "harness_service"
|
|
19
|
+
*/
|
|
20
|
+
service?: string;
|
|
21
|
+
/**
|
|
22
|
+
* tags attached to the database schema
|
|
23
|
+
*/
|
|
24
|
+
tags?: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Changelog } from '../schemas/Changelog';
|
|
2
|
+
/**
|
|
3
|
+
* Database Schema Response
|
|
4
|
+
*/
|
|
5
|
+
export interface DbSchemaOut {
|
|
6
|
+
changelog: Changelog;
|
|
7
|
+
/**
|
|
8
|
+
* epoch seconds when the database schema was created
|
|
9
|
+
* @format int64
|
|
10
|
+
*/
|
|
11
|
+
created: number;
|
|
12
|
+
/**
|
|
13
|
+
* identifier of the database schema
|
|
14
|
+
*/
|
|
15
|
+
identifier: string;
|
|
16
|
+
/**
|
|
17
|
+
* name of the database schema
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* harness service corresponding to database schema
|
|
22
|
+
*/
|
|
23
|
+
service?: string;
|
|
24
|
+
/**
|
|
25
|
+
* tags attached to the database schema
|
|
26
|
+
*/
|
|
27
|
+
tags?: {
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* epoch seconds when the database schema was last updated
|
|
32
|
+
* @format int64
|
|
33
|
+
*/
|
|
34
|
+
updated?: number;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IStringifyOptions } from 'qs';
|
|
2
|
+
export interface FetcherOptions<TQueryParams = never, TBody = never, THeaderParams = HeadersInit> extends Omit<RequestInit, 'body' | 'headers'> {
|
|
3
|
+
url: string;
|
|
4
|
+
queryParams?: TQueryParams extends never ? undefined : TQueryParams;
|
|
5
|
+
body?: TBody extends never ? undefined : TBody;
|
|
6
|
+
stringifyQueryParamsOptions?: IStringifyOptions;
|
|
7
|
+
headers?: THeaderParams;
|
|
8
|
+
}
|
|
9
|
+
export interface ClientCallbacks {
|
|
10
|
+
responseInterceptor?: (response: Response) => Response;
|
|
11
|
+
requestInterceptor?: (request: Request) => Request;
|
|
12
|
+
urlInterceptor?: (url: string) => string;
|
|
13
|
+
getRequestHeaders?: () => Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
export declare function setupClient(callbacks: ClientCallbacks): void;
|
|
16
|
+
export declare const updateClientHeaders: (headers: Record<string, any>) => void;
|
|
17
|
+
export declare function fetcher<TResponse = unknown, TQueryParams = never, TBody = never, THeaderParams = HeadersInit>(options: FetcherOptions<TQueryParams, TBody, THeaderParams>): Promise<TResponse>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __awaiter, __rest } from "tslib";
|
|
2
|
+
import { stringify } from 'qs';
|
|
3
|
+
const JSON_CONTENT_TYPES = ['application/json'];
|
|
4
|
+
let APIClientInitialized = false;
|
|
5
|
+
let fetcherCallbacks;
|
|
6
|
+
let customHeaders = {
|
|
7
|
+
'Content-Type': JSON_CONTENT_TYPES[0],
|
|
8
|
+
};
|
|
9
|
+
export function setupClient(callbacks) {
|
|
10
|
+
fetcherCallbacks = callbacks;
|
|
11
|
+
customHeaders = Object.assign(Object.assign({}, customHeaders), ((fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.getRequestHeaders) ? fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.getRequestHeaders() : {}));
|
|
12
|
+
APIClientInitialized = true;
|
|
13
|
+
}
|
|
14
|
+
export const updateClientHeaders = (headers) => {
|
|
15
|
+
customHeaders = Object.assign(Object.assign({}, customHeaders), headers);
|
|
16
|
+
};
|
|
17
|
+
export function fetcher(options) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
// If not initialized throw error even without making request
|
|
21
|
+
if (!APIClientInitialized) {
|
|
22
|
+
throw { reason: 'HarnessReactAPIClient has not been initialized' };
|
|
23
|
+
}
|
|
24
|
+
const { stringifyQueryParamsOptions, headers, body, url, queryParams = { account: customHeaders['Harness-Account'] } } = options, rest = __rest(options, ["stringifyQueryParamsOptions", "headers", "body", "url", "queryParams"]);
|
|
25
|
+
const token = customHeaders.token;
|
|
26
|
+
let finalUrl = url;
|
|
27
|
+
if (queryParams) {
|
|
28
|
+
finalUrl += stringify(queryParams, Object.assign(Object.assign({}, stringifyQueryParamsOptions), { addQueryPrefix: true }));
|
|
29
|
+
}
|
|
30
|
+
if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) {
|
|
31
|
+
finalUrl = (_a = fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) === null || _a === void 0 ? void 0 : _a.call(fetcherCallbacks, finalUrl);
|
|
32
|
+
}
|
|
33
|
+
let request = new Request(finalUrl, Object.assign({ headers: Object.assign(Object.assign({ Authorization: `Bearer ${token}` }, headers), customHeaders), body: body ? JSON.stringify(body) : undefined }, rest));
|
|
34
|
+
if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.requestInterceptor) {
|
|
35
|
+
request = fetcherCallbacks.requestInterceptor(request.clone());
|
|
36
|
+
}
|
|
37
|
+
let response = yield fetch(request);
|
|
38
|
+
if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) {
|
|
39
|
+
response = (_b = fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) === null || _b === void 0 ? void 0 : _b.call(fetcherCallbacks, response.clone());
|
|
40
|
+
}
|
|
41
|
+
const contentType = response.headers.get('Content-Type');
|
|
42
|
+
let total, pageSize, pageNumber, pageCount, pagination;
|
|
43
|
+
try {
|
|
44
|
+
total = response.headers.get('x-total-elements');
|
|
45
|
+
pageSize = response.headers.get('x-page-size');
|
|
46
|
+
pageNumber = response.headers.get('x-page-number');
|
|
47
|
+
pagination = total || pageSize || pageNumber;
|
|
48
|
+
if (pagination) {
|
|
49
|
+
total = Number(total);
|
|
50
|
+
pageSize = Number(pageSize);
|
|
51
|
+
pageCount = Math.ceil(total / pageSize);
|
|
52
|
+
pageNumber = Number(pageNumber);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw new Error('HarnessReactAPIClient: An error occurred while parsing pagination headers. ' + e);
|
|
57
|
+
}
|
|
58
|
+
const asJson = contentType && JSON_CONTENT_TYPES.some((h) => contentType.startsWith(h));
|
|
59
|
+
const data = yield (asJson ? response.json() : response.text());
|
|
60
|
+
if (response.ok) {
|
|
61
|
+
return Object.assign({ content: data }, (pagination ? { pagination: { total, pageCount, pageSize, pageNumber } } : {}));
|
|
62
|
+
}
|
|
63
|
+
throw data;
|
|
64
|
+
});
|
|
65
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@harnessio/react-dbops-service-client",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Harness React DB Devops service client - DB Devops APIs integrated with react hooks",
|
|
5
|
+
"author": "Harness Inc",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"source": "src/index.ts",
|
|
8
|
+
"main": "./dist/dbops-service/src/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/dbops-service/src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"types": "./dist/dbops-service/src/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/*"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/harness/react-api-client",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/harness/react-api-client.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/harness/react-api-client/issues"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"prebuild": "rimraf dist",
|
|
27
|
+
"build": "yarn generate && tsc",
|
|
28
|
+
"generate": "oats import --config='./oats.config.ts'",
|
|
29
|
+
"fmt": "prettier --write ./index.ts"
|
|
30
|
+
}
|
|
31
|
+
}
|