Skip to content

Commit

Permalink
feat: strong type objects and types (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffMathy authored Nov 27, 2023
1 parent 5a168d2 commit 0db6604
Show file tree
Hide file tree
Showing 15 changed files with 3,175 additions and 7 deletions.
21 changes: 21 additions & 0 deletions source/__snapshots__/default-custom-attributes.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,55 @@ export function getAttributeConfigurations() {
name: "fend",
label: "Frame end",
entityType: "task",
default: 1,
objectType: "Shot",
isHierarchical: false,
},
{
name: "handles",
label: "Frame handles",
entityType: "task",
default: 0,
objectType: "Shot",
isHierarchical: false,
},
{
name: "duration",
label: "Frame duration",
entityType: "task",
default: "{self.fend - self.fstart + 1}",
objectType: "Shot",
isHierarchical: false,
},
{
name: "fstart",
label: "Frame start",
entityType: "task",
default: 1,
objectType: "Shot",
isHierarchical: false,
},
{
name: "fps",
label: "fps",
entityType: "show",
default: 24,
objectType: undefined,
isHierarchical: false,
},
{
name: "fps",
label: "fps",
entityType: "task",
default: 25,
objectType: "Sequence",
isHierarchical: false,
},
{
name: "fps",
label: "fps",
entityType: "task",
default: 25,
objectType: "Shot",
isHierarchical: false,
},
Expand All @@ -87,4 +94,18 @@ export type CustomAttributeConfigurationName =
export type CustomAttributeConfigurationLabel =
CustomAttributeConfiguration["label"];

export function getTypes() {
return [] as const;
}

export type Type = ReturnType<typeof getTypes>[number];
export type TypeName = Type["name"];

export function getObjectTypes() {
return [] as const;
}

export type ObjectType = ReturnType<typeof getObjectTypes>[number];
export type ObjectTypeName = ObjectType["name"];

// Errors:
14 changes: 14 additions & 0 deletions source/__snapshots__/default-ftrack-schema.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1434,4 +1434,18 @@ export type CustomAttributeConfigurationName =
export type CustomAttributeConfigurationLabel =
CustomAttributeConfiguration["label"];

export function getTypes() {
return [] as const;
}

export type Type = ReturnType<typeof getTypes>[number];
export type TypeName = Type["name"];

export function getObjectTypes() {
return [] as const;
}

export type ObjectType = ReturnType<typeof getObjectTypes>[number];
export type ObjectTypeName = ObjectType["name"];

// Errors:
155 changes: 155 additions & 0 deletions source/__snapshots__/default-object-types.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

export interface TypedContext<
K extends TypedContextSubtype = TypedContextSubtype
> {
__entity_type__?: K;
__permissions?: Record<string, any>;
}
export interface BasicLink {
id: string;
type: string;
name: string;
}
export interface EntityTypeMap {
TypedContext: TypedContext;
}
export type EntityType = keyof EntityTypeMap;
export type EntityData<TEntityType extends EntityType = EntityType> =
EntityTypeMap[TEntityType];
export interface TypedContextSubtypeMap {
TypedContext: TypedContext;
}
export type TypedContextSubtype = keyof TypedContextSubtypeMap;
export function getAttributeConfigurations() {
return [] as const;
}

export type CustomAttributeConfiguration = ReturnType<
typeof getAttributeConfigurations
>[number];
export type CustomAttributeConfigurationName =
CustomAttributeConfiguration["name"];
export type CustomAttributeConfigurationLabel =
CustomAttributeConfiguration["label"];

export function getTypes() {
return [] as const;
}

export type Type = ReturnType<typeof getTypes>[number];
export type TypeName = Type["name"];

export function getObjectTypes() {
return [
{
name: "Folder",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: false,
is_schedulable: false,
is_prioritizable: true,
is_leaf: false,
},
{
name: "Asset Build",
is_time_reportable: false,
is_taskable: true,
is_typeable: true,
is_statusable: true,
is_schedulable: false,
is_prioritizable: true,
is_leaf: false,
},
{
name: "Episode",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: true,
is_schedulable: false,
is_prioritizable: true,
is_leaf: false,
},
{
name: "Scene",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: true,
is_schedulable: false,
is_prioritizable: false,
is_leaf: false,
},
{
name: "Sequence",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: false,
is_schedulable: false,
is_prioritizable: true,
is_leaf: false,
},
{
name: "Shot",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: true,
is_schedulable: false,
is_prioritizable: true,
is_leaf: false,
},
{
name: "Milestone",
is_time_reportable: false,
is_taskable: false,
is_typeable: true,
is_statusable: true,
is_schedulable: true,
is_prioritizable: true,
is_leaf: true,
},
{
name: "Task",
is_time_reportable: true,
is_taskable: false,
is_typeable: true,
is_statusable: true,
is_schedulable: true,
is_prioritizable: true,
is_leaf: true,
},
{
name: "Image",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: false,
is_schedulable: false,
is_prioritizable: false,
is_leaf: false,
},
{
name: "Information",
is_time_reportable: false,
is_taskable: true,
is_typeable: false,
is_statusable: false,
is_schedulable: false,
is_prioritizable: false,
is_leaf: false,
},
] as const;
}

export type ObjectType = ReturnType<typeof getObjectTypes>[number];
export type ObjectTypeName = ObjectType["name"];

// Errors:
Loading

0 comments on commit 0db6604

Please sign in to comment.