diff --git a/package.json b/package.json index 94237146e..5865b0c14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenstack-monorepo", - "version": "2.7.4", + "version": "2.7.5", "description": "", "scripts": { "build": "pnpm -r build", diff --git a/packages/ide/jetbrains/build.gradle.kts b/packages/ide/jetbrains/build.gradle.kts index a2e6892fe..0fc8a6f16 100644 --- a/packages/ide/jetbrains/build.gradle.kts +++ b/packages/ide/jetbrains/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "dev.zenstack" -version = "2.7.4" +version = "2.7.5" repositories { mavenCentral() diff --git a/packages/ide/jetbrains/package.json b/packages/ide/jetbrains/package.json index 5a43c79e0..76cfe0e0c 100644 --- a/packages/ide/jetbrains/package.json +++ b/packages/ide/jetbrains/package.json @@ -1,6 +1,6 @@ { "name": "jetbrains", - "version": "2.7.4", + "version": "2.7.5", "displayName": "ZenStack JetBrains IDE Plugin", "description": "ZenStack JetBrains IDE plugin", "homepage": "https://zenstack.dev", diff --git a/packages/language/package.json b/packages/language/package.json index f5b30d6e0..03d937974 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/language", - "version": "2.7.4", + "version": "2.7.5", "displayName": "ZenStack modeling language compiler", "description": "ZenStack modeling language compiler", "homepage": "https://zenstack.dev", diff --git a/packages/misc/redwood/package.json b/packages/misc/redwood/package.json index 752d79017..41edf7ead 100644 --- a/packages/misc/redwood/package.json +++ b/packages/misc/redwood/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/redwood", "displayName": "ZenStack RedwoodJS Integration", - "version": "2.7.4", + "version": "2.7.5", "description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.", "repository": { "type": "git", diff --git a/packages/plugins/openapi/package.json b/packages/plugins/openapi/package.json index ed83d25b2..870667ded 100644 --- a/packages/plugins/openapi/package.json +++ b/packages/plugins/openapi/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/openapi", "displayName": "ZenStack Plugin and Runtime for OpenAPI", - "version": "2.7.4", + "version": "2.7.5", "description": "ZenStack plugin and runtime supporting OpenAPI", "main": "index.js", "repository": { diff --git a/packages/plugins/swr/package.json b/packages/plugins/swr/package.json index 42de62697..8cc181aa6 100644 --- a/packages/plugins/swr/package.json +++ b/packages/plugins/swr/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/swr", "displayName": "ZenStack plugin for generating SWR hooks", - "version": "2.7.4", + "version": "2.7.5", "description": "ZenStack plugin for generating SWR hooks", "main": "index.js", "repository": { diff --git a/packages/plugins/swr/src/runtime/index.ts b/packages/plugins/swr/src/runtime/index.ts index 0ca4212cc..11e73692d 100644 --- a/packages/plugins/swr/src/runtime/index.ts +++ b/packages/plugins/swr/src/runtime/index.ts @@ -7,7 +7,6 @@ import { type ModelMeta, type PrismaWriteActionType, } from '@zenstackhq/runtime/cross'; -import * as crossFetch from 'cross-fetch'; import { lowerCaseFirst } from 'lower-case-first'; import { createContext, useContext } from 'react'; import type { Cache, Fetcher, SWRConfiguration, SWRResponse } from 'swr'; @@ -376,10 +375,19 @@ export function useInvalidation(model: string, modelMeta: ModelMeta): Invalidato export async function fetcher( url: string, options?: RequestInit, - fetch?: FetchFn, + customFetch?: FetchFn, checkReadBack?: C ): Promise { - const _fetch = fetch ?? crossFetch.fetch; + // Note: 'cross-fetch' is supposed to handle fetch compatibility + // but it doesn't work for cloudflare workers + const _fetch = + customFetch ?? + // check if fetch is available globally + (typeof fetch === 'function' + ? fetch + : // fallback to 'cross-fetch' if otherwise + (await import('cross-fetch')).default); + const res = await _fetch(url, options); if (!res.ok) { const errData = unmarshal(await res.text()); diff --git a/packages/plugins/tanstack-query/package.json b/packages/plugins/tanstack-query/package.json index 05a97815c..ba0d1545b 100644 --- a/packages/plugins/tanstack-query/package.json +++ b/packages/plugins/tanstack-query/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/tanstack-query", "displayName": "ZenStack plugin for generating tanstack-query hooks", - "version": "2.7.4", + "version": "2.7.5", "description": "ZenStack plugin for generating tanstack-query hooks", "main": "index.js", "exports": { diff --git a/packages/plugins/tanstack-query/src/runtime/common.ts b/packages/plugins/tanstack-query/src/runtime/common.ts index 2d6793c8a..a595e3423 100644 --- a/packages/plugins/tanstack-query/src/runtime/common.ts +++ b/packages/plugins/tanstack-query/src/runtime/common.ts @@ -8,7 +8,6 @@ import { type ModelMeta, type PrismaWriteActionType, } from '@zenstackhq/runtime/cross'; -import * as crossFetch from 'cross-fetch'; /** * The default query endpoint. @@ -133,10 +132,19 @@ export type APIContext = { export async function fetcher( url: string, options?: RequestInit, - fetch?: FetchFn, + customFetch?: FetchFn, checkReadBack?: C ): Promise { - const _fetch = fetch ?? crossFetch.fetch; + // Note: 'cross-fetch' is supposed to handle fetch compatibility + // but it doesn't work for cloudflare workers + const _fetch = + customFetch ?? + // check if fetch is available globally + (typeof fetch === 'function' + ? fetch + : // fallback to 'cross-fetch' if otherwise + (await import('cross-fetch')).default); + const res = await _fetch(url, options); if (!res.ok) { const errData = unmarshal(await res.text()); diff --git a/packages/plugins/trpc/package.json b/packages/plugins/trpc/package.json index 0e7f4afe5..c62b0c70a 100644 --- a/packages/plugins/trpc/package.json +++ b/packages/plugins/trpc/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/trpc", "displayName": "ZenStack plugin for tRPC", - "version": "2.7.4", + "version": "2.7.5", "description": "ZenStack plugin for tRPC", "main": "index.js", "repository": { diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 088bde289..dcf4bb9ae 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/runtime", "displayName": "ZenStack Runtime Library", - "version": "2.7.4", + "version": "2.7.5", "description": "Runtime of ZenStack for both client-side and server-side environments.", "repository": { "type": "git", diff --git a/packages/schema/package.json b/packages/schema/package.json index efb704ba1..dcff63940 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -3,7 +3,7 @@ "publisher": "zenstack", "displayName": "ZenStack Language Tools", "description": "FullStack enhancement for Prisma ORM: seamless integration from database to UI", - "version": "2.7.4", + "version": "2.7.5", "author": { "name": "ZenStack Team" }, diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ea62b7d44..5d9af1782 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/sdk", - "version": "2.7.4", + "version": "2.7.5", "description": "ZenStack plugin development SDK", "main": "index.js", "scripts": { diff --git a/packages/server/package.json b/packages/server/package.json index 49d897cef..05f905117 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/server", - "version": "2.7.4", + "version": "2.7.5", "displayName": "ZenStack Server-side Adapters", "description": "ZenStack server-side adapters", "homepage": "https://zenstack.dev", diff --git a/packages/testtools/package.json b/packages/testtools/package.json index ad909bdb7..47cf64447 100644 --- a/packages/testtools/package.json +++ b/packages/testtools/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/testtools", - "version": "2.7.4", + "version": "2.7.5", "description": "ZenStack Test Tools", "main": "index.js", "private": true,