@microsoft/typespec-msgraph 0.0.1-Preview.1 → 0.0.1-Preview.10
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/acceptable-media-types-annotation.d.ts +3 -4
- package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -1
- package/dist/src/components/acceptable-media-types-annotation.js +2 -6
- package/dist/src/components/acceptable-media-types-annotation.js.map +1 -1
- package/dist/src/components/alternate-keys-annotation.d.ts +4 -4
- package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -1
- package/dist/src/components/alternate-keys-annotation.js +8 -16
- package/dist/src/components/alternate-keys-annotation.js.map +1 -1
- package/dist/src/components/annotations.d.ts +12 -0
- package/dist/src/components/annotations.d.ts.map +1 -0
- package/dist/src/components/annotations.js +63 -0
- package/dist/src/components/annotations.js.map +1 -0
- package/dist/src/components/common-elements.d.ts +15 -73
- package/dist/src/components/common-elements.d.ts.map +1 -1
- package/dist/src/components/common-elements.js +12 -26
- package/dist/src/components/common-elements.js.map +1 -1
- package/dist/src/components/computed-annotation.d.ts +3 -4
- package/dist/src/components/computed-annotation.d.ts.map +1 -1
- package/dist/src/components/computed-annotation.js +4 -10
- package/dist/src/components/computed-annotation.js.map +1 -1
- package/dist/src/components/count-restrictions-annotation.d.ts +3 -4
- package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/count-restrictions-annotation.js +4 -13
- package/dist/src/components/count-restrictions-annotation.js.map +1 -1
- package/dist/src/components/description-annotation.d.ts +3 -4
- package/dist/src/components/description-annotation.d.ts.map +1 -1
- package/dist/src/components/description-annotation.js +5 -11
- package/dist/src/components/description-annotation.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts +21 -0
- package/dist/src/components/entity-container-element.d.ts.map +1 -0
- package/dist/src/components/entity-container-element.js +22 -0
- package/dist/src/components/entity-container-element.js.map +1 -0
- package/dist/src/components/enum-type-element.d.ts +6 -0
- package/dist/src/components/enum-type-element.d.ts.map +1 -0
- package/dist/src/components/enum-type-element.js +17 -0
- package/dist/src/components/enum-type-element.js.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts +4 -5
- package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/expand-restrictions-annotation.js +9 -30
- package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
- package/dist/src/components/filter-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/filter-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/filter-restrictions-annotation.js +10 -0
- package/dist/src/components/filter-restrictions-annotation.js.map +1 -0
- package/dist/src/components/immutable-annotation.d.ts +5 -0
- package/dist/src/components/immutable-annotation.d.ts.map +1 -0
- package/dist/src/components/immutable-annotation.js +6 -0
- package/dist/src/components/immutable-annotation.js.map +1 -0
- package/dist/src/components/index.d.ts +2 -14
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +9 -14
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/insert-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/insert-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/insert-restrictions-annotation.js +10 -0
- package/dist/src/components/insert-restrictions-annotation.js.map +1 -0
- package/dist/src/components/operation-element.d.ts +6 -0
- package/dist/src/components/operation-element.d.ts.map +1 -0
- package/dist/src/components/operation-element.js +70 -0
- package/dist/src/components/operation-element.js.map +1 -0
- package/dist/src/components/permissions-annotation.d.ts +3 -4
- package/dist/src/components/permissions-annotation.d.ts.map +1 -1
- package/dist/src/components/permissions-annotation.js +2 -10
- package/dist/src/components/permissions-annotation.js.map +1 -1
- package/dist/src/components/property-element.d.ts +4 -4
- package/dist/src/components/property-element.d.ts.map +1 -1
- package/dist/src/components/property-element.js +16 -32
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/revisions-annotation.d.ts +4 -5
- package/dist/src/components/revisions-annotation.d.ts.map +1 -1
- package/dist/src/components/revisions-annotation.js +7 -51
- package/dist/src/components/revisions-annotation.js.map +1 -1
- package/dist/src/components/schema-element.d.ts +6 -0
- package/dist/src/components/schema-element.d.ts.map +1 -0
- package/dist/src/components/schema-element.js +42 -0
- package/dist/src/components/schema-element.js.map +1 -0
- package/dist/src/components/search-restrictions-annotation.d.ts +3 -4
- package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/search-restrictions-annotation.js +4 -13
- package/dist/src/components/search-restrictions-annotation.js.map +1 -1
- package/dist/src/components/skip-supported-annotation.d.ts +3 -4
- package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/skip-supported-annotation.js +2 -11
- package/dist/src/components/skip-supported-annotation.js.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.d.ts +4 -5
- package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.js +9 -30
- package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
- package/dist/src/components/structured-type-element.d.ts +7 -4
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +24 -66
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/top-supported-annotation.d.ts +3 -4
- package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/top-supported-annotation.js +3 -10
- package/dist/src/components/top-supported-annotation.js.map +1 -1
- package/dist/src/components/update-restrictions-annotation.d.ts +5 -0
- package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/update-restrictions-annotation.js +8 -0
- package/dist/src/components/update-restrictions-annotation.js.map +1 -0
- package/dist/src/decorators/abstract.d.ts.map +1 -1
- package/dist/src/decorators/abstract.js +0 -6
- package/dist/src/decorators/abstract.js.map +1 -1
- package/dist/src/decorators/action.d.ts +10 -0
- package/dist/src/decorators/action.d.ts.map +1 -0
- package/dist/src/decorators/action.js +16 -0
- package/dist/src/decorators/action.js.map +1 -0
- package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +3 -1
- package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
- package/dist/src/decorators/additional-query-parameters.js +21 -0
- package/dist/src/decorators/additional-query-parameters.js.map +1 -0
- package/dist/src/decorators/ags-attribute.d.ts +14 -0
- package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
- package/dist/src/decorators/ags-attribute.js +115 -0
- package/dist/src/decorators/ags-attribute.js.map +1 -0
- package/dist/src/decorators/allowed-values.d.ts +13 -0
- package/dist/src/decorators/allowed-values.d.ts.map +1 -0
- package/dist/src/decorators/allowed-values.js +35 -0
- package/dist/src/decorators/allowed-values.js.map +1 -0
- package/dist/src/decorators/complex.d.ts.map +1 -1
- package/dist/src/decorators/complex.js +0 -6
- package/dist/src/decorators/complex.js.map +1 -1
- package/dist/src/decorators/delta-collection.d.ts +8 -0
- package/dist/src/decorators/delta-collection.d.ts.map +1 -0
- package/dist/src/decorators/delta-collection.js +12 -0
- package/dist/src/decorators/delta-collection.js.map +1 -0
- package/dist/src/decorators/entity.d.ts.map +1 -1
- package/dist/src/decorators/entity.js +0 -6
- package/dist/src/decorators/entity.js.map +1 -1
- package/dist/src/decorators/filter.d.ts +11 -0
- package/dist/src/decorators/filter.d.ts.map +1 -0
- package/dist/src/decorators/filter.js +27 -0
- package/dist/src/decorators/filter.js.map +1 -0
- package/dist/src/decorators/flags.d.ts +9 -0
- package/dist/src/decorators/flags.d.ts.map +1 -0
- package/dist/src/decorators/flags.js +13 -0
- package/dist/src/decorators/flags.js.map +1 -0
- package/dist/src/decorators/function.d.ts +10 -0
- package/dist/src/decorators/function.d.ts.map +1 -0
- package/dist/src/decorators/function.js +16 -0
- package/dist/src/decorators/function.js.map +1 -0
- package/dist/src/decorators/graph-route.d.ts +16 -0
- package/dist/src/decorators/graph-route.d.ts.map +1 -0
- package/dist/src/decorators/graph-route.js +98 -0
- package/dist/src/decorators/graph-route.js.map +1 -0
- package/dist/src/decorators/has-stream.d.ts +1 -2
- package/dist/src/decorators/has-stream.d.ts.map +1 -1
- package/dist/src/decorators/has-stream.js +1 -14
- package/dist/src/decorators/has-stream.js.map +1 -1
- package/dist/src/decorators/immutable.d.ts +8 -0
- package/dist/src/decorators/immutable.d.ts.map +1 -0
- package/dist/src/decorators/immutable.js +12 -0
- package/dist/src/decorators/immutable.js.map +1 -0
- package/dist/src/decorators/index.d.ts +20 -1
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +20 -1
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/is-owner.d.ts +10 -0
- package/dist/src/decorators/is-owner.d.ts.map +1 -0
- package/dist/src/decorators/is-owner.js +17 -0
- package/dist/src/decorators/is-owner.js.map +1 -0
- package/dist/src/decorators/open.d.ts.map +1 -1
- package/dist/src/decorators/open.js +0 -6
- package/dist/src/decorators/open.js.map +1 -1
- package/dist/src/decorators/{routed-interfaces.d.ts → operation-parameters.d.ts} +3 -11
- package/dist/src/decorators/operation-parameters.d.ts.map +1 -0
- package/dist/src/decorators/operation-parameters.js +15 -0
- package/dist/src/decorators/operation-parameters.js.map +1 -0
- package/dist/src/decorators/paged-collection.d.ts +8 -0
- package/dist/src/decorators/paged-collection.d.ts.map +1 -0
- package/dist/src/decorators/paged-collection.js +12 -0
- package/dist/src/decorators/paged-collection.js.map +1 -0
- package/dist/src/decorators/partial.d.ts +10 -0
- package/dist/src/decorators/partial.d.ts.map +1 -0
- package/dist/src/decorators/partial.js +16 -0
- package/dist/src/decorators/partial.js.map +1 -0
- package/dist/src/decorators/private-preview.d.ts.map +1 -1
- package/dist/src/decorators/private-preview.js +0 -10
- package/dist/src/decorators/private-preview.js.map +1 -1
- package/dist/src/decorators/privileged.d.ts +9 -0
- package/dist/src/decorators/privileged.d.ts.map +1 -0
- package/dist/src/decorators/privileged.js +13 -0
- package/dist/src/decorators/privileged.js.map +1 -0
- package/dist/src/decorators/public-namespace.d.ts +10 -0
- package/dist/src/decorators/public-namespace.d.ts.map +1 -0
- package/dist/src/decorators/public-namespace.js +16 -0
- package/dist/src/decorators/public-namespace.js.map +1 -0
- package/dist/src/decorators/required-for-create.d.ts +10 -0
- package/dist/src/decorators/required-for-create.d.ts.map +1 -0
- package/dist/src/decorators/required-for-create.js +14 -0
- package/dist/src/decorators/required-for-create.js.map +1 -0
- package/dist/src/decorators/workload-name-msa.d.ts +9 -0
- package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
- package/dist/src/decorators/workload-name-msa.js +13 -0
- package/dist/src/decorators/workload-name-msa.js.map +1 -0
- package/dist/src/decorators/workload-name.d.ts +9 -0
- package/dist/src/decorators/workload-name.d.ts.map +1 -0
- package/dist/src/decorators/workload-name.js +13 -0
- package/dist/src/decorators/workload-name.js.map +1 -0
- package/dist/src/emitter.d.ts +2 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +7 -3
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/entities/annotations.d.ts +40 -0
- package/dist/src/entities/annotations.d.ts.map +1 -0
- package/dist/src/entities/annotations.js +139 -0
- package/dist/src/entities/annotations.js.map +1 -0
- package/dist/src/entities/entity-container.d.ts +15 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -0
- package/dist/src/entities/entity-container.js +42 -0
- package/dist/src/entities/entity-container.js.map +1 -0
- package/dist/src/entities/enum.d.ts +17 -0
- package/dist/src/entities/enum.d.ts.map +1 -0
- package/dist/src/entities/enum.js +24 -0
- package/dist/src/entities/enum.js.map +1 -0
- package/dist/src/entities/model.d.ts +47 -0
- package/dist/src/entities/model.d.ts.map +1 -0
- package/dist/src/entities/model.js +104 -0
- package/dist/src/entities/model.js.map +1 -0
- package/dist/src/entities/namespace.d.ts +21 -0
- package/dist/src/entities/namespace.d.ts.map +1 -0
- package/dist/src/entities/namespace.js +81 -0
- package/dist/src/entities/namespace.js.map +1 -0
- package/dist/src/entities/operation.d.ts +28 -0
- package/dist/src/entities/operation.d.ts.map +1 -0
- package/dist/src/entities/operation.js +103 -0
- package/dist/src/entities/operation.js.map +1 -0
- package/dist/src/entities/property.d.ts +3 -0
- package/dist/src/entities/property.d.ts.map +1 -0
- package/dist/src/entities/property.js +57 -0
- package/dist/src/entities/property.js.map +1 -0
- package/dist/src/entities/revision-definition.d.ts +9 -0
- package/dist/src/entities/revision-definition.d.ts.map +1 -0
- package/dist/src/entities/revision-definition.js +42 -0
- package/dist/src/entities/revision-definition.js.map +1 -0
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +53 -2
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +25 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +34 -25
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/allowed-values.d.ts +6 -0
- package/dist/src/rules/allowed-values.d.ts.map +1 -0
- package/dist/src/rules/allowed-values.js +59 -0
- package/dist/src/rules/allowed-values.js.map +1 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts +2 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts.map +1 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.js +28 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.js.map +1 -0
- package/dist/src/rules/count.d.ts.map +1 -1
- package/dist/src/rules/count.js +3 -1
- package/dist/src/rules/count.js.map +1 -1
- package/dist/src/rules/disallowed-typespec-decorators.d.ts +2 -0
- package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -0
- package/dist/src/rules/disallowed-typespec-decorators.js +33 -0
- package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -0
- package/dist/src/rules/entity.d.ts +1 -0
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +43 -1
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +2 -0
- package/dist/src/rules/enum.d.ts.map +1 -0
- package/dist/src/rules/enum.js +26 -0
- package/dist/src/rules/enum.js.map +1 -0
- package/dist/src/rules/expand.d.ts.map +1 -1
- package/dist/src/rules/expand.js +5 -7
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/extends-on-same-type.d.ts +2 -0
- package/dist/src/rules/extends-on-same-type.d.ts.map +1 -0
- package/dist/src/rules/extends-on-same-type.js +38 -0
- package/dist/src/rules/extends-on-same-type.js.map +1 -0
- package/dist/src/rules/filter.d.ts +4 -0
- package/dist/src/rules/filter.d.ts.map +1 -0
- package/dist/src/rules/filter.js +92 -0
- package/dist/src/rules/filter.js.map +1 -0
- package/dist/src/rules/function.d.ts +2 -0
- package/dist/src/rules/function.d.ts.map +1 -0
- package/dist/src/rules/function.js +26 -0
- package/dist/src/rules/function.js.map +1 -0
- package/dist/src/rules/graph-route.d.ts +6 -0
- package/dist/src/rules/graph-route.d.ts.map +1 -0
- package/dist/src/rules/graph-route.js +88 -0
- package/dist/src/rules/graph-route.js.map +1 -0
- package/dist/src/rules/index.d.ts +13 -6
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +13 -161
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/namespace.d.ts +3 -0
- package/dist/src/rules/namespace.d.ts.map +1 -0
- package/dist/src/rules/namespace.js +58 -0
- package/dist/src/rules/namespace.js.map +1 -0
- package/dist/src/rules/operation-inside-interface.d.ts +2 -0
- package/dist/src/rules/operation-inside-interface.d.ts.map +1 -0
- package/dist/src/rules/operation-inside-interface.js +25 -0
- package/dist/src/rules/operation-inside-interface.js.map +1 -0
- package/dist/src/rules/order-by.d.ts +1 -1
- package/dist/src/rules/order-by.d.ts.map +1 -1
- package/dist/src/rules/order-by.js +11 -10
- package/dist/src/rules/order-by.js.map +1 -1
- package/dist/src/rules/partial.d.ts +5 -0
- package/dist/src/rules/partial.d.ts.map +1 -0
- package/dist/src/rules/partial.js +35 -0
- package/dist/src/rules/partial.js.map +1 -0
- package/dist/src/rules/required-for-create.d.ts +2 -0
- package/dist/src/rules/required-for-create.d.ts.map +1 -0
- package/dist/src/rules/required-for-create.js +40 -0
- package/dist/src/rules/required-for-create.js.map +1 -0
- package/dist/src/rules/search.d.ts.map +1 -1
- package/dist/src/rules/search.js +3 -1
- package/dist/src/rules/search.js.map +1 -1
- package/dist/src/rules/skip.d.ts.map +1 -1
- package/dist/src/rules/skip.js +3 -1
- package/dist/src/rules/skip.js.map +1 -1
- package/dist/src/rules/top.d.ts.map +1 -1
- package/dist/src/rules/top.js +3 -1
- package/dist/src/rules/top.js.map +1 -1
- package/dist/src/utils.d.ts +18 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +160 -4
- package/dist/src/utils.js.map +1 -1
- package/lib/decorators.tsp +182 -39
- package/lib/deployment.tsp +18 -0
- package/lib/lib.tsp +6 -22
- package/lib/msgraph.tsp +4 -0
- package/lib/porcelain.tsp +135 -0
- package/lib/responses.tsp +82 -0
- package/lib/shared-models.tsp +75 -0
- package/package.json +31 -20
- package/dist/src/components/program-context.d.ts +0 -4
- package/dist/src/components/program-context.d.ts.map +0 -1
- package/dist/src/components/program-context.js +0 -3
- package/dist/src/components/program-context.js.map +0 -1
- package/dist/src/csdl.d.ts +0 -8
- package/dist/src/csdl.d.ts.map +0 -1
- package/dist/src/csdl.js +0 -298
- package/dist/src/csdl.js.map +0 -1
- package/dist/src/decorators/attribute-builder.d.ts +0 -2
- package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
- package/dist/src/decorators/attribute-builder.js +0 -166
- package/dist/src/decorators/attribute-builder.js.map +0 -1
- package/dist/src/decorators/attributes.d.ts +0 -57
- package/dist/src/decorators/attributes.d.ts.map +0 -1
- package/dist/src/decorators/attributes.js +0 -50
- package/dist/src/decorators/attributes.js.map +0 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -36
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -7
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
- package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
- package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
- package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/index.js +0 -3
- package/dist/src/decorators/handlers/custom/index.js.map +0 -1
- package/dist/src/decorators/handlers/index.d.ts +0 -30
- package/dist/src/decorators/handlers/index.d.ts.map +0 -1
- package/dist/src/decorators/handlers/index.js +0 -121
- package/dist/src/decorators/handlers/index.js.map +0 -1
- package/dist/src/decorators/routed-interfaces.d.ts.map +0 -1
- package/dist/src/decorators/routed-interfaces.js +0 -43
- package/dist/src/decorators/routed-interfaces.js.map +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { getDoc, walkPropertiesInherited } from "@typespec/compiler";
|
|
2
|
+
import { getInterfaceNavigationSourceType } from "../utils.js";
|
|
3
|
+
import { getOperationVerb } from "@typespec/http";
|
|
4
|
+
import { getExpand, getFilter, getOrderBy, isContains, isCount, isExpand, isFilter, isOrderBy, isReferences, isRequiredForCreate, isSearch, isSkip, isTop } from "../index.js";
|
|
5
|
+
export function GetResourceAnnotations(program, namespaceName, navigationSources) {
|
|
6
|
+
const annotations = new Map();
|
|
7
|
+
navigationSources.forEach((entity, routePath) => {
|
|
8
|
+
annotations.set(routePath, getResourceAnnotations(program, namespaceName, routePath, entity));
|
|
9
|
+
});
|
|
10
|
+
return annotations;
|
|
11
|
+
}
|
|
12
|
+
function getResourceAnnotations(program, namespaceName, routePath, entity) {
|
|
13
|
+
const resource = entity.theInterface;
|
|
14
|
+
const type = getInterfaceNavigationSourceType(program, resource);
|
|
15
|
+
const minimumParameters = routePath.split('/').length - 1;
|
|
16
|
+
const operationMethods = [...entity.operations].map(operation => ({
|
|
17
|
+
operation,
|
|
18
|
+
verb: getOperationVerb(program, operation),
|
|
19
|
+
hasMinimumParameters: operation.parameters.properties.size === minimumParameters,
|
|
20
|
+
}));
|
|
21
|
+
const [hasExpandOnCollectionOrResource, nonExpandableProperties] = getExpandProperties(program, type, operationMethods);
|
|
22
|
+
const annotations = {
|
|
23
|
+
Target: `${namespaceName}.container/${routePath}`,
|
|
24
|
+
HasGetOnResource: operationMethods.some(({ verb }) => verb === "get"),
|
|
25
|
+
HasPatchOnResource: operationMethods.some(({ verb }) => verb === "patch"),
|
|
26
|
+
HasDeleteOnResource: operationMethods.some(({ verb }) => verb === "delete"),
|
|
27
|
+
HasExpandOnCollectionOrResource: hasExpandOnCollectionOrResource,
|
|
28
|
+
NonExpandableProperties: nonExpandableProperties,
|
|
29
|
+
Description: getDoc(program, resource),
|
|
30
|
+
};
|
|
31
|
+
return annotations;
|
|
32
|
+
}
|
|
33
|
+
export function GetCollectionAnnotations(program, namespaceName, sources) {
|
|
34
|
+
const annotations = new Map();
|
|
35
|
+
sources.forEach((entity, routePath) => {
|
|
36
|
+
annotations.set(routePath, getCollectionAnnotations(program, namespaceName, routePath, entity));
|
|
37
|
+
});
|
|
38
|
+
return annotations;
|
|
39
|
+
}
|
|
40
|
+
function getCollectionAnnotations(program, namespaceName, routePath, entity) {
|
|
41
|
+
const collection = entity.theInterface;
|
|
42
|
+
const type = getInterfaceNavigationSourceType(program, collection);
|
|
43
|
+
const minimumParameters = routePath.split('/').length - 1;
|
|
44
|
+
const operationMethods = entity.operations.map(operation => ({
|
|
45
|
+
operation,
|
|
46
|
+
verb: getOperationVerb(program, operation),
|
|
47
|
+
hasMinimumParameters: operation.parameters.properties.size === minimumParameters,
|
|
48
|
+
}));
|
|
49
|
+
const [hasFilterOperation, nonFilterableProperties] = getFilterProperties(program, type, operationMethods);
|
|
50
|
+
const [hasExpandOnCollectionOrResource, nonExpandableProperties] = getExpandProperties(program, type, operationMethods);
|
|
51
|
+
const [hasSortOnCollection, nonSortableProperties] = getSortProperties(program, type, operationMethods);
|
|
52
|
+
const annotations = {
|
|
53
|
+
Target: `${namespaceName}.container/${routePath}`,
|
|
54
|
+
HasGetOnCollection: operationMethods.some(m => m.hasMinimumParameters && m.verb === "get"),
|
|
55
|
+
HasGetOnResource: operationMethods.some(m => !m.hasMinimumParameters && m.verb === "get"),
|
|
56
|
+
HasPostOnCollection: operationMethods.some(m => m.verb === "post"),
|
|
57
|
+
RequiredProperties: getRequiredForCreateProperties(program, type),
|
|
58
|
+
HasPatchOnResource: operationMethods.some(m => !m.hasMinimumParameters && m.verb === "patch"),
|
|
59
|
+
HasDeleteOnResource: operationMethods.some(m => !m.hasMinimumParameters && m.verb === "delete"),
|
|
60
|
+
HasCountOnCollection: operationMethods.some(m => isCount(program, m.operation)),
|
|
61
|
+
HasSearchOnCollection: operationMethods.some(m => isSearch(program, m.operation)),
|
|
62
|
+
HasSkipOnCollection: operationMethods.some(m => isSkip(program, m.operation)),
|
|
63
|
+
HasFilterOperation: hasFilterOperation,
|
|
64
|
+
NonFilterableProperties: nonFilterableProperties,
|
|
65
|
+
HasExpandOnCollectionOrResource: hasExpandOnCollectionOrResource,
|
|
66
|
+
NonExpandableProperties: nonExpandableProperties,
|
|
67
|
+
HasSortOnCollection: hasSortOnCollection,
|
|
68
|
+
NonSortableProperties: nonSortableProperties,
|
|
69
|
+
HasTopOnCollection: operationMethods.some(m => isTop(program, m.operation)),
|
|
70
|
+
Description: getDoc(program, collection),
|
|
71
|
+
};
|
|
72
|
+
return annotations;
|
|
73
|
+
}
|
|
74
|
+
function getExpandProperties(program, type, operationMethods) {
|
|
75
|
+
const expandOperationMethod = operationMethods.find(m => m.verb === "get" &&
|
|
76
|
+
m.hasMinimumParameters &&
|
|
77
|
+
isExpand(program, m.operation));
|
|
78
|
+
if (expandOperationMethod) {
|
|
79
|
+
const expandableProperties = getExpand(program, expandOperationMethod.operation);
|
|
80
|
+
const navigationProperties = [...walkPropertiesInherited(type)]
|
|
81
|
+
.filter((property) => isContains(program, property) || isReferences(program, property))
|
|
82
|
+
.map((property) => property.name);
|
|
83
|
+
const nonExpandableProperties = navigationProperties.filter((property) => { var _a; return (_a = !(expandableProperties === null || expandableProperties === void 0 ? void 0 : expandableProperties.includes(property))) !== null && _a !== void 0 ? _a : false; });
|
|
84
|
+
return [true, nonExpandableProperties];
|
|
85
|
+
}
|
|
86
|
+
return [false, undefined];
|
|
87
|
+
}
|
|
88
|
+
function getFilterProperties(program, type, operationMethods) {
|
|
89
|
+
const filterOperationMethod = operationMethods.find((m) => m.verb === "get" && m.hasMinimumParameters && isFilter(program, m.operation));
|
|
90
|
+
if (filterOperationMethod) {
|
|
91
|
+
const filterableProperties = getFilter(program, filterOperationMethod.operation);
|
|
92
|
+
const navigationProperties = [...walkPropertiesInherited(type)]
|
|
93
|
+
.filter((property) => !isContains(program, property) && !isReferences(program, property))
|
|
94
|
+
.map((property) => property.name);
|
|
95
|
+
const nonFilterableProperties = navigationProperties.filter((property) => !filterableProperties.includes(property));
|
|
96
|
+
return [true, nonFilterableProperties];
|
|
97
|
+
}
|
|
98
|
+
return [false, undefined];
|
|
99
|
+
}
|
|
100
|
+
function getSortProperties(program, type, operationMethods) {
|
|
101
|
+
const sortOperationMethod = operationMethods.find(m => m.verb === "get" &&
|
|
102
|
+
m.hasMinimumParameters &&
|
|
103
|
+
isOrderBy(program, m.operation));
|
|
104
|
+
if (sortOperationMethod) {
|
|
105
|
+
const sortableProperties = getOrderBy(program, sortOperationMethod.operation);
|
|
106
|
+
const nonNavigationProperties = [...walkPropertiesInherited(type)]
|
|
107
|
+
.filter((property) => !isContains(program, property) && !isReferences(program, property))
|
|
108
|
+
.map((property) => property.name);
|
|
109
|
+
const nonSortableProperties = nonNavigationProperties.filter((property) => !sortableProperties.includes(property));
|
|
110
|
+
return [true, nonSortableProperties];
|
|
111
|
+
}
|
|
112
|
+
return [false, undefined];
|
|
113
|
+
}
|
|
114
|
+
function getRequiredForCreateProperties(program, type) {
|
|
115
|
+
const requiredForCreateProperties = [...walkPropertiesInherited(type)]
|
|
116
|
+
.filter((property) => isRequiredForCreate(program, property))
|
|
117
|
+
.map((property) => property.name);
|
|
118
|
+
return requiredForCreateProperties || undefined;
|
|
119
|
+
}
|
|
120
|
+
export function GetAllowedValuesAnnotations(program, namespaceName, models) {
|
|
121
|
+
const annotations = new Map();
|
|
122
|
+
for (const [_key, value] of models) {
|
|
123
|
+
const properties = value.Properties;
|
|
124
|
+
if ((properties === null || properties === void 0 ? void 0 : properties.length) > 0) {
|
|
125
|
+
properties.forEach(property => {
|
|
126
|
+
var _a, _b;
|
|
127
|
+
if (((_b = (_a = property === null || property === void 0 ? void 0 : property.allowedValues) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
128
|
+
annotations.set(`${namespaceName}/${value.Name}/${property.Name}`, {
|
|
129
|
+
Target: `${namespaceName}/${value.Name}/${property.Name}`,
|
|
130
|
+
allowedValues: property.allowedValues,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
;
|
|
137
|
+
return annotations;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../src/entities/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAoB,gCAAgC,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAY,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,QAAQ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} from "../utils.js";
|
|
3
|
+
export interface Singleton {
|
|
4
|
+
Name: string | undefined;
|
|
5
|
+
TypeName: string;
|
|
6
|
+
AgsAttributes: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface EntitySet {
|
|
9
|
+
Name: string | undefined;
|
|
10
|
+
TypeName: string;
|
|
11
|
+
AgsAttributes: Record<string, string | boolean | undefined>;
|
|
12
|
+
}
|
|
13
|
+
export declare function GetSingletons(program: Program, sources: Map<string, MsGraphInterface>): Map<string, Singleton>;
|
|
14
|
+
export declare function GetEntitySets(program: Program, sources: Map<string, MsGraphInterface>): Map<string, EntitySet>;
|
|
15
|
+
//# sourceMappingURL=entity-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-container.d.ts","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAER,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGL,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAC7D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAQ9G;AAkBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAQ9G"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
2
|
+
import { getPropertyTypeName, getInterfaceNavigationSourceType, } from "../utils.js";
|
|
3
|
+
export function GetSingletons(program, sources) {
|
|
4
|
+
const singletons = new Map();
|
|
5
|
+
sources.forEach((entity, routePath) => {
|
|
6
|
+
singletons.set(routePath, getSingleton(program, routePath, entity));
|
|
7
|
+
});
|
|
8
|
+
return singletons;
|
|
9
|
+
}
|
|
10
|
+
function getSingleton(program, routePath, entity) {
|
|
11
|
+
const singleton = entity.theInterface;
|
|
12
|
+
const type = getInterfaceNavigationSourceType(program, singleton);
|
|
13
|
+
const agsAttributes = { ...getOperationAgsAttributes(program, entity.operations), ...buildAttributes(program, singleton) };
|
|
14
|
+
const entry = {
|
|
15
|
+
Name: routePath,
|
|
16
|
+
TypeName: getPropertyTypeName(program, type),
|
|
17
|
+
AgsAttributes: agsAttributes,
|
|
18
|
+
};
|
|
19
|
+
return entry;
|
|
20
|
+
}
|
|
21
|
+
export function GetEntitySets(program, sources) {
|
|
22
|
+
const entitySets = new Map();
|
|
23
|
+
sources.forEach((entity, routePath) => {
|
|
24
|
+
entitySets.set(routePath, getEntitySet(program, routePath, entity));
|
|
25
|
+
});
|
|
26
|
+
return entitySets;
|
|
27
|
+
}
|
|
28
|
+
function getEntitySet(program, routePath, entity) {
|
|
29
|
+
const entitySet = entity.theInterface;
|
|
30
|
+
const type = getInterfaceNavigationSourceType(program, entitySet);
|
|
31
|
+
const agsAttributes = { ...getOperationAgsAttributes(program, entity.operations), ...buildAttributes(program, entitySet) };
|
|
32
|
+
const entry = {
|
|
33
|
+
Name: routePath,
|
|
34
|
+
TypeName: getPropertyTypeName(program, type),
|
|
35
|
+
AgsAttributes: agsAttributes,
|
|
36
|
+
};
|
|
37
|
+
return entry;
|
|
38
|
+
}
|
|
39
|
+
function getOperationAgsAttributes(program, operations) {
|
|
40
|
+
return operations.reduce((attr, operation) => ({ ...attr, ...buildAttributes(program, operation) }), {});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=entity-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-container.js","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,gCAAgC,GAEjC,MAAM,aAAa,CAAC;AAcrB,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,OAAsC;IACpF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEhD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB,EAAE,SAAiB,EAAE,MAAwB;IACjF,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAEtC,MAAM,IAAI,GAAG,gCAAgC,CAAC,OAAO,EAAE,SAAS,CAAE,CAAC;IAEnE,MAAM,aAAa,GAAG,EAAE,GAAG,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAE3H,MAAM,KAAK,GAAc;QACvB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC;QAC5C,aAAa,EAAE,aAAa;KAC7B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,OAAsC;IACpF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEhD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB,EAAE,SAAiB,EAAE,MAAwB;IACjF,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAEtC,MAAM,IAAI,GAAG,gCAAgC,CAAC,OAAO,EAAE,SAAS,CAAE,CAAC;IAEnE,MAAM,aAAa,GAAG,EAAE,GAAG,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAE3H,MAAM,KAAK,GAAc;QACvB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC;QAC5C,aAAa,EAAE,aAAa;KAC7B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,yBAAyB,CAAC,OAAgB,EAAE,UAAuB;IAC1E,OAAO,UAAU,CAAC,MAAM,CACtB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC,EAC1E,EAAE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Program, Enum } from "@typespec/compiler";
|
|
2
|
+
import { RevisionDefinition } from "./revision-definition.js";
|
|
3
|
+
export interface MsGraphEnum {
|
|
4
|
+
Name: string;
|
|
5
|
+
AgsAttributes: Record<string, string>;
|
|
6
|
+
RevisionDefinition: RevisionDefinition | undefined;
|
|
7
|
+
Elements: MsGraphEnumMember[];
|
|
8
|
+
IsFlags: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface MsGraphEnumMember {
|
|
11
|
+
Name: string;
|
|
12
|
+
Value: string | number | undefined;
|
|
13
|
+
AgsAttributes: Record<string, string>;
|
|
14
|
+
RevisionDefinition: RevisionDefinition | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function GetMsGraphEnumTypeElement(program: Program, enumType: Enum): MsGraphEnum;
|
|
17
|
+
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIrF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,WAAW,CAUvF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
2
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
3
|
+
import { isFlags } from "../index.js";
|
|
4
|
+
export function GetMsGraphEnumTypeElement(program, enumType) {
|
|
5
|
+
const element = {
|
|
6
|
+
Name: enumType.name,
|
|
7
|
+
AgsAttributes: buildAttributes(program, enumType),
|
|
8
|
+
RevisionDefinition: GetRevisionDefinition(program, enumType, enumType === null || enumType === void 0 ? void 0 : enumType.namespace),
|
|
9
|
+
Elements: [...enumType.members].map(([_, m]) => getMsGraphEnumMember(program, m)),
|
|
10
|
+
IsFlags: isFlags(program, enumType),
|
|
11
|
+
};
|
|
12
|
+
return element;
|
|
13
|
+
}
|
|
14
|
+
function getMsGraphEnumMember(program, member) {
|
|
15
|
+
var _a;
|
|
16
|
+
const element = {
|
|
17
|
+
Name: member.name,
|
|
18
|
+
Value: member.value,
|
|
19
|
+
AgsAttributes: buildAttributes(program, member),
|
|
20
|
+
RevisionDefinition: GetRevisionDefinition(program, member, (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
21
|
+
};
|
|
22
|
+
return element;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAiBtC,MAAM,UAAU,yBAAyB,CAAC,OAAgB,EAAE,QAAc;IACxE,MAAM,OAAO,GAAgB;QAC3B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,aAAa,EAAE,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC;QACjD,kBAAkB,EAAE,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAC;QACjF,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACjF,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;KACpC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAgB,EAAE,MAAkB;;IAChE,MAAM,OAAO,GAAsB;QACjC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,aAAa,EAAE,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC;QAC/C,kBAAkB,EAAE,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,CAAC;KACnF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Model, ModelProperty, Program } from "@typespec/compiler";
|
|
2
|
+
import { RevisionDefinition } from "./revision-definition.js";
|
|
3
|
+
export interface MsGraphModel {
|
|
4
|
+
Kind: MsGraphModelKind;
|
|
5
|
+
Name: string;
|
|
6
|
+
IsAbstract: boolean;
|
|
7
|
+
BaseType: string | undefined;
|
|
8
|
+
IsOpenType: boolean;
|
|
9
|
+
HasStream: boolean;
|
|
10
|
+
AgsAttributes: Record<string, string>;
|
|
11
|
+
Properties: MsGraphModelProperty[];
|
|
12
|
+
RevisionDefinition: RevisionDefinition | undefined;
|
|
13
|
+
Description: string | undefined;
|
|
14
|
+
KeyProperty: [string, ModelProperty] | undefined;
|
|
15
|
+
AlternateKeys: AlternateKeyProperty[];
|
|
16
|
+
StreamTypes: string[];
|
|
17
|
+
isPartial: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare enum MsGraphModelKind {
|
|
20
|
+
Unknown = 0,
|
|
21
|
+
Entity = 1,
|
|
22
|
+
Complex = 2
|
|
23
|
+
}
|
|
24
|
+
export interface AllowedValues {
|
|
25
|
+
type: string;
|
|
26
|
+
values: unknown[];
|
|
27
|
+
}
|
|
28
|
+
export interface MsGraphModelProperty {
|
|
29
|
+
Name: string;
|
|
30
|
+
IsNavigation: boolean;
|
|
31
|
+
IsNullable: boolean;
|
|
32
|
+
AgsAttributes: Record<string, string>;
|
|
33
|
+
PropertyTypeName: string;
|
|
34
|
+
IsContained: boolean;
|
|
35
|
+
IsComputed: boolean;
|
|
36
|
+
Permission: "Read" | "Write" | null;
|
|
37
|
+
RevisionDefinition: RevisionDefinition | undefined;
|
|
38
|
+
Description: string | undefined;
|
|
39
|
+
isImmutable: boolean;
|
|
40
|
+
allowedValues: AllowedValues;
|
|
41
|
+
}
|
|
42
|
+
export interface AlternateKeyProperty {
|
|
43
|
+
IsModel: boolean;
|
|
44
|
+
ModelProperty: ModelProperty;
|
|
45
|
+
}
|
|
46
|
+
export declare function GetMsGraphModels(program: Program, models: Map<string, Model>): Map<string, MsGraphModel>;
|
|
47
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA2BrF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CA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}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { getDoc, isKey } from "@typespec/compiler";
|
|
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, } from "../utils.js";
|
|
5
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
6
|
+
import { isPartial } from "../decorators/partial.js";
|
|
7
|
+
export var MsGraphModelKind;
|
|
8
|
+
(function (MsGraphModelKind) {
|
|
9
|
+
MsGraphModelKind[MsGraphModelKind["Unknown"] = 0] = "Unknown";
|
|
10
|
+
MsGraphModelKind[MsGraphModelKind["Entity"] = 1] = "Entity";
|
|
11
|
+
MsGraphModelKind[MsGraphModelKind["Complex"] = 2] = "Complex";
|
|
12
|
+
})(MsGraphModelKind || (MsGraphModelKind = {}));
|
|
13
|
+
export function GetMsGraphModels(program, models) {
|
|
14
|
+
const map = new Map();
|
|
15
|
+
models.forEach((m, key) => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (isPartial(program, m)) {
|
|
18
|
+
if ((_a = m.baseModel) === null || _a === void 0 ? void 0 : _a.name) { // meaning there is an extends clause
|
|
19
|
+
const baseModel = getMsGraphModel(program, m.baseModel, false);
|
|
20
|
+
if (baseModel) {
|
|
21
|
+
baseModel.IsOpenType = false;
|
|
22
|
+
baseModel.BaseType = undefined;
|
|
23
|
+
map.set(key + Math.random(), baseModel);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const partialModel = getMsGraphModel(program, m);
|
|
27
|
+
if (partialModel) {
|
|
28
|
+
partialModel.IsOpenType = false;
|
|
29
|
+
partialModel.BaseType = undefined;
|
|
30
|
+
map.set(key + Math.random(), partialModel);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const model = getMsGraphModel(program, m);
|
|
35
|
+
if (model) {
|
|
36
|
+
map.set(key, model);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return map;
|
|
40
|
+
}
|
|
41
|
+
function getMsGraphModel(program, model, generateProperties = true) {
|
|
42
|
+
let kind = MsGraphModelKind.Unknown;
|
|
43
|
+
if (isEntity(program, model)) {
|
|
44
|
+
kind = MsGraphModelKind.Entity;
|
|
45
|
+
}
|
|
46
|
+
else if (isComplex(program, model)) {
|
|
47
|
+
kind = MsGraphModelKind.Complex;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
Kind: kind,
|
|
54
|
+
Name: model.name,
|
|
55
|
+
IsAbstract: isAbstract(program, model),
|
|
56
|
+
BaseType: model.baseModel ? getIdForType(program, model.baseModel) : undefined,
|
|
57
|
+
IsOpenType: isOpen(program, model),
|
|
58
|
+
HasStream: hasStream(program, model),
|
|
59
|
+
AgsAttributes: buildAttributes(program, model, kind),
|
|
60
|
+
RevisionDefinition: GetRevisionDefinition(program, model, model.namespace),
|
|
61
|
+
Description: getDoc(program, model),
|
|
62
|
+
KeyProperty: kind === MsGraphModelKind.Entity ? [...model.properties].find(([_, property]) => isKey(program, property)) : undefined,
|
|
63
|
+
AlternateKeys: kind === MsGraphModelKind.Entity ? getAlternateKeys(program, model.properties) : [],
|
|
64
|
+
StreamTypes: kind === MsGraphModelKind.Entity ? getStreamTypes(program, model) : [],
|
|
65
|
+
Properties: generateProperties ? getModelProperties(program, model.properties) : [],
|
|
66
|
+
isPartial: isPartial(program, model),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function getModelProperties(program, properties) {
|
|
70
|
+
return [...properties].map(([_, v]) => {
|
|
71
|
+
var _a;
|
|
72
|
+
return {
|
|
73
|
+
Name: v.name,
|
|
74
|
+
IsNavigation: isNavigationProperty(program, v),
|
|
75
|
+
IsNullable: isTypeNullable(program, v.type),
|
|
76
|
+
AgsAttributes: buildAttributes(program, v),
|
|
77
|
+
PropertyTypeName: getPropertyTypeName(program, v.type),
|
|
78
|
+
IsContained: isContains(program, v),
|
|
79
|
+
IsComputed: isComputed(program, v),
|
|
80
|
+
Permission: isReadOnly(program, v)
|
|
81
|
+
? "Read"
|
|
82
|
+
: isWriteOnly(program, v)
|
|
83
|
+
? "Write"
|
|
84
|
+
: null,
|
|
85
|
+
RevisionDefinition: GetRevisionDefinition(program, v, (_a = v.model) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
86
|
+
Description: getDoc(program, v),
|
|
87
|
+
isImmutable: isImmutable(program, v),
|
|
88
|
+
allowedValues: hasAllowedValues(program, v) ? getAllowedValues(program, v) : [],
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function getAlternateKeys(program, properties) {
|
|
93
|
+
const result = new Array();
|
|
94
|
+
properties.forEach(v => {
|
|
95
|
+
if (isAlternateKey(program, v)) {
|
|
96
|
+
result.push({
|
|
97
|
+
IsModel: v.type.kind === "Model" && !isComplex(program, v.type),
|
|
98
|
+
ModelProperty: v,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAClF,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,EAEjB,MAA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CAAC,OAAO,EAAE,CAAC,CAAC;gBAChC,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;oBACzB,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC,IAAI;YACR,kBAAkB,EAAE,qBAAqB,CAAC,OAAO,EAAE,CAAC,EAAE,MAAA,CAAC,CAAC,KAAK,0CAAE,SAAS,CAAC;YACzE,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/B,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YACpC,aAAa,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAA8B;SAC5G,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB,EAAE,UAAsC;IAChF,MAAM,MAAM,GAA2B,IAAI,KAAK,EAAwB,CAAC;IAEzE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACrB,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC;gBAC/D,aAAa,EAAE,CAAC;aACjB,CAAC,CAAA;SACH;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
import { MsGraphEnum } from "./enum.js";
|
|
3
|
+
import { MsGraphModel } from "./model.js";
|
|
4
|
+
import { EntitySet, Singleton } from "./entity-container.js";
|
|
5
|
+
import { MsGraphOperation } from "./operation.js";
|
|
6
|
+
import { CollectionAnnotations, ResourceAnnotations, AllowedValuesAnnotations } from "./annotations.js";
|
|
7
|
+
export interface MsGraphNamespace {
|
|
8
|
+
Name: string;
|
|
9
|
+
Enums: MsGraphEnum[];
|
|
10
|
+
Models: Map<string, MsGraphModel>;
|
|
11
|
+
AgsAttributes: Record<string, string>;
|
|
12
|
+
Singletons: Map<string, Singleton>;
|
|
13
|
+
EntitySets: Map<string, EntitySet>;
|
|
14
|
+
Operations: MsGraphOperation[];
|
|
15
|
+
ResourceAnnotations: Map<string, ResourceAnnotations>;
|
|
16
|
+
CollectionAnnotations: Map<string, CollectionAnnotations>;
|
|
17
|
+
AllowedValuesAnnotations: Map<string, AllowedValuesAnnotations>;
|
|
18
|
+
key?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function GetMsGraphNamespaces(program: Program): MsGraphNamespace[];
|
|
21
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,OAAO,EAAQ,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAA6B,WAAW,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAoB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAgC,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAoD,wBAAwB,EAA+B,MAAM,kBAAkB,CAAC;AAIvL,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACtD,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAC1D,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAOzE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { getInterfacesOfKinds, isExcludedCoreType, isNavigationSource, isTopLevelNavigationSource } from "../utils.js";
|
|
2
|
+
import { GetMsGraphEnumTypeElement } from "./enum.js";
|
|
3
|
+
import { GetMsGraphModels } from "./model.js";
|
|
4
|
+
import { GetEntitySets, GetSingletons } from "./entity-container.js";
|
|
5
|
+
import { GetMsGraphOperations } from "./operation.js";
|
|
6
|
+
import { GetCollectionAnnotations, GetResourceAnnotations, GetAllowedValuesAnnotations } from "./annotations.js";
|
|
7
|
+
import { buildAttributes, getPublicNamespaceName } from "../index.js";
|
|
8
|
+
const DEFAULT_MSGRAPH_NAMESPACE = "microsoft.graph";
|
|
9
|
+
export function GetMsGraphNamespaces(program) {
|
|
10
|
+
const root = program.checker.getGlobalNamespaceType();
|
|
11
|
+
const namespaces = expandNamespaces(root)
|
|
12
|
+
.filter((namespace) => !isExcludedCoreType(program, namespace) && hasChildren(namespace))
|
|
13
|
+
.map((namespace) => getMsGraphNamespace(program, namespace));
|
|
14
|
+
return namespaces;
|
|
15
|
+
}
|
|
16
|
+
function expandNamespaces(namespace) {
|
|
17
|
+
return [namespace, ...[...namespace.namespaces.values()].flatMap(expandNamespaces)];
|
|
18
|
+
}
|
|
19
|
+
function hasChildren(type) {
|
|
20
|
+
switch (type.kind) {
|
|
21
|
+
case "Namespace":
|
|
22
|
+
return type.enums.size || type.models.size || type.interfaces.size || type.operations.size;
|
|
23
|
+
default:
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function getMsGraphNamespace(program, namespace) {
|
|
28
|
+
var _a;
|
|
29
|
+
const namespaceName = (_a = getPublicNamespaceName(program, namespace)) !== null && _a !== void 0 ? _a : DEFAULT_MSGRAPH_NAMESPACE;
|
|
30
|
+
const models = GetMsGraphModels(program, namespace.models);
|
|
31
|
+
const enums = [...namespace.enums].map(([_, e]) => GetMsGraphEnumTypeElement(program, e));
|
|
32
|
+
const sources = getNavigationSources(namespace.interfaces);
|
|
33
|
+
const resourceSources = getInterfacesOfKinds(program, sources, ["Resource"]);
|
|
34
|
+
const collectionSources = getInterfacesOfKinds(program, sources, ["Collection"]);
|
|
35
|
+
resourceSources.forEach((entity, routePath) => {
|
|
36
|
+
if (collectionSources.has(routePath)) {
|
|
37
|
+
const existing = collectionSources.get(routePath);
|
|
38
|
+
existing.operations = [...existing.operations, ...entity.operations.values()];
|
|
39
|
+
resourceSources.delete(routePath);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const singletonSources = getRootNavigationSources(program, resourceSources);
|
|
43
|
+
const entitySetSources = getRootNavigationSources(program, collectionSources);
|
|
44
|
+
const singletons = GetSingletons(program, singletonSources);
|
|
45
|
+
const entitySets = GetEntitySets(program, entitySetSources);
|
|
46
|
+
const resourceAnnotations = GetResourceAnnotations(program, namespaceName, resourceSources);
|
|
47
|
+
const collectionAnnotations = GetCollectionAnnotations(program, namespaceName, collectionSources);
|
|
48
|
+
const allowedValuesAnnotations = GetAllowedValuesAnnotations(program, namespaceName, models);
|
|
49
|
+
const operations = GetMsGraphOperations(program, namespace.interfaces);
|
|
50
|
+
return {
|
|
51
|
+
Name: namespaceName,
|
|
52
|
+
Enums: enums,
|
|
53
|
+
Models: models,
|
|
54
|
+
AgsAttributes: buildAttributes(program, namespace),
|
|
55
|
+
Singletons: singletons,
|
|
56
|
+
EntitySets: entitySets,
|
|
57
|
+
Operations: operations,
|
|
58
|
+
ResourceAnnotations: resourceAnnotations,
|
|
59
|
+
CollectionAnnotations: collectionAnnotations,
|
|
60
|
+
AllowedValuesAnnotations: allowedValuesAnnotations,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function getNavigationSources(interfaces) {
|
|
64
|
+
const navigationSources = new Map();
|
|
65
|
+
interfaces.forEach((theInterface, key) => {
|
|
66
|
+
if (isNavigationSource(theInterface)) {
|
|
67
|
+
navigationSources.set(key, theInterface);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return navigationSources;
|
|
71
|
+
}
|
|
72
|
+
function getRootNavigationSources(program, sources) {
|
|
73
|
+
const rootSources = new Map();
|
|
74
|
+
sources.forEach((entity, routePath) => {
|
|
75
|
+
if (isTopLevelNavigationSource(program, entity)) {
|
|
76
|
+
rootSources.set(routePath, entity);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return rootSources;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzI,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,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AO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Program, Interface } from "@typespec/compiler";
|
|
2
|
+
export declare enum OperationKind {
|
|
3
|
+
Unknown = 0,
|
|
4
|
+
Action = 1,
|
|
5
|
+
Function = 2
|
|
6
|
+
}
|
|
7
|
+
export interface MsGraphOperation {
|
|
8
|
+
Name: string;
|
|
9
|
+
Kind: OperationKind;
|
|
10
|
+
BindingTypeName: string;
|
|
11
|
+
AgsAttributes: Record<string, string>;
|
|
12
|
+
Properties: MsGraphOperationProperty[];
|
|
13
|
+
UnionProperties: MsGraphOperationProperty[][];
|
|
14
|
+
IsVoid: boolean;
|
|
15
|
+
IsNullable: boolean;
|
|
16
|
+
ReturnTypeName: string;
|
|
17
|
+
Description: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface MsGraphOperationProperty {
|
|
20
|
+
Name: string;
|
|
21
|
+
IsNullable: boolean;
|
|
22
|
+
PropertyTypeName: string;
|
|
23
|
+
IsOptional: boolean;
|
|
24
|
+
DefaultValue: Record<string, unknown> | undefined;
|
|
25
|
+
Description: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare function GetMsGraphOperations(program: Program, interfaces: Map<string, Interface>): MsGraphOperation[];
|
|
28
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuD,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO7G,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,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;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;CACjC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAgB,EAAE,CAuB7G"}
|