58 lines
1.7 KiB
Plaintext
58 lines
1.7 KiB
Plaintext
--!strict
|
|
-- DrCr: Web-based double-entry bookkeeping framework
|
|
-- Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
|
--
|
|
-- This program is free software: you can redistribute it and/or modify
|
|
-- it under the terms of the GNU Affero General Public License as published by
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
|
-- (at your option) any later version.
|
|
--
|
|
-- This program is distributed in the hope that it will be useful,
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
-- GNU Affero General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU Affero General Public License
|
|
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
------------------------
|
|
-- Plugin specific types
|
|
|
|
-- Represents a libdrcr plugin specification and implementation
|
|
export type Plugin = {
|
|
spec: PluginSpec,
|
|
requires: (string, {ReportingProductKind}, ReportingStepArgs) -> {ReportingProductId},
|
|
execute: (string, {ReportingProductKind}, ReportingStepArgs) -> {ReportingProduct},
|
|
}
|
|
|
|
-- Represents a libdrcr plugin specification
|
|
export type PluginSpec = {
|
|
name: string,
|
|
reporting_steps: {ReportingStepSpec},
|
|
}
|
|
|
|
-- Specifies a ReportingStep provided by the plugin
|
|
export type ReportingStepSpec = {
|
|
name: string,
|
|
product_kinds: {ReportingProductKind}
|
|
}
|
|
|
|
-------------------------
|
|
-- libdrcr internal types
|
|
|
|
export type ReportingProduct = any
|
|
|
|
export type ReportingProductId = {
|
|
name: string,
|
|
kind: ReportingProductKind,
|
|
args: ReportingStepArgs,
|
|
}
|
|
|
|
export type ReportingProductKind = string
|
|
|
|
-- TODO: Currently only VoidArgs is supported
|
|
export type ReportingStepArgs = string
|
|
|
|
local libdrcr = {}
|
|
return libdrcr
|