@v3finance/core-sdk 0.16.0 → 0.17.0

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.
@@ -1,5 +1,5 @@
1
1
  /** SDK version, sent in the `user-agent` header. */
2
- export declare const SDK_VERSION = "0.16.0";
2
+ export declare const SDK_VERSION = "0.17.0";
3
3
  /** Default API base URL. */
4
4
  export declare const DEFAULT_BASE_URL = "https://policy-engine-rest.ezig.workers.dev";
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** SDK version, sent in the `user-agent` header. */
2
- export const SDK_VERSION = '0.16.0';
2
+ export const SDK_VERSION = '0.17.0';
3
3
  /** Default API base URL. */
4
4
  export const DEFAULT_BASE_URL = 'https://policy-engine-rest.ezig.workers.dev';
5
5
  //# sourceMappingURL=version.js.map
package/docs/errors.md CHANGED
@@ -493,9 +493,21 @@ The export **download** endpoint streams a file rather than JSON. Errors from it
493
493
  | `INVALID_EMAIL` | 400 | The address is malformed, or is itself a seat placeholder address. | Normal form validation. |
494
494
  | `EMAIL_TAKEN` | 409 | Another account already uses that address. | Ask for another, or point the user at signing in with it. |
495
495
  | `NOT_A_SEAT` | 409 | The account already has a real email. This endpoint binds a first address to a seat account; it is **not** a change-email endpoint, because changing an address without a confirmation loop is account takeover. | Terminal. Changing an existing address needs a separate, confirmed flow. |
496
+ | `WEB_SESSION_CANNOT_BIND_EMAIL` | 403 | A web or Mac session (a web login) tried to bind the first email to a seat account. The address that becomes the way to sign in is bound only from the mobile app. Nothing was changed. | Terminal in that session. In a web or Mac client do not offer it: tell the user to add the email in the app on the phone. |
496
497
  | `INVITATION_NOT_FOUND` | 404 | No pending invitation for that email. | The user needs a new invitation from an admin. |
497
498
  | `USER_ALREADY_LINKED` | 400 | The account is already attached to an invitation. | Benign under retries. Treat as already-done. |
498
499
 
500
+ ### Push tokens
501
+
502
+ `me.registerPushToken` checks the token against its provider. No `provider` means `expo`, as older clients send it.
503
+
504
+ | Code | Status | When | What to do |
505
+ |---|---|---|---|
506
+ | `INVALID_PUSH_TOKEN` | 400 | The token does not match its provider: `expo` wants `ExponentPushToken[…]` (or `ExpoPushToken[…]`), `apns` wants the device token in hex, at least 64 characters. | A client bug: an APNs device token needs `provider: 'apns'`. Not a retry. |
507
+ | `APNS_ENVIRONMENT_REQUIRED` | 400 | `provider: 'apns'` without `environment` — the server cannot pick the APNs host. | Send `sandbox` for builds from Xcode, `production` for TestFlight and the App Store. |
508
+ | `APNS_TOPIC_NOT_ALLOWED` | 400 | `topic` is not an app this server pushes to (today only `finance.v3.ios`). | Leave `topic` out to get the default, or ask for the new app to be added on the server. |
509
+ | `PUSH_PROVIDER_MISMATCH` | 400 | `environment` or `topic` sent without `provider: 'apns'`. Refused rather than ignored: silently stored as Expo, a native token would never get a push. | Send `provider: 'apns'` with them, or drop them for an Expo token. |
510
+
499
511
  The public invitation lookup (`GET /invitations/by-token/{token}`) signals a dead link with **410** and no domain code — you get `REQUEST_FAILED`. Both "revoked" and "already accepted" come back that way, distinguishable only by `message`. Branch on `status === 410` and tell the user the link is no longer usable.
500
512
 
501
513
  ## AML
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v3finance/core-sdk",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "The official TypeScript SDK for the V3 Finance Core API — custodial addresses, transfers under policy control, approvals, shared access, labelling and reports",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -9,7 +9,7 @@
9
9
  // the API does not slip in unclassified.
10
10
  //
11
11
  // Operations: 250 · admin: 45 · both: 1 · member: 201 · service: 3
12
- // Spec sha256: 18bd9bc695a90be2d39fb997f81af9df580d054b64736ca2bf9e5c95f28edfe5
12
+ // Spec sha256: 585b254ed09a4e675ae6713e5929b2edcc258bb25691604ecde6bf29ef728022
13
13
 
14
14
  export type Audience = 'member' | 'admin' | 'service' | 'both' | 'unknown'
15
15
 
@@ -3961,8 +3961,15 @@ export interface PolicyWithRules {
3961
3961
  export interface PushToken {
3962
3962
  /** cuid */
3963
3963
  id: string
3964
+ /** Как хранится: hex APNs — в нижнем регистре */
3964
3965
  token: string
3965
3966
  platform: string
3967
+ /** Кто доставляет пуш. `expo` — приложение на Expo (iOS и Android), через exp.host; `apns` — нативное приложение для iPhone, сервер шлёт напрямую в Apple */
3968
+ provider: "expo" | "apns"
3969
+ /** Окружение APNs: `sandbox` (сборки из Xcode) или `production`; у `expo` — null */
3970
+ environment: "sandbox" | "production" | null
3971
+ /** bundle id (`apns-topic`); у `expo` — null */
3972
+ topic: string | null
3966
3973
  /** format: date-time */
3967
3974
  createdAt: string
3968
3975
  /** format: date-time */
@@ -4051,13 +4058,19 @@ export interface ReconcileTransferResult {
4051
4058
 
4052
4059
  export interface RegisterPushTokenBody {
4053
4060
  /**
4054
- * Expo push token
4061
+ * Токен устройства. Для `expo` — `ExponentPushToken[…]` (или `ExpoPushToken[…]`); для `apns` — токен устройства APNs в hex (не короче 64 символов), регистр не важен: хранится в нижнем
4055
4062
  *
4056
4063
  * length: 1..∞
4057
4064
  */
4058
4065
  token: string
4059
4066
  /** default ios */
4060
4067
  platform?: "ios" | "android"
4068
+ /** По умолчанию `expo` — так регистрируются клиенты, которые поля не шлют */
4069
+ provider?: "expo" | "apns"
4070
+ /** Только для `apns`, и там обязателен (`APNS_ENVIRONMENT_REQUIRED`). Для `expo` — 400 `PUSH_PROVIDER_MISMATCH` */
4071
+ environment?: "sandbox" | "production"
4072
+ /** Только для `apns`: bundle id приложения (`apns-topic`). Допустимые: finance.v3.ios; по умолчанию `finance.v3.ios`. Другой — 400 `APNS_TOPIC_NOT_ALLOWED`. Для `expo` — 400 `PUSH_PROVIDER_MISMATCH` */
4073
+ topic?: string
4061
4074
  }
4062
4075
 
4063
4076
  export interface RegistryNetwork {
package/src/version.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** SDK version, sent in the `user-agent` header. */
2
- export const SDK_VERSION = '0.16.0'
2
+ export const SDK_VERSION = '0.17.0'
3
3
 
4
4
  /** Default API base URL. */
5
5
  export const DEFAULT_BASE_URL = 'https://policy-engine-rest.ezig.workers.dev'