blockprotocol
Advanced tools
Comparing version 0.0.8 to 0.0.9
173
core.d.ts
// ---------------------------- UTILITIES ----------------------------- // | ||
type DistributedOmit<T, K extends PropertyKey> = T extends T | ||
? Omit<T, K> | ||
: never; | ||
type UnknownRecord = Record<string, unknown>; | ||
@@ -124,8 +120,5 @@ | ||
accountId?: string | null; | ||
links?: DistributedOmit< | ||
links?: Omit< | ||
BlockProtocolCreateLinksAction, | ||
| "sourceAccountId" | ||
| "sourceEntityId" | ||
| "sourceEntityTypeId" | ||
| "sourceEntityVersionId" | ||
"sourceAccountId" | "sourceEntityId" | "sourceEntityTypeId" | ||
>[]; | ||
@@ -175,2 +168,10 @@ }; | ||
export type BlockProtocolFilterOperatorType = | ||
| BlockProtocolFilterOperatorRequiringValue | ||
| BlockProtocolFilterOperatorWithoutValue; | ||
export type BlockProtocolFilterOperatorWithoutValue = | ||
| "IS_EMPTY" | ||
| "IS_NOT_EMPTY"; | ||
export type BlockProtocolFilterOperatorRequiringValue = | ||
| "CONTAINS" | ||
@@ -181,5 +182,3 @@ | "DOES_NOT_CONTAIN" | ||
| "STARTS_WITH" | ||
| "ENDS_WITH" | ||
| "IS_EMPTY" | ||
| "IS_NOT_EMPTY"; | ||
| "ENDS_WITH"; | ||
@@ -189,15 +188,20 @@ export type BlockProtocolMultiFilterOperatorType = "AND" | "OR"; | ||
export type BlockProtocolMultiFilter = { | ||
filters: { | ||
field: string; | ||
operator: BlockProtocolFilterOperatorType; | ||
value: string; | ||
}[]; | ||
filters: ( | ||
| { | ||
field: string; | ||
operator: BlockProtocolFilterOperatorRequiringValue; | ||
value: string; | ||
} | ||
| { field: string; operator: BlockProtocolFilterOperatorWithoutValue } | ||
)[]; | ||
operator: BlockProtocolMultiFilterOperatorType; | ||
}; | ||
export type BlockProtocolMultiSort = { | ||
export type BlockProtocolSort = { | ||
field: string; | ||
desc?: boolean | undefined | null; | ||
}[]; | ||
}; | ||
export type BlockProtocolMultiSort = BlockProtocolSort[]; | ||
export type BlockProtocolAggregateOperationInput = { | ||
@@ -256,12 +260,2 @@ entityTypeId?: string | null; | ||
type SingleTargetLinkFields = { | ||
destinationEntityId: string; | ||
destinationEntityTypeId?: string | null; | ||
destinationEntityVersionId?: string | null; | ||
}; | ||
type AggregationTargetLinkFields = { | ||
operation: BlockProtocolAggregateOperationInput; | ||
}; | ||
export type BlockProtocolLink = { | ||
@@ -272,7 +266,8 @@ linkId: string; | ||
sourceEntityTypeId?: string | null; | ||
sourceEntityVersionId?: string | null; | ||
destinationAccountId?: string | null; | ||
destinationEntityId: string; | ||
destinationEntityTypeId?: string | null; | ||
index?: number | null; | ||
path: string; | ||
} & (SingleTargetLinkFields | AggregationTargetLinkFields); | ||
}; | ||
@@ -282,3 +277,2 @@ export type BlockProtocolLinkGroup = { | ||
sourceEntityId: string; | ||
sourceEntityVersionId?: string | null; | ||
sourceEntityTypeId?: string | null; | ||
@@ -289,10 +283,2 @@ path: string; | ||
export type BlockProtocolLinkedAggregation = { | ||
sourceAccountId?: string | null; | ||
sourceEntityId: string; | ||
sourceEntityVersionId?: string | null; | ||
sourceEntityTypeId?: string | null; | ||
path: string; | ||
} & BlockProtocolAggregateEntitiesResult<BlockProtocolEntity>; | ||
export type BlockProtocolGetLinkAction = { | ||
@@ -306,6 +292,3 @@ linkId: string; | ||
export type BlockProtocolCreateLinksAction = DistributedOmit< | ||
BlockProtocolLink, | ||
"linkId" | ||
>; | ||
export type BlockProtocolCreateLinksAction = Omit<BlockProtocolLink, "linkId">; | ||
@@ -316,10 +299,7 @@ export type BlockProtocolCreateLinksFunction = { | ||
export type BlockProtocolUpdateLinksAction = | ||
| { linkId: string; data: Pick<BlockProtocolLink, "index"> } | ||
| ({ | ||
// temporary identifiers for LinkedAggregations - to be replaced with a single id | ||
sourceAccountId?: string | null; | ||
sourceEntityId: string; | ||
path: string; | ||
} & { data: BlockProtocolAggregateOperationInput }); | ||
export type BlockProtocolUpdateLinksAction = { | ||
sourceAccountId?: string | null; | ||
linkId: string; | ||
data: Pick<BlockProtocolLink, "index">; | ||
}; | ||
@@ -332,3 +312,2 @@ export type BlockProtocolUpdateLinksFunction = { | ||
sourceAccountId?: string | null; | ||
sourceEntityId?: string | null; | ||
linkId: string; | ||
@@ -341,2 +320,67 @@ }; | ||
// ---------------------- LINKED AGGREGATIONS ------------------------- // | ||
export type BlockProtocolLinkedAggregationDefinition = { | ||
aggregationId: string; | ||
sourceAccountId?: string | null; | ||
sourceEntityId: string; | ||
sourceEntityTypeId?: string | null; | ||
path: string; | ||
operation: BlockProtocolAggregateOperationInput; | ||
}; | ||
export type BlockProtocolLinkedAggregation = Omit< | ||
BlockProtocolLinkedAggregationDefinition, | ||
"operation" | ||
> & | ||
BlockProtocolAggregateEntitiesResult<BlockProtocolEntity>; | ||
export type BlockProtocolGetLinkedAggregationAction = { | ||
sourceAccountId?: string | null; | ||
aggregationId: string; | ||
}; | ||
export type BlockProtocolGetLinkedAggregationsFunction = { | ||
(actions: BlockProtocolGetLinkedAggregationAction[]): Promise< | ||
BlockProtocolLinkedAggregation[] | ||
>; | ||
}; | ||
export type BlockProtocolCreateLinkedAggregationAction = Omit< | ||
BlockProtocolLinkedAggregationDefinition, | ||
"aggregationId" | ||
>; | ||
export type BlockProtocolCreateLinkedAggregationsFunction = { | ||
(actions: BlockProtocolCreateLinkedAggregationAction[]): Promise< | ||
BlockProtocolLinkedAggregationDefinition[] | ||
>; | ||
}; | ||
export type BlockProtocolUpdateLinkedAggregationActionFragment = { | ||
sourceAccountId?: string | null; | ||
aggregationId: string; | ||
}; | ||
export type BlockProtocolUpdateLinkedAggregationAction = { | ||
sourceAccountId?: string | null; | ||
aggregationId: string; | ||
operation: BlockProtocolLinkedAggregationDefinition["operation"]; | ||
}; | ||
export type BlockProtocolUpdateLinkedAggregationsFunction = { | ||
(actions: BlockProtocolUpdateLinkedAggregationAction[]): Promise< | ||
BlockProtocolLinkedAggregationDefinition[] | ||
>; | ||
}; | ||
export type BlockProtocolDeleteLinkedAggregationAction = { | ||
sourceAccountId?: string | null; | ||
aggregationId: string; | ||
}; | ||
export type BlockProtocolDeleteLinkedAggregationsFunction = { | ||
(actions: BlockProtocolDeleteLinkedAggregationAction[]): Promise<boolean[]>; | ||
}; | ||
// ------------------------- ENTITY TYPES ----------------------------- // | ||
@@ -346,3 +390,3 @@ | ||
accountId?: string | null; | ||
entityTypeId: string; | ||
entityTypeId: string; // @todo consider removing this and just using $id, the URI | ||
$id: string; | ||
@@ -357,3 +401,3 @@ $schema: string; | ||
accountId?: string | null; | ||
schema: JSONObject; | ||
schema: JSONObject; // @todo should this be an Omit<BlockProtocolEntityType, "entityTypeId" | "$id">? | ||
}; | ||
@@ -372,3 +416,3 @@ | ||
includeOtherTypesInUse?: boolean | null; | ||
operation?: DistributedOmit< | ||
operation?: Omit< | ||
BlockProtocolAggregateOperationInput, | ||
@@ -425,11 +469,15 @@ "entityTypeId" | "entityTypeVersionId" | ||
| BlockProtocolCreateLinksFunction | ||
| BlockProtocolCreateLinkedAggregationsFunction | ||
| BlockProtocolGetEntitiesFunction | ||
| BlockProtocolGetEntityTypesFunction | ||
| BlockProtocolGetLinksFunction | ||
| BlockProtocolGetLinkedAggregationsFunction | ||
| BlockProtocolDeleteEntitiesFunction | ||
| BlockProtocolDeleteEntityTypesFunction | ||
| BlockProtocolDeleteLinksFunction | ||
| BlockProtocolDeleteLinkedAggregationsFunction | ||
| BlockProtocolUpdateEntitiesFunction | ||
| BlockProtocolUpdateEntityTypesFunction | ||
| BlockProtocolUpdateLinksFunction | ||
| BlockProtocolUpdateLinkedAggregationsFunction | ||
| BlockProtocolUploadFileFunction; | ||
@@ -455,2 +503,15 @@ | ||
getLinkedAggregations?: | ||
| BlockProtocolGetLinkedAggregationsFunction | ||
| undefined; | ||
createLinkedAggregations?: | ||
| BlockProtocolCreateLinkedAggregationsFunction | ||
| undefined; | ||
deleteLinkedAggregations?: | ||
| BlockProtocolDeleteLinkedAggregationsFunction | ||
| undefined; | ||
updateLinkedAggregations?: | ||
| BlockProtocolUpdateLinkedAggregationsFunction | ||
| undefined; | ||
uploadFile?: BlockProtocolUploadFileFunction | undefined; | ||
@@ -457,0 +518,0 @@ }; |
{ | ||
"name": "blockprotocol", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "TypeScript typings for https://blockprotocol.org developers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# [Block Protocol](https://blockprotocol.org) | ||
`yarn add blockprotocol` | ||
Current version of this package only provides TypeScript types. | ||
@@ -4,0 +6,0 @@ Watch https://github.com/blockprotocol/blockprotocol for the updates! |
16418
450
14