Skip to content

Commit e370e5f

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/realtime-handler
# Conflicts: # package-lock.json # package.json
2 parents 3c91616 + ec92f98 commit e370e5f

17 files changed

Lines changed: 339 additions & 87 deletions

.github/dependabot.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1+
#
2+
# Switches js-sdk from routine version updates to SECURITY UPDATES ONLY, with a 7-day
3+
# cooldown — matching the vite-plugin / apper templates policy. (The previous config chased
4+
# every version bump with no cooldown, which created 11 non-security PRs.)
5+
#
6+
# open-pull-requests-limit: 0 turns off scheduled version bumps (no "chase latest" churn, no
7+
# major upgrades). Dependabot *security* updates ignore this limit and still flow — they need
8+
# Dependabot alerts enabled in repo Settings > Security. cooldown + groups are inert while
9+
# version updates are off, kept forward-compatible for if limit: 0 is ever dropped
10+
# (cooldown = 7-day supply-chain buffer; groups batch minor/patch).
111
version: 2
212
updates:
3-
# Keep package.json dependencies patched. Combined with GitHub's
4-
# Dependabot security updates (enabled in repo Settings > Security),
5-
# this opens PRs for both routine version bumps and CVE fixes.
613
- package-ecosystem: "npm"
714
directory: "/"
815
schedule:
9-
interval: "weekly"
10-
open-pull-requests-limit: 10
16+
interval: "daily"
17+
cooldown:
18+
default-days: 7
19+
open-pull-requests-limit: 0
20+
labels:
21+
- "dependencies"
22+
commit-message:
23+
prefix: "chore(deps)"
1124
groups:
12-
# Batch low-risk dev tooling updates into a single PR to cut noise.
13-
dev-dependencies:
14-
dependency-type: "development"
15-
update-types:
16-
- "minor"
17-
- "patch"
18-
19-
# Keep the GitHub Actions used by these workflows up to date.
20-
- package-ecosystem: "github-actions"
21-
directory: "/"
22-
schedule:
23-
interval: "weekly"
25+
npm-minor-patch:
26+
update-types: ["minor", "patch"]

.github/workflows/claude-code-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
4040

4141
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
42-
model: "claude-opus-4-20250514"
42+
model: "claude-opus-4-8"
4343

4444
# Direct prompt for automated review (no @claude mention needed)
4545
direct_prompt: |

.github/workflows/claude-docs-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3838
use_sticky_comment: true
3939
claude_args: |
40-
--model claude-sonnet-4-20250514
40+
--model claude-sonnet-4-6
4141
--json-schema '{"type":"object","properties":{"needs_docs":{"type":"boolean","description":"true if the PR has public APIs that need new or improved JSDoc"}},"required":["needs_docs"]}'
4242
4343
prompt: |

.github/workflows/claude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
actions: read
4242
4343
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
44-
model: "claude-opus-4-20250514"
44+
model: "claude-opus-4-8"
4545

4646
# Optional: Customize the trigger phrase (default: @claude)
4747
# trigger_phrase: "/claude"

.github/workflows/manual-publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
required: false
1919
default: false
2020
type: boolean
21+
notify_skills_repo:
22+
description: "Notify the skills repo about the release"
23+
required: false
24+
default: true
25+
type: boolean
2126

2227
jobs:
2328
publish:
@@ -30,6 +35,7 @@ jobs:
3035
with:
3136
app-id: ${{ vars.BASE44_GITHUB_ACTIONS_APP_ID }}
3237
private-key: ${{ secrets.BASE44_GITHUB_ACTIONS_APP_PRIVATE_KEY }}
38+
owner: base44
3339

3440
- name: Checkout code
3541
uses: actions/checkout@v4
@@ -131,6 +137,19 @@ jobs:
131137
draft: false
132138
prerelease: false
133139

