Class DelegatingSchemaService
Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:557
See the class documentation above for usage.
Implements
Constructors
Constructor
new DelegatingSchemaService(store, schema): DelegatingSchemaService;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:583
Parameters
store
Store
schema
Returns
DelegatingSchemaService
Methods
attributesDefinitionFor()?
optional attributesDefinitionFor(resource): AttributesSchema;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:562
Delegates to whichever of the primary/fallback schema services has a schema for the resource, preferring the primary. See isDelegated.
Parameters
resource
| ResourceKey | { type: string; }
Returns
AttributesSchema
cacheFields()?
optional cacheFields(resource): Map<string,
| LegacyBelongsToField
| LegacyHasManyField
| LinksModeBelongsToField
| LinksModeHasManyField
| LegacyAttributeField
| GenericField
| ObjectField
| SchemaObjectField
| ArrayField
| SchemaArrayField
| ResourceField
| CollectionField>;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:621
Queries for the fields of a given resource type or resource identity.
Should error if the resource type is not recognized.
Parameters
resource
type
string
Returns
Map<string, | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField | LegacyAttributeField | GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | ResourceField | CollectionField>
CAUTION_MEGA_DANGER_ZONE_arrayExtensions()
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field):
| Map<string | symbol, ExtensionDef>
| null;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:682
Retrieve the extension map for an array field
Parameters
field
ExtensibleField
Returns
| Map<string | symbol, ExtensionDef> | null
CAUTION_MEGA_DANGER_ZONE_hasExtension()
CAUTION_MEGA_DANGER_ZONE_hasExtension(ext): boolean;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:661
Check if a specific extension has been registered previously
Parameters
ext
kind
"object" | "array"
name
string
Returns
boolean
CAUTION_MEGA_DANGER_ZONE_objectExtensions()
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field, resolvedType):
| Map<string | symbol, ExtensionDef>
| null;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:675
Retrieve the extension map for an object field
Parameters
field
ExtensibleField
resolvedType
string | null
Returns
| Map<string | symbol, ExtensionDef> | null
CAUTION_MEGA_DANGER_ZONE_registerExtension()
CAUTION_MEGA_DANGER_ZONE_registerExtension(extension): void;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:665
Register an extension for either objects or arrays
See also CAUTION_MEGA_DANGER_ZONE_Extension
Parameters
extension
CAUTION_MEGA_DANGER_ZONE_Extension
Returns
void
CAUTION_MEGA_DANGER_ZONE_resourceExtensions()
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource):
| Map<string | symbol, ExtensionDef>
| null;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:669
Retrieve the extension map for a resource
Parameters
resource
| ResourceKey | { type: string; }
Returns
| Map<string | symbol, ExtensionDef> | null
derivation()
derivation(field): Derivation;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:636
Returns the derivation registered with the name provided by field.type. Validates that the field is a valid DerivedField.
Parameters
field
| DerivedField | { type: string; }
Returns
doesTypeExist()?
optional doesTypeExist(type): boolean;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:572
Whether either the primary or fallback schema service has a schema for the given type.
Parameters
type
string
Returns
boolean
fields()
fields(resource): Map<string, FieldSchema>;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:615
Queries for the fields of a given resource type or resource identity.
Should error if the resource type is not recognized.
Parameters
resource
| ResourceKey | { type: string; }
Returns
Map<string, FieldSchema>
hashFn()
hashFn(field): HashFn;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:633
Returns the hash function registered with the name provided by field.type. Validates that the field is a valid HashField.
Parameters
field
| HashField | { type: string; }
Returns
hasResource()
hasResource(resource): boolean;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:600
Queries whether the SchemaService recognizes type as a resource type
Parameters
resource
| ResourceKey | { type: string; }
Returns
boolean
hasTrait()
hasTrait(type): boolean;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:603
Queries whether the SchemaService recognizes type as a resource trait
Parameters
type
string
Returns
boolean
isDelegated()
isDelegated(resource): boolean;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:592
Whether the given resource's schema is being served by the fallback (legacy Model-derived) schema service rather than the primary one.
Parameters
resource
| ResourceKey | { type: string; }
Returns
boolean
registerDerivation()
registerDerivation<R, T, FM>(derivation): void;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:654
Enables registration of a derivation.
The derivation can later be retrieved by the name attached to it's [Type] property.
Type Parameters
R
R
T
T
FM
FM extends | ObjectValue | null
Parameters
derivation
Derivation<R, T, FM>
Returns
void
registerHashFn()
registerHashFn(hashFn): void;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:657
Enables registration of a hashing function
The hashing function can later be retrieved by the name attached to it's [Type] property.
Parameters
hashFn
Returns
void
registerResource()
registerResource(schema): void;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:648
Enables registration of a single Schema representing either a resource in PolarisMode or LegacyMode or an ObjectSchema representing an embedded structure in other schemas.
This can be useful for either pre-loading schema information or for registering schema information delivered by API calls or other sources just-in-time.
Parameters
schema
| ResourceSchema | ObjectSchema
Returns
void
registerResources()
registerResources(schemas): void;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:645
Enables registration of multiple Schemas at once.
This can be useful for either pre-loading schema information or for registering schema information delivered by API calls or other sources just-in-time.
Parameters
schemas
( | ResourceSchema | ObjectSchema)[]
Returns
void
registerTransformation()
registerTransformation(transform): void;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:651
Enables registration of a transformation.
The transformation can later be retrieved by the name attached to it's [Type] property.
Parameters
transform
Returns
void
relationshipsDefinitionFor()?
optional relationshipsDefinitionFor(resource): RelationshipsSchema;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:567
Delegates to whichever of the primary/fallback schema services has a schema for the resource, preferring the primary. See isDelegated.
Parameters
resource
| ResourceKey | { type: string; }
Returns
RelationshipsSchema
resource()
resource(resource):
| ResourceSchema
| ObjectSchema;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:639
Returns the schema for the provided resource type.
Parameters
resource
| ResourceKey | { type: string; }
Returns
| ResourceSchema | ObjectSchema
resourceHasTrait()
resourceHasTrait(resource, trait): boolean;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:609
Queries whether the given resource has the given trait
Parameters
resource
| ResourceKey | { type: string; }
trait
string
Returns
boolean
resourceTypes()
resourceTypes(): readonly string[];Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:596
Returns all known resource types
Returns
readonly string[]
transformation()
transformation(field): Transformation;Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:630
Returns the transformation registered with the name provided by field.type. Validates that the field is a valid transformable.
Parameters
field
| GenericField | ObjectField | ArrayField | { type: string; }