“找不到名称'IPost'”ServiceStack TypeScript DTO用于Auth服务

时间:2017-11-17 01:08:06

标签: servicestack

我使用以下ServiceStack代码创建了我的Auth服务器:

Plugins.Add(new AuthFeature(() => new CustomUserSession(),
    new IAuthProvider[] {
        new JwtAuthProvider
        {
            HashAlgorithm = AuthSettings.HashAlgorithm,
            RequireSecureConnection = requireSecureConnection,
            AuthKeyBase64 = AuthSettings.JwtAuthKeyBase64,
            ExpireTokensIn        = TimeSpan.FromHours(_configuration["AuthSettings:ExpireTokensIn"].ToDouble()),
            ExpireRefreshTokensIn = TimeSpan.FromHours(_configuration["AuthSettings:ExpireRefreshTokensIn"].ToDouble()),
            CreatePayloadFilter = (payload,session) => {
                    payload["zipCode"] = ((CustomUserSession)session).ZipCode;
            },
            PopulateSessionFilter = AuthSettings.PopulateSessionFilterImplementation
        },
        new CustomCredentialsAuthProvider((ITsoContext)_serviceProvider.GetService(typeof(ITsoContext))) //HTML Form post of User/Pass
    }));

非常简单,然后我从我的http://runningauthservice/types渲染了我的Typescript“dtos.ts”。

我正在使用servicestack-client版本0.0.40

这是我第一次在任何dtos.ts中看到IPost,我是从我的ServiceStack api渲染的,这里是我的auth dto.ts的片段:

// @Route("/assignroles")
// @DataContract
export class AssignRoles implements IReturn<AssignRolesResponse>, IPost
{
    // @DataMember(Order=1)
    userName: string;

    // @DataMember(Order=2)
    permissions: string[];

    // @DataMember(Order=3)
    roles: string[];
    createResponse() { return new AssignRolesResponse(); }
    getTypeName() { return "AssignRoles"; }
}

Visual Code中的Typescript错误片段:

enter image description here

1 个答案:

答案 0 :(得分:2)

此问题should be resolved包含MyGet上的最新预发行包。请在升级前查看ServiceStack v5 changes