@open-dy/ai_coding_sdk 1.0.25 → 1.0.26-beta.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.
@@ -94,7 +94,10 @@ function buildOpenAPIErrorMessage(errMsg, errNo, logId, subErrMsg, subErrNo) {
94
94
  }
95
95
  async function callOpenAPI(params, options) {
96
96
  const { path, method = 'GET', queryParams, body, domain = 'open.douyin.com', requiresUserAuth, } = params;
97
- const accessToken = options?.accessToken ?? options?.delegateToken;
97
+ const providedAccessToken = options?.accessToken ?? options?.delegateToken;
98
+ const accessToken = requiresUserAuth || !isCloudEnvironment()
99
+ ? providedAccessToken
100
+ : undefined;
98
101
  const envPpeEnv = process.env.APP_ENV?.startsWith('ppe_') ? process.env.APP_ENV : undefined;
99
102
  const ppeEnv = options?.ppeEnv || envPpeEnv;
100
103
  const extraHeaders = options?.logid ? { 'x-tt-logid': options.logid } : {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-dy/ai_coding_sdk",
3
- "version": "1.0.25",
3
+ "version": "1.0.26-beta.0",
4
4
  "description": "AI Coding SDK — 抖音开放平台 OpenAPI 客户端与工具集",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,36 +0,0 @@
1
- import type { CallOptions, OpenAPIResponse } from '../core';
2
- export interface UploadSitemapRequest {
3
- /** 小程序 app_id */
4
- app_id: string;
5
- /** 页面路径列表 */
6
- page_paths: string[];
7
- }
8
- export interface DeleteIndexRequest {
9
- /** 小程序 app_id */
10
- app_id: string;
11
- /** 在控制台显示的文件名称 */
12
- name: string;
13
- /** 待删除路径集合 */
14
- path_list: string[];
15
- }
16
- export interface WebSearchOperationResponse {
17
- err_no: number;
18
- err_msg: string;
19
- log_id: string;
20
- }
21
- /**
22
- * 提交小程序页面路径
23
- * - Path: `/api/apps/v1/search/upload_sitemap/`
24
- * - Capability: `ma.web.search`
25
- * - Scope: `ma.search`
26
- * - 需要用户授权: `否`
27
- */
28
- export declare function uploadSitemap(params: UploadSitemapRequest, options?: CallOptions): Promise<OpenAPIResponse<WebSearchOperationResponse>>;
29
- /**
30
- * 删除索引
31
- * - Path: `/api/apps/v1/search/delete_index/`
32
- * - Capability: `ma.web.search`
33
- * - Scope: `ma.search`
34
- * - 需要用户授权: `否`
35
- */
36
- export declare function deleteIndex(params: DeleteIndexRequest, options?: CallOptions): Promise<OpenAPIResponse<WebSearchOperationResponse>>;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uploadSitemap = uploadSitemap;
4
- exports.deleteIndex = deleteIndex;
5
- const core_1 = require("../core");
6
- /**
7
- * 提交小程序页面路径
8
- * - Path: `/api/apps/v1/search/upload_sitemap/`
9
- * - Capability: `ma.web.search`
10
- * - Scope: `ma.search`
11
- * - 需要用户授权: `否`
12
- */
13
- async function uploadSitemap(params, options) {
14
- return (0, core_1.callOpenAPI)({
15
- path: '/api/apps/v1/search/upload_sitemap/',
16
- method: 'POST',
17
- body: params,
18
- domain: 'open.douyin.com',
19
- }, options);
20
- }
21
- /**
22
- * 删除索引
23
- * - Path: `/api/apps/v1/search/delete_index/`
24
- * - Capability: `ma.web.search`
25
- * - Scope: `ma.search`
26
- * - 需要用户授权: `否`
27
- */
28
- async function deleteIndex(params, options) {
29
- return (0, core_1.callOpenAPI)({
30
- path: '/api/apps/v1/search/delete_index/',
31
- method: 'POST',
32
- body: params,
33
- domain: 'open.douyin.com',
34
- }, options);
35
- }