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.
Files changed (244) hide show
  1. package/lib/$.d.ts +7 -0
  2. package/lib/$.d.ts.map +1 -0
  3. package/lib/$.js +31 -0
  4. package/lib/$.js.map +1 -0
  5. package/lib/agent/ai.d.ts +40 -0
  6. package/lib/agent/ai.d.ts.map +1 -0
  7. package/lib/agent/ai.js +132 -0
  8. package/lib/agent/ai.js.map +1 -0
  9. package/lib/agent/anthropic.d.ts +9 -0
  10. package/lib/agent/anthropic.d.ts.map +1 -0
  11. package/lib/agent/anthropic.js +25 -0
  12. package/lib/agent/anthropic.js.map +1 -0
  13. package/lib/agent/dependencies.d.ts +4 -0
  14. package/lib/agent/dependencies.d.ts.map +1 -0
  15. package/lib/agent/dependencies.js +48 -0
  16. package/lib/agent/dependencies.js.map +1 -0
  17. package/lib/agent/file-context.d.ts +13 -0
  18. package/lib/agent/file-context.d.ts.map +1 -0
  19. package/lib/agent/file-context.js +6 -0
  20. package/lib/agent/file-context.js.map +1 -0
  21. package/lib/agent/index.d.ts +10 -0
  22. package/lib/agent/index.d.ts.map +1 -0
  23. package/lib/agent/index.js +10 -0
  24. package/lib/agent/index.js.map +1 -0
  25. package/lib/agent/model.d.ts +8 -0
  26. package/lib/agent/model.d.ts.map +1 -0
  27. package/lib/agent/model.js +29 -0
  28. package/lib/agent/model.js.map +1 -0
  29. package/lib/agent/module.d.ts +81 -0
  30. package/lib/agent/module.d.ts.map +1 -0
  31. package/lib/agent/module.js +309 -0
  32. package/lib/agent/module.js.map +1 -0
  33. package/lib/agent/openai.d.ts +6 -0
  34. package/lib/agent/openai.d.ts.map +1 -0
  35. package/lib/agent/openai.js +41 -0
  36. package/lib/agent/openai.js.map +1 -0
  37. package/lib/agent/program.d.ts +12 -0
  38. package/lib/agent/program.d.ts.map +1 -0
  39. package/lib/agent/program.js +21 -0
  40. package/lib/agent/program.js.map +1 -0
  41. package/lib/agent/prompts.d.ts +4 -0
  42. package/lib/agent/prompts.d.ts.map +1 -0
  43. package/lib/agent/prompts.js +11 -0
  44. package/lib/agent/prompts.js.map +1 -0
  45. package/lib/agent/scrape.d.ts +71 -0
  46. package/lib/agent/scrape.d.ts.map +1 -0
  47. package/lib/agent/scrape.js +45 -0
  48. package/lib/agent/scrape.js.map +1 -0
  49. package/lib/alchemize.d.ts +43 -0
  50. package/lib/alchemize.d.ts.map +1 -0
  51. package/lib/alchemize.js +105 -0
  52. package/lib/alchemize.js.map +1 -0
  53. package/lib/apply.d.ts +23 -0
  54. package/lib/apply.d.ts.map +1 -0
  55. package/lib/apply.js +84 -0
  56. package/lib/apply.js.map +1 -0
  57. package/lib/aws/auto/docs.d.ts +11 -0
  58. package/lib/aws/auto/docs.d.ts.map +1 -0
  59. package/lib/aws/auto/docs.js +56 -0
  60. package/lib/aws/auto/docs.js.map +1 -0
  61. package/lib/aws/auto/index.d.ts +5 -0
  62. package/lib/aws/auto/index.d.ts.map +1 -0
  63. package/lib/aws/auto/index.js +5 -0
  64. package/lib/aws/auto/index.js.map +1 -0
  65. package/lib/aws/auto/resource.d.ts +24 -0
  66. package/lib/aws/auto/resource.d.ts.map +1 -0
  67. package/lib/aws/auto/resource.js +194 -0
  68. package/lib/aws/auto/resource.js.map +1 -0
  69. package/lib/aws/auto/service.d.ts +10 -0
  70. package/lib/aws/auto/service.d.ts.map +1 -0
  71. package/lib/aws/auto/service.js +34 -0
  72. package/lib/aws/auto/service.js.map +1 -0
  73. package/lib/aws/auto/spec.d.ts +83 -0
  74. package/lib/aws/auto/spec.d.ts.map +1 -0
  75. package/lib/aws/auto/spec.js +58 -0
  76. package/lib/aws/auto/spec.js.map +1 -0
  77. package/lib/aws/bucket.d.ts +21 -0
  78. package/lib/aws/bucket.d.ts.map +1 -0
  79. package/lib/aws/bucket.js +114 -0
  80. package/lib/aws/bucket.js.map +1 -0
  81. package/lib/aws/function.d.ts +53 -0
  82. package/lib/aws/function.d.ts.map +1 -0
  83. package/lib/aws/function.js +195 -0
  84. package/lib/aws/function.js.map +1 -0
  85. package/lib/aws/index.d.ts +7 -0
  86. package/lib/aws/index.d.ts.map +1 -0
  87. package/lib/aws/index.js +7 -0
  88. package/lib/aws/index.js.map +1 -0
  89. package/lib/aws/policy.d.ts +46 -0
  90. package/lib/aws/policy.d.ts.map +1 -0
  91. package/lib/aws/policy.js +139 -0
  92. package/lib/aws/policy.js.map +1 -0
  93. package/lib/aws/queue.d.ts +38 -0
  94. package/lib/aws/queue.d.ts.map +1 -0
  95. package/lib/aws/queue.js +162 -0
  96. package/lib/aws/queue.js.map +1 -0
  97. package/lib/aws/role.d.ts +27 -0
  98. package/lib/aws/role.d.ts.map +1 -0
  99. package/lib/aws/role.js +149 -0
  100. package/lib/aws/role.js.map +1 -0
  101. package/lib/aws/table.d.ts +26 -0
  102. package/lib/aws/table.d.ts.map +1 -0
  103. package/lib/aws/table.js +120 -0
  104. package/lib/aws/table.js.map +1 -0
  105. package/lib/destroy.d.ts +19 -0
  106. package/lib/destroy.d.ts.map +1 -0
  107. package/lib/destroy.js +47 -0
  108. package/lib/destroy.js.map +1 -0
  109. package/lib/error.d.ts +2 -0
  110. package/lib/error.d.ts.map +1 -0
  111. package/lib/error.js +13 -0
  112. package/lib/error.js.map +1 -0
  113. package/lib/esbuild.d.ts +70 -0
  114. package/lib/esbuild.d.ts.map +1 -0
  115. package/lib/esbuild.js +58 -0
  116. package/lib/esbuild.js.map +1 -0
  117. package/lib/fs.d.ts +12 -0
  118. package/lib/fs.d.ts.map +1 -0
  119. package/lib/fs.js +41 -0
  120. package/lib/fs.js.map +1 -0
  121. package/lib/global.d.ts +18 -0
  122. package/lib/global.d.ts.map +1 -0
  123. package/lib/global.js +42 -0
  124. package/lib/global.js.map +1 -0
  125. package/lib/index.d.ts +9 -0
  126. package/lib/index.d.ts.map +1 -0
  127. package/lib/index.js +8 -0
  128. package/lib/index.js.map +1 -0
  129. package/lib/input.d.ts +6 -0
  130. package/lib/input.d.ts.map +1 -0
  131. package/lib/input.js +2 -0
  132. package/lib/input.js.map +1 -0
  133. package/lib/main.d.ts +3 -0
  134. package/lib/main.d.ts.map +1 -0
  135. package/lib/main.js +32 -0
  136. package/lib/main.js.map +1 -0
  137. package/lib/markdown/design.d.ts +17 -0
  138. package/lib/markdown/design.d.ts.map +1 -0
  139. package/lib/markdown/design.js +92 -0
  140. package/lib/markdown/design.js.map +1 -0
  141. package/lib/markdown/extract.d.ts +7 -0
  142. package/lib/markdown/extract.d.ts.map +1 -0
  143. package/lib/markdown/extract.js +10 -0
  144. package/lib/markdown/extract.js.map +1 -0
  145. package/lib/markdown/index.d.ts +4 -0
  146. package/lib/markdown/index.d.ts.map +1 -0
  147. package/lib/markdown/index.js +4 -0
  148. package/lib/markdown/index.js.map +1 -0
  149. package/lib/markdown/requirements.d.ts +79 -0
  150. package/lib/markdown/requirements.d.ts.map +1 -0
  151. package/lib/markdown/requirements.js +105 -0
  152. package/lib/markdown/requirements.js.map +1 -0
  153. package/lib/output.d.ts +19 -0
  154. package/lib/output.d.ts.map +1 -0
  155. package/lib/output.js +16 -0
  156. package/lib/output.js.map +1 -0
  157. package/lib/resource.d.ts +66 -0
  158. package/lib/resource.d.ts.map +1 -0
  159. package/lib/resource.js +242 -0
  160. package/lib/resource.js.map +1 -0
  161. package/lib/scope.d.ts +15 -0
  162. package/lib/scope.d.ts.map +1 -0
  163. package/lib/scope.js +38 -0
  164. package/lib/scope.js.map +1 -0
  165. package/lib/slug.d.ts +2 -0
  166. package/lib/slug.d.ts.map +1 -0
  167. package/lib/slug.js +4 -0
  168. package/lib/slug.js.map +1 -0
  169. package/lib/state.d.ts +40 -0
  170. package/lib/state.d.ts.map +1 -0
  171. package/lib/state.js +73 -0
  172. package/lib/state.js.map +1 -0
  173. package/lib/stripe/index.d.ts +4 -0
  174. package/lib/stripe/index.d.ts.map +1 -0
  175. package/lib/stripe/index.js +4 -0
  176. package/lib/stripe/index.js.map +1 -0
  177. package/lib/stripe/price.d.ts +109 -0
  178. package/lib/stripe/price.d.ts.map +1 -0
  179. package/lib/stripe/price.js +112 -0
  180. package/lib/stripe/price.js.map +1 -0
  181. package/lib/stripe/product.d.ts +86 -0
  182. package/lib/stripe/product.d.ts.map +1 -0
  183. package/lib/stripe/product.js +90 -0
  184. package/lib/stripe/product.js.map +1 -0
  185. package/lib/stripe/webhook.d.ts +73 -0
  186. package/lib/stripe/webhook.d.ts.map +1 -0
  187. package/lib/stripe/webhook.js +94 -0
  188. package/lib/stripe/webhook.js.map +1 -0
  189. package/lib/typescript/check-omission.d.ts +2 -0
  190. package/lib/typescript/check-omission.d.ts.map +1 -0
  191. package/lib/typescript/check-omission.js +43 -0
  192. package/lib/typescript/check-omission.js.map +1 -0
  193. package/lib/typescript/debug-type-errors.d.ts +3 -0
  194. package/lib/typescript/debug-type-errors.d.ts.map +1 -0
  195. package/lib/typescript/debug-type-errors.js +35 -0
  196. package/lib/typescript/debug-type-errors.js.map +1 -0
  197. package/lib/typescript/extract.d.ts +7 -0
  198. package/lib/typescript/extract.d.ts.map +1 -0
  199. package/lib/typescript/extract.js +10 -0
  200. package/lib/typescript/extract.js.map +1 -0
  201. package/lib/typescript/index.d.ts +7 -0
  202. package/lib/typescript/index.d.ts.map +1 -0
  203. package/lib/typescript/index.js +7 -0
  204. package/lib/typescript/index.js.map +1 -0
  205. package/lib/typescript/install-dependencies.d.ts +29 -0
  206. package/lib/typescript/install-dependencies.d.ts.map +1 -0
  207. package/lib/typescript/install-dependencies.js +52 -0
  208. package/lib/typescript/install-dependencies.js.map +1 -0
  209. package/lib/typescript/package.d.ts +157 -0
  210. package/lib/typescript/package.d.ts.map +1 -0
  211. package/lib/typescript/package.js +115 -0
  212. package/lib/typescript/package.js.map +1 -0
  213. package/lib/typescript/repair-omissions.d.ts +3 -0
  214. package/lib/typescript/repair-omissions.d.ts.map +1 -0
  215. package/lib/typescript/repair-omissions.js +23 -0
  216. package/lib/typescript/repair-omissions.js.map +1 -0
  217. package/lib/typescript/repair.d.ts +3 -0
  218. package/lib/typescript/repair.d.ts.map +1 -0
  219. package/lib/typescript/repair.js +34 -0
  220. package/lib/typescript/repair.js.map +1 -0
  221. package/lib/typescript/tsconfig.d.ts +469 -0
  222. package/lib/typescript/tsconfig.d.ts.map +1 -0
  223. package/lib/typescript/tsconfig.js +143 -0
  224. package/lib/typescript/tsconfig.js.map +1 -0
  225. package/lib/typescript/typescript.d.ts +107 -0
  226. package/lib/typescript/typescript.d.ts.map +1 -0
  227. package/lib/typescript/typescript.js +180 -0
  228. package/lib/typescript/typescript.js.map +1 -0
  229. package/lib/typescript/validate.d.ts +10 -0
  230. package/lib/typescript/validate.d.ts.map +1 -0
  231. package/lib/typescript/validate.js +49 -0
  232. package/lib/typescript/validate.js.map +1 -0
  233. package/package.json +11 -11
  234. package/src/aws/auto/resource.ts +1 -1
  235. package/src/index.ts +1 -1
  236. package/test/aws/function.test.ts +0 -144
  237. package/test/aws/queue.test.ts +0 -85
  238. package/test/aws/role.test.ts +0 -153
  239. package/test/aws/table.test.ts +0 -73
  240. package/test/esbuild.test.ts +0 -41
  241. package/test/handler.ts +0 -9
  242. package/test/scope.test.ts +0 -67
  243. package/test/stripe/stripe.test.ts +0 -136
  244. package/tsconfig.json +0 -7
@@ -0,0 +1,105 @@
1
+ import { evaluate } from "./apply";
2
+ import { destroy } from "./destroy";
3
+ import { defaultStage, defaultStateStore, providers } from "./global";
4
+ import { getScope } from "./scope";
5
+ /**
6
+ * Explicitly finalize the program by deleting any resources that were dropped from the root stack.
7
+ *
8
+ * By default, this will be called when
9
+ */
10
+ export async function alchemize(options) {
11
+ const scope = options?.scope ?? getScope();
12
+ const nodes = scope.nodes;
13
+ const stage = options?.stage ?? defaultStage;
14
+ const stateStore = new (options?.stateStore ?? defaultStateStore)(scope.getScopePath(stage));
15
+ if (nodes.size > 0) {
16
+ await stateStore.init?.();
17
+ }
18
+ // Track in-progress deletions to avoid duplicate work
19
+ const deletionPromises = new Map();
20
+ const priorStates = await stateStore.all();
21
+ const priorIDs = Object.keys(priorStates);
22
+ const mode = options?.mode ?? "up";
23
+ if (mode === "up") {
24
+ await Promise.allSettled(Array.from(nodes.values())
25
+ .reverse()
26
+ .map((node) => evaluate(node.resource, {
27
+ stage,
28
+ scope,
29
+ stateStore,
30
+ quiet: options?.quiet,
31
+ })));
32
+ if (options?.destroyOrphans === false) {
33
+ return;
34
+ }
35
+ }
36
+ const aliveIDs = new Set(mode === "up"
37
+ ? nodes.keys()
38
+ : // There are no alive resources in destroy mode
39
+ []);
40
+ const orphanIDs = Array.from(priorIDs).filter((id) => !aliveIDs.has(id));
41
+ const orphanStates = Object.fromEntries(orphanIDs.map((id) => [id, priorStates[id]]));
42
+ // compute a map of resourceID -> upstream dependencies (resources that depend on it)
43
+ const orphanGraph = {};
44
+ for (const [orphanID, orphanState] of Object.entries(orphanStates)) {
45
+ orphanGraph[orphanID] ??= new Set();
46
+ for (const dep of orphanState.deps) {
47
+ (orphanGraph[dep] ??= new Set()).add(orphanID);
48
+ }
49
+ }
50
+ // Start deletion from each orphan that has no dependents (nothing depends on it)
51
+ await Promise.all(orphanIDs
52
+ .filter((id) => orphanGraph[id].size === 0)
53
+ .map((id) => deleteOrphan(id)));
54
+ const remaining = await stateStore.count();
55
+ if (remaining === 0) {
56
+ await stateStore.deinit?.();
57
+ }
58
+ // Recursively delete orphans in dependency order
59
+ async function deleteOrphan(orphanID) {
60
+ // Return existing deletion promise if this orphan is already being deleted
61
+ const existing = deletionPromises.get(orphanID);
62
+ if (existing) {
63
+ return existing;
64
+ }
65
+ // Create promise immediately to prevent race conditions
66
+ let resolve;
67
+ let reject;
68
+ const promise = new Promise((res, rej) => {
69
+ resolve = res;
70
+ reject = rej;
71
+ });
72
+ deletionPromises.set(orphanID, promise);
73
+ try {
74
+ const orphanState = orphanStates[orphanID];
75
+ // First delete this resource
76
+ const providerType = orphanState.provider;
77
+ const provider = providers.get(providerType);
78
+ if (!provider) {
79
+ throw new Error(`No provider found for ${providerType}. Did you forget to import it?`);
80
+ }
81
+ if (!options?.quiet) {
82
+ console.log("Destroy:", orphanID);
83
+ }
84
+ await destroy(stage, scope, orphanID, orphanState, provider, stateStore, {
85
+ quiet: options?.quiet,
86
+ });
87
+ // After this resource is deleted, we can delete its dependencies if they're orphans
88
+ if (orphanState.deps.length > 0) {
89
+ await Promise.all(orphanState.deps
90
+ .filter((dep) => orphanIDs.includes(dep)) // Only delete if it's an orphan
91
+ .map((dep) => deleteOrphan(dep)));
92
+ }
93
+ resolve();
94
+ }
95
+ catch (error) {
96
+ reject(error);
97
+ }
98
+ return promise;
99
+ }
100
+ }
101
+ if (process.env.ALCHEMY_NO_DEPLOY !== "true") {
102
+ // Listen for signals or events
103
+ process.on("exit", () => alchemize());
104
+ }
105
+ //# sourceMappingURL=alchemize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alchemize.js","sourceRoot":"","sources":["../src/alchemize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAc,QAAQ,EAAE,MAAM,SAAS,CAAC;AAsC/C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,YAAY,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,IAAI,iBAAiB,CAAC,CAC/D,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,IAAI,KAAK,CAAC,IAAI,GAAG,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MAAM,EAAE,CAAC;IAC7C,+BAA+B;IAC/B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;AACxC,CAAC"}
package/lib/apply.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { Output } from "./output";
2
+ import { type Scope as IScope } from "./scope";
3
+ import type { StateStore } from "./state";
4
+ export interface ApplyOptions {
5
+ stage: string;
6
+ scope: IScope;
7
+ stateStore: StateStore;
8
+ quiet?: boolean;
9
+ }
10
+ /**
11
+ * Apply a sub-graph to produce a resource.
12
+ * @param output A sub-graph that produces a resource.
13
+ * @returns The resource properties.
14
+ */
15
+ export declare function apply<T>(output: T | Output<T>, options?: Partial<ApplyOptions>): Promise<T>;
16
+ declare class Evaluated<T> {
17
+ readonly value: T;
18
+ readonly deps: string[];
19
+ constructor(value: T, deps?: string[]);
20
+ }
21
+ export declare function evaluate<T>(output: T | Output<T>, options: ApplyOptions): Promise<Evaluated<T>>;
22
+ export {};
23
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,OAAO,EAAE,KAAK,KAAK,IAAI,MAAM,EAAY,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC9B,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,cAAM,SAAS,CAAC,CAAC;aAEG,KAAK,EAAE,CAAC;aACR,IAAI,EAAE,MAAM,EAAE;gBADd,KAAK,EAAE,CAAC,EACR,IAAI,GAAE,MAAM,EAAO;CAEtC;AAID,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAiFvB"}
package/lib/apply.js ADDED
@@ -0,0 +1,84 @@
1
+ import { defaultStage, defaultStateStore } from "./global";
2
+ import { Output } from "./output";
3
+ import { Input, Provider, ResourceID, isResource, } from "./resource";
4
+ import { getScope } from "./scope";
5
+ /**
6
+ * Apply a sub-graph to produce a resource.
7
+ * @param output A sub-graph that produces a resource.
8
+ * @returns The resource properties.
9
+ */
10
+ export async function apply(output, options) {
11
+ const stage = options?.stage ?? defaultStage;
12
+ const scope = options?.scope ?? getScope();
13
+ const statePath = scope.getScopePath(stage);
14
+ const stateStore = options?.stateStore ?? new defaultStateStore(statePath);
15
+ return (await evaluate(output, { stage, scope, stateStore, quiet: options?.quiet })).value;
16
+ }
17
+ class Evaluated {
18
+ value;
19
+ deps;
20
+ constructor(value, deps = []) {
21
+ this.value = value;
22
+ this.deps = deps;
23
+ }
24
+ }
25
+ const cache = new WeakMap();
26
+ export async function evaluate(output, options) {
27
+ const stage = options.stage;
28
+ const stateStore = options.stateStore;
29
+ if (isResource(output)) {
30
+ const resource = output;
31
+ const resourceID = resource[ResourceID];
32
+ const evaluated = await Promise.all(resource[Input].map((r) => evaluate(r, options)));
33
+ if (cache.has(resource)) {
34
+ return await cache.get(resource);
35
+ }
36
+ let resolve;
37
+ let reject;
38
+ const promise = new Promise((res, rej) => {
39
+ resolve = res;
40
+ reject = rej;
41
+ });
42
+ // set this eagerly to avoid double-apply (caused by recursive applies to inputs)
43
+ cache.set(resource, promise);
44
+ const deps = new Set(evaluated.flatMap((input) => input.deps));
45
+ const inputs = evaluated.map((input) => input.value);
46
+ try {
47
+ const result = await resource[Provider].update(stage, resource, deps, inputs, stateStore, options);
48
+ resolve(new Evaluated(result, [resourceID, ...deps]));
49
+ }
50
+ catch (error) {
51
+ console.error(error);
52
+ reject(error);
53
+ }
54
+ return promise;
55
+ }
56
+ else if (output instanceof Output) {
57
+ const inside = output;
58
+ const parent = await evaluate(inside.parent, options);
59
+ const ret = inside.fn(parent.value);
60
+ // the ret may be an Output (e.g. in the flatMap case), so we need to evaluate it and include its deps
61
+ const evaluated = await evaluate(ret, options);
62
+ return new Evaluated(evaluated.value, [
63
+ ...parent.deps,
64
+ ...evaluated.deps,
65
+ ]);
66
+ }
67
+ else if (Array.isArray(output)) {
68
+ const evaluatedItems = await Promise.all(output.map((item) => evaluate(item, options)));
69
+ return new Evaluated(evaluatedItems.map((e) => e.value), evaluatedItems.flatMap((e) => e.deps));
70
+ }
71
+ else if (output instanceof Date) {
72
+ return new Evaluated(output);
73
+ }
74
+ else if (output && typeof output === "object") {
75
+ const entries = Object.entries(output);
76
+ const evaluatedEntries = await Promise.all(entries.map(async ([key, value]) => [key, await evaluate(value, options)]));
77
+ const result = Object.fromEntries(evaluatedEntries.map(([key, evaluated]) => [key, evaluated.value]));
78
+ const deps = evaluatedEntries.flatMap(([_, evaluated]) => evaluated.deps);
79
+ return new Evaluated(result, deps);
80
+ }
81
+ // Base case: primitive value
82
+ return new Evaluated(output);
83
+ }
84
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,KAAK,EACL,QAAQ,EAER,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAA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CAAC,CAAU,CACvE,CACF,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAC/B,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CACnD,CAAC;QAElB,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE1E,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,6BAA6B;IAC7B,OAAO,IAAI,SAAS,CAAI,MAAW,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,11 @@
1
+ declare const AWSDocReference_base: import("../../resource").Provider<"AWSDocReference", [props: {
2
+ serviceName: string;
3
+ resourceName: string;
4
+ requirements: string;
5
+ }], {
6
+ content: string;
7
+ }>;
8
+ export declare class AWSDocReference extends AWSDocReference_base {
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/docs.ts"],"names":[],"mappings":";iBAUmB,MAAM;kBACL,MAAM;kBACN,MAAM;;aAGb,MAAM;;AAVnB,qBAAa,eAAgB,SAAQ,oBAmEpC;CAAG"}
@@ -0,0 +1,56 @@
1
+ import TurndownService from "turndown";
2
+ import { generateText } from "../../agent/ai";
3
+ import { resolveModel } from "../../agent/model";
4
+ import { Resource } from "../../resource";
5
+ export class AWSDocReference extends Resource("AWSDocReference", async (ctx, props) => {
6
+ if (ctx.event === "delete") {
7
+ return;
8
+ }
9
+ const serviceNameLower = props.serviceName.toLowerCase();
10
+ const url = `https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/${serviceNameLower}`;
11
+ const response = await fetch(url);
12
+ if (!response.ok) {
13
+ throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
14
+ }
15
+ const html = await response.text();
16
+ const turndownService = new TurndownService({
17
+ headingStyle: "atx",
18
+ codeBlockStyle: "fenced",
19
+ });
20
+ const markdown = turndownService.turndown(html);
21
+ // Use AI to analyze the docs and extract relevant API information
22
+ const model = await resolveModel("gpt-4o");
23
+ const apiSummary = await generateText({
24
+ model,
25
+ temperature: 0.1,
26
+ messages: [
27
+ {
28
+ role: "system",
29
+ content: "You are an expert at analyzing AWS SDK documentation and identifying relevant APIs for CloudFormation resource implementations.",
30
+ },
31
+ {
32
+ role: "user",
33
+ content: `Please analyze the AWS SDK v3 documentation for the ${props.serviceName} service and identify APIs that would be relevant for implementing the ${props.resourceName} resource's CRUD lifecycle.
34
+
35
+ Requirements for the CRUD lifecycle:
36
+ ${props.requirements}
37
+
38
+ For each relevant API, extract:
39
+ 1. The command name (e.g., CreateUserCOMmand, DeleteRoleCommand)
40
+ 2. A brief description of what it does
41
+ 3. The Input type name (e.g. CreateUserCommandInput)
42
+ 4. The Output type name (e.g. CreateUserCommandOutput)
43
+
44
+ Also include the written documentation for the API.
45
+
46
+ Documentation:
47
+ ${markdown}`,
48
+ },
49
+ ],
50
+ });
51
+ return {
52
+ content: apiSummary.text,
53
+ };
54
+ }) {
55
+ }
56
+ //# sourceMappingURL=docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/aws/auto/docs.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAgB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,OAAO,eAAgB,SAAQ,QAAQ,CAC3C,iBAAiB,EACjB,KAAK,EACH,GAAiC,EACjC,KAIC,EAGO,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export * from "./spec";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./docs";
2
+ export * from "./resource";
3
+ export * from "./service";
4
+ export * from "./spec";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/aws/auto/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Requirements } from "../../markdown/requirements";
2
+ import { TypeScriptFile } from "../../typescript";
3
+ declare const AWSResource_base: import("../../resource").Provider<"cfn-resource", [props: import("./spec").ResourceSpec & {
4
+ ServiceName: string;
5
+ ResourceName: string;
6
+ ResourceFQN: string;
7
+ Properties: {
8
+ [propertyName: string]: import("./spec").ResourceProperty & {
9
+ Spec: import("./spec").PropertySpec;
10
+ };
11
+ };
12
+ } & {
13
+ ServiceName: string;
14
+ requirementsDir: string;
15
+ srcDir: string;
16
+ rootDir: string;
17
+ }], {
18
+ requirements: Requirements;
19
+ implementation: TypeScriptFile;
20
+ } | undefined>;
21
+ export declare class AWSResource extends AWSResource_base {
22
+ }
23
+ export {};
24
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/resource.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;;;;;;;;;;;iBAS/B,MAAM;qBACF,MAAM;YACf,MAAM;aACL,MAAM;;;;;AARrB,qBAAa,WAAY,SAAQ,gBAmMhC;CAAG"}
@@ -0,0 +1,194 @@
1
+ import { kebabCase } from "change-case";
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { z } from "zod";
5
+ import { generateObject } from "../../agent/ai";
6
+ import { resolveModel } from "../../agent/model";
7
+ import { Requirements } from "../../markdown/requirements";
8
+ import { Resource } from "../../resource";
9
+ import { TypeScriptFile } from "../../typescript";
10
+ import { AWSDocReference } from "./docs";
11
+ export class AWSResource extends Resource("cfn-resource", async (ctx, props) => {
12
+ if (ctx.event === "delete") {
13
+ return;
14
+ }
15
+ // Load relevant Terraform provider implementation files for this resource
16
+ const terraformServicePath = path.join(props.rootDir, "3p", "terraform-provider-aws", "internal", "service", props.ServiceName.toLowerCase());
17
+ const files = await fs.readdir(terraformServicePath);
18
+ const resourcePrefix = kebabCase(props.ResourceName).toLowerCase();
19
+ const goFiles = files.filter((file) => file.endsWith(".go") && !file.endsWith("_test.go"));
20
+ if (goFiles.length === 0) {
21
+ throw new Error(`No Terraform implementation files found for resource ${props.ResourceName} in ${terraformServicePath}. Expected files starting with "${resourcePrefix}"`);
22
+ }
23
+ // Identify relevant files using AI
24
+ const { relevantFiles } = await identifyRelevantFiles(props.ResourceName, props.ServiceName, goFiles, resourcePrefix, props);
25
+ if (relevantFiles.length === 0) {
26
+ throw new Error(`No relevant Terraform implementation files identified for resource ${props.ResourceName}`);
27
+ }
28
+ console.log(`Found ${relevantFiles.length} relevant files for ${props.ResourceFQN}:`);
29
+ for (const file of relevantFiles) {
30
+ console.log(` - ${file}`);
31
+ }
32
+ const fileContents = await Promise.all(relevantFiles.map(async (file) => {
33
+ const content = await fs.readFile(path.join(terraformServicePath, file), "utf-8");
34
+ return `// ${file}\n${content}`;
35
+ }));
36
+ const terraformImplementation = fileContents.join("\n\n");
37
+ const requirements = new Requirements("requirements", {
38
+ modelId: "o3-mini",
39
+ reasoningEffort: "high",
40
+ file: path.join(props.requirementsDir, kebabCase(props.ResourceName) + ".md"),
41
+ requirements: [
42
+ `Due to problems relying on the AWS CloudFormation Service, we have decided
43
+ to reproduce the CRUD lifecycle of the ${props.ResourceName} resource locally using
44
+ TypeScript and the AWS SDK v3.
45
+
46
+ Before proceeding, we need to clearly define the requirements for this Resource's lifecycle handler, covering the following aspects:
47
+ 1. Input and Output contract. These are the input properties that are accepted by CloudFormation
48
+ and the output Attributes produced and referenceable after the resource has been created. Don't be lazy by just referencing the documentation, you should describe the property and its behavior explicitly in the requirements document.
49
+ 2. Update lifecycle for each property. This determines the behavior of the CRUD lifecycle when
50
+ a property changes, e.g. when a resource must be REPLACED when a property changes, or whether it can be mutated with a PUT.
51
+ 3. AWS APIs that must be called to create this "CloudFormation Resource". This is not always 1:1, e.g. an IAM Role may have Policies that need to be created and attached.
52
+ 4. Waiting for stabilization - AWS resources can take time to fully stabilize and be ready for use. Our Resource should wait and poll until the resource is ready. Please identify the resources that require stabilization check and which API call can be used to check the status reliably.
53
+ Note: ideally, stabilization checks are performed downstream where they are used (i.e. optimistically instead of pessimistically), so we should analyze this Resource's upstream dependencies and define any checks that should be performed.
54
+ 5. Create, Update and Delete lifecycle procedure. What operations should be performed on CREATE, UPDATE and DELETE?
55
+ 6. Error handling. Point out specific error codes for AWS APIs that require special handling an describe how.
56
+
57
+ Don't be vague. This is a specific requirements doc. Information like "robust" blah-blah is not relevant. Simply focus on the details of the AWS Resource, its contract, composite parts, error handling and lifecycle.
58
+
59
+ Based on analysis of the Terraform AWS Provider implementation below, be sure to identify:
60
+ - Important edge cases and error conditions that need special handling
61
+ - API call patterns and sequences that have been proven to work
62
+ - Stabilization and wait conditions that are necessary
63
+ - Any specific error codes or scenarios that require retry logic or special handling
64
+
65
+ Here is the relevant Terraform implementation:
66
+ ${terraformImplementation}
67
+
68
+ Below is the CloudFormation Resource Specification for the ${props.ResourceName} resource:
69
+ ${JSON.stringify(props, null, 2)}
70
+ `,
71
+ ],
72
+ });
73
+ // First, fetch AWS SDK documentation
74
+ const docReference = new AWSDocReference("docs", {
75
+ serviceName: props.ServiceName,
76
+ resourceName: props.ResourceName,
77
+ requirements: requirements.content,
78
+ });
79
+ const exampleDir = path.join(props.rootDir, "alchemy", "src", "aws");
80
+ const fewShotExamples = await Promise.all((await fs.readdir(exampleDir))
81
+ .filter((file) => file.endsWith(".ts"))
82
+ .map(async (file) => {
83
+ const content = await fs.readFile(path.join(exampleDir, file), "utf-8");
84
+ return `// ${file}\n${content}`;
85
+ }));
86
+ const implementation = new TypeScriptFile("implementation", {
87
+ modelId: "claude-3-5-sonnet-20241022",
88
+ path: path.join(props.srcDir, kebabCase(props.ResourceName) + ".ts"),
89
+ projectRoot: __dirname,
90
+ typeCheck: true,
91
+ requirements: requirements.content.apply((requirements) => docReference.content.apply((docs) => `Implement the ${props.ResourceName} using TypeScript and AWS SDK V3.
92
+
93
+ Requirements:
94
+ ${requirements}
95
+
96
+ API SDK v3 Documentation:
97
+ ${docs}
98
+
99
+ Here is the Terraform Go implementation that we can learn from:
100
+ ${terraformImplementation}
101
+
102
+ Here are some examples of how this has been done before. Make sure to follow the same structure and style of defining input and output contracts as types and then export a class using the mixin pattern and implement the lifecycle as a function, using ctx.event to detect CREATE, UPDATE and DELETE events:
103
+ ${fewShotExamples.join("\n")}
104
+
105
+ One slight difference from the example is that the \`ignore\` and \`Resource\` functions should be imported from alchemy
106
+
107
+ import { type Context, Resource, ignore } from "alchemy";
108
+
109
+ Make sure to add an explicit type for Context<T>
110
+
111
+ async (ctx: Context<OutputType>, props: InputType) => Promise<OutputType> { .. }
112
+
113
+ It must be the OutputType. This avoids problems like it ctx.output being \`unknown\`.
114
+
115
+ Another common gotcha is that ctx.outputs only exists when ctx.event is update | delete. You will get type error when it is create.
116
+
117
+ For reference, here is what the Context object looks like:
118
+ export type Context<Outputs> = {
119
+ stage: string;
120
+ resourceID: ResourceID;
121
+ scope: IScope;
122
+ /**
123
+ * Indicate that this resource is being replaced.
124
+ * This will cause the resource to be deleted at the end of the stack's CREATE phase.
125
+ */
126
+ replace(): void;
127
+ } & (
128
+ | {
129
+ event: "create";
130
+ }
131
+ | {
132
+ event: "update" | "delete";
133
+ output: Outputs;
134
+ }
135
+ );
136
+ `)),
137
+ });
138
+ return {
139
+ requirements,
140
+ implementation,
141
+ };
142
+ }) {
143
+ }
144
+ const RelevantFilesSchema = z.object({
145
+ /**
146
+ * List of Go file names that are relevant for implementing the CRUD lifecycle
147
+ * for this resource
148
+ */
149
+ relevantFiles: z.array(z.string()),
150
+ });
151
+ async function identifyRelevantFiles(resourceName, serviceName, files, resourcePrefix, cfnSpec) {
152
+ const model = await resolveModel("gpt-4o");
153
+ const result = await generateObject({
154
+ model,
155
+ schema: RelevantFilesSchema,
156
+ temperature: 0.1,
157
+ messages: [
158
+ {
159
+ role: "system",
160
+ content: "You are an expert at AWS service implementations and Go code analysis. Your task is to identify ONLY the Go files that are specifically implementing the given AWS resource's CRUD lifecycle, excluding any files that work with other resources.",
161
+ },
162
+ {
163
+ role: "user",
164
+ content: `Please identify which Go files are specifically implementing the CRUD lifecycle for the AWS::${serviceName}::${resourceName} resource.
165
+
166
+ Available files (all in the ${serviceName.toLowerCase()} package):
167
+ ${files.map((f) => `- ${f}`).join("\n")}
168
+
169
+ CloudFormation Resource Specification:
170
+ ${JSON.stringify(cfnSpec, null, 2)}
171
+
172
+ Selection Rules:
173
+ 1. ONLY select files that are specifically implementing this exact resource type (AWS::${serviceName}::${resourceName})
174
+ 2. Files must handle one or more of:
175
+ - Resource creation and deletion
176
+ - Resource updates and modifications
177
+ - Resource state checking and stabilization
178
+ - Resource validation
179
+ 3. Strict Exclusions:
180
+ - Test files
181
+ - Files working with other resource types
182
+ - General utility files (unless they are ONLY used by this resource)
183
+ - Files that just happen to share a similar prefix but work with different resources
184
+ 4. Files should start with the prefix: ${resourcePrefix}
185
+
186
+ Important: Be very strict about only including files that are specifically working with this exact resource type. If a file works with multiple resources or similar resources, exclude it unless it's absolutely essential for this resource's implementation.
187
+
188
+ Return ONLY the list of relevant file names.`,
189
+ },
190
+ ],
191
+ });
192
+ return result.object;
193
+ }
194
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../src/aws/auto/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC,MAAM,OAAO,WAAY,SAAQ,QAAQ,CACvC,cAAc,EACd,KAAK,EACH,GAAG,EACH,KAKC,EACD,EAAE;IACF,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,0EAA0E;IAC1E,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CACpC,KAAK,CAAC,OAAO,EACb,IAAI,EACJ,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,CAChC,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IACnE,MAAM,OAAO,GAAG,KAAK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AAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;EAGrC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;;yFAGuD,WAAW,KAAK,YAAY;;;;;;;;;;;yCAW5E,cAAc;;;;6CAIV;aACtC;SACF;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { CfnService } from "./spec";
2
+ declare const AWSService_base: import("../../resource").Provider<"aws-service", [props: CfnService & {
3
+ requirementsDir: string;
4
+ srcDir: string;
5
+ rootDir: string;
6
+ }], unknown>;
7
+ export declare class AWSService extends AWSService_base {
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;;qBAOlB,MAAM;YACf,MAAM;aACL,MAAM;;AAPrB,qBAAa,UAAW,SAAQ,eA2C/B;CAAG"}
@@ -0,0 +1,34 @@
1
+ import { kebabCase } from "change-case";
2
+ import path from "node:path";
3
+ import { Folder } from "../../fs";
4
+ import { Resource } from "../../resource";
5
+ import { AWSResource } from "./resource";
6
+ export class AWSService extends Resource("aws-service", async (ctx, props) => {
7
+ const serviceDir = new Folder("service", path.join(props.requirementsDir, kebabCase(props.ServiceName))).path;
8
+ const srcDir = new Folder("src", path.join(props.srcDir, kebabCase(props.ServiceName))).path;
9
+ const resources = Object.entries(props.Resources);
10
+ if (process.env.DEBUG) {
11
+ // Only instantiate first resource in debug mode
12
+ const [resourceName, resource] = resources[0];
13
+ return [
14
+ new AWSResource(resourceName, {
15
+ ...resource,
16
+ ServiceName: props.ServiceName,
17
+ requirementsDir: serviceDir,
18
+ srcDir,
19
+ rootDir: props.rootDir,
20
+ }),
21
+ ];
22
+ }
23
+ return resources.map(([resourceName, resource]) => {
24
+ return new AWSResource(resourceName, {
25
+ ...resource,
26
+ ServiceName: props.ServiceName,
27
+ rootDir: props.rootDir,
28
+ srcDir,
29
+ requirementsDir: serviceDir,
30
+ });
31
+ });
32
+ }) {
33
+ }
34
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/aws/auto/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,OAAO,UAAW,SAAQ,QAAQ,CACtC,aAAa,EACb,KAAK,EACH,GAAG,EACH,KAIC,EACD,EAAE;IACF,MAAM,UAAU,GAAG,IAAI,MAAM,CAC3B,SAAS,EACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAC/D,CAAC,IAAI,CAAC;IACP,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,KAAK,EACL,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CACtD,CAAC,IAAI,CAAC;IAEP,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACtB,gDAAgD;QAChD,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC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