Skip to content
module@warp-drive/legacy/model/migration-support @legacy

Class DelegatingSchemaService ​

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:573

See the class documentation above for usage.

Implements ​

  • SchemaService

Constructors ​

Constructor ​

ts
new DelegatingSchemaService(store: Store$1, schema: SchemaService): DelegatingSchemaService;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:601

Parameters ​

store ​

Store$1

schema ​

SchemaService

Returns ​

DelegatingSchemaService

Methods ​

attributesDefinitionFor()? ​

ts
optional attributesDefinitionFor(resource: 
  | ResourceKey
  | {
  type: string;
}): AttributesSchema;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:578

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()? ​

ts
optional cacheFields(resource: {
  type: string;
}): 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:639

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() ​

ts
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): 
  | Map<string | symbol, ExtensionDef>
  | null;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:700

Retrieve the extension map for an array field

Parameters ​

field ​

ExtensibleField

Returns ​

| Map<string | symbol, ExtensionDef> | null


CAUTION_MEGA_DANGER_ZONE_hasExtension() ​

ts
CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: {
  kind: "object" | "array";
  name: string;
}): boolean;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:679

Check if a specific extension has been registered previously

Parameters ​

ext ​
kind ​

"object" | "array"

name ​

string

Returns ​

boolean


CAUTION_MEGA_DANGER_ZONE_objectExtensions() ​

ts
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): 
  | Map<string | symbol, ExtensionDef>
  | null;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:693

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() ​

ts
CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:683

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() ​

ts
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: 
  | ResourceKey
  | {
  type: string;
}): 
  | Map<string | symbol, ExtensionDef>
  | null;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:687

Retrieve the extension map for a resource

Parameters ​

resource ​

| ResourceKey | { type: string; }

Returns ​

| Map<string | symbol, ExtensionDef> | null


derivation() ​

ts
derivation(field: 
  | DerivedField
  | {
  type: string;
}): Derivation;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:654

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 ​

Derivation


doesTypeExist()? ​

ts
optional doesTypeExist(type: string): boolean;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:588

Whether either the primary or fallback schema service has a schema for the given type.

Parameters ​

type ​

string

Returns ​

boolean


fields() ​

ts
fields(resource: 
  | ResourceKey
  | {
  type: string;
}): Map<string, FieldSchema>;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:633

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() ​

ts
hashFn(field: 
  | HashField
  | {
  type: string;
}): HashFn;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:651

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 ​

HashFn


hasResource() ​

ts
hasResource(resource: 
  | ResourceKey
  | {
  type: string;
}): boolean;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:618

Queries whether the SchemaService recognizes type as a resource type

Parameters ​

resource ​

| ResourceKey | { type: string; }

Returns ​

boolean


hasTrait() ​

ts
hasTrait(type: string): boolean;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:621

Queries whether the SchemaService recognizes type as a resource trait

Parameters ​

type ​

string

Returns ​

boolean


isDelegated() ​

ts
isDelegated(resource: 
  | ResourceKey
  | {
  type: string;
}): boolean;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:610

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() ​

ts
registerDerivation<R, T, FM extends 
  | ObjectValue
  | null>(derivation: Derivation<R, T, FM>): void;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:672

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() ​

ts
registerHashFn(hashFn: HashFn): void;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:675

Enables registration of a hashing function

The hashing function can later be retrieved by the name attached to it's [Type] property.

Parameters ​

hashFn ​

HashFn

Returns ​

void


registerResource() ​

ts
registerResource(schema: 
  | ResourceSchema
  | ObjectSchema): void;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:666

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() ​

ts
registerResources(schemas: (
  | ResourceSchema
  | ObjectSchema)[]): void;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:663

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() ​

ts
registerTransformation(transform: Transformation): void;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:669

Enables registration of a transformation.

The transformation can later be retrieved by the name attached to it's [Type] property.

Parameters ​

transform ​

Transformation

Returns ​

void


relationshipsDefinitionFor()? ​

ts
optional relationshipsDefinitionFor(resource: 
  | ResourceKey
  | {
  type: string;
}): RelationshipsSchema;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:583

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() ​

ts
resource(resource: 
  | ResourceKey
  | {
  type: string;
}): 
  | ResourceSchema
  | ObjectSchema;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:657

Returns the schema for the provided resource type.

Parameters ​

resource ​

| ResourceKey | { type: string; }

Returns ​

| ResourceSchema | ObjectSchema


resourceHasTrait() ​

ts
resourceHasTrait(resource: 
  | ResourceKey
  | {
  type: string;
}, trait: string): boolean;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:627

Queries whether the given resource has the given trait

Parameters ​

resource ​

| ResourceKey | { type: string; }

trait ​

string

Returns ​

boolean


resourceTypes() ​

ts
resourceTypes(): readonly string[];

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:614

Returns all known resource types

Returns ​

readonly string[]


transformation() ​

ts
transformation(field: 
  | GenericField
  | ObjectField
  | ArrayField
  | {
  type: string;
}): Transformation;

Defined in: warp-drive-packages/legacy/src/model/migration-support.ts:648

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; }

Returns ​

Transformation

Released under the MIT License.