Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 52 additions & 12 deletions packages/api/src/generated/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2421,11 +2421,7 @@ export const V1GetJitAccessConfigOutput = Schema.Union(
}),
Schema.Struct({
state: Schema.Literal("unavailable"),
unavailableReason: Schema.Literals([
"manual_migration_required",
"postgres_upgrade_required",
"temporarily_unavailable",
]),
unavailableReason: Schema.Literals(["postgres_upgrade_required", "temporarily_unavailable"]),
}),
],
{ mode: "oneOf" },
Expand Down Expand Up @@ -3112,6 +3108,39 @@ export const V1GetProjectLogsOutput = Schema.Struct({
),
),
});
export const V1GetProjectLogsAllInput = Schema.Struct({
ref: Schema.String.check(Schema.isMinLength(20))
.check(Schema.isMaxLength(20))
.check(Schema.isPattern(new RegExp("^[a-z]+$"))),
sql: Schema.optionalKey(Schema.String),
iso_timestamp_start: Schema.optionalKey(Schema.String.annotate({ format: "date-time" })),
iso_timestamp_end: Schema.optionalKey(Schema.String.annotate({ format: "date-time" })),
});
export const V1GetProjectLogsAllOutput = Schema.Struct({
result: Schema.optionalKey(Schema.Array(Schema.Unknown)),
error: Schema.optionalKey(
Schema.Union(
[
Schema.String,
Schema.Struct({
code: Schema.Number.check(Schema.isFinite()),
errors: Schema.Array(
Schema.Struct({
domain: Schema.String,
location: Schema.String,
locationType: Schema.String,
message: Schema.String,
reason: Schema.String,
}),
),
message: Schema.String,
status: Schema.String,
}),
],
{ mode: "oneOf" },
),
),
});
export const V1GetProjectPgbouncerConfigInput = Schema.Struct({
ref: Schema.String.check(Schema.isMinLength(20))
.check(Schema.isMaxLength(20))
Expand Down Expand Up @@ -5510,11 +5539,7 @@ export const V1UpdateJitAccessConfigOutput = Schema.Union(
}),
Schema.Struct({
state: Schema.Literal("unavailable"),
unavailableReason: Schema.Literals([
"manual_migration_required",
"postgres_upgrade_required",
"temporarily_unavailable",
]),
unavailableReason: Schema.Literals(["postgres_upgrade_required", "temporarily_unavailable"]),
}),
],
{ mode: "oneOf" },
Expand Down Expand Up @@ -6151,6 +6176,7 @@ export const openApiOperationIdMap = {
"v1-get-project-function-combined-stats": "v1GetProjectFunctionCombinedStats",
"v1-get-project-legacy-api-keys": "v1GetProjectLegacyApiKeys",
"v1-get-project-logs": "v1GetProjectLogs",
"v1-get-project-logs-all": "v1GetProjectLogsAll",
"v1-get-project-pgbouncer-config": "v1GetProjectPgbouncerConfig",
"v1-get-project-signing-key": "v1GetProjectSigningKey",
"v1-get-project-signing-keys": "v1GetProjectSigningKeys",
Expand Down Expand Up @@ -7456,9 +7482,9 @@ export const operationDefinitions = {
v1GetProjectLogs: {
id: "v1GetProjectLogs",
description:
"Executes a SQL query on the project's logs.\n\nEither the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided.\nIf both are not provided, only the last 1 minute of logs will be queried.\nThe timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.\n\nNote: Unless the `sql` parameter is provided, only edge_logs will be queried. See the [log query docs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer:~:text=logs%20from%20the-,Sources,-drop%2Ddown%3A) for all available sources.",
"Executes an SQL or LQL query on the project's unified logs stream.\n\nEither the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided.\nIf both are not provided, only the last 1 minute of logs will be queried.\nThe timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.\n\nFilter by the `source` column to specify specific log sources, such as edge_logs, postgres_logs, etc.\n\nNote: SQL must be written in **ClickHouse SQL dialect**.",
method: "GET",
path: "/v1/projects/{ref}/analytics/endpoints/logs.all",
path: "/v1/projects/{ref}/analytics/endpoints/logs",
pathParams: ["ref"],
queryParams: ["sql", "iso_timestamp_start", "iso_timestamp_end"],
headerParams: [],
Expand All @@ -7467,6 +7493,20 @@ export const operationDefinitions = {
inputSchema: V1GetProjectLogsInput,
outputSchema: V1GetProjectLogsOutput,
},
v1GetProjectLogsAll: {
id: "v1GetProjectLogsAll",
description:
"Executes a SQL query on the project's logs.\n\nEither the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided.\nIf both are not provided, only the last 1 minute of logs will be queried.\nThe timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.\n\nNote: Unless the `sql` parameter is provided, only edge_logs will be queried. See the [log query docs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer:~:text=logs%20from%20the-,Sources,-drop%2Ddown%3A) for all available sources.",
method: "GET",
path: "/v1/projects/{ref}/analytics/endpoints/logs.all",
pathParams: ["ref"],
queryParams: ["sql", "iso_timestamp_start", "iso_timestamp_end"],
headerParams: [],
requestBody: { kind: "none" },
response: { kind: "json" },
inputSchema: V1GetProjectLogsAllInput,
outputSchema: V1GetProjectLogsAllOutput,
},
v1GetProjectPgbouncerConfig: {
id: "v1GetProjectPgbouncerConfig",
description: "Get project's pgbouncer config",
Expand Down
18 changes: 18 additions & 0 deletions packages/api/src/generated/effect-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,20 @@ export const versionedEffectOperations = {
input,
);
}),
getProjectLogsAll: (
input: typeof operationDefinitions.v1GetProjectLogsAll.inputSchema.Type,
): Effect.Effect<
typeof operationDefinitions.v1GetProjectLogsAll.outputSchema.Type,
SupabaseApiError,
SupabaseApiClient
> =>
Effect.gen(function* () {
const client = yield* SupabaseApiClient;
return yield* client.execute<"v1GetProjectLogsAll">(
operationDefinitions.v1GetProjectLogsAll,
input,
);
}),
getProjectPgbouncerConfig: (
input: typeof operationDefinitions.v1GetProjectPgbouncerConfig.inputSchema.Type,
): Effect.Effect<
Expand Down Expand Up @@ -2671,6 +2685,10 @@ export function executeApiClientOperation(
return Schema.decodeUnknownEffect(operationDefinitions.v1GetProjectLogs.inputSchema)(
input,
).pipe(Effect.flatMap((decoded) => api.v1.getProjectLogs(decoded)));
case "v1GetProjectLogsAll":
return Schema.decodeUnknownEffect(operationDefinitions.v1GetProjectLogsAll.inputSchema)(
input,
).pipe(Effect.flatMap((decoded) => api.v1.getProjectLogsAll(decoded)));
case "v1GetProjectPgbouncerConfig":
return Schema.decodeUnknownEffect(
operationDefinitions.v1GetProjectPgbouncerConfig.inputSchema,
Expand Down
107 changes: 100 additions & 7 deletions packages/api/src/generated/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6671,8 +6671,9 @@
},
"/v1/projects/{ref}/analytics/endpoints/logs.all": {
"get": {
"description": "Executes a SQL query on the project's logs.\n\nEither the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided.\nIf both are not provided, only the last 1 minute of logs will be queried.\nThe timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.\n\nNote: Unless the `sql` parameter is provided, only edge_logs will be queried. See the [log query docs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer:~:text=logs%20from%20the-,Sources,-drop%2Ddown%3A) for all available sources. \n",
"operationId": "v1-get-project-logs",
"deprecated": true,
"description": "Executes a SQL query on the project's logs.\n\nEither the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided.\nIf both are not provided, only the last 1 minute of logs will be queried.\nThe timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.\n\nNote: Unless the `sql` parameter is provided, only edge_logs will be queried. See the [log query docs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer:~:text=logs%20from%20the-,Sources,-drop%2Ddown%3A) for all available sources.\n",
"operationId": "v1-get-project-logs-all",
"parameters": [
{
"name": "ref",
Expand Down Expand Up @@ -6731,6 +6732,9 @@
"401": {
"description": "Unauthorized"
},
"402": {
"description": "Usage exceeded. Enable additional usage to continue querying"
},
"403": {
"description": "Forbidden action"
},
Expand Down Expand Up @@ -6758,6 +6762,99 @@
"x-oauth-scope": "analytics:read"
}
},
"/v1/projects/{ref}/analytics/endpoints/logs": {
"get": {
"deprecated": false,
"description": "Executes an SQL or LQL query on the project's unified logs stream.\n\nEither the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided.\nIf both are not provided, only the last 1 minute of logs will be queried.\nThe timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.\n\nFilter by the `source` column to specify specific log sources, such as edge_logs, postgres_logs, etc.\n\nNote: SQL must be written in **ClickHouse SQL dialect**.\n",
"operationId": "v1-get-project-logs",
"parameters": [
{
"name": "ref",
"required": true,
"in": "path",
"description": "Project ref",
"schema": {
"minLength": 20,
"maxLength": 20,
"pattern": "^[a-z]+$",
"example": "abcdefghijklmnopqrst",
"type": "string"
}
},
{
"name": "sql",
"required": false,
"in": "query",
"description": "Custom SQL query to execute on the logs. See [querying logs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer) for more details.",
"schema": {
"type": "string"
}
},
{
"name": "iso_timestamp_start",
"required": false,
"in": "query",
"schema": {
"format": "date-time",
"example": "2025-03-01T00:00:00Z",
"type": "string"
}
},
{
"name": "iso_timestamp_end",
"required": false,
"in": "query",
"schema": {
"format": "date-time",
"example": "2025-03-01T23:59:59Z",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnalyticsResponse"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"402": {
"description": "Usage exceeded. Enable additional usage to continue querying"
},
"403": {
"description": "Forbidden action"
},
"429": {
"description": "Rate limit exceeded"
}
},
"security": [
{
"bearer": []
},
{
"fga_permissions": ["analytics_logs_read"]
}
],
"summary": "Gets all project's logs in a single log stream",
"tags": ["Analytics"],
"x-badges": [
{
"name": "OAuth scope: analytics:read",
"position": "after"
}
],
"x-endpoint-owners": ["analytics"],
"x-oauth-scope": "analytics:read"
}
},
"/v1/projects/{ref}/analytics/endpoints/usage.api-counts": {
"get": {
"operationId": "v1-get-project-usage-api-count",
Expand Down Expand Up @@ -12921,11 +13018,7 @@
},
"unavailableReason": {
"type": "string",
"enum": [
"manual_migration_required",
"postgres_upgrade_required",
"temporarily_unavailable"
]
"enum": ["postgres_upgrade_required", "temporarily_unavailable"]
}
},
"required": ["state", "unavailableReason"]
Expand Down
Loading