mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
requested changes
This commit is contained in:
@@ -7,7 +7,7 @@ import { daysToMillisecond } from "@app/lib/dates";
|
||||
import { removeTrailingSlash } from "@app/lib/fn";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { DefaultResponseErrorsSchema, SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvider) => {
|
||||
@@ -37,7 +37,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.CREATE.path)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
lease: DynamicSecretLeasesSchema,
|
||||
dynamicSecret: SanitizedDynamicSecretSchema,
|
||||
@@ -82,7 +81,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
||||
isForced: z.boolean().default(false).describe(DYNAMIC_SECRET_LEASES.DELETE.isForced)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
lease: DynamicSecretLeasesSchema
|
||||
})
|
||||
@@ -136,7 +134,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.RENEW.environmentSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
lease: DynamicSecretLeasesSchema
|
||||
})
|
||||
@@ -177,7 +174,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.GET_BY_LEASEID.environmentSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
lease: DynamicSecretLeasesSchema.extend({
|
||||
dynamicSecret: SanitizedDynamicSecretSchema
|
||||
|
||||
@@ -9,7 +9,7 @@ import { daysToMillisecond } from "@app/lib/dates";
|
||||
import { removeTrailingSlash } from "@app/lib/fn";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { DefaultResponseErrorsSchema, SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
export const registerDynamicSecretRouter = async (server: FastifyZodProvider) => {
|
||||
@@ -59,7 +59,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
})
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
dynamicSecret: SanitizedDynamicSecretSchema
|
||||
})
|
||||
@@ -91,7 +90,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
clientSecret: z.string().min(1).describe("The client secret of the Azure Entra ID App Registration")
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z
|
||||
.object({
|
||||
name: z.string().min(1).describe("The name of the user"),
|
||||
@@ -157,7 +155,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
})
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
dynamicSecret: SanitizedDynamicSecretSchema
|
||||
})
|
||||
@@ -197,7 +194,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
isForced: z.boolean().default(false).describe(DYNAMIC_SECRETS.DELETE.isForced)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
dynamicSecret: SanitizedDynamicSecretSchema
|
||||
})
|
||||
@@ -233,7 +229,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.GET_BY_NAME.environmentSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
dynamicSecret: SanitizedDynamicSecretSchema.extend({
|
||||
inputs: z.unknown()
|
||||
@@ -268,7 +263,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.LIST.environmentSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
dynamicSecrets: SanitizedDynamicSecretSchema.array()
|
||||
})
|
||||
@@ -308,7 +302,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.LIST_LEAES_BY_NAME.environmentSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
leases: DynamicSecretLeasesSchema.array()
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@ import { z } from "zod";
|
||||
import { GroupsSchema, OrgMembershipRole, UsersSchema } from "@app/db/schemas";
|
||||
import { GROUPS } from "@app/lib/api-docs";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { DefaultResponseErrorsSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
@@ -27,7 +26,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(GROUPS.CREATE.role)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: GroupsSchema
|
||||
}
|
||||
},
|
||||
@@ -53,7 +51,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
id: z.string().trim().describe(GROUPS.GET_BY_ID.id)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: GroupsSchema
|
||||
}
|
||||
},
|
||||
@@ -76,7 +73,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||
schema: {
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: GroupsSchema.array()
|
||||
}
|
||||
},
|
||||
@@ -116,7 +112,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
})
|
||||
.partial(),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: GroupsSchema
|
||||
}
|
||||
},
|
||||
@@ -143,7 +138,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
id: z.string().trim().describe(GROUPS.DELETE.id)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: GroupsSchema
|
||||
}
|
||||
},
|
||||
@@ -174,7 +168,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
username: z.string().optional().describe(GROUPS.LIST_USERS.username)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
users: UsersSchema.pick({
|
||||
email: true,
|
||||
@@ -217,7 +210,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
username: z.string().trim().describe(GROUPS.ADD_USER.username)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: UsersSchema.pick({
|
||||
email: true,
|
||||
username: true,
|
||||
@@ -251,7 +243,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||
username: z.string().trim().describe(GROUPS.DELETE_USER.username)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: UsersSchema.pick({
|
||||
email: true,
|
||||
username: true,
|
||||
|
||||
@@ -10,7 +10,6 @@ import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import {
|
||||
DefaultResponseErrorsSchema,
|
||||
ProjectPermissionSchema,
|
||||
ProjectSpecificPrivilegePermissionSchema,
|
||||
SanitizedIdentityPrivilegeSchema
|
||||
@@ -53,7 +52,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
||||
).optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
privilege: SanitizedIdentityPrivilegeSchema
|
||||
})
|
||||
@@ -133,7 +131,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
||||
.describe(IDENTITY_ADDITIONAL_PRIVILEGE.CREATE.temporaryAccessStartTime)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
privilege: SanitizedIdentityPrivilegeSchema
|
||||
})
|
||||
@@ -218,7 +215,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
||||
.partial()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
privilege: SanitizedIdentityPrivilegeSchema
|
||||
})
|
||||
@@ -274,7 +270,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
||||
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.DELETE.projectSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
privilege: SanitizedIdentityPrivilegeSchema
|
||||
})
|
||||
@@ -316,7 +311,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
||||
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.GET_BY_SLUG.projectSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
privilege: SanitizedIdentityPrivilegeSchema
|
||||
})
|
||||
@@ -354,7 +348,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
||||
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.LIST.projectSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
privileges: SanitizedIdentityPrivilegeSchema.array()
|
||||
})
|
||||
|
||||
@@ -6,11 +6,7 @@ import { ProjectMembershipRole, ProjectMembershipsSchema, ProjectRolesSchema } f
|
||||
import { PROJECT_ROLE } from "@app/lib/api-docs";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import {
|
||||
DefaultResponseErrorsSchema,
|
||||
ProjectPermissionSchema,
|
||||
SanitizedRoleSchema
|
||||
} from "@app/server/routes/sanitizedSchemas";
|
||||
import { ProjectPermissionSchema, SanitizedRoleSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
@@ -49,7 +45,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
permissions: ProjectPermissionSchema.array().describe(PROJECT_ROLE.CREATE.permissions)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
role: SanitizedRoleSchema
|
||||
})
|
||||
@@ -110,7 +105,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
permissions: ProjectPermissionSchema.array().describe(PROJECT_ROLE.UPDATE.permissions).optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
role: SanitizedRoleSchema
|
||||
})
|
||||
@@ -152,7 +146,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
roleId: z.string().trim().describe(PROJECT_ROLE.DELETE.roleId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
role: SanitizedRoleSchema
|
||||
})
|
||||
@@ -189,7 +182,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
projectSlug: z.string().trim().describe(PROJECT_ROLE.LIST.projectSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
roles: ProjectRolesSchema.omit({ permissions: true }).array()
|
||||
})
|
||||
@@ -220,7 +212,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
slug: z.string().trim().describe(PROJECT_ROLE.GET_ROLE_BY_SLUG.roleSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
role: SanitizedRoleSchema
|
||||
})
|
||||
@@ -251,7 +242,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||
projectId: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
data: z.object({
|
||||
membership: ProjectMembershipsSchema.extend({
|
||||
|
||||
@@ -6,7 +6,6 @@ import { AUDIT_LOGS, PROJECTS } from "@app/lib/api-docs";
|
||||
import { getLastMidnightDateISO, removeTrailingSlash } from "@app/lib/fn";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { DefaultResponseErrorsSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { KmsType } from "@app/services/kms/kms-types";
|
||||
|
||||
@@ -34,7 +33,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
limit: z.coerce.number().default(20).describe(PROJECTS.GET_SNAPSHOTS.limit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secretSnapshots: SecretSnapshotsSchema.array()
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@ import { SecretSnapshotsSchema, SecretTagsSchema } from "@app/db/schemas";
|
||||
import { PROJECTS } from "@app/lib/api-docs";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { DefaultResponseErrorsSchema, secretRawSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { secretRawSchema } from "@app/server/routes/sanitizedSchemas";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
export const registerSnapshotRouter = async (server: FastifyZodProvider) => {
|
||||
@@ -77,7 +77,6 @@ export const registerSnapshotRouter = async (server: FastifyZodProvider) => {
|
||||
secretSnapshotId: z.string().trim().describe(PROJECTS.ROLLBACK_TO_SNAPSHOT.secretSnapshotId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secretSnapshot: SecretSnapshotsSchema
|
||||
})
|
||||
|
||||
@@ -20,6 +20,7 @@ import { TQueueServiceFactory } from "@app/queue";
|
||||
import { TSmtpService } from "@app/services/smtp/smtp-service";
|
||||
|
||||
import { globalRateLimiterCfg } from "./config/rateLimiter";
|
||||
import { addErrorsToResponseSchemas } from "./plugins/add-errors-to-response-schemas";
|
||||
import { fastifyErrHandler } from "./plugins/error-handler";
|
||||
import { registerExternalNextjs } from "./plugins/external-nextjs";
|
||||
import { serializerCompiler, validatorCompiler, ZodTypeProvider } from "./plugins/fastify-zod";
|
||||
@@ -75,6 +76,8 @@ export const main = async ({ db, smtp, logger, queue, keyStore }: TMain) => {
|
||||
credentials: true,
|
||||
origin: appCfg.SITE_URL || true
|
||||
});
|
||||
|
||||
await server.register(addErrorsToResponseSchemas);
|
||||
// pull ip based on various proxy headers
|
||||
await server.register(fastifyIp);
|
||||
|
||||
|
||||
20
backend/src/server/plugins/add-errors-to-response-schemas.ts
Normal file
20
backend/src/server/plugins/add-errors-to-response-schemas.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import fp from "fastify-plugin";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../routes/sanitizedSchemas";
|
||||
|
||||
export const addErrorsToResponseSchemas = fp(async (server) => {
|
||||
server.addHook("onRoute", (routeOptions) => {
|
||||
if (routeOptions.schema && routeOptions.schema.response) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
routeOptions.schema.response = {
|
||||
...DefaultResponseErrorsSchema,
|
||||
...routeOptions.schema.response
|
||||
};
|
||||
} else {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
routeOptions.schema = routeOptions.schema || {};
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
routeOptions.schema.response = { ...DefaultResponseErrorsSchema };
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -51,10 +51,10 @@ export const DefaultResponseErrorsSchema = {
|
||||
}),
|
||||
403: z.object({
|
||||
statusCode: z.literal(403),
|
||||
message: z.literal(
|
||||
`<string>: Contains a human-readable message about what went wrong. 403 errors are forbidden errors, and will occur when attempting to access a resource without the necessary permissions`
|
||||
),
|
||||
error: z.literal(`<string>: Contains a human-readable error name.`)
|
||||
message: z.any(),
|
||||
error: z.literal(
|
||||
`<string>: Contains a human-readable error name. The message can be both an object or a string. It will always be a string except if the error is happening due to a request validation error.`
|
||||
)
|
||||
}),
|
||||
500: z.object({
|
||||
statusCode: z.literal(500),
|
||||
|
||||
@@ -15,8 +15,6 @@ import {
|
||||
validateCaDateField
|
||||
} from "@app/services/certificate-authority/certificate-authority-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -65,7 +63,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
ca: CertificateAuthoritiesSchema
|
||||
})
|
||||
@@ -111,7 +108,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
ca: CertificateAuthoritiesSchema
|
||||
})
|
||||
@@ -159,7 +155,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caCertId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CERT_BY_ID.caCertId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.instanceof(Buffer)
|
||||
}
|
||||
},
|
||||
@@ -192,7 +187,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(CERTIFICATE_AUTHORITIES.CREATE.requireTemplateForIssuance)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
ca: CertificateAuthoritiesSchema
|
||||
})
|
||||
@@ -240,7 +234,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.DELETE.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
ca: CertificateAuthoritiesSchema
|
||||
})
|
||||
@@ -286,7 +279,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CSR.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
csr: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CSR.csr)
|
||||
})
|
||||
@@ -336,7 +328,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
notAfter: validateCaDateField.describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.notAfter)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.certificate),
|
||||
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.certificateChain),
|
||||
@@ -388,7 +379,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CA_CERTS.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.array(
|
||||
z.object({
|
||||
certificate: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CA_CERTS.certificate),
|
||||
@@ -437,7 +427,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CERT.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CERT.certificate),
|
||||
certificateChain: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CERT.certificateChain),
|
||||
@@ -493,7 +482,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
maxPathLength: z.number().min(-1).default(-1).describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.maxPathLength)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.certificate),
|
||||
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.certificateChain),
|
||||
@@ -555,7 +543,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.IMPORT_CERT.certificateChain)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string().trim(),
|
||||
caId: z.string().trim()
|
||||
@@ -629,7 +616,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.certificate),
|
||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||
@@ -712,7 +698,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.certificate),
|
||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||
@@ -768,7 +753,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificateTemplates: CertificateTemplatesSchema.array()
|
||||
})
|
||||
@@ -814,7 +798,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CRLS.caId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.array(
|
||||
z.object({
|
||||
id: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CRLS.id),
|
||||
|
||||
@@ -13,8 +13,6 @@ import {
|
||||
validateCaDateField
|
||||
} from "@app/services/certificate-authority/certificate-authority-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -29,7 +27,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
serialNumber: z.string().trim().describe(CERTIFICATES.GET.serialNumber)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: CertificatesSchema
|
||||
})
|
||||
@@ -121,7 +118,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.certificate),
|
||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||
@@ -223,7 +219,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
}
|
||||
),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.certificate),
|
||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||
@@ -281,7 +276,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
revocationReason: z.nativeEnum(CrlReason).describe(CERTIFICATES.REVOKE.revocationReason)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string().trim(),
|
||||
serialNumber: z.string().trim().describe(CERTIFICATES.REVOKE.serialNumberRes),
|
||||
@@ -333,7 +327,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
serialNumber: z.string().trim().describe(CERTIFICATES.DELETE.serialNumber)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: CertificatesSchema
|
||||
})
|
||||
@@ -380,7 +373,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||
serialNumber: z.string().trim().describe(CERTIFICATES.GET_CERT.serialNumber)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificate: z.string().trim().describe(CERTIFICATES.GET_CERT.certificate),
|
||||
certificateChain: z.string().trim().describe(CERTIFICATES.GET_CERT.certificateChain),
|
||||
|
||||
@@ -11,8 +11,6 @@ import { CertExtendedKeyUsage, CertKeyUsage } from "@app/services/certificate/ce
|
||||
import { sanitizedCertificateTemplate } from "@app/services/certificate-template/certificate-template-schema";
|
||||
import { validateTemplateRegexField } from "@app/services/certificate-template/certificate-template-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
const sanitizedEstConfig = CertificateTemplateEstConfigsSchema.pick({
|
||||
id: true,
|
||||
certificateTemplateId: true,
|
||||
@@ -31,7 +29,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.GET.certificateTemplateId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedCertificateTemplate
|
||||
}
|
||||
},
|
||||
@@ -93,7 +90,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
.describe(CERTIFICATE_TEMPLATES.CREATE.extendedKeyUsages)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedCertificateTemplate
|
||||
}
|
||||
},
|
||||
@@ -159,7 +155,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.UPDATE.certificateTemplateId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedCertificateTemplate
|
||||
}
|
||||
},
|
||||
@@ -206,7 +201,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.DELETE.certificateTemplateId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedCertificateTemplate
|
||||
}
|
||||
},
|
||||
@@ -253,7 +247,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
isEnabled: z.boolean().default(true)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedEstConfig
|
||||
}
|
||||
},
|
||||
@@ -301,7 +294,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
isEnabled: z.boolean().optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedEstConfig
|
||||
}
|
||||
},
|
||||
@@ -344,7 +336,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
certificateTemplateId: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: sanitizedEstConfig.extend({
|
||||
caChain: z.string()
|
||||
})
|
||||
|
||||
@@ -12,8 +12,6 @@ import {
|
||||
validatePrincipalArns
|
||||
} from "@app/services/identity-aws-auth/identity-aws-auth-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -30,7 +28,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
||||
iamRequestHeaders: z.string().describe(AWS_AUTH.LOGIN.iamRequestHeaders)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -121,7 +118,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AWS_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAwsAuth: IdentityAwsAuthsSchema
|
||||
})
|
||||
@@ -201,7 +197,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
||||
.describe(AWS_AUTH.UPDATE.accessTokenMaxTTL)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAwsAuth: IdentityAwsAuthsSchema
|
||||
})
|
||||
@@ -257,7 +252,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().describe(AWS_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAwsAuth: IdentityAwsAuthsSchema
|
||||
})
|
||||
@@ -304,7 +298,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().describe(AWS_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAwsAuth: IdentityAwsAuthsSchema
|
||||
})
|
||||
|
||||
@@ -9,7 +9,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||
import { validateAzureAuthField } from "@app/services/identity-azure-auth/identity-azure-auth-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
import {} from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -25,7 +25,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
||||
jwt: z.string()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -111,7 +110,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AZURE_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAzureAuth: IdentityAzureAuthsSchema
|
||||
})
|
||||
@@ -192,7 +190,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
||||
.describe(AZURE_AUTH.UPDATE.accessTokenMaxTTL)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAzureAuth: IdentityAzureAuthsSchema
|
||||
})
|
||||
@@ -247,7 +244,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
||||
identityId: z.string().describe(AZURE_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAzureAuth: IdentityAzureAuthsSchema
|
||||
})
|
||||
@@ -295,7 +291,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
||||
identityId: z.string().describe(AZURE_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityAzureAuth: IdentityAzureAuthsSchema
|
||||
})
|
||||
|
||||
@@ -9,8 +9,6 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||
import { validateGcpAuthField } from "@app/services/identity-gcp-auth/identity-gcp-auth-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -25,7 +23,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
||||
jwt: z.string()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -112,7 +109,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(GCP_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityGcpAuth: IdentityGcpAuthsSchema
|
||||
})
|
||||
@@ -194,7 +190,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
||||
.describe(GCP_AUTH.UPDATE.accessTokenMaxTTL)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityGcpAuth: IdentityGcpAuthsSchema
|
||||
})
|
||||
@@ -251,7 +246,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().describe(GCP_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityGcpAuth: IdentityGcpAuthsSchema
|
||||
})
|
||||
@@ -299,7 +293,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().describe(GCP_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityGcpAuth: IdentityGcpAuthsSchema
|
||||
})
|
||||
|
||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
const IdentityKubernetesAuthResponseSchema = IdentityKubernetesAuthsSchema.omit({
|
||||
encryptedCaCert: true,
|
||||
caCertIV: true,
|
||||
@@ -36,7 +34,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
||||
jwt: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -132,7 +129,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
||||
.describe(KUBERNETES_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
||||
})
|
||||
@@ -226,7 +222,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
||||
.describe(KUBERNETES_AUTH.UPDATE.accessTokenMaxTTL)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
||||
})
|
||||
@@ -282,7 +277,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
||||
identityId: z.string().describe(KUBERNETES_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
||||
})
|
||||
@@ -330,7 +324,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
||||
identityId: z.string().describe(KUBERNETES_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema.omit({
|
||||
caCert: true,
|
||||
|
||||
@@ -12,8 +12,6 @@ import {
|
||||
validateOidcBoundClaimsField
|
||||
} from "@app/services/identity-oidc-auth/identity-oidc-auth-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
const IdentityOidcAuthResponseSchema = IdentityOidcAuthsSchema.omit({
|
||||
encryptedCaCert: true,
|
||||
caCertIV: true,
|
||||
@@ -36,7 +34,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
||||
jwt: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -127,7 +124,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(OIDC_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityOidcAuth: IdentityOidcAuthResponseSchema
|
||||
})
|
||||
@@ -227,7 +223,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
||||
})
|
||||
.partial(),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityOidcAuth: IdentityOidcAuthResponseSchema
|
||||
})
|
||||
@@ -286,7 +281,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().describe(OIDC_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityOidcAuth: IdentityOidcAuthResponseSchema
|
||||
})
|
||||
@@ -334,7 +328,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().describe(OIDC_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityOidcAuth: IdentityOidcAuthResponseSchema.omit({
|
||||
caCert: true
|
||||
|
||||
@@ -9,7 +9,7 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
import { SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -32,7 +32,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(IDENTITIES.CREATE.role)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identity: IdentitiesSchema
|
||||
})
|
||||
@@ -97,7 +96,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||
role: z.string().trim().min(1).optional().describe(IDENTITIES.UPDATE.role)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identity: IdentitiesSchema
|
||||
})
|
||||
@@ -147,7 +145,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||
identityId: z.string().describe(IDENTITIES.DELETE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identity: IdentitiesSchema
|
||||
})
|
||||
@@ -194,7 +191,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||
identityId: z.string().describe(IDENTITIES.GET_BY_ID.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identity: IdentityOrgMembershipsSchema.extend({
|
||||
customRole: OrgRolesSchema.pick({
|
||||
@@ -240,7 +236,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||
orgId: z.string().describe(IDENTITIES.LIST.orgId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identities: IdentityOrgMembershipsSchema.extend({
|
||||
customRole: OrgRolesSchema.pick({
|
||||
|
||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -59,7 +57,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(TOKEN_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityTokenAuth: IdentityTokenAuthsSchema
|
||||
})
|
||||
@@ -135,7 +132,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
.describe(TOKEN_AUTH.UPDATE.accessTokenMaxTTL)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityTokenAuth: IdentityTokenAuthsSchema
|
||||
})
|
||||
@@ -190,7 +186,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
identityId: z.string().describe(TOKEN_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityTokenAuth: IdentityTokenAuthsSchema
|
||||
})
|
||||
@@ -238,7 +233,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
identityId: z.string().describe(TOKEN_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityTokenAuth: IdentityTokenAuthsSchema
|
||||
})
|
||||
@@ -289,7 +283,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
name: z.string().optional().describe(TOKEN_AUTH.CREATE_TOKEN.name)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -352,7 +345,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
limit: z.coerce.number().min(1).max(100).default(20).describe(TOKEN_AUTH.GET_TOKENS.limit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
tokens: IdentityAccessTokensSchema.array()
|
||||
})
|
||||
@@ -404,7 +396,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
name: z.string().optional().describe(TOKEN_AUTH.UPDATE_TOKEN.name)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
token: IdentityAccessTokensSchema
|
||||
})
|
||||
@@ -455,7 +446,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
||||
tokenId: z.string().describe(TOKEN_AUTH.REVOKE_TOKEN.tokenId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string()
|
||||
})
|
||||
|
||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const sanitizedClientSecretSchema = IdentityUaClientSecretsSchema.pick({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
@@ -37,7 +35,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
clientSecret: z.string().trim().describe(UNIVERSAL_AUTH.LOGIN.clientSecret)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
accessToken: z.string(),
|
||||
expiresIn: z.coerce.number(),
|
||||
@@ -133,7 +130,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(UNIVERSAL_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||
})
|
||||
@@ -226,7 +222,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(UNIVERSAL_AUTH.UPDATE.accessTokenMaxTTL)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||
})
|
||||
@@ -280,7 +275,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
identityId: z.string().describe(UNIVERSAL_AUTH.RETRIEVE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||
})
|
||||
@@ -328,7 +322,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
identityId: z.string().describe(UNIVERSAL_AUTH.REVOKE.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||
})
|
||||
@@ -381,7 +374,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
ttl: z.number().min(0).max(315360000).default(0).describe(UNIVERSAL_AUTH.CREATE_CLIENT_SECRET.ttl)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
clientSecret: z.string(),
|
||||
clientSecretData: sanitizedClientSecretSchema
|
||||
@@ -433,7 +425,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
identityId: z.string().describe(UNIVERSAL_AUTH.LIST_CLIENT_SECRETS.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
clientSecretData: sanitizedClientSecretSchema.array()
|
||||
})
|
||||
@@ -483,7 +474,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
clientSecretId: z.string().describe(UNIVERSAL_AUTH.GET_CLIENT_SECRET.clientSecretId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
clientSecretData: sanitizedClientSecretSchema
|
||||
})
|
||||
@@ -534,7 +524,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
||||
clientSecretId: z.string().describe(UNIVERSAL_AUTH.REVOKE_CLIENT_SECRET.clientSecretId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
clientSecretData: sanitizedClientSecretSchema
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema, integrationAuthPubSchema } from "../sanitizedSchemas";
|
||||
import { integrationAuthPubSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIntegrationAuthRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -64,7 +64,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
||||
integrationAuthId: z.string().trim().describe(INTEGRATION_AUTH.GET.integrationAuthId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integrationAuth: integrationAuthPubSchema
|
||||
})
|
||||
@@ -101,7 +100,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
||||
projectId: z.string().trim().describe(INTEGRATION_AUTH.DELETE.projectId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integrationAuth: integrationAuthPubSchema.array()
|
||||
})
|
||||
@@ -150,7 +148,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
||||
integrationAuthId: z.string().trim().describe(INTEGRATION_AUTH.DELETE_BY_ID.integrationAuthId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integrationAuth: integrationAuthPubSchema
|
||||
})
|
||||
@@ -254,7 +251,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
||||
refreshToken: z.string().trim().optional().describe(INTEGRATION_AUTH.CREATE_ACCESS_TOKEN.refreshToken)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integrationAuth: integrationAuthPubSchema
|
||||
})
|
||||
|
||||
@@ -11,7 +11,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { IntegrationMetadataSchema } from "@app/services/integration/integration-schema";
|
||||
import { PostHogEventTypes, TIntegrationCreatedEvent } from "@app/services/telemetry/telemetry-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
import {} from "../sanitizedSchemas";
|
||||
|
||||
export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -51,7 +51,6 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
||||
metadata: IntegrationMetadataSchema.default({})
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integration: IntegrationsSchema
|
||||
})
|
||||
@@ -138,7 +137,6 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
||||
metadata: IntegrationMetadataSchema.optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integration: IntegrationsSchema
|
||||
})
|
||||
@@ -223,7 +221,6 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
||||
.transform((val) => val === "true")
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integration: IntegrationsSchema
|
||||
})
|
||||
|
||||
@@ -18,8 +18,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -116,7 +114,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
}),
|
||||
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
auditLogs: AuditLogsSchema.omit({
|
||||
eventMetadata: true,
|
||||
|
||||
@@ -7,8 +7,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -31,7 +29,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(ALERTS.CREATE.emails)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiAlertsSchema
|
||||
}
|
||||
},
|
||||
@@ -76,7 +73,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
||||
alertId: z.string().trim().describe(ALERTS.GET.alertId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiAlertsSchema
|
||||
}
|
||||
},
|
||||
@@ -128,7 +124,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(ALERTS.UPDATE.emails)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiAlertsSchema
|
||||
}
|
||||
},
|
||||
@@ -174,7 +169,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
||||
alertId: z.string().trim().describe(ALERTS.DELETE.alertId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiAlertsSchema
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { PkiItemType } from "@app/services/pki-collection/pki-collection-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerPkiCollectionRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -26,7 +24,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
description: z.string().trim().default("").describe(PKI_COLLECTIONS.CREATE.description)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiCollectionsSchema
|
||||
}
|
||||
},
|
||||
@@ -68,7 +65,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
collectionId: z.string().trim().describe(PKI_COLLECTIONS.GET.collectionId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiCollectionsSchema
|
||||
}
|
||||
},
|
||||
@@ -113,7 +109,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
description: z.string().trim().optional().describe(PKI_COLLECTIONS.UPDATE.description)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiCollectionsSchema
|
||||
}
|
||||
},
|
||||
@@ -156,7 +151,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
collectionId: z.string().trim().describe(PKI_COLLECTIONS.DELETE.collectionId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiCollectionsSchema
|
||||
}
|
||||
},
|
||||
@@ -202,7 +196,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
limit: z.coerce.number().min(1).max(100).default(25).describe(PKI_COLLECTIONS.LIST_ITEMS.limit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
collectionItems: z.array(
|
||||
PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
||||
@@ -263,7 +256,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
itemId: z.string().trim().describe(PKI_COLLECTIONS.ADD_ITEM.itemId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
||||
type: z.nativeEnum(PkiItemType).describe(PKI_COLLECTIONS.ADD_ITEM.type),
|
||||
itemId: z.string().trim().describe(PKI_COLLECTIONS.ADD_ITEM.itemId)
|
||||
@@ -312,7 +304,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
||||
collectionItemId: z.string().trim().describe(PKI_COLLECTIONS.DELETE_ITEM.collectionItemId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
||||
type: z.nativeEnum(PkiItemType).describe(PKI_COLLECTIONS.DELETE_ITEM.type),
|
||||
itemId: z.string().trim().describe(PKI_COLLECTIONS.DELETE_ITEM.itemId)
|
||||
|
||||
@@ -8,8 +8,6 @@ import { writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -87,7 +85,6 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(ENVIRONMENTS.CREATE.slug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
workspace: z.string(),
|
||||
@@ -155,7 +152,6 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
||||
position: z.number().optional().describe(ENVIRONMENTS.UPDATE.position)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
workspace: z.string(),
|
||||
@@ -217,7 +213,6 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
||||
id: z.string().trim().describe(ENVIRONMENTS.DELETE.id)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
workspace: z.string(),
|
||||
|
||||
@@ -15,8 +15,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerProjectMembershipRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -35,7 +33,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
||||
workspaceId: z.string().trim().describe(PROJECT_USERS.GET_USER_MEMBERSHIPS.workspaceId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
memberships: ProjectMembershipsSchema.extend({
|
||||
user: UsersSchema.pick({
|
||||
@@ -97,7 +94,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
||||
username: z.string().min(1).trim().describe(PROJECT_USERS.GET_USER_MEMBERSHIP.username)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
membership: ProjectMembershipsSchema.extend({
|
||||
user: UsersSchema.pick({
|
||||
@@ -231,7 +227,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
||||
.describe(PROJECT_USERS.UPDATE_USER_MEMBERSHIP.roles)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
roles: ProjectUserMembershipRolesSchema.array()
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { ProjectFilterType } from "@app/services/project/project-types";
|
||||
import { validateSlackChannelsField } from "@app/services/slack/slack-auth-validators";
|
||||
|
||||
import { DefaultResponseErrorsSchema, integrationAuthPubSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
import { integrationAuthPubSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
import { sanitizedServiceTokenSchema } from "../v2/service-token-router";
|
||||
|
||||
const projectWithEnv = SanitizedProjectSchema.merge(
|
||||
@@ -177,7 +177,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
workspaceId: z.string().trim().describe(PROJECTS.GET.workspaceId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspace: projectWithEnv.optional()
|
||||
})
|
||||
@@ -300,7 +299,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
autoCapitalization: z.boolean().optional().describe(PROJECTS.UPDATE.autoCapitalization)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspace: SanitizedProjectSchema
|
||||
})
|
||||
@@ -458,7 +456,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION.workspaceId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
integrations: IntegrationsSchema.merge(
|
||||
z.object({
|
||||
@@ -502,7 +499,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION_AUTHORIZATION.workspaceId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
authorizations: integrationAuthPubSchema.array()
|
||||
})
|
||||
|
||||
@@ -8,8 +8,6 @@ import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerSecretFolderRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
url: "/",
|
||||
@@ -45,7 +43,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
||||
.describe(FOLDERS.CREATE.directory)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
folder: SecretFoldersSchema
|
||||
})
|
||||
@@ -118,7 +115,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
||||
.describe(FOLDERS.UPDATE.directory)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
folder: SecretFoldersSchema
|
||||
})
|
||||
@@ -262,7 +258,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
||||
.describe(FOLDERS.DELETE.directory)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
folder: SecretFoldersSchema
|
||||
})
|
||||
@@ -331,7 +326,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
||||
.describe(FOLDERS.LIST.directory)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
folders: SecretFoldersSchema.array()
|
||||
})
|
||||
@@ -370,7 +364,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
||||
id: z.string().trim().describe(FOLDERS.GET_BY_ID.folderId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
folder: SecretFoldersSchema
|
||||
})
|
||||
|
||||
@@ -8,7 +8,7 @@ import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema, secretRawSchema } from "../sanitizedSchemas";
|
||||
import { secretRawSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerSecretImportRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -35,7 +35,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
||||
isReplication: z.boolean().default(false).describe(SECRET_IMPORTS.CREATE.isReplication)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
||||
@@ -109,7 +108,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
||||
})
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
||||
@@ -174,7 +172,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(SECRET_IMPORTS.DELETE.path)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
||||
@@ -278,7 +275,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(SECRET_IMPORTS.LIST.path)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string(),
|
||||
secretImports: SecretImportsSchema.omit({ importEnv: true })
|
||||
|
||||
@@ -7,8 +7,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -21,7 +19,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
projectId: z.string().trim().describe(SECRET_TAGS.LIST.projectId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspaceTags: SecretTagsSchema.array()
|
||||
})
|
||||
@@ -52,7 +49,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
tagId: z.string().trim().describe(SECRET_TAGS.GET_TAG_BY_ID.tagId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
// akhilmhdh: for terraform backward compatiability
|
||||
workspaceTag: SecretTagsSchema.extend({ name: z.string() })
|
||||
@@ -84,7 +80,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
tagSlug: z.string().trim().describe(SECRET_TAGS.GET_TAG_BY_SLUG.tagSlug)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
// akhilmhdh: for terraform backward compatiability
|
||||
workspaceTag: SecretTagsSchema.extend({ name: z.string() })
|
||||
@@ -127,7 +122,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
color: z.string().trim().describe(SECRET_TAGS.CREATE.color)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspaceTag: SecretTagsSchema
|
||||
})
|
||||
@@ -170,7 +164,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
color: z.string().trim().describe(SECRET_TAGS.UPDATE.color)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspaceTag: SecretTagsSchema
|
||||
})
|
||||
@@ -202,7 +195,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||
tagId: z.string().trim().describe(SECRET_TAGS.DELETE.tagId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspaceTag: SecretTagsSchema
|
||||
})
|
||||
|
||||
@@ -13,8 +13,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerGroupProjectRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -65,7 +63,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
||||
path: ["role", "roles"]
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
groupMembership: GroupProjectMembershipsSchema
|
||||
})
|
||||
@@ -122,7 +119,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
||||
.describe(PROJECTS.UPDATE_GROUP_IN_PROJECT.roles)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
roles: ProjectUserMembershipRolesSchema.array()
|
||||
})
|
||||
@@ -162,7 +158,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
||||
groupId: z.string().trim().describe(PROJECTS.REMOVE_GROUP_FROM_PROJECT.groupId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
groupMembership: GroupProjectMembershipsSchema
|
||||
})
|
||||
@@ -200,7 +195,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
||||
projectId: z.string().trim().describe(PROJECTS.LIST_GROUPS_IN_PROJECT.projectId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
groupMemberships: z
|
||||
.object({
|
||||
@@ -260,7 +254,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
||||
groupId: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
groupMembership: z.object({
|
||||
id: z.string(),
|
||||
|
||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { OrgIdentityOrderBy } from "@app/services/identity/identity-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityOrgRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -50,7 +48,6 @@ export const registerIdentityOrgRouter = async (server: FastifyZodProvider) => {
|
||||
search: z.string().trim().describe(ORGANIZATIONS.LIST_IDENTITY_MEMBERSHIPS.search).optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityMemberships: IdentityOrgMembershipsSchema.merge(
|
||||
z.object({
|
||||
|
||||
@@ -16,7 +16,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
||||
import { ProjectIdentityOrderBy } from "@app/services/identity-project/identity-project-types";
|
||||
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
import { SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerIdentityProjectRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -71,7 +71,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
||||
.optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityMembership: IdentityProjectMembershipsSchema
|
||||
})
|
||||
@@ -144,7 +143,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
||||
.describe(PROJECT_IDENTITIES.UPDATE_IDENTITY_MEMBERSHIP.roles.description)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
roles: ProjectUserMembershipRolesSchema.array()
|
||||
})
|
||||
@@ -183,7 +181,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().trim().describe(PROJECT_IDENTITIES.DELETE_IDENTITY_MEMBERSHIP.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityMembership: IdentityProjectMembershipsSchema
|
||||
})
|
||||
@@ -246,7 +243,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
||||
search: z.string().trim().describe(PROJECT_IDENTITIES.LIST_IDENTITY_MEMBERSHIPS.search).optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityMemberships: z
|
||||
.object({
|
||||
@@ -312,7 +308,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
||||
identityId: z.string().trim().describe(PROJECT_IDENTITIES.GET_IDENTITY_MEMBERSHIP_BY_ID.identityId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
identityMembership: z.object({
|
||||
id: z.string(),
|
||||
|
||||
@@ -13,8 +13,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "GET",
|
||||
@@ -33,7 +31,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
organizationId: z.string().trim().describe(ORGANIZATIONS.LIST_USER_MEMBERSHIPS.organizationId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
users: OrgMembershipsSchema.merge(
|
||||
z.object({
|
||||
@@ -82,7 +79,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
organizationId: z.string().trim().describe(ORGANIZATIONS.GET_PROJECTS.organizationId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
workspaces: z
|
||||
.object({
|
||||
@@ -185,7 +181,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
isActive: z.boolean().optional().describe(ORGANIZATIONS.UPDATE_USER_MEMBERSHIP.isActive)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
membership: OrgMembershipsSchema
|
||||
})
|
||||
@@ -225,7 +220,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
membershipId: z.string().trim().describe(ORGANIZATIONS.DELETE_USER_MEMBERSHIP.membershipId)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
membership: OrgMembershipsSchema
|
||||
})
|
||||
|
||||
@@ -7,8 +7,6 @@ import { writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerProjectMembershipRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
method: "POST",
|
||||
@@ -32,7 +30,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
||||
roleSlugs: z.string().array().optional().describe(PROJECT_USERS.INVITE_MEMBER.roleSlugs)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
memberships: ProjectMembershipsSchema.array()
|
||||
})
|
||||
@@ -95,7 +92,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
||||
usernames: z.string().array().default([]).describe(PROJECT_USERS.REMOVE_MEMBER.usernames)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
memberships: ProjectMembershipsSchema.array()
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ import { sanitizedCertificateTemplate } from "@app/services/certificate-template
|
||||
import { ProjectFilterType } from "@app/services/project/project-types";
|
||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
import { SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||
|
||||
const projectWithEnv = SanitizedProjectSchema.extend({
|
||||
_id: z.string(),
|
||||
@@ -172,7 +172,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
kmsKeyId: z.string().optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
project: projectWithEnv
|
||||
})
|
||||
@@ -222,7 +221,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
slug: slugSchema.describe("The slug of the project to delete.")
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: SanitizedProjectSchema
|
||||
}
|
||||
},
|
||||
@@ -378,7 +376,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
limit: z.coerce.number().min(1).max(100).default(25).describe(PROJECTS.LIST_CERTIFICATES.limit)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
certificates: z.array(CertificatesSchema),
|
||||
totalCount: z.number()
|
||||
|
||||
@@ -7,7 +7,7 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { DefaultResponseErrorsSchema, sanitizedServiceTokenUserSchema } from "../sanitizedSchemas";
|
||||
import { sanitizedServiceTokenUserSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const sanitizedServiceTokenSchema = ServiceTokensSchema.omit({
|
||||
secretHash: true,
|
||||
@@ -32,7 +32,6 @@ export const registerServiceTokenRouter = async (server: FastifyZodProvider) =>
|
||||
}
|
||||
],
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: ServiceTokensSchema.merge(
|
||||
z.object({
|
||||
workspace: z.string(),
|
||||
|
||||
@@ -21,7 +21,7 @@ import { ProjectFilterType } from "@app/services/project/project-types";
|
||||
import { SecretOperations, SecretProtectionType } from "@app/services/secret/secret-types";
|
||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||
|
||||
import { DefaultResponseErrorsSchema, secretRawSchema } from "../sanitizedSchemas";
|
||||
import { secretRawSchema } from "../sanitizedSchemas";
|
||||
|
||||
export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
server.route({
|
||||
@@ -53,7 +53,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
tagSlugs: z.string().array().min(1).describe(SECRETS.ATTACH_TAGS.tagSlugs)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||
z.object({
|
||||
@@ -117,7 +116,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
tagSlugs: z.string().array().min(1).describe(SECRETS.DETACH_TAGS.tagSlugs)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).extend({
|
||||
tags: SecretTagsSchema.pick({
|
||||
@@ -191,7 +189,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.transform((el) => (el ? el.split(",").map((i) => i.trim()) : []))
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secrets: secretRawSchema
|
||||
.extend({
|
||||
@@ -215,8 +212,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
})
|
||||
.array()
|
||||
.optional()
|
||||
}),
|
||||
...DefaultResponseErrorsSchema
|
||||
})
|
||||
}
|
||||
},
|
||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.API_KEY, AuthMode.SERVICE_TOKEN, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||
@@ -331,7 +327,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.describe(RAW_SECRETS.GET.includeImports)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secret: secretRawSchema.extend({
|
||||
tags: SecretTagsSchema.pick({
|
||||
@@ -454,7 +449,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
secretReminderNote: z.string().optional().nullable().describe(RAW_SECRETS.CREATE.secretReminderNote)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secret: secretRawSchema
|
||||
@@ -562,7 +556,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
secretComment: z.string().optional().describe(RAW_SECRETS.UPDATE.secretComment)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secret: secretRawSchema
|
||||
@@ -656,7 +649,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
type: z.nativeEnum(SecretType).default(SecretType.Shared).describe(RAW_SECRETS.DELETE.type)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secret: secretRawSchema
|
||||
@@ -736,7 +728,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.transform((value) => value === "true")
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secrets: SecretsSchema.omit({ secretBlindIndex: true })
|
||||
.extend({
|
||||
@@ -852,7 +843,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.transform((value) => value === "true")
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||
z.object({
|
||||
@@ -940,7 +930,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
secretName: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||
@@ -1118,7 +1107,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
metadata: z.record(z.string()).optional()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||
@@ -1290,7 +1278,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
environment: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||
@@ -1414,7 +1401,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
shouldOverwrite: z.boolean().default(false)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
isSourceUpdated: z.boolean(),
|
||||
isDestinationUpdated: z.boolean()
|
||||
@@ -1483,7 +1469,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
||||
@@ -1611,7 +1596,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
||||
@@ -1727,7 +1711,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
||||
@@ -1861,7 +1844,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secrets: secretRawSchema.array()
|
||||
@@ -1968,7 +1950,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secrets: secretRawSchema.array()
|
||||
@@ -2061,7 +2042,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
.min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.union([
|
||||
z.object({
|
||||
secrets: secretRawSchema.array()
|
||||
@@ -2139,7 +2119,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||
projectId: z.string().trim().min(1)
|
||||
}),
|
||||
response: {
|
||||
...DefaultResponseErrorsSchema,
|
||||
200: z.object({
|
||||
message: z.string()
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Infisical",
|
||||
"openapi": "http://localhost:8080/api/docs/json",
|
||||
"openapi": "https://app.infisical.com/api/docs/json",
|
||||
"logo": {
|
||||
"dark": "/logo/dark.svg",
|
||||
"light": "/logo/light.svg",
|
||||
|
||||
Reference in New Issue
Block a user