@player-tools/xlr 0.0.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.cjs.js +3 -0
- package/dist/index.d.ts +208 -0
- package/dist/index.esm.js +2 -0
- package/package.json +31 -0
- package/src/core.ts +253 -0
- package/src/index.ts +2 -0
- package/src/utility.ts +30 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
interface Annotations {
|
|
2
|
+
/** The name used to reference this type */
|
|
3
|
+
name?: string;
|
|
4
|
+
/** The path within a type to this type (may be the same as `name` ) */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** The JSDoc string for this type */
|
|
7
|
+
description?: string;
|
|
8
|
+
/** The JSDoc `@example` string for this type */
|
|
9
|
+
examples?: string | Array<string>;
|
|
10
|
+
/** The JSDoc `@default` string for this type */
|
|
11
|
+
default?: string;
|
|
12
|
+
/** The JSDoc `@see` string for this type */
|
|
13
|
+
see?: string | Array<string>;
|
|
14
|
+
/** The Typescript comment associated with the type */
|
|
15
|
+
comment?: string;
|
|
16
|
+
}
|
|
17
|
+
interface TypeMap {
|
|
18
|
+
/** */
|
|
19
|
+
and: void;
|
|
20
|
+
/** */
|
|
21
|
+
or: void;
|
|
22
|
+
/** */
|
|
23
|
+
ref: string;
|
|
24
|
+
/** */
|
|
25
|
+
any: unknown;
|
|
26
|
+
/** */
|
|
27
|
+
null: null;
|
|
28
|
+
/** */
|
|
29
|
+
string: string;
|
|
30
|
+
/** */
|
|
31
|
+
number: number;
|
|
32
|
+
/** */
|
|
33
|
+
boolean: boolean;
|
|
34
|
+
/** */
|
|
35
|
+
object: object;
|
|
36
|
+
/** */
|
|
37
|
+
array: Array<unknown>;
|
|
38
|
+
/** */
|
|
39
|
+
tuple: Array<unknown>;
|
|
40
|
+
/** */
|
|
41
|
+
function: () => unknown;
|
|
42
|
+
/** */
|
|
43
|
+
record: Record<string | number | symbol, unknown>;
|
|
44
|
+
/** */
|
|
45
|
+
undefined: undefined;
|
|
46
|
+
/** */
|
|
47
|
+
never: never;
|
|
48
|
+
/** */
|
|
49
|
+
unknown: unknown;
|
|
50
|
+
}
|
|
51
|
+
interface Const<T> {
|
|
52
|
+
/** The literal value for the node */
|
|
53
|
+
const?: T;
|
|
54
|
+
}
|
|
55
|
+
interface Enum<T> {
|
|
56
|
+
/** The list of enums for the node */
|
|
57
|
+
enum?: Array<T>;
|
|
58
|
+
}
|
|
59
|
+
declare type CommonTypeInfo<T> = Const<T> & Enum<T>;
|
|
60
|
+
interface TypeNode<Name = string> {
|
|
61
|
+
/** The type of Node */
|
|
62
|
+
type: Name;
|
|
63
|
+
}
|
|
64
|
+
declare type AnyType = TypeNode<'any'> & CommonTypeInfo<any> & Annotations;
|
|
65
|
+
declare type UnknownType = TypeNode<'unknown'> & CommonTypeInfo<unknown> & Annotations;
|
|
66
|
+
declare type UndefinedType = TypeNode<'undefined'> & CommonTypeInfo<undefined> & Annotations;
|
|
67
|
+
declare type NullType = TypeNode<'null'> & CommonTypeInfo<null> & Annotations;
|
|
68
|
+
declare type StringType = TypeNode<'string'> & CommonTypeInfo<string> & Annotations;
|
|
69
|
+
declare type NumberType = TypeNode<'number'> & CommonTypeInfo<number> & Annotations;
|
|
70
|
+
declare type BooleanType = TypeNode<'boolean'> & CommonTypeInfo<boolean> & Annotations;
|
|
71
|
+
declare type NeverType = TypeNode<'never'> & CommonTypeInfo<never> & Annotations;
|
|
72
|
+
interface RefNode extends TypeNode<'ref'> {
|
|
73
|
+
/** Name of the referenced Type */
|
|
74
|
+
ref: string;
|
|
75
|
+
/** Parameters to potentially fill in a generic when it is resolved. Position is preserved */
|
|
76
|
+
genericArguments?: Array<NodeType>;
|
|
77
|
+
}
|
|
78
|
+
declare type RefType = RefNode & Annotations;
|
|
79
|
+
interface ObjectProperty {
|
|
80
|
+
/** If this property is required */
|
|
81
|
+
required: boolean;
|
|
82
|
+
/** The type of the property */
|
|
83
|
+
node: NodeType;
|
|
84
|
+
}
|
|
85
|
+
interface ObjectNode extends TypeNode<'object'> {
|
|
86
|
+
/** the properties associated with an object */
|
|
87
|
+
properties: {
|
|
88
|
+
[name: string]: ObjectProperty;
|
|
89
|
+
};
|
|
90
|
+
/** What type, if any, of additional properties are allowed on the object */
|
|
91
|
+
additionalProperties: false | NodeType;
|
|
92
|
+
}
|
|
93
|
+
declare type ObjectType = ObjectNode & CommonTypeInfo<object> & Annotations;
|
|
94
|
+
interface ArrayNode extends TypeNode<'array'> {
|
|
95
|
+
/** What types are allowed in the array */
|
|
96
|
+
elementType: NodeType;
|
|
97
|
+
}
|
|
98
|
+
declare type ArrayType<T = unknown> = ArrayNode & CommonTypeInfo<Array<T>> & Annotations;
|
|
99
|
+
interface ConditionalNode extends TypeNode<'conditional'> {
|
|
100
|
+
/** The check arguments */
|
|
101
|
+
check: {
|
|
102
|
+
/** operator */
|
|
103
|
+
left: NodeType;
|
|
104
|
+
/** operand */
|
|
105
|
+
right: NodeType;
|
|
106
|
+
};
|
|
107
|
+
/** The resulting values to use */
|
|
108
|
+
value: {
|
|
109
|
+
/** If the conditional is true */
|
|
110
|
+
true: NodeType;
|
|
111
|
+
/** If the conditional is false */
|
|
112
|
+
false: NodeType;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
declare type ConditionalType = ConditionalNode & Annotations;
|
|
116
|
+
interface TupleNode extends TypeNode<'tuple'> {
|
|
117
|
+
/** The types in the tuple */
|
|
118
|
+
elementTypes: Array<NodeType>;
|
|
119
|
+
/** The minimum number of items */
|
|
120
|
+
minItems: number;
|
|
121
|
+
/** What, if any, additional types can be provided */
|
|
122
|
+
additionalItems: false | NodeType;
|
|
123
|
+
}
|
|
124
|
+
declare type TupleType<T extends unknown[] = unknown[]> = TupleNode & CommonTypeInfo<T> & Annotations;
|
|
125
|
+
declare type AndType = TypeNode<'and'> & Annotations & {
|
|
126
|
+
/** Nodes in intersection */
|
|
127
|
+
and: NodeType[];
|
|
128
|
+
};
|
|
129
|
+
declare type OrType = TypeNode<'or'> & Annotations & {
|
|
130
|
+
/** Nodes in the union */
|
|
131
|
+
or: NodeType[];
|
|
132
|
+
};
|
|
133
|
+
declare type TemplateLiteralType = TypeNode<'template'> & Annotations & {
|
|
134
|
+
/** String version of regex used to validate template */
|
|
135
|
+
format: string;
|
|
136
|
+
};
|
|
137
|
+
declare type RecordType = TypeNode<'record'> & Annotations & {
|
|
138
|
+
/** Key types for the Record */
|
|
139
|
+
keyType: NodeType;
|
|
140
|
+
/** Value types for the Record */
|
|
141
|
+
valueType: NodeType;
|
|
142
|
+
};
|
|
143
|
+
declare type FunctionTypeParameters = {
|
|
144
|
+
/** String name of the function parameter */
|
|
145
|
+
name: string;
|
|
146
|
+
/** The type constraint of the parameter */
|
|
147
|
+
type: NodeType;
|
|
148
|
+
/** Indicates that the parameter is optional */
|
|
149
|
+
optional?: true;
|
|
150
|
+
/** Default value for the parameter if nothing is supplied */
|
|
151
|
+
default?: NodeType;
|
|
152
|
+
};
|
|
153
|
+
declare type FunctionType = TypeNode<'function'> & Annotations & {
|
|
154
|
+
/** Types for the parameters, in order, for the function */
|
|
155
|
+
parameters: Array<FunctionTypeParameters>;
|
|
156
|
+
/** Return type of the function */
|
|
157
|
+
returnType?: NodeType;
|
|
158
|
+
};
|
|
159
|
+
/** Primitive Type Nodes */
|
|
160
|
+
declare type PrimitiveTypes = NeverType | NullType | StringType | NumberType | BooleanType | AnyType | UnknownType | UndefinedType;
|
|
161
|
+
/** Set of all Node Types */
|
|
162
|
+
declare type NodeType = AnyType | UnknownType | UndefinedType | NullType | NeverType | StringType | TemplateLiteralType | NumberType | BooleanType | ObjectType | ArrayType | TupleType | RecordType | AndType | OrType | RefType | FunctionType | ConditionalType;
|
|
163
|
+
declare type NamedType<T extends NodeType = NodeType> = T & {
|
|
164
|
+
/** Name of the exported interface/type */
|
|
165
|
+
name: string;
|
|
166
|
+
/** File the type was exported from */
|
|
167
|
+
source: string;
|
|
168
|
+
};
|
|
169
|
+
interface ParamTypeNode {
|
|
170
|
+
/** Symbol used to identify the generic in the interface/type */
|
|
171
|
+
symbol: string;
|
|
172
|
+
/** The type constraint for the generic */
|
|
173
|
+
constraints?: NodeType;
|
|
174
|
+
/** The default value for the generic if no value is provided */
|
|
175
|
+
default?: NodeType;
|
|
176
|
+
}
|
|
177
|
+
declare type NamedTypeWithGenerics<T extends NodeType = NodeType> = NamedType<T> & {
|
|
178
|
+
/** Generics for the Named Type that need to be filled in */
|
|
179
|
+
genericTokens: Array<ParamTypeNode>;
|
|
180
|
+
};
|
|
181
|
+
declare type NodeTypeWithGenerics<T extends NodeType = NodeType> = T & {
|
|
182
|
+
/** Generics for the Node that need to be filled in */
|
|
183
|
+
genericTokens: Array<ParamTypeNode>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
declare type TransformFunction = (input: NamedType<NodeType>, capabilityType: string) => void;
|
|
187
|
+
interface Capability {
|
|
188
|
+
/** Name of the capability that is provided to Player */
|
|
189
|
+
name: string;
|
|
190
|
+
/** List of XLRs that are provided for the Capability */
|
|
191
|
+
provides: Array<string>;
|
|
192
|
+
}
|
|
193
|
+
interface Manifest {
|
|
194
|
+
/** Name of the plugin */
|
|
195
|
+
pluginName: string;
|
|
196
|
+
/** Map of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
197
|
+
capabilities?: Map<string, Array<string>>;
|
|
198
|
+
}
|
|
199
|
+
interface TSManifest {
|
|
200
|
+
/** Name of the plugin */
|
|
201
|
+
pluginName: string;
|
|
202
|
+
/** Index of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
203
|
+
capabilities: {
|
|
204
|
+
[capability: string]: Array<NamedType>;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export { AndType, Annotations, AnyType, ArrayNode, ArrayType, BooleanType, Capability, CommonTypeInfo, ConditionalNode, ConditionalType, Const, Enum, FunctionType, FunctionTypeParameters, Manifest, NamedType, NamedTypeWithGenerics, NeverType, NodeType, NodeTypeWithGenerics, NullType, NumberType, ObjectNode, ObjectProperty, ObjectType, OrType, ParamTypeNode, PrimitiveTypes, RecordType, RefNode, RefType, StringType, TSManifest, TemplateLiteralType, TransformFunction, TupleNode, TupleType, TypeMap, TypeNode, UndefinedType, UnknownType };
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@player-tools/xlr",
|
|
3
|
+
"version": "0.0.2-next.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@babel/runtime": "7.15.4"
|
|
11
|
+
},
|
|
12
|
+
"main": "dist/index.cjs.js",
|
|
13
|
+
"module": "dist/index.esm.js",
|
|
14
|
+
"typings": "dist/index.d.ts",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/player-ui/tools"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/player-ui/tools/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://player-ui.github.io",
|
|
25
|
+
"contributors": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Ketan Reddy",
|
|
28
|
+
"url": "https://github.com/KetanReddy"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
package/src/core.ts
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
export interface Annotations {
|
|
2
|
+
/** The name used to reference this type */
|
|
3
|
+
name?: string;
|
|
4
|
+
/** The path within a type to this type (may be the same as `name` ) */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** The JSDoc string for this type */
|
|
7
|
+
description?: string;
|
|
8
|
+
/** The JSDoc `@example` string for this type */
|
|
9
|
+
examples?: string | Array<string>;
|
|
10
|
+
/** The JSDoc `@default` string for this type */
|
|
11
|
+
default?: string;
|
|
12
|
+
/** The JSDoc `@see` string for this type */
|
|
13
|
+
see?: string | Array<string>;
|
|
14
|
+
/** The Typescript comment associated with the type */
|
|
15
|
+
comment?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TypeMap {
|
|
19
|
+
/** */
|
|
20
|
+
and: void;
|
|
21
|
+
/** */
|
|
22
|
+
or: void;
|
|
23
|
+
/** */
|
|
24
|
+
ref: string;
|
|
25
|
+
/** */
|
|
26
|
+
any: unknown;
|
|
27
|
+
/** */
|
|
28
|
+
null: null;
|
|
29
|
+
/** */
|
|
30
|
+
string: string;
|
|
31
|
+
/** */
|
|
32
|
+
number: number;
|
|
33
|
+
/** */
|
|
34
|
+
boolean: boolean;
|
|
35
|
+
/** */
|
|
36
|
+
object: object;
|
|
37
|
+
/** */
|
|
38
|
+
array: Array<unknown>;
|
|
39
|
+
/** */
|
|
40
|
+
tuple: Array<unknown>;
|
|
41
|
+
/** */
|
|
42
|
+
function: () => unknown;
|
|
43
|
+
/** */
|
|
44
|
+
record: Record<string | number | symbol, unknown>;
|
|
45
|
+
/** */
|
|
46
|
+
undefined: undefined;
|
|
47
|
+
/** */
|
|
48
|
+
never: never;
|
|
49
|
+
/** */
|
|
50
|
+
unknown: unknown;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface Const<T> {
|
|
54
|
+
/** The literal value for the node */
|
|
55
|
+
const?: T;
|
|
56
|
+
}
|
|
57
|
+
export interface Enum<T> {
|
|
58
|
+
/** The list of enums for the node */
|
|
59
|
+
enum?: Array<T>;
|
|
60
|
+
}
|
|
61
|
+
export type CommonTypeInfo<T> = Const<T> & Enum<T>;
|
|
62
|
+
|
|
63
|
+
export interface TypeNode<Name = string> {
|
|
64
|
+
/** The type of Node */
|
|
65
|
+
type: Name;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type AnyType = TypeNode<'any'> & CommonTypeInfo<any> & Annotations;
|
|
69
|
+
|
|
70
|
+
export type UnknownType = TypeNode<'unknown'> &
|
|
71
|
+
CommonTypeInfo<unknown> &
|
|
72
|
+
Annotations;
|
|
73
|
+
export type UndefinedType = TypeNode<'undefined'> &
|
|
74
|
+
CommonTypeInfo<undefined> &
|
|
75
|
+
Annotations;
|
|
76
|
+
export type NullType = TypeNode<'null'> & CommonTypeInfo<null> & Annotations;
|
|
77
|
+
export type StringType = TypeNode<'string'> &
|
|
78
|
+
CommonTypeInfo<string> &
|
|
79
|
+
Annotations;
|
|
80
|
+
export type NumberType = TypeNode<'number'> &
|
|
81
|
+
CommonTypeInfo<number> &
|
|
82
|
+
Annotations;
|
|
83
|
+
export type BooleanType = TypeNode<'boolean'> &
|
|
84
|
+
CommonTypeInfo<boolean> &
|
|
85
|
+
Annotations;
|
|
86
|
+
export type NeverType = TypeNode<'never'> & CommonTypeInfo<never> & Annotations;
|
|
87
|
+
|
|
88
|
+
export interface RefNode extends TypeNode<'ref'> {
|
|
89
|
+
/** Name of the referenced Type */
|
|
90
|
+
ref: string;
|
|
91
|
+
/** Parameters to potentially fill in a generic when it is resolved. Position is preserved */
|
|
92
|
+
genericArguments?: Array<NodeType>;
|
|
93
|
+
}
|
|
94
|
+
export type RefType = RefNode & Annotations;
|
|
95
|
+
|
|
96
|
+
export interface ObjectProperty {
|
|
97
|
+
/** If this property is required */
|
|
98
|
+
required: boolean;
|
|
99
|
+
/** The type of the property */
|
|
100
|
+
node: NodeType;
|
|
101
|
+
}
|
|
102
|
+
export interface ObjectNode extends TypeNode<'object'> {
|
|
103
|
+
/** the properties associated with an object */
|
|
104
|
+
properties: {
|
|
105
|
+
[name: string]: ObjectProperty;
|
|
106
|
+
};
|
|
107
|
+
/** What type, if any, of additional properties are allowed on the object */
|
|
108
|
+
additionalProperties: false | NodeType;
|
|
109
|
+
}
|
|
110
|
+
export type ObjectType = ObjectNode & CommonTypeInfo<object> & Annotations;
|
|
111
|
+
|
|
112
|
+
export interface ArrayNode extends TypeNode<'array'> {
|
|
113
|
+
/** What types are allowed in the array */
|
|
114
|
+
elementType: NodeType;
|
|
115
|
+
}
|
|
116
|
+
export type ArrayType<T = unknown> = ArrayNode &
|
|
117
|
+
CommonTypeInfo<Array<T>> &
|
|
118
|
+
Annotations;
|
|
119
|
+
|
|
120
|
+
export interface ConditionalNode extends TypeNode<'conditional'> {
|
|
121
|
+
/** The check arguments */
|
|
122
|
+
check: {
|
|
123
|
+
/** operator */
|
|
124
|
+
left: NodeType;
|
|
125
|
+
/** operand */
|
|
126
|
+
right: NodeType;
|
|
127
|
+
};
|
|
128
|
+
/** The resulting values to use */
|
|
129
|
+
value: {
|
|
130
|
+
/** If the conditional is true */
|
|
131
|
+
true: NodeType;
|
|
132
|
+
/** If the conditional is false */
|
|
133
|
+
false: NodeType;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type ConditionalType = ConditionalNode & Annotations;
|
|
138
|
+
|
|
139
|
+
export interface TupleNode extends TypeNode<'tuple'> {
|
|
140
|
+
/** The types in the tuple */
|
|
141
|
+
elementTypes: Array<NodeType>;
|
|
142
|
+
/** The minimum number of items */
|
|
143
|
+
minItems: number;
|
|
144
|
+
/** What, if any, additional types can be provided */
|
|
145
|
+
additionalItems: false | NodeType;
|
|
146
|
+
}
|
|
147
|
+
export type TupleType<T extends unknown[] = unknown[]> = TupleNode &
|
|
148
|
+
CommonTypeInfo<T> &
|
|
149
|
+
Annotations;
|
|
150
|
+
|
|
151
|
+
export type AndType = TypeNode<'and'> &
|
|
152
|
+
Annotations & {
|
|
153
|
+
/** Nodes in intersection */
|
|
154
|
+
and: NodeType[];
|
|
155
|
+
};
|
|
156
|
+
export type OrType = TypeNode<'or'> &
|
|
157
|
+
Annotations & {
|
|
158
|
+
/** Nodes in the union */
|
|
159
|
+
or: NodeType[];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export type TemplateLiteralType = TypeNode<'template'> &
|
|
163
|
+
Annotations & {
|
|
164
|
+
/** String version of regex used to validate template */
|
|
165
|
+
format: string;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type RecordType = TypeNode<'record'> &
|
|
169
|
+
Annotations & {
|
|
170
|
+
/** Key types for the Record */
|
|
171
|
+
keyType: NodeType;
|
|
172
|
+
/** Value types for the Record */
|
|
173
|
+
valueType: NodeType;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type FunctionTypeParameters = {
|
|
177
|
+
/** String name of the function parameter */
|
|
178
|
+
name: string;
|
|
179
|
+
/** The type constraint of the parameter */
|
|
180
|
+
type: NodeType;
|
|
181
|
+
/** Indicates that the parameter is optional */
|
|
182
|
+
optional?: true;
|
|
183
|
+
/** Default value for the parameter if nothing is supplied */
|
|
184
|
+
default?: NodeType;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type FunctionType = TypeNode<'function'> &
|
|
188
|
+
Annotations & {
|
|
189
|
+
/** Types for the parameters, in order, for the function */
|
|
190
|
+
parameters: Array<FunctionTypeParameters>;
|
|
191
|
+
/** Return type of the function */
|
|
192
|
+
returnType?: NodeType;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/** Primitive Type Nodes */
|
|
196
|
+
export type PrimitiveTypes =
|
|
197
|
+
| NeverType
|
|
198
|
+
| NullType
|
|
199
|
+
| StringType
|
|
200
|
+
| NumberType
|
|
201
|
+
| BooleanType
|
|
202
|
+
| AnyType
|
|
203
|
+
| UnknownType
|
|
204
|
+
| UndefinedType;
|
|
205
|
+
|
|
206
|
+
/** Set of all Node Types */
|
|
207
|
+
export type NodeType =
|
|
208
|
+
| AnyType
|
|
209
|
+
| UnknownType
|
|
210
|
+
| UndefinedType
|
|
211
|
+
| NullType
|
|
212
|
+
| NeverType
|
|
213
|
+
| StringType
|
|
214
|
+
| TemplateLiteralType
|
|
215
|
+
| NumberType
|
|
216
|
+
| BooleanType
|
|
217
|
+
| ObjectType
|
|
218
|
+
| ArrayType
|
|
219
|
+
| TupleType
|
|
220
|
+
| RecordType
|
|
221
|
+
| AndType
|
|
222
|
+
| OrType
|
|
223
|
+
| RefType
|
|
224
|
+
| FunctionType
|
|
225
|
+
| ConditionalType;
|
|
226
|
+
|
|
227
|
+
export type NamedType<T extends NodeType = NodeType> = T & {
|
|
228
|
+
/** Name of the exported interface/type */
|
|
229
|
+
name: string;
|
|
230
|
+
|
|
231
|
+
/** File the type was exported from */
|
|
232
|
+
source: string;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export interface ParamTypeNode {
|
|
236
|
+
/** Symbol used to identify the generic in the interface/type */
|
|
237
|
+
symbol: string;
|
|
238
|
+
/** The type constraint for the generic */
|
|
239
|
+
constraints?: NodeType;
|
|
240
|
+
/** The default value for the generic if no value is provided */
|
|
241
|
+
default?: NodeType;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export type NamedTypeWithGenerics<T extends NodeType = NodeType> =
|
|
245
|
+
NamedType<T> & {
|
|
246
|
+
/** Generics for the Named Type that need to be filled in */
|
|
247
|
+
genericTokens: Array<ParamTypeNode>;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export type NodeTypeWithGenerics<T extends NodeType = NodeType> = T & {
|
|
251
|
+
/** Generics for the Node that need to be filled in */
|
|
252
|
+
genericTokens: Array<ParamTypeNode>;
|
|
253
|
+
};
|
package/src/index.ts
ADDED
package/src/utility.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { NamedType, NodeType } from '.';
|
|
2
|
+
|
|
3
|
+
export type TransformFunction = (
|
|
4
|
+
input: NamedType<NodeType>,
|
|
5
|
+
capabilityType: string
|
|
6
|
+
) => void;
|
|
7
|
+
|
|
8
|
+
export interface Capability {
|
|
9
|
+
/** Name of the capability that is provided to Player */
|
|
10
|
+
name: string;
|
|
11
|
+
/** List of XLRs that are provided for the Capability */
|
|
12
|
+
provides: Array<string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Manifest {
|
|
16
|
+
/** Name of the plugin */
|
|
17
|
+
pluginName: string;
|
|
18
|
+
/** Map of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
19
|
+
capabilities?: Map<string, Array<string>>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TSManifest {
|
|
23
|
+
/** Name of the plugin */
|
|
24
|
+
pluginName: string;
|
|
25
|
+
|
|
26
|
+
/** Index of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
27
|
+
capabilities: {
|
|
28
|
+
[capability: string]: Array<NamedType>;
|
|
29
|
+
};
|
|
30
|
+
}
|