تخطَّ إلى المحتوى

@dukkan.one/app-sdk/config

The dukkan.app.toml schema (zod and JSON Schema) and the version surface the CLI pushes to the portal.

الحزمة
@dukkan.one/app-sdk@0.3.0
مراجعة الواجهة
2026-09-10
الاستيراد
import { … } from "@dukkan.one/app-sdk/config"
في هذه الصفحة

الدوال

appConfigJsonSchema#

function appConfigJsonSchema(): Record<string, unknown>

JSON Schema (draft 2020-12) of the file, for editors and other languages.

parseAppConfig#

function parseAppConfig(value: unknown): AppConfig

Validates a parsed file (any TOML/JSON reader) and applies defaults; throws DukkanConfigError.

versionSurfaceFromConfig#

function versionSurfaceFromConfig(config: AppConfig): { requested_scopes: string[]; redirect_uris: string[]; webhook_topics: string[]; api_version: "v1"; }

The surface dukkan app config push sends to the portal (its version draft).

الأنواع

AppConfig#

type AppConfig = z.infer<typeof appConfigSchema>

AppConfigInput#

type AppConfigInput = z.input<typeof appConfigSchema>

الثوابت

appConfigSchema#

const appConfigSchema: z.ZodObject<{ config_version: z.ZodLiteral<1>; app: z.ZodObject<{ name: z.ZodString; client_id: z.ZodOptional<z.ZodString>; handle: z.ZodOptional<z.ZodString>; api_version: z.ZodDefault<z.ZodLiteral<"v1">>; }, z.core.$strip>; auth: z.ZodObject<{ scopes: z.ZodArray<z.ZodEnum<{ "orders:read": "orders:read"; "products:read": "products:read"; "inventory:read": "inventory:read"; "clients:read": "clients:read"; "clients:write": "clients:write"; "discounts:read": "discounts:read"; "fulfillments:write": "fulfillments:write"; "inventory:write": "inventory:write"; "orders:create": "orders:create"; "orders:write": "orders:write"; "refunds:write": "refunds:write"; }>>; redirect_uris: z.ZodArray<z.ZodString>; }, z.core.$strip>; webhooks: z.ZodDefault<z.ZodObject<{ topics: z.ZodDefault<z.ZodArray<z.ZodEnum<{ "order.created": "order.created"; "order.status_changed": "order.status_changed"; "order.paid": "order.paid"; "product.created": "product.created"; "product.updated": "product.updated"; "product.deleted": "product.deleted"; "inventory.movement_created": "inventory.movement_created"; "fulfillment.requested": "fulfillment.requested"; "fulfillment.created": "fulfillment.created"; "fulfillment.updated": "fulfillment.updated"; "refund.created": "refund.created"; "app.uninstalled": "app.uninstalled"; }>>>; }, z.core.$strip>>; urls: z.ZodDefault<z.ZodObject<{ app_url: z.ZodOptional<z.ZodString>; install_path: z.ZodDefault<z.ZodString>; callback_path: z.ZodDefault<z.ZodString>; webhook_path: z.ZodDefault<z.ZodString>; }, z.core.$strip>>; dev: z.ZodDefault<z.ZodObject<{ port: z.ZodDefault<z.ZodNumber>; tunnel: z.ZodDefault<z.ZodEnum<{ cloudflared: "cloudflared"; none: "none"; }>>; }, z.core.$strip>>; }, z.core.$strict>

The zod schema of dukkan.app.toml: app identity, scopes and redirect URIs, webhook topics, route paths and the dev block.