@typespec/compiler 0.65.0-dev.1 → 0.65.0-dev.11
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/generated-defs/TypeSpec.d.ts +66 -32
- package/dist/generated-defs/TypeSpec.d.ts.map +1 -1
- package/dist/manifest.js +2 -2
- package/dist/src/core/binder.d.ts +1 -1
- package/dist/src/core/checker.d.ts.map +1 -1
- package/dist/src/core/checker.js +1 -2
- package/dist/src/core/checker.js.map +1 -1
- package/dist/src/core/compiler-code-fixes/convert-to-value.codefix.d.ts +10 -0
- package/dist/src/core/compiler-code-fixes/convert-to-value.codefix.d.ts.map +1 -0
- package/dist/src/core/compiler-code-fixes/convert-to-value.codefix.js +68 -0
- package/dist/src/core/compiler-code-fixes/convert-to-value.codefix.js.map +1 -0
- package/dist/src/core/visibility/core.d.ts +13 -0
- package/dist/src/core/visibility/core.d.ts.map +1 -1
- package/dist/src/core/visibility/core.js +28 -26
- package/dist/src/core/visibility/core.js.map +1 -1
- package/dist/src/core/visibility/index.d.ts +1 -1
- package/dist/src/core/visibility/index.d.ts.map +1 -1
- package/dist/src/core/visibility/index.js +1 -1
- package/dist/src/core/visibility/index.js.map +1 -1
- package/dist/src/core/visibility/lifecycle.d.ts.map +1 -1
- package/dist/src/core/visibility/lifecycle.js +8 -0
- package/dist/src/core/visibility/lifecycle.js.map +1 -1
- package/dist/src/emitter-framework/types.d.ts.map +1 -1
- package/dist/src/experimental/index.d.ts +6 -2
- package/dist/src/experimental/index.d.ts.map +1 -1
- package/dist/src/experimental/index.js +6 -2
- package/dist/src/experimental/index.js.map +1 -1
- package/dist/src/experimental/typekit/kits/literal.d.ts +61 -52
- package/dist/src/experimental/typekit/kits/literal.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/literal.js.map +1 -1
- package/dist/src/experimental/typekit/kits/model-property.d.ts +11 -3
- package/dist/src/experimental/typekit/kits/model-property.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/model-property.js.map +1 -1
- package/dist/src/experimental/typekit/kits/model.d.ts +41 -15
- package/dist/src/experimental/typekit/kits/model.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/model.js +4 -0
- package/dist/src/experimental/typekit/kits/model.js.map +1 -1
- package/dist/src/experimental/typekit/kits/scalar.d.ts +349 -344
- package/dist/src/experimental/typekit/kits/scalar.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/scalar.js.map +1 -1
- package/dist/src/experimental/typekit/kits/type.d.ts +5 -4
- package/dist/src/experimental/typekit/kits/type.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/type.js.map +1 -1
- package/dist/src/experimental/typekit/kits/union-variant.d.ts +28 -15
- package/dist/src/experimental/typekit/kits/union-variant.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/union-variant.js.map +1 -1
- package/dist/src/experimental/typekit/kits/union.d.ts +39 -30
- package/dist/src/experimental/typekit/kits/union.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/union.js.map +1 -1
- package/dist/src/lib/decorators.d.ts +0 -1
- package/dist/src/lib/decorators.d.ts.map +1 -1
- package/dist/src/lib/decorators.js +15 -15
- package/dist/src/lib/decorators.js.map +1 -1
- package/dist/src/lib/encoded-names.d.ts.map +1 -1
- package/dist/src/lib/encoded-names.js +5 -3
- package/dist/src/lib/encoded-names.js.map +1 -1
- package/dist/src/lib/key.d.ts.map +1 -1
- package/dist/src/lib/key.js +5 -2
- package/dist/src/lib/key.js.map +1 -1
- package/dist/src/lib/paging.d.ts.map +1 -1
- package/dist/src/lib/paging.js +5 -3
- package/dist/src/lib/paging.js.map +1 -1
- package/dist/src/lib/service.js +1 -1
- package/dist/src/lib/service.js.map +1 -1
- package/dist/src/lib/utils.d.ts +1 -3
- package/dist/src/lib/utils.d.ts.map +1 -1
- package/dist/src/lib/utils.js +0 -10
- package/dist/src/lib/utils.js.map +1 -1
- package/dist/src/lib/visibility.d.ts +54 -0
- package/dist/src/lib/visibility.d.ts.map +1 -1
- package/dist/src/lib/visibility.js +90 -3
- package/dist/src/lib/visibility.js.map +1 -1
- package/dist/src/server/lib-provider.d.ts +23 -0
- package/dist/src/server/lib-provider.d.ts.map +1 -0
- package/dist/src/server/{emitter-provider.js → lib-provider.js} +25 -23
- package/dist/src/server/lib-provider.js.map +1 -0
- package/dist/src/server/serverlib.d.ts.map +1 -1
- package/dist/src/server/serverlib.js +5 -2
- package/dist/src/server/serverlib.js.map +1 -1
- package/dist/src/server/tspconfig/completion.d.ts +5 -3
- package/dist/src/server/tspconfig/completion.d.ts.map +1 -1
- package/dist/src/server/tspconfig/completion.js +234 -16
- package/dist/src/server/tspconfig/completion.js.map +1 -1
- package/dist/src/server/yaml-resolver.d.ts +20 -2
- package/dist/src/server/yaml-resolver.d.ts.map +1 -1
- package/dist/src/server/yaml-resolver.js +39 -6
- package/dist/src/server/yaml-resolver.js.map +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/{experimental → utils}/state-accessor.d.ts +2 -4
- package/dist/src/utils/state-accessor.d.ts.map +1 -0
- package/dist/src/{experimental → utils}/state-accessor.js +2 -4
- package/dist/src/utils/state-accessor.js.map +1 -0
- package/lib/std/visibility.tsp +210 -36
- package/package.json +15 -11
- package/templates/__snapshots__/rest/.gitignore +9 -0
- package/templates/__snapshots__/rest/main.tsp +40 -0
- package/templates/__snapshots__/rest/package.json +20 -0
- package/templates/__snapshots__/rest/tspconfig.yaml +16 -0
- package/templates/rest/main.tsp +40 -0
- package/templates/scaffolding.json +51 -5
- package/dist/src/core/compiler-code-fixes/model-to-object-literal.codefix.d.ts +0 -6
- package/dist/src/core/compiler-code-fixes/model-to-object-literal.codefix.d.ts.map +0 -1
- package/dist/src/core/compiler-code-fixes/model-to-object-literal.codefix.js +0 -15
- package/dist/src/core/compiler-code-fixes/model-to-object-literal.codefix.js.map +0 -1
- package/dist/src/core/compiler-code-fixes/tuple-to-array-value.codefix.d.ts +0 -6
- package/dist/src/core/compiler-code-fixes/tuple-to-array-value.codefix.d.ts.map +0 -1
- package/dist/src/core/compiler-code-fixes/tuple-to-array-value.codefix.js +0 -15
- package/dist/src/core/compiler-code-fixes/tuple-to-array-value.codefix.js.map +0 -1
- package/dist/src/experimental/state-accessor.d.ts.map +0 -1
- package/dist/src/experimental/state-accessor.js.map +0 -1
- package/dist/src/server/emitter-provider.d.ts +0 -22
- package/dist/src/server/emitter-provider.d.ts.map +0 -1
- package/dist/src/server/emitter-provider.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-property.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAU,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAwB,MAAM,4BAA4B,CAAC;AAG9E
|
|
1
|
+
{"version":3,"file":"model-property.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAU,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAwB,MAAM,4BAA4B,CAAC;AAG9E;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,aAAa,CAAC;IAEtC;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;IAE7D;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;IAEvD;;OAEG;IACH,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;CACxF;AAED,UAAU,gBAAgB;IACxB;;;;;;;OAOG;IACH,aAAa,EAAE,gBAAgB,CAAC;CACjC;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,OAAQ,SAAQ,gBAAgB;KAAG;CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-property.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAc,SAAS,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-property.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAc,SAAS,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAyD7C,SAAS,CAAmB;IAC1B,aAAa,EAAE;QACb,EAAE,CAAC,IAAI;YACL,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC;QACvC,CAAC;QAED,WAAW,CAAC,IAAI;YACd,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAc,CAAC,CAAC;QACvF,CAAC;QAED,SAAS,CAAC,IAAI;YACZ,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAc,CAAC,CAAC;QACvF,CAAC;QAED,qBAAqB,CAAC,QAAQ,EAAE,eAAe;YAC7C,OAAO,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxE,CAAC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -24,24 +24,50 @@ interface ModelDescriptor {
|
|
|
24
24
|
*/
|
|
25
25
|
sourceModels?: SourceModel[];
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Utilities for working with models.
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
27
31
|
export interface ModelKit {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Create a model type.
|
|
34
|
+
*
|
|
35
|
+
* @param desc The descriptor of the model.
|
|
36
|
+
*/
|
|
37
|
+
create(desc: ModelDescriptor): Model;
|
|
38
|
+
/**
|
|
39
|
+
* Check if the given `type` is a model..
|
|
40
|
+
*
|
|
41
|
+
* @param type The type to check.
|
|
42
|
+
*/
|
|
43
|
+
is(type: Type): type is Model;
|
|
44
|
+
/**
|
|
45
|
+
* If the input is anonymous (or the provided filter removes properties)
|
|
46
|
+
* and there exists a named model with the same set of properties
|
|
47
|
+
* (ignoring filtered properties), then return that named model.
|
|
48
|
+
* Otherwise, return the input unchanged.
|
|
49
|
+
*
|
|
50
|
+
* This can be used by emitters to find a better name for a set of
|
|
51
|
+
* properties after filtering. For example, given `{ @metadata prop:
|
|
52
|
+
* string} & SomeName`, and an emitter that wishes to discard properties
|
|
53
|
+
* marked with `@metadata`, the emitter can use this to recover that the
|
|
54
|
+
* best name for the remaining properties is `SomeName`.
|
|
55
|
+
*
|
|
56
|
+
* @param model The input model
|
|
57
|
+
* @param filter An optional filter to apply to the input model's
|
|
58
|
+
* properties.
|
|
59
|
+
*/
|
|
60
|
+
getEffectiveModel(model: Model, filter?: (property: ModelProperty) => boolean): Model;
|
|
61
|
+
}
|
|
62
|
+
interface TypekitExtension {
|
|
63
|
+
/**
|
|
64
|
+
* Utilities for working with models.
|
|
65
|
+
* @experimental
|
|
66
|
+
*/
|
|
67
|
+
model: ModelKit;
|
|
42
68
|
}
|
|
43
69
|
declare module "../define-kit.js" {
|
|
44
|
-
interface Typekit extends
|
|
70
|
+
interface Typekit extends TypekitExtension {
|
|
45
71
|
}
|
|
46
72
|
}
|
|
47
73
|
export declare const ModelKit: void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EAAwB,aAAa,EAAE,MAAM,aAAa,CAAC;AAElE,oBAAoB;AACpB,UAAU,eAAe;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE1C;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,KAAK,CAAC;IAErC;;;;OAIG;IACH,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC;IAE9B;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,GAAG,KAAK,CAAC;CACvF;AAED,UAAU,gBAAgB;IACxB;;;OAGG;IACH,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,OAAQ,SAAQ,gBAAgB;KAAG;CAC9C;AAED,eAAO,MAAM,QAAQ,MA0BnB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getEffectiveModelType } from "../../../core/checker.js";
|
|
1
2
|
import { createRekeyableMap } from "../../../utils/misc.js";
|
|
2
3
|
import { defineKit } from "../define-kit.js";
|
|
3
4
|
import { decoratorApplication } from "../utils.js";
|
|
@@ -21,6 +22,9 @@ export const ModelKit = defineKit({
|
|
|
21
22
|
is(type) {
|
|
22
23
|
return type.kind === "Model";
|
|
23
24
|
},
|
|
25
|
+
getEffectiveModel(model, filter) {
|
|
26
|
+
return getEffectiveModelType(this.program, model, filter);
|
|
27
|
+
},
|
|
24
28
|
},
|
|
25
29
|
});
|
|
26
30
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAiB,MAAM,aAAa,CAAC;AAiFlE,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAmB;IAClD,KAAK,EAAE;QACL,MAAM,CAAC,IAAI;YACT,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACnF,MAAM,KAAK,GAAU,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;gBACnD,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;gBACrB,UAAU,EAAE,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC;gBACvD,UAAU,EAAE,UAAU;gBACtB,UAAU,EAAE,IAAI,CAAC,IAAI,KAAK,SAAS;gBACnC,IAAI,EAAE,SAAgB;gBACtB,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE;gBACvC,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;aACtC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,EAAE,CAAC,IAAI;YACL,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;QAC/B,CAAC;QACD,iBAAiB,CAAC,KAAK,EAAE,MAA6C;YACpE,OAAO,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC5D,CAAC;KACF;CACF,CAAC,CAAC"}
|