@keystrokehq/spotify 0.0.9 → 0.0.15

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 (57) hide show
  1. package/dist/_official/index.d.mts +3 -7
  2. package/dist/_official/index.mjs +1 -1
  3. package/dist/albums.d.mts +9 -18
  4. package/dist/albums.mjs +1 -1
  5. package/dist/artists.d.mts +11 -22
  6. package/dist/artists.mjs +1 -1
  7. package/dist/audio-analysis.d.mts +3 -6
  8. package/dist/audio-analysis.mjs +1 -1
  9. package/dist/audio-features.d.mts +5 -10
  10. package/dist/audio-features.mjs +1 -1
  11. package/dist/audiobooks.d.mts +7 -14
  12. package/dist/audiobooks.mjs +1 -1
  13. package/dist/browse.d.mts +3 -6
  14. package/dist/browse.mjs +1 -1
  15. package/dist/categories.d.mts +7 -14
  16. package/dist/categories.mjs +1 -1
  17. package/dist/chapters.d.mts +5 -10
  18. package/dist/chapters.mjs +1 -1
  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 +5 -10
  23. package/dist/episodes.mjs +1 -1
  24. package/dist/factory-DMprpzS1.mjs +8 -0
  25. package/dist/follow.d.mts +9 -18
  26. package/dist/follow.mjs +1 -1
  27. package/dist/genres.d.mts +3 -6
  28. package/dist/genres.mjs +1 -1
  29. package/dist/integration-B5oEi2sg.d.mts +27 -0
  30. package/dist/integration-D9ABjTOP.mjs +51 -0
  31. package/dist/library.d.mts +41 -82
  32. package/dist/library.mjs +1 -1
  33. package/dist/markets.d.mts +3 -6
  34. package/dist/markets.mjs +1 -1
  35. package/dist/me.d.mts +7 -14
  36. package/dist/me.mjs +1 -1
  37. package/dist/player.d.mts +33 -64
  38. package/dist/player.mjs +1 -1
  39. package/dist/playlists.d.mts +29 -58
  40. package/dist/playlists.mjs +1 -1
  41. package/dist/recommendations.d.mts +3 -6
  42. package/dist/recommendations.mjs +1 -1
  43. package/dist/schemas.d.mts +1 -1
  44. package/dist/search.d.mts +4 -7
  45. package/dist/search.mjs +1 -1
  46. package/dist/shows.d.mts +7 -14
  47. package/dist/shows.mjs +1 -1
  48. package/dist/tracks.d.mts +5 -10
  49. package/dist/tracks.mjs +1 -1
  50. package/dist/triggers.d.mts +3 -2
  51. package/dist/triggers.mjs +7 -56
  52. package/dist/users.d.mts +3 -6
  53. package/dist/users.mjs +1 -1
  54. package/package.json +5 -5
  55. package/dist/factory-C9W7aXmR.mjs +0 -7
  56. package/dist/integration-CrkQTg9q.mjs +0 -170
  57. package/dist/integration-DXXNe4_j.d.mts +0 -40
@@ -1,170 +0,0 @@
1
- import { CredentialSet, Operation } from "@keystrokehq/core";
2
- import { z } from "zod";
3
-
4
- //#region ../../packages/integration-authoring/dist/official/runtime.mjs
5
- const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
6
- function getRegistry() {
7
- const globalStore = globalThis;
8
- if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
9
- return globalStore[REGISTRY_KEY];
10
- }
11
- function registerOfficialOperation(operation, metadata) {
12
- getRegistry().set(operation, Object.freeze({ ...metadata }));
13
- }
14
-
15
- //#endregion
16
- //#region ../../packages/integration-authoring/dist/official/index.mjs
17
- const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
18
- function officialCredentialSetId(id) {
19
- return `${OFFICIAL_CREDENTIAL_SET_ID_PREFIX}${id}`;
20
- }
21
- function stripOfficialCredentialSetIdPrefix(id) {
22
- return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
23
- }
24
- /**
25
- * Creates a factory for Keystroke-official integration operations.
26
- *
27
- * It keeps the same flat `run(input, credentials)` ergonomics as the generic
28
- * operation factory, while registering official metadata for builder/runtime
29
- * operation metadata.
30
- */
31
- function createOfficialOperationFactory(credentialSet) {
32
- const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
33
- return (config) => {
34
- const wrappedRun = async (input, ctx) => {
35
- const creds = ctx.credentials[credentialSet.id];
36
- return config.run(input, creds);
37
- };
38
- const operation = new Operation({
39
- id: config.id,
40
- name: config.name,
41
- description: config.description,
42
- input: config.input,
43
- output: config.output,
44
- credentialSets: [credentialSet],
45
- ...config.tags !== void 0 ? { tags: config.tags } : {},
46
- ...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
47
- ...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
48
- ...config.retries !== void 0 ? { retries: config.retries } : {},
49
- ...config.timeout !== void 0 ? { timeout: config.timeout } : {},
50
- ...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
51
- run: wrappedRun
52
- });
53
- registerOfficialOperation(operation, { integrationId });
54
- return operation;
55
- };
56
- }
57
- /**
58
- * Creates an official integration bundle from a single config object.
59
- *
60
- * - Creates the public `CredentialSet` internally.
61
- * - Accepts optional `internal` fields for Keystroke-owned platform credentials.
62
- */
63
- function defineOfficialIntegration(config) {
64
- const internalCredentialSets = config.internal ?? {};
65
- const allInternalCredentialSets = [
66
- ...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
67
- ...internalCredentialSets.providerAppVariants ?? [],
68
- ...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
69
- ...internalCredentialSets.other ?? []
70
- ];
71
- const credentialSet = new CredentialSet({
72
- id: config.id,
73
- name: config.name,
74
- description: config.description,
75
- auth: config.auth,
76
- ...config.connections ? { connections: config.connections } : {},
77
- ...config.proxy ? { proxy: config.proxy } : {},
78
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {}
79
- });
80
- return Object.freeze({
81
- integration: {
82
- id: config.id,
83
- name: config.name,
84
- ...config.description !== void 0 ? { description: config.description } : {},
85
- auth: config.auth,
86
- ...config.proxy ? { proxy: config.proxy } : {},
87
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {},
88
- ...config.connections ? { connections: config.connections } : {}
89
- },
90
- credentialSet,
91
- internalCredentialSets,
92
- allInternalCredentialSets
93
- });
94
- }
95
-
96
- //#endregion
97
- //#region src/_official/provider-app.ts
98
- const spotifyAppCredentialSet = new CredentialSet({
99
- id: officialCredentialSetId("spotify-app"),
100
- exposure: "platform-only",
101
- name: "Spotify App",
102
- auth: z.object({
103
- clientId: z.string().min(1),
104
- clientSecret: z.string().min(1)
105
- })
106
- });
107
- const spotifyOfficialProviderSeed = {
108
- provider: "spotify",
109
- appRef: "spotify-platform",
110
- displayName: "Spotify Platform",
111
- credentialSetName: "Keystroke Spotify Platform App",
112
- envShape: {
113
- KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID: z.string().optional(),
114
- KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_SECRET: z.string().optional()
115
- },
116
- requiredEnvKeys: ["KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID", "KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_SECRET"],
117
- externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID",
118
- buildCredentials: (env) => ({
119
- clientId: env.KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_ID,
120
- clientSecret: env.KEYSTROKE_OFFICIAL_SPOTIFY_CLIENT_SECRET
121
- })
122
- };
123
-
124
- //#endregion
125
- //#region src/integration.ts
126
- const spotifyAuthSchema = z.object({ SPOTIFY_ACCESS_TOKEN: z.string().min(1) });
127
- const spotifyScopes = [
128
- "user-read-private",
129
- "user-read-email",
130
- "user-read-recently-played",
131
- "user-top-read",
132
- "user-library-read",
133
- "user-library-modify",
134
- "playlist-read-private",
135
- "playlist-read-collaborative",
136
- "playlist-modify-private",
137
- "playlist-modify-public",
138
- "user-read-currently-playing",
139
- "user-modify-playback-state",
140
- "user-read-playback-state",
141
- "user-follow-read",
142
- "user-follow-modify",
143
- "user-read-playback-position",
144
- "ugc-image-upload"
145
- ];
146
- const spotifyOfficialIntegration = {
147
- id: "spotify",
148
- name: "Spotify",
149
- description: "Spotify playback, catalog, playlists, library, and polling triggers for Keystroke workflows",
150
- proxy: { hosts: ["api.spotify.com", "accounts.spotify.com"] },
151
- auth: spotifyAuthSchema,
152
- connections: [{
153
- id: "oauth",
154
- kind: "oauth",
155
- tokenType: "refreshable",
156
- authUrl: "https://accounts.spotify.com/authorize",
157
- tokenUrl: "https://accounts.spotify.com/api/token",
158
- revokeUrl: null,
159
- scopes: [...spotifyScopes],
160
- vault: { accessToken: "SPOTIFY_ACCESS_TOKEN" }
161
- }]
162
- };
163
- const spotifyBundle = defineOfficialIntegration({
164
- ...spotifyOfficialIntegration,
165
- internal: { providerApp: spotifyAppCredentialSet }
166
- });
167
- const spotify = spotifyBundle.credentialSet;
168
-
169
- //#endregion
170
- export { spotifyOfficialProviderSeed as a, spotifyAppCredentialSet as i, spotifyBundle as n, createOfficialOperationFactory as o, spotifyOfficialIntegration as r, spotify as t };
@@ -1,40 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
- import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
-
6
- //#region src/integration.d.ts
7
- declare const spotifyOfficialIntegration: {
8
- id: "spotify";
9
- name: string;
10
- description: string;
11
- proxy: {
12
- hosts: string[];
13
- };
14
- auth: z.ZodObject<{
15
- SPOTIFY_ACCESS_TOKEN: z.ZodString;
16
- }, z.core.$strip>;
17
- connections: {
18
- id: string;
19
- kind: "oauth";
20
- tokenType: "refreshable";
21
- authUrl: string;
22
- tokenUrl: string;
23
- revokeUrl: null;
24
- scopes: ("user-read-private" | "user-read-email" | "user-read-recently-played" | "user-top-read" | "user-library-read" | "user-library-modify" | "playlist-read-private" | "playlist-read-collaborative" | "playlist-modify-private" | "playlist-modify-public" | "user-read-currently-playing" | "user-modify-playback-state" | "user-read-playback-state" | "user-follow-read" | "user-follow-modify" | "user-read-playback-position" | "ugc-image-upload")[];
25
- vault: {
26
- accessToken: "SPOTIFY_ACCESS_TOKEN";
27
- };
28
- }[];
29
- };
30
- declare const spotifyBundle: undefined<"spotify", z.ZodObject<{
31
- SPOTIFY_ACCESS_TOKEN: z.ZodString;
32
- }, z.core.$strip>>;
33
- declare const spotify: _keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
34
- SPOTIFY_ACCESS_TOKEN: z.ZodString;
35
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
36
- SPOTIFY_ACCESS_TOKEN: z.ZodString;
37
- }, z.core.$strip>>[] | undefined>;
38
- type SpotifyCredentials = InferCredentialSetAuth<typeof spotify>;
39
- //#endregion
40
- export { spotifyOfficialIntegration as i, spotify as n, spotifyBundle as r, SpotifyCredentials as t };