@crossdelta/platform-sdk 0.19.0 → 0.19.3

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 (46) hide show
  1. package/README.md +27 -5
  2. package/bin/chunk-634PL24Z.mjs +20 -0
  3. package/bin/cli.mjs +604 -0
  4. package/bin/config-CKQHYOF4.mjs +2 -0
  5. package/bin/docs/generators/code-style.md +79 -0
  6. package/bin/docs/generators/natural-language.md +117 -0
  7. package/bin/docs/generators/service.md +129 -60
  8. package/bin/templates/hono-microservice/Dockerfile.hbs +3 -1
  9. package/bin/templates/hono-microservice/src/config/env.ts.hbs +3 -0
  10. package/bin/templates/nest-microservice/Dockerfile.hbs +6 -2
  11. package/bin/templates/nest-microservice/src/config/env.ts.hbs +17 -0
  12. package/bin/templates/nest-microservice/src/main.ts.hbs +2 -1
  13. package/bin/templates/workspace/.github/actions/prepare-build-context/action.yml +58 -6
  14. package/bin/templates/workspace/.github/workflows/build-and-deploy.yml.hbs +25 -3
  15. package/bin/templates/workspace/.github/workflows/publish-packages.yml +6 -8
  16. package/bin/templates/workspace/biome.json.hbs +4 -1
  17. package/bin/templates/workspace/infra/package.json.hbs +2 -2
  18. package/bin/templates/workspace/package.json.hbs +1 -0
  19. package/bin/templates/workspace/packages/contracts/README.md.hbs +5 -5
  20. package/bin/templates/workspace/packages/contracts/package.json.hbs +15 -6
  21. package/bin/templates/workspace/packages/contracts/src/index.ts +1 -1
  22. package/bin/templates/workspace/packages/contracts/tsconfig.json.hbs +6 -1
  23. package/bin/templates/workspace/turbo.json +8 -11
  24. package/bin/templates/workspace/turbo.json.hbs +6 -5
  25. package/dist/facade.d.mts +840 -0
  26. package/dist/facade.d.ts +840 -0
  27. package/dist/facade.js +2294 -0
  28. package/dist/facade.js.map +1 -0
  29. package/dist/facade.mjs +2221 -0
  30. package/dist/facade.mjs.map +1 -0
  31. package/dist/plugin-types-DQOv97Zh.d.mts +180 -0
  32. package/dist/plugin-types-DQOv97Zh.d.ts +180 -0
  33. package/dist/plugin-types.d.mts +1 -0
  34. package/dist/plugin-types.d.ts +1 -0
  35. package/dist/plugin-types.js +19 -0
  36. package/dist/plugin-types.js.map +1 -0
  37. package/dist/plugin-types.mjs +1 -0
  38. package/dist/plugin-types.mjs.map +1 -0
  39. package/dist/plugin.d.mts +31 -0
  40. package/dist/plugin.d.ts +31 -0
  41. package/dist/plugin.js +105 -0
  42. package/dist/plugin.js.map +1 -0
  43. package/dist/plugin.mjs +75 -0
  44. package/dist/plugin.mjs.map +1 -0
  45. package/package.json +118 -99
  46. package/bin/cli.js +0 -540
@@ -9,6 +9,7 @@ on:
9
9
  - 'infra/**'
10
10
  - 'bun.lock'
11
11
  - '.github/workflows/**'
12
+ workflow_dispatch:
12
13
  workflow_run:
13
14
  workflows: ['📦 Publish Packages']
14
15
  types:
@@ -37,7 +38,7 @@ jobs:
37
38
  outputs:
38
39
  scopes: $\{{ steps.scope-generator.outputs.scopes }}
39
40
  scope_count: $\{{ steps.scope-generator.outputs.scopes_count }}
40
- infrastructure_changed: $\{{ steps.infra-check.outputs.changed }}
41
+ infrastructure_changed: $\{{ steps.infra-eval.outputs.changed }}
41
42
  steps:
42
43
  - uses: actions/checkout@v4
43
44
  with:
@@ -68,6 +69,15 @@ jobs:
68
69
  changed:
69
70
  - 'infra/**'
70
71
 
72
+ - name: Evaluate infrastructure change
73
+ id: infra-eval
74
+ run: |
75
+ if [ "$\{{ github.event_name }}" = "workflow_run" ] || [ "$\{{ github.event_name }}" = "workflow_dispatch" ] || [ "$\{{ steps.infra-check.outputs.changed }}" = "true" ]; then
76
+ echo "changed=true" >> "$GITHUB_OUTPUT"
77
+ else
78
+ echo "changed=false" >> "$GITHUB_OUTPUT"
79
+ fi
80
+
71
81
  - name: Generate scope matrix
72
82
  id: scope-generator
73
83
  uses: ./.github/actions/generate-scope-matrix
@@ -214,9 +224,21 @@ jobs:
214
224
  cache-restore-keys: bun-$\{{ runner.os }}-
215
225
  npm-token: $\{{ secrets.NPM_TOKEN }}
216
226
 
217
- - name: Build infrastructure package
227
+ - name: Build infrastructure dependencies
228
+ run: |
229
+ bunx turbo run build --filter=@crossdelta/infrastructure --filter={{scope}}/contracts
230
+
231
+ - name: Refresh Pulumi state
232
+ env:
233
+ PULUMI_ACCESS_TOKEN: $\{{ secrets.PULUMI_ACCESS_TOKEN }}
234
+ DIGITALOCEAN_TOKEN: $\{{ secrets.DIGITALOCEAN_TOKEN }}
235
+ working-directory: infra
218
236
  run: |
219
- bun run --cwd packages/infrastructure build
237
+ pulumi refresh \
238
+ --stack $\{{ env.PULUMI_STACK }} \
239
+ --run-program \
240
+ --yes \
241
+ --non-interactive
220
242
 
221
243
  - name: Pulumi up
222
244
  uses: pulumi/actions@v6
@@ -35,23 +35,21 @@ jobs:
35
35
  uses: tj-actions/changed-files@v45
36
36
  with:
37
37
  json: true
38
- dir_names: true
39
- dir_names_max_depth: 2
40
38
  files: packages/*/**
41
39
 
42
40
  - name: Build package matrix
43
41
  id: set-matrix
44
42
  env:
45
43
  INPUT_PACKAGE: ${{ github.event.inputs.package || '' }}
46
- CHANGED_DIRS: ${{ steps.changed.outputs.all_changed_files }}
44
+ CHANGED_FILES: ${{ steps.changed.outputs.all_changed_files }}
47
45
  run: |
48
46
  declare -a packages=()
49
47
  declare -A changed_packages
50
-
51
- # Parse changed directories from JSON
52
- if [ "${{ github.event_name }}" == "push" ] && [ -n "$CHANGED_DIRS" ]; then
53
- for dir in $(echo "$CHANGED_DIRS" | jq -r '.[]'); do
54
- if [[ $dir =~ ^packages/([^/]+)$ ]]; then
48
+
49
+ # Extract package names from changed file paths (e.g. packages/platform-sdk/src/foo.ts → platform-sdk)
50
+ if [ "${{ github.event_name }}" == "push" ] && [ -n "$CHANGED_FILES" ]; then
51
+ for file in $(echo "$CHANGED_FILES" | jq -r '.[]'); do
52
+ if [[ $file =~ ^packages/([^/]+)/ ]]; then
55
53
  changed_packages["${BASH_REMATCH[1]}"]=1
56
54
  fi
57
55
  done
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3
3
  "formatter": {
4
4
  "indentStyle": "space"
5
5
  },
@@ -36,6 +36,9 @@
36
36
  }
37
37
  },
38
38
  "javascript": {
39
+ "parser": {
40
+ "unsafeParameterDecoratorsEnabled": true
41
+ },
39
42
  "formatter": {
40
43
  "indentWidth": 2,
41
44
  "quoteStyle": "single",
@@ -7,8 +7,8 @@
7
7
  "pulumi": "pulumi"
8
8
  },
9
9
  "dependencies": {
10
- "@crossdelta/cloudevents": "^0.6.3",
11
- "@crossdelta/infrastructure": "^0.5.3",
10
+ "@crossdelta/cloudevents": "^0.6.4",
11
+ "@crossdelta/infrastructure": "^0.6.1",
12
12
  "{{scope}}/contracts": "workspace:*",
13
13
  "@pulumi/digitalocean": "^4.55.0",
14
14
  "@pulumi/kubernetes": "^4.21.0",
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "pf": {
15
15
  "registry": "{{projectName}}/platform",
16
+ "plugins": ["@crossdelta/cloudevents"],
16
17
  "commands": {
17
18
  "pulumi": {
18
19
  "cwd": "infra"
@@ -35,7 +35,7 @@ src/
35
35
  ### Using the CLI (Recommended)
36
36
 
37
37
  ```bash
38
- pf event add product.created --fields "productId:string,name:string,price:number"
38
+ pf cloudevents add product.created --fields "productId:string,name:string,price:number"
39
39
  ```
40
40
 
41
41
  This will create `src/events/products/created.ts` with proper domain structure.
@@ -92,7 +92,7 @@ Contracts are **auto-generated** when you create event handlers:
92
92
  pf new hono-micro notifications --ai -d "Sends emails on order.created events"
93
93
 
94
94
  # 2. Add event (creates contract, mock, handler)
95
- pf event add order.created --service services/notifications
95
+ pf cloudevents add order.created --service services/notifications
96
96
  ```
97
97
 
98
98
  This creates:
@@ -141,13 +141,13 @@ See [`infra/streams/README.md`](../../infra/streams/README.md) for details.
141
141
 
142
142
  ```bash
143
143
  # List all available events
144
- pf event list
144
+ pf cloudevents list
145
145
 
146
146
  # Publish mock event
147
- pf event publish order.created
147
+ pf cloudevents publish order.created
148
148
 
149
149
  # Publish with custom data
150
- pf event publish order.created --data '{"orderId":"test-123"}'
150
+ pf cloudevents publish order.created --data '{"orderId":"test-123"}'
151
151
  ```
152
152
 
153
153
  ## Guidelines
@@ -2,21 +2,30 @@
2
2
  "name": "{{scope}}/contracts",
3
3
  "private": true,
4
4
  "type": "module",
5
- "main": "./src/index.ts",
6
- "types": "./src/index.ts",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
7
8
  "exports": {
8
9
  ".": {
9
- "types": "./src/index.ts",
10
- "default": "./src/index.ts"
10
+ "bun": "./src/index.ts",
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
11
14
  }
12
15
  },
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "dev": "tsup --watch",
19
+ "clean": "rm -rf dist"
20
+ },
13
21
  "dependencies": {
14
- "@crossdelta/cloudevents": "^0.6.3",
15
- "@crossdelta/infrastructure": "^0.5.3",
22
+ "@crossdelta/cloudevents": "^0.6.4",
23
+ "@crossdelta/infrastructure": "^0.6.1",
16
24
  "zod": "^4.0.0"
17
25
  },
18
26
  "devDependencies": {
19
27
  "@biomejs/biome": "^1.9.4",
28
+ "tsup": "^8.5.0",
20
29
  "typescript": "^5.7.2"
21
30
  }
22
31
  }
@@ -1,7 +1,7 @@
1
1
  // Export your event contracts and schemas here
2
2
  // Use the CLI to generate contracts:
3
3
  //
4
- // pf event add orders.created --fields "orderId:string,total:number"
4
+ // pf cloudevents add orders.created --fields "orderId:string,total:number"
5
5
  //
6
6
  // This will create: src/events/orders/created.ts
7
7
  // Then uncomment the exports below:
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "outDir": "./dist",
4
- "rootDir": "./src"
4
+ "rootDir": "./src",
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "declaration": true,
8
+ "strict": true,
9
+ "skipLibCheck": true
5
10
  },
6
11
  "include": ["src/**/*"]
7
12
  }
@@ -3,7 +3,8 @@
3
3
  "tasks": {
4
4
  "start:dev": {
5
5
  "cache": false,
6
- "persistent": true
6
+ "persistent": true,
7
+ "dependsOn": ["^build"]
7
8
  },
8
9
  "sync-templates": {
9
10
  "cache": false
@@ -13,19 +14,17 @@
13
14
  },
14
15
  "pulumi": {},
15
16
  "build": {
16
- "cache": false,
17
- "dependsOn": ["^build"]
17
+ "dependsOn": ["^build"],
18
+ "outputs": ["dist/**", "bin/**", ".next/**", ".qwik/**"]
18
19
  },
19
20
  "test": {
20
- "dependsOn": ["^build"],
21
+ "dependsOn": ["build", "^build"],
21
22
  "cache": false
22
23
  },
23
24
  "format": {
24
25
  "cache": false
25
26
  },
26
- "lint": {
27
- "cache": false
28
- },
27
+ "lint": {},
29
28
  "preview": {
30
29
  "cache": false,
31
30
  "persistent": true
@@ -33,7 +32,5 @@
33
32
  },
34
33
  "ui": "tui",
35
34
  "concurrency": "50",
36
- "globalPassThroughEnv": [
37
- "*"
38
- ]
39
- }
35
+ "globalPassThroughEnv": ["*"]
36
+ }
@@ -3,21 +3,22 @@
3
3
  "tasks": {
4
4
  "start:dev": {
5
5
  "cache": false,
6
- "persistent": true
6
+ "persistent": true,
7
+ "dependsOn": ["^build"]
7
8
  },
8
9
  "pulumi": {},
9
10
  "build": {
10
- "cache": false
11
+ "dependsOn": ["^build"],
12
+ "outputs": ["dist/**", "bin/**"]
11
13
  },
12
14
  "test": {
15
+ "dependsOn": ["build", "^build"],
13
16
  "cache": false
14
17
  },
15
18
  "format": {
16
19
  "cache": false
17
20
  },
18
- "lint": {
19
- "cache": false
20
- },
21
+ "lint": {},
21
22
  "preview": {
22
23
  "cache": false,
23
24
  "persistent": true