oblaka-iac 0.0.8 → 0.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oblaka-iac",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "main": "./src/index.ts",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,3 +1,4 @@
1
+ import * as fs from 'node:fs/promises'
1
2
  import type { Input } from './input'
2
3
  import { ResourceProcessor } from './resource-processor'
3
4
 
@@ -15,9 +16,30 @@ export class CloudflareConfigureExecutor {
15
16
  }
16
17
 
17
18
  private async run() {
18
- const resourceProcessor = new ResourceProcessor({
19
- applyResource: () => Promise.resolve(undefined),
20
- })
21
- await resourceProcessor.run({ main: this.input.main, env: this.input.env })
19
+ const written: string[] = []
20
+
21
+ const resourceProcessor = new ResourceProcessor(
22
+ { applyResource: () => Promise.resolve(undefined) },
23
+ async (configPath, content) => {
24
+ await fs.writeFile(configPath, content)
25
+ written.push(configPath)
26
+ },
27
+ )
28
+
29
+ try {
30
+ await resourceProcessor.run({ main: this.input.main, env: this.input.env })
31
+ } catch (error) {
32
+ console.error('Configure failed:', error)
33
+ process.exit(1)
34
+ }
35
+
36
+ if (written.length === 0) {
37
+ console.log('No workers found, no configs generated.')
38
+ } else {
39
+ for (const configPath of written) {
40
+ console.log(`wrote ${configPath}`)
41
+ }
42
+ console.log(`Configure complete: generated ${written.length} wrangler config(s).`)
43
+ }
22
44
  }
23
45
  }
@@ -0,0 +1,10 @@
1
+ import type { Bindable, Config } from '../types'
2
+
3
+ export class AiGateway implements Bindable {
4
+ configureBinding(args: { config: Config; binding: string; env: string }): Config {
5
+ return {
6
+ ...args.config,
7
+ ai: { binding: args.binding },
8
+ }
9
+ }
10
+ }
@@ -9,6 +9,7 @@ import { VectorizeIndexDestroyer } from './vectorize'
9
9
  import { WorkerDestroyer } from './worker'
10
10
  import { WorkflowDestroyer } from './workflow'
11
11
 
12
+ export * from './ai-gateway'
12
13
  export * from './analytics-engine'
13
14
  export * from './browser'
14
15
  export * from './container'