ory / sdk

The place where ORY's SDKs are being auto-generated
Apache License 2.0
139 stars 86 forks source link

JavaScript SDK did not find AdminApi PublicApi #228

Closed bulolo closed 1 year ago

bulolo commented 1 year ago

Preflight checklist

Describe the bug

image
import { Configuration, PublicApi, AdminApi } from "@ory/hydra-client"

const hydraPublic = new PublicApi(
  new Configuration({
    basePath: "https://public.hydra:4444/",
  }),
)

const hydraAdmin = new AdminApi(
  new Configuration({
    basePath: "https://public.hydra:4445/",
  }),
)
image

can't find PublicApi AdminApi

Reproducing the bug

yarn add @ory/hydra-client
import { Configuration, PublicApi, AdminApi } from "@ory/hydra-client"

const hydraPublic = new PublicApi(
  new Configuration({
    basePath: "https://public.hydra:4444/",
  }),
)

const hydraAdmin = new AdminApi(
  new Configuration({
    basePath: "https://public.hydra:4445/",
  }),
)
src/modules/auth/auth.service.ts:6:25 - error TS2305: Module '"@ory/hydra-client"' has no exported member 'PublicApi'.

6 import { Configuration, PublicApi, AdminApi } from "@ory/hydra-client"
                          ~~~~~~~~~

src/modules/auth/auth.service.ts:6:36 - error TS2305: Module '"@ory/hydra-client"' has no exported member 'AdminApi'.

6 import { Configuration, PublicApi, AdminApi } from "@ory/hydra-client"

Relevant log output

No response

Relevant configuration

No response

Version

2.0.2

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

Docker

Additional Context

No response

aeneasr commented 1 year ago

Please see https://github.com/ory/hydra/blob/master/CHANGELOG.md#breaking-changes

bulolo commented 1 year ago

@aeneasr any diffrent between @ory/client and @ory/hydra-client@v2.0.2?

vinckr commented 1 year ago

@aeneasr any diffrent between @ory/client and @ory/hydra-client@v2.0.2?

For future reference: When self-hosting it is recommended to use the dedicated client (hydra-client in this case). When using Ory Network you use @ory/client

Functionally they are the same and work interchangeably, both built from ory/sdk, but Ory Network might have features that are not yet released in hydra-client.

botosa commented 1 year ago

If anyone stumbles into the same issue, use OAuth2Api instead:

import { Configuration, OAuth2Api } from "@ory/hydra-client";

export const publicApi = new OAuth2Api(
  new Configuration({
    basePath: "HYDRA_PUBLIC_URL",
  })
);

export const adminApi = new OAuth2Api(
  new Configuration({
    basePath: "HYDRA_ADMIN_URL",
  })
);