jukebox-media-server 0.5.1 → 0.7.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 +18 -20
- package/dist/client/assets/{Watch-Ja4PAA8Y.js → Watch-BiR2iXrC.js} +33 -33
- package/dist/client/assets/index-CKZbQJYY.css +1 -0
- package/dist/client/assets/index-CoxOmmZz.js +87 -0
- package/dist/client/index.html +2 -2
- package/dist/client/sw.js +1 -1
- package/dist/server/HttpApiBuilder-DWwOvarr.js +42786 -0
- package/dist/server/better-sqlite3-CkwhTVXW.js +129 -0
- package/dist/server/bun-database-CqinoQgb.js +14 -0
- package/dist/server/bun-database-oVoIc-C8.js +15 -0
- package/dist/server/bun-sqlite-Bk_yjDLi.js +134 -0
- package/dist/server/chunk-CrysgU_F.js +36 -0
- package/dist/server/config-CCAveLuN.js +12 -0
- package/dist/server/esm-Dm4Gq4cv.js +40975 -0
- package/dist/server/index.js +3884 -5603
- package/dist/server/{indexes-VMR6QVVl.js → indexes-vPbUiKXP.js} +4 -100
- package/dist/server/{better-sqlite3-Dy_YhTFe.js → logger-ygdFSBOU.js} +243 -368
- package/dist/server/{migrator-CWPnMvx5.js → migrator-8uumkKvi.js} +1 -7
- package/dist/server/migrator-CpDrzLY4.js +8 -0
- package/dist/server/migrator-D9F-ETAB.js +8 -0
- package/dist/server/schema-1sWMC8cP.js +59 -0
- package/dist/server/schema-B7-kIAVY.js +145 -0
- package/dist/server/select-62doObBa.js +101 -0
- package/drizzle/0011_loose_eternity.sql +1 -0
- package/drizzle/meta/0011_snapshot.json +1066 -0
- package/drizzle/meta/_journal.json +8 -1
- package/drizzle-telemetry/0000_great_thor.sql +45 -0
- package/drizzle-telemetry/meta/0000_snapshot.json +320 -0
- package/drizzle-telemetry/meta/_journal.json +13 -0
- package/package.json +22 -8
- package/dist/client/assets/index-AENKhh_8.css +0 -1
- package/dist/client/assets/index-Cm9WIhoR.js +0 -58
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as __exportAll } from "./chunk-CrysgU_F.js";
|
|
2
|
+
import { t as configDirectory } from "./config-CCAveLuN.js";
|
|
3
|
+
import { a as text, i as sqliteTable, o as real, s as integer, t as index } from "./indexes-vPbUiKXP.js";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
//#region src/telemetry/config.ts
|
|
6
|
+
const telemetryDatabasePath = join(configDirectory, "telemetry.db");
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/telemetry/schema.ts
|
|
9
|
+
var schema_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
errors: () => errors,
|
|
11
|
+
spans: () => spans
|
|
12
|
+
});
|
|
13
|
+
const spans = sqliteTable("spans", {
|
|
14
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
15
|
+
traceId: text("trace_id").notNull(),
|
|
16
|
+
spanId: text("span_id").notNull(),
|
|
17
|
+
parentSpanId: text("parent_span_id"),
|
|
18
|
+
name: text("name").notNull(),
|
|
19
|
+
kind: text("kind").notNull().default("internal"),
|
|
20
|
+
source: text("source").notNull(),
|
|
21
|
+
route: text("route"),
|
|
22
|
+
startTime: integer("start_time").notNull(),
|
|
23
|
+
endTime: integer("end_time").notNull(),
|
|
24
|
+
durationMs: real("duration_ms").notNull(),
|
|
25
|
+
statusCode: text("status_code").notNull().default("unset"),
|
|
26
|
+
statusMessage: text("status_message"),
|
|
27
|
+
attributes: text("attributes").notNull().default("{}"),
|
|
28
|
+
events: text("events").notNull().default("[]"),
|
|
29
|
+
resource: text("resource").notNull().default("{}"),
|
|
30
|
+
sessionId: text("session_id"),
|
|
31
|
+
createdAt: integer("created_at").notNull()
|
|
32
|
+
}, (table) => [
|
|
33
|
+
index("spans_trace_id_idx").on(table.traceId),
|
|
34
|
+
index("spans_trace_start_idx").on(table.traceId, table.startTime),
|
|
35
|
+
index("spans_status_idx").on(table.statusCode),
|
|
36
|
+
index("spans_created_idx").on(table.createdAt),
|
|
37
|
+
index("spans_parent_idx").on(table.parentSpanId),
|
|
38
|
+
index("spans_route_idx").on(table.route)
|
|
39
|
+
]);
|
|
40
|
+
const errors = sqliteTable("errors", {
|
|
41
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
42
|
+
traceId: text("trace_id"),
|
|
43
|
+
spanId: text("span_id"),
|
|
44
|
+
source: text("source").notNull(),
|
|
45
|
+
kind: text("kind").notNull(),
|
|
46
|
+
name: text("name").notNull(),
|
|
47
|
+
message: text("message").notNull(),
|
|
48
|
+
stack: text("stack"),
|
|
49
|
+
url: text("url"),
|
|
50
|
+
attributes: text("attributes").notNull().default("{}"),
|
|
51
|
+
timestamp: integer("timestamp").notNull(),
|
|
52
|
+
createdAt: integer("created_at").notNull()
|
|
53
|
+
}, (table) => [
|
|
54
|
+
index("errors_created_idx").on(table.createdAt),
|
|
55
|
+
index("errors_trace_idx").on(table.traceId),
|
|
56
|
+
index("errors_source_idx").on(table.source)
|
|
57
|
+
]);
|
|
58
|
+
//#endregion
|
|
59
|
+
export { telemetryDatabasePath as i, schema_exports as n, spans as r, errors as t };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { n as __exportAll } from "./chunk-CrysgU_F.js";
|
|
2
|
+
import { a as text, i as sqliteTable, n as uniqueIndex, o as real, s as integer } from "./indexes-vPbUiKXP.js";
|
|
3
|
+
//#region src/database/schema.ts
|
|
4
|
+
var schema_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
authConfig: () => authConfig,
|
|
6
|
+
episodes: () => episodes,
|
|
7
|
+
favorites: () => favorites,
|
|
8
|
+
libraries: () => libraries,
|
|
9
|
+
movies: () => movies,
|
|
10
|
+
profiles: () => profiles,
|
|
11
|
+
scanJobs: () => scanJobs,
|
|
12
|
+
seasons: () => seasons,
|
|
13
|
+
sessions: () => sessions,
|
|
14
|
+
settings: () => settings,
|
|
15
|
+
shows: () => shows,
|
|
16
|
+
subtitles: () => subtitles,
|
|
17
|
+
watchProgress: () => watchProgress
|
|
18
|
+
});
|
|
19
|
+
const profiles = sqliteTable("profiles", {
|
|
20
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
21
|
+
name: text("name").notNull().unique(),
|
|
22
|
+
emoji: text("emoji").notNull(),
|
|
23
|
+
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
24
|
+
});
|
|
25
|
+
const libraries = sqliteTable("libraries", {
|
|
26
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
27
|
+
name: text("name").notNull(),
|
|
28
|
+
path: text("path").notNull().unique(),
|
|
29
|
+
type: text("type").notNull(),
|
|
30
|
+
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
31
|
+
});
|
|
32
|
+
const movies = sqliteTable("movies", {
|
|
33
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
34
|
+
title: text("title").notNull(),
|
|
35
|
+
filePath: text("file_path").notNull().unique(),
|
|
36
|
+
fileName: text("file_name").notNull(),
|
|
37
|
+
fileSize: integer("file_size"),
|
|
38
|
+
extension: text("extension"),
|
|
39
|
+
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
40
|
+
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
|
|
41
|
+
externalId: text("external_id"),
|
|
42
|
+
year: integer("year"),
|
|
43
|
+
overview: text("overview"),
|
|
44
|
+
runtime: integer("runtime"),
|
|
45
|
+
genres: text("genres"),
|
|
46
|
+
rating: real("rating"),
|
|
47
|
+
posterUrl: text("poster_url"),
|
|
48
|
+
backdropUrl: text("backdrop_url"),
|
|
49
|
+
trailerUrl: text("trailer_url")
|
|
50
|
+
});
|
|
51
|
+
const shows = sqliteTable("shows", {
|
|
52
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
53
|
+
title: text("title").notNull(),
|
|
54
|
+
folderPath: text("folder_path").notNull().unique(),
|
|
55
|
+
externalId: text("external_id"),
|
|
56
|
+
year: integer("year"),
|
|
57
|
+
overview: text("overview"),
|
|
58
|
+
genres: text("genres"),
|
|
59
|
+
rating: real("rating"),
|
|
60
|
+
posterUrl: text("poster_url"),
|
|
61
|
+
backdropUrl: text("backdrop_url"),
|
|
62
|
+
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
63
|
+
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
64
|
+
});
|
|
65
|
+
const seasons = sqliteTable("seasons", {
|
|
66
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
67
|
+
showId: integer("show_id").notNull().references(() => shows.id),
|
|
68
|
+
seasonNumber: integer("season_number").notNull(),
|
|
69
|
+
name: text("name"),
|
|
70
|
+
overview: text("overview"),
|
|
71
|
+
posterUrl: text("poster_url"),
|
|
72
|
+
episodeCount: integer("episode_count")
|
|
73
|
+
});
|
|
74
|
+
const episodes = sqliteTable("episodes", {
|
|
75
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
76
|
+
showId: integer("show_id").notNull().references(() => shows.id),
|
|
77
|
+
seasonId: integer("season_id").notNull().references(() => seasons.id),
|
|
78
|
+
seasonNumber: integer("season_number").notNull(),
|
|
79
|
+
episodeNumber: integer("episode_number").notNull(),
|
|
80
|
+
title: text("title").notNull(),
|
|
81
|
+
filePath: text("file_path").notNull().unique(),
|
|
82
|
+
fileName: text("file_name").notNull(),
|
|
83
|
+
fileSize: integer("file_size"),
|
|
84
|
+
extension: text("extension"),
|
|
85
|
+
externalId: text("external_id"),
|
|
86
|
+
overview: text("overview"),
|
|
87
|
+
runtime: integer("runtime"),
|
|
88
|
+
stillUrl: text("still_url"),
|
|
89
|
+
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
90
|
+
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
91
|
+
});
|
|
92
|
+
const watchProgress = sqliteTable("watch_progress", {
|
|
93
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
94
|
+
profileId: integer("profile_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
95
|
+
movieId: integer("movie_id").references(() => movies.id, { onDelete: "cascade" }),
|
|
96
|
+
episodeId: integer("episode_id").references(() => episodes.id, { onDelete: "cascade" }),
|
|
97
|
+
currentTime: integer("current_time").notNull(),
|
|
98
|
+
duration: integer("duration"),
|
|
99
|
+
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
100
|
+
}, (table) => [uniqueIndex("watch_progress_profile_movie_idx").on(table.profileId, table.movieId), uniqueIndex("watch_progress_profile_episode_idx").on(table.profileId, table.episodeId)]);
|
|
101
|
+
const favorites = sqliteTable("favorites", {
|
|
102
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
103
|
+
profileId: integer("profile_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
104
|
+
movieId: integer("movie_id").references(() => movies.id, { onDelete: "cascade" }),
|
|
105
|
+
showId: integer("show_id").references(() => shows.id, { onDelete: "cascade" }),
|
|
106
|
+
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
107
|
+
}, (table) => [uniqueIndex("favorites_profile_movie_idx").on(table.profileId, table.movieId), uniqueIndex("favorites_profile_show_idx").on(table.profileId, table.showId)]);
|
|
108
|
+
const authConfig = sqliteTable("auth_config", {
|
|
109
|
+
id: integer("id").primaryKey(),
|
|
110
|
+
passwordHash: text("password_hash"),
|
|
111
|
+
updatedAt: integer("updated_at").notNull()
|
|
112
|
+
});
|
|
113
|
+
const sessions = sqliteTable("sessions", {
|
|
114
|
+
id: text("id").primaryKey(),
|
|
115
|
+
createdAt: integer("created_at").notNull(),
|
|
116
|
+
expiresAt: integer("expires_at").notNull(),
|
|
117
|
+
lastSeenAt: integer("last_seen_at").notNull(),
|
|
118
|
+
userAgent: text("user_agent")
|
|
119
|
+
});
|
|
120
|
+
const settings = sqliteTable("settings", {
|
|
121
|
+
key: text("key").primaryKey(),
|
|
122
|
+
value: text("value").notNull(),
|
|
123
|
+
updatedAt: integer("updated_at").notNull()
|
|
124
|
+
});
|
|
125
|
+
const scanJobs = sqliteTable("scan_jobs", {
|
|
126
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
127
|
+
startedAt: integer("started_at", { mode: "timestamp" }).notNull(),
|
|
128
|
+
endedAt: integer("ended_at", { mode: "timestamp" }),
|
|
129
|
+
status: text("status").notNull(),
|
|
130
|
+
added: integer("added").notNull().default(0),
|
|
131
|
+
updated: integer("updated").notNull().default(0),
|
|
132
|
+
total: integer("total").notNull().default(0),
|
|
133
|
+
errorMessage: text("error_message"),
|
|
134
|
+
libraryResults: text("library_results")
|
|
135
|
+
});
|
|
136
|
+
const subtitles = sqliteTable("subtitles", {
|
|
137
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
138
|
+
movieId: integer("movie_id").references(() => movies.id, { onDelete: "cascade" }),
|
|
139
|
+
episodeId: integer("episode_id").references(() => episodes.id, { onDelete: "cascade" }),
|
|
140
|
+
filePath: text("file_path").notNull(),
|
|
141
|
+
language: text("language").notNull(),
|
|
142
|
+
format: text("format").notNull()
|
|
143
|
+
});
|
|
144
|
+
//#endregion
|
|
145
|
+
export { movies as a, schema_exports as c, settings as d, shows as f, libraries as i, seasons as l, watchProgress as m, episodes as n, profiles as o, subtitles as p, favorites as r, scanJobs as s, authConfig as t, sessions as u };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { C as isDriverValueEncoder, D as Table, F as is, N as Column, T as sql, _ as Param, b as StringChunk, v as Placeholder, w as isSQLWrapper, x as View, y as SQL } from "./indexes-vPbUiKXP.js";
|
|
2
|
+
//#region node_modules/drizzle-orm/sql/expressions/conditions.js
|
|
3
|
+
function bindIfParam(value, column) {
|
|
4
|
+
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) return new Param(value, column);
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
const eq = (left, right) => {
|
|
8
|
+
return sql`${left} = ${bindIfParam(right, left)}`;
|
|
9
|
+
};
|
|
10
|
+
const ne = (left, right) => {
|
|
11
|
+
return sql`${left} <> ${bindIfParam(right, left)}`;
|
|
12
|
+
};
|
|
13
|
+
function and(...unfilteredConditions) {
|
|
14
|
+
const conditions = unfilteredConditions.filter((c) => c !== void 0);
|
|
15
|
+
if (conditions.length === 0) return;
|
|
16
|
+
if (conditions.length === 1) return new SQL(conditions);
|
|
17
|
+
return new SQL([
|
|
18
|
+
new StringChunk("("),
|
|
19
|
+
sql.join(conditions, new StringChunk(" and ")),
|
|
20
|
+
new StringChunk(")")
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
function or(...unfilteredConditions) {
|
|
24
|
+
const conditions = unfilteredConditions.filter((c) => c !== void 0);
|
|
25
|
+
if (conditions.length === 0) return;
|
|
26
|
+
if (conditions.length === 1) return new SQL(conditions);
|
|
27
|
+
return new SQL([
|
|
28
|
+
new StringChunk("("),
|
|
29
|
+
sql.join(conditions, new StringChunk(" or ")),
|
|
30
|
+
new StringChunk(")")
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
function not(condition) {
|
|
34
|
+
return sql`not ${condition}`;
|
|
35
|
+
}
|
|
36
|
+
const gt = (left, right) => {
|
|
37
|
+
return sql`${left} > ${bindIfParam(right, left)}`;
|
|
38
|
+
};
|
|
39
|
+
const gte = (left, right) => {
|
|
40
|
+
return sql`${left} >= ${bindIfParam(right, left)}`;
|
|
41
|
+
};
|
|
42
|
+
const lt = (left, right) => {
|
|
43
|
+
return sql`${left} < ${bindIfParam(right, left)}`;
|
|
44
|
+
};
|
|
45
|
+
const lte = (left, right) => {
|
|
46
|
+
return sql`${left} <= ${bindIfParam(right, left)}`;
|
|
47
|
+
};
|
|
48
|
+
function inArray(column, values) {
|
|
49
|
+
if (Array.isArray(values)) {
|
|
50
|
+
if (values.length === 0) return sql`false`;
|
|
51
|
+
return sql`${column} in ${values.map((v) => bindIfParam(v, column))}`;
|
|
52
|
+
}
|
|
53
|
+
return sql`${column} in ${bindIfParam(values, column)}`;
|
|
54
|
+
}
|
|
55
|
+
function notInArray(column, values) {
|
|
56
|
+
if (Array.isArray(values)) {
|
|
57
|
+
if (values.length === 0) return sql`true`;
|
|
58
|
+
return sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`;
|
|
59
|
+
}
|
|
60
|
+
return sql`${column} not in ${bindIfParam(values, column)}`;
|
|
61
|
+
}
|
|
62
|
+
function isNull(value) {
|
|
63
|
+
return sql`${value} is null`;
|
|
64
|
+
}
|
|
65
|
+
function isNotNull(value) {
|
|
66
|
+
return sql`${value} is not null`;
|
|
67
|
+
}
|
|
68
|
+
function exists(subquery) {
|
|
69
|
+
return sql`exists ${subquery}`;
|
|
70
|
+
}
|
|
71
|
+
function notExists(subquery) {
|
|
72
|
+
return sql`not exists ${subquery}`;
|
|
73
|
+
}
|
|
74
|
+
function between(column, min, max) {
|
|
75
|
+
return sql`${column} between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
|
|
76
|
+
}
|
|
77
|
+
function notBetween(column, min, max) {
|
|
78
|
+
return sql`${column} not between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
|
|
79
|
+
}
|
|
80
|
+
function like(column, value) {
|
|
81
|
+
return sql`${column} like ${value}`;
|
|
82
|
+
}
|
|
83
|
+
function notLike(column, value) {
|
|
84
|
+
return sql`${column} not like ${value}`;
|
|
85
|
+
}
|
|
86
|
+
function ilike(column, value) {
|
|
87
|
+
return sql`${column} ilike ${value}`;
|
|
88
|
+
}
|
|
89
|
+
function notIlike(column, value) {
|
|
90
|
+
return sql`${column} not ilike ${value}`;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region node_modules/drizzle-orm/sql/expressions/select.js
|
|
94
|
+
function asc(column) {
|
|
95
|
+
return sql`${column} asc`;
|
|
96
|
+
}
|
|
97
|
+
function desc(column) {
|
|
98
|
+
return sql`${column} desc`;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { or as C, notLike as S, not as _, eq as a, notIlike as b, gte as c, isNotNull as d, isNull as f, ne as g, lte as h, between as i, ilike as l, lt as m, desc as n, exists as o, like as p, and as r, gt as s, asc as t, inArray as u, notBetween as v, notInArray as x, notExists as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `scan_jobs` ADD `library_results` text;
|