@perk-net/perk-pushplus-sdk 1.0.1 → 1.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/README.md +10 -0
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.global.js +10 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +1 -1
- package/src/enums.ts +2 -0
- package/src/models.ts +6 -0
package/dist/index.d.cts
CHANGED
|
@@ -176,7 +176,9 @@ declare enum Template {
|
|
|
176
176
|
/** 路由器插件定制模板。 */
|
|
177
177
|
ROUTE = "route",
|
|
178
178
|
/** 支付成功通知模板。 */
|
|
179
|
-
PAY = "pay"
|
|
179
|
+
PAY = "pay",
|
|
180
|
+
/** 表单格式模板;发送时需传 pushId(表单编码)。 */
|
|
181
|
+
FORM = "form"
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
182
184
|
* 消息投递状态。
|
|
@@ -308,6 +310,8 @@ interface SendRequest {
|
|
|
308
310
|
to?: string;
|
|
309
311
|
/** 预处理编码(仅会员)。 */
|
|
310
312
|
pre?: string;
|
|
313
|
+
/** push 表单编码;template 为 form 时必传。 */
|
|
314
|
+
pushId?: string;
|
|
311
315
|
}
|
|
312
316
|
declare class SendRequestBuilder {
|
|
313
317
|
private req;
|
|
@@ -322,6 +326,7 @@ declare class SendRequestBuilder {
|
|
|
322
326
|
timestamp(v?: number): this;
|
|
323
327
|
to(v?: string): this;
|
|
324
328
|
pre(v?: string): this;
|
|
329
|
+
pushId(v?: string): this;
|
|
325
330
|
build(): SendRequest;
|
|
326
331
|
}
|
|
327
332
|
/**
|
|
@@ -345,6 +350,8 @@ interface BatchSendRequest {
|
|
|
345
350
|
timestamp?: number;
|
|
346
351
|
to?: string;
|
|
347
352
|
pre?: string;
|
|
353
|
+
/** push 表单编码;template 为 form 时必传。 */
|
|
354
|
+
pushId?: string;
|
|
348
355
|
}
|
|
349
356
|
/**
|
|
350
357
|
* 链式 Builder:支持以 `channel(Channel)` / `option(string)` 形式累积调用,
|
|
@@ -366,6 +373,7 @@ declare class BatchSendRequestBuilder {
|
|
|
366
373
|
timestamp(v?: number): this;
|
|
367
374
|
to(v?: string): this;
|
|
368
375
|
pre(v?: string): this;
|
|
376
|
+
pushId(v?: string): this;
|
|
369
377
|
/** 追加一个 channel。 */
|
|
370
378
|
channel(ch: Channel | string): this;
|
|
371
379
|
/** 追加一个 option,与最近一次 channel() 配对;可传空串。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -176,7 +176,9 @@ declare enum Template {
|
|
|
176
176
|
/** 路由器插件定制模板。 */
|
|
177
177
|
ROUTE = "route",
|
|
178
178
|
/** 支付成功通知模板。 */
|
|
179
|
-
PAY = "pay"
|
|
179
|
+
PAY = "pay",
|
|
180
|
+
/** 表单格式模板;发送时需传 pushId(表单编码)。 */
|
|
181
|
+
FORM = "form"
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
182
184
|
* 消息投递状态。
|
|
@@ -308,6 +310,8 @@ interface SendRequest {
|
|
|
308
310
|
to?: string;
|
|
309
311
|
/** 预处理编码(仅会员)。 */
|
|
310
312
|
pre?: string;
|
|
313
|
+
/** push 表单编码;template 为 form 时必传。 */
|
|
314
|
+
pushId?: string;
|
|
311
315
|
}
|
|
312
316
|
declare class SendRequestBuilder {
|
|
313
317
|
private req;
|
|
@@ -322,6 +326,7 @@ declare class SendRequestBuilder {
|
|
|
322
326
|
timestamp(v?: number): this;
|
|
323
327
|
to(v?: string): this;
|
|
324
328
|
pre(v?: string): this;
|
|
329
|
+
pushId(v?: string): this;
|
|
325
330
|
build(): SendRequest;
|
|
326
331
|
}
|
|
327
332
|
/**
|
|
@@ -345,6 +350,8 @@ interface BatchSendRequest {
|
|
|
345
350
|
timestamp?: number;
|
|
346
351
|
to?: string;
|
|
347
352
|
pre?: string;
|
|
353
|
+
/** push 表单编码;template 为 form 时必传。 */
|
|
354
|
+
pushId?: string;
|
|
348
355
|
}
|
|
349
356
|
/**
|
|
350
357
|
* 链式 Builder:支持以 `channel(Channel)` / `option(string)` 形式累积调用,
|
|
@@ -366,6 +373,7 @@ declare class BatchSendRequestBuilder {
|
|
|
366
373
|
timestamp(v?: number): this;
|
|
367
374
|
to(v?: string): this;
|
|
368
375
|
pre(v?: string): this;
|
|
376
|
+
pushId(v?: string): this;
|
|
369
377
|
/** 追加一个 channel。 */
|
|
370
378
|
channel(ch: Channel | string): this;
|
|
371
379
|
/** 追加一个 option,与最近一次 channel() 配对;可传空串。 */
|
package/dist/index.global.js
CHANGED
|
@@ -23,6 +23,7 @@ var PerkPushPlus = (function (exports) {
|
|
|
23
23
|
Template2["JENKINS"] = "jenkins";
|
|
24
24
|
Template2["ROUTE"] = "route";
|
|
25
25
|
Template2["PAY"] = "pay";
|
|
26
|
+
Template2["FORM"] = "form";
|
|
26
27
|
return Template2;
|
|
27
28
|
})(Template || {});
|
|
28
29
|
var SendStatus = /* @__PURE__ */ ((SendStatus2) => {
|
|
@@ -1136,7 +1137,7 @@ var PerkPushPlus = (function (exports) {
|
|
|
1136
1137
|
logRequest: (_g = cfg.logRequest) != null ? _g : false,
|
|
1137
1138
|
rateLimitGuardEnabled: (_h = cfg.rateLimitGuardEnabled) != null ? _h : true,
|
|
1138
1139
|
rateLimitCooldownMs: (_i = cfg.rateLimitCooldownMs) != null ? _i : 0,
|
|
1139
|
-
userAgent: (_j = cfg.userAgent) != null ? _j : `@perk-net/perk-pushplus-sdk/1.0
|
|
1140
|
+
userAgent: (_j = cfg.userAgent) != null ? _j : `@perk-net/perk-pushplus-sdk/1.1.0`
|
|
1140
1141
|
};
|
|
1141
1142
|
}
|
|
1142
1143
|
|
|
@@ -1377,6 +1378,10 @@ var PerkPushPlus = (function (exports) {
|
|
|
1377
1378
|
this.req.pre = v;
|
|
1378
1379
|
return this;
|
|
1379
1380
|
}
|
|
1381
|
+
pushId(v) {
|
|
1382
|
+
this.req.pushId = v;
|
|
1383
|
+
return this;
|
|
1384
|
+
}
|
|
1380
1385
|
build() {
|
|
1381
1386
|
return { ...this.req };
|
|
1382
1387
|
}
|
|
@@ -1426,6 +1431,10 @@ var PerkPushPlus = (function (exports) {
|
|
|
1426
1431
|
this.req.pre = v;
|
|
1427
1432
|
return this;
|
|
1428
1433
|
}
|
|
1434
|
+
pushId(v) {
|
|
1435
|
+
this.req.pushId = v;
|
|
1436
|
+
return this;
|
|
1437
|
+
}
|
|
1429
1438
|
/** 追加一个 channel。 */
|
|
1430
1439
|
channel(ch) {
|
|
1431
1440
|
this.channelList.push(typeof ch === "string" ? ch : ch);
|