oblaka-iac 0.0.21 → 0.0.22
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 +3 -3
- package/src/commands/deploy.ts +1 -1
- package/src/resources/vpc.ts +1 -2
- package/src/state.ts +2 -1
- package/src/types.ts +2 -18
- package/src/utils/migrations.ts +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oblaka-iac",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"main": "./src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"@biomejs/biome": "^2.4.6",
|
|
28
28
|
"@cloudflare/workers-types": "^4.20260312.1",
|
|
29
29
|
"@types/bun": "latest",
|
|
30
|
-
"dprint": "^0.52.0"
|
|
31
|
-
"wrangler": "^4.72.0"
|
|
30
|
+
"dprint": "^0.52.0"
|
|
32
31
|
},
|
|
33
32
|
"peerDependencies": {
|
|
34
33
|
"typescript": "^5"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
36
|
+
"@cloudflare/workers-utils": "^0.54.1",
|
|
37
37
|
"jsonc-parser": "^3.3.1"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/commands/deploy.ts
CHANGED
|
@@ -82,7 +82,7 @@ export class CloudflareDeployExecutor implements ResourceApplier {
|
|
|
82
82
|
}
|
|
83
83
|
} else {
|
|
84
84
|
for (const idString of this.remaining) {
|
|
85
|
-
const [resource, id] = idString.split(':', 2)
|
|
85
|
+
const [resource = idString, id] = idString.split(':', 2)
|
|
86
86
|
if (!this.input.dryRun) {
|
|
87
87
|
await atomic(async () => {
|
|
88
88
|
await destroyers[resource]?.({
|
package/src/resources/vpc.ts
CHANGED
|
@@ -24,8 +24,7 @@ export class VpcNetwork implements Bindable {
|
|
|
24
24
|
...(args.config.vpc_networks ?? []),
|
|
25
25
|
{
|
|
26
26
|
binding: args.binding,
|
|
27
|
-
|
|
28
|
-
tunnel_id: 'tunnelId' in this.options ? this.options.tunnelId : undefined,
|
|
27
|
+
...('networkId' in this.options ? { network_id: this.options.networkId } : { tunnel_id: this.options.tunnelId }),
|
|
29
28
|
remote: this.options.remote ?? true,
|
|
30
29
|
},
|
|
31
30
|
],
|
package/src/state.ts
CHANGED
|
@@ -55,7 +55,8 @@ export class KVStateStorage implements StateStorage {
|
|
|
55
55
|
keys: [key.env],
|
|
56
56
|
},
|
|
57
57
|
})
|
|
58
|
-
|
|
58
|
+
const stored = value.values?.[key.env]
|
|
59
|
+
return stored ? JSON.parse(stored) : { version: 1, resources: {} }
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
async set(key: StateKey, state: State): Promise<void> {
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RawEnvironment } from '@cloudflare/workers-utils'
|
|
2
2
|
import type { CloudflareClient } from './client'
|
|
3
3
|
import type { Worker } from './resources'
|
|
4
4
|
|
|
@@ -12,23 +12,7 @@ export interface Context {
|
|
|
12
12
|
client: CloudflareClient
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type Config =
|
|
16
|
-
vpc_networks?: Array<{
|
|
17
|
-
binding: string
|
|
18
|
-
network_id?: string
|
|
19
|
-
tunnel_id?: string
|
|
20
|
-
remote?: boolean
|
|
21
|
-
}>
|
|
22
|
-
ai_search_namespaces?: Array<{
|
|
23
|
-
binding: string
|
|
24
|
-
namespace: string
|
|
25
|
-
remote?: boolean
|
|
26
|
-
}>
|
|
27
|
-
flagship?: Array<{
|
|
28
|
-
binding: string
|
|
29
|
-
app_id: string
|
|
30
|
-
}>
|
|
31
|
-
}
|
|
15
|
+
export type Config = RawEnvironment
|
|
32
16
|
|
|
33
17
|
export type ResourceKind =
|
|
34
18
|
| 'worker'
|
package/src/utils/migrations.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export const getNextMigrationTag = (config: { migrations?: { tag: string }[] }) => {
|
|
2
2
|
const latestTag = config.migrations?.map(it => it.tag).sort().pop() ?? 'v0000'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
if (!match) {
|
|
4
|
+
if (!/^v\d{4}$/.test(latestTag)) {
|
|
6
5
|
throw new Error(`Invalid migration tag format: ${latestTag}`)
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
const currentVersion = parseInt(
|
|
8
|
+
const currentVersion = parseInt(latestTag.slice(1), 10)
|
|
10
9
|
const nextVersion = currentVersion + 1
|
|
11
10
|
return `v${String(nextVersion).padStart(4, '0')}`
|
|
12
11
|
}
|