-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/content-releases
- Loading branch information
Showing
8 changed files
with
116 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/core/types/src/modules/entity-service/params/attributes/id.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import type { Entity } from '../../../../types'; | ||
|
||
export type ID = Entity.ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/core/types/src/modules/entity-service/params/attributes/literals.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Attribute } from '../../../../types'; | ||
|
||
export type BooleanValue = boolean | 'true' | 'false' | 't' | 'f' | '1' | '0' | 1 | 0; | ||
|
||
export type NumberValue = string | number; | ||
|
||
export type DateValue = Attribute.DateValue | number; | ||
|
||
export type TimeValue = Attribute.TimeValue | number; | ||
|
||
export type DateTimeValue = Attribute.DateTimeValue | number; | ||
|
||
export type TimeStampValue = Attribute.TimestampValue; |
42 changes: 42 additions & 0 deletions
42
packages/core/types/src/modules/entity-service/params/attributes/relation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { Attribute, Common, Utils } from '../../../../types'; | ||
import type { ID } from './id'; | ||
|
||
type ShortHand = ID; | ||
type LongHand = { id: ID }; | ||
|
||
interface PositionalArguments { | ||
before?: ID; | ||
after?: ID; | ||
start?: boolean; | ||
end?: boolean; | ||
} | ||
|
||
type WithPositionArguments<T> = T & PositionalArguments; | ||
|
||
type Set = { set: ShortHand[] | LongHand[] | null }; | ||
type Connect = { connect: ShortHand[] | WithPositionArguments<LongHand>[] }; | ||
type Disconnect = { disconnect: ShortHand[] | LongHand[] }; | ||
|
||
type FullUpdate = Set; | ||
type PartialUpdate = Partial<Connect & Disconnect>; | ||
|
||
type XOneInput = ShortHand | LongHand | null; | ||
type XManyInput = ShortHand[] | LongHand[] | null | PartialUpdate | FullUpdate; | ||
|
||
type RelationInputValue<TRelationKind extends Attribute.RelationKind.Any> = Utils.Expression.If< | ||
Attribute.IsManyRelation<TRelationKind>, | ||
XManyInput, | ||
XOneInput | ||
>; | ||
|
||
type RelationsKeysWithoutTarget<TSchemaUID extends Common.UID.Schema> = Exclude< | ||
Attribute.GetKeysByType<TSchemaUID, 'relation'>, | ||
Attribute.GetKeysWithTarget<TSchemaUID> | ||
>; | ||
|
||
type OmitRelationsWithoutTarget<TSchemaUID extends Common.UID.Schema, TValue> = Omit< | ||
TValue, | ||
RelationsKeysWithoutTarget<TSchemaUID> | ||
>; | ||
|
||
export type { RelationInputValue, RelationsKeysWithoutTarget, OmitRelationsWithoutTarget }; |
20 changes: 20 additions & 0 deletions
20
packages/core/types/src/modules/entity-service/params/attributes/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { Attribute, Common, Utils } from '../../../../types'; | ||
|
||
export type NonFilterableKind = Extract<Attribute.Kind, 'password' | 'dynamiczone'>; | ||
export type FilterableKind = Exclude<Attribute.Kind, NonFilterableKind>; | ||
|
||
export type GetNonFilterableKeys<TSchemaUID extends Common.UID.Schema> = Utils.Object.KeysBy< | ||
Attribute.GetAll<TSchemaUID>, | ||
Attribute.OfType<NonFilterableKind>, | ||
string | ||
>; | ||
|
||
export type GetScalarKeys<TSchemaUID extends Common.UID.Schema> = Exclude< | ||
Attribute.GetKeysByType<TSchemaUID, Attribute.NonPopulatableKind>, | ||
GetNonFilterableKeys<TSchemaUID> | ||
>; | ||
|
||
export type GetNestedKeys<TSchemaUID extends Common.UID.Schema> = Exclude< | ||
Attribute.GetKeysWithTarget<TSchemaUID>, | ||
GetNonFilterableKeys<TSchemaUID> | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters