Skip to content

Commit

Permalink
fix: Expose endpoint to store json schema (#218)
Browse files Browse the repository at this point in the history
- Exposes `PUT /clusters/:culsterId/services/:serviceName/schema`
  • Loading branch information
nadeesha authored Apr 25, 2024
1 parent e4fae56 commit 81cc21a
Show file tree
Hide file tree
Showing 22 changed files with 2,801 additions and 80 deletions.
132 changes: 110 additions & 22 deletions admin/client/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,22 @@ export const definition = {
body: z.object({
targetFn: z.string(),
targetArgs: z.string(),
service: z.string().default("unknown"),
cacheKey: z.string().optional(),
service: z.string(),
callConfig: z
.object({
cache: z
.object({
key: z.string(),
ttlSeconds: z.number(),
})
.optional(),
retryCountOnStall: z.number(),
predictiveRetriesOnRejection: z.boolean(),
timeoutSeconds: z.number(),
executionId: z.string().optional(),
background: z.boolean().default(false),
})
.optional(),
}),
},
getJobStatus: {
Expand Down Expand Up @@ -402,26 +416,6 @@ export const definition = {
}),
},
},
getDeployment: {
method: "GET",
path: "/clusters/:clusterId/service/:serviceName/deployments/:deploymentId",
headers: z.object({
authorization: z.string(),
}),
body: z.undefined(),
responses: {
401: z.undefined(),
404: z.undefined(),
200: z.object({
id: z.string(),
status: z.enum(["uploading", "active", "inactive", "failed"]),
clusterId: z.string(),
service: z.string(),
provider: z.string(),
createdAt: z.date(),
}),
},
},
getDeployments: {
method: "GET",
path: "/clusters/:clusterId/service/:serviceName/deployments",
Expand Down Expand Up @@ -467,6 +461,32 @@ export const definition = {
}),
},
},
getDeploymentLogs: {
method: "GET",
path: "/clusters/:clusterId/service/:serviceName/deployments/:deploymentId/logs",
headers: z.object({
authorization: z.string(),
}),
query: z.object({
next: z.string().optional(),
filter: z.string().optional(),
start: z.coerce.date().optional(),
end: z.coerce.date().optional(),
}),
body: z.undefined(),
responses: {
401: z.undefined(),
404: z.undefined(),
200: z.object({
events: z.array(
z.object({
message: z.string(),
}),
),
next: z.string().optional(),
}),
},
},
createClientLibraryVersion: {
method: "POST",
path: "/clusters/:clusterId/client-libraries",
Expand Down Expand Up @@ -604,6 +624,74 @@ export const definition = {
400: z.undefined(),
},
},
createOrUpdateClusterAccessPoint: {
method: "PUT",
path: "/clusters/:clusterId/access-point/:name",
headers: z.object({
authorization: z.string(),
}),
body: z.object({
allowedServices: z.string(),
}),
responses: {
200: z.object({
token: z.string(),
}),
401: z.undefined(),
404: z.undefined(),
},
},
deleteClusterAccessPoint: {
method: "DELETE",
path: "/clusters/:clusterId/access-point/:name",
headers: z.object({
authorization: z.string(),
}),
body: z.undefined(),
responses: {
204: z.undefined(),
401: z.undefined(),
404: z.undefined(),
},
},
executeJobSync: {
method: "POST",
path: "/clusters/:clusterId/execute",
headers: z.object({
authorization: z.string(),
}),
body: z.object({
service: z.string(),
function: z.string(),
args: z.array(z.any()),
}),
responses: {
401: z.undefined(),
404: z.undefined(),
200: z.object({
resultType: z.string(),
result: z.any(),
status: z.string(),
}),
500: z.object({
error: z.string(),
}),
},
},
storeJsonSchema: {
method: "PUT",
path: "/clusters/:clusterId/service/:serviceName/schema",
headers: z.object({
authorization: z.string(),
}),
body: z.object({
jsonSchema: z.any(),
}),
responses: {
204: z.undefined(),
401: z.undefined(),
},
},
} as const;

export const contract = c.router(definition);
Loading

0 comments on commit 81cc21a

Please sign in to comment.