Meta
Defined in: js-api/src/meta.ts:36
Reflection over what the platform knows about its own types (grok.meta).
Constructors
Constructor
new Meta():
Meta
Returns
Meta
Methods
coreLocationOf()
coreLocationOf(
type):Promise<CoreLocation|null>
Defined in: js-api/src/meta.ts:81
Where [type]'s rows are served as a read-only domain table, or null when the
platform does not serve them — pass the result to grok.dapi.domains.table()
to query, facet or filter them with the names propertiesOf returned.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
Promise<CoreLocation | null>
propertiesOf()
propertiesOf(
type,options?):Promise<EntityPropertyInfo[] |null>
Defined in: js-api/src/meta.ts:55
Properties of [type] — a platform entity type name ('User', 'UserSession') or a
domain table addressed as '<schema>.<table>' ('Core.users', 'plates.plate').
Null when the platform curates no catalog for the type, and null for a domain table
that does not exist — a caller cannot tell an uncurated type from an unknown one,
and neither can the platform.
With filterable, narrows a platform type to its database-backed subset — the
properties a filter string may name. A domain table answers the same full column
list either way: every domain column is filterable.
These are the descriptors the platform renders and filters by. For the richer
per-column metadata of a domain table (nullable, choices, min/max, defaultValue,
get/set-bound to row values), read DomainRegistryClient.rowProperties
through grok.dapi.domains.registry.
Parameters
| Parameter | Type |
|---|---|
type | string |
options? | { filterable?: boolean; } |
options.filterable? | boolean |
Returns
Promise<EntityPropertyInfo[] | null>
Example
const props = await grok.meta.propertiesOf('User', {filterable: true});
const users = await grok.dapi.users.filter(`${props[0].name} = "admin"`).list();