@vxil/sdk 0.13.0 → 0.13.1
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/index.d.ts +96 -96
- package/dist/index.js +52 -52
- package/dist/qs.js +1 -1
- package/dist/reporting.js +1 -2
- package/dist/retry.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -475,7 +475,7 @@ export interface RateLimitOverride {
|
|
|
475
475
|
created_at: string;
|
|
476
476
|
updated_at?: string;
|
|
477
477
|
}
|
|
478
|
-
/** A payments provider webhook delivery in the event log (
|
|
478
|
+
/** A payments provider webhook delivery in the event log (guide ch. 6, payments).
|
|
479
479
|
* `payload` and `raw_body` are only populated on the detail read. */
|
|
480
480
|
export interface PaymentsWebhookEvent {
|
|
481
481
|
event_id: string;
|
|
@@ -508,7 +508,7 @@ export interface PaymentsWebhookEvent {
|
|
|
508
508
|
raw_body?: string | null;
|
|
509
509
|
provider_event_ts?: string | null;
|
|
510
510
|
}
|
|
511
|
-
/** The outcome of a provider re-sync / Restore Purchases (
|
|
511
|
+
/** The outcome of a provider re-sync / Restore Purchases (guide ch. 6, payments). */
|
|
512
512
|
export interface PaymentsSyncOutcome {
|
|
513
513
|
provider: string;
|
|
514
514
|
synced: number;
|
|
@@ -523,7 +523,7 @@ export interface PaymentsSyncOutcome {
|
|
|
523
523
|
}>;
|
|
524
524
|
dry_run?: boolean;
|
|
525
525
|
}
|
|
526
|
-
/** A lifecycle simulation run (
|
|
526
|
+
/** A lifecycle simulation run (guide ch. 6, payments; mock/dev tenants only). */
|
|
527
527
|
export interface PaymentsSimulationResult {
|
|
528
528
|
scenario: string;
|
|
529
529
|
run_id: string;
|
|
@@ -545,8 +545,8 @@ export interface PaymentsSimulationResult {
|
|
|
545
545
|
pass: boolean;
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
|
-
/** The ONE complete entitlement read (GET /v1/payments/entitlements;
|
|
549
|
-
*
|
|
548
|
+
/** The ONE complete entitlement read (GET /v1/payments/entitlements; guide ch. 6,
|
|
549
|
+
* payments). `until` is the winning subscription's current_period_end (+ the
|
|
550
550
|
* configured grace window when it is past_due); null on the free baseline. */
|
|
551
551
|
export interface PaymentsEntitlementView {
|
|
552
552
|
user_id: string;
|
|
@@ -581,7 +581,7 @@ export interface PaymentsEntitlementView {
|
|
|
581
581
|
* `completed` (Paddle paid → completed). Handle `succeeded` gated on
|
|
582
582
|
* `provider_status === 'completed'` plus `completed` to act once per charge. */
|
|
583
583
|
export type PaymentsProviderChargeStatus = 'paid' | 'completed';
|
|
584
|
-
/** A charge row as listed by GET /v1/payments/charges (
|
|
584
|
+
/** A charge row as listed by GET /v1/payments/charges (guide ch. 6, payments). */
|
|
585
585
|
export interface PaymentsCharge {
|
|
586
586
|
/** the vxil charge id (`chg_…`) — what refunds and a charge-linked grant key on */
|
|
587
587
|
charge_id: string;
|
|
@@ -630,8 +630,8 @@ export interface PaymentsRefund {
|
|
|
630
630
|
source: 'api' | 'webhook';
|
|
631
631
|
created_at: string | null;
|
|
632
632
|
}
|
|
633
|
-
/** A subscription row as listed by GET /v1/payments/subscriptions (
|
|
634
|
-
*
|
|
633
|
+
/** A subscription row as listed by GET /v1/payments/subscriptions (guide ch. 6,
|
|
634
|
+
* payments) — provider subscriptions, manual grants and purchase passes alike.
|
|
635
635
|
* `current_period_start` (2026-09-25) is the row's own window start: for a
|
|
636
636
|
* purchase pass (`provider_sub_id: 'purchase:<charge_id>'`) the day its access
|
|
637
637
|
* begins, which is in the FUTURE for a pass queued behind a live one; for a
|
|
@@ -662,8 +662,8 @@ export interface FileObject {
|
|
|
662
662
|
status: 'pending' | 'available' | 'deleted';
|
|
663
663
|
created_at: string;
|
|
664
664
|
}
|
|
665
|
-
/** A live shared link as listed by GET /v1/files/{id}/shared-links (
|
|
666
|
-
*
|
|
665
|
+
/** A live shared link as listed by GET /v1/files/{id}/shared-links (guide ch. 6,
|
|
666
|
+
* files). `downloads` is the burn-on-read counter; `max_downloads` null =
|
|
667
667
|
* unlimited (1 = a one-time link). A link that hit its cap, expired, or was
|
|
668
668
|
* revoked no longer lists. */
|
|
669
669
|
export interface FileSharedLink {
|
|
@@ -682,7 +682,7 @@ export interface CreateSharedLinkOptions {
|
|
|
682
682
|
expires_at?: string;
|
|
683
683
|
max_downloads?: number | null;
|
|
684
684
|
}
|
|
685
|
-
/** One recognized OCR text block (
|
|
685
|
+
/** One recognized OCR text block (guide ch. 6, files). bbox is [x, y, w, h] in the
|
|
686
686
|
* provider's unit space; page is 1-based. confidence is 0..1 normalized per
|
|
687
687
|
* provider (Textract native 0..100 divided by 100; mock pins 0.95); absent
|
|
688
688
|
* when the provider supplied none. */
|
|
@@ -923,7 +923,7 @@ export interface AiGenerationRecord {
|
|
|
923
923
|
* generation) */
|
|
924
924
|
result_state: 'stored' | 'purged' | 'not_recorded';
|
|
925
925
|
}
|
|
926
|
-
/** The `data` of `job.generation.queued` (
|
|
926
|
+
/** The `data` of `job.generation.queued` (guide ch. 6, jobs): the run was accepted. */
|
|
927
927
|
export interface JobGenerationQueuedEventPayload {
|
|
928
928
|
run_id: string;
|
|
929
929
|
job_name: string;
|
|
@@ -1510,7 +1510,7 @@ export interface RagSearchHit {
|
|
|
1510
1510
|
* vector-search (−1…1; null when retrieval used no query vector). */
|
|
1511
1511
|
similarity?: number | null;
|
|
1512
1512
|
/** the effective post-boost score results are RANKED by — present only when
|
|
1513
|
-
* metadata boosts applied (
|
|
1513
|
+
* metadata boosts applied (guide ch. 6, rag). */
|
|
1514
1514
|
boosted_score?: number;
|
|
1515
1515
|
metadata?: Record<string, unknown>;
|
|
1516
1516
|
}
|
|
@@ -1527,7 +1527,7 @@ export interface RagSearchResult {
|
|
|
1527
1527
|
};
|
|
1528
1528
|
}
|
|
1529
1529
|
/** A replayed frame page from the rag-native resume endpoint (proxies the ai
|
|
1530
|
-
*
|
|
1530
|
+
* feature's replay buffer: every recorded frame with seq > since, plus done). */
|
|
1531
1531
|
export interface RagResumePage {
|
|
1532
1532
|
generation_id: string;
|
|
1533
1533
|
since: number;
|
|
@@ -1751,7 +1751,7 @@ export interface DmConfigState {
|
|
|
1751
1751
|
version: number;
|
|
1752
1752
|
configured: boolean;
|
|
1753
1753
|
}
|
|
1754
|
-
/** The safe query subset the keyless cms public lane admits (
|
|
1754
|
+
/** The safe query subset the keyless cms public lane admits (guide ch. 4): the
|
|
1755
1755
|
* same bounded filter/sort/limit/cursor as the authored list, minus anything
|
|
1756
1756
|
* owner- or lifecycle-scoped (the lane FORCES status='published'). `filter` is a
|
|
1757
1757
|
* JSON object, serialized to the wire `filter=` param. */
|
|
@@ -1773,7 +1773,7 @@ export interface CmsPublicRow {
|
|
|
1773
1773
|
published_at: string | null;
|
|
1774
1774
|
}
|
|
1775
1775
|
/** Build the anonymous, KEYLESS public-delivery URL for a collection's PUBLISHED
|
|
1776
|
-
* items (
|
|
1776
|
+
* items (guide ch. 4, "Draft and publish") — `{base}/v1/cms/public/:tenantId/:collection[?…]`. This is
|
|
1777
1777
|
* the reader path a public blog/storefront/docs site hits with NO api key: the
|
|
1778
1778
|
* edge mints a restricted read-only inner token bound to the URL tenant, forces
|
|
1779
1779
|
* `status='published'`, and strips the collection's owner_field. PURE (no
|
|
@@ -1784,7 +1784,7 @@ export declare function cmsPublicUrl(tenantId: string, collection: string, query
|
|
|
1784
1784
|
baseUrl?: string;
|
|
1785
1785
|
}): string;
|
|
1786
1786
|
/** Fetch a page of a collection's PUBLISHED items over the KEYLESS public lane
|
|
1787
|
-
* (
|
|
1787
|
+
* (guide ch. 4) — NO api key, no `Vxil` client, no auth of any kind. This is the
|
|
1788
1788
|
* anonymous reader path (a blog/storefront/docs front-end). Returns the same
|
|
1789
1789
|
* `{ items, next_cursor }` envelope the authed list does, but rows are stripped
|
|
1790
1790
|
* to the public surface (`CmsPublicRow`) — drafts and the owner_field are never
|
|
@@ -1952,12 +1952,12 @@ type DisabledFeatures<S extends VxilSchemaShape> = {
|
|
|
1952
1952
|
[P in keyof FeatureMap]: FeatureMap[P] extends S['features'] ? never : P;
|
|
1953
1953
|
}[keyof FeatureMap];
|
|
1954
1954
|
/** The feature-narrowed client: feature namespaces the tenant hasn't enabled become
|
|
1955
|
-
* a compile error
|
|
1955
|
+
* a compile error. `Vxil.connect<VxilSchema>()`
|
|
1956
1956
|
* returns it; plain `new Vxil<VxilSchema>()` stays un-narrowed for back-compat. */
|
|
1957
1957
|
export type EnabledVxil<S extends VxilSchemaShape> = Omit<Vxil<S>, DisabledFeatures<S>> & {
|
|
1958
1958
|
[P in DisabledFeatures<S>]: DisabledFeature<FeatureMap[P] & string>;
|
|
1959
1959
|
};
|
|
1960
|
-
/** One config-declared per-record ACTION (
|
|
1960
|
+
/** One config-declared per-record ACTION (guide ch. 4): a button on a record row
|
|
1961
1961
|
* that invokes the deployed tenant function `fn` ONCE with `{ collection,
|
|
1962
1962
|
* item_id, action, actor, item }`. Exactly one human-initiated step — no
|
|
1963
1963
|
* conditions, no chaining, no scheduling. ≤8 per collection. */
|
|
@@ -1969,7 +1969,7 @@ export interface CmsActionDef {
|
|
|
1969
1969
|
/** the deployed function name (/^[a-z][a-z0-9-]{0,47}$/) */
|
|
1970
1970
|
fn: string;
|
|
1971
1971
|
}
|
|
1972
|
-
/** One live item referencing another through a relation field (
|
|
1972
|
+
/** One live item referencing another through a relation field (guide ch. 4). */
|
|
1973
1973
|
export interface CmsBacklink {
|
|
1974
1974
|
collection: string;
|
|
1975
1975
|
field: string;
|
|
@@ -1986,7 +1986,7 @@ export interface CmsBacklinksPage {
|
|
|
1986
1986
|
has_more: boolean;
|
|
1987
1987
|
limit: number;
|
|
1988
1988
|
}
|
|
1989
|
-
/** ONE page of the slot re-index (
|
|
1989
|
+
/** ONE page of the slot re-index (guide ch. 4). Loop while `complete` is false,
|
|
1990
1990
|
* feeding `next_cursor` back in. `skipped` counts rows a concurrent write moved
|
|
1991
1991
|
* under the page — the re-index never overwrites them (their own writer
|
|
1992
1992
|
* re-projected them), but a `$inc` or a cascade `set_null` only re-projects its
|
|
@@ -2006,7 +2006,7 @@ export interface CmsReindexPage {
|
|
|
2006
2006
|
* but unaccelerated). */
|
|
2007
2007
|
index_certify?: 'armed' | 'pending' | 'timeout';
|
|
2008
2008
|
}
|
|
2009
|
-
/** The result of a bounded filtered delete (
|
|
2009
|
+
/** The result of a bounded filtered delete (guide ch. 4). `matched` counts the
|
|
2010
2010
|
* rows this page selected (≤ `limit`); `deleted` counts the ones actually
|
|
2011
2011
|
* removed (a row that vanished between the match and the delete is skipped).
|
|
2012
2012
|
* Loop while `deleted > 0` — the filter re-evaluates against live rows.
|
|
@@ -2026,33 +2026,33 @@ export interface CmsBulkDeleteResult {
|
|
|
2026
2026
|
complete: boolean;
|
|
2027
2027
|
next_cursor: string | null;
|
|
2028
2028
|
}
|
|
2029
|
-
/** A write guard (
|
|
2029
|
+
/** A write guard (guide ch. 4): "after this write, at most `max` live items
|
|
2030
2030
|
* match `filter`". Requires `lock` — an unlocked guard is racy by construction. */
|
|
2031
2031
|
export interface CmsGuard {
|
|
2032
2032
|
filter: Record<string, unknown>;
|
|
2033
2033
|
max: number;
|
|
2034
2034
|
}
|
|
2035
|
-
/** One guard of a `guards[]` multi-invariant write (
|
|
2035
|
+
/** One guard of a `guards[]` multi-invariant write (guide ch. 4). Same
|
|
2036
2036
|
* { filter, max } as CmsGuard plus an optional custom 409 `message` surfaced on
|
|
2037
2037
|
* the FIRST violation. */
|
|
2038
2038
|
export interface CmsGuardTerm extends CmsGuard {
|
|
2039
2039
|
/** Custom guard_failed message (≤200 chars) for THIS invariant. */
|
|
2040
2040
|
message?: string;
|
|
2041
2041
|
}
|
|
2042
|
-
/** Concurrency options shared by the cms write methods (
|
|
2042
|
+
/** Concurrency options shared by the cms write methods (guide ch. 4). */
|
|
2043
2043
|
export interface CmsWriteOpts {
|
|
2044
2044
|
/** Optimistic CAS: sent as `If-Match: <version>`; mismatch → 409 version_conflict. */
|
|
2045
2045
|
ifVersion?: number;
|
|
2046
2046
|
/** Bounded field precondition checked against the locked row (≤4 terms;
|
|
2047
2047
|
* `{field: null}` = "absent or null" — the slot-claim shape). 409 precondition_failed. */
|
|
2048
2048
|
if?: Record<string, unknown>;
|
|
2049
|
-
/**
|
|
2049
|
+
/** A per-(project, collection, key) lock — serializes same-key writers. */
|
|
2050
2050
|
lock?: string;
|
|
2051
2051
|
/** Declarative capacity/overlap invariant; requires `lock`. 409 guard_failed.
|
|
2052
2052
|
* Mutually exclusive with `guards`. */
|
|
2053
2053
|
guard?: CmsGuard;
|
|
2054
2054
|
/** Multiple capacity/overlap invariants evaluated co-atomically under the ONE
|
|
2055
|
-
* `lock` (≤4; requires `lock`;
|
|
2055
|
+
* `lock` (≤4; requires `lock`; guide ch. 4). Mutually exclusive with `guard`.
|
|
2056
2056
|
* The FIRST failing guard's optional `message` rides the 409 guard_failed. */
|
|
2057
2057
|
guards?: CmsGuardTerm[];
|
|
2058
2058
|
}
|
|
@@ -2068,7 +2068,7 @@ export interface CmsWindow {
|
|
|
2068
2068
|
since?: string;
|
|
2069
2069
|
until?: string;
|
|
2070
2070
|
}
|
|
2071
|
-
/**
|
|
2071
|
+
/** the aggregate request body (guide ch. 4). */
|
|
2072
2072
|
export interface CmsAggregateBody {
|
|
2073
2073
|
/** 1–4 exprs; fn ∈ count|sum|min|max|avg (sum/avg need an n*-slot field). */
|
|
2074
2074
|
aggregates: Array<{
|
|
@@ -2086,7 +2086,7 @@ export interface CmsAggregateBody {
|
|
|
2086
2086
|
/** group rows returned; clamped to 500. */
|
|
2087
2087
|
limit?: number;
|
|
2088
2088
|
}
|
|
2089
|
-
/**
|
|
2089
|
+
/** the rank request body (guide ch. 4). */
|
|
2090
2090
|
export interface CmsRankBody {
|
|
2091
2091
|
/** REQUIRED: the ranked entity — a slot-bound own field (often a relation). */
|
|
2092
2092
|
groupBy: string;
|
|
@@ -2103,7 +2103,7 @@ export interface CmsRankBody {
|
|
|
2103
2103
|
window?: CmsWindow;
|
|
2104
2104
|
limit?: number;
|
|
2105
2105
|
}
|
|
2106
|
-
/**
|
|
2106
|
+
/** one transaction step (guide ch. 4). `$where` = the bounded CAS
|
|
2107
2107
|
* precondition (the PATCH `if` grammar: ≤4 terms, scalar / null /
|
|
2108
2108
|
* {$eq $ne $gt $gte $lt $lte $in}). */
|
|
2109
2109
|
export type CmsTxStep = {
|
|
@@ -2123,7 +2123,7 @@ export type CmsTxStep = {
|
|
|
2123
2123
|
item_id: string;
|
|
2124
2124
|
$where?: Record<string, unknown>;
|
|
2125
2125
|
};
|
|
2126
|
-
/** One op of `vx.cms.batch` (
|
|
2126
|
+
/** One op of `vx.cms.batch` (guide ch. 4) — the single route's own body keys,
|
|
2127
2127
|
* typed by op. `ref` is an opaque tag echoed on the matching result. */
|
|
2128
2128
|
export type CmsBatchOp = {
|
|
2129
2129
|
op: 'get';
|
|
@@ -2222,7 +2222,7 @@ export interface CmsBatchResponse<T extends readonly CmsBatchOp[]> {
|
|
|
2222
2222
|
};
|
|
2223
2223
|
}
|
|
2224
2224
|
/** One CMS item as the API returns it — the envelope `$expand` inlines in place
|
|
2225
|
-
* of a stored relation id (
|
|
2225
|
+
* of a stored relation id (guide ch. 4). `R` is the target collection's Row. */
|
|
2226
2226
|
export interface CmsItemEnvelope<R> {
|
|
2227
2227
|
item_id: string;
|
|
2228
2228
|
collection: string;
|
|
@@ -2238,7 +2238,7 @@ export interface CmsFileRef {
|
|
|
2238
2238
|
object_id: string;
|
|
2239
2239
|
$ref: 'files';
|
|
2240
2240
|
}
|
|
2241
|
-
/** Every shape an expanded member can take (
|
|
2241
|
+
/** Every shape an expanded member can take (guide ch. 4, all four verified in
|
|
2242
2242
|
* cms-v1 core.ts): the full envelope; a `{ object_id, $ref: 'files' }` stub for
|
|
2243
2243
|
* a file field; the BARE id when the expansion hit a cycle or the depth budget;
|
|
2244
2244
|
* `null` when the target is soft-deleted, not visible to this caller, or owned
|
|
@@ -2282,7 +2282,7 @@ export interface CollectionClient<C extends VxilSchemaShape['cms'][string], S ex
|
|
|
2282
2282
|
version: number;
|
|
2283
2283
|
data: C['Row'];
|
|
2284
2284
|
}>;
|
|
2285
|
-
/** `expand` inlines the named relation/file fields (
|
|
2285
|
+
/** `expand` inlines the named relation/file fields (guide ch. 4) — the names
|
|
2286
2286
|
* come from the generated `Relations`, so a typo is a compile error. Bounds
|
|
2287
2287
|
* (worker-clamped regardless of config): depth 1 (ceiling 2), ≤5 fields
|
|
2288
2288
|
* (ceiling 25). Omit it and the result type is exactly today's `Row`. */
|
|
@@ -2317,12 +2317,12 @@ export interface CollectionClient<C extends VxilSchemaShape['cms'][string], S ex
|
|
|
2317
2317
|
items: C['Row'][];
|
|
2318
2318
|
next_cursor: string | null;
|
|
2319
2319
|
}>;
|
|
2320
|
-
/** `SELECT count(*)` under the same bounded filter grammar (
|
|
2320
|
+
/** `SELECT count(*)` under the same bounded filter grammar (guide ch. 4).
|
|
2321
2321
|
* Refused (422) on collections with beforeRead visibility hooks. */
|
|
2322
2322
|
count(filter?: Partial<C['Filterable']>): Promise<number>;
|
|
2323
2323
|
patch(itemId: string, data: C['Patch'], opts?: CmsWriteOpts): Promise<C['Row']>;
|
|
2324
2324
|
/** Atomic in-database increment — ONE conditional UPDATE; never
|
|
2325
|
-
* read-modify-write (
|
|
2325
|
+
* read-modify-write (guide ch. 4). Delta keys are the numeric Row fields. */
|
|
2326
2326
|
inc(itemId: string, incs: Partial<Record<NumericKeys<C['Row']> & string, number>>, opts?: Pick<CmsWriteOpts, 'ifVersion' | 'if'>): Promise<C['Row']>;
|
|
2327
2327
|
delete(itemId: string, opts?: Pick<CmsWriteOpts, 'ifVersion'>): Promise<{
|
|
2328
2328
|
item_id: string;
|
|
@@ -2330,7 +2330,7 @@ export interface CollectionClient<C extends VxilSchemaShape['cms'][string], S ex
|
|
|
2330
2330
|
cascaded: number;
|
|
2331
2331
|
set_null: number;
|
|
2332
2332
|
}>;
|
|
2333
|
-
/**
|
|
2333
|
+
/** Bounded filtered delete over the generated `Filterable` — a
|
|
2334
2334
|
* filter is required, ≤100 rows per call, `dryRun` previews. Loop while
|
|
2335
2335
|
* `deleted > 0`. */
|
|
2336
2336
|
deleteMany(q: {
|
|
@@ -2340,7 +2340,7 @@ export interface CollectionClient<C extends VxilSchemaShape['cms'][string], S ex
|
|
|
2340
2340
|
dryRun?: boolean;
|
|
2341
2341
|
}): Promise<CmsBulkDeleteResult>;
|
|
2342
2342
|
publish(itemId: string): Promise<C['Row']>;
|
|
2343
|
-
/**
|
|
2343
|
+
/** Bounded group-by aggregate (guide ch. 4).
|
|
2344
2344
|
* groupBy/field names are typed over the Row's keys; slot-existence stays a
|
|
2345
2345
|
* runtime check — exactly like `query`. Joins stay expressed as dotted
|
|
2346
2346
|
* filter keys (no `.join()` builder — one grammar, not two). */
|
|
@@ -2357,7 +2357,7 @@ export interface CollectionClient<C extends VxilSchemaShape['cms'][string], S ex
|
|
|
2357
2357
|
}>;
|
|
2358
2358
|
scanned: number;
|
|
2359
2359
|
}>;
|
|
2360
|
-
/**
|
|
2360
|
+
/** Window ranking over the aggregate (guide ch. 4). */
|
|
2361
2361
|
rank(q: Omit<CmsRankBody, 'groupBy' | 'partitionBy' | 'metric'> & {
|
|
2362
2362
|
groupBy: keyof C['Row'] & string;
|
|
2363
2363
|
partitionBy?: keyof C['Row'] & string;
|
|
@@ -2413,12 +2413,12 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2413
2413
|
* `Vxil.connect<VxilSchema>({ apiKey }).rag` won't type-check if `rag` is off.
|
|
2414
2414
|
* Runtime is identical to `new Vxil`; this only adds the compile-time gate. */
|
|
2415
2415
|
static connect<S extends VxilSchemaShape = VxilSchemaShape>(opts: VxilOptions): EnabledVxil<S>;
|
|
2416
|
-
/** Typed per-collection CMS handle (
|
|
2416
|
+
/** Typed per-collection CMS handle (guide ch. 5). A thin wrapper over the
|
|
2417
2417
|
* generic `cms.items.*` methods — the wire calls are identical; the generated
|
|
2418
2418
|
* `VxilSchema` supplies the field types. `vx.cms.items.*` stays as the
|
|
2419
2419
|
* always-available un-generic fallback. */
|
|
2420
2420
|
from<C extends keyof S['cms'] & string>(collection: C): CollectionClient<S['cms'][C], S>;
|
|
2421
|
-
/** Typed function invoke (
|
|
2421
|
+
/** Typed function invoke (guide ch. 8). `vx.fn.<name>(payload)` POSTs to
|
|
2422
2422
|
* /v1/fn/<name>; the generated `VxilSchema` types Input/Output (Level-0
|
|
2423
2423
|
* opaque until a function declares a signature). A Proxy gives the
|
|
2424
2424
|
* `vx.fn.<name>` accessor shape without enumerating names at runtime.
|
|
@@ -2457,7 +2457,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2457
2457
|
* (email/display_name/avatar_url/attributes) is scrubbed, while the id is
|
|
2458
2458
|
* kept so cross-feature references stay intact. NOTE: a full account-delete
|
|
2459
2459
|
* flow also calls the auth half — POST /v1/auth/users/:id/erase — to erase
|
|
2460
|
-
* the credential/session identity (see
|
|
2460
|
+
* the credential/session identity (see guide ch. 6, auth).
|
|
2461
2461
|
*/
|
|
2462
2462
|
delete: (id: string, opts?: {
|
|
2463
2463
|
erase?: boolean;
|
|
@@ -2494,7 +2494,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2494
2494
|
readonly notifications: {
|
|
2495
2495
|
send: (input: {
|
|
2496
2496
|
user_id: string;
|
|
2497
|
-
/** The four shipped template ids (
|
|
2497
|
+
/** The four shipped template ids (guide ch. 6, notifications). */
|
|
2498
2498
|
template: "magic-link" | "otp-code" | "welcome" | "transactional";
|
|
2499
2499
|
data: Record<string, unknown>;
|
|
2500
2500
|
/** Explicit wins; otherwise the recipient's stored `locale` attribute
|
|
@@ -2590,7 +2590,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2590
2590
|
user_id?: string;
|
|
2591
2591
|
status?: string;
|
|
2592
2592
|
limit?: number;
|
|
2593
|
-
/**
|
|
2593
|
+
/** only deliveries that reached this engagement state */
|
|
2594
2594
|
engagement?: "delivered" | "opened" | "clicked";
|
|
2595
2595
|
}) => Promise<Delivery[]>;
|
|
2596
2596
|
suppressions: {
|
|
@@ -2643,7 +2643,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2643
2643
|
* does not cover them, so an "unsubscribe from everything" click can never
|
|
2644
2644
|
* lock a user out of its own account. Muteable ids: `welcome`,
|
|
2645
2645
|
* `transactional`. (Password-reset mail rides `transactional`, which stays
|
|
2646
|
-
* muteable — see
|
|
2646
|
+
* muteable — see guide ch. 6, notifications.)
|
|
2647
2647
|
*
|
|
2648
2648
|
* SCOPES: with an end-user token both calls are confined to the verified
|
|
2649
2649
|
* principal and take `notifications:read` (a browser key that can mute its
|
|
@@ -2687,7 +2687,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2687
2687
|
};
|
|
2688
2688
|
/** A single delivery by id (the list is `deliveries()`). */
|
|
2689
2689
|
delivery: (deliveryId: string) => Promise<Delivery>;
|
|
2690
|
-
/** Email broadcast campaigns (
|
|
2690
|
+
/** Email broadcast campaigns (guide ch. 6, notifications): audience-ref fan-out
|
|
2691
2691
|
* with quiet-hours + frequency-cap policy. `schedule_cron` sets a recurring
|
|
2692
2692
|
* send (status `scheduled`); omit it for a `draft`. */
|
|
2693
2693
|
campaigns: {
|
|
@@ -2754,12 +2754,12 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2754
2754
|
/** The tenant's enabled-feature summary (GET /v1/features). Privilege-
|
|
2755
2755
|
* independent: any valid key may read it — it leaks no secrets, only which
|
|
2756
2756
|
* features the tenant has turned on. Mirrors what the MCP tool-list
|
|
2757
|
-
* aggregation sees.
|
|
2757
|
+
* aggregation sees. */
|
|
2758
2758
|
list: () => Promise<string[]>;
|
|
2759
2759
|
/** The FULL enabled-feature summary: `features` + `api_versions` (released
|
|
2760
2760
|
* API majors per feature) + the additive `key` block — the CALLING key's
|
|
2761
2761
|
* identity and per-tool MCP permissions (allowed_tools/denied_tools
|
|
2762
|
-
* patterns
|
|
2762
|
+
* patterns; guide ch. 10). `key` is absent for non-key
|
|
2763
2763
|
* callers and for keys without explicit tool perms. `list()` stays the
|
|
2764
2764
|
* stable flat-array shorthand. */
|
|
2765
2765
|
summary: () => Promise<{
|
|
@@ -2865,7 +2865,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2865
2865
|
}>;
|
|
2866
2866
|
count: number;
|
|
2867
2867
|
}>;
|
|
2868
|
-
/** Enqueue a long-running EXTERNAL generation run (
|
|
2868
|
+
/** Enqueue a long-running EXTERNAL generation run (guide ch. 6, jobs): Vxil calls
|
|
2869
2869
|
* the provider (BYO key), tracks completion via poll/webhook, mirrors a typed
|
|
2870
2870
|
* generation_status onto a tenant record, enforces a built-in timeout, and
|
|
2871
2871
|
* (on failure) fires the payments credit-reversal.
|
|
@@ -2874,7 +2874,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
2874
2874
|
* of the same `idempotency_key` (`deduplicated: true`) carries the run's
|
|
2875
2875
|
* status NOW (`processing`, `completed` or `failed` too).
|
|
2876
2876
|
*
|
|
2877
|
-
* `reserve_credits`
|
|
2877
|
+
* `reserve_credits` takes a PROVISIONAL held credit debit at enqueue
|
|
2878
2878
|
* (linked to the run), committed on `completed` and reversed on
|
|
2879
2879
|
* failed/timeout/DLQ. `amount` is positive-only and CLAMPED to the platform
|
|
2880
2880
|
* `config.generation.maxReserveCredits` cap; in end-user mode `user_id` is
|
|
@@ -3431,9 +3431,9 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3431
3431
|
createPolicy: (input: {
|
|
3432
3432
|
name: string;
|
|
3433
3433
|
key_template: string;
|
|
3434
|
-
/** omitted ⇒ seeded from the tenant's rate-limits config `defaults`
|
|
3434
|
+
/** omitted ⇒ seeded from the tenant's rate-limits config `defaults` */
|
|
3435
3435
|
limit?: number;
|
|
3436
|
-
/** omitted ⇒ seeded from the tenant's rate-limits config `defaults`
|
|
3436
|
+
/** omitted ⇒ seeded from the tenant's rate-limits config `defaults` */
|
|
3437
3437
|
window_seconds?: number;
|
|
3438
3438
|
behavior?: "block" | "shape";
|
|
3439
3439
|
}) => Promise<RateLimitPolicy>;
|
|
@@ -3507,7 +3507,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3507
3507
|
}>;
|
|
3508
3508
|
/** Per-identifier overrides layered over a policy: `pattern` matches the
|
|
3509
3509
|
* RENDERED key (exact, or a `*`-glob where the longest literal prefix
|
|
3510
|
-
* wins). Propagates to the check path within ≤30s (
|
|
3510
|
+
* wins). Propagates to the check path within ≤30s (cache TTL). */
|
|
3511
3511
|
overrides: {
|
|
3512
3512
|
list: (policyId: string) => Promise<RateLimitOverride[]>;
|
|
3513
3513
|
create: (policyId: string, input: {
|
|
@@ -3539,7 +3539,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3539
3539
|
* end-user principal (default-deny) in end-user mode; a no-op in
|
|
3540
3540
|
* server-caller mode. Omit for shared/reference collections. */
|
|
3541
3541
|
owner_field?: string;
|
|
3542
|
-
/** Public delivery (
|
|
3542
|
+
/** Public delivery (guide ch. 4): when true, this collection's PUBLISHED
|
|
3543
3543
|
* items become KEYLESS-readable through the anonymous public lane —
|
|
3544
3544
|
* `GET {base}/v1/cms/public/:tenantId/:collection` with NO api key. Drafts
|
|
3545
3545
|
* and the owner_field are never exposed. Optional; defaults false. Use the
|
|
@@ -3557,15 +3557,15 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3557
3557
|
};
|
|
3558
3558
|
index_slot?: "s1" | "s2" | "s3" | "s4" | "n1" | "n2" | "t1" | "t2";
|
|
3559
3559
|
relation_to?: string;
|
|
3560
|
-
/** Value uniqueness across the collection's LIVE items (
|
|
3560
|
+
/** Value uniqueness across the collection's LIVE items (guide ch. 4);
|
|
3561
3561
|
* scalar-valued types only. Concurrent duplicates → 409 unique_violation. */
|
|
3562
3562
|
unique?: boolean;
|
|
3563
3563
|
/** relation fields only: what a delete of the referenced item does to
|
|
3564
|
-
* this one — cascade / set_null (bounded fan-out,
|
|
3565
|
-
* `restrict` (
|
|
3564
|
+
* this one — cascade / set_null (bounded fan-out, guide ch. 4) or
|
|
3565
|
+
* `restrict` (the delete is refused with 409 `referenced`
|
|
3566
3566
|
* while a live reference exists). */
|
|
3567
3567
|
on_delete?: "cascade" | "set_null" | "restrict";
|
|
3568
|
-
/** FIELD-LEVEL read security (
|
|
3568
|
+
/** FIELD-LEVEL read security (guide ch. 4): the end-user ORG ROLE slugs
|
|
3569
3569
|
* allowed to READ this field. Omitted/`[]` = ungated. A non-empty list
|
|
3570
3570
|
* is FAIL-SAFE — in verified end-user mode the field is OMITTED from
|
|
3571
3571
|
* every read (get / list / query / `$expand` / the write-response echo)
|
|
@@ -3575,14 +3575,14 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3575
3575
|
* session) still sees every field. Writes are unaffected. ≤16 entries,
|
|
3576
3576
|
* each `^[a-z0-9][a-z0-9_-]{0,31}$` (the `orgs` role alphabet). */
|
|
3577
3577
|
read_roles?: string[];
|
|
3578
|
-
/** Equality index for an UNSLOTTED field (
|
|
3578
|
+
/** Equality index for an UNSLOTTED field (guide ch. 4 "Indexed
|
|
3579
3579
|
* equality"): `=` / `$eq` / `$in` filters on it are index-served
|
|
3580
3580
|
* instead of a bounded scan — results are identical either way. ≤4
|
|
3581
3581
|
* per collection; not with `index_slot` (a slot already indexes
|
|
3582
3582
|
* equality) and not on a computed field. */
|
|
3583
3583
|
indexed?: boolean;
|
|
3584
3584
|
}>;
|
|
3585
|
-
/** Per-record action buttons (
|
|
3585
|
+
/** Per-record action buttons (guide ch. 4): `[{ key, label, fn }]` —
|
|
3586
3586
|
* exactly ONE human-initiated step each; `fn` names a deployed tenant
|
|
3587
3587
|
* function invoked by `items.runAction`. ≤8 per collection. */
|
|
3588
3588
|
actions?: CmsActionDef[];
|
|
@@ -3600,7 +3600,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3600
3600
|
owner_field?: string | null;
|
|
3601
3601
|
}>>;
|
|
3602
3602
|
addField: (collection: string, field: Record<string, unknown>) => Promise<void>;
|
|
3603
|
-
/** Set (or clear, with `null`/`[]`) a field's READ-ROLE gate (
|
|
3603
|
+
/** Set (or clear, with `null`/`[]`) a field's READ-ROLE gate (guide ch. 4) —
|
|
3604
3604
|
* the same-type in-place alter on the fields route. Re-sends the field's
|
|
3605
3605
|
* `type` (required by the alter path); every OTHER attribute the field
|
|
3606
3606
|
* carries is re-sent from `rest`, because the alter overwrites the whole
|
|
@@ -3608,7 +3608,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3608
3608
|
* read unless the session's verified roles intersect `roles`; server-caller
|
|
3609
3609
|
* reads and ALL writes are unaffected. */
|
|
3610
3610
|
setFieldReadRoles: (collection: string, field: string, type: "string" | "text" | "int" | "float" | "bool" | "datetime" | "json" | "relation" | "file", roles: string[] | null, rest?: Record<string, unknown>) => Promise<void>;
|
|
3611
|
-
/** Turn a field's EQUALITY INDEX on or off (
|
|
3611
|
+
/** Turn a field's EQUALITY INDEX on or off (guide ch. 4 "Indexed equality")
|
|
3612
3612
|
* — the same-type in-place alter on the fields route; `indexed` is
|
|
3613
3613
|
* present-key, so no other attribute moves. Only for UNSLOTTED,
|
|
3614
3614
|
* non-computed fields, ≤4 per collection (422 `eq_index_budget`).
|
|
@@ -3621,16 +3621,16 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3621
3621
|
reindex_required: boolean;
|
|
3622
3622
|
}>;
|
|
3623
3623
|
/** Set (or clear, with `null`) the collection's end-user owner-scope flag
|
|
3624
|
-
* (
|
|
3624
|
+
* (guide ch. 4, "`ownerField`"). Names an existing `string` field that holds the owner id. */
|
|
3625
3625
|
setOwnerField: (collection: string, ownerField: string | null) => Promise<void>;
|
|
3626
|
-
/** Toggle the collection's PUBLIC-delivery flag (
|
|
3626
|
+
/** Toggle the collection's PUBLIC-delivery flag (guide ch. 4). When `true`,
|
|
3627
3627
|
* its PUBLISHED items become KEYLESS-readable via the anonymous public lane
|
|
3628
3628
|
* (`GET {base}/v1/cms/public/:tenantId/:collection` — no api key); drafts and
|
|
3629
3629
|
* the owner_field are never exposed. `false` closes the lane (and purges the
|
|
3630
3630
|
* edge cache). Read the public side with `cmsPublicUrl` / `listCmsPublic`. */
|
|
3631
3631
|
setPublic: (collection: string, isPublic: boolean) => Promise<void>;
|
|
3632
3632
|
/** Re-project the collection's index slots after an `index_slot` move
|
|
3633
|
-
* (
|
|
3633
|
+
* (guide ch. 4). Slots are projected on WRITE only, so until this runs,
|
|
3634
3634
|
* stored rows keep their OLD projection: the new slot is NULL and the
|
|
3635
3635
|
* VACATED slot still holds the old field's values — range/sort on the
|
|
3636
3636
|
* moved field returns the WRONG rows, not merely missing ones. ONE page
|
|
@@ -3659,15 +3659,15 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3659
3659
|
pages: number;
|
|
3660
3660
|
index_certify?: CmsReindexPage["index_certify"];
|
|
3661
3661
|
}>;
|
|
3662
|
-
/** Replace the collection's per-record ACTION list (
|
|
3662
|
+
/** Replace the collection's per-record ACTION list (guide ch. 4) — the
|
|
3663
3663
|
* `{ actions }` fields-route meta-op; `[]` clears. Each action is ONE
|
|
3664
3664
|
* human-initiated step: the dashboard renders it as a button per record,
|
|
3665
3665
|
* and `items.runAction` invokes its deployed function. */
|
|
3666
3666
|
setActions: (collection: string, actions: CmsActionDef[]) => Promise<void>;
|
|
3667
3667
|
};
|
|
3668
3668
|
items: {
|
|
3669
|
-
/** `lock` serializes same-key writers (per-
|
|
3670
|
-
* is the declarative capacity/overlap invariant (requires lock) —
|
|
3669
|
+
/** `lock` serializes same-key writers (a per-key lock); `guard`
|
|
3670
|
+
* is the declarative capacity/overlap invariant (requires lock) — guide ch. 4. */
|
|
3671
3671
|
create: (collection: string, input: {
|
|
3672
3672
|
data: Record<string, unknown>;
|
|
3673
3673
|
status?: "draft" | "published";
|
|
@@ -3680,7 +3680,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3680
3680
|
version: number;
|
|
3681
3681
|
data: Record<string, unknown>;
|
|
3682
3682
|
}>;
|
|
3683
|
-
/** `expand` inlines relation/file fields into `data` (
|
|
3683
|
+
/** `expand` inlines relation/file fields into `data` (guide ch. 4): the
|
|
3684
3684
|
* full item envelope, a `{ object_id, $ref: 'files' }` stub for a file,
|
|
3685
3685
|
* the bare id on a cycle/depth cut, `null` for an invisible target. */
|
|
3686
3686
|
get: (collection: string, itemId: string, opts?: {
|
|
@@ -3714,19 +3714,19 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3714
3714
|
items: Array<Record<string, unknown>>;
|
|
3715
3715
|
next_cursor: string | null;
|
|
3716
3716
|
}>;
|
|
3717
|
-
/** Merge-patch data keys; null clears a key. Concurrency opts (
|
|
3717
|
+
/** Merge-patch data keys; null clears a key. Concurrency opts (guide ch. 4):
|
|
3718
3718
|
* `ifVersion` → If-Match CAS; `if` → bounded field precondition against
|
|
3719
|
-
* the locked row; `lock`/`guard` → the
|
|
3719
|
+
* the locked row; `lock`/`guard` → the write-serialization primitives (guide ch. 4). */
|
|
3720
3720
|
patch: (collection: string, itemId: string, data: Record<string, unknown>, opts?: CmsWriteOpts) => Promise<Record<string, unknown>>;
|
|
3721
3721
|
/** Atomic in-database increment — PATCH `{ $inc: {field: delta} }`, ONE
|
|
3722
3722
|
* conditional UPDATE guarded by the field's validation min/max (the quota
|
|
3723
3723
|
* shape), the optional `if` precondition, and If-Match. 409
|
|
3724
|
-
* inc_out_of_bounds when the guard refuses (
|
|
3724
|
+
* inc_out_of_bounds when the guard refuses (guide ch. 4). */
|
|
3725
3725
|
inc: (collection: string, itemId: string, incs: Record<string, number>, opts?: Pick<CmsWriteOpts, "ifVersion" | "if">) => Promise<Record<string, unknown>>;
|
|
3726
|
-
/** `{ count }` under the same bounded filter grammar (
|
|
3726
|
+
/** `{ count }` under the same bounded filter grammar (guide ch. 4). 422
|
|
3727
3727
|
* count_unavailable_with_read_hooks on beforeRead-hooked collections. */
|
|
3728
3728
|
count: (collection: string, filter?: Record<string, unknown>) => Promise<number>;
|
|
3729
|
-
/** Returns the cascade tally (
|
|
3729
|
+
/** Returns the cascade tally (guide ch. 4); `ifVersion` rides If-Match and
|
|
3730
3730
|
* a conflict aborts BEFORE any cascade side-effect. */
|
|
3731
3731
|
delete: (collection: string, itemId: string, opts?: Pick<CmsWriteOpts, "ifVersion">) => Promise<{
|
|
3732
3732
|
item_id: string;
|
|
@@ -3734,7 +3734,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3734
3734
|
cascaded: number;
|
|
3735
3735
|
set_null: number;
|
|
3736
3736
|
}>;
|
|
3737
|
-
/**
|
|
3737
|
+
/** BOUNDED FILTERED delete — soft-delete up to `limit`
|
|
3738
3738
|
* items (1–100, default 25) matching `filter`, newest id first. A filter
|
|
3739
3739
|
* is REQUIRED (an unselected sweep is refused 422). Each matched row runs
|
|
3740
3740
|
* the SAME single-item delete path (restrict refusal, cascade budget,
|
|
@@ -3754,7 +3754,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3754
3754
|
dryRun?: boolean;
|
|
3755
3755
|
}) => Promise<CmsBulkDeleteResult>;
|
|
3756
3756
|
publish: (collection: string, itemId: string) => Promise<Record<string, unknown>>;
|
|
3757
|
-
/**
|
|
3757
|
+
/** The BOUNDED reverse read — which live items
|
|
3758
3758
|
* reference this one, through which relation field. Owner-scoped in
|
|
3759
3759
|
* end-user mode like `get`. `count` is the page returned (≤ limit, max
|
|
3760
3760
|
* 100), never a total; `has_more` says the cap was hit. A DELETE refused
|
|
@@ -3763,7 +3763,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3763
3763
|
backlinks: (collection: string, itemId: string, opts?: {
|
|
3764
3764
|
limit?: number;
|
|
3765
3765
|
}) => Promise<CmsBacklinksPage>;
|
|
3766
|
-
/**
|
|
3766
|
+
/** Run ONE declared per-record action — invokes the
|
|
3767
3767
|
* action's deployed function with `{ collection, item_id, action, actor,
|
|
3768
3768
|
* item }` and returns its result. 404 when the key is not declared;
|
|
3769
3769
|
* 502 `action_failed` (with `upstream.code` = the function's error
|
|
@@ -3775,7 +3775,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3775
3775
|
fn: string;
|
|
3776
3776
|
result: unknown;
|
|
3777
3777
|
}>;
|
|
3778
|
-
/**
|
|
3778
|
+
/** Bounded group-by aggregate. fns count|sum|
|
|
3779
3779
|
* min|max|avg over index-slot-bound fields; groupBy ≤2 slot-bound
|
|
3780
3780
|
* fields; filter = the full query DSL incl. ONE-hop dotted join terms
|
|
3781
3781
|
* ({"channel.visibility":"public"}); scan capped at 50k rows → 422
|
|
@@ -3786,7 +3786,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3786
3786
|
}>;
|
|
3787
3787
|
scanned: number;
|
|
3788
3788
|
}>;
|
|
3789
|
-
/**
|
|
3789
|
+
/** Window ranking over the aggregate — rank ∈
|
|
3790
3790
|
* row_number|rank|percent_rank, computed over ≤500 aggregated groups
|
|
3791
3791
|
* (never raw rows), optional partitionBy. Same scan cap as aggregate. */
|
|
3792
3792
|
rank: (collection: string, body: CmsRankBody) => Promise<{
|
|
@@ -3814,7 +3814,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3814
3814
|
done: boolean;
|
|
3815
3815
|
}>;
|
|
3816
3816
|
};
|
|
3817
|
-
/**
|
|
3817
|
+
/** Atomic multi-collection transaction — 1–5
|
|
3818
3818
|
* steps over ≤3 collections, per-step `$where` CAS preconditions (the
|
|
3819
3819
|
* PATCH `if` grammar). All-or-nothing: any failed precondition/validation
|
|
3820
3820
|
* rolls the WHOLE transaction back (409 precondition_failed names the
|
|
@@ -3830,7 +3830,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3830
3830
|
committed: boolean;
|
|
3831
3831
|
tx_id: string;
|
|
3832
3832
|
}>;
|
|
3833
|
-
/**
|
|
3833
|
+
/** Several get / query / create / patch / delete ops in
|
|
3834
3834
|
* ONE round trip — the function-chain shape ("read 3 rows → patch 2 →
|
|
3835
3835
|
* create 1" is one call, not six). ≤25 ops, each run through the SAME path
|
|
3836
3836
|
* its single route uses (scopes, owner-scoping, hooks, guards, `if`,
|
|
@@ -3844,7 +3844,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3844
3844
|
batch: <T extends readonly CmsBatchOp[]>(ops: readonly [...T], opts?: {
|
|
3845
3845
|
atomic?: boolean;
|
|
3846
3846
|
}) => Promise<CmsBatchResponse<T>>;
|
|
3847
|
-
/**
|
|
3847
|
+
/** Declared read-models (config `readModels`
|
|
3848
3848
|
* bag) — list with last-run status, and "run now" materialization into
|
|
3849
3849
|
* the rollup collection. */
|
|
3850
3850
|
readModels: {
|
|
@@ -3949,7 +3949,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
3949
3949
|
/** Read the resolved DM config (defaults merged with the stored partial). */
|
|
3950
3950
|
getConfig: () => Promise<DmConfigState>;
|
|
3951
3951
|
/** Write the DM master config — a partial merge (omitted leaves keep their
|
|
3952
|
-
* current value), version-bumped and republished to the gate's
|
|
3952
|
+
* current value), version-bumped and republished to the gate's cache. */
|
|
3953
3953
|
setConfig: (patch: {
|
|
3954
3954
|
enabled?: boolean;
|
|
3955
3955
|
maxParticipants?: number;
|
|
@@ -4082,7 +4082,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4082
4082
|
/** The MCP aggregation surface (the `mcp` feature). */
|
|
4083
4083
|
readonly mcp: {
|
|
4084
4084
|
/** Per-tenant secret for verifying the X-Vxil-Mcp-Signature header on custom
|
|
4085
|
-
* MCP tool calls (
|
|
4085
|
+
* MCP tool calls (guide ch. 10) — the mirror of jobs.signingSecret(). */
|
|
4086
4086
|
signingSecret: () => Promise<string>;
|
|
4087
4087
|
};
|
|
4088
4088
|
/**
|
|
@@ -4179,7 +4179,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4179
4179
|
ids?: string[];
|
|
4180
4180
|
before?: string;
|
|
4181
4181
|
}) => Promise<FeedBadge>;
|
|
4182
|
-
/** The badge: { unseen, unread, total } (
|
|
4182
|
+
/** The badge: { unseen, unread, total } (cached, recomputed on a miss). */
|
|
4183
4183
|
unreadCount: (userId: string) => Promise<FeedBadge>;
|
|
4184
4184
|
};
|
|
4185
4185
|
/**
|
|
@@ -4294,7 +4294,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4294
4294
|
ids?: string[];
|
|
4295
4295
|
before?: string;
|
|
4296
4296
|
}) => Promise<FeedBadge>;
|
|
4297
|
-
/** The badge: { unseen, unread, total } (
|
|
4297
|
+
/** The badge: { unseen, unread, total } (cached, recomputed on a miss). */
|
|
4298
4298
|
unreadCount: (userId: string) => Promise<FeedBadge>;
|
|
4299
4299
|
};
|
|
4300
4300
|
/**
|
|
@@ -4545,7 +4545,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4545
4545
|
pending?: boolean;
|
|
4546
4546
|
}>>;
|
|
4547
4547
|
};
|
|
4548
|
-
/** Custom tenant roles (permission-sets
|
|
4548
|
+
/** Custom tenant roles (permission-sets). A custom role
|
|
4549
4549
|
* is a named set of permissions assignable like any built-in; the four
|
|
4550
4550
|
* built-ins reproduce the fixed owner>admin>member>viewer lattice. */
|
|
4551
4551
|
roles: {
|
|
@@ -4579,7 +4579,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4579
4579
|
/** Delete a custom role (built-in roles cannot be deleted). */
|
|
4580
4580
|
delete: (roleKey: string) => Promise<void>;
|
|
4581
4581
|
};
|
|
4582
|
-
/** Per-org/user resource ACL grants
|
|
4582
|
+
/** Per-org/user resource ACL grants: grant a permission
|
|
4583
4583
|
* on a specific resource string; `check(...,{ resource })` consults them. */
|
|
4584
4584
|
acl: {
|
|
4585
4585
|
grant: (orgId: string, input: {
|
|
@@ -4721,7 +4721,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4721
4721
|
};
|
|
4722
4722
|
available: Record<string, number | null>;
|
|
4723
4723
|
}>;
|
|
4724
|
-
/** OCR / text extraction (
|
|
4724
|
+
/** OCR / text extraction (guide ch. 6, files, BYO-key add-on). Small/mock inputs
|
|
4725
4725
|
* extract inline (status `available`); large inputs (or `async:true`) return
|
|
4726
4726
|
* 202 with a `job_id` — poll `getText()`. */
|
|
4727
4727
|
extractText: (objectId: string, opts?: {
|
|
@@ -4875,7 +4875,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
4875
4875
|
* The AI substrate (the `ai` feature): store prompt TEMPLATES (config-as-code),
|
|
4876
4876
|
* then generate (sync or streamed) and embed across providers. 'mock' is the
|
|
4877
4877
|
* deterministic default; the real providers (openai/anthropic/gemini/azure/
|
|
4878
|
-
* openrouter) route via BYO keys in
|
|
4878
|
+
* openrouter) route via BYO keys in your project secrets. `images` on the generate
|
|
4879
4879
|
* inputs takes up to 8 vision refs: a public https:// URL, a
|
|
4880
4880
|
* data:image/...;base64 URL, or file:<object_id> (a files-feature object) —
|
|
4881
4881
|
* fetched images are capped at 4 MiB each; `documents` (pdf/text, ≤10 MiB
|
|
@@ -5087,7 +5087,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
5087
5087
|
* outlives the ≤300s realtime token TTL); reconnect with `?since=<seq>`. */
|
|
5088
5088
|
remintToken: (generationId: string) => Promise<AiStreamToken>;
|
|
5089
5089
|
/** Resume a streamed generation after a dropped socket: every recorded frame
|
|
5090
|
-
* with seq > `since` plus `done` (the
|
|
5090
|
+
* with seq > `since` plus `done` (the replay buffer — plain JSON, not
|
|
5091
5091
|
* an SSE stream; the buffer lives 1 h). A settled JOB-lane generation is
|
|
5092
5092
|
* served from its stored answer instead (30 days). `status` says where the
|
|
5093
5093
|
* generation is; `expired: true` means it settled but its frames are gone
|
|
@@ -5184,7 +5184,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
5184
5184
|
user_id?: string;
|
|
5185
5185
|
input?: Record<string, unknown>;
|
|
5186
5186
|
}) => Promise<RagStreamHandle>;
|
|
5187
|
-
/** Retrieval-only grounding preview (
|
|
5187
|
+
/** Retrieval-only grounding preview (guide ch. 6, rag): the exact chunks `answer`
|
|
5188
5188
|
* would ground on, with rerank + metadata boosts applied — no generation,
|
|
5189
5189
|
* no token spend. `boosts`/`rerank`/`min_score` override the rag config.
|
|
5190
5190
|
* `min_score` floors the EFFECTIVE `score`, which is a RANK value (about
|
|
@@ -5312,7 +5312,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
5312
5312
|
* `quota` inlines one quota, `creditType` inlines the same owner-bound
|
|
5313
5313
|
* balance `getBalance` returns — ONE call for a thin client's paywall.
|
|
5314
5314
|
* A non-2xx answer means UNKNOWN: render the last cached answer, never
|
|
5315
|
-
* free (
|
|
5315
|
+
* free (guide ch. 6, payments).
|
|
5316
5316
|
*
|
|
5317
5317
|
* OVERLAPPING SUBSCRIPTIONS — what `until` means. The WINNER is the
|
|
5318
5318
|
* entitled subscription with the highest `tierMap[tier].rank` (default 0);
|
|
@@ -5456,7 +5456,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
5456
5456
|
status?: string;
|
|
5457
5457
|
}) => Promise<PaymentsSubscription[]>;
|
|
5458
5458
|
/**
|
|
5459
|
-
* Create a hosted-checkout session (
|
|
5459
|
+
* Create a hosted-checkout session (guide ch. 6, payments). Redirect the buyer to
|
|
5460
5460
|
* the returned `url`; completion lands server-side via the provider webhook
|
|
5461
5461
|
* (the matching session flips to completed, the charge/grant is folded).
|
|
5462
5462
|
* Idempotency-Key REQUIRED — a retry replays the SAME session verbatim.
|
|
@@ -5480,7 +5480,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
5480
5480
|
url: string;
|
|
5481
5481
|
}>;
|
|
5482
5482
|
/**
|
|
5483
|
-
* Refund a charge at-most-once (
|
|
5483
|
+
* Refund a charge at-most-once (guide ch. 6, payments). Omit `amount_cents` to
|
|
5484
5484
|
* refund the full un-refunded remainder. Idempotency-Key REQUIRED — a retry
|
|
5485
5485
|
* replays the recorded refund (never a second provider refund); a refund can
|
|
5486
5486
|
* NEVER exceed the charge (422 refund_exceeds_charge).
|
|
@@ -5677,7 +5677,7 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
5677
5677
|
}) => Promise<{
|
|
5678
5678
|
refunds: PaymentsRefund[];
|
|
5679
5679
|
}>;
|
|
5680
|
-
/** Provider webhook event log (
|
|
5680
|
+
/** Provider webhook event log (guide ch. 6, payments "Event log & replay"):
|
|
5681
5681
|
* operator visibility over every delivery — incl. persisted signature
|
|
5682
5682
|
* failures — plus an idempotent reprocess verb. Needs payments:read
|
|
5683
5683
|
* (reprocess: payments:write).
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// (code/message/hint/fixUrl + request id) so callers — humans or agents —
|
|
4
4
|
// can self-correct.
|
|
5
5
|
/** The released API majors, as a CLOSED union — one per released major (docs/
|
|
6
|
-
*
|
|
6
|
+
* guide ch. 5). `'v1'` is the only released major, so pinning
|
|
7
7
|
* anything else (`apiVersion: 'v2'`) is a COMPILE error until a v2 GAs and
|
|
8
8
|
* widens this union. Every path the SDK builds is major-versioned; the default
|
|
9
9
|
* is the compile-time constant `'v1'` (never a floating `latest` alias). */
|
|
@@ -136,7 +136,7 @@ function resolveBase(explicit) {
|
|
|
136
136
|
return (explicit ?? envBase ?? DEFAULT_BASE).replace(/\/$/, '');
|
|
137
137
|
}
|
|
138
138
|
/** Build the anonymous, KEYLESS public-delivery URL for a collection's PUBLISHED
|
|
139
|
-
* items (
|
|
139
|
+
* items (guide ch. 4, "Draft and publish") — `{base}/v1/cms/public/:tenantId/:collection[?…]`. This is
|
|
140
140
|
* the reader path a public blog/storefront/docs site hits with NO api key: the
|
|
141
141
|
* edge mints a restricted read-only inner token bound to the URL tenant, forces
|
|
142
142
|
* `status='published'`, and strips the collection's owner_field. PURE (no
|
|
@@ -155,7 +155,7 @@ export function cmsPublicUrl(tenantId, collection, query, opts) {
|
|
|
155
155
|
return `${base}${path}${s}`;
|
|
156
156
|
}
|
|
157
157
|
/** Fetch a page of a collection's PUBLISHED items over the KEYLESS public lane
|
|
158
|
-
* (
|
|
158
|
+
* (guide ch. 4) — NO api key, no `Vxil` client, no auth of any kind. This is the
|
|
159
159
|
* anonymous reader path (a blog/storefront/docs front-end). Returns the same
|
|
160
160
|
* `{ items, next_cursor }` envelope the authed list does, but rows are stripped
|
|
161
161
|
* to the public surface (`CmsPublicRow`) — drafts and the owner_field are never
|
|
@@ -254,7 +254,7 @@ export class Vxil {
|
|
|
254
254
|
static connect(opts) {
|
|
255
255
|
return new Vxil(opts);
|
|
256
256
|
}
|
|
257
|
-
/** Typed per-collection CMS handle (
|
|
257
|
+
/** Typed per-collection CMS handle (guide ch. 5). A thin wrapper over the
|
|
258
258
|
* generic `cms.items.*` methods — the wire calls are identical; the generated
|
|
259
259
|
* `VxilSchema` supplies the field types. `vx.cms.items.*` stays as the
|
|
260
260
|
* always-available un-generic fallback. */
|
|
@@ -291,7 +291,7 @@ export class Vxil {
|
|
|
291
291
|
rank: (q) => this.cms.items.rank(c, q),
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
/** Typed function invoke (
|
|
294
|
+
/** Typed function invoke (guide ch. 8). `vx.fn.<name>(payload)` POSTs to
|
|
295
295
|
* /v1/fn/<name>; the generated `VxilSchema` types Input/Output (Level-0
|
|
296
296
|
* opaque until a function declares a signature). A Proxy gives the
|
|
297
297
|
* `vx.fn.<name>` accessor shape without enumerating names at runtime.
|
|
@@ -359,7 +359,7 @@ export class Vxil {
|
|
|
359
359
|
});
|
|
360
360
|
// An empty body on a 2xx is a valid "no content" success (e.g. 204 from
|
|
361
361
|
// DELETE/markRead) — never an error. Only parse when there are bytes; a
|
|
362
|
-
// void-returning caller ignores `data` anyway.
|
|
362
|
+
// void-returning caller ignores `data` anyway.
|
|
363
363
|
let parsed = {};
|
|
364
364
|
if (text.length > 0) {
|
|
365
365
|
try {
|
|
@@ -395,7 +395,7 @@ export class Vxil {
|
|
|
395
395
|
* (email/display_name/avatar_url/attributes) is scrubbed, while the id is
|
|
396
396
|
* kept so cross-feature references stay intact. NOTE: a full account-delete
|
|
397
397
|
* flow also calls the auth half — POST /v1/auth/users/:id/erase — to erase
|
|
398
|
-
* the credential/session identity (see
|
|
398
|
+
* the credential/session identity (see guide ch. 6, auth).
|
|
399
399
|
*/
|
|
400
400
|
delete: async (id, opts) => {
|
|
401
401
|
await this.call('DELETE', `/v1/users/${encodeURIComponent(id)}${opts?.erase ? '?erase=true' : ''}`);
|
|
@@ -497,7 +497,7 @@ export class Vxil {
|
|
|
497
497
|
* does not cover them, so an "unsubscribe from everything" click can never
|
|
498
498
|
* lock a user out of its own account. Muteable ids: `welcome`,
|
|
499
499
|
* `transactional`. (Password-reset mail rides `transactional`, which stays
|
|
500
|
-
* muteable — see
|
|
500
|
+
* muteable — see guide ch. 6, notifications.)
|
|
501
501
|
*
|
|
502
502
|
* SCOPES: with an end-user token both calls are confined to the verified
|
|
503
503
|
* principal and take `notifications:read` (a browser key that can mute its
|
|
@@ -524,7 +524,7 @@ export class Vxil {
|
|
|
524
524
|
},
|
|
525
525
|
/** A single delivery by id (the list is `deliveries()`). */
|
|
526
526
|
delivery: async (deliveryId) => (await this.call('GET', `/v1/notifications/deliveries/${encodeURIComponent(deliveryId)}`)).data,
|
|
527
|
-
/** Email broadcast campaigns (
|
|
527
|
+
/** Email broadcast campaigns (guide ch. 6, notifications): audience-ref fan-out
|
|
528
528
|
* with quiet-hours + frequency-cap policy. `schedule_cron` sets a recurring
|
|
529
529
|
* send (status `scheduled`); omit it for a `draft`. */
|
|
530
530
|
campaigns: {
|
|
@@ -557,12 +557,12 @@ export class Vxil {
|
|
|
557
557
|
/** The tenant's enabled-feature summary (GET /v1/features). Privilege-
|
|
558
558
|
* independent: any valid key may read it — it leaks no secrets, only which
|
|
559
559
|
* features the tenant has turned on. Mirrors what the MCP tool-list
|
|
560
|
-
* aggregation sees.
|
|
560
|
+
* aggregation sees. */
|
|
561
561
|
list: async () => (await this.call('GET', '/v1/features')).data.features,
|
|
562
562
|
/** The FULL enabled-feature summary: `features` + `api_versions` (released
|
|
563
563
|
* API majors per feature) + the additive `key` block — the CALLING key's
|
|
564
564
|
* identity and per-tool MCP permissions (allowed_tools/denied_tools
|
|
565
|
-
* patterns
|
|
565
|
+
* patterns; guide ch. 10). `key` is absent for non-key
|
|
566
566
|
* callers and for keys without explicit tool perms. `list()` stays the
|
|
567
567
|
* stable flat-array shorthand. */
|
|
568
568
|
summary: async () => (await this.call('GET', '/v1/features')).data,
|
|
@@ -610,7 +610,7 @@ export class Vxil {
|
|
|
610
610
|
if (!res.ok) {
|
|
611
611
|
// Preserve the structured error envelope on failure — the export path
|
|
612
612
|
// is hand-rolled (no this.call), so without this a 403/429 would lose
|
|
613
|
-
// its code/hint/requestId.
|
|
613
|
+
// its code/hint/requestId.
|
|
614
614
|
let env = {};
|
|
615
615
|
try {
|
|
616
616
|
env = JSON.parse(text);
|
|
@@ -621,7 +621,7 @@ export class Vxil {
|
|
|
621
621
|
}
|
|
622
622
|
// Skip blank lines AND tolerate a single malformed NDJSON line rather
|
|
623
623
|
// than aborting the whole batch (e.g. a truncated final line on a large
|
|
624
|
-
// page) — collect parse failures so the caller can decide.
|
|
624
|
+
// page) — collect parse failures so the caller can decide.
|
|
625
625
|
const events = [];
|
|
626
626
|
const parseErrors = [];
|
|
627
627
|
text.split('\n').forEach((l, i) => {
|
|
@@ -657,7 +657,7 @@ export class Vxil {
|
|
|
657
657
|
* batch). Each item = the enqueue input, incl. per-item idempotency_key
|
|
658
658
|
* and deliver_after/delay_seconds. Results align with the input order. */
|
|
659
659
|
enqueueBatch: async (items) => (await this.call('POST', '/v1/jobs/enqueue-batch', { jobs: items })).data,
|
|
660
|
-
/** Enqueue a long-running EXTERNAL generation run (
|
|
660
|
+
/** Enqueue a long-running EXTERNAL generation run (guide ch. 6, jobs): Vxil calls
|
|
661
661
|
* the provider (BYO key), tracks completion via poll/webhook, mirrors a typed
|
|
662
662
|
* generation_status onto a tenant record, enforces a built-in timeout, and
|
|
663
663
|
* (on failure) fires the payments credit-reversal.
|
|
@@ -666,7 +666,7 @@ export class Vxil {
|
|
|
666
666
|
* of the same `idempotency_key` (`deduplicated: true`) carries the run's
|
|
667
667
|
* status NOW (`processing`, `completed` or `failed` too).
|
|
668
668
|
*
|
|
669
|
-
* `reserve_credits`
|
|
669
|
+
* `reserve_credits` takes a PROVISIONAL held credit debit at enqueue
|
|
670
670
|
* (linked to the run), committed on `completed` and reversed on
|
|
671
671
|
* failed/timeout/DLQ. `amount` is positive-only and CLAMPED to the platform
|
|
672
672
|
* `config.generation.maxReserveCredits` cap; in end-user mode `user_id` is
|
|
@@ -1059,7 +1059,7 @@ export class Vxil {
|
|
|
1059
1059
|
check: async (input) => (await this.call('POST', '/v1/rate-limits/check', input)).data,
|
|
1060
1060
|
/** Per-identifier overrides layered over a policy: `pattern` matches the
|
|
1061
1061
|
* RENDERED key (exact, or a `*`-glob where the longest literal prefix
|
|
1062
|
-
* wins). Propagates to the check path within ≤30s (
|
|
1062
|
+
* wins). Propagates to the check path within ≤30s (cache TTL). */
|
|
1063
1063
|
overrides: {
|
|
1064
1064
|
list: async (policyId) => (await this.call('GET', `/v1/rate-limits/policies/${encodeURIComponent(policyId)}/overrides`)).data.overrides,
|
|
1065
1065
|
create: async (policyId, input) => (await this.call('POST', `/v1/rate-limits/policies/${encodeURIComponent(policyId)}/overrides`, input)).data,
|
|
@@ -1078,7 +1078,7 @@ export class Vxil {
|
|
|
1078
1078
|
addField: async (collection, field) => {
|
|
1079
1079
|
await this.call('POST', `/v1/cms/collections/${encodeURIComponent(collection)}/fields`, field);
|
|
1080
1080
|
},
|
|
1081
|
-
/** Set (or clear, with `null`/`[]`) a field's READ-ROLE gate (
|
|
1081
|
+
/** Set (or clear, with `null`/`[]`) a field's READ-ROLE gate (guide ch. 4) —
|
|
1082
1082
|
* the same-type in-place alter on the fields route. Re-sends the field's
|
|
1083
1083
|
* `type` (required by the alter path); every OTHER attribute the field
|
|
1084
1084
|
* carries is re-sent from `rest`, because the alter overwrites the whole
|
|
@@ -1088,7 +1088,7 @@ export class Vxil {
|
|
|
1088
1088
|
setFieldReadRoles: async (collection, field, type, roles, rest = {}) => {
|
|
1089
1089
|
await this.call('POST', `/v1/cms/collections/${encodeURIComponent(collection)}/fields`, { ...rest, field, type, read_roles: roles ?? [] });
|
|
1090
1090
|
},
|
|
1091
|
-
/** Turn a field's EQUALITY INDEX on or off (
|
|
1091
|
+
/** Turn a field's EQUALITY INDEX on or off (guide ch. 4 "Indexed equality")
|
|
1092
1092
|
* — the same-type in-place alter on the fields route; `indexed` is
|
|
1093
1093
|
* present-key, so no other attribute moves. Only for UNSLOTTED,
|
|
1094
1094
|
* non-computed fields, ≤4 per collection (422 `eq_index_budget`).
|
|
@@ -1112,11 +1112,11 @@ export class Vxil {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
},
|
|
1114
1114
|
/** Set (or clear, with `null`) the collection's end-user owner-scope flag
|
|
1115
|
-
* (
|
|
1115
|
+
* (guide ch. 4, "`ownerField`"). Names an existing `string` field that holds the owner id. */
|
|
1116
1116
|
setOwnerField: async (collection, ownerField) => {
|
|
1117
1117
|
await this.call('POST', `/v1/cms/collections/${encodeURIComponent(collection)}/fields`, { owner_field: ownerField });
|
|
1118
1118
|
},
|
|
1119
|
-
/** Toggle the collection's PUBLIC-delivery flag (
|
|
1119
|
+
/** Toggle the collection's PUBLIC-delivery flag (guide ch. 4). When `true`,
|
|
1120
1120
|
* its PUBLISHED items become KEYLESS-readable via the anonymous public lane
|
|
1121
1121
|
* (`GET {base}/v1/cms/public/:tenantId/:collection` — no api key); drafts and
|
|
1122
1122
|
* the owner_field are never exposed. `false` closes the lane (and purges the
|
|
@@ -1125,7 +1125,7 @@ export class Vxil {
|
|
|
1125
1125
|
await this.call('POST', `/v1/cms/collections/${encodeURIComponent(collection)}/fields`, { public: isPublic });
|
|
1126
1126
|
},
|
|
1127
1127
|
/** Re-project the collection's index slots after an `index_slot` move
|
|
1128
|
-
* (
|
|
1128
|
+
* (guide ch. 4). Slots are projected on WRITE only, so until this runs,
|
|
1129
1129
|
* stored rows keep their OLD projection: the new slot is NULL and the
|
|
1130
1130
|
* VACATED slot still holds the old field's values — range/sort on the
|
|
1131
1131
|
* moved field returns the WRONG rows, not merely missing ones. ONE page
|
|
@@ -1180,7 +1180,7 @@ export class Vxil {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
return { scanned, updated, skipped, pages, ...(indexCertify ? { index_certify: indexCertify } : {}) };
|
|
1182
1182
|
},
|
|
1183
|
-
/** Replace the collection's per-record ACTION list (
|
|
1183
|
+
/** Replace the collection's per-record ACTION list (guide ch. 4) — the
|
|
1184
1184
|
* `{ actions }` fields-route meta-op; `[]` clears. Each action is ONE
|
|
1185
1185
|
* human-initiated step: the dashboard renders it as a button per record,
|
|
1186
1186
|
* and `items.runAction` invokes its deployed function. */
|
|
@@ -1189,10 +1189,10 @@ export class Vxil {
|
|
|
1189
1189
|
},
|
|
1190
1190
|
},
|
|
1191
1191
|
items: {
|
|
1192
|
-
/** `lock` serializes same-key writers (per-
|
|
1193
|
-
* is the declarative capacity/overlap invariant (requires lock) —
|
|
1192
|
+
/** `lock` serializes same-key writers (a per-key lock); `guard`
|
|
1193
|
+
* is the declarative capacity/overlap invariant (requires lock) — guide ch. 4. */
|
|
1194
1194
|
create: async (collection, input) => (await this.call('POST', `/v1/cms/items/${encodeURIComponent(collection)}`, input)).data,
|
|
1195
|
-
/** `expand` inlines relation/file fields into `data` (
|
|
1195
|
+
/** `expand` inlines relation/file fields into `data` (guide ch. 4): the
|
|
1196
1196
|
* full item envelope, a `{ object_id, $ref: 'files' }` stub for a file,
|
|
1197
1197
|
* the bare id on a cycle/depth cut, `null` for an invisible target. */
|
|
1198
1198
|
get: async (collection, itemId, opts) => {
|
|
@@ -1224,9 +1224,9 @@ export class Vxil {
|
|
|
1224
1224
|
});
|
|
1225
1225
|
return (await this.call('GET', `/v1/cms/items/${encodeURIComponent(collection)}${s}`)).data;
|
|
1226
1226
|
},
|
|
1227
|
-
/** Merge-patch data keys; null clears a key. Concurrency opts (
|
|
1227
|
+
/** Merge-patch data keys; null clears a key. Concurrency opts (guide ch. 4):
|
|
1228
1228
|
* `ifVersion` → If-Match CAS; `if` → bounded field precondition against
|
|
1229
|
-
* the locked row; `lock`/`guard` → the
|
|
1229
|
+
* the locked row; `lock`/`guard` → the write-serialization primitives (guide ch. 4). */
|
|
1230
1230
|
patch: async (collection, itemId, data, opts) => (await this.call('PATCH', `/v1/cms/items/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`, {
|
|
1231
1231
|
data,
|
|
1232
1232
|
...(opts?.if ? { if: opts.if } : {}),
|
|
@@ -1237,18 +1237,18 @@ export class Vxil {
|
|
|
1237
1237
|
/** Atomic in-database increment — PATCH `{ $inc: {field: delta} }`, ONE
|
|
1238
1238
|
* conditional UPDATE guarded by the field's validation min/max (the quota
|
|
1239
1239
|
* shape), the optional `if` precondition, and If-Match. 409
|
|
1240
|
-
* inc_out_of_bounds when the guard refuses (
|
|
1240
|
+
* inc_out_of_bounds when the guard refuses (guide ch. 4). */
|
|
1241
1241
|
inc: async (collection, itemId, incs, opts) => (await this.call('PATCH', `/v1/cms/items/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`, { $inc: incs, ...(opts?.if ? { if: opts.if } : {}) }, opts?.ifVersion !== undefined ? { 'if-match': String(opts.ifVersion) } : {})).data,
|
|
1242
|
-
/** `{ count }` under the same bounded filter grammar (
|
|
1242
|
+
/** `{ count }` under the same bounded filter grammar (guide ch. 4). 422
|
|
1243
1243
|
* count_unavailable_with_read_hooks on beforeRead-hooked collections. */
|
|
1244
1244
|
count: async (collection, filter) => {
|
|
1245
1245
|
const s = qs({ count: 'true', filter: filter ? JSON.stringify(filter) : undefined });
|
|
1246
1246
|
return (await this.call('GET', `/v1/cms/items/${encodeURIComponent(collection)}${s}`)).data.count;
|
|
1247
1247
|
},
|
|
1248
|
-
/** Returns the cascade tally (
|
|
1248
|
+
/** Returns the cascade tally (guide ch. 4); `ifVersion` rides If-Match and
|
|
1249
1249
|
* a conflict aborts BEFORE any cascade side-effect. */
|
|
1250
1250
|
delete: async (collection, itemId, opts) => (await this.call('DELETE', `/v1/cms/items/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`, undefined, opts?.ifVersion !== undefined ? { 'if-match': String(opts.ifVersion) } : {})).data,
|
|
1251
|
-
/**
|
|
1251
|
+
/** BOUNDED FILTERED delete — soft-delete up to `limit`
|
|
1252
1252
|
* items (1–100, default 25) matching `filter`, newest id first. A filter
|
|
1253
1253
|
* is REQUIRED (an unselected sweep is refused 422). Each matched row runs
|
|
1254
1254
|
* the SAME single-item delete path (restrict refusal, cascade budget,
|
|
@@ -1268,7 +1268,7 @@ export class Vxil {
|
|
|
1268
1268
|
...(q.dryRun !== undefined ? { dry_run: q.dryRun } : {}),
|
|
1269
1269
|
})).data,
|
|
1270
1270
|
publish: async (collection, itemId) => (await this.call('POST', `/v1/cms/items/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}/publish`)).data,
|
|
1271
|
-
/**
|
|
1271
|
+
/** The BOUNDED reverse read — which live items
|
|
1272
1272
|
* reference this one, through which relation field. Owner-scoped in
|
|
1273
1273
|
* end-user mode like `get`. `count` is the page returned (≤ limit, max
|
|
1274
1274
|
* 100), never a total; `has_more` says the cap was hit. A DELETE refused
|
|
@@ -1278,19 +1278,19 @@ export class Vxil {
|
|
|
1278
1278
|
const qs = opts?.limit !== undefined ? `?limit=${encodeURIComponent(String(opts.limit))}` : '';
|
|
1279
1279
|
return (await this.call('GET', `/v1/cms/items/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}/backlinks${qs}`)).data;
|
|
1280
1280
|
},
|
|
1281
|
-
/**
|
|
1281
|
+
/** Run ONE declared per-record action — invokes the
|
|
1282
1282
|
* action's deployed function with `{ collection, item_id, action, actor,
|
|
1283
1283
|
* item }` and returns its result. 404 when the key is not declared;
|
|
1284
1284
|
* 502 `action_failed` (with `upstream.code` = the function's error
|
|
1285
1285
|
* class) when the function fails. Requires cms:write. */
|
|
1286
1286
|
runAction: async (collection, itemId, key) => (await this.call('POST', `/v1/cms/items/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}/actions/${encodeURIComponent(key)}`)).data,
|
|
1287
|
-
/**
|
|
1287
|
+
/** Bounded group-by aggregate. fns count|sum|
|
|
1288
1288
|
* min|max|avg over index-slot-bound fields; groupBy ≤2 slot-bound
|
|
1289
1289
|
* fields; filter = the full query DSL incl. ONE-hop dotted join terms
|
|
1290
1290
|
* ({"channel.visibility":"public"}); scan capped at 50k rows → 422
|
|
1291
1291
|
* window_too_large (narrow the window or materialize a read-model). */
|
|
1292
1292
|
aggregate: async (collection, body) => (await this.call('POST', `/v1/cms/items/${encodeURIComponent(collection)}/aggregate`, body)).data,
|
|
1293
|
-
/**
|
|
1293
|
+
/** Window ranking over the aggregate — rank ∈
|
|
1294
1294
|
* row_number|rank|percent_rank, computed over ≤500 aggregated groups
|
|
1295
1295
|
* (never raw rows), optional partitionBy. Same scan cap as aggregate. */
|
|
1296
1296
|
rank: async (collection, body) => (await this.call('POST', `/v1/cms/items/${encodeURIComponent(collection)}/rank`, body)).data,
|
|
@@ -1304,13 +1304,13 @@ export class Vxil {
|
|
|
1304
1304
|
* merge, the event is the backstop. Emits one `cms.items.rekeyed`. */
|
|
1305
1305
|
reKey: async (input) => (await this.call('POST', '/v1/cms/items/re-key', input)).data,
|
|
1306
1306
|
},
|
|
1307
|
-
/**
|
|
1307
|
+
/** Atomic multi-collection transaction — 1–5
|
|
1308
1308
|
* steps over ≤3 collections, per-step `$where` CAS preconditions (the
|
|
1309
1309
|
* PATCH `if` grammar). All-or-nothing: any failed precondition/validation
|
|
1310
1310
|
* rolls the WHOLE transaction back (409 precondition_failed names the
|
|
1311
1311
|
* step). cms-internal only — no cross-feature effects inside the tx. */
|
|
1312
1312
|
transaction: async (steps) => (await this.call('POST', '/v1/cms/transactions', { steps })).data,
|
|
1313
|
-
/**
|
|
1313
|
+
/** Several get / query / create / patch / delete ops in
|
|
1314
1314
|
* ONE round trip — the function-chain shape ("read 3 rows → patch 2 →
|
|
1315
1315
|
* create 1" is one call, not six). ≤25 ops, each run through the SAME path
|
|
1316
1316
|
* its single route uses (scopes, owner-scoping, hooks, guards, `if`,
|
|
@@ -1325,7 +1325,7 @@ export class Vxil {
|
|
|
1325
1325
|
ops: ops.map((o) => ('expand' in o && o.expand !== undefined ? { ...o, expand: expandParam(o.expand) } : o)),
|
|
1326
1326
|
...(opts?.atomic !== undefined ? { atomic: opts.atomic } : {}),
|
|
1327
1327
|
})).data,
|
|
1328
|
-
/**
|
|
1328
|
+
/** Declared read-models (config `readModels`
|
|
1329
1329
|
* bag) — list with last-run status, and "run now" materialization into
|
|
1330
1330
|
* the rollup collection. */
|
|
1331
1331
|
readModels: {
|
|
@@ -1373,7 +1373,7 @@ export class Vxil {
|
|
|
1373
1373
|
/** Read the resolved DM config (defaults merged with the stored partial). */
|
|
1374
1374
|
getConfig: async () => (await this.call('GET', '/v1/dm/config')).data,
|
|
1375
1375
|
/** Write the DM master config — a partial merge (omitted leaves keep their
|
|
1376
|
-
* current value), version-bumped and republished to the gate's
|
|
1376
|
+
* current value), version-bumped and republished to the gate's cache. */
|
|
1377
1377
|
setConfig: async (patch) => (await this.call('PUT', '/v1/dm/config', patch)).data,
|
|
1378
1378
|
conversations: {
|
|
1379
1379
|
/** Open (or, for a direct pair, return the existing) conversation. A
|
|
@@ -1436,7 +1436,7 @@ export class Vxil {
|
|
|
1436
1436
|
/** The MCP aggregation surface (the `mcp` feature). */
|
|
1437
1437
|
mcp = {
|
|
1438
1438
|
/** Per-tenant secret for verifying the X-Vxil-Mcp-Signature header on custom
|
|
1439
|
-
* MCP tool calls (
|
|
1439
|
+
* MCP tool calls (guide ch. 10) — the mirror of jobs.signingSecret(). */
|
|
1440
1440
|
signingSecret: async () => (await this.call('GET', '/v1/mcp/signing-secret')).data.signing_secret,
|
|
1441
1441
|
};
|
|
1442
1442
|
/**
|
|
@@ -1521,7 +1521,7 @@ export class Vxil {
|
|
|
1521
1521
|
markAll: async (userId) => this.feedsMark(userId, 'read'),
|
|
1522
1522
|
/** Archive/dismiss groups (hidden from inbox + dropped from the badge). */
|
|
1523
1523
|
archive: async (userId, scope) => this.feedsMark(userId, 'archive', scope),
|
|
1524
|
-
/** The badge: { unseen, unread, total } (
|
|
1524
|
+
/** The badge: { unseen, unread, total } (cached, recomputed on a miss). */
|
|
1525
1525
|
unreadCount: async (userId) => (await this.call('GET', `/v1/feeds/notification/${encodeURIComponent(userId)}/count`)).data,
|
|
1526
1526
|
},
|
|
1527
1527
|
/**
|
|
@@ -1649,7 +1649,7 @@ export class Vxil {
|
|
|
1649
1649
|
/** List an org's pending invitations. */
|
|
1650
1650
|
list: async (orgId) => (await this.call('GET', `/v1/orgs/${encodeURIComponent(orgId)}/invitations`)).data.invitations,
|
|
1651
1651
|
},
|
|
1652
|
-
/** Custom tenant roles (permission-sets
|
|
1652
|
+
/** Custom tenant roles (permission-sets). A custom role
|
|
1653
1653
|
* is a named set of permissions assignable like any built-in; the four
|
|
1654
1654
|
* built-ins reproduce the fixed owner>admin>member>viewer lattice. */
|
|
1655
1655
|
roles: {
|
|
@@ -1662,7 +1662,7 @@ export class Vxil {
|
|
|
1662
1662
|
await this.call('DELETE', `/v1/orgs/roles/${encodeURIComponent(roleKey)}`);
|
|
1663
1663
|
},
|
|
1664
1664
|
},
|
|
1665
|
-
/** Per-org/user resource ACL grants
|
|
1665
|
+
/** Per-org/user resource ACL grants: grant a permission
|
|
1666
1666
|
* on a specific resource string; `check(...,{ resource })` consults them. */
|
|
1667
1667
|
acl: {
|
|
1668
1668
|
grant: async (orgId, input) => (await this.call('POST', `/v1/orgs/${encodeURIComponent(orgId)}/acl`, input)).data,
|
|
@@ -1735,7 +1735,7 @@ export class Vxil {
|
|
|
1735
1735
|
},
|
|
1736
1736
|
/** Aggregate storage usage vs quotas (the FilesManager Storage panel). */
|
|
1737
1737
|
usage: async () => (await this.call('GET', '/v1/files/usage')).data,
|
|
1738
|
-
/** OCR / text extraction (
|
|
1738
|
+
/** OCR / text extraction (guide ch. 6, files, BYO-key add-on). Small/mock inputs
|
|
1739
1739
|
* extract inline (status `available`); large inputs (or `async:true`) return
|
|
1740
1740
|
* 202 with a `job_id` — poll `getText()`. */
|
|
1741
1741
|
extractText: async (objectId, opts) => (await this.call('POST', `/v1/files/${encodeURIComponent(objectId)}/extract-text`, opts ?? {})).data,
|
|
@@ -1818,7 +1818,7 @@ export class Vxil {
|
|
|
1818
1818
|
* The AI substrate (the `ai` feature): store prompt TEMPLATES (config-as-code),
|
|
1819
1819
|
* then generate (sync or streamed) and embed across providers. 'mock' is the
|
|
1820
1820
|
* deterministic default; the real providers (openai/anthropic/gemini/azure/
|
|
1821
|
-
* openrouter) route via BYO keys in
|
|
1821
|
+
* openrouter) route via BYO keys in your project secrets. `images` on the generate
|
|
1822
1822
|
* inputs takes up to 8 vision refs: a public https:// URL, a
|
|
1823
1823
|
* data:image/...;base64 URL, or file:<object_id> (a files-feature object) —
|
|
1824
1824
|
* fetched images are capped at 4 MiB each; `documents` (pdf/text, ≤10 MiB
|
|
@@ -1878,7 +1878,7 @@ export class Vxil {
|
|
|
1878
1878
|
* outlives the ≤300s realtime token TTL); reconnect with `?since=<seq>`. */
|
|
1879
1879
|
remintToken: async (generationId) => (await this.call('GET', `/v1/ai/generations/${encodeURIComponent(generationId)}/token`)).data,
|
|
1880
1880
|
/** Resume a streamed generation after a dropped socket: every recorded frame
|
|
1881
|
-
* with seq > `since` plus `done` (the
|
|
1881
|
+
* with seq > `since` plus `done` (the replay buffer — plain JSON, not
|
|
1882
1882
|
* an SSE stream; the buffer lives 1 h). A settled JOB-lane generation is
|
|
1883
1883
|
* served from its stored answer instead (30 days). `status` says where the
|
|
1884
1884
|
* generation is; `expired: true` means it settled but its frames are gone
|
|
@@ -1929,7 +1929,7 @@ export class Vxil {
|
|
|
1929
1929
|
/** Streamed grounded answer: citations + the channel handle up front, tokens
|
|
1930
1930
|
* over the realtime channel. */
|
|
1931
1931
|
stream: async (input) => (await this.call('POST', '/v1/rag/answer', { ...input, stream: true })).data,
|
|
1932
|
-
/** Retrieval-only grounding preview (
|
|
1932
|
+
/** Retrieval-only grounding preview (guide ch. 6, rag): the exact chunks `answer`
|
|
1933
1933
|
* would ground on, with rerank + metadata boosts applied — no generation,
|
|
1934
1934
|
* no token spend. `boosts`/`rerank`/`min_score` override the rag config.
|
|
1935
1935
|
* `min_score` floors the EFFECTIVE `score`, which is a RANK value (about
|
|
@@ -2028,7 +2028,7 @@ export class Vxil {
|
|
|
2028
2028
|
* `quota` inlines one quota, `creditType` inlines the same owner-bound
|
|
2029
2029
|
* balance `getBalance` returns — ONE call for a thin client's paywall.
|
|
2030
2030
|
* A non-2xx answer means UNKNOWN: render the last cached answer, never
|
|
2031
|
-
* free (
|
|
2031
|
+
* free (guide ch. 6, payments).
|
|
2032
2032
|
*
|
|
2033
2033
|
* OVERLAPPING SUBSCRIPTIONS — what `until` means. The WINNER is the
|
|
2034
2034
|
* entitled subscription with the highest `tierMap[tier].rank` (default 0);
|
|
@@ -2114,14 +2114,14 @@ export class Vxil {
|
|
|
2114
2114
|
return (await this.call('GET', `/v1/payments/subscriptions${s}`)).data.subscriptions;
|
|
2115
2115
|
},
|
|
2116
2116
|
/**
|
|
2117
|
-
* Create a hosted-checkout session (
|
|
2117
|
+
* Create a hosted-checkout session (guide ch. 6, payments). Redirect the buyer to
|
|
2118
2118
|
* the returned `url`; completion lands server-side via the provider webhook
|
|
2119
2119
|
* (the matching session flips to completed, the charge/grant is folded).
|
|
2120
2120
|
* Idempotency-Key REQUIRED — a retry replays the SAME session verbatim.
|
|
2121
2121
|
*/
|
|
2122
2122
|
createCheckoutSession: async (input, opts) => (await this.call('POST', '/v1/payments/checkout-sessions', input, { 'idempotency-key': opts.idempotencyKey })).data,
|
|
2123
2123
|
/**
|
|
2124
|
-
* Refund a charge at-most-once (
|
|
2124
|
+
* Refund a charge at-most-once (guide ch. 6, payments). Omit `amount_cents` to
|
|
2125
2125
|
* refund the full un-refunded remainder. Idempotency-Key REQUIRED — a retry
|
|
2126
2126
|
* replays the recorded refund (never a second provider refund); a refund can
|
|
2127
2127
|
* NEVER exceed the charge (422 refund_exceeds_charge).
|
|
@@ -2241,7 +2241,7 @@ export class Vxil {
|
|
|
2241
2241
|
});
|
|
2242
2242
|
return (await this.call('GET', `/v1/payments/refunds${suffix}`)).data;
|
|
2243
2243
|
},
|
|
2244
|
-
/** Provider webhook event log (
|
|
2244
|
+
/** Provider webhook event log (guide ch. 6, payments "Event log & replay"):
|
|
2245
2245
|
* operator visibility over every delivery — incl. persisted signature
|
|
2246
2246
|
* failures — plus an idempotent reprocess verb. Needs payments:read
|
|
2247
2247
|
* (reprocess: payments:write).
|
|
@@ -2276,5 +2276,5 @@ export class Vxil {
|
|
|
2276
2276
|
};
|
|
2277
2277
|
}
|
|
2278
2278
|
// Failure reporting for tenant functions — the Sentry-envelope forwarder
|
|
2279
|
-
// (
|
|
2279
|
+
// (guide ch. 8). Zero dependencies; see reporting.ts.
|
|
2280
2280
|
export { withReporting, report, buildEnvelope, parseDsn, exceptionEvent, reportServerErrors, REPORT_TIMEOUT_MS, } from './reporting.js';
|
package/dist/qs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Query-string builder — the SDK's replacement for the WHATWG `URLSearchParams`
|
|
2
|
-
// at every call site (
|
|
2
|
+
// at every call site (the React-Native-clean SDK).
|
|
3
3
|
//
|
|
4
4
|
// WHY (implementation note; `//` comments never reach the shipped .d.ts):
|
|
5
5
|
// React Native supplies its own URLSearchParams polyfill, and up to RN 0.79
|
package/dist/reporting.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// withReporting — forward a tenant function's failure to the tenant's OWN
|
|
2
|
-
// error reporter over the Sentry envelope HTTP format
|
|
3
|
-
// techmaker evaluation P0-5's "SDK half", 2026-09-23).
|
|
2
|
+
// error reporter over the Sentry envelope HTTP format.
|
|
4
3
|
//
|
|
5
4
|
// NOT a Sentry SDK and NOT a dependency on one: the function sandbox is
|
|
6
5
|
// Web-standard fetch/crypto only, so this is the plain ingestion envelope
|
package/dist/retry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The request seam: retry + timeout + hooks around the ONE `fetch` every SDK
|
|
2
|
-
// request goes through
|
|
3
|
-
// `VxilError.retryAfter` shares
|
|
2
|
+
// request goes through, and the `Retry-After` parser
|
|
3
|
+
// `VxilError.retryAfter` shares. DEFAULT OFF — with no `retry`,
|
|
4
4
|
// `timeoutMs` or `hooks` option the transport is a single `fetch` + `text()`,
|
|
5
5
|
// exactly what `call()` did before.
|
|
6
6
|
//
|
package/package.json
CHANGED