chore: scaffold the Serverpod 4 build

Deviations from a stock `serverpod create`:
- Dropped Flutter web support, for two reasons:
  - Appflowy editor had issues in the past, potentially related to the
    Flutter-Web IME bridge. Upstream has also open bugs in relation to
that:
    - AppFlowy-IO/appflowy-editor#1029 [Bug][Web] Unwanted space on click
       and overall space bugs (open)
    - AppFlowy-IO/appflowy-editor#782 [Bug] Editor auto-scrolling when
       pressing space too quickly if placed inside a scrollable (open)
  - Offline-first is a required feature. serverpod_offline_sync's SQLite
    support in browsers, maybe via sqlite3.wasm + OPFS, is not
documented.
- SDK constraints raised to ^3.13.0, instead of ^3.12.2, so enjoy the
  newest language features.
- Pinned to Flutter 3.47.4 via FVM.

Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-09-16 19:24:59 +02:00
commit e17d99fa51
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
32 changed files with 17563 additions and 0 deletions

22
halkyon_learn_server/.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
# Files and directories created by pub
.dart_tool/
.packages
# Conventional directory for build outputs
build/
# Directory created by dartdoc
doc/api/
# Passwords file
config/passwords.yaml
# Firebase service account key for Firebase auth
config/firebase_service_account_key.json
# Embedded PostgreSQL runtime artifacts (data dir, sockets, pidfiles)
.serverpod/
# SQLite databases created by the ephemeral test database
**/sp_*.db*

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version, created by Stagehand

View file

@ -0,0 +1,58 @@
# Build from the project root with:
# docker build -f halkyon_learn_server/Dockerfile .
# Build stage
FROM dart:3.12.2 AS build
# Create a minimal workspace that preserves locked server dependency versions.
WORKDIR /app
COPY pubspec.lock .
COPY halkyon_learn_server halkyon_learn_server
RUN printf '%s\n' \
'name: _' \
'environment:' \
' sdk: ^3.12.2' \
'workspace:' \
' - halkyon_learn_server' \
> pubspec.yaml
RUN dart pub get
# Compile the server executable.
WORKDIR /app/halkyon_learn_server
RUN dart build cli --target bin/main.dart --output build
RUN mv build/bundle/bin/main build/bundle/bin/server
# Add a fallback for the copy of possibly missing directories.
RUN mkdir -p config web migrations
# Final stage
FROM alpine:latest
WORKDIR /app
# Environment variables
ENV runmode=production
ENV serverid=default
ENV logging=normal
ENV role=monolith
# Copy runtime dependencies
COPY --from=build /runtime/ /
# Copy compiled server executable and native libraries
COPY --from=build /app/halkyon_learn_server/build/bundle/ ./
# Copy configuration files and resources
COPY --from=build /app/halkyon_learn_server/config/ config/
COPY --from=build /app/halkyon_learn_server/web/ web/
COPY --from=build /app/halkyon_learn_server/migrations/ migrations/
# This file is required to enable the endpoint log filter in Insights.
COPY --from=build /app/halkyon_learn_server/lib/src/generated/protocol.yaml lib/src/generated/protocol.yaml
# Expose ports
EXPOSE 8080
EXPOSE 8081
EXPOSE 8082
# Define the entrypoint command
ENTRYPOINT ./bin/server --mode=$runmode --server-id=$serverid --logging=$logging --role=$role

View file

@ -0,0 +1,10 @@
# halkyon_learn_server
This is the starting point for your Serverpod server.
Start your server by running:
cd halkyon_learn
serverpod start
When you are finished, you can shut down the running server with `Q`.

View file

@ -0,0 +1,34 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
linter:
rules:
unawaited_futures: true
avoid_print: true
analyzer:
exclude:
- lib/src/generated/**
- test/integration/test_tools/serverpod_test_tools.dart
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
formatter:
trailing_commas: preserve

View file

@ -0,0 +1,7 @@
import 'package:halkyon_learn_server/server.dart';
/// This is the starting point for your Serverpod server. Typically, there is
/// no need to modify this file.
void main(List<String> args) {
run(args);
}

View file

@ -0,0 +1,76 @@
# This is the configuration file for your local development environment. By
# default, it runs a single server on port 8080. To set up your server, you will
# need to add the name of the database you are connecting to and the user name.
# The password for the database is stored in the config/passwords.yaml.
#
# When running your server locally, the server ports are the same as the public
# facing ports.
# Configuration for the main API server.
apiServer:
port: 8080
publicHost: localhost
publicPort: 8080
publicScheme: http
# Configuration for the Insights server.
insightsServer:
port: 8081
publicHost: localhost
publicPort: 8081
publicScheme: http
# Configuration for the web server.
webServer:
port: 8082
publicHost: localhost
publicPort: 8082
publicScheme: http
# This is the database setup for your server.
database:
host: localhost
port: 8090
name: halkyon_learn
user: postgres
#requireSsl: true # defaults to false
#isUnixSocket: true # defaults to false
dataPath: .serverpod/development/pgdata
#maxConnectionCount: 10 # Defaults to 10, a negative or null value removes the limit
# This is the setup for Redis.
redis:
enabled: false
host: localhost
port: 8091
#user: # defaults to empty
#requireSsl: true # defaults to false
maxRequestSize: 524288 # The maximum size of requests allowed in bytes
sessionLogs:
persistentEnabled: true
consoleEnabled: true
consoleLogFormat: text # Defaults to "json", options are "text" or "json"
# futureCallExecutionEnabled: true # Defaults to true
#futureCall:
# concurrencyLimit: 1 # Defaults to 1, a negative or null value removes the limit
# scanInterval: 5000 # Unit in milliseconds, defaults to 5000
# Recommended when serving web clients: keeps auth tokens in httpOnly
# cookies. Without this, web tokens live in JavaScript-readable storage,
# where any XSS can steal them. Web clients opt in with
# `client.cookieAuth = true`. Requires `allowedOrigins`; browsers from
# origins not in the list lose cross-origin access, including to public
# endpoints.
#authCookie:
# secure: false # Cookies require https; relax only for http://localhost
# #name: serverpod_auth # Defaults to "serverpod_auth"
# #refreshName: serverpod_auth_refresh # Defaults to "<name>_refresh"
# #domain: example.com # Defaults to host-only; set to share across subdomains
# #path: / # Defaults to "/"
# #sameSite: lax # Defaults to "lax", options are "strict" or "none"
#allowedOrigins:
# - http://localhost:8082 # The origin serving your Flutter web app

View file

@ -0,0 +1,4 @@
type: server
client_package_path: ../halkyon_learn_client
server_test_tools_path: test/integration/test_tools

View file

@ -0,0 +1,79 @@
# This is the configuration file for your production environment.
# Typically, you will want to route the traffic through a load balancer
# which adds SSL security through https. If you use Serverpod's standard
# Terraform scripts to deploy your server, all you need to change in
# this file is the examplepod.com domain name.
# Configuration for the main API server.
apiServer:
port: 8080
publicHost: api.examplepod.com
publicPort: 443
publicScheme: https
# Configuration for the Insights server.
insightsServer:
port: 8081
publicHost: insights.examplepod.com
publicPort: 443
publicScheme: https
# Configuration for the web server.
webServer:
port: 8082
publicHost: app.examplepod.com
publicPort: 443
publicScheme: https
# This is the database setup for your servers. The default for the Google Cloud
# Engine Terraform configuration is to connect on a private IP address.
# If you are connecting on a public IP (e.g. on AWS or Google Cloud Run), you
# connect on the public IP of the database e.g. database.examplepod.com.
database:
host: database.private-production.examplepod.com
port: 5432
name: serverpod
user: postgres
requireSsl: true
#isUnixSocket: true # defaults to false
#maxConnectionCount: 10 # Defaults to 10, a negative or null value removes the limit
# This is the setup for Redis. The default for the Google Cloud Engine Terraform
# configuration is to connect on a private IP address.
# If you are connecting on a public IP (e.g. on AWS or Google Cloud Run), you
# connect on the public IP of the database e.g. redis.examplepod.com.
redis:
enabled: false
host: redis.private-production.examplepod.com
port: 6379
#user: # defaults to empty
#requireSsl: true # defaults to false
maxRequestSize: 524288 # The maximum size of requests allowed in bytes
sessionLogs:
consoleEnabled: false
# persistentEnabled: true
# consoleLogFormat: json # Defaults to "json", options are "text" or "json"
# futureCallExecutionEnabled: true # Defaults to true
#futureCall:
# concurrencyLimit: 1 # Defaults to 1, a negative or null value removes the limit
# scanInterval: 5000 # Unit in milliseconds, defaults to 5000
# Recommended when serving web clients: keeps auth tokens in httpOnly
# cookies. Without this, web tokens live in JavaScript-readable storage,
# where any XSS can steal them. Web clients opt in with
# `client.cookieAuth = true`. Requires `allowedOrigins`; browsers from
# origins not in the list lose cross-origin access, including to public
# endpoints.
#authCookie:
# sameSite: lax # Defaults to "lax", options are "strict" or "none"
# #name: serverpod_auth # Defaults to "serverpod_auth"
# #refreshName: serverpod_auth_refresh # Defaults to "<name>_refresh"
# #domain: examplepod.com # Defaults to host-only; set to share across subdomains
# #path: / # Defaults to "/"
# #secure: true # Defaults to true; the cookie is only sent over https
#allowedOrigins:
# - https://app.examplepod.com # The origin serving your Flutter web app

View file

@ -0,0 +1,83 @@
# This is the configuration file for your staging environment. The staging
# environment is meant to resemble the production environment as much as
# possible and may connect to production databases services and data. You use it
# for final testing before deploying the production server.
#
# Typically, you will want to route the traffic through a load balancer
# which adds SSL security through https. If you use Serverpod's standard
# Terraform scripts to deploy your server, all you need to change in
# this file is the examplepod.com domain name.
# Configuration for the main API server.
apiServer:
port: 8080
publicHost: api-staging.examplepod.com
publicPort: 443
publicScheme: https
# Configuration for the Insights server.
insightsServer:
port: 8081
publicHost: insights-staging.examplepod.com
publicPort: 443
publicScheme: https
# Configuration for the web server.
webServer:
port: 8082
publicHost: app-staging.examplepod.com
publicPort: 443
publicScheme: https
# This is the database setup for your servers. The default for the Google Cloud
# Engine Terraform configuration is to connect on a private IP address.
# If you are connecting on a public IP (e.g. on AWS or Google Cloud Run), you
# connect on the public IP of the database e.g. database-staging.examplepod.com.
database:
host: database.private-staging.examplepod.com
port: 5432
name: serverpod
user: postgres
requireSsl: true
#isUnixSocket: true # defaults to false
#maxConnectionCount: 10 # Defaults to 10, a negative or null value removes the limit
# This is the setup for Redis. The default for the Google Cloud Engine Terraform
# configuration is to connect on a private IP address.
# If you are connecting on a public IP (e.g. on AWS or Google Cloud Run), you
# connect on the public IP of the database e.g. redis-staging.examplepod.com.
redis:
enabled: false
host: redis.private-staging.examplepod.com
port: 6379
#user: # defaults to empty
#requireSsl: true # defaults to false
maxRequestSize: 524288 # The maximum size of requests allowed in bytes
sessionLogs:
# persistentEnabled: true
# consoleEnabled: true
# consoleLogFormat: json # Defaults to "json", options are "text" or "json"
# futureCallExecutionEnabled: true # Defaults to true
#futureCall:
# concurrencyLimit: 1 # Defaults to 1, a negative or null value removes the limit
# scanInterval: 5000 # Unit in milliseconds, defaults to 5000
# Recommended when serving web clients: keeps auth tokens in httpOnly
# cookies. Without this, web tokens live in JavaScript-readable storage,
# where any XSS can steal them. Web clients opt in with
# `client.cookieAuth = true`. Requires `allowedOrigins`; browsers from
# origins not in the list lose cross-origin access, including to public
# endpoints.
#authCookie:
# sameSite: lax # Defaults to "lax", options are "strict" or "none"
# #name: serverpod_auth # Defaults to "serverpod_auth"
# #refreshName: serverpod_auth_refresh # Defaults to "<name>_refresh"
# #domain: examplepod.com # Defaults to host-only; set to share across subdomains
# #path: / # Defaults to "/"
# #secure: true # Defaults to true; the cookie is only sent over https
#allowedOrigins:
# - https://app-staging.examplepod.com # The origin serving your Flutter web app

View file

@ -0,0 +1,57 @@
# This is the configuration file for your test environment.
# All ports are set to zero in this file which makes the server find the next available port.
# This is needed to enable running tests concurrently. To set up your server, you will
# need to add the name of the database you are connecting to and the user name.
# The password for the database is stored in the config/passwords.yaml.
#
# When running your server locally, the server ports are the same as the public
# facing ports.
# Configuration for the main API test server.
apiServer:
port: 0
publicHost: localhost
publicPort: 0
publicScheme: http
# Configuration for the Insights test server.
insightsServer:
port: 0
publicHost: localhost
publicPort: 0
publicScheme: http
# Configuration for the web test server.
webServer:
port: 0
publicHost: localhost
publicPort: 0
publicScheme: http
# This is the database setup for your test server.
database:
host: localhost
port: 9090
name: halkyon_learn_test
user: postgres
dataPath: .serverpod/test/pgdata
#maxConnectionCount: 10 # Defaults to 10, a negative or null value removes the limit
# This is the setup for your Redis test instance.
redis:
enabled: false
host: localhost
port: 9091
#user: # defaults to empty
#requireSsl: true # defaults to false
sessionLogs:
persistentEnabled: true
consoleEnabled: true
# consoleLogFormat: json # Defaults to "json", options are "text" or "json"
# futureCallExecutionEnabled: true # Defaults to true
#futureCall:
# concurrencyLimit: 1 # Defaults to 1, a negative or null value removes the limit
# scanInterval: 5000 # Unit in milliseconds, defaults to 5000

View file

@ -0,0 +1,2 @@
tags:
integration: {}

View file

@ -0,0 +1,44 @@
services:
# Development services
postgres:
image: ghcr.io/serverpod/postgres:16
ports:
- "8090:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: halkyon_learn
POSTGRES_PASSWORD: "zLZiS0hYW86MNDWF3fTB9iYudoEQ4rZG"
volumes:
- halkyon_learn_data:/var/lib/postgresql/data
redis:
image: redis:6.2.6
ports:
- "8091:6379"
command: redis-server --requirepass "CaFsHWMa_hwVFcDEVDMRc5nneKiIC1In"
environment:
- REDIS_REPLICATION_MODE=master
# Test services
postgres_test:
image: ghcr.io/serverpod/postgres:16
ports:
- "9090:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: halkyon_learn_test
POSTGRES_PASSWORD: "h8hg2NM2Ho1N7Zv-WxwJyhfJC76hxy6h"
volumes:
- halkyon_learn_test_data:/var/lib/postgresql/data
redis_test:
image: redis:6.2.6
ports:
- "9091:6379"
command: redis-server --requirepass "JRcMj86Jrhg4s6soZ_DShJqQilJGzEJo"
environment:
- REDIS_REPLICATION_MODE=master
volumes:
halkyon_learn_data:
halkyon_learn_test_data:

View file

@ -0,0 +1,51 @@
import 'package:serverpod_auth_idp_server/core.dart';
import 'package:serverpod_auth_idp_server/providers/email.dart';
import 'package:serverpod_cloud_storage/serverpod_cloud_storage.dart';
import 'src/generated/serverpod.dart';
/// The starting point of the Serverpod server.
void run(List<String> args) async {
// Initialize Serverpod. The generated Serverpod class is already connected
// with your project's generated code.
final pod = Serverpod(args);
// Initialize authentication services for the server.
// Token managers will be used to validate and issue authentication keys,
// and the identity providers will be the authentication options available for users.
pod.initializeAuthServices(
tokenManagerBuilders: [
// Use JWT for authentication keys towards the server.
JwtConfigFromPasswords(),
],
identityProviderBuilders: [
// Configure the email identity provider for email/password authentication.
// The default setup works with Serverpod Cloud without configuration. In
// development the verification codes are logged to the console, and in
// staging and production they are sent through the Serverpod Cloud email
// service. If you want to use a custom provider for sending emails, use
// `EmailIdpConfigFromPasswords`.
ServerpodCloudEmailIdpConfig(
appDisplayName: 'halkyon_learn',
),
],
);
// Configure cloud storage.
// This setup works with Serverpod Cloud without extra configuration.
// If you want to use a custom provider for cloud storage, replace these
// with your preferred provider.
pod.addCloudStorage(
await ServerpodCloudProvider.private(
fallback: () => DatabaseCloudStorage('private'),
),
);
pod.addCloudStorage(
await ServerpodCloudProvider.public(
fallback: () => DatabaseCloudStorage('public'),
),
);
// Start the server.
await pod.start();
}

View file

@ -0,0 +1,6 @@
import 'package:serverpod_auth_idp_server/providers/email.dart';
/// By extending [EmailIdpBaseEndpoint], the email identity provider endpoints
/// are made available on the server and enable the corresponding sign-in widget
/// on the client.
class EmailIdpEndpoint extends EmailIdpBaseEndpoint {}

View file

@ -0,0 +1,5 @@
import 'package:serverpod_auth_idp_server/core.dart';
/// By extending [RefreshJwtTokensEndpoint], the JWT token refresh endpoint
/// is made available on the server and enables automatic token refresh on the client.
class JwtRefreshEndpoint extends RefreshJwtTokensEndpoint {}

View file

@ -0,0 +1,281 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod/serverpod.dart' as _is;
import 'package:serverpod_auth_core_server/serverpod_auth_core_server.dart'
as _iacs;
import 'package:serverpod_auth_idp_server/serverpod_auth_idp_server.dart'
as _iais;
import '../auth/email_idp_endpoint.dart' as _iuc1hd5t;
import '../auth/jwt_refresh_endpoint.dart' as _inwq3ztq;
import '../greetings/greeting_endpoint.dart' as _il624ik7;
class Endpoints extends _is.EndpointDispatch {
@override
void initializeEndpoints(_is.Server server) {
var endpoints = <String, _is.Endpoint>{
'emailIdp': _iuc1hd5t.EmailIdpEndpoint()
..initialize(
server,
'emailIdp',
null,
),
'jwtRefresh': _inwq3ztq.JwtRefreshEndpoint()
..initialize(
server,
'jwtRefresh',
null,
),
'greeting': _il624ik7.GreetingEndpoint()
..initialize(
server,
'greeting',
null,
),
};
connectors['emailIdp'] = _is.EndpointConnector(
name: 'emailIdp',
endpoint: endpoints['emailIdp']!,
methodConnectors: {
'login': _is.MethodConnector(
name: 'login',
params: {
'email': _is.ParameterDescription(
name: 'email',
type: _is.getType<String>(),
nullable: false,
),
'password': _is.ParameterDescription(
name: 'password',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async =>
(endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint).login(
session,
email: params['email'],
password: params['password'],
),
),
'startRegistration': _is.MethodConnector(
name: 'startRegistration',
params: {
'email': _is.ParameterDescription(
name: 'email',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.startRegistration(
session,
email: params['email'],
),
),
'verifyRegistrationCode': _is.MethodConnector(
name: 'verifyRegistrationCode',
params: {
'accountRequestId': _is.ParameterDescription(
name: 'accountRequestId',
type: _is.getType<_is.UuidValue>(),
nullable: false,
),
'verificationCode': _is.ParameterDescription(
name: 'verificationCode',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.verifyRegistrationCode(
session,
accountRequestId: params['accountRequestId'],
verificationCode: params['verificationCode'],
),
),
'finishRegistration': _is.MethodConnector(
name: 'finishRegistration',
params: {
'registrationToken': _is.ParameterDescription(
name: 'registrationToken',
type: _is.getType<String>(),
nullable: false,
),
'password': _is.ParameterDescription(
name: 'password',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.finishRegistration(
session,
registrationToken: params['registrationToken'],
password: params['password'],
),
),
'startPasswordReset': _is.MethodConnector(
name: 'startPasswordReset',
params: {
'email': _is.ParameterDescription(
name: 'email',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.startPasswordReset(
session,
email: params['email'],
),
),
'verifyPasswordResetCode': _is.MethodConnector(
name: 'verifyPasswordResetCode',
params: {
'passwordResetRequestId': _is.ParameterDescription(
name: 'passwordResetRequestId',
type: _is.getType<_is.UuidValue>(),
nullable: false,
),
'verificationCode': _is.ParameterDescription(
name: 'verificationCode',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.verifyPasswordResetCode(
session,
passwordResetRequestId: params['passwordResetRequestId'],
verificationCode: params['verificationCode'],
),
),
'finishPasswordReset': _is.MethodConnector(
name: 'finishPasswordReset',
params: {
'finishPasswordResetToken': _is.ParameterDescription(
name: 'finishPasswordResetToken',
type: _is.getType<String>(),
nullable: false,
),
'newPassword': _is.ParameterDescription(
name: 'newPassword',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.finishPasswordReset(
session,
finishPasswordResetToken:
params['finishPasswordResetToken'],
newPassword: params['newPassword'],
),
),
'hasAccount': _is.MethodConnector(
name: 'hasAccount',
params: {},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
.hasAccount(session),
),
},
);
connectors['jwtRefresh'] = _is.EndpointConnector(
name: 'jwtRefresh',
endpoint: endpoints['jwtRefresh']!,
methodConnectors: {
'refreshAccessToken': _is.MethodConnector(
name: 'refreshAccessToken',
params: {
'refreshToken': _is.ParameterDescription(
name: 'refreshToken',
type: _is.getType<String?>(),
nullable: true,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async =>
(endpoints['jwtRefresh'] as _inwq3ztq.JwtRefreshEndpoint)
.refreshAccessToken(
session,
refreshToken: params['refreshToken'],
),
),
},
);
connectors['greeting'] = _is.EndpointConnector(
name: 'greeting',
endpoint: endpoints['greeting']!,
methodConnectors: {
'hello': _is.MethodConnector(
name: 'hello',
params: {
'name': _is.ParameterDescription(
name: 'name',
type: _is.getType<String>(),
nullable: false,
),
},
call:
(
_is.Session session,
Map<String, dynamic> params,
) async =>
(endpoints['greeting'] as _il624ik7.GreetingEndpoint).hello(
session,
params['name'],
),
),
},
);
modules['serverpod_auth_idp'] = _iais.Endpoints()
..initializeEndpoints(server);
modules['serverpod_auth_core'] = _iacs.Endpoints()
..initializeEndpoints(server);
}
}

View file

@ -0,0 +1,109 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod/serverpod.dart' as _is;
/// A greeting message which can be sent to or from the server.
abstract class Greeting
implements _is.SerializableModel, _is.ProtocolSerialization {
Greeting._({
required this.message,
required this.author,
required this.timestamp,
});
factory Greeting({
required String message,
required String author,
required DateTime timestamp,
}) = _GreetingImpl;
factory Greeting.fromJson(Map<String, dynamic> jsonSerialization) {
return Greeting(
message: jsonSerialization['message'] as String,
author: jsonSerialization['author'] as String,
timestamp: _is.DateTimeJsonExtension.fromJson(
jsonSerialization['timestamp'],
),
);
}
/// The greeting message.
String message;
/// The author of the greeting message.
String author;
/// The time when the message was created.
DateTime timestamp;
/// Returns a shallow copy of this [Greeting]
/// with some or all fields replaced by the given arguments.
@_is.useResult
Greeting copyWith({
String? message,
String? author,
DateTime? timestamp,
});
@override
Map<String, dynamic> toJson() {
return {
'__className__': 'Greeting',
'message': message,
'author': author,
'timestamp': timestamp.toJson(),
};
}
@override
Map<String, dynamic> toJsonForProtocol() {
return {
'__className__': 'Greeting',
'message': message,
'author': author,
'timestamp': timestamp.toJson(),
};
}
@override
String toString() {
return _is.SerializationManager.encode(this);
}
}
class _GreetingImpl extends Greeting {
_GreetingImpl({
required String message,
required String author,
required DateTime timestamp,
}) : super._(
message: message,
author: author,
timestamp: timestamp,
);
/// Returns a shallow copy of this [Greeting]
/// with some or all fields replaced by the given arguments.
@_is.useResult
@override
Greeting copyWith({
String? message,
String? author,
DateTime? timestamp,
}) {
return Greeting(
message: message ?? this.message,
author: author ?? this.author,
timestamp: timestamp ?? this.timestamp,
);
}
}

View file

@ -0,0 +1,199 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: dead_code, unnecessary_type_check
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod/protocol.dart' as _isp;
import 'package:serverpod/serverpod.dart' as _is;
import 'package:serverpod_auth_core_server/serverpod_auth_core_server.dart'
as _iacs;
import 'package:serverpod_auth_idp_server/serverpod_auth_idp_server.dart'
as _iais;
import 'greetings/greeting.dart' as _izw8z7ou;
export 'greetings/greeting.dart';
class Protocol extends _is.DatabaseSerializationManager {
Protocol._();
factory Protocol() => _instance;
static final Protocol _instance = Protocol._().._registerHostProtocols();
static List<_isp.TableDefinition> get targetTableDefinitions => [
..._iais.Protocol.targetTableDefinitions,
..._iacs.Protocol.targetTableDefinitions,
..._isp.Protocol.targetTableDefinitions,
];
static String? getClassNameFromObjectJson(dynamic data) {
if (data is! Map) return null;
final className = data['__className__'] as String?;
return className;
}
@override
T deserialize<T>(
dynamic data, [
Type? t,
]) {
t ??= T;
final dataClassName = getClassNameFromObjectJson(data);
if (dataClassName != null && dataClassName != getClassNameForType(t)) {
try {
return deserializeByClassName({
'className': dataClassName,
'data': data,
});
} on _is.DeserializationClassNameNotFoundException catch (_) {
// If the className is not recognized (e.g., older client receiving
// data with a new subtype), fall back to deserializing without the
// className, using the expected type T.
}
}
if (t == _izw8z7ou.Greeting) {
return _izw8z7ou.Greeting.fromJson(data) as T;
}
if (t == _is.getType<_izw8z7ou.Greeting?>()) {
return (data != null ? _izw8z7ou.Greeting.fromJson(data) : null) as T;
}
try {
return _iais.Protocol().deserialize<T>(data, t);
} on _is.DeserializationTypeNotFoundException catch (_) {}
try {
return _iacs.Protocol().deserialize<T>(data, t);
} on _is.DeserializationTypeNotFoundException catch (_) {}
try {
return _isp.Protocol().deserialize<T>(data, t);
} on _is.DeserializationTypeNotFoundException catch (_) {}
return super.deserialize<T>(data, t);
}
static String? getClassNameForType(Type type) {
return switch (type) {
_izw8z7ou.Greeting => 'Greeting',
_ => null,
};
}
@override
String? getClassNameForObject(Object? data) {
String? className = super.getClassNameForObject(data);
if (className != null) return className;
if (data is Map<String, dynamic> && data['__className__'] is String) {
return (data['__className__'] as String).replaceFirst(
'halkyon_learn.',
'',
);
}
switch (data) {
case _izw8z7ou.Greeting():
return 'Greeting';
}
className = _iais.Protocol().getClassNameForObject(data);
if (className != null) {
return className.contains('.')
? className
: 'serverpod_auth_idp.$className';
}
className = _iacs.Protocol().getClassNameForObject(data);
if (className != null) {
return className.contains('.')
? className
: 'serverpod_auth_core.$className';
}
className = _isp.Protocol().getClassNameForObject(data);
if (className != null) {
return className.contains('.') ? className : 'serverpod.$className';
}
return null;
}
@override
dynamic deserializeByClassName(Map<String, dynamic> data) {
var dataClassName = data['className'];
if (dataClassName is! String) {
return super.deserializeByClassName(data);
}
if (dataClassName == 'Greeting') {
return deserialize<_izw8z7ou.Greeting>(data['data']);
}
if (dataClassName.startsWith('serverpod_auth_idp.')) {
data['className'] = dataClassName.substring(19);
return _iais.Protocol().deserializeByClassName(data);
}
if (dataClassName.startsWith('serverpod_auth_core.')) {
data['className'] = dataClassName.substring(20);
return _iacs.Protocol().deserializeByClassName(data);
}
if (dataClassName.startsWith('serverpod.')) {
data['className'] = dataClassName.substring(10);
return _isp.Protocol().deserializeByClassName(data);
}
return super.deserializeByClassName(data);
}
void _registerHostProtocols() {
_iais.Protocol().registerHostProtocol('halkyon_learn', this);
_iacs.Protocol().registerHostProtocol('halkyon_learn', this);
}
@override
_is.Table? getTableForType(Type t) {
{
var table = _iais.Protocol().getTableForType(t);
if (table != null) {
return table;
}
}
{
var table = _iacs.Protocol().getTableForType(t);
if (table != null) {
return table;
}
}
{
var table = _isp.Protocol().getTableForType(t);
if (table != null) {
return table;
}
}
return null;
}
@override
List<_isp.TableDefinition> getTargetTableDefinitions() =>
targetTableDefinitions;
@override
String getModuleName() => 'halkyon_learn';
/// Maps any `Record`s known to this [Protocol] to their JSON representation
///
/// Throws in case the record type is not known.
///
/// This method will return `null` (only) for `null` inputs.
Map<String, dynamic>? mapRecordToJson(Record? record) {
if (record == null) {
return null;
}
try {
return _iais.Protocol().mapRecordToJson(record);
} catch (_) {}
try {
return _iacs.Protocol().mapRecordToJson(record);
} catch (_) {}
throw Exception('Unsupported record type ${record.runtimeType}');
}
}

View file

@ -0,0 +1,13 @@
emailIdp:
- login:
- startRegistration:
- verifyRegistrationCode:
- finishRegistration:
- startPasswordReset:
- verifyPasswordResetCode:
- finishPasswordReset:
- hasAccount:
jwtRefresh:
- refreshAccessToken:
greeting:
- hello:

Some files were not shown because too many files have changed in this diff Show more