Optionaldata: Partial<TokenData> = {}Initial data used to construct the data object. The provided object will be owned by the constructed model instance and may be mutated.
Optionaloptions: DocumentConstructionContext = {}Context and data validation options which affects initial model construction.
Internal_movementThe movement continuation state of this Token document.
The source data object for this DataModel instance. Once constructed, the source object is sealed such that no keys may be added nor removed.
A singleton collection which holds a reference to the synthetic token actor by its base actor's ID.
An immutable reverse-reference to a parent DataModel to which this model belongs.
The Regions this Token is currently in.
Static Internal_schemaThe defined and cached Data Schema for all instances of this DataModel.
StaticDEFAULT_The default icon used for newly created Token documents
StaticLOCALIZATION_StaticmetadataDefault metadata which applies to each instance of this Document type.
Static ReadonlyMOVEMENT_The fields of the data model for which changes count as a movement action.
AbstractcompendiumA reference to the Compendium Collection containing this Document, if any, and otherwise null.
Check if the document has a distinct subject texture (inferred or explicit).
The canonical identifier for this Document.
An indicator for whether this Token is currently involved in the active combat encounter.
Is this document in a compendium?
Is the current state of this DataModel invalid? The model is invalid if there is any unresolved failure.
Is this document embedded within a parent document?
A convenient reference for whether this TokenDocument is linked to the Actor it represents, or is a synthetic copy
An indicator for whether the current User has full control over this Token document.
Does this TokenDocument have the SECRET disposition and is the current user lacking the necessary permissions that would reveal this secret?
The current movement data of this Token document.
The movement history.
Define the data schema for this document instance.
A Universally Unique Identifier (uuid) for this Document instance.
An array of validation failure instances which may have occurred when this instance was last validated.
StaticbaseThe base document definition that this document class extends from.
StaticcollectionThe named collection to which this Document belongs.
StaticdatabaseThe database backend used to execute operations and handle results.
StaticdocumentThe canonical name of this Document type, for example "Actor".
StatichasDoes this Document support additional subtypes?
StatichierarchyThe Embedded Document hierarchy for this Document.
StaticimplementationReturn a reference to the configured subclass of this base Document type.
StaticschemaEnsure that all Document classes share the same schema of their base declaration.
StaticTYPESThe allowed types which may exist for this Document class.
InternalIdentify the collection in a parent Document that this Document belongs to, if any.
OptionalparentCollection: null | stringAn explicitly provided parent collection name.
InternalGet the position of the Token from the top-left grid offset.
The top-left grid offset
Optionaldata: Partial<TokenDimensions> = {}The dimensions that override the current dimensions
The snapped position
InternalIdentify the Regions the Token currently is or is going to be in after the changes are applied.
Optionalchanges: object = {}The changes that will be applied to this Token
The Region IDs this Token is in after the changes are applied (sorted)
Initialize the instance by copying data from the source object to instance attributes. This mirrors the workflow of SchemaField#initialize but with some added functionality.
Options provided to the model constructor
Initialize the source data for a new DataModel instance. One-time migrations and initial cleaning operations are applied to the source data.
The candidate source data from which the model will be constructed
Options provided to the model constructor
Migrated and cleaned source data which will be stored to the model instance,
which is the same object as the data argument
Post-process a creation operation for a single Document instance. Post-operation events occur for all connected clients.
The initial data object provided to the document creation request
Additional options which modify the creation request
The id of the User requesting the document update
Post-process a deletion operation for a single Document instance. Post-operation events occur for all connected clients.
Additional options which modify the deletion request
The id of the User requesting the document update
Post-process an update operation for a single Document instance. Post-operation events occur for all connected clients.
The differential data that was changed relative to the documents prior values
Additional options which modify the update request
The id of the User requesting the document update
InternalWhen the base Actor for a TokenDocument changes, we may need to update its Actor instance
Optionalupdate: object = {}The update delta
Optionaloptions: Partial<DatabaseUpdateOperation> = {}The database operation that was performed
InternalGet the top-left grid offset of the Token.
Optionaldata: Partial<ElevatedPoint & TokenDimensions> = {}The position and dimensions
The top-left grid offset
InternalPrepare changes to a descendent delta collection.
Candidate source changes.
Options which determine how the new data is merged.
Pre-process an update operation for a single Document instance. Pre-operation events only occur for the client which requested the operation.
The candidate changes to the Document
Additional options which modify the update request
The User requesting the document update
A return value of false indicates the update operation should be cancelled.
InternalThis function is called on Token documents that are still being moved by a User that just disconnected.
Test whether a given User has permission to perform some action on this Document
The User attempting modification
The attempted action
Optionaldata: object = {}Data involved in the attempted action
Does the User have permission?
Clear the movement history of this Token.
Clone a document, creating a new document by combining current data with provided overrides. The cloned document is ephemeral and not yet saved to the database.
Additional data which overrides current document data at the time of creation
Additional context options passed to the create method
The cloned Document instance
Create multiple embedded Document instances within this parent Document using provided input data.
The name of the embedded Document type
An array of data objects used to create multiple documents
Optionaloperation: DatabaseCreateOperation = {}Parameters of the database creation workflow
An array of created Document instances
Delete this Document, removing it from the database.
Optionaloperation: Partial<Omit<DatabaseDeleteOperation, "ids">> = {}Parameters of the deletion operation
The deleted Document instance, or undefined if not deleted
Delete multiple embedded Document instances within a parent Document using provided string ids.
The name of the embedded Document type
An array of string ids for each Document to be deleted
Optionaloperation: DatabaseDeleteOperation = {}Parameters of the database deletion workflow
An array of deleted Document instances
A helper method to retrieve the underlying data behind one of the Token's attribute bars
The named bar to retrieve the attribute for
Optionaloptions: { alternative?: string } = {}Optionalalternative?: stringAn alternative attribute path to get instead of the default one
The attribute displayed on the Token bar, if any
Get the center point of the Token.
Optionaldata: Partial<ElevatedPoint & TokenDimensions> = {}The position and dimensions
The center point
Get the path of movement with the intermediate steps of the direct path between waypoints.
The waypoints of movement
The path of movement with all intermediate steps
Obtain a reference to the Array of source data within the data object for a certain embedded Document name
The name of the embedded Document type
The Collection instance of embedded Documents of the requested type
Get an embedded document by its id from a named collection in the parent document.
The name of the embedded Document type
The id of the child document to retrieve
Optionaloptions: { invalid?: boolean; strict?: boolean } = {}Additional options which modify how embedded documents are retrieved
Optionalinvalid?: booleanAllow retrieving an invalid Embedded Document.
Optionalstrict?: booleanThrow an Error if the requested id does not exist. See Collection#get
The retrieved embedded Document instance, or undefined
Get the value of a "flag" for this document See the setFlag method for more details on flags
The flag scope which namespaces the key
The flag key
The flag value
Get the grid space polygon of the Token. Returns undefined in gridless grids because there are no grid spaces.
Optionaldata: Partial<TokenDimensions> = {}The dimensions
The grid space polygon or undefined if gridless
Get the offsets of grid spaces that are occupied by this Token at the current or given position. The grid spaces the Token occupies are those that are covered by the Token's shape in the snapped position. Returns an empty array in gridless grids.
Optionaldata: Partial<Point & TokenDimensions> = {}The position and dimensions
The offsets of occupied grid spaces
Get the width and height of the Token in pixels.
Optionaldata: Partial<{ height: number; width: number }> = {}The width and/or height in grid units (must be positive)
The width and height in pixels
Get the snapped position of the Token.
Optionaldata: Partial<ElevatedPoint & TokenDimensions> = {}The position and dimensions
The snapped position
Get the explicit permission level that a User has over this Document, a value in CONST.DOCUMENT_OWNERSHIP_LEVELS. Compendium content ignores the ownership field in favor of User role-based ownership. Otherwise, Documents use granular per-User ownership definitions and Embedded Documents defer to their parent ownership.
This method returns the value recorded in Document ownership, regardless of the User's role, for example a GAMEMASTER user might still return a result of NONE if they are not explicitly denoted as having a level.
To test whether a user has a certain capability over the document, testUserPermission should be used.
The User being tested
A numeric permission level from CONST.DOCUMENT_OWNERSHIP_LEVELS
Test whether a Token has a specific status effect.
The status effect ID as defined in CONFIG.statusEffects
Does the Actor of the Token have this status effect?
Measure the movement path for this Token.
The waypoints of movement
Optionaloptions: { aggregator?: TokenMovementCostAggregator; cost?: TokenMovementCostFunction } = {}Additional measurement options
Optionalaggregator?: TokenMovementCostAggregatorThe cost aggregator.
Default: CONFIG.Token.movement.costAggregator.
Optionalcost?: TokenMovementCostFunctionThe function that returns the cost for a given move between grid spaces (default is the distance travelled along the direct path)
For Documents which include game system data, migrate the system data object to conform to its latest data model. The data model is defined by the template.json specification included by the game system.
The migrated system data object
Move the Token through the given waypoint(s).
The waypoint(s) to move the Token through
Optionaloptions: Partial<Parameters of the update operation
A Promise that resolves to true if the Token was moved, otherwise resolves to false
Pause the movement of this Token document. The movement can be resumed after being paused. Only the User that initiated the movement can pause it. Returns a callback that can be used to resume the movement later. Only after all callbacks and keys have been called the movement of the Token is resumed. If the callback is called within the update operation workflow, the movement is resumed after the workflow.
The callback to resume movement if the movement was or is paused, otherwise null
// This is an Execute Script Region Behavior that makes the token invisible
// On TOKEN_MOVE_IN...
if ( !event.user.isSelf ) return;
const resumeMovement = event.data.token.pauseMovement();
if ( event.data.token.rendered ) await event.data.token.object.movementAnimationPromise;
await event.data.token.actor.toggleStatusEffect("invisible", {active: true});
const resumed = await resumeMovement();
Pause the movement of this Token document. The movement can be resumed after being paused. Only the User that initiated the movement can pause it. Returns a promise that resolves to true if the movement was resumed by TokenDocument#resumeMovement with the same key that was passed to this function. Only after all callbacks and keys have been called the movement of the Token is resumed. If the callback is called within the update operation workflow, the movement is resumed after the workflow.
The key to resume movement with TokenDocument#resumeMovement
The continuation promise if the movement was paused, otherwise null
// This is an Execute Script Region Behavior of a pressure plate that activates a trap
// On TOKEN_MOVE_IN...
if ( event.user.isSelf ) {
event.data.token.pauseMovement(this.parent.uuid);
}
if ( game.user.isActiveGM ) {
if ( event.data.token.rendered ) await event.data.token.object.movementAnimationPromise;
const trapUuid; // The Region Behavior UUID of the trap
const trapBehavior = await fromUuid(trapUuid);
await trapBehavior.update({disabled: false});
event.data.token.resumeMovement(event.data.movement.id, this.parent.uuid);
}
Reset the state of this data instance back to mirror the contained source data, erasing any changes.
Resize the token Token such that its center point remains (almost) unchanged. The center point might change slightly because the new (x, y) position is rounded.
The new dimensions
Optionaloptions: Partial<Omit<DatabaseUpdateOperation, "updates">>Parameters of the update operation
A Promise that resolves to true if the Token was resized, otherwise resolves to false
Resume the movement given its ID and the key that was passed to TokenDocument#pauseMovement.
The movement ID
The key that was passed to TokenDocument#pauseMovement
Undo all recorded movement or the recorded movement corresponding to given movement ID up to the last movement. The token is displaced to the prior recorded position and the movement history it rolled back accordingly.
OptionalmovementId: stringThe ID of the recorded movement to undo
True if the movement was undone, otherwise false
Split the Token movement path through the Region into its segments. The Token and the Region must be in the same Scene.
Implementations of this function are restricted in the following ways:
x, y, elevation, width, height, and shape.The region
The waypoints of movement
The movement split into its segments
Assign a "flag" to this document. Flags represent key-value type data which can be used to store flexible or arbitrary data required by either the core software, game systems, or user-created modules.
Each flag should be set using a scope which provides a namespace for the flag to help prevent collisions.
Flags set by the core software use the "core" scope. Flags set by game systems or modules should use the canonical name attribute for the module Flags set by an individual world should "world" as the scope.
Flag values can assume almost any data type. Setting a flag value to null will delete that flag.
The flag scope which namespaces the key
The flag key
The flag value
A Promise resolving to the updated document
Stop the movement of this Token document. The movement cannot be continued after being stopped. Only the User that initiated the movement can stop it.
True if the movement was or is stopped, otherwise false
Test whether the Token is inside the Region. This function determines the state of TokenDocument#regions and foundry.documents.RegionDocument#tokens. The Token and the Region must be in the same Scene.
Implementations of this function are restricted in the following ways:
x, y, elevation, width, height, and shape.If this function is overridden, then TokenDocument#segmentizeRegionMovementPath must be overridden too.
If an override of this function uses Token document fields other than x, y, elevation, width, height, and
shape, TokenDocument#_couldRegionsChange must be overridden to return true for changes
of these fields. If an override of this function uses non-Token properties other than Scene#grid.type and
Scene#grid.size,
foundry.documents.Scene#updateTokenRegions must be called when any of those properties change.
The region.
Is inside the Region?
The region.
The position and dimensions. Defaults to the values of the document source.
Is inside the Region?
Test whether a certain User has a requested permission level (or greater) over the Document
The User being tested
The permission level from DOCUMENT_OWNERSHIP_LEVELS to test
Additional options involved in the permission test
Optionalexact?: booleanRequire the exact permission level requested?
Does the user have this permission level over the Document?
Add or remove this Token from a Combat encounter.
Optionaloptions: { active?: boolean } = {}Additional options passed to TokenDocument.createCombatants or TokenDocument.deleteCombatants
Optionalactive?: booleanRequire this token to be an active Combatant or to be removed. Otherwise, the current combat state of the Token is toggled.
Is this Token now an active Combatant?
Extract the source data for the DataModel into a simple object format that can be serialized.
The document source data expressed as a plain object
Copy and transform the DataModel into a plain object. Draw the values of the extracted object from the data source (by default) otherwise from its transformed values.
Draw values from the underlying data source rather than transformed values
The extracted primitive object
Remove a flag assigned to the document
The flag scope which namespaces the key
The flag key
The updated document instance
Update this Document using incremental data, saving it to the database.
Optionaldata: object = {}Differential update data which modifies the existing values of this document
Optionaloperation: Partial<Omit<DatabaseUpdateOperation, "updates">> = {}Parameters of the update operation
The updated Document instance, or undefined not updated
Update multiple embedded Document instances within a parent Document using provided differential data.
The name of the embedded Document type
An array of differential data objects, each used to update a single Document
Optionaloperation: DatabaseUpdateOperation = {}Parameters of the database update workflow
An array of updated Document instances
Update the DataModel locally by applying an object of changes to its source data. The provided changes are expanded, cleaned, validated, and stored to the source data object for this model. The provided changes argument is mutated in this process. The source data is then re-initialized to apply those changes to the prepared data. The method returns an object of differential changes which modified the original data.
New values which should be applied to the data model
Options which determine how the new data is merged
An object containing differential keys and values that were changed
Convenience method to change a token vision mode.
The vision mode to apply to this token.
Optionaldefaults: boolean = trueIf the vision mode should be updated with its defaults.
The updated Document instance, or undefined not updated.
Validate the data contained in the document to check for type and content. If changes are provided, missing types are added to it before cleaning and validation. This mutates the provided changes. This function throws an error if data within the document is not valid.
Options which modify how the model is validated
Whether the data source or proposed change is reported as valid. A boolean is always returned if validation is non-strict.
Protected_couldProtectedIs the Token document updated such that the Regions the Token is contained in may change? Called as part of the preUpdate workflow.
The changes.
Could this Token update change Region containment?
Protected_inferProtectedInfer the movement action.
The default implementation returns CONFIG.Token.movement.defaultAction.
Protected_inferProtectedInfer the subject texture path to use for a token ring.
Protected_onProtectedCalled when the current movement is paused.
Protected_onProtectedCalled when the movement is recorded or cleared.
Protected_onProtectedCalled when the current movement is stopped.
Protected_onProtectedWhenever the token's actor delta changes, or the base actor changes, perform associated refreshes.
Optionalupdate: object | object[] = {}The update delta
Optionaloperation: Partial<DatabaseOperation> = {}The database operation that was performed
Protected_onProtectedPost-process an update operation of a movement.
The movement of this Token
The update operation
The User that requested the update operation
Protected_preProtectedPre-process a creation operation for a single Document instance. Pre-operation events only occur for the client which requested the operation.
Modifications to the pending Document instance must be performed using updateSource.
The initial data object provided to the document creation request
Additional options which modify the creation request
The User requesting the document creation
Return false to exclude this Document from the creation operation
Protected_preProtectedPre-process a deletion operation for a single Document instance. Pre-operation events only occur for the client which requested the operation.
Additional options which modify the deletion request
The User requesting the document deletion
A return value of false indicates the deletion operation should be cancelled.
Protected_prepareProtectedPrepare detection modes which are available to the Token. Ensure that every Token has the basic sight detection mode configured.
Protected_preProtectedReject the movement or modify the update operation as needed based on the movement. Called after the movement for this document update has been determined. The waypoints of movement are final and cannot be changed. The movement can only be rejected entirely.
The pending movement of this Token
The update operation
If false, the movement is prevented
Protected_shouldProtectedShould the movement of this Token update be recorded in the movement history? Called as part of the preUpdate workflow if the Token is moved.
Should the movement of this Token update be recorded in the movement history?
Static_addInternalDefine a simple migration from one field name to another. The value of the data can be transformed during the migration by an optional application function.
The data object being migrated
The old field name
The new field name
Optionalapply: (data: object) => anyAn application function, otherwise the old value is applied
Whether a migration was applied.
Static_addInternalA reusable helper for adding a migration shim The value of the data can be transformed during the migration by an optional application function.
The data object being shimmed
The old field name
The new field name
Optionaloptions: { value?: any; warning?: string } = {}Options passed to foundry.utils.logCompatibilityWarning
Optionalvalue?: anyThe value of the shim
Optionalwarning?: stringThe deprecation message
Static_addInternalA reusable helper for adding migration shims.
The data object being shimmed
The mapping of old keys to new keys
Optionaloptions: { value?: any; warning?: string }Options passed to foundry.utils.logCompatibilityWarning
Optionalvalue?: anyThe value of the shim
Optionalwarning?: stringThe deprecation message
Static_addInternalAdd deprecated getters for the teleport and forced option.
Static_clearInternalClear the fields from the given Document data recursively.
The (partial) Document data
The fields that are cleared
Optionaloptions: { callback?: RecursiveFieldClearCallback } = {}Optionalcallback?: RecursiveFieldClearCallbackA callback that is invoked on each field in order to clear it.
Static_getInternalGet the hexagonal offsets given the type, width, and height.
The width of the Token (positive)
The height of the Token (positive)
The shape (one of CONST.TOKEN_SHAPES)
Column-based instead of row-based hexagonal grid?
The hexagonal offsets
Static_initializationStatic_isInternalAre these changes moving the Token?
The (candidate) changes
Is movement?
InternalAre these changes moving the Token from the given origin?
The (candidate) changes
The origin
Is movement?
Static_logInternalLog a compatbility warning for the data field migration.
The old field name
The new field name
Optionaloptions: object = {}Options passed to foundry.utils.logCompatibilityWarning
Static_onStatic_onStatic_onStatic_prePre-process a creation operation, potentially altering its instructions or input data. Pre-operation events only occur for the client which requested the operation.
This batch-wise workflow occurs after individual _preCreate workflows and provides a final pre-flight check before a database operation occurs.
Modifications to pending documents must mutate the documents array or alter individual document instances using updateSource.
Pending document instances to be created
Parameters of the database creation operation
The User requesting the creation operation
Return false to cancel the creation operation entirely
Static_prePre-process an update operation, potentially altering its instructions or input data. Pre-operation events only occur for the client which requested the operation.
This batch-wise workflow occurs after individual _preUpdate workflows and provides a final pre-flight check before a database operation occurs.
Modifications to the requested updates are performed by mutating the data array of the operation.
Document instances to be updated
Parameters of the database update operation
The User requesting the update operation
Return false to cancel the update operation entirely
StaticareAre the given positions equal?
StaticcanTest whether a given User has sufficient permissions to create Documents of this type in general. This does not guarantee that the User is able to create all Documents of this type, as certain document-specific requirements may also be present.
Generally speaking, this method is used to verify whether a User should be presented with the option to create Documents of this type in the UI.
The User being tested
Does the User have a sufficient role to create?
StaticcleanClean a data source object to conform to a specific provided schema.
Optionalsource: object = {}The source data object
Optionaloptions: object = {}Additional options which are passed to field cleaning methods
The cleaned source data, which is the same object as the source argument
StaticcreateCreate a new Document using provided input data, saving it to the database.
Optionaldata: Initial data used to create this Document, or a Document instance to persist.
Optionaloperation: Partial<Omit<DatabaseCreateOperation, "data">> = {}Parameters of the creation operation
The created Document instance(s)
const data = [{name: "Special Sword", type: "weapon"}];
const created = await Item.implementation.create(data);
StaticcreateCreate or remove Combatants for an array of provided Token objects.
The tokens which should be added to the Combat
Optionaloptions: { combat?: documents.Combat } = {}Options which modify the toggle operation
An array of created Combatant documents
StaticcreateCreate multiple Documents using provided input data. Data is provided as an array of objects where each individual object becomes one new Document.
An array of data objects or existing Documents to persist.
Optionaloperation: Partial<Omit<DatabaseCreateOperation, "data">> = {}Parameters of the requested creation operation
An array of created Document instances
const data = [{name: "New Actor", type: "character", img: "path/to/profile.jpg"}];
const created = await Actor.implementation.createDocuments(data);
const data = [{name: "Tim", type: "npc"], [{name: "Tom", type: "npc"}];
const created = await Actor.implementation.createDocuments(data);
StaticdefineDefine the data schema for models of this type. The schema is populated the first time it is accessed and cached for future reuse.
The schema, through its fields, provide the essential cleaning, validation, and initialization methods to turn the _source values into direct properties of the data model. The schema is a static property of the model and is reused by all instances to perform validation.
The schemas defined by the core software in classes like foundry.documents.BaseActor are validated by the
server, where user code does not run. However, almost all documents have a flags field to store data, and many
have a system field that can be configured to be a foundry.abstract.TypeDataModel instance. Those models
are not constructed on the server and rely purely on client-side code, which means certain extra-sensitive fields
must be also be registered through your package manifest. foundry.packages.types.ServerSanitizationFields
class SomeModel extends foundry.abstract.DataModel {
static defineSchema() {
return {
foo: new foundry.data.fields.StringField()
}
}
}
class AnotherModel extends SomeModel {
static defineSchema() {
// Inheritance and object oriented principles apply to schema definition
const schema = super.defineSchema()
schema.bar = new foundry.data.fields.NumberField()
return schema;
}
}
StaticdeleteRemove Combatants for the array of provided Tokens.
The tokens which should removed from the Combat
Optionaloptions: { combat?: documents.Combat } = {}Options which modify the operation
An array of deleted Combatant documents
StaticdeleteDelete one or multiple existing Documents using an array of provided ids. Data is provided as an array of string ids for the documents to delete.
An array of string ids for the documents to be deleted
Optionaloperation: Partial<Omit<DatabaseDeleteOperation, "ids">> = {}Parameters of the database deletion operation
An array of deleted Document instances
const tim = game.actors.getName("Tim");
const deleted = await Actor.implementation.deleteDocuments([tim.id]);
const tim = game.actors.getName("Tim");
const tom = game.actors.getName("Tom");
const deleted = await Actor.implementation.deleteDocuments([tim.id, tom.id]);
StaticfromJSONCreate a DataModel instance using a provided serialized JSON string.
Serialized document data in string format
A constructed data model instance
StaticfromCreate a new instance of this DataModel from a source record. The source is presumed to be trustworthy and is not strictly validated.
Initial document data which comes from a trusted source.
Optionalcontext: Omit<DataModelConstructionContext, "strict"> & DataModelFromSourceOptions = {}Model construction context
StaticgetGet a World-level Document of this type by its id.
The Document ID
Optionaloperation: DatabaseGetOperation = {}Parameters of the get operation
The retrieved Document, or null
StaticgetA compatibility method that returns the appropriate name of an embedded collection within this Document.
An existing collection name or a document name.
The provided collection name if it exists, the first available collection for the document name provided, or null if no appropriate embedded collection could be found.
StaticgetInspect the Actor data model and identify the set of attributes which could be used for a Token Bar.
The tracked attributes which can be chosen from
A nested object of attribute choices to display
StaticgetGet an Array of attribute choices which could be tracked for Actors in the Combat Tracker
Optionaldata: The object to explore for attributes, or an Actor type.
Optional_path: string[] = []StaticmigrateMigrate candidate source data for this DataModel which may require initial cleaning or transformations.
The candidate source data from which the model will be constructed
Migrated source data, which is the same object as the source argument
StaticmigrateWrap data migration in a try/catch which attempts it safely
The candidate source data from which the model will be constructed
Migrated source data, which is the same object as the source argument
StaticshimTake data which conforms to the current data schema and add backwards-compatible accessors to it in order to support older code which uses this data.
Data which matches the current schema
Additional shimming options
Data with added backwards-compatible properties, which is the same object as
the data argument
StaticupdateUpdate multiple Document instances using provided differential data. Data is provided as an array of objects where each individual object updates one existing Document.
An array of differential data objects, each used to update a single Document
Optionaloperation: Partial<Omit<DatabaseUpdateOperation, "updates">> = {}Parameters of the database update operation
An array of updated Document instances
const updates = [{_id: "12ekjf43kj2312ds", name: "Timothy"}];
const updated = await Actor.implementation.updateDocuments(updates);
const updates = [{_id: "12ekjf43kj2312ds", name: "Timothy"}, {_id: "kj549dk48k34jk34", name: "Thomas"}]};
const updated = await Actor.implementation.updateDocuments(updates);
StaticvalidateEvaluate joint validation rules which apply validation conditions across multiple fields of the model. Field-specific validation rules should be defined as part of the DataSchema for the model. This method allows for testing aggregate rules which impose requirements on the overall model.
Candidate data for the model
Protected Static_getProtectedRetrieve any configured attributes for a given Actor type.
Optionaltype: stringThe Actor type.
Protected Static_getProtectedRetrieve an Array of attribute choices from a plain object.
The object to explore for attributes.
Protected Static_getProtectedRetrieve an Array of attribute choices from a SchemaField.
The schema to explore for attributes.
Protected Static_preProtectedPre-process a deletion operation, potentially altering its instructions or input data. Pre-operation events only occur for the client which requested the operation.
This batch-wise workflow occurs after individual _preDelete workflows and provides a final pre-flight check before a database operation occurs.
Modifications to the requested deletions are performed by mutating the operation object. updateSource.
Document instances to be deleted
Parameters of the database update operation
The User requesting the deletion operation
Return false to cancel the deletion operation entirely
The client-side Token document which extends the common BaseToken document model.
The following fields must no be altered from source during data preparation:
x,y,elevation,width,height,shape.Hook Events
Mixes
CanvasDocumentMixin
See