alchemy 0.1.6 → 0.1.9
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 +7 -0
- package/lib/$.d.ts.map +1 -0
- package/lib/$.js +31 -0
- package/lib/$.js.map +1 -0
- package/lib/agent/ai.d.ts +40 -0
- package/lib/agent/ai.d.ts.map +1 -0
- package/lib/agent/ai.js +132 -0
- package/lib/agent/ai.js.map +1 -0
- package/lib/agent/anthropic.d.ts +9 -0
- package/lib/agent/anthropic.d.ts.map +1 -0
- package/lib/agent/anthropic.js +25 -0
- package/lib/agent/anthropic.js.map +1 -0
- package/lib/agent/dependencies.d.ts +4 -0
- package/lib/agent/dependencies.d.ts.map +1 -0
- package/lib/agent/dependencies.js +48 -0
- package/lib/agent/dependencies.js.map +1 -0
- package/lib/agent/file-context.d.ts +13 -0
- package/lib/agent/file-context.d.ts.map +1 -0
- package/lib/agent/file-context.js +6 -0
- package/lib/agent/file-context.js.map +1 -0
- package/lib/agent/index.d.ts +10 -0
- package/lib/agent/index.d.ts.map +1 -0
- package/lib/agent/index.js +10 -0
- package/lib/agent/index.js.map +1 -0
- package/lib/agent/model.d.ts +8 -0
- package/lib/agent/model.d.ts.map +1 -0
- package/lib/agent/model.js +29 -0
- package/lib/agent/model.js.map +1 -0
- package/lib/agent/module.d.ts +81 -0
- package/lib/agent/module.d.ts.map +1 -0
- package/lib/agent/module.js +309 -0
- package/lib/agent/module.js.map +1 -0
- package/lib/agent/openai.d.ts +6 -0
- package/lib/agent/openai.d.ts.map +1 -0
- package/lib/agent/openai.js +41 -0
- package/lib/agent/openai.js.map +1 -0
- package/lib/agent/program.d.ts +12 -0
- package/lib/agent/program.d.ts.map +1 -0
- package/lib/agent/program.js +21 -0
- package/lib/agent/program.js.map +1 -0
- package/lib/agent/prompts.d.ts +4 -0
- package/lib/agent/prompts.d.ts.map +1 -0
- package/lib/agent/prompts.js +11 -0
- package/lib/agent/prompts.js.map +1 -0
- package/lib/agent/scrape.d.ts +71 -0
- package/lib/agent/scrape.d.ts.map +1 -0
- package/lib/agent/scrape.js +45 -0
- package/lib/agent/scrape.js.map +1 -0
- package/lib/alchemize.d.ts +43 -0
- package/lib/alchemize.d.ts.map +1 -0
- package/lib/alchemize.js +105 -0
- package/lib/alchemize.js.map +1 -0
- package/lib/apply.d.ts +23 -0
- package/lib/apply.d.ts.map +1 -0
- package/lib/apply.js +84 -0
- package/lib/apply.js.map +1 -0
- package/lib/aws/auto/docs.d.ts +11 -0
- package/lib/aws/auto/docs.d.ts.map +1 -0
- package/lib/aws/auto/docs.js +56 -0
- package/lib/aws/auto/docs.js.map +1 -0
- package/lib/aws/auto/index.d.ts +5 -0
- package/lib/aws/auto/index.d.ts.map +1 -0
- package/lib/aws/auto/index.js +5 -0
- package/lib/aws/auto/index.js.map +1 -0
- package/lib/aws/auto/resource.d.ts +24 -0
- package/lib/aws/auto/resource.d.ts.map +1 -0
- package/lib/aws/auto/resource.js +194 -0
- package/lib/aws/auto/resource.js.map +1 -0
- package/lib/aws/auto/service.d.ts +10 -0
- package/lib/aws/auto/service.d.ts.map +1 -0
- package/lib/aws/auto/service.js +34 -0
- package/lib/aws/auto/service.js.map +1 -0
- package/lib/aws/auto/spec.d.ts +83 -0
- package/lib/aws/auto/spec.d.ts.map +1 -0
- package/lib/aws/auto/spec.js +58 -0
- package/lib/aws/auto/spec.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 +7 -0
- package/lib/aws/index.d.ts.map +1 -0
- package/lib/aws/index.js +7 -0
- package/lib/aws/index.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 +38 -0
- package/lib/aws/queue.d.ts.map +1 -0
- package/lib/aws/queue.js +162 -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 +149 -0
- package/lib/aws/role.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 +120 -0
- package/lib/aws/table.js.map +1 -0
- package/lib/destroy.d.ts +19 -0
- package/lib/destroy.d.ts.map +1 -0
- package/lib/destroy.js +47 -0
- package/lib/destroy.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 +70 -0
- package/lib/esbuild.d.ts.map +1 -0
- package/lib/esbuild.js +58 -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/global.d.ts +18 -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 +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/input.d.ts +6 -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/markdown/design.d.ts +17 -0
- package/lib/markdown/design.d.ts.map +1 -0
- package/lib/markdown/design.js +92 -0
- package/lib/markdown/design.js.map +1 -0
- package/lib/markdown/extract.d.ts +7 -0
- package/lib/markdown/extract.d.ts.map +1 -0
- package/lib/markdown/extract.js +10 -0
- package/lib/markdown/extract.js.map +1 -0
- package/lib/markdown/index.d.ts +4 -0
- package/lib/markdown/index.d.ts.map +1 -0
- package/lib/markdown/index.js +4 -0
- package/lib/markdown/index.js.map +1 -0
- package/lib/markdown/requirements.d.ts +79 -0
- package/lib/markdown/requirements.d.ts.map +1 -0
- package/lib/markdown/requirements.js +105 -0
- package/lib/markdown/requirements.js.map +1 -0
- package/lib/output.d.ts +19 -0
- package/lib/output.d.ts.map +1 -0
- package/lib/output.js +16 -0
- package/lib/output.js.map +1 -0
- package/lib/resource.d.ts +66 -0
- package/lib/resource.d.ts.map +1 -0
- package/lib/resource.js +242 -0
- package/lib/resource.js.map +1 -0
- package/lib/scope.d.ts +15 -0
- package/lib/scope.d.ts.map +1 -0
- package/lib/scope.js +38 -0
- package/lib/scope.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 +73 -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/typescript/check-omission.d.ts +2 -0
- package/lib/typescript/check-omission.d.ts.map +1 -0
- package/lib/typescript/check-omission.js +43 -0
- package/lib/typescript/check-omission.js.map +1 -0
- package/lib/typescript/debug-type-errors.d.ts +3 -0
- package/lib/typescript/debug-type-errors.d.ts.map +1 -0
- package/lib/typescript/debug-type-errors.js +35 -0
- package/lib/typescript/debug-type-errors.js.map +1 -0
- package/lib/typescript/extract.d.ts +7 -0
- package/lib/typescript/extract.d.ts.map +1 -0
- package/lib/typescript/extract.js +10 -0
- package/lib/typescript/extract.js.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/index.js +7 -0
- package/lib/typescript/index.js.map +1 -0
- package/lib/typescript/install-dependencies.d.ts +29 -0
- package/lib/typescript/install-dependencies.d.ts.map +1 -0
- package/lib/typescript/install-dependencies.js +52 -0
- package/lib/typescript/install-dependencies.js.map +1 -0
- package/lib/typescript/package.d.ts +157 -0
- package/lib/typescript/package.d.ts.map +1 -0
- package/lib/typescript/package.js +115 -0
- package/lib/typescript/package.js.map +1 -0
- package/lib/typescript/repair-omissions.d.ts +3 -0
- package/lib/typescript/repair-omissions.d.ts.map +1 -0
- package/lib/typescript/repair-omissions.js +23 -0
- package/lib/typescript/repair-omissions.js.map +1 -0
- package/lib/typescript/repair.d.ts +3 -0
- package/lib/typescript/repair.d.ts.map +1 -0
- package/lib/typescript/repair.js +34 -0
- package/lib/typescript/repair.js.map +1 -0
- package/lib/typescript/tsconfig.d.ts +469 -0
- package/lib/typescript/tsconfig.d.ts.map +1 -0
- package/lib/typescript/tsconfig.js +143 -0
- package/lib/typescript/tsconfig.js.map +1 -0
- package/lib/typescript/typescript.d.ts +107 -0
- package/lib/typescript/typescript.d.ts.map +1 -0
- package/lib/typescript/typescript.js +180 -0
- package/lib/typescript/typescript.js.map +1 -0
- package/lib/typescript/validate.d.ts +10 -0
- package/lib/typescript/validate.d.ts.map +1 -0
- package/lib/typescript/validate.js +49 -0
- package/lib/typescript/validate.js.map +1 -0
- package/package.json +11 -11
- package/src/aws/auto/resource.ts +1 -1
- package/src/index.ts +1 -1
- package/test/aws/function.test.ts +0 -144
- package/test/aws/queue.test.ts +0 -85
- package/test/aws/role.test.ts +0 -153
- package/test/aws/table.test.ts +0 -73
- package/test/esbuild.test.ts +0 -41
- package/test/handler.ts +0 -9
- package/test/scope.test.ts +0 -67
- package/test/stripe/stripe.test.ts +0 -136
- package/tsconfig.json +0 -7
package/lib/resource.js
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { alchemize } from "./alchemize";
|
|
2
|
+
import { apply } from "./apply";
|
|
3
|
+
import { defaultStateStore, deletions, providers } from "./global";
|
|
4
|
+
import { Output } from "./output";
|
|
5
|
+
import { Scope as IScope, getScope, pushScope } from "./scope";
|
|
6
|
+
export const ResourceID = Symbol.for("ResourceID");
|
|
7
|
+
export const Provider = Symbol.for("Provider");
|
|
8
|
+
export const Input = Symbol.for("Input");
|
|
9
|
+
export const Value = Symbol.for("Value");
|
|
10
|
+
export const Apply = Symbol.for("Apply");
|
|
11
|
+
export const Provide = Symbol.for("Provide");
|
|
12
|
+
export const Scope = Symbol.for("Scope");
|
|
13
|
+
export const Options = Symbol.for("Options");
|
|
14
|
+
// properties that pierce through the Proxy
|
|
15
|
+
const OrthogonalProperties = [
|
|
16
|
+
ResourceID,
|
|
17
|
+
Provider,
|
|
18
|
+
Input,
|
|
19
|
+
Value,
|
|
20
|
+
Apply,
|
|
21
|
+
Provide,
|
|
22
|
+
Scope,
|
|
23
|
+
Options,
|
|
24
|
+
];
|
|
25
|
+
export function isResource(value) {
|
|
26
|
+
return value?.[ResourceID] !== undefined;
|
|
27
|
+
}
|
|
28
|
+
export function Resource(type, ...args) {
|
|
29
|
+
if (providers.has(type)) {
|
|
30
|
+
throw new Error(`Resource ${type} already exists`);
|
|
31
|
+
}
|
|
32
|
+
const [options, func] = args.length === 2 ? args : [undefined, args[0]];
|
|
33
|
+
class Resource {
|
|
34
|
+
static type = type;
|
|
35
|
+
constructor(id, ...input) {
|
|
36
|
+
const scope = getScope();
|
|
37
|
+
const node = {
|
|
38
|
+
provider: Resource,
|
|
39
|
+
resource: this,
|
|
40
|
+
};
|
|
41
|
+
if (scope.nodes.has(id)) {
|
|
42
|
+
// TODO(sam): do we want to throw?
|
|
43
|
+
// it's kind of awesome that you can re-create a resource and call apply
|
|
44
|
+
// console.warn(`Resource ${id} already exists in the stack: ${stack.id}`);
|
|
45
|
+
}
|
|
46
|
+
scope.nodes.set(id, node);
|
|
47
|
+
this[ResourceID] = id;
|
|
48
|
+
this[Provider] = Resource;
|
|
49
|
+
this[Input] = input;
|
|
50
|
+
this[Value] = undefined;
|
|
51
|
+
this[Scope] = scope;
|
|
52
|
+
this[Provide] = (value) => {
|
|
53
|
+
this[Value] = value;
|
|
54
|
+
};
|
|
55
|
+
this[Options] = {
|
|
56
|
+
alwaysUpdate: options?.alwaysUpdate ?? false,
|
|
57
|
+
};
|
|
58
|
+
return new Proxy(this, {
|
|
59
|
+
// TODO(sam): this won't work for the sub-class (class Table extends Resource)
|
|
60
|
+
getPrototypeOf() {
|
|
61
|
+
return Resource.prototype;
|
|
62
|
+
},
|
|
63
|
+
get(target, prop) {
|
|
64
|
+
if (OrthogonalProperties.includes(prop)) {
|
|
65
|
+
return target[prop];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return target[Apply]((value) => value[prop]);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
[Apply](fn) {
|
|
74
|
+
return new Output(this, fn);
|
|
75
|
+
}
|
|
76
|
+
box = undefined;
|
|
77
|
+
[Provide](value) {
|
|
78
|
+
if (this.box) {
|
|
79
|
+
throw new Error(`Output ${this[ResourceID]} already has a value`);
|
|
80
|
+
}
|
|
81
|
+
this.box = { value };
|
|
82
|
+
const subscribers = this.subscribers;
|
|
83
|
+
this.subscribers = [];
|
|
84
|
+
subscribers.forEach((fn) => fn(value));
|
|
85
|
+
}
|
|
86
|
+
subscribers = [];
|
|
87
|
+
/**
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
subscribe(fn) {
|
|
91
|
+
if (this.box) {
|
|
92
|
+
fn(this.box.value);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.subscribers.push(fn);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
static async update(stage, resource, deps, inputs, stateStore, options) {
|
|
99
|
+
// const stack = resource[ResourceStack];
|
|
100
|
+
const resourceID = resource[ResourceID];
|
|
101
|
+
let resourceState = await stateStore.get(resourceID);
|
|
102
|
+
if (resourceState === undefined) {
|
|
103
|
+
resourceState = {
|
|
104
|
+
provider: type,
|
|
105
|
+
status: "creating",
|
|
106
|
+
data: {},
|
|
107
|
+
output: undefined,
|
|
108
|
+
deps: [...deps],
|
|
109
|
+
inputs,
|
|
110
|
+
};
|
|
111
|
+
await stateStore.set(resourceID, resourceState);
|
|
112
|
+
}
|
|
113
|
+
const resourceFQN = `${resource[Scope].getScopePath(stage)}/${resourceID}`;
|
|
114
|
+
// Skip update if inputs haven't changed and resource is in a stable state
|
|
115
|
+
if (resourceState.status === "created" ||
|
|
116
|
+
resourceState.status === "updated") {
|
|
117
|
+
if (JSON.stringify(resourceState.inputs) === JSON.stringify(inputs) &&
|
|
118
|
+
!resource[Options].alwaysUpdate) {
|
|
119
|
+
if (!options?.quiet) {
|
|
120
|
+
console.log(`Skip: ${resourceFQN} (no changes)`);
|
|
121
|
+
}
|
|
122
|
+
if (resourceState.output !== undefined) {
|
|
123
|
+
resource[Provide](resourceState.output);
|
|
124
|
+
}
|
|
125
|
+
return resourceState.output;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const event = resourceState.status === "creating" ? "create" : "update";
|
|
129
|
+
resourceState.status = event === "create" ? "creating" : "updating";
|
|
130
|
+
resourceState.oldInputs = resourceState.inputs;
|
|
131
|
+
resourceState.inputs = inputs;
|
|
132
|
+
if (!options?.quiet) {
|
|
133
|
+
console.log(`${event === "create" ? "Create" : "Update"}: ${resourceFQN}`);
|
|
134
|
+
}
|
|
135
|
+
await stateStore.set(resourceID, resourceState);
|
|
136
|
+
let isReplaced = false;
|
|
137
|
+
const quiet = options.quiet ?? false;
|
|
138
|
+
const evaluated = await pushScope(resource[Scope], resourceID, async () => {
|
|
139
|
+
const result = await func({
|
|
140
|
+
stage,
|
|
141
|
+
resourceID,
|
|
142
|
+
event,
|
|
143
|
+
scope: getScope(),
|
|
144
|
+
output: resourceState.output,
|
|
145
|
+
replace: () => {
|
|
146
|
+
if (isReplaced) {
|
|
147
|
+
console.warn(`Resource ${type} ${resourceFQN} is already marked as REPLACE`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
isReplaced = true;
|
|
151
|
+
deletions.push({
|
|
152
|
+
id: resourceID,
|
|
153
|
+
data: {
|
|
154
|
+
...resourceState.data,
|
|
155
|
+
},
|
|
156
|
+
inputs: inputs,
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
get: (key) => resourceState.data[key],
|
|
160
|
+
set: async (key, value) => {
|
|
161
|
+
resourceState.data[key] = value;
|
|
162
|
+
await stateStore.set(resourceID, resourceState);
|
|
163
|
+
},
|
|
164
|
+
delete: async (key) => {
|
|
165
|
+
const value = resourceState.data[key];
|
|
166
|
+
delete resourceState.data[key];
|
|
167
|
+
await stateStore.set(resourceID, resourceState);
|
|
168
|
+
return value;
|
|
169
|
+
},
|
|
170
|
+
quiet,
|
|
171
|
+
}, ...inputs);
|
|
172
|
+
if (result === undefined) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
const evaluated = await apply(result, {
|
|
176
|
+
stage,
|
|
177
|
+
scope: getScope(),
|
|
178
|
+
quiet,
|
|
179
|
+
});
|
|
180
|
+
return evaluated;
|
|
181
|
+
});
|
|
182
|
+
if (!options?.quiet) {
|
|
183
|
+
console.log(`${event === "create" ? "Created" : "Updated"}: ${resourceFQN}`);
|
|
184
|
+
}
|
|
185
|
+
await stateStore.set(resourceID, {
|
|
186
|
+
provider: type,
|
|
187
|
+
data: resourceState.data,
|
|
188
|
+
status: event === "create" ? "created" : "updated",
|
|
189
|
+
output: evaluated,
|
|
190
|
+
inputs,
|
|
191
|
+
deps: [...deps],
|
|
192
|
+
});
|
|
193
|
+
if (evaluated !== undefined) {
|
|
194
|
+
resource[Provide](evaluated);
|
|
195
|
+
}
|
|
196
|
+
return evaluated;
|
|
197
|
+
}
|
|
198
|
+
static async delete(stage, scope, resourceID, state, inputs, options) {
|
|
199
|
+
const resourceFQN = `${scope.getScopePath(stage)}/${resourceID}`;
|
|
200
|
+
const nestedScope = new IScope(resourceID, scope);
|
|
201
|
+
await alchemize({
|
|
202
|
+
mode: "destroy",
|
|
203
|
+
stage,
|
|
204
|
+
scope: nestedScope,
|
|
205
|
+
// TODO(sam): should use the appropriate state store
|
|
206
|
+
stateStore: defaultStateStore,
|
|
207
|
+
quiet: options.quiet,
|
|
208
|
+
});
|
|
209
|
+
if (!options?.quiet) {
|
|
210
|
+
console.log(`Delete: ${resourceFQN}`);
|
|
211
|
+
}
|
|
212
|
+
await func({
|
|
213
|
+
stage,
|
|
214
|
+
scope,
|
|
215
|
+
resourceID: resourceID,
|
|
216
|
+
event: "delete",
|
|
217
|
+
output: state.output,
|
|
218
|
+
replace() {
|
|
219
|
+
throw new Error("Cannot replace a resource that is being deleted");
|
|
220
|
+
},
|
|
221
|
+
get: (key) => {
|
|
222
|
+
return state.data[key];
|
|
223
|
+
},
|
|
224
|
+
set: async (key, value) => {
|
|
225
|
+
state.data[key] = value;
|
|
226
|
+
},
|
|
227
|
+
delete: async (key) => {
|
|
228
|
+
const value = state.data[key];
|
|
229
|
+
delete state.data[key];
|
|
230
|
+
return value;
|
|
231
|
+
},
|
|
232
|
+
quiet: options.quiet ?? false,
|
|
233
|
+
}, ...inputs);
|
|
234
|
+
if (!options?.quiet) {
|
|
235
|
+
console.log(`Deleted: ${resourceFQN}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
providers.set(type, Resource);
|
|
240
|
+
return Resource;
|
|
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;gBACf,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,OAAO;oBACL,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBACrE,CAAC;gBACD,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;oBACX,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzB,CAAC;gBACD,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;oBACxB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBAC1B,CAAC;gBACD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;oBACpB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBACvB,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;aAC9B,EACD,GAAG,MAAM,CACV,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,YAAY,WAAW,EAAE,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;;IAEH,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAe,CAAC,CAAC;IACrC,OAAO,QAAe,CAAC;AACzB,CAAC"}
|
package/lib/scope.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Provider, Resource } from "./resource";
|
|
2
|
+
export declare class Scope {
|
|
3
|
+
readonly scopeName: string | null;
|
|
4
|
+
readonly parent: Scope | undefined;
|
|
5
|
+
readonly nodes: Map<string, {
|
|
6
|
+
provider: Provider<any, any[], any>;
|
|
7
|
+
resource: Resource<any, any>;
|
|
8
|
+
}>;
|
|
9
|
+
constructor(scopeName?: string | null, parent?: Scope | undefined);
|
|
10
|
+
getScopePath(root: string): string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getScope(): Scope;
|
|
13
|
+
export declare function withScope<T>(scope: Scope, fn: () => T | Promise<T>): Promise<T>;
|
|
14
|
+
export declare function pushScope<T>(parent: Scope, scopeName: string, fn: () => T | Promise<T>): Promise<T>;
|
|
15
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAc,MAAM,YAAY,CAAC;AAMjE,qBAAa,KAAK;aAUE,SAAS,EAAE,MAAM,GAAG,IAAI;aACxB,MAAM,EAAE,KAAK,GAAG,SAAS;IAV3C,SAAgB,KAAK;kBAGP,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC;kBACzB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;OAE5B;gBAGc,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,MAAM,GAAE,KAAK,GAAG,SAAqB;IAGhD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAM1C;AAED,wBAAgB,QAAQ,IAAI,KAAK,CAEhC;AAED,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAQZ;AAED,wBAAgB,SAAS,CAAC,CAAC,EACzB,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAGZ"}
|
package/lib/scope.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { rootScope } from "./global";
|
|
4
|
+
const scopeGlobal = new Map();
|
|
5
|
+
const scopeStorage = new AsyncLocalStorage();
|
|
6
|
+
export class Scope {
|
|
7
|
+
scopeName;
|
|
8
|
+
parent;
|
|
9
|
+
nodes = new Map();
|
|
10
|
+
constructor(scopeName = null, parent = undefined) {
|
|
11
|
+
this.scopeName = scopeName;
|
|
12
|
+
this.parent = parent;
|
|
13
|
+
}
|
|
14
|
+
getScopePath(root) {
|
|
15
|
+
// First, compute the parent's scope path
|
|
16
|
+
const parentPath = this.parent ? this.parent.getScopePath(root) : root;
|
|
17
|
+
// Then join the current scope name (if any) onto the parent's path
|
|
18
|
+
return this.scopeName ? path.join(parentPath, this.scopeName) : parentPath;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function getScope() {
|
|
22
|
+
return scopeStorage.getStore() ?? rootScope;
|
|
23
|
+
}
|
|
24
|
+
export function withScope(scope, fn) {
|
|
25
|
+
return scopeStorage.run(scope, async () => {
|
|
26
|
+
try {
|
|
27
|
+
return await fn();
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function pushScope(parent, scopeName, fn) {
|
|
35
|
+
const newScope = new Scope(scopeName, parent);
|
|
36
|
+
return withScope(newScope, fn);
|
|
37
|
+
}
|
|
38
|
+
//# 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;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAC;AAEpD,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAS,CA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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":"AAIA,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,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,+CAA+C;IAC/C,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,6CAA6C;IAC7C,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1B,mDAAmD;IACnD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACxD,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACtC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAID,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,EAAE,MAAM,KAAK,UAAU,CAAC;AAE7D,qBAAa,oBAAqB,YAAW,UAAU;IACrD,SAAgB,IAAI,EAAE,MAAM,CAAC;gBACjB,GAAG,EAAE,MAAM;IAIjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAIxB,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAe5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7C,MAAM,CAAC,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,73 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ignore } from "./error";
|
|
4
|
+
const stateFile = path.join(process.cwd(), ".alchemy");
|
|
5
|
+
export class FileSystemStateStore {
|
|
6
|
+
path;
|
|
7
|
+
constructor(dir) {
|
|
8
|
+
this.path = path.join(stateFile, dir);
|
|
9
|
+
}
|
|
10
|
+
async init() {
|
|
11
|
+
await fs.promises.mkdir(stateFile, { recursive: true });
|
|
12
|
+
await fs.promises.mkdir(this.path, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
async deinit() {
|
|
15
|
+
await ignore("ENOENT", () => fs.promises.rmdir(this.path));
|
|
16
|
+
}
|
|
17
|
+
async count() {
|
|
18
|
+
return Object.keys(await this.list()).length;
|
|
19
|
+
}
|
|
20
|
+
async list() {
|
|
21
|
+
try {
|
|
22
|
+
const files = await fs.promises.readdir(this.path, {
|
|
23
|
+
withFileTypes: true,
|
|
24
|
+
});
|
|
25
|
+
return files
|
|
26
|
+
.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".json"))
|
|
27
|
+
.map((dirent) => dirent.name.replace(/\.json$/, ""));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error.code === "ENOENT") {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async get(key) {
|
|
37
|
+
try {
|
|
38
|
+
const content = await fs.promises.readFile(await this.getPath(key), "utf8");
|
|
39
|
+
return JSON.parse(content);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error.code === "ENOENT") {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async set(key, value) {
|
|
49
|
+
return fs.promises.writeFile(await this.getPath(key), JSON.stringify(value, null, 2));
|
|
50
|
+
}
|
|
51
|
+
async delete(key) {
|
|
52
|
+
return fs.promises.unlink(await this.getPath(key));
|
|
53
|
+
}
|
|
54
|
+
async all() {
|
|
55
|
+
return this.getBatch(await this.list());
|
|
56
|
+
}
|
|
57
|
+
async getBatch(ids) {
|
|
58
|
+
return Object.fromEntries((await Promise.all(Array.from(ids).flatMap(async (id) => {
|
|
59
|
+
const s = await this.get(id);
|
|
60
|
+
if (s === undefined) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return [[id, s]];
|
|
64
|
+
}))).flat());
|
|
65
|
+
}
|
|
66
|
+
async getPath(key) {
|
|
67
|
+
const file = path.join(this.path, `${key}.json`);
|
|
68
|
+
const dir = path.dirname(file);
|
|
69
|
+
await fs.promises.mkdir(dir, { recursive: true });
|
|
70
|
+
return file;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# 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;AAkCjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;AAIvD,MAAM,OAAO,oBAAoB;IACf,IAAI,CAAS;IAC7B,YAAY,GAAW;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAA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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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