@typespec/compiler 0.67.0-dev.0 → 0.67.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.Prototypes.d.ts +1 -1
- package/dist/generated-defs/TypeSpec.Prototypes.d.ts.map +1 -1
- package/dist/generated-defs/TypeSpec.d.ts +11 -65
- package/dist/generated-defs/TypeSpec.d.ts.map +1 -1
- package/dist/manifest.js +2 -2
- package/dist/src/config/config-loader.d.ts +0 -1
- package/dist/src/config/config-loader.d.ts.map +1 -1
- package/dist/src/config/config-loader.js +2 -26
- package/dist/src/config/config-loader.js.map +1 -1
- package/dist/src/config/config-to-options.d.ts.map +1 -1
- package/dist/src/config/config-to-options.js +2 -1
- package/dist/src/config/config-to-options.js.map +1 -1
- package/dist/src/config/types.d.ts +1 -1
- package/dist/src/core/checker.d.ts +0 -11
- package/dist/src/core/checker.d.ts.map +1 -1
- package/dist/src/core/checker.js +1 -20
- package/dist/src/core/checker.js.map +1 -1
- package/dist/src/core/cli/cli.js +8 -7
- package/dist/src/core/cli/cli.js.map +1 -1
- package/dist/src/core/decorator-utils.d.ts +0 -26
- package/dist/src/core/decorator-utils.d.ts.map +1 -1
- package/dist/src/core/decorator-utils.js +0 -104
- package/dist/src/core/decorator-utils.js.map +1 -1
- package/dist/src/core/diagnostic-error.d.ts +7 -0
- package/dist/src/core/diagnostic-error.d.ts.map +1 -0
- package/dist/src/core/diagnostic-error.js +9 -0
- package/dist/src/core/diagnostic-error.js.map +1 -0
- package/dist/src/core/emitter-utils.js +2 -2
- package/dist/src/core/emitter-utils.js.map +1 -1
- package/dist/src/core/entrypoint-resolution.d.ts.map +1 -1
- package/dist/src/core/entrypoint-resolution.js +1 -8
- package/dist/src/core/entrypoint-resolution.js.map +1 -1
- package/dist/src/core/formatter.d.ts +0 -2
- package/dist/src/core/formatter.d.ts.map +1 -1
- package/dist/src/core/formatter.js +0 -2
- package/dist/src/core/formatter.js.map +1 -1
- package/dist/src/core/helpers/index.d.ts +6 -7
- package/dist/src/core/helpers/index.d.ts.map +1 -1
- package/dist/src/core/helpers/index.js +6 -7
- package/dist/src/core/helpers/index.js.map +1 -1
- package/dist/src/core/helpers/string-template-utils.d.ts +0 -4
- package/dist/src/core/helpers/string-template-utils.d.ts.map +1 -1
- package/dist/src/core/helpers/string-template-utils.js +0 -11
- package/dist/src/core/helpers/string-template-utils.js.map +1 -1
- package/dist/src/core/index.d.ts +1 -26
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +1 -26
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/intrinsic-type-state.d.ts +1 -1
- package/dist/src/core/intrinsic-type-state.d.ts.map +1 -1
- package/dist/src/core/library.d.ts +0 -4
- package/dist/src/core/library.d.ts.map +1 -1
- package/dist/src/core/library.js +0 -4
- package/dist/src/core/library.js.map +1 -1
- package/dist/src/core/messages.d.ts +18 -64
- package/dist/src/core/messages.d.ts.map +1 -1
- package/dist/src/core/messages.js +4 -18
- package/dist/src/core/messages.js.map +1 -1
- package/dist/src/core/options.d.ts +0 -10
- package/dist/src/core/options.d.ts.map +1 -1
- package/dist/src/core/program.d.ts.map +1 -1
- package/dist/src/core/program.js +10 -27
- package/dist/src/core/program.js.map +1 -1
- package/dist/src/core/projected-program.d.ts +1 -1
- package/dist/src/core/projected-program.d.ts.map +1 -1
- package/dist/src/core/projector.d.ts.map +1 -1
- package/dist/src/core/projector.js +0 -5
- package/dist/src/core/projector.js.map +1 -1
- package/dist/src/core/source-file.js +1 -1
- package/dist/src/core/source-file.js.map +1 -1
- package/dist/src/core/types.d.ts +0 -37
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/types.js +0 -2
- package/dist/src/core/types.js.map +1 -1
- package/dist/src/core/visibility/core.d.ts +0 -50
- package/dist/src/core/visibility/core.d.ts.map +1 -1
- package/dist/src/core/visibility/core.js +18 -80
- 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 +1 -19
- package/dist/src/core/visibility/lifecycle.d.ts.map +1 -1
- package/dist/src/core/visibility/lifecycle.js +0 -52
- package/dist/src/core/visibility/lifecycle.js.map +1 -1
- package/dist/src/emitter-framework/asset-emitter.d.ts +2 -1
- package/dist/src/emitter-framework/asset-emitter.d.ts.map +1 -1
- package/dist/src/emitter-framework/asset-emitter.js.map +1 -1
- package/dist/src/emitter-framework/builders/array-builder.js +1 -1
- package/dist/src/emitter-framework/builders/array-builder.js.map +1 -1
- package/dist/src/emitter-framework/builders/object-builder.js +1 -1
- package/dist/src/emitter-framework/builders/object-builder.js.map +1 -1
- package/dist/src/emitter-framework/index.d.ts +7 -7
- package/dist/src/emitter-framework/index.d.ts.map +1 -1
- package/dist/src/emitter-framework/index.js +7 -7
- package/dist/src/emitter-framework/index.js.map +1 -1
- package/dist/src/emitter-framework/reference-cycle.d.ts +1 -1
- package/dist/src/emitter-framework/types.d.ts +2 -1
- package/dist/src/emitter-framework/types.d.ts.map +1 -1
- package/dist/src/experimental/freeze-graph.d.ts +1 -1
- package/dist/src/experimental/freeze-graph.d.ts.map +1 -1
- package/dist/src/experimental/freeze-graph.js +1 -1
- package/dist/src/experimental/freeze-graph.js.map +1 -1
- package/dist/src/experimental/index.d.ts +1 -6
- package/dist/src/experimental/index.d.ts.map +1 -1
- package/dist/src/experimental/index.js +1 -6
- package/dist/src/experimental/index.js.map +1 -1
- package/dist/src/experimental/mutators.d.ts.map +1 -1
- package/dist/src/experimental/mutators.js +2 -1
- package/dist/src/experimental/mutators.js.map +1 -1
- package/dist/src/experimental/typekit/define-kit.d.ts +1 -1
- package/dist/src/experimental/typekit/define-kit.d.ts.map +1 -1
- package/dist/src/experimental/typekit/define-kit.js.map +1 -1
- package/dist/src/experimental/typekit/index.d.ts +1 -1
- package/dist/src/experimental/typekit/index.d.ts.map +1 -1
- package/dist/src/experimental/typekit/index.js +1 -1
- package/dist/src/experimental/typekit/index.js.map +1 -1
- package/dist/src/experimental/typekit/kits/model.d.ts +11 -0
- package/dist/src/experimental/typekit/kits/model.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/model.js +19 -0
- package/dist/src/experimental/typekit/kits/model.js.map +1 -1
- package/dist/src/experimental/typekit/kits/type.js +1 -1
- package/dist/src/experimental/typekit/kits/type.js.map +1 -1
- package/dist/src/formatter/index.js +1 -1
- package/dist/src/formatter/index.js.map +1 -1
- package/dist/src/index.d.ts +30 -18
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +28 -17
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/init.d.ts.map +1 -1
- package/dist/src/init/init.js +7 -3
- package/dist/src/init/init.js.map +1 -1
- package/dist/src/install/config.d.ts +9 -0
- package/dist/src/install/config.d.ts.map +1 -0
- package/dist/src/install/config.js +16 -0
- package/dist/src/install/config.js.map +1 -0
- package/dist/src/install/install.d.ts +14 -0
- package/dist/src/install/install.d.ts.map +1 -0
- package/dist/src/install/install.js +159 -0
- package/dist/src/install/install.js.map +1 -0
- package/dist/src/install/spec.d.ts +39 -0
- package/dist/src/install/spec.d.ts.map +1 -0
- package/dist/src/install/spec.js +152 -0
- package/dist/src/install/spec.js.map +1 -0
- package/dist/src/lib/decorators.d.ts +2 -56
- package/dist/src/lib/decorators.d.ts.map +1 -1
- package/dist/src/lib/decorators.js +7 -111
- package/dist/src/lib/decorators.js.map +1 -1
- package/dist/src/lib/intrinsic/decorators.d.ts.map +1 -1
- package/dist/src/lib/key.d.ts +1 -1
- package/dist/src/lib/key.d.ts.map +1 -1
- package/dist/src/lib/paging.d.ts +1 -1
- package/dist/src/lib/paging.d.ts.map +1 -1
- package/dist/src/lib/paging.js +3 -1
- package/dist/src/lib/paging.js.map +1 -1
- package/dist/src/lib/service.d.ts +0 -2
- package/dist/src/lib/service.d.ts.map +1 -1
- package/dist/src/lib/service.js +1 -1
- package/dist/src/lib/service.js.map +1 -1
- package/dist/src/lib/tsp-index.d.ts +0 -1
- package/dist/src/lib/tsp-index.d.ts.map +1 -1
- package/dist/src/lib/tsp-index.js +1 -5
- package/dist/src/lib/tsp-index.js.map +1 -1
- package/dist/src/lib/visibility.d.ts +0 -18
- package/dist/src/lib/visibility.d.ts.map +1 -1
- package/dist/src/lib/visibility.js +35 -261
- package/dist/src/lib/visibility.js.map +1 -1
- package/dist/src/manifest.d.ts +0 -4
- package/dist/src/manifest.d.ts.map +1 -1
- package/dist/src/manifest.js +0 -2
- package/dist/src/manifest.js.map +1 -1
- package/dist/src/package-manger/npm-registry-utils.d.ts +83 -0
- package/dist/src/package-manger/npm-registry-utils.d.ts.map +1 -0
- package/dist/src/package-manger/npm-registry-utils.js +42 -0
- package/dist/src/package-manger/npm-registry-utils.js.map +1 -0
- package/dist/src/server/classify.d.ts +1 -1
- package/dist/src/server/classify.d.ts.map +1 -1
- package/dist/src/server/classify.js +4 -1
- package/dist/src/server/classify.js.map +1 -1
- package/dist/src/server/compile-service.d.ts +1 -1
- package/dist/src/server/compile-service.d.ts.map +1 -1
- package/dist/src/server/compile-service.js +3 -1
- package/dist/src/server/compile-service.js.map +1 -1
- package/dist/src/server/completion.d.ts +2 -1
- package/dist/src/server/completion.d.ts.map +1 -1
- package/dist/src/server/completion.js +4 -1
- package/dist/src/server/completion.js.map +1 -1
- package/dist/src/server/constants.d.ts +1 -1
- package/dist/src/server/constants.d.ts.map +1 -1
- package/dist/src/server/index.d.ts +2 -2
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +1 -2
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/language-config.d.ts +0 -99
- package/dist/src/server/language-config.d.ts.map +1 -1
- package/dist/src/server/language-config.js +0 -5
- package/dist/src/server/language-config.js.map +1 -1
- package/dist/src/server/npm-package-provider.d.ts +2 -2
- package/dist/src/server/serverlib.d.ts.map +1 -1
- package/dist/src/server/serverlib.js +3 -3
- package/dist/src/server/serverlib.js.map +1 -1
- package/dist/src/server/symbol-structure.d.ts +1 -1
- package/dist/src/server/symbol-structure.d.ts.map +1 -1
- package/dist/src/server/type-details.js +4 -1
- package/dist/src/server/type-details.js.map +1 -1
- package/dist/src/server/types.d.ts +4 -2
- package/dist/src/server/types.d.ts.map +1 -1
- package/dist/src/server/types.js.map +1 -1
- package/dist/src/server/yaml-resolver.d.ts +1 -1
- package/dist/src/server/yaml-resolver.d.ts.map +1 -1
- package/dist/src/testing/code-fix-testing.d.ts +1 -1
- package/dist/src/testing/code-fix-testing.d.ts.map +1 -1
- package/dist/src/testing/code-fix-testing.js +2 -1
- package/dist/src/testing/code-fix-testing.js.map +1 -1
- package/dist/src/testing/expect.d.ts +1 -1
- package/dist/src/testing/expect.d.ts.map +1 -1
- package/dist/src/testing/expect.js +2 -1
- package/dist/src/testing/expect.js.map +1 -1
- package/dist/src/testing/rule-tester.d.ts +1 -1
- package/dist/src/testing/rule-tester.d.ts.map +1 -1
- package/dist/src/testing/rule-tester.js +2 -1
- package/dist/src/testing/rule-tester.js.map +1 -1
- package/dist/src/testing/test-utils.d.ts +1 -1
- package/dist/src/testing/test-utils.d.ts.map +1 -1
- package/dist/src/testing/test-utils.js +3 -1
- package/dist/src/testing/test-utils.js.map +1 -1
- package/dist/src/testing/types.d.ts +3 -2
- package/dist/src/testing/types.d.ts.map +1 -1
- package/dist/src/testing/types.js.map +1 -1
- package/dist/src/types/package-json.d.ts +14 -0
- package/dist/src/types/package-json.d.ts.map +1 -1
- package/dist/src/utils/fs-utils.d.ts +3 -0
- package/dist/src/utils/fs-utils.d.ts.map +1 -0
- package/dist/src/utils/fs-utils.js +19 -0
- package/dist/src/utils/fs-utils.js.map +1 -0
- package/dist/src/utils/misc.d.ts +1 -2
- package/dist/src/utils/misc.d.ts.map +1 -1
- package/dist/src/utils/misc.js +1 -5
- package/dist/src/utils/misc.js.map +1 -1
- package/lib/std/decorators.tsp +0 -60
- package/lib/std/main.tsp +0 -1
- package/lib/std/types.tsp +1 -8
- package/lib/std/visibility.tsp +10 -16
- package/package.json +16 -15
- package/templates/scaffolding.json +1 -1
- package/dist/src/core/install.d.ts +0 -3
- package/dist/src/core/install.d.ts.map +0 -1
- package/dist/src/core/install.js +0 -60
- package/dist/src/core/install.js.map +0 -1
- package/lib/std/projected-names.tsp +0 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paging.d.ts","sourceRoot":"","sources":["../../../src/lib/paging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"paging.d.ts","sourceRoot":"","sources":["../../../src/lib/paging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,OAAO,KAAK,EAGV,UAAU,EACV,aAAa,EACb,SAAS,EAEV,MAAM,kBAAkB,CAAC;AAK1B,eAAO;AACL;;;;GAIG;AACH,MAAM,kDACN,QAAQ;AACR,kCAAkC;AAClC,aAAa,eACiC,CAAC;AAEjD,eAAO;AACL;;;;GAIG;AACH,gBAAgB,sDAChB,UAAU;AACV,oCAAoC;AACpC,eAAe,iBACsE,CAAC;AAExF,eAAO;AACL;;;;GAIG;AACH,mBAAmB,sDACnB,qBAAqB;AACrB,uCAAuC;AACvC,kBAAkB,oBAC4E,CAAC;AAEjG,eAAO;AACL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C,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;QACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;QACnC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC;KAC7C,CAAC;CACH;AAwDD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,SAAS,GACZ,CAAC,eAAe,GAAG,SAAS,EAAE,SAAS,UAAU,EAAE,CAAC,CAkBtD"}
|
package/dist/src/lib/paging.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { createDiagnosticCollector } from "../core/diagnostics.js";
|
|
1
2
|
import { getTypeName } from "../core/helpers/type-name-utils.js";
|
|
2
|
-
import { createDiagnosticCollector, isArrayModelType, navigateProgram, } from "../core/index.js";
|
|
3
3
|
import { createDiagnostic, reportDiagnostic } from "../core/messages.js";
|
|
4
|
+
import { navigateProgram } from "../core/semantic-walker.js";
|
|
5
|
+
import { isArrayModelType } from "../core/type-utils.js";
|
|
4
6
|
import { createStateSymbol } from "../lib/utils.js";
|
|
5
7
|
import { DuplicateTracker, useStateSet } from "../utils/index.js";
|
|
6
8
|
import { isNumericType, isStringType } from "./decorators.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paging.js","sourceRoot":"","sources":["../../../src/lib/paging.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"paging.js","sourceRoot":"","sources":["../../../src/lib/paging.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,O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|
|
|
3
3
|
import { Namespace } from "../core/types.js";
|
|
4
4
|
export interface ServiceDetails {
|
|
5
5
|
title?: string;
|
|
6
|
-
/** @deprecated Service version is deprecated. If wanting to describe a service versioning you can use the `@typespec/versioning` library. If wanting to describe the project version you can use the package.json version */
|
|
7
|
-
version?: string;
|
|
8
6
|
}
|
|
9
7
|
export interface Service extends ServiceDetails {
|
|
10
8
|
type: Namespace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/lib/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,kCAAkC,CAAC;AAGzF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAoB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI/D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/lib/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,kCAAkC,CAAC;AAGzF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAoB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI/D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAQ,SAAQ,cAAc;IAC7C,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,QAAA,MAAO,UAAU,4DAEhB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAExD;AAED,OAAO;AACL;;;;;GAKG;AACH,UAAU,GACX,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,cAAmB,GAC3B,IAAI,CAIN;AAED,eAAO,MAAM,QAAQ,EAAE,gBAgBtB,CAAC"}
|
package/dist/src/lib/service.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateDecoratorUniqueOnNode } from "../core/decorator-utils.js";
|
|
2
|
-
import { reportDeprecated } from "../core/
|
|
2
|
+
import { reportDeprecated } from "../core/diagnostics.js";
|
|
3
3
|
import { Realm } from "../experimental/realm.js";
|
|
4
4
|
import { useStateMap } from "../utils/index.js";
|
|
5
5
|
const [getService, setService, getServiceMap] = useStateMap(Symbol.for("@typespec/compiler.services"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/lib/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/lib/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,GAAG,WAAW,CACzD,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,M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tsp-index.d.ts","sourceRoot":"","sources":["../../../src/lib/tsp-index.ts"],"names":[],"mappings":"AA4HA,eAAO,MAAM,SAAS,aAAa,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $discriminator, $doc, $encode, $encodedName, $error, $errorsDoc, $example, $format, $friendlyName, $inspectType, $inspectTypeName, $key, $maxItems, $maxLength, $maxValue, $maxValueExclusive, $minItems, $minLength, $minValue, $minValueExclusive, $opExample, $overload, $pattern, $returnsDoc, $secret, $service, $summary, $tag, $withOptionalProperties, $withPickedProperties, $withoutDefaultValues, $withoutOmittedProperties, discriminatedDecorator, } from "./decorators.js";
|
|
2
2
|
import { continuationTokenDecorator, firstLinkDecorator, lastLinkDecorator, listDecorator, nextLinkDecorator, offsetDecorator, pageIndexDecorator, pageItemsDecorator, pageSizeDecorator, prevLinkDecorator, } from "./paging.js";
|
|
3
3
|
import { $defaultVisibility, $invisible, $parameterVisibility, $removeVisibility, $returnTypeVisibility, $visibility, $withDefaultKeyVisibility, $withLifecycleUpdate, $withUpdateableProperties, $withVisibility, $withVisibilityFilter, } from "./visibility.js";
|
|
4
4
|
/** @internal */
|
|
@@ -14,7 +14,6 @@ export const $decorators = {
|
|
|
14
14
|
summary: $summary,
|
|
15
15
|
returnsDoc: $returnsDoc,
|
|
16
16
|
errorsDoc: $errorsDoc,
|
|
17
|
-
deprecated: $deprecated,
|
|
18
17
|
service: $service,
|
|
19
18
|
error: $error,
|
|
20
19
|
format: $format,
|
|
@@ -30,10 +29,8 @@ export const $decorators = {
|
|
|
30
29
|
secret: $secret,
|
|
31
30
|
tag: $tag,
|
|
32
31
|
friendlyName: $friendlyName,
|
|
33
|
-
knownValues: $knownValues,
|
|
34
32
|
key: $key,
|
|
35
33
|
overload: $overload,
|
|
36
|
-
projectedName: $projectedName,
|
|
37
34
|
encodedName: $encodedName,
|
|
38
35
|
discriminated: discriminatedDecorator,
|
|
39
36
|
discriminator: $discriminator,
|
|
@@ -65,5 +62,4 @@ export const $decorators = {
|
|
|
65
62
|
};
|
|
66
63
|
// Projection function exports
|
|
67
64
|
export const namespace = "TypeSpec";
|
|
68
|
-
export { getProjectedName, hasProjectedName } from "./decorators.js";
|
|
69
65
|
//# sourceMappingURL=tsp-index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsp-index.js","sourceRoot":"","sources":["../../../src/lib/tsp-index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"tsp-index.js","sourceRoot":"","sources":["../../../src/lib/tsp-index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,gBAAgB;AAChB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB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AC7B,QAAQ,EAAE,iBAAiB;QAC3B,SAAS,EAAE,kBAAkB;QAC7B,iBAAiB,EAAE,0BAA0B;QAC7C,QAAQ,EAAE,iBAAiB;QAC3B,QAAQ,EAAE,iBAAiB;QAC3B,SAAS,EAAE,kBAAkB;QAC7B,QAAQ,EAAE,iBAAiB;KACC;CAC/B,CAAC;AAEF,8BAA8B;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC"}
|
|
@@ -4,15 +4,6 @@ import { Operation } from "../core/types.js";
|
|
|
4
4
|
import { VisibilityFilter } from "../core/visibility/core.js";
|
|
5
5
|
export declare const $withDefaultKeyVisibility: WithDefaultKeyVisibilityDecorator;
|
|
6
6
|
export declare const $parameterVisibility: ParameterVisibilityDecorator;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the visibilities of the parameters of the given operation, if provided with `@parameterVisibility`.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated Use `getParameterVisibilityFilter` instead. This function will be REMOVED in TypeSpec 1.0-rc.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link getParameterVisibilityFilter}
|
|
13
|
-
* @see {@link $parameterVisibility}
|
|
14
|
-
*/
|
|
15
|
-
export declare function getParameterVisibility(program: Program, entity: Operation): string[] | undefined;
|
|
16
7
|
/**
|
|
17
8
|
* A context-specific provider for visibility information that applies when parameter or return type visibility
|
|
18
9
|
* constraints are not explicitly specified. Visibility providers are provided by libraries that define implied
|
|
@@ -50,15 +41,6 @@ export declare const EmptyVisibilityProvider: VisibilityProvider;
|
|
|
50
41
|
*/
|
|
51
42
|
export declare function getParameterVisibilityFilter(program: Program, operation: Operation, defaultProvider: VisibilityProvider): VisibilityFilter;
|
|
52
43
|
export declare const $returnTypeVisibility: ReturnTypeVisibilityDecorator;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the visibilities of the return type of the given operation, if provided with `@returnTypeVisibility`.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Use `getReturnTypeVisibilityFilter` instead. This function will be REMOVED in TypeSpec 1.0-rc.
|
|
57
|
-
*
|
|
58
|
-
* @see {@link getReturnTypeVisibilityFilter}
|
|
59
|
-
* @see {@link $returnTypeVisibility}
|
|
60
|
-
*/
|
|
61
|
-
export declare function getReturnTypeVisibility(program: Program, entity: Operation): string[] | undefined;
|
|
62
44
|
/**
|
|
63
45
|
* Get the visibility filter that should apply to the return type of the given operation, or `undefined` if no return
|
|
64
46
|
* type visibility is set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/lib/visibility.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,iCAAiC,EACjC,4BAA4B,EAC5B,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/lib/visibility.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,iCAAiC,EACjC,4BAA4B,EAC5B,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EASL,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EASL,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAOpC,eAAO,MAAM,yBAAyB,EAAE,iCA+BvC,CAAC;AAoCF,eAAO,MAAM,oBAAoB,EAAE,4BAmBlC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;IACrE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAAC;CACtE;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,kBAGrC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,kBAAkB,GAClC,gBAAgB,CAiBlB;AAED,eAAO,MAAM,qBAAqB,EAAE,6BAmBnC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,kBAAkB,GAClC,gBAAgB,CAiBlB;AAQD,eAAO,MAAM,WAAW,EAAE,mBAWzB,CAAC;AAIF,eAAO,MAAM,iBAAiB,EAAE,yBAU/B,CAAC;AAIF,eAAO,MAAM,UAAU,EAAE,kBAMxB,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,0BAqBhC,CAAC;AAQF,eAAO,MAAM,eAAe,EAAE,uBAiB7B,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,iCAavC,CAAC;AAQF,eAAO,MAAM,qBAAqB,EAAE,6BAcnC,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,4BAuBlC,CAAC"}
|
|
@@ -1,154 +1,37 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { validateDecoratorTarget, validateDecoratorUniqueOnNode } from "../core/decorator-utils.js";
|
|
4
|
-
import {
|
|
4
|
+
import { compilerAssert } from "../core/diagnostics.js";
|
|
5
5
|
import { reportDiagnostic } from "../core/messages.js";
|
|
6
|
-
import { addVisibilityModifiers,
|
|
7
|
-
import { getLifecycleVisibilityEnum
|
|
6
|
+
import { addVisibilityModifiers, clearVisibilityModifiersForClass, getRawVisibilityStore, isVisible, removeVisibilityModifiers, resetVisibilityModifiersForClass, setDefaultModifierSetForVisibilityClass, VisibilityFilter, } from "../core/visibility/core.js";
|
|
7
|
+
import { getLifecycleVisibilityEnum } from "../core/visibility/lifecycle.js";
|
|
8
8
|
import { isMutableType, mutateSubgraph, MutatorFlow } from "../experimental/mutators.js";
|
|
9
9
|
import { useStateMap } from "../utils/index.js";
|
|
10
10
|
import { isKey } from "./key.js";
|
|
11
11
|
import { createStateSymbol, filterModelPropertiesInPlace } from "./utils.js";
|
|
12
|
-
// #region Legacy Visibility Utilities
|
|
13
|
-
/**
|
|
14
|
-
* Takes a list of visibilities that possibly include both legacy visibility
|
|
15
|
-
* strings and visibility class members, and returns two lists containing only
|
|
16
|
-
* each type.
|
|
17
|
-
*
|
|
18
|
-
* @param visibilities - The list of visibilities to split
|
|
19
|
-
* @returns a tuple containing visibility enum members in the first position and
|
|
20
|
-
* legacy visibility strings in the second position
|
|
21
|
-
*/
|
|
22
|
-
function splitLegacyVisibility(context, visibilities, decorator) {
|
|
23
|
-
const legacyVisibilities = [];
|
|
24
|
-
const modifiers = [];
|
|
25
|
-
let argIdx = 0;
|
|
26
|
-
const decoratorLocation = getSourceLocation(context.decoratorTarget);
|
|
27
|
-
const decoratorName = decorator.name.slice(1);
|
|
28
|
-
function isArgumentFixable(idx) {
|
|
29
|
-
const argTarget = context.getArgumentTarget(idx);
|
|
30
|
-
const argTargetIsStringLiteral = argTarget &&
|
|
31
|
-
typeof argTarget !== "symbol" &&
|
|
32
|
-
"kind" in argTarget &&
|
|
33
|
-
argTarget.kind === SyntaxKind.StringLiteral;
|
|
34
|
-
const argTargetSourceLocation = getSourceLocation(argTarget);
|
|
35
|
-
// We can fix the string if the target is a string literal
|
|
36
|
-
// in user code.
|
|
37
|
-
return (!!argTargetIsStringLiteral &&
|
|
38
|
-
argTargetSourceLocation !== undefined &&
|
|
39
|
-
!argTargetSourceLocation.isSynthetic &&
|
|
40
|
-
!argTargetSourceLocation.file.path.includes("node_modules"));
|
|
41
|
-
}
|
|
42
|
-
const allVisibilityStringsAreFixable = visibilities.every((v, idx) => {
|
|
43
|
-
if (typeof v !== "string")
|
|
44
|
-
return false;
|
|
45
|
-
const lifecycleModifier = normalizeLegacyLifecycleVisibilityString(context.program, v);
|
|
46
|
-
return lifecycleModifier && isArgumentFixable(idx);
|
|
47
|
-
});
|
|
48
|
-
for (const visibility of visibilities) {
|
|
49
|
-
if (typeof visibility === "string") {
|
|
50
|
-
const lifecycleModifier = normalizeLegacyLifecycleVisibilityString(context.program, visibility);
|
|
51
|
-
const canApplyCodeFix = isArgumentFixable(argIdx);
|
|
52
|
-
const argTarget = context.getArgumentTarget(argIdx);
|
|
53
|
-
const fallbackTarget = argTarget ?? context.decoratorTarget;
|
|
54
|
-
if (lifecycleModifier) {
|
|
55
|
-
const codefixes = [];
|
|
56
|
-
if (allVisibilityStringsAreFixable) {
|
|
57
|
-
let alreadyFixed = false;
|
|
58
|
-
codefixes.push({
|
|
59
|
-
id: "visibility-legacy-to-lifecycle",
|
|
60
|
-
label: `Convert to Lifecycle`,
|
|
61
|
-
fix: (ctx) => {
|
|
62
|
-
if (alreadyFixed)
|
|
63
|
-
return;
|
|
64
|
-
alreadyFixed = true;
|
|
65
|
-
const replacements = visibilities
|
|
66
|
-
.map((v) => {
|
|
67
|
-
const normalized = normalizeLegacyLifecycleVisibilityString(context.program, v);
|
|
68
|
-
return `Lifecycle.${normalized.name}`;
|
|
69
|
-
})
|
|
70
|
-
.join(", ");
|
|
71
|
-
return ctx.replaceText(decoratorLocation, `@${decoratorName}(${replacements})`);
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
reportDiagnostic(context.program, {
|
|
76
|
-
code: "visibility-legacy",
|
|
77
|
-
target: fallbackTarget,
|
|
78
|
-
messageId: "default",
|
|
79
|
-
format: {
|
|
80
|
-
modifier: visibility,
|
|
81
|
-
newModifier: `Lifecycle.${lifecycleModifier.name}`,
|
|
82
|
-
},
|
|
83
|
-
codefixes,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
else if (visibility === "none" && decoratorName === "visibility") {
|
|
87
|
-
const codefixes = [];
|
|
88
|
-
if (visibilities.length === 1 && canApplyCodeFix) {
|
|
89
|
-
codefixes.push({
|
|
90
|
-
id: "visibility-none-invisible-lifecycle",
|
|
91
|
-
label: "Convert to `@invisible(Lifecycle)`",
|
|
92
|
-
fix: (ctx) => {
|
|
93
|
-
return ctx.replaceText(decoratorLocation, "@invisible(Lifecycle)");
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
reportDiagnostic(context.program, {
|
|
98
|
-
code: "visibility-legacy",
|
|
99
|
-
messageId: "none",
|
|
100
|
-
target: decoratorLocation,
|
|
101
|
-
codefixes,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
reportDiagnostic(context.program, {
|
|
106
|
-
code: "visibility-legacy",
|
|
107
|
-
target: context.getArgumentTarget(argIdx) ?? context.decoratorTarget,
|
|
108
|
-
messageId: "unrecognized",
|
|
109
|
-
format: {
|
|
110
|
-
modifier: visibility,
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
legacyVisibilities.push(visibility);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
modifiers.push(visibility.value);
|
|
118
|
-
}
|
|
119
|
-
argIdx += 1;
|
|
120
|
-
}
|
|
121
|
-
return [modifiers, legacyVisibilities];
|
|
122
|
-
}
|
|
123
12
|
export const $withDefaultKeyVisibility = (context, entity, visibility) => {
|
|
124
|
-
const keyProperties = []
|
|
125
|
-
entity.properties.forEach((prop) => {
|
|
13
|
+
const keyProperties = [...entity.properties].filter(([_, prop]) => {
|
|
126
14
|
// Keep track of any key property without a visibility
|
|
127
|
-
|
|
128
|
-
if (isKey(context.program, prop) && !getVisibility(context.program, prop)) {
|
|
129
|
-
keyProperties.push(prop);
|
|
130
|
-
}
|
|
15
|
+
return isKey(context.program, prop) && !getRawVisibilityStore(context.program, prop);
|
|
131
16
|
});
|
|
132
17
|
// For each key property without a visibility, clone it and add the specified
|
|
133
18
|
// default visibility value
|
|
134
|
-
|
|
135
|
-
entity.properties.set(
|
|
19
|
+
for (const [name, keyProp] of keyProperties) {
|
|
20
|
+
entity.properties.set(name, context.program.checker.cloneType(keyProp, {
|
|
136
21
|
decorators: [
|
|
137
22
|
...keyProp.decorators,
|
|
138
23
|
{
|
|
139
24
|
decorator: $visibility,
|
|
140
25
|
args: [
|
|
141
26
|
{
|
|
142
|
-
value:
|
|
143
|
-
? context.program.checker.createLiteralType(visibility)
|
|
144
|
-
: visibility,
|
|
27
|
+
value: visibility,
|
|
145
28
|
jsValue: visibility,
|
|
146
29
|
},
|
|
147
30
|
],
|
|
148
31
|
},
|
|
149
32
|
],
|
|
150
33
|
}));
|
|
151
|
-
}
|
|
34
|
+
}
|
|
152
35
|
};
|
|
153
36
|
const [getOperationVisibilityConfigRaw, setOperationVisibilityConfigRaw] = useStateMap(createStateSymbol("operationVisibilityConfig"));
|
|
154
37
|
function getOperationVisibilityConfig(program, operation) {
|
|
@@ -159,47 +42,18 @@ function getOperationVisibilityConfig(program, operation) {
|
|
|
159
42
|
}
|
|
160
43
|
return config;
|
|
161
44
|
}
|
|
162
|
-
|
|
163
|
-
// to set the LegacyParameterVisibility flag. This is a hack.
|
|
164
|
-
const parameterVisibilityIsEmpty = Symbol.for("TypeSpec.Visibility.ParameterVisibilityIsEmpty");
|
|
165
|
-
export const $parameterVisibility = (context, operation, ...visibilities) => {
|
|
45
|
+
export const $parameterVisibility = (context, operation, ...modifiers) => {
|
|
166
46
|
validateDecoratorUniqueOnNode(context, operation, $parameterVisibility);
|
|
167
|
-
if (
|
|
47
|
+
if (modifiers.length === 0) {
|
|
168
48
|
reportDiagnostic(context.program, {
|
|
169
49
|
code: "operation-visibility-constraint-empty",
|
|
170
50
|
messageId: "parameter",
|
|
171
51
|
target: context.decoratorTarget,
|
|
172
52
|
});
|
|
173
|
-
context.program.stateSet(parameterVisibilityIsEmpty).add(operation);
|
|
174
|
-
}
|
|
175
|
-
const [modifiers, legacyVisibilities] = splitLegacyVisibility(context, visibilities, $parameterVisibility);
|
|
176
|
-
if (modifiers.length > 0 && legacyVisibilities.length > 0) {
|
|
177
|
-
reportDiagnostic(context.program, {
|
|
178
|
-
code: "visibility-mixed-legacy",
|
|
179
|
-
target: context.decoratorTarget,
|
|
180
|
-
});
|
|
181
53
|
return;
|
|
182
54
|
}
|
|
183
|
-
|
|
184
|
-
getOperationVisibilityConfig(context.program, operation).parameters = modifiers;
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
getOperationVisibilityConfig(context.program, operation).parameters = legacyVisibilities;
|
|
188
|
-
}
|
|
55
|
+
getOperationVisibilityConfig(context.program, operation).parameters = modifiers.map((m) => m.value);
|
|
189
56
|
};
|
|
190
|
-
/**
|
|
191
|
-
* Returns the visibilities of the parameters of the given operation, if provided with `@parameterVisibility`.
|
|
192
|
-
*
|
|
193
|
-
* @deprecated Use `getParameterVisibilityFilter` instead. This function will be REMOVED in TypeSpec 1.0-rc.
|
|
194
|
-
*
|
|
195
|
-
* @see {@link getParameterVisibilityFilter}
|
|
196
|
-
* @see {@link $parameterVisibility}
|
|
197
|
-
*/
|
|
198
|
-
export function getParameterVisibility(program, entity) {
|
|
199
|
-
return getOperationVisibilityConfig(program, entity)
|
|
200
|
-
.parameters?.map((p) => typeof p === "string" ? p : normalizeVisibilityToLegacyLifecycleString(program, p))
|
|
201
|
-
.filter((p) => !!p);
|
|
202
|
-
}
|
|
203
57
|
/**
|
|
204
58
|
* An empty visibility provider. This provider returns an empty filter that considers all properties visible. This filter
|
|
205
59
|
* is used when no context-specific visibility provider is available.
|
|
@@ -229,58 +83,27 @@ export function getParameterVisibilityFilter(program, operation, defaultProvider
|
|
|
229
83
|
const operationVisibilityConfig = getOperationVisibilityConfig(program, operation);
|
|
230
84
|
if (!operationVisibilityConfig.parameters)
|
|
231
85
|
return defaultProvider.parameters(program, operation);
|
|
232
|
-
|
|
233
|
-
// disable the default visibility provider for an operation.
|
|
234
|
-
if (operationVisibilityConfig.parameters.length === 0)
|
|
235
|
-
return {};
|
|
86
|
+
compilerAssert(operationVisibilityConfig.parameters.length !== 0, "Empty parameter visibility constraint.");
|
|
236
87
|
return {
|
|
237
88
|
// WARNING: the HTTP library depends on `any` being the only key in the filter object returned by this method.
|
|
238
89
|
// if you change this logic, you will need to update the HTTP library to account for differences in the
|
|
239
90
|
// returned object. HTTP does not currently have a way to express `all` or `none` constraints in the same
|
|
240
91
|
// way that the core visibility system does.
|
|
241
|
-
any: new Set(operationVisibilityConfig.parameters
|
|
242
|
-
.map((v) => typeof v === "string" ? normalizeLegacyLifecycleVisibilityString(program, v) : v)
|
|
243
|
-
.filter((v) => !!v)),
|
|
92
|
+
any: new Set(operationVisibilityConfig.parameters),
|
|
244
93
|
};
|
|
245
94
|
}
|
|
246
|
-
export const $returnTypeVisibility = (context, operation, ...
|
|
95
|
+
export const $returnTypeVisibility = (context, operation, ...modifiers) => {
|
|
247
96
|
validateDecoratorUniqueOnNode(context, operation, $parameterVisibility);
|
|
248
|
-
if (
|
|
97
|
+
if (modifiers.length === 0) {
|
|
249
98
|
reportDiagnostic(context.program, {
|
|
250
99
|
code: "operation-visibility-constraint-empty",
|
|
251
100
|
messageId: "returnType",
|
|
252
101
|
target: context.decoratorTarget,
|
|
253
102
|
});
|
|
254
|
-
context.program.stateSet(parameterVisibilityIsEmpty).add(operation);
|
|
255
|
-
}
|
|
256
|
-
const [modifiers, legacyVisibilities] = splitLegacyVisibility(context, visibilities, $returnTypeVisibility);
|
|
257
|
-
if (modifiers.length > 0 && legacyVisibilities.length > 0) {
|
|
258
|
-
reportDiagnostic(context.program, {
|
|
259
|
-
code: "visibility-mixed-legacy",
|
|
260
|
-
target: context.decoratorTarget,
|
|
261
|
-
});
|
|
262
103
|
return;
|
|
263
104
|
}
|
|
264
|
-
|
|
265
|
-
getOperationVisibilityConfig(context.program, operation).returnType = modifiers;
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
getOperationVisibilityConfig(context.program, operation).returnType = legacyVisibilities;
|
|
269
|
-
}
|
|
105
|
+
getOperationVisibilityConfig(context.program, operation).returnType = modifiers.map((m) => m.value);
|
|
270
106
|
};
|
|
271
|
-
/**
|
|
272
|
-
* Returns the visibilities of the return type of the given operation, if provided with `@returnTypeVisibility`.
|
|
273
|
-
*
|
|
274
|
-
* @deprecated Use `getReturnTypeVisibilityFilter` instead. This function will be REMOVED in TypeSpec 1.0-rc.
|
|
275
|
-
*
|
|
276
|
-
* @see {@link getReturnTypeVisibilityFilter}
|
|
277
|
-
* @see {@link $returnTypeVisibility}
|
|
278
|
-
*/
|
|
279
|
-
export function getReturnTypeVisibility(program, entity) {
|
|
280
|
-
return getOperationVisibilityConfig(program, entity)
|
|
281
|
-
.returnType?.map((p) => typeof p === "string" ? p : normalizeVisibilityToLegacyLifecycleString(program, p))
|
|
282
|
-
.filter((p) => !!p);
|
|
283
|
-
}
|
|
284
107
|
/**
|
|
285
108
|
* Get the visibility filter that should apply to the return type of the given operation, or `undefined` if no return
|
|
286
109
|
* type visibility is set.
|
|
@@ -295,48 +118,20 @@ export function getReturnTypeVisibilityFilter(program, operation, defaultProvide
|
|
|
295
118
|
const visibilityConfig = getOperationVisibilityConfig(program, operation);
|
|
296
119
|
if (!visibilityConfig.returnType)
|
|
297
120
|
return defaultProvider.returnType(program, operation);
|
|
298
|
-
|
|
299
|
-
// `@returnTypeVisibility()` to disable the default visibility provider for an operation.
|
|
300
|
-
if (visibilityConfig.returnType.length === 0)
|
|
301
|
-
return {};
|
|
121
|
+
compilerAssert(visibilityConfig.returnType.length !== 0, "Empty return type visibility constraint.");
|
|
302
122
|
return {
|
|
303
123
|
// WARNING: the HTTP library depends on `any` being the only key in the filter object returned by this method.
|
|
304
124
|
// if you change this logic, you will need to update the HTTP library to account for differences in the
|
|
305
125
|
// returned object. HTTP does not currently have a way to express `all` or `none` constraints in the same
|
|
306
126
|
// way that the core visibility system does.
|
|
307
|
-
any: new Set(visibilityConfig.returnType
|
|
308
|
-
.map((v) => typeof v === "string" ? normalizeLegacyLifecycleVisibilityString(program, v) : v)
|
|
309
|
-
.filter((v) => !!v)),
|
|
127
|
+
any: new Set(visibilityConfig.returnType),
|
|
310
128
|
};
|
|
311
129
|
}
|
|
312
130
|
// #endregion
|
|
313
131
|
// #region Core Visibility Decorators
|
|
314
132
|
// -- @visibility decorator ---------------------
|
|
315
|
-
export const $visibility = (context, target, ...
|
|
316
|
-
|
|
317
|
-
if (legacyVisibilities.length > 0 || visibilities.length === 0) {
|
|
318
|
-
const isUnique = validateDecoratorUniqueOnNode(context, target, $visibility);
|
|
319
|
-
if (modifiers.length > 0) {
|
|
320
|
-
reportDiagnostic(context.program, {
|
|
321
|
-
code: "visibility-mixed-legacy",
|
|
322
|
-
target: context.decoratorTarget,
|
|
323
|
-
});
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
// Only attempt to set the legacy visibility modifiers if the visibility invocation is unique. Otherwise, a compiler
|
|
327
|
-
// assertion will fail inside the legacy visibility management API.
|
|
328
|
-
if (isUnique)
|
|
329
|
-
setLegacyVisibility(context, target, legacyVisibilities);
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
332
|
-
if (getLegacyVisibility(context.program, target)) {
|
|
333
|
-
reportDiagnostic(context.program, {
|
|
334
|
-
code: "visibility-mixed-legacy",
|
|
335
|
-
target: context.decoratorTarget,
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
addVisibilityModifiers(context.program, target, modifiers, context);
|
|
339
|
-
}
|
|
133
|
+
export const $visibility = (context, target, ...modifiers) => {
|
|
134
|
+
addVisibilityModifiers(context.program, target, modifiers.map((m) => m.value), context);
|
|
340
135
|
};
|
|
341
136
|
// -- @removeVisibility decorator ---------------------
|
|
342
137
|
export const $removeVisibility = (context, target, ...visibilities) => {
|
|
@@ -366,39 +161,16 @@ export const $defaultVisibility = (context, target, ...visibilities) => {
|
|
|
366
161
|
// #endregion
|
|
367
162
|
// #region Legacy Visibility Transforms
|
|
368
163
|
// -- @withVisibility decorator ---------------------
|
|
369
|
-
export const $withVisibility = (context, target, ...
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
380
|
-
filterModelPropertiesInPlace(target, (p) => isVisible(context.program, p, legacyVisibilities));
|
|
381
|
-
for (const p of target.properties.values()) {
|
|
382
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
383
|
-
const legacyModifiers = getVisibility(context.program, p);
|
|
384
|
-
if (legacyModifiers && legacyModifiers.length > 0) {
|
|
385
|
-
clearLegacyVisibility(context.program, p);
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
resetVisibilityModifiersForClass(context.program, p, getLifecycleVisibilityEnum(context.program));
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
const filter = {
|
|
394
|
-
all: new Set(modifiers),
|
|
395
|
-
};
|
|
396
|
-
const visibilityClasses = new Set(modifiers.map((m) => m.enum));
|
|
397
|
-
filterModelPropertiesInPlace(target, (p) => isVisible(context.program, p, filter));
|
|
398
|
-
for (const p of target.properties.values()) {
|
|
399
|
-
for (const c of visibilityClasses) {
|
|
400
|
-
resetVisibilityModifiersForClass(context.program, p, c);
|
|
401
|
-
}
|
|
164
|
+
export const $withVisibility = (context, target, ...modifiers) => {
|
|
165
|
+
const modifierMembers = modifiers.map((m) => m.value);
|
|
166
|
+
const filter = {
|
|
167
|
+
all: new Set(modifierMembers),
|
|
168
|
+
};
|
|
169
|
+
const visibilityClasses = new Set(modifierMembers.map((m) => m.enum));
|
|
170
|
+
filterModelPropertiesInPlace(target, (p) => isVisible(context.program, p, filter));
|
|
171
|
+
for (const p of target.properties.values()) {
|
|
172
|
+
for (const c of visibilityClasses) {
|
|
173
|
+
resetVisibilityModifiersForClass(context.program, p, c);
|
|
402
174
|
}
|
|
403
175
|
}
|
|
404
176
|
};
|
|
@@ -413,8 +185,10 @@ export const $withUpdateableProperties = (context, target) => {
|
|
|
413
185
|
if (!validateDecoratorTarget(context, target, "@withUpdateableProperties", "Model")) {
|
|
414
186
|
return;
|
|
415
187
|
}
|
|
416
|
-
|
|
417
|
-
|
|
188
|
+
const filter = {
|
|
189
|
+
all: new Set([getLifecycleVisibilityEnum(context.program).members.get("Update")]),
|
|
190
|
+
};
|
|
191
|
+
filterModelPropertiesInPlace(target, (p) => isVisible(context.program, p, filter));
|
|
418
192
|
};
|
|
419
193
|
// #endregion
|
|
420
194
|
// #region Mutator Driven Transforms
|