chore: merge back origin/main

This commit is contained in:
Stefan Benz
2024-11-20 16:03:20 +01:00
15 changed files with 269 additions and 203 deletions

View File

@@ -9,7 +9,7 @@ Login UI.
The scope of functionality of this repo and packages is under active development.
The `@zitadel/client` and `@zitadel/node` packages are using [@connectrpc/connect](https://github.com/connectrpc/connect-es#readme) and its [2.0.0-alpha](https://github.com/connectrpc/connect-es/releases/tag/v2.0.0-alpha.1) release which might still change.
The `@zitadel/client` and `@zitadel/node` packages are using [@connectrpc/connect](https://github.com/connectrpc/connect-es#readme).
You can read the [contribution guide](/CONTRIBUTING.md) on how to contribute.
Questions can be raised in our [Discord channel](https://discord.gg/erh5Brh7jE) or as

View File

@@ -45,6 +45,9 @@ services:
ZITADEL_API_INTERNAL_URL: http://zitadel:8080
WRITE_ENVIRONMENT_FILE: /apps/login/.env.local
WRITE_TEST_ENVIRONMENT_FILE: /acceptance/tests/.env.local
SINK_EMAIL_INTERNAL_URL: http://sink:3333/email
SINK_SMS_INTERNAL_URL: http://sink:3333/sms
SINK_NOTIFICATION_URL: http://localhost:3333/notification
volumes:
- "./pat:/pat"
- "../apps/login:/apps/login"
@@ -56,7 +59,7 @@ services:
sink:
image: golang:1.19-alpine
container_name: sink
command: go run /sink/main.go -port 3333
command: go run /sink/main.go -port '3333' -email '/email' -sms '/sms' -notification '/notification'
ports:
- 3333:3333
volumes:

View File

@@ -8,9 +8,9 @@ ZITADEL_API_DOMAIN="${ZITADEL_API_DOMAIN:-localhost}"
ZITADEL_API_PORT="${ZITADEL_API_PORT:-8080}"
ZITADEL_API_URL="${ZITADEL_API_URL:-${ZITADEL_API_PROTOCOL}://${ZITADEL_API_DOMAIN}:${ZITADEL_API_PORT}}"
ZITADEL_API_INTERNAL_URL="${ZITADEL_API_INTERNAL_URL:-${ZITADEL_API_URL}}"
SINK_EMAIL_URL="${SINK_EMAIL_URL:-"http://localhost:3333/email"}}"
SINK_SMS_URL="${SINK_SMS_URL:-"http://localhost:3333/sms"}}"
SINK_NOTIFICATION_URL="${SINK_SMS_URL:-"http://localhost:3333/notification"}}"
SINK_EMAIL_INTERNAL_URL="${SINK_EMAIL_INTERNAL_URL:-"http://sink:3333/email"}"
SINK_SMS_INTERNAL_URL="${SINK_SMS_INTERNAL_URL:-"http://sink:3333/sms"}"
SINK_NOTIFICATION_URL="${SINK_NOTIFICATION_URL:-"http://localhost:3333/notification"}"
if [ -z "${PAT}" ]; then
echo "Reading PAT from file ${PAT_FILE}"
@@ -56,7 +56,7 @@ SMSHTTP_RESPONSE=$(curl -s --request POST \
--header "Authorization: Bearer ${PAT}" \
--header "Host: ${ZITADEL_API_DOMAIN}" \
--header "Content-Type: application/json" \
-d "{\"endpoint\": \"${SINK_SMS_URL}\", \"description\": \"test\"}")
-d "{\"endpoint\": \"${SINK_SMS_INTERNAL_URL}\", \"description\": \"test\"}")
echo "Received SMS HTTP response: ${SMSHTTP_RESPONSE}"
SMSHTTP_ID=$(echo ${SMSHTTP_RESPONSE} | jq -r '. | .id')
@@ -78,7 +78,7 @@ EMAILHTTP_RESPONSE=$(curl -s --request POST \
--header "Authorization: Bearer ${PAT}" \
--header "Host: ${ZITADEL_API_DOMAIN}" \
--header "Content-Type: application/json" \
-d "{\"endpoint\": \"${SINK_EMAIL_URL}\", \"description\": \"test\"}")
-d "{\"endpoint\": \"${SINK_EMAIL_INTERNAL_URL}\", \"description\": \"test\"}")
echo "Received Email HTTP response: ${EMAILHTTP_RESPONSE}"
EMAILHTTP_ID=$(echo ${EMAILHTTP_RESPONSE} | jq -r '. | .id')

View File

@@ -4,7 +4,7 @@ import { getCodeFromSink } from "./sink";
export async function codeFromSink(page: Page, key: string) {
// wait for send of the code
await page.waitForTimeout(2000);
await page.waitForTimeout(3000);
const c = await getCodeFromSink(key);
await code(page, c);
}

View File

@@ -3,7 +3,7 @@ import axios from "axios";
export async function getCodeFromSink(key: string): Promise<any> {
try {
const response = await axios.post(
process.env.SINK_NOTIFICATION_URL,
process.env.SINK_NOTIFICATION_URL!,
{
recipient: key,
},

View File

@@ -11,7 +11,6 @@ import { getSession } from "./zitadel";
const transport = (token: string) =>
createServerTransport(token, {
baseUrl: process.env.ZITADEL_API_URL!,
httpVersion: "2",
});
const sessionService = (sessionId: string) => {

View File

@@ -54,10 +54,7 @@ const CACHE_REVALIDATION_INTERVAL_IN_SECONDS = process.env
const transport = createServerTransport(
process.env.ZITADEL_SERVICE_USER_TOKEN!,
{
baseUrl: process.env.ZITADEL_API_URL!,
httpVersion: "2",
},
{ baseUrl: process.env.ZITADEL_API_URL! },
);
export const sessionService = createSessionServiceClient(transport);
@@ -652,7 +649,6 @@ export async function createPasskeyRegistrationLink(
) {
// const transport = createServerTransport(token, {
// baseUrl: process.env.ZITADEL_API_URL!,
// httpVersion: "2",
// });
// const service = createUserServiceClient(transport);
@@ -680,7 +676,6 @@ export async function registerU2F(
) {
// const transport = createServerTransport(token, {
// baseUrl: process.env.ZITADEL_API_URL!,
// httpVersion: "2",
// });
// const service = createUserServiceClient(transport);

View File

@@ -5,6 +5,8 @@
"scripts": {
"generate": "turbo run generate",
"build": "turbo run build",
"build:packages": "turbo run build --filter=./packages/*",
"build:apps": "turbo run build --filter=./apps/*",
"test": "turbo run test",
"start": "turbo run start",
"start:built": "turbo run start:built",
@@ -22,7 +24,8 @@
"version-packages": "changeset version",
"release": "turbo run build --filter=login^... && changeset publish",
"run-zitadel": "docker compose -f ./acceptance/docker-compose.yaml run setup",
"run-sink": "docker compose -f ./acceptance/docker-compose.yaml up -d sink"
"run-sink": "docker compose -f ./acceptance/docker-compose.yaml up -d sink",
"stop": "docker compose -f ./acceptance/docker-compose.yaml stop"
},
"pnpm": {
"overrides": {

View File

@@ -44,8 +44,8 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"dependencies": {
"@bufbuild/protobuf": "^2.0.0",
"@connectrpc/connect": "2.0.0-alpha.1",
"@bufbuild/protobuf": "^2.2.2",
"@connectrpc/connect": "^2.0.0",
"@zitadel/proto": "workspace:*"
},
"devDependencies": {

View File

@@ -1,9 +1,9 @@
import type { DescService } from "@bufbuild/protobuf";
import { Timestamp, timestampDate } from "@bufbuild/protobuf/wkt";
import { createPromiseClient, Transport } from "@connectrpc/connect";
import { createClient, Transport } from "@connectrpc/connect";
export function createClientFor<TService extends DescService>(service: TService) {
return (transport: Transport) => createPromiseClient(service, transport);
return (transport: Transport) => createClient(service, transport);
}
export function toDate(timestamp: Timestamp | undefined): Date | undefined {

View File

@@ -1,6 +1,7 @@
import { create } from "@bufbuild/protobuf";
import { FeatureService } from "@zitadel/proto/zitadel/feature/v2/feature_service_pb";
import { IdentityProviderService } from "@zitadel/proto/zitadel/idp/v2/idp_service_pb";
import { RequestContext } from "@zitadel/proto/zitadel/object/v2/object_pb";
import { RequestContextSchema } from "@zitadel/proto/zitadel/object/v2/object_pb";
import { OIDCService } from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
import { OrganizationService } from "@zitadel/proto/zitadel/org/v2/org_service_pb";
import { SessionService } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
@@ -17,8 +18,8 @@ export const createOrganizationServiceClient = createClientFor(OrganizationServi
export const createFeatureServiceClient = createClientFor(FeatureService);
export const createIdpServiceClient = createClientFor(IdentityProviderService);
export function makeReqCtx(orgId: string | undefined): Partial<RequestContext> {
return {
export function makeReqCtx(orgId: string | undefined) {
return create(RequestContextSchema, {
resourceOwner: orgId ? { case: "orgId", value: orgId } : { case: "instance", value: true },
};
});
}

View File

@@ -29,15 +29,15 @@
},
"peerDependencies": {
"@zitadel/client": "workspace:*",
"@connectrpc/connect": "^2.0.0-alpha.1"
"@connectrpc/connect": "^2.0.0"
},
"dependencies": {
"@connectrpc/connect-node": "^2.0.0-alpha.1",
"@connectrpc/connect-web": "^2.0.0-alpha.1",
"@connectrpc/connect-node": "^2.0.0",
"@connectrpc/connect-web": "^2.0.0",
"jose": "^5.3.0"
},
"devDependencies": {
"@connectrpc/connect": "^2.0.0-alpha.1",
"@connectrpc/connect": "^2.0.0",
"@types/node": "^22.9.0",
"@zitadel/client": "workspace:*",
"@zitadel/tsconfig": "workspace:*",

View File

@@ -2,7 +2,7 @@ version: v2
managed:
enabled: true
plugins:
- remote: buf.build/bufbuild/es:v2.0.0
- remote: buf.build/bufbuild/es:v2.2.0
out: .
include_imports: true
opt:

View File

@@ -12,12 +12,12 @@
"sideEffects": false,
"scripts": {
"generate": "buf generate https://github.com/zitadel/zitadel.git --path ./proto/zitadel",
"clean": "rm -rf zitadel && rm -rf .turbo && rm -rf node_modules"
"clean": "rm -rf zitadel .turbo node_modules google protoc-gen-openapiv2 validate"
},
"dependencies": {
"@bufbuild/protobuf": "^2.0.0"
"@bufbuild/protobuf": "^2.2.2"
},
"devDependencies": {
"@bufbuild/buf": "^1.46.0"
"@bufbuild/buf": "^1.47.2"
}
}

405
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff