alchemy 0.1.14 → 0.1.16

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 (222) hide show
  1. package/lib/apply.js +1 -1
  2. package/lib/apply.js.map +1 -1
  3. package/lib/destroy.js +9 -3
  4. package/lib/destroy.js.map +1 -1
  5. package/package.json +1 -2
  6. package/src/apply.ts +1 -1
  7. package/src/aws/table.ts +30 -8
  8. package/src/cloudflare/kv-namespace.ts +34 -15
  9. package/src/cloudflare/worker.ts +66 -41
  10. package/src/destroy.ts +15 -10
  11. package/src/utils/retry.ts +1 -0
  12. package/README.md +0 -334
  13. package/lib/$.d.ts +0 -12
  14. package/lib/$.d.ts.map +0 -1
  15. package/lib/$.js +0 -42
  16. package/lib/$.js.map +0 -1
  17. package/lib/alchemize.d.ts +0 -43
  18. package/lib/alchemize.d.ts.map +0 -1
  19. package/lib/alchemize.js +0 -112
  20. package/lib/alchemize.js.map +0 -1
  21. package/lib/apply.d.ts +0 -23
  22. package/lib/aws/account-id.d.ts +0 -5
  23. package/lib/aws/account-id.d.ts.map +0 -1
  24. package/lib/aws/account-id.js +0 -10
  25. package/lib/aws/account-id.js.map +0 -1
  26. package/lib/aws/bucket.d.ts +0 -21
  27. package/lib/aws/bucket.d.ts.map +0 -1
  28. package/lib/aws/bucket.js +0 -114
  29. package/lib/aws/bucket.js.map +0 -1
  30. package/lib/aws/function.d.ts +0 -53
  31. package/lib/aws/function.d.ts.map +0 -1
  32. package/lib/aws/function.js +0 -195
  33. package/lib/aws/function.js.map +0 -1
  34. package/lib/aws/index.d.ts +0 -9
  35. package/lib/aws/index.d.ts.map +0 -1
  36. package/lib/aws/index.js +0 -9
  37. package/lib/aws/index.js.map +0 -1
  38. package/lib/aws/oidc/github-oidc-provider.d.ts +0 -11
  39. package/lib/aws/oidc/github-oidc-provider.d.ts.map +0 -1
  40. package/lib/aws/oidc/github-oidc-provider.js +0 -22
  41. package/lib/aws/oidc/github-oidc-provider.js.map +0 -1
  42. package/lib/aws/oidc/index.d.ts +0 -3
  43. package/lib/aws/oidc/index.d.ts.map +0 -1
  44. package/lib/aws/oidc/index.js +0 -3
  45. package/lib/aws/oidc/index.js.map +0 -1
  46. package/lib/aws/oidc/oidc-provider.d.ts +0 -60
  47. package/lib/aws/oidc/oidc-provider.d.ts.map +0 -1
  48. package/lib/aws/oidc/oidc-provider.js +0 -140
  49. package/lib/aws/oidc/oidc-provider.js.map +0 -1
  50. package/lib/aws/policy.d.ts +0 -46
  51. package/lib/aws/policy.d.ts.map +0 -1
  52. package/lib/aws/policy.js +0 -139
  53. package/lib/aws/policy.js.map +0 -1
  54. package/lib/aws/queue.d.ts +0 -62
  55. package/lib/aws/queue.d.ts.map +0 -1
  56. package/lib/aws/queue.js +0 -167
  57. package/lib/aws/queue.js.map +0 -1
  58. package/lib/aws/role.d.ts +0 -27
  59. package/lib/aws/role.d.ts.map +0 -1
  60. package/lib/aws/role.js +0 -197
  61. package/lib/aws/role.js.map +0 -1
  62. package/lib/aws/ses.d.ts +0 -75
  63. package/lib/aws/ses.d.ts.map +0 -1
  64. package/lib/aws/ses.js +0 -189
  65. package/lib/aws/ses.js.map +0 -1
  66. package/lib/aws/table.d.ts +0 -26
  67. package/lib/aws/table.d.ts.map +0 -1
  68. package/lib/aws/table.js +0 -142
  69. package/lib/aws/table.js.map +0 -1
  70. package/lib/cloudflare/api.d.ts +0 -88
  71. package/lib/cloudflare/api.d.ts.map +0 -1
  72. package/lib/cloudflare/api.js +0 -184
  73. package/lib/cloudflare/api.js.map +0 -1
  74. package/lib/cloudflare/asset-manifest.d.ts +0 -15
  75. package/lib/cloudflare/asset-manifest.d.ts.map +0 -1
  76. package/lib/cloudflare/asset-manifest.js +0 -2
  77. package/lib/cloudflare/asset-manifest.js.map +0 -1
  78. package/lib/cloudflare/auth.d.ts +0 -52
  79. package/lib/cloudflare/auth.d.ts.map +0 -1
  80. package/lib/cloudflare/auth.js +0 -114
  81. package/lib/cloudflare/auth.js.map +0 -1
  82. package/lib/cloudflare/bindings.d.ts +0 -259
  83. package/lib/cloudflare/bindings.d.ts.map +0 -1
  84. package/lib/cloudflare/bindings.js +0 -2
  85. package/lib/cloudflare/bindings.js.map +0 -1
  86. package/lib/cloudflare/durable-object-namespace.d.ts +0 -20
  87. package/lib/cloudflare/durable-object-namespace.d.ts.map +0 -1
  88. package/lib/cloudflare/durable-object-namespace.js +0 -21
  89. package/lib/cloudflare/durable-object-namespace.js.map +0 -1
  90. package/lib/cloudflare/generate-asset-manifest.d.ts +0 -3
  91. package/lib/cloudflare/generate-asset-manifest.d.ts.map +0 -1
  92. package/lib/cloudflare/generate-asset-manifest.js +0 -69
  93. package/lib/cloudflare/generate-asset-manifest.js.map +0 -1
  94. package/lib/cloudflare/index.d.ts +0 -7
  95. package/lib/cloudflare/index.d.ts.map +0 -1
  96. package/lib/cloudflare/index.js +0 -7
  97. package/lib/cloudflare/index.js.map +0 -1
  98. package/lib/cloudflare/kv-namespace.d.ts +0 -64
  99. package/lib/cloudflare/kv-namespace.d.ts.map +0 -1
  100. package/lib/cloudflare/kv-namespace.js +0 -97
  101. package/lib/cloudflare/kv-namespace.js.map +0 -1
  102. package/lib/cloudflare/state.d.ts +0 -83
  103. package/lib/cloudflare/state.d.ts.map +0 -1
  104. package/lib/cloudflare/state.js +0 -109
  105. package/lib/cloudflare/state.js.map +0 -1
  106. package/lib/cloudflare/static-site-router.d.ts +0 -19
  107. package/lib/cloudflare/static-site-router.d.ts.map +0 -1
  108. package/lib/cloudflare/static-site-router.js +0 -110
  109. package/lib/cloudflare/static-site-router.js.map +0 -1
  110. package/lib/cloudflare/static-site.d.ts +0 -166
  111. package/lib/cloudflare/static-site.d.ts.map +0 -1
  112. package/lib/cloudflare/static-site.js +0 -150
  113. package/lib/cloudflare/static-site.js.map +0 -1
  114. package/lib/cloudflare/types.d.ts +0 -52
  115. package/lib/cloudflare/types.d.ts.map +0 -1
  116. package/lib/cloudflare/types.js +0 -21
  117. package/lib/cloudflare/types.js.map +0 -1
  118. package/lib/cloudflare/upload-asset-manifest.d.ts +0 -12
  119. package/lib/cloudflare/upload-asset-manifest.d.ts.map +0 -1
  120. package/lib/cloudflare/upload-asset-manifest.js +0 -55
  121. package/lib/cloudflare/upload-asset-manifest.js.map +0 -1
  122. package/lib/cloudflare/worker-metadata.d.ts +0 -130
  123. package/lib/cloudflare/worker-metadata.d.ts.map +0 -1
  124. package/lib/cloudflare/worker-metadata.js +0 -2
  125. package/lib/cloudflare/worker-metadata.js.map +0 -1
  126. package/lib/cloudflare/worker-migration.d.ts +0 -110
  127. package/lib/cloudflare/worker-migration.d.ts.map +0 -1
  128. package/lib/cloudflare/worker-migration.js +0 -11
  129. package/lib/cloudflare/worker-migration.js.map +0 -1
  130. package/lib/cloudflare/worker.d.ts +0 -108
  131. package/lib/cloudflare/worker.d.ts.map +0 -1
  132. package/lib/cloudflare/worker.js +0 -384
  133. package/lib/cloudflare/worker.js.map +0 -1
  134. package/lib/destroy.d.ts +0 -19
  135. package/lib/error.d.ts +0 -2
  136. package/lib/error.d.ts.map +0 -1
  137. package/lib/error.js +0 -13
  138. package/lib/error.js.map +0 -1
  139. package/lib/esbuild.d.ts +0 -152
  140. package/lib/esbuild.d.ts.map +0 -1
  141. package/lib/esbuild.js +0 -67
  142. package/lib/esbuild.js.map +0 -1
  143. package/lib/fs.d.ts +0 -12
  144. package/lib/fs.d.ts.map +0 -1
  145. package/lib/fs.js +0 -41
  146. package/lib/fs.js.map +0 -1
  147. package/lib/github/client.d.ts +0 -34
  148. package/lib/github/client.d.ts.map +0 -1
  149. package/lib/github/client.js +0 -91
  150. package/lib/github/client.js.map +0 -1
  151. package/lib/github/index.d.ts +0 -2
  152. package/lib/github/index.d.ts.map +0 -1
  153. package/lib/github/index.js +0 -2
  154. package/lib/github/index.js.map +0 -1
  155. package/lib/github/secret.d.ts +0 -46
  156. package/lib/github/secret.d.ts.map +0 -1
  157. package/lib/github/secret.js +0 -103
  158. package/lib/github/secret.js.map +0 -1
  159. package/lib/global.d.ts +0 -16
  160. package/lib/global.d.ts.map +0 -1
  161. package/lib/global.js +0 -42
  162. package/lib/global.js.map +0 -1
  163. package/lib/index.d.ts +0 -10
  164. package/lib/index.d.ts.map +0 -1
  165. package/lib/index.js +0 -9
  166. package/lib/index.js.map +0 -1
  167. package/lib/input.d.ts +0 -6
  168. package/lib/input.d.ts.map +0 -1
  169. package/lib/input.js +0 -2
  170. package/lib/input.js.map +0 -1
  171. package/lib/main.d.ts +0 -3
  172. package/lib/main.d.ts.map +0 -1
  173. package/lib/main.js +0 -32
  174. package/lib/main.js.map +0 -1
  175. package/lib/output.d.ts +0 -24
  176. package/lib/output.d.ts.map +0 -1
  177. package/lib/output.js +0 -23
  178. package/lib/output.js.map +0 -1
  179. package/lib/print.d.ts +0 -7
  180. package/lib/print.d.ts.map +0 -1
  181. package/lib/print.js +0 -10
  182. package/lib/print.js.map +0 -1
  183. package/lib/resource.d.ts +0 -71
  184. package/lib/resource.d.ts.map +0 -1
  185. package/lib/resource.js +0 -276
  186. package/lib/resource.js.map +0 -1
  187. package/lib/scope.d.ts +0 -18
  188. package/lib/scope.d.ts.map +0 -1
  189. package/lib/scope.js +0 -30
  190. package/lib/scope.js.map +0 -1
  191. package/lib/slug.d.ts +0 -2
  192. package/lib/slug.d.ts.map +0 -1
  193. package/lib/slug.js +0 -4
  194. package/lib/slug.js.map +0 -1
  195. package/lib/state.d.ts +0 -40
  196. package/lib/state.d.ts.map +0 -1
  197. package/lib/state.js +0 -73
  198. package/lib/state.js.map +0 -1
  199. package/lib/stripe/index.d.ts +0 -4
  200. package/lib/stripe/index.d.ts.map +0 -1
  201. package/lib/stripe/index.js +0 -4
  202. package/lib/stripe/index.js.map +0 -1
  203. package/lib/stripe/price.d.ts +0 -109
  204. package/lib/stripe/price.d.ts.map +0 -1
  205. package/lib/stripe/price.js +0 -112
  206. package/lib/stripe/price.js.map +0 -1
  207. package/lib/stripe/product.d.ts +0 -86
  208. package/lib/stripe/product.d.ts.map +0 -1
  209. package/lib/stripe/product.js +0 -90
  210. package/lib/stripe/product.js.map +0 -1
  211. package/lib/stripe/webhook.d.ts +0 -73
  212. package/lib/stripe/webhook.d.ts.map +0 -1
  213. package/lib/stripe/webhook.js +0 -94
  214. package/lib/stripe/webhook.js.map +0 -1
  215. package/lib/utils/content-type.d.ts +0 -8
  216. package/lib/utils/content-type.d.ts.map +0 -1
  217. package/lib/utils/content-type.js +0 -41
  218. package/lib/utils/content-type.js.map +0 -1
  219. package/lib/utils/retry.d.ts +0 -13
  220. package/lib/utils/retry.d.ts.map +0 -1
  221. package/lib/utils/retry.js +0 -31
  222. package/lib/utils/retry.js.map +0 -1
package/lib/esbuild.js DELETED
@@ -1,67 +0,0 @@
1
- import * as esbuild from "esbuild";
2
- import crypto from "node:crypto";
3
- import fs from "node:fs";
4
- import path from "node:path";
5
- import { Resource } from "./resource";
6
- export class Bundle extends Resource("esbuild::Bundle", {
7
- alwaysUpdate: true,
8
- }, async (ctx, props) => {
9
- // Determine output path
10
- const outputPath = getOutputPath(props);
11
- // Ensure output directory exists
12
- await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });
13
- if (ctx.event === "delete") {
14
- await fs.promises.unlink(outputPath).catch(() => { });
15
- // Also clean up sourcemap if it exists
16
- await fs.promises.unlink(outputPath + ".map").catch(() => { });
17
- return { path: outputPath, hash: "" };
18
- }
19
- const result = await bundle(props);
20
- // Calculate hash of the output
21
- const contents = await fs.promises.readFile(outputPath);
22
- const hash = crypto.createHash("sha256").update(contents).digest("hex");
23
- // Store metadata in context
24
- await ctx.set("metafile", result.metafile);
25
- await ctx.set("hash", hash);
26
- // Return output info
27
- return {
28
- path: outputPath,
29
- hash,
30
- };
31
- }) {
32
- /**
33
- * Get the metafile from the last build
34
- */
35
- async getMetafile(ctx) {
36
- return ctx.get("metafile");
37
- }
38
- /**
39
- * Get the hash from the last build
40
- */
41
- async getHash(ctx) {
42
- return ctx.get("hash");
43
- }
44
- }
45
- export async function bundle(props) {
46
- const outputPath = getOutputPath(props);
47
- // Build the bundle
48
- return await esbuild.build({
49
- entryPoints: [props.entryPoint],
50
- outfile: outputPath,
51
- bundle: true,
52
- format: props.format,
53
- target: props.target,
54
- minify: props.minify,
55
- sourcemap: props.sourcemap,
56
- external: props.external,
57
- platform: props.platform,
58
- metafile: true,
59
- write: true,
60
- ...props.options,
61
- });
62
- }
63
- function getOutputPath(props) {
64
- return (props.outfile ||
65
- path.join(props.outdir || "dist", path.basename(props.entryPoint, path.extname(props.entryPoint)) + ".js"));
66
- }
67
- //# sourceMappingURL=esbuild.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAwDtC,MAAM,OAAO,MAAO,SAAQ,QAAQ,CAClC,iBAAiB,EACjB;IACE,YAAY,EAAE,IAAI;CACnB,EACD,KAAK,EAAE,GAAG,EAAE,KAAkB,EAAyB,EAAE;IACvD,wBAAwB;IACxB,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAExC,iCAAiC;IACjC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvE,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrD,uCAAuC;QACvC,MAAM,EAAE,CAAC,QAAQ,CAA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AAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;QACX,GAAG,KAAK,CAAC,OAAO;KACjB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,KAAkB;IACvC,OAAO,CACL,KAAK,CAAC,OAAO;QACb,IAAI,CAAC,IAAI,CACP,KAAK,CAAC,MAAM,IAAI,MAAM,EACtB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,KAAK,CACxE,CACF,CAAC;AACJ,CAAC"}
package/lib/fs.d.ts DELETED
@@ -1,12 +0,0 @@
1
- declare const File_base: import("./resource").Provider<"fs::File", [filePath: string, content: string], string>;
2
- export declare class File extends File_base {
3
- }
4
- declare const Folder_base: import("./resource").Provider<"fs::Folder", [dirPath: string], {
5
- path: string;
6
- }>;
7
- export declare class Folder extends Folder_base {
8
- file(filePath: string, content: string): File;
9
- }
10
- export declare function rm(filePath: string): Promise<void>;
11
- export {};
12
- //# sourceMappingURL=fs.d.ts.map
package/lib/fs.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":";AAMA,qBAAa,IAAK,SAAQ,SAWzB;CAAG;;UAI4C,MAAM;;AAFtD,qBAAa,MAAO,SAAQ,WAa3B;IACQ,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAG9C;AAED,wBAAsB,EAAE,CAAC,QAAQ,EAAE,MAAM,iBAQxC"}
package/lib/fs.js DELETED
@@ -1,41 +0,0 @@
1
- import fs from "node:fs";
2
- import { unlink } from "node:fs/promises";
3
- import path from "node:path";
4
- import { ignore } from "./error";
5
- import { Resource } from "./resource";
6
- export class File extends Resource("fs::File", async (ctx, filePath, content) => {
7
- if (ctx.event === "delete") {
8
- await ignore("ENOENT", () => fs.promises.unlink(filePath));
9
- }
10
- else {
11
- await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
12
- await fs.promises.writeFile(filePath, content);
13
- }
14
- return filePath;
15
- }) {
16
- }
17
- export class Folder extends Resource("fs::Folder", async (ctx, dirPath) => {
18
- if (ctx.event === "delete") {
19
- // we just do a best effort attempt
20
- await ignore(["ENOENT", "ENOTEMPTY"], () => fs.promises.rmdir(dirPath));
21
- }
22
- else {
23
- await ignore("EEXIST", () => fs.promises.mkdir(dirPath, { recursive: true }));
24
- }
25
- return { path: dirPath };
26
- }) {
27
- file(filePath, content) {
28
- return new File(path.basename(filePath), filePath, content);
29
- }
30
- }
31
- export async function rm(filePath) {
32
- try {
33
- await unlink(filePath);
34
- }
35
- catch (error) {
36
- if (error.code !== "ENOENT") {
37
- throw error;
38
- }
39
- }
40
- }
41
- //# sourceMappingURL=fs.js.map
package/lib/fs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,OAAO,IAAK,SAAQ,QAAQ,CAChC,UAAU,EACV,KAAK,EAAE,GAAG,EAAE,QAAgB,EAAE,OAAe,EAAE,EAAE;IAC/C,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,MAAM,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AAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,34 +0,0 @@
1
- import { Octokit } from "@octokit/rest";
2
- /**
3
- * Try to get a GitHub token from the GitHub CLI
4
- */
5
- export declare function getGitHubTokenFromCLI(): Promise<string | null>;
6
- /**
7
- * Get GitHub authentication token with the following priority:
8
- * 1. Explicit token provided in props
9
- * 2. GITHUB_ACCESS_TOKEN environment variable (for actions with admin permissions)
10
- * 3. GITHUB_TOKEN environment variable
11
- * 4. GitHub CLI token (if gh is installed and authenticated)
12
- *
13
- * @param token Optional token to use
14
- * @returns The resolved token or null if not available
15
- */
16
- export declare function getGitHubToken(token?: string): Promise<string | null>;
17
- /**
18
- * Create an authenticated Octokit client
19
- *
20
- * @param options Options for creating the client
21
- * @returns An authenticated Octokit client
22
- */
23
- export declare function createGitHubClient(options?: {
24
- token?: string;
25
- }): Promise<Octokit>;
26
- /**
27
- * Verifies GitHub authentication and provides helpful error messages
28
- *
29
- * @param octokit Octokit client
30
- * @param owner Repository owner
31
- * @param repo Repository name
32
- */
33
- export declare function verifyGitHubAuth(octokit: Octokit, owner: string, repo: string): Promise<void>;
34
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/github/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxC;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYpE;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAO3E;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA4Cf"}
@@ -1,91 +0,0 @@
1
- import { Octokit } from "@octokit/rest";
2
- import { exec } from "child_process";
3
- import { promisify } from "util";
4
- // Convert exec to promise-based
5
- const execAsync = promisify(exec);
6
- /**
7
- * Try to get a GitHub token from the GitHub CLI
8
- */
9
- export async function getGitHubTokenFromCLI() {
10
- try {
11
- // Check if GitHub CLI is installed
12
- const { stdout: ghVersion } = await execAsync("gh --version");
13
- if (!ghVersion)
14
- return null;
15
- // Get the auth token
16
- const { stdout: token } = await execAsync("gh auth token");
17
- return token?.trim() || null;
18
- }
19
- catch (error) {
20
- return null;
21
- }
22
- }
23
- /**
24
- * Get GitHub authentication token with the following priority:
25
- * 1. Explicit token provided in props
26
- * 2. GITHUB_ACCESS_TOKEN environment variable (for actions with admin permissions)
27
- * 3. GITHUB_TOKEN environment variable
28
- * 4. GitHub CLI token (if gh is installed and authenticated)
29
- *
30
- * @param token Optional token to use
31
- * @returns The resolved token or null if not available
32
- */
33
- export async function getGitHubToken(token) {
34
- return (token ||
35
- process.env.GITHUB_ACCESS_TOKEN ||
36
- process.env.GITHUB_TOKEN ||
37
- (await getGitHubTokenFromCLI()));
38
- }
39
- /**
40
- * Create an authenticated Octokit client
41
- *
42
- * @param options Options for creating the client
43
- * @returns An authenticated Octokit client
44
- */
45
- export async function createGitHubClient(options = {}) {
46
- const token = await getGitHubToken(options.token);
47
- return new Octokit({
48
- auth: token,
49
- });
50
- }
51
- /**
52
- * Verifies GitHub authentication and provides helpful error messages
53
- *
54
- * @param octokit Octokit client
55
- * @param owner Repository owner
56
- * @param repo Repository name
57
- */
58
- export async function verifyGitHubAuth(octokit, owner, repo) {
59
- try {
60
- // Make a test request to check authentication
61
- await octokit.rest.repos.get({
62
- owner,
63
- repo,
64
- });
65
- }
66
- catch (error) {
67
- if (error.status === 401) {
68
- console.error("\n⚠️ GitHub authentication failed. Please try one of the following:");
69
- console.error("1. Run 'gh auth login' to authenticate with the GitHub CLI");
70
- console.error("2. Set the GITHUB_TOKEN environment variable with a personal access token");
71
- console.error("3. Pass a token directly to the constructor");
72
- console.error("\nTo create a token, visit: https://github.com/settings/tokens");
73
- console.error("Required scopes: 'repo' for private repos or 'public_repo' for public repos\n");
74
- throw new Error("GitHub authentication failed");
75
- }
76
- else if (error.status === 403) {
77
- console.error("\n⚠️ Insufficient permissions. You need admin access to the repository.");
78
- console.error("Make sure your token has the 'repo' scope for private repos or 'public_repo' for public repos\n");
79
- throw new Error("Insufficient GitHub permissions");
80
- }
81
- else if (error.status === 404) {
82
- console.error(`\n⚠️ Repository not found: ${owner}/${repo}`);
83
- console.error("Make sure the repository exists and you have access to it\n");
84
- throw new Error("GitHub repository not found");
85
- }
86
- else {
87
- throw error;
88
- }
89
- }
90
- }
91
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/github/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,gCAAgC;AAChC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,IAAI,CAAC;QACH,mCAAmC;QACnC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAE5B,qBAAq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gEAAgE,CACjE,CAAC;YACF,OAAO,CAAC,KAAK,CACX,+EAA+E,CAChF,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAChC,OAAO,CAAC,KAAK,CACX,yEAAyE,CAC1E,CAAC;YACF,OAAO,CAAC,KAAK,CACX,iGAAiG,CAClG,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,8BAA8B,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;YAC7D,OAAO,CAAC,KAAK,CACX,6DAA6D,CAC9D,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./secret";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/github/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./secret";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/github/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,46 +0,0 @@
1
- /**
2
- * Properties for creating or updating a GitHub Secret
3
- */
4
- export interface GitHubSecretProps {
5
- /**
6
- * Repository owner (user or organization)
7
- */
8
- owner: string;
9
- /**
10
- * Repository name
11
- */
12
- repository: string;
13
- /**
14
- * Secret name
15
- */
16
- name: string;
17
- /**
18
- * Secret value (will be stored securely on GitHub)
19
- */
20
- value: string;
21
- /**
22
- * Optional GitHub API token (overrides environment variable)
23
- */
24
- token?: string;
25
- }
26
- /**
27
- * Output returned after Secret creation/update
28
- */
29
- export interface GitHubSecretOutput extends Omit<GitHubSecretProps, "value"> {
30
- /**
31
- * The ID of the resource
32
- */
33
- id: string;
34
- /**
35
- * Time at which the object was created/updated
36
- */
37
- updatedAt: string;
38
- }
39
- declare const GitHubSecret_base: import("../resource").Provider<"github::Secret", [props: GitHubSecretProps], GitHubSecretOutput>;
40
- /**
41
- * Resource for managing GitHub repository secrets
42
- */
43
- export declare class GitHubSecret extends GitHubSecret_base {
44
- }
45
- export {};
46
- //# sourceMappingURL=secret.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/github/secret.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC1E;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;;AA2BD;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBA8FjC;CAAG"}
@@ -1,103 +0,0 @@
1
- import sodium from "libsodium-wrappers";
2
- import { Resource } from "../resource";
3
- import { createGitHubClient, verifyGitHubAuth } from "./client";
4
- /**
5
- * Encrypt a value for GitHub using libsodium
6
- * Based on GitHub's documentation for encrypting secrets
7
- *
8
- * @param value - The secret value to encrypt
9
- * @param publicKey - The base64-encoded public key from GitHub
10
- * @returns The base64-encoded encrypted value
11
- */
12
- async function encryptValue(value, publicKey) {
13
- // Initialize libsodium
14
- await sodium.ready;
15
- // Convert the public key from base64 to binary
16
- const binKey = sodium.from_base64(publicKey, sodium.base64_variants.ORIGINAL);
17
- // Convert the message to a Uint8Array
18
- const binMessage = sodium.from_string(value);
19
- // Encrypt the message with the public key using libsodium's sealed box
20
- const encryptedBin = sodium.crypto_box_seal(binMessage, binKey);
21
- // Convert the encrypted message to base64
22
- return sodium.to_base64(encryptedBin, sodium.base64_variants.ORIGINAL);
23
- }
24
- /**
25
- * Resource for managing GitHub repository secrets
26
- */
27
- export class GitHubSecret extends Resource("github::Secret", async (ctx, props) => {
28
- // Create authenticated Octokit client - will automatically handle token resolution
29
- const octokit = await createGitHubClient({ token: props.token });
30
- // Verify authentication and permissions
31
- if (!ctx.quiet) {
32
- await verifyGitHubAuth(octokit, props.owner, props.repository);
33
- }
34
- if (ctx.event === "delete") {
35
- if (ctx.output?.id) {
36
- try {
37
- // Delete the secret
38
- await octokit.rest.actions.deleteRepoSecret({
39
- owner: props.owner,
40
- repo: props.repository,
41
- secret_name: props.name,
42
- });
43
- }
44
- catch (error) {
45
- // Ignore 404 errors (secret already deleted)
46
- if (error.status === 404) {
47
- console.log("Secret doesn't exist, ignoring");
48
- }
49
- else {
50
- throw error;
51
- }
52
- }
53
- }
54
- // Return void (a deleted resource has no content)
55
- return undefined;
56
- }
57
- else {
58
- try {
59
- // Get the repository's public key for encrypting secrets
60
- const { data: publicKey } = await octokit.rest.actions.getRepoPublicKey({
61
- owner: props.owner,
62
- repo: props.repository,
63
- });
64
- // Encrypt the secret value using libsodium
65
- const encryptedValue = await encryptValue(props.value, publicKey.key);
66
- // Create or update the secret with the encrypted value and key_id
67
- const response = await octokit.rest.actions.createOrUpdateRepoSecret({
68
- owner: props.owner,
69
- repo: props.repository,
70
- secret_name: props.name,
71
- encrypted_value: encryptedValue,
72
- key_id: publicKey.key_id,
73
- });
74
- // Log success
75
- if (!ctx.quiet) {
76
- console.log(`Successfully created/updated secret: ${props.name}`);
77
- }
78
- // GitHub doesn't return the secret details on create/update, so we need to construct it
79
- const output = {
80
- id: `${props.owner}/${props.repository}/${props.name}`,
81
- owner: props.owner,
82
- repository: props.repository,
83
- name: props.name,
84
- token: props.token,
85
- updatedAt: new Date().toISOString(),
86
- };
87
- return output;
88
- }
89
- catch (error) {
90
- if (error.status === 403 &&
91
- error.message?.includes("Must have admin rights")) {
92
- console.error("\n⚠️ Error creating/updating GitHub secret: You must have admin rights to the repository.");
93
- console.error("Make sure your GitHub token has the required permissions (repo scope for private repos).\n");
94
- }
95
- else {
96
- console.error("Error creating/updating GitHub secret:", error.message);
97
- }
98
- throw error;
99
- }
100
- }
101
- }) {
102
- }
103
- //# sourceMappingURL=secret.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"secret.js","sourceRoot":"","sources":["../../src/github/secret.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAgB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA+ChE;;;;;;;GAOG;AACH,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,SAAiB;IAC1D,uBAAuB;IACvB,MAAM,MAAM,CAAC,KAAK,CAAC;IAEnB,+CAA+C;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE9E,sCAAsC;IACtC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAE7C,uEAAuE;IACvE,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAEhE,0CAA0C;IAC1C,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,C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YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CACX,wCAAwC,EACxC,KAAK,CAAC,OAAO,CACd,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC,CACF;CAAG"}
package/lib/global.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import type { Provider } from "./resource";
2
- import { FileSystemStateStore } from "./state";
3
- export interface Config {
4
- defaultStage?: string;
5
- stateStore?: new (dir: string) => FileSystemStateStore;
6
- }
7
- export declare const config: Config;
8
- export declare const defaultStage: string;
9
- export declare const defaultStateStore: typeof FileSystemStateStore;
10
- export declare const providers: Map<string, Provider<string, any[], any>>;
11
- export declare const deletions: {
12
- id: string;
13
- data: Record<string, any>;
14
- inputs: any[];
15
- }[];
16
- //# sourceMappingURL=global.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,MAAM;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,oBAAoB,CAAC;CACxD;AAoCD,eAAO,MAAM,MAAM,EAAE,MAGpB,CAAC;AAEF,eAAO,MAAM,YAAY,QAAgC,CAAC;AAE1D,eAAO,MAAM,iBAAiB,6BAA4C,CAAC;AAE3E,eAAO,MAAM,SAAS,2CAGnB,CAAC;AAEJ,eAAO,MAAM,SAAS,EAAE;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,EAAE,CAAC;CACf,EAAO,CAAC"}
package/lib/global.js DELETED
@@ -1,42 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { FileSystemStateStore } from "./state";
4
- const alchemy = path.resolve(process.cwd(), "alchemy.ts");
5
- let _config;
6
- const exists =
7
- // @ts-ignore
8
- fs.promises.exists ??
9
- async function exists(path) {
10
- try {
11
- await fs.promises.access(path);
12
- return true;
13
- }
14
- catch {
15
- return false;
16
- }
17
- };
18
- if (await exists(alchemy)) {
19
- const mod = await import(alchemy);
20
- if (mod) {
21
- const config = mod.default;
22
- if (config) {
23
- if (typeof config !== "object") {
24
- throw new Error("Config is not an object");
25
- }
26
- if (typeof config.defaultStage !== "string") {
27
- throw new Error("Config.stage is not a string");
28
- }
29
- _config = config;
30
- }
31
- }
32
- }
33
- const _stage = process.env.ALCHEMY_STAGE ?? process.env.USER ?? "dev";
34
- export const config = _config ?? {
35
- defaultStage: _stage,
36
- stateStore: FileSystemStateStore,
37
- };
38
- export const defaultStage = config.defaultStage ?? _stage;
39
- export const defaultStateStore = config.stateStore ?? FileSystemStateStore;
40
- export const providers = new Map();
41
- export const deletions = [];
42
- //# sourceMappingURL=global.js.map
package/lib/global.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAO/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC;AAE1D,IAAI,OAA2B,CAAC;AAEhC,MAAM,MAAM;AACV,aAAa;AACb,EAAE,CAAC,QAAQ,CAAC,MAAM;IAClB,KAAK,UAAU,MAAM,CAAC,IAAY;QAChC,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC;AAEJ,IAAI,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,MAAM,GAAG,GAAG,CAAC,OAA6B,CAAC;QACjD,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;gBAC5C,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,GAAG,MAAM,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC;AAEtE,MAAM,CAAC,MAAM,MAAM,GAAW,OAAO,IAAI;IACvC,YAAY,EAAE,MAAM;IACpB,UAAU,EAAE,oBAAoB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,IAAI,oBAAoB,CAAC;AAE3E,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,GAAG,EAG7B,CAAC;AAEJ,MAAM,CAAC,MAAM,SAAS,GAIhB,EAAE,CAAC"}
package/lib/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export * from "./$";
2
- export * from "./alchemize";
3
- export * from "./error";
4
- export * from "./global";
5
- export * from "./input";
6
- export * from "./output";
7
- export * from "./print";
8
- export { Resource, type Context, type CreateContext, type DeleteContext, type UpdateContext, } from "./resource";
9
- export type { FileSystemStateStore as StateStore } from "./state";
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC;AACpB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,oBAAoB,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC"}
package/lib/index.js DELETED
@@ -1,9 +0,0 @@
1
- export * from "./$";
2
- export * from "./alchemize";
3
- export * from "./error";
4
- export * from "./global";
5
- export * from "./input";
6
- export * from "./output";
7
- export * from "./print";
8
- export { Resource, } from "./resource";
9
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC;AACpB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,QAAQ,GAKT,MAAM,YAAY,CAAC"}
package/lib/input.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { Output } from "./output";
2
- export type Inputs<P extends any[]> = P extends [infer First, ...infer Rest] ? [Input<First>, ...Inputs<Rest>] : [];
3
- export type Input<T = any> = T | Output<T> | (T extends any[] ? Inputs<T> : never) | (T extends string | number | boolean ? Output<T> : never) | (T extends object ? {
4
- [k in keyof T]: Input<T[k]>;
5
- } : never);
6
- //# sourceMappingURL=input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GACxE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,GAC/B,EAAE,CAAC;AAEP,MAAM,MAAM,KAAK,CAAC,CAAC,GAAG,GAAG,IACrB,CAAC,GACD,MAAM,CAAC,CAAC,CAAC,GACT,CAAC,CAAC,SAAS,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GACrC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GACzD,CAAC,CAAC,SAAS,MAAM,GACb;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC5B,GACD,KAAK,CAAC,CAAC"}
package/lib/input.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=input.js.map
package/lib/input.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":""}
package/lib/main.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env bun
2
- export {};
3
- //# sourceMappingURL=main.d.ts.map
package/lib/main.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
package/lib/main.js DELETED
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env bun
2
- import { parseArgs } from "util";
3
- const { values, positionals } = parseArgs({
4
- args: process.argv.slice(2),
5
- options: {
6
- help: {
7
- type: "boolean",
8
- short: "h",
9
- },
10
- },
11
- strict: true,
12
- allowPositionals: true,
13
- });
14
- if (values.help || positionals.length === 0) {
15
- console.error("Usage: iac <command> [args]");
16
- console.error("\nCommands:");
17
- console.error(" destroy [stack names] Delete the specified stacks");
18
- process.exit(1);
19
- }
20
- const [command, ...restArgs] = positionals;
21
- if (command.toLowerCase() === "destroy") {
22
- if (restArgs.length === 0) {
23
- console.error("Error: Please specify at least one stack name to destroy");
24
- process.exit(1);
25
- }
26
- console.log("Deleting stacks:", restArgs);
27
- }
28
- else {
29
- console.error(`Unknown command: ${command}`);
30
- process.exit(1);
31
- }
32
- //# sourceMappingURL=main.js.map
package/lib/main.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,GAAG;SACX;KACF;IACD,MAAM,EAAE,IAAI;IACZ,gBAAgB,EAAE,IAAI;CACvB,CAAC,CAAC;AAEH,IAAI,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC;AAE3C,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;IACxC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAC5C,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
package/lib/output.d.ts DELETED
@@ -1,24 +0,0 @@
1
- export declare function isOutput<T>(value: any): value is Output<T>;
2
- export type Outputs<P extends readonly any[]> = P extends [
3
- infer First,
4
- ...infer Rest
5
- ] ? [Output<First>, ...Outputs<Rest>] : [];
6
- export interface Output<T> {
7
- apply<U>(fn: (value: T) => U): Output<U>;
8
- }
9
- export declare class OutputChain<T, U> {
10
- readonly parent: Output<T>;
11
- readonly fn: (value: T) => U;
12
- constructor(parent: Output<T>, fn: (value: T) => U);
13
- apply<V>(fn: (value: U) => Output<V>): Output<V>;
14
- apply<V>(fn: (value: U) => V): Output<V>;
15
- }
16
- export type Resolved<O> = O extends Output<infer U> ? U : O extends null ? O : O extends any[] ? ResolveN<O> : O extends object ? {
17
- [k in keyof O]: Resolved<O[k]>;
18
- } : O;
19
- type ResolveN<O extends any[]> = O extends [infer First, ...infer Rest] ? [Resolved<First>, ...ResolveN<Rest>] : [];
20
- export type Export<Out> = Out extends null ? Output<Out> : Out extends any[] ? Outputs<Out> : Out extends object ? {
21
- [k in keyof Out]: Output<Out[k]>;
22
- } : Output<Out>;
23
- export {};
24
- //# sourceMappingURL=output.d.ts.map