feat(import): resolve references and schema composition
This commit is contained in:
@@ -108,6 +108,24 @@ pub(super) fn build_test_app(
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn build_test_app_with_external_references(
|
||||
registry: PostgresRegistry,
|
||||
storage_root: std::path::PathBuf,
|
||||
allowed_url_prefixes: Vec<String>,
|
||||
) -> Router {
|
||||
build_app(AppState {
|
||||
service: test_service_with_external_references(
|
||||
registry,
|
||||
storage_root,
|
||||
allowed_url_prefixes,
|
||||
),
|
||||
api_rate_limiter: crank_runtime::RequestRateLimiter::new(
|
||||
crank_runtime::RequestRateLimitConfig::new(10_000, 10_000).unwrap(),
|
||||
),
|
||||
trusted_proxy_ips: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn build_test_app_with_audit_sink(
|
||||
registry: PostgresRegistry,
|
||||
storage_root: std::path::PathBuf,
|
||||
@@ -152,6 +170,33 @@ pub(super) fn test_service(
|
||||
.build()
|
||||
}
|
||||
|
||||
pub(super) fn test_service_with_external_references(
|
||||
registry: PostgresRegistry,
|
||||
storage_root: std::path::PathBuf,
|
||||
allowed_url_prefixes: Vec<String>,
|
||||
) -> AdminService {
|
||||
let outbound_policy = crank_runtime::OutboundHttpPolicy::allowing_hosts(["127.0.0.1"]);
|
||||
let runtime = crank_runtime::community_with_outbound_policy(outbound_policy.clone()).build();
|
||||
AdminServiceBuilder::new(
|
||||
registry,
|
||||
storage_root,
|
||||
test_auth_settings(),
|
||||
test_secret_crypto(),
|
||||
runtime,
|
||||
)
|
||||
.with_external_reference_import(&crank_config::ExternalReferenceSettings {
|
||||
allowed_url_prefixes,
|
||||
max_depth: 8,
|
||||
max_documents: 32,
|
||||
max_fetch_bytes: 64 * 1024,
|
||||
fetch_timeout_ms: 2_000,
|
||||
max_expanded_nodes: 10_000,
|
||||
})
|
||||
.unwrap()
|
||||
.with_outbound_http_policy(outbound_policy)
|
||||
.build()
|
||||
}
|
||||
|
||||
pub(super) async fn spawn_upstream_server() -> String {
|
||||
let app = Router::new().route("/crm/leads", post(create_lead));
|
||||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user