@xlr-lib/xlr 0.1.1-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/dist/cjs/index.cjs +19 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/index.legacy-esm.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +26 -0
- package/src/core.ts +242 -0
- package/src/index.ts +2 -0
- package/src/utility.ts +32 -0
- package/types/core.d.ts +172 -0
- package/types/index.d.ts +3 -0
- package/types/utility.d.ts +25 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/types/javascript/src/index.ts
|
|
17
|
+
var src_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(src_exports);
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/types/javascript/src/index.ts"],"sourcesContent":["export * from \"./core\";\nexport * from \"./utility\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sideEffects": false,
|
|
3
|
+
"files": [
|
|
4
|
+
"dist",
|
|
5
|
+
"src",
|
|
6
|
+
"types"
|
|
7
|
+
],
|
|
8
|
+
"name": "@xlr-lib/xlr",
|
|
9
|
+
"version": "0.1.1-next.0",
|
|
10
|
+
"main": "dist/cjs/index.cjs",
|
|
11
|
+
"module": "dist/index.legacy-esm.js",
|
|
12
|
+
"types": "types/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": "./package.json",
|
|
15
|
+
"./dist/index.css": "./dist/index.css",
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./types/index.d.ts",
|
|
18
|
+
"import": "./dist/index.mjs",
|
|
19
|
+
"default": "./dist/cjs/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"tslib": "^2.6.2"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {}
|
|
26
|
+
}
|
package/src/core.ts
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
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
|
+
/** The JSDoc `@meta` string for this type */
|
|
17
|
+
meta?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Const<T> {
|
|
21
|
+
/** The literal value for the node */
|
|
22
|
+
const?: T;
|
|
23
|
+
}
|
|
24
|
+
export interface Enum<T> {
|
|
25
|
+
/** The list of enums for the node */
|
|
26
|
+
enum?: Array<T>;
|
|
27
|
+
}
|
|
28
|
+
export type CommonTypeInfo<T> = Const<T> & Enum<T>;
|
|
29
|
+
|
|
30
|
+
export interface TypeNode<Name = string> {
|
|
31
|
+
/** The type of Node */
|
|
32
|
+
type: Name;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type AnyType = TypeNode<"any"> & CommonTypeInfo<any> & Annotations;
|
|
36
|
+
|
|
37
|
+
export type UnknownType = TypeNode<"unknown"> &
|
|
38
|
+
CommonTypeInfo<unknown> &
|
|
39
|
+
Annotations;
|
|
40
|
+
export type UndefinedType = TypeNode<"undefined"> &
|
|
41
|
+
CommonTypeInfo<undefined> &
|
|
42
|
+
Annotations;
|
|
43
|
+
export type NullType = TypeNode<"null"> & CommonTypeInfo<null> & Annotations;
|
|
44
|
+
export type VoidType = TypeNode<"void"> & CommonTypeInfo<void> & Annotations;
|
|
45
|
+
export type StringType = TypeNode<"string"> &
|
|
46
|
+
CommonTypeInfo<string> &
|
|
47
|
+
Annotations;
|
|
48
|
+
export type NumberType = TypeNode<"number"> &
|
|
49
|
+
CommonTypeInfo<number> &
|
|
50
|
+
Annotations;
|
|
51
|
+
export type BooleanType = TypeNode<"boolean"> &
|
|
52
|
+
CommonTypeInfo<boolean> &
|
|
53
|
+
Annotations;
|
|
54
|
+
export type NeverType = TypeNode<"never"> & CommonTypeInfo<never> & Annotations;
|
|
55
|
+
|
|
56
|
+
export interface RefNode extends TypeNode<"ref"> {
|
|
57
|
+
/** Name of the referenced Type */
|
|
58
|
+
ref: string;
|
|
59
|
+
/** Parameters to potentially fill in a generic when it is resolved. Position is preserved */
|
|
60
|
+
genericArguments?: Array<NodeType>;
|
|
61
|
+
/** Optional property to access when the reference is resolved */
|
|
62
|
+
property?: string;
|
|
63
|
+
}
|
|
64
|
+
export type RefType = RefNode & Annotations;
|
|
65
|
+
|
|
66
|
+
export interface ObjectProperty {
|
|
67
|
+
/** If this property is required */
|
|
68
|
+
required: boolean;
|
|
69
|
+
/** The type of the property */
|
|
70
|
+
node: NodeType;
|
|
71
|
+
}
|
|
72
|
+
export interface ObjectNode extends TypeNode<"object"> {
|
|
73
|
+
/** The properties associated with an object */
|
|
74
|
+
properties: {
|
|
75
|
+
[name: string]: ObjectProperty;
|
|
76
|
+
};
|
|
77
|
+
/** A custom primitive that this object extends that is to be resolved when used */
|
|
78
|
+
extends?: RefType;
|
|
79
|
+
/** What type, if any, of additional properties are allowed on the object */
|
|
80
|
+
additionalProperties: false | NodeType;
|
|
81
|
+
}
|
|
82
|
+
export type ObjectType = ObjectNode & CommonTypeInfo<object> & Annotations;
|
|
83
|
+
|
|
84
|
+
export interface ArrayNode extends TypeNode<"array"> {
|
|
85
|
+
/** What types are allowed in the array */
|
|
86
|
+
elementType: NodeType;
|
|
87
|
+
}
|
|
88
|
+
export type ArrayType<T = unknown> = ArrayNode &
|
|
89
|
+
CommonTypeInfo<Array<T>> &
|
|
90
|
+
Annotations;
|
|
91
|
+
|
|
92
|
+
export interface ConditionalNode extends TypeNode<"conditional"> {
|
|
93
|
+
/** The check arguments */
|
|
94
|
+
check: {
|
|
95
|
+
/** operator */
|
|
96
|
+
left: NodeType;
|
|
97
|
+
/** operand */
|
|
98
|
+
right: NodeType;
|
|
99
|
+
};
|
|
100
|
+
/** The resulting values to use */
|
|
101
|
+
value: {
|
|
102
|
+
/** If the conditional is true */
|
|
103
|
+
true: NodeType;
|
|
104
|
+
/** If the conditional is false */
|
|
105
|
+
false: NodeType;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type ConditionalType = ConditionalNode & Annotations;
|
|
110
|
+
|
|
111
|
+
export interface TupleMember {
|
|
112
|
+
/** Optional Name of the Tuple Member */
|
|
113
|
+
name?: string;
|
|
114
|
+
/** Type constraint of the Tuple Member */
|
|
115
|
+
type: NodeType;
|
|
116
|
+
/** Is the Tuple Member Optional */
|
|
117
|
+
optional?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface TupleNode extends TypeNode<"tuple"> {
|
|
121
|
+
/** The types in the tuple */
|
|
122
|
+
elementTypes: Array<TupleMember>;
|
|
123
|
+
/** The minimum number of items */
|
|
124
|
+
minItems: number;
|
|
125
|
+
/** What, if any, additional types can be provided */
|
|
126
|
+
additionalItems: false | NodeType;
|
|
127
|
+
}
|
|
128
|
+
export type TupleType<T extends unknown[] = unknown[]> = TupleNode &
|
|
129
|
+
CommonTypeInfo<T> &
|
|
130
|
+
Annotations;
|
|
131
|
+
|
|
132
|
+
export type AndType = TypeNode<"and"> &
|
|
133
|
+
Annotations & {
|
|
134
|
+
/** Nodes in intersection */
|
|
135
|
+
and: NodeType[];
|
|
136
|
+
};
|
|
137
|
+
export type OrType = TypeNode<"or"> &
|
|
138
|
+
Annotations & {
|
|
139
|
+
/** Nodes in the union */
|
|
140
|
+
or: NodeType[];
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type TemplateLiteralType = TypeNode<"template"> &
|
|
144
|
+
Annotations & {
|
|
145
|
+
/** String version of regex used to validate template */
|
|
146
|
+
format: string;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type RecordType = TypeNode<"record"> &
|
|
150
|
+
Annotations & {
|
|
151
|
+
/** Key types for the Record */
|
|
152
|
+
keyType: NodeType;
|
|
153
|
+
/** Value types for the Record */
|
|
154
|
+
valueType: NodeType;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export type FunctionTypeParameters = {
|
|
158
|
+
/** String name of the function parameter */
|
|
159
|
+
name: string;
|
|
160
|
+
/** The type constraint of the parameter */
|
|
161
|
+
type: NodeType;
|
|
162
|
+
/** Indicates that the parameter is optional */
|
|
163
|
+
optional?: true;
|
|
164
|
+
/** Default value for the parameter if nothing is supplied */
|
|
165
|
+
default?: NodeType;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type FunctionType = TypeNode<"function"> &
|
|
169
|
+
Annotations & {
|
|
170
|
+
/** Types for the parameters, in order, for the function */
|
|
171
|
+
parameters: Array<FunctionTypeParameters>;
|
|
172
|
+
/** Return type of the function */
|
|
173
|
+
returnType?: NodeType;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/** Primitive Type Nodes */
|
|
177
|
+
export type PrimitiveTypes =
|
|
178
|
+
| NeverType
|
|
179
|
+
| NullType
|
|
180
|
+
| StringType
|
|
181
|
+
| NumberType
|
|
182
|
+
| BooleanType
|
|
183
|
+
| AnyType
|
|
184
|
+
| UnknownType
|
|
185
|
+
| UndefinedType
|
|
186
|
+
| VoidType;
|
|
187
|
+
|
|
188
|
+
/** Set of all Node Types */
|
|
189
|
+
export type NodeType =
|
|
190
|
+
| AnyType
|
|
191
|
+
| UnknownType
|
|
192
|
+
| UndefinedType
|
|
193
|
+
| NullType
|
|
194
|
+
| NeverType
|
|
195
|
+
| StringType
|
|
196
|
+
| TemplateLiteralType
|
|
197
|
+
| NumberType
|
|
198
|
+
| BooleanType
|
|
199
|
+
| ObjectType
|
|
200
|
+
| ArrayType
|
|
201
|
+
| TupleType
|
|
202
|
+
| RecordType
|
|
203
|
+
| AndType
|
|
204
|
+
| OrType
|
|
205
|
+
| RefType
|
|
206
|
+
| FunctionType
|
|
207
|
+
| ConditionalType
|
|
208
|
+
| VoidType;
|
|
209
|
+
|
|
210
|
+
export type NodeTypeStrings = Pick<NodeType, "type">["type"];
|
|
211
|
+
|
|
212
|
+
export type NodeTypeMap = {
|
|
213
|
+
[K in NodeTypeStrings]: Extract<NodeType, { type: K }>;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export type NamedType<T extends NodeType = NodeType> = T & {
|
|
217
|
+
/** Name of the exported interface/type */
|
|
218
|
+
name: string;
|
|
219
|
+
|
|
220
|
+
/** File the type was exported from */
|
|
221
|
+
source: string;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export interface ParamTypeNode {
|
|
225
|
+
/** Symbol used to identify the generic in the interface/type */
|
|
226
|
+
symbol: string;
|
|
227
|
+
/** The type constraint for the generic */
|
|
228
|
+
constraints?: NodeType;
|
|
229
|
+
/** The default value for the generic if no value is provided */
|
|
230
|
+
default?: NodeType;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export type NamedTypeWithGenerics<T extends NodeType = NodeType> =
|
|
234
|
+
NamedType<T> & {
|
|
235
|
+
/** Generics for the Named Type that need to be filled in */
|
|
236
|
+
genericTokens: Array<ParamTypeNode>;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export type NodeTypeWithGenerics<T extends NodeType = NodeType> = T & {
|
|
240
|
+
/** Generics for the Node that need to be filled in */
|
|
241
|
+
genericTokens: Array<ParamTypeNode>;
|
|
242
|
+
};
|
package/src/index.ts
ADDED
package/src/utility.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { NamedType, NodeType } from ".";
|
|
2
|
+
|
|
3
|
+
export type TransformFunction = (
|
|
4
|
+
input: NamedType<NodeType> | NodeType,
|
|
5
|
+
capabilityType: string,
|
|
6
|
+
) => NamedType | NodeType;
|
|
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
|
+
/** CustomPrimitives that are the most basic types in the Payer Ecosystem */
|
|
21
|
+
customPrimitives?: Array<string>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TSManifest {
|
|
25
|
+
/** Name of the plugin */
|
|
26
|
+
pluginName: string;
|
|
27
|
+
|
|
28
|
+
/** Index of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
29
|
+
capabilities: {
|
|
30
|
+
[capability: string]: Array<NamedType>;
|
|
31
|
+
};
|
|
32
|
+
}
|
package/types/core.d.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
/** The JSDoc `@meta` string for this type */
|
|
17
|
+
meta?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
export interface Const<T> {
|
|
20
|
+
/** The literal value for the node */
|
|
21
|
+
const?: T;
|
|
22
|
+
}
|
|
23
|
+
export interface Enum<T> {
|
|
24
|
+
/** The list of enums for the node */
|
|
25
|
+
enum?: Array<T>;
|
|
26
|
+
}
|
|
27
|
+
export type CommonTypeInfo<T> = Const<T> & Enum<T>;
|
|
28
|
+
export interface TypeNode<Name = string> {
|
|
29
|
+
/** The type of Node */
|
|
30
|
+
type: Name;
|
|
31
|
+
}
|
|
32
|
+
export type AnyType = TypeNode<"any"> & CommonTypeInfo<any> & Annotations;
|
|
33
|
+
export type UnknownType = TypeNode<"unknown"> & CommonTypeInfo<unknown> & Annotations;
|
|
34
|
+
export type UndefinedType = TypeNode<"undefined"> & CommonTypeInfo<undefined> & Annotations;
|
|
35
|
+
export type NullType = TypeNode<"null"> & CommonTypeInfo<null> & Annotations;
|
|
36
|
+
export type VoidType = TypeNode<"void"> & CommonTypeInfo<void> & Annotations;
|
|
37
|
+
export type StringType = TypeNode<"string"> & CommonTypeInfo<string> & Annotations;
|
|
38
|
+
export type NumberType = TypeNode<"number"> & CommonTypeInfo<number> & Annotations;
|
|
39
|
+
export type BooleanType = TypeNode<"boolean"> & CommonTypeInfo<boolean> & Annotations;
|
|
40
|
+
export type NeverType = TypeNode<"never"> & CommonTypeInfo<never> & Annotations;
|
|
41
|
+
export interface RefNode extends TypeNode<"ref"> {
|
|
42
|
+
/** Name of the referenced Type */
|
|
43
|
+
ref: string;
|
|
44
|
+
/** Parameters to potentially fill in a generic when it is resolved. Position is preserved */
|
|
45
|
+
genericArguments?: Array<NodeType>;
|
|
46
|
+
/** Optional property to access when the reference is resolved */
|
|
47
|
+
property?: string;
|
|
48
|
+
}
|
|
49
|
+
export type RefType = RefNode & Annotations;
|
|
50
|
+
export interface ObjectProperty {
|
|
51
|
+
/** If this property is required */
|
|
52
|
+
required: boolean;
|
|
53
|
+
/** The type of the property */
|
|
54
|
+
node: NodeType;
|
|
55
|
+
}
|
|
56
|
+
export interface ObjectNode extends TypeNode<"object"> {
|
|
57
|
+
/** The properties associated with an object */
|
|
58
|
+
properties: {
|
|
59
|
+
[name: string]: ObjectProperty;
|
|
60
|
+
};
|
|
61
|
+
/** A custom primitive that this object extends that is to be resolved when used */
|
|
62
|
+
extends?: RefType;
|
|
63
|
+
/** What type, if any, of additional properties are allowed on the object */
|
|
64
|
+
additionalProperties: false | NodeType;
|
|
65
|
+
}
|
|
66
|
+
export type ObjectType = ObjectNode & CommonTypeInfo<object> & Annotations;
|
|
67
|
+
export interface ArrayNode extends TypeNode<"array"> {
|
|
68
|
+
/** What types are allowed in the array */
|
|
69
|
+
elementType: NodeType;
|
|
70
|
+
}
|
|
71
|
+
export type ArrayType<T = unknown> = ArrayNode & CommonTypeInfo<Array<T>> & Annotations;
|
|
72
|
+
export interface ConditionalNode extends TypeNode<"conditional"> {
|
|
73
|
+
/** The check arguments */
|
|
74
|
+
check: {
|
|
75
|
+
/** operator */
|
|
76
|
+
left: NodeType;
|
|
77
|
+
/** operand */
|
|
78
|
+
right: NodeType;
|
|
79
|
+
};
|
|
80
|
+
/** The resulting values to use */
|
|
81
|
+
value: {
|
|
82
|
+
/** If the conditional is true */
|
|
83
|
+
true: NodeType;
|
|
84
|
+
/** If the conditional is false */
|
|
85
|
+
false: NodeType;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export type ConditionalType = ConditionalNode & Annotations;
|
|
89
|
+
export interface TupleMember {
|
|
90
|
+
/** Optional Name of the Tuple Member */
|
|
91
|
+
name?: string;
|
|
92
|
+
/** Type constraint of the Tuple Member */
|
|
93
|
+
type: NodeType;
|
|
94
|
+
/** Is the Tuple Member Optional */
|
|
95
|
+
optional?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface TupleNode extends TypeNode<"tuple"> {
|
|
98
|
+
/** The types in the tuple */
|
|
99
|
+
elementTypes: Array<TupleMember>;
|
|
100
|
+
/** The minimum number of items */
|
|
101
|
+
minItems: number;
|
|
102
|
+
/** What, if any, additional types can be provided */
|
|
103
|
+
additionalItems: false | NodeType;
|
|
104
|
+
}
|
|
105
|
+
export type TupleType<T extends unknown[] = unknown[]> = TupleNode & CommonTypeInfo<T> & Annotations;
|
|
106
|
+
export type AndType = TypeNode<"and"> & Annotations & {
|
|
107
|
+
/** Nodes in intersection */
|
|
108
|
+
and: NodeType[];
|
|
109
|
+
};
|
|
110
|
+
export type OrType = TypeNode<"or"> & Annotations & {
|
|
111
|
+
/** Nodes in the union */
|
|
112
|
+
or: NodeType[];
|
|
113
|
+
};
|
|
114
|
+
export type TemplateLiteralType = TypeNode<"template"> & Annotations & {
|
|
115
|
+
/** String version of regex used to validate template */
|
|
116
|
+
format: string;
|
|
117
|
+
};
|
|
118
|
+
export type RecordType = TypeNode<"record"> & Annotations & {
|
|
119
|
+
/** Key types for the Record */
|
|
120
|
+
keyType: NodeType;
|
|
121
|
+
/** Value types for the Record */
|
|
122
|
+
valueType: NodeType;
|
|
123
|
+
};
|
|
124
|
+
export type FunctionTypeParameters = {
|
|
125
|
+
/** String name of the function parameter */
|
|
126
|
+
name: string;
|
|
127
|
+
/** The type constraint of the parameter */
|
|
128
|
+
type: NodeType;
|
|
129
|
+
/** Indicates that the parameter is optional */
|
|
130
|
+
optional?: true;
|
|
131
|
+
/** Default value for the parameter if nothing is supplied */
|
|
132
|
+
default?: NodeType;
|
|
133
|
+
};
|
|
134
|
+
export type FunctionType = TypeNode<"function"> & Annotations & {
|
|
135
|
+
/** Types for the parameters, in order, for the function */
|
|
136
|
+
parameters: Array<FunctionTypeParameters>;
|
|
137
|
+
/** Return type of the function */
|
|
138
|
+
returnType?: NodeType;
|
|
139
|
+
};
|
|
140
|
+
/** Primitive Type Nodes */
|
|
141
|
+
export type PrimitiveTypes = NeverType | NullType | StringType | NumberType | BooleanType | AnyType | UnknownType | UndefinedType | VoidType;
|
|
142
|
+
/** Set of all Node Types */
|
|
143
|
+
export type NodeType = AnyType | UnknownType | UndefinedType | NullType | NeverType | StringType | TemplateLiteralType | NumberType | BooleanType | ObjectType | ArrayType | TupleType | RecordType | AndType | OrType | RefType | FunctionType | ConditionalType | VoidType;
|
|
144
|
+
export type NodeTypeStrings = Pick<NodeType, "type">["type"];
|
|
145
|
+
export type NodeTypeMap = {
|
|
146
|
+
[K in NodeTypeStrings]: Extract<NodeType, {
|
|
147
|
+
type: K;
|
|
148
|
+
}>;
|
|
149
|
+
};
|
|
150
|
+
export type NamedType<T extends NodeType = NodeType> = T & {
|
|
151
|
+
/** Name of the exported interface/type */
|
|
152
|
+
name: string;
|
|
153
|
+
/** File the type was exported from */
|
|
154
|
+
source: string;
|
|
155
|
+
};
|
|
156
|
+
export interface ParamTypeNode {
|
|
157
|
+
/** Symbol used to identify the generic in the interface/type */
|
|
158
|
+
symbol: string;
|
|
159
|
+
/** The type constraint for the generic */
|
|
160
|
+
constraints?: NodeType;
|
|
161
|
+
/** The default value for the generic if no value is provided */
|
|
162
|
+
default?: NodeType;
|
|
163
|
+
}
|
|
164
|
+
export type NamedTypeWithGenerics<T extends NodeType = NodeType> = NamedType<T> & {
|
|
165
|
+
/** Generics for the Named Type that need to be filled in */
|
|
166
|
+
genericTokens: Array<ParamTypeNode>;
|
|
167
|
+
};
|
|
168
|
+
export type NodeTypeWithGenerics<T extends NodeType = NodeType> = T & {
|
|
169
|
+
/** Generics for the Node that need to be filled in */
|
|
170
|
+
genericTokens: Array<ParamTypeNode>;
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=core.d.ts.map
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NamedType, NodeType } from ".";
|
|
2
|
+
export type TransformFunction = (input: NamedType<NodeType> | NodeType, capabilityType: string) => NamedType | NodeType;
|
|
3
|
+
export interface Capability {
|
|
4
|
+
/** Name of the capability that is provided to Player */
|
|
5
|
+
name: string;
|
|
6
|
+
/** List of XLRs that are provided for the Capability */
|
|
7
|
+
provides: Array<string>;
|
|
8
|
+
}
|
|
9
|
+
export interface Manifest {
|
|
10
|
+
/** Name of the plugin */
|
|
11
|
+
pluginName: string;
|
|
12
|
+
/** Map of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
13
|
+
capabilities?: Map<string, Array<string>>;
|
|
14
|
+
/** CustomPrimitives that are the most basic types in the Payer Ecosystem */
|
|
15
|
+
customPrimitives?: Array<string>;
|
|
16
|
+
}
|
|
17
|
+
export interface TSManifest {
|
|
18
|
+
/** Name of the plugin */
|
|
19
|
+
pluginName: string;
|
|
20
|
+
/** Index of capabilities provided by the plugin to the name of the XLR for the capabilities */
|
|
21
|
+
capabilities: {
|
|
22
|
+
[capability: string]: Array<NamedType>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=utility.d.ts.map
|