{ "kind": "open-flow-workflow", "version": 1, "name": "Archive Discover Weekly Tracks", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_2c484b4ca1643c54": { "name": "Monday at 08:30 UTC", "kind": "cron", "cronTimes": [ { "type": "cron", "expression": "30 8 * * 1", "timezone": "UTC" } ] }, "n_9e56e6f263a8450c": { "inputs": { "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9e56e6f263a8450c", "output": "state" } ] }, "page": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_181dbbffa313bba5", "output": "output" } ] } }, "name": "Collect playlists", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "page" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "offset" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" } ], "name": "Collect playlists", "moduleId": "n_11e7da65082b3d36", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_18ec03bbd3c24bf6": { "inputs": {}, "name": "More playlists pages", "kind": "condition", "matchMode": "first", "cases": [ { "output": "more", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_9e56e6f263a8450c", "output": "more" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_181dbbffa313bba5": { "inputs": { "limit": { "kind": "value", "value": 50 }, "offset": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9e56e6f263a8450c", "output": "offset" } ] } }, "name": "Read playlists page", "kind": "task", "task": { "inputs": [ { "description": "Maximum number of items to return.", "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 50, "description": "Maximum number of items to return." }, "nullable": true, "handle": "limit", "value": null }, { "description": "Zero-based index of the first item to return.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "Zero-based index of the first item to return." }, "nullable": true, "handle": "offset", "value": null } ], "outputs": [ { "description": "Spotify paging object.", "jsonSchema": { "type": "object", "properties": { "href": { "type": "string", "description": "Spotify API URL for this page." }, "limit": { "type": "integer", "description": "Maximum number of items returned." }, "next": { "type": [ "string", "null" ], "description": "URL for the next page when available." }, "offset": { "type": "integer", "description": "Zero-based index of the first returned item." }, "previous": { "type": [ "string", "null" ], "description": "URL for the previous page when available." }, "total": { "type": "integer", "description": "Total number of matched items." }, "items": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Spotify object with provider-specific fields." }, "description": "Spotify items on the current page." } }, "required": [ "href", "limit", "offset", "total", "items" ], "additionalProperties": true, "description": "Spotify paging object." }, "nullable": false, "handle": "output" } ], "name": "Read playlists page", "executor": { "kind": "connector", "action": "spotify.get_current_user_playlists", "outputMode": "value" } } }, "n_88bcbb143b6d4542": { "inputs": { "playlists": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9e56e6f263a8450c", "output": "items" } ] }, "archiveName": { "kind": "value", "value": "Discover Weekly Archive" } }, "name": "Find both playlists", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "playlists" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "archiveName" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "discover" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "archive" } ], "name": "Find both playlists", "moduleId": "n_050a7160686fc4f8", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b52f88bbc5ea00e4": { "inputs": { "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b52f88bbc5ea00e4", "output": "state" } ] }, "page": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_24659c64ec05135d", "output": "page" } ] } }, "name": "Collect Discover Weekly tracks", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "page" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "offset" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" } ], "name": "Collect Discover Weekly tracks", "moduleId": "n_e5f78d4f7138dd89", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_0a3d54675ef63c2f": { "inputs": {}, "name": "More Discover Weekly tracks pages", "kind": "condition", "matchMode": "first", "cases": [ { "output": "more", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_b52f88bbc5ea00e4", "output": "more" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_912fac7a7724757d": { "inputs": { "playlistId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_88bcbb143b6d4542", "output": "discover" } ] }, "limit": { "kind": "value", "value": 50 }, "offset": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b52f88bbc5ea00e4", "output": "offset" } ] } }, "name": "Read Discover Weekly tracks page", "kind": "task", "task": { "inputs": [ { "description": "Spotify playlist ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Spotify playlist ID." }, "nullable": false, "handle": "playlistId" }, { "description": "Maximum number of items to return.", "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 50, "description": "Maximum number of items to return." }, "nullable": true, "handle": "limit", "value": null }, { "description": "Zero-based index of the first item to return.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "Zero-based index of the first item to return." }, "nullable": true, "handle": "offset", "value": null }, { "description": "An ISO 3166-1 alpha-2 country code or from_token to apply market filtering.", "jsonSchema": { "anyOf": [ { "const": "from_token", "description": "A union variant." }, { "type": "string", "minLength": 2, "maxLength": 2, "description": "An ISO 3166-1 alpha-2 country code." } ], "description": "An ISO 3166-1 alpha-2 country code or from_token to apply market filtering." }, "nullable": true, "handle": "market", "value": null } ], "outputs": [ { "description": "Spotify API URL for this page.", "jsonSchema": { "type": "string", "description": "Spotify API URL for this page." }, "nullable": false, "handle": "href" }, { "description": "Maximum number of items returned.", "jsonSchema": { "type": "integer", "description": "Maximum number of items returned." }, "nullable": false, "handle": "limit" }, { "description": "URL for the next page when available.", "jsonSchema": { "type": [ "string", "null" ], "description": "URL for the next page when available." }, "nullable": true, "handle": "next" }, { "description": "Zero-based index of the first returned item.", "jsonSchema": { "type": "integer", "description": "Zero-based index of the first returned item." }, "nullable": false, "handle": "offset" }, { "description": "URL for the previous page when available.", "jsonSchema": { "type": [ "string", "null" ], "description": "URL for the previous page when available." }, "nullable": true, "handle": "previous" }, { "description": "Total number of playlist items.", "jsonSchema": { "type": "integer", "description": "Total number of playlist items." }, "nullable": false, "handle": "total" }, { "description": "Playlist track entries.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "added_at": { "type": [ "string", "null" ], "description": "Timestamp when the item was added." }, "is_local": { "type": "boolean", "description": "Whether the playlist item references a local file." }, "added_by": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify user ID." }, "display_name": { "type": [ "string", "null" ], "description": "Spotify display name." }, "uri": { "type": "string", "description": "Spotify user URI." }, "href": { "type": "string", "description": "Spotify user API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Owner external URLs." } }, "required": [ "id" ], "additionalProperties": true, "description": "User who added the item." }, "track": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify track ID." }, "name": { "type": "string", "description": "Track name." }, "uri": { "type": "string", "description": "Spotify track URI." }, "href": { "type": "string", "description": "Spotify track API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "duration_ms": { "type": "integer", "description": "Track duration in milliseconds." }, "explicit": { "type": "boolean", "description": "Whether the track contains explicit content." }, "disc_number": { "type": "integer", "description": "Disc number." }, "track_number": { "type": "integer", "description": "Track number within the disc." }, "popularity": { "type": "integer", "description": "Track popularity score." }, "preview_url": { "type": [ "string", "null" ], "description": "Preview audio URL when available." }, "is_local": { "type": "boolean", "description": "Whether the track is a local file." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the track is available." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Track artists." }, "album": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify album ID." }, "name": { "type": "string", "description": "Album name." }, "uri": { "type": "string", "description": "Spotify album URI." }, "href": { "type": "string", "description": "Spotify album API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "album_type": { "type": "string", "description": "Album type." }, "total_tracks": { "type": "integer", "description": "Total number of tracks." }, "release_date": { "type": "string", "description": "Album release date." }, "release_date_precision": { "type": "string", "description": "Album release date precision." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the album is available." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Album cover images." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Album artists." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Album external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Album summary." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Track external URLs." } }, "required": [ "id", "name", "uri", "href", "type", "duration_ms", "artists" ], "additionalProperties": true, "description": "Track referenced by the playlist item." } }, "additionalProperties": true, "description": "Playlist track entry." }, "description": "Playlist track entries." }, "nullable": false, "handle": "items" } ], "name": "Read Discover Weekly tracks page", "executor": { "kind": "connector", "action": "spotify.get_playlist_items" } } }, "n_24659c64ec05135d": { "inputs": { "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_912fac7a7724757d", "output": "items" } ] }, "next": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_912fac7a7724757d", "output": "next" } ] }, "offset": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_912fac7a7724757d", "output": "offset" } ] }, "total": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_912fac7a7724757d", "output": "total" } ] } }, "name": "Prepare Discover Weekly tracks page", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "added_at": { "type": [ "string", "null" ], "description": "Timestamp when the item was added." }, "is_local": { "type": "boolean", "description": "Whether the playlist item references a local file." }, "added_by": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify user ID." }, "display_name": { "type": [ "string", "null" ], "description": "Spotify display name." }, "uri": { "type": "string", "description": "Spotify user URI." }, "href": { "type": "string", "description": "Spotify user API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Owner external URLs." } }, "required": [ "id" ], "additionalProperties": true, "description": "User who added the item." }, "track": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify track ID." }, "name": { "type": "string", "description": "Track name." }, "uri": { "type": "string", "description": "Spotify track URI." }, "href": { "type": "string", "description": "Spotify track API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "duration_ms": { "type": "integer", "description": "Track duration in milliseconds." }, "explicit": { "type": "boolean", "description": "Whether the track contains explicit content." }, "disc_number": { "type": "integer", "description": "Disc number." }, "track_number": { "type": "integer", "description": "Track number within the disc." }, "popularity": { "type": "integer", "description": "Track popularity score." }, "preview_url": { "type": [ "string", "null" ], "description": "Preview audio URL when available." }, "is_local": { "type": "boolean", "description": "Whether the track is a local file." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the track is available." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Track artists." }, "album": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify album ID." }, "name": { "type": "string", "description": "Album name." }, "uri": { "type": "string", "description": "Spotify album URI." }, "href": { "type": "string", "description": "Spotify album API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "album_type": { "type": "string", "description": "Album type." }, "total_tracks": { "type": "integer", "description": "Total number of tracks." }, "release_date": { "type": "string", "description": "Album release date." }, "release_date_precision": { "type": "string", "description": "Album release date precision." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the album is available." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Album cover images." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Album artists." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Album external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Album summary." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Track external URLs." } }, "required": [ "id", "name", "uri", "href", "type", "duration_ms", "artists" ], "additionalProperties": true, "description": "Track referenced by the playlist item." } }, "additionalProperties": true, "description": "Playlist track entry." }, "description": "Playlist track entries." }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": [ "string", "null" ], "description": "URL for the next page when available." }, "nullable": true, "handle": "next" }, { "jsonSchema": { "type": "integer", "description": "Zero-based index of the first returned item." }, "nullable": false, "handle": "offset" }, { "jsonSchema": { "type": "integer", "description": "Total number of playlist items." }, "nullable": false, "handle": "total" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "page" } ], "name": "Prepare Discover Weekly tracks page", "moduleId": "n_69d4883f0d96e3c3", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_5ff3e9fc4e6f6845": { "inputs": { "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5ff3e9fc4e6f6845", "output": "state" } ] }, "page": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a1ed7cff572ee64e", "output": "page" } ] } }, "name": "Collect archive tracks", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "page" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "offset" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" } ], "name": "Collect archive tracks", "moduleId": "n_58b8c9a51157deaf", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_24023f81963d025d": { "inputs": {}, "name": "More archive tracks pages", "kind": "condition", "matchMode": "first", "cases": [ { "output": "more", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_5ff3e9fc4e6f6845", "output": "more" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_3fa6f14a6a03b0f8": { "inputs": { "playlistId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_88bcbb143b6d4542", "output": "archive" } ] }, "limit": { "kind": "value", "value": 50 }, "offset": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5ff3e9fc4e6f6845", "output": "offset" } ] } }, "name": "Read archive tracks page", "kind": "task", "task": { "inputs": [ { "description": "Spotify playlist ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Spotify playlist ID." }, "nullable": false, "handle": "playlistId" }, { "description": "Maximum number of items to return.", "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 50, "description": "Maximum number of items to return." }, "nullable": true, "handle": "limit", "value": null }, { "description": "Zero-based index of the first item to return.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "Zero-based index of the first item to return." }, "nullable": true, "handle": "offset", "value": null }, { "description": "An ISO 3166-1 alpha-2 country code or from_token to apply market filtering.", "jsonSchema": { "anyOf": [ { "const": "from_token", "description": "A union variant." }, { "type": "string", "minLength": 2, "maxLength": 2, "description": "An ISO 3166-1 alpha-2 country code." } ], "description": "An ISO 3166-1 alpha-2 country code or from_token to apply market filtering." }, "nullable": true, "handle": "market", "value": null } ], "outputs": [ { "description": "Spotify API URL for this page.", "jsonSchema": { "type": "string", "description": "Spotify API URL for this page." }, "nullable": false, "handle": "href" }, { "description": "Maximum number of items returned.", "jsonSchema": { "type": "integer", "description": "Maximum number of items returned." }, "nullable": false, "handle": "limit" }, { "description": "URL for the next page when available.", "jsonSchema": { "type": [ "string", "null" ], "description": "URL for the next page when available." }, "nullable": true, "handle": "next" }, { "description": "Zero-based index of the first returned item.", "jsonSchema": { "type": "integer", "description": "Zero-based index of the first returned item." }, "nullable": false, "handle": "offset" }, { "description": "URL for the previous page when available.", "jsonSchema": { "type": [ "string", "null" ], "description": "URL for the previous page when available." }, "nullable": true, "handle": "previous" }, { "description": "Total number of playlist items.", "jsonSchema": { "type": "integer", "description": "Total number of playlist items." }, "nullable": false, "handle": "total" }, { "description": "Playlist track entries.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "added_at": { "type": [ "string", "null" ], "description": "Timestamp when the item was added." }, "is_local": { "type": "boolean", "description": "Whether the playlist item references a local file." }, "added_by": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify user ID." }, "display_name": { "type": [ "string", "null" ], "description": "Spotify display name." }, "uri": { "type": "string", "description": "Spotify user URI." }, "href": { "type": "string", "description": "Spotify user API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Owner external URLs." } }, "required": [ "id" ], "additionalProperties": true, "description": "User who added the item." }, "track": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify track ID." }, "name": { "type": "string", "description": "Track name." }, "uri": { "type": "string", "description": "Spotify track URI." }, "href": { "type": "string", "description": "Spotify track API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "duration_ms": { "type": "integer", "description": "Track duration in milliseconds." }, "explicit": { "type": "boolean", "description": "Whether the track contains explicit content." }, "disc_number": { "type": "integer", "description": "Disc number." }, "track_number": { "type": "integer", "description": "Track number within the disc." }, "popularity": { "type": "integer", "description": "Track popularity score." }, "preview_url": { "type": [ "string", "null" ], "description": "Preview audio URL when available." }, "is_local": { "type": "boolean", "description": "Whether the track is a local file." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the track is available." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Track artists." }, "album": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify album ID." }, "name": { "type": "string", "description": "Album name." }, "uri": { "type": "string", "description": "Spotify album URI." }, "href": { "type": "string", "description": "Spotify album API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "album_type": { "type": "string", "description": "Album type." }, "total_tracks": { "type": "integer", "description": "Total number of tracks." }, "release_date": { "type": "string", "description": "Album release date." }, "release_date_precision": { "type": "string", "description": "Album release date precision." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the album is available." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Album cover images." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Album artists." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Album external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Album summary." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Track external URLs." } }, "required": [ "id", "name", "uri", "href", "type", "duration_ms", "artists" ], "additionalProperties": true, "description": "Track referenced by the playlist item." } }, "additionalProperties": true, "description": "Playlist track entry." }, "description": "Playlist track entries." }, "nullable": false, "handle": "items" } ], "name": "Read archive tracks page", "executor": { "kind": "connector", "action": "spotify.get_playlist_items" } } }, "n_a1ed7cff572ee64e": { "inputs": { "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3fa6f14a6a03b0f8", "output": "items" } ] }, "next": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3fa6f14a6a03b0f8", "output": "next" } ] }, "offset": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3fa6f14a6a03b0f8", "output": "offset" } ] }, "total": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3fa6f14a6a03b0f8", "output": "total" } ] } }, "name": "Prepare archive tracks page", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "added_at": { "type": [ "string", "null" ], "description": "Timestamp when the item was added." }, "is_local": { "type": "boolean", "description": "Whether the playlist item references a local file." }, "added_by": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify user ID." }, "display_name": { "type": [ "string", "null" ], "description": "Spotify display name." }, "uri": { "type": "string", "description": "Spotify user URI." }, "href": { "type": "string", "description": "Spotify user API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Owner external URLs." } }, "required": [ "id" ], "additionalProperties": true, "description": "User who added the item." }, "track": { "type": [ "object", "null" ], "properties": { "id": { "type": "string", "description": "Spotify track ID." }, "name": { "type": "string", "description": "Track name." }, "uri": { "type": "string", "description": "Spotify track URI." }, "href": { "type": "string", "description": "Spotify track API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "duration_ms": { "type": "integer", "description": "Track duration in milliseconds." }, "explicit": { "type": "boolean", "description": "Whether the track contains explicit content." }, "disc_number": { "type": "integer", "description": "Disc number." }, "track_number": { "type": "integer", "description": "Track number within the disc." }, "popularity": { "type": "integer", "description": "Track popularity score." }, "preview_url": { "type": [ "string", "null" ], "description": "Preview audio URL when available." }, "is_local": { "type": "boolean", "description": "Whether the track is a local file." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the track is available." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Track artists." }, "album": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify album ID." }, "name": { "type": "string", "description": "Album name." }, "uri": { "type": "string", "description": "Spotify album URI." }, "href": { "type": "string", "description": "Spotify album API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "album_type": { "type": "string", "description": "Album type." }, "total_tracks": { "type": "integer", "description": "Total number of tracks." }, "release_date": { "type": "string", "description": "Album release date." }, "release_date_precision": { "type": "string", "description": "Album release date precision." }, "available_markets": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Markets where the album is available." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Album cover images." }, "artists": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Spotify artist ID." }, "name": { "type": "string", "description": "Artist name." }, "uri": { "type": "string", "description": "Spotify artist URI." }, "href": { "type": "string", "description": "Spotify artist API URL." }, "type": { "type": "string", "description": "Spotify object type." }, "popularity": { "type": "integer", "description": "Artist popularity score." }, "genres": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Artist genres." }, "followers": { "type": "object", "properties": { "href": { "type": [ "string", "null" ], "description": "Followers API URL when available." }, "total": { "type": "integer", "description": "Follower count." } }, "additionalProperties": false, "description": "Follower summary." }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Image URL." }, "height": { "type": [ "integer", "null" ], "description": "Image height in pixels." }, "width": { "type": [ "integer", "null" ], "description": "Image width in pixels." } }, "required": [ "url" ], "additionalProperties": false, "description": "Spotify image object." }, "description": "Artist images." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Artist external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Spotify artist." }, "description": "Album artists." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Album external URLs." } }, "required": [ "id", "name", "uri", "href", "type" ], "additionalProperties": true, "description": "Album summary." }, "external_urls": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "Track external URLs." } }, "required": [ "id", "name", "uri", "href", "type", "duration_ms", "artists" ], "additionalProperties": true, "description": "Track referenced by the playlist item." } }, "additionalProperties": true, "description": "Playlist track entry." }, "description": "Playlist track entries." }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": [ "string", "null" ], "description": "URL for the next page when available." }, "nullable": true, "handle": "next" }, { "jsonSchema": { "type": "integer", "description": "Zero-based index of the first returned item." }, "nullable": false, "handle": "offset" }, { "jsonSchema": { "type": "integer", "description": "Total number of playlist items." }, "nullable": false, "handle": "total" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "page" } ], "name": "Prepare archive tracks page", "moduleId": "n_ca65ffcbe334c0b6", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b1afbaf29881d197": { "inputs": { "discover": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b52f88bbc5ea00e4", "output": "items" } ] }, "archive": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5ff3e9fc4e6f6845", "output": "items" } ] }, "id": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_88bcbb143b6d4542", "output": "archive" } ] } }, "name": "Find missing tracks", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "discover" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "archive" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "id" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "id" } ], "name": "Find missing tracks", "moduleId": "n_b3440d76677234af", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_f2c5135ce2fd0331": { "inputs": { "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b1afbaf29881d197", "output": "items" } ] }, "id": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b1afbaf29881d197", "output": "id" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f2c5135ce2fd0331", "output": "state" } ] } }, "name": "Prepare next track", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "id" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "id" }, { "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Spotify URI." }, "minItems": 1, "maxItems": 100, "description": "Spotify URIs in the order Spotify should use." }, "nullable": false, "handle": "uris" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "removeItems" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "count" } ], "name": "Prepare next track", "moduleId": "n_cfdedd9f76563199", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_01760ce46f2c7a7a": { "inputs": {}, "name": "More tracks?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "more", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_f2c5135ce2fd0331", "output": "more" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_e00d95cf39cb48e8": { "inputs": { "playlistId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f2c5135ce2fd0331", "output": "id" } ] }, "uris": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f2c5135ce2fd0331", "output": "uris" } ] } }, "name": "Add a track", "kind": "task", "task": { "inputs": [ { "description": "Spotify playlist ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Spotify playlist ID." }, "nullable": false, "handle": "playlistId" }, { "description": "Spotify URIs in the order Spotify should use.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Spotify URI." }, "minItems": 1, "maxItems": 100, "description": "Spotify URIs in the order Spotify should use." }, "nullable": false, "handle": "uris" }, { "description": "Zero-based insertion position.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "Zero-based insertion position." }, "nullable": true, "handle": "position", "value": null } ], "outputs": [ { "description": "Playlist snapshot identifier returned by Spotify.", "jsonSchema": { "type": "string", "description": "Playlist snapshot identifier returned by Spotify." }, "nullable": false, "handle": "snapshotId" } ], "name": "Add a track", "executor": { "kind": "connector", "action": "spotify.add_items_to_playlist" } } }, "n_e96773b45c13687b": { "name": "Added track count", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "count" } ], "outputMappings": { "count": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f2c5135ce2fd0331", "output": "count" } ] } } } }, "edges": [ { "source": "n_181dbbffa313bba5", "target": "n_9e56e6f263a8450c" }, { "source": "n_9e56e6f263a8450c", "target": "n_18ec03bbd3c24bf6" }, { "source": "n_18ec03bbd3c24bf6", "target": "n_181dbbffa313bba5", "sourceHandle": "more" }, { "source": "n_912fac7a7724757d", "target": "n_24659c64ec05135d" }, { "source": "n_24659c64ec05135d", "target": "n_b52f88bbc5ea00e4" }, { "source": "n_b52f88bbc5ea00e4", "target": "n_0a3d54675ef63c2f" }, { "source": "n_0a3d54675ef63c2f", "target": "n_912fac7a7724757d", "sourceHandle": "more" }, { "source": "n_3fa6f14a6a03b0f8", "target": "n_a1ed7cff572ee64e" }, { "source": "n_a1ed7cff572ee64e", "target": "n_5ff3e9fc4e6f6845" }, { "source": "n_5ff3e9fc4e6f6845", "target": "n_24023f81963d025d" }, { "source": "n_24023f81963d025d", "target": "n_3fa6f14a6a03b0f8", "sourceHandle": "more" }, { "source": "n_2c484b4ca1643c54", "target": "n_9e56e6f263a8450c" }, { "source": "n_18ec03bbd3c24bf6", "target": "n_88bcbb143b6d4542", "sourceHandle": "otherwise" }, { "source": "n_88bcbb143b6d4542", "target": "n_b52f88bbc5ea00e4" }, { "source": "n_0a3d54675ef63c2f", "target": "n_5ff3e9fc4e6f6845", "sourceHandle": "otherwise" }, { "source": "n_24023f81963d025d", "target": "n_b1afbaf29881d197", "sourceHandle": "otherwise" }, { "source": "n_b1afbaf29881d197", "target": "n_f2c5135ce2fd0331" }, { "source": "n_f2c5135ce2fd0331", "target": "n_01760ce46f2c7a7a" }, { "source": "n_01760ce46f2c7a7a", "target": "n_e00d95cf39cb48e8", "sourceHandle": "more" }, { "source": "n_e00d95cf39cb48e8", "target": "n_f2c5135ce2fd0331" }, { "source": "n_01760ce46f2c7a7a", "target": "n_e96773b45c13687b", "sourceHandle": "otherwise" } ] } }, "modules": { "n_11e7da65082b3d36": { "name": "Collect playlists", "imports": [], "source": "export default function collect({page,previousState}){\n if(previousState===null)return {state:{items:[],offset:0},items:[],offset:0,more:true};\n if(!page||!Array.isArray(page.items)||!Number.isSafeInteger(page.offset)||page.offset!==previousState.offset||!Number.isSafeInteger(page.total)||page.total<0)throw Error('Invalid Spotify page');\n if(!Object.hasOwn(page,'next'))throw Error('Spotify page lacks next marker');\n const items=previousState.items.concat(page.items),next=page.next;\n if(next!==null&&next!==undefined&&(typeof next!=='string'||!next||page.items.length===0))throw Error('Invalid Spotify next page');\n const offset=page.offset+page.items.length;\n if(next!=null){const match=/[?&]offset=(\\d+)(?:&|$)/.exec(next);if(!match||Number(match[1])!==offset)throw Error('Invalid Spotify next offset');}\n return {state:{items,offset},items,offset,more:next!=null};\n}\n" }, "n_050a7160686fc4f8": { "name": "Find both playlists", "imports": [], "source": "export default function({playlists,archiveName}){const pick=n=>{const a=playlists.filter(p=>p?.name===n);if(a.length!==1||typeof a[0].id!=='string'||!a[0].id)throw Error('Expected exactly one '+n+' playlist');return a[0].id};return {discover:pick('Discover Weekly'),archive:pick(archiveName)}}\n" }, "n_e5f78d4f7138dd89": { "name": "Collect Discover Weekly tracks", "imports": [], "source": "export default function collect({page,previousState}){\n if(previousState===null)return {state:{items:[],offset:0},items:[],offset:0,more:true};\n if(!page||!Array.isArray(page.items)||!Number.isSafeInteger(page.offset)||page.offset!==previousState.offset||!Number.isSafeInteger(page.total)||page.total<0)throw Error('Invalid Spotify page');\n if(!Object.hasOwn(page,'next'))throw Error('Spotify page lacks next marker');\n const items=previousState.items.concat(page.items),next=page.next;\n if(next!==null&&next!==undefined&&(typeof next!=='string'||!next||page.items.length===0))throw Error('Invalid Spotify next page');\n const offset=page.offset+page.items.length;\n if(next!=null){const match=/[?&]offset=(\\d+)(?:&|$)/.exec(next);if(!match||Number(match[1])!==offset)throw Error('Invalid Spotify next offset');}\n return {state:{items,offset},items,offset,more:next!=null};\n}\n" }, "n_69d4883f0d96e3c3": { "name": "Prepare Discover Weekly tracks page", "imports": [], "source": "export default function({items,next,offset,total}){return {page:{items,next,offset,total}};}" }, "n_58b8c9a51157deaf": { "name": "Collect archive tracks", "imports": [], "source": "export default function collect({page,previousState}){\n if(previousState===null)return {state:{items:[],offset:0},items:[],offset:0,more:true};\n if(!page||!Array.isArray(page.items)||!Number.isSafeInteger(page.offset)||page.offset!==previousState.offset||!Number.isSafeInteger(page.total)||page.total<0)throw Error('Invalid Spotify page');\n if(!Object.hasOwn(page,'next'))throw Error('Spotify page lacks next marker');\n const items=previousState.items.concat(page.items),next=page.next;\n if(next!==null&&next!==undefined&&(typeof next!=='string'||!next||page.items.length===0))throw Error('Invalid Spotify next page');\n const offset=page.offset+page.items.length;\n if(next!=null){const match=/[?&]offset=(\\d+)(?:&|$)/.exec(next);if(!match||Number(match[1])!==offset)throw Error('Invalid Spotify next offset');}\n return {state:{items,offset},items,offset,more:next!=null};\n}\n" }, "n_ca65ffcbe334c0b6": { "name": "Prepare archive tracks page", "imports": [], "source": "export default function({items,next,offset,total}){return {page:{items,next,offset,total}};}" }, "n_b3440d76677234af": { "name": "Find missing tracks", "imports": [], "source": "export default function({discover,archive,id}){const uri=x=>{const u=x?.track?.uri;if(typeof u!=='string'||!u.startsWith('spotify:track:'))throw Error('Playlist item has no track URI');return u};const existing=new Set(archive.map(uri));return {items:discover.map(uri).filter(x=>!existing.has(x)).map(uri=>({uri})),id}}\n" }, "n_cfdedd9f76563199": { "name": "Prepare next track", "imports": [], "source": "export default function next({items,id,previousState}){const index=previousState===null?0:previousState.index+1;if(index>=items.length)return {state:{index},more:false,id,uris:['-'],removeItems:[{uri:'-'}],count:items.length};const uri=items[index]?.uri;if(typeof uri!=='string'||!uri)throw Error('Invalid track URI');return {state:{index},more:true,id,uris:[uri],removeItems:[{uri}],count:items.length};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }