Sync with InsForge-sdk-js v1.5.1

AG
3mo ago
+336-1

Ports the API changes from InsForge-sdk-js v1.5.0..v1.5.1 (release: email OTP sign-in; the diff also includes the storage batch-delete feature merged in the same window).

Ported

Auth — passwordless email OTP sign-in (mirrors auth.signInWithOtp / auth.verifyOtp):

  • client.auth.sign_in_with_otp(email=...) — POST /api/auth/email/send-otp; returns the enumeration-safe generic {success, message} payload (AuthEmailActionResponse).
  • client.auth.verify_otp(email=..., otp=..., name=None) — POST /api/auth/sessions?client_type=server with method: "otp" set last so it cannot be clobbered; returns AuthSessionResponse (user + tokens). name is only applied on first-time passwordless user creation.
  • New request models AuthSendOtpRequest / AuthVerifyOtpRequest (pydantic, non-empty field validation), matching SendOTPRequest / VerifyOtpRequest from @insforge/shared-schemas@1.2.1.

Storage — batch object deletion (mirrors the bucket.remove(paths[]) overload):

  • client.storage.delete_objects(bucket_name, object_keys) — DELETE /api/storage/buckets/{bucket}/objects with {"keys": [...]} (server limit 1000 keys, not split client-side); returns per-key results.
  • New models StorageDeleteObjectResult (status: "deleted" | "notFound" | "failed") and StorageDeleteObjectsResponse, exported from insforge.storage. Implemented as a separate method rather than a JS-style overload — idiomatic Python, keeps delete_object unchanged.

Also: README examples for both features; version bumped 0.1.0 → 0.2.0 (additive feature release; repo maintains version in pyproject.toml, no changelog file exists).

Skipped (JS-only)

  • @insforge/shared-schemas dependency bump, package.json/lockfile, tsconfig type-test config, CI action bumps — build plumbing with no Python equivalent (schema shapes were ported as pydantic models instead).
  • SSR createAuthActions() OTP mirroring — this SDK has no SSR/cookie module.
  • TS overload/type gymnastics for remove() and the PasswordSessionRequest narrowing — the Python sign_in_with_password signature already only accepts email/password.
  • Browser-mode session persistence / client_type=mobile behavior in verifyOtp — this SDK is stateless server-side and uses client_type=server, consistent with sign_in_with_password / verify_email.

Tests

Added 6 tests following existing patterns (request capture via fake http_client.request): OTP send payload/endpoint, verify payload with method: "otp" + session response, optional-name omission + 401 → InsforgeAuthError, empty-field validation, batch delete endpoint/payload/per-key results, and oversized-batch error passthrough (single request, no client-side splitting).

pytest tests -q (Python 3.12): 91 passed, 15 skipped (skips are pre-existing integration tests requiring a live backend).

🤖 Generated with Claude Code


Summary by cubic

Sync with InsForge-sdk-js v1.5.1 to add passwordless email OTP sign-in and batch storage object deletion. Docs updated and version bumped to 0.2.0.

  • New Features
    • Auth: auth.sign_in_with_otp(email) and auth.verify_otp(email, otp, name=None) for OTP-based sign-in; enumeration-safe send response; sessions created with client_type=server.
    • Storage: storage.delete_objects(bucket_name, object_keys) deletes up to 1000 objects in one call; returns per-key status (deleted | notFound | failed); exports StorageDeleteObjectResult and StorageDeleteObjectsResponse.