@zhin.js/plugin-ledger 1.0.3 → 1.0.5
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.
- package/lib/runtime.d.ts +2 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js +3 -2
- package/lib/runtime.js.map +1 -1
- package/package.json +14 -15
- package/pages/index/index.js +14 -6
- package/pages/index/index.ts +14 -6
- package/plugin.js +31 -5
- package/src/runtime.ts +3 -2
package/lib/runtime.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { LedgerService } from './service.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ledgerServiceStore: import("zhin.js").PluginStore<LedgerService, unknown>;
|
|
3
|
+
export declare const ledgerServiceToken: import("zhin.js").PluginStore<LedgerService, unknown>;
|
|
3
4
|
//# sourceMappingURL=runtime.d.ts.map
|
package/lib/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,kBAAkB,uDAAqF,CAAC;AACrH,eAAO,MAAM,kBAAkB,uDAAqB,CAAC"}
|
package/lib/runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const
|
|
1
|
+
import { definePluginStore } from 'zhin.js';
|
|
2
|
+
export const ledgerServiceStore = definePluginStore('zhin.ledger.service', 'Personal expense ledger');
|
|
3
|
+
export const ledgerServiceToken = ledgerServiceStore;
|
|
3
4
|
//# sourceMappingURL=runtime.js.map
|
package/lib/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAgB,qBAAqB,EAAE,yBAAyB,CAAC,CAAC;AACrH,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-ledger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Personal expense ledger for Zhin.js (Plugin Runtime): per-user entries in integer cents, period and category summaries, group privacy and an opt-in daily report",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -37,20 +37,19 @@
|
|
|
37
37
|
"url": "https://github.com/lc-cn"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@zhin.js/
|
|
41
|
-
"@zhin.js/
|
|
42
|
-
"@zhin.js/
|
|
43
|
-
"@zhin.js/
|
|
44
|
-
"@zhin.js/tool": "1.1.16"
|
|
40
|
+
"@zhin.js/console-contract": "1.1.5",
|
|
41
|
+
"@zhin.js/page": "1.1.17",
|
|
42
|
+
"@zhin.js/skill": "1.1.16",
|
|
43
|
+
"@zhin.js/tool": "1.1.18"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"zod": "^4.0.0",
|
|
48
|
-
"zhin.js": "^1.1.
|
|
49
|
-
"@zhin.js/command": "^1.1.
|
|
50
|
-
"@zhin.js/page": "^1.1.
|
|
51
|
-
"@zhin.js/schedule-feature": "^1.1.
|
|
52
|
-
"@zhin.js/skill": "^1.1.
|
|
53
|
-
"@zhin.js/tool": "^1.1.
|
|
47
|
+
"zhin.js": "^1.1.24",
|
|
48
|
+
"@zhin.js/command": "^1.1.17",
|
|
49
|
+
"@zhin.js/page": "^1.1.17",
|
|
50
|
+
"@zhin.js/schedule-feature": "^1.1.15",
|
|
51
|
+
"@zhin.js/skill": "^1.1.16",
|
|
52
|
+
"@zhin.js/tool": "^1.1.18"
|
|
54
53
|
},
|
|
55
54
|
"peerDependenciesMeta": {
|
|
56
55
|
"@zhin.js/command": {
|
|
@@ -67,9 +66,9 @@
|
|
|
67
66
|
"typescript": "^6.0.3",
|
|
68
67
|
"vitest": "^4.1.10",
|
|
69
68
|
"zod": "^4.4.3",
|
|
70
|
-
"@zhin.js/schedule-feature": "1.1.
|
|
71
|
-
"@zhin.js/testing": "1.0.
|
|
72
|
-
"zhin.js": "1.1.
|
|
69
|
+
"@zhin.js/schedule-feature": "1.1.15",
|
|
70
|
+
"@zhin.js/testing": "1.0.9",
|
|
71
|
+
"zhin.js": "1.1.24"
|
|
73
72
|
},
|
|
74
73
|
"engines": {
|
|
75
74
|
"node": ">=22.19.0"
|
package/pages/index/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
-
import { definePage } from '@zhin.js/console-contract';
|
|
3
|
-
import { createDeclarativePage } from '@zhin.js/client';
|
|
2
|
+
import { definePage, createDeclarativePage } from '@zhin.js/console-contract';
|
|
4
3
|
export const meta = definePage({
|
|
5
4
|
title: '记账本',
|
|
6
5
|
titleI18n: { en: 'Ledger' },
|
|
@@ -53,10 +52,19 @@ export default createDeclarativePage({
|
|
|
53
52
|
{
|
|
54
53
|
id: 'config',
|
|
55
54
|
title: { zh: '配置详情', en: 'Configuration' },
|
|
56
|
-
entries:
|
|
57
|
-
{ label: 'Timezone',
|
|
58
|
-
{ label: 'Report Time',
|
|
59
|
-
{
|
|
55
|
+
entries: [
|
|
56
|
+
{ label: 'Timezone', dataKey: 'timezone' },
|
|
57
|
+
{ label: 'Report Time', dataKey: 'reportTime' },
|
|
58
|
+
{
|
|
59
|
+
label: 'Report When Empty',
|
|
60
|
+
value: {
|
|
61
|
+
$map: {
|
|
62
|
+
path: 'reportWhenEmpty',
|
|
63
|
+
cases: { true: 'Yes', false: 'No' },
|
|
64
|
+
default: 'No',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
60
68
|
],
|
|
61
69
|
},
|
|
62
70
|
],
|
package/pages/index/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { definePage } from '@zhin.js/console-contract';
|
|
2
|
-
import { createDeclarativePage } from '@zhin.js/client';
|
|
1
|
+
import { definePage, createDeclarativePage } from '@zhin.js/console-contract';
|
|
3
2
|
import type { LedgerConsoleSnapshot, LedgerConsoleSubscriber } from '../../src/service.js';
|
|
4
3
|
|
|
5
4
|
export const meta = definePage({
|
|
@@ -55,10 +54,19 @@ export default createDeclarativePage<LedgerConsoleSnapshot>({
|
|
|
55
54
|
{
|
|
56
55
|
id: 'config',
|
|
57
56
|
title: { zh: '配置详情', en: 'Configuration' },
|
|
58
|
-
entries:
|
|
59
|
-
{ label: 'Timezone',
|
|
60
|
-
{ label: 'Report Time',
|
|
61
|
-
{
|
|
57
|
+
entries: [
|
|
58
|
+
{ label: 'Timezone', dataKey: 'timezone' },
|
|
59
|
+
{ label: 'Report Time', dataKey: 'reportTime' },
|
|
60
|
+
{
|
|
61
|
+
label: 'Report When Empty',
|
|
62
|
+
value: {
|
|
63
|
+
$map: {
|
|
64
|
+
path: 'reportWhenEmpty',
|
|
65
|
+
cases: { true: 'Yes', false: 'No' },
|
|
66
|
+
default: 'No',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
62
70
|
],
|
|
63
71
|
},
|
|
64
72
|
],
|
package/plugin.js
CHANGED
|
@@ -1,21 +1,47 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
-
import { databaseHostToken, definePlugin, outboundHostToken, pluginConsoleRpcToken } from 'zhin.js';
|
|
2
|
+
import { databaseHostToken, definePlugin, definePluginCapabilityGraph, outboundHostToken, pluginConsoleRpcToken, } from 'zhin.js';
|
|
3
3
|
import { resolveLedgerConfig } from "./lib/config.js";
|
|
4
4
|
import { createLedgerConsoleRpc } from "./lib/console.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ledgerServiceStore } from "./lib/runtime.js";
|
|
6
6
|
import { LedgerService } from "./lib/service.js";
|
|
7
7
|
import { defineLedgerTables } from "./lib/store.js";
|
|
8
8
|
export default definePlugin({
|
|
9
9
|
name: 'ledger',
|
|
10
10
|
metadata: { displayName: '记账' },
|
|
11
11
|
requires: [databaseHostToken],
|
|
12
|
+
capabilityGraph: definePluginCapabilityGraph({
|
|
13
|
+
provides: [ledgerServiceStore, pluginConsoleRpcToken],
|
|
14
|
+
injects: [databaseHostToken, outboundHostToken],
|
|
15
|
+
features: {
|
|
16
|
+
commands: [
|
|
17
|
+
'ledger-add',
|
|
18
|
+
'ledger-delete',
|
|
19
|
+
'ledger-list',
|
|
20
|
+
'ledger-month',
|
|
21
|
+
'ledger-report',
|
|
22
|
+
'ledger-stats',
|
|
23
|
+
'ledger-today',
|
|
24
|
+
'ledger-week',
|
|
25
|
+
],
|
|
26
|
+
schedules: ['daily-report'],
|
|
27
|
+
skills: ['ledger'],
|
|
28
|
+
tools: [
|
|
29
|
+
'skill/ledger/ledger_add',
|
|
30
|
+
'skill/ledger/ledger_delete',
|
|
31
|
+
'skill/ledger/ledger_list',
|
|
32
|
+
'skill/ledger/ledger_summary',
|
|
33
|
+
],
|
|
34
|
+
pages: ['index'],
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
12
37
|
setup(context) {
|
|
13
38
|
const config = resolveLedgerConfig(context.config.get());
|
|
14
39
|
const database = context.resources.use(databaseHostToken);
|
|
15
40
|
defineLedgerTables(database);
|
|
16
41
|
const outbound = context.resources.has(outboundHostToken) ? context.resources.use(outboundHostToken) : undefined;
|
|
17
|
-
const service = new LedgerService(database, outbound, config);
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
const service = ledgerServiceStore.provide(context, new LedgerService(database, outbound, config));
|
|
43
|
+
return {
|
|
44
|
+
consoleRpc: createLedgerConsoleRpc(service),
|
|
45
|
+
};
|
|
20
46
|
},
|
|
21
47
|
});
|
package/src/runtime.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePluginStore } from 'zhin.js';
|
|
2
2
|
import type { LedgerService } from './service.js';
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const ledgerServiceStore = definePluginStore<LedgerService>('zhin.ledger.service', 'Personal expense ledger');
|
|
5
|
+
export const ledgerServiceToken = ledgerServiceStore;
|