/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ import type { ResourcerContext } from '@nocobase/resourcer'; import type { PathSegment, VariablePathRef } from '../template/variable-expression'; import { type RecordParams } from './records'; import type { RecordSlotPolicies } from './record-slot-policy'; export type AuthorizedRecordBinding = Readonly<{ params: RecordParams; varName: string; prefix: readonly PathSegment[]; relativePaths: readonly (readonly PathSegment[])[]; preferFullRecord: boolean; contextKey: string; contextLocation: readonly PathSegment[]; }>; export type RecordBindingRejectionReason = 'protected-context-root' | 'protected-context-key'; export type RecordBindingRejection = Readonly<{ reason: RecordBindingRejectionReason; varName: string; prefix: readonly PathSegment[]; contextKey: string; contextLocation: readonly PathSegment[]; }>; export type RecordBindingPlan = Readonly<{ bindings: readonly AuthorizedRecordBinding[]; contextParams: Readonly>; rejections: readonly RecordBindingRejection[]; }>; export type RecordBindingUsage = Readonly>; export type PlanRecordBindingsOptions = Readonly<{ contextParams?: Readonly>; koaCtx: ResourcerContext; policies?: RecordSlotPolicies; usage: RecordBindingUsage; }>; export declare function planRecordBindings(options: PlanRecordBindingsOptions): Promise;