diff --git a/.husky/pre-commit b/.husky/pre-commit index ed3f04a6..28eeed98 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -pnpm lint && pnpm format && pnpm test:api && pnpm test:api-client +pnpm lint && pnpm format diff --git a/apps/cli/.eslintrc.js b/apps/cli/.eslintrc.cjs similarity index 95% rename from apps/cli/.eslintrc.js rename to apps/cli/.eslintrc.cjs index 8e243274..0ac907bd 100644 --- a/apps/cli/.eslintrc.js +++ b/apps/cli/.eslintrc.cjs @@ -26,6 +26,6 @@ module.exports = { '@typescript-eslint/space-before-function-paren': 'off', '@typescript-eslint/strict-boolean-expressions': 'off', '@typescript-eslint/prefer-nullish-coalescing': 'off', - 'space-before-function-paren': 'off', + 'space-before-function-paren': 'off' } } diff --git a/apps/cli/package.json b/apps/cli/package.json index 1d72c493..631954c4 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -4,10 +4,12 @@ "description": "CLI for keyshade", "main": "index.ts", "private": false, + "type": "module", "scripts": { "build": "tsc && tsc-alias", "start": "node dist/src/index.js", - "dev": "pnpm build && node dist/index.js" + "dev": "pnpm build && node dist/index.js", + "lint": "eslint \"src/**/*.ts\" --fix" }, "keywords": [], "author": "", diff --git a/apps/cli/src/commands/base.command.ts b/apps/cli/src/commands/base.command.ts index cb20c0de..9863e4fb 100644 --- a/apps/cli/src/commands/base.command.ts +++ b/apps/cli/src/commands/base.command.ts @@ -7,6 +7,7 @@ import { fetchProfileConfig } from '@/util/configuration' import { Logger } from '@/util/logger' import { getDefaultProfile } from '@/util/profile' import type { Command } from 'commander' +import ControllerInstance from '@/util/controller-instance' /** * The base class for all commands. All commands should extend this class. @@ -17,6 +18,17 @@ export default abstract class BaseCommand { protected apiKey: string | null = null protected baseUrl: string | null = null + // Headers to be used by the API requests + protected headers: Record | null = null + + /** + * Technically the entrypoint to the entire application. This function + * is used to register the various commands across the entire CLI. The + * function is only called from index.ts to register the commands and + * should not be overridden. + * + * @param program The program to add the command to. + */ readonly prepare = (program: Command): void => { const argsCount = this.getArguments().length @@ -82,7 +94,7 @@ export default abstract class BaseCommand { } getVersion(): string { - return null + return '1' } /** @@ -102,11 +114,9 @@ export default abstract class BaseCommand { /** * The action that the command should take. * @param data The data passed to the command. - * @param data.options The options passed to the command. - * @param data.args The arguments passed to the command. */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - action({ options, args }: CommandActionData): Promise | void {} + // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-pattern + action({}: CommandActionData): Promise | void {} /** * If the command has subcommands, return them here. @@ -154,5 +164,13 @@ export default abstract class BaseCommand { this.baseUrl = defaultProfile.baseUrl } } + + // Initialize the header + this.headers = { + 'x-keyshade-token': this.apiKey + } + + // Initialize Controller Instance + ControllerInstance.initialize(this.baseUrl) } } diff --git a/apps/cli/src/commands/workspace.command.ts b/apps/cli/src/commands/workspace.command.ts new file mode 100644 index 00000000..bbf0891a --- /dev/null +++ b/apps/cli/src/commands/workspace.command.ts @@ -0,0 +1,30 @@ +import BaseCommand from '@/commands/base.command' +import CreateWorkspace from '@/commands/workspace/create.workspace' +import DeleteWorkspace from '@/commands/workspace/delete.workspace' +import ExportWorkspace from '@/commands/workspace/export.workspace' +import GetWorkspace from '@/commands/workspace/get.workspace' +import ListWorkspace from '@/commands/workspace/list.workspace' +import SearchWorkspace from '@/commands/workspace/search.workspace' +import UpdateWorkspace from '@/commands/workspace/update.workspace' + +export default class WorkspaceCommand extends BaseCommand { + getName(): string { + return 'workspace' + } + + getDescription(): string { + return 'Manages the workspaces on keyshade' + } + + getSubCommands(): BaseCommand[] { + return [ + new CreateWorkspace(), + new DeleteWorkspace(), + new ExportWorkspace(), + new GetWorkspace(), + new ListWorkspace(), + new SearchWorkspace(), + new UpdateWorkspace() + ] + } +} diff --git a/apps/cli/src/commands/workspace/create.workspace.ts b/apps/cli/src/commands/workspace/create.workspace.ts new file mode 100644 index 00000000..00c48cd2 --- /dev/null +++ b/apps/cli/src/commands/workspace/create.workspace.ts @@ -0,0 +1,71 @@ +import BaseCommand from '@/commands/base.command' +import { + type CommandActionData, + type CommandOption +} from '@/types/command/command.types' +import ControllerInstance from '@/util/controller-instance' +import { Logger } from '@/util/logger' +import { text } from '@clack/prompts' + +export default class CreateWorkspace extends BaseCommand { + getName(): string { + return 'create' + } + + getDescription(): string { + return 'Creates a new workspace' + } + + getOptions(): CommandOption[] { + return [ + { + short: '-n', + long: '--name ', + description: 'Name of the workspace.' + }, + { + short: '-i', + long: '--icon ', + description: 'Icon of the workspace.' + } + ] + } + + async action({ options }: CommandActionData): Promise { + const { name, icon } = await this.parseInput(options) + + const { data, error, success } = + await ControllerInstance.getInstance().workspaceController.createWorkspace( + { + name, + icon + }, + this.headers + ) + + if (success) { + Logger.info(`Workspace ${data.name} (${data.slug}) created successfully!`) + Logger.info(`Created at ${data.createdAt}`) + Logger.info(`Updated at ${data.updatedAt}`) + } else { + Logger.error(`Failed to create workspace: ${error.message}`) + } + } + + private async parseInput(options: CommandActionData['options']): Promise<{ + name: string + icon?: string + }> { + let { name } = options + const { icon } = options + + if (!name) { + name = await text({ + message: 'Enter the name of the Workspace', + placeholder: 'My Workspace' + }) + } + + return { name, icon } + } +} diff --git a/apps/cli/src/commands/workspace/delete.workspace.ts b/apps/cli/src/commands/workspace/delete.workspace.ts new file mode 100644 index 00000000..4a44044a --- /dev/null +++ b/apps/cli/src/commands/workspace/delete.workspace.ts @@ -0,0 +1,44 @@ +import BaseCommand from '@/commands/base.command' +import { + type CommandActionData, + type CommandArgument +} from '@/types/command/command.types' +import ControllerInstance from '@/util/controller-instance' +import { Logger } from '@/util/logger' + +export default class DeleteWorkspace extends BaseCommand { + getName(): string { + return 'delete' + } + + getDescription(): string { + return 'Deletes an existing workspace' + } + + getArguments(): CommandArgument[] { + return [ + { + name: '', + description: 'Slug of the workspace which you want to delete.' + } + ] + } + + async action({ args }: CommandActionData): Promise { + const [workspaceSlug] = args + + const { error, success } = + await ControllerInstance.getInstance().workspaceController.deleteWorkspace( + { + workspaceSlug + }, + this.headers + ) + + if (success) { + Logger.info(`Workspace ${workspaceSlug} deleted successfully!`) + } else { + Logger.error(`Failed to delete workspace: ${error.message}`) + } + } +} diff --git a/apps/cli/src/commands/workspace/export.workspace.ts b/apps/cli/src/commands/workspace/export.workspace.ts new file mode 100644 index 00000000..ae4763db --- /dev/null +++ b/apps/cli/src/commands/workspace/export.workspace.ts @@ -0,0 +1,68 @@ +import BaseCommand from '@/commands/base.command' +import { + type CommandActionData, + type CommandArgument, + type CommandOption +} from '@/types/command/command.types' +import { Logger } from '@/util/logger' +import ControllerInstance from '@/util/controller-instance' +import { writeFileSync } from 'fs' + +export default class ExportWorkspace extends BaseCommand { + getName(): string { + return 'export' + } + + getDescription(): string { + return 'Exports all projects, environments, secrets, variables and roles of a workspace' + } + + getArguments(): CommandArgument[] { + return [ + { + name: '', + description: 'Slug of the workspace which you want to export.' + } + ] + } + + getOptions(): CommandOption[] { + return [ + { + short: '-s', + long: '--save-to-file ', + description: 'Saves the exported data to a file.' + } + ] + } + + async action({ args, options }: CommandActionData): Promise { + const [workspaceSlug] = args + const { saveToFile } = options as { saveToFile: string } + + Logger.info('Exporting workspace...') + + const { data, error, success } = + await ControllerInstance.getInstance().workspaceController.exportWorkspaceData( + { + workspaceSlug + }, + this.headers + ) + + if (success) { + if (saveToFile) { + const filePath = saveToFile + const fileContent = JSON.stringify(data, null, 2) + + writeFileSync(saveToFile, fileContent) + + Logger.info(`Workspace exported to file: ${filePath}`) + } else { + Logger.info(JSON.stringify(data)) + } + } else { + Logger.error(`Failed exporting workspace: ${error.message}`) + } + } +} diff --git a/apps/cli/src/commands/workspace/get.workspace.ts b/apps/cli/src/commands/workspace/get.workspace.ts new file mode 100644 index 00000000..d13aa639 --- /dev/null +++ b/apps/cli/src/commands/workspace/get.workspace.ts @@ -0,0 +1,50 @@ +import BaseCommand from '@/commands/base.command' +import { + type CommandActionData, + type CommandArgument +} from '@/types/command/command.types' +import { Logger } from '@/util/logger' +import ControllerInstance from '@/util/controller-instance' + +export default class GetWorkspace extends BaseCommand { + getName(): string { + return 'get' + } + + getDescription(): string { + return 'Fetches a particular workspace' + } + + getArguments(): CommandArgument[] { + return [ + { + name: '', + description: 'Slug of the workspace which you want to fetch.' + } + ] + } + + async action({ args }: CommandActionData): Promise { + const [workspaceSlug] = args + + Logger.info('Fetching workspace...') + + const { data, error, success } = + await ControllerInstance.getInstance().workspaceController.getWorkspace( + { + workspaceSlug + }, + this.headers + ) + + if (success) { + Logger.info('Workspace fetched successfully:') + Logger.info(`Workspace: ${data.name} (${data.slug})`) + Logger.info(`Created at: ${data.createdAt}`) + Logger.info(`Updated at: ${data.updatedAt}`) + Logger.info(`Is default workspace: ${data.isDefault}`) + } else { + Logger.error(`Failed fetching workspace: ${error.message}`) + } + } +} diff --git a/apps/cli/src/commands/workspace/list.workspace.ts b/apps/cli/src/commands/workspace/list.workspace.ts new file mode 100644 index 00000000..401138f3 --- /dev/null +++ b/apps/cli/src/commands/workspace/list.workspace.ts @@ -0,0 +1,31 @@ +import BaseCommand from '@/commands/base.command' +import { Logger } from '@/util/logger' +import ControllerInstance from '@/util/controller-instance' + +export default class ListWorkspace extends BaseCommand { + getName(): string { + return 'list' + } + + getDescription(): string { + return 'Fetches all the workspace you have access to' + } + + async action(): Promise { + Logger.info('Fetching all workspaces...') + + const { success, data, error } = + await ControllerInstance.getInstance().workspaceController.getWorkspacesOfUser( + {}, + this.headers + ) + + if (success) { + data.items.forEach((workspace: any) => { + Logger.info(`- ${workspace.name} (${workspace.slug})`) + }) + } else { + Logger.error(`Failed fetching workspaces: ${error.message}`) + } + } +} diff --git a/apps/cli/src/commands/workspace/search.workspace.ts b/apps/cli/src/commands/workspace/search.workspace.ts new file mode 100644 index 00000000..4f544009 --- /dev/null +++ b/apps/cli/src/commands/workspace/search.workspace.ts @@ -0,0 +1,79 @@ +import BaseCommand from '@/commands/base.command' +import { + type CommandActionData, + type CommandArgument +} from '@/types/command/command.types' +import ControllerInstance from '@/util/controller-instance' +import { Logger } from '@/util/logger' + +export default class SearchWorkspace extends BaseCommand { + getName(): string { + return 'search' + } + + getDescription(): string { + return 'Performs a full-text search for projects, secrets, variables and environments in a workspace' + } + + getArguments(): CommandArgument[] { + return [ + { + name: '', + description: 'Slug of the workspace which you want to search.' + }, + { + name: '', + description: 'Search term that you want to search for.' + } + ] + } + + async action({ args }: CommandActionData): Promise { + const [workspaceSlug, searchTerm] = args + + const { data, success, error } = + await ControllerInstance.getInstance().workspaceController.globalSearch( + { + workspaceSlug, + search: searchTerm + }, + this.headers + ) + + if (success) { + Logger.info('Search results:') + + Logger.info('') + + Logger.info(`Projects (${data.projects.length})`) + data.projects.forEach((project) => { + Logger.info(`- ${project.name} (${project.id})`) + }) + + Logger.info('') + + Logger.info(`Environments (${data.environments.length})`) + data.environments.forEach((environment) => { + Logger.info(`- ${environment.name} (${environment.id})`) + }) + + Logger.info('') + + Logger.info(`Variables (${data.variables.length})`) + data.variables.forEach((variable) => { + Logger.info(`- ${variable.name} (${variable.id})`) + }) + + Logger.info('') + + Logger.info(`Secrets (${data.secrets.length})`) + data.secrets.forEach((secret) => { + Logger.info(`- ${secret.name} (${secret.id})`) + }) + + Logger.info('') + } else { + Logger.error(`Failed searching in workspace: ${error.message}`) + } + } +} diff --git a/apps/cli/src/commands/workspace/update.workspace.ts b/apps/cli/src/commands/workspace/update.workspace.ts new file mode 100644 index 00000000..cb707e1a --- /dev/null +++ b/apps/cli/src/commands/workspace/update.workspace.ts @@ -0,0 +1,73 @@ +import BaseCommand from '@/commands/base.command' +import { + type CommandActionData, + type CommandArgument, + type CommandOption +} from '@/types/command/command.types' +import ControllerInstance from '@/util/controller-instance' +import { Logger } from '@/util/logger' + +export default class UpdateWorkspace extends BaseCommand { + getName(): string { + return 'update' + } + + getDescription(): string { + return 'Updates a workspace' + } + + getArguments(): CommandArgument[] { + return [ + { + name: '', + description: 'Slug of the workspace which you want to update.' + } + ] + } + + getOptions(): CommandOption[] { + return [ + { + short: '-n', + long: '--name ', + description: 'Name of the workspace.' + }, + { + short: '-i', + long: '--icon ', + description: 'Icon of the workspace.' + } + ] + } + + async action({ args, options }: CommandActionData): Promise { + const [workspaceSlug] = args + const { name, icon } = options + + if (name || icon) { + Logger.info('Updating workspace...') + + const { data, error, success } = + await ControllerInstance.getInstance().workspaceController.updateWorkspace( + { + workspaceSlug, + name, + icon + }, + this.headers + ) + + if (success) { + Logger.info('Workspace updated successfully:') + Logger.info(`Workspace: ${data.name} (${data.slug})`) + Logger.info(`Created at: ${data.createdAt}`) + Logger.info(`Updated at: ${data.updatedAt}`) + Logger.info(`Is default workspace: ${data.isDefault}`) + } else { + Logger.error(`Failed updating workspace: ${error.message}`) + } + } else { + Logger.info('No data provided. Skipping update.') + } + } +} diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.ts index 572aa04b..e0ac23d5 100644 --- a/apps/cli/src/index.ts +++ b/apps/cli/src/index.ts @@ -4,6 +4,7 @@ import InitCommand from './commands/init.command' import RunCommand from './commands/run.command' import ProfileCommand from './commands/profile.command' import EnvironmentCommand from './commands/environment.command' +import WorkspaceCommand from '@/commands/workspace.command' import ScanCommand from '@/commands/scan.command' const program = new Command() @@ -16,6 +17,7 @@ const COMMANDS: BaseCommand[] = [ new RunCommand(), new InitCommand(), new ProfileCommand(), + new WorkspaceCommand(), new EnvironmentCommand(), new ScanCommand() ] diff --git a/apps/cli/src/types/command/command.types.d.ts b/apps/cli/src/types/command/command.types.d.ts index 6cc58969..c42ff378 100644 --- a/apps/cli/src/types/command/command.types.d.ts +++ b/apps/cli/src/types/command/command.types.d.ts @@ -11,6 +11,6 @@ export interface CommandArgument { } export interface CommandActionData { - options: Record - args: string[] + options: Record // Any parameters that might be passed to the command + args: string[] // The arguments passed to the command } diff --git a/apps/cli/src/util/configuration.ts b/apps/cli/src/util/configuration.ts index 241667ee..506e1130 100644 --- a/apps/cli/src/util/configuration.ts +++ b/apps/cli/src/util/configuration.ts @@ -4,7 +4,7 @@ import type { ProjectRootConfig } from '@/types/index.types' import { existsSync } from 'fs' -import { readFile, readdir, writeFile, mkdir } from 'fs/promises' +import { readFile, writeFile, mkdir } from 'fs/promises' export const getOsType = (): 'unix' | 'windows' => { return process.platform === 'win32' ? 'windows' : 'unix' @@ -77,14 +77,6 @@ export const writeProjectRootConfig = async ( await writeFile('./keyshade.json', JSON.stringify(config, null, 2), 'utf8') } -export const fetchUserRootConfigurationFiles = async (): Promise => { - const osType = getOsType() - const home = osType === 'windows' ? 'USERPROFILE' : 'HOME' - const path = `${process.env[home]}/.keyshade` - const files = await readdir(path) - return `- ${files.join('\n- ')}` -} - const ensureDirectoryExists = async (path: string) => { // Create the parent directory if it doesn't exist const parentDirectory = path.split('/').slice(0, -1).join('/') diff --git a/apps/cli/src/util/controller-instance.ts b/apps/cli/src/util/controller-instance.ts new file mode 100644 index 00000000..bc6b2e59 --- /dev/null +++ b/apps/cli/src/util/controller-instance.ts @@ -0,0 +1,110 @@ +import { + EnvironmentController, + EventController, + IntegrationController, + ProjectController, + SecretController, + VariableController, + WorkspaceController, + WorkspaceRoleController +} from '@keyshade/api-client' + +export default class ControllerInstance { + private static instance: ControllerInstance | null + + private _environmentController: EnvironmentController | null = null + + get environmentController(): EnvironmentController { + if (!this._environmentController) { + throw new Error('ControllerInstance not initialized') + } + return this._environmentController + } + + private _eventController: EventController | null = null + + get eventController(): EventController { + if (!this._eventController) { + throw new Error('ControllerInstance not initialized') + } + return this._eventController + } + + private _integrationController: IntegrationController | null = null + + get integrationController(): IntegrationController { + if (!this._integrationController) { + throw new Error('ControllerInstance not initialized') + } + return this._integrationController + } + + private _projectController: ProjectController | null = null + + get projectController(): ProjectController { + if (!this._projectController) { + throw new Error('ControllerInstance not initialized') + } + return this._projectController + } + + private _secretController: SecretController | null = null + + get secretController(): SecretController { + if (!this._secretController) { + throw new Error('ControllerInstance not initialized') + } + return this._secretController + } + + private _variableController: VariableController | null = null + + get variableController(): VariableController { + if (!this._variableController) { + throw new Error('ControllerInstance not initialized') + } + return this._variableController + } + + private _workspaceController: WorkspaceController | null = null + + get workspaceController(): WorkspaceController { + if (!this._workspaceController) { + throw new Error('ControllerInstance not initialized') + } + return this._workspaceController + } + + private _workspaceRoleController: WorkspaceRoleController | null = null + + get workspaceRoleController(): WorkspaceRoleController { + if (!this._workspaceRoleController) { + throw new Error('ControllerInstance not initialized') + } + return this._workspaceRoleController + } + + static initialize(baseUrl: string) { + if (!ControllerInstance.instance) { + const instance = new ControllerInstance() + + instance._environmentController = new EnvironmentController(baseUrl) + instance._eventController = new EventController(baseUrl) + instance._integrationController = new IntegrationController(baseUrl) + instance._projectController = new ProjectController(baseUrl) + instance._secretController = new SecretController(baseUrl) + instance._variableController = new VariableController(baseUrl) + instance._workspaceController = new WorkspaceController(baseUrl) + instance._workspaceRoleController = new WorkspaceRoleController(baseUrl) + + ControllerInstance.instance = instance + } + } + + static getInstance(): ControllerInstance { + if (!ControllerInstance.instance) { + throw new Error('ControllerInstance not initialized') + } + return ControllerInstance.instance + } +} diff --git a/apps/cli/src/util/decrypt.ts b/apps/cli/src/util/decrypt.ts index 6db7932e..bcce6f4e 100644 --- a/apps/cli/src/util/decrypt.ts +++ b/apps/cli/src/util/decrypt.ts @@ -1,6 +1,14 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ import * as eccrypto from 'eccrypto' +/** + * Decrypts a given encrypted data using a given private key. + * + * @param privateKey - The private key to use for decryption. + * @param data - The encrypted data to decrypt. + * + * @returns The decrypted data as a string. + */ export const decrypt = async ( privateKey: string, data: string diff --git a/apps/cli/tsconfig.json b/apps/cli/tsconfig.json index 26898f66..07b50e18 100644 --- a/apps/cli/tsconfig.json +++ b/apps/cli/tsconfig.json @@ -21,6 +21,6 @@ "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true }, - "include": ["src/**/*.ts", "tsup.config.ts"], + "include": ["src/**/*.ts", ".eslintrc.cjs", "tsup.config.ts"], "exclude": ["node_modules"] } diff --git a/packages/api-client/.eslintrc.js b/packages/api-client/.eslintrc.cjs similarity index 100% rename from packages/api-client/.eslintrc.js rename to packages/api-client/.eslintrc.cjs diff --git a/packages/api-client/package.json b/packages/api-client/package.json index eacad446..2cea5708 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -2,6 +2,7 @@ "name": "@keyshade/api-client", "version": "1.0.0", "main": "dist/src/index.js", + "type": "module", "description": "This package holds all the API request logic", "private": true, "scripts": { diff --git a/packages/api-client/src/index.ts b/packages/api-client/src/index.ts index 05d9b163..77192b35 100644 --- a/packages/api-client/src/index.ts +++ b/packages/api-client/src/index.ts @@ -4,7 +4,8 @@ import EventController from '@api-client/controllers/event' import IntegrationController from '@api-client/controllers/integration' import ProjectController from '@api-client/controllers/project' import VariableController from '@api-client/controllers/variable' -import WorkspaceController from './controllers/workspace' +import WorkspaceController from '@api-client/controllers/workspace' +import WorkspaceRoleController from '@api-client/controllers/workspace-role' export { EnvironmentController, @@ -13,5 +14,6 @@ export { IntegrationController, ProjectController, VariableController, - WorkspaceController + WorkspaceController, + WorkspaceRoleController } diff --git a/packages/api-client/src/types/environment.types.d.ts b/packages/api-client/src/types/environment.types.d.ts index 076ddc32..c8d3f1f5 100644 --- a/packages/api-client/src/types/environment.types.d.ts +++ b/packages/api-client/src/types/environment.types.d.ts @@ -1,6 +1,6 @@ import { PageRequest, PageResponse } from './index.types' -interface Environment { +export interface Environment { id: string name: string slug: string diff --git a/packages/api-client/src/types/integration.types.d.ts b/packages/api-client/src/types/integration.types.d.ts index 035f5658..fed5ac03 100644 --- a/packages/api-client/src/types/integration.types.d.ts +++ b/packages/api-client/src/types/integration.types.d.ts @@ -37,7 +37,7 @@ export enum EventType { INTEGRATION_DELETED } -interface Integration { +export interface Integration { id: string name: string slug: string diff --git a/packages/api-client/src/types/project.types.d.ts b/packages/api-client/src/types/project.types.d.ts index 55afb05b..b26b5c8f 100644 --- a/packages/api-client/src/types/project.types.d.ts +++ b/packages/api-client/src/types/project.types.d.ts @@ -1,6 +1,6 @@ import { PageRequest, PageResponse } from './index.types' -interface Project { +export interface Project { id: string name: string slug: string diff --git a/packages/api-client/src/types/secret.types.d.ts b/packages/api-client/src/types/secret.types.d.ts index 4d07a84d..1a173354 100644 --- a/packages/api-client/src/types/secret.types.d.ts +++ b/packages/api-client/src/types/secret.types.d.ts @@ -1,6 +1,6 @@ import { PageRequest, PageResponse } from './index.types' -interface Secret { +export interface Secret { id: string name: string slug: string diff --git a/packages/api-client/src/types/variable.types.d.ts b/packages/api-client/src/types/variable.types.d.ts index 7240b3aa..a240fd92 100644 --- a/packages/api-client/src/types/variable.types.d.ts +++ b/packages/api-client/src/types/variable.types.d.ts @@ -1,6 +1,6 @@ import { PageRequest, PageResponse } from './index.types' -interface Variable { +export interface Variable { id: string name: string slug: string diff --git a/packages/api-client/src/types/workspace-role.types.d.ts b/packages/api-client/src/types/workspace-role.types.d.ts index 47116229..df6f3f91 100644 --- a/packages/api-client/src/types/workspace-role.types.d.ts +++ b/packages/api-client/src/types/workspace-role.types.d.ts @@ -1,6 +1,6 @@ import { PageRequest, PageResponse } from './index.types' -interface WorkspaceRole { +export interface WorkspaceRole { id: string name: string slug: string diff --git a/packages/api-client/src/types/workspace.types.d.ts b/packages/api-client/src/types/workspace.types.d.ts index b9c190a1..c1d60b61 100644 --- a/packages/api-client/src/types/workspace.types.d.ts +++ b/packages/api-client/src/types/workspace.types.d.ts @@ -1,6 +1,6 @@ import { PageRequest, PageResponse } from './index.types' -interface Workspace { +export interface Workspace { id: string name: string slug: string diff --git a/packages/api-client/tsconfig.json b/packages/api-client/tsconfig.json index 4671d0fe..0ea2662a 100644 --- a/packages/api-client/tsconfig.json +++ b/packages/api-client/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../tsconfig/base.json", "compilerOptions": { "baseUrl": ".", + "declaration": true, "paths": { "@api-client/*": ["./src/*"] }, @@ -12,6 +13,11 @@ "resolveFullPaths": true, "verbose": false }, - "include": ["src/**/*.ts", "tests/**/*.ts", "jest.config.ts"], + "include": [ + "src/**/*.ts", + "tests/**/*.ts", + "jest.config.ts", + ".eslintrc.cjs" + ], "exclude": ["node_modules", "dist"] }