@microsoft/typespec-msgraph 0.0.1-Preview.13 → 0.0.1-Preview.15
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/src/components/annotations.d.ts.map +1 -1
- package/dist/src/components/annotations.js +5 -2
- package/dist/src/components/annotations.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts.map +1 -1
- package/dist/src/components/entity-container-element.js +9 -6
- package/dist/src/components/entity-container-element.js.map +1 -1
- package/dist/src/components/open-property-type-constraint-annotation-element.d.ts +5 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.d.ts.map +1 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.js +7 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.js.map +1 -0
- package/dist/src/components/operation-element.js +2 -2
- package/dist/src/components/operation-element.js.map +1 -1
- package/dist/src/components/property-element.js +1 -1
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/reference-target-element.d.ts +9 -0
- package/dist/src/components/reference-target-element.d.ts.map +1 -0
- package/dist/src/components/reference-target-element.js +3 -0
- package/dist/src/components/reference-target-element.js.map +1 -0
- package/dist/src/components/select-supported-annotation.d.ts +5 -0
- package/dist/src/components/select-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/select-supported-annotation.js +6 -0
- package/dist/src/components/select-supported-annotation.js.map +1 -0
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +3 -1
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/update-restrictions-annotation.d.ts +2 -1
- package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/update-restrictions-annotation.js +6 -4
- package/dist/src/components/update-restrictions-annotation.js.map +1 -1
- package/dist/src/decorators/address-url-msa.d.ts +12 -0
- package/dist/src/decorators/address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/address-url-msa.js +19 -0
- package/dist/src/decorators/address-url-msa.js.map +1 -0
- package/dist/src/decorators/address-url.d.ts +16 -0
- package/dist/src/decorators/address-url.d.ts.map +1 -0
- package/dist/src/decorators/address-url.js +19 -0
- package/dist/src/decorators/address-url.js.map +1 -0
- package/dist/src/decorators/function.d.ts +7 -2
- package/dist/src/decorators/function.d.ts.map +1 -1
- package/dist/src/decorators/function.js +2 -2
- package/dist/src/decorators/function.js.map +1 -1
- package/dist/src/decorators/graph-route.d.ts +1 -0
- package/dist/src/decorators/graph-route.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.js +14 -0
- package/dist/src/decorators/graph-route.js.map +1 -1
- package/dist/src/decorators/index.d.ts +6 -0
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +6 -0
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/passthrough-address-url-msa.d.ts +12 -0
- package/dist/src/decorators/passthrough-address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url-msa.js +19 -0
- package/dist/src/decorators/passthrough-address-url-msa.js.map +1 -0
- package/dist/src/decorators/passthrough-address-url.d.ts +12 -0
- package/dist/src/decorators/passthrough-address-url.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url.js +19 -0
- package/dist/src/decorators/passthrough-address-url.js.map +1 -0
- package/dist/src/decorators/reference-target.d.ts +16 -0
- package/dist/src/decorators/reference-target.d.ts.map +1 -0
- package/dist/src/decorators/reference-target.js +52 -0
- package/dist/src/decorators/reference-target.js.map +1 -0
- package/dist/src/decorators/select.d.ts +9 -0
- package/dist/src/decorators/select.d.ts.map +1 -0
- package/dist/src/decorators/select.js +13 -0
- package/dist/src/decorators/select.js.map +1 -0
- package/dist/src/entities/address-url.d.ts +7 -0
- package/dist/src/entities/address-url.d.ts.map +1 -0
- package/dist/src/entities/address-url.js +42 -0
- package/dist/src/entities/address-url.js.map +1 -0
- package/dist/src/entities/annotations.d.ts +11 -2
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +47 -7
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/entity-container.d.ts +16 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -1
- package/dist/src/entities/entity-container.js +9 -0
- package/dist/src/entities/entity-container.js.map +1 -1
- package/dist/src/entities/model.d.ts +7 -1
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +63 -5
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/ms-graph-route.d.ts +13 -0
- package/dist/src/entities/ms-graph-route.d.ts.map +1 -0
- package/dist/src/entities/ms-graph-route.js +64 -0
- package/dist/src/entities/ms-graph-route.js.map +1 -0
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +27 -7
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts +1 -0
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +24 -7
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +25 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +15 -4
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts +2 -0
- package/dist/src/linter.d.ts.map +1 -0
- package/dist/src/linter.js +15 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/rules/address-url.d.ts +18 -0
- package/dist/src/rules/address-url.d.ts.map +1 -0
- package/dist/src/rules/address-url.js +99 -0
- package/dist/src/rules/address-url.js.map +1 -0
- package/dist/src/rules/contains.d.ts +1 -1
- package/dist/src/rules/contains.js +1 -1
- package/dist/src/rules/graph-route.d.ts +6 -0
- package/dist/src/rules/graph-route.d.ts.map +1 -1
- package/dist/src/rules/graph-route.js +83 -3
- package/dist/src/rules/graph-route.js.map +1 -1
- package/dist/src/rules/index.d.ts +4 -0
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +4 -0
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/model.d.ts +4 -0
- package/dist/src/rules/model.d.ts.map +1 -0
- package/dist/src/rules/model.js +36 -0
- package/dist/src/rules/model.js.map +1 -0
- package/dist/src/rules/record-t.d.ts +5 -0
- package/dist/src/rules/record-t.d.ts.map +1 -0
- package/dist/src/rules/record-t.js +78 -0
- package/dist/src/rules/record-t.js.map +1 -0
- package/dist/src/rules/reference-target.d.ts +8 -0
- package/dist/src/rules/reference-target.d.ts.map +1 -0
- package/dist/src/rules/reference-target.js +118 -0
- package/dist/src/rules/reference-target.js.map +1 -0
- package/dist/src/utils.d.ts +19 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +49 -21
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/src/validate.js +15 -2
- package/dist/src/validate.js.map +1 -1
- package/lib/decorators.tsp +131 -23
- package/lib/porcelain.tsp +18 -7
- package/lib/responses.tsp +32 -7
- package/lib/shared-models.tsp +0 -50
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAqC,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAqC,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAoCrF,OAAO,EAAE,iBAAiB,EAAsH,MAAM,kBAAkB,CAAC;AAIzK,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBA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EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC1C,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,qBAAqB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACrD,wBAAwB,EAAE,iBAAiB,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAgCxG"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { getDoc, getLocationContext, isKey } from "@typespec/compiler";
|
|
2
2
|
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
3
|
-
import { isContains, isComputed, isReadOnly, isWriteOnly, isAlternateKey, isComplex, getStreamTypes, isEntity, isOpen, hasStream, isAbstract, isImmutable, hasAllowedValues, getAllowedValues } from "../index.js";
|
|
4
|
-
import { isNavigationProperty, isTypeNullable, getPropertyTypeName, getIdForType, isTypeCollection, extractTypesFromUnion, removeReferencePrefixFromType, } from "../utils.js";
|
|
3
|
+
import { isContains, isComputed, isReadOnly, isWriteOnly, isAlternateKey, isComplex, getStreamTypes, isEntity, isOpen, hasStream, isAbstract, isImmutable, hasAllowedValues, getAllowedValues, hasAddressUrl, getPublicNamespaceName, hasAddressUrlMsa, hasPassthroughAddressUrl, } from "../index.js";
|
|
4
|
+
import { isNavigationProperty, isTypeNullable, getPropertyTypeName, getIdForType, isTypeCollection, extractTypesFromUnion, removeReferencePrefixFromType, getNameForModelType, isDictionaryType, generateDictionaryBaseType, } from "../utils.js";
|
|
5
5
|
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
6
6
|
import { usedLibraryTypesKey } from "./namespace.js";
|
|
7
7
|
import { isPartial } from "../decorators/partial.js";
|
|
8
|
+
import { getMsGraphAddressUrl, getMsGraphAddressUrlMsa, getMsGraphPassthroughAddressUrl, getMsGraphPassthroughAddressUrlMsa } from "./address-url.js";
|
|
9
|
+
import { GetMsGraphRoutes } from "./ms-graph-route.js";
|
|
10
|
+
import { hasPassthroughAddressUrlMsa } from "../decorators/passthrough-address-url-msa.js";
|
|
8
11
|
export var MsGraphModelKind;
|
|
9
12
|
(function (MsGraphModelKind) {
|
|
10
13
|
MsGraphModelKind[MsGraphModelKind["Unknown"] = 0] = "Unknown";
|
|
@@ -75,8 +78,8 @@ function getMsGraphModel(program, model, generateProperties = true) {
|
|
|
75
78
|
Kind: kind,
|
|
76
79
|
Name: model.name,
|
|
77
80
|
IsAbstract: isAbstract(program, model),
|
|
78
|
-
BaseType: model.baseModel ? getIdForType(program, model.baseModel) : undefined,
|
|
79
|
-
IsOpenType: isOpen(program, model),
|
|
81
|
+
BaseType: model.baseModel ? getIdForType(program, model.baseModel) : (isDictionaryType(program, model) ? generateDictionaryBaseType(program, model) : undefined),
|
|
82
|
+
IsOpenType: isOpen(program, model) || isDictionaryType(program, model),
|
|
80
83
|
HasStream: hasStream(program, model),
|
|
81
84
|
AgsAttributes: buildAttributes(program, model, kind),
|
|
82
85
|
RevisionDefinition: GetRevisionDefinition(program, model, model.namespace),
|
|
@@ -85,9 +88,24 @@ function getMsGraphModel(program, model, generateProperties = true) {
|
|
|
85
88
|
AlternateKeys: kind === MsGraphModelKind.Entity ? getAlternateKeys(program, model.properties) : [],
|
|
86
89
|
StreamTypes: kind === MsGraphModelKind.Entity ? getStreamTypes(program, model) : [],
|
|
87
90
|
Properties: generateProperties ? getModelProperties(program, model.properties) : [],
|
|
88
|
-
|
|
91
|
+
IsPartial: isPartial(program, model),
|
|
92
|
+
RecordType: getRecordType(program, model)
|
|
89
93
|
};
|
|
90
94
|
}
|
|
95
|
+
function getRecordType(program, model) {
|
|
96
|
+
var _a;
|
|
97
|
+
const indexer = (_a = model.indexer) === null || _a === void 0 ? void 0 : _a.value;
|
|
98
|
+
if (!indexer)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (indexer.kind === "Model") {
|
|
101
|
+
const namespaceName = getPublicNamespaceName(program, model.namespace);
|
|
102
|
+
return namespaceName === null || namespaceName === void 0 ? void 0 : namespaceName.concat(".", indexer.name);
|
|
103
|
+
}
|
|
104
|
+
if (indexer.kind === "Scalar") {
|
|
105
|
+
return getNameForModelType(program, indexer);
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
91
109
|
function getModelProperties(program, properties) {
|
|
92
110
|
return [...properties].map(([_, v]) => {
|
|
93
111
|
var _a;
|
|
@@ -110,6 +128,10 @@ function getModelProperties(program, properties) {
|
|
|
110
128
|
isImmutable: isImmutable(program, v),
|
|
111
129
|
allowedValues: hasAllowedValues(program, v) ? getAllowedValues(program, v) : [],
|
|
112
130
|
IsCollection: isTypeCollection(program, v.type),
|
|
131
|
+
AddressUrl: isNavigationProperty(program, v) ? getNavigationPropertyAddressUrl(program, v) : undefined,
|
|
132
|
+
AddressUrlMsa: isNavigationProperty(program, v) ? getNavigationPropertyAddressUrlMsa(program, v) : undefined,
|
|
133
|
+
PassthroughAddressUrl: isNavigationProperty(program, v) ? getNavigationPropertyPassthroughAddressUrl(program, v) : undefined,
|
|
134
|
+
PassthroughAddressUrlMsa: isNavigationProperty(program, v) ? getNavigationPropertyPassthroughAddressUrlMsa(program, v) : undefined,
|
|
113
135
|
};
|
|
114
136
|
});
|
|
115
137
|
}
|
|
@@ -151,4 +173,40 @@ function getAlternateKeys(program, properties) {
|
|
|
151
173
|
});
|
|
152
174
|
return result;
|
|
153
175
|
}
|
|
176
|
+
function getNavigationPropertyAddressUrl(program, property) {
|
|
177
|
+
const msGraphRoutes = GetMsGraphRoutes(program);
|
|
178
|
+
for (const [_, msGraphRoute] of msGraphRoutes.entries()) {
|
|
179
|
+
if (msGraphRoute.resource === property && hasAddressUrl(program, msGraphRoute.theInterface)) {
|
|
180
|
+
return getMsGraphAddressUrl(program, msGraphRoute.theInterface);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
function getNavigationPropertyAddressUrlMsa(program, property) {
|
|
186
|
+
const msGraphRoutes = GetMsGraphRoutes(program);
|
|
187
|
+
for (const [_, msGraphRoute] of msGraphRoutes.entries()) {
|
|
188
|
+
if (msGraphRoute.resource === property && hasAddressUrlMsa(program, msGraphRoute.theInterface)) {
|
|
189
|
+
return getMsGraphAddressUrlMsa(program, msGraphRoute.theInterface);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
function getNavigationPropertyPassthroughAddressUrl(program, property) {
|
|
195
|
+
const msGraphRoutes = GetMsGraphRoutes(program);
|
|
196
|
+
for (const [_, msGraphRoute] of msGraphRoutes.entries()) {
|
|
197
|
+
if (msGraphRoute.resource === property && hasPassthroughAddressUrl(program, msGraphRoute.theInterface)) {
|
|
198
|
+
return getMsGraphPassthroughAddressUrl(program, msGraphRoute.theInterface);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
function getNavigationPropertyPassthroughAddressUrlMsa(program, property) {
|
|
204
|
+
const msGraphRoutes = GetMsGraphRoutes(program);
|
|
205
|
+
for (const [_, msGraphRoute] of msGraphRoutes.entries()) {
|
|
206
|
+
if (msGraphRoute.resource === property && hasPassthroughAddressUrlMsa(program, msGraphRoute.theInterface)) {
|
|
207
|
+
return getMsGraphPassthroughAddressUrlMsa(program, msGraphRoute.theInterface);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
154
212
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACrF,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,cAAc,EACd,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACrF,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,cAAc,EACd,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAqB,oBAAoB,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,kCAAkC,EAAE,MAAM,kBAAkB,CAAC;AACzK,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAA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
|
1
|
+
import { Program, Interface, Model, ModelProperty } from "@typespec/compiler";
|
|
2
|
+
export interface MsGraphRoute {
|
|
3
|
+
resource: Model | ModelProperty;
|
|
4
|
+
routeType: MsGraphRouteType;
|
|
5
|
+
theInterface: Interface;
|
|
6
|
+
}
|
|
7
|
+
export declare enum MsGraphRouteType {
|
|
8
|
+
EntitySet = 0,
|
|
9
|
+
Singleton = 1,
|
|
10
|
+
NavigationProperty = 2
|
|
11
|
+
}
|
|
12
|
+
export declare function GetMsGraphRoutes(program: Program): Map<string, MsGraphRoute>;
|
|
13
|
+
//# sourceMappingURL=ms-graph-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms-graph-route.d.ts","sourceRoot":"","sources":["../../../src/entities/ms-graph-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI9E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,GAAG,aAAa,CAAC;IAChC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,YAAY,EAAE,SAAS,CAAC;CACzB;AAED,oBAAY,gBAAgB;IAC1B,SAAS,IAAA;IACT,SAAS,IAAA;IACT,kBAAkB,IAAA;CACnB;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAuD5E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getInterfaceNavigationSourceType, getInterfacesOfKinds, getSourceInterfaces, isNavigationProperty, isTopLevelNavigationSource } from "../utils.js";
|
|
2
|
+
import { GetDeclaredNamespaces, getNavigationSources } from "./namespace.js";
|
|
3
|
+
export var MsGraphRouteType;
|
|
4
|
+
(function (MsGraphRouteType) {
|
|
5
|
+
MsGraphRouteType[MsGraphRouteType["EntitySet"] = 0] = "EntitySet";
|
|
6
|
+
MsGraphRouteType[MsGraphRouteType["Singleton"] = 1] = "Singleton";
|
|
7
|
+
MsGraphRouteType[MsGraphRouteType["NavigationProperty"] = 2] = "NavigationProperty";
|
|
8
|
+
})(MsGraphRouteType || (MsGraphRouteType = {}));
|
|
9
|
+
export function GetMsGraphRoutes(program) {
|
|
10
|
+
const graphRoutes = new Map();
|
|
11
|
+
const namespaces = GetDeclaredNamespaces(program);
|
|
12
|
+
for (const namespace of namespaces) {
|
|
13
|
+
const sources = getNavigationSources(namespace.interfaces);
|
|
14
|
+
const navigationSources = getInterfacesOfKinds(program, sources, ["Resource", "Collection"]);
|
|
15
|
+
// Populate cache with entity sets and singletons
|
|
16
|
+
navigationSources.forEach((msGraphInterface, graphRoute) => {
|
|
17
|
+
if (isTopLevelNavigationSource(program, msGraphInterface)) {
|
|
18
|
+
const navigationSourceType = getInterfaceNavigationSourceType(program, msGraphInterface.theInterface);
|
|
19
|
+
if (getSourceInterfaces(msGraphInterface.theInterface).some((baseInterface) => baseInterface.name === "Collection")) {
|
|
20
|
+
graphRoutes.set(graphRoute, {
|
|
21
|
+
resource: navigationSourceType,
|
|
22
|
+
routeType: MsGraphRouteType.EntitySet,
|
|
23
|
+
theInterface: msGraphInterface.theInterface
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
graphRoutes.set(graphRoute, {
|
|
28
|
+
resource: navigationSourceType,
|
|
29
|
+
routeType: MsGraphRouteType.Singleton,
|
|
30
|
+
theInterface: msGraphInterface.theInterface
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// Then populate cache with navigation properties
|
|
36
|
+
navigationSources.forEach((msGraphInterface, graphRoute) => {
|
|
37
|
+
if (!isTopLevelNavigationSource(program, msGraphInterface)) {
|
|
38
|
+
const routeSegments = graphRoute.split("/");
|
|
39
|
+
const topLevelGraphRoute = graphRoutes.get(routeSegments[0]);
|
|
40
|
+
if (topLevelGraphRoute) {
|
|
41
|
+
let model = topLevelGraphRoute === null || topLevelGraphRoute === void 0 ? void 0 : topLevelGraphRoute.resource;
|
|
42
|
+
for (let i = 1; i < routeSegments.length; i++) {
|
|
43
|
+
model.properties.forEach((property) => {
|
|
44
|
+
if (property.name === routeSegments[i] && isNavigationProperty(program, property)) {
|
|
45
|
+
if (i === routeSegments.length - 1) {
|
|
46
|
+
graphRoutes.set(graphRoute, {
|
|
47
|
+
resource: property,
|
|
48
|
+
routeType: MsGraphRouteType.NavigationProperty,
|
|
49
|
+
theInterface: msGraphInterface.theInterface
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
model = property.type;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return graphRoutes;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=ms-graph-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms-graph-route.js","sourceRoot":"","sources":["../../../src/entities/ms-graph-route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC5J,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAQ7E,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,iEAAS,CAAA;IACT,iEAAS,CAAA;IACT,mFAAkB,CAAA;AACpB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAGD,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,WAAW,GAA8B,IAAI,GAAG,EAAwB,CAAC;IAC/E,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAClD,KAAK,MAAM,SAAS,IAAI,UAAU,EAA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ElE;AAsGD,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAU/F"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getInterfacesOfKinds,
|
|
1
|
+
import { getInterfacesOfKinds, getCollectionIndexInterfaces, isExcludedCoreType, isNavigationSource, isTopLevelNavigationSource, isTypeDefinedInExternalLibrary } from "../utils.js";
|
|
2
2
|
import { GetMsGraphEnumTypeElement } from "./enum.js";
|
|
3
3
|
import { GetMsGraphModels } from "./model.js";
|
|
4
4
|
import { GetEntitySets, GetSingletons } from "./entity-container.js";
|
|
5
5
|
import { GetMsGraphOperations } from "./operation.js";
|
|
6
6
|
import { GetCollectionAnnotations, GetResourceAnnotations, GetAllowedValuesAnnotations } from "./annotations.js";
|
|
7
|
-
import { applyOwnerlessAttributeToInterfaceBindingType, buildAttributes, getPublicNamespaceName } from "../index.js";
|
|
7
|
+
import { applyOwnerlessAttributeToInterfaceBindingType, buildAttributes, getGraphRoutePaths, getNavigationPropertyBindingProperties, getPublicNamespaceName, hasReferenceTarget } from "../index.js";
|
|
8
8
|
import { GetMsGraphTerms } from "./term.js";
|
|
9
9
|
const DEFAULT_MSGRAPH_NAMESPACE = "microsoft.graph";
|
|
10
10
|
export const usedLibraryTypesKey = Symbol("usedLibraryTypesKey");
|
|
@@ -107,7 +107,7 @@ function getMsGraphNamespace(program, namespace) {
|
|
|
107
107
|
models = applyOwnerlessAttributeToInterfaceBindingType(program, namespace.interfaces, models);
|
|
108
108
|
const enums = [...namespace.enums].map(([_, e]) => GetMsGraphEnumTypeElement(program, e));
|
|
109
109
|
const sources = getNavigationSources(namespace.interfaces);
|
|
110
|
-
const
|
|
110
|
+
const collectionIndexSources = getCollectionIndexInterfaces(program, sources);
|
|
111
111
|
const resourceSources = getInterfacesOfKinds(program, sources, ["Resource"]);
|
|
112
112
|
const collectionSources = getInterfacesOfKinds(program, sources, ["Collection"]);
|
|
113
113
|
resourceSources.forEach((entity, routePath) => {
|
|
@@ -117,8 +117,8 @@ function getMsGraphNamespace(program, namespace) {
|
|
|
117
117
|
resourceSources.delete(routePath);
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
if (
|
|
121
|
-
|
|
120
|
+
if (collectionIndexSources && collectionIndexSources.size > 0) {
|
|
121
|
+
collectionIndexSources.forEach((entity, routePath) => {
|
|
122
122
|
if (collectionSources.has(routePath)) {
|
|
123
123
|
const existing = collectionSources.get(routePath);
|
|
124
124
|
existing.operations = [...existing.operations, ...entity.operations.values()];
|
|
@@ -129,8 +129,10 @@ function getMsGraphNamespace(program, namespace) {
|
|
|
129
129
|
}
|
|
130
130
|
const singletonSources = getRootNavigationSources(program, resourceSources);
|
|
131
131
|
const entitySetSources = getRootNavigationSources(program, collectionSources);
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
let singletons = GetSingletons(program, singletonSources);
|
|
133
|
+
let entitySets = GetEntitySets(program, entitySetSources);
|
|
134
|
+
singletons = applyNavigationPropertyBindingToCollection(program, singletons, resourceSources);
|
|
135
|
+
entitySets = applyNavigationPropertyBindingToCollection(program, entitySets, collectionSources);
|
|
134
136
|
const resourceAnnotations = GetResourceAnnotations(program, namespaceName, resourceSources);
|
|
135
137
|
const collectionAnnotations = GetCollectionAnnotations(program, namespaceName, collectionSources);
|
|
136
138
|
const allowedValuesAnnotations = GetAllowedValuesAnnotations(program, namespaceName, models);
|
|
@@ -150,6 +152,24 @@ function getMsGraphNamespace(program, namespace) {
|
|
|
150
152
|
Terms: terms,
|
|
151
153
|
};
|
|
152
154
|
}
|
|
155
|
+
function applyNavigationPropertyBindingToCollection(program, collections, sources) {
|
|
156
|
+
sources.forEach((msgraphInterface, routePath) => {
|
|
157
|
+
if (hasReferenceTarget(program, msgraphInterface.theInterface)) {
|
|
158
|
+
const graphRoutes = getGraphRoutePaths(program, msgraphInterface.theInterface);
|
|
159
|
+
if (graphRoutes) {
|
|
160
|
+
graphRoutes.forEach(graphRoute => {
|
|
161
|
+
const firstSegment = graphRoute.split("/")[0];
|
|
162
|
+
const referencedCollection = collections.get(firstSegment);
|
|
163
|
+
if (referencedCollection) {
|
|
164
|
+
referencedCollection.NavigationPropertyBindingProperties = getNavigationPropertyBindingProperties(program, msgraphInterface.theInterface, graphRoute, referencedCollection.Name);
|
|
165
|
+
collections.set(firstSegment, referencedCollection);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return collections;
|
|
172
|
+
}
|
|
153
173
|
export function getNavigationSources(interfaces) {
|
|
154
174
|
const navigationSources = new Map();
|
|
155
175
|
interfaces.forEach((theInterface, key) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,oBAAoB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AACvM,OAAO,EAAE,yBAAyB,EAAe,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAgB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAa,aAAa,EAAE,aAAa,EAAa,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAoB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAA8C,wBAAwB,EAAE,sBAAsB,EAA4B,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AACvL,OAAO,EAA6B,6CAA6C,EAAE,eAAe,EAAE,kBAAkB,EAAE,sCAAsC,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA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E,SAAS,EAAE,EAAE;QACpC,IAAI,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;YAC/C,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;SACpC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -14,6 +14,7 @@ export interface MsGraphOperation {
|
|
|
14
14
|
UnionProperties: MsGraphOperationProperty[][];
|
|
15
15
|
IsVoid: boolean;
|
|
16
16
|
IsNullable: boolean;
|
|
17
|
+
IsComposable: boolean | undefined;
|
|
17
18
|
ReturnTypeName: string;
|
|
18
19
|
Description: string | undefined;
|
|
19
20
|
RevisionDefinition: RevisionDefinition | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA8D,SAAS,EAAsB,MAAM,oBAAoB,CAAC;AAMxI,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGrF,oBAAY,aAAa;IACvB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,wBAAwB,EAAE,CAAC;IACvC,eAAe,EAAE,wBAAwB,EAAE,EAAE,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACnD,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IAEvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAClD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAgB,EAAE,CAuB7G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isVoidType, getDoc, getLocationContext } from "@typespec/compiler";
|
|
2
2
|
import { isPathParam } from "@typespec/http";
|
|
3
3
|
import { extractParamsFromPath, getAction, getFunction, getGraphRoutePaths, isGlobalOperation, isOperationParameters } from "../index.js";
|
|
4
|
-
import { isTypeNullable, getPropertyTypeName, extractTypesFromUnion, getInterfaceNavigationSourceType } from "../utils.js";
|
|
4
|
+
import { isTypeNullable, getPropertyTypeName, extractTypesFromUnion, getInterfaceNavigationSourceType, getSourceInterfaces } from "../utils.js";
|
|
5
5
|
import { getDefaultPropertyValue } from "./property.js";
|
|
6
6
|
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
7
7
|
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
@@ -39,13 +39,25 @@ function GetMsGraphOperation(program, bindingTypeName, operation) {
|
|
|
39
39
|
UnionProperties: new Array(),
|
|
40
40
|
IsVoid: isVoidType(operation.returnType),
|
|
41
41
|
IsNullable: false,
|
|
42
|
+
IsComposable: undefined,
|
|
42
43
|
ReturnTypeName: "",
|
|
43
44
|
Description: getDoc(program, operation),
|
|
44
45
|
RevisionDefinition: GetRevisionDefinition(program, operation, operation.namespace),
|
|
45
46
|
IsGlobalOperation: isGlobalOperation(program, operation)
|
|
46
47
|
};
|
|
47
48
|
if (!element.IsVoid) {
|
|
48
|
-
|
|
49
|
+
let returnType = operation.returnType;
|
|
50
|
+
// Remove unions with Error responses added in by standard Operation base op.
|
|
51
|
+
if (returnType.kind === "Union") {
|
|
52
|
+
const unionTypes = extractTypesFromUnion(returnType);
|
|
53
|
+
const filteredTypes = unionTypes.filter((type) => {
|
|
54
|
+
if (type.kind === "Model" && type.name.endsWith("ErrorResponse")) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
returnType = filteredTypes[0];
|
|
60
|
+
}
|
|
49
61
|
if (!returnType || isVoidType(returnType)) {
|
|
50
62
|
element.IsVoid = true;
|
|
51
63
|
}
|
|
@@ -61,9 +73,10 @@ function GetMsGraphOperation(program, bindingTypeName, operation) {
|
|
|
61
73
|
element.Kind = OperationKind.Action;
|
|
62
74
|
}
|
|
63
75
|
else {
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
element.Name =
|
|
76
|
+
const theFunction = getFunction(program, operation);
|
|
77
|
+
if (theFunction) {
|
|
78
|
+
element.Name = theFunction.name;
|
|
79
|
+
element.IsComposable = theFunction.isComposable;
|
|
67
80
|
element.Kind = OperationKind.Function;
|
|
68
81
|
const parameterProperty = operation.parameters.properties.get("parameters");
|
|
69
82
|
if (parameterProperty && parameterProperty.type.kind === "Union") {
|
|
@@ -94,12 +107,16 @@ function getBindingTypeName(program, operation) {
|
|
|
94
107
|
if (!bindingType) {
|
|
95
108
|
return undefined;
|
|
96
109
|
}
|
|
97
|
-
|
|
110
|
+
const propertyTypeName = getPropertyTypeName(program, bindingType);
|
|
111
|
+
if (getSourceInterfaces(operation.interface).some((theInterface) => theInterface.name === "Collection")) {
|
|
112
|
+
return `Collection(${propertyTypeName})`;
|
|
113
|
+
}
|
|
114
|
+
return propertyTypeName;
|
|
98
115
|
}
|
|
99
116
|
function getParameterProperties(program, parameters) {
|
|
100
117
|
const properties = [...parameters].flatMap(([, property]) => {
|
|
101
118
|
var _a;
|
|
102
|
-
if (isPathParam(program, property)) {
|
|
119
|
+
if (isPathParam(program, property) || property.name === "graphRouteParams") {
|
|
103
120
|
return [];
|
|
104
121
|
}
|
|
105
122
|
if (property.type.kind === "Model" && isOperationParameters(program, property.type)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,UAAU,EAAE,MAAM,EAAmC,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxI,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC1I,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gCAAgC,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,u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src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
package/dist/src/lib.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const namespace = "MsGraph";
|
|
|
2
2
|
export interface MsGraphEmitterOptions {
|
|
3
3
|
filename?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const reportDiagnostic: <C extends "decorator-missing-dependencies" | "element-missing-dependencies" | "decorator-invalid-use" | "singleton-invalid-name" | "extends-invalid-use", M extends keyof {
|
|
5
|
+
export declare const reportDiagnostic: <C extends "decorator-missing-dependencies" | "element-missing-dependencies" | "decorator-invalid-use" | "singleton-invalid-name" | "extends-invalid-use" | "type-invalid-use", M extends keyof {
|
|
6
6
|
"decorator-missing-dependencies": {
|
|
7
7
|
readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
|
|
8
8
|
readonly function: import("@typespec/compiler").CallableMessage<[]>;
|
|
@@ -44,6 +44,12 @@ export declare const reportDiagnostic: <C extends "decorator-missing-dependencie
|
|
|
44
44
|
readonly globalOperationMustBeUsedWithNonRoutedInterface: import("@typespec/compiler").CallableMessage<[]>;
|
|
45
45
|
readonly globalOperationMustBeUsedWithProjectBindingType: import("@typespec/compiler").CallableMessage<[]>;
|
|
46
46
|
readonly graphRouteWithRoutingParameterAsFinalSegment: import("@typespec/compiler").CallableMessage<[string]>;
|
|
47
|
+
readonly referenceTargetInterfaceMustHaveGraphRoute: import("@typespec/compiler").CallableMessage<[]>;
|
|
48
|
+
readonly referenceTargetMustOnlyBeUsedOnceOnInterface: import("@typespec/compiler").CallableMessage<[]>;
|
|
49
|
+
readonly referenceTargetPathShouldNotHaveParameters: import("@typespec/compiler").CallableMessage<[string]>;
|
|
50
|
+
readonly interfaceWithGraphRouteMustExtendGraphStandardBaseInterface: import("@typespec/compiler").CallableMessage<[]>;
|
|
51
|
+
readonly duplicateGraphRouteNotAllowed: import("@typespec/compiler").CallableMessage<[string, string, string]>;
|
|
52
|
+
readonly duplicateParametersAreNotAllowedInGraphRoute: import("@typespec/compiler").CallableMessage<[string, string]>;
|
|
47
53
|
};
|
|
48
54
|
"singleton-invalid-name": {
|
|
49
55
|
readonly default: import("@typespec/compiler").CallableMessage<[string]>;
|
|
@@ -52,6 +58,12 @@ export declare const reportDiagnostic: <C extends "decorator-missing-dependencie
|
|
|
52
58
|
readonly default: import("@typespec/compiler").CallableMessage<[string, string]>;
|
|
53
59
|
readonly namespaces: "A model can only extend other models in a different logical namespace. Use @partial instead.";
|
|
54
60
|
};
|
|
61
|
+
"type-invalid-use": {
|
|
62
|
+
readonly default: import("@typespec/compiler").CallableMessage<[string]>;
|
|
63
|
+
readonly recordTypeCannotBePrepopulated: import("@typespec/compiler").CallableMessage<[string]>;
|
|
64
|
+
readonly recordTypeCannotBeNull: import("@typespec/compiler").CallableMessage<[string]>;
|
|
65
|
+
readonly recordTypeCannotBeUsedInLine: import("@typespec/compiler").CallableMessage<[string]>;
|
|
66
|
+
};
|
|
55
67
|
}[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
|
|
56
68
|
"decorator-missing-dependencies": {
|
|
57
69
|
readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
|
|
@@ -94,6 +106,12 @@ export declare const reportDiagnostic: <C extends "decorator-missing-dependencie
|
|
|
94
106
|
readonly globalOperationMustBeUsedWithNonRoutedInterface: import("@typespec/compiler").CallableMessage<[]>;
|
|
95
107
|
readonly globalOperationMustBeUsedWithProjectBindingType: import("@typespec/compiler").CallableMessage<[]>;
|
|
96
108
|
readonly graphRouteWithRoutingParameterAsFinalSegment: import("@typespec/compiler").CallableMessage<[string]>;
|
|
109
|
+
readonly referenceTargetInterfaceMustHaveGraphRoute: import("@typespec/compiler").CallableMessage<[]>;
|
|
110
|
+
readonly referenceTargetMustOnlyBeUsedOnceOnInterface: import("@typespec/compiler").CallableMessage<[]>;
|
|
111
|
+
readonly referenceTargetPathShouldNotHaveParameters: import("@typespec/compiler").CallableMessage<[string]>;
|
|
112
|
+
readonly interfaceWithGraphRouteMustExtendGraphStandardBaseInterface: import("@typespec/compiler").CallableMessage<[]>;
|
|
113
|
+
readonly duplicateGraphRouteNotAllowed: import("@typespec/compiler").CallableMessage<[string, string, string]>;
|
|
114
|
+
readonly duplicateParametersAreNotAllowedInGraphRoute: import("@typespec/compiler").CallableMessage<[string, string]>;
|
|
97
115
|
};
|
|
98
116
|
"singleton-invalid-name": {
|
|
99
117
|
readonly default: import("@typespec/compiler").CallableMessage<[string]>;
|
|
@@ -102,5 +120,11 @@ export declare const reportDiagnostic: <C extends "decorator-missing-dependencie
|
|
|
102
120
|
readonly default: import("@typespec/compiler").CallableMessage<[string, string]>;
|
|
103
121
|
readonly namespaces: "A model can only extend other models in a different logical namespace. Use @partial instead.";
|
|
104
122
|
};
|
|
123
|
+
"type-invalid-use": {
|
|
124
|
+
readonly default: import("@typespec/compiler").CallableMessage<[string]>;
|
|
125
|
+
readonly recordTypeCannotBePrepopulated: import("@typespec/compiler").CallableMessage<[string]>;
|
|
126
|
+
readonly recordTypeCannotBeNull: import("@typespec/compiler").CallableMessage<[string]>;
|
|
127
|
+
readonly recordTypeCannotBeUsedInLine: import("@typespec/compiler").CallableMessage<[string]>;
|
|
128
|
+
};
|
|
105
129
|
}, C, M>) => void;
|
|
106
130
|
//# sourceMappingURL=lib.d.ts.map
|
package/dist/src/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAQ,gBAAgB
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoFpB,CAAC"}
|
package/dist/src/lib.js
CHANGED
|
@@ -64,6 +64,12 @@ export const { reportDiagnostic } = createTypeSpecLibrary({
|
|
|
64
64
|
globalOperationMustBeUsedWithNonRoutedInterface: paramMessage `The @globalOperation decorator must be used on an operation with a non-routed interface.`,
|
|
65
65
|
globalOperationMustBeUsedWithProjectBindingType: paramMessage `The @globalOperation decorator must be used on an operation that has a local model binding the interface.`,
|
|
66
66
|
graphRouteWithRoutingParameterAsFinalSegment: paramMessage `The @graphRoute ${"graphRoute"} with a routing parameter as the last segment cannot be used with a collection interface.`,
|
|
67
|
+
referenceTargetInterfaceMustHaveGraphRoute: paramMessage `The @referenceTarget decorator must be used on an interface with a @graphRoute decorator.`,
|
|
68
|
+
referenceTargetMustOnlyBeUsedOnceOnInterface: paramMessage `The @referenceTarget decorator can only be used once on an interface.`,
|
|
69
|
+
referenceTargetPathShouldNotHaveParameters: paramMessage `The @referenceTarget path "${"target"}" cannot have parameters {}.`,
|
|
70
|
+
interfaceWithGraphRouteMustExtendGraphStandardBaseInterface: paramMessage `The @graphRoute decorator can only be used on an interface that ultimately extends a Graph standard base interface i.e. Resource<T> or Collection<T>.`,
|
|
71
|
+
duplicateGraphRouteNotAllowed: paramMessage `The @graphRoute "${"graphRoute"}" on "${"target"}" is already defined on another interface "${"existing"}".`,
|
|
72
|
+
duplicateParametersAreNotAllowedInGraphRoute: paramMessage `The parameters "${"parameters"}" on the @graphRoute "${"graphRoute"}" must have unique names.`,
|
|
67
73
|
},
|
|
68
74
|
},
|
|
69
75
|
"singleton-invalid-name": {
|
|
@@ -79,11 +85,16 @@ export const { reportDiagnostic } = createTypeSpecLibrary({
|
|
|
79
85
|
namespaces: 'A model can only extend other models in a different logical namespace. Use @partial instead.'
|
|
80
86
|
},
|
|
81
87
|
},
|
|
88
|
+
"type-invalid-use": {
|
|
89
|
+
severity: "error",
|
|
90
|
+
messages: {
|
|
91
|
+
default: paramMessage `The ${"type"} has been wrongly used. Refer to Typespec documentation`,
|
|
92
|
+
recordTypeCannotBePrepopulated: paramMessage `The record type "${"type"}" cannot be prepopulated.`,
|
|
93
|
+
recordTypeCannotBeNull: paramMessage `The record type "${"type"}" cannot be null.`,
|
|
94
|
+
recordTypeCannotBeUsedInLine: paramMessage `Using inline record as type on ${"type"} is not supported. Create a complex entity to represent it.`,
|
|
95
|
+
}
|
|
96
|
+
}
|
|
82
97
|
},
|
|
83
|
-
// TODO: Enable the linter rule
|
|
84
|
-
// linter: {
|
|
85
|
-
// rules: [useEvolvableEnumRule],
|
|
86
|
-
// },
|
|
87
98
|
emitter: { options: EmitterOptionsSchema },
|
|
88
99
|
});
|
|
89
100
|
//# sourceMappingURL=lib.js.map
|