alchemy 0.24.0 → 0.25.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/lib/aws/control/client.js +1 -1
- package/lib/aws/control/client.js.map +1 -1
- package/lib/aws/control/resource.d.ts.map +1 -1
- package/lib/aws/control/resource.js +2 -1
- package/lib/aws/control/resource.js.map +1 -1
- package/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +1 -4
- package/lib/aws/function.js.map +1 -1
- package/lib/cloudflare/ai.d.ts +21 -0
- package/lib/cloudflare/ai.d.ts.map +1 -1
- package/lib/cloudflare/ai.js +21 -0
- package/lib/cloudflare/ai.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +3 -3
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +3 -3
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/index.d.ts +2 -0
- package/lib/cloudflare/do-state-store/index.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/index.js +2 -0
- package/lib/cloudflare/do-state-store/index.js.map +1 -0
- package/lib/cloudflare/do-state-store/internal.d.ts +19 -0
- package/lib/cloudflare/do-state-store/internal.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/internal.js +163 -0
- package/lib/cloudflare/do-state-store/internal.js.map +1 -0
- package/lib/cloudflare/do-state-store/store.d.ts +59 -0
- package/lib/cloudflare/do-state-store/store.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/store.js +120 -0
- package/lib/cloudflare/do-state-store/store.js.map +1 -0
- package/lib/cloudflare/do-state-store/types.d.ts +82 -0
- package/lib/cloudflare/do-state-store/types.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/types.js +1 -0
- package/lib/cloudflare/do-state-store/types.js.map +1 -0
- package/lib/cloudflare/do-state-store/worker.d.ts +27 -0
- package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/worker.js +170 -0
- package/lib/cloudflare/do-state-store/worker.js.map +1 -0
- package/lib/cloudflare/index.d.ts +1 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +1 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/pipeline.js +1 -1
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts +14 -1
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +17 -0
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/website.d.ts +30 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +8 -5
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +13 -3
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-metadata.js +1 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +40 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +40 -38
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.js +1 -1
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts +30 -2
- package/lib/cloudflare/zone.d.ts.map +1 -1
- package/lib/cloudflare/zone.js +53 -0
- package/lib/cloudflare/zone.js.map +1 -1
- package/lib/fs/file-system-state-store.d.ts +3 -1
- package/lib/fs/file-system-state-store.d.ts.map +1 -1
- package/lib/fs/file-system-state-store.js +2 -2
- package/lib/fs/file-system-state-store.js.map +1 -1
- package/lib/stripe/card.d.ts +171 -0
- package/lib/stripe/card.d.ts.map +1 -0
- package/lib/stripe/card.js +148 -0
- package/lib/stripe/card.js.map +1 -0
- package/lib/stripe/client.d.ts +9 -0
- package/lib/stripe/client.d.ts.map +1 -0
- package/lib/stripe/client.js +94 -0
- package/lib/stripe/client.js.map +1 -0
- package/lib/stripe/coupon.d.ts +135 -0
- package/lib/stripe/coupon.d.ts.map +1 -0
- package/lib/stripe/coupon.js +161 -0
- package/lib/stripe/coupon.js.map +1 -0
- package/lib/stripe/customer.d.ts +269 -0
- package/lib/stripe/customer.d.ts.map +1 -0
- package/lib/stripe/customer.js +289 -0
- package/lib/stripe/customer.js.map +1 -0
- package/lib/stripe/entitlements-feature.d.ts +84 -0
- package/lib/stripe/entitlements-feature.d.ts.map +1 -0
- package/lib/stripe/entitlements-feature.js +102 -0
- package/lib/stripe/entitlements-feature.js.map +1 -0
- package/lib/stripe/file.d.ts +143 -0
- package/lib/stripe/file.d.ts.map +1 -0
- package/lib/stripe/file.js +97 -0
- package/lib/stripe/file.js.map +1 -0
- package/lib/stripe/index.d.ts +11 -0
- package/lib/stripe/index.d.ts.map +1 -1
- package/lib/stripe/index.js +11 -0
- package/lib/stripe/index.js.map +1 -1
- package/lib/stripe/meter.d.ts +10 -1
- package/lib/stripe/meter.d.ts.map +1 -1
- package/lib/stripe/meter.js +13 -7
- package/lib/stripe/meter.js.map +1 -1
- package/lib/stripe/portal-configuration.d.ts +286 -0
- package/lib/stripe/portal-configuration.d.ts.map +1 -0
- package/lib/stripe/portal-configuration.js +320 -0
- package/lib/stripe/portal-configuration.js.map +1 -0
- package/lib/stripe/price.d.ts +10 -1
- package/lib/stripe/price.d.ts.map +1 -1
- package/lib/stripe/price.js +34 -13
- package/lib/stripe/price.js.map +1 -1
- package/lib/stripe/product-feature.d.ts +76 -0
- package/lib/stripe/product-feature.d.ts.map +1 -0
- package/lib/stripe/product-feature.js +74 -0
- package/lib/stripe/product-feature.js.map +1 -0
- package/lib/stripe/product.d.ts +10 -1
- package/lib/stripe/product.d.ts.map +1 -1
- package/lib/stripe/product.js +33 -14
- package/lib/stripe/product.js.map +1 -1
- package/lib/stripe/promotion-code.d.ts +138 -0
- package/lib/stripe/promotion-code.d.ts.map +1 -0
- package/lib/stripe/promotion-code.js +150 -0
- package/lib/stripe/promotion-code.js.map +1 -0
- package/lib/stripe/shipping-rate.d.ts +188 -0
- package/lib/stripe/shipping-rate.d.ts.map +1 -0
- package/lib/stripe/shipping-rate.js +198 -0
- package/lib/stripe/shipping-rate.js.map +1 -0
- package/lib/stripe/tax-rate.d.ts +130 -0
- package/lib/stripe/tax-rate.d.ts.map +1 -0
- package/lib/stripe/tax-rate.js +126 -0
- package/lib/stripe/tax-rate.js.map +1 -0
- package/lib/stripe/webhook.d.ts +10 -1
- package/lib/stripe/webhook.d.ts.map +1 -1
- package/lib/stripe/webhook.js +59 -14
- package/lib/stripe/webhook.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +2 -6
- package/lib/test/bun.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js +3 -7
- package/lib/test/vitest.js.map +1 -1
- package/lib/util/retry.d.ts +1 -1
- package/lib/util/retry.d.ts.map +1 -1
- package/lib/util/retry.js.map +1 -1
- package/package.json +3 -2
- package/src/aws/control/client.ts +1 -1
- package/src/aws/control/resource.ts +2 -1
- package/src/aws/function.ts +3 -6
- package/src/cloudflare/ai.ts +21 -0
- package/src/cloudflare/bindings.ts +3 -2
- package/src/cloudflare/bound.ts +3 -3
- package/src/cloudflare/do-state-store/index.ts +1 -0
- package/src/cloudflare/do-state-store/internal.ts +215 -0
- package/src/cloudflare/do-state-store/store.ts +188 -0
- package/src/cloudflare/do-state-store/types.ts +74 -0
- package/src/cloudflare/do-state-store/worker.ts +199 -0
- package/src/cloudflare/index.ts +1 -0
- package/src/cloudflare/pipeline.ts +1 -1
- package/src/cloudflare/queue-consumer.ts +59 -1
- package/src/cloudflare/website.ts +38 -6
- package/src/cloudflare/worker-assets.ts +15 -3
- package/src/cloudflare/worker-metadata.ts +1 -1
- package/src/cloudflare/worker.ts +66 -46
- package/src/cloudflare/wrangler.json.ts +1 -1
- package/src/cloudflare/zone.ts +75 -2
- package/src/fs/file-system-state-store.ts +7 -2
- package/src/stripe/card.ts +320 -0
- package/src/stripe/client.ts +145 -0
- package/src/stripe/coupon.ts +280 -0
- package/src/stripe/customer.ts +528 -0
- package/src/stripe/entitlements-feature.ts +169 -0
- package/src/stripe/file.ts +219 -0
- package/src/stripe/index.ts +11 -0
- package/src/stripe/meter.ts +23 -7
- package/src/stripe/portal-configuration.ts +609 -0
- package/src/stripe/price.ts +47 -14
- package/src/stripe/product-feature.ts +150 -0
- package/src/stripe/product.ts +48 -15
- package/src/stripe/promotion-code.ts +268 -0
- package/src/stripe/shipping-rate.ts +362 -0
- package/src/stripe/tax-rate.ts +218 -0
- package/src/stripe/webhook.ts +82 -15
- package/src/test/bun.ts +2 -7
- package/src/test/vitest.ts +3 -8
- package/src/util/retry.ts +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Resource } from "../resource.js";
|
|
2
|
+
import { createStripeClient, isStripeConflictError } from "./client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create and manage Stripe files for uploads
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Upload a dispute evidence file
|
|
8
|
+
* const disputeEvidence = await File("dispute-evidence", {
|
|
9
|
+
* file: fs.readFileSync("./evidence.pdf"),
|
|
10
|
+
* purpose: "dispute_evidence"
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Upload an identity document
|
|
15
|
+
* const identityDocument = await File("identity-doc", {
|
|
16
|
+
* file: fs.readFileSync("./passport.jpg"),
|
|
17
|
+
* purpose: "identity_document"
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Upload a business logo with file link
|
|
22
|
+
* const businessLogo = await File("business-logo", {
|
|
23
|
+
* file: fs.readFileSync("./logo.png"),
|
|
24
|
+
* purpose: "business_logo",
|
|
25
|
+
* fileLink: {
|
|
26
|
+
* create: true,
|
|
27
|
+
* expiresAt: Math.floor(Date.now() / 1000) + 86400,
|
|
28
|
+
* metadata: {
|
|
29
|
+
* brand: "company_logo"
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
export const File = Resource("stripe::File", async function (_id, props) {
|
|
35
|
+
const stripe = createStripeClient({ apiKey: props.apiKey });
|
|
36
|
+
if (this.phase === "delete") {
|
|
37
|
+
return this.destroy();
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
let file;
|
|
41
|
+
if (this.phase === "update" && this.output?.id) {
|
|
42
|
+
file = await stripe.files.retrieve(this.output.id);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
try {
|
|
46
|
+
file = await stripe.files.create({
|
|
47
|
+
file: props.file,
|
|
48
|
+
purpose: props.purpose,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (isStripeConflictError(error) && props.adopt) {
|
|
53
|
+
throw new Error("File adoption is not supported - files are immutable and cannot be adopted");
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return this({
|
|
61
|
+
id: file.id,
|
|
62
|
+
object: file.object,
|
|
63
|
+
created: file.created,
|
|
64
|
+
expiresAt: file.expires_at || undefined,
|
|
65
|
+
filename: file.filename || undefined,
|
|
66
|
+
links: file.links
|
|
67
|
+
? {
|
|
68
|
+
object: file.links.object,
|
|
69
|
+
data: file.links.data.map((link) => ({
|
|
70
|
+
id: link.id,
|
|
71
|
+
object: link.object,
|
|
72
|
+
created: link.created,
|
|
73
|
+
expired: link.expired,
|
|
74
|
+
expiresAt: link.expires_at || undefined,
|
|
75
|
+
file: typeof link.file === "string" ? link.file : link.file.id,
|
|
76
|
+
livemode: link.livemode,
|
|
77
|
+
metadata: link.metadata,
|
|
78
|
+
url: link.url || undefined,
|
|
79
|
+
})),
|
|
80
|
+
hasMore: file.links.has_more,
|
|
81
|
+
url: file.links.url,
|
|
82
|
+
}
|
|
83
|
+
: undefined,
|
|
84
|
+
purpose: file.purpose,
|
|
85
|
+
size: file.size,
|
|
86
|
+
title: file.title || undefined,
|
|
87
|
+
type: file.type || undefined,
|
|
88
|
+
url: file.url || undefined,
|
|
89
|
+
livemode: true,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.error("Error creating/retrieving file:", error);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/stripe/file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAgHxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAC1B,cAAc,EACd,KAAK,WAEH,GAAW,EACX,KAAgB;IAEhB,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5D,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC;QACH,IAAI,IAAiB,CAAC;QAEtB,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC;YAC/C,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC;gBACH,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,IAAI,CAAC,QAAQ;wBACvB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,SAAS;qBAC3B,CAAC,CAAC;oBACH,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;oBAC5B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;iBACpB;gBACH,CAAC,CAAC,SAAS;YACb,OAAO,EAAE,IAAI,CAAC,OAA8B;YAC5C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;YAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,SAAS;YAC5B,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,SAAS;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACxD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC"}
|
package/lib/stripe/index.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
export * from "./card.ts";
|
|
2
|
+
export * from "./client.ts";
|
|
3
|
+
export * from "./coupon.ts";
|
|
4
|
+
export * from "./customer.ts";
|
|
5
|
+
export * from "./entitlements-feature.ts";
|
|
6
|
+
export * from "./file.ts";
|
|
1
7
|
export * from "./meter.ts";
|
|
8
|
+
export * from "./portal-configuration.ts";
|
|
2
9
|
export * from "./price.ts";
|
|
3
10
|
export * from "./product.ts";
|
|
11
|
+
export * from "./product-feature.ts";
|
|
12
|
+
export * from "./promotion-code.ts";
|
|
13
|
+
export * from "./shipping-rate.ts";
|
|
14
|
+
export * from "./tax-rate.ts";
|
|
4
15
|
export * from "./webhook.ts";
|
|
5
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
package/lib/stripe/index.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
export * from "./card.js";
|
|
2
|
+
export * from "./client.js";
|
|
3
|
+
export * from "./coupon.js";
|
|
4
|
+
export * from "./customer.js";
|
|
5
|
+
export * from "./entitlements-feature.js";
|
|
6
|
+
export * from "./file.js";
|
|
1
7
|
export * from "./meter.js";
|
|
8
|
+
export * from "./portal-configuration.js";
|
|
2
9
|
export * from "./price.js";
|
|
3
10
|
export * from "./product.js";
|
|
11
|
+
export * from "./product-feature.js";
|
|
12
|
+
export * from "./promotion-code.js";
|
|
13
|
+
export * from "./shipping-rate.js";
|
|
14
|
+
export * from "./tax-rate.js";
|
|
4
15
|
export * from "./webhook.js";
|
|
5
16
|
//# sourceMappingURL=index.js.map
|
package/lib/stripe/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
package/lib/stripe/meter.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import Stripe from "stripe";
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
2
|
import type { Context } from "../context.ts";
|
|
3
3
|
import { Resource } from "../resource.ts";
|
|
4
|
+
import type { Secret } from "../secret.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Properties for creating or updating a Stripe Meter.
|
|
6
7
|
* Note: Nested objects like defaultAggregation, customerMapping, valueSettings
|
|
@@ -21,6 +22,14 @@ export interface MeterProps {
|
|
|
21
22
|
valueSettings: {
|
|
22
23
|
eventPayloadKey: string;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* API key to use (overrides environment variable)
|
|
27
|
+
*/
|
|
28
|
+
apiKey?: Secret;
|
|
29
|
+
/**
|
|
30
|
+
* If true, adopt existing resource if creation fails due to conflict
|
|
31
|
+
*/
|
|
32
|
+
adopt?: boolean;
|
|
24
33
|
}
|
|
25
34
|
/**
|
|
26
35
|
* Output returned after Stripe Meter creation/update.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../src/stripe/meter.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../src/stripe/meter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC/B,kBAAkB,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,OAAO,CAAC;KACtE,CAAC;IACF,eAAe,EAAE;QACf,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;KAChE,CAAC;IACF,aAAa,EAAE;QACb,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,KAAM,SAAQ,QAAQ,CAAC,eAAe,CAAC;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;KAC7D,CAAC;IACF,eAAe,EAAE;QACf,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;KACpD,CAAC;IACF,aAAa,EAAE;QACb,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE;QAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAEH,eAAO,MAAM,KAAK,yFAGR,OAAO,CAAC,KAAK,CAAC,cACR,MAAM,SACX,UAAU,KAChB,OAAO,CAAC,KAAK,CAAC,CA8KlB,CAAC"}
|
package/lib/stripe/meter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Stripe from "stripe";
|
|
2
1
|
import { Resource } from "../resource.js";
|
|
2
|
+
import { createStripeClient, isStripeConflictError } from "./client.js";
|
|
3
3
|
/**
|
|
4
4
|
* Manages Stripe Billing Meters. Meters allow you to define how usage of a product
|
|
5
5
|
* is measured and aggregated for billing purposes. You can track events and their
|
|
@@ -86,11 +86,7 @@ import { Resource } from "../resource.js";
|
|
|
86
86
|
* });
|
|
87
87
|
*/
|
|
88
88
|
export const Meter = Resource("stripe::Meter", async function (_logicalId, props) {
|
|
89
|
-
const
|
|
90
|
-
if (!apiKey) {
|
|
91
|
-
throw new Error("STRIPE_API_KEY environment variable is required");
|
|
92
|
-
}
|
|
93
|
-
const stripe = new Stripe(apiKey);
|
|
89
|
+
const stripe = createStripeClient({ apiKey: props.apiKey });
|
|
94
90
|
const currentOutputId = this.output?.id;
|
|
95
91
|
// Helper to map MeterProps (camelCase nested) to Stripe API params (snake_case nested)
|
|
96
92
|
const mapPropsToStripeParams = (inputProps) => ({
|
|
@@ -211,7 +207,17 @@ export const Meter = Resource("stripe::Meter", async function (_logicalId, props
|
|
|
211
207
|
throw new Error("displayName, eventName, defaultAggregation, customerMapping, and valueSettings are required for creating a Stripe Meter.");
|
|
212
208
|
}
|
|
213
209
|
const createParams = mapPropsToStripeParams(props);
|
|
214
|
-
|
|
210
|
+
try {
|
|
211
|
+
stripeAPIResponse = await stripe.billing.meters.create(createParams);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
if (isStripeConflictError(error) && props.adopt) {
|
|
215
|
+
throw new Error("Meter adoption is not supported - meters cannot be uniquely identified for adoption");
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
215
221
|
// If status 'inactive' is requested during creation, and Stripe created it as 'active'
|
|
216
222
|
if (props.status === "inactive" &&
|
|
217
223
|
stripeAPIResponse.status === "active") {
|
package/lib/stripe/meter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.js","sourceRoot":"","sources":["../../src/stripe/meter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meter.js","sourceRoot":"","sources":["../../src/stripe/meter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA2DxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAC3B,eAAe,EACf,KAAK,WAEH,UAAkB,EAClB,KAAiB;IAEjB,MAAM,MA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iB,CAAC,MAAM,kBAAkB,KAAK,CAAC,MAAM,4BAA4B,CACxI,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAC/D,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import type { Context } from "../context.ts";
|
|
3
|
+
import { Resource } from "../resource.ts";
|
|
4
|
+
import type { Secret } from "../secret.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Business profile information for the portal
|
|
7
|
+
*/
|
|
8
|
+
export interface PortalConfigurationBusinessProfile {
|
|
9
|
+
/**
|
|
10
|
+
* The messaging shown to customers in the portal
|
|
11
|
+
*/
|
|
12
|
+
headline?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A link to the business's publicly available privacy policy
|
|
15
|
+
*/
|
|
16
|
+
privacyPolicyUrl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A link to the business's publicly available terms of service
|
|
19
|
+
*/
|
|
20
|
+
termsOfServiceUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Customer update feature configuration
|
|
24
|
+
*/
|
|
25
|
+
export interface PortalCustomerUpdateFeature {
|
|
26
|
+
/**
|
|
27
|
+
* The types of customer update that are supported
|
|
28
|
+
*/
|
|
29
|
+
allowedUpdates?: Array<Stripe.BillingPortal.ConfigurationCreateParams.Features.CustomerUpdate.AllowedUpdate>;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the feature is enabled
|
|
32
|
+
*/
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Invoice history feature configuration
|
|
37
|
+
*/
|
|
38
|
+
export interface PortalInvoiceHistoryFeature {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the feature is enabled
|
|
41
|
+
*/
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Payment method update feature configuration
|
|
46
|
+
*/
|
|
47
|
+
export interface PortalPaymentMethodUpdateFeature {
|
|
48
|
+
/**
|
|
49
|
+
* Whether the feature is enabled
|
|
50
|
+
*/
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Subscription cancellation reason configuration
|
|
55
|
+
*/
|
|
56
|
+
export interface PortalSubscriptionCancellationReason {
|
|
57
|
+
/**
|
|
58
|
+
* Whether the feature is enabled
|
|
59
|
+
*/
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Which cancellation reasons will be given as options to the customer
|
|
63
|
+
*/
|
|
64
|
+
options?: Array<Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason.Option>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Subscription cancel feature configuration
|
|
68
|
+
*/
|
|
69
|
+
export interface PortalSubscriptionCancelFeature {
|
|
70
|
+
/**
|
|
71
|
+
* Cancellation reason configuration
|
|
72
|
+
*/
|
|
73
|
+
cancellationReason?: PortalSubscriptionCancellationReason;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the feature is enabled
|
|
76
|
+
*/
|
|
77
|
+
enabled?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to cancel subscriptions immediately or at the end of the billing period
|
|
80
|
+
*/
|
|
81
|
+
mode?: Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionCancel.Mode;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to create prorations when canceling subscriptions
|
|
84
|
+
*/
|
|
85
|
+
prorationBehavior?: Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionCancel.ProrationBehavior;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Subscription pause feature configuration
|
|
89
|
+
*/
|
|
90
|
+
export interface PortalSubscriptionPauseFeature {
|
|
91
|
+
/**
|
|
92
|
+
* Whether the feature is enabled
|
|
93
|
+
*/
|
|
94
|
+
enabled?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Subscription update product configuration
|
|
98
|
+
*/
|
|
99
|
+
export interface PortalSubscriptionUpdateProduct {
|
|
100
|
+
product: string;
|
|
101
|
+
prices?: string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Subscription update feature configuration
|
|
105
|
+
*/
|
|
106
|
+
export interface PortalSubscriptionUpdateFeature {
|
|
107
|
+
/**
|
|
108
|
+
* The types of subscription updates that are supported for items
|
|
109
|
+
*/
|
|
110
|
+
defaultAllowedUpdates?: Array<Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionUpdate.DefaultAllowedUpdate>;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the feature is enabled
|
|
113
|
+
*/
|
|
114
|
+
enabled?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* The list of products that support subscription updates
|
|
117
|
+
*/
|
|
118
|
+
products?: Array<PortalSubscriptionUpdateProduct>;
|
|
119
|
+
/**
|
|
120
|
+
* Determines how to handle prorations resulting from subscription updates
|
|
121
|
+
*/
|
|
122
|
+
prorationBehavior?: Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionUpdate.ProrationBehavior;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Features available in the customer portal
|
|
126
|
+
*/
|
|
127
|
+
export interface PortalConfigurationFeatures {
|
|
128
|
+
/**
|
|
129
|
+
* Information about updating the customer details in the portal
|
|
130
|
+
*/
|
|
131
|
+
customerUpdate?: PortalCustomerUpdateFeature;
|
|
132
|
+
/**
|
|
133
|
+
* Information about showing the billing history in the portal
|
|
134
|
+
*/
|
|
135
|
+
invoiceHistory?: PortalInvoiceHistoryFeature;
|
|
136
|
+
/**
|
|
137
|
+
* Information about updating payment methods in the portal
|
|
138
|
+
*/
|
|
139
|
+
paymentMethodUpdate?: PortalPaymentMethodUpdateFeature;
|
|
140
|
+
/**
|
|
141
|
+
* Information about canceling subscriptions in the portal
|
|
142
|
+
*/
|
|
143
|
+
subscriptionCancel?: PortalSubscriptionCancelFeature;
|
|
144
|
+
/**
|
|
145
|
+
* Information about pausing subscriptions in the portal
|
|
146
|
+
*/
|
|
147
|
+
subscriptionPause?: PortalSubscriptionPauseFeature;
|
|
148
|
+
/**
|
|
149
|
+
* Information about updating subscriptions in the portal
|
|
150
|
+
*/
|
|
151
|
+
subscriptionUpdate?: PortalSubscriptionUpdateFeature;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Properties for creating a Stripe portal configuration
|
|
155
|
+
*/
|
|
156
|
+
export interface PortalConfigurationProps {
|
|
157
|
+
/**
|
|
158
|
+
* The business information shown to customers in the portal
|
|
159
|
+
*/
|
|
160
|
+
businessProfile?: PortalConfigurationBusinessProfile;
|
|
161
|
+
/**
|
|
162
|
+
* The default URL to redirect customers to when they click on the portal's link to return to your website
|
|
163
|
+
*/
|
|
164
|
+
defaultReturnUrl?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Information about the features available in the portal
|
|
167
|
+
*/
|
|
168
|
+
features?: PortalConfigurationFeatures;
|
|
169
|
+
/**
|
|
170
|
+
* Set of key-value pairs that you can attach to an object
|
|
171
|
+
*/
|
|
172
|
+
metadata?: Record<string, string>;
|
|
173
|
+
/**
|
|
174
|
+
* API key to use (overrides environment variable)
|
|
175
|
+
*/
|
|
176
|
+
apiKey?: Secret;
|
|
177
|
+
/**
|
|
178
|
+
* If true, adopt existing resource if creation fails due to conflict
|
|
179
|
+
*/
|
|
180
|
+
adopt?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Output from the Stripe portal configuration
|
|
184
|
+
*/
|
|
185
|
+
export interface PortalConfiguration extends Resource<"stripe::PortalConfiguration">, PortalConfigurationProps {
|
|
186
|
+
/**
|
|
187
|
+
* The ID of the configuration
|
|
188
|
+
*/
|
|
189
|
+
id: string;
|
|
190
|
+
/**
|
|
191
|
+
* String representing the object's type
|
|
192
|
+
*/
|
|
193
|
+
object: "billing_portal.configuration";
|
|
194
|
+
/**
|
|
195
|
+
* Whether the configuration is active and can be used to create portal sessions
|
|
196
|
+
*/
|
|
197
|
+
active: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* ID of the Connect Application that created the configuration
|
|
200
|
+
*/
|
|
201
|
+
application?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Time at which the object was created
|
|
204
|
+
*/
|
|
205
|
+
created: number;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the configuration is the default
|
|
208
|
+
*/
|
|
209
|
+
isDefault: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Has the value true if the object exists in live mode or the value false if the object exists in test mode
|
|
212
|
+
*/
|
|
213
|
+
livemode: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Time at which the object was last updated
|
|
216
|
+
*/
|
|
217
|
+
updated: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Create and manage Stripe customer portal configurations
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* // Create a basic portal configuration
|
|
224
|
+
* const basicPortal = await PortalConfiguration("basic-portal", {
|
|
225
|
+
* businessProfile: {
|
|
226
|
+
* headline: "Manage your subscription",
|
|
227
|
+
* privacyPolicyUrl: "https://example.com/privacy",
|
|
228
|
+
* termsOfServiceUrl: "https://example.com/terms"
|
|
229
|
+
* },
|
|
230
|
+
* features: {
|
|
231
|
+
* invoiceHistory: { enabled: true },
|
|
232
|
+
* paymentMethodUpdate: { enabled: true }
|
|
233
|
+
* }
|
|
234
|
+
* });
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* // Create a portal with subscription management
|
|
238
|
+
* const subscriptionPortal = await PortalConfiguration("subscription-portal", {
|
|
239
|
+
* defaultReturnUrl: "https://example.com/account",
|
|
240
|
+
* features: {
|
|
241
|
+
* subscriptionCancel: {
|
|
242
|
+
* enabled: true,
|
|
243
|
+
* mode: "at_period_end",
|
|
244
|
+
* prorationBehavior: "none"
|
|
245
|
+
* },
|
|
246
|
+
* subscriptionUpdate: {
|
|
247
|
+
* enabled: true,
|
|
248
|
+
* defaultAllowedUpdates: ["price", "quantity"],
|
|
249
|
+
* prorationBehavior: "create_prorations"
|
|
250
|
+
* }
|
|
251
|
+
* }
|
|
252
|
+
* });
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* // Create a comprehensive portal configuration
|
|
256
|
+
* const fullPortal = await PortalConfiguration("full-portal", {
|
|
257
|
+
* businessProfile: {
|
|
258
|
+
* headline: "Manage your Acme Corp subscription",
|
|
259
|
+
* privacyPolicyUrl: "https://acme.com/privacy",
|
|
260
|
+
* termsOfServiceUrl: "https://acme.com/terms"
|
|
261
|
+
* },
|
|
262
|
+
* defaultReturnUrl: "https://acme.com/dashboard",
|
|
263
|
+
* features: {
|
|
264
|
+
* customerUpdate: {
|
|
265
|
+
* enabled: true,
|
|
266
|
+
* allowedUpdates: ["email", "address", "shipping", "phone", "tax_id"]
|
|
267
|
+
* },
|
|
268
|
+
* invoiceHistory: { enabled: true },
|
|
269
|
+
* paymentMethodUpdate: { enabled: true },
|
|
270
|
+
* subscriptionCancel: {
|
|
271
|
+
* enabled: true,
|
|
272
|
+
* mode: "immediately",
|
|
273
|
+
* cancellationReason: {
|
|
274
|
+
* enabled: true,
|
|
275
|
+
* options: ["too_expensive", "missing_features", "switched_service"]
|
|
276
|
+
* }
|
|
277
|
+
* }
|
|
278
|
+
* },
|
|
279
|
+
* metadata: {
|
|
280
|
+
* environment: "production",
|
|
281
|
+
* version: "v2"
|
|
282
|
+
* }
|
|
283
|
+
* });
|
|
284
|
+
*/
|
|
285
|
+
export declare const PortalConfiguration: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<PortalConfiguration>, _id: string, props: PortalConfigurationProps) => Promise<PortalConfiguration>);
|
|
286
|
+
//# sourceMappingURL=portal-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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