@keystrokehq/spotify 0.0.7 → 0.0.9

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.
Files changed (56) hide show
  1. package/dist/_official/index.d.mts +2 -2
  2. package/dist/_official/index.mjs +1 -1
  3. package/dist/albums.d.mts +5 -5
  4. package/dist/albums.mjs +5 -5
  5. package/dist/artists.d.mts +6 -6
  6. package/dist/artists.mjs +6 -6
  7. package/dist/audio-analysis.d.mts +2 -2
  8. package/dist/audio-analysis.mjs +2 -2
  9. package/dist/audio-features.d.mts +3 -3
  10. package/dist/audio-features.mjs +3 -3
  11. package/dist/audiobooks.d.mts +4 -4
  12. package/dist/audiobooks.mjs +4 -4
  13. package/dist/browse.d.mts +2 -2
  14. package/dist/browse.mjs +2 -2
  15. package/dist/categories.d.mts +4 -4
  16. package/dist/categories.mjs +4 -4
  17. package/dist/chapters.d.mts +3 -3
  18. package/dist/chapters.mjs +3 -3
  19. package/dist/client.d.mts +230 -230
  20. package/dist/connection.d.mts +1 -1
  21. package/dist/connection.mjs +1 -1
  22. package/dist/episodes.d.mts +3 -3
  23. package/dist/episodes.mjs +3 -3
  24. package/dist/factory-C9W7aXmR.mjs +7 -0
  25. package/dist/follow.d.mts +5 -5
  26. package/dist/follow.mjs +5 -5
  27. package/dist/genres.d.mts +2 -2
  28. package/dist/genres.mjs +2 -2
  29. package/dist/integration-CrkQTg9q.mjs +170 -0
  30. package/dist/{integration-Dzf1u4u-.d.mts → integration-DXXNe4_j.d.mts} +3 -4
  31. package/dist/library.d.mts +21 -21
  32. package/dist/library.mjs +21 -21
  33. package/dist/markets.d.mts +2 -2
  34. package/dist/markets.mjs +2 -2
  35. package/dist/me.d.mts +4 -4
  36. package/dist/me.mjs +4 -4
  37. package/dist/player.d.mts +18 -18
  38. package/dist/player.mjs +16 -16
  39. package/dist/playlists.d.mts +15 -15
  40. package/dist/playlists.mjs +15 -15
  41. package/dist/recommendations.d.mts +2 -2
  42. package/dist/recommendations.mjs +2 -2
  43. package/dist/schemas.d.mts +1 -1
  44. package/dist/search.d.mts +3 -3
  45. package/dist/search.mjs +2 -2
  46. package/dist/shows.d.mts +4 -4
  47. package/dist/shows.mjs +4 -4
  48. package/dist/tracks.d.mts +3 -3
  49. package/dist/tracks.mjs +3 -3
  50. package/dist/triggers.d.mts +2 -3
  51. package/dist/triggers.mjs +56 -7
  52. package/dist/users.d.mts +2 -2
  53. package/dist/users.mjs +2 -2
  54. package/package.json +4 -4
  55. package/dist/factory-C3uQLYXY.mjs +0 -8
  56. package/dist/integration-BK1PIn1V.mjs +0 -78
package/dist/search.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spotifyMarketSchema, spotifySearchResultSchema } from "./schemas.mjs";
2
2
  import { createSpotifyClient } from "./client.mjs";
3
- import { t as spotifyOperation } from "./factory-C3uQLYXY.mjs";
3
+ import { t as spotifyOperation } from "./factory-C9W7aXmR.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/search.ts
@@ -14,7 +14,7 @@ const spotifySearchTypeSchema = z.enum([
14
14
  "audiobook"
15
15
  ]);
16
16
  const search = spotifyOperation({
17
- id: "search_spotify_catalog",
17
+ id: "spotify.search-spotify-catalog",
18
18
  name: "Search Spotify Catalog",
19
19
  description: "Search the Spotify catalog across one or more resource types.",
20
20
  input: z.object({
package/dist/shows.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import * as _keystrokehq_core0 from "@keystrokehq/core";
2
+ import { z } from "zod";
3
3
  import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
4
 
5
5
  //#region src/shows.d.ts
@@ -33,7 +33,7 @@ declare const getShow: _keystrokehq_core0.Operation<z.ZodObject<{
33
33
  uri: z.ZodOptional<z.ZodString>;
34
34
  htmlDescription: z.ZodOptional<z.ZodString>;
35
35
  isExternallyHosted: z.ZodOptional<z.ZodBoolean>;
36
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:spotify", z.ZodObject<{
36
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
37
37
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
38
38
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
39
39
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
@@ -70,7 +70,7 @@ declare const getSeveralShows: _keystrokehq_core0.Operation<z.ZodObject<{
70
70
  htmlDescription: z.ZodOptional<z.ZodString>;
71
71
  isExternallyHosted: z.ZodOptional<z.ZodBoolean>;
72
72
  }, z.core.$strip>>;
73
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:spotify", z.ZodObject<{
73
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
74
74
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
75
75
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
76
76
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
@@ -150,7 +150,7 @@ declare const getShowEpisodes: _keystrokehq_core0.Operation<z.ZodObject<{
150
150
  offset: z.ZodNumber;
151
151
  previousPageToken: z.ZodOptional<z.ZodString>;
152
152
  total: z.ZodOptional<z.ZodNumber>;
153
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:spotify", z.ZodObject<{
153
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
154
154
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
155
155
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
156
156
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
package/dist/shows.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spotifyEpisodePageSchema, spotifyIdSchema, spotifyMarketSchema, spotifyShowSchema } from "./schemas.mjs";
2
2
  import { createSpotifyClient } from "./client.mjs";
3
- import { t as spotifyOperation } from "./factory-C3uQLYXY.mjs";
3
+ import { t as spotifyOperation } from "./factory-C9W7aXmR.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/shows.ts
@@ -21,7 +21,7 @@ const showEpisodesInputSchema = z.object({
21
21
  offset: z.number().int().nonnegative().optional()
22
22
  });
23
23
  const getShow = spotifyOperation({
24
- id: "get_spotify_show",
24
+ id: "spotify.get-spotify-show",
25
25
  name: "Get Spotify Show",
26
26
  description: "Fetch a single Spotify show by ID.",
27
27
  input: showLookupInputSchema,
@@ -31,7 +31,7 @@ const getShow = spotifyOperation({
31
31
  }
32
32
  });
33
33
  const getSeveralShows = spotifyOperation({
34
- id: "get_spotify_several_shows",
34
+ id: "spotify.get-spotify-several-shows",
35
35
  name: "Get Several Spotify Shows",
36
36
  description: "Fetch multiple Spotify shows in a single request.",
37
37
  input: severalShowsInputSchema,
@@ -41,7 +41,7 @@ const getSeveralShows = spotifyOperation({
41
41
  }
42
42
  });
43
43
  const getShowEpisodes = spotifyOperation({
44
- id: "get_spotify_show_episodes",
44
+ id: "spotify.get-spotify-show-episodes",
45
45
  name: "Get Spotify Show Episodes",
46
46
  description: "List episodes for a Spotify show.",
47
47
  input: showEpisodesInputSchema,
package/dist/tracks.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import * as _keystrokehq_core0 from "@keystrokehq/core";
2
+ import { z } from "zod";
3
3
  import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
4
 
5
5
  //#region src/tracks.d.ts
@@ -80,7 +80,7 @@ declare const getTrack: _keystrokehq_core0.Operation<z.ZodObject<{
80
80
  trackNumber: z.ZodOptional<z.ZodNumber>;
81
81
  type: z.ZodLiteral<"track">;
82
82
  uri: z.ZodOptional<z.ZodString>;
83
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:spotify", z.ZodObject<{
83
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
84
84
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
85
85
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
86
86
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
@@ -164,7 +164,7 @@ declare const getSeveralTracks: _keystrokehq_core0.Operation<z.ZodObject<{
164
164
  type: z.ZodLiteral<"track">;
165
165
  uri: z.ZodOptional<z.ZodString>;
166
166
  }, z.core.$strip>>;
167
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:spotify", z.ZodObject<{
167
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
168
168
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
169
169
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
170
170
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
package/dist/tracks.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { spotifyIdSchema, spotifyMarketSchema, spotifyTrackSchema } from "./schemas.mjs";
2
2
  import { createSpotifyClient } from "./client.mjs";
3
- import { t as spotifyOperation } from "./factory-C3uQLYXY.mjs";
3
+ import { t as spotifyOperation } from "./factory-C9W7aXmR.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/tracks.ts
7
7
  const trackIdListSchema = z.array(spotifyIdSchema).min(1).max(50);
8
8
  const severalTracksResponseSchema = z.object({ tracks: z.array(spotifyTrackSchema) });
9
9
  const getTrack = spotifyOperation({
10
- id: "get_spotify_track",
10
+ id: "spotify.get-spotify-track",
11
11
  name: "Get Spotify Track",
12
12
  description: "Fetch a Spotify track by its ID.",
13
13
  input: z.object({
@@ -20,7 +20,7 @@ const getTrack = spotifyOperation({
20
20
  }
21
21
  });
22
22
  const getSeveralTracks = spotifyOperation({
23
- id: "get_spotify_several_tracks",
23
+ id: "spotify.get-spotify-several-tracks",
24
24
  name: "Get Several Spotify Tracks",
25
25
  description: "Fetch multiple Spotify tracks in one request.",
26
26
  input: z.object({
@@ -1,8 +1,7 @@
1
- import { n as spotify } from "./integration-Dzf1u4u-.mjs";
1
+ import { n as spotify } from "./integration-DXXNe4_j.mjs";
2
2
  import { spotifyNewDeviceAddedEventSchema, spotifyPlaylistItemsChangedEventSchema, spotifyRecentlyPlayedTrackAddedEventSchema, spotifySavedItemAddedEventSchema, spotifyUserPlaylistsChangedEventSchema } from "./events.mjs";
3
+ import { BoundTrigger, Operation } from "@keystrokehq/core";
3
4
  import { z } from "zod";
4
- import { BoundTrigger } from "@keystrokehq/core";
5
- import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
6
5
  import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
7
6
 
8
7
  //#region src/triggers.d.ts
package/dist/triggers.mjs CHANGED
@@ -1,9 +1,58 @@
1
- import { t as spotify } from "./integration-BK1PIn1V.mjs";
1
+ import { t as spotify } from "./integration-CrkQTg9q.mjs";
2
2
  import { createSpotifyClient } from "./client.mjs";
3
3
  import { spotifyNewDeviceAddedEventSchema, spotifyPlaylistItemsChangedEventSchema, spotifyRecentlyPlayedTrackAddedEventSchema, spotifySavedItemAddedEventSchema, spotifyUserPlaylistsChangedEventSchema } from "./events.mjs";
4
+ import { Operation } from "@keystrokehq/core";
4
5
  import { z } from "zod";
5
- import { createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
6
+ import { pollingTrigger } from "@keystrokehq/core/trigger";
6
7
 
8
+ //#region ../../packages/integration-authoring/dist/index.mjs
9
+ const IntegrationConfigSchema = z.object({
10
+ id: z.string().min(1),
11
+ name: z.string().min(1),
12
+ description: z.string().optional()
13
+ });
14
+ function resolveMetadata(metadata, defaults) {
15
+ return {
16
+ id: metadata?.id ?? defaults.defaultId,
17
+ description: metadata?.description ?? defaults.defaultDescription
18
+ };
19
+ }
20
+ function resolveAuthorPayload(payload, mapPayload) {
21
+ if (!mapPayload) return payload;
22
+ return mapPayload(payload);
23
+ }
24
+ function createIntegrationTriggerBindingFactory(config) {
25
+ const bind = (options) => {
26
+ const resolvedMetadata = resolveMetadata(options, config);
27
+ const baseTrigger = config.createBaseTrigger(resolvedMetadata);
28
+ const userTransform = options?.transform;
29
+ return baseTrigger({ transform: userTransform || config.mapPayload ? (runtimePayload, request) => {
30
+ const authorPayload = resolveAuthorPayload(runtimePayload, config.mapPayload);
31
+ if (authorPayload === null) throw new Error(`Trigger "${resolvedMetadata.id}" mapPayload returned null after the trigger filter passed; tighten the trigger filter schema.`);
32
+ if (!userTransform) return authorPayload;
33
+ return userTransform(authorPayload, request);
34
+ } : void 0 });
35
+ };
36
+ return Object.freeze(bind);
37
+ }
38
+ function createPollingTriggerBindingFactory(config) {
39
+ return createIntegrationTriggerBindingFactory({
40
+ defaultId: config.defaultId,
41
+ defaultDescription: config.defaultDescription,
42
+ mapPayload: config.mapPayload,
43
+ createBaseTrigger: (metadata) => pollingTrigger({
44
+ id: metadata.id,
45
+ description: metadata.description,
46
+ schedule: config.schedule,
47
+ response: config.response,
48
+ poll: config.poll,
49
+ ...config.credentialSets ? { credentialSets: config.credentialSets } : {},
50
+ ...config.filter ? { filter: config.filter } : {}
51
+ })
52
+ });
53
+ }
54
+
55
+ //#endregion
7
56
  //#region src/triggers.ts
8
57
  const nullableNewDeviceEventSchema = z.union([spotifyNewDeviceAddedEventSchema, z.null()]);
9
58
  const nullablePlaylistItemsChangedEventSchema = z.union([spotifyPlaylistItemsChangedEventSchema, z.null()]);
@@ -18,7 +67,7 @@ function newDeviceAdded(options) {
18
67
  credentialSets: [spotify],
19
68
  response: nullableNewDeviceEventSchema,
20
69
  poll: async (ctx) => {
21
- const device = (await createSpotifyClient(ctx.credentials["keystroke:spotify"]).player.getAvailableDevices()).devices[0];
70
+ const device = (await createSpotifyClient(ctx.credentials["spotify"]).player.getAvailableDevices()).devices[0];
22
71
  return device ? {
23
72
  eventId: `device:${device.id ?? device.name}`,
24
73
  type: "device.added",
@@ -39,7 +88,7 @@ function playlistItemsChanged(options) {
39
88
  credentialSets: [spotify],
40
89
  response: nullablePlaylistItemsChangedEventSchema,
41
90
  poll: async (ctx) => {
42
- const item = (await createSpotifyClient(ctx.credentials["keystroke:spotify"]).playlists.getPlaylistItems(options.playlistId, {
91
+ const item = (await createSpotifyClient(ctx.credentials["spotify"]).playlists.getPlaylistItems(options.playlistId, {
43
92
  market: options.market,
44
93
  limit: options.limit ?? 20
45
94
  })).items[0];
@@ -66,7 +115,7 @@ function userPlaylistsChanged(options) {
66
115
  credentialSets: [spotify],
67
116
  response: nullableUserPlaylistsChangedEventSchema,
68
117
  poll: async (ctx) => {
69
- const playlist = (await createSpotifyClient(ctx.credentials["keystroke:spotify"]).playlists.listMyPlaylists({
118
+ const playlist = (await createSpotifyClient(ctx.credentials["spotify"]).playlists.listMyPlaylists({
70
119
  limit: options?.limit ?? 20,
71
120
  offset: options?.offset
72
121
  })).items[0];
@@ -90,7 +139,7 @@ function recentlyPlayedTrackAdded(options) {
90
139
  credentialSets: [spotify],
91
140
  response: nullableRecentlyPlayedTrackAddedEventSchema,
92
141
  poll: async (ctx) => {
93
- const play = (await createSpotifyClient(ctx.credentials["keystroke:spotify"]).player.getRecentlyPlayed({
142
+ const play = (await createSpotifyClient(ctx.credentials["spotify"]).player.getRecentlyPlayed({
94
143
  limit: options?.limit ?? 1,
95
144
  after: ctx.lastPolledAt ? Date.parse(ctx.lastPolledAt) : void 0
96
145
  })).items[0];
@@ -114,7 +163,7 @@ function savedItemAdded(options) {
114
163
  credentialSets: [spotify],
115
164
  response: nullableSavedItemAddedEventSchema,
116
165
  poll: async (ctx) => {
117
- const client = createSpotifyClient(ctx.credentials["keystroke:spotify"]);
166
+ const client = createSpotifyClient(ctx.credentials["spotify"]);
118
167
  if (options.itemType === "album") {
119
168
  const item = (await client.library.listSavedAlbums({
120
169
  limit: options.limit ?? 1,
package/dist/users.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import * as _keystrokehq_core0 from "@keystrokehq/core";
2
+ import { z } from "zod";
3
3
  import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
4
 
5
5
  //#region src/users.d.ts
@@ -26,7 +26,7 @@ declare const getUser: _keystrokehq_core0.Operation<z.ZodObject<{
26
26
  height: z.ZodNullable<z.ZodNumber>;
27
27
  width: z.ZodNullable<z.ZodNumber>;
28
28
  }, z.core.$strip>>>;
29
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:spotify", z.ZodObject<{
29
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
30
30
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
31
31
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
32
32
  SPOTIFY_ACCESS_TOKEN: z.ZodString;
package/dist/users.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { spotifyIdSchema, spotifyUserSchema } from "./schemas.mjs";
2
2
  import { createSpotifyClient } from "./client.mjs";
3
- import { t as spotifyOperation } from "./factory-C3uQLYXY.mjs";
3
+ import { t as spotifyOperation } from "./factory-C9W7aXmR.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/users.ts
7
7
  const userLookupInputSchema = z.object({ id: spotifyIdSchema });
8
8
  const getUser = spotifyOperation({
9
- id: "get_spotify_user",
9
+ id: "spotify.get-spotify-user",
10
10
  name: "Get Spotify User",
11
11
  description: "Fetch a Spotify user profile by user ID.",
12
12
  input: userLookupInputSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keystrokehq/spotify",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -144,7 +144,6 @@
144
144
  "LICENSE"
145
145
  ],
146
146
  "dependencies": {
147
- "@keystrokehq/integration-authoring": "^0.0.7",
148
147
  "zod": "^4.3.6"
149
148
  },
150
149
  "peerDependencies": {
@@ -155,9 +154,10 @@
155
154
  "tsdown": "^0.20.3",
156
155
  "typescript": "^5.9.3",
157
156
  "vitest": "^4.0.18",
158
- "@keystrokehq/core": "^0.0.8",
157
+ "@keystrokehq/core": "^0.0.12",
158
+ "@keystrokehq/typescript-config": "0.0.0",
159
159
  "@keystrokehq/test-utils": "0.0.0",
160
- "@keystrokehq/typescript-config": "0.0.0"
160
+ "@keystrokehq/integration-authoring": "0.0.9"
161
161
  },
162
162
  "keywords": [
163
163
  "spotify",
@@ -1,8 +0,0 @@
1
- import { t as spotify } from "./integration-BK1PIn1V.mjs";
2
- import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
3
-
4
- //#region src/factory.ts
5
- const spotifyOperation = createOfficialOperationFactory(spotify);
6
-
7
- //#endregion
8
- export { spotifyOperation as t };
@@ -1,78 +0,0 @@
1
- import { defineOfficialIntegration, officialCredentialSetId } from "@keystrokehq/integration-authoring/official";
2
- import { z } from "zod";
3
- import { CredentialSet } from "@keystrokehq/core";
4
-
5
- //#region src/_official/provider-app.ts
6
- const spotifyAppCredentialSet = new CredentialSet({
7
- id: officialCredentialSetId("spotify-app"),
8
- exposure: "platform-only",
9
- name: "Spotify App",
10
- auth: z.object({
11
- clientId: z.string().min(1),
12
- clientSecret: z.string().min(1)
13
- })
14
- });
15
- const spotifyOfficialProviderSeed = {
16
- provider: "spotify",
17
- appRef: "spotify-platform",
18
- displayName: "Spotify Platform",
19
- credentialSetName: "Keystroke Spotify Platform App",
20
- envShape: {
21
- KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID: z.string().optional(),
22
- KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_SECRET: z.string().optional()
23
- },
24
- requiredEnvKeys: ["KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID", "KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_SECRET"],
25
- externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID",
26
- buildCredentials: (env) => ({
27
- clientId: env.KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID,
28
- clientSecret: env.KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_SECRET
29
- })
30
- };
31
-
32
- //#endregion
33
- //#region src/integration.ts
34
- const spotifyAuthSchema = z.object({ SPOTIFY_ACCESS_TOKEN: z.string().min(1) });
35
- const spotifyScopes = [
36
- "user-read-private",
37
- "user-read-email",
38
- "user-read-recently-played",
39
- "user-top-read",
40
- "user-library-read",
41
- "user-library-modify",
42
- "playlist-read-private",
43
- "playlist-read-collaborative",
44
- "playlist-modify-private",
45
- "playlist-modify-public",
46
- "user-read-currently-playing",
47
- "user-modify-playback-state",
48
- "user-read-playback-state",
49
- "user-follow-read",
50
- "user-follow-modify",
51
- "user-read-playback-position",
52
- "ugc-image-upload"
53
- ];
54
- const spotifyOfficialIntegration = {
55
- id: "spotify",
56
- name: "Spotify",
57
- description: "Spotify playback, catalog, playlists, library, and polling triggers for Keystroke workflows",
58
- proxy: { hosts: ["api.spotify.com", "accounts.spotify.com"] },
59
- auth: spotifyAuthSchema,
60
- connections: [{
61
- id: "oauth",
62
- kind: "oauth",
63
- tokenType: "refreshable",
64
- authUrl: "https://accounts.spotify.com/authorize",
65
- tokenUrl: "https://accounts.spotify.com/api/token",
66
- revokeUrl: null,
67
- scopes: [...spotifyScopes],
68
- vault: { accessToken: "SPOTIFY_ACCESS_TOKEN" }
69
- }]
70
- };
71
- const spotifyBundle = defineOfficialIntegration({
72
- ...spotifyOfficialIntegration,
73
- internal: { providerApp: spotifyAppCredentialSet }
74
- });
75
- const spotify = spotifyBundle.credentialSet;
76
-
77
- //#endregion
78
- export { spotifyOfficialProviderSeed as a, spotifyAppCredentialSet as i, spotifyBundle as n, spotifyOfficialIntegration as r, spotify as t };