@tokensapi/dsh-finance 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import type { FinanceApi } from './FinanceOverlay.tsx';
2
+ interface Props {
3
+ api: FinanceApi;
4
+ currentRevision: number;
5
+ onRestored: () => Promise<void>;
6
+ }
7
+ export declare function FinanceBackupSection({ api, currentRevision, onRestored }: Props): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { CompanyWorkspace } from '../contract.ts';
2
+ import type { FinanceApi } from './FinanceOverlay.tsx';
3
+ interface Props {
4
+ api: FinanceApi;
5
+ workspace: CompanyWorkspace;
6
+ onRevision: (revision: number) => void;
7
+ }
8
+ export declare function FinanceBatchSection({ api, workspace, onRevision }: Props): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { CompanyWorkspace } from '../contract.ts';
2
+ import type { FinanceApi } from './FinanceOverlay.tsx';
3
+ interface Props {
4
+ api: FinanceApi;
5
+ workspace: CompanyWorkspace;
6
+ onRevision: (revision: number) => void;
7
+ }
8
+ export declare function FinanceImportSection({ api, workspace, onRevision }: Props): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { PropsLocale, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { createFinanceViewStore } from './store.ts';
3
+ export type FinanceLauncherProps = PropsRuntime<'sidebar.footer.action'> & PropsStore<ReturnType<typeof createFinanceViewStore>> & PropsLocale<'tokens-cowork-finance'>;
4
+ export declare function FinanceLauncher({ wide, useStore, actions, t }: FinanceLauncherProps): import("react").JSX.Element;
@@ -0,0 +1,82 @@
1
+ import type { PropsLocale, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { AccountCategory, BackupEnvelope, BackupPreview, BatchDetail, BatchMutationInput, CompanyWorkspace, CompanyBatchList, CommitImportInput, FinanceBootstrap, FinanceReports, GenerateReportsInput, ImportCommitResult, ImportPreview, PreviewImportInput, PreviewBackupInput, RestoreBackupInput, TransactionMutationInput, UpdateAccountInput, UpdateBatchFundingInput, UpdateTransactionInput } from '../contract.ts';
3
+ import type { createFinanceViewStore } from './store.ts';
4
+ export interface FinanceApi {
5
+ bootstrap(): Promise<FinanceBootstrap>;
6
+ workspace(id: string): Promise<CompanyWorkspace>;
7
+ createCompany(input: {
8
+ name: string;
9
+ baseCurrency: string;
10
+ currencyExponent: number;
11
+ openingDate: string;
12
+ expectedRevision: number;
13
+ }): Promise<CompanyWorkspace>;
14
+ renameCompany(input: {
15
+ companyId: string;
16
+ name: string;
17
+ expectedRevision: number;
18
+ }): Promise<CompanyWorkspace>;
19
+ deleteCompany(input: {
20
+ companyId: string;
21
+ confirmationName: string;
22
+ expectedRevision: number;
23
+ }): Promise<FinanceBootstrap>;
24
+ createAccount(input: {
25
+ companyId: string;
26
+ code: string;
27
+ name: string;
28
+ category: AccountCategory;
29
+ reportItem: string;
30
+ isContra: boolean;
31
+ openingBalanceMinor: string;
32
+ expectedRevision: number;
33
+ }): Promise<CompanyWorkspace>;
34
+ updateAccount(input: UpdateAccountInput): Promise<CompanyWorkspace>;
35
+ updateBalance(input: {
36
+ accountId: string;
37
+ openingBalanceMinor: string;
38
+ expectedRevision: number;
39
+ }): Promise<CompanyWorkspace>;
40
+ updateOpeningSettings(input: {
41
+ companyId: string;
42
+ openingDate: string;
43
+ baseCurrency: string;
44
+ currencyExponent: number;
45
+ expectedRevision: number;
46
+ }): Promise<CompanyWorkspace>;
47
+ deleteAccount(input: {
48
+ accountId: string;
49
+ expectedRevision: number;
50
+ }): Promise<CompanyWorkspace>;
51
+ setRetained(input: {
52
+ companyId: string;
53
+ accountId: string;
54
+ expectedRevision: number;
55
+ }): Promise<CompanyWorkspace>;
56
+ lock(input: {
57
+ companyId: string;
58
+ expectedRevision: number;
59
+ }): Promise<CompanyWorkspace>;
60
+ unlock(input: {
61
+ companyId: string;
62
+ expectedRevision: number;
63
+ }): Promise<CompanyWorkspace>;
64
+ previewImport(input: PreviewImportInput): Promise<ImportPreview>;
65
+ commitImport(input: CommitImportInput): Promise<ImportCommitResult>;
66
+ companyBatches(companyId: string): Promise<CompanyBatchList>;
67
+ batchDetail(batchId: string): Promise<BatchDetail>;
68
+ updateTransaction(input: UpdateTransactionInput): Promise<BatchDetail>;
69
+ deleteTransaction(input: TransactionMutationInput): Promise<BatchDetail>;
70
+ updateBatchFunding(input: UpdateBatchFundingInput): Promise<BatchDetail>;
71
+ deleteBatch(input: BatchMutationInput): Promise<CompanyBatchList>;
72
+ approveBatch(input: BatchMutationInput): Promise<BatchDetail>;
73
+ unapproveBatch(input: BatchMutationInput): Promise<BatchDetail>;
74
+ generateReports(input: GenerateReportsInput): Promise<FinanceReports>;
75
+ exportBackup(): Promise<BackupEnvelope>;
76
+ previewBackup(input: PreviewBackupInput): Promise<BackupPreview>;
77
+ restoreBackup(input: RestoreBackupInput): Promise<FinanceBootstrap>;
78
+ }
79
+ export type FinanceOverlayProps = PropsRuntime<'shell.overlay'> & PropsStore<ReturnType<typeof createFinanceViewStore>> & PropsLocale<'tokens-cowork-finance'> & {
80
+ api: FinanceApi;
81
+ };
82
+ export declare function FinanceOverlay({ useStore, actions, t, api }: FinanceOverlayProps): import("react").ReactPortal | null;
@@ -0,0 +1,8 @@
1
+ import type { CompanyWorkspace } from '../contract.ts';
2
+ import type { FinanceApi } from './FinanceOverlay.tsx';
3
+ interface Props {
4
+ api: FinanceApi;
5
+ workspace: CompanyWorkspace;
6
+ }
7
+ export declare function FinanceReportSection({ api, workspace }: Props): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { type FinanceLocaleKey } from './locales.ts';
3
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
4
+ interface LocaleNamespaceMap {
5
+ 'tokens-cowork-finance': FinanceLocaleKey;
6
+ }
7
+ }
8
+ export declare const inject: string[];
9
+ export declare function apply(ctx: Context): void;
@@ -0,0 +1,26 @@
1
+ export declare const NS = "tokens-cowork-finance";
2
+ export declare const zh: {
3
+ readonly title: "财务报表";
4
+ readonly subtitle: "基于银行流水生成资产负债表和利润表";
5
+ readonly close: "关闭财务报表";
6
+ readonly loading: "正在读取本地财务数据…";
7
+ readonly emptyTitle: "尚未创建公司";
8
+ readonly emptyDescription: "创建第一家公司后,即可设置会计科目、导入银行流水并生成报表。";
9
+ readonly skeletonNotice: "插件骨架已连接。公司、科目、流水和报表功能将在下一阶段实现。";
10
+ readonly loadFailed: "无法读取财务数据";
11
+ readonly retry: "重试";
12
+ readonly localOnly: "财务数据保存在 TokensCowork 本地存储中。";
13
+ };
14
+ export declare const en: {
15
+ readonly title: "Finance Reports";
16
+ readonly subtitle: "Generate balance sheets and income statements from bank transactions";
17
+ readonly close: "Close finance reports";
18
+ readonly loading: "Loading local finance data…";
19
+ readonly emptyTitle: "No company yet";
20
+ readonly emptyDescription: "Create a company to configure accounts, import bank transactions, and generate reports.";
21
+ readonly skeletonNotice: "The plugin skeleton is connected. Company, account, transaction, and reporting features come next.";
22
+ readonly loadFailed: "Unable to load finance data";
23
+ readonly retry: "Retry";
24
+ readonly localOnly: "Finance data is stored locally by TokensCowork.";
25
+ };
26
+ export type FinanceLocaleKey = keyof typeof zh;
@@ -0,0 +1,45 @@
1
+ import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
2
+ import { type CompanyMutationInput, type CompanyWorkspace, type CreateAccountInput, type CreateCompanyInput, type DeleteCompanyInput, type FinanceBootstrap, type RenameCompanyInput, type RevisionedIdInput, type SetRetainedEarningsInput, type UpdateAccountInput, type UpdateOpeningBalanceInput, type UpdateOpeningSettingsInput, type PreviewImportInput, type ImportPreview, type CommitImportInput, type ImportCommitResult, type CompanyBatchList, type BatchDetail, type UpdateTransactionInput, type TransactionMutationInput, type UpdateBatchFundingInput, type BatchMutationInput, type GenerateReportsInput, type FinanceReports, type BackupEnvelope, type BackupPreview, type PreviewBackupInput, type RestoreBackupInput } from '../contract.ts';
3
+ export declare const FINANCE_REMOTE: TypertRemoteContribution;
4
+ export interface FinanceRemoteFace {
5
+ getBootstrap(): Promise<RemoteResult<FinanceBootstrap>>;
6
+ getCompanyWorkspace(input: {
7
+ companyId: string;
8
+ }): Promise<RemoteResult<CompanyWorkspace>>;
9
+ createCompany(input: CreateCompanyInput): Promise<RemoteResult<CompanyWorkspace>>;
10
+ renameCompany(input: RenameCompanyInput): Promise<RemoteResult<CompanyWorkspace>>;
11
+ deleteCompany(input: DeleteCompanyInput): Promise<RemoteResult<FinanceBootstrap>>;
12
+ createAccount(input: CreateAccountInput): Promise<RemoteResult<CompanyWorkspace>>;
13
+ updateAccount(input: UpdateAccountInput): Promise<RemoteResult<CompanyWorkspace>>;
14
+ deleteAccount(input: RevisionedIdInput): Promise<RemoteResult<CompanyWorkspace>>;
15
+ updateOpeningBalance(input: UpdateOpeningBalanceInput): Promise<RemoteResult<CompanyWorkspace>>;
16
+ updateOpeningSettings(input: UpdateOpeningSettingsInput): Promise<RemoteResult<CompanyWorkspace>>;
17
+ setRetainedEarningsAccount(input: SetRetainedEarningsInput): Promise<RemoteResult<CompanyWorkspace>>;
18
+ lockOpening(input: CompanyMutationInput): Promise<RemoteResult<CompanyWorkspace>>;
19
+ unlockOpening(input: CompanyMutationInput): Promise<RemoteResult<CompanyWorkspace>>;
20
+ previewImport(input: PreviewImportInput): Promise<RemoteResult<ImportPreview>>;
21
+ commitImport(input: CommitImportInput): Promise<RemoteResult<ImportCommitResult>>;
22
+ getCompanyBatches(input: {
23
+ companyId: string;
24
+ }): Promise<RemoteResult<CompanyBatchList>>;
25
+ getBatchDetail(input: {
26
+ batchId: string;
27
+ }): Promise<RemoteResult<BatchDetail>>;
28
+ updateTransaction(input: UpdateTransactionInput): Promise<RemoteResult<BatchDetail>>;
29
+ deleteTransaction(input: TransactionMutationInput): Promise<RemoteResult<BatchDetail>>;
30
+ updateBatchFundingAccount(input: UpdateBatchFundingInput): Promise<RemoteResult<BatchDetail>>;
31
+ deleteBatch(input: BatchMutationInput): Promise<RemoteResult<CompanyBatchList>>;
32
+ approveBatch(input: BatchMutationInput): Promise<RemoteResult<BatchDetail>>;
33
+ unapproveBatch(input: BatchMutationInput): Promise<RemoteResult<BatchDetail>>;
34
+ generateReports(input: GenerateReportsInput): Promise<RemoteResult<FinanceReports>>;
35
+ exportBackup(): Promise<RemoteResult<BackupEnvelope>>;
36
+ previewBackup(input: PreviewBackupInput): Promise<RemoteResult<BackupPreview>>;
37
+ restoreBackup(input: RestoreBackupInput): Promise<RemoteResult<FinanceBootstrap>>;
38
+ }
39
+ declare module '@deepseek-ai/dsh-typert-protocol' {
40
+ interface TypertRemoteNamespace$66696e616e6365 extends FinanceRemoteFace {
41
+ }
42
+ interface TypertRemoteNamespaceMap {
43
+ finance: TypertRemoteNamespace$66696e616e6365;
44
+ }
45
+ }
@@ -0,0 +1,18 @@
1
+ import type { StoreHandle } from '@deepseek-ai/dsh-client-ui-slots';
2
+ export interface FinanceViewState {
3
+ open: boolean;
4
+ }
5
+ type FinanceViewActions = {
6
+ open: (draft: FinanceViewState) => void;
7
+ close: (draft: FinanceViewState) => void;
8
+ };
9
+ /**
10
+ * Build the small observable store contract consumed by DSH 0.4.4 slots.
11
+ *
12
+ * DSH 0.4.4 removed the former dsh-client-runtime package and moved its generic
13
+ * store engine into an unpublished internal package. Keeping this store local
14
+ * makes the plugin bundle self-contained while preserving the public slot
15
+ * contract: spec/create/getSnapshot/subscribe/actions/clearPersisted.
16
+ */
17
+ export declare function createFinanceViewStore(): StoreHandle<FinanceViewState, FinanceViewActions>;
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare function installFinanceStyles(): () => void;