@ax-hub/sdk 0.0.3 → 0.0.5
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/CHANGELOG.md +83 -1
- package/README.md +85 -1
- package/dist/cli/doctor.cjs +1 -1
- package/dist/cli/doctor.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +232 -19
- package/dist/index.d.ts +232 -19
- package/dist/index.js +1 -1
- package/package.json +14 -2
package/dist/index.d.ts
CHANGED
|
@@ -124,10 +124,24 @@ declare class StreamConsumedError extends AxHubError {
|
|
|
124
124
|
}
|
|
125
125
|
declare class TenantSlugRequiredError extends AxHubError {
|
|
126
126
|
}
|
|
127
|
+
declare class ConfigurationError extends AxHubError {
|
|
128
|
+
}
|
|
127
129
|
declare class PoolStaleError extends UnauthenticatedError {
|
|
128
130
|
}
|
|
129
131
|
declare class WebhookVerificationError extends ValidationError {
|
|
130
132
|
}
|
|
133
|
+
declare class TableNotFoundError extends NotFoundError {
|
|
134
|
+
}
|
|
135
|
+
declare class IntrospectFailedError extends InternalServerError {
|
|
136
|
+
}
|
|
137
|
+
declare class InvalidCursorError extends ValidationError {
|
|
138
|
+
}
|
|
139
|
+
declare class LegacyCursorError extends ValidationError {
|
|
140
|
+
}
|
|
141
|
+
declare class MockInProductionError extends ConfigurationError {
|
|
142
|
+
}
|
|
143
|
+
declare class ScanLimitExceededError extends InternalServerError {
|
|
144
|
+
}
|
|
131
145
|
interface OAuthErrorInit {
|
|
132
146
|
code: string;
|
|
133
147
|
description?: string;
|
|
@@ -317,10 +331,22 @@ interface PaginatedList<T> {
|
|
|
317
331
|
items: T[];
|
|
318
332
|
nextCursor: string | null;
|
|
319
333
|
total: number;
|
|
334
|
+
firstCursor?: string | null;
|
|
335
|
+
hasNext?: boolean;
|
|
336
|
+
hasPrev?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* `true` when `total` reflects the full filtered result set the caller will
|
|
339
|
+
* see. `false` when SDK-side filtering (no backend `where` pushdown) means
|
|
340
|
+
* `total` is the backend's unfiltered total and the true filtered count
|
|
341
|
+
* requires walking remaining pages. Absent on plain unfiltered queries.
|
|
342
|
+
*/
|
|
343
|
+
totalIsExact?: boolean;
|
|
320
344
|
}
|
|
321
345
|
interface ListOptions {
|
|
322
346
|
pageSize?: number;
|
|
323
347
|
cursor?: string;
|
|
348
|
+
after?: string;
|
|
349
|
+
before?: string;
|
|
324
350
|
}
|
|
325
351
|
interface ListAllOptions extends ListOptions {
|
|
326
352
|
signal?: AbortSignal;
|
|
@@ -332,6 +358,47 @@ type ListAllItem<T> = {
|
|
|
332
358
|
type: 'drift';
|
|
333
359
|
addedSince: number;
|
|
334
360
|
};
|
|
361
|
+
type CursorDirection = 'forward' | 'backward';
|
|
362
|
+
type OrderDirection = 'asc' | 'desc';
|
|
363
|
+
interface OrderByField {
|
|
364
|
+
field: string;
|
|
365
|
+
dir?: OrderDirection;
|
|
366
|
+
}
|
|
367
|
+
type DataOrderBy = string | readonly OrderByField[];
|
|
368
|
+
interface KeysetCursor {
|
|
369
|
+
values: Record<string, string | number | boolean | null>;
|
|
370
|
+
direction: CursorDirection;
|
|
371
|
+
orderBy: OrderByField[];
|
|
372
|
+
orderByFingerprint: string;
|
|
373
|
+
tiebreaker?: {
|
|
374
|
+
field: string;
|
|
375
|
+
value: string | number;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Backend compatibility metadata. Current AX Hub data API exposes offset
|
|
379
|
+
* `page`/`per_page` pagination and treats unknown query keys as filters, so
|
|
380
|
+
* SDK-generated v2 cursors carry the next/previous page number instead of
|
|
381
|
+
* sending unsupported `after`/`before` query parameters to production.
|
|
382
|
+
*/
|
|
383
|
+
page?: number;
|
|
384
|
+
/**
|
|
385
|
+
* Scope binding. SDK-generated cursors carry a fingerprint of the
|
|
386
|
+
* `${tenant}/${app}/${table}` resource so a cursor minted on table A cannot
|
|
387
|
+
* be silently replayed against table B. Optional on decoded cursors for
|
|
388
|
+
* backward compatibility with backend-emitted cursors that omit it.
|
|
389
|
+
*/
|
|
390
|
+
contextFingerprint?: string;
|
|
391
|
+
}
|
|
392
|
+
interface CursorBuildOptions {
|
|
393
|
+
direction?: CursorDirection;
|
|
394
|
+
orderBy?: DataOrderBy;
|
|
395
|
+
page?: number;
|
|
396
|
+
contextFingerprint?: string;
|
|
397
|
+
}
|
|
398
|
+
declare function encodeCursor(cursor: KeysetCursor): string;
|
|
399
|
+
declare function decodeCursor(token: string): KeysetCursor;
|
|
400
|
+
declare function orderByFingerprint(orderBy?: DataOrderBy): string;
|
|
401
|
+
declare function cursorFromRow(row: Record<string, unknown> | undefined, opts?: CursorBuildOptions): string | null;
|
|
335
402
|
|
|
336
403
|
interface RequestOptions {
|
|
337
404
|
signal?: AbortSignal;
|
|
@@ -365,10 +432,17 @@ interface GatewayQueryInput {
|
|
|
365
432
|
params?: unknown[];
|
|
366
433
|
rowLimit?: number;
|
|
367
434
|
}
|
|
435
|
+
interface GatewayQueryColumn {
|
|
436
|
+
name: string;
|
|
437
|
+
dataType: string;
|
|
438
|
+
}
|
|
368
439
|
interface GatewayQueryResult<Row = Record<string, unknown>> {
|
|
440
|
+
allowed: boolean;
|
|
441
|
+
denyReason?: string;
|
|
442
|
+
columns: GatewayQueryColumn[];
|
|
369
443
|
rows: Row[];
|
|
370
444
|
rowCount: number;
|
|
371
|
-
|
|
445
|
+
matchedPolicies?: string[];
|
|
372
446
|
}
|
|
373
447
|
declare class GatewayClient {
|
|
374
448
|
private readonly http;
|
|
@@ -394,7 +468,7 @@ declare class GatewayCrud<T extends {
|
|
|
394
468
|
protected readonly http: HttpClient;
|
|
395
469
|
protected readonly base: string;
|
|
396
470
|
constructor(http: HttpClient, base: string);
|
|
397
|
-
list(opts?:
|
|
471
|
+
list(opts?: RequestOptions): Promise<T[]>;
|
|
398
472
|
get(id: string, opts?: RequestOptions): Promise<T>;
|
|
399
473
|
create(input: Record<string, unknown>, opts?: RequestOptions): Promise<T>;
|
|
400
474
|
update(id: string, patch: Record<string, unknown>, opts?: RequestOptions): Promise<T>;
|
|
@@ -1500,6 +1574,30 @@ declare class AppsClient {
|
|
|
1500
1574
|
deleteEnvVar: (...args: Parameters<AppsEnvVarsMixin["deleteEnvVar"]>) => Promise<void>;
|
|
1501
1575
|
}
|
|
1502
1576
|
|
|
1577
|
+
interface ValidationOptions {
|
|
1578
|
+
/**
|
|
1579
|
+
* Zod-compatible schema. The SDK deliberately duck-types `safeParse` so
|
|
1580
|
+
* zod stays an optional peer dependency and is never bundled.
|
|
1581
|
+
*/
|
|
1582
|
+
validate?: ZodSchemaLike;
|
|
1583
|
+
}
|
|
1584
|
+
interface ZodIssueLike {
|
|
1585
|
+
path?: Array<string | number>;
|
|
1586
|
+
code?: string;
|
|
1587
|
+
message?: string;
|
|
1588
|
+
}
|
|
1589
|
+
interface ZodErrorLike {
|
|
1590
|
+
issues?: ZodIssueLike[];
|
|
1591
|
+
}
|
|
1592
|
+
interface ZodResultLike {
|
|
1593
|
+
success: boolean;
|
|
1594
|
+
error?: ZodErrorLike;
|
|
1595
|
+
}
|
|
1596
|
+
interface ZodSchemaLike {
|
|
1597
|
+
safeParse(data: unknown): ZodResultLike;
|
|
1598
|
+
partial?: () => ZodSchemaLike;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1503
1601
|
type ColumnPrimitive = 'uuid' | 'string' | 'number' | 'integer' | 'boolean' | 'timestamp' | 'json';
|
|
1504
1602
|
type EnumColumn<V extends readonly string[]> = {
|
|
1505
1603
|
type: 'enum';
|
|
@@ -1512,12 +1610,13 @@ interface DataColumn<Name extends string = string, Def extends ColumnDef = Colum
|
|
|
1512
1610
|
name: Name;
|
|
1513
1611
|
def: Def;
|
|
1514
1612
|
}
|
|
1515
|
-
interface DataTableSchema<Row extends Record<string, unknown> = Record<string, unknown
|
|
1613
|
+
interface DataTableSchema<Row extends Record<string, unknown> = Record<string, unknown>, S extends SchemaShape = SchemaShape> {
|
|
1516
1614
|
table: string;
|
|
1517
|
-
columns:
|
|
1615
|
+
columns: S;
|
|
1518
1616
|
cols: {
|
|
1519
|
-
[K in keyof
|
|
1617
|
+
[K in keyof S & string]: DataColumn<K, S[K]>;
|
|
1520
1618
|
};
|
|
1619
|
+
validate?: ZodSchemaLike;
|
|
1521
1620
|
}
|
|
1522
1621
|
type ColumnValue<D extends ColumnDef> = D extends {
|
|
1523
1622
|
type: 'enum';
|
|
@@ -1526,10 +1625,17 @@ type ColumnValue<D extends ColumnDef> = D extends {
|
|
|
1526
1625
|
type RowFromSchema<S extends SchemaShape> = {
|
|
1527
1626
|
[K in keyof S & string]: ColumnValue<S[K]>;
|
|
1528
1627
|
};
|
|
1628
|
+
type InferRow<T extends DataTableSchema> = T extends DataTableSchema<infer Row, SchemaShape> ? Row : never;
|
|
1629
|
+
type StringColumnDef<V> = string extends V ? 'string' : EnumColumn<readonly Extract<V, string>[]>;
|
|
1630
|
+
type ColumnDefFromValue<V> = V extends boolean ? 'boolean' : V extends number ? 'number' : V extends string ? StringColumnDef<V> : 'json';
|
|
1631
|
+
type SchemaShapeFromRow<Row extends Record<string, unknown>> = {
|
|
1632
|
+
[K in keyof Row & string]: ColumnDefFromValue<Row[K]>;
|
|
1633
|
+
};
|
|
1529
1634
|
declare function defineSchema<const S extends SchemaShape>(input: {
|
|
1530
1635
|
table: string;
|
|
1531
1636
|
columns: S;
|
|
1532
|
-
}): DataTableSchema<RowFromSchema<S
|
|
1637
|
+
}, opts?: ValidationOptions): DataTableSchema<RowFromSchema<S>, S>;
|
|
1638
|
+
declare function defineSchema<Row extends Record<string, unknown>, S extends SchemaShape>(input: DataTableSchema<Row, S>, opts: ValidationOptions): DataTableSchema<Row, S>;
|
|
1533
1639
|
|
|
1534
1640
|
type QueryExpr = {
|
|
1535
1641
|
op: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'like';
|
|
@@ -1555,7 +1661,9 @@ declare function raw(sql: string, params?: unknown[]): QueryExpr;
|
|
|
1555
1661
|
declare function and(...clauses: QueryExpr[]): QueryExpr;
|
|
1556
1662
|
declare function or(...clauses: QueryExpr[]): QueryExpr;
|
|
1557
1663
|
declare function not(clause: QueryExpr): QueryExpr;
|
|
1558
|
-
declare function where<
|
|
1664
|
+
declare function where<D extends ColumnDef>(column: DataColumn<string, D>): WhereBuilder<ColumnValue<D>>;
|
|
1665
|
+
declare function where<T = unknown>(column: string): WhereBuilder<T>;
|
|
1666
|
+
interface WhereBuilder<T> {
|
|
1559
1667
|
eq: (value: T) => QueryExpr;
|
|
1560
1668
|
ne: (value: T) => QueryExpr;
|
|
1561
1669
|
gt: (value: T) => QueryExpr;
|
|
@@ -1569,24 +1677,103 @@ declare function where<T>(column: DataColumn<string> | string): {
|
|
|
1569
1677
|
endsWith: (value: string) => QueryExpr;
|
|
1570
1678
|
raw: (value: string) => QueryExpr;
|
|
1571
1679
|
};
|
|
1572
|
-
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
interface DiscoverOptions extends RequestOptions {
|
|
1683
|
+
/**
|
|
1684
|
+
* Bypass the schema cache and force a backend introspection request.
|
|
1685
|
+
*/
|
|
1686
|
+
fresh?: boolean;
|
|
1687
|
+
/**
|
|
1688
|
+
* Override the cache TTL for this discovered schema.
|
|
1689
|
+
*/
|
|
1690
|
+
ttlMs?: number;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
type SelectColumns<Row extends Record<string, unknown>> = readonly (keyof Row & string)[];
|
|
1573
1694
|
|
|
1574
|
-
interface
|
|
1695
|
+
interface SchemaCacheOptions {
|
|
1696
|
+
maxEntries?: number;
|
|
1697
|
+
ttlMs?: number;
|
|
1698
|
+
negativeTtlMs?: number;
|
|
1699
|
+
}
|
|
1700
|
+
interface SchemaCacheLookupOptions {
|
|
1701
|
+
fresh?: boolean;
|
|
1702
|
+
ttlMs?: number;
|
|
1703
|
+
}
|
|
1704
|
+
declare class SchemaCache {
|
|
1705
|
+
private readonly store;
|
|
1706
|
+
private readonly inflight;
|
|
1707
|
+
private readonly maxEntries;
|
|
1708
|
+
private readonly ttlMs;
|
|
1709
|
+
private readonly negativeTtlMs;
|
|
1710
|
+
private writeCounter;
|
|
1711
|
+
constructor(opts?: SchemaCacheOptions);
|
|
1712
|
+
get size(): number;
|
|
1713
|
+
get(key: string): DataTableSchema<Record<string, unknown>> | null;
|
|
1714
|
+
set(key: string, schema: DataTableSchema<Record<string, unknown>>, opts?: Pick<SchemaCacheLookupOptions, 'ttlMs'>): void;
|
|
1715
|
+
invalidate(key?: string): void;
|
|
1716
|
+
getOrSet(key: string, loader: () => Promise<DataTableSchema<Record<string, unknown>>>, opts?: SchemaCacheLookupOptions): Promise<DataTableSchema<Record<string, unknown>>>;
|
|
1717
|
+
private evictOverflow;
|
|
1718
|
+
}
|
|
1719
|
+
declare function schemaCacheKey(tenantSlug: string, appSlug: string, table: string): string;
|
|
1720
|
+
|
|
1721
|
+
type MockRow = Record<string, unknown>;
|
|
1722
|
+
type MockFixtures = Record<string, MockRow[]>;
|
|
1723
|
+
type MockSchemas = Record<string, DataTableSchema<MockRow>>;
|
|
1724
|
+
declare class MockStore {
|
|
1725
|
+
private readonly initialFixtures;
|
|
1726
|
+
private tables;
|
|
1727
|
+
private readonly schemas;
|
|
1728
|
+
private nextId;
|
|
1729
|
+
constructor(fixtures?: MockFixtures, schemas?: MockSchemas);
|
|
1730
|
+
keys(): string[];
|
|
1731
|
+
schema(key: string): DataTableSchema<MockRow> | undefined;
|
|
1732
|
+
list(key: string): MockRow[];
|
|
1733
|
+
get(key: string, id: string): MockRow | null;
|
|
1734
|
+
insert(key: string, row: MockRow): MockRow;
|
|
1735
|
+
update(key: string, id: string, patch: MockRow): MockRow;
|
|
1736
|
+
delete(key: string, id: string): void;
|
|
1737
|
+
reset(key?: string): void;
|
|
1738
|
+
private ensureTable;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
interface MockRuntime<Row extends Record<string, unknown>> {
|
|
1742
|
+
store: MockStore;
|
|
1743
|
+
key: string;
|
|
1744
|
+
schema?: DataTableSchema<Row>;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
interface DataClientOptions {
|
|
1748
|
+
schemaCache?: SchemaCacheOptions | SchemaCache;
|
|
1749
|
+
mockStore?: MockStore;
|
|
1750
|
+
}
|
|
1751
|
+
interface DataListOptions<Row extends Record<string, unknown> = Record<string, unknown>> extends ListOptions, RequestOptions {
|
|
1575
1752
|
where?: QueryExpr;
|
|
1576
|
-
orderBy?:
|
|
1753
|
+
orderBy?: DataOrderBy;
|
|
1754
|
+
select?: SelectColumns<Row>;
|
|
1755
|
+
limit?: number;
|
|
1756
|
+
direction?: CursorDirection;
|
|
1577
1757
|
}
|
|
1578
1758
|
interface DataCountOptions extends RequestOptions {
|
|
1579
1759
|
where?: QueryExpr;
|
|
1580
1760
|
}
|
|
1761
|
+
interface DataGetOptions<Row extends Record<string, unknown> = Record<string, unknown>> extends RequestOptions {
|
|
1762
|
+
select?: SelectColumns<Row>;
|
|
1763
|
+
}
|
|
1581
1764
|
interface DataBulkResult<Row = unknown> {
|
|
1582
1765
|
items: Row[];
|
|
1583
1766
|
count: number;
|
|
1584
1767
|
}
|
|
1585
1768
|
declare class DataClient {
|
|
1586
1769
|
private readonly http;
|
|
1587
|
-
|
|
1770
|
+
private readonly schemaCache;
|
|
1771
|
+
private readonly mockStore?;
|
|
1772
|
+
constructor(http: HttpClient, opts?: DataClientOptions);
|
|
1588
1773
|
table<Row extends Record<string, unknown> = Record<string, unknown>>(tenantSlug: string, appSlug: string, table: string | DataTableSchema<Row>): DataTableClient<Row>;
|
|
1589
1774
|
scoped(tenantSlug: string): TenantDataFactory;
|
|
1775
|
+
discover<Row extends Record<string, unknown> = Record<string, unknown>>(tenantSlug: string, appSlug: string, table: string, opts?: DiscoverOptions): Promise<DataTableClient<Row, SchemaShapeFromRow<Row>>>;
|
|
1776
|
+
invalidateSchema(tenantSlug?: string, appSlug?: string, table?: string): void;
|
|
1590
1777
|
}
|
|
1591
1778
|
declare class TenantDataFactory {
|
|
1592
1779
|
private readonly data;
|
|
@@ -1600,18 +1787,29 @@ declare class AppDataFactory {
|
|
|
1600
1787
|
private readonly appSlug;
|
|
1601
1788
|
constructor(data: DataClient, tenantSlug: string, appSlug: string);
|
|
1602
1789
|
table<Row extends Record<string, unknown> = Record<string, unknown>>(table: string | DataTableSchema<Row>): DataTableClient<Row>;
|
|
1790
|
+
discover<Row extends Record<string, unknown> = Record<string, unknown>>(table: string, opts?: DiscoverOptions): Promise<DataTableClient<Row, SchemaShapeFromRow<Row>>>;
|
|
1791
|
+
invalidateSchema(table?: string): void;
|
|
1603
1792
|
}
|
|
1604
|
-
declare class DataTableClient<Row extends Record<string, unknown> = Record<string, unknown
|
|
1793
|
+
declare class DataTableClient<Row extends Record<string, unknown> = Record<string, unknown>, S extends SchemaShape = SchemaShape> {
|
|
1605
1794
|
private readonly http;
|
|
1606
1795
|
private readonly tenantSlug;
|
|
1607
1796
|
private readonly appSlug;
|
|
1608
1797
|
private readonly tableName;
|
|
1609
|
-
|
|
1798
|
+
readonly schema?: DataTableSchema<Row, S> | undefined;
|
|
1799
|
+
private readonly mockRuntime?;
|
|
1800
|
+
private readonly contextFingerprint;
|
|
1801
|
+
constructor(http: HttpClient, tenantSlug: string, appSlug: string, tableName: string, schema?: DataTableSchema<Row, S> | undefined, mockRuntime?: MockRuntime<Row> | undefined);
|
|
1610
1802
|
private path;
|
|
1611
|
-
list(opts
|
|
1612
|
-
|
|
1803
|
+
list<const K extends keyof Row & string>(opts: DataListOptions<Row> & {
|
|
1804
|
+
select: readonly K[];
|
|
1805
|
+
}): Promise<PaginatedList<Pick<Row, K>>>;
|
|
1806
|
+
list(opts?: DataListOptions<Row>): Promise<PaginatedList<Row>>;
|
|
1807
|
+
listAll(opts?: DataListOptions<Row>): AsyncGenerator<ListAllItem<Row>>;
|
|
1613
1808
|
count(opts?: DataCountOptions): Promise<number>;
|
|
1614
|
-
get(id: string, opts
|
|
1809
|
+
get<const K extends keyof Row & string>(id: string, opts: DataGetOptions<Row> & {
|
|
1810
|
+
select: readonly K[];
|
|
1811
|
+
}): Promise<Pick<Row, K>>;
|
|
1812
|
+
get(id: string, opts?: DataGetOptions<Row>): Promise<Row>;
|
|
1615
1813
|
insert(row: Partial<Row>, opts?: RequestOptions): Promise<Row>;
|
|
1616
1814
|
insertMany(rows: Array<Partial<Row>>, opts?: RequestOptions): Promise<DataBulkResult<Row>>;
|
|
1617
1815
|
update(id: string, patch: Partial<Row>, opts?: RequestOptions): Promise<Row>;
|
|
@@ -1654,6 +1852,8 @@ declare class AppScopedDataClient {
|
|
|
1654
1852
|
private readonly rootData;
|
|
1655
1853
|
constructor(tenantSlug: string, appSlug: string, rootData: DataClient);
|
|
1656
1854
|
table<Row extends Record<string, unknown> = Record<string, unknown>>(table: string | DataTableSchema<Row>): DataTableClient<Row>;
|
|
1855
|
+
discover<Row extends Record<string, unknown> = Record<string, unknown>>(table: string, opts?: DiscoverOptions): Promise<DataTableClient<Row, SchemaShapeFromRow<Row>>>;
|
|
1856
|
+
invalidateSchema(table?: string): void;
|
|
1657
1857
|
}
|
|
1658
1858
|
declare class AppScopedTablesClient {
|
|
1659
1859
|
private readonly tenantSlug;
|
|
@@ -2049,13 +2249,21 @@ declare class PublicationRequestsClient {
|
|
|
2049
2249
|
listPending(opts?: ListOptions): Promise<PaginatedList<PublicationRequest>>;
|
|
2050
2250
|
}
|
|
2051
2251
|
|
|
2252
|
+
interface MockClientOptions {
|
|
2253
|
+
mode?: 'live' | 'mock';
|
|
2254
|
+
fixtures?: MockFixtures;
|
|
2255
|
+
schemas?: Record<string, DataTableSchema<Record<string, unknown>>>;
|
|
2256
|
+
}
|
|
2257
|
+
declare function createMockStore(opts: MockClientOptions): MockStore | undefined;
|
|
2258
|
+
declare function assertMockModeAllowed(): void;
|
|
2259
|
+
|
|
2052
2260
|
/**
|
|
2053
2261
|
* Default production base URL for AX Hub. Override via `baseUrl` for staging,
|
|
2054
2262
|
* local dev, or self-hosted environments. Also overridable via env var
|
|
2055
2263
|
* `AX_HUB_BASE_URL` (caller wires this if desired).
|
|
2056
2264
|
*/
|
|
2057
2265
|
declare const DEFAULT_BASE_URL = "https://axhub-api.jocodingax.ai";
|
|
2058
|
-
interface AxHubClientOptions {
|
|
2266
|
+
interface AxHubClientOptions extends MockClientOptions {
|
|
2059
2267
|
/**
|
|
2060
2268
|
* Backend root URL. Defaults to {@link DEFAULT_BASE_URL}. Override for
|
|
2061
2269
|
* staging / self-hosted / local dev.
|
|
@@ -2080,18 +2288,23 @@ interface AxHubClientOptions {
|
|
|
2080
2288
|
};
|
|
2081
2289
|
retryPolicy?: RetryPolicy;
|
|
2082
2290
|
rateLimitStrategy?: RateLimitStrategy;
|
|
2291
|
+
schemaCache?: SchemaCacheOptions;
|
|
2083
2292
|
}
|
|
2084
2293
|
interface AxHubInternalOptions {
|
|
2085
|
-
__sharedHttp: HttpClient;
|
|
2294
|
+
'__sharedHttp': HttpClient;
|
|
2086
2295
|
defaultTenantSlug: string;
|
|
2087
2296
|
defaultTenantId?: string;
|
|
2088
2297
|
logger: Logger;
|
|
2298
|
+
schemaCacheOptions?: SchemaCacheOptions;
|
|
2299
|
+
mockStore?: MockStore;
|
|
2089
2300
|
}
|
|
2090
2301
|
declare class AxHubClient {
|
|
2091
2302
|
readonly http: HttpClient;
|
|
2092
2303
|
readonly defaultTenantSlug?: string;
|
|
2093
2304
|
readonly defaultTenantId?: string;
|
|
2094
2305
|
readonly logger: Logger;
|
|
2306
|
+
private readonly schemaCacheOptions?;
|
|
2307
|
+
readonly mock?: MockStore;
|
|
2095
2308
|
private _apps?;
|
|
2096
2309
|
private _audit?;
|
|
2097
2310
|
private _authz?;
|
|
@@ -2190,4 +2403,4 @@ interface VerifyWebhookResult {
|
|
|
2190
2403
|
declare function signWebhook(rawBody: Buffer | Uint8Array | string, secret: string, timestamp?: string): string;
|
|
2191
2404
|
declare function verifyWebhook(input: VerifyWebhookInput): VerifyWebhookResult;
|
|
2192
2405
|
|
|
2193
|
-
export { AbortError, AccessDeniedError, type AddColumnInput, type AddCommentInput, type AddGrantInput, AlreadyAccessedError, AlreadyActiveError, AlreadyDeletedError, AlreadyInactiveError, AlreadyMemberError, AlreadyRevokedError, AlreadySettledError, type AnonymizeInput, type AppAccess, type AppCategory, type AppID, type AppId, type AppResponse, AppScopedClient, AppScopedDataClient, type AppSlug, type AppTable, type AppTemplate, AppUnavailableError, AppsClient, AuditClient, type AuditEvent, type AuditEventID, type AuthProvider, type AuthRing, AuthorizationPendingError, AuthzClient, type AuthzGrant, type AuthzSubject, type AuthzTag, AxHubClient, type AxHubClientOptions, AxHubError, type AxHubErrorInit, BadRequestError, type Branded, type BuildLogEvent, type BulkInviteResult, type ColumnType, type Comment, ConflictError, type ConnectGitInput, type ConnectorID, type CreateAppInput, type CreateCategoryInput, type CreateDeploymentInput, type CreateOAuthClientInput, type CreateTableInput, type CreateTenantInput, DEFAULT_BASE_URL, type DataBulkResult, DataClient, type DataCountOptions, type DataListOptions, DataTableClient, type DataTableSchema, type DecideInput, type DecideResult, DecodeError, type DeploymentID, type DeploymentId, type DeploymentResponse, type DeploymentStatus, DeploymentsClient, type DeviceAuthorizationResponse, DeviceFlowDeniedError, DeviceFlowTimeoutError, type DiscoverAppsOptions, type DispatchContext, DomainTakenError, DuplicateError, type EmailDomain, type EmitAuditEventInput, EmptyError, type EnvVar, ExpiredTokenError, type FetchLike, type FieldError, ForbiddenError, GatewayClient, type GatewayConnector, type GatewayEngine, type GatewayQueryInput, type GatewayQueryResult, type GatewayResource, type GitConnection, type GitConnectionSetup, type GitConnectionStatus, type GithubInstallStart, type GrantID, type GrantPrincipalType, type GrantScope, IdentityClient, IdentityDeviceCodeClient, IdentityMeClient, IdentityOAuthClient, IdentityOIDCClient, IdentityPATClient, type IdentityProvider, IdentityProviderClient, IdentitySystemOAuthClientsClient, type InstallStartInput, type IntegrityCheckResult, InternalServerError, InvalidGrantError, InvalidPathError, InvalidStateTransitionError, InvalidValueError, InvitationExpiredError, type InviteTenantMemberInput, type IssuePersonalAccessTokenInput, type IssuePersonalAccessTokenResult, LastAdminError, type LikeResult, type LikeStatus, type ListAllItem, type ListAllOptions, type ListOptions, type Logger, type MeResponse, NetworkError, NoAuth, NotAdminError, NotAllowedError, NotDeletedError, NotFoundError, NotMemberError, type OAuthClient, type OAuthClientWithSecret, OAuthError, type OAuthErrorInit, type OAuthTokenResponse, type PATID, type PATSummary, type PaginatedList, type ParsedFrame, type PatId, PendingExistsError, PermanentlyDeletedError, PermissionDeniedError, type PodEventEvent, type PodLogEvent, PoolStaleError, PreconditionFailedError, type PublicationRequest, type PublicationRequestStatus, PublicationRequestsClient, type QueryExpr, type RateLimitStrategy, RateLimitedError, type RequestId, RequiredError, type ResourceID, type RetryInfo, type SSEStream, SchemaNameTakenError, type SettlePublicationInput, type SignIconUploadInput, type SignIconUploadResult, SlowDownError, SlugTakenError, StaticTokenAuth, StreamConsumedError, type StreamItem, type SubjectID, type SubmitPublicationInput, type SystemOAuthClient, type TableColumn, type TableConstraint, type TableGrant, type TableID, type TableIndex, type TableSchema, type TagID, type Tenant, type TenantID, type TenantId, type TenantInvitation, type TenantMember, TenantScopedAppsClient, TenantScopedClient, type TenantSlug, TenantSlugRequiredError, TenantsClient, TimeoutError, TokenExpiredError, TokenInvalidError, TokenMissingError, type TokenType, UnauthenticatedError, UnavailableError, type UnlikeResult, type UnpublishInput, type UpdateAppInput, type UpdateGitConnectionInput, type UpdateTenantInput, type UserID, type UserId, ValidationError, type VerifyWebhookInput, type VerifyWebhookResult, WebhookVerificationError, type WebhookVerifyReason, and, asAppId, asAppSlug, asDeploymentId, asPatId, asRequestId, asTenantId, asTenantSlug, asUserId, defineSchema, dispatch, escapeLike, formatErrorMessage, id, isOAuthPath, not, or, parseRetryAfter, raw, signWebhook, verifyWebhook, where };
|
|
2406
|
+
export { AbortError, AccessDeniedError, type AddColumnInput, type AddCommentInput, type AddGrantInput, AlreadyAccessedError, AlreadyActiveError, AlreadyDeletedError, AlreadyInactiveError, AlreadyMemberError, AlreadyRevokedError, AlreadySettledError, type AnonymizeInput, type AppAccess, type AppCategory, type AppID, type AppId, type AppResponse, AppScopedClient, AppScopedDataClient, type AppSlug, type AppTable, type AppTemplate, AppUnavailableError, AppsClient, AuditClient, type AuditEvent, type AuditEventID, type AuthProvider, type AuthRing, AuthorizationPendingError, AuthzClient, type AuthzGrant, type AuthzSubject, type AuthzTag, AxHubClient, type AxHubClientOptions, AxHubError, type AxHubErrorInit, BadRequestError, type Branded, type BuildLogEvent, type BulkInviteResult, type ColumnType, type Comment, ConfigurationError, ConflictError, type ConnectGitInput, type ConnectorID, type CreateAppInput, type CreateCategoryInput, type CreateDeploymentInput, type CreateOAuthClientInput, type CreateTableInput, type CreateTenantInput, type CursorDirection, DEFAULT_BASE_URL, type DataBulkResult, DataClient, type DataCountOptions, type DataGetOptions, type DataListOptions, type DataOrderBy, DataTableClient, type DataTableSchema, type DecideInput, type DecideResult, DecodeError, type DeploymentID, type DeploymentId, type DeploymentResponse, type DeploymentStatus, DeploymentsClient, type DeviceAuthorizationResponse, DeviceFlowDeniedError, DeviceFlowTimeoutError, type DiscoverAppsOptions, type DiscoverOptions, type DispatchContext, DomainTakenError, DuplicateError, type EmailDomain, type EmitAuditEventInput, EmptyError, type EnvVar, ExpiredTokenError, type FetchLike, type FieldError, ForbiddenError, GatewayClient, type GatewayConnector, type GatewayEngine, type GatewayQueryColumn, type GatewayQueryInput, type GatewayQueryResult, type GatewayResource, type GitConnection, type GitConnectionSetup, type GitConnectionStatus, type GithubInstallStart, type GrantID, type GrantPrincipalType, type GrantScope, IdentityClient, IdentityDeviceCodeClient, IdentityMeClient, IdentityOAuthClient, IdentityOIDCClient, IdentityPATClient, type IdentityProvider, IdentityProviderClient, IdentitySystemOAuthClientsClient, type InferRow, type InstallStartInput, type IntegrityCheckResult, InternalServerError, IntrospectFailedError, InvalidCursorError, InvalidGrantError, InvalidPathError, InvalidStateTransitionError, InvalidValueError, InvitationExpiredError, type InviteTenantMemberInput, type IssuePersonalAccessTokenInput, type IssuePersonalAccessTokenResult, type KeysetCursor, LastAdminError, LegacyCursorError, type LikeResult, type LikeStatus, type ListAllItem, type ListAllOptions, type ListOptions, type Logger, type MeResponse, type MockClientOptions, type MockFixtures, MockInProductionError, type MockRow, type MockSchemas, MockStore, NetworkError, NoAuth, NotAdminError, NotAllowedError, NotDeletedError, NotFoundError, NotMemberError, type OAuthClient, type OAuthClientWithSecret, OAuthError, type OAuthErrorInit, type OAuthTokenResponse, type OrderByField, type PATID, type PATSummary, type PaginatedList, type ParsedFrame, type PatId, PendingExistsError, PermanentlyDeletedError, PermissionDeniedError, type PodEventEvent, type PodLogEvent, PoolStaleError, PreconditionFailedError, type PublicationRequest, type PublicationRequestStatus, PublicationRequestsClient, type QueryExpr, type RateLimitStrategy, RateLimitedError, type RequestId, RequiredError, type ResourceID, type RetryInfo, type SSEStream, ScanLimitExceededError, SchemaCache, type SchemaCacheOptions, SchemaNameTakenError, type SchemaShapeFromRow, type SelectColumns, type SettlePublicationInput, type SignIconUploadInput, type SignIconUploadResult, SlowDownError, SlugTakenError, StaticTokenAuth, StreamConsumedError, type StreamItem, type SubjectID, type SubmitPublicationInput, type SystemOAuthClient, type TableColumn, type TableConstraint, type TableGrant, type TableID, type TableIndex, TableNotFoundError, type TableSchema, type TagID, type Tenant, type TenantID, type TenantId, type TenantInvitation, type TenantMember, TenantScopedAppsClient, TenantScopedClient, type TenantSlug, TenantSlugRequiredError, TenantsClient, TimeoutError, TokenExpiredError, TokenInvalidError, TokenMissingError, type TokenType, UnauthenticatedError, UnavailableError, type UnlikeResult, type UnpublishInput, type UpdateAppInput, type UpdateGitConnectionInput, type UpdateTenantInput, type UserID, type UserId, ValidationError, type VerifyWebhookInput, type VerifyWebhookResult, WebhookVerificationError, type WebhookVerifyReason, and, asAppId, asAppSlug, asDeploymentId, asPatId, asRequestId, asTenantId, asTenantSlug, asUserId, assertMockModeAllowed, createMockStore, cursorFromRow, decodeCursor, defineSchema, dispatch, encodeCursor, escapeLike, formatErrorMessage, id, isOAuthPath, not, or, orderByFingerprint, parseRetryAfter, raw, schemaCacheKey, signWebhook, verifyWebhook, where };
|