@zhin.js/plugin-answers 0.0.10 → 0.0.12

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/config.d.ts CHANGED
@@ -11,12 +11,19 @@ export declare const answersConfig: Schema<Schema.InputRecord<{
11
11
  timezone: Schema<string, string> & Schema.Present;
12
12
  quizTimeoutSeconds: Schema<number, number> & Schema.Present;
13
13
  enableDrivingQuiz: Schema<boolean, boolean> & Schema.Present;
14
- }>, {
15
- dailyStable: boolean;
16
- timezone: string;
17
- quizTimeoutSeconds: number;
18
- enableDrivingQuiz: boolean;
19
- } & {}>;
14
+ }>, Schema.RecordTypes<{
15
+ dailyStable: Schema<boolean, boolean> & Schema.Present;
16
+ timezone: Schema<string, string> & Schema.Present;
17
+ quizTimeoutSeconds: Schema<number, number> & Schema.Present;
18
+ enableDrivingQuiz: Schema<boolean, boolean> & Schema.Present;
19
+ }>> & {
20
+ readonly output?: Schema.RecordTypes<{
21
+ dailyStable: Schema<boolean, boolean> & Schema.Present;
22
+ timezone: Schema<string, string> & Schema.Present;
23
+ quizTimeoutSeconds: Schema<number, number> & Schema.Present;
24
+ enableDrivingQuiz: Schema<boolean, boolean> & Schema.Present;
25
+ }> | undefined;
26
+ };
20
27
  export type AnswersConfig = Schema.Output<typeof answersConfig>;
21
28
  /** Missing fields fall back to defaults so commands stay usable when Runtime passes a partial view. */
22
29
  export declare function resolveAnswersConfig(config: Partial<AnswersConfig> | undefined): AnswersConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,sBAAsB;;;;;EAKjC,CAAC;AAEH,gIAAgI;AAChI,eAAO,MAAM,aAAa;;;;;;;;;;OAKxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAEhE,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,GAAG,aAAa,CAE9F"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,sBAAsB;;;;;EAKjC,CAAC;AAEH,gIAAgI;AAChI,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAKxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAEhE,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,GAAG,aAAa,CAE9F"}
package/lib/runtime.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { QuizService } from './quiz.js';
2
2
  /** Owner-scoped quiz state consumed by discovered commands and middleware. */
3
- export declare const quizServiceToken: import("zhin.js").Token<QuizService>;
3
+ export declare const quizServiceStore: import("zhin.js").PluginStore<QuizService, unknown>;
4
+ export declare const quizServiceToken: import("zhin.js").PluginStore<QuizService, unknown>;
4
5
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,sCAAsG,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,qDAA4G,CAAC;AAC1I,eAAO,MAAM,gBAAgB,qDAAmB,CAAC"}
package/lib/runtime.js CHANGED
@@ -1,4 +1,5 @@
1
- import { createToken } from 'zhin.js';
1
+ import { definePluginStore } from 'zhin.js';
2
2
  /** Owner-scoped quiz state consumed by discovered commands and middleware. */
3
- export const quizServiceToken = createToken('zhin.answers.quiz', 'Pending quiz questions per conversation and sender');
3
+ export const quizServiceStore = definePluginStore('zhin.answers.quiz', 'Pending quiz questions per conversation and sender');
4
+ export const quizServiceToken = quizServiceStore;
4
5
  //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAc,mBAAmB,EAAE,oDAAoD,CAAC,CAAC"}
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAc,mBAAmB,EAAE,oDAAoD,CAAC,CAAC;AAC1I,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/plugin-answers",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Zhin.js 答案之书、趣味选择题与交规小测(原创内容,Plugin Runtime)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -37,12 +37,12 @@
37
37
  },
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@zhin.js/core": "1.1.56"
40
+ "@zhin.js/core": "1.1.58"
41
41
  },
42
42
  "devDependencies": {
43
43
  "typescript": "^6.0.3",
44
44
  "vitest": "^4.1.10",
45
- "zhin.js": "1.1.21"
45
+ "zhin.js": "1.1.23"
46
46
  },
47
47
  "repository": {
48
48
  "type": "git",
@@ -75,9 +75,9 @@
75
75
  "plugins": []
76
76
  },
77
77
  "peerDependencies": {
78
- "@zhin.js/command": "^1.1.14",
79
- "@zhin.js/middleware": "^1.1.13",
80
- "zhin.js": "^1.1.21"
78
+ "@zhin.js/command": "^1.1.16",
79
+ "@zhin.js/middleware": "^1.1.15",
80
+ "zhin.js": "^1.1.23"
81
81
  },
82
82
  "peerDependenciesMeta": {
83
83
  "@zhin.js/command": {
package/plugin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
2
  import { definePlugin } from 'zhin.js';
3
3
  import { QuizService } from "./lib/quiz.js";
4
- import { quizServiceToken } from "./lib/runtime.js";
4
+ import { quizServiceStore } from "./lib/runtime.js";
5
5
  /**
6
6
  * Plugin Runtime:
7
7
  * - `commands/` 提供 答案之书 / 好无聊 / 科目一;
@@ -14,8 +14,7 @@ export default definePlugin({
14
14
  displayName: '答案之书',
15
15
  },
16
16
  setup(context) {
17
- const service = new QuizService();
18
- context.resources.provide(quizServiceToken, service);
17
+ const service = quizServiceStore.provide(context, new QuizService());
19
18
  return () => service.dispose();
20
19
  },
21
20
  });
package/src/runtime.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { createToken } from 'zhin.js';
1
+ import { definePluginStore } from 'zhin.js';
2
2
  import type { QuizService } from './quiz.js';
3
3
 
4
4
  /** Owner-scoped quiz state consumed by discovered commands and middleware. */
5
- export const quizServiceToken = createToken<QuizService>('zhin.answers.quiz', 'Pending quiz questions per conversation and sender');
5
+ export const quizServiceStore = definePluginStore<QuizService>('zhin.answers.quiz', 'Pending quiz questions per conversation and sender');
6
+ export const quizServiceToken = quizServiceStore;