@vxil/sdk 0.5.1 → 0.5.2

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 CHANGED
@@ -399,6 +399,12 @@ export interface PaymentsWebhookEvent {
399
399
  event_id: string;
400
400
  provider: string;
401
401
  provider_evt_id: string;
402
+ /** the NORMALISED charge id the receiver stamped at delivery time — the same
403
+ * string `payments.charge.*` events carry as `provider_charge_id`. `null`
404
+ * when the delivery carries no charge (subscription events, failures) or
405
+ * was received before the column existed. Filter on it with
406
+ * `webhookEvents.list({ provider_charge_id })`. */
407
+ provider_charge_id?: string | null;
402
408
  event_type: string;
403
409
  /** received | processed | error | sig_failed | parse_failed | reprocessed |
404
410
  * ignored (a well-formed provider type we deliberately do not fold) |
@@ -640,6 +646,8 @@ export interface AiChatMessage {
640
646
  /** A synchronous generation result (POST /v1/ai/generate without stream). */
641
647
  export interface AiGeneration {
642
648
  generation_id: string;
649
+ /** your own `correlation_id` echoed back (null when you sent none). */
650
+ correlation_id?: string | null;
643
651
  text: string;
644
652
  usage: AiUsage;
645
653
  finish: string;
@@ -655,6 +663,8 @@ export interface AiGeneration {
655
663
  /** A streamed generation handle: open the realtime channel for token frames. */
656
664
  export interface AiStreamHandle {
657
665
  generation_id: string;
666
+ /** your own `correlation_id` echoed back (null when you sent none). */
667
+ correlation_id?: string | null;
658
668
  channel: string;
659
669
  token?: string;
660
670
  ttl_seconds?: number;
@@ -696,6 +706,10 @@ export interface AiTokenExpiringEvent {
696
706
  export interface AiJobHandle {
697
707
  generation_id: string;
698
708
  run_id: string;
709
+ /** your own `correlation_id` echoed back (null when you sent none). The
710
+ * `job.generation.completed|failed` events carry BOTH `generation_id` and
711
+ * `correlation_id` next to `run_id`, so no run→record link is needed. */
712
+ correlation_id?: string | null;
699
713
  status: string;
700
714
  resume_path: string;
701
715
  }
@@ -2110,20 +2124,38 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
2110
2124
  * `otp.testRecipients` (store-review / CI accounts): no mail is sent and
2111
2125
  * the full sign-in link comes back instead. `captcha_token` is required
2112
2126
  * when the tenant configured `security.captchaSecretRef`; `locale`
2113
- * chooses the mail's language. */
2127
+ * chooses the mail's language. `redirect_url` is an https page in your
2128
+ * app — or `http://localhost[:port]` / `http://127.0.0.1[:port]` for local
2129
+ * development (plain http on any other host is refused).
2130
+ *
2131
+ * GUEST CLAIM: pass the guest's session bearer as `anonymous_token` and
2132
+ * the link claims `email` FOR THAT GUEST — `verify` (which must present
2133
+ * the same `anonymous_token`) then keeps the guest's `user_id` (every
2134
+ * owner-scoped row survives) or, when the address already has an
2135
+ * account, merges the guest into it (`merged: true`, `user_id` = the
2136
+ * existing account; swap tokens). Needs `anonymous.enabled`; a non-guest
2137
+ * bearer is `409 not_anonymous`. */
2114
2138
  request: (input: {
2115
2139
  email: string;
2116
2140
  redirect_url: string;
2117
2141
  locale?: string;
2118
2142
  captcha_token?: string;
2143
+ anonymous_token?: string;
2119
2144
  }) => Promise<{
2120
2145
  sent: true;
2121
2146
  test_link?: string;
2122
2147
  }>;
2123
- verify: (token: string) => Promise<{
2148
+ /** `opts.anonymous_token` is REQUIRED for a link that was requested with
2149
+ * one (the guest claim above): the same guest session must present it,
2150
+ * else `401 invalid_session`. `merged` is true only when the guest was
2151
+ * folded into an existing account (then `user_id` is that account). */
2152
+ verify: (token: string, opts?: {
2153
+ anonymous_token?: string;
2154
+ }) => Promise<{
2124
2155
  user_id: string;
2125
2156
  session: AuthSession;
2126
2157
  verified: boolean;
2158
+ merged?: boolean;
2127
2159
  }>;
2128
2160
  };
2129
2161
  /** Email OTP sign-in: a 6-digit single-use code (distinct from magic-link).
@@ -3757,6 +3789,10 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3757
3789
  ttl?: "5m" | "1h";
3758
3790
  };
3759
3791
  user_id?: string;
3792
+ /** Your own opaque handle (1..128 chars) for this generation — stored on
3793
+ * the row, echoed on the answer and the replay read, and (job mode)
3794
+ * carried on the `job.generation.*` events with `generation_id`. */
3795
+ correlation_id?: string;
3760
3796
  }) => Promise<AiGeneration>;
3761
3797
  /** Streamed generation: returns the channel + connect token immediately; open
3762
3798
  * the realtime channel for AiStreamFrame frames (token/title, then a
@@ -3786,6 +3822,10 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3786
3822
  * {{prompt}}); overrides the built-in instruction (stream-only). */
3787
3823
  title_template?: string;
3788
3824
  user_id?: string;
3825
+ /** Your own opaque handle (1..128 chars) for this generation — stored on
3826
+ * the row, echoed on the answer and the replay read, and (job mode)
3827
+ * carried on the `job.generation.*` events with `generation_id`. */
3828
+ correlation_id?: string;
3789
3829
  }) => Promise<AiStreamHandle>;
3790
3830
  /** Job-routed async generation (long/vision/batch): 202 + a jobs run drives
3791
3831
  * the provider call; the settled answer lands in the replay buffer at
@@ -3834,6 +3874,10 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3834
3874
  ttl?: "5m" | "1h";
3835
3875
  };
3836
3876
  user_id?: string;
3877
+ /** Your own opaque handle (1..128 chars) for this generation — stored on
3878
+ * the row, echoed on the answer and the replay read, and (job mode)
3879
+ * carried on the `job.generation.*` events with `generation_id`. */
3880
+ correlation_id?: string;
3837
3881
  }) => Promise<AiJobHandle>;
3838
3882
  /** Re-mint a fresh connect token for a LIVE stream (a generation that
3839
3883
  * outlives the ≤300s realtime token TTL); reconnect with `?since=<seq>`. */
@@ -4399,6 +4443,13 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
4399
4443
  outcome?: "received" | "processed" | "error" | "sig_failed" | "parse_failed" | "reprocessed" | "ignored" | "unowned" | "rejected_environment";
4400
4444
  /** the provider-reported environment axis (not the API key's label) */
4401
4445
  environment?: "production" | "sandbox";
4446
+ /** exact match on the normalised charge id (= `payments.charge.*`'s
4447
+ * `provider_charge_id`) — the delivery that recorded a charge, and any
4448
+ * refund/dispute delivery against it, in ≤ a few rows; then ONE
4449
+ * detail `get` reads the verified payload. */
4450
+ provider_charge_id?: string;
4451
+ /** exact match on the provider's own event id. */
4452
+ provider_evt_id?: string;
4402
4453
  since?: string;
4403
4454
  cursor?: string;
4404
4455
  limit?: number;
package/dist/index.js CHANGED
@@ -635,9 +635,23 @@ export class Vxil {
635
635
  * `otp.testRecipients` (store-review / CI accounts): no mail is sent and
636
636
  * the full sign-in link comes back instead. `captcha_token` is required
637
637
  * when the tenant configured `security.captchaSecretRef`; `locale`
638
- * chooses the mail's language. */
638
+ * chooses the mail's language. `redirect_url` is an https page in your
639
+ * app — or `http://localhost[:port]` / `http://127.0.0.1[:port]` for local
640
+ * development (plain http on any other host is refused).
641
+ *
642
+ * GUEST CLAIM: pass the guest's session bearer as `anonymous_token` and
643
+ * the link claims `email` FOR THAT GUEST — `verify` (which must present
644
+ * the same `anonymous_token`) then keeps the guest's `user_id` (every
645
+ * owner-scoped row survives) or, when the address already has an
646
+ * account, merges the guest into it (`merged: true`, `user_id` = the
647
+ * existing account; swap tokens). Needs `anonymous.enabled`; a non-guest
648
+ * bearer is `409 not_anonymous`. */
639
649
  request: async (input) => (await this.call('POST', '/v1/auth/magic-link/request', input)).data,
640
- verify: async (token) => (await this.call('POST', '/v1/auth/magic-link/verify', { token })).data,
650
+ /** `opts.anonymous_token` is REQUIRED for a link that was requested with
651
+ * one (the guest claim above): the same guest session must present it,
652
+ * else `401 invalid_session`. `merged` is true only when the guest was
653
+ * folded into an existing account (then `user_id` is that account). */
654
+ verify: async (token, opts = {}) => (await this.call('POST', '/v1/auth/magic-link/verify', { token, ...(opts.anonymous_token !== undefined ? { anonymous_token: opts.anonymous_token } : {}) })).data,
641
655
  },
642
656
  /** Email OTP sign-in: a 6-digit single-use code (distinct from magic-link).
643
657
  * Server-side guessing budget (config otp.maxAttempts), single active code,
@@ -1821,6 +1835,8 @@ export class Vxil {
1821
1835
  event_type: q?.event_type || undefined,
1822
1836
  outcome: q?.outcome || undefined,
1823
1837
  environment: q?.environment || undefined,
1838
+ provider_charge_id: q?.provider_charge_id || undefined,
1839
+ provider_evt_id: q?.provider_evt_id || undefined,
1824
1840
  since: q?.since || undefined,
1825
1841
  cursor: q?.cursor || undefined,
1826
1842
  limit: q?.limit || undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxil/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Typed client for the Vxil REST API (notifications, auth, jobs, files, cms, comments, webhooks, realtime, orgs, rate-limits).",