From b33241b092840d2f6e007069e9bb1285e2d837b9 Mon Sep 17 00:00:00 2001 From: Saxon Fletcher Date: Mon, 14 Sep 2026 21:10:47 +1000 Subject: [PATCH] feat(api): add the v2 notebook endpoints to the generated client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pins the five `/v2/projects/{ref}/notebooks` routes into the OpenAPI overrides and regenerates the contracts, effect client, and spec snapshot so `list`/`get`/`create`/`update`/`delete` notebook operations are available as typed operations. supabase/infrastructure ships these routes ahead of the platform spec, so the override is an add paired with a remove that keeps it idempotent once the deployed spec carries them — at which point the whole block should be deleted rather than left masking upstream. Co-Authored-By: Claude Opus 5 --- packages/api/scripts/openapi-overrides.json | 1581 +++++++++++++++++- packages/api/src/generated/contracts.ts | 1396 ++++++++++++++++ packages/api/src/generated/effect-client.ts | 87 + packages/api/src/generated/openapi.json | 1623 ++++++++++++++++++- 4 files changed, 4648 insertions(+), 39 deletions(-) diff --git a/packages/api/scripts/openapi-overrides.json b/packages/api/scripts/openapi-overrides.json index b53de50a96..70e506286d 100644 --- a/packages/api/scripts/openapi-overrides.json +++ b/packages/api/scripts/openapi-overrides.json @@ -626,7 +626,7 @@ { "op": "remove", "path": "/paths/~1v2~1projects~1{ref}~1webhooks~1endpoints", - "$comment": "CLI-2157: the platform's v2 spec gives all 10 project-webhook operations the shared operationId \"allV2ProjectsByRefWebhooks\" (and all 10 org-webhook operations share \"allV2OrganizationsBySlugWebhooks\") — duplicated and not version-prefixed, which breaks codegen. Remove-if-present because staging's v2-json is currently served by two backend variants that disagree on whether these paths exist." + "$comment": "CLI-2157: the platform's v2 spec gives all 10 project-webhook operations the shared operationId \"allV2ProjectsByRefWebhooks\" (and all 10 org-webhook operations share \"allV2OrganizationsBySlugWebhooks\") \u2014 duplicated and not version-prefixed, which breaks codegen. Remove-if-present because staging's v2-json is currently served by two backend variants that disagree on whether these paths exist." }, { "op": "remove", @@ -656,7 +656,7 @@ { "op": "remove", "path": "/paths/~1v2~1organizations~1{slug}~1webhooks~1endpoints", - "$comment": "CLI-2157: the platform's v2 spec gives all 10 org-webhook operations the shared operationId \"allV2OrganizationsBySlugWebhooks\" (and all 10 project-webhook operations share \"allV2ProjectsByRefWebhooks\") — duplicated and not version-prefixed, which breaks codegen. Remove-if-present because staging's v2-json is currently served by two backend variants that disagree on whether these paths exist." + "$comment": "CLI-2157: the platform's v2 spec gives all 10 org-webhook operations the shared operationId \"allV2OrganizationsBySlugWebhooks\" (and all 10 project-webhook operations share \"allV2ProjectsByRefWebhooks\") \u2014 duplicated and not version-prefixed, which breaks codegen. Remove-if-present because staging's v2-json is currently served by two backend variants that disagree on whether these paths exist." }, { "op": "remove", @@ -723,5 +723,1582 @@ "description": "Postgres engine version. If not provided, the latest version will be used." }, "$comment": "CLI-2180: the public spec deliberately hides this field (upstream marks it deprecated/null) even though POST /v1/projects accepts it; enum mirrors CreateBranchBody.postgres_engine in the same spec." + }, + { + "op": "remove", + "path": "/paths/~1v2~1projects~1{ref}~1notebooks" + }, + { + "$comment": "supabase/infrastructure ships the v2 notebook routes ahead of the platform. Pinned here so `supabase notebooks push/pull` has a typed client; the paired remove keeps the add idempotent once the deployed spec carries them, at which point this whole block should be deleted rather than left masking upstream.", + "op": "add", + "path": "/paths/~1v2~1projects~1{ref}~1notebooks", + "value": { + "get": { + "description": "Returns a cursor-paginated list of the project notebooks. Notebook bodies are omitted \u2014 read a single notebook to get its cells.", + "operationId": "v2-list-notebooks", + "parameters": [ + { + "in": "query", + "name": "filter", + "required": false, + "schema": { + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "type": "object" + }, + "style": "deepObject" + }, + { + "in": "query", + "name": "page", + "required": false, + "schema": { + "properties": { + "after": { + "minLength": 1, + "type": "string" + }, + "before": { + "minLength": 1, + "type": "string" + }, + "size": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" + }, + "style": "deepObject" + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + }, + { + "in": "query", + "name": "sort", + "required": false, + "schema": { + "enum": ["-inserted_at", "-name", "inserted_at", "name"], + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2ListNotebooksResponse" + } + } + }, + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to retrieve project's notebooks" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "List notebooks of a project", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:read", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_read"]], + "x-oauth-scope": "database:read" + }, + "post": { + "description": "Creates a notebook shared with everyone who has access to the project. Cell ids are assigned by the server and returned in the response.", + "operationId": "v2-create-notebook", + "parameters": [ + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2CreateNotebookRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NotebookResponse" + } + } + }, + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to create notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Create a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:write", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_write"]], + "x-oauth-scope": "database:write" + } + } + }, + { + "op": "remove", + "path": "/paths/~1v2~1projects~1{ref}~1notebooks~1{id}" + }, + { + "op": "add", + "path": "/paths/~1v2~1projects~1{ref}~1notebooks~1{id}", + "value": { + "delete": { + "operationId": "v2-delete-notebook", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "44444444-4444-4444-8444-444444444444", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Notebook not found" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to delete notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Delete a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:write", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_write"]], + "x-oauth-scope": "database:write" + }, + "get": { + "operationId": "v2-get-notebook", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "44444444-4444-4444-8444-444444444444", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NotebookResponse" + } + } + }, + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Notebook not found" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to retrieve notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Get a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:read", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_read"]], + "x-oauth-scope": "database:read" + }, + "patch": { + "description": "Updates the attributes provided and leaves the rest untouched. Sending `content` replaces the whole notebook body.", + "operationId": "v2-update-notebook", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "44444444-4444-4444-8444-444444444444", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2UpdateNotebookRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NotebookResponse" + } + } + }, + "description": "" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "The request references a cell that does not exist on this notebook" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Notebook not found" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to update notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Update a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:write", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_write"]], + "x-oauth-scope": "database:write" + } + } + }, + { + "op": "remove", + "path": "/components/schemas/V2CreateNotebookRequest" + }, + { + "op": "add", + "path": "/components/schemas/V2CreateNotebookRequest", + "value": { + "properties": { + "data": { + "properties": { + "attributes": { + "properties": { + "content": { + "properties": { + "cells": { + "items": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": ["markdown"], + "type": "string" + } + }, + "required": ["text", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "database_identifier": { + "description": "Read replica to run against. Omit to use the primary database.", + "type": "string" + }, + "id": { + "type": "string" + }, + "row_limit": { + "default": 100, + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "sql": { + "description": "SQL run against the project database.", + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["database"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "sql": { + "description": "SQL run against the project logs.", + "type": "string" + }, + "time_range": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "end": { + "description": "ISO 8601 end of the range.", + "type": "string" + }, + "start": { + "description": "ISO 8601 start of the range.", + "type": "string" + }, + "type": { + "enum": ["absolute"], + "type": "string" + } + }, + "required": ["end", "start", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "amount": { + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "type": { + "enum": ["relative"], + "type": "string" + }, + "unit": { + "enum": ["day", "hour", "minute", "month", "week", "year"], + "type": "string" + } + }, + "required": ["amount", "type", "unit"], + "type": "object" + } + ] + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["log"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "time_range", "type"], + "type": "object" + } + ] + }, + "type": "array" + } + }, + "required": ["cells"], + "type": "object" + }, + "description": { + "maxLength": 10000, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "name": { + "maxLength": 255, + "minLength": 1, + "type": "string" + } + }, + "required": ["content", "name"], + "type": "object" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "type"], + "type": "object" + } + }, + "required": ["data"], + "type": "object" + } + }, + { + "op": "remove", + "path": "/components/schemas/V2ListNotebooksResponse" + }, + { + "op": "add", + "path": "/components/schemas/V2ListNotebooksResponse", + "value": { + "properties": { + "data": { + "items": { + "properties": { + "attributes": { + "additionalProperties": {}, + "properties": { + "description": { + "nullable": true, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "inserted_at": { + "type": "string" + }, + "name": { + "type": "string" + }, + "owner": { + "additionalProperties": {}, + "description": "User who created the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + }, + "updated_at": { + "type": "string" + }, + "updated_by": { + "additionalProperties": {}, + "description": "User who last wrote to the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + } + }, + "required": [ + "description", + "favorite", + "inserted_at", + "name", + "owner", + "updated_at", + "updated_by" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "id", "type"], + "type": "object" + }, + "type": "array" + }, + "links": { + "properties": { + "first": { + "description": "URL path to the first page if available.", + "example": "/v2/projects/{ref}/notebooks?page[size]=10", + "nullable": true, + "type": "string" + }, + "last": { + "description": "URL path to the last page if available.", + "example": "/v2/projects/{ref}/notebooks?page[size]=10&page[after]=019adf7d-4513-71ba-b264-21900edb4295", + "nullable": true, + "type": "string" + }, + "next": { + "description": "URL path to the next page.", + "example": "/v2/projects/{ref}/notebooks?page[size]=10&page[after]=019adf7d-4513-7062-b292-78b86cc470a4", + "nullable": true, + "type": "string" + }, + "prev": { + "description": "URL path to the previous page.", + "example": "/v2/projects/{ref}/notebooks?page[size]=10&page[before]=019adf7d-4513-74c5-bb9a-f1bc0f7a95d7", + "nullable": true, + "type": "string" + } + }, + "required": ["next", "prev"], + "type": "object" + } + }, + "required": ["data", "links"], + "type": "object" + } + }, + { + "op": "remove", + "path": "/components/schemas/V2NotebookResponse" + }, + { + "op": "add", + "path": "/components/schemas/V2NotebookResponse", + "value": { + "properties": { + "data": { + "properties": { + "attributes": { + "additionalProperties": {}, + "properties": { + "content": { + "additionalProperties": {}, + "properties": { + "cells": { + "items": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": ["markdown"], + "type": "string" + } + }, + "required": ["id", "text", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "database_identifier": { + "description": "Read replica to run against. Omit to use the primary database.", + "type": "string" + }, + "id": { + "type": "string" + }, + "row_limit": { + "default": 100, + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "sql": { + "description": "SQL run against the project database.", + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["database"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["id", "sql", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "sql": { + "description": "SQL run against the project logs.", + "type": "string" + }, + "time_range": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "end": { + "description": "ISO 8601 end of the range.", + "type": "string" + }, + "start": { + "description": "ISO 8601 start of the range.", + "type": "string" + }, + "type": { + "enum": ["absolute"], + "type": "string" + } + }, + "required": ["end", "start", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "amount": { + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "type": { + "enum": ["relative"], + "type": "string" + }, + "unit": { + "enum": ["day", "hour", "minute", "month", "week", "year"], + "type": "string" + } + }, + "required": ["amount", "type", "unit"], + "type": "object" + } + ] + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["log"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["id", "sql", "time_range", "type"], + "type": "object" + } + ] + }, + "type": "array" + }, + "schema_version": { + "type": "number" + } + }, + "required": ["cells", "schema_version"], + "type": "object" + }, + "description": { + "nullable": true, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "inserted_at": { + "type": "string" + }, + "name": { + "type": "string" + }, + "owner": { + "additionalProperties": {}, + "description": "User who created the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + }, + "updated_at": { + "type": "string" + }, + "updated_by": { + "additionalProperties": {}, + "description": "User who last wrote to the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + } + }, + "required": [ + "content", + "description", + "favorite", + "inserted_at", + "name", + "owner", + "updated_at", + "updated_by" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "id", "type"], + "type": "object" + } + }, + "required": ["data"], + "type": "object" + } + }, + { + "op": "remove", + "path": "/components/schemas/V2UpdateNotebookRequest" + }, + { + "op": "add", + "path": "/components/schemas/V2UpdateNotebookRequest", + "value": { + "properties": { + "data": { + "properties": { + "attributes": { + "properties": { + "content": { + "description": "Replaces the notebook body. A cell keeps its identity by echoing back its `id`; a cell sent without an `id` is added as a new one.", + "properties": { + "cells": { + "items": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": ["markdown"], + "type": "string" + } + }, + "required": ["text", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "database_identifier": { + "description": "Read replica to run against. Omit to use the primary database.", + "type": "string" + }, + "id": { + "type": "string" + }, + "row_limit": { + "default": 100, + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "sql": { + "description": "SQL run against the project database.", + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["database"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "sql": { + "description": "SQL run against the project logs.", + "type": "string" + }, + "time_range": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "end": { + "description": "ISO 8601 end of the range.", + "type": "string" + }, + "start": { + "description": "ISO 8601 start of the range.", + "type": "string" + }, + "type": { + "enum": ["absolute"], + "type": "string" + } + }, + "required": ["end", "start", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "amount": { + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "type": { + "enum": ["relative"], + "type": "string" + }, + "unit": { + "enum": ["day", "hour", "minute", "month", "week", "year"], + "type": "string" + } + }, + "required": ["amount", "type", "unit"], + "type": "object" + } + ] + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["log"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "time_range", "type"], + "type": "object" + } + ] + }, + "type": "array" + } + }, + "required": ["cells"], + "type": "object" + }, + "description": { + "maxLength": 10000, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "name": { + "maxLength": 255, + "minLength": 1, + "type": "string" + } + }, + "type": "object" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "type"], + "type": "object" + } + }, + "required": ["data"], + "type": "object" + } } ] diff --git a/packages/api/src/generated/contracts.ts b/packages/api/src/generated/contracts.ts index 7cdccda519..e208c25f1c 100644 --- a/packages/api/src/generated/contracts.ts +++ b/packages/api/src/generated/contracts.ts @@ -10186,6 +10186,454 @@ export const V2CreateLogDrainOutput = Schema.Struct({ }), }), }); +export const V2CreateNotebookInput = Schema.Struct({ + ref: Schema.String.check( + Schema.isMinLength(20).annotate({ expected: "a value with a length of at least 20" }), + ) + .check(Schema.isMaxLength(20).annotate({ expected: "a value with a length of at most 20" })) + .check( + Schema.isPattern(new RegExp("^[a-z]+$")).annotate({ + expected: "a string matching the RegExp ^[a-z]+$", + }), + ), + data: Schema.Struct({ + attributes: Schema.Struct({ + content: Schema.Struct({ + cells: Schema.Array( + Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.optionalKey(Schema.String), + text: Schema.String, + type: Schema.Literal("markdown"), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: "Chart configuration, retained even while `view` is `table`.", + }), + ), + database_identifier: Schema.optionalKey( + Schema.String.annotate({ + description: "Read replica to run against. Omit to use the primary database.", + }), + ), + id: Schema.optionalKey(Schema.String), + row_limit: Schema.optionalKey( + Schema.Number.check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" }), + ), + ), + sql: Schema.String.annotate({ + description: "SQL run against the project database.", + }), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("database"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: "Chart configuration, retained even while `view` is `table`.", + }), + ), + id: Schema.optionalKey(Schema.String), + sql: Schema.String.annotate({ description: "SQL run against the project logs." }), + time_range: Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + end: Schema.String.annotate({ + description: "ISO 8601 end of the range.", + }), + start: Schema.String.annotate({ + description: "ISO 8601 start of the range.", + }), + type: Schema.Literal("absolute"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + amount: Schema.Number.check( + Schema.isInt().annotate({ expected: "an integer" }), + ) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + type: Schema.Literal("relative"), + unit: Schema.Literals(["day", "hour", "minute", "month", "week", "year"]), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("log"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + ], + { mode: "oneOf" }, + ), + ), + }), + description: Schema.optionalKey( + Schema.String.check( + Schema.isMaxLength(10000).annotate({ + expected: "a value with a length of at most 10000", + }), + ), + ), + favorite: Schema.optionalKey(Schema.Boolean), + name: Schema.String.check( + Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), + ).check( + Schema.isMaxLength(255).annotate({ expected: "a value with a length of at most 255" }), + ), + }), + type: Schema.Literal("notebook").annotate({ description: "Resource type." }), + }), +}); +export const V2CreateNotebookOutput = Schema.Struct({ + data: Schema.Struct({ + attributes: Schema.StructWithRest( + Schema.Struct({ + content: Schema.StructWithRest( + Schema.Struct({ + cells: Schema.Array( + Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("markdown"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: + "Chart configuration, retained even while `view` is `table`.", + }), + ), + database_identifier: Schema.optionalKey( + Schema.String.annotate({ + description: + "Read replica to run against. Omit to use the primary database.", + }), + ), + id: Schema.String, + row_limit: Schema.optionalKey( + Schema.Number.check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + ), + sql: Schema.String.annotate({ + description: "SQL run against the project database.", + }), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("database"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: + "Chart configuration, retained even while `view` is `table`.", + }), + ), + id: Schema.String, + sql: Schema.String.annotate({ + description: "SQL run against the project logs.", + }), + time_range: Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + end: Schema.String.annotate({ + description: "ISO 8601 end of the range.", + }), + start: Schema.String.annotate({ + description: "ISO 8601 start of the range.", + }), + type: Schema.Literal("absolute"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + amount: Schema.Number.check( + Schema.isInt().annotate({ expected: "an integer" }), + ) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + type: Schema.Literal("relative"), + unit: Schema.Literals([ + "day", + "hour", + "minute", + "month", + "week", + "year", + ]), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("log"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + ), + schema_version: Schema.Number.check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + description: Schema.Union([Schema.String, Schema.Null]), + favorite: Schema.Boolean, + inserted_at: Schema.String, + name: Schema.String, + owner: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check(Schema.isFinite().annotate({ expected: "a finite number" })), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who created the notebook." }), + Schema.Null, + ]), + updated_at: Schema.String, + updated_by: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check(Schema.isFinite().annotate({ expected: "a finite number" })), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who last wrote to the notebook." }), + Schema.Null, + ]), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + id: Schema.String, + type: Schema.Literal("notebook").annotate({ description: "Resource type." }), + }), +}); export const V2CreateOrganizationInvitationsInput = Schema.Struct({ slug: Schema.String.check( Schema.isPattern(new RegExp("^[\\w-]+$")).annotate({ @@ -10499,6 +10947,27 @@ export const V2DeleteLogDrainInput = Schema.Struct({ }), ), }); +export const V2DeleteNotebookInput = Schema.Struct({ + id: Schema.String.annotate({ format: "uuid" }).check( + Schema.isPattern( + new RegExp( + "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + ), + ).annotate({ + expected: + "a string matching the RegExp ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + }), + ), + ref: Schema.String.check( + Schema.isMinLength(20).annotate({ expected: "a value with a length of at least 20" }), + ) + .check(Schema.isMaxLength(20).annotate({ expected: "a value with a length of at most 20" })) + .check( + Schema.isPattern(new RegExp("^[a-z]+$")).annotate({ + expected: "a string matching the RegExp ^[a-z]+$", + }), + ), +}); export const V2DeleteOrganizationInvitationsInput = Schema.Struct({ slug: Schema.String.check( Schema.isPattern(new RegExp("^[\\w-]+$")).annotate({ @@ -10790,6 +11259,272 @@ export const V2GetAWorkerOutput = Schema.Struct({ }), }), }); +export const V2GetNotebookInput = Schema.Struct({ + id: Schema.String.annotate({ format: "uuid" }).check( + Schema.isPattern( + new RegExp( + "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + ), + ).annotate({ + expected: + "a string matching the RegExp ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + }), + ), + ref: Schema.String.check( + Schema.isMinLength(20).annotate({ expected: "a value with a length of at least 20" }), + ) + .check(Schema.isMaxLength(20).annotate({ expected: "a value with a length of at most 20" })) + .check( + Schema.isPattern(new RegExp("^[a-z]+$")).annotate({ + expected: "a string matching the RegExp ^[a-z]+$", + }), + ), +}); +export const V2GetNotebookOutput = Schema.Struct({ + data: Schema.Struct({ + attributes: Schema.StructWithRest( + Schema.Struct({ + content: Schema.StructWithRest( + Schema.Struct({ + cells: Schema.Array( + Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("markdown"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: + "Chart configuration, retained even while `view` is `table`.", + }), + ), + database_identifier: Schema.optionalKey( + Schema.String.annotate({ + description: + "Read replica to run against. Omit to use the primary database.", + }), + ), + id: Schema.String, + row_limit: Schema.optionalKey( + Schema.Number.check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + ), + sql: Schema.String.annotate({ + description: "SQL run against the project database.", + }), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("database"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: + "Chart configuration, retained even while `view` is `table`.", + }), + ), + id: Schema.String, + sql: Schema.String.annotate({ + description: "SQL run against the project logs.", + }), + time_range: Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + end: Schema.String.annotate({ + description: "ISO 8601 end of the range.", + }), + start: Schema.String.annotate({ + description: "ISO 8601 start of the range.", + }), + type: Schema.Literal("absolute"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + amount: Schema.Number.check( + Schema.isInt().annotate({ expected: "an integer" }), + ) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + type: Schema.Literal("relative"), + unit: Schema.Literals([ + "day", + "hour", + "minute", + "month", + "week", + "year", + ]), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("log"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + ), + schema_version: Schema.Number.check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + description: Schema.Union([Schema.String, Schema.Null]), + favorite: Schema.Boolean, + inserted_at: Schema.String, + name: Schema.String, + owner: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check(Schema.isFinite().annotate({ expected: "a finite number" })), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who created the notebook." }), + Schema.Null, + ]), + updated_at: Schema.String, + updated_by: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check(Schema.isFinite().annotate({ expected: "a finite number" })), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who last wrote to the notebook." }), + Schema.Null, + ]), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + id: Schema.String, + type: Schema.Literal("notebook").annotate({ description: "Resource type." }), + }), +}); export const V2GetProjectConfigInput = Schema.Struct({ ref: Schema.String.check( Schema.isMinLength(20).annotate({ expected: "a value with a length of at least 20" }), @@ -11601,6 +12336,118 @@ export const V2ListLogDrainsOutput = Schema.Struct({ }), ), }); +export const V2ListNotebooksInput = Schema.Struct({ + filter: Schema.optionalKey( + Schema.Struct({ + name: Schema.optionalKey( + Schema.String.check( + Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), + ), + ), + }), + ), + page: Schema.optionalKey( + Schema.Struct({ + after: Schema.optionalKey( + Schema.String.check( + Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), + ), + ), + before: Schema.optionalKey( + Schema.String.check( + Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), + ), + ), + size: Schema.optionalKey( + Schema.Number.check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isGreaterThanOrEqualTo(1).annotate({ + expected: "a value greater than or equal to 1", + }), + ) + .check( + Schema.isLessThanOrEqualTo(100).annotate({ + expected: "a value less than or equal to 100", + }), + ), + ), + }), + ), + ref: Schema.String.check( + Schema.isMinLength(20).annotate({ expected: "a value with a length of at least 20" }), + ) + .check(Schema.isMaxLength(20).annotate({ expected: "a value with a length of at most 20" })) + .check( + Schema.isPattern(new RegExp("^[a-z]+$")).annotate({ + expected: "a string matching the RegExp ^[a-z]+$", + }), + ), + sort: Schema.optionalKey(Schema.Literals(["-inserted_at", "-name", "inserted_at", "name"])), +}); +export const V2ListNotebooksOutput = Schema.Struct({ + data: Schema.Array( + Schema.Struct({ + attributes: Schema.StructWithRest( + Schema.Struct({ + description: Schema.Union([Schema.String, Schema.Null]), + favorite: Schema.Boolean, + inserted_at: Schema.String, + name: Schema.String, + owner: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who created the notebook." }), + Schema.Null, + ]), + updated_at: Schema.String, + updated_by: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who last wrote to the notebook." }), + Schema.Null, + ]), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + id: Schema.String, + type: Schema.Literal("notebook").annotate({ description: "Resource type." }), + }), + ), + links: Schema.Struct({ + first: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "URL path to the first page if available." }), + Schema.Null, + ]), + ), + last: Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ description: "URL path to the last page if available." }), + Schema.Null, + ]), + ), + next: Schema.Union([ + Schema.String.annotate({ description: "URL path to the next page." }), + Schema.Null, + ]), + prev: Schema.Union([ + Schema.String.annotate({ description: "URL path to the previous page." }), + Schema.Null, + ]), + }), +}); export const V2ListOrganizationGithubConnectionsInput = Schema.Struct({ slug: Schema.String.check( Schema.isPattern(new RegExp("^[\\w-]+$")).annotate({ @@ -12568,6 +13415,481 @@ export const V2UpdateLogDrainOutput = Schema.Struct({ }), }), }); +export const V2UpdateNotebookInput = Schema.Struct({ + id: Schema.String.annotate({ format: "uuid" }).check( + Schema.isPattern( + new RegExp( + "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + ), + ).annotate({ + expected: + "a string matching the RegExp ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + }), + ), + ref: Schema.String.check( + Schema.isMinLength(20).annotate({ expected: "a value with a length of at least 20" }), + ) + .check(Schema.isMaxLength(20).annotate({ expected: "a value with a length of at most 20" })) + .check( + Schema.isPattern(new RegExp("^[a-z]+$")).annotate({ + expected: "a string matching the RegExp ^[a-z]+$", + }), + ), + data: Schema.Struct({ + attributes: Schema.Struct({ + content: Schema.optionalKey( + Schema.Struct({ + cells: Schema.Array( + Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.optionalKey(Schema.String), + text: Schema.String, + type: Schema.Literal("markdown"), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: "Chart configuration, retained even while `view` is `table`.", + }), + ), + database_identifier: Schema.optionalKey( + Schema.String.annotate({ + description: + "Read replica to run against. Omit to use the primary database.", + }), + ), + id: Schema.optionalKey(Schema.String), + row_limit: Schema.optionalKey( + Schema.Number.check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ expected: "a value greater than 0" }), + ), + ), + sql: Schema.String.annotate({ + description: "SQL run against the project database.", + }), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("database"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: "Chart configuration, retained even while `view` is `table`.", + }), + ), + id: Schema.optionalKey(Schema.String), + sql: Schema.String.annotate({ + description: "SQL run against the project logs.", + }), + time_range: Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + end: Schema.String.annotate({ + description: "ISO 8601 end of the range.", + }), + start: Schema.String.annotate({ + description: "ISO 8601 start of the range.", + }), + type: Schema.Literal("absolute"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + amount: Schema.Number.check( + Schema.isInt().annotate({ expected: "an integer" }), + ) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + type: Schema.Literal("relative"), + unit: Schema.Literals([ + "day", + "hour", + "minute", + "month", + "week", + "year", + ]), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("log"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + ], + { mode: "oneOf" }, + ), + ), + }).annotate({ + description: + "Replaces the notebook body. A cell keeps its identity by echoing back its `id`; a cell sent without an `id` is added as a new one.", + }), + ), + description: Schema.optionalKey( + Schema.String.check( + Schema.isMaxLength(10000).annotate({ + expected: "a value with a length of at most 10000", + }), + ), + ), + favorite: Schema.optionalKey(Schema.Boolean), + name: Schema.optionalKey( + Schema.String.check( + Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" }), + ).check( + Schema.isMaxLength(255).annotate({ expected: "a value with a length of at most 255" }), + ), + ), + }), + type: Schema.Literal("notebook").annotate({ description: "Resource type." }), + }), +}); +export const V2UpdateNotebookOutput = Schema.Struct({ + data: Schema.Struct({ + attributes: Schema.StructWithRest( + Schema.Struct({ + content: Schema.StructWithRest( + Schema.Struct({ + cells: Schema.Array( + Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.String, + text: Schema.String, + type: Schema.Literal("markdown"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: + "Chart configuration, retained even while `view` is `table`.", + }), + ), + database_identifier: Schema.optionalKey( + Schema.String.annotate({ + description: + "Read replica to run against. Omit to use the primary database.", + }), + ), + id: Schema.String, + row_limit: Schema.optionalKey( + Schema.Number.check(Schema.isInt().annotate({ expected: "an integer" })) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + ), + sql: Schema.String.annotate({ + description: "SQL run against the project database.", + }), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("database"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + chart: Schema.optionalKey( + Schema.StructWithRest( + Schema.Struct({ + cumulative: Schema.Boolean, + scale: Schema.Literals(["linear", "log"]), + show_labels: Schema.Boolean, + type: Schema.Literals(["bar", "line"]), + x_column: Schema.String.annotate({ + description: "Result column used for the x axis.", + }), + y_series: Schema.Array( + Schema.StructWithRest( + Schema.Struct({ + column: Schema.String.annotate({ + description: "Result column plotted as a series.", + }), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ).annotate({ + description: + "Chart configuration, retained even while `view` is `table`.", + }), + ), + id: Schema.String, + sql: Schema.String.annotate({ + description: "SQL run against the project logs.", + }), + time_range: Schema.Union( + [ + Schema.StructWithRest( + Schema.Struct({ + end: Schema.String.annotate({ + description: "ISO 8601 end of the range.", + }), + start: Schema.String.annotate({ + description: "ISO 8601 start of the range.", + }), + type: Schema.Literal("absolute"), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + Schema.StructWithRest( + Schema.Struct({ + amount: Schema.Number.check( + Schema.isInt().annotate({ expected: "an integer" }), + ) + .check( + Schema.isLessThanOrEqualTo(9007199254740991).annotate({ + expected: "a value less than or equal to 9007199254740991", + }), + ) + .check( + Schema.isGreaterThan(0).annotate({ + expected: "a value greater than 0", + }), + ), + type: Schema.Literal("relative"), + unit: Schema.Literals([ + "day", + "hour", + "minute", + "month", + "week", + "year", + ]), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + title: Schema.optionalKey(Schema.String), + type: Schema.Literal("log"), + view: Schema.optionalKey(Schema.Literals(["chart", "table"])), + }), + [ + Schema.Record( + Schema.String, + Schema.Json.annotate({ expected: "JSON value" }), + ), + ], + ), + ], + { mode: "oneOf" }, + ), + ), + schema_version: Schema.Number.check( + Schema.isFinite().annotate({ expected: "a finite number" }), + ), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + description: Schema.Union([Schema.String, Schema.Null]), + favorite: Schema.Boolean, + inserted_at: Schema.String, + name: Schema.String, + owner: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check(Schema.isFinite().annotate({ expected: "a finite number" })), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who created the notebook." }), + Schema.Null, + ]), + updated_at: Schema.String, + updated_by: Schema.Union([ + Schema.StructWithRest( + Schema.Struct({ + id: Schema.Number.check(Schema.isFinite().annotate({ expected: "a finite number" })), + username: Schema.String, + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ).annotate({ description: "User who last wrote to the notebook." }), + Schema.Null, + ]), + }), + [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))], + ), + id: Schema.String, + type: Schema.Literal("notebook").annotate({ description: "Resource type." }), + }), +}); export const V1ApplyAMigrationOutput = Schema.Void; export const V1ApplyProjectAddonOutput = Schema.Void; export const V1AuthorizeUserOutput = Schema.Void; @@ -12608,6 +13930,7 @@ export const V1UpdateStorageConfigOutput = Schema.Void; export const V1UpsertAMigrationOutput = Schema.Void; export const V2DeleteAWorkerOutput = Schema.Void; export const V2DeleteLogDrainOutput = Schema.Void; +export const V2DeleteNotebookOutput = Schema.Void; export const V2DeletePrivateLinkAssociationOutput = Schema.Void; export const V2DeletePrivateLinkAssociationForDatabaseOutput = Schema.Void; export const V2TransferAProjectOutput = Schema.Void; @@ -12785,19 +14108,23 @@ export const openApiOperationIdMap = { "v1-verify-dns-config": "v1VerifyDnsConfig", "v2-assign-organization-member-role": "v2AssignOrganizationMemberRole", "v2-create-log-drain": "v2CreateLogDrain", + "v2-create-notebook": "v2CreateNotebook", "v2-create-organization-invitations": "v2CreateOrganizationInvitations", "v2-create-private-link-association": "v2CreatePrivateLinkAssociation", "v2-create-worker-upload": "v2CreateWorkerUpload", "v2-delete-a-worker": "v2DeleteAWorker", "v2-delete-log-drain": "v2DeleteLogDrain", + "v2-delete-notebook": "v2DeleteNotebook", "v2-delete-organization-invitations": "v2DeleteOrganizationInvitations", "v2-delete-private-link-association": "v2DeletePrivateLinkAssociation", "v2-delete-private-link-association-for-database": "v2DeletePrivateLinkAssociationForDatabase", "v2-deploy-a-worker": "v2DeployAWorker", "v2-get-a-worker": "v2GetAWorker", + "v2-get-notebook": "v2GetNotebook", "v2-get-project-config": "v2GetProjectConfig", "v2-list-all-workers": "v2ListAllWorkers", "v2-list-log-drains": "v2ListLogDrains", + "v2-list-notebooks": "v2ListNotebooks", "v2-list-organization-github-connections": "v2ListOrganizationGithubConnections", "v2-list-organization-members": "v2ListOrganizationMembers", "v2-list-organization-projects": "v2ListOrganizationProjects", @@ -12807,6 +14134,7 @@ export const openApiOperationIdMap = { "v2-run-project-advisors": "v2RunProjectAdvisors", "v2-transfer-a-project": "v2TransferAProject", "v2-update-log-drain": "v2UpdateLogDrain", + "v2-update-notebook": "v2UpdateNotebook", } as const; export const operationDefinitions = { @@ -15546,6 +16874,20 @@ export const operationDefinitions = { inputSchema: V2CreateLogDrainInput, outputSchema: V2CreateLogDrainOutput, }, + v2CreateNotebook: { + id: "v2CreateNotebook", + description: + "Creates a notebook shared with everyone who has access to the project. Cell ids are assigned by the server and returned in the response.", + method: "POST", + path: "/v2/projects/{ref}/notebooks", + pathParams: ["ref"], + queryParams: [], + headerParams: [], + requestBody: { kind: "json", contentType: "application/json", fields: ["data"] }, + response: { kind: "json" }, + inputSchema: V2CreateNotebookInput, + outputSchema: V2CreateNotebookOutput, + }, v2CreateOrganizationInvitations: { id: "v2CreateOrganizationInvitations", description: @@ -15614,6 +16956,19 @@ export const operationDefinitions = { inputSchema: V2DeleteLogDrainInput, outputSchema: V2DeleteLogDrainOutput, }, + v2DeleteNotebook: { + id: "v2DeleteNotebook", + description: "Delete a notebook", + method: "DELETE", + path: "/v2/projects/{ref}/notebooks/{id}", + pathParams: ["id", "ref"], + queryParams: [], + headerParams: [], + requestBody: { kind: "none" }, + response: { kind: "void" }, + inputSchema: V2DeleteNotebookInput, + outputSchema: V2DeleteNotebookOutput, + }, v2DeleteOrganizationInvitations: { id: "v2DeleteOrganizationInvitations", description: "Bulk delete member invitations for an organization by email address.", @@ -15683,6 +17038,19 @@ export const operationDefinitions = { inputSchema: V2GetAWorkerInput, outputSchema: V2GetAWorkerOutput, }, + v2GetNotebook: { + id: "v2GetNotebook", + description: "Get a notebook", + method: "GET", + path: "/v2/projects/{ref}/notebooks/{id}", + pathParams: ["id", "ref"], + queryParams: [], + headerParams: [], + requestBody: { kind: "none" }, + response: { kind: "json" }, + inputSchema: V2GetNotebookInput, + outputSchema: V2GetNotebookOutput, + }, v2GetProjectConfig: { id: "v2GetProjectConfig", description: @@ -15723,6 +17091,20 @@ export const operationDefinitions = { inputSchema: V2ListLogDrainsInput, outputSchema: V2ListLogDrainsOutput, }, + v2ListNotebooks: { + id: "v2ListNotebooks", + description: + "Returns a cursor-paginated list of the project notebooks. Notebook bodies are omitted — read a single notebook to get its cells.", + method: "GET", + path: "/v2/projects/{ref}/notebooks", + pathParams: ["ref"], + queryParams: ["filter", "page", "sort"], + headerParams: [], + requestBody: { kind: "none" }, + response: { kind: "json" }, + inputSchema: V2ListNotebooksInput, + outputSchema: V2ListNotebooksOutput, + }, v2ListOrganizationGithubConnections: { id: "v2ListOrganizationGithubConnections", description: @@ -15844,6 +17226,20 @@ export const operationDefinitions = { inputSchema: V2UpdateLogDrainInput, outputSchema: V2UpdateLogDrainOutput, }, + v2UpdateNotebook: { + id: "v2UpdateNotebook", + description: + "Updates the attributes provided and leaves the rest untouched. Sending `content` replaces the whole notebook body.", + method: "PATCH", + path: "/v2/projects/{ref}/notebooks/{id}", + pathParams: ["id", "ref"], + queryParams: [], + headerParams: [], + requestBody: { kind: "json", contentType: "application/json", fields: ["data"] }, + response: { kind: "json" }, + inputSchema: V2UpdateNotebookInput, + outputSchema: V2UpdateNotebookOutput, + }, } as const; export type OpenApiOperationId = keyof typeof openApiOperationIdMap; diff --git a/packages/api/src/generated/effect-client.ts b/packages/api/src/generated/effect-client.ts index c0ef028752..35907571da 100644 --- a/packages/api/src/generated/effect-client.ts +++ b/packages/api/src/generated/effect-client.ts @@ -2369,6 +2369,20 @@ export const versionedEffectOperations = { input, ); }), + createNotebook: ( + input: typeof operationDefinitions.v2CreateNotebook.inputSchema.Type, + ): Effect.Effect< + typeof operationDefinitions.v2CreateNotebook.outputSchema.Type, + SupabaseApiError, + SupabaseApiClient + > => + Effect.gen(function* () { + const client = yield* SupabaseApiClient; + return yield* client.execute<"v2CreateNotebook">( + operationDefinitions.v2CreateNotebook, + input, + ); + }), createOrganizationInvitations: ( input: typeof operationDefinitions.v2CreateOrganizationInvitations.inputSchema.Type, ): Effect.Effect< @@ -2439,6 +2453,20 @@ export const versionedEffectOperations = { input, ); }), + deleteNotebook: ( + input: typeof operationDefinitions.v2DeleteNotebook.inputSchema.Type, + ): Effect.Effect< + typeof operationDefinitions.v2DeleteNotebook.outputSchema.Type, + SupabaseApiError, + SupabaseApiClient + > => + Effect.gen(function* () { + const client = yield* SupabaseApiClient; + return yield* client.execute<"v2DeleteNotebook">( + operationDefinitions.v2DeleteNotebook, + input, + ); + }), deleteOrganizationInvitations: ( input: typeof operationDefinitions.v2DeleteOrganizationInvitations.inputSchema.Type, ): Effect.Effect< @@ -2506,6 +2534,17 @@ export const versionedEffectOperations = { const client = yield* SupabaseApiClient; return yield* client.execute<"v2GetAWorker">(operationDefinitions.v2GetAWorker, input); }), + getNotebook: ( + input: typeof operationDefinitions.v2GetNotebook.inputSchema.Type, + ): Effect.Effect< + typeof operationDefinitions.v2GetNotebook.outputSchema.Type, + SupabaseApiError, + SupabaseApiClient + > => + Effect.gen(function* () { + const client = yield* SupabaseApiClient; + return yield* client.execute<"v2GetNotebook">(operationDefinitions.v2GetNotebook, input); + }), getProjectConfig: ( input: typeof operationDefinitions.v2GetProjectConfig.inputSchema.Type, ): Effect.Effect< @@ -2548,6 +2587,20 @@ export const versionedEffectOperations = { input, ); }), + listNotebooks: ( + input: typeof operationDefinitions.v2ListNotebooks.inputSchema.Type, + ): Effect.Effect< + typeof operationDefinitions.v2ListNotebooks.outputSchema.Type, + SupabaseApiError, + SupabaseApiClient + > => + Effect.gen(function* () { + const client = yield* SupabaseApiClient; + return yield* client.execute<"v2ListNotebooks">( + operationDefinitions.v2ListNotebooks, + input, + ); + }), listOrganizationGithubConnections: ( input: typeof operationDefinitions.v2ListOrganizationGithubConnections.inputSchema.Type, ): Effect.Effect< @@ -2674,6 +2727,20 @@ export const versionedEffectOperations = { input, ); }), + updateNotebook: ( + input: typeof operationDefinitions.v2UpdateNotebook.inputSchema.Type, + ): Effect.Effect< + typeof operationDefinitions.v2UpdateNotebook.outputSchema.Type, + SupabaseApiError, + SupabaseApiClient + > => + Effect.gen(function* () { + const client = yield* SupabaseApiClient; + return yield* client.execute<"v2UpdateNotebook">( + operationDefinitions.v2UpdateNotebook, + input, + ); + }), }, } as const; @@ -3374,6 +3441,10 @@ export function executeApiClientOperation( return Schema.decodeUnknownEffect(operationDefinitions.v2CreateLogDrain.inputSchema)( input, ).pipe(Effect.flatMap((decoded) => api.v2.createLogDrain(decoded))); + case "v2CreateNotebook": + return Schema.decodeUnknownEffect(operationDefinitions.v2CreateNotebook.inputSchema)( + input, + ).pipe(Effect.flatMap((decoded) => api.v2.createNotebook(decoded))); case "v2CreateOrganizationInvitations": return Schema.decodeUnknownEffect( operationDefinitions.v2CreateOrganizationInvitations.inputSchema, @@ -3394,6 +3465,10 @@ export function executeApiClientOperation( return Schema.decodeUnknownEffect(operationDefinitions.v2DeleteLogDrain.inputSchema)( input, ).pipe(Effect.flatMap((decoded) => api.v2.deleteLogDrain(decoded))); + case "v2DeleteNotebook": + return Schema.decodeUnknownEffect(operationDefinitions.v2DeleteNotebook.inputSchema)( + input, + ).pipe(Effect.flatMap((decoded) => api.v2.deleteNotebook(decoded))); case "v2DeleteOrganizationInvitations": return Schema.decodeUnknownEffect( operationDefinitions.v2DeleteOrganizationInvitations.inputSchema, @@ -3416,6 +3491,10 @@ export function executeApiClientOperation( return Schema.decodeUnknownEffect(operationDefinitions.v2GetAWorker.inputSchema)(input).pipe( Effect.flatMap((decoded) => api.v2.getAWorker(decoded)), ); + case "v2GetNotebook": + return Schema.decodeUnknownEffect(operationDefinitions.v2GetNotebook.inputSchema)(input).pipe( + Effect.flatMap((decoded) => api.v2.getNotebook(decoded)), + ); case "v2GetProjectConfig": return Schema.decodeUnknownEffect(operationDefinitions.v2GetProjectConfig.inputSchema)( input, @@ -3428,6 +3507,10 @@ export function executeApiClientOperation( return Schema.decodeUnknownEffect(operationDefinitions.v2ListLogDrains.inputSchema)( input, ).pipe(Effect.flatMap((decoded) => api.v2.listLogDrains(decoded))); + case "v2ListNotebooks": + return Schema.decodeUnknownEffect(operationDefinitions.v2ListNotebooks.inputSchema)( + input, + ).pipe(Effect.flatMap((decoded) => api.v2.listNotebooks(decoded))); case "v2ListOrganizationGithubConnections": return Schema.decodeUnknownEffect( operationDefinitions.v2ListOrganizationGithubConnections.inputSchema, @@ -3464,5 +3547,9 @@ export function executeApiClientOperation( return Schema.decodeUnknownEffect(operationDefinitions.v2UpdateLogDrain.inputSchema)( input, ).pipe(Effect.flatMap((decoded) => api.v2.updateLogDrain(decoded))); + case "v2UpdateNotebook": + return Schema.decodeUnknownEffect(operationDefinitions.v2UpdateNotebook.inputSchema)( + input, + ).pipe(Effect.flatMap((decoded) => api.v2.updateNotebook(decoded))); } } diff --git a/packages/api/src/generated/openapi.json b/packages/api/src/generated/openapi.json index a6372ce8d4..b219912db9 100644 --- a/packages/api/src/generated/openapi.json +++ b/packages/api/src/generated/openapi.json @@ -13530,6 +13530,577 @@ "x-fga-permissions": [["organization_projects_read"]], "x-oauth-scope": "projects:read" } + }, + "/v2/projects/{ref}/notebooks": { + "get": { + "description": "Returns a cursor-paginated list of the project notebooks. Notebook bodies are omitted — read a single notebook to get its cells.", + "operationId": "v2-list-notebooks", + "parameters": [ + { + "in": "query", + "name": "filter", + "required": false, + "schema": { + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "type": "object" + }, + "style": "deepObject" + }, + { + "in": "query", + "name": "page", + "required": false, + "schema": { + "properties": { + "after": { + "minLength": 1, + "type": "string" + }, + "before": { + "minLength": 1, + "type": "string" + }, + "size": { + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" + }, + "style": "deepObject" + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + }, + { + "in": "query", + "name": "sort", + "required": false, + "schema": { + "enum": ["-inserted_at", "-name", "inserted_at", "name"], + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2ListNotebooksResponse" + } + } + }, + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to retrieve project's notebooks" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "List notebooks of a project", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:read", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_read"]], + "x-oauth-scope": "database:read" + }, + "post": { + "description": "Creates a notebook shared with everyone who has access to the project. Cell ids are assigned by the server and returned in the response.", + "operationId": "v2-create-notebook", + "parameters": [ + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2CreateNotebookRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NotebookResponse" + } + } + }, + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to create notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Create a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:write", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_write"]], + "x-oauth-scope": "database:write" + } + }, + "/v2/projects/{ref}/notebooks/{id}": { + "delete": { + "operationId": "v2-delete-notebook", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "44444444-4444-4444-8444-444444444444", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Notebook not found" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to delete notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Delete a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:write", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_write"]], + "x-oauth-scope": "database:write" + }, + "get": { + "operationId": "v2-get-notebook", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "44444444-4444-4444-8444-444444444444", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NotebookResponse" + } + } + }, + "description": "" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Notebook not found" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to retrieve notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Get a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:read", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_read"]], + "x-oauth-scope": "database:read" + }, + "patch": { + "description": "Updates the attributes provided and leaves the rest untouched. Sending `content` replaces the whole notebook body.", + "operationId": "v2-update-notebook", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "44444444-4444-4444-8444-444444444444", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + { + "description": "Project ref", + "in": "path", + "name": "ref", + "required": true, + "schema": { + "example": "abcdefghijklmnopqrst", + "maxLength": 20, + "minLength": 20, + "pattern": "^[a-z]+$", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2UpdateNotebookRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NotebookResponse" + } + } + }, + "description": "" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "The request references a cell that does not exist on this notebook" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Unauthorized" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Forbidden action" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Notebook not found" + }, + "429": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Rate limit exceeded" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseBody" + } + } + }, + "description": "Failed to update notebook" + } + }, + "security": [ + { + "bearer": [] + } + ], + "summary": "Update a notebook", + "tags": ["Projects"], + "x-badges": [ + { + "name": "OAuth scope: database:write", + "position": "after" + } + ], + "x-endpoint-owners": ["control-plane"], + "x-fga-permissions": [["project_notebooks_write"]], + "x-oauth-scope": "database:write" + } } }, "components": { @@ -26365,66 +26936,1044 @@ }, "username": { "type": "string" - }, - "primary_email": { - "type": "string", - "nullable": true + }, + "primary_email": { + "type": "string", + "nullable": true + } + }, + "required": ["id", "username", "primary_email"], + "description": "The user who created the connection, if still known", + "nullable": true + } + }, + "required": [ + "inserted_at", + "updated_at", + "installation_id", + "workdir", + "supabase_changes_only", + "branch_limit", + "new_branch_per_pr", + "project", + "repository", + "user" + ] + } + }, + "required": ["type", "id", "attributes"] + } + }, + "links": { + "type": "object", + "properties": { + "first": { + "type": "string", + "description": "URL path to the first page if available.", + "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10", + "nullable": true + }, + "prev": { + "type": "string", + "description": "URL path to the previous page.", + "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10&page[before]=019adf7d-4513-74c5-bb9a-f1bc0f7a95d7", + "nullable": true + }, + "next": { + "type": "string", + "description": "URL path to the next page.", + "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10&page[after]=019adf7d-4513-7062-b292-78b86cc470a4", + "nullable": true + }, + "last": { + "type": "string", + "description": "URL path to the last page if available.", + "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10&page[after]=019adf7d-4513-71ba-b264-21900edb4295", + "nullable": true + } + }, + "required": ["prev", "next"] + } + }, + "required": ["data", "links"] + }, + "V2CreateNotebookRequest": { + "properties": { + "data": { + "properties": { + "attributes": { + "properties": { + "content": { + "properties": { + "cells": { + "items": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": ["markdown"], + "type": "string" + } + }, + "required": ["text", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "database_identifier": { + "description": "Read replica to run against. Omit to use the primary database.", + "type": "string" + }, + "id": { + "type": "string" + }, + "row_limit": { + "default": 100, + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "sql": { + "description": "SQL run against the project database.", + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["database"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "sql": { + "description": "SQL run against the project logs.", + "type": "string" + }, + "time_range": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "end": { + "description": "ISO 8601 end of the range.", + "type": "string" + }, + "start": { + "description": "ISO 8601 start of the range.", + "type": "string" + }, + "type": { + "enum": ["absolute"], + "type": "string" + } + }, + "required": ["end", "start", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "amount": { + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "type": { + "enum": ["relative"], + "type": "string" + }, + "unit": { + "enum": [ + "day", + "hour", + "minute", + "month", + "week", + "year" + ], + "type": "string" + } + }, + "required": ["amount", "type", "unit"], + "type": "object" + } + ] + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["log"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "time_range", "type"], + "type": "object" + } + ] + }, + "type": "array" + } + }, + "required": ["cells"], + "type": "object" + }, + "description": { + "maxLength": 10000, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "name": { + "maxLength": 255, + "minLength": 1, + "type": "string" + } + }, + "required": ["content", "name"], + "type": "object" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "type"], + "type": "object" + } + }, + "required": ["data"], + "type": "object" + }, + "V2ListNotebooksResponse": { + "properties": { + "data": { + "items": { + "properties": { + "attributes": { + "additionalProperties": {}, + "properties": { + "description": { + "nullable": true, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "inserted_at": { + "type": "string" + }, + "name": { + "type": "string" + }, + "owner": { + "additionalProperties": {}, + "description": "User who created the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + }, + "updated_at": { + "type": "string" + }, + "updated_by": { + "additionalProperties": {}, + "description": "User who last wrote to the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" } }, - "required": ["id", "username", "primary_email"], - "description": "The user who created the connection, if still known", - "nullable": true + "required": ["id", "username"], + "type": "object" } }, "required": [ + "description", + "favorite", "inserted_at", + "name", + "owner", "updated_at", - "installation_id", - "workdir", - "supabase_changes_only", - "branch_limit", - "new_branch_per_pr", - "project", - "repository", - "user" - ] + "updated_by" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" } }, - "required": ["type", "id", "attributes"] - } + "required": ["attributes", "id", "type"], + "type": "object" + }, + "type": "array" }, "links": { - "type": "object", "properties": { "first": { - "type": "string", "description": "URL path to the first page if available.", - "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10", - "nullable": true + "example": "/v2/projects/{ref}/notebooks?page[size]=10", + "nullable": true, + "type": "string" }, - "prev": { - "type": "string", - "description": "URL path to the previous page.", - "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10&page[before]=019adf7d-4513-74c5-bb9a-f1bc0f7a95d7", - "nullable": true + "last": { + "description": "URL path to the last page if available.", + "example": "/v2/projects/{ref}/notebooks?page[size]=10&page[after]=019adf7d-4513-71ba-b264-21900edb4295", + "nullable": true, + "type": "string" }, "next": { - "type": "string", "description": "URL path to the next page.", - "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10&page[after]=019adf7d-4513-7062-b292-78b86cc470a4", - "nullable": true + "example": "/v2/projects/{ref}/notebooks?page[size]=10&page[after]=019adf7d-4513-7062-b292-78b86cc470a4", + "nullable": true, + "type": "string" }, - "last": { - "type": "string", - "description": "URL path to the last page if available.", - "example": "/v2/organizations/my-org/integrations/github/connections?page[size]=10&page[after]=019adf7d-4513-71ba-b264-21900edb4295", - "nullable": true + "prev": { + "description": "URL path to the previous page.", + "example": "/v2/projects/{ref}/notebooks?page[size]=10&page[before]=019adf7d-4513-74c5-bb9a-f1bc0f7a95d7", + "nullable": true, + "type": "string" } }, - "required": ["prev", "next"] + "required": ["next", "prev"], + "type": "object" } }, - "required": ["data", "links"] + "required": ["data", "links"], + "type": "object" + }, + "V2NotebookResponse": { + "properties": { + "data": { + "properties": { + "attributes": { + "additionalProperties": {}, + "properties": { + "content": { + "additionalProperties": {}, + "properties": { + "cells": { + "items": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": ["markdown"], + "type": "string" + } + }, + "required": ["id", "text", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "database_identifier": { + "description": "Read replica to run against. Omit to use the primary database.", + "type": "string" + }, + "id": { + "type": "string" + }, + "row_limit": { + "default": 100, + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "sql": { + "description": "SQL run against the project database.", + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["database"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["id", "sql", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "sql": { + "description": "SQL run against the project logs.", + "type": "string" + }, + "time_range": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "end": { + "description": "ISO 8601 end of the range.", + "type": "string" + }, + "start": { + "description": "ISO 8601 start of the range.", + "type": "string" + }, + "type": { + "enum": ["absolute"], + "type": "string" + } + }, + "required": ["end", "start", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "amount": { + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "type": { + "enum": ["relative"], + "type": "string" + }, + "unit": { + "enum": [ + "day", + "hour", + "minute", + "month", + "week", + "year" + ], + "type": "string" + } + }, + "required": ["amount", "type", "unit"], + "type": "object" + } + ] + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["log"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["id", "sql", "time_range", "type"], + "type": "object" + } + ] + }, + "type": "array" + }, + "schema_version": { + "type": "number" + } + }, + "required": ["cells", "schema_version"], + "type": "object" + }, + "description": { + "nullable": true, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "inserted_at": { + "type": "string" + }, + "name": { + "type": "string" + }, + "owner": { + "additionalProperties": {}, + "description": "User who created the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + }, + "updated_at": { + "type": "string" + }, + "updated_by": { + "additionalProperties": {}, + "description": "User who last wrote to the notebook.", + "nullable": true, + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": ["id", "username"], + "type": "object" + } + }, + "required": [ + "content", + "description", + "favorite", + "inserted_at", + "name", + "owner", + "updated_at", + "updated_by" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "id", "type"], + "type": "object" + } + }, + "required": ["data"], + "type": "object" + }, + "V2UpdateNotebookRequest": { + "properties": { + "data": { + "properties": { + "attributes": { + "properties": { + "content": { + "description": "Replaces the notebook body. A cell keeps its identity by echoing back its `id`; a cell sent without an `id` is added as a new one.", + "properties": { + "cells": { + "items": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": ["markdown"], + "type": "string" + } + }, + "required": ["text", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "database_identifier": { + "description": "Read replica to run against. Omit to use the primary database.", + "type": "string" + }, + "id": { + "type": "string" + }, + "row_limit": { + "default": 100, + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "sql": { + "description": "SQL run against the project database.", + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["database"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "chart": { + "additionalProperties": {}, + "description": "Chart configuration, retained even while `view` is `table`.", + "properties": { + "cumulative": { + "type": "boolean" + }, + "scale": { + "enum": ["linear", "log"], + "type": "string" + }, + "show_labels": { + "type": "boolean" + }, + "type": { + "enum": ["bar", "line"], + "type": "string" + }, + "x_column": { + "description": "Result column used for the x axis.", + "type": "string" + }, + "y_series": { + "items": { + "additionalProperties": {}, + "properties": { + "column": { + "description": "Result column plotted as a series.", + "type": "string" + } + }, + "required": ["column"], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "cumulative", + "scale", + "show_labels", + "type", + "x_column", + "y_series" + ], + "type": "object" + }, + "id": { + "type": "string" + }, + "sql": { + "description": "SQL run against the project logs.", + "type": "string" + }, + "time_range": { + "oneOf": [ + { + "additionalProperties": {}, + "properties": { + "end": { + "description": "ISO 8601 end of the range.", + "type": "string" + }, + "start": { + "description": "ISO 8601 start of the range.", + "type": "string" + }, + "type": { + "enum": ["absolute"], + "type": "string" + } + }, + "required": ["end", "start", "type"], + "type": "object" + }, + { + "additionalProperties": {}, + "properties": { + "amount": { + "exclusiveMinimum": true, + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "type": { + "enum": ["relative"], + "type": "string" + }, + "unit": { + "enum": [ + "day", + "hour", + "minute", + "month", + "week", + "year" + ], + "type": "string" + } + }, + "required": ["amount", "type", "unit"], + "type": "object" + } + ] + }, + "title": { + "type": "string" + }, + "type": { + "enum": ["log"], + "type": "string" + }, + "view": { + "enum": ["chart", "table"], + "type": "string" + } + }, + "required": ["sql", "time_range", "type"], + "type": "object" + } + ] + }, + "type": "array" + } + }, + "required": ["cells"], + "type": "object" + }, + "description": { + "maxLength": 10000, + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "name": { + "maxLength": 255, + "minLength": 1, + "type": "string" + } + }, + "type": "object" + }, + "type": { + "description": "Resource type.", + "enum": ["notebook"], + "type": "string" + } + }, + "required": ["attributes", "type"], + "type": "object" + } + }, + "required": ["data"], + "type": "object" } } }