@cesteral/tiktok-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/LICENSE.md +201 -0
  2. package/README.md +347 -0
  3. package/dist/auth/index.d.ts +3 -0
  4. package/dist/auth/index.d.ts.map +1 -0
  5. package/dist/auth/index.js +3 -0
  6. package/dist/auth/index.js.map +1 -0
  7. package/dist/auth/tiktok-auth-adapter.d.ts +40 -0
  8. package/dist/auth/tiktok-auth-adapter.d.ts.map +1 -0
  9. package/dist/auth/tiktok-auth-adapter.js +126 -0
  10. package/dist/auth/tiktok-auth-adapter.js.map +1 -0
  11. package/dist/auth/tiktok-auth-strategy.d.ts +14 -0
  12. package/dist/auth/tiktok-auth-strategy.d.ts.map +1 -0
  13. package/dist/auth/tiktok-auth-strategy.js +54 -0
  14. package/dist/auth/tiktok-auth-strategy.js.map +1 -0
  15. package/dist/config/index.d.ts +120 -0
  16. package/dist/config/index.d.ts.map +1 -0
  17. package/dist/config/index.js +55 -0
  18. package/dist/config/index.js.map +1 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +47 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.d.ts +4 -0
  24. package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.d.ts.map +1 -0
  25. package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.js +127 -0
  26. package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.js.map +1 -0
  27. package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.d.ts +4 -0
  28. package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.d.ts.map +1 -0
  29. package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.js +104 -0
  30. package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.js.map +1 -0
  31. package/dist/mcp-server/prompts/definitions/creative-upload-workflow.prompt.d.ts +4 -0
  32. package/dist/mcp-server/prompts/definitions/creative-upload-workflow.prompt.d.ts.map +1 -0
  33. package/dist/mcp-server/prompts/definitions/creative-upload-workflow.prompt.js +121 -0
  34. package/dist/mcp-server/prompts/definitions/creative-upload-workflow.prompt.js.map +1 -0
  35. package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.d.ts +4 -0
  36. package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.d.ts.map +1 -0
  37. package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.js +299 -0
  38. package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.js.map +1 -0
  39. package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.d.ts +4 -0
  40. package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.d.ts.map +1 -0
  41. package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.js +170 -0
  42. package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.js.map +1 -0
  43. package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.d.ts +4 -0
  44. package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.d.ts.map +1 -0
  45. package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.js +198 -0
  46. package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.js.map +1 -0
  47. package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.d.ts +4 -0
  48. package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.d.ts.map +1 -0
  49. package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.js +189 -0
  50. package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.js.map +1 -0
  51. package/dist/mcp-server/prompts/definitions/reporting-workflow.prompt.d.ts +4 -0
  52. package/dist/mcp-server/prompts/definitions/reporting-workflow.prompt.d.ts.map +1 -0
  53. package/dist/mcp-server/prompts/definitions/reporting-workflow.prompt.js +126 -0
  54. package/dist/mcp-server/prompts/definitions/reporting-workflow.prompt.js.map +1 -0
  55. package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.d.ts +4 -0
  56. package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.d.ts.map +1 -0
  57. package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.js +200 -0
  58. package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.js.map +1 -0
  59. package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.d.ts +4 -0
  60. package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.d.ts.map +1 -0
  61. package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.js +93 -0
  62. package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.js.map +1 -0
  63. package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.d.ts +4 -0
  64. package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.d.ts.map +1 -0
  65. package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.js +111 -0
  66. package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.js.map +1 -0
  67. package/dist/mcp-server/prompts/index.d.ts +9 -0
  68. package/dist/mcp-server/prompts/index.d.ts.map +1 -0
  69. package/dist/mcp-server/prompts/index.js +97 -0
  70. package/dist/mcp-server/prompts/index.js.map +1 -0
  71. package/dist/mcp-server/resources/definitions/entity-examples.resource.d.ts +4 -0
  72. package/dist/mcp-server/resources/definitions/entity-examples.resource.d.ts.map +1 -0
  73. package/dist/mcp-server/resources/definitions/entity-examples.resource.js +182 -0
  74. package/dist/mcp-server/resources/definitions/entity-examples.resource.js.map +1 -0
  75. package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.d.ts +3 -0
  76. package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.d.ts.map +1 -0
  77. package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.js +147 -0
  78. package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.js.map +1 -0
  79. package/dist/mcp-server/resources/definitions/entity-schemas.resource.d.ts +4 -0
  80. package/dist/mcp-server/resources/definitions/entity-schemas.resource.d.ts.map +1 -0
  81. package/dist/mcp-server/resources/definitions/entity-schemas.resource.js +135 -0
  82. package/dist/mcp-server/resources/definitions/entity-schemas.resource.js.map +1 -0
  83. package/dist/mcp-server/resources/definitions/index.d.ts +8 -0
  84. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  85. package/dist/mcp-server/resources/definitions/index.js +79 -0
  86. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  87. package/dist/mcp-server/resources/definitions/reporting-reference.resource.d.ts +3 -0
  88. package/dist/mcp-server/resources/definitions/reporting-reference.resource.d.ts.map +1 -0
  89. package/dist/mcp-server/resources/definitions/reporting-reference.resource.js +165 -0
  90. package/dist/mcp-server/resources/definitions/reporting-reference.resource.js.map +1 -0
  91. package/dist/mcp-server/resources/definitions/targeting-reference.resource.d.ts +3 -0
  92. package/dist/mcp-server/resources/definitions/targeting-reference.resource.d.ts.map +1 -0
  93. package/dist/mcp-server/resources/definitions/targeting-reference.resource.js +134 -0
  94. package/dist/mcp-server/resources/definitions/targeting-reference.resource.js.map +1 -0
  95. package/dist/mcp-server/resources/index.d.ts +3 -0
  96. package/dist/mcp-server/resources/index.d.ts.map +1 -0
  97. package/dist/mcp-server/resources/index.js +2 -0
  98. package/dist/mcp-server/resources/index.js.map +1 -0
  99. package/dist/mcp-server/resources/types.d.ts +8 -0
  100. package/dist/mcp-server/resources/types.d.ts.map +1 -0
  101. package/dist/mcp-server/resources/types.js +2 -0
  102. package/dist/mcp-server/resources/types.js.map +1 -0
  103. package/dist/mcp-server/server.d.ts +5 -0
  104. package/dist/mcp-server/server.d.ts.map +1 -0
  105. package/dist/mcp-server/server.js +134 -0
  106. package/dist/mcp-server/server.js.map +1 -0
  107. package/dist/mcp-server/tools/definitions/adjust-bids.tool.d.ts +209 -0
  108. package/dist/mcp-server/tools/definitions/adjust-bids.tool.d.ts.map +1 -0
  109. package/dist/mcp-server/tools/definitions/adjust-bids.tool.js +141 -0
  110. package/dist/mcp-server/tools/definitions/adjust-bids.tool.js.map +1 -0
  111. package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.d.ts +151 -0
  112. package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.d.ts.map +1 -0
  113. package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.js +112 -0
  114. package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.js.map +1 -0
  115. package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.d.ts +193 -0
  116. package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.d.ts.map +1 -0
  117. package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.js +130 -0
  118. package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.js.map +1 -0
  119. package/dist/mcp-server/tools/definitions/bulk-update-status.tool.d.ts +153 -0
  120. package/dist/mcp-server/tools/definitions/bulk-update-status.tool.d.ts.map +1 -0
  121. package/dist/mcp-server/tools/definitions/bulk-update-status.tool.js +137 -0
  122. package/dist/mcp-server/tools/definitions/bulk-update-status.tool.js.map +1 -0
  123. package/dist/mcp-server/tools/definitions/check-report-status.tool.d.ts +119 -0
  124. package/dist/mcp-server/tools/definitions/check-report-status.tool.d.ts.map +1 -0
  125. package/dist/mcp-server/tools/definitions/check-report-status.tool.js +89 -0
  126. package/dist/mcp-server/tools/definitions/check-report-status.tool.js.map +1 -0
  127. package/dist/mcp-server/tools/definitions/create-entity.tool.d.ts +115 -0
  128. package/dist/mcp-server/tools/definitions/create-entity.tool.d.ts.map +1 -0
  129. package/dist/mcp-server/tools/definitions/create-entity.tool.js +103 -0
  130. package/dist/mcp-server/tools/definitions/create-entity.tool.js.map +1 -0
  131. package/dist/mcp-server/tools/definitions/delete-entity.tool.d.ts +100 -0
  132. package/dist/mcp-server/tools/definitions/delete-entity.tool.d.ts.map +1 -0
  133. package/dist/mcp-server/tools/definitions/delete-entity.tool.js +110 -0
  134. package/dist/mcp-server/tools/definitions/delete-entity.tool.js.map +1 -0
  135. package/dist/mcp-server/tools/definitions/download-report.tool.d.ts +297 -0
  136. package/dist/mcp-server/tools/definitions/download-report.tool.d.ts.map +1 -0
  137. package/dist/mcp-server/tools/definitions/download-report.tool.js +105 -0
  138. package/dist/mcp-server/tools/definitions/download-report.tool.js.map +1 -0
  139. package/dist/mcp-server/tools/definitions/duplicate-entity.tool.d.ts +105 -0
  140. package/dist/mcp-server/tools/definitions/duplicate-entity.tool.d.ts.map +1 -0
  141. package/dist/mcp-server/tools/definitions/duplicate-entity.tool.js +85 -0
  142. package/dist/mcp-server/tools/definitions/duplicate-entity.tool.js.map +1 -0
  143. package/dist/mcp-server/tools/definitions/get-ad-preview.tool.d.ts +89 -0
  144. package/dist/mcp-server/tools/definitions/get-ad-preview.tool.d.ts.map +1 -0
  145. package/dist/mcp-server/tools/definitions/get-ad-preview.tool.js +74 -0
  146. package/dist/mcp-server/tools/definitions/get-ad-preview.tool.js.map +1 -0
  147. package/dist/mcp-server/tools/definitions/get-ad-previews.tool.d.ts +89 -0
  148. package/dist/mcp-server/tools/definitions/get-ad-previews.tool.d.ts.map +1 -0
  149. package/dist/mcp-server/tools/definitions/get-ad-previews.tool.js +83 -0
  150. package/dist/mcp-server/tools/definitions/get-ad-previews.tool.js.map +1 -0
  151. package/dist/mcp-server/tools/definitions/get-audience-estimate.tool.d.ts +85 -0
  152. package/dist/mcp-server/tools/definitions/get-audience-estimate.tool.d.ts.map +1 -0
  153. package/dist/mcp-server/tools/definitions/get-audience-estimate.tool.js +88 -0
  154. package/dist/mcp-server/tools/definitions/get-audience-estimate.tool.js.map +1 -0
  155. package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts +76 -0
  156. package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts.map +1 -0
  157. package/dist/mcp-server/tools/definitions/get-entity.tool.js +71 -0
  158. package/dist/mcp-server/tools/definitions/get-entity.tool.js.map +1 -0
  159. package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.d.ts +295 -0
  160. package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.d.ts.map +1 -0
  161. package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.js +174 -0
  162. package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.js.map +1 -0
  163. package/dist/mcp-server/tools/definitions/get-report.tool.d.ts +303 -0
  164. package/dist/mcp-server/tools/definitions/get-report.tool.d.ts.map +1 -0
  165. package/dist/mcp-server/tools/definitions/get-report.tool.js +178 -0
  166. package/dist/mcp-server/tools/definitions/get-report.tool.js.map +1 -0
  167. package/dist/mcp-server/tools/definitions/get-targeting-options.tool.d.ts +127 -0
  168. package/dist/mcp-server/tools/definitions/get-targeting-options.tool.d.ts.map +1 -0
  169. package/dist/mcp-server/tools/definitions/get-targeting-options.tool.js +120 -0
  170. package/dist/mcp-server/tools/definitions/get-targeting-options.tool.js.map +1 -0
  171. package/dist/mcp-server/tools/definitions/index.d.ts +26 -0
  172. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  173. package/dist/mcp-server/tools/definitions/index.js +78 -0
  174. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  175. package/dist/mcp-server/tools/definitions/list-advertisers.tool.d.ts +54 -0
  176. package/dist/mcp-server/tools/definitions/list-advertisers.tool.d.ts.map +1 -0
  177. package/dist/mcp-server/tools/definitions/list-advertisers.tool.js +58 -0
  178. package/dist/mcp-server/tools/definitions/list-advertisers.tool.js.map +1 -0
  179. package/dist/mcp-server/tools/definitions/list-entities.tool.d.ts +167 -0
  180. package/dist/mcp-server/tools/definitions/list-entities.tool.d.ts.map +1 -0
  181. package/dist/mcp-server/tools/definitions/list-entities.tool.js +114 -0
  182. package/dist/mcp-server/tools/definitions/list-entities.tool.js.map +1 -0
  183. package/dist/mcp-server/tools/definitions/search-targeting.tool.d.ts +131 -0
  184. package/dist/mcp-server/tools/definitions/search-targeting.tool.d.ts.map +1 -0
  185. package/dist/mcp-server/tools/definitions/search-targeting.tool.js +123 -0
  186. package/dist/mcp-server/tools/definitions/search-targeting.tool.js.map +1 -0
  187. package/dist/mcp-server/tools/definitions/submit-report.tool.d.ts +153 -0
  188. package/dist/mcp-server/tools/definitions/submit-report.tool.d.ts.map +1 -0
  189. package/dist/mcp-server/tools/definitions/submit-report.tool.js +117 -0
  190. package/dist/mcp-server/tools/definitions/submit-report.tool.js.map +1 -0
  191. package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts +111 -0
  192. package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts.map +1 -0
  193. package/dist/mcp-server/tools/definitions/update-entity.tool.js +89 -0
  194. package/dist/mcp-server/tools/definitions/update-entity.tool.js.map +1 -0
  195. package/dist/mcp-server/tools/definitions/upload-image.tool.d.ts +87 -0
  196. package/dist/mcp-server/tools/definitions/upload-image.tool.d.ts.map +1 -0
  197. package/dist/mcp-server/tools/definitions/upload-image.tool.js +82 -0
  198. package/dist/mcp-server/tools/definitions/upload-image.tool.js.map +1 -0
  199. package/dist/mcp-server/tools/definitions/upload-video.tool.d.ts +88 -0
  200. package/dist/mcp-server/tools/definitions/upload-video.tool.d.ts.map +1 -0
  201. package/dist/mcp-server/tools/definitions/upload-video.tool.js +113 -0
  202. package/dist/mcp-server/tools/definitions/upload-video.tool.js.map +1 -0
  203. package/dist/mcp-server/tools/definitions/validate-entity.tool.d.ts +197 -0
  204. package/dist/mcp-server/tools/definitions/validate-entity.tool.d.ts.map +1 -0
  205. package/dist/mcp-server/tools/definitions/validate-entity.tool.js +237 -0
  206. package/dist/mcp-server/tools/definitions/validate-entity.tool.js.map +1 -0
  207. package/dist/mcp-server/tools/index.d.ts +2 -0
  208. package/dist/mcp-server/tools/index.d.ts.map +1 -0
  209. package/dist/mcp-server/tools/index.js +2 -0
  210. package/dist/mcp-server/tools/index.js.map +1 -0
  211. package/dist/mcp-server/tools/utils/entity-mapping.d.ts +22 -0
  212. package/dist/mcp-server/tools/utils/entity-mapping.d.ts.map +1 -0
  213. package/dist/mcp-server/tools/utils/entity-mapping.js +121 -0
  214. package/dist/mcp-server/tools/utils/entity-mapping.js.map +1 -0
  215. package/dist/mcp-server/tools/utils/resolve-session.d.ts +4 -0
  216. package/dist/mcp-server/tools/utils/resolve-session.d.ts.map +1 -0
  217. package/dist/mcp-server/tools/utils/resolve-session.js +6 -0
  218. package/dist/mcp-server/tools/utils/resolve-session.js.map +1 -0
  219. package/dist/mcp-server/transports/streamable-http-transport.d.ts +59 -0
  220. package/dist/mcp-server/transports/streamable-http-transport.d.ts.map +1 -0
  221. package/dist/mcp-server/transports/streamable-http-transport.js +107 -0
  222. package/dist/mcp-server/transports/streamable-http-transport.js.map +1 -0
  223. package/dist/services/session-services.d.ts +21 -0
  224. package/dist/services/session-services.d.ts.map +1 -0
  225. package/dist/services/session-services.js +25 -0
  226. package/dist/services/session-services.js.map +1 -0
  227. package/dist/services/tiktok/tiktok-http-client.d.ts +19 -0
  228. package/dist/services/tiktok/tiktok-http-client.d.ts.map +1 -0
  229. package/dist/services/tiktok/tiktok-http-client.js +184 -0
  230. package/dist/services/tiktok/tiktok-http-client.js.map +1 -0
  231. package/dist/services/tiktok/tiktok-reporting-service.d.ts +62 -0
  232. package/dist/services/tiktok/tiktok-reporting-service.d.ts.map +1 -0
  233. package/dist/services/tiktok/tiktok-reporting-service.js +129 -0
  234. package/dist/services/tiktok/tiktok-reporting-service.js.map +1 -0
  235. package/dist/services/tiktok/tiktok-service.d.ts +86 -0
  236. package/dist/services/tiktok/tiktok-service.d.ts.map +1 -0
  237. package/dist/services/tiktok/tiktok-service.js +217 -0
  238. package/dist/services/tiktok/tiktok-service.js.map +1 -0
  239. package/dist/services/tiktok/types.d.ts +161 -0
  240. package/dist/services/tiktok/types.d.ts.map +1 -0
  241. package/dist/services/tiktok/types.js +31 -0
  242. package/dist/services/tiktok/types.js.map +1 -0
  243. package/dist/types-global/mcp.d.ts +2 -0
  244. package/dist/types-global/mcp.d.ts.map +1 -0
  245. package/dist/types-global/mcp.js +2 -0
  246. package/dist/types-global/mcp.js.map +1 -0
  247. package/dist/utils/errors/index.d.ts +2 -0
  248. package/dist/utils/errors/index.d.ts.map +1 -0
  249. package/dist/utils/errors/index.js +2 -0
  250. package/dist/utils/errors/index.js.map +1 -0
  251. package/dist/utils/platform.d.ts +3 -0
  252. package/dist/utils/platform.d.ts.map +1 -0
  253. package/dist/utils/platform.js +5 -0
  254. package/dist/utils/platform.js.map +1 -0
  255. package/dist/utils/security/rate-limiter.d.ts +3 -0
  256. package/dist/utils/security/rate-limiter.d.ts.map +1 -0
  257. package/dist/utils/security/rate-limiter.js +5 -0
  258. package/dist/utils/security/rate-limiter.js.map +1 -0
  259. package/dist/utils/telemetry/index.d.ts +2 -0
  260. package/dist/utils/telemetry/index.d.ts.map +1 -0
  261. package/dist/utils/telemetry/index.js +2 -0
  262. package/dist/utils/telemetry/index.js.map +1 -0
  263. package/dist/utils/telemetry/tracing.d.ts +3 -0
  264. package/dist/utils/telemetry/tracing.d.ts.map +1 -0
  265. package/dist/utils/telemetry/tracing.js +4 -0
  266. package/dist/utils/telemetry/tracing.js.map +1 -0
  267. package/package.json +55 -0
package/LICENSE.md ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,347 @@
1
+ # @cesteral/tiktok-mcp
2
+
3
+ TikTok Ads MCP Server - Campaign management and reporting via TikTok Marketing API v1.3.
4
+
5
+ ## Purpose
6
+
7
+ Management server for TikTok Ads. Provides full CRUD operations, async
8
+ reporting, targeting discovery, bulk operations, and specialized features like
9
+ entity duplication and audience estimation. Designed for AI agents to manage
10
+ TikTok Ads campaigns programmatically through the Model Context Protocol with
11
+ per-session Bearer token authentication.
12
+
13
+ ## Features
14
+
15
+ - **Per-session Bearer token auth** via `TikTokBearerAuthStrategy` (validates tokens and extracts advertiser ID)
16
+ - **Streamable HTTP + stdio transports** via Hono + `@hono/mcp`
17
+ - **OpenTelemetry** instrumentation for traces and metrics
18
+ - **Rate limiting** via shared `RateLimiter` class (100/min default)
19
+ - **Structured logging** via Pino
20
+ - **Automatic `advertiser_id` injection** into GET query params and POST request bodies
21
+
22
+ ## MCP Tools
23
+
24
+ ### Core CRUD
25
+
26
+ #### 1. `tiktok_list_entities`
27
+
28
+ List TikTok Ads entities with page-based pagination and optional filtering.
29
+
30
+ **Parameters:**
31
+
32
+ - `entityType` (string, required): Type of entity to list
33
+ - `advertiserId` (string, required): TikTok Advertiser ID
34
+ - `filters` (object, optional): Filter criteria for the entity list
35
+ - `page` (number, optional): Page number for pagination
36
+ - `pageSize` (number, optional): Results per page
37
+
38
+ #### 2. `tiktok_get_entity`
39
+
40
+ Get a single TikTok Ads entity by ID.
41
+
42
+ **Parameters:**
43
+
44
+ - `entityType` (string, required): Type of entity to retrieve
45
+ - `advertiserId` (string, required): TikTok Advertiser ID
46
+ - `entityId` (string, required): The entity ID
47
+
48
+ #### 3. `tiktok_create_entity`
49
+
50
+ Create a new TikTok Ads entity.
51
+
52
+ **Parameters:**
53
+
54
+ - `entityType` (string, required): Type of entity to create
55
+ - `advertiserId` (string, required): TikTok Advertiser ID
56
+ - `data` (object, required): Entity fields as key-value pairs
57
+
58
+ #### 4. `tiktok_update_entity`
59
+
60
+ Update an existing TikTok Ads entity.
61
+
62
+ **Parameters:**
63
+
64
+ - `entityType` (string, required): Type of entity to update
65
+ - `advertiserId` (string, required): TikTok Advertiser ID
66
+ - `entityId` (string, required): The entity ID to update
67
+ - `data` (object, required): Fields to update as key-value pairs
68
+
69
+ #### 5. `tiktok_delete_entity`
70
+
71
+ Delete TikTok Ads entities.
72
+
73
+ **Parameters:**
74
+
75
+ - `entityType` (string, required): Type of entities to delete
76
+ - `advertiserId` (string, required): TikTok Advertiser ID
77
+ - `entityIds` (string[], required): Entity IDs to delete (max 20)
78
+
79
+ ### Account
80
+
81
+ #### 6. `tiktok_list_advertisers`
82
+
83
+ List advertiser accounts accessible to the authenticated user.
84
+
85
+ **Parameters:** _(none)_
86
+
87
+ ### Reporting
88
+
89
+ > All TikTok reporting tools return data using the shared bounded report-view contract: `mode` (`"summary"` default — headers + counts + 10-row preview, or `"rows"` for a paginated rows page), `columns` (project to selected columns), `offset` (zero-based pagination), and `maxRows` (page size; default 10 for summary, 50 for rows; hard cap 200).
90
+
91
+ #### 7. `tiktok_get_report`
92
+
93
+ Submit an async report and download results once complete.
94
+
95
+ **Parameters:**
96
+
97
+ - `advertiserId` (string, required): TikTok Advertiser ID
98
+ - `dimensions` (string[], required): Report dimensions (e.g., `campaign_id`, `adgroup_id`)
99
+ - `metrics` (string[], required): Metrics to include (e.g., `spend`, `impressions`, `clicks`)
100
+ - `startDate` (string, required): Start date (YYYY-MM-DD)
101
+ - `endDate` (string, required): End date (YYYY-MM-DD)
102
+ - `mode`, `columns`, `offset`, `maxRows` (optional): Bounded report-view params (see note above)
103
+
104
+ #### 8. `tiktok_get_report_breakdowns`
105
+
106
+ Submit a report with additional breakdown dimensions.
107
+
108
+ **Parameters:**
109
+
110
+ - `advertiserId` (string, required): TikTok Advertiser ID
111
+ - `dimensions` (string[], required): Primary dimensions
112
+ - `breakdowns` (string[], required): Breakdown dimensions (e.g., `age`, `gender`, `country`)
113
+ - `metrics` (string[], required): Metrics to include
114
+ - `startDate` (string, required): Start date (YYYY-MM-DD)
115
+ - `endDate` (string, required): End date (YYYY-MM-DD)
116
+ - `mode`, `columns`, `offset`, `maxRows` (optional): Bounded report-view params (see note above)
117
+
118
+ #### 9. `tiktok_submit_report`
119
+
120
+ Submit an async report without waiting for completion (non-blocking).
121
+
122
+ **Parameters:**
123
+
124
+ - `advertiserId` (string, required): TikTok Advertiser ID
125
+ - `dimensions` (string[], required): Report dimensions
126
+ - `metrics` (string[], required): Metrics to include
127
+ - `startDate` (string, required): Start date (YYYY-MM-DD)
128
+ - `endDate` (string, required): End date (YYYY-MM-DD)
129
+
130
+ #### 10. `tiktok_check_report_status`
131
+
132
+ Single status check for a submitted report.
133
+
134
+ **Parameters:**
135
+
136
+ - `advertiserId` (string, required): TikTok Advertiser ID
137
+ - `taskId` (string, required): Report task ID from submit
138
+
139
+ #### 11. `tiktok_download_report`
140
+
141
+ Download and parse report CSV from URL.
142
+
143
+ **Parameters:**
144
+
145
+ - `downloadUrl` (string, required): Report download URL
146
+ - `mode`, `columns`, `offset`, `maxRows` (optional): Bounded report-view params (see note above the reporting tools)
147
+
148
+ ### Bulk Operations
149
+
150
+ #### 12. `tiktok_bulk_update_status`
151
+
152
+ Batch enable, disable, or delete multiple entities.
153
+
154
+ **Parameters:**
155
+
156
+ - `entityType` (string, required): Type of entities to update
157
+ - `advertiserId` (string, required): TikTok Advertiser ID
158
+ - `entityIds` (string[], required): Entity IDs to update (max 50)
159
+ - `operationStatus` (string, required): `ENABLE`, `DISABLE`, or `DELETE`
160
+
161
+ #### 13. `tiktok_bulk_create_entities`
162
+
163
+ Batch create multiple entities of the same type.
164
+
165
+ **Parameters:**
166
+
167
+ - `entityType` (string, required): Type of entities to create
168
+ - `advertiserId` (string, required): TikTok Advertiser ID
169
+ - `items` (array, required): Array of entity data objects (max 50)
170
+
171
+ #### 14. `tiktok_bulk_update_entities`
172
+
173
+ Batch update multiple entities with individual data payloads.
174
+
175
+ **Parameters:**
176
+
177
+ - `entityType` (string, required): Type of entities to update
178
+ - `advertiserId` (string, required): TikTok Advertiser ID
179
+ - `items` (array, required): Array of update items (max 50), each with entity ID and data
180
+
181
+ ### Bid Adjustment
182
+
183
+ #### 15. `tiktok_adjust_bids`
184
+
185
+ Batch adjust ad group bid prices with safe read-modify-write pattern.
186
+
187
+ **Parameters:**
188
+
189
+ - `advertiserId` (string, required): TikTok Advertiser ID
190
+ - `adjustments` (array, required): Array of bid adjustments, each with ad group ID, adjustment type, and value
191
+
192
+ ### Targeting
193
+
194
+ #### 16. `tiktok_search_targeting`
195
+
196
+ Search for targeting options (interest categories, behaviors, demographics) by keyword.
197
+
198
+ **Parameters:**
199
+
200
+ - `advertiserId` (string, required): TikTok Advertiser ID
201
+ - `targetingType` (string, required): Type of targeting to search
202
+ - `query` (string, optional): Search keyword
203
+
204
+ #### 17. `tiktok_get_targeting_options`
205
+
206
+ Browse available targeting categories.
207
+
208
+ **Parameters:**
209
+
210
+ - `advertiserId` (string, required): TikTok Advertiser ID
211
+ - `targetingType` (string, optional): Filter by targeting type
212
+
213
+ ### Specialized
214
+
215
+ #### 18. `tiktok_duplicate_entity`
216
+
217
+ Duplicate a campaign, ad group, or ad.
218
+
219
+ **Parameters:**
220
+
221
+ - `entityType` (string, required): Type of entity to duplicate (`campaign`, `adGroup`, `ad`)
222
+ - `advertiserId` (string, required): TikTok Advertiser ID
223
+ - `entityId` (string, required): ID of the entity to duplicate
224
+ - `options` (object, optional): Duplication options (e.g., rename prefix/suffix)
225
+
226
+ #### 19. `tiktok_get_audience_estimate`
227
+
228
+ Get estimated audience size for a targeting configuration.
229
+
230
+ **Parameters:**
231
+
232
+ - `advertiserId` (string, required): TikTok Advertiser ID
233
+ - `targetingConfig` (object, required): Targeting specification for estimation
234
+
235
+ #### 20. `tiktok_get_ad_preview`
236
+
237
+ Get ad preview for video or image ads.
238
+
239
+ **Parameters:**
240
+
241
+ - `advertiserId` (string, required): TikTok Advertiser ID
242
+ - `adId` (string, required): Ad ID to preview
243
+ - `adFormat` (string, optional): Ad format for preview rendering
244
+
245
+ ### Validation
246
+
247
+ #### 21. `tiktok_validate_entity`
248
+
249
+ Client-side validation of entity payloads without making API calls.
250
+
251
+ **Parameters:**
252
+
253
+ - `entityType` (string, required): Type of entity to validate
254
+ - `mode` (string, required): Validation mode (`create` or `update`)
255
+ - `data` (object, required): Entity data to validate
256
+
257
+ ## Supported Entity Types
258
+
259
+ | Entity Type | API Object | Notes |
260
+ | ----------- | ---------- | ----------------------------------------------- |
261
+ | `campaign` | Campaign | Top-level entity under advertiser account |
262
+ | `adGroup` | Ad Group | Targeting, budget, schedule, bidding, placement |
263
+ | `ad` | Ad | Links creative content to ad group |
264
+ | `creative` | Creative | Video/image creative assets |
265
+
266
+ **Entity Hierarchy:** Advertiser > Campaign > Ad Group > Ad (+ Creatives)
267
+
268
+ ## Current Status
269
+
270
+ **Phase: Production-Ready**
271
+
272
+ All listed tools are fully implemented using TikTok Marketing API v1.3 with
273
+ Bearer token authentication, async reporting, and targeting discovery.
274
+
275
+ ## Development
276
+
277
+ ```bash
278
+ # Install dependencies
279
+ pnpm install
280
+
281
+ # Run in development mode
282
+ pnpm run dev:http
283
+
284
+ # Build
285
+ pnpm run build
286
+
287
+ # Start production server
288
+ pnpm run start
289
+
290
+ # Type check
291
+ pnpm run typecheck
292
+ ```
293
+
294
+ ## Environment Variables
295
+
296
+ - `TIKTOK_MCP_PORT`: Server port (default: 3007)
297
+ - `TIKTOK_MCP_HOST`: Server host (default: `127.0.0.1` in development, `0.0.0.0` in production)
298
+ - `MCP_AUTH_MODE`: Authentication mode - `tiktok-bearer` (default), `jwt`, or `none`
299
+ - `MCP_AUTH_SECRET_KEY`: Required when `MCP_AUTH_MODE=jwt`
300
+ - `TIKTOK_API_BASE_URL`: TikTok Business API base URL (default: `https://business-api.tiktok.com`)
301
+ - `TIKTOK_API_VERSION`: API version (default: `v1.3`)
302
+ - `TIKTOK_RATE_LIMIT_PER_MINUTE`: Rate limit ceiling (default: 100)
303
+ - `TIKTOK_ACCESS_TOKEN`: Access token for stdio mode
304
+ - `TIKTOK_ADVERTISER_ID`: Advertiser ID for stdio mode
305
+
306
+ ## Architecture
307
+
308
+ ### Key Components
309
+
310
+ - **`TikTokHttpClient`** - HTTP client for TikTok Marketing API v1.3
311
+ - **`TikTokService`** - CRUD, bulk ops, duplication, targeting, audience estimates, ad previews
312
+ - **`TikTokReportingService`** - Async report submission, polling, and download
313
+ - **`TikTokBearerAuthStrategy`** - Bearer token + advertiser ID auth
314
+ - **`TikTokAuthAdapter`** - Token + advertiser ID management for per-session API calls
315
+ - **`SessionServiceStore`** - Per-session service instances keyed by session ID
316
+
317
+ ### Key Gotchas
318
+
319
+ - `advertiser_id` is automatically injected into GET query params and POST request bodies
320
+ - Uses page-based pagination (`page`/`page_size`) not cursor-based
321
+ - Reporting is async: submit report -> poll for completion -> download results
322
+ - Delete operations accept max 20 entity IDs per call
323
+ - `DISABLE` status is used instead of `PAUSED` (TikTok-specific terminology)
324
+
325
+ ### Transport
326
+
327
+ Streamable HTTP via Hono + `@hono/mcp`. Health check at `/health`.
328
+
329
+ ## Contributing
330
+
331
+ See root [CLAUDE.md](../../CLAUDE.md) for development guidelines, build system details, and monorepo conventions. See the [root README](../../README.md) for full architecture context.
332
+
333
+ ---
334
+
335
+ ## Get Started
336
+
337
+ **Self-host**: Follow the [deployment guide](../../docs/guides/deployment-instructions.md) to run this server on your own infrastructure.
338
+
339
+ **Cesteral Intelligence**: [Request access](https://cesteral.com/integrations/tiktok-ads?utm_source=github&utm_medium=package-readme&utm_campaign=tiktok-mcp) -- governed execution with credential brokering, approvals, audit, and multi-tenant access.
340
+
341
+ **Book a workflow demo**: [See it in action](mailto:sales@cesteral.com?subject=Workflow%20demo%20-%20TikTok%20Ads%20MCP) with your own ad accounts.
342
+
343
+ **Compare options**: [OSS connectors vs Cesteral Intelligence](https://cesteral.com/compare?utm_source=github&utm_medium=package-readme&utm_campaign=tiktok-mcp)
344
+
345
+ ## License
346
+
347
+ Apache License 2.0 — see [LICENSE](../../LICENSE.md) for details. This package is part of Cesteral's open-source connector layer; managed hosting and higher-level governance features live outside this repository.
@@ -0,0 +1,3 @@
1
+ export * from "./tiktok-auth-adapter.js";
2
+ export * from "./tiktok-auth-strategy.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAGA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./tiktok-auth-adapter.js";
2
+ export * from "./tiktok-auth-strategy.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAGA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { OAuth2RefreshAdapterBase } from "@cesteral/shared";
2
+ export interface TikTokAuthAdapter {
3
+ getAccessToken(): Promise<string>;
4
+ validate(): Promise<void>;
5
+ readonly userId: string;
6
+ readonly advertiserId: string;
7
+ }
8
+ export declare class TikTokAccessTokenAdapter implements TikTokAuthAdapter {
9
+ private readonly accessToken;
10
+ private readonly _advertiserId;
11
+ private readonly baseUrl;
12
+ private readonly apiVersion;
13
+ private validated;
14
+ private _userId;
15
+ constructor(accessToken: string, _advertiserId: string, baseUrl?: string, apiVersion?: string);
16
+ get userId(): string;
17
+ get advertiserId(): string;
18
+ getAccessToken(): Promise<string>;
19
+ validate(): Promise<void>;
20
+ }
21
+ export interface TikTokRefreshCredentials {
22
+ appId: string;
23
+ appSecret: string;
24
+ refreshToken: string;
25
+ }
26
+ export declare class TikTokRefreshTokenAdapter extends OAuth2RefreshAdapterBase<TikTokRefreshCredentials> implements TikTokAuthAdapter {
27
+ private readonly _advertiserId;
28
+ private readonly baseUrl;
29
+ private readonly apiVersion;
30
+ private _userId;
31
+ constructor(credentials: TikTokRefreshCredentials, _advertiserId: string, baseUrl?: string, apiVersion?: string);
32
+ get userId(): string;
33
+ get advertiserId(): string;
34
+ validate(): Promise<void>;
35
+ }
36
+ export declare function parseTikTokRefreshCredentialsFromHeaders(headers: Record<string, string | string[] | undefined>): TikTokRefreshCredentials | undefined;
37
+ export declare function parseTikTokTokenFromHeaders(headers: Record<string, string | string[] | undefined>): string;
38
+ export declare function getTikTokAdvertiserIdFromHeaders(headers: Record<string, string | string[] | undefined>): string;
39
+ export declare function getTikTokCredentialFingerprint(accessToken: string, advertiserId: string): string;
40
+ //# sourceMappingURL=tiktok-auth-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiktok-auth-adapter.d.ts","sourceRoot":"","sources":["../../src/auth/tiktok-auth-adapter.ts"],"names":[],"mappings":"AAgBA,OAAO,EAML,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAiB1B,MAAM,WAAW,iBAAiB;IAChC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AA8CD,qBAAa,wBAAyB,YAAW,iBAAiB;IAK9D,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAP7B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAM;gBAGF,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,MAA0C,EACnD,UAAU,GAAE,MAAe;IAG9C,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IAEK,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAKhC;AAKD,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAuBD,qBAAa,yBACX,SAAQ,wBAAwB,CAAC,wBAAwB,CACzD,YAAW,iBAAiB;IAM1B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAN7B,OAAO,CAAC,OAAO,CAAM;gBAGnB,WAAW,EAAE,wBAAwB,EACpB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,MAA0C,EACnD,UAAU,GAAE,MAAe;IA+C9C,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAKhC;AAMD,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,wBAAwB,GAAG,SAAS,CAUtC;AAMD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,MAAM,CAaR;AAMD,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,MAAM,CAQR;AAKD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEhG"}