@shisho/plugin-sdk 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -13,7 +13,7 @@ npm install --save-dev @shisho/plugin-sdk
13
13
  The types provide autocompletion for:
14
14
 
15
15
  - **`shisho.*`** - Host APIs (log, config, http, fs, archive, xml, ffmpeg)
16
- - **`plugin`** - Hook structure (inputConverter, fileParser, metadataEnricher, outputGenerator)
16
+ - **`plugin`** - Hook structure (inputConverter, fileParser, metadataEnricher)
17
17
  - **Hook contexts** - Typed `context` parameters for each hook method
18
18
  - **Return types** - `ParsedMetadata`, `ConvertResult`, `SearchResponse`, etc.
19
19
 
package/hooks.d.ts CHANGED
@@ -62,49 +62,6 @@ export interface SearchResponse {
62
62
  results: ParsedMetadata[];
63
63
  }
64
64
 
65
- /** Book metadata passed to output-generator hooks. */
66
- export interface OutputBookContext {
67
- id?: number;
68
- title?: string;
69
- subtitle?: string;
70
- description?: string;
71
- authors?: Array<{ name: string; role?: string }>;
72
- series?: Array<{ name: string; number?: number }>;
73
- genres?: string[];
74
- tags?: string[];
75
- }
76
-
77
- /** File metadata passed to output-generator hooks. */
78
- export interface OutputFileContext {
79
- id?: number;
80
- filepath?: string;
81
- fileType?: string;
82
- fileRole?: string;
83
- filesizeBytes?: number;
84
- name?: string;
85
- url?: string;
86
- publisher?: string;
87
- releaseDate?: string;
88
- narrators?: string[];
89
- identifiers?: Array<{ type: string; value: string }>;
90
- }
91
-
92
- /** Context passed to outputGenerator.generate(). */
93
- export interface OutputGeneratorContext {
94
- /** Path to the source book file. */
95
- sourcePath: string;
96
- /** Path where the output file should be written. */
97
- destPath: string;
98
- book: OutputBookContext;
99
- file: OutputFileContext;
100
- }
101
-
102
- /** Context passed to outputGenerator.fingerprint(). */
103
- export interface FingerprintContext {
104
- book: OutputBookContext;
105
- file: OutputFileContext;
106
- }
107
-
108
65
  /** Input converter hook. */
109
66
  export interface InputConverterHook {
110
67
  convert(context: InputConverterContext): ConvertResult;
@@ -121,18 +78,11 @@ export interface MetadataEnricherHook {
121
78
  search(context: SearchContext): SearchResponse;
122
79
  }
123
80
 
124
- /** Output generator hook. */
125
- export interface OutputGeneratorHook {
126
- generate(context: OutputGeneratorContext): void;
127
- fingerprint(context: FingerprintContext): string;
128
- }
129
-
130
81
  /** The global plugin object created by main.js. */
131
82
  export interface ShishoPlugin {
132
83
  inputConverter?: InputConverterHook;
133
84
  fileParser?: FileParserHook;
134
85
  metadataEnricher?: MetadataEnricherHook;
135
- outputGenerator?: OutputGeneratorHook;
136
86
 
137
87
  /**
138
88
  * Optional lifecycle hook called before the plugin is uninstalled.
package/host-api.d.ts CHANGED
@@ -130,9 +130,23 @@ export interface ShishoFS {
130
130
  readFile(path: string): ArrayBuffer;
131
131
  /** Read file contents as UTF-8 string. */
132
132
  readTextFile(path: string): string;
133
- /** Write ArrayBuffer data to a file. */
133
+ /**
134
+ * Write ArrayBuffer data to a file.
135
+ *
136
+ * A new file is created with mode 0600 inside the plugin's own directory,
137
+ * `shisho.dataDir`, or `tempDir()`, and 0644 at any other permitted path
138
+ * (hook-provided paths and paths allowed by `fileAccess: "readwrite"`).
139
+ * The umask still applies. Overwriting an existing file keeps its mode.
140
+ */
134
141
  writeFile(path: string, data: ArrayBuffer): void;
135
- /** Write string content to a file. */
142
+ /**
143
+ * Write string content to a file as UTF-8.
144
+ *
145
+ * New files get the same mode as `writeFile`: 0600 inside the plugin's own
146
+ * directory, `shisho.dataDir`, or `tempDir()`, and 0644 at any other
147
+ * permitted path. The umask still applies. Overwriting an existing file
148
+ * keeps its mode.
149
+ */
136
150
  writeTextFile(path: string, content: string): void;
137
151
  /** Check if a path exists. */
138
152
  exists(path: string): boolean;
package/manifest.d.ts CHANGED
@@ -18,17 +18,6 @@ export interface FileParserCap {
18
18
  mimeTypes?: string[];
19
19
  }
20
20
 
21
- /** Output generator capability declaration. */
22
- export interface OutputGeneratorCap {
23
- description?: string;
24
- /** Unique format identifier (e.g., "mobi"). */
25
- id: string;
26
- /** Display name (e.g., "MOBI"). */
27
- name: string;
28
- /** Source file types this generator can convert from. */
29
- sourceTypes: string[];
30
- }
31
-
32
21
  /** Valid metadata field names for enricher declarations. */
33
22
  export type MetadataField =
34
23
  | "title"
@@ -102,7 +91,6 @@ export interface ShellAccessCap {
102
91
  export interface Capabilities {
103
92
  inputConverter?: InputConverterCap;
104
93
  fileParser?: FileParserCap;
105
- outputGenerator?: OutputGeneratorCap;
106
94
  metadataEnricher?: MetadataEnricherCap;
107
95
  identifierTypes?: IdentifierTypeCap[];
108
96
  httpAccess?: HTTPAccessCap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisho/plugin-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for Shisho plugin development — types, host API declarations, and test utilities",
5
5
  "homepage": "https://github.com/shishobooks/shisho/blob/master/packages/plugin-sdk/README.md",
6
6
  "types": "index.d.ts",
@@ -1,4 +1,4 @@
1
- import type { OutputGeneratorContext, ParsedMetadata } from "../index";
1
+ import type { ParsedMetadata } from "../index";
2
2
 
3
3
  type Equal<Left, Right> =
4
4
  (<Type>() => Type extends Left ? 1 : 2) extends <Type>() => Type extends Right
@@ -12,19 +12,4 @@ type SeriesNumberEndContract = Expect<
12
12
  Equal<ParsedMetadata["seriesNumberEnd"], number | undefined>
13
13
  >;
14
14
 
15
- type OutputSeriesContract = Expect<
16
- Equal<
17
- OutputGeneratorContext["book"]["series"],
18
- Array<{ name: string; number?: number }> | undefined
19
- >
20
- >;
21
-
22
- type OutputFilepathContract = Expect<
23
- Equal<OutputGeneratorContext["file"]["filepath"], string | undefined>
24
- >;
25
-
26
- export type {
27
- OutputFilepathContract,
28
- OutputSeriesContract,
29
- SeriesNumberEndContract,
30
- };
15
+ export type { SeriesNumberEndContract };