@vllnt/convex-music 0.1.0-canary.09eea4e
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 +169 -0
- package/dist/client/index.d.ts +284 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +166 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +100 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +125 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +1143 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +133 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/actions.d.ts +144 -0
- package/dist/component/actions.d.ts.map +1 -0
- package/dist/component/actions.js +125 -0
- package/dist/component/actions.js.map +1 -0
- package/dist/component/catalog/browse_order.d.ts +22 -0
- package/dist/component/catalog/browse_order.d.ts.map +1 -0
- package/dist/component/catalog/browse_order.js +37 -0
- package/dist/component/catalog/browse_order.js.map +1 -0
- package/dist/component/catalog/field_source_policy.d.ts +30 -0
- package/dist/component/catalog/field_source_policy.d.ts.map +1 -0
- package/dist/component/catalog/field_source_policy.js +36 -0
- package/dist/component/catalog/field_source_policy.js.map +1 -0
- package/dist/component/catalog/merge.d.ts +58 -0
- package/dist/component/catalog/merge.d.ts.map +1 -0
- package/dist/component/catalog/merge.js +74 -0
- package/dist/component/catalog/merge.js.map +1 -0
- package/dist/component/catalog/mutations.d.ts +78 -0
- package/dist/component/catalog/mutations.d.ts.map +1 -0
- package/dist/component/catalog/mutations.js +259 -0
- package/dist/component/catalog/mutations.js.map +1 -0
- package/dist/component/catalog/promote.d.ts +21 -0
- package/dist/component/catalog/promote.d.ts.map +1 -0
- package/dist/component/catalog/promote.js +25 -0
- package/dist/component/catalog/promote.js.map +1 -0
- package/dist/component/catalog/queries.d.ts +421 -0
- package/dist/component/catalog/queries.d.ts.map +1 -0
- package/dist/component/catalog/queries.js +168 -0
- package/dist/component/catalog/queries.js.map +1 -0
- package/dist/component/config/mutations.d.ts +11 -0
- package/dist/component/config/mutations.d.ts.map +1 -0
- package/dist/component/config/mutations.js +30 -0
- package/dist/component/config/mutations.js.map +1 -0
- package/dist/component/config/queries.d.ts +9 -0
- package/dist/component/config/queries.d.ts.map +1 -0
- package/dist/component/config/queries.js +20 -0
- package/dist/component/config/queries.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +30 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/crons.d.ts +11 -0
- package/dist/component/crons.d.ts.map +1 -0
- package/dist/component/crons.js +41 -0
- package/dist/component/crons.js.map +1 -0
- package/dist/component/imports/actions.d.ts +119 -0
- package/dist/component/imports/actions.d.ts.map +1 -0
- package/dist/component/imports/actions.js +442 -0
- package/dist/component/imports/actions.js.map +1 -0
- package/dist/component/imports/dedupe.d.ts +29 -0
- package/dist/component/imports/dedupe.d.ts.map +1 -0
- package/dist/component/imports/dedupe.js +33 -0
- package/dist/component/imports/dedupe.js.map +1 -0
- package/dist/component/imports/mutations.d.ts +59 -0
- package/dist/component/imports/mutations.d.ts.map +1 -0
- package/dist/component/imports/mutations.js +151 -0
- package/dist/component/imports/mutations.js.map +1 -0
- package/dist/component/imports/queries.d.ts +68 -0
- package/dist/component/imports/queries.d.ts.map +1 -0
- package/dist/component/imports/queries.js +22 -0
- package/dist/component/imports/queries.js.map +1 -0
- package/dist/component/imports/state.d.ts +36 -0
- package/dist/component/imports/state.d.ts.map +1 -0
- package/dist/component/imports/state.js +62 -0
- package/dist/component/imports/state.js.map +1 -0
- package/dist/component/mutations.d.ts +55 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +74 -0
- package/dist/component/mutations.js.map +1 -0
- package/dist/component/providers/actions.d.ts +26 -0
- package/dist/component/providers/actions.d.ts.map +1 -0
- package/dist/component/providers/actions.js +92 -0
- package/dist/component/providers/actions.js.map +1 -0
- package/dist/component/providers/apple/impl.d.ts +52 -0
- package/dist/component/providers/apple/impl.d.ts.map +1 -0
- package/dist/component/providers/apple/impl.js +127 -0
- package/dist/component/providers/apple/impl.js.map +1 -0
- package/dist/component/providers/apple/jwt.d.ts +32 -0
- package/dist/component/providers/apple/jwt.d.ts.map +1 -0
- package/dist/component/providers/apple/jwt.js +68 -0
- package/dist/component/providers/apple/jwt.js.map +1 -0
- package/dist/component/providers/apple/mappers.d.ts +20 -0
- package/dist/component/providers/apple/mappers.d.ts.map +1 -0
- package/dist/component/providers/apple/mappers.js +68 -0
- package/dist/component/providers/apple/mappers.js.map +1 -0
- package/dist/component/providers/apple/types.d.ts +80 -0
- package/dist/component/providers/apple/types.d.ts.map +1 -0
- package/dist/component/providers/apple/types.js +7 -0
- package/dist/component/providers/apple/types.js.map +1 -0
- package/dist/component/providers/deezer/impl.d.ts +37 -0
- package/dist/component/providers/deezer/impl.d.ts.map +1 -0
- package/dist/component/providers/deezer/impl.js +99 -0
- package/dist/component/providers/deezer/impl.js.map +1 -0
- package/dist/component/providers/deezer/mappers.d.ts +18 -0
- package/dist/component/providers/deezer/mappers.d.ts.map +1 -0
- package/dist/component/providers/deezer/mappers.js +53 -0
- package/dist/component/providers/deezer/mappers.js.map +1 -0
- package/dist/component/providers/deezer/types.d.ts +59 -0
- package/dist/component/providers/deezer/types.d.ts.map +1 -0
- package/dist/component/providers/deezer/types.js +7 -0
- package/dist/component/providers/deezer/types.js.map +1 -0
- package/dist/component/providers/fetch.d.ts +69 -0
- package/dist/component/providers/fetch.d.ts.map +1 -0
- package/dist/component/providers/fetch.js +145 -0
- package/dist/component/providers/fetch.js.map +1 -0
- package/dist/component/providers/musicbrainz/impl.d.ts +36 -0
- package/dist/component/providers/musicbrainz/impl.d.ts.map +1 -0
- package/dist/component/providers/musicbrainz/impl.js +74 -0
- package/dist/component/providers/musicbrainz/impl.js.map +1 -0
- package/dist/component/providers/musicbrainz/mappers.d.ts +10 -0
- package/dist/component/providers/musicbrainz/mappers.d.ts.map +1 -0
- package/dist/component/providers/musicbrainz/mappers.js +32 -0
- package/dist/component/providers/musicbrainz/mappers.js.map +1 -0
- package/dist/component/providers/musicbrainz/types.d.ts +24 -0
- package/dist/component/providers/musicbrainz/types.d.ts.map +1 -0
- package/dist/component/providers/musicbrainz/types.js +7 -0
- package/dist/component/providers/musicbrainz/types.js.map +1 -0
- package/dist/component/providers/registry.d.ts +22 -0
- package/dist/component/providers/registry.d.ts.map +1 -0
- package/dist/component/providers/registry.js +33 -0
- package/dist/component/providers/registry.js.map +1 -0
- package/dist/component/providers/spotify/client.d.ts +25 -0
- package/dist/component/providers/spotify/client.d.ts.map +1 -0
- package/dist/component/providers/spotify/client.js +30 -0
- package/dist/component/providers/spotify/client.js.map +1 -0
- package/dist/component/providers/spotify/impl.d.ts +51 -0
- package/dist/component/providers/spotify/impl.d.ts.map +1 -0
- package/dist/component/providers/spotify/impl.js +131 -0
- package/dist/component/providers/spotify/impl.js.map +1 -0
- package/dist/component/providers/spotify/mappers.d.ts +18 -0
- package/dist/component/providers/spotify/mappers.d.ts.map +1 -0
- package/dist/component/providers/spotify/mappers.js +60 -0
- package/dist/component/providers/spotify/mappers.js.map +1 -0
- package/dist/component/providers/spotify/types.d.ts +97 -0
- package/dist/component/providers/spotify/types.d.ts.map +1 -0
- package/dist/component/providers/spotify/types.js +7 -0
- package/dist/component/providers/spotify/types.js.map +1 -0
- package/dist/component/providers/types.d.ts +84 -0
- package/dist/component/providers/types.d.ts.map +1 -0
- package/dist/component/providers/types.js +10 -0
- package/dist/component/providers/types.js.map +1 -0
- package/dist/component/providers/wikidata/impl.d.ts +34 -0
- package/dist/component/providers/wikidata/impl.d.ts.map +1 -0
- package/dist/component/providers/wikidata/impl.js +88 -0
- package/dist/component/providers/wikidata/impl.js.map +1 -0
- package/dist/component/providers/wikidata/mappers.d.ts +11 -0
- package/dist/component/providers/wikidata/mappers.d.ts.map +1 -0
- package/dist/component/providers/wikidata/mappers.js +53 -0
- package/dist/component/providers/wikidata/mappers.js.map +1 -0
- package/dist/component/providers/wikidata/types.d.ts +35 -0
- package/dist/component/providers/wikidata/types.d.ts.map +1 -0
- package/dist/component/providers/wikidata/types.js +8 -0
- package/dist/component/providers/wikidata/types.js.map +1 -0
- package/dist/component/queries.d.ts +103 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +45 -0
- package/dist/component/queries.js.map +1 -0
- package/dist/component/schema.d.ts +566 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +59 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/sources/actions.d.ts +51 -0
- package/dist/component/sources/actions.d.ts.map +1 -0
- package/dist/component/sources/actions.js +164 -0
- package/dist/component/sources/actions.js.map +1 -0
- package/dist/component/sources/mutations.d.ts +25 -0
- package/dist/component/sources/mutations.d.ts.map +1 -0
- package/dist/component/sources/mutations.js +64 -0
- package/dist/component/sources/mutations.js.map +1 -0
- package/dist/component/sources/queries.d.ts +19 -0
- package/dist/component/sources/queries.d.ts.map +1 -0
- package/dist/component/sources/queries.js +20 -0
- package/dist/component/sources/queries.js.map +1 -0
- package/dist/component/sync/lifecycle.d.ts +46 -0
- package/dist/component/sync/lifecycle.d.ts.map +1 -0
- package/dist/component/sync/lifecycle.js +87 -0
- package/dist/component/sync/lifecycle.js.map +1 -0
- package/dist/component/sync/mutations.d.ts +101 -0
- package/dist/component/sync/mutations.d.ts.map +1 -0
- package/dist/component/sync/mutations.js +132 -0
- package/dist/component/sync/mutations.js.map +1 -0
- package/dist/component/sync/queries.d.ts +69 -0
- package/dist/component/sync/queries.d.ts.map +1 -0
- package/dist/component/sync/queries.js +32 -0
- package/dist/component/sync/queries.js.map +1 -0
- package/dist/component/validators.d.ts +1112 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +317 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/react/index.d.ts +42 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +43 -0
- package/dist/react/index.js.map +1 -0
- package/dist/shared.d.ts +28 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +24 -0
- package/dist/shared.js.map +1 -0
- package/package.json +126 -0
- package/src/client/index.ts +558 -0
- package/src/client/types.ts +117 -0
- package/src/component/_generated/api.ts +141 -0
- package/src/component/_generated/component.ts +1814 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +169 -0
- package/src/component/actions.ts +156 -0
- package/src/component/catalog/browse_order.test.ts +55 -0
- package/src/component/catalog/browse_order.ts +43 -0
- package/src/component/catalog/field_source_policy.test.ts +47 -0
- package/src/component/catalog/field_source_policy.ts +44 -0
- package/src/component/catalog/merge.test.ts +187 -0
- package/src/component/catalog/merge.ts +134 -0
- package/src/component/catalog/mutations.ts +328 -0
- package/src/component/catalog/promote.ts +40 -0
- package/src/component/catalog/queries.ts +220 -0
- package/src/component/config/mutations.ts +29 -0
- package/src/component/config/queries.ts +20 -0
- package/src/component/convex.config.ts +32 -0
- package/src/component/crons.test.ts +8 -0
- package/src/component/crons.ts +52 -0
- package/src/component/imports/actions.ts +553 -0
- package/src/component/imports/dedupe.test.ts +66 -0
- package/src/component/imports/dedupe.ts +54 -0
- package/src/component/imports/mutations.ts +203 -0
- package/src/component/imports/queries.ts +25 -0
- package/src/component/imports/state.test.ts +60 -0
- package/src/component/imports/state.ts +74 -0
- package/src/component/mutations.ts +96 -0
- package/src/component/providers/actions.ts +127 -0
- package/src/component/providers/apple/impl.test.ts +267 -0
- package/src/component/providers/apple/impl.ts +224 -0
- package/src/component/providers/apple/jwt.test.ts +153 -0
- package/src/component/providers/apple/jwt.ts +99 -0
- package/src/component/providers/apple/mappers.test.ts +190 -0
- package/src/component/providers/apple/mappers.ts +100 -0
- package/src/component/providers/apple/types.ts +77 -0
- package/src/component/providers/deezer/impl.test.ts +109 -0
- package/src/component/providers/deezer/impl.ts +179 -0
- package/src/component/providers/deezer/mappers.test.ts +78 -0
- package/src/component/providers/deezer/mappers.ts +72 -0
- package/src/component/providers/deezer/types.ts +59 -0
- package/src/component/providers/fetch.test.ts +282 -0
- package/src/component/providers/fetch.ts +190 -0
- package/src/component/providers/musicbrainz/impl.test.ts +79 -0
- package/src/component/providers/musicbrainz/impl.ts +132 -0
- package/src/component/providers/musicbrainz/mappers.test.ts +75 -0
- package/src/component/providers/musicbrainz/mappers.ts +34 -0
- package/src/component/providers/musicbrainz/types.ts +20 -0
- package/src/component/providers/registry.test.ts +14 -0
- package/src/component/providers/registry.ts +48 -0
- package/src/component/providers/spotify/client.test.ts +80 -0
- package/src/component/providers/spotify/client.ts +57 -0
- package/src/component/providers/spotify/impl.test.ts +311 -0
- package/src/component/providers/spotify/impl.ts +230 -0
- package/src/component/providers/spotify/mappers.test.ts +182 -0
- package/src/component/providers/spotify/mappers.ts +81 -0
- package/src/component/providers/spotify/types.ts +101 -0
- package/src/component/providers/types.ts +95 -0
- package/src/component/providers/wikidata/impl.test.ts +81 -0
- package/src/component/providers/wikidata/impl.ts +139 -0
- package/src/component/providers/wikidata/mappers.test.ts +62 -0
- package/src/component/providers/wikidata/mappers.ts +66 -0
- package/src/component/providers/wikidata/types.ts +28 -0
- package/src/component/queries.ts +51 -0
- package/src/component/schema.ts +81 -0
- package/src/component/sources/actions.ts +177 -0
- package/src/component/sources/mutations.ts +67 -0
- package/src/component/sources/queries.ts +21 -0
- package/src/component/sync/lifecycle.test.ts +72 -0
- package/src/component/sync/lifecycle.ts +121 -0
- package/src/component/sync/mutations.ts +154 -0
- package/src/component/sync/queries.ts +33 -0
- package/src/component/validators.ts +411 -0
- package/src/react/index.test.ts +78 -0
- package/src/react/index.ts +112 -0
- package/src/shared.ts +32 -0
- package/src/test.ts +22 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a provider's stored credentials, or `null` if unconfigured. Internal —
|
|
3
|
+
* credentials are read only by the component's own token actions, never exposed
|
|
4
|
+
* back to the host.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getProviderSecrets: import("convex/server").RegisteredQuery<"internal", {
|
|
7
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
8
|
+
}, Promise<Record<string, string> | null>>;
|
|
9
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/config/queries.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;0CAU7B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { internalQuery } from "../_generated/server.js";
|
|
3
|
+
import { provider, providerSecrets } from "../validators.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read a provider's stored credentials, or `null` if unconfigured. Internal —
|
|
6
|
+
* credentials are read only by the component's own token actions, never exposed
|
|
7
|
+
* back to the host.
|
|
8
|
+
*/
|
|
9
|
+
export const getProviderSecrets = internalQuery({
|
|
10
|
+
args: { provider },
|
|
11
|
+
returns: v.union(v.null(), providerSecrets),
|
|
12
|
+
handler: async (ctx, args) => {
|
|
13
|
+
const row = await ctx.db
|
|
14
|
+
.query("providerConfig")
|
|
15
|
+
.withIndex("by_provider", (q) => q.eq("provider", args.provider))
|
|
16
|
+
.unique();
|
|
17
|
+
return row === null ? null : row.secrets;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/config/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;IAC9C,IAAI,EAAE,EAAE,QAAQ,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,eAAe,CAAC;IAC3C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,EAAE;aACrB,KAAK,CAAC,gBAAgB,CAAC;aACvB,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;aAChE,MAAM,EAAE,CAAC;QACZ,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;IAC3C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,SAAS,sDAA2B,CAAC;eA2B5B,SAAS"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent } from "convex/server";
|
|
2
|
+
import actionCache from "@convex-dev/action-cache/convex.config";
|
|
3
|
+
import rateLimiter from "@convex-dev/rate-limiter/convex.config";
|
|
4
|
+
const component = defineComponent("music");
|
|
5
|
+
/**
|
|
6
|
+
* Official child components, composed (never re-implemented):
|
|
7
|
+
* - `action-cache` — provider token cache (Spotify token + signed Apple JWT).
|
|
8
|
+
* - `rate-limiter` — auto-import throughput budgets (token buckets, separate for
|
|
9
|
+
* new-source import vs stale-row refresh), decoupled from cron frequency.
|
|
10
|
+
*
|
|
11
|
+
* The import traversal is a bounded fetch→upsert fan-out run inline in one action,
|
|
12
|
+
* with the request lifecycle tracked in the component's own `importRequests` table
|
|
13
|
+
* (a control-plane status machine, enforced by `imports/state.ts`). It is not
|
|
14
|
+
* durable, resumable, multi-step orchestration, so it does NOT compose
|
|
15
|
+
* `@convex-dev/workflow`/`workpool`; in-action batch concurrency is bounded with
|
|
16
|
+
* `mapWithConcurrency`. A workflow-backed durable traversal is a future option if
|
|
17
|
+
* catalogs grow large enough to need resumable, cross-failure imports.
|
|
18
|
+
*
|
|
19
|
+
* Deferred: `@vllnt/convex-idempotency` — import-request dedup is the
|
|
20
|
+
* component-owned active-request control-plane check (serializable under Convex
|
|
21
|
+
* OCC; see `imports/mutations.ts`).
|
|
22
|
+
*
|
|
23
|
+
* On `convex@^1.41`, `action-cache` 0.3.0's `fetch` ctx type lags the widened
|
|
24
|
+
* query-context `runQuery` (a cosmetic seam); bridged at the call site — see
|
|
25
|
+
* `providers/actions.ts`.
|
|
26
|
+
*/
|
|
27
|
+
component.use(actionCache);
|
|
28
|
+
component.use(rateLimiter);
|
|
29
|
+
export default component;
|
|
30
|
+
//# sourceMappingURL=convex.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAEjE,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC3B,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAE3B,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component-internal scheduled maintenance. Mount-safe (each `app.use` mount runs
|
|
3
|
+
* its own crons) and idempotent. `pruneExpired` is bounded to expired rows, so
|
|
4
|
+
* running it hourly safely reclaims raw-cache storage. Overlapping ticks are safe:
|
|
5
|
+
* the refresh sweep claims each stale row atomically (`claimNextStale`) and the
|
|
6
|
+
* auto-import sweep collapses duplicate requests (dedup is serializable under
|
|
7
|
+
* Convex OCC), so two concurrent sweeps never double-process the same row.
|
|
8
|
+
*/
|
|
9
|
+
declare const crons: import("convex/server").Crons;
|
|
10
|
+
export default crons;
|
|
11
|
+
//# sourceMappingURL=crons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,QAAA,MAAM,KAAK,+BAAa,CAAC;eAwCV,KAAK"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cronJobs } from "convex/server";
|
|
2
|
+
import { api } from "./_generated/api.js";
|
|
3
|
+
/**
|
|
4
|
+
* Component-internal scheduled maintenance. Mount-safe (each `app.use` mount runs
|
|
5
|
+
* its own crons) and idempotent. `pruneExpired` is bounded to expired rows, so
|
|
6
|
+
* running it hourly safely reclaims raw-cache storage. Overlapping ticks are safe:
|
|
7
|
+
* the refresh sweep claims each stale row atomically (`claimNextStale`) and the
|
|
8
|
+
* auto-import sweep collapses duplicate requests (dedup is serializable under
|
|
9
|
+
* Convex OCC), so two concurrent sweeps never double-process the same row.
|
|
10
|
+
*/
|
|
11
|
+
const crons = cronJobs();
|
|
12
|
+
crons.interval("music:prune-expired-cache", { hours: 1 }, api.mutations.pruneExpired, {});
|
|
13
|
+
// Daily freshness sweep: flip past-window synced rows to stale (the auto-import
|
|
14
|
+
// sweep re-syncs them). Per-kind so each batch is bounded.
|
|
15
|
+
crons.interval("music:mark-stale-artists", { hours: 24 }, api.sync.mutations.markStale, {
|
|
16
|
+
kind: "artist",
|
|
17
|
+
});
|
|
18
|
+
crons.interval("music:mark-stale-tracks", { hours: 24 }, api.sync.mutations.markStale, {
|
|
19
|
+
kind: "track",
|
|
20
|
+
});
|
|
21
|
+
// Auto-import sweep: pull due enabled sources. Opt-in — no-op without sources, so
|
|
22
|
+
// a fresh mount never auto-hammers providers.
|
|
23
|
+
crons.interval("music:auto-import", { hours: 1 }, api.sources.actions.runAutoImport, {});
|
|
24
|
+
// Refresh sweep: re-sync rows the mark-stale sweep flagged. Per-kind, opt-in
|
|
25
|
+
// (no stale rows → no-op).
|
|
26
|
+
crons.interval("music:refresh-artists", { hours: 6 }, api.sources.actions.runRefresh, {
|
|
27
|
+
kind: "artist",
|
|
28
|
+
});
|
|
29
|
+
crons.interval("music:refresh-tracks", { hours: 6 }, api.sources.actions.runRefresh, {
|
|
30
|
+
kind: "track",
|
|
31
|
+
});
|
|
32
|
+
// Recovery watchdog: salvage rows stuck `running` past the lease (a crashed
|
|
33
|
+
// re-sync) back to `stale` for re-pickup. Per-kind, idempotent.
|
|
34
|
+
crons.interval("music:recover-artists", { hours: 1 }, api.sync.mutations.recoverStuckSyncs, {
|
|
35
|
+
kind: "artist",
|
|
36
|
+
});
|
|
37
|
+
crons.interval("music:recover-tracks", { hours: 1 }, api.sync.mutations.recoverStuckSyncs, {
|
|
38
|
+
kind: "track",
|
|
39
|
+
});
|
|
40
|
+
export default crons;
|
|
41
|
+
//# sourceMappingURL=crons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.js","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,KAAK,CAAC,QAAQ,CACZ,2BAA2B,EAC3B,EAAE,KAAK,EAAE,CAAC,EAAE,EACZ,GAAG,CAAC,SAAS,CAAC,YAAY,EAC1B,EAAE,CACH,CAAC;AAEF,gFAAgF;AAChF,2DAA2D;AAC3D,KAAK,CAAC,QAAQ,CAAC,0BAA0B,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;IACtF,IAAI,EAAE,QAAQ;CACf,CAAC,CAAC;AACH,KAAK,CAAC,QAAQ,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;IACrF,IAAI,EAAE,OAAO;CACd,CAAC,CAAC;AAEH,kFAAkF;AAClF,8CAA8C;AAC9C,KAAK,CAAC,QAAQ,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAEzF,6EAA6E;AAC7E,2BAA2B;AAC3B,KAAK,CAAC,QAAQ,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE;IACpF,IAAI,EAAE,QAAQ;CACf,CAAC,CAAC;AACH,KAAK,CAAC,QAAQ,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE;IACnF,IAAI,EAAE,OAAO;CACd,CAAC,CAAC;AAEH,4EAA4E;AAC5E,gEAAgE;AAChE,KAAK,CAAC,QAAQ,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE;IAC1F,IAAI,EAAE,QAAQ;CACf,CAAC,CAAC;AACH,KAAK,CAAC,QAAQ,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE;IACzF,IAAI,EAAE,OAAO;CACd,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import entry points + traversal. An entry point creates a control-plane request
|
|
3
|
+
* (dedup-aware) then runs the traversal, which resolves the target (by provider
|
|
4
|
+
* id or by name-search), fetches it via the adapter, promotes it into the
|
|
5
|
+
* catalog, and drives the request through `running → completed | failed`. The
|
|
6
|
+
* traversal reuses the tested token + adapter + catalog-upsert layers.
|
|
7
|
+
*/
|
|
8
|
+
import type { ImportStatus } from "./state.js";
|
|
9
|
+
/** The request id + the request's terminal (or, when deduped, current) status. */
|
|
10
|
+
type ImportOutcome = {
|
|
11
|
+
requestId: string;
|
|
12
|
+
status: ImportStatus;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Run an artist import: resolve the artist's provider id (directly or via
|
|
16
|
+
* name-search), fetch + promote it into the catalog, and complete (or fail) the
|
|
17
|
+
* request. Returns the terminal status.
|
|
18
|
+
*/
|
|
19
|
+
export declare const runArtistImport: import("convex/server").RegisteredAction<"public", {
|
|
20
|
+
name: string;
|
|
21
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
22
|
+
providerId: string;
|
|
23
|
+
requestId: import("convex/values").GenericId<"importRequests">;
|
|
24
|
+
targetMode: "name" | "providerId";
|
|
25
|
+
tracks?: "all" | "none" | "top" | undefined;
|
|
26
|
+
withTracks?: boolean | undefined;
|
|
27
|
+
}, Promise<{
|
|
28
|
+
status: "completed" | "failed";
|
|
29
|
+
}>>;
|
|
30
|
+
/**
|
|
31
|
+
* Import an artist by name or provider id, promoting it into the catalog. Creates
|
|
32
|
+
* a dedup-aware control-plane request, runs the traversal, and returns the
|
|
33
|
+
* request id + terminal status.
|
|
34
|
+
*/
|
|
35
|
+
export declare const importArtist: import("convex/server").RegisteredAction<"public", {
|
|
36
|
+
mode?: "import" | "refresh" | "reimport" | "repair" | undefined;
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
priority?: "high" | "low" | "normal" | undefined;
|
|
39
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
40
|
+
providerId?: string | undefined;
|
|
41
|
+
targetMode: "name" | "providerId";
|
|
42
|
+
tracks?: "all" | "none" | "top" | undefined;
|
|
43
|
+
withTracks?: boolean | undefined;
|
|
44
|
+
}, Promise<ImportOutcome>>;
|
|
45
|
+
/**
|
|
46
|
+
* Run a track import: fetch the track by provider id, resolve + promote its
|
|
47
|
+
* credited artists, and complete (or fail) the request. Returns the terminal
|
|
48
|
+
* status.
|
|
49
|
+
*/
|
|
50
|
+
export declare const runTrackImport: import("convex/server").RegisteredAction<"public", {
|
|
51
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
52
|
+
providerId: string;
|
|
53
|
+
requestId: import("convex/values").GenericId<"importRequests">;
|
|
54
|
+
withAlbum?: boolean | undefined;
|
|
55
|
+
}, Promise<{
|
|
56
|
+
status: "completed" | "failed";
|
|
57
|
+
}>>;
|
|
58
|
+
/**
|
|
59
|
+
* Import a track by provider id, promoting it + its credited artists into the
|
|
60
|
+
* catalog. Returns the request id + terminal status.
|
|
61
|
+
*/
|
|
62
|
+
export declare const importTrack: import("convex/server").RegisteredAction<"public", {
|
|
63
|
+
mode?: "import" | "refresh" | "reimport" | "repair" | undefined;
|
|
64
|
+
priority?: "high" | "low" | "normal" | undefined;
|
|
65
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
66
|
+
providerId: string;
|
|
67
|
+
withAlbum?: boolean | undefined;
|
|
68
|
+
}, Promise<ImportOutcome>>;
|
|
69
|
+
/**
|
|
70
|
+
* Run a playlist import: fetch the playlist, promote its ISRC-bearing tracks (+
|
|
71
|
+
* their credited artists) into the catalog, store the playlist with its resolved
|
|
72
|
+
* membership, and complete (or fail) the request. ISRC-less tracks are skipped
|
|
73
|
+
* (they can't be unified).
|
|
74
|
+
*/
|
|
75
|
+
export declare const runPlaylistImport: import("convex/server").RegisteredAction<"public", {
|
|
76
|
+
limit?: number | undefined;
|
|
77
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
78
|
+
providerId: string;
|
|
79
|
+
requestId: import("convex/values").GenericId<"importRequests">;
|
|
80
|
+
}, Promise<{
|
|
81
|
+
status: "completed" | "failed";
|
|
82
|
+
}>>;
|
|
83
|
+
/**
|
|
84
|
+
* Import a playlist by provider id, promoting its tracks + storing membership.
|
|
85
|
+
* Returns the request id + terminal status.
|
|
86
|
+
*/
|
|
87
|
+
export declare const importPlaylist: import("convex/server").RegisteredAction<"public", {
|
|
88
|
+
limit?: number | undefined;
|
|
89
|
+
mode?: "import" | "refresh" | "reimport" | "repair" | undefined;
|
|
90
|
+
priority?: "high" | "low" | "normal" | undefined;
|
|
91
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
92
|
+
providerId: string;
|
|
93
|
+
}, Promise<ImportOutcome>>;
|
|
94
|
+
/**
|
|
95
|
+
* Run an album import: fetch the album by provider id, promote its ISRC tracks
|
|
96
|
+
* (with enrichment) + its credited artists, store the album row, and complete
|
|
97
|
+
* (or fail) the request. Returns the terminal status.
|
|
98
|
+
*/
|
|
99
|
+
export declare const runAlbumImport: import("convex/server").RegisteredAction<"public", {
|
|
100
|
+
limit?: number | undefined;
|
|
101
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
102
|
+
providerId: string;
|
|
103
|
+
requestId: import("convex/values").GenericId<"importRequests">;
|
|
104
|
+
}, Promise<{
|
|
105
|
+
status: "completed" | "failed";
|
|
106
|
+
}>>;
|
|
107
|
+
/**
|
|
108
|
+
* Import an album by provider id, promoting its tracks + artists + storing the
|
|
109
|
+
* album row. Returns the request id + terminal status.
|
|
110
|
+
*/
|
|
111
|
+
export declare const importAlbum: import("convex/server").RegisteredAction<"public", {
|
|
112
|
+
limit?: number | undefined;
|
|
113
|
+
mode?: "import" | "refresh" | "reimport" | "repair" | undefined;
|
|
114
|
+
priority?: "high" | "low" | "normal" | undefined;
|
|
115
|
+
provider: "apple" | "deezer" | "musicbrainz" | "spotify" | "wikidata";
|
|
116
|
+
providerId: string;
|
|
117
|
+
}, Promise<ImportOutcome>>;
|
|
118
|
+
export {};
|
|
119
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/component/imports/actions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,kFAAkF;AAClF,KAAK,aAAa,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAiEjE;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;YAWoB,WAAW,GAAG,QAAQ;GAqFpE,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;0BAsCvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;YAQqB,WAAW,GAAG,QAAQ;GA8CpE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;0BA8BtB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;YAQkB,WAAW,GAAG,QAAQ;GAoDpE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;0BA6BzB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;YAQqB,WAAW,GAAG,QAAQ;GAyDpE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;0BA6BtB,CAAC"}
|