alchemy 0.1.16 → 0.1.18
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/$.d.ts +12 -0
- package/lib/$.d.ts.map +1 -0
- package/lib/$.js +42 -0
- package/lib/$.js.map +1 -0
- package/lib/alchemize.d.ts +47 -0
- package/lib/alchemize.d.ts.map +1 -0
- package/lib/alchemize.js +116 -0
- package/lib/alchemize.js.map +1 -0
- package/lib/apply.d.ts +23 -0
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +4 -0
- package/lib/apply.js.map +1 -1
- package/lib/aws/account-id.d.ts +5 -0
- package/lib/aws/account-id.d.ts.map +1 -0
- package/lib/aws/account-id.js +10 -0
- package/lib/aws/account-id.js.map +1 -0
- package/lib/aws/bucket.d.ts +21 -0
- package/lib/aws/bucket.d.ts.map +1 -0
- package/lib/aws/bucket.js +114 -0
- package/lib/aws/bucket.js.map +1 -0
- package/lib/aws/function.d.ts +53 -0
- package/lib/aws/function.d.ts.map +1 -0
- package/lib/aws/function.js +195 -0
- package/lib/aws/function.js.map +1 -0
- package/lib/aws/index.d.ts +9 -0
- package/lib/aws/index.d.ts.map +1 -0
- package/lib/aws/index.js +9 -0
- package/lib/aws/index.js.map +1 -0
- package/lib/aws/oidc/github-oidc-provider.d.ts +11 -0
- package/lib/aws/oidc/github-oidc-provider.d.ts.map +1 -0
- package/lib/aws/oidc/github-oidc-provider.js +22 -0
- package/lib/aws/oidc/github-oidc-provider.js.map +1 -0
- package/lib/aws/oidc/index.d.ts +3 -0
- package/lib/aws/oidc/index.d.ts.map +1 -0
- package/lib/aws/oidc/index.js +3 -0
- package/lib/aws/oidc/index.js.map +1 -0
- package/lib/aws/oidc/oidc-provider.d.ts +60 -0
- package/lib/aws/oidc/oidc-provider.d.ts.map +1 -0
- package/lib/aws/oidc/oidc-provider.js +140 -0
- package/lib/aws/oidc/oidc-provider.js.map +1 -0
- package/lib/aws/policy.d.ts +46 -0
- package/lib/aws/policy.d.ts.map +1 -0
- package/lib/aws/policy.js +139 -0
- package/lib/aws/policy.js.map +1 -0
- package/lib/aws/queue.d.ts +62 -0
- package/lib/aws/queue.d.ts.map +1 -0
- package/lib/aws/queue.js +167 -0
- package/lib/aws/queue.js.map +1 -0
- package/lib/aws/role.d.ts +27 -0
- package/lib/aws/role.d.ts.map +1 -0
- package/lib/aws/role.js +197 -0
- package/lib/aws/role.js.map +1 -0
- package/lib/aws/ses.d.ts +75 -0
- package/lib/aws/ses.d.ts.map +1 -0
- package/lib/aws/ses.js +189 -0
- package/lib/aws/ses.js.map +1 -0
- package/lib/aws/table.d.ts +26 -0
- package/lib/aws/table.d.ts.map +1 -0
- package/lib/aws/table.js +154 -0
- package/lib/aws/table.js.map +1 -0
- package/lib/cloudflare/api.d.ts +88 -0
- package/lib/cloudflare/api.d.ts.map +1 -0
- package/lib/cloudflare/api.js +184 -0
- package/lib/cloudflare/api.js.map +1 -0
- package/lib/cloudflare/asset-manifest.d.ts +15 -0
- package/lib/cloudflare/asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/asset-manifest.js +2 -0
- package/lib/cloudflare/asset-manifest.js.map +1 -0
- package/lib/cloudflare/auth.d.ts +52 -0
- package/lib/cloudflare/auth.d.ts.map +1 -0
- package/lib/cloudflare/auth.js +114 -0
- package/lib/cloudflare/auth.js.map +1 -0
- package/lib/cloudflare/bindings.d.ts +261 -0
- package/lib/cloudflare/bindings.d.ts.map +1 -0
- package/lib/cloudflare/bindings.js +2 -0
- package/lib/cloudflare/bindings.js.map +1 -0
- package/lib/cloudflare/bound.d.ts +8 -0
- package/lib/cloudflare/bound.d.ts.map +1 -0
- package/lib/cloudflare/bound.js +2 -0
- package/lib/cloudflare/bound.js.map +1 -0
- package/lib/cloudflare/bucket.d.ts +54 -0
- package/lib/cloudflare/bucket.d.ts.map +1 -0
- package/lib/cloudflare/bucket.js +120 -0
- package/lib/cloudflare/bucket.js.map +1 -0
- package/lib/cloudflare/durable-object-namespace.d.ts +20 -0
- package/lib/cloudflare/durable-object-namespace.d.ts.map +1 -0
- package/lib/cloudflare/durable-object-namespace.js +21 -0
- package/lib/cloudflare/durable-object-namespace.js.map +1 -0
- package/lib/cloudflare/generate-asset-manifest.d.ts +3 -0
- package/lib/cloudflare/generate-asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/generate-asset-manifest.js +69 -0
- package/lib/cloudflare/generate-asset-manifest.js.map +1 -0
- package/lib/cloudflare/index.d.ts +8 -0
- package/lib/cloudflare/index.d.ts.map +1 -0
- package/lib/cloudflare/index.js +8 -0
- package/lib/cloudflare/index.js.map +1 -0
- package/lib/cloudflare/kv-namespace.d.ts +64 -0
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -0
- package/lib/cloudflare/kv-namespace.js +114 -0
- package/lib/cloudflare/kv-namespace.js.map +1 -0
- package/lib/cloudflare/state.d.ts +83 -0
- package/lib/cloudflare/state.d.ts.map +1 -0
- package/lib/cloudflare/state.js +109 -0
- package/lib/cloudflare/state.js.map +1 -0
- package/lib/cloudflare/static-site-router.d.ts +19 -0
- package/lib/cloudflare/static-site-router.d.ts.map +1 -0
- package/lib/cloudflare/static-site-router.js +110 -0
- package/lib/cloudflare/static-site-router.js.map +1 -0
- package/lib/cloudflare/static-site.d.ts +166 -0
- package/lib/cloudflare/static-site.d.ts.map +1 -0
- package/lib/cloudflare/static-site.js +161 -0
- package/lib/cloudflare/static-site.js.map +1 -0
- package/lib/cloudflare/types.d.ts +52 -0
- package/lib/cloudflare/types.d.ts.map +1 -0
- package/lib/cloudflare/types.js +21 -0
- package/lib/cloudflare/types.js.map +1 -0
- package/lib/cloudflare/upload-asset-manifest.d.ts +12 -0
- package/lib/cloudflare/upload-asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/upload-asset-manifest.js +55 -0
- package/lib/cloudflare/upload-asset-manifest.js.map +1 -0
- package/lib/cloudflare/worker-metadata.d.ts +130 -0
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -0
- package/lib/cloudflare/worker-metadata.js +2 -0
- package/lib/cloudflare/worker-metadata.js.map +1 -0
- package/lib/cloudflare/worker-migration.d.ts +110 -0
- package/lib/cloudflare/worker-migration.d.ts.map +1 -0
- package/lib/cloudflare/worker-migration.js +11 -0
- package/lib/cloudflare/worker-migration.js.map +1 -0
- package/lib/cloudflare/worker.d.ts +114 -0
- package/lib/cloudflare/worker.d.ts.map +1 -0
- package/lib/cloudflare/worker.js +419 -0
- package/lib/cloudflare/worker.js.map +1 -0
- package/lib/destroy.d.ts +19 -0
- package/lib/encrypt.d.ts +17 -0
- package/lib/encrypt.d.ts.map +1 -0
- package/lib/encrypt.js +45 -0
- package/lib/encrypt.js.map +1 -0
- package/lib/error.d.ts +2 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +13 -0
- package/lib/error.js.map +1 -0
- package/lib/esbuild.d.ts +152 -0
- package/lib/esbuild.d.ts.map +1 -0
- package/lib/esbuild.js +67 -0
- package/lib/esbuild.js.map +1 -0
- package/lib/fs.d.ts +12 -0
- package/lib/fs.d.ts.map +1 -0
- package/lib/fs.js +41 -0
- package/lib/fs.js.map +1 -0
- package/lib/github/client.d.ts +34 -0
- package/lib/github/client.d.ts.map +1 -0
- package/lib/github/client.js +91 -0
- package/lib/github/client.js.map +1 -0
- package/lib/github/index.d.ts +2 -0
- package/lib/github/index.d.ts.map +1 -0
- package/lib/github/index.js +2 -0
- package/lib/github/index.js.map +1 -0
- package/lib/github/secret.d.ts +47 -0
- package/lib/github/secret.d.ts.map +1 -0
- package/lib/github/secret.js +99 -0
- package/lib/github/secret.js.map +1 -0
- package/lib/global.d.ts +16 -0
- package/lib/global.d.ts.map +1 -0
- package/lib/global.js +42 -0
- package/lib/global.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/input.d.ts +7 -0
- package/lib/input.d.ts.map +1 -0
- package/lib/input.js +2 -0
- package/lib/input.js.map +1 -0
- package/lib/main.d.ts +3 -0
- package/lib/main.d.ts.map +1 -0
- package/lib/main.js +32 -0
- package/lib/main.js.map +1 -0
- package/lib/output.d.ts +25 -0
- package/lib/output.d.ts.map +1 -0
- package/lib/output.js +23 -0
- package/lib/output.js.map +1 -0
- package/lib/print.d.ts +7 -0
- package/lib/print.d.ts.map +1 -0
- package/lib/print.js +10 -0
- package/lib/print.js.map +1 -0
- package/lib/resource.d.ts +71 -0
- package/lib/resource.d.ts.map +1 -0
- package/lib/resource.js +276 -0
- package/lib/resource.js.map +1 -0
- package/lib/scope.d.ts +18 -0
- package/lib/scope.d.ts.map +1 -0
- package/lib/scope.js +30 -0
- package/lib/scope.js.map +1 -0
- package/lib/secret.d.ts +12 -0
- package/lib/secret.d.ts.map +1 -0
- package/lib/secret.js +30 -0
- package/lib/secret.js.map +1 -0
- package/lib/serde.d.ts +3 -0
- package/lib/serde.d.ts.map +1 -0
- package/lib/serde.js +37 -0
- package/lib/serde.js.map +1 -0
- package/lib/slug.d.ts +2 -0
- package/lib/slug.d.ts.map +1 -0
- package/lib/slug.js +4 -0
- package/lib/slug.js.map +1 -0
- package/lib/state.d.ts +40 -0
- package/lib/state.d.ts.map +1 -0
- package/lib/state.js +74 -0
- package/lib/state.js.map +1 -0
- package/lib/stripe/index.d.ts +4 -0
- package/lib/stripe/index.d.ts.map +1 -0
- package/lib/stripe/index.js +4 -0
- package/lib/stripe/index.js.map +1 -0
- package/lib/stripe/price.d.ts +109 -0
- package/lib/stripe/price.d.ts.map +1 -0
- package/lib/stripe/price.js +112 -0
- package/lib/stripe/price.js.map +1 -0
- package/lib/stripe/product.d.ts +86 -0
- package/lib/stripe/product.d.ts.map +1 -0
- package/lib/stripe/product.js +90 -0
- package/lib/stripe/product.js.map +1 -0
- package/lib/stripe/webhook.d.ts +73 -0
- package/lib/stripe/webhook.d.ts.map +1 -0
- package/lib/stripe/webhook.js +94 -0
- package/lib/stripe/webhook.js.map +1 -0
- package/lib/utils/content-type.d.ts +8 -0
- package/lib/utils/content-type.d.ts.map +1 -0
- package/lib/utils/content-type.js +41 -0
- package/lib/utils/content-type.js.map +1 -0
- package/lib/utils/retry.d.ts +13 -0
- package/lib/utils/retry.d.ts.map +1 -0
- package/lib/utils/retry.js +32 -0
- package/lib/utils/retry.js.map +1 -0
- package/package.json +3 -6
- package/src/alchemize.ts +9 -0
- package/src/apply.ts +3 -0
- package/src/cloudflare/bindings.ts +9 -1
- package/src/cloudflare/bound.ts +18 -0
- package/src/cloudflare/bucket.ts +240 -0
- package/src/cloudflare/index.ts +1 -0
- package/src/cloudflare/static-site.ts +14 -2
- package/src/cloudflare/worker.ts +84 -59
- package/src/encrypt.ts +79 -0
- package/src/github/secret.ts +34 -33
- package/src/index.ts +1 -0
- package/src/input.ts +13 -10
- package/src/output.ts +13 -9
- package/src/secret.ts +41 -0
- package/src/serde.ts +46 -0
- package/src/state.ts +3 -2
package/lib/scope.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
const scopeStorage = new AsyncLocalStorage();
|
|
4
|
+
export class Scope {
|
|
5
|
+
scopeName;
|
|
6
|
+
parent;
|
|
7
|
+
nodes = new Map();
|
|
8
|
+
callbacks = [];
|
|
9
|
+
constructor(scopeName = null, parent = undefined) {
|
|
10
|
+
this.scopeName = scopeName;
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
getScopePath(root) {
|
|
14
|
+
// First, compute the parent's scope path
|
|
15
|
+
const parentPath = this.parent ? this.parent.getScopePath(root) : root;
|
|
16
|
+
// Then join the current scope name (if any) onto the parent's path
|
|
17
|
+
return this.scopeName ? path.join(parentPath, this.scopeName) : parentPath;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const rootScope = new Scope(null);
|
|
21
|
+
export function getScope() {
|
|
22
|
+
return scopeStorage.getStore() ?? rootScope;
|
|
23
|
+
}
|
|
24
|
+
export function withScope(scope, fn) {
|
|
25
|
+
return scopeStorage.run(scope, async () => fn());
|
|
26
|
+
}
|
|
27
|
+
export function pushScope(parent, scopeName, fn) {
|
|
28
|
+
return scopeStorage.run(new Scope(scopeName, parent), async () => fn());
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=scope.js.map
|
package/lib/scope.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAS,CAAC;AAEpD,MAAM,OAAO,KAAK;IAYE;IACA;IAZF,KAAK,GAAG,IAAI,GAAG,EAM5B,CAAC;IAEY,SAAS,GAAmB,EAAE,CAAC;IAE/C,YACkB,YAA2B,IAAI,EAC/B,SAA4B,SAAS;QADrC,cAAS,GAAT,SAAS,CAAsB;QAC/B,WAAM,GAAN,MAAM,CAA+B;IACpD,CAAC;IAEG,YAAY,CAAC,IAAY;QAC9B,yCAAyC;QACzC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACvE,mEAAmE;QACnE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAC7E,CAAC;CACF;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AAEzC,MAAM,UAAU,QAAQ;IACtB,OAAO,YAAY,CAAC,QAAQ,EAAE,IAAI,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,KAAY,EACZ,EAAwB;IAExB,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,MAAa,EACb,SAAiB,EACjB,EAAwB;IAExB,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
package/lib/secret.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Input } from "./input";
|
|
2
|
+
import { type Output } from "./output";
|
|
3
|
+
export declare function secret<S extends Input<string> | undefined>(unencrypted: S): S extends undefined ? never : S extends Output<string> ? Output<Secret> : Secret;
|
|
4
|
+
export declare class Secret {
|
|
5
|
+
readonly unencrypted: string;
|
|
6
|
+
readonly type = "secret";
|
|
7
|
+
constructor(unencrypted: string);
|
|
8
|
+
}
|
|
9
|
+
export declare function setSecretPassphrase(passphrase: string): void;
|
|
10
|
+
export declare function getSecretPassphrase(): string;
|
|
11
|
+
export declare function tryGetSecretPassphrase(): string | undefined;
|
|
12
|
+
//# sourceMappingURL=secret.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../src/secret.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,UAAU,CAAC;AAIjD,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,EACxD,WAAW,EAAE,CAAC,GACb,CAAC,SAAS,SAAS,GAClB,KAAK,GACL,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GACtB,MAAM,CAAC,MAAM,CAAC,GACd,MAAM,CAOX;AAED,qBAAa,MAAM;IAEL,QAAQ,CAAC,WAAW,EAAE,MAAM;IADxC,SAAgB,IAAI,YAAY;gBACX,WAAW,EAAE,MAAM;CACzC;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,QAErD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAED,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAE3D"}
|
package/lib/secret.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { isOutput } from "./output";
|
|
3
|
+
const passphraseContext = new AsyncLocalStorage();
|
|
4
|
+
export function secret(unencrypted) {
|
|
5
|
+
if (unencrypted === undefined) {
|
|
6
|
+
throw new Error("Secret cannot be undefined");
|
|
7
|
+
}
|
|
8
|
+
return (isOutput(unencrypted) ? unencrypted.apply(secret) : new Secret(unencrypted));
|
|
9
|
+
}
|
|
10
|
+
export class Secret {
|
|
11
|
+
unencrypted;
|
|
12
|
+
type = "secret";
|
|
13
|
+
constructor(unencrypted) {
|
|
14
|
+
this.unencrypted = unencrypted;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function setSecretPassphrase(passphrase) {
|
|
18
|
+
passphraseContext.enterWith(passphrase);
|
|
19
|
+
}
|
|
20
|
+
export function getSecretPassphrase() {
|
|
21
|
+
const passphrase = passphraseContext.getStore();
|
|
22
|
+
if (!passphrase) {
|
|
23
|
+
throw new Error("No passphrase set");
|
|
24
|
+
}
|
|
25
|
+
return passphrase;
|
|
26
|
+
}
|
|
27
|
+
export function tryGetSecretPassphrase() {
|
|
28
|
+
return passphraseContext.getStore();
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=secret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../src/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,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G,CAAC,CAsB1D"}
|
package/lib/serde.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { decryptWithKey, encryptWithKey } from "./encrypt";
|
|
2
|
+
import { Secret, getSecretPassphrase } from "./secret";
|
|
3
|
+
export async function serialize(value) {
|
|
4
|
+
if (Array.isArray(value)) {
|
|
5
|
+
return Promise.all(value.map(serialize));
|
|
6
|
+
}
|
|
7
|
+
else if (value instanceof Secret) {
|
|
8
|
+
return {
|
|
9
|
+
"@secret": await encryptWithKey(value.unencrypted, getSecretPassphrase()),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
else if (value && typeof value === "object") {
|
|
13
|
+
return Object.fromEntries(await Promise.all(Object.entries(value).map(async ([key, value]) => [
|
|
14
|
+
key,
|
|
15
|
+
await serialize(value),
|
|
16
|
+
])));
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
export async function deserialize(value) {
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
return await Promise.all(value.map(async (item) => await deserialize(item)));
|
|
23
|
+
}
|
|
24
|
+
else if (value && typeof value === "object") {
|
|
25
|
+
if (typeof value["@secret"] === "string") {
|
|
26
|
+
return new Secret(await decryptWithKey(value["@secret"], getSecretPassphrase()));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return Object.fromEntries(await Promise.all(Object.entries(value).map(async ([key, value]) => [
|
|
30
|
+
key,
|
|
31
|
+
await deserialize(value),
|
|
32
|
+
])));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=serde.js.map
|
package/lib/serde.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serde.js","sourceRoot":"","sources":["../src/serde.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,MAAM,EAA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C,EAAE,mBAAmB,EAAE,CAAC,CAC9D,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;gBAChD,GAAG;gBACH,MAAM,WAAW,CAAC,KAAK,CAAC;aACzB,CAAC,CACH,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/lib/slug.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../src/slug.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,UAElC"}
|
package/lib/slug.js
ADDED
package/lib/slug.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../src/slug.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
package/lib/state.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface State {
|
|
2
|
+
status: `creating` | `created` | `updating` | `updated` | `deleting` | `deleted`;
|
|
3
|
+
provider: string;
|
|
4
|
+
data: Record<string, any>;
|
|
5
|
+
deps: string[];
|
|
6
|
+
inputs: any[];
|
|
7
|
+
oldInputs?: any[];
|
|
8
|
+
output: any;
|
|
9
|
+
}
|
|
10
|
+
export interface StateStore {
|
|
11
|
+
/** Initialize the state container if one is required */
|
|
12
|
+
init?(): Promise<void>;
|
|
13
|
+
/** Delete the state container if one exists */
|
|
14
|
+
deinit?(): Promise<void>;
|
|
15
|
+
/** List all resources in the given stage. */
|
|
16
|
+
list(): Promise<string[]>;
|
|
17
|
+
/** Return the number of items let in this store */
|
|
18
|
+
count(): Promise<number>;
|
|
19
|
+
get(key: string): Promise<State | undefined>;
|
|
20
|
+
getBatch(ids: string[]): Promise<Record<string, State>>;
|
|
21
|
+
all(): Promise<Record<string, State>>;
|
|
22
|
+
set(key: string, value: State): Promise<void>;
|
|
23
|
+
delete(key: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export type StateStoreType = new (dir: string) => StateStore;
|
|
26
|
+
export declare class FileSystemStateStore implements StateStore {
|
|
27
|
+
readonly path: string;
|
|
28
|
+
constructor(dir: string);
|
|
29
|
+
init(): Promise<void>;
|
|
30
|
+
deinit(): Promise<void>;
|
|
31
|
+
count(): Promise<number>;
|
|
32
|
+
list(): Promise<string[]>;
|
|
33
|
+
get(key: string): Promise<State | undefined>;
|
|
34
|
+
set(key: string, value: State): Promise<void>;
|
|
35
|
+
delete(key: string): Promise<void>;
|
|
36
|
+
all(): Promise<Record<string, State>>;
|
|
37
|
+
getBatch(ids: string[]): Promise<Record<string, State>>;
|
|
38
|
+
private getPath;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,KAAK;IACpB,MAAM,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,MAAM,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,wDAAwD;IACxD,IAAI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C,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAIrC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAgB/C,OAAO;CAMtB"}
|
package/lib/state.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ignore } from "./error";
|
|
4
|
+
import { deserialize, serialize } from "./serde";
|
|
5
|
+
const stateFile = path.join(process.cwd(), ".alchemy");
|
|
6
|
+
export class FileSystemStateStore {
|
|
7
|
+
path;
|
|
8
|
+
constructor(dir) {
|
|
9
|
+
this.path = path.join(stateFile, dir);
|
|
10
|
+
}
|
|
11
|
+
async init() {
|
|
12
|
+
await fs.promises.mkdir(stateFile, { recursive: true });
|
|
13
|
+
await fs.promises.mkdir(this.path, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
async deinit() {
|
|
16
|
+
await ignore("ENOENT", () => fs.promises.rmdir(this.path));
|
|
17
|
+
}
|
|
18
|
+
async count() {
|
|
19
|
+
return Object.keys(await this.list()).length;
|
|
20
|
+
}
|
|
21
|
+
async list() {
|
|
22
|
+
try {
|
|
23
|
+
const files = await fs.promises.readdir(this.path, {
|
|
24
|
+
withFileTypes: true,
|
|
25
|
+
});
|
|
26
|
+
return files
|
|
27
|
+
.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".json"))
|
|
28
|
+
.map((dirent) => dirent.name.replace(/\.json$/, ""));
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error.code === "ENOENT") {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async get(key) {
|
|
38
|
+
try {
|
|
39
|
+
const content = await fs.promises.readFile(await this.getPath(key), "utf8");
|
|
40
|
+
return (await deserialize(JSON.parse(content)));
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error.code === "ENOENT") {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async set(key, value) {
|
|
50
|
+
return fs.promises.writeFile(await this.getPath(key), JSON.stringify(await serialize(value), null, 2));
|
|
51
|
+
}
|
|
52
|
+
async delete(key) {
|
|
53
|
+
return fs.promises.unlink(await this.getPath(key));
|
|
54
|
+
}
|
|
55
|
+
async all() {
|
|
56
|
+
return this.getBatch(await this.list());
|
|
57
|
+
}
|
|
58
|
+
async getBatch(ids) {
|
|
59
|
+
return Object.fromEntries((await Promise.all(Array.from(ids).flatMap(async (id) => {
|
|
60
|
+
const s = await this.get(id);
|
|
61
|
+
if (s === undefined) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
return [[id, s]];
|
|
65
|
+
}))).flat());
|
|
66
|
+
}
|
|
67
|
+
async getPath(key) {
|
|
68
|
+
const file = path.join(this.path, `${key}.json`);
|
|
69
|
+
const dir = path.dirname(file);
|
|
70
|
+
await fs.promises.mkdir(dir, { recursive: true });
|
|
71
|
+
return file;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=state.js.map
|
package/lib/state.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkCjD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC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,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACnC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC7B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;gBACpB,OAAO,EAAW,CAAC;YACrB,CAAC;YACD,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAU,CAAC;QAC5B,CAAC,CAAC,CACH,CACF,CAAC,IAAI,EAAE,CACT,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import Stripe from "stripe";
|
|
2
|
+
/**
|
|
3
|
+
* Properties for price recurring configuration
|
|
4
|
+
*/
|
|
5
|
+
export interface PriceRecurring {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies billing frequency. Either 'day', 'week', 'month' or 'year'.
|
|
8
|
+
*/
|
|
9
|
+
interval: Stripe.PriceCreateParams.Recurring.Interval;
|
|
10
|
+
/**
|
|
11
|
+
* The number of intervals between subscription billings. For example, interval=month and interval_count=3 bills every 3 months.
|
|
12
|
+
*/
|
|
13
|
+
intervalCount?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Configures how the quantity per period should be determined, can be either 'metered' or 'licensed'.
|
|
16
|
+
* 'licensed' will automatically bill the quantity set for a plan when adding it to a subscription,
|
|
17
|
+
* 'metered' will aggregate the total usage based on usage records.
|
|
18
|
+
*/
|
|
19
|
+
usageType?: Stripe.PriceCreateParams.Recurring.UsageType;
|
|
20
|
+
/**
|
|
21
|
+
* Specifies a usage aggregation strategy for prices of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period,
|
|
22
|
+
* `last_during_period` for picking the last usage record reported within a period,
|
|
23
|
+
* `last_ever` for picking the last usage record ever (across period bounds) or `max` which picks the usage record with the maximum reported usage during a period.
|
|
24
|
+
*/
|
|
25
|
+
aggregateUsage?: Stripe.PriceCreateParams.Recurring.AggregateUsage;
|
|
26
|
+
}
|
|
27
|
+
type TaxBehavior = Stripe.PriceCreateParams.TaxBehavior;
|
|
28
|
+
type BillingScheme = Stripe.PriceCreateParams.BillingScheme;
|
|
29
|
+
/**
|
|
30
|
+
* Properties for creating a Stripe price
|
|
31
|
+
*/
|
|
32
|
+
export interface PriceProps {
|
|
33
|
+
/**
|
|
34
|
+
* The ID of the product that this price will belong to
|
|
35
|
+
*/
|
|
36
|
+
product: string;
|
|
37
|
+
/**
|
|
38
|
+
* Three-letter ISO currency code, in lowercase. Must be a supported currency.
|
|
39
|
+
*/
|
|
40
|
+
currency: string;
|
|
41
|
+
/**
|
|
42
|
+
* A positive integer in cents (or local equivalent) representing how much to charge (e.g., 999 for $9.99).
|
|
43
|
+
* Alternatively, use unit_amount_decimal to specify a precise amount.
|
|
44
|
+
*/
|
|
45
|
+
unitAmount?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Same as unit_amount, but accepts a decimal string (e.g., '9.99') with at most 12 decimal places.
|
|
48
|
+
* Only one of unit_amount and unit_amount_decimal can be set.
|
|
49
|
+
*/
|
|
50
|
+
unitAmountDecimal?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the price can be used for new purchases
|
|
53
|
+
*/
|
|
54
|
+
active?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Describes how to compute the price per period. Either `per_unit` or `tiered`.
|
|
57
|
+
* `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`)
|
|
58
|
+
* will be charged per unit in `quantity`.
|
|
59
|
+
* `tiered` indicates that the unit pricing will be computed using a tiering strategy.
|
|
60
|
+
*/
|
|
61
|
+
billingScheme?: BillingScheme;
|
|
62
|
+
/**
|
|
63
|
+
* A brief description of the price, hidden from customers.
|
|
64
|
+
*/
|
|
65
|
+
nickname?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The recurring components of a price such as `interval` and `interval_count`.
|
|
68
|
+
*/
|
|
69
|
+
recurring?: PriceRecurring;
|
|
70
|
+
/**
|
|
71
|
+
* Set of key-value pairs that you can attach to an object.
|
|
72
|
+
*/
|
|
73
|
+
metadata?: Record<string, string>;
|
|
74
|
+
/**
|
|
75
|
+
* Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
|
|
76
|
+
* One of inclusive, exclusive, or unspecified.
|
|
77
|
+
*/
|
|
78
|
+
taxBehavior?: TaxBehavior;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Output from the Stripe price
|
|
82
|
+
*/
|
|
83
|
+
export interface PriceOutput extends PriceProps {
|
|
84
|
+
/**
|
|
85
|
+
* The ID of the price
|
|
86
|
+
*/
|
|
87
|
+
id: string;
|
|
88
|
+
/**
|
|
89
|
+
* Time at which the object was created
|
|
90
|
+
*/
|
|
91
|
+
createdAt: number;
|
|
92
|
+
/**
|
|
93
|
+
* Has the value true if the object exists in live mode or the value false if the object exists in test mode
|
|
94
|
+
*/
|
|
95
|
+
livemode: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The type of the price - either 'one_time' or 'recurring'
|
|
98
|
+
*/
|
|
99
|
+
type: Stripe.Price.Type;
|
|
100
|
+
/**
|
|
101
|
+
* The lookup key (if any) used by the customer to identify this price object
|
|
102
|
+
*/
|
|
103
|
+
lookupKey?: string;
|
|
104
|
+
}
|
|
105
|
+
declare const Price_base: import("../resource").Provider<"stripe::Price", [props: PriceProps], PriceOutput>;
|
|
106
|
+
export declare class Price extends Price_base {
|
|
107
|
+
}
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=price.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/stripe/price.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC;IAEzD;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,cAAc,CAAC;CACpE;AAED,KAAK,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC;AACxD,KAAK,aAAa,GAAG,MAAM,CAAC,iBAAiB,CAAC,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;AAED,qBAAa,KAAM,SAAQ,UAoH1B;CAAG"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import Stripe from "stripe";
|
|
2
|
+
import { Resource } from "../resource";
|
|
3
|
+
export class Price extends Resource("stripe::Price", async (ctx, props) => {
|
|
4
|
+
// Get Stripe API key from context or environment
|
|
5
|
+
const apiKey = process.env.STRIPE_API_KEY;
|
|
6
|
+
if (!apiKey) {
|
|
7
|
+
throw new Error("STRIPE_API_KEY environment variable is required");
|
|
8
|
+
}
|
|
9
|
+
// Initialize Stripe client
|
|
10
|
+
const stripe = new Stripe(apiKey);
|
|
11
|
+
if (ctx.event === "delete") {
|
|
12
|
+
try {
|
|
13
|
+
if (ctx.event === "delete" && ctx.output?.id) {
|
|
14
|
+
// Prices can't be deleted, only deactivated
|
|
15
|
+
await stripe.prices.update(ctx.output.id, { active: false });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
// Ignore if the price doesn't exist
|
|
20
|
+
console.error("Error deactivating price:", error);
|
|
21
|
+
}
|
|
22
|
+
// Return a minimal output for deleted state
|
|
23
|
+
return {
|
|
24
|
+
...props,
|
|
25
|
+
id: "",
|
|
26
|
+
createdAt: 0,
|
|
27
|
+
livemode: false,
|
|
28
|
+
type: (props.recurring ? "recurring" : "one_time"),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
try {
|
|
33
|
+
let price;
|
|
34
|
+
if (ctx.event === "update" && ctx.output?.id) {
|
|
35
|
+
// Update existing price (limited properties can be updated)
|
|
36
|
+
price = await stripe.prices.update(ctx.output.id, {
|
|
37
|
+
active: props.active,
|
|
38
|
+
metadata: props.metadata,
|
|
39
|
+
nickname: props.nickname,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Create new price
|
|
44
|
+
const createParams = {
|
|
45
|
+
currency: props.currency,
|
|
46
|
+
product: props.product,
|
|
47
|
+
active: props.active,
|
|
48
|
+
billing_scheme: props.billingScheme,
|
|
49
|
+
nickname: props.nickname,
|
|
50
|
+
metadata: props.metadata,
|
|
51
|
+
tax_behavior: props.taxBehavior,
|
|
52
|
+
};
|
|
53
|
+
// Add unit amount fields
|
|
54
|
+
if (props.unitAmount !== undefined) {
|
|
55
|
+
createParams.unit_amount = props.unitAmount;
|
|
56
|
+
}
|
|
57
|
+
else if (props.unitAmountDecimal !== undefined) {
|
|
58
|
+
createParams.unit_amount_decimal = props.unitAmountDecimal;
|
|
59
|
+
}
|
|
60
|
+
// Add recurring parameters if present
|
|
61
|
+
if (props.recurring) {
|
|
62
|
+
createParams.recurring = {
|
|
63
|
+
interval: props.recurring.interval,
|
|
64
|
+
interval_count: props.recurring.intervalCount,
|
|
65
|
+
usage_type: props.recurring.usageType,
|
|
66
|
+
aggregate_usage: props.recurring.aggregateUsage,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
price = await stripe.prices.create(createParams);
|
|
70
|
+
}
|
|
71
|
+
// Transform Stripe recurring object to our format
|
|
72
|
+
const recurring = price.recurring
|
|
73
|
+
? {
|
|
74
|
+
interval: price.recurring
|
|
75
|
+
.interval,
|
|
76
|
+
intervalCount: price.recurring.interval_count,
|
|
77
|
+
usageType: price.recurring
|
|
78
|
+
.usage_type,
|
|
79
|
+
aggregateUsage: price.recurring
|
|
80
|
+
.aggregate_usage,
|
|
81
|
+
}
|
|
82
|
+
: undefined;
|
|
83
|
+
// Map Stripe API response to our output format
|
|
84
|
+
const output = {
|
|
85
|
+
id: price.id,
|
|
86
|
+
product: typeof price.product === "string"
|
|
87
|
+
? price.product
|
|
88
|
+
: price.product.id,
|
|
89
|
+
currency: price.currency,
|
|
90
|
+
unitAmount: price.unit_amount || undefined,
|
|
91
|
+
unitAmountDecimal: price.unit_amount_decimal || undefined,
|
|
92
|
+
active: price.active,
|
|
93
|
+
billingScheme: price.billing_scheme,
|
|
94
|
+
nickname: price.nickname || undefined,
|
|
95
|
+
recurring: recurring,
|
|
96
|
+
metadata: price.metadata || undefined,
|
|
97
|
+
taxBehavior: price.tax_behavior,
|
|
98
|
+
createdAt: price.created,
|
|
99
|
+
livemode: price.livemode,
|
|
100
|
+
type: price.type,
|
|
101
|
+
lookupKey: price.lookup_key || undefined,
|
|
102
|
+
};
|
|
103
|
+
return output;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error("Error creating/updating price:", error);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}) {
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/stripe/price.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA6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ACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC,CACF;CAAG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import Stripe from "stripe";
|
|
2
|
+
type ProductType = Stripe.Product.Type;
|
|
3
|
+
/**
|
|
4
|
+
* Properties for creating a Stripe product
|
|
5
|
+
*/
|
|
6
|
+
export interface ProductProps {
|
|
7
|
+
/**
|
|
8
|
+
* The product's name
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The product's description
|
|
13
|
+
*/
|
|
14
|
+
description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the product is active
|
|
17
|
+
*/
|
|
18
|
+
active?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* A list of up to 8 URLs of images for this product
|
|
21
|
+
*/
|
|
22
|
+
images?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* A URL of the product's thumbnail
|
|
25
|
+
*/
|
|
26
|
+
url?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether this product is shipped (physical goods)
|
|
29
|
+
*/
|
|
30
|
+
shippable?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Product type: good, service
|
|
33
|
+
*/
|
|
34
|
+
type?: ProductType;
|
|
35
|
+
/**
|
|
36
|
+
* Unit label to use on invoices
|
|
37
|
+
*/
|
|
38
|
+
unitLabel?: string;
|
|
39
|
+
/**
|
|
40
|
+
* A label for the product to be displayed on Checkout
|
|
41
|
+
*/
|
|
42
|
+
statementDescriptor?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Set of key-value pairs for this product
|
|
45
|
+
*/
|
|
46
|
+
metadata?: Record<string, string>;
|
|
47
|
+
/**
|
|
48
|
+
* Default tax code for the product
|
|
49
|
+
*/
|
|
50
|
+
taxCode?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Output from the Stripe product
|
|
54
|
+
*/
|
|
55
|
+
export interface ProductOutput extends ProductProps {
|
|
56
|
+
/**
|
|
57
|
+
* The ID of the product
|
|
58
|
+
*/
|
|
59
|
+
id: string;
|
|
60
|
+
/**
|
|
61
|
+
* Time at which the object was created
|
|
62
|
+
*/
|
|
63
|
+
createdAt: number;
|
|
64
|
+
/**
|
|
65
|
+
* Has the value true if the object exists in live mode or the value false if the object exists in test mode
|
|
66
|
+
*/
|
|
67
|
+
livemode: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Time at which the object was last updated
|
|
70
|
+
*/
|
|
71
|
+
updatedAt: number;
|
|
72
|
+
/**
|
|
73
|
+
* Whether this product can be used for Checkout/Payment Links
|
|
74
|
+
*/
|
|
75
|
+
packageDimensions?: {
|
|
76
|
+
height: number;
|
|
77
|
+
length: number;
|
|
78
|
+
weight: number;
|
|
79
|
+
width: number;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
declare const Product_base: import("../resource").Provider<"stripe::Product", [props: ProductProps], ProductOutput>;
|
|
83
|
+
export declare class Product extends Product_base {
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/stripe/product.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,KAAK,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,IA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