@waffo/pancake-ts 0.13.0 → 0.14.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/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to `@waffo/pancake-ts` will be documented in this file.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.14.0] - 2026-07-18
8
+
9
+ Adds content-safety prompt scanning for AIGC generation.
10
+
11
+ ### Added
12
+
13
+ - `client.contentSafety.scanPrompt(params)` — scan a user prompt before AIGC generation; returns a redacted verdict (`action` = allow / review / block, continue only when `allow`). Stateless (prompt text never stored); fails closed to `review` if the safety service is briefly unavailable.
14
+ - Types: `ScanPromptParams`, `ScanResult`; enums `ScanAction`, `ScanReasonCode`, `ScanPolicyCategory`, `ScanSemanticMode`, `ScanSemanticStatus`.
15
+
7
16
  ## [0.13.0] - 2026-07-17
8
17
 
9
18
  Adds cashier language selection to checkout sessions.
package/README.md CHANGED
@@ -507,6 +507,17 @@ const { orderId, status } = await client.orders.cancelSubscription({
507
507
  // status: "canceled" (was pending) or "canceling" (was active, PSP notified)
508
508
  ```
509
509
 
510
+ ### Content Safety
511
+
512
+ Scan a user's prompt for content-safety compliance before AIGC generation — continue only when `action` is `allow`. Stateless (prompt text is never stored); fails closed to `review` if the safety service is briefly unavailable.
513
+
514
+ ```typescript
515
+ const verdict = await client.contentSafety.scanPrompt({ prompt: "a cat riding a bike" });
516
+ if (verdict.action !== "allow") {
517
+ // do not generate — verdict.action is "review" or "block"
518
+ }
519
+ ```
520
+
510
521
  ## Error Handling
511
522
 
512
523
  API errors throw `WaffoPancakeError` with the HTTP status code and a call-stack-ordered errors array.
@@ -543,6 +554,7 @@ try {
543
554
  | `client.subscriptionProducts` | `create()` `update()` `publish()` `updateStatus()` | Subscription products |
544
555
  | `client.subscriptionProductGroups` | `create()` `update()` `delete()` `publish()` | Product groups |
545
556
  | `client.orders` | `cancelSubscription()` | Order management |
557
+ | `client.contentSafety` | `scanPrompt()` | AIGC prompt content-safety scan |
546
558
 
547
559
  ## Documentation
548
560
 
package/dist/index.cjs CHANGED
@@ -30,6 +30,11 @@ __export(index_exports, {
30
30
  ProductVersionStatus: () => ProductVersionStatus,
31
31
  RefundStatus: () => RefundStatus,
32
32
  RefundTicketStatus: () => RefundTicketStatus,
33
+ ScanAction: () => ScanAction,
34
+ ScanPolicyCategory: () => ScanPolicyCategory,
35
+ ScanReasonCode: () => ScanReasonCode,
36
+ ScanSemanticMode: () => ScanSemanticMode,
37
+ ScanSemanticStatus: () => ScanSemanticStatus,
33
38
  StoreRole: () => StoreRole,
34
39
  SubscriptionOrderStatus: () => SubscriptionOrderStatus,
35
40
  TaxCategory: () => TaxCategory,
@@ -532,6 +537,35 @@ var CheckoutResource = class {
532
537
  }
533
538
  };
534
539
 
540
+ // src/resources/content-safety.ts
541
+ var ContentSafetyResource = class {
542
+ constructor(http) {
543
+ this.http = http;
544
+ }
545
+ /**
546
+ * Scan a user's text prompt for content-safety compliance before AIGC
547
+ * generation. Call this before invoking your image/video model and continue
548
+ * only when `action` is `allow`.
549
+ *
550
+ * Stateless — the check never stores prompt text. If the safety service is
551
+ * briefly unavailable, the verdict fails closed to `review` so an
552
+ * unmoderated prompt is never let through.
553
+ *
554
+ * @param params - Scan parameters (prompt required; locale / semantic optional)
555
+ * @returns Redacted scan verdict
556
+ *
557
+ * @example
558
+ * const verdict = await client.contentSafety.scanPrompt({ prompt: "a cat riding a bike" });
559
+ * if (verdict.action !== "allow") {
560
+ * // do not generate
561
+ * }
562
+ */
563
+ async scanPrompt(params) {
564
+ validateRequired("prompt", params.prompt);
565
+ return unwrapAction(await this.http.post("/v1/actions/verification/scan-prompt", params));
566
+ }
567
+ };
568
+
535
569
  // src/resources/customer.ts
536
570
  var CustomerSession = class {
537
571
  constructor(http) {
@@ -1323,6 +1357,7 @@ var WaffoPancake = class {
1323
1357
  checkout;
1324
1358
  graphql;
1325
1359
  webhooks;
1360
+ contentSafety;
1326
1361
  constructor(config) {
1327
1362
  validateShortId("merchantId", config.merchantId, "MER");
1328
1363
  this.config = config;
@@ -1337,6 +1372,7 @@ var WaffoPancake = class {
1337
1372
  this.checkout = new CheckoutResource(this.http);
1338
1373
  this.graphql = new GraphQLResource(this.http);
1339
1374
  this.webhooks = new WebhooksResource(this.http, config.webhookPublicKey);
1375
+ this.contentSafety = new ContentSafetyResource(this.http);
1340
1376
  }
1341
1377
  /**
1342
1378
  * Create a customer session for self-service operations.
@@ -1492,6 +1528,44 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1492
1528
  WebhookEventType2["RefundFailed"] = "refund.failed";
1493
1529
  return WebhookEventType2;
1494
1530
  })(WebhookEventType || {});
1531
+ var ScanAction = /* @__PURE__ */ ((ScanAction2) => {
1532
+ ScanAction2["Allow"] = "allow";
1533
+ ScanAction2["Review"] = "review";
1534
+ ScanAction2["Block"] = "block";
1535
+ return ScanAction2;
1536
+ })(ScanAction || {});
1537
+ var ScanReasonCode = /* @__PURE__ */ ((ScanReasonCode2) => {
1538
+ ScanReasonCode2["Allowed"] = "allowed";
1539
+ ScanReasonCode2["ReviewRequired"] = "review_required";
1540
+ ScanReasonCode2["RestrictedContent"] = "restricted_content";
1541
+ ScanReasonCode2["ServiceDegraded"] = "service_degraded";
1542
+ return ScanReasonCode2;
1543
+ })(ScanReasonCode || {});
1544
+ var ScanPolicyCategory = /* @__PURE__ */ ((ScanPolicyCategory2) => {
1545
+ ScanPolicyCategory2["CsamMinor"] = "csam_minor";
1546
+ ScanPolicyCategory2["SexualViolenceNonconsensual"] = "sexual_violence_nonconsensual";
1547
+ ScanPolicyCategory2["UndressTransform"] = "undress_transform";
1548
+ ScanPolicyCategory2["FaceSwapIdentity"] = "face_swap_identity";
1549
+ ScanPolicyCategory2["BestialityRestricted"] = "bestiality_restricted";
1550
+ ScanPolicyCategory2["AdultNsfw"] = "adult_nsfw";
1551
+ return ScanPolicyCategory2;
1552
+ })(ScanPolicyCategory || {});
1553
+ var ScanSemanticMode = /* @__PURE__ */ ((ScanSemanticMode2) => {
1554
+ ScanSemanticMode2["Off"] = "off";
1555
+ ScanSemanticMode2["Shadow"] = "shadow";
1556
+ ScanSemanticMode2["Enforce"] = "enforce";
1557
+ return ScanSemanticMode2;
1558
+ })(ScanSemanticMode || {});
1559
+ var ScanSemanticStatus = /* @__PURE__ */ ((ScanSemanticStatus2) => {
1560
+ ScanSemanticStatus2["Disabled"] = "disabled";
1561
+ ScanSemanticStatus2["Scored"] = "scored";
1562
+ ScanSemanticStatus2["ShadowScored"] = "shadow_scored";
1563
+ ScanSemanticStatus2["SkippedRulesBlock"] = "skipped_rules_block";
1564
+ ScanSemanticStatus2["SkippedBudget"] = "skipped_budget";
1565
+ ScanSemanticStatus2["ProviderTimeout"] = "provider_timeout";
1566
+ ScanSemanticStatus2["ProviderError"] = "provider_error";
1567
+ return ScanSemanticStatus2;
1568
+ })(ScanSemanticStatus || {});
1495
1569
  // Annotate the CommonJS export names for ESM import in node:
1496
1570
  0 && (module.exports = {
1497
1571
  BillingPeriod,
@@ -1504,6 +1578,11 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1504
1578
  ProductVersionStatus,
1505
1579
  RefundStatus,
1506
1580
  RefundTicketStatus,
1581
+ ScanAction,
1582
+ ScanPolicyCategory,
1583
+ ScanReasonCode,
1584
+ ScanSemanticMode,
1585
+ ScanSemanticStatus,
1507
1586
  StoreRole,
1508
1587
  SubscriptionOrderStatus,
1509
1588
  TaxCategory,