Replacing JsonServiceClient's usage of fetch
ServiceStack Customer Forums » TypeScript
by brunomlopes
6h ago
Is there a way to not use fetch and use another http client library/method on JsonServiceClient, so we can override the Host header (which is not possible startin from node 18.8.2, according to Node 18.18.2 : unable to override the Host header in fetch · Issue #50305 · nodejs/node · GitHub )? For context: we’re using the typescript version of JsonServiceClient on a NextJS frontend for a .Net multi-tenant application. Each tenant has a different host. There is: nextjs code running on the browser on the client, calling the backend api nextjs code running on the nodejs server, calling the backen ..read more
Visit website
Typescript client get JWT
ServiceStack Customer Forums » TypeScript
by DigitalReach
3d ago
I am having a few issues with the typescript client and Identity auth. When making request inside nextjs getStaticProps() the authentication request successeds but subsequent request will receive a 401. Same code in a server component in dev mode works fine. export async function generateStaticParams() { let client = JsonApiClient.create("https://localhost:5001"); client.credentials = "include"; let req = new Authenticate(); req.provider = "credentials"; req.userName = "user"; req.password = "pass"; const response = await client.post(req); console.log("AUTH", response, cl ..read more
Visit website
Typescript DTO generation for Identity ApplicationUser
ServiceStack Customer Forums » TypeScript
by DigitalReach
1w ago
When the Identity user gets generated via TS it creates error: TS2449: Class ‘IdentityUser_1’ used before its declaration. I think because it inherits from a generic class. This class gets generated after it is referenced export class IdentityUser extends IdentityUser_1<string> { public constructor(init?: Partial<IdentityUser>) { super(init); (Object as any).assign(this, init); } } I do have an ApplicationUserResponse model with flat properties that is used on all IReturn values but I am using autocrud so if I specify any ICreateDb<TEntity> that has a reference to Ap ..read more
Visit website
Typescript client - hook into bearer token refresh
ServiceStack Customer Forums » TypeScript
by kev_rm
1M ago
I have a need to send along the bearer token as a query string ( ss-tok ) sometimes in the url (in particular for file upload/download) - so I am able to stash the bearer token doing a post to auth, but after expiry, the client is automatically using the refresh token which kind of works but causes two things to happen: a lot of redundant calls to refresh the bearer token as we reset the bearer token from localstorage when they load the app Me having to make a competing call to get a new bearer token for use in non-ts client api calls (which might also exacerbates 1) Any thoughts on a di ..read more
Visit website
X typescript EnumAsInt
ServiceStack Customer Forums » TypeScript
by MikeOtown
8M ago
My Enum: [EnumAsInt] public enum FileTypeEnum { CollectorTraining = 0, BATCertification = 1, DeviceCalibration = 2, Invoice = 3, DrugCOC = 4, AlcoholCOC = 5, } is generated as strings instead of ints by “x typescript”… export enum FileTypeEnum { CollectorTraining = 'CollectorTraining', BATCertification = 'BATCertification', DeviceCalibration = 'DeviceCalibration', Invoice = 'Invoice', DrugCOC = 'DrugCOC', AlcoholCOC = 'AlcoholCOC', } 2 posts - 2 participants Read full topic ..read more
Visit website
Client unable to parse responseStatus when service throws exception
ServiceStack Customer Forums » TypeScript
by lai
10M ago
Hi, I am using @servicestack/client 2.0.8 and unable to resolve a situation where a servicestack service is throwing an exception but the client is failing to serialize the responseStatus from the request body, I get the error message and I can’t get the error message sent from the server. [TypeError: right operand of 'instanceof' is not an object] I’ve follwed the code to here on in the sourcecode For brevity I have hardcoded the service call public object Post(SiteSignOff request) { var response = new SiteSignOffResponse(); // await Mediator.Send(n ..read more
Visit website
Fetch tags with typescript client
ServiceStack Customer Forums » TypeScript
by DigitalReach
11M ago
I am trying to take advantage of on demand revalidation in NextJs 13 - Data Fetching: Revalidating | Next.js It requires tagging the fetch request. Is it possible to do this with SS typescript client or I must use fetch directly? 1 post - 1 participant Read full topic ..read more
Visit website
Typescript-ref stopped working for IReturn
ServiceStack Customer Forums » TypeScript
by @tiptopweb
1y ago
@tiptopweb wrote: Hello I am generating the file dtos.ts using typescript-ref tool typescript-ref https://mds2.mojomotorcycles.com.au dtos.ts For this model: [Route("/admin-download-attachments")] public class AdminDownloadAttachments : IReturn<byte[]> { public int VehicleTransactionId { get; set; } } The issue is that I am getting this : IReturn<string> // @Route("/admin-download-attachments") export class AdminDownloadAttachments implements IReturn<string> { public vehicleTransactionId: number; public constructor(init?: Partial<AdminDownloadAttachments> ..read more
Visit website
Generated TS code has changed after an update from ServiceStack 5.10 to 5.11
ServiceStack Customer Forums » TypeScript
by @Alex Alexander Bauer
1y ago
@Alex wrote: Hello, raw data responses in generated TS code has changed after an update from ServiceStack 5.10 to 5.11 https://docs.servicestack.net/typescript-add-servicestack-reference#raw-data-responses Responses of byte[] are now string instead of Uint8Array in the generated TS code. Is this a mistake or has this been intentionally changed. Thanks Alex Posts: 4 Participants: 2 Read full topic ..read more
Visit website
Restricting TypeScript generation to specific namespaces
ServiceStack Customer Forums » TypeScript
by @dbrackett Daniel Brackett
1y ago
@dbrackett wrote: When using TypeScript generation, is there a mechanism where we could specify exact namespace matches for IncludeTypes in the client code generation? For instance, when we generate TypeScript, specifying Namespace1.Core/* pulls in the following namespaces: Namespace1.Core.Foo Namespace1.CoreBar I wanted to target just Namespace1.Core entities. If there isn’t anything currently, would it be possible to add a token that could cause it to match Namespace1.Core only (maybe just /)? Posts: 2 Participants: 2 Read full topic ..read more
Visit website

Follow ServiceStack Customer Forums » TypeScript on FeedSpot

Continue with Google
Continue with Apple
OR