Giter Site home page Giter Site logo

fake-seam-connect's People

Watchers

 avatar  avatar

fake-seam-connect's Issues

Introduce a mutable server for fake-seam-connect

e.g. either of the following schemes are good:

  • https://<mutable_ref>.fake-seam-connect.com/...
  • https://fake-seam-connect.seam.co/<mutable_ref>/...

Using headers is an interesting approach as well but I think it's too subtle and could cause confusion.

I was initially against a mutable server, instead preferring in-browser fakes or "dynamically spun up" instances. I think the Pros of having it available have outweighed the Cons to me:

Pros

  • Very simple to set up fixturing, just change the endpoint
  • SDK tests are made dramatically easier because there is no testcontainers required

Cons

  • Tests are always coupled to the latest seam connect
  • Seeing logs or debugging seam connect state is much more difficult, sometimes not possible

Simple fake sandbox implementation using postgres: https://github.com/seamapi/unified-access-services/blob/main/apps/temporary-api/pages/api/nightly/%5B...uas_path%5D.ts

`/locks/unlock_door` doesn't work in sdk testing

import Seam from "seamapi"

const seam = new Seam({
  endpoint: `https://r${Math.random()
    .toString(16)
    .slice(2)}.fakeseamconnect.seam.vc`,
  apiKey: "seam_apikey1_token",
})


console.log(
  await seam.locks.unlockDoor("august_device_1")
)

Sweep: Replace the type assertions with better types

The type assertions using the as keyword should be removed and replaced with stronger types.

Checklist
  • Modify src/lib/database/index.ts โœ“ 00f8671
  • Modify src/lib/middleware/index.ts ! No changes made
  • Create src/pages/api/index.tsx โœ“ aa465e3
  • Modify src/lib/zod/index.ts ! No changes made

Flowchart

Implement /internal/devicedb/ endpoints

See https://github.com/seamapi/devicedb/tree/main/pages/api/device_models and can import Zod schemas directly from @seamapi/types/devicedb

Device images can be added to /public/devicedb/images in this repo and urls in the API response can be served from https://fake-seam-connect.seam.vc/devicedb/images

  • /internal/devicedb/v1/device_models/list
  • /internal/devicedb/v1/device_models/get
  • /internal/devicedb/v1/manufacturers/list
  • /internal/devicedb/v1/manufacturers/get

Emulate fake visionline and assa abloy on fake seam-connect

In order to test the mobile sdk, we need to be able to register an endpoint from fake visionline and simulate reader behaviors. Since we're using fake seam connect, it doesn't hold any references to underlying fakes (double fake problem). In order to get around this we need to implement fake visionline endpoints into fake seam connect. We need everything under the api/_fake endpoints:

  • api/_fake/load_credentials
  • api/_fake/redeem_invite_code
  • api/simulate/readers/list
  • api/simulate/readers/unlock

We need it in reference to this section of the sequence diagram:
Image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.