@fluidframework/type-factory 2.93.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.
Files changed (64) hide show
  1. package/.mocharc.cjs +11 -0
  2. package/CHANGELOG.md +3 -0
  3. package/LICENSE +21 -0
  4. package/README.md +133 -0
  5. package/alpha.d.ts +11 -0
  6. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-bundle.json +5 -0
  9. package/api-extractor/api-extractor-lint-index.cjs.json +5 -0
  10. package/api-extractor/api-extractor-lint-index.esm.json +5 -0
  11. package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
  12. package/api-extractor/api-extractor-lint-public.esm.json +5 -0
  13. package/api-extractor.json +14 -0
  14. package/api-report/type-factory.alpha.api.md +208 -0
  15. package/api-report/type-factory.beta.api.md +7 -0
  16. package/api-report/type-factory.public.api.md +7 -0
  17. package/dist/alpha.d.ts +57 -0
  18. package/dist/index.d.ts +14 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +21 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/methodBinding.d.ts +101 -0
  23. package/dist/methodBinding.d.ts.map +1 -0
  24. package/dist/methodBinding.js +26 -0
  25. package/dist/methodBinding.js.map +1 -0
  26. package/dist/package.json +4 -0
  27. package/dist/propertyBinding.d.ts +50 -0
  28. package/dist/propertyBinding.d.ts.map +1 -0
  29. package/dist/propertyBinding.js +13 -0
  30. package/dist/propertyBinding.js.map +1 -0
  31. package/dist/public.d.ts +16 -0
  32. package/dist/treeAgentTypes.d.ts +428 -0
  33. package/dist/treeAgentTypes.d.ts.map +1 -0
  34. package/dist/treeAgentTypes.js +218 -0
  35. package/dist/treeAgentTypes.js.map +1 -0
  36. package/eslint.config.mts +43 -0
  37. package/internal.d.ts +11 -0
  38. package/lib/alpha.d.ts +57 -0
  39. package/lib/index.d.ts +14 -0
  40. package/lib/index.d.ts.map +1 -0
  41. package/lib/index.js +13 -0
  42. package/lib/index.js.map +1 -0
  43. package/lib/methodBinding.d.ts +101 -0
  44. package/lib/methodBinding.d.ts.map +1 -0
  45. package/lib/methodBinding.js +22 -0
  46. package/lib/methodBinding.js.map +1 -0
  47. package/lib/propertyBinding.d.ts +50 -0
  48. package/lib/propertyBinding.d.ts.map +1 -0
  49. package/lib/propertyBinding.js +10 -0
  50. package/lib/propertyBinding.js.map +1 -0
  51. package/lib/public.d.ts +16 -0
  52. package/lib/treeAgentTypes.d.ts +428 -0
  53. package/lib/treeAgentTypes.d.ts.map +1 -0
  54. package/lib/treeAgentTypes.js +214 -0
  55. package/lib/treeAgentTypes.js.map +1 -0
  56. package/lib/tsdoc-metadata.json +11 -0
  57. package/package.json +142 -0
  58. package/src/index.ts +57 -0
  59. package/src/methodBinding.ts +139 -0
  60. package/src/propertyBinding.ts +62 -0
  61. package/src/treeAgentTypes.ts +601 -0
  62. package/tsconfig.cjs.json +7 -0
  63. package/tsconfig.json +14 -0
  64. package/tsdoc.json +4 -0
@@ -0,0 +1,428 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Type kinds for the type factory type system.
7
+ * @alpha
8
+ */
9
+ export type TypeFactoryTypeKind = "string" | "number" | "boolean" | "void" | "undefined" | "null" | "unknown" | "date" | "promise" | "array" | "object" | "record" | "map" | "tuple" | "union" | "intersection" | "literal" | "optional" | "readonly" | "function" | "instanceof";
10
+ /**
11
+ * Base interface for type factory types.
12
+ * @alpha
13
+ */
14
+ export interface TypeFactoryType {
15
+ /**
16
+ * The kind of type this represents.
17
+ */
18
+ readonly _kind: TypeFactoryTypeKind;
19
+ }
20
+ /**
21
+ * Type guard to check if a value is a type factory type.
22
+ * @alpha
23
+ */
24
+ export declare function isTypeFactoryType(value: unknown): value is TypeFactoryType;
25
+ /**
26
+ * Represents a string type in the type factory system.
27
+ * @alpha
28
+ */
29
+ export interface TypeFactoryString extends TypeFactoryType {
30
+ /**
31
+ * {@inheritDoc TypeFactoryType._kind}
32
+ */
33
+ readonly _kind: "string";
34
+ }
35
+ /**
36
+ * Represents a number type in the type factory system.
37
+ * @alpha
38
+ */
39
+ export interface TypeFactoryNumber extends TypeFactoryType {
40
+ /**
41
+ * {@inheritDoc TypeFactoryType._kind}
42
+ */
43
+ readonly _kind: "number";
44
+ }
45
+ /**
46
+ * Represents a boolean type in the type factory system.
47
+ * @alpha
48
+ */
49
+ export interface TypeFactoryBoolean extends TypeFactoryType {
50
+ /**
51
+ * {@inheritDoc TypeFactoryType._kind}
52
+ */
53
+ readonly _kind: "boolean";
54
+ }
55
+ /**
56
+ * Represents a Date type in the type factory system.
57
+ * @alpha
58
+ */
59
+ export interface TypeFactoryDate extends TypeFactoryType {
60
+ /**
61
+ * {@inheritDoc TypeFactoryType._kind}
62
+ */
63
+ readonly _kind: "date";
64
+ }
65
+ /**
66
+ * Represents a void type in the type factory system.
67
+ * @alpha
68
+ */
69
+ export interface TypeFactoryVoid extends TypeFactoryType {
70
+ /**
71
+ * {@inheritDoc TypeFactoryType._kind}
72
+ */
73
+ readonly _kind: "void";
74
+ }
75
+ /**
76
+ * Represents an undefined type in the type factory system.
77
+ * @alpha
78
+ */
79
+ export interface TypeFactoryUndefined extends TypeFactoryType {
80
+ /**
81
+ * {@inheritDoc TypeFactoryType._kind}
82
+ */
83
+ readonly _kind: "undefined";
84
+ }
85
+ /**
86
+ * Represents a null type in the type factory system.
87
+ * @alpha
88
+ */
89
+ export interface TypeFactoryNull extends TypeFactoryType {
90
+ /**
91
+ * {@inheritDoc TypeFactoryType._kind}
92
+ */
93
+ readonly _kind: "null";
94
+ }
95
+ /**
96
+ * Represents an unknown type in the type factory system.
97
+ * @alpha
98
+ */
99
+ export interface TypeFactoryUnknown extends TypeFactoryType {
100
+ /**
101
+ * {@inheritDoc TypeFactoryType._kind}
102
+ */
103
+ readonly _kind: "unknown";
104
+ }
105
+ /**
106
+ * Represents an array type in the type factory system.
107
+ * @alpha
108
+ */
109
+ export interface TypeFactoryArray extends TypeFactoryType {
110
+ /**
111
+ * {@inheritDoc TypeFactoryType._kind}
112
+ */
113
+ readonly _kind: "array";
114
+ /**
115
+ * The type of elements in the array.
116
+ */
117
+ readonly element: TypeFactoryType;
118
+ }
119
+ /**
120
+ * Represents a Promise type in the type factory system.
121
+ * @alpha
122
+ */
123
+ export interface TypeFactoryPromise extends TypeFactoryType {
124
+ /**
125
+ * {@inheritDoc TypeFactoryType._kind}
126
+ */
127
+ readonly _kind: "promise";
128
+ /**
129
+ * The type that the Promise resolves to.
130
+ */
131
+ readonly innerType: TypeFactoryType;
132
+ }
133
+ /**
134
+ * Represents an object type with a fixed shape in the type factory system.
135
+ * @alpha
136
+ */
137
+ export interface TypeFactoryObject extends TypeFactoryType {
138
+ /**
139
+ * {@inheritDoc TypeFactoryType._kind}
140
+ */
141
+ readonly _kind: "object";
142
+ /**
143
+ * The shape of the object, mapping property names to their types.
144
+ */
145
+ readonly shape: Record<string, TypeFactoryType>;
146
+ }
147
+ /**
148
+ * Represents a record type (index signature) in the type factory system.
149
+ * @alpha
150
+ */
151
+ export interface TypeFactoryRecord extends TypeFactoryType {
152
+ /**
153
+ * {@inheritDoc TypeFactoryType._kind}
154
+ */
155
+ readonly _kind: "record";
156
+ /**
157
+ * The type of the record's keys.
158
+ */
159
+ readonly keyType: TypeFactoryType;
160
+ /**
161
+ * The type of the record's values.
162
+ */
163
+ readonly valueType: TypeFactoryType;
164
+ }
165
+ /**
166
+ * Represents a Map type in the type factory system.
167
+ * @alpha
168
+ */
169
+ export interface TypeFactoryMap extends TypeFactoryType {
170
+ /**
171
+ * {@inheritDoc TypeFactoryType._kind}
172
+ */
173
+ readonly _kind: "map";
174
+ /**
175
+ * The type of the map's keys.
176
+ */
177
+ readonly keyType: TypeFactoryType;
178
+ /**
179
+ * The type of the map's values.
180
+ */
181
+ readonly valueType: TypeFactoryType;
182
+ }
183
+ /**
184
+ * Represents a tuple type with fixed-length items and optional rest elements in the type factory system.
185
+ * @alpha
186
+ */
187
+ export interface TypeFactoryTuple extends TypeFactoryType {
188
+ /**
189
+ * {@inheritDoc TypeFactoryType._kind}
190
+ */
191
+ readonly _kind: "tuple";
192
+ /**
193
+ * The fixed-length items in the tuple.
194
+ */
195
+ readonly items: readonly TypeFactoryType[];
196
+ /**
197
+ * Optional rest element type for variable-length tuples.
198
+ */
199
+ readonly rest?: TypeFactoryType;
200
+ }
201
+ /**
202
+ * Represents a union type in the type factory system.
203
+ * @alpha
204
+ */
205
+ export interface TypeFactoryUnion extends TypeFactoryType {
206
+ /**
207
+ * {@inheritDoc TypeFactoryType._kind}
208
+ */
209
+ readonly _kind: "union";
210
+ /**
211
+ * The possible types in the union.
212
+ */
213
+ readonly options: readonly TypeFactoryType[];
214
+ }
215
+ /**
216
+ * Represents an intersection type in the type factory system.
217
+ * @alpha
218
+ */
219
+ export interface TypeFactoryIntersection extends TypeFactoryType {
220
+ /**
221
+ * {@inheritDoc TypeFactoryType._kind}
222
+ */
223
+ readonly _kind: "intersection";
224
+ /**
225
+ * The types to intersect.
226
+ */
227
+ readonly types: readonly TypeFactoryType[];
228
+ }
229
+ /**
230
+ * Represents a literal type (specific string, number, or boolean value) in the type factory system.
231
+ * @alpha
232
+ */
233
+ export interface TypeFactoryLiteral extends TypeFactoryType {
234
+ /**
235
+ * {@inheritDoc TypeFactoryType._kind}
236
+ */
237
+ readonly _kind: "literal";
238
+ /**
239
+ * The specific literal value.
240
+ */
241
+ readonly value: string | number | boolean;
242
+ }
243
+ /**
244
+ * Represents an optional type modifier in the type factory system.
245
+ * @alpha
246
+ */
247
+ export interface TypeFactoryOptional extends TypeFactoryType {
248
+ /**
249
+ * {@inheritDoc TypeFactoryType._kind}
250
+ */
251
+ readonly _kind: "optional";
252
+ /**
253
+ * The inner type that is optional.
254
+ */
255
+ readonly innerType: TypeFactoryType;
256
+ }
257
+ /**
258
+ * Represents a readonly type modifier in the type factory system.
259
+ * @alpha
260
+ */
261
+ export interface TypeFactoryReadonly extends TypeFactoryType {
262
+ /**
263
+ * {@inheritDoc TypeFactoryType._kind}
264
+ */
265
+ readonly _kind: "readonly";
266
+ /**
267
+ * The inner type that is readonly.
268
+ */
269
+ readonly innerType: TypeFactoryType;
270
+ }
271
+ /**
272
+ * Represents a function parameter as a tuple of [name, type].
273
+ * @alpha
274
+ */
275
+ export type TypeFactoryFunctionParameter = readonly [name: string, type: TypeFactoryType];
276
+ /**
277
+ * Represents a function type in the type factory system.
278
+ * @alpha
279
+ */
280
+ export interface TypeFactoryFunction extends TypeFactoryType {
281
+ /**
282
+ * {@inheritDoc TypeFactoryType._kind}
283
+ */
284
+ readonly _kind: "function";
285
+ /**
286
+ * The function parameters.
287
+ */
288
+ readonly parameters: readonly TypeFactoryFunctionParameter[];
289
+ /**
290
+ * The function return type.
291
+ */
292
+ readonly returnType: TypeFactoryType;
293
+ /**
294
+ * Optional rest parameter for variable-length argument lists.
295
+ */
296
+ readonly restParameter?: TypeFactoryFunctionParameter;
297
+ }
298
+ /**
299
+ * Represents an instanceof type that references a class in the type factory system.
300
+ * @alpha
301
+ */
302
+ export interface TypeFactoryInstanceOf extends TypeFactoryType {
303
+ /**
304
+ * The kind of type this represents.
305
+ */
306
+ readonly _kind: "instanceof";
307
+ /**
308
+ * The constructor to reference.
309
+ */
310
+ readonly constructor: new (...args: any[]) => unknown;
311
+ }
312
+ /**
313
+ * Namespace containing type factory functions for building type definitions
314
+ * that describe method signatures and property types to an LLM agent.
315
+ *
316
+ * @internal
317
+ */
318
+ export declare const typeFactory: {
319
+ /**
320
+ * Create a string type.
321
+ * @alpha
322
+ */
323
+ string(): TypeFactoryString;
324
+ /**
325
+ * Create a number type.
326
+ * @alpha
327
+ */
328
+ number(): TypeFactoryNumber;
329
+ /**
330
+ * Create a boolean type.
331
+ * @alpha
332
+ */
333
+ boolean(): TypeFactoryBoolean;
334
+ /**
335
+ * Create a Date type.
336
+ * @alpha
337
+ */
338
+ date(): TypeFactoryDate;
339
+ /**
340
+ * Create a void type.
341
+ * @alpha
342
+ */
343
+ void(): TypeFactoryVoid;
344
+ /**
345
+ * Create an undefined type.
346
+ * @alpha
347
+ */
348
+ undefined(): TypeFactoryUndefined;
349
+ /**
350
+ * Create a null type.
351
+ * @alpha
352
+ */
353
+ null(): TypeFactoryNull;
354
+ /**
355
+ * Create an unknown type.
356
+ * @alpha
357
+ */
358
+ unknown(): TypeFactoryUnknown;
359
+ /**
360
+ * Create an array type.
361
+ * @alpha
362
+ */
363
+ array(element: TypeFactoryType): TypeFactoryArray;
364
+ /**
365
+ * Create a Promise type.
366
+ * @alpha
367
+ */
368
+ promise(innerType: TypeFactoryType): TypeFactoryPromise;
369
+ /**
370
+ * Create an object type.
371
+ * @alpha
372
+ */
373
+ object(shape: Record<string, TypeFactoryType>): TypeFactoryObject;
374
+ /**
375
+ * Create a record type.
376
+ * @alpha
377
+ */
378
+ record(keyType: TypeFactoryType, valueType: TypeFactoryType): TypeFactoryRecord;
379
+ /**
380
+ * Create a map type.
381
+ * @alpha
382
+ */
383
+ map(keyType: TypeFactoryType, valueType: TypeFactoryType): TypeFactoryMap;
384
+ /**
385
+ * Create a tuple type.
386
+ * @alpha
387
+ */
388
+ tuple(items: readonly TypeFactoryType[], rest?: TypeFactoryType): TypeFactoryTuple;
389
+ /**
390
+ * Create a union type.
391
+ * @alpha
392
+ */
393
+ union(options: readonly TypeFactoryType[]): TypeFactoryUnion;
394
+ /**
395
+ * Create an intersection type.
396
+ * @alpha
397
+ */
398
+ intersection(types: readonly TypeFactoryType[]): TypeFactoryIntersection;
399
+ /**
400
+ * Create a literal type.
401
+ * @alpha
402
+ */
403
+ literal(value: string | number | boolean): TypeFactoryLiteral;
404
+ /**
405
+ * Create an optional type.
406
+ * @alpha
407
+ */
408
+ optional(innerType: TypeFactoryType): TypeFactoryOptional;
409
+ /**
410
+ * Create a readonly type.
411
+ * @alpha
412
+ */
413
+ readonly(innerType: TypeFactoryType): TypeFactoryReadonly;
414
+ /**
415
+ * Create a function type.
416
+ * @alpha
417
+ */
418
+ function(parameters: readonly TypeFactoryFunctionParameter[], returnType: TypeFactoryType, restParameter?: TypeFactoryFunctionParameter): TypeFactoryFunction;
419
+ /**
420
+ * Create an instanceOf type for a class.
421
+ * @remarks
422
+ * This is an untyped version. `@fluidframework/tree-agent` re-exports a
423
+ * narrower override that constrains the constructor to `ObjectNodeSchema`.
424
+ * @internal
425
+ */
426
+ instanceOf(constructor: new (...args: any[]) => unknown): TypeFactoryInstanceOf;
427
+ };
428
+ //# sourceMappingURL=treeAgentTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeAgentTypes.d.ts","sourceRoot":"","sources":["../src/treeAgentTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC5B,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,WAAW,GACX,MAAM,GACN,SAAS,GACT,MAAM,GACN,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,OAAO,GACP,OAAO,GACP,cAAc,GACd,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,YAAY,CAAC;AAEhB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACpC;AA8BD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAM1E;AAID;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACzD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACzD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CACzB;AAED;;;GAG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B;IAI7B;;;OAGG;mBACY,eAAe,GAAG,gBAAgB;IAIjD;;;OAGG;uBACgB,eAAe,GAAG,kBAAkB;IAIvD;;;OAGG;kBACW,OAAO,MAAM,EAAE,eAAe,CAAC,GAAG,iBAAiB;IAIjE;;;OAGG;oBACa,eAAe,aAAa,eAAe,GAAG,iBAAiB;IAI/E;;;OAGG;iBACU,eAAe,aAAa,eAAe,GAAG,cAAc;IAIzE;;;OAGG;iBACU,SAAS,eAAe,EAAE,SAAS,eAAe,GAAG,gBAAgB;IASlF;;;OAGG;mBACY,SAAS,eAAe,EAAE,GAAG,gBAAgB;IAS5D;;;OAGG;wBACiB,SAAS,eAAe,EAAE,GAAG,uBAAuB;IASxE;;;OAGG;mBACY,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,kBAAkB;IAI7D;;;OAGG;wBACiB,eAAe,GAAG,mBAAmB;IAIzD;;;OAGG;wBACiB,eAAe,GAAG,mBAAmB;IAIzD;;;OAGG;yBAEU,SAAS,4BAA4B,EAAE,cACvC,eAAe,kBACX,4BAA4B,GAC1C,mBAAmB;IAMtB;;;;;;OAMG;4BAEqB,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,GAAG,qBAAqB;CAG/E,CAAC"}
@@ -0,0 +1,214 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
+ /**
7
+ * Set of valid type factory type kinds for efficient validation.
8
+ * @internal
9
+ */
10
+ const validTypeKinds = new Set([
11
+ "string",
12
+ "number",
13
+ "boolean",
14
+ "void",
15
+ "undefined",
16
+ "null",
17
+ "unknown",
18
+ "date",
19
+ "promise",
20
+ "array",
21
+ "object",
22
+ "record",
23
+ "map",
24
+ "tuple",
25
+ "union",
26
+ "intersection",
27
+ "literal",
28
+ "optional",
29
+ "readonly",
30
+ "function",
31
+ "instanceof",
32
+ ]);
33
+ /**
34
+ * Type guard to check if a value is a type factory type.
35
+ * @alpha
36
+ */
37
+ export function isTypeFactoryType(value) {
38
+ if (typeof value !== "object" || value === null || !("_kind" in value)) {
39
+ return false;
40
+ }
41
+ const kind = value._kind;
42
+ return typeof kind === "string" && validTypeKinds.has(kind);
43
+ }
44
+ /**
45
+ * Namespace containing type factory functions for building type definitions
46
+ * that describe method signatures and property types to an LLM agent.
47
+ *
48
+ * @internal
49
+ */
50
+ export const typeFactory = {
51
+ /**
52
+ * Create a string type.
53
+ * @alpha
54
+ */
55
+ string() {
56
+ return { _kind: "string" };
57
+ },
58
+ /**
59
+ * Create a number type.
60
+ * @alpha
61
+ */
62
+ number() {
63
+ return { _kind: "number" };
64
+ },
65
+ /**
66
+ * Create a boolean type.
67
+ * @alpha
68
+ */
69
+ boolean() {
70
+ return { _kind: "boolean" };
71
+ },
72
+ /**
73
+ * Create a Date type.
74
+ * @alpha
75
+ */
76
+ date() {
77
+ return { _kind: "date" };
78
+ },
79
+ /**
80
+ * Create a void type.
81
+ * @alpha
82
+ */
83
+ void() {
84
+ return { _kind: "void" };
85
+ },
86
+ /**
87
+ * Create an undefined type.
88
+ * @alpha
89
+ */
90
+ undefined() {
91
+ return { _kind: "undefined" };
92
+ },
93
+ /**
94
+ * Create a null type.
95
+ * @alpha
96
+ */
97
+ null() {
98
+ return { _kind: "null" };
99
+ },
100
+ /**
101
+ * Create an unknown type.
102
+ * @alpha
103
+ */
104
+ unknown() {
105
+ return { _kind: "unknown" };
106
+ },
107
+ /**
108
+ * Create an array type.
109
+ * @alpha
110
+ */
111
+ array(element) {
112
+ return { _kind: "array", element };
113
+ },
114
+ /**
115
+ * Create a Promise type.
116
+ * @alpha
117
+ */
118
+ promise(innerType) {
119
+ return { _kind: "promise", innerType };
120
+ },
121
+ /**
122
+ * Create an object type.
123
+ * @alpha
124
+ */
125
+ object(shape) {
126
+ return { _kind: "object", shape };
127
+ },
128
+ /**
129
+ * Create a record type.
130
+ * @alpha
131
+ */
132
+ record(keyType, valueType) {
133
+ return { _kind: "record", keyType, valueType };
134
+ },
135
+ /**
136
+ * Create a map type.
137
+ * @alpha
138
+ */
139
+ map(keyType, valueType) {
140
+ return { _kind: "map", keyType, valueType };
141
+ },
142
+ /**
143
+ * Create a tuple type.
144
+ * @alpha
145
+ */
146
+ tuple(items, rest) {
147
+ if (items.length === 0 && rest === undefined) {
148
+ throw new UsageError("typeFactory.tuple requires at least one item or a rest type. Empty tuples are not supported.");
149
+ }
150
+ return rest === undefined ? { _kind: "tuple", items } : { _kind: "tuple", items, rest };
151
+ },
152
+ /**
153
+ * Create a union type.
154
+ * @alpha
155
+ */
156
+ union(options) {
157
+ if (options.length === 0) {
158
+ throw new UsageError("typeFactory.union requires at least one option. Empty unions are not valid TypeScript types.");
159
+ }
160
+ return { _kind: "union", options };
161
+ },
162
+ /**
163
+ * Create an intersection type.
164
+ * @alpha
165
+ */
166
+ intersection(types) {
167
+ if (types.length === 0) {
168
+ throw new UsageError("typeFactory.intersection requires at least one type. Empty intersections are not valid TypeScript types.");
169
+ }
170
+ return { _kind: "intersection", types };
171
+ },
172
+ /**
173
+ * Create a literal type.
174
+ * @alpha
175
+ */
176
+ literal(value) {
177
+ return { _kind: "literal", value };
178
+ },
179
+ /**
180
+ * Create an optional type.
181
+ * @alpha
182
+ */
183
+ optional(innerType) {
184
+ return { _kind: "optional", innerType };
185
+ },
186
+ /**
187
+ * Create a readonly type.
188
+ * @alpha
189
+ */
190
+ readonly(innerType) {
191
+ return { _kind: "readonly", innerType };
192
+ },
193
+ /**
194
+ * Create a function type.
195
+ * @alpha
196
+ */
197
+ function(parameters, returnType, restParameter) {
198
+ return restParameter === undefined
199
+ ? { _kind: "function", parameters, returnType }
200
+ : { _kind: "function", parameters, returnType, restParameter };
201
+ },
202
+ /**
203
+ * Create an instanceOf type for a class.
204
+ * @remarks
205
+ * This is an untyped version. `@fluidframework/tree-agent` re-exports a
206
+ * narrower override that constrains the constructor to `ObjectNodeSchema`.
207
+ * @internal
208
+ */
209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
210
+ instanceOf(constructor) {
211
+ return { _kind: "instanceof", constructor };
212
+ },
213
+ };
214
+ //# sourceMappingURL=treeAgentTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeAgentTypes.js","sourceRoot":"","sources":["../src/treeAgentTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAwCtE;;;GAGG;AACH,MAAM,cAAc,GAAqC,IAAI,GAAG,CAAsB;IACrF,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,WAAW;IACX,MAAM;IACN,SAAS;IACT,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,cAAc;IACd,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,YAAY;CACZ,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAI,KAA4B,CAAC,KAAK,CAAC;IACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,cAAc,CAAC,GAAG,CAAC,IAA2B,CAAC,CAAC;AACpF,CAAC;AA8TD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B;;;OAGG;IACH,MAAM;QACL,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,MAAM;QACL,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,EAAE,KAAK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AAa,EAAE,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,8DAA8D;IAC9D,UAAU,CAAC,WAA4C;QACtD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;IAC7C,CAAC;CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Type kinds for the type factory type system.\n * @alpha\n */\nexport type TypeFactoryTypeKind =\n\t| \"string\"\n\t| \"number\"\n\t| \"boolean\"\n\t| \"void\"\n\t| \"undefined\"\n\t| \"null\"\n\t| \"unknown\"\n\t| \"date\"\n\t| \"promise\"\n\t| \"array\"\n\t| \"object\"\n\t| \"record\"\n\t| \"map\"\n\t| \"tuple\"\n\t| \"union\"\n\t| \"intersection\"\n\t| \"literal\"\n\t| \"optional\"\n\t| \"readonly\"\n\t| \"function\"\n\t| \"instanceof\";\n\n/**\n * Base interface for type factory types.\n * @alpha\n */\nexport interface TypeFactoryType {\n\t/**\n\t * The kind of type this represents.\n\t */\n\treadonly _kind: TypeFactoryTypeKind;\n}\n\n/**\n * Set of valid type factory type kinds for efficient validation.\n * @internal\n */\nconst validTypeKinds: ReadonlySet<TypeFactoryTypeKind> = new Set<TypeFactoryTypeKind>([\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"void\",\n\t\"undefined\",\n\t\"null\",\n\t\"unknown\",\n\t\"date\",\n\t\"promise\",\n\t\"array\",\n\t\"object\",\n\t\"record\",\n\t\"map\",\n\t\"tuple\",\n\t\"union\",\n\t\"intersection\",\n\t\"literal\",\n\t\"optional\",\n\t\"readonly\",\n\t\"function\",\n\t\"instanceof\",\n]);\n\n/**\n * Type guard to check if a value is a type factory type.\n * @alpha\n */\nexport function isTypeFactoryType(value: unknown): value is TypeFactoryType {\n\tif (typeof value !== \"object\" || value === null || !(\"_kind\" in value)) {\n\t\treturn false;\n\t}\n\tconst kind = (value as { _kind: unknown })._kind;\n\treturn typeof kind === \"string\" && validTypeKinds.has(kind as TypeFactoryTypeKind);\n}\n\n// Primitive type factories\n\n/**\n * Represents a string type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryString extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"string\";\n}\n\n/**\n * Represents a number type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryNumber extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"number\";\n}\n\n/**\n * Represents a boolean type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryBoolean extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"boolean\";\n}\n\n/**\n * Represents a Date type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryDate extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"date\";\n}\n\n/**\n * Represents a void type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryVoid extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"void\";\n}\n\n/**\n * Represents an undefined type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryUndefined extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"undefined\";\n}\n\n/**\n * Represents a null type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryNull extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"null\";\n}\n\n/**\n * Represents an unknown type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryUnknown extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"unknown\";\n}\n\n// Complex type interfaces\n\n/**\n * Represents an array type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryArray extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"array\";\n\t/**\n\t * The type of elements in the array.\n\t */\n\treadonly element: TypeFactoryType;\n}\n\n/**\n * Represents a Promise type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryPromise extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"promise\";\n\t/**\n\t * The type that the Promise resolves to.\n\t */\n\treadonly innerType: TypeFactoryType;\n}\n\n/**\n * Represents an object type with a fixed shape in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryObject extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"object\";\n\t/**\n\t * The shape of the object, mapping property names to their types.\n\t */\n\treadonly shape: Record<string, TypeFactoryType>;\n}\n\n/**\n * Represents a record type (index signature) in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryRecord extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"record\";\n\t/**\n\t * The type of the record's keys.\n\t */\n\treadonly keyType: TypeFactoryType;\n\t/**\n\t * The type of the record's values.\n\t */\n\treadonly valueType: TypeFactoryType;\n}\n\n/**\n * Represents a Map type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryMap extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"map\";\n\t/**\n\t * The type of the map's keys.\n\t */\n\treadonly keyType: TypeFactoryType;\n\t/**\n\t * The type of the map's values.\n\t */\n\treadonly valueType: TypeFactoryType;\n}\n\n/**\n * Represents a tuple type with fixed-length items and optional rest elements in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryTuple extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"tuple\";\n\t/**\n\t * The fixed-length items in the tuple.\n\t */\n\treadonly items: readonly TypeFactoryType[];\n\t/**\n\t * Optional rest element type for variable-length tuples.\n\t */\n\treadonly rest?: TypeFactoryType;\n}\n\n/**\n * Represents a union type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryUnion extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"union\";\n\t/**\n\t * The possible types in the union.\n\t */\n\treadonly options: readonly TypeFactoryType[];\n}\n\n/**\n * Represents an intersection type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryIntersection extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"intersection\";\n\t/**\n\t * The types to intersect.\n\t */\n\treadonly types: readonly TypeFactoryType[];\n}\n\n/**\n * Represents a literal type (specific string, number, or boolean value) in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryLiteral extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"literal\";\n\t/**\n\t * The specific literal value.\n\t */\n\treadonly value: string | number | boolean;\n}\n\n/**\n * Represents an optional type modifier in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryOptional extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"optional\";\n\t/**\n\t * The inner type that is optional.\n\t */\n\treadonly innerType: TypeFactoryType;\n}\n\n/**\n * Represents a readonly type modifier in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryReadonly extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"readonly\";\n\t/**\n\t * The inner type that is readonly.\n\t */\n\treadonly innerType: TypeFactoryType;\n}\n\n/**\n * Represents a function parameter as a tuple of [name, type].\n * @alpha\n */\nexport type TypeFactoryFunctionParameter = readonly [name: string, type: TypeFactoryType];\n\n/**\n * Represents a function type in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryFunction extends TypeFactoryType {\n\t/**\n\t * {@inheritDoc TypeFactoryType._kind}\n\t */\n\treadonly _kind: \"function\";\n\t/**\n\t * The function parameters.\n\t */\n\treadonly parameters: readonly TypeFactoryFunctionParameter[];\n\t/**\n\t * The function return type.\n\t */\n\treadonly returnType: TypeFactoryType;\n\t/**\n\t * Optional rest parameter for variable-length argument lists.\n\t */\n\treadonly restParameter?: TypeFactoryFunctionParameter;\n}\n\n/**\n * Represents an instanceof type that references a class in the type factory system.\n * @alpha\n */\nexport interface TypeFactoryInstanceOf extends TypeFactoryType {\n\t/**\n\t * The kind of type this represents.\n\t */\n\treadonly _kind: \"instanceof\";\n\t/**\n\t * The constructor to reference.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treadonly constructor: new (\n\t\t...args: any[]\n\t) => unknown;\n}\n\n/**\n * Namespace containing type factory functions for building type definitions\n * that describe method signatures and property types to an LLM agent.\n *\n * @internal\n */\nexport const typeFactory = {\n\t/**\n\t * Create a string type.\n\t * @alpha\n\t */\n\tstring(): TypeFactoryString {\n\t\treturn { _kind: \"string\" };\n\t},\n\n\t/**\n\t * Create a number type.\n\t * @alpha\n\t */\n\tnumber(): TypeFactoryNumber {\n\t\treturn { _kind: \"number\" };\n\t},\n\n\t/**\n\t * Create a boolean type.\n\t * @alpha\n\t */\n\tboolean(): TypeFactoryBoolean {\n\t\treturn { _kind: \"boolean\" };\n\t},\n\n\t/**\n\t * Create a Date type.\n\t * @alpha\n\t */\n\tdate(): TypeFactoryDate {\n\t\treturn { _kind: \"date\" };\n\t},\n\n\t/**\n\t * Create a void type.\n\t * @alpha\n\t */\n\tvoid(): TypeFactoryVoid {\n\t\treturn { _kind: \"void\" };\n\t},\n\n\t/**\n\t * Create an undefined type.\n\t * @alpha\n\t */\n\tundefined(): TypeFactoryUndefined {\n\t\treturn { _kind: \"undefined\" };\n\t},\n\n\t/**\n\t * Create a null type.\n\t * @alpha\n\t */\n\tnull(): TypeFactoryNull {\n\t\treturn { _kind: \"null\" };\n\t},\n\n\t/**\n\t * Create an unknown type.\n\t * @alpha\n\t */\n\tunknown(): TypeFactoryUnknown {\n\t\treturn { _kind: \"unknown\" };\n\t},\n\n\t/**\n\t * Create an array type.\n\t * @alpha\n\t */\n\tarray(element: TypeFactoryType): TypeFactoryArray {\n\t\treturn { _kind: \"array\", element };\n\t},\n\n\t/**\n\t * Create a Promise type.\n\t * @alpha\n\t */\n\tpromise(innerType: TypeFactoryType): TypeFactoryPromise {\n\t\treturn { _kind: \"promise\", innerType };\n\t},\n\n\t/**\n\t * Create an object type.\n\t * @alpha\n\t */\n\tobject(shape: Record<string, TypeFactoryType>): TypeFactoryObject {\n\t\treturn { _kind: \"object\", shape };\n\t},\n\n\t/**\n\t * Create a record type.\n\t * @alpha\n\t */\n\trecord(keyType: TypeFactoryType, valueType: TypeFactoryType): TypeFactoryRecord {\n\t\treturn { _kind: \"record\", keyType, valueType };\n\t},\n\n\t/**\n\t * Create a map type.\n\t * @alpha\n\t */\n\tmap(keyType: TypeFactoryType, valueType: TypeFactoryType): TypeFactoryMap {\n\t\treturn { _kind: \"map\", keyType, valueType };\n\t},\n\n\t/**\n\t * Create a tuple type.\n\t * @alpha\n\t */\n\ttuple(items: readonly TypeFactoryType[], rest?: TypeFactoryType): TypeFactoryTuple {\n\t\tif (items.length === 0 && rest === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"typeFactory.tuple requires at least one item or a rest type. Empty tuples are not supported.\",\n\t\t\t);\n\t\t}\n\t\treturn rest === undefined ? { _kind: \"tuple\", items } : { _kind: \"tuple\", items, rest };\n\t},\n\n\t/**\n\t * Create a union type.\n\t * @alpha\n\t */\n\tunion(options: readonly TypeFactoryType[]): TypeFactoryUnion {\n\t\tif (options.length === 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"typeFactory.union requires at least one option. Empty unions are not valid TypeScript types.\",\n\t\t\t);\n\t\t}\n\t\treturn { _kind: \"union\", options };\n\t},\n\n\t/**\n\t * Create an intersection type.\n\t * @alpha\n\t */\n\tintersection(types: readonly TypeFactoryType[]): TypeFactoryIntersection {\n\t\tif (types.length === 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"typeFactory.intersection requires at least one type. Empty intersections are not valid TypeScript types.\",\n\t\t\t);\n\t\t}\n\t\treturn { _kind: \"intersection\", types };\n\t},\n\n\t/**\n\t * Create a literal type.\n\t * @alpha\n\t */\n\tliteral(value: string | number | boolean): TypeFactoryLiteral {\n\t\treturn { _kind: \"literal\", value };\n\t},\n\n\t/**\n\t * Create an optional type.\n\t * @alpha\n\t */\n\toptional(innerType: TypeFactoryType): TypeFactoryOptional {\n\t\treturn { _kind: \"optional\", innerType };\n\t},\n\n\t/**\n\t * Create a readonly type.\n\t * @alpha\n\t */\n\treadonly(innerType: TypeFactoryType): TypeFactoryReadonly {\n\t\treturn { _kind: \"readonly\", innerType };\n\t},\n\n\t/**\n\t * Create a function type.\n\t * @alpha\n\t */\n\tfunction(\n\t\tparameters: readonly TypeFactoryFunctionParameter[],\n\t\treturnType: TypeFactoryType,\n\t\trestParameter?: TypeFactoryFunctionParameter,\n\t): TypeFactoryFunction {\n\t\treturn restParameter === undefined\n\t\t\t? { _kind: \"function\", parameters, returnType }\n\t\t\t: { _kind: \"function\", parameters, returnType, restParameter };\n\t},\n\n\t/**\n\t * Create an instanceOf type for a class.\n\t * @remarks\n\t * This is an untyped version. `@fluidframework/tree-agent` re-exports a\n\t * narrower override that constrains the constructor to `ObjectNodeSchema`.\n\t * @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinstanceOf(constructor: new (...args: any[]) => unknown): TypeFactoryInstanceOf {\n\t\treturn { _kind: \"instanceof\", constructor };\n\t},\n};\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.58.1"
9
+ }
10
+ ]
11
+ }