@branch-fiction/extension-sdk 0.1.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/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/db/boolean-plugin.d.ts +10 -0
- package/dist/db/boolean-plugin.js +24 -0
- package/dist/db/boolean-plugin.js.map +1 -0
- package/dist/db/iframe.d.ts +15 -0
- package/dist/db/iframe.js +78 -0
- package/dist/db/iframe.js.map +1 -0
- package/dist/db/types.d.ts +247 -0
- package/dist/db/types.js +1 -0
- package/dist/dev-cli.d.ts +1 -0
- package/dist/dev-cli.js +297 -0
- package/dist/dev-cli.js.map +1 -0
- package/dist/dev.d.ts +46 -0
- package/dist/dev.js +2 -0
- package/dist/extension-host.bundle.js +122607 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/manifest-CQaa55kR.mjs +200 -0
- package/dist/manifest-CQaa55kR.mjs.map +1 -0
- package/dist/manifest.d.ts +97 -0
- package/dist/manifest.js +2 -0
- package/dist/models-catalog.d.ts +12 -0
- package/dist/models-catalog.js +58 -0
- package/dist/models-catalog.js.map +1 -0
- package/dist/pi-handle.d.ts +26 -0
- package/dist/pi-handle.js +108 -0
- package/dist/pi-handle.js.map +1 -0
- package/dist/sdk-source.d.ts +69 -0
- package/dist/sdk-source.js +205 -0
- package/dist/sdk-source.js.map +1 -0
- package/dist/server-BcwliPFy.mjs +752 -0
- package/dist/server-BcwliPFy.mjs.map +1 -0
- package/dist/types-ZCFYu2MY.d.mts +23 -0
- package/dist/vite.d.ts +53 -0
- package/dist/vite.js +83 -0
- package/dist/vite.js.map +1 -0
- package/package.json +94 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chris McClelland
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @branch-fiction/extension-sdk
|
|
2
|
+
|
|
3
|
+
SDK and dev tooling for building [Branch Fiction](https://github.com/chrisvariety/branch-fiction) extensions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add -D @branch-fiction/extension-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's included
|
|
12
|
+
|
|
13
|
+
- **Iframe SDK** — `window.extensionSDK` (db, fs, worker, providers, context) served to your extension UI.
|
|
14
|
+
- **Worker host** — the bundled runtime that boots your `worker` entry in a sandboxed Deno sidecar (`globalThis.host`).
|
|
15
|
+
- **Manifest helpers** — `defineManifest`, `validateManifest`, and the `ExtensionManifestV1` types.
|
|
16
|
+
- **Dev CLI** — `branch-fiction-extension-dev`, run it via a `dev` script to develop an extension against a local Branch Fiction install.
|
|
17
|
+
|
|
18
|
+
See the [extension guide](https://github.com/chrisvariety/branch-fiction) for the full manifest schema and runtime API.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KyselyPlugin, PluginTransformQueryArgs, PluginTransformResultArgs, QueryResult, RootOperationNode, UnknownRow } from "kysely";
|
|
2
|
+
|
|
3
|
+
//#region src/db/boolean-plugin.d.ts
|
|
4
|
+
declare class BooleanPlugin implements KyselyPlugin {
|
|
5
|
+
transformQuery(args: PluginTransformQueryArgs): RootOperationNode;
|
|
6
|
+
transformResult(args: PluginTransformResultArgs): Promise<QueryResult<UnknownRow>>;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { BooleanPlugin };
|
|
10
|
+
//# sourceMappingURL=boolean-plugin.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/db/boolean-plugin.ts
|
|
2
|
+
const BOOLEAN_COLUMNS = new Set([
|
|
3
|
+
"hasVoice",
|
|
4
|
+
"isPreliminary",
|
|
5
|
+
"isMajority"
|
|
6
|
+
]);
|
|
7
|
+
var BooleanPlugin = class {
|
|
8
|
+
transformQuery(args) {
|
|
9
|
+
return args.node;
|
|
10
|
+
}
|
|
11
|
+
async transformResult(args) {
|
|
12
|
+
if (args.result.rows) {
|
|
13
|
+
for (const row of args.result.rows) for (const key of Object.keys(row)) if (BOOLEAN_COLUMNS.has(key)) {
|
|
14
|
+
const rec = row;
|
|
15
|
+
rec[key] = rec[key] === 1 ? true : rec[key] === 0 ? false : rec[key];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return args.result;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { BooleanPlugin };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=boolean-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean-plugin.js","names":[],"sources":["../../src/db/boolean-plugin.ts"],"sourcesContent":["import type {\n KyselyPlugin,\n PluginTransformQueryArgs,\n PluginTransformResultArgs,\n QueryResult,\n RootOperationNode,\n UnknownRow\n} from 'kysely';\n\n// Keys are matched after CamelCasePlugin runs, so they're camelCase here.\n// Every boolean column in the reserved extension schema (0001_init.sql) must be\n// listed or it arrives as a raw SQLite 0/1 integer.\nconst BOOLEAN_COLUMNS = new Set([\n 'hasVoice', // bookEntities\n 'isPreliminary', // chapterScenes\n 'isMajority' // bookStyles\n]);\n\nexport class BooleanPlugin implements KyselyPlugin {\n transformQuery(args: PluginTransformQueryArgs): RootOperationNode {\n return args.node;\n }\n\n async transformResult(\n args: PluginTransformResultArgs\n ): Promise<QueryResult<UnknownRow>> {\n if (args.result.rows) {\n for (const row of args.result.rows) {\n for (const key of Object.keys(row as Record<string, unknown>)) {\n if (BOOLEAN_COLUMNS.has(key)) {\n const rec = row as Record<string, unknown>;\n rec[key] = rec[key] === 1 ? true : rec[key] === 0 ? false : rec[key];\n }\n }\n }\n }\n return args.result;\n }\n}\n"],"mappings":";AAYA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;AACF,CAAC;AAED,IAAa,gBAAb,MAAmD;CACjD,eAAe,MAAmD;EAChE,OAAO,KAAK;CACd;CAEA,MAAM,gBACJ,MACkC;EAClC,IAAI,KAAK,OAAO;QACT,MAAM,OAAO,KAAK,OAAO,MAC5B,KAAK,MAAM,OAAO,OAAO,KAAK,GAA8B,GAC1D,IAAI,gBAAgB,IAAI,GAAG,GAAG;IAC5B,MAAM,MAAM;IACZ,IAAI,OAAO,IAAI,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,QAAQ,IAAI;GAClE;;EAIN,OAAO,KAAK;CACd;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SeededDatabase } from "./types.js";
|
|
2
|
+
import { Kysely } from "kysely";
|
|
3
|
+
|
|
4
|
+
//#region src/db/iframe.d.ts
|
|
5
|
+
type IframeQueryFn = (sql: string, params: readonly unknown[]) => Promise<{
|
|
6
|
+
rows: unknown[];
|
|
7
|
+
changes: number;
|
|
8
|
+
}>;
|
|
9
|
+
interface CreateIframeKyselyOptions {
|
|
10
|
+
query?: IframeQueryFn;
|
|
11
|
+
}
|
|
12
|
+
declare function createIframeKysely<Extra>(options?: CreateIframeKyselyOptions): Kysely<SeededDatabase & Extra>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CreateIframeKyselyOptions, IframeQueryFn, createIframeKysely };
|
|
15
|
+
//# sourceMappingURL=iframe.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BooleanPlugin } from "./boolean-plugin.js";
|
|
2
|
+
import { CamelCasePlugin, Kysely, SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler } from "kysely";
|
|
3
|
+
import { SerializePlugin } from "kysely-plugin-serialize";
|
|
4
|
+
//#region src/db/iframe.ts
|
|
5
|
+
function defaultQuery() {
|
|
6
|
+
const sdk = globalThis.extensionSDK;
|
|
7
|
+
if (!sdk?.db?.query) throw new Error("createIframeKysely: window.extensionSDK.db.query is not available — was the extension SDK script loaded?");
|
|
8
|
+
return sdk.db.query.bind(sdk.db);
|
|
9
|
+
}
|
|
10
|
+
var IframeConnection = class {
|
|
11
|
+
query;
|
|
12
|
+
constructor(query) {
|
|
13
|
+
this.query = query;
|
|
14
|
+
}
|
|
15
|
+
async executeQuery(compiled) {
|
|
16
|
+
const { rows, changes } = await this.query(compiled.sql, compiled.parameters);
|
|
17
|
+
return {
|
|
18
|
+
rows,
|
|
19
|
+
numAffectedRows: BigInt(changes)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async *streamQuery() {
|
|
23
|
+
throw new Error("streamQuery is not supported in the iframe driver");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var IframeDriver = class {
|
|
27
|
+
#connection;
|
|
28
|
+
constructor(query) {
|
|
29
|
+
this.#connection = new IframeConnection(query);
|
|
30
|
+
}
|
|
31
|
+
async init() {}
|
|
32
|
+
async acquireConnection() {
|
|
33
|
+
return this.#connection;
|
|
34
|
+
}
|
|
35
|
+
async releaseConnection() {}
|
|
36
|
+
async beginTransaction() {
|
|
37
|
+
throw new Error("transactions are not supported in the iframe driver (use the worker side)");
|
|
38
|
+
}
|
|
39
|
+
async commitTransaction() {
|
|
40
|
+
throw new Error("transactions are not supported in the iframe driver");
|
|
41
|
+
}
|
|
42
|
+
async rollbackTransaction() {
|
|
43
|
+
throw new Error("transactions are not supported in the iframe driver");
|
|
44
|
+
}
|
|
45
|
+
async destroy() {}
|
|
46
|
+
};
|
|
47
|
+
var IframeDialect = class {
|
|
48
|
+
query;
|
|
49
|
+
constructor(query) {
|
|
50
|
+
this.query = query;
|
|
51
|
+
}
|
|
52
|
+
createDriver() {
|
|
53
|
+
return new IframeDriver(this.query);
|
|
54
|
+
}
|
|
55
|
+
createQueryCompiler() {
|
|
56
|
+
return new SqliteQueryCompiler();
|
|
57
|
+
}
|
|
58
|
+
createAdapter() {
|
|
59
|
+
return new SqliteAdapter();
|
|
60
|
+
}
|
|
61
|
+
createIntrospector(db) {
|
|
62
|
+
return new SqliteIntrospector(db);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
function createIframeKysely(options = {}) {
|
|
66
|
+
return new Kysely({
|
|
67
|
+
dialect: new IframeDialect(options.query ?? defaultQuery()),
|
|
68
|
+
plugins: [
|
|
69
|
+
new CamelCasePlugin(),
|
|
70
|
+
new BooleanPlugin(),
|
|
71
|
+
new SerializePlugin()
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { createIframeKysely };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=iframe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe.js","names":["#connection"],"sources":["../../src/db/iframe.ts"],"sourcesContent":["// Browser-side Kysely. Wraps `window.extensionSDK.db.query`\n\nimport {\n CamelCasePlugin,\n type CompiledQuery,\n type DatabaseConnection,\n type DatabaseIntrospector,\n type Dialect,\n type DialectAdapter,\n type Driver,\n Kysely,\n type QueryResult,\n SqliteAdapter,\n SqliteIntrospector,\n SqliteQueryCompiler\n} from 'kysely';\nimport { SerializePlugin } from 'kysely-plugin-serialize';\n\nimport { BooleanPlugin } from './boolean-plugin';\nimport type { SeededDatabase } from './types';\n\nexport type IframeQueryFn = (\n sql: string,\n params: readonly unknown[]\n) => Promise<{ rows: unknown[]; changes: number }>;\n\nfunction defaultQuery(): IframeQueryFn {\n const sdk = (\n globalThis as unknown as { extensionSDK?: { db?: { query?: IframeQueryFn } } }\n ).extensionSDK;\n if (!sdk?.db?.query) {\n throw new Error(\n 'createIframeKysely: window.extensionSDK.db.query is not available — was the extension SDK script loaded?'\n );\n }\n return sdk.db.query.bind(sdk.db);\n}\n\nclass IframeConnection implements DatabaseConnection {\n constructor(private readonly query: IframeQueryFn) {}\n\n async executeQuery<O>(compiled: CompiledQuery): Promise<QueryResult<O>> {\n const { rows, changes } = await this.query(compiled.sql, compiled.parameters);\n return { rows: rows as O[], numAffectedRows: BigInt(changes) };\n }\n\n // eslint-disable-next-line require-yield\n async *streamQuery<O>(): AsyncIterableIterator<QueryResult<O>> {\n throw new Error('streamQuery is not supported in the iframe driver');\n }\n}\n\nclass IframeDriver implements Driver {\n readonly #connection: IframeConnection;\n\n constructor(query: IframeQueryFn) {\n this.#connection = new IframeConnection(query);\n }\n\n async init(): Promise<void> {}\n async acquireConnection(): Promise<DatabaseConnection> {\n return this.#connection;\n }\n async releaseConnection(): Promise<void> {}\n\n async beginTransaction(): Promise<void> {\n throw new Error(\n 'transactions are not supported in the iframe driver (use the worker side)'\n );\n }\n async commitTransaction(): Promise<void> {\n throw new Error('transactions are not supported in the iframe driver');\n }\n async rollbackTransaction(): Promise<void> {\n throw new Error('transactions are not supported in the iframe driver');\n }\n\n async destroy(): Promise<void> {}\n}\n\nclass IframeDialect implements Dialect {\n constructor(private readonly query: IframeQueryFn) {}\n createDriver(): Driver {\n return new IframeDriver(this.query);\n }\n createQueryCompiler() {\n return new SqliteQueryCompiler();\n }\n createAdapter(): DialectAdapter {\n return new SqliteAdapter();\n }\n createIntrospector(db: Kysely<unknown>): DatabaseIntrospector {\n return new SqliteIntrospector(db);\n }\n}\n\nexport interface CreateIframeKyselyOptions {\n // Override the transport. Defaults to `window.extensionSDK.db.query`.\n query?: IframeQueryFn;\n}\n\nexport function createIframeKysely<Extra>(\n options: CreateIframeKyselyOptions = {}\n): Kysely<SeededDatabase & Extra> {\n const query = options.query ?? defaultQuery();\n return new Kysely<SeededDatabase & Extra>({\n dialect: new IframeDialect(query),\n plugins: [new CamelCasePlugin(), new BooleanPlugin(), new SerializePlugin()]\n });\n}\n"],"mappings":";;;;AA0BA,SAAS,eAA8B;CACrC,MAAM,MACJ,WACA;CACF,IAAI,CAAC,KAAK,IAAI,OACZ,MAAM,IAAI,MACR,0GACF;CAEF,OAAO,IAAI,GAAG,MAAM,KAAK,IAAI,EAAE;AACjC;AAEA,IAAM,mBAAN,MAAqD;CACtB;CAA7B,YAAY,OAAuC;EAAtB,KAAA,QAAA;CAAuB;CAEpD,MAAM,aAAgB,UAAkD;EACtE,MAAM,EAAE,MAAM,YAAY,MAAM,KAAK,MAAM,SAAS,KAAK,SAAS,UAAU;EAC5E,OAAO;GAAQ;GAAa,iBAAiB,OAAO,OAAO;EAAE;CAC/D;CAGA,OAAO,cAAwD;EAC7D,MAAM,IAAI,MAAM,mDAAmD;CACrE;AACF;AAEA,IAAM,eAAN,MAAqC;CACnC;CAEA,YAAY,OAAsB;EAChC,KAAKA,cAAc,IAAI,iBAAiB,KAAK;CAC/C;CAEA,MAAM,OAAsB,CAAC;CAC7B,MAAM,oBAAiD;EACrD,OAAO,KAAKA;CACd;CACA,MAAM,oBAAmC,CAAC;CAE1C,MAAM,mBAAkC;EACtC,MAAM,IAAI,MACR,2EACF;CACF;CACA,MAAM,oBAAmC;EACvC,MAAM,IAAI,MAAM,qDAAqD;CACvE;CACA,MAAM,sBAAqC;EACzC,MAAM,IAAI,MAAM,qDAAqD;CACvE;CAEA,MAAM,UAAyB,CAAC;AAClC;AAEA,IAAM,gBAAN,MAAuC;CACR;CAA7B,YAAY,OAAuC;EAAtB,KAAA,QAAA;CAAuB;CACpD,eAAuB;EACrB,OAAO,IAAI,aAAa,KAAK,KAAK;CACpC;CACA,sBAAsB;EACpB,OAAO,IAAI,oBAAoB;CACjC;CACA,gBAAgC;EAC9B,OAAO,IAAI,cAAc;CAC3B;CACA,mBAAmB,IAA2C;EAC5D,OAAO,IAAI,mBAAmB,EAAE;CAClC;AACF;AAOA,SAAgB,mBACd,UAAqC,CAAC,GACN;CAEhC,OAAO,IAAI,OAA+B;EACxC,SAAS,IAAI,cAFD,QAAQ,SAAS,aAAa,CAEV;EAChC,SAAS;GAAC,IAAI,gBAAgB;GAAG,IAAI,cAAc;GAAG,IAAI,gBAAgB;EAAC;CAC7E,CAAC;AACH"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Generated, Insertable, Selectable, Updateable } from "kysely";
|
|
2
|
+
|
|
3
|
+
//#region src/db/types.d.ts
|
|
4
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
interface BooksTable {
|
|
8
|
+
id: string;
|
|
9
|
+
shareCode: string;
|
|
10
|
+
userId: string;
|
|
11
|
+
title: string;
|
|
12
|
+
slug: string;
|
|
13
|
+
isbn: string | null;
|
|
14
|
+
language: string | null;
|
|
15
|
+
publisher: string | null;
|
|
16
|
+
characterRankType: 'ENSEMBLE' | 'EPISODIC' | null;
|
|
17
|
+
imageUrl: string | null;
|
|
18
|
+
status: 'completed' | null;
|
|
19
|
+
createdAt: Generated<string>;
|
|
20
|
+
updatedAt: Generated<string>;
|
|
21
|
+
}
|
|
22
|
+
type Book = Selectable<BooksTable>;
|
|
23
|
+
type NewBook = Insertable<BooksTable>;
|
|
24
|
+
type BookUpdate = Updateable<BooksTable>;
|
|
25
|
+
interface ChaptersTable {
|
|
26
|
+
id: string;
|
|
27
|
+
idx: number;
|
|
28
|
+
href: string;
|
|
29
|
+
bookId: string;
|
|
30
|
+
title: string;
|
|
31
|
+
summary: string | null;
|
|
32
|
+
endSummary: string | null;
|
|
33
|
+
createdAt: Generated<string>;
|
|
34
|
+
updatedAt: Generated<string>;
|
|
35
|
+
}
|
|
36
|
+
type Chapter = Selectable<ChaptersTable>;
|
|
37
|
+
type NewChapter = Insertable<ChaptersTable>;
|
|
38
|
+
type ChapterUpdate = Updateable<ChaptersTable>;
|
|
39
|
+
interface ChapterParagraphsTable {
|
|
40
|
+
id: string;
|
|
41
|
+
bookId: string;
|
|
42
|
+
chapterId: string;
|
|
43
|
+
chapterIdx: number;
|
|
44
|
+
paragraphIdx: number;
|
|
45
|
+
bookParagraphIdx: number;
|
|
46
|
+
content: string;
|
|
47
|
+
createdAt: Generated<string>;
|
|
48
|
+
updatedAt: Generated<string>;
|
|
49
|
+
}
|
|
50
|
+
type ChapterParagraph = Selectable<ChapterParagraphsTable>;
|
|
51
|
+
type NewChapterParagraph = Insertable<ChapterParagraphsTable>;
|
|
52
|
+
type ChapterParagraphUpdate = Updateable<ChapterParagraphsTable>;
|
|
53
|
+
interface ChapterScenesTable {
|
|
54
|
+
id: string;
|
|
55
|
+
chapterId: string;
|
|
56
|
+
bookId: string;
|
|
57
|
+
startChapterParagraphId: string;
|
|
58
|
+
endChapterParagraphId: string;
|
|
59
|
+
povBookEntityId: string | null;
|
|
60
|
+
pov: 'first-person' | 'second-person' | 'third-person limited' | 'third-person omniscient';
|
|
61
|
+
title: string;
|
|
62
|
+
isPreliminary: Generated<boolean>;
|
|
63
|
+
povEntity: string;
|
|
64
|
+
location: string | null;
|
|
65
|
+
setting: string | null;
|
|
66
|
+
locationBookEntityId: string | null;
|
|
67
|
+
settingBookEntityId: string | null;
|
|
68
|
+
createdAt: Generated<string>;
|
|
69
|
+
updatedAt: Generated<string>;
|
|
70
|
+
}
|
|
71
|
+
type ChapterScene = Selectable<ChapterScenesTable>;
|
|
72
|
+
type NewChapterScene = Insertable<ChapterScenesTable>;
|
|
73
|
+
type ChapterSceneUpdate = Updateable<ChapterScenesTable>;
|
|
74
|
+
interface ChapterSceneGroupsTable {
|
|
75
|
+
id: string;
|
|
76
|
+
bookId: string;
|
|
77
|
+
idx: number;
|
|
78
|
+
startChapterId: string;
|
|
79
|
+
endChapterId: string;
|
|
80
|
+
chapterSceneIds: string[];
|
|
81
|
+
createdAt: Generated<string>;
|
|
82
|
+
updatedAt: Generated<string>;
|
|
83
|
+
}
|
|
84
|
+
type ChapterSceneGroup = Selectable<ChapterSceneGroupsTable>;
|
|
85
|
+
type NewChapterSceneGroup = Insertable<ChapterSceneGroupsTable>;
|
|
86
|
+
type ChapterSceneGroupUpdate = Updateable<ChapterSceneGroupsTable>;
|
|
87
|
+
interface ChapterRelationshipsTable {
|
|
88
|
+
id: string;
|
|
89
|
+
bookId: string;
|
|
90
|
+
chapterId: string;
|
|
91
|
+
sourceBookEntityId: string;
|
|
92
|
+
targetBookEntityId: string;
|
|
93
|
+
predicateType: string;
|
|
94
|
+
predicateDescription: string;
|
|
95
|
+
createdAt: Generated<string>;
|
|
96
|
+
updatedAt: Generated<string>;
|
|
97
|
+
}
|
|
98
|
+
type ChapterRelationship = Selectable<ChapterRelationshipsTable>;
|
|
99
|
+
type NewChapterRelationship = Insertable<ChapterRelationshipsTable>;
|
|
100
|
+
type ChapterRelationshipUpdate = Updateable<ChapterRelationshipsTable>;
|
|
101
|
+
interface ChapterEntityAppellationsTable {
|
|
102
|
+
id: string;
|
|
103
|
+
bookId: string;
|
|
104
|
+
chapterId: string;
|
|
105
|
+
sourceBookEntityId: string;
|
|
106
|
+
targetBookEntityId: string;
|
|
107
|
+
phrase: string;
|
|
108
|
+
type: string;
|
|
109
|
+
context: string;
|
|
110
|
+
createdAt: Generated<string>;
|
|
111
|
+
updatedAt: Generated<string>;
|
|
112
|
+
}
|
|
113
|
+
type ChapterEntityAppellation = Selectable<ChapterEntityAppellationsTable>;
|
|
114
|
+
type NewChapterEntityAppellation = Insertable<ChapterEntityAppellationsTable>;
|
|
115
|
+
type ChapterEntityAppellationUpdate = Updateable<ChapterEntityAppellationsTable>;
|
|
116
|
+
interface ChapterEntityAttributesTable {
|
|
117
|
+
id: string;
|
|
118
|
+
bookId: string;
|
|
119
|
+
chapterId: string;
|
|
120
|
+
bookEntityId: string;
|
|
121
|
+
category: string;
|
|
122
|
+
name: string;
|
|
123
|
+
value: string;
|
|
124
|
+
evidence: string;
|
|
125
|
+
createdAt: Generated<string>;
|
|
126
|
+
updatedAt: Generated<string>;
|
|
127
|
+
}
|
|
128
|
+
type ChapterEntityAttribute = Selectable<ChapterEntityAttributesTable>;
|
|
129
|
+
type NewChapterEntityAttribute = Insertable<ChapterEntityAttributesTable>;
|
|
130
|
+
type ChapterEntityAttributeUpdate = Updateable<ChapterEntityAttributesTable>;
|
|
131
|
+
interface BookEntitiesTable {
|
|
132
|
+
id: string;
|
|
133
|
+
friendlyId: string;
|
|
134
|
+
bookId: string;
|
|
135
|
+
name: string;
|
|
136
|
+
type: string;
|
|
137
|
+
aliases: string[];
|
|
138
|
+
pronouns: string | null;
|
|
139
|
+
description: string | null;
|
|
140
|
+
significanceTier: 'PRIMARY' | 'SECONDARY' | null;
|
|
141
|
+
significanceRank: number | null;
|
|
142
|
+
names: Generated<string[]>;
|
|
143
|
+
continuedFromBookEntityId: string | null;
|
|
144
|
+
hasVoice: Generated<boolean>;
|
|
145
|
+
label: string | null;
|
|
146
|
+
minorStatus: Generated<'NEVER' | 'THROUGHOUT' | 'UNTIL_CHAPTER'>;
|
|
147
|
+
minorUntilChapterId: string | null;
|
|
148
|
+
identityTag: string | null;
|
|
149
|
+
createdAt: Generated<string>;
|
|
150
|
+
updatedAt: Generated<string>;
|
|
151
|
+
}
|
|
152
|
+
type BookEntity = Selectable<BookEntitiesTable>;
|
|
153
|
+
type NewBookEntity = Insertable<BookEntitiesTable>;
|
|
154
|
+
type BookEntityUpdate = Updateable<BookEntitiesTable>;
|
|
155
|
+
interface BookEntityHierarchiesTable {
|
|
156
|
+
id: string;
|
|
157
|
+
bookId: string;
|
|
158
|
+
bookEntityId: string;
|
|
159
|
+
level: 'REALM' | 'HUB' | 'LOCALE' | 'MICRO';
|
|
160
|
+
parentBookEntityId: string | null;
|
|
161
|
+
classificationReasoning: string | null;
|
|
162
|
+
significanceRank: number | null;
|
|
163
|
+
createdAt: Generated<string>;
|
|
164
|
+
updatedAt: Generated<string>;
|
|
165
|
+
}
|
|
166
|
+
type BookEntityHierarchy = Selectable<BookEntityHierarchiesTable>;
|
|
167
|
+
type NewBookEntityHierarchy = Insertable<BookEntityHierarchiesTable>;
|
|
168
|
+
type BookEntityHierarchyUpdate = Updateable<BookEntityHierarchiesTable>;
|
|
169
|
+
interface BookArcsTable {
|
|
170
|
+
id: string;
|
|
171
|
+
bookId: string;
|
|
172
|
+
type: string;
|
|
173
|
+
startChapterId: string;
|
|
174
|
+
endChapterId: string;
|
|
175
|
+
title: string;
|
|
176
|
+
content: string;
|
|
177
|
+
bookEntityIds: string[];
|
|
178
|
+
friendlyIdPrefix: string;
|
|
179
|
+
friendlyIdIdx: number;
|
|
180
|
+
friendlyId: Generated<string>;
|
|
181
|
+
imageUrl: string | null;
|
|
182
|
+
createdAt: Generated<string>;
|
|
183
|
+
updatedAt: Generated<string>;
|
|
184
|
+
}
|
|
185
|
+
type BookArc = Selectable<BookArcsTable>;
|
|
186
|
+
type NewBookArc = Insertable<BookArcsTable>;
|
|
187
|
+
type BookArcUpdate = Updateable<BookArcsTable>;
|
|
188
|
+
interface BookCategoriesTable {
|
|
189
|
+
id: string;
|
|
190
|
+
bookId: string;
|
|
191
|
+
name: string;
|
|
192
|
+
description: string;
|
|
193
|
+
examples: Generated<JsonValue[]>;
|
|
194
|
+
type: string;
|
|
195
|
+
exclusion: string | null;
|
|
196
|
+
allowedTypes: Generated<string[]>;
|
|
197
|
+
createdAt: Generated<string>;
|
|
198
|
+
updatedAt: Generated<string>;
|
|
199
|
+
}
|
|
200
|
+
type BookCategory = Selectable<BookCategoriesTable>;
|
|
201
|
+
type NewBookCategory = Insertable<BookCategoriesTable>;
|
|
202
|
+
type BookCategoryUpdate = Updateable<BookCategoriesTable>;
|
|
203
|
+
interface BookCharacterPlaceScoresTable {
|
|
204
|
+
id: string;
|
|
205
|
+
bookId: string;
|
|
206
|
+
characterBookEntityId: string;
|
|
207
|
+
placeBookEntityId: string;
|
|
208
|
+
score: number;
|
|
209
|
+
createdAt: Generated<string>;
|
|
210
|
+
updatedAt: Generated<string>;
|
|
211
|
+
}
|
|
212
|
+
type BookCharacterPlaceScore = Selectable<BookCharacterPlaceScoresTable>;
|
|
213
|
+
type NewBookCharacterPlaceScore = Insertable<BookCharacterPlaceScoresTable>;
|
|
214
|
+
type BookCharacterPlaceScoreUpdate = Updateable<BookCharacterPlaceScoresTable>;
|
|
215
|
+
interface BookStylesTable {
|
|
216
|
+
id: string;
|
|
217
|
+
bookId: string;
|
|
218
|
+
pov: string;
|
|
219
|
+
povEntity: string;
|
|
220
|
+
povBookEntityId: string | null;
|
|
221
|
+
styleAnalysis: string;
|
|
222
|
+
isMajority: Generated<boolean>;
|
|
223
|
+
createdAt: Generated<string>;
|
|
224
|
+
updatedAt: Generated<string>;
|
|
225
|
+
}
|
|
226
|
+
type BookStyle = Selectable<BookStylesTable>;
|
|
227
|
+
type NewBookStyle = Insertable<BookStylesTable>;
|
|
228
|
+
type BookStyleUpdate = Updateable<BookStylesTable>;
|
|
229
|
+
interface SeededDatabase {
|
|
230
|
+
books: BooksTable;
|
|
231
|
+
chapters: ChaptersTable;
|
|
232
|
+
chapterParagraphs: ChapterParagraphsTable;
|
|
233
|
+
chapterScenes: ChapterScenesTable;
|
|
234
|
+
chapterSceneGroups: ChapterSceneGroupsTable;
|
|
235
|
+
chapterRelationships: ChapterRelationshipsTable;
|
|
236
|
+
chapterEntityAppellations: ChapterEntityAppellationsTable;
|
|
237
|
+
chapterEntityAttributes: ChapterEntityAttributesTable;
|
|
238
|
+
bookEntities: BookEntitiesTable;
|
|
239
|
+
bookEntityHierarchies: BookEntityHierarchiesTable;
|
|
240
|
+
bookArcs: BookArcsTable;
|
|
241
|
+
bookCategories: BookCategoriesTable;
|
|
242
|
+
bookCharacterPlaceScores: BookCharacterPlaceScoresTable;
|
|
243
|
+
bookStyles: BookStylesTable;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { Book, BookArc, BookArcUpdate, BookArcsTable, BookCategoriesTable, BookCategory, BookCategoryUpdate, BookCharacterPlaceScore, BookCharacterPlaceScoreUpdate, BookCharacterPlaceScoresTable, BookEntitiesTable, BookEntity, BookEntityHierarchiesTable, BookEntityHierarchy, BookEntityHierarchyUpdate, BookEntityUpdate, BookStyle, BookStyleUpdate, BookStylesTable, BookUpdate, BooksTable, Chapter, ChapterEntityAppellation, ChapterEntityAppellationUpdate, ChapterEntityAppellationsTable, ChapterEntityAttribute, ChapterEntityAttributeUpdate, ChapterEntityAttributesTable, ChapterParagraph, ChapterParagraphUpdate, ChapterParagraphsTable, ChapterRelationship, ChapterRelationshipUpdate, ChapterRelationshipsTable, ChapterScene, ChapterSceneGroup, ChapterSceneGroupUpdate, ChapterSceneGroupsTable, ChapterSceneUpdate, ChapterScenesTable, ChapterUpdate, ChaptersTable, JsonValue, NewBook, NewBookArc, NewBookCategory, NewBookCharacterPlaceScore, NewBookEntity, NewBookEntityHierarchy, NewBookStyle, NewChapter, NewChapterEntityAppellation, NewChapterEntityAttribute, NewChapterParagraph, NewChapterRelationship, NewChapterScene, NewChapterSceneGroup, SeededDatabase };
|
|
247
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/db/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|