-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2,487 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = tab | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[package.json] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
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 @@ | ||
/test-d/ |
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,61 @@ | ||
declare const __base: unique symbol | ||
declare const __name: unique symbol | ||
declare const __nonNull: unique symbol | ||
declare const __reference: unique symbol | ||
|
||
type Brand< | ||
Base, | ||
Name extends string | ||
> = { | ||
[__base]: Base | ||
[__name]: Name | ||
} | ||
|
||
type GraphQLBrand< | ||
Base, | ||
Name extends string, | ||
NonNull extends boolean = false, | ||
Reference extends boolean = false | ||
> = { | ||
[__base]: Base | ||
[__name]: Name | ||
[__nonNull]: NonNull | ||
[__reference]: Reference | ||
} | ||
|
||
export type JustBrand = Brand<any, string> | ||
export type AnyGraphQLBrand = GraphQLBrand<any, string, boolean, boolean> | ||
|
||
export type Branded< | ||
Base, | ||
Name extends string, | ||
> = Base & Brand<Base, Name> | ||
|
||
export type GraphQLBranded< | ||
Base, | ||
Name extends string, | ||
NonNull extends boolean = false, | ||
Reference extends boolean = false | ||
> = Base & GraphQLBrand<Base, Name, NonNull, Reference> | ||
|
||
export type GetBase<T> = T extends Brand<infer Base, any> ? Base : never | ||
export type GetName<T> = T extends Brand<any, infer Name> ? Name : never | ||
|
||
// export type GetBase<T> = T extends GraphQLBrand<infer Base, any, any, any> ? Base : never | ||
// export type GetName<T> = T extends GraphQLBrand<any, infer Name, any, any> ? Name : never | ||
|
||
export type GetNonNull<T> = T extends GraphQLBrand<any, any, infer NonNull, any> ? NonNull : never | ||
export type GetReference<T> = T extends GraphQLBrand<any, any, any, infer Reference> ? Reference : never | ||
|
||
export declare type NonNull<T> = GraphQLBranded<GetBase<T>, GetName<T>, true, GetReference<T>> | ||
export declare type Reference<T> = GraphQLBranded<GetBase<T>, GetName<T>, GetNonNull<T>, true> | ||
|
||
// export type BrandBuilder<T extends Branded<Base, any>, Base = BrandBase<T>> = { | ||
// check: (value: Base) => value is T | ||
// assert: (value: Base) => asserts value is T | ||
// from: (value: Base) => T | ||
// } | ||
|
||
// export type BrandBuilderOptions<Base> = { | ||
// validate?: (value: Base) => boolean | string | ||
// } |
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,50 @@ | ||
export declare enum GuillotineBuiltinEnumTypeName { | ||
ComponentType = 'ComponentType', | ||
FormItemType = 'FormItemType', | ||
MediaIntentType = 'MediaIntentType', | ||
Permission = 'Permission', | ||
PrincipalType = 'PrincipalType', | ||
} | ||
|
||
export declare type GuillotineBuiltinEnumTypeNames = keyof typeof GuillotineBuiltinEnumTypeName | ||
|
||
//────────────────────────────────────────────────────────────────────────────── | ||
// Each of the keys in GuillotineBuiltinEnumTypeName must be implemented below | ||
// And each of the enum names below should be in GuillotineBuiltinEnumTypeName | ||
//────────────────────────────────────────────────────────────────────────────── | ||
export declare enum ComponentType { | ||
page = 'page', | ||
layout = 'layout', | ||
image = 'image', | ||
part = 'part', | ||
text = 'text', | ||
fragment = 'fragment', | ||
} | ||
|
||
export declare enum FormItemType { | ||
ItemSet = 'ItemSet', | ||
Layout = 'Layout', | ||
Input = 'Input', | ||
OptionSet = 'OptionSet', | ||
} | ||
|
||
export declare enum MediaIntentType { | ||
download = 'download', | ||
inline = 'inline', | ||
} | ||
|
||
export declare enum Permission { | ||
READ = 'READ', | ||
CREATE = 'CREATE', | ||
MODIFY = 'MODIFY', | ||
DELETE = 'DELETE', | ||
PUBLISH = 'PUBLISH', | ||
READ_PERMISSIONS = 'READ_PERMISSIONS', | ||
WRITE_PERMISSIONS = 'WRITE_PERMISSIONS', | ||
} | ||
|
||
export declare enum PrincipalType { | ||
user = 'user', | ||
group = 'group', | ||
role = 'role', | ||
} |
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,85 @@ | ||
import type { | ||
NonNull, | ||
} from './Branded'; | ||
import type { | ||
// GraphQLBoolean, | ||
// GraphQLDate, | ||
// GraphQLDateTime, | ||
GraphQLFloat, | ||
GraphQLID, | ||
// GraphQLInt, | ||
// GraphQLJson, | ||
// GraphQLLocalDateTime, | ||
// GraphQLLocalTime, | ||
GraphQLString, | ||
} from './GraphQL'; | ||
import { | ||
GuillotineBuiltinObjectTypeName | ||
} from './ObjectTypes'; | ||
import { | ||
GraphQLContent, | ||
GraphQLmedia_Image, | ||
} from './Schema'; | ||
|
||
|
||
declare global { | ||
interface GraphQLInputTypesMap { | ||
[inputTypeName: string]: unknown | ||
} | ||
interface GraphQLObjectTypesMap { | ||
// Date: GraphQLDate | ||
// DateTime: GraphQLDateTime | ||
// Json: GraphQLJson | ||
// GraphQLBoolean: GraphQLBoolean | ||
// GraphQLFloat: GraphQLFloat | ||
// GraphQLID: GraphQLID | ||
// GraphQLInt: GraphQLInt | ||
// GraphQLString: GraphQLString | ||
// LocalDateTime: GraphQLLocalDateTime | ||
// LocalTime: GraphQLLocalTime | ||
[GuillotineBuiltinObjectTypeName.Content]: GraphQLContent | ||
[GuillotineBuiltinObjectTypeName.media_Image]: GraphQLmedia_Image | ||
[typeName: string]: unknown | ||
} | ||
interface GraphQLObjectTypeFieldsMap { | ||
// [typeName: string]: string[] | ||
// [GuillotineObjectTypeName.Content]: { | ||
// _id: NonNull<GraphQLID> | ||
// _name: NonNull<GraphQLString> | ||
// _path: NonNull<GraphQLString> | ||
// //_references: GraphQLContent[] | ||
// _score: GraphQLFloat | ||
// creator: PrincipalKey | ||
// modifier: PrincipalKey | ||
// createdTime: GraphQLDateTime | ||
// modifiedTime: GraphQLDateTime | ||
// owner: PrincipalKey | ||
// type: String | ||
// contentType: ContentType | ||
// displayName: String | ||
// hasChildren: Boolean | ||
// language: String | ||
// valid: Boolean | ||
// dataAsJson: JSON | ||
// x: ExtraData | ||
// xAsJson: JSON | ||
// pageAsJson: JSON | ||
// pageTemplate: Content | ||
// components: [Component] | ||
// attachments: [Attachment] | ||
// publish: PublishInfo | ||
// pageUrl: String | ||
// site: portal_Site | ||
// parent: Content | ||
// children: [Content] | ||
// childrenConnection: ContentConnection | ||
// permissions: Permissions | ||
// } | ||
[typeName: string]: { | ||
[fieldName: string]: unknown // TODO | ||
} | ||
} | ||
} // global | ||
|
||
|
||
export {} |
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,62 @@ | ||
/// <reference path="./Global.Modifying.d.ts"/> | ||
|
||
|
||
import type { | ||
GraphQLBranded, | ||
NonNull, | ||
Reference, | ||
} from './Branded' | ||
import type {ValueOf} from './Utils' | ||
|
||
|
||
export declare type GraphQLBoolean = GraphQLBranded<boolean, 'GraphQLBoolean'> | ||
export declare type GraphQLDate = GraphQLBranded<string, 'Date'> | ||
export declare type GraphQLDateTime = GraphQLBranded<string, 'DateTime'> | ||
export declare type GraphQLFloat = GraphQLBranded<number, 'GraphQLFloat'> | ||
export declare type GraphQLID = GraphQLBranded<string, 'GraphQLID'> | ||
export declare type GraphQLInt = GraphQLBranded<number, 'GraphQLInt'> | ||
export declare type GraphQLJson = GraphQLBranded<string, 'Json'> | ||
export declare type GraphQLLocalDateTime = GraphQLBranded<string, 'LocalDateTime'> | ||
export declare type GraphQLLocalTime = GraphQLBranded<string, 'LocalTime'> | ||
export declare type GraphQLString = GraphQLBranded<string, 'GraphQLString'> | ||
|
||
export declare type GraphQLNonNull< | ||
GraphQLObjectType extends ValueOf<GraphQLObjectTypesMap> | ||
> = NonNull<GraphQLObjectType> | ||
|
||
export declare type GraphQLReference< | ||
GraphQLObjectType extends ValueOf<GraphQLObjectTypesMap> | ||
> = Reference<GraphQLObjectType> | ||
|
||
export declare interface GraphQLBaseScalars { | ||
GraphQLBoolean: GraphQLBoolean | ||
GraphQLFloat: GraphQLFloat | ||
GraphQLID: GraphQLID | ||
GraphQLInt: GraphQLInt | ||
GraphQLString: GraphQLString | ||
} | ||
|
||
export declare interface GraphQLExtendedScalars { | ||
Date: GraphQLDate | ||
DateTime: GraphQLDateTime | ||
Json: GraphQLJson | ||
} | ||
|
||
export declare interface GraphQLCustomScalars { | ||
LocalDateTime: GraphQLLocalDateTime | ||
LocalTime: GraphQLLocalTime | ||
} | ||
|
||
export declare interface GraphQLScalars | ||
extends GraphQLBaseScalars, GraphQLExtendedScalars, GraphQLCustomScalars {} | ||
|
||
export declare type GraphQLArgs = Record<string, | ||
| GraphQLScalars | ||
| GraphQLInputType | ||
> | ||
|
||
export declare type GraphQLInputType = ValueOf<GraphQLInputTypesMap> | ||
export declare type GraphQLInputTypeName = keyof GraphQLInputTypesMap | ||
|
||
export declare type GraphQLObjectType = ValueOf<GraphQLObjectTypesMap> | ||
export declare type GraphQLObjectTypeName = keyof GraphQLObjectTypesMap |
Oops, something went wrong.