Interface: ObjectSchemaDefinition<K, L>¶
A schema definition for an object value (a value with key-value pairs).
Extends¶
BaseSchema.PropertyWithOptions<{ }>
Type Parameters¶
| Type Parameter |
|---|
K extends string |
L extends string |
Properties¶
attribution?¶
optionalattribution:AttributionNode[]
Attribution text, images, and/or links that should be rendered along with this value.
See makeAttributionNode.
Only supported in Superhuman Docs.
codaType?¶
optionalcodaType:Person|Reference|SelectList
A hint for how Superhuman Docs should interpret and render this object value.
For example, an object can represent a person (user) in a doc, with properties for the
email address of the person and their name. Using ValueHintType.Person tells Superhuman Docs to
render such a value as an @-reference to that person, rather than a basic object chip.
createdAtProperty?¶
optionalcreatedAtProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the creation datetime of the object.
Must be a ValueType.String or ValueType.Number property with the ValueHintType.Date or ValueHintType.DateTime hints
createdByProperty?¶
optionalcreatedByProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the creator of the object.
Must be a ValueType.String property with the ValueHintType.Email hint or a ValueType.Object with the ValueHintType.Person hint
description?¶
optionaldescription:string
A explanation of this object schema property shown to the user in the UI.
If your pack has an object schema with many properties, it may be useful to explain the purpose or contents of any property that is not self-evident.
Inherited from¶
BaseSchema.description
displayProperty?¶
optionaldisplayProperty:K
The name of a property within ObjectSchemaDefinition.properties that be used to label this object in the UI. Object values can contain many properties and the Superhuman Docs UI will display them as a "chip" with only the value of the "displayProperty" property used as the chip's display label. The other properties can be seen when hovering over the chip.
featured?¶
optionalfeatured:L[]
Deprecated¶
Use ObjectSchemaDefinition.featuredProperties
featuredProperties?¶
optionalfeaturedProperties:L[]
A list of property names from within ObjectSchemaDefinition.properties for the "featured" properties of this object, used in sync tables. When a sync table is first added to a document, columns are created for each of the featured properties. The user can easily add additional columns for any other properties, as desired. All featured properties need to be top-level. If you can't or don't want to change the received data format, consider changing the received object after fetching and before returning and assigning it to the schema.
This distinction exists for cases where a sync table may include dozens of properties, which would create a very wide table that is difficult to use. Featuring properties allows a sync table to be created with the most useful columns created by default, and the user can add additional columns as they find them useful.
Non-featured properties can always be referenced in formulas regardless of whether column projections have been created for them.
Only supported in Superhuman Docs.
id?¶
optionalid:K
Deprecated¶
Use ObjectSchemaDefinition.idProperty
identity?¶
optionalidentity:IdentityDefinition
An identity for this schema, if this schema is important enough to be named and referenced. See IdentityDefinition.
idProperty?¶
optionalidProperty:K
The name of a property within ObjectSchemaDefinition.properties that represents a unique id for this object. Sync table schemas must specify an id property, which uniquely identify each synced row.
imageProperty?¶
optionalimageProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that can be used as a rich image preview of the object.
Must be a ValueType.String property with the ValueHintType.ImageAttachment or ValueHintType.ImageReference hints
includeUnknownProperties?¶
optionalincludeUnknownProperties:boolean
Specifies that object instances with this schema can contain additional properties not defined in the schema, and that the packs infrastructure should retain these unknown properties rather than stripping them.
Properties not declared in the schema will not work properly in Superhuman Docs: they cannot be used natively in the formula language and will not have correct types in Superhuman Docs. But, in certain scenarios they can be useful.
Only supported in Superhuman Docs.
index?¶
optionalindex:IndexDefinition
Defines how to index objects for use with full-text indexing.
Only supported in Superhuman Go.
linkProperty?¶
optionallinkProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that will navigate users to more details about this object
Must be a ValueType.String property with a ValueHintType.Url ObjectSchemaDefinition.codaType.
modifiedAtProperty?¶
optionalmodifiedAtProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the last modified datetime of the object.
Must be a ValueType.String or ValueType.Number property with the ValueHintType.Date or ValueHintType.DateTime hints
modifiedByProperty?¶
optionalmodifiedByProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the last modifier of the object.
Must be a ValueType.String property with the ValueHintType.Email hint or a ValueType.Object with the ValueHintType.Person hint
options?¶
optionaloptions:PropertySchemaOptions<{ }>
A list of values or a formula that returns a list of values to suggest when someone edits this property.
Example¶
properties: {
color: {
type: sdk.ValueType.String,
codaType: sdk.ValueHintType.SelectList,
mutable: true,
options: ['red', 'green', 'blue'],
},
user: {
type: sdk.ValueType.String,
codaType: sdk.ValueHintType.SelectList,
mutable: true,
options: async function (context) {
let url = sdk.withQueryParams("https://example.com/userSearch", { name: context.search });
let response = await context.fetcher.fetch({ method: "GET", url: url });
let results = response.body.users;
return results.map(user => {display: user.name, value: user.id})
},
},
}
Inherited from¶
primary?¶
optionalprimary:K
Deprecated¶
Use ObjectSchemaDefinition.displayProperty
properties¶
properties:
ObjectSchemaProperties<K|L>
Definition of the key-value pairs in this object.
requireForUpdates?¶
optionalrequireForUpdates:boolean
Blocks updates from being sent with a blank value.
Inherited from¶
PropertyWithOptions.requireForUpdates
snippetProperty?¶
optionalsnippetProperty:PropertyIdentifier<K>
The name of a property within ObjectSchemaDefinition.properties that be used as a textual summary of the object.
Must be a ValueType.String property or ValueType.Array of ValueType.Strings.
subtitleProperties?¶
optionalsubtitleProperties:PropertyIdentifier<K>[]
A list of property names from within ObjectSchemaDefinition.properties for the properties of the object to be shown in the subtitle of a rich card preview for formulas that return this object. Defaults to the value of ObjectSchemaDefinition.featuredProperties if not specified.
titleProperty?¶
optionaltitleProperty:PropertyIdentifier<K>
The name of a property within properties that will be used as a title of a rich card preview for formulas that return this object. Defaults to the value of ObjectSchemaDefinition.displayProperty if not specified
Must be a ValueType.String property
type¶
type:
Object
Identifies this schema as an object schema.
userEmailProperty?¶
optionaluserEmailProperty:PropertyIdentifier<K>
For cases where the object being synced represents a user, the name of the property within ObjectSchemaDefinition.properties that identifies the email address of the user.
Must be a ValueType.String property with the ValueHintType.Email hint or a ValueType.Object with the ValueHintType.Person hint.