@taicor-ai/wave-sdk 0.0.0-stage → 0.1.0-staging.sha0716fbd6688d

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/LICENSE.md ADDED
@@ -0,0 +1,3 @@
1
+ PolyForm Strict License 1.0.0: <https://polyformproject.org/licenses/strict/1.0.0>
2
+
3
+ Required Notice: Copyright Taicor (https://www.taicor.ai)
package/README.md CHANGED
@@ -1,3 +1,38 @@
1
- # Temporary Holding Version
1
+ # `@taicor-ai/wave-sdk`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Call Wave operations from TypeScript, with types for each operation's input and
4
+ result. [`@taicor-ai/wave-frontend`](https://www.npmjs.com/package/@taicor-ai/wave-frontend)
5
+ starts an app, signs you in, and generates `wave.generated.ts`.
6
+
7
+ ## Call operations
8
+
9
+ ```ts
10
+ import { createWaveClient } from "@taicor-ai/wave-sdk";
11
+ import { WAVE_ONTOLOGY } from "./wave.generated";
12
+
13
+ const client = createWaveClient({ ontology: WAVE_ONTOLOGY });
14
+
15
+ const page = await client.query("state.objects.list", {
16
+ objectType: { slug: "storage_bin" },
17
+ attributes: [{ slug: "unit_count" }],
18
+ limit: 50,
19
+ });
20
+ ```
21
+
22
+ `wave-app codegen` from `@taicor-ai/wave-frontend` writes `wave.generated.ts`.
23
+ Pass its descriptor to the client; a type argument alone does not specialize
24
+ it. The types are a snapshot, so rerun codegen after the ontology changes.
25
+
26
+ A page is `{ items, next }`; pass a non-null `next` as `after` to continue.
27
+ Queries accept an optional `AbortSignal`. Commands require an
28
+ `idempotencyKey` in their options, and an input's own `idempotencyKey` must
29
+ match it. A `contract.incompatible` problem means the package uses a different
30
+ RPC protocol than the server.
31
+
32
+ ## Other exports
33
+
34
+ - `uploadFile(client, { filename, bytes, signal, onProgress })` uploads a
35
+ `Blob` or `Uint8Array` and waits until Wave settles it. A failed upload
36
+ throws `WaveUploadError`.
37
+ - `connectWave({ origin }).client` from `@taicor-ai/wave-frontend/vite` is a
38
+ client for scripts, as the User who ran `wave-app login`.
@@ -0,0 +1,130 @@
1
+ import type { WaveCommandName, WaveOperationInput, WaveOperationKind, WaveOperationOutput, WaveQueryName } from "./contract.ts";
2
+ import { type WaveSdkOperationMap, type WaveSdkOperationName } from "./generated/operations.ts";
3
+ import type { WaveProblemBody } from "./generated/public-problem.ts";
4
+ import type { WaveOntologyMetadata, WaveOperationInputCheck, WaveOperationResult } from "./ontology.ts";
5
+ export type { WaveProblemBody } from "./generated/public-problem.ts";
6
+ type Awaitable<Value> = PromiseLike<Value> | Value;
7
+ /** The callable transport contract does not require runtime-specific fetch statics. */
8
+ export type WaveFetch = (...args: Parameters<typeof globalThis.fetch>) => ReturnType<typeof globalThis.fetch>;
9
+ export type WaveHeaders = HeadersInit | ((context: {
10
+ signal?: AbortSignal;
11
+ }) => Awaitable<HeadersInit | undefined>);
12
+ /** Transport options shared by canonical and ontology-bound clients. */
13
+ export interface WaveClientOptions {
14
+ /** Same-origin by default. A pathname prefix such as `/api` is supported. */
15
+ baseUrl?: string | URL;
16
+ headers?: WaveHeaders;
17
+ credentials?: RequestCredentials;
18
+ fetch?: WaveFetch;
19
+ onUnauthorized?: () => void;
20
+ }
21
+ /** A client of the generated operations without ontology refinement. */
22
+ export interface WaveCanonicalClientConfig extends WaveClientOptions {
23
+ ontology?: undefined;
24
+ }
25
+ /** A client whose Object and Action types come from this actual descriptor. */
26
+ export interface WaveBoundClientConfig<Metadata extends WaveOntologyMetadata> extends WaveClientOptions {
27
+ ontology: Metadata;
28
+ }
29
+ export type WaveClientConfig<Metadata extends WaveOntologyMetadata | undefined = undefined> = Metadata extends WaveOntologyMetadata ? WaveBoundClientConfig<Metadata> : WaveCanonicalClientConfig;
30
+ export interface WaveQueryOptions {
31
+ signal?: AbortSignal;
32
+ }
33
+ export interface WaveCommandOptions extends WaveQueryOptions {
34
+ idempotencyKey: string;
35
+ }
36
+ type ActionBatchItem<Metadata extends WaveOntologyMetadata | undefined> = WaveOperationInput<"actions.submit", Metadata>["submissions"][number];
37
+ type ExactActionItems<Metadata extends WaveOntologyMetadata | undefined, Items extends readonly ActionBatchItem<Metadata>[]> = [Metadata] extends [WaveOntologyMetadata] ? WaveOperationInputCheck<"actions.submit", {
38
+ submissions: Items;
39
+ }, Metadata, {
40
+ submissions: readonly ActionBatchItem<Metadata>[];
41
+ }> extends {
42
+ submissions: infer Checked;
43
+ } ? Checked : never : unknown;
44
+ type ActionBatchSnapshot = NonNullable<WaveSdkOperationMap["actions.batches.get"]["output"]>;
45
+ export type WaveActionBatchOutcome = ActionBatchSnapshot["outcomes"][number];
46
+ export type WaveActionBatchSummary = Omit<ActionBatchSnapshot, "outcomes" | "nextCursor">;
47
+ export interface WaveActionBatchWaitOptions extends WaveQueryOptions {
48
+ /** Resume reads after the last successfully delivered ordinal. */
49
+ cursor?: number;
50
+ /** Last ordinal to report, inclusive. The wait still returns terminal progress. */
51
+ throughIndex?: number;
52
+ /** Called once for each outcome observed by this wait. */
53
+ onOutcome?: (outcome: WaveActionBatchOutcome) => Awaitable<void>;
54
+ /** The wait stops after this many milliseconds; default 5 minutes. */
55
+ maxWaitMs?: number;
56
+ }
57
+ export type WaveOperationOptions<Name extends WaveSdkOperationName> = Name extends WaveQueryName ? WaveQueryOptions & {
58
+ idempotencyKey?: never;
59
+ } : WaveCommandOptions;
60
+ export declare class WaveConfigurationError extends Error {
61
+ readonly code: "sdk.configuration";
62
+ constructor(message: string, options?: ErrorOptions);
63
+ }
64
+ export declare class WaveProblem extends Error {
65
+ readonly status: number;
66
+ readonly code: string;
67
+ readonly body: WaveProblemBody;
68
+ readonly responseBody: unknown;
69
+ constructor(status: number, body: WaveProblemBody, responseBody?: unknown, options?: ErrorOptions);
70
+ }
71
+ /** A Wave refusal framed as Wave RPC frames it, for local proxies and test
72
+ * servers: tRPC's native error, whose data carries the Problem and status. */
73
+ export declare function waveProblemResponse(status: number, problem: WaveProblemBody, headers?: HeadersInit): Response;
74
+ export declare class WaveTransportError extends Error {
75
+ readonly code: "sdk.transport";
76
+ readonly responseBody?: string;
77
+ constructor(message: string, options?: ErrorOptions, responseBody?: string);
78
+ }
79
+ /** Public Problem shape retained across separately bundled SDK copies. */
80
+ export interface RemoteWaveProblem {
81
+ name: "WaveProblem";
82
+ status: number;
83
+ code: string;
84
+ message?: string;
85
+ body: Record<string, unknown>;
86
+ }
87
+ export declare function isWaveProblem(error: unknown): error is RemoteWaveProblem;
88
+ export declare function isWaveTransportError(error: unknown): error is WaveTransportError;
89
+ export declare function isAbortError(error: unknown): boolean;
90
+ /** A failure outside any Wave response. The caller's cancellation reason wins
91
+ * over its own fallout, and an independent failure keeps both. */
92
+ export declare function transportFailure(message: string, error: unknown, signal: AbortSignal | undefined, responseBody?: string): unknown;
93
+ /** One Wave operation call over the tRPC HTTP protocol. */
94
+ export interface WaveOperationRequest {
95
+ baseUrl?: string | URL;
96
+ /** The flat dotted operation path. */
97
+ operation: string;
98
+ kind: WaveOperationKind;
99
+ input: unknown;
100
+ idempotencyKey?: string;
101
+ headers?: WaveHeaders;
102
+ credentials?: RequestCredentials;
103
+ fetch?: WaveFetch;
104
+ signal?: AbortSignal;
105
+ }
106
+ /** Call one operation using the Wave tRPC wire protocol. */
107
+ export declare function requestWaveOperation(request: WaveOperationRequest): Promise<{
108
+ data: unknown;
109
+ response: Response;
110
+ }>;
111
+ export declare class WaveClient<const Metadata extends WaveOntologyMetadata | undefined = undefined> {
112
+ #private;
113
+ constructor(config: WaveClientConfig<Metadata>);
114
+ /** The descriptor this client's types and Object read selectors follow. */
115
+ get ontology(): Metadata;
116
+ query<Name extends WaveQueryName, const Input extends WaveOperationInput<Name, Metadata> = WaveOperationInput<Name, Metadata>>(name: Name, input: Input & WaveOperationInputCheck<Name, Input, Metadata>, options?: WaveQueryOptions): Promise<WaveOperationResult<Name, Input, Metadata>>;
117
+ command<Name extends WaveCommandName, const Input extends WaveOperationInput<Name, Metadata> = WaveOperationInput<Name, Metadata>>(name: Name, input: Input & WaveOperationInputCheck<Name, Input, Metadata>, options: WaveCommandOptions): Promise<WaveOperationResult<Name, Input, Metadata>>;
118
+ execute<Name extends WaveSdkOperationName, const Input extends WaveOperationInput<Name, Metadata> = WaveOperationInput<Name, Metadata>>(name: Name, input: Input & WaveOperationInputCheck<Name, Input, Metadata>, options: WaveOperationOptions<Name>): Promise<WaveOperationResult<Name, Input, Metadata>>;
119
+ /** Transfer an ordered Action batch in bounded pages and return once sealed. */
120
+ submitActions<const Items extends readonly ActionBatchItem<Metadata>[]>(submissions: Items & ExactActionItems<Metadata, Items>, options: WaveCommandOptions): Promise<WaveOperationOutput<"actions.submit", Metadata>>;
121
+ /** Start with a receipt or read by batch ID. With a cursor, read after that ordinal. */
122
+ waitForActionBatch(batch: string | ActionBatchSnapshot, options?: WaveActionBatchWaitOptions): Promise<WaveActionBatchSummary>;
123
+ /** Submit one Action and wait for its applied, invalid, or refused outcome. */
124
+ submitActionAndWait(submission: ActionBatchItem<Metadata>, options: WaveCommandOptions & Pick<WaveActionBatchWaitOptions, "maxWaitMs">): Promise<Extract<WaveActionBatchOutcome, {
125
+ result: unknown;
126
+ }>["result"]>;
127
+ }
128
+ /** A client of the generated operations, or one refined by an actual ontology descriptor. */
129
+ export declare function createWaveClient(config?: WaveCanonicalClientConfig): WaveClient;
130
+ export declare function createWaveClient<const Metadata extends WaveOntologyMetadata>(config: WaveBoundClientConfig<Metadata>): WaveClient<Metadata>;
package/dist/client.js ADDED
@@ -0,0 +1 @@
1
+ import{createTRPCUntypedClient as E,httpLink as _,isTRPCClientError as N}from"@trpc/client";import{getTRPCErrorShape as C,initTRPC as k,TRPCError as U,transformTRPCResponse as M}from"@trpc/server";import{ACTION_BATCH_PAGE as x,WAVE_RPC_PROTOCOL_VERSION as B,WAVE_SDK_OPERATIONS as L}from"./generated/operations.js";import{WAVE_TRANSPORT_PROBLEM_CODES as b}from"./problem-codes.js";export class WaveConfigurationError extends Error{code=b.configuration;constructor(t,e){super(t,e);this.name="WaveConfigurationError"}}export class WaveProblem extends Error{status;code;body;responseBody;constructor(t,e,o=e,n){super(e.detail??e.title??`Wave request failed with HTTP ${t}`,n);this.name="WaveProblem";this.status=t;this.code=e.code??`http.${t}`;this.body=e;this.responseBody=o}}export function waveProblemResponse(t,e,o){const{_config:n}=k.create({isServer:!0,isDev:!1}),i=C({config:n,error:new U({code:"INTERNAL_SERVER_ERROR",message:e.detail??e.title??`Wave RPC failed with HTTP ${t}`}),type:"unknown",path:void 0,input:void 0,ctx:void 0});return Response.json(M(n,{error:{...i,data:{...i.data,httpStatus:t,problem:e}}}),{status:t,headers:o})}export class WaveTransportError extends Error{code=b.transport;responseBody;constructor(t,e,o){super(t,e);this.responseBody=o;this.name="WaveTransportError"}}export function isWaveProblem(t){return m(t)&&t.name==="WaveProblem"&&Number.isInteger(t.status)&&typeof t.code==="string"&&m(t.body)}export function isWaveTransportError(t){return m(t)&&t.name==="WaveTransportError"&&t.code===b.transport&&typeof t.message==="string"}export function isAbortError(t){return t instanceof DOMException&&t.name==="AbortError"}export function transportFailure(t,e,o,n){if(o?.aborted!==!0)return isWaveTransportError(e)?e:new WaveTransportError(t,{cause:e},n);if(Object.is(e,o.reason)||isAbortError(e))return o.reason;if(isWaveTransportError(e)&&e.cause instanceof AggregateError&&e.cause.errors.some((r)=>Object.is(r,o.reason)))return e;const i=AggregateError([e,o.reason],"Wave request failed during cancellation");return new WaveTransportError(t,{cause:i},n)}function m(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function O(t){try{return new URL(t??"/",globalThis.location?.origin??"http://localhost")}catch(e){throw new WaveConfigurationError("Wave client base URL is invalid",{cause:e})}}function D(t){const{tenantId:e}=t;let o="/rpc";if(t.tenant&&e!==void 0){if(e===""||e==="."||e==="..")throw new WaveConfigurationError(`${t.operation} has an unsafe Tenant path value ${e}`);o=`/tenants/${encodeURIComponent(e)}/rpc`}const n=O(t.baseUrl);n.pathname=`${n.pathname.replace(/\/$/u,"")}${o}`;n.search="";n.hash="";return n}function I(t){return`Wave returned an invalid RPC response with HTTP ${t}`}function J(t,e,o,n){const i=N(t)?t:void 0,r=i?.data;if(i&&m(r)&&typeof r.httpStatus==="number")return new WaveProblem(r.httpStatus,m(r.problem)?r.problem:{detail:i.message},i.meta?.responseJSON,{cause:i});const a=i?.cause??t,s=o===void 0?`Wave request to ${e} failed`:I(o.status),c=isWaveTransportError(a)?a.responseBody:JSON.stringify(i?.meta?.responseJSON);if(n?.aborted!==!0){if(isAbortError(a))return a;if(o?.status===401)return new WaveProblem(401,{title:"Authentication required",detail:s},c,{cause:a})}return transportFailure(s,a,n,c)}function R(t){try{return JSON.parse(JSON.stringify(t))}catch(e){throw new WaveConfigurationError("Wave request input is not serializable",{cause:e})}}const K=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;function W(t,e,o){const n=new TextEncoder;let i=n.encode(JSON.stringify({...o,complete:!1,submissions:[]})).byteLength;const r=[];for(let a=e;a<t.length&&r.length<x.items;a++){const s=n.encode(JSON.stringify(t[a])).byteLength+(r.length?1:0);if(i+s>x.bytes+(a===t.length-1?1:0))break;r.push(t[a]);i+=s}if(r.length===0)throw new WaveConfigurationError("One Action exceeds the one mebibyte page limit");return r}function j(t,e){let o;const n=new Promise((i)=>{o=setTimeout(i,t)});return g(n,e).finally(()=>clearTimeout(o))}function g(t,e){return new Promise((o,n)=>{const i=()=>n(e.reason);t.then((r)=>{e.removeEventListener("abort",i);o(r)},(r)=>{e.removeEventListener("abort",i);n(r)});e.throwIfAborted();e.addEventListener("abort",i,{once:!0})})}async function F(t,e){let o;try{o=typeof t==="function"?await t({signal:e}):t}catch(n){if(e?.aborted!==!0&&isAbortError(n))throw n;throw transportFailure("Wave request credentials are unavailable",n,e)}try{return new Headers(o)}catch(n){throw new WaveConfigurationError("Wave request headers are invalid",{cause:n})}}const H=/^application\/json(?:\s*;|$)/iu;export async function requestWaveOperation(t){const{operation:e,signal:o}=t,n=D(t),i=R(t.input);o?.throwIfAborted();const r=await F(t.headers,o);r.set("accept","application/json");r.set("x-wave-rpc-protocol",String(B));if(t.idempotencyKey!==void 0)r.set("idempotency-key",t.idempotencyKey);const a=t.fetch??globalThis.fetch.bind(globalThis);let s;const c=E({links:[_({url:n,methodOverride:"POST",headers:Object.fromEntries(r),fetch:async(d,u)=>{const h=await a(d,{...u,...t.credentials?{credentials:t.credentials}:{}});s=h;if(!H.test(h.headers.get("content-type")??""))throw new WaveTransportError(I(h.status),{cause:TypeError("Wave RPC response is not JSON")},await h.text());return h}})]});try{return{data:t.kind==="query"?await c.query(e,i,{signal:o}):await c.mutation(e,i,{signal:o}),response:s}}catch(d){throw J(d,`${n.pathname}/${e}`,s,o)}}export class WaveClient{#e;constructor(t){this.#e={...t,baseUrl:O(t.baseUrl)}}get ontology(){return this.#e.ontology}query(t,e,o={}){return this.#t(t,e,o)}command(t,e,o){return this.#t(t,e,o)}execute(t,e,o){return this.#t(t,e,o)}async submitActions(t,e){e.signal?.throwIfAborted();if(t.length===0)throw new WaveConfigurationError("An Action batch cannot be empty");const o=e.idempotencyKey;if(!K.test(o))throw new WaveConfigurationError("Action batch idempotency key must be a UUID");const n=R(t).map(({payload:s={},...c})=>({...c,payload:s}));let i=0,r,a;do{e.signal?.throwIfAborted();const s=r===void 0?{idempotencyKey:o}:{batchId:r,index:i},c=W(n,i,s),d=()=>this.#t("actions.submit",{...s,submissions:c,complete:i+c.length===n.length},{...e,idempotencyKey:r===void 0?o:`${r}:${i}`});try{a=await d()}catch(u){if(!isWaveProblem(u)||u.code!=="action.idempotency_conflict")throw u;const h=u.body.retainedItems;if(typeof h!=="number"||!Number.isInteger(h)||h<=i||h>=i+c.length)throw u;c.length=h-i;a=await d()}i+=c.length;r=a.batchId}while(i<n.length);if(a.status==="receiving")throw new WaveTransportError("Wave did not confirm the complete Action batch");return a}async waitForActionBatch(t,e={}){const{signal:o,onOutcome:n,maxWaitMs:i=300000}=e,r=e.throughIndex??1/0;if(e.throughIndex!==void 0&&(!Number.isSafeInteger(r)||r<0))throw new WaveConfigurationError("throughIndex must be a nonnegative integer");if(!Number.isFinite(i)||i<=0)throw new WaveConfigurationError("maxWaitMs must be a positive duration");const a=performance.now()+i,s=new DOMException("Action batch wait timed out","TimeoutError"),c=new AbortController,d=o?AbortSignal.any([o,c.signal]):c.signal;let u;const h=()=>{const p=a-performance.now();if(p<=0)c.abort(s);else u=setTimeout(h,Math.min(p,2147483647))};h();let{cursor:f}=e;const v=typeof t==="string"?t:t.batchId,T=typeof t==="string"||f!==void 0?void 0:t;let w=250;try{for(let p=T;;p=void 0){d.throwIfAborted();if(performance.now()>=a)throw s;const P=Math.min(100,Math.max(1,r-(f??-1))),l=p??await g(this.#t("actions.batches.get",{batchId:v,cursor:f,limit:P},{signal:d}),d);d.throwIfAborted();if(performance.now()>=a)throw s;if(l!==null){for(const y of l.outcomes){if(y.index>r)break;if(n)await g(Promise.resolve(n(y)),d)}if(l.nextCursor!==null&&l.nextCursor<r){if(f!==void 0&&l.nextCursor<=f)throw new WaveTransportError("Action batch cursor did not advance");f=l.nextCursor;continue}f=l.outcomes.at(-1)?.index??f;if(l.status==="completed"||l.status==="failed"||l.status==="expired"){d.throwIfAborted();if(performance.now()>=a)throw s;const{outcomes:y,nextCursor:V,...S}=l;return S}if(f!==void 0&&f>=r)f=Math.max(f,l.totalItems-1)}if(p)continue;const A=a-performance.now();if(A<=0)throw s;await j(Math.min(w,A),d);w=Math.min(w*2,5000)}}finally{if(u!==void 0)clearTimeout(u)}}async submitActionAndWait(t,e){const o=await this.submitActions([t],e);let n;const i=await this.waitForActionBatch(o,{...e,onOutcome:(r)=>{if(r.index===0)n=r}}).catch((r)=>{if(e.signal?.aborted)throw r;throw new WaveTransportError("Action batch outcome could not be confirmed",{cause:r})});if(n&&"result"in n)return n.result;if(n&&"refusal"in n)throw new WaveProblem(n.refusal.status,n.refusal);if(n&&"unavailable"in n)throw new WaveTransportError("Action batch outcome is unavailable");if(i.failure)throw new WaveProblem(i.failure.status,i.failure);throw new WaveTransportError(`Action batch ${i.status} without an Action outcome`)}async#t(t,e,o){const{ontology:n,onUnauthorized:i,...r}=this.#e,{idempotencyKey:a,signal:s}=o,c=e?.idempotencyKey;if(typeof c==="string"&&a!==void 0&&c!==a)throw new WaveConfigurationError(`${t} input and transport idempotency keys must match`);const d=L[t];try{const{data:u}=await requestWaveOperation({...r,credentials:r.credentials??"same-origin",operation:t,kind:d.kind,tenant:!("bootstrap"in d),input:e,idempotencyKey:a,signal:s});return u}catch(u){if(isWaveProblem(u)&&u.status===401)try{i?.()}catch(h){if(h===u)throw u;throw AggregateError([u,h],"Wave response and unauthorized callback both failed")}throw u}}}export function createWaveClient(t={}){return new WaveClient(t)}
@@ -0,0 +1,27 @@
1
+ import type { WaveSdkOperationMap, WaveSdkOperationName } from "./generated/operations.ts";
2
+ import type { WaveBoundOntologyOperationMap, WaveOntologyMetadata } from "./ontology.ts";
3
+ export type WaveOperationKind = "query" | "command";
4
+ /** Generated operation types, refined only by an actual bound ontology descriptor. */
5
+ export type WaveClientOperationMap<Metadata extends WaveOntologyMetadata | undefined = undefined> = {
6
+ [Name in WaveSdkOperationName]: Metadata extends WaveOntologyMetadata ? WaveBoundOntologyOperationMap<Metadata>[Name] : WaveSdkOperationMap[Name];
7
+ };
8
+ export type WaveQueryName = {
9
+ [Name in WaveSdkOperationName]: WaveSdkOperationMap[Name] extends {
10
+ kind: "query";
11
+ } ? Name : never;
12
+ }[WaveSdkOperationName];
13
+ export type WaveCommandName = {
14
+ [Name in WaveSdkOperationName]: WaveSdkOperationMap[Name] extends {
15
+ kind: "command";
16
+ } ? Name : never;
17
+ }[WaveSdkOperationName];
18
+ /** Operations whose input a bound ontology descriptor refines. */
19
+ type WaveOntologyInputName = "actions.submit" | "state.objects.aggregate" | "state.objects.get" | "state.objects.list" | "state.objects.links";
20
+ /** Inputs retain their generated shape unless an ontology descriptor refines them. */
21
+ export type WaveOperationInput<Name extends WaveSdkOperationName, Metadata extends WaveOntologyMetadata | undefined = undefined> = [Metadata] extends [undefined] ? WaveSdkOperationMap[Name]["input"] : [Name] extends [Exclude<WaveSdkOperationName, WaveOntologyInputName>] ? WaveSdkOperationMap[Name]["input"] : Metadata extends WaveOntologyMetadata ? WaveBoundOntologyOperationMap<Metadata>[Name] extends {
22
+ input: infer Input;
23
+ } ? Input : never : WaveSdkOperationMap[Name]["input"];
24
+ export type WaveOperationOutput<Name extends WaveSdkOperationName, Metadata extends WaveOntologyMetadata | undefined = undefined> = Metadata extends WaveOntologyMetadata ? WaveBoundOntologyOperationMap<Metadata>[Name] extends {
25
+ output: infer Output;
26
+ } ? Output : never : WaveSdkOperationMap[Name]["output"];
27
+ export {};
File without changes
@@ -0,0 +1,2 @@
1
+ export declare const WAVE_FEEDBACK_CODES: readonly ["account_lookup_failed", "account_mismatch", "account_verification_failed", "action.authority_role_forbidden", "action.authority_role_required", "action.context_changed", "action.evidence_conflict", "action.evidence_forbidden", "action.evidence_invalid", "action.forbidden", "action.grant_required", "action.idempotency_conflict", "action.not_found", "action.object_access_check_incomplete", "action.object_access_loss", "action.parameter_unavailable", "action.payload_invalid", "action.read_budget_exceeded", "action.review_ceiling", "action.review_timeout", "action.stale_config", "action.type_retired", "action.unknown_type", "action.write_required", "additional_source_context.evaluation_failed", "agent.child_budget_exhausted", "agent.child_output_incomplete", "agent.history_duplicate", "agent.history_invalid", "agent.history_missing", "agent.persistence_failure", "agent.provider_aborted", "agent.provider_budget", "agent.provider_configuration", "agent.provider_credential", "agent.provider_failure", "agent.provider_invalid_input", "agent.provider_scope", "agent.provider_transient", "agent.provider_unknown_outcome", "agent.responder_ambiguous", "agent.route_ambiguous", "agent.runtime_failure", "agent.sandbox_oom", "agent.sandbox_unavailable", "agent.session_not_found", "agent.tool_failure", "agent.turn_agent_unavailable", "agent.turn_channel_forbidden", "agent.turn_context_unavailable", "agent.turn_source_unavailable", "agent.turn_transport_unavailable", "api.declaration_invalid", "api.query_in_progress", "assignment", "attachment.admission_failed", "attachment.fetch_failed", "attachment.file_unavailable", "attachment.reading.erased", "attachment.reading.failed", "attachment.reading.invalid_output", "attachment.reading.model_aborted", "attachment.reading.model_failed", "attachment.reading.model_incomplete", "attachment.reading.provider_outcome_unknown", "attachment.reading.reprocess_unavailable", "attachment.reading.retention_failed", "attachment.reading.start_unavailable", "attachment.reading.timeout", "attachment.reading.unavailable", "attachment.reading.unsupported", "attempt_preparation_failed", "attenuation", "authentication.required", "authority_changed", "authority_or_target_changed", "authorization_failed", "authorization_scopes_changed", "bridge_unavailable", "calculation", "cel", "channel_archived", "channel_unavailable", "cloud.authorization_failed", "cloud.authorization_revoked", "cloud.webhook_unverified", "completion_failed", "config.activation_rejected", "config.conflict", "config.document.config_not_found", "config.document.duplicate_revision", "config.document.identity_mismatch", "config.document.invalid_import", "config.document.invalid_ownership", "config.document.invalid_snapshot", "config.document.revision_mismatch", "config.duplicate", "config.entry.generated", "config.entry.illegal_slug", "config.entry.managed_factory", "config.entry.not_found", "config.entry.not_live", "config.entry.pack_owned", "config.entry.package_locked", "config.graph", "config.identity", "config.identity_conflict", "config.import", "config.missing_file", "config.not_found", "config.ownership", "config.reference", "config.schema", "config.scope_unknown_slice", "config.status_type_retired", "config.sync.api_resources_too_many", "config.sync.change_set_too_large", "config.sync.invalid_source", "config.syntax", "config.template_file_unavailable", "config.unsupported_language_version", "config.version", "console.registry_mismatch", "contract.incompatible", "coverage", "credential_persist_failed", "credential_store_failed", "custom", "database.connection_lost", "database.lock_timeout", "database.timeout", "dataset.reading.failed", "dataset.reading.incomplete", "decision.input_unavailable", "decision.invalid_answer", "decision.provider_failed", "decision.provider_outcome_unknown", "decision.unavailable", "decision.unresolved", "document", "emission.archive_transition", "emission.correction_target_unavailable", "emission.eval_error", "emission.future_fact", "emission.link_conflict", "emission.link_cycle", "emission.object_conflict", "emission.object_merged", "emission.subject_erased", "emission.tenant_organization_archive", "emission.unique_conflict", "emission.validation_failed", "emission.work_limit", "endpoint_held", "entity.not_found", "erasure.merged_object_omitted", "erasure.secret_mismatch", "erasure.secret_required", "erasure.subject_not_found", "event.cursor_invalid", "exclusivity", "execution.canceled", "execution.effect_unavailable", "execution.firing_channel_unknown", "execution.not_found", "execution.output_erased", "execution.state_unavailable", "export.validation_failed", "file.too_large", "finalization_timeout", "genesis.action_refused", "genesis.tenant_exists", "googledrive.authorization_in_progress", "googledrive.authorization_unavailable", "identity_retired", "import.broken", "import.empty_statement", "import.enum_unmapped", "import.execution_not_found", "import.identity_discontinuity", "import.input_unavailable", "import.key_collision", "import.key_format", "import.no_parser", "import.parse", "import.precision", "import.reference_changed", "import.rekeyed_export", "import.too_large", "import.unknown_type", "import.value_swap", "input.invalid", "installation_binding_failed", "installation_verification_failed", "integration.authorization_stale", "integration.unavailable", "internal", "invalid_element", "invalid_format", "invalid_key", "invalid_type", "invalid_union", "invalid_value", "invitation_failed", "invitation_not_allowed", "invitation_outcome_unknown", "lease_lost", "listener.binding_invalid", "listener.input_unavailable", "listener.matcher_evaluation_failed", "listener.selection_required", "listener.skip_condition_unresolved", "listener.unavailable", "members.principal_missing", "missing_code", "missing_scope", "missing_scopes", "model", "native.action_not_found", "native.admin_self_removal", "native.agent_not_found", "native.binding_exists", "native.binding_not_found", "native.binding_structure_invalid", "native.binding_supervisor_invalid", "native.channel_member_not_grantable", "native.channel_member_not_granted", "native.channel_not_found", "native.channel_not_linkable", "native.channel_not_opened", "native.channel_not_owned", "native.channel_owner_ineligible", "native.channel_slug_taken", "native.channel_unchanged", "native.config_entry_restore_not_found", "native.config_entry_staged_reference", "native.config_source_actor_required", "native.config_stale_preview", "native.email_in_use", "native.email_invalid", "native.feedback_already_acknowledged", "native.group_channel_linked", "native.group_member_not_found", "native.group_not_live", "native.integration_not_live", "native.integration_not_paired", "native.integration_owner_changed", "native.integration_retired", "native.integration_setup_not_discardable", "native.invitation_accepted", "native.invitation_not_found", "native.lane_binding_in_use", "native.lane_not_assignable", "native.lane_succession_stale", "native.lane_successor_invalid", "native.lane_successor_required", "native.lane_successor_unavailable", "native.last_active_apex", "native.merge_invalid", "native.object_group_ineligible", "native.object_not_found", "native.owner_required", "native.package_install_binding_invalid", "native.package_install_content_changed", "native.package_install_stale", "native.package_install_target_changed", "native.package_update_resolution_invalid", "native.package_update_stale", "native.package_update_target_unknown", "native.param_missing", "native.payload_invalid", "native.phone_in_use", "native.phone_invalid", "native.phone_not_found", "native.phone_verification_not_deliverable", "native.phone_verification_not_delivered", "native.phone_verification_not_found", "native.phone_verified", "native.platform_action_live", "native.platform_action_missing", "native.platform_action_unknown", "native.principal_not_found", "native.principal_unassigned", "native.reader_required", "native.retraction_creation", "native.retraction_dependents", "native.retraction_not_own", "native.retraction_platform", "native.retraction_unapplied", "native.role_not_live", "native.tenant_organization_ineligible", "native.tenant_organization_recorded", "native.user_erased", "native.user_inactive", "native.user_name_unchanged", "native.user_not_found", "native.wave_integration_missing", "not_multiple_of", "number_already_linked", "number_mismatch", "object.cursor_invalid", "object.read_budget_exceeded", "object.selection_invalid", "operation.contention", "operation.idempotency_conflict", "operation.timeout", "operator_canceled", "ordering", "outbound.condition_unresolved", "outbound.recipient_unresolved", "pack.incompatible", "pack.invalid", "package.install.stale_review", "package.update.stale_review", "pagination.repeated_cursor", "param_enum", "param_expects", "param_file", "param_file_media", "param_file_mime", "param_kind", "param_limit", "param_missing", "param_object_type", "provider_denied", "provider_identity_mismatch", "provider_identity_verification_failed", "provider_rejected", "qr_expired", "rate_limited", "read.timeout", "reference", "refresh_token_missing", "retirement", "rpc.bad_gateway", "rpc.bad_request", "rpc.internal_server_error", "rpc.method_not_supported", "rpc.not_found", "rpc.not_implemented", "rpc.parse_error", "rpc.payload_too_large", "rpc.unprocessable_content", "rpc.unsupported_media_type", "schedule.execution_not_terminal", "schedule.failed", "schedule.occurrence_invalidated", "schedule.occurrence_unavailable", "schedule.reprocess_unavailable", "scope_mismatch", "sdk.configuration", "sdk.transport", "setup_timeout", "slack.account_mismatch", "slack.authorization_in_progress", "slack.authorization_required", "slack.delivery_changed", "slack.integration_not_live", "slack.reconnect_required", "slug", "source.destination_unavailable", "source.echo_pending", "source.idempotency_conflict", "source.not_found", "source.preparation_failed", "source.preparation_unavailable", "staffing", "state_capture.scope_limit", "state_capture.unsupported_value", "strategy", "superseded", "supervisor_required", "supporting_fact", "team_info_failed", "temporary_token_revocation_failed", "tenant.claim_mismatch", "tenant.not_found", "tenant.slug_invalid", "tenant.slug_taken", "token_exchange_failed", "too_big", "too_small", "tree", "unbound_token_revocation_failed", "unique", "unknown_param", "unrecognized_keys", "unsupported_channel", "upload.failed", "upload.quota_exceeded", "user_authorization_invalid", "user_not_channel_member", "validation", "whatsapp.conversation_key_required", "worker.reclaimed"];
2
+ export type WaveFeedbackCode = (typeof WAVE_FEEDBACK_CODES)[number];
@@ -0,0 +1 @@
1
+ export const WAVE_FEEDBACK_CODES=["account_lookup_failed","account_mismatch","account_verification_failed","action.authority_role_forbidden","action.authority_role_required","action.context_changed","action.evidence_conflict","action.evidence_forbidden","action.evidence_invalid","action.forbidden","action.grant_required","action.idempotency_conflict","action.not_found","action.object_access_check_incomplete","action.object_access_loss","action.parameter_unavailable","action.payload_invalid","action.read_budget_exceeded","action.review_ceiling","action.review_timeout","action.stale_config","action.type_retired","action.unknown_type","action.write_required","additional_source_context.evaluation_failed","agent.child_budget_exhausted","agent.child_output_incomplete","agent.history_duplicate","agent.history_invalid","agent.history_missing","agent.persistence_failure","agent.provider_aborted","agent.provider_budget","agent.provider_configuration","agent.provider_credential","agent.provider_failure","agent.provider_invalid_input","agent.provider_scope","agent.provider_transient","agent.provider_unknown_outcome","agent.responder_ambiguous","agent.route_ambiguous","agent.runtime_failure","agent.sandbox_oom","agent.sandbox_unavailable","agent.session_not_found","agent.tool_failure","agent.turn_agent_unavailable","agent.turn_channel_forbidden","agent.turn_context_unavailable","agent.turn_source_unavailable","agent.turn_transport_unavailable","api.declaration_invalid","api.query_in_progress","assignment","attachment.admission_failed","attachment.fetch_failed","attachment.file_unavailable","attachment.reading.erased","attachment.reading.failed","attachment.reading.invalid_output","attachment.reading.model_aborted","attachment.reading.model_failed","attachment.reading.model_incomplete","attachment.reading.provider_outcome_unknown","attachment.reading.reprocess_unavailable","attachment.reading.retention_failed","attachment.reading.start_unavailable","attachment.reading.timeout","attachment.reading.unavailable","attachment.reading.unsupported","attempt_preparation_failed","attenuation","authentication.required","authority_changed","authority_or_target_changed","authorization_failed","authorization_scopes_changed","bridge_unavailable","calculation","cel","channel_archived","channel_unavailable","cloud.authorization_failed","cloud.authorization_revoked","cloud.webhook_unverified","completion_failed","config.activation_rejected","config.conflict","config.document.config_not_found","config.document.duplicate_revision","config.document.identity_mismatch","config.document.invalid_import","config.document.invalid_ownership","config.document.invalid_snapshot","config.document.revision_mismatch","config.duplicate","config.entry.generated","config.entry.illegal_slug","config.entry.managed_factory","config.entry.not_found","config.entry.not_live","config.entry.pack_owned","config.entry.package_locked","config.graph","config.identity","config.identity_conflict","config.import","config.missing_file","config.not_found","config.ownership","config.reference","config.schema","config.scope_unknown_slice","config.status_type_retired","config.sync.api_resources_too_many","config.sync.change_set_too_large","config.sync.invalid_source","config.syntax","config.template_file_unavailable","config.unsupported_language_version","config.version","console.registry_mismatch","contract.incompatible","coverage","credential_persist_failed","credential_store_failed","custom","database.connection_lost","database.lock_timeout","database.timeout","dataset.reading.failed","dataset.reading.incomplete","decision.input_unavailable","decision.invalid_answer","decision.provider_failed","decision.provider_outcome_unknown","decision.unavailable","decision.unresolved","document","emission.archive_transition","emission.correction_target_unavailable","emission.eval_error","emission.future_fact","emission.link_conflict","emission.link_cycle","emission.object_conflict","emission.object_merged","emission.subject_erased","emission.tenant_organization_archive","emission.unique_conflict","emission.validation_failed","emission.work_limit","endpoint_held","entity.not_found","erasure.merged_object_omitted","erasure.secret_mismatch","erasure.secret_required","erasure.subject_not_found","event.cursor_invalid","exclusivity","execution.canceled","execution.effect_unavailable","execution.firing_channel_unknown","execution.not_found","execution.output_erased","execution.state_unavailable","export.validation_failed","file.too_large","finalization_timeout","genesis.action_refused","genesis.tenant_exists","googledrive.authorization_in_progress","googledrive.authorization_unavailable","identity_retired","import.broken","import.empty_statement","import.enum_unmapped","import.execution_not_found","import.identity_discontinuity","import.input_unavailable","import.key_collision","import.key_format","import.no_parser","import.parse","import.precision","import.reference_changed","import.rekeyed_export","import.too_large","import.unknown_type","import.value_swap","input.invalid","installation_binding_failed","installation_verification_failed","integration.authorization_stale","integration.unavailable","internal","invalid_element","invalid_format","invalid_key","invalid_type","invalid_union","invalid_value","invitation_failed","invitation_not_allowed","invitation_outcome_unknown","lease_lost","listener.binding_invalid","listener.input_unavailable","listener.matcher_evaluation_failed","listener.selection_required","listener.skip_condition_unresolved","listener.unavailable","members.principal_missing","missing_code","missing_scope","missing_scopes","model","native.action_not_found","native.admin_self_removal","native.agent_not_found","native.binding_exists","native.binding_not_found","native.binding_structure_invalid","native.binding_supervisor_invalid","native.channel_member_not_grantable","native.channel_member_not_granted","native.channel_not_found","native.channel_not_linkable","native.channel_not_opened","native.channel_not_owned","native.channel_owner_ineligible","native.channel_slug_taken","native.channel_unchanged","native.config_entry_restore_not_found","native.config_entry_staged_reference","native.config_source_actor_required","native.config_stale_preview","native.email_in_use","native.email_invalid","native.feedback_already_acknowledged","native.group_channel_linked","native.group_member_not_found","native.group_not_live","native.integration_not_live","native.integration_not_paired","native.integration_owner_changed","native.integration_retired","native.integration_setup_not_discardable","native.invitation_accepted","native.invitation_not_found","native.lane_binding_in_use","native.lane_not_assignable","native.lane_succession_stale","native.lane_successor_invalid","native.lane_successor_required","native.lane_successor_unavailable","native.last_active_apex","native.merge_invalid","native.object_group_ineligible","native.object_not_found","native.owner_required","native.package_install_binding_invalid","native.package_install_content_changed","native.package_install_stale","native.package_install_target_changed","native.package_update_resolution_invalid","native.package_update_stale","native.package_update_target_unknown","native.param_missing","native.payload_invalid","native.phone_in_use","native.phone_invalid","native.phone_not_found","native.phone_verification_not_deliverable","native.phone_verification_not_delivered","native.phone_verification_not_found","native.phone_verified","native.platform_action_live","native.platform_action_missing","native.platform_action_unknown","native.principal_not_found","native.principal_unassigned","native.reader_required","native.retraction_creation","native.retraction_dependents","native.retraction_not_own","native.retraction_platform","native.retraction_unapplied","native.role_not_live","native.tenant_organization_ineligible","native.tenant_organization_recorded","native.user_erased","native.user_inactive","native.user_name_unchanged","native.user_not_found","native.wave_integration_missing","not_multiple_of","number_already_linked","number_mismatch","object.cursor_invalid","object.read_budget_exceeded","object.selection_invalid","operation.contention","operation.idempotency_conflict","operation.timeout","operator_canceled","ordering","outbound.condition_unresolved","outbound.recipient_unresolved","pack.incompatible","pack.invalid","package.install.stale_review","package.update.stale_review","pagination.repeated_cursor","param_enum","param_expects","param_file","param_file_media","param_file_mime","param_kind","param_limit","param_missing","param_object_type","provider_denied","provider_identity_mismatch","provider_identity_verification_failed","provider_rejected","qr_expired","rate_limited","read.timeout","reference","refresh_token_missing","retirement","rpc.bad_gateway","rpc.bad_request","rpc.internal_server_error","rpc.method_not_supported","rpc.not_found","rpc.not_implemented","rpc.parse_error","rpc.payload_too_large","rpc.unprocessable_content","rpc.unsupported_media_type","schedule.execution_not_terminal","schedule.failed","schedule.occurrence_invalidated","schedule.occurrence_unavailable","schedule.reprocess_unavailable","scope_mismatch","sdk.configuration","sdk.transport","setup_timeout","slack.account_mismatch","slack.authorization_in_progress","slack.authorization_required","slack.delivery_changed","slack.integration_not_live","slack.reconnect_required","slug","source.destination_unavailable","source.echo_pending","source.idempotency_conflict","source.not_found","source.preparation_failed","source.preparation_unavailable","staffing","state_capture.scope_limit","state_capture.unsupported_value","strategy","superseded","supervisor_required","supporting_fact","team_info_failed","temporary_token_revocation_failed","tenant.claim_mismatch","tenant.not_found","tenant.slug_invalid","tenant.slug_taken","token_exchange_failed","too_big","too_small","tree","unbound_token_revocation_failed","unique","unknown_param","unrecognized_keys","unsupported_channel","upload.failed","upload.quota_exceeded","user_authorization_invalid","user_not_channel_member","validation","whatsapp.conversation_key_required","worker.reclaimed"];
@@ -0,0 +1,3 @@
1
+ /** Same-origin Console path a login may return to, shared by the browser
2
+ * runtime and the server that honors it. */
3
+ export declare function validatedLoginRedirect(value: unknown): string | undefined;
@@ -0,0 +1 @@
1
+ export function validatedLoginRedirect(n){if(typeof n!=="string"||n.length>2048||!n.startsWith("/")||n.startsWith("//")||/[\\\p{Cc}\s]/u.test(n))return;try{const t=new URL(n,"https://browser.invalid"),e=decodeURIComponent(t.pathname),i=new URL(e,t.origin);if(t.origin!=="https://browser.invalid"||i.origin!==t.origin||/[\\\p{Cc}]/u.test(e)||e.startsWith("//")||/^(?:\/console)?\/(?:login|auth)(?:\/|$)/u.test(i.pathname))return;return`${t.pathname}${t.search}${t.hash}`}catch{return}}