@qzsy/pdd-ddk-sdk 0.1.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.
- package/LICENSE +21 -0
- package/dist/apis/util.d.ts +21 -0
- package/dist/apis/util.d.ts.map +1 -0
- package/dist/apis/util.js +23 -0
- package/dist/apis/util.js.map +1 -0
- package/dist/client.d.ts +24 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +31 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/types/util.d.ts +10 -0
- package/dist/types/util.d.ts.map +1 -0
- package/dist/types/util.js +2 -0
- package/dist/types/util.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 qzsy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PddHttpClient } from "@qzsy/pdd-core";
|
|
2
|
+
import type { DdkTimeGetResult } from "../types/util.ts";
|
|
3
|
+
/**
|
|
4
|
+
* 多多进宝通用接口:服务器时间等不需要授权的方法。
|
|
5
|
+
*/
|
|
6
|
+
export declare class DdkUtilApi {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* @param http 共享的拼多多 HTTP 客户端
|
|
10
|
+
*/
|
|
11
|
+
constructor(http: PddHttpClient);
|
|
12
|
+
/**
|
|
13
|
+
* 获取拼多多 POP 服务器时间,可用于校对本地时钟。
|
|
14
|
+
*
|
|
15
|
+
* 对应官方接口:`pdd.time.get`
|
|
16
|
+
*
|
|
17
|
+
* @returns 服务器时间
|
|
18
|
+
*/
|
|
19
|
+
getTime(): Promise<DdkTimeGetResult>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/apis/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;GAEG;AACH,qBAAa,UAAU;;IAGrB;;OAEG;IACH,YAAY,IAAI,EAAE,aAAa,EAE9B;IAED;;;;;;OAMG;IACH,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAEnC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 多多进宝通用接口:服务器时间等不需要授权的方法。
|
|
3
|
+
*/
|
|
4
|
+
export class DdkUtilApi {
|
|
5
|
+
#http;
|
|
6
|
+
/**
|
|
7
|
+
* @param http 共享的拼多多 HTTP 客户端
|
|
8
|
+
*/
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.#http = http;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 获取拼多多 POP 服务器时间,可用于校对本地时钟。
|
|
14
|
+
*
|
|
15
|
+
* 对应官方接口:`pdd.time.get`
|
|
16
|
+
*
|
|
17
|
+
* @returns 服务器时间
|
|
18
|
+
*/
|
|
19
|
+
getTime() {
|
|
20
|
+
return this.#http.call("pdd.time.get", {}, { auth: "none" });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/apis/util.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,UAAU;IACZ,KAAK,CAAgB;IAE9B;;OAEG;IACH,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,cAAc,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACjF,CAAC;CACF"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PddHttpClient, type PddClientCaller, type PddClientOptions } from "@qzsy/pdd-core";
|
|
2
|
+
import { DdkUtilApi } from "./apis/util.ts";
|
|
3
|
+
/**
|
|
4
|
+
* 拼多多多多进宝服务端客户端。
|
|
5
|
+
*
|
|
6
|
+
* 默认不注入 `access_token`。需要店铺授权的进宝接口,调用 `http.call` 时显式传入 `{ auth: "access_token" }`,
|
|
7
|
+
* 或在构造时提供 `accessToken` / `getAccessToken`。
|
|
8
|
+
*/
|
|
9
|
+
export declare class DdkClient {
|
|
10
|
+
/**
|
|
11
|
+
* 底层 HTTP 客户端,需要调用尚未封装的接口时可直接使用。
|
|
12
|
+
*/
|
|
13
|
+
readonly http: PddHttpClient;
|
|
14
|
+
/**
|
|
15
|
+
* 通用接口,例如服务器时间。
|
|
16
|
+
*/
|
|
17
|
+
readonly util: DdkUtilApi;
|
|
18
|
+
/**
|
|
19
|
+
* @param credentials 应用 `clientId` / `clientSecret`,以及可选的授权令牌
|
|
20
|
+
* @param options 可选的令牌存储、超时与 `fetch` 注入
|
|
21
|
+
*/
|
|
22
|
+
constructor(credentials: PddClientCaller, options?: PddClientOptions);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B;;;OAGG;IACH,YAAY,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,gBAAgB,EAOnE;CACF"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PddHttpClient, } from "@qzsy/pdd-core";
|
|
2
|
+
import { DdkUtilApi } from "./apis/util.js";
|
|
3
|
+
/**
|
|
4
|
+
* 拼多多多多进宝服务端客户端。
|
|
5
|
+
*
|
|
6
|
+
* 默认不注入 `access_token`。需要店铺授权的进宝接口,调用 `http.call` 时显式传入 `{ auth: "access_token" }`,
|
|
7
|
+
* 或在构造时提供 `accessToken` / `getAccessToken`。
|
|
8
|
+
*/
|
|
9
|
+
export class DdkClient {
|
|
10
|
+
/**
|
|
11
|
+
* 底层 HTTP 客户端,需要调用尚未封装的接口时可直接使用。
|
|
12
|
+
*/
|
|
13
|
+
http;
|
|
14
|
+
/**
|
|
15
|
+
* 通用接口,例如服务器时间。
|
|
16
|
+
*/
|
|
17
|
+
util;
|
|
18
|
+
/**
|
|
19
|
+
* @param credentials 应用 `clientId` / `clientSecret`,以及可选的授权令牌
|
|
20
|
+
* @param options 可选的令牌存储、超时与 `fetch` 注入
|
|
21
|
+
*/
|
|
22
|
+
constructor(credentials, options) {
|
|
23
|
+
this.http = new PddHttpClient(credentials, {
|
|
24
|
+
userAgent: "@qzsy/pdd-ddk-sdk",
|
|
25
|
+
tokenKind: "none",
|
|
26
|
+
...options,
|
|
27
|
+
});
|
|
28
|
+
this.util = new DdkUtilApi(this.http);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IACpB;;OAEG;IACM,IAAI,CAAgB;IAE7B;;OAEG;IACM,IAAI,CAAa;IAE1B;;;OAGG;IACH,YAAY,WAA4B,EAAE,OAA0B;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE;YACzC,SAAS,EAAE,mBAAmB;YAC9B,SAAS,EAAE,MAAM;YACjB,GAAG,OAAO;SACX,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DdkClient } from "./client.ts";
|
|
2
|
+
export { DdkUtilApi } from "./apis/util.ts";
|
|
3
|
+
export type { DdkTimeGetResult } from "./types/util.ts";
|
|
4
|
+
export { MemoryTokenStore, PddApiError, PddError, PddHttpError, } from "@qzsy/pdd-core";
|
|
5
|
+
export type { PddAppCredentials, PddAuthorizerCaller, PddCallMode, PddClientCaller, PddClientOptions, PddErrorContext, PddMerchantCaller, TokenStore, } from "@qzsy/pdd-core";
|
|
6
|
+
export { isAuthorizerCaller } from "@qzsy/pdd-core";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC;AAWxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/types/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/types/util.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qzsy/pdd-ddk-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Pinduoduo Duo Duo Jinbao (多多进宝) server SDK",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "qzsy",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/qzsy/pdd-sdk.git",
|
|
11
|
+
"directory": "packages/pdd-ddk"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./src/index.ts",
|
|
16
|
+
"bun": "./src/index.ts",
|
|
17
|
+
"import": "./src/index.ts",
|
|
18
|
+
"default": "./src/index.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"main": "./src/index.ts",
|
|
22
|
+
"types": "./src/index.ts",
|
|
23
|
+
"files": ["dist"],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc --build",
|
|
38
|
+
"typecheck": "tsc --build --pretty"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@qzsy/pdd-core": "0.1.0"
|
|
42
|
+
}
|
|
43
|
+
}
|