@deepraxis/sdk 0.1.0-dev.ce6682e → 0.1.0-dev.d23f787
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/client.d.ts +5 -1
- package/dist/core/client.js +3 -0
- package/dist/core/transport.d.ts +5 -0
- package/dist/core/transport.js +6 -1
- package/dist/generated/sdk.gen.d.ts +7 -7
- package/dist/generated/sdk.gen.js +7 -7
- package/dist/generated/types.gen.d.ts +602 -27
- package/dist/helpers/database-count.d.ts +17 -0
- package/dist/helpers/database-count.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/operations.generated.d.ts +54 -18
- package/dist/operations.generated.js +60 -18
- package/dist/resources.generated.d.ts +126 -0
- package/package.json +1 -1
package/dist/core/client.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { resourceFactories } from '../resources.generated.js';
|
|
2
2
|
import { type PraxisOptions } from './transport.js';
|
|
3
3
|
import { type PublishInput, type PublishResult } from '../helpers/application-publish.js';
|
|
4
|
+
import { type CountInput, type CountResult } from '../helpers/database-count.js';
|
|
4
5
|
type Resources = {
|
|
5
6
|
readonly [K in keyof typeof resourceFactories]: ReturnType<(typeof resourceFactories)[K]>;
|
|
6
7
|
};
|
|
7
|
-
export interface Praxis extends Omit<Resources, 'application'> {
|
|
8
|
+
export interface Praxis extends Omit<Resources, 'application' | 'database'> {
|
|
9
|
+
readonly database: Resources['database'] & {
|
|
10
|
+
count(input: CountInput): Promise<CountResult>;
|
|
11
|
+
};
|
|
8
12
|
readonly application: Resources['application'] & {
|
|
9
13
|
publish(input: PublishInput): Promise<PublishResult>;
|
|
10
14
|
};
|
package/dist/core/client.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { resourceFactories } from "../resources.generated.js";
|
|
2
2
|
import { Transport } from "./transport.js";
|
|
3
3
|
import { publish } from "../helpers/application-publish.js";
|
|
4
|
+
import { count } from "../helpers/database-count.js";
|
|
4
5
|
export class Praxis {
|
|
5
6
|
constructor(options) {
|
|
6
7
|
const transport = new Transport(options);
|
|
7
8
|
for (const [name, create] of Object.entries(resourceFactories)) {
|
|
8
9
|
const resource = create(transport);
|
|
9
10
|
// Assemble before sealing the resource property; never replace a readonly SDK resource.
|
|
11
|
+
if (name === 'database')
|
|
12
|
+
Object.assign(resource, { count: (input) => count(transport, input) });
|
|
10
13
|
if (name === 'application')
|
|
11
14
|
Object.assign(resource, { publish: (input) => publish(this, input) });
|
|
12
15
|
Object.defineProperty(this, name, { value: resource, enumerable: true });
|
package/dist/core/transport.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ export declare class Transport {
|
|
|
31
31
|
private validate;
|
|
32
32
|
private scope;
|
|
33
33
|
request<R>(operation: Operation, options?: InternalOptions): Promise<R>;
|
|
34
|
+
/** Internal helper access to response metadata, with the same request policy. */
|
|
35
|
+
requestWithResponse<R>(operation: Operation, options?: InternalOptions): Promise<{
|
|
36
|
+
data: R;
|
|
37
|
+
response: Response;
|
|
38
|
+
}>;
|
|
34
39
|
stream<E extends SSEEvent = SSEEvent>(operation: Operation, options?: InternalOptions): AsyncGenerator<E>;
|
|
35
40
|
}
|
|
36
41
|
export {};
|
package/dist/core/transport.js
CHANGED
|
@@ -92,9 +92,14 @@ export class Transport {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
async request(operation, options = {}) {
|
|
95
|
+
return (await this.requestWithResponse(operation, options)).data;
|
|
96
|
+
}
|
|
97
|
+
/** Internal helper access to response metadata, with the same request policy. */
|
|
98
|
+
async requestWithResponse(operation, options = {}) {
|
|
95
99
|
const scope = this.scope(options, false);
|
|
96
100
|
try {
|
|
97
|
-
|
|
101
|
+
const result = await abortable(operation(scope.options), scope.signal);
|
|
102
|
+
return { data: result.data, response: result.response };
|
|
98
103
|
}
|
|
99
104
|
finally {
|
|
100
105
|
scope.close();
|
|
@@ -210,7 +210,7 @@ export declare const computersFilesContent: <ThrowOnError extends boolean = fals
|
|
|
210
210
|
*
|
|
211
211
|
* Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id, plus the machine tier the computer is on now (light or heavy) and the lease that keeps it there (lease_id, lease_expires_at; lease_id is null when no lease exists). Keep the lease while the connection stays open: renew it about every 20 seconds (POST .../leases/{lease_id}/renew) and release it on close (DELETE .../leases/{lease_id}). An unrenewed lease simply expires, and the full machine is reclaimed only after that. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.
|
|
212
212
|
*
|
|
213
|
-
* Connect to a computer with a caller-held lease. Omit the body or send {} to request light: the lightweight shell, or the heavy instance while it is running. Send {"need":"heavy"} to request full Linux for interactive programs; files are synchronized before the heavy connection is returned with tier heavy.
|
|
213
|
+
* Connect to a computer with a caller-held lease. Omit the body or send {} to request light: the lightweight shell, or the heavy instance while it is running. Send {"need":"heavy"} to request full Linux for interactive programs; files are synchronized before the heavy connection is returned with tier heavy. Renew the lease while using the connection and release it with DELETE when finished.
|
|
214
214
|
*/
|
|
215
215
|
export declare const connectComputer: <ThrowOnError extends boolean = false>(options: Options<ConnectComputerData, ThrowOnError>) => RequestResult<ConnectComputerResponses, ConnectComputerErrors, ThrowOnError>;
|
|
216
216
|
/**
|
|
@@ -893,7 +893,7 @@ export declare const sessionsList: <ThrowOnError extends boolean = false>(option
|
|
|
893
893
|
/**
|
|
894
894
|
* Create session
|
|
895
895
|
*
|
|
896
|
-
* Create a session: one conversation with an agent
|
|
896
|
+
* Create a session: one conversation with an agent. Pass agent as an agent id (latest version) or {id, version, type:"agent"}. Unlike Anthropic Managed Agents, omit environment_id to get a light machine, unless computer_id (explicit, or the agent's default) selects a Computer; pass an environment id for a sandbox recipe. For service agents, omission returns environment_id=light; explicit null allocates no machine, so codemode, bash and other machine tools are unavailable. Optional model must be one of the agent's allowed models; optional thinking is {effort: low|medium|high|xhigh|max|none} or null, where null inherits the agent default and then the model default (none requires the model to allow disabling thinking). Selections are saved before initial_events run; invalid ones return 400 invalid_request_error. Inline agent overrides are not supported. Supports vault_ids, up to 50, owned by the current organization and not archived; credential injection is deferred to a later version. Omitted budget defaults to USD 20; null removes the limit, and a limit object uses a positive integer string of USD cents. Up to 500 file resources can be attached. Use initial_events to send a first user.message in this request, or send messages afterwards with sessions.events.send. The returned status can still be idle before initial events run; read agent.message and the subsequent session.status_idle event to confirm completion.
|
|
897
897
|
*/
|
|
898
898
|
export declare const sessionsCreate: <ThrowOnError extends boolean = false>(options: Options<SessionsCreateData, ThrowOnError>) => RequestResult<SessionsCreateResponses, unknown, ThrowOnError>;
|
|
899
899
|
/**
|
|
@@ -1667,7 +1667,7 @@ export declare const databaseListTables: <ThrowOnError extends boolean = false>(
|
|
|
1667
1667
|
/**
|
|
1668
1668
|
* Create table
|
|
1669
1669
|
*
|
|
1670
|
-
* Creates a table together with its initial fields in one call and returns it (HTTP 201) with generated tbl_ and fld_ ids. name must match ^[a-z_][a-z0-9_]{0,62}$ and be unused in this database (duplicate: 409 UNIQUE_VIOLATION). fields is required and may be an empty array; fields can also be added later with databaseAddField. Limits: 50 tables per database, 64 fields per table, and 16 indexed or unique fields per table; exceeding one returns 400 LIMIT_EXCEEDED. Every row also has a system id column, which is not declared as a field. Insert data afterwards with databaseInsert. Unlike Supabase, define schema with this table API and the field APIs; PostgreSQL DDL and SQL migration files cannot be submitted. Each table supports up to 1,000,000 rows.
|
|
1670
|
+
* Creates a table together with its initial fields in one call and returns it (HTTP 201) with generated tbl_ and fld_ ids. name must match ^[a-z_][a-z0-9_]{0,62}$ and be unused in this database (duplicate: 409 UNIQUE_VIOLATION). fields is required and may be an empty array; fields can also be added later with databaseAddField. Limits: 50 tables per database, 64 fields per table, and 16 indexed or unique fields per table; exceeding one returns 400 LIMIT_EXCEEDED. Fields default to indexed:false. Set indexed:true explicitly for fields used in filters or ordering. Only indexed:true or unique:true consumes one of the 16 indexed-or-unique field slots; a field with both consumes one slot. Unique fields still consume a slot even with indexed:false. Existing fields are unchanged. Minimal field example: {"name":"notes","type":"string","indexed":false}. Every row also has a system id column, which is not declared as a field. Insert data afterwards with databaseInsert. Unlike Supabase, define schema with this table API and the field APIs; PostgreSQL DDL and SQL migration files cannot be submitted. Each table supports up to 1,000,000 rows.
|
|
1671
1671
|
*/
|
|
1672
1672
|
export declare const databaseCreateTable: <ThrowOnError extends boolean = false>(options: Options<DatabaseCreateTableData, ThrowOnError>) => RequestResult<DatabaseCreateTableResponses, DatabaseCreateTableErrors, ThrowOnError>;
|
|
1673
1673
|
/**
|
|
@@ -1691,7 +1691,7 @@ export declare const databaseUpdateTable: <ThrowOnError extends boolean = false>
|
|
|
1691
1691
|
/**
|
|
1692
1692
|
* Add field
|
|
1693
1693
|
*
|
|
1694
|
-
* Adds one field to an existing table and returns the updated table (HTTP 201). Required inputs are name (lowercase letters, digits and underscores; id and names starting with _ are reserved) and type (string, integer, number, boolean, datetime, json or link); json needs options.schema and link needs options.linked_table_id and options.multiple. Adding a required field to a table that already has rows needs a default, otherwise the call fails with 400 VALIDATION_FAILED; a default is written into every existing row.
|
|
1694
|
+
* Adds one field to an existing table and returns the updated table (HTTP 201). Required inputs are name (lowercase letters, digits and underscores; id and names starting with _ are reserved) and type (string, integer, number, boolean, datetime, json or link); json needs options.schema and link needs options.linked_table_id and options.multiple. Adding a required field to a table that already has rows needs a default, otherwise the call fails with 400 VALIDATION_FAILED; a default is written into every existing row. Fields default to indexed:false. Set indexed:true explicitly for fields used in filters or ordering. Only indexed:true or unique:true consumes one of the 16 indexed-or-unique field slots; a field with both consumes one slot. Unique fields still consume a slot even with indexed:false. Existing fields are unchanged. Minimal field example: {"name":"notes","type":"string","indexed":false}. JSON and link fields cannot be indexed. Limits: 64 fields and 16 indexed or unique fields per table (400 LIMIT_EXCEEDED). Unlike Supabase, schema evolution uses field definitions rather than ALTER TABLE statements or SQL migrations.
|
|
1695
1695
|
*/
|
|
1696
1696
|
export declare const databaseAddField: <ThrowOnError extends boolean = false>(options: Options<DatabaseAddFieldData, ThrowOnError>) => RequestResult<DatabaseAddFieldResponses, DatabaseAddFieldErrors, ThrowOnError>;
|
|
1697
1697
|
/**
|
|
@@ -1721,13 +1721,13 @@ export declare const databaseDelete: <ThrowOnError extends boolean = false>(opti
|
|
|
1721
1721
|
/**
|
|
1722
1722
|
* Select rows
|
|
1723
1723
|
*
|
|
1724
|
-
* Read matching rows with filters, selected columns and ordering. Returns at most 1000 rows per request, including when limit is omitted. Content-Range reports the actual returned interval and the total when count is requested. PATCH and DELETE are not subject to this read cap. Unlike Supabase, casts, aggregates, spread and join modifiers are unsupported. Each table supports up to 1,000,000 rows. Query budget: 8,000 ms with a shared 3,000,000-row safety ceiling. Create indexes on filtered or sorted fields, or narrow the request when it exceeds its budget. Synchronous SQLite aggregates use candidate-row throughput estimates before execution; deployed Workers freeze clocks during synchronous CPU work, so the timer is not a guaranteed server-side interrupt. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode. Error table: QUERY_CANCELED / PostgREST 57014 is HTTP 500, retryable=false: Query timed out: index filtered or sorted fields, or narrow the range. DATABASE_INVALID_STATE is HTTP 409 for operations on a deleting database. Cleared or nonexistent databases return DATABASE_NOT_FOUND / HTTP 404. The count is an HTTP Content-Range response header, not a JSON property.
|
|
1724
|
+
* Read matching rows with filters, selected columns and ordering. Returns at most 1000 rows per request, including when limit is omitted. Content-Range reports the actual returned interval and the total when count is requested. PATCH and DELETE are not subject to this read cap. Unlike Supabase, casts, aggregates, spread and join modifiers are unsupported. Each table supports up to 1,000,000 rows. Query budget: 8,000 ms with a shared 3,000,000-row safety ceiling. Create indexes on filtered or sorted fields, or narrow the request when it exceeds its budget. Synchronous SQLite aggregates use candidate-row throughput estimates before execution; deployed Workers freeze clocks during synchronous CPU work, so the timer is not a guaranteed server-side interrupt. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode. Error table: QUERY_CANCELED / PostgREST 57014 is HTTP 500, retryable=false: Query timed out: index filtered or sorted fields, or narrow the range. DATABASE_INVALID_STATE is HTTP 409 for operations on a deleting database. Cleared or nonexistent databases return DATABASE_NOT_FOUND / HTTP 404. The count is an HTTP Content-Range response header, not a JSON property. Use praxis.database.count in the SDK or codemode to return { count: number | null }; a page length is not a total unless you know all matches fit in that page.
|
|
1725
1725
|
*/
|
|
1726
1726
|
export declare const databaseSelect: <ThrowOnError extends boolean = false>(options: Options<DatabaseSelectData, ThrowOnError>) => RequestResult<DatabaseSelectResponses, DatabaseSelectErrors, ThrowOnError>;
|
|
1727
1727
|
/**
|
|
1728
1728
|
* Count rows
|
|
1729
1729
|
*
|
|
1730
|
-
* Inspect the HTTP row count and range without retrieving row data; send Prefer: count=exact for a filtered count. Returns no body and does not fetch or serialize row data. A known count determines the interval using limit/offset or Range with a default and maximum page size of 1000. Without a count preference, or when the selected count mode cannot supply a total, Content-Range is **. Singular Accept still validates page cardinality. Unlike Supabase, planned and estimated counts do not use PostgreSQL planner estimates. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode.
|
|
1730
|
+
* Inspect the HTTP row count and range without retrieving row data; send Prefer: count=exact for a filtered count. Returns no body and does not fetch or serialize row data. A known count determines the interval using limit/offset or Range with a default and maximum page size of 1000. Without a count preference, or when the selected count mode cannot supply a total, Content-Range is **. Singular Accept still validates page cardinality. Unlike Supabase, planned and estimated counts do not use PostgreSQL planner estimates. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode. Use praxis.database.count in the SDK or codemode to return { count: number | null } from this header without retrieving rows.
|
|
1731
1731
|
*/
|
|
1732
1732
|
export declare const databaseHead: <ThrowOnError extends boolean = false>(options: Options<DatabaseHeadData, ThrowOnError>) => RequestResult<DatabaseHeadResponses, DatabaseHeadErrors, ThrowOnError>;
|
|
1733
1733
|
/**
|
|
@@ -1741,7 +1741,7 @@ export declare const databaseUpdate: <ThrowOnError extends boolean = false>(opti
|
|
|
1741
1741
|
*
|
|
1742
1742
|
* Insert rows into an existing table after defining its fields; at most 500 rows per request. Each request is atomic: any failure rolls back the entire batch. There are no transactions across requests.
|
|
1743
1743
|
* Rows are filled to the union of their keys with null; send Prefer: missing=default to use field defaults for missing keys.
|
|
1744
|
-
* The default is return=minimal: success returns HTTP 201 with an empty body. Send Prefer: return=representation to return the inserted rows. Unlike Supabase, upsert conflicts can target only id or one unique field, not a composite key. Each table supports up to 1,000,000 rows.
|
|
1744
|
+
* The default is return=minimal: success returns HTTP 201 with an empty body. Send Prefer: return=representation to return the inserted rows. With resolution=merge-duplicates, a conflicting row keeps columns omitted from the request; supplied values replace the whole field value (including JSON objects), and explicit null clears a nullable field. With resolution=ignore-duplicates, a conflicting row is left unchanged. Without a conflict, both modes insert a new row using field defaults for omitted fields. In a batch, a key present in another row is filled with null when omitted in this row unless missing=default is set; that null can overwrite a value during merge. With missing=default, omitted keys stay omitted for conflict merges (existing values are preserved); new rows use defaults, or null when no default exists. Explicit null never invokes a default. Unlike Supabase, upsert conflicts can target only id or one unique field, not a composite key. Each table supports up to 1,000,000 rows.
|
|
1745
1745
|
*/
|
|
1746
1746
|
export declare const databaseInsert: <ThrowOnError extends boolean = false>(options: Options<DatabaseInsertData, ThrowOnError>) => RequestResult<DatabaseInsertResponses, DatabaseInsertErrors, ThrowOnError>;
|
|
1747
1747
|
/**
|
|
@@ -497,7 +497,7 @@ export const computersFilesContent = (options) => (options.client ?? client).get
|
|
|
497
497
|
*
|
|
498
498
|
* Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id, plus the machine tier the computer is on now (light or heavy) and the lease that keeps it there (lease_id, lease_expires_at; lease_id is null when no lease exists). Keep the lease while the connection stays open: renew it about every 20 seconds (POST .../leases/{lease_id}/renew) and release it on close (DELETE .../leases/{lease_id}). An unrenewed lease simply expires, and the full machine is reclaimed only after that. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.
|
|
499
499
|
*
|
|
500
|
-
* Connect to a computer with a caller-held lease. Omit the body or send {} to request light: the lightweight shell, or the heavy instance while it is running. Send {"need":"heavy"} to request full Linux for interactive programs; files are synchronized before the heavy connection is returned with tier heavy.
|
|
500
|
+
* Connect to a computer with a caller-held lease. Omit the body or send {} to request light: the lightweight shell, or the heavy instance while it is running. Send {"need":"heavy"} to request full Linux for interactive programs; files are synchronized before the heavy connection is returned with tier heavy. Renew the lease while using the connection and release it with DELETE when finished.
|
|
501
501
|
*/
|
|
502
502
|
export const connectComputer = (options) => (options.client ?? client).post({
|
|
503
503
|
security: [{
|
|
@@ -2508,7 +2508,7 @@ export const sessionsList = (options) => (options?.client ?? client).get({
|
|
|
2508
2508
|
/**
|
|
2509
2509
|
* Create session
|
|
2510
2510
|
*
|
|
2511
|
-
* Create a session: one conversation with an agent
|
|
2511
|
+
* Create a session: one conversation with an agent. Pass agent as an agent id (latest version) or {id, version, type:"agent"}. Unlike Anthropic Managed Agents, omit environment_id to get a light machine, unless computer_id (explicit, or the agent's default) selects a Computer; pass an environment id for a sandbox recipe. For service agents, omission returns environment_id=light; explicit null allocates no machine, so codemode, bash and other machine tools are unavailable. Optional model must be one of the agent's allowed models; optional thinking is {effort: low|medium|high|xhigh|max|none} or null, where null inherits the agent default and then the model default (none requires the model to allow disabling thinking). Selections are saved before initial_events run; invalid ones return 400 invalid_request_error. Inline agent overrides are not supported. Supports vault_ids, up to 50, owned by the current organization and not archived; credential injection is deferred to a later version. Omitted budget defaults to USD 20; null removes the limit, and a limit object uses a positive integer string of USD cents. Up to 500 file resources can be attached. Use initial_events to send a first user.message in this request, or send messages afterwards with sessions.events.send. The returned status can still be idle before initial events run; read agent.message and the subsequent session.status_idle event to confirm completion.
|
|
2512
2512
|
*/
|
|
2513
2513
|
export const sessionsCreate = (options) => (options.client ?? client).post({
|
|
2514
2514
|
security: [{
|
|
@@ -4908,7 +4908,7 @@ export const databaseListTables = (options) => (options.client ?? client).get({
|
|
|
4908
4908
|
/**
|
|
4909
4909
|
* Create table
|
|
4910
4910
|
*
|
|
4911
|
-
* Creates a table together with its initial fields in one call and returns it (HTTP 201) with generated tbl_ and fld_ ids. name must match ^[a-z_][a-z0-9_]{0,62}$ and be unused in this database (duplicate: 409 UNIQUE_VIOLATION). fields is required and may be an empty array; fields can also be added later with databaseAddField. Limits: 50 tables per database, 64 fields per table, and 16 indexed or unique fields per table; exceeding one returns 400 LIMIT_EXCEEDED. Every row also has a system id column, which is not declared as a field. Insert data afterwards with databaseInsert. Unlike Supabase, define schema with this table API and the field APIs; PostgreSQL DDL and SQL migration files cannot be submitted. Each table supports up to 1,000,000 rows.
|
|
4911
|
+
* Creates a table together with its initial fields in one call and returns it (HTTP 201) with generated tbl_ and fld_ ids. name must match ^[a-z_][a-z0-9_]{0,62}$ and be unused in this database (duplicate: 409 UNIQUE_VIOLATION). fields is required and may be an empty array; fields can also be added later with databaseAddField. Limits: 50 tables per database, 64 fields per table, and 16 indexed or unique fields per table; exceeding one returns 400 LIMIT_EXCEEDED. Fields default to indexed:false. Set indexed:true explicitly for fields used in filters or ordering. Only indexed:true or unique:true consumes one of the 16 indexed-or-unique field slots; a field with both consumes one slot. Unique fields still consume a slot even with indexed:false. Existing fields are unchanged. Minimal field example: {"name":"notes","type":"string","indexed":false}. Every row also has a system id column, which is not declared as a field. Insert data afterwards with databaseInsert. Unlike Supabase, define schema with this table API and the field APIs; PostgreSQL DDL and SQL migration files cannot be submitted. Each table supports up to 1,000,000 rows.
|
|
4912
4912
|
*/
|
|
4913
4913
|
export const databaseCreateTable = (options) => (options.client ?? client).post({
|
|
4914
4914
|
security: [{
|
|
@@ -4972,7 +4972,7 @@ export const databaseUpdateTable = (options) => (options.client ?? client).patch
|
|
|
4972
4972
|
/**
|
|
4973
4973
|
* Add field
|
|
4974
4974
|
*
|
|
4975
|
-
* Adds one field to an existing table and returns the updated table (HTTP 201). Required inputs are name (lowercase letters, digits and underscores; id and names starting with _ are reserved) and type (string, integer, number, boolean, datetime, json or link); json needs options.schema and link needs options.linked_table_id and options.multiple. Adding a required field to a table that already has rows needs a default, otherwise the call fails with 400 VALIDATION_FAILED; a default is written into every existing row.
|
|
4975
|
+
* Adds one field to an existing table and returns the updated table (HTTP 201). Required inputs are name (lowercase letters, digits and underscores; id and names starting with _ are reserved) and type (string, integer, number, boolean, datetime, json or link); json needs options.schema and link needs options.linked_table_id and options.multiple. Adding a required field to a table that already has rows needs a default, otherwise the call fails with 400 VALIDATION_FAILED; a default is written into every existing row. Fields default to indexed:false. Set indexed:true explicitly for fields used in filters or ordering. Only indexed:true or unique:true consumes one of the 16 indexed-or-unique field slots; a field with both consumes one slot. Unique fields still consume a slot even with indexed:false. Existing fields are unchanged. Minimal field example: {"name":"notes","type":"string","indexed":false}. JSON and link fields cannot be indexed. Limits: 64 fields and 16 indexed or unique fields per table (400 LIMIT_EXCEEDED). Unlike Supabase, schema evolution uses field definitions rather than ALTER TABLE statements or SQL migrations.
|
|
4976
4976
|
*/
|
|
4977
4977
|
export const databaseAddField = (options) => (options.client ?? client).post({
|
|
4978
4978
|
security: [{
|
|
@@ -5050,7 +5050,7 @@ export const databaseDelete = (options) => (options.client ?? client).delete({
|
|
|
5050
5050
|
/**
|
|
5051
5051
|
* Select rows
|
|
5052
5052
|
*
|
|
5053
|
-
* Read matching rows with filters, selected columns and ordering. Returns at most 1000 rows per request, including when limit is omitted. Content-Range reports the actual returned interval and the total when count is requested. PATCH and DELETE are not subject to this read cap. Unlike Supabase, casts, aggregates, spread and join modifiers are unsupported. Each table supports up to 1,000,000 rows. Query budget: 8,000 ms with a shared 3,000,000-row safety ceiling. Create indexes on filtered or sorted fields, or narrow the request when it exceeds its budget. Synchronous SQLite aggregates use candidate-row throughput estimates before execution; deployed Workers freeze clocks during synchronous CPU work, so the timer is not a guaranteed server-side interrupt. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode. Error table: QUERY_CANCELED / PostgREST 57014 is HTTP 500, retryable=false: Query timed out: index filtered or sorted fields, or narrow the range. DATABASE_INVALID_STATE is HTTP 409 for operations on a deleting database. Cleared or nonexistent databases return DATABASE_NOT_FOUND / HTTP 404. The count is an HTTP Content-Range response header, not a JSON property.
|
|
5053
|
+
* Read matching rows with filters, selected columns and ordering. Returns at most 1000 rows per request, including when limit is omitted. Content-Range reports the actual returned interval and the total when count is requested. PATCH and DELETE are not subject to this read cap. Unlike Supabase, casts, aggregates, spread and join modifiers are unsupported. Each table supports up to 1,000,000 rows. Query budget: 8,000 ms with a shared 3,000,000-row safety ceiling. Create indexes on filtered or sorted fields, or narrow the request when it exceeds its budget. Synchronous SQLite aggregates use candidate-row throughput estimates before execution; deployed Workers freeze clocks during synchronous CPU work, so the timer is not a guaranteed server-side interrupt. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode. Error table: QUERY_CANCELED / PostgREST 57014 is HTTP 500, retryable=false: Query timed out: index filtered or sorted fields, or narrow the range. DATABASE_INVALID_STATE is HTTP 409 for operations on a deleting database. Cleared or nonexistent databases return DATABASE_NOT_FOUND / HTTP 404. The count is an HTTP Content-Range response header, not a JSON property. Use praxis.database.count in the SDK or codemode to return { count: number | null }; a page length is not a total unless you know all matches fit in that page.
|
|
5054
5054
|
*/
|
|
5055
5055
|
export const databaseSelect = (options) => (options.client ?? client).get({
|
|
5056
5056
|
security: [{
|
|
@@ -5064,7 +5064,7 @@ export const databaseSelect = (options) => (options.client ?? client).get({
|
|
|
5064
5064
|
/**
|
|
5065
5065
|
* Count rows
|
|
5066
5066
|
*
|
|
5067
|
-
* Inspect the HTTP row count and range without retrieving row data; send Prefer: count=exact for a filtered count. Returns no body and does not fetch or serialize row data. A known count determines the interval using limit/offset or Range with a default and maximum page size of 1000. Without a count preference, or when the selected count mode cannot supply a total, Content-Range is **. Singular Accept still validates page cardinality. Unlike Supabase, planned and estimated counts do not use PostgreSQL planner estimates. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode.
|
|
5067
|
+
* Inspect the HTTP row count and range without retrieving row data; send Prefer: count=exact for a filtered count. Returns no body and does not fetch or serialize row data. A known count determines the interval using limit/offset or Range with a default and maximum page size of 1000. Without a count preference, or when the selected count mode cannot supply a total, Content-Range is **. Singular Accept still validates page cardinality. Unlike Supabase, planned and estimated counts do not use PostgreSQL planner estimates. Count preferences: without filters, exact, planned and estimated all use SQLite's exact b-tree count. With filters, exact counts within budget; planned skips counting and reports an unknown total (Content-Range: 0-24*); estimated attempts exact counting only when the preflight budget allows it, otherwise reports an unknown total. Preference-Applied echoes the requested count mode. Use praxis.database.count in the SDK or codemode to return { count: number | null } from this header without retrieving rows.
|
|
5068
5068
|
*/
|
|
5069
5069
|
export const databaseHead = (options) => (options.client ?? client).head({
|
|
5070
5070
|
security: [{
|
|
@@ -5098,7 +5098,7 @@ export const databaseUpdate = (options) => (options.client ?? client).patch({
|
|
|
5098
5098
|
*
|
|
5099
5099
|
* Insert rows into an existing table after defining its fields; at most 500 rows per request. Each request is atomic: any failure rolls back the entire batch. There are no transactions across requests.
|
|
5100
5100
|
* Rows are filled to the union of their keys with null; send Prefer: missing=default to use field defaults for missing keys.
|
|
5101
|
-
* The default is return=minimal: success returns HTTP 201 with an empty body. Send Prefer: return=representation to return the inserted rows. Unlike Supabase, upsert conflicts can target only id or one unique field, not a composite key. Each table supports up to 1,000,000 rows.
|
|
5101
|
+
* The default is return=minimal: success returns HTTP 201 with an empty body. Send Prefer: return=representation to return the inserted rows. With resolution=merge-duplicates, a conflicting row keeps columns omitted from the request; supplied values replace the whole field value (including JSON objects), and explicit null clears a nullable field. With resolution=ignore-duplicates, a conflicting row is left unchanged. Without a conflict, both modes insert a new row using field defaults for omitted fields. In a batch, a key present in another row is filled with null when omitted in this row unless missing=default is set; that null can overwrite a value during merge. With missing=default, omitted keys stay omitted for conflict merges (existing values are preserved); new rows use defaults, or null when no default exists. Explicit null never invokes a default. Unlike Supabase, upsert conflicts can target only id or one unique field, not a composite key. Each table supports up to 1,000,000 rows.
|
|
5102
5102
|
*/
|
|
5103
5103
|
export const databaseInsert = (options) => (options.client ?? client).post({
|
|
5104
5104
|
security: [{
|