ObjectStackObjectStack

Push Device schema — System Protocol reference

Push Device schemas of the ObjectStack System Protocol: UserDevice — each property with its type, default and a TypeScript example.

Source: packages/spec/src/system/push-device.zod.ts

TypeScript Usage

import { UserDeviceSchema } from '@objectstack/spec/system';
import type { UserDevice } from '@objectstack/spec/system';

// Validate data
const result = UserDeviceSchema.parse(data);

UserDevice

A push device of one user: one row per app install

Properties

PropertyTypeRequiredDescription
deviceIdstring✅Client-held device id, stable per app install: the one the registration carried or the server minted. Unique per user
userIdstring✅The user the device belongs to: the session user who registered it. No organization member
vendorEnum<'apns' | 'fcm'>✅Push vendor the token belongs to: the registration's vendor, or the one derived from platform
tokenstring✅Vendor push token. Held by one live device at a time: a second user's registration moves it
platformEnum<'ios' | 'android' | 'web'>✅Device platform, as the registration named it
appIdstringoptionalApp the token was issued to: the iOS bundle ID or the Android application ID
localestringoptionalDevice locale (BCP 47, for example zh-CN), as the registration named it. Stored for the device; no push renders by it: a push arrives in the recipient's language (sys_user.locale, then the deployment default)
namestringoptionalDevice friendly name, as the registration named it
originstringoptionalThe origin the Console was loaded from, as the registration named it (for example https://crm.example.com). The device registry keeps it on the row and the push channel copies it into every push to this device, where the mobile shell picks the saved server by it. Absent on a device registered without one
enabledboolean✅False once the vendor reported the token dead; nothing is delivered to a disabled device
invalidatedAtstringoptionalWhen the vendor reported the token dead. Present exactly while enabled is false: absent on an enabled device, and cleared by the registration that re-enables it
lastSeenAtstringoptionalWhen the device last registered or refreshed. Every registration and refresh sets it, so it is absent only on a row no registration wrote; listDevices answers such a device last

On this page