140+
- name: Notify skills repo
141+
if: github.event.inputs.dry_run == 'false' && github.event.inputs.notify_skills_repo == 'true'
142+
uses: peter-evans/repository-dispatch@v4
143+
with:
144+
token: ${{ steps.generate-token.outputs.token }}
145+
repository: base44/skills
146+
event-type: sdk-release
147+
client-payload: |
148+
{
149+
"version": "v${{ env.NEW_VERSION }}",
150+
"release_name": "Release v${{ env.NEW_VERSION }}"
151+
}
152+
134153
permissions:
135154
contents: write
136155
packages: write

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@base44/sdk",
3-
"version": "0.8.37",
3+
"version": "0.8.40",
44
"description": "JavaScript SDK for Base44 API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
2626
"create-docs:process": "node scripts/mintlify-post-processing/file-processing/file-processing.js"
2727
},
2828
"dependencies": {
29-
"axios": "^1.17.0",
29+
"axios": "^1.18.1",
3030
"partysocket": "^0.0.23",
3131
"socket.io-client": "^4.8.3",
3232
"uuid": "^13.0.2"

pstest.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import PartySocket from "partysocket";
2+
3+
// Fake WebSocket that just records the URL PartySocket tries to open.
4+
class FakeWS {
5+
constructor(url) { FakeWS.lastUrl = url; this.readyState = 0; }
6+
addEventListener(){} removeEventListener(){} close(){} send(){}
7+
}
8+
9+
function urlFor(host) {
10+
FakeWS.lastUrl = null;
11+
try {
12+
new PartySocket({ host, room: "room123", party: "GameRoom", WebSocket: FakeWS, query: { token: "T" } });
13+
} catch (e) { return "THREW: " + e.message; }
14+
return FakeWS.lastUrl;
15+
}
16+
17+
console.log("=== PartySocket host -> connect URL ===");
18+
for (const h of ["https://app.base44.app", "http://localhost:1999", "app.base44.app", "https://app.com/sub/path", "http://10.0.0.5:3000"]) {
19+
console.log(`host=${JSON.stringify(h)}\n -> ${urlFor(h)}`);
20+
}
21+
22+
console.log("\n=== new URL(raw).origin behavior ===");
23+
for (const raw of ["https://app.com", "http://localhost:1999", "https://app.com/foo", "app.com", "myapp.base44.app"]) {
24+
try { console.log(`${JSON.stringify(raw)} -> ${new URL(raw).origin}`); }
25+
catch (e) { console.log(`${JSON.stringify(raw)} -> THREW: ${e.message}`); }
26+
}

src/client.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export function createClient(config: CreateClientConfig): Base44Client {
212212
serverUrl,
213213
token,
214214
}),
215-
aiGateway: createAiGatewayModule({ serverUrl, token }),
215+
aiGateway: createAiGatewayModule({ serverUrl, token, appId }),
216216
appLogs: createAppLogsModule(axiosClient, appId),
217217
users: createUsersModule(axiosClient, appId),
218218
analytics: createAnalyticsModule({
@@ -265,7 +265,7 @@ export function createClient(config: CreateClientConfig): Base44Client {
265265
serverUrl,
266266
token,
267267
}),
268-
aiGateway: createAiGatewayModule({ serverUrl, token: serviceToken }),
268+
aiGateway: createAiGatewayModule({ serverUrl, token: serviceToken, appId }),
269269
appLogs: createAppLogsModule(serviceRoleAxiosClient, appId),
270270
cleanup: () => {
271271
if (socket) {
@@ -427,6 +427,7 @@ export function createClientFromRequest(request: Request): Base44Client {
427427
const serverUrlHeader = request.headers.get("Base44-Api-Url");
428428
const functionsVersion = request.headers.get("Base44-Functions-Version");
429429
const stateHeader = request.headers.get("Base44-State");
430+
const dataEnvHeader = request.headers.get("X-Data-Env");
430431

431432
if (!appId) {
432433
throw new Error(
@@ -469,6 +470,16 @@ export function createClientFromRequest(request: Request): Base44Client {
469470
if (stateHeader) {
470471
additionalHeaders["Base44-State"] = stateHeader;
471472
}
473+
// Propagate the data environment so entity operations from the function stay
474+
// in the same environment (e.g. test data) as the triggering request. This
475+
// matters for the user-scoped client: unlike the service token, the user JWT
476+
// carries no data-env, so without forwarding this header the callbacks fall
477+
// back to production data even when the app runs in test-data mode.
478+
// Forward only the known closed set (matches the backend contract) rather
479+
// than relaying an arbitrary attacker-supplied header value onward.
480+
if (dataEnvHeader === "dev" || dataEnvHeader === "prod") {
481+
additionalHeaders["X-Data-Env"] = dataEnvHeader;
482+
}
472483

473484
return createClient({
474485
serverUrl: serverUrlHeader || "https://base44.app",

src/modules/ai-gateway.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import {
88
export function createAiGatewayModule({
99
serverUrl,
1010
token,
11+
appId,
1112
}: AiGatewayModuleConfig): AiGatewayModule {
1213
const connection = (): AiGatewayConnection => ({
13-
baseURL: `${serverUrl}/api/ai/openai/v1`,
14+
baseURL: `${serverUrl}/api/apps/${appId}/ai/openai/v1`,
1415
token: token ?? getAccessToken() ?? "",
1516
});
1617

0 commit comments

Comments
 (0)