mtmsdk 0.0.51 → 0.0.53
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/dist/gomtmapi/@tanstack/react-query.gen.d.ts +21 -185
- package/dist/gomtmapi/@tanstack/react-query.gen.d.ts.map +1 -1
- package/dist/gomtmapi/@tanstack/react-query.gen.js +39 -215
- package/dist/gomtmapi/@tanstack/react-query.gen.js.map +1 -1
- package/dist/gomtmapi/index.d.ts +2 -2
- package/dist/gomtmapi/index.d.ts.map +1 -1
- package/dist/gomtmapi/index.js +1 -1
- package/dist/gomtmapi/index.js.map +1 -1
- package/dist/gomtmapi/schemas.gen.d.ts +67 -138
- package/dist/gomtmapi/schemas.gen.d.ts.map +1 -1
- package/dist/gomtmapi/schemas.gen.js +68 -142
- package/dist/gomtmapi/schemas.gen.js.map +1 -1
- package/dist/gomtmapi/sdk.gen.d.ts +15 -107
- package/dist/gomtmapi/sdk.gen.d.ts.map +1 -1
- package/dist/gomtmapi/sdk.gen.js +22 -128
- package/dist/gomtmapi/sdk.gen.js.map +1 -1
- package/dist/gomtmapi/types.gen.d.ts +66 -303
- package/dist/gomtmapi/types.gen.d.ts.map +1 -1
- package/dist/gomtmapi/zod.gen.d.ts +48 -183
- package/dist/gomtmapi/zod.gen.d.ts.map +1 -1
- package/dist/gomtmapi/zod.gen.js +36 -150
- package/dist/gomtmapi/zod.gen.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/sbmng/@tanstack/react-query.gen.d.ts +183 -209
- package/dist/sbmng/@tanstack/react-query.gen.d.ts.map +1 -1
- package/dist/sbmng/@tanstack/react-query.gen.js +25 -71
- package/dist/sbmng/@tanstack/react-query.gen.js.map +1 -1
- package/dist/sbmng/index.d.ts +2 -2
- package/dist/sbmng/index.d.ts.map +1 -1
- package/dist/sbmng/index.js +1 -1
- package/dist/sbmng/index.js.map +1 -1
- package/dist/sbmng/schemas.gen.d.ts +10 -99
- package/dist/sbmng/schemas.gen.d.ts.map +1 -1
- package/dist/sbmng/schemas.gen.js +11 -143
- package/dist/sbmng/schemas.gen.js.map +1 -1
- package/dist/sbmng/sdk.gen.d.ts +13 -23
- package/dist/sbmng/sdk.gen.d.ts.map +1 -1
- package/dist/sbmng/sdk.gen.js +16 -38
- package/dist/sbmng/sdk.gen.js.map +1 -1
- package/dist/sbmng/types.gen.d.ts +41 -157
- package/dist/sbmng/types.gen.d.ts.map +1 -1
- package/dist/supabase/auth-provider.d.ts +8 -1
- package/dist/supabase/auth-provider.d.ts.map +1 -1
- package/dist/supabase/context.d.ts +3844 -1
- package/dist/supabase/context.d.ts.map +1 -1
- package/dist/supabase/cursor-pagination.d.ts +4 -4
- package/dist/supabase/cursor-pagination.js +4 -4
- package/dist/supabase/schema/index.d.ts +1 -11
- package/dist/supabase/schema/index.d.ts.map +1 -1
- package/dist/supabase/schema/index.js +1 -19
- package/dist/supabase/schema/index.js.map +1 -1
- package/dist/supabase/schema/system-config.d.ts +12 -0
- package/dist/supabase/schema/system-config.d.ts.map +1 -0
- package/dist/supabase/schema/system-config.js +22 -0
- package/dist/supabase/schema/system-config.js.map +1 -0
- package/dist/supabase/supabase-client.d.ts +25 -591
- package/dist/supabase/supabase-client.d.ts.map +1 -1
- package/dist/supabase/supabase.d.ts +59 -1191
- package/dist/supabase/supabase.d.ts.map +1 -1
- package/dist/supabase/use-sb-query/build-query-opts.d.ts +6 -2
- package/dist/supabase/use-sb-query/build-query-opts.d.ts.map +1 -1
- package/dist/supabase/use-sb-query/build-query-opts.js +8 -4
- package/dist/supabase/use-sb-query/build-query-opts.js.map +1 -1
- package/dist/supabase/use-sb-query/use-query.d.ts +9 -6
- package/dist/supabase/use-sb-query/use-query.d.ts.map +1 -1
- package/dist/supabase/use-sb-query/use-query.js.map +1 -1
- package/dist/supabase/use-sb-query/use-rpc-mutation.d.ts +8 -8
- package/dist/supabase/use-sb-query/use-rpc-mutation.js +8 -8
- package/dist/supabase/use-sb-query/use-rpc-query.d.ts +25 -17
- package/dist/supabase/use-sb-query/use-rpc-query.d.ts.map +1 -1
- package/dist/supabase/use-sb-query/use-rpc-query.js +48 -26
- package/dist/supabase/use-sb-query/use-rpc-query.js.map +1 -1
- package/dist/types/contracts.d.ts +63 -0
- package/dist/types/contracts.d.ts.map +1 -0
- package/dist/types/contracts.js +17 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/database.schemas.d.ts +94 -786
- package/dist/types/database.schemas.d.ts.map +1 -1
- package/dist/types/database.schemas.js +30 -474
- package/dist/types/database.schemas.js.map +1 -1
- package/dist/types/database.types.d.ts +25 -596
- package/dist/types/database.types.d.ts.map +1 -1
- package/dist/types/database.types.js +0 -10
- package/dist/types/database.types.js.map +1 -1
- package/dist/types/index.d.ts +22 -67
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +16 -5
- package/dist/types/index.js.map +1 -1
- package/package.json +17 -26
- package/dist/adk/api/client.d.ts +0 -9
- package/dist/adk/api/client.d.ts.map +0 -1
- package/dist/adk/api/client.js +0 -39
- package/dist/adk/api/client.js.map +0 -1
- package/dist/adk/core/constants/tool-icons.d.ts +0 -21
- package/dist/adk/core/constants/tool-icons.d.ts.map +0 -1
- package/dist/adk/core/constants/tool-icons.js +0 -47
- package/dist/adk/core/constants/tool-icons.js.map +0 -1
- package/dist/adk/core/models/AgentBuilder.d.ts +0 -77
- package/dist/adk/core/models/AgentBuilder.d.ts.map +0 -1
- package/dist/adk/core/models/AgentBuilder.js +0 -18
- package/dist/adk/core/models/AgentBuilder.js.map +0 -1
- package/dist/adk/core/models/AgentRunRequest.d.ts +0 -37
- package/dist/adk/core/models/AgentRunRequest.d.ts.map +0 -1
- package/dist/adk/core/models/AgentRunRequest.js +0 -18
- package/dist/adk/core/models/AgentRunRequest.js.map +0 -1
- package/dist/adk/core/models/Eval.d.ts +0 -55
- package/dist/adk/core/models/Eval.d.ts.map +0 -1
- package/dist/adk/core/models/Eval.js +0 -27
- package/dist/adk/core/models/Eval.js.map +0 -1
- package/dist/adk/core/models/LiveRequest.d.ts +0 -23
- package/dist/adk/core/models/LiveRequest.d.ts.map +0 -1
- package/dist/adk/core/models/LiveRequest.js +0 -18
- package/dist/adk/core/models/LiveRequest.js.map +0 -1
- package/dist/adk/core/models/RuntimeConfig.d.ts +0 -32
- package/dist/adk/core/models/RuntimeConfig.d.ts.map +0 -1
- package/dist/adk/core/models/RuntimeConfig.js +0 -18
- package/dist/adk/core/models/RuntimeConfig.js.map +0 -1
- package/dist/adk/core/models/Session.d.ts +0 -117
- package/dist/adk/core/models/Session.d.ts.map +0 -1
- package/dist/adk/core/models/Session.js +0 -31
- package/dist/adk/core/models/Session.js.map +0 -1
- package/dist/adk/core/models/Trace.d.ts +0 -40
- package/dist/adk/core/models/Trace.d.ts.map +0 -1
- package/dist/adk/core/models/Trace.js +0 -2
- package/dist/adk/core/models/Trace.js.map +0 -1
- package/dist/adk/core/models/types.d.ts +0 -338
- package/dist/adk/core/models/types.d.ts.map +0 -1
- package/dist/adk/core/models/types.js +0 -189
- package/dist/adk/core/models/types.js.map +0 -1
- package/dist/cloud-account/platform-configs.d.ts +0 -64
- package/dist/cloud-account/platform-configs.d.ts.map +0 -1
- package/dist/cloud-account/platform-configs.js +0 -44
- package/dist/cloud-account/platform-configs.js.map +0 -1
- package/dist/lib/aisdk/types.d.ts +0 -3
- package/dist/lib/aisdk/types.d.ts.map +0 -1
- package/dist/lib/aisdk/types.js +0 -5
- package/dist/lib/aisdk/types.js.map +0 -1
- package/dist/lib/logger/index.d.ts +0 -22
- package/dist/lib/logger/index.d.ts.map +0 -1
- package/dist/lib/logger/index.js +0 -7
- package/dist/lib/logger/index.js.map +0 -1
- package/dist/lib/schema.d.ts +0 -53
- package/dist/lib/schema.d.ts.map +0 -1
- package/dist/lib/schema.js +0 -37
- package/dist/lib/schema.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -14
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -45
- package/dist/lib/utils.js.map +0 -1
- package/dist/mtgate_api/@tanstack/react-query.gen.d.ts +0 -166
- package/dist/mtgate_api/@tanstack/react-query.gen.d.ts.map +0 -1
- package/dist/mtgate_api/@tanstack/react-query.gen.js +0 -118
- package/dist/mtgate_api/@tanstack/react-query.gen.js.map +0 -1
- package/dist/mtgate_api/client/client.gen.d.ts +0 -3
- package/dist/mtgate_api/client/client.gen.d.ts.map +0 -1
- package/dist/mtgate_api/client/client.gen.js +0 -236
- package/dist/mtgate_api/client/client.gen.js.map +0 -1
- package/dist/mtgate_api/client/index.d.ts +0 -9
- package/dist/mtgate_api/client/index.d.ts.map +0 -1
- package/dist/mtgate_api/client/index.js +0 -7
- package/dist/mtgate_api/client/index.js.map +0 -1
- package/dist/mtgate_api/client/types.gen.d.ts +0 -118
- package/dist/mtgate_api/client/types.gen.d.ts.map +0 -1
- package/dist/mtgate_api/client/types.gen.js +0 -3
- package/dist/mtgate_api/client/types.gen.js.map +0 -1
- package/dist/mtgate_api/client/utils.gen.d.ts +0 -34
- package/dist/mtgate_api/client/utils.gen.d.ts.map +0 -1
- package/dist/mtgate_api/client/utils.gen.js +0 -232
- package/dist/mtgate_api/client/utils.gen.js.map +0 -1
- package/dist/mtgate_api/client.gen.d.ts +0 -13
- package/dist/mtgate_api/client.gen.d.ts.map +0 -1
- package/dist/mtgate_api/client.gen.js +0 -4
- package/dist/mtgate_api/client.gen.js.map +0 -1
- package/dist/mtgate_api/core/auth.gen.d.ts +0 -19
- package/dist/mtgate_api/core/auth.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/auth.gen.js +0 -15
- package/dist/mtgate_api/core/auth.gen.js.map +0 -1
- package/dist/mtgate_api/core/bodySerializer.gen.d.ts +0 -26
- package/dist/mtgate_api/core/bodySerializer.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/bodySerializer.gen.js +0 -58
- package/dist/mtgate_api/core/bodySerializer.gen.js.map +0 -1
- package/dist/mtgate_api/core/params.gen.d.ts +0 -44
- package/dist/mtgate_api/core/params.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/params.gen.js +0 -101
- package/dist/mtgate_api/core/params.gen.js.map +0 -1
- package/dist/mtgate_api/core/pathSerializer.gen.d.ts +0 -34
- package/dist/mtgate_api/core/pathSerializer.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/pathSerializer.gen.js +0 -115
- package/dist/mtgate_api/core/pathSerializer.gen.js.map +0 -1
- package/dist/mtgate_api/core/queryKeySerializer.gen.d.ts +0 -19
- package/dist/mtgate_api/core/queryKeySerializer.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/queryKeySerializer.gen.js +0 -100
- package/dist/mtgate_api/core/queryKeySerializer.gen.js.map +0 -1
- package/dist/mtgate_api/core/serverSentEvents.gen.d.ts +0 -72
- package/dist/mtgate_api/core/serverSentEvents.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/serverSentEvents.gen.js +0 -138
- package/dist/mtgate_api/core/serverSentEvents.gen.js.map +0 -1
- package/dist/mtgate_api/core/types.gen.d.ts +0 -79
- package/dist/mtgate_api/core/types.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/types.gen.js +0 -3
- package/dist/mtgate_api/core/types.gen.js.map +0 -1
- package/dist/mtgate_api/core/utils.gen.d.ts +0 -20
- package/dist/mtgate_api/core/utils.gen.d.ts.map +0 -1
- package/dist/mtgate_api/core/utils.gen.js +0 -88
- package/dist/mtgate_api/core/utils.gen.js.map +0 -1
- package/dist/mtgate_api/index.d.ts +0 -3
- package/dist/mtgate_api/index.d.ts.map +0 -1
- package/dist/mtgate_api/index.js +0 -3
- package/dist/mtgate_api/index.js.map +0 -1
- package/dist/mtgate_api/schemas.gen.d.ts +0 -233
- package/dist/mtgate_api/schemas.gen.d.ts.map +0 -1
- package/dist/mtgate_api/schemas.gen.js +0 -277
- package/dist/mtgate_api/schemas.gen.js.map +0 -1
- package/dist/mtgate_api/sdk.gen.d.ts +0 -23
- package/dist/mtgate_api/sdk.gen.d.ts.map +0 -1
- package/dist/mtgate_api/sdk.gen.js +0 -31
- package/dist/mtgate_api/sdk.gen.js.map +0 -1
- package/dist/mtgate_api/types.gen.d.ts +0 -203
- package/dist/mtgate_api/types.gen.d.ts.map +0 -1
- package/dist/mtgate_api/types.gen.js +0 -3
- package/dist/mtgate_api/types.gen.js.map +0 -1
- package/dist/mtgate_api/zod.gen.d.ts +0 -321
- package/dist/mtgate_api/zod.gen.d.ts.map +0 -1
- package/dist/mtgate_api/zod.gen.js +0 -148
- package/dist/mtgate_api/zod.gen.js.map +0 -1
- package/dist/mtmai_api/@tanstack/react-query.gen.d.ts +0 -949
- package/dist/mtmai_api/@tanstack/react-query.gen.d.ts.map +0 -1
- package/dist/mtmai_api/@tanstack/react-query.gen.js +0 -917
- package/dist/mtmai_api/@tanstack/react-query.gen.js.map +0 -1
- package/dist/mtmai_api/client/client.gen.d.ts +0 -3
- package/dist/mtmai_api/client/client.gen.d.ts.map +0 -1
- package/dist/mtmai_api/client/client.gen.js +0 -236
- package/dist/mtmai_api/client/client.gen.js.map +0 -1
- package/dist/mtmai_api/client/index.d.ts +0 -9
- package/dist/mtmai_api/client/index.d.ts.map +0 -1
- package/dist/mtmai_api/client/index.js +0 -7
- package/dist/mtmai_api/client/index.js.map +0 -1
- package/dist/mtmai_api/client/types.gen.d.ts +0 -118
- package/dist/mtmai_api/client/types.gen.d.ts.map +0 -1
- package/dist/mtmai_api/client/types.gen.js +0 -3
- package/dist/mtmai_api/client/types.gen.js.map +0 -1
- package/dist/mtmai_api/client/utils.gen.d.ts +0 -34
- package/dist/mtmai_api/client/utils.gen.d.ts.map +0 -1
- package/dist/mtmai_api/client/utils.gen.js +0 -232
- package/dist/mtmai_api/client/utils.gen.js.map +0 -1
- package/dist/mtmai_api/client.gen.d.ts +0 -13
- package/dist/mtmai_api/client.gen.d.ts.map +0 -1
- package/dist/mtmai_api/client.gen.js +0 -4
- package/dist/mtmai_api/client.gen.js.map +0 -1
- package/dist/mtmai_api/core/auth.gen.d.ts +0 -19
- package/dist/mtmai_api/core/auth.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/auth.gen.js +0 -15
- package/dist/mtmai_api/core/auth.gen.js.map +0 -1
- package/dist/mtmai_api/core/bodySerializer.gen.d.ts +0 -26
- package/dist/mtmai_api/core/bodySerializer.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/bodySerializer.gen.js +0 -58
- package/dist/mtmai_api/core/bodySerializer.gen.js.map +0 -1
- package/dist/mtmai_api/core/params.gen.d.ts +0 -44
- package/dist/mtmai_api/core/params.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/params.gen.js +0 -101
- package/dist/mtmai_api/core/params.gen.js.map +0 -1
- package/dist/mtmai_api/core/pathSerializer.gen.d.ts +0 -34
- package/dist/mtmai_api/core/pathSerializer.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/pathSerializer.gen.js +0 -115
- package/dist/mtmai_api/core/pathSerializer.gen.js.map +0 -1
- package/dist/mtmai_api/core/queryKeySerializer.gen.d.ts +0 -19
- package/dist/mtmai_api/core/queryKeySerializer.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/queryKeySerializer.gen.js +0 -100
- package/dist/mtmai_api/core/queryKeySerializer.gen.js.map +0 -1
- package/dist/mtmai_api/core/serverSentEvents.gen.d.ts +0 -72
- package/dist/mtmai_api/core/serverSentEvents.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/serverSentEvents.gen.js +0 -138
- package/dist/mtmai_api/core/serverSentEvents.gen.js.map +0 -1
- package/dist/mtmai_api/core/types.gen.d.ts +0 -79
- package/dist/mtmai_api/core/types.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/types.gen.js +0 -3
- package/dist/mtmai_api/core/types.gen.js.map +0 -1
- package/dist/mtmai_api/core/utils.gen.d.ts +0 -20
- package/dist/mtmai_api/core/utils.gen.d.ts.map +0 -1
- package/dist/mtmai_api/core/utils.gen.js +0 -88
- package/dist/mtmai_api/core/utils.gen.js.map +0 -1
- package/dist/mtmai_api/index.d.ts +0 -3
- package/dist/mtmai_api/index.d.ts.map +0 -1
- package/dist/mtmai_api/index.js +0 -4
- package/dist/mtmai_api/index.js.map +0 -1
- package/dist/mtmai_api/schemas.gen.d.ts +0 -7721
- package/dist/mtmai_api/schemas.gen.d.ts.map +0 -1
- package/dist/mtmai_api/schemas.gen.js +0 -9774
- package/dist/mtmai_api/schemas.gen.js.map +0 -1
- package/dist/mtmai_api/sdk.gen.d.ts +0 -282
- package/dist/mtmai_api/sdk.gen.d.ts.map +0 -1
- package/dist/mtmai_api/sdk.gen.js +0 -404
- package/dist/mtmai_api/sdk.gen.js.map +0 -1
- package/dist/mtmai_api/types.gen.d.ts +0 -7152
- package/dist/mtmai_api/types.gen.d.ts.map +0 -1
- package/dist/mtmai_api/types.gen.js +0 -253
- package/dist/mtmai_api/types.gen.js.map +0 -1
- package/dist/mtmai_api/zod.gen.d.ts +0 -55827
- package/dist/mtmai_api/zod.gen.d.ts.map +0 -1
- package/dist/mtmai_api/zod.gen.js +0 -4805
- package/dist/mtmai_api/zod.gen.js.map +0 -1
- package/dist/openclaw/client-info.d.ts +0 -38
- package/dist/openclaw/client-info.d.ts.map +0 -1
- package/dist/openclaw/client-info.js +0 -38
- package/dist/openclaw/client-info.js.map +0 -1
- package/dist/openclaw/device-auth-utils.d.ts +0 -12
- package/dist/openclaw/device-auth-utils.d.ts.map +0 -1
- package/dist/openclaw/device-auth-utils.js +0 -16
- package/dist/openclaw/device-auth-utils.js.map +0 -1
- package/dist/openclaw/device-auth.d.ts +0 -21
- package/dist/openclaw/device-auth.d.ts.map +0 -1
- package/dist/openclaw/device-auth.js +0 -87
- package/dist/openclaw/device-auth.js.map +0 -1
- package/dist/openclaw/device-identity.d.ts +0 -8
- package/dist/openclaw/device-identity.d.ts.map +0 -1
- package/dist/openclaw/device-identity.js +0 -87
- package/dist/openclaw/device-identity.js.map +0 -1
- package/dist/openclaw/gateway.d.ts +0 -100
- package/dist/openclaw/gateway.d.ts.map +0 -1
- package/dist/openclaw/gateway.js +0 -302
- package/dist/openclaw/gateway.js.map +0 -1
- package/dist/openclaw/types.d.ts +0 -473
- package/dist/openclaw/types.d.ts.map +0 -1
- package/dist/openclaw/types.js +0 -2
- package/dist/openclaw/types.js.map +0 -1
- package/dist/supabase/use-sb-query/prefetch.d.ts +0 -10
- package/dist/supabase/use-sb-query/prefetch.d.ts.map +0 -1
- package/dist/supabase/use-sb-query/prefetch.js +0 -14
- package/dist/supabase/use-sb-query/prefetch.js.map +0 -1
- package/src/adk/api/client.ts +0 -46
- package/src/adk/core/constants/tool-icons.ts +0 -51
- package/src/adk/core/models/AgentBuilder.ts +0 -80
- package/src/adk/core/models/AgentRunRequest.ts +0 -33
- package/src/adk/core/models/Eval.ts +0 -70
- package/src/adk/core/models/LiveRequest.ts +0 -23
- package/src/adk/core/models/RuntimeConfig.ts +0 -33
- package/src/adk/core/models/Session.ts +0 -52
- package/src/adk/core/models/Trace.ts +0 -42
- package/src/adk/core/models/types.ts +0 -255
- package/src/cloud-account/platform-configs.ts +0 -73
- package/src/gomtmapi/@tanstack/react-query.gen.ts +0 -575
- package/src/gomtmapi/client/client.gen.ts +0 -311
- package/src/gomtmapi/client/index.ts +0 -25
- package/src/gomtmapi/client/types.gen.ts +0 -241
- package/src/gomtmapi/client/utils.gen.ts +0 -332
- package/src/gomtmapi/client.gen.ts +0 -16
- package/src/gomtmapi/core/auth.gen.ts +0 -42
- package/src/gomtmapi/core/bodySerializer.gen.ts +0 -100
- package/src/gomtmapi/core/params.gen.ts +0 -176
- package/src/gomtmapi/core/pathSerializer.gen.ts +0 -181
- package/src/gomtmapi/core/queryKeySerializer.gen.ts +0 -136
- package/src/gomtmapi/core/serverSentEvents.gen.ts +0 -266
- package/src/gomtmapi/core/types.gen.ts +0 -118
- package/src/gomtmapi/core/utils.gen.ts +0 -143
- package/src/gomtmapi/index.ts +0 -4
- package/src/gomtmapi/schemas.gen.ts +0 -596
- package/src/gomtmapi/sdk.gen.ts +0 -399
- package/src/gomtmapi/types.gen.ts +0 -962
- package/src/gomtmapi/zod.gen.ts +0 -507
- package/src/index.ts +0 -5
- package/src/lib/aisdk/types.ts +0 -8
- package/src/lib/logger/index.ts +0 -8
- package/src/lib/schema.ts +0 -50
- package/src/lib/utils.ts +0 -54
- package/src/mtgate_api/@tanstack/react-query.gen.ts +0 -142
- package/src/mtgate_api/client/client.gen.ts +0 -311
- package/src/mtgate_api/client/index.ts +0 -25
- package/src/mtgate_api/client/types.gen.ts +0 -241
- package/src/mtgate_api/client/utils.gen.ts +0 -332
- package/src/mtgate_api/client.gen.ts +0 -16
- package/src/mtgate_api/core/auth.gen.ts +0 -42
- package/src/mtgate_api/core/bodySerializer.gen.ts +0 -100
- package/src/mtgate_api/core/params.gen.ts +0 -176
- package/src/mtgate_api/core/pathSerializer.gen.ts +0 -181
- package/src/mtgate_api/core/queryKeySerializer.gen.ts +0 -136
- package/src/mtgate_api/core/serverSentEvents.gen.ts +0 -266
- package/src/mtgate_api/core/types.gen.ts +0 -118
- package/src/mtgate_api/core/utils.gen.ts +0 -143
- package/src/mtgate_api/index.ts +0 -4
- package/src/mtgate_api/schemas.gen.ts +0 -290
- package/src/mtgate_api/sdk.gen.ts +0 -54
- package/src/mtgate_api/types.gen.ts +0 -239
- package/src/mtgate_api/zod.gen.ts +0 -176
- package/src/mtmai_api/@tanstack/react-query.gen.ts +0 -1010
- package/src/mtmai_api/client/client.gen.ts +0 -311
- package/src/mtmai_api/client/index.ts +0 -25
- package/src/mtmai_api/client/types.gen.ts +0 -241
- package/src/mtmai_api/client/utils.gen.ts +0 -332
- package/src/mtmai_api/client.gen.ts +0 -16
- package/src/mtmai_api/core/auth.gen.ts +0 -42
- package/src/mtmai_api/core/bodySerializer.gen.ts +0 -100
- package/src/mtmai_api/core/params.gen.ts +0 -176
- package/src/mtmai_api/core/pathSerializer.gen.ts +0 -181
- package/src/mtmai_api/core/queryKeySerializer.gen.ts +0 -136
- package/src/mtmai_api/core/serverSentEvents.gen.ts +0 -266
- package/src/mtmai_api/core/types.gen.ts +0 -118
- package/src/mtmai_api/core/utils.gen.ts +0 -143
- package/src/mtmai_api/index.ts +0 -4
- package/src/mtmai_api/schemas.gen.ts +0 -9980
- package/src/mtmai_api/sdk.gen.ts +0 -471
- package/src/mtmai_api/types.gen.ts +0 -7609
- package/src/mtmai_api/zod.gen.ts +0 -5101
- package/src/openclaw/client-info.ts +0 -54
- package/src/openclaw/device-auth-utils.ts +0 -26
- package/src/openclaw/device-auth.ts +0 -99
- package/src/openclaw/device-identity.ts +0 -108
- package/src/openclaw/gateway.ts +0 -392
- package/src/openclaw/types.ts +0 -518
- package/src/sbmng/@tanstack/react-query.gen.ts +0 -3017
- package/src/sbmng/client/client.gen.ts +0 -311
- package/src/sbmng/client/index.ts +0 -25
- package/src/sbmng/client/types.gen.ts +0 -241
- package/src/sbmng/client/utils.gen.ts +0 -332
- package/src/sbmng/client.gen.ts +0 -16
- package/src/sbmng/core/auth.gen.ts +0 -42
- package/src/sbmng/core/bodySerializer.gen.ts +0 -100
- package/src/sbmng/core/params.gen.ts +0 -176
- package/src/sbmng/core/pathSerializer.gen.ts +0 -181
- package/src/sbmng/core/queryKeySerializer.gen.ts +0 -136
- package/src/sbmng/core/serverSentEvents.gen.ts +0 -266
- package/src/sbmng/core/types.gen.ts +0 -118
- package/src/sbmng/core/utils.gen.ts +0 -143
- package/src/sbmng/index.ts +0 -4
- package/src/sbmng/schemas.gen.ts +0 -9805
- package/src/sbmng/sdk.gen.ts +0 -1780
- package/src/sbmng/types.gen.ts +0 -8016
- package/src/supabase/auth-provider.tsx +0 -67
- package/src/supabase/context.tsx +0 -51
- package/src/supabase/cursor-pagination.ts +0 -155
- package/src/supabase/schema/browser.ts +0 -45
- package/src/supabase/schema/index.ts +0 -25
- package/src/supabase/supabase-client.ts +0 -30
- package/src/supabase/supabase.ts +0 -67
- package/src/supabase/use-sb-query/build-query-opts.ts +0 -56
- package/src/supabase/use-sb-query/key.ts +0 -57
- package/src/supabase/use-sb-query/prefetch.ts +0 -59
- package/src/supabase/use-sb-query/use-query.ts +0 -340
- package/src/supabase/use-sb-query/use-rpc-mutation.ts +0 -83
- package/src/supabase/use-sb-query/use-rpc-query.ts +0 -231
- package/src/supabase/utils.ts +0 -75
- package/src/types/database.schemas.ts +0 -4378
- package/src/types/database.types.ts +0 -4288
- package/src/types/index.ts +0 -102
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 将 supabase api封装位 react query的 形式.
|
|
3
|
-
* 原官方库: https://github.com/psteinroe/supabase-cache-helpers
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
AnyPostgrestResponse,
|
|
8
|
-
BuildNormalizedQueryOps,
|
|
9
|
-
PostgrestQueryParserOptions,
|
|
10
|
-
} from "@supabase-cache-helpers/postgrest-core";
|
|
11
|
-
import { PostgrestFilter, encodeObject, type DecodedKey } from "@supabase-cache-helpers/postgrest-core";
|
|
12
|
-
import type {
|
|
13
|
-
PostgrestError,
|
|
14
|
-
PostgrestMaybeSingleResponse,
|
|
15
|
-
PostgrestResponse,
|
|
16
|
-
PostgrestResponseSuccess,
|
|
17
|
-
PostgrestSingleResponse,
|
|
18
|
-
} from "@supabase/postgrest-js";
|
|
19
|
-
import {
|
|
20
|
-
useQueryClient,
|
|
21
|
-
useQuery as useReactQuery,
|
|
22
|
-
useSuspenseQuery as useReactSuspenseQuery,
|
|
23
|
-
type UseQueryOptions as UseReactQueryOptions,
|
|
24
|
-
type UseQueryResult as UseReactQueryResult,
|
|
25
|
-
type UseSuspenseQueryResult as UseReactSuspenseQueryResult,
|
|
26
|
-
type UseSuspenseQueryOptions as UserReactSuspenseQueryOptions,
|
|
27
|
-
} from "@tanstack/react-query";
|
|
28
|
-
import { buildQueryOpts, buildSuspenseQueryOpts } from "./build-query-opts";
|
|
29
|
-
import { decode, encode } from "./key";
|
|
30
|
-
|
|
31
|
-
export const KEY_PREFIX = "postgrest";
|
|
32
|
-
export const INFINITE_KEY_PREFIX = "page";
|
|
33
|
-
|
|
34
|
-
export type DecodedReactQueryKey = DecodedKey & {
|
|
35
|
-
isInfinite: boolean;
|
|
36
|
-
key: string[];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const POSTGREST_FILTER_KEY_PREFIX = "postgrest-filter";
|
|
40
|
-
|
|
41
|
-
export const usePostgrestFilterCache = <R extends Record<string, unknown>>() => {
|
|
42
|
-
const queryClient = useQueryClient();
|
|
43
|
-
|
|
44
|
-
return (query: string, opts?: PostgrestQueryParserOptions) => {
|
|
45
|
-
const key = [POSTGREST_FILTER_KEY_PREFIX, query, opts ? encodeObject(opts) : null];
|
|
46
|
-
const cacheData = queryClient.getQueryData(key);
|
|
47
|
-
if (cacheData instanceof PostgrestFilter) {
|
|
48
|
-
return cacheData;
|
|
49
|
-
}
|
|
50
|
-
const filter = PostgrestFilter.fromQuery(query, opts);
|
|
51
|
-
queryClient.setQueryData(key, filter);
|
|
52
|
-
return filter as PostgrestFilter<R>;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const useQueriesForTableLoader = (table: string) => {
|
|
57
|
-
const queryClient = useQueryClient();
|
|
58
|
-
const getPostgrestFilter = usePostgrestFilterCache();
|
|
59
|
-
|
|
60
|
-
return () =>
|
|
61
|
-
queryClient
|
|
62
|
-
.getQueryCache()
|
|
63
|
-
.getAll()
|
|
64
|
-
.map((c) => c.queryKey)
|
|
65
|
-
.reduce<ReturnType<BuildNormalizedQueryOps["queriesForTable"]>>((prev, curr) => {
|
|
66
|
-
const decodedKey = decode(curr);
|
|
67
|
-
if (decodedKey?.table === table) {
|
|
68
|
-
prev.push(getPostgrestFilter(decodedKey.queryKey).params);
|
|
69
|
-
}
|
|
70
|
-
return prev;
|
|
71
|
-
}, []);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Applies Omit over a union, while preserving its union-ness.
|
|
76
|
-
*/
|
|
77
|
-
// biome-ignore lint/suspicious/noExplicitAny: keyof any 是 TypeScript 泛型约束的标准用法
|
|
78
|
-
type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Represents the return value of the `useQuery` hook when `query` is expected to return
|
|
82
|
-
* a single row.
|
|
83
|
-
*/
|
|
84
|
-
export type UseQuerySingleReturn<Result> = DistributiveOmit<
|
|
85
|
-
UseReactQueryResult<PostgrestSingleResponse<Result>["data"], PostgrestError>,
|
|
86
|
-
"refetch"
|
|
87
|
-
> &
|
|
88
|
-
Pick<UseReactQueryResult<PostgrestSingleResponse<Result>, PostgrestError>, "refetch"> &
|
|
89
|
-
Pick<PostgrestSingleResponse<Result>, "count">;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Represents the return value of the `useQuery` hook when `query` is expected to return
|
|
93
|
-
* either a single row or an empty response.
|
|
94
|
-
*/
|
|
95
|
-
export type UseQueryMaybeSingleReturn<Result> = DistributiveOmit<
|
|
96
|
-
UseReactQueryResult<PostgrestMaybeSingleResponse<Result>["data"], PostgrestError>,
|
|
97
|
-
"refetch"
|
|
98
|
-
> &
|
|
99
|
-
Pick<UseReactQueryResult<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "refetch"> &
|
|
100
|
-
Pick<PostgrestMaybeSingleResponse<Result>, "count">;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Represents the return value of the `useQuery` hook when `query` is expected to return
|
|
104
|
-
* one or more rows.
|
|
105
|
-
*/
|
|
106
|
-
export type UseQueryReturn<Result> = DistributiveOmit<
|
|
107
|
-
UseReactQueryResult<PostgrestResponse<Result>["data"], PostgrestError>,
|
|
108
|
-
"refetch"
|
|
109
|
-
> &
|
|
110
|
-
Pick<UseReactQueryResult<PostgrestResponse<Result>, PostgrestError>, "refetch"> &
|
|
111
|
-
Pick<PostgrestResponse<Result>, "count">;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Represents the return value of the `useQuery` hook when the type of the query response
|
|
115
|
-
* is not known.
|
|
116
|
-
*/
|
|
117
|
-
export type UseQueryAnyReturn<Result> = DistributiveOmit<
|
|
118
|
-
UseReactQueryResult<AnyPostgrestResponse<Result>["data"], PostgrestError>,
|
|
119
|
-
"refetch"
|
|
120
|
-
> &
|
|
121
|
-
Pick<UseReactQueryResult<AnyPostgrestResponse<Result>, PostgrestError>, "refetch"> &
|
|
122
|
-
Pick<AnyPostgrestResponse<Result>, "count">;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* React hook to execute a PostgREST query and return a single item response.
|
|
126
|
-
*
|
|
127
|
-
* @param {PromiseLike<PostgrestSingleResponse<Result>>} query A promise that resolves to a PostgREST single item response.
|
|
128
|
-
* @param {Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
129
|
-
* @returns {UseQuerySingleReturn<Result>} The hook result containing the single item response data.
|
|
130
|
-
*/
|
|
131
|
-
function useQuery<Result>(
|
|
132
|
-
query: PromiseLike<PostgrestSingleResponse<Result>>,
|
|
133
|
-
config?: Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
134
|
-
): UseQuerySingleReturn<Result>;
|
|
135
|
-
/**
|
|
136
|
-
* React hook to execute a PostgREST query and return a maybe single item response.
|
|
137
|
-
*
|
|
138
|
-
* @param {PromiseLike<PostgrestMaybeSingleResponse<Result>>} query A promise that resolves to a PostgREST maybe single item response.
|
|
139
|
-
* @param {Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
140
|
-
* @returns {UseQueryMaybeSingleReturn<Result>} The hook result containing the maybe single item response data.
|
|
141
|
-
*/
|
|
142
|
-
function useQuery<Result>(
|
|
143
|
-
query: PromiseLike<PostgrestMaybeSingleResponse<Result>>,
|
|
144
|
-
config?: Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
145
|
-
): UseQueryMaybeSingleReturn<Result>;
|
|
146
|
-
/**
|
|
147
|
-
* React hook to execute a PostgREST query.
|
|
148
|
-
*
|
|
149
|
-
* @template Result The expected response data type.
|
|
150
|
-
* @param {PromiseLike<PostgrestResponse<Result>>} query A promise that resolves to a PostgREST response.
|
|
151
|
-
* @param {Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
152
|
-
* @returns {UseQueryReturn<Result>} The hook result containing the response data.
|
|
153
|
-
*/
|
|
154
|
-
function useQuery<Result>(
|
|
155
|
-
query: PromiseLike<PostgrestResponse<Result>>,
|
|
156
|
-
config?: Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
157
|
-
): UseQueryReturn<Result>;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* React hook to execute a PostgREST query.
|
|
161
|
-
*
|
|
162
|
-
* @template Result The expected response data type.
|
|
163
|
-
* @param {PromiseLike<AnyPostgrestResponse<Result>>} query A promise that resolves to a PostgREST response of any kind.
|
|
164
|
-
* @param {Omit<UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
165
|
-
* @returns {UseQueryAnyReturn<Result>} The hook result containing the response data.
|
|
166
|
-
*/
|
|
167
|
-
function useQuery<Result>(
|
|
168
|
-
query: PromiseLike<AnyPostgrestResponse<Result>>,
|
|
169
|
-
config?: Omit<UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
170
|
-
): UseQueryAnyReturn<Result> {
|
|
171
|
-
const result = useReactQuery<AnyPostgrestResponse<Result>, PostgrestError>(buildQueryOpts<Result>(query, config));
|
|
172
|
-
|
|
173
|
-
// isPending and isLoadingError are the only cases in which no data is present
|
|
174
|
-
if (result.isPending || result.isLoadingError) {
|
|
175
|
-
return {
|
|
176
|
-
...result,
|
|
177
|
-
data: undefined,
|
|
178
|
-
count: null,
|
|
179
|
-
} as UseQueryAnyReturn<Result>;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return {
|
|
183
|
-
...result,
|
|
184
|
-
data: result.data?.data,
|
|
185
|
-
count: result.data?.count,
|
|
186
|
-
} as UseQueryAnyReturn<Result>;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export { useQuery };
|
|
190
|
-
|
|
191
|
-
// 增加 queryQuery 获取函数
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* 获取 PostgREST 查询的完整 QueryKey
|
|
195
|
-
* @param query Supabase PostgrestBuilder 实例 (例如: sb.from('...').select() 或 sb.rpc(...))
|
|
196
|
-
* @param isInfinite 是否为无限查询 (默认 false)
|
|
197
|
-
*/
|
|
198
|
-
export function getSbQueryKey<Result>(query: PromiseLike<AnyPostgrestResponse<Result>>, isInfinite = false): string[] {
|
|
199
|
-
return encode(query, isInfinite);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* 获取 PostgREST 查询的 "Base Key" (仅包含前缀、Schema、Table/RPC名称)
|
|
204
|
-
* 用于 invalidateQueries 时模糊匹配整个表或RPC的所有查询,忽略具体的 filter/page 参数。
|
|
205
|
-
*
|
|
206
|
-
* 结构: ['postgrest', 'null'|'page', schema, table|rpc, ...]
|
|
207
|
-
* 返回: 前4个元素
|
|
208
|
-
*/
|
|
209
|
-
export function getSbTableKey<Result>(query: PromiseLike<AnyPostgrestResponse<Result>>): string[] {
|
|
210
|
-
const fullKey = encode(query, false);
|
|
211
|
-
// 截取前4个元素作为基础Key: [prefix, infinitePrefix, schema, table]
|
|
212
|
-
// 这样 invalidateQueries(baseKey) 将会匹配该表/RPC下的所有查询变体
|
|
213
|
-
return fullKey.slice(0, 4);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// 增加 suspense query 的支持 ========================================================================================
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Represents the return value of the `useSuspenseQuery` hook when `query` is expected to return
|
|
220
|
-
* a single row.
|
|
221
|
-
*/
|
|
222
|
-
export type useSuspenseQuerySingleReturn<Result> = DistributiveOmit<
|
|
223
|
-
UseReactSuspenseQueryResult<PostgrestMaybeSingleResponseV4<Result>["data"], PostgrestError>,
|
|
224
|
-
"refetch"
|
|
225
|
-
> &
|
|
226
|
-
Pick<
|
|
227
|
-
UseReactSuspenseQueryResult<
|
|
228
|
-
// PostgrestSingleResponse<Result>,
|
|
229
|
-
Result,
|
|
230
|
-
PostgrestError
|
|
231
|
-
>,
|
|
232
|
-
"refetch"
|
|
233
|
-
> &
|
|
234
|
-
Pick<PostgrestSingleResponse<Result>, "count">;
|
|
235
|
-
|
|
236
|
-
export type PostgrestMaybeSingleResponseV4<T> = PostgrestResponseSuccess<T>;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Represents the return value of the `useSuspenseQuery` hook when `query` is expected to return
|
|
240
|
-
* either a single row or an empty response.
|
|
241
|
-
*/
|
|
242
|
-
export type useSuspenseQueryMaybeSingleReturn<Result> = DistributiveOmit<
|
|
243
|
-
UseReactSuspenseQueryResult<PostgrestMaybeSingleResponseV4<NonNullable<Result>>["data"], PostgrestError>,
|
|
244
|
-
"refetch"
|
|
245
|
-
> &
|
|
246
|
-
Pick<UseReactSuspenseQueryResult<PostgrestMaybeSingleResponseV4<NonNullable<Result>>, PostgrestError>, "refetch"> &
|
|
247
|
-
Pick<PostgrestMaybeSingleResponseV4<Result>, "count">;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Represents the return value of the `useSuspenseQuery` hook when `query` is expected to return
|
|
251
|
-
* one or more rows.
|
|
252
|
-
*/
|
|
253
|
-
export type useSuspenseQueryReturn<Result> = DistributiveOmit<
|
|
254
|
-
UseReactSuspenseQueryResult<PostgrestResponse<Result>["data"], PostgrestError>,
|
|
255
|
-
"refetch"
|
|
256
|
-
> &
|
|
257
|
-
Pick<UseReactSuspenseQueryResult<PostgrestResponse<Result>, PostgrestError>, "refetch"> &
|
|
258
|
-
Pick<PostgrestResponse<Result>, "count">;
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Represents the return value of the `useSuspenseQuery` hook when the type of the query response
|
|
262
|
-
* is not known.
|
|
263
|
-
*/
|
|
264
|
-
export type useSuspenseQueryAnyReturn<Result> = DistributiveOmit<
|
|
265
|
-
UseReactSuspenseQueryResult<PostgrestResponse<Result>["data"], PostgrestError>,
|
|
266
|
-
"refetch"
|
|
267
|
-
> &
|
|
268
|
-
Pick<UseReactSuspenseQueryResult<PostgrestResponse<Result>, PostgrestError>, "refetch"> &
|
|
269
|
-
Pick<PostgrestResponse<Result>, "count">;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* React hook to execute a PostgREST query and return a single item response.
|
|
273
|
-
*
|
|
274
|
-
* @param {PromiseLike<PostgrestSingleResponse<Result>>} query A promise that resolves to a PostgREST single item response.
|
|
275
|
-
* @param {Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
276
|
-
* @returns {useSuspenseQuerySingleReturn<Result>} The hook result containing the single item response data.
|
|
277
|
-
*/
|
|
278
|
-
function useSbSuspenseQuery<Result>(
|
|
279
|
-
query: PromiseLike<PostgrestSingleResponse<Result>>,
|
|
280
|
-
config?: Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
281
|
-
): useSuspenseQuerySingleReturn<NonNullable<Result>>;
|
|
282
|
-
/**
|
|
283
|
-
* React hook to execute a PostgREST query and return a maybe single item response.
|
|
284
|
-
*
|
|
285
|
-
* @param {PromiseLike<PostgrestMaybeSingleResponse<Result>>} query A promise that resolves to a PostgREST maybe single item response.
|
|
286
|
-
* @param {Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
287
|
-
* @returns {useSuspenseQueryMaybeSingleReturn<Result>} The hook result containing the maybe single item response data.
|
|
288
|
-
*/
|
|
289
|
-
function useSbSuspenseQuery<Result>(
|
|
290
|
-
query: PromiseLike<PostgrestMaybeSingleResponse<Result>>,
|
|
291
|
-
config?: Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
292
|
-
): useSuspenseQueryMaybeSingleReturn<NonNullable<Result>>;
|
|
293
|
-
/**
|
|
294
|
-
* React hook to execute a PostgREST query.
|
|
295
|
-
*
|
|
296
|
-
* @template Result The expected response data type.
|
|
297
|
-
* @param {PromiseLike<PostgrestResponse<Result>>} query A promise that resolves to a PostgREST response.
|
|
298
|
-
* @param {Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
299
|
-
* @returns {useSuspenseQueryReturn<Result>} The hook result containing the response data.
|
|
300
|
-
*/
|
|
301
|
-
function useSbSuspenseQuery<Result>(
|
|
302
|
-
query: PromiseLike<PostgrestResponse<Result>>,
|
|
303
|
-
config?: Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
304
|
-
): useSuspenseQueryReturn<NonNullable<Result>>;
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* React hook to execute a PostgREST query.
|
|
308
|
-
*
|
|
309
|
-
* @template Result The expected response data type.
|
|
310
|
-
* @param {PromiseLike<AnyPostgrestResponse<Result>>} query A promise that resolves to a PostgREST response of any kind.
|
|
311
|
-
* @param {Omit<UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
|
|
312
|
-
* @returns {useSuspenseQueryAnyReturn<Result>} The hook result containing the response data.
|
|
313
|
-
*/
|
|
314
|
-
function useSbSuspenseQuery<Result>(
|
|
315
|
-
query: PromiseLike<PostgrestResponse<Result>>,
|
|
316
|
-
config?: Omit<UserReactSuspenseQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
317
|
-
): useSuspenseQueryReturn<NonNullable<Result>> {
|
|
318
|
-
const result = useReactSuspenseQuery<AnyPostgrestResponse<Result>, PostgrestError>(
|
|
319
|
-
buildSuspenseQueryOpts<Result>(query, config),
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
// isPending and isLoadingError are the only cases in which no data is present
|
|
323
|
-
// if (result.isPending || result.isLoadingError) {
|
|
324
|
-
// return {
|
|
325
|
-
// ...result,
|
|
326
|
-
// data: undefined,
|
|
327
|
-
// count: null,
|
|
328
|
-
// } //as useSuspenseQueryAnyReturn<Result>;
|
|
329
|
-
// }
|
|
330
|
-
|
|
331
|
-
return {
|
|
332
|
-
...result,
|
|
333
|
-
data: result.data.data, // NonNullable<Result|Result[]>,
|
|
334
|
-
count: result.data.count,
|
|
335
|
-
} as useSuspenseQueryAnyReturn<NonNullable<Result>>;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export const useSbQuery = useQuery;
|
|
339
|
-
|
|
340
|
-
export { useSbSuspenseQuery };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supabase RPC Mutation Hook
|
|
3
|
-
* 简化 RPC 写操作(upsert, delete 等)的调用
|
|
4
|
-
*
|
|
5
|
-
* 使用示例:
|
|
6
|
-
* ```tsx
|
|
7
|
-
* const updateProject = useRpcMutation("audit_project_upsert");
|
|
8
|
-
*
|
|
9
|
-
* // 调用
|
|
10
|
-
* await updateProject.mutateAsync({
|
|
11
|
-
* p_id: projectId,
|
|
12
|
-
* p_name: "New Name"
|
|
13
|
-
* });
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import type { PostgrestError } from "@supabase/supabase-js";
|
|
18
|
-
import { useMutation, type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
|
|
19
|
-
import { useSupabaseBrowser } from "../context";
|
|
20
|
-
import type { RPCFunctionArgs, RPCFunctionName, RPCFunctionReturns } from "./use-rpc-query";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* RPC Mutation 的返回类型
|
|
24
|
-
*/
|
|
25
|
-
export interface RpcMutationResult<TData> {
|
|
26
|
-
data: TData | null;
|
|
27
|
-
error: PostgrestError | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 基于 RPC 函数名进行 Mutation 操作的 Hook
|
|
32
|
-
*
|
|
33
|
-
* @template TFunc RPC 函数名类型
|
|
34
|
-
* @template TData 返回数据类型
|
|
35
|
-
* @param functionName RPC 函数名
|
|
36
|
-
* @param options React Query Mutation 配置选项
|
|
37
|
-
* @returns Mutation 结果
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* // 示例1: 基础使用
|
|
42
|
-
* const updateProject = useRpcMutation("audit_project_upsert");
|
|
43
|
-
*
|
|
44
|
-
* // 在表单提交中使用
|
|
45
|
-
* const handleSubmit = async (values) => {
|
|
46
|
-
* const { data, error } = await updateProject.mutateAsync({
|
|
47
|
-
* p_id: project.id,
|
|
48
|
-
* p_name: values.name,
|
|
49
|
-
* p_target: values.target
|
|
50
|
-
* });
|
|
51
|
-
*
|
|
52
|
-
* if (error) {
|
|
53
|
-
* toast.error(error.message);
|
|
54
|
-
* } else {
|
|
55
|
-
* toast.success("Updated successfully");
|
|
56
|
-
* }
|
|
57
|
-
* };
|
|
58
|
-
*
|
|
59
|
-
* // 示例2: 带类型推断
|
|
60
|
-
* type ProjectResult = { id: string; name: string };
|
|
61
|
-
* const updateProject = useRpcMutation<"audit_project_upsert", ProjectResult>("audit_project_upsert");
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export function useRpcMutation<
|
|
65
|
-
TFunc extends RPCFunctionName,
|
|
66
|
-
TData = RPCFunctionReturns<TFunc>,
|
|
67
|
-
TError = PostgrestError,
|
|
68
|
-
TContext = unknown,
|
|
69
|
-
>(
|
|
70
|
-
functionName: TFunc,
|
|
71
|
-
options?: Omit<UseMutationOptions<RpcMutationResult<TData>, TError, RPCFunctionArgs<TFunc>, TContext>, "mutationFn">,
|
|
72
|
-
): UseMutationResult<RpcMutationResult<TData>, TError, RPCFunctionArgs<TFunc>, TContext> {
|
|
73
|
-
const sb = useSupabaseBrowser();
|
|
74
|
-
|
|
75
|
-
return useMutation<RpcMutationResult<TData>, TError, RPCFunctionArgs<TFunc>, TContext>({
|
|
76
|
-
mutationFn: async (args) => {
|
|
77
|
-
// biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 内部类型系统
|
|
78
|
-
const result = await sb.rpc(functionName, args as any);
|
|
79
|
-
return result as RpcMutationResult<TData>;
|
|
80
|
-
},
|
|
81
|
-
...options,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 简化版的 Supabase RPC 查询 Hook
|
|
3
|
-
* 自动处理 Supabase Client 的获取,无需手动调用 useSupabaseBrowser()
|
|
4
|
-
*
|
|
5
|
-
* 使用示例:
|
|
6
|
-
* ```tsx
|
|
7
|
-
* // 方式1: 自动推断类型
|
|
8
|
-
* const query1 = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" });
|
|
9
|
-
*
|
|
10
|
-
* // 方式2: 使用 Zod Schema 进行类型验证和推断 (推荐)
|
|
11
|
-
* const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
|
|
12
|
-
* const query2 = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
|
|
13
|
-
* schema: z.object({ rows: z.array(navItemSchema) })
|
|
14
|
-
* });
|
|
15
|
-
* // data 的类型为 { rows: { label: string; url?: string }[] } | undefined
|
|
16
|
-
*
|
|
17
|
-
* // 方式3: 显式泛型指定返回类型
|
|
18
|
-
* type NavItem = { label: string; url?: string };
|
|
19
|
-
* const query3 = useRpcQuery<NavItem[]>("dash_navitems_list", { p_location: "sidebar_admin" });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { useMemo } from "react";
|
|
24
|
-
import type { z } from "zod";
|
|
25
|
-
import type { SBFunctions } from "../../types";
|
|
26
|
-
import { useSupabaseBrowser } from "../context";
|
|
27
|
-
import {
|
|
28
|
-
KEY_PREFIX,
|
|
29
|
-
type UseQueryAnyReturn,
|
|
30
|
-
type UseQuerySingleReturn,
|
|
31
|
-
useSbQuery,
|
|
32
|
-
useSbSuspenseQuery,
|
|
33
|
-
} from "./use-query";
|
|
34
|
-
|
|
35
|
-
/** 从 SBFunctions 中提取 RPC 函数名的类型 */
|
|
36
|
-
export type RPCFunctionName = keyof SBFunctions;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 获取 RPC 查询的通用 Query Key 前缀 (用于 invalidation)
|
|
40
|
-
* 对应 supabase-cache-helpers 生成的 key 结构: ['postgrest', 'null'|'page', schema, table|rpc, ...]
|
|
41
|
-
*
|
|
42
|
-
* @param functionName RPC 函数名
|
|
43
|
-
* @returns Standard Query Key Prefix e.g. ["postgrest", "null", "public", "function_name"]
|
|
44
|
-
*/
|
|
45
|
-
export function getRpcQueryKey(functionName: string): string[] {
|
|
46
|
-
// 默认 schema 为 public, infinite prefix 默认为 "null" (即使是 infinite query, invalidate prefix 通常也能匹配?)
|
|
47
|
-
// 注意: explicit invalidation 最好匹配 prefix.
|
|
48
|
-
// supabase-cache-helpers 的 getSbTableKey 返回的是 4 个元素
|
|
49
|
-
// 注: 对于 RPC,表名解析为 rpc/名称
|
|
50
|
-
return [KEY_PREFIX, "null", "public", `rpc/${functionName}`];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** 提取指定 RPC 函数的参数类型 */
|
|
54
|
-
export type RPCFunctionArgs<T extends RPCFunctionName> = SBFunctions[T]["Args"] extends never
|
|
55
|
-
? Record<string, never>
|
|
56
|
-
: SBFunctions[T]["Args"];
|
|
57
|
-
|
|
58
|
-
/** 提取指定 RPC 函数的返回类型 */
|
|
59
|
-
export type RPCFunctionReturns<T extends RPCFunctionName> = SBFunctions[T]["Returns"];
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* RPC 查询的额外选项
|
|
63
|
-
*/
|
|
64
|
-
export interface RpcQueryOptions {
|
|
65
|
-
/**
|
|
66
|
-
* 可选的 Zod Schema 用于验证和推断返回类型
|
|
67
|
-
* 当传入时,将自动验证数据并从 schema 推断类型
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```tsx
|
|
71
|
-
* const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
|
|
72
|
-
* const resultSchema = z.object({ rows: z.array(navItemSchema), meta: z.any() });
|
|
73
|
-
*
|
|
74
|
-
* const { data } = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
|
|
75
|
-
* schema: resultSchema
|
|
76
|
-
* });
|
|
77
|
-
* // data 类型自动推断为 { rows: { label: string; url?: string }[]; meta: any } | undefined
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
schema?: z.ZodType;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 基于 RPC 函数名和参数进行查询的 Hook (普通模式)
|
|
85
|
-
*
|
|
86
|
-
* @template TData 返回数据类型(显式指定或从数据库函数推断)
|
|
87
|
-
* @param functionName RPC 函数名
|
|
88
|
-
* @param args RPC 函数参数
|
|
89
|
-
* @param options 配置选项,包含 React Query 配置和可选的 schema
|
|
90
|
-
* @returns 查询结果
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```tsx
|
|
94
|
-
* // 示例1: 基础使用(自动推断)
|
|
95
|
-
* const { data } = useRpcQuery("sys_config_get", { p_key: "github_app" });
|
|
96
|
-
*
|
|
97
|
-
* // 示例2: 使用 Zod Schema(推荐)
|
|
98
|
-
* const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
|
|
99
|
-
* const { data } = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
|
|
100
|
-
* schema: z.object({ rows: z.array(navItemSchema), meta: z.any() })
|
|
101
|
-
* });
|
|
102
|
-
*
|
|
103
|
-
* // 示例3: 显式泛型
|
|
104
|
-
* type NavItem = { label: string; url?: string };
|
|
105
|
-
* const { data } = useRpcQuery<NavItem[]>("dash_navitems_list", { p_location: "sidebar_admin" });
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
// Overload 1: Schema provided -> Infer TData from Schema
|
|
109
|
-
export function useRpcQuery<TFunc extends RPCFunctionName, TSchema extends z.ZodType>(
|
|
110
|
-
functionName: TFunc,
|
|
111
|
-
args: RPCFunctionArgs<TFunc> | undefined,
|
|
112
|
-
options: { schema: TSchema } & Record<string, any>,
|
|
113
|
-
): UseQuerySingleReturn<z.infer<TSchema>>;
|
|
114
|
-
|
|
115
|
-
// Overload 2: No schema provided -> Infer TData from Generic (defaulting to RPC return)
|
|
116
|
-
export function useRpcQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
|
|
117
|
-
functionName: TFunc,
|
|
118
|
-
args?: RPCFunctionArgs<TFunc>,
|
|
119
|
-
options?: { schema?: undefined } & Record<string, any>,
|
|
120
|
-
): UseQueryAnyReturn<TData>;
|
|
121
|
-
|
|
122
|
-
// Overload 3: Legacy/Fallback
|
|
123
|
-
export function useRpcQuery<TData = any>(
|
|
124
|
-
functionName: string,
|
|
125
|
-
args?: any,
|
|
126
|
-
options?: { schema?: z.ZodType } & Record<string, any>,
|
|
127
|
-
): UseQueryAnyReturn<TData>;
|
|
128
|
-
|
|
129
|
-
export function useRpcQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
|
|
130
|
-
functionName: TFunc,
|
|
131
|
-
args?: RPCFunctionArgs<TFunc>,
|
|
132
|
-
options?: RpcQueryOptions & Record<string, any>,
|
|
133
|
-
): UseQueryAnyReturn<TData> {
|
|
134
|
-
const sb = useSupabaseBrowser();
|
|
135
|
-
const query = sb.rpc(functionName, args as never);
|
|
136
|
-
|
|
137
|
-
const { schema, ...reactQueryConfig } = options || {};
|
|
138
|
-
|
|
139
|
-
// biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 内部类型系统
|
|
140
|
-
const baseResult = useSbQuery(query as any, reactQueryConfig);
|
|
141
|
-
|
|
142
|
-
// 如果提供了 schema,对数据进行验证和转换
|
|
143
|
-
const transformedResult = useMemo(() => {
|
|
144
|
-
if (!schema || !baseResult.data) {
|
|
145
|
-
return baseResult;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
try {
|
|
149
|
-
const validatedData = schema.parse(baseResult.data);
|
|
150
|
-
return {
|
|
151
|
-
...baseResult,
|
|
152
|
-
data: validatedData as TData,
|
|
153
|
-
};
|
|
154
|
-
} catch (error) {
|
|
155
|
-
console.error(`[useRpcQuery] Schema validation failed for ${String(functionName)}:`, error);
|
|
156
|
-
// 验证失败时返回原始数据,避免阻断用户流程
|
|
157
|
-
return baseResult;
|
|
158
|
-
}
|
|
159
|
-
}, [schema, baseResult, functionName]);
|
|
160
|
-
|
|
161
|
-
return transformedResult as UseQueryAnyReturn<TData>;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* 基于 RPC 函数名和参数进行查询的 Hook (Suspense 模式)
|
|
166
|
-
*
|
|
167
|
-
* @template TData 返回数据类型(通过 schema 或泛型指定)
|
|
168
|
-
* @param functionName RPC 函数名
|
|
169
|
-
* @param args RPC 函数参数
|
|
170
|
-
* @param options 配置选项
|
|
171
|
-
* @returns Suspense 查询结果
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```tsx
|
|
175
|
-
* const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
|
|
176
|
-
* const { data } = useRpcSuspenseQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
|
|
177
|
-
* schema: z.object({ rows: z.array(navItemSchema) })
|
|
178
|
-
* });
|
|
179
|
-
* // data 类型: { rows: { label: string; url?: string }[] }
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
// Overload 1: Schema provided
|
|
183
|
-
export function useRpcSuspenseQuery<TFunc extends RPCFunctionName, TSchema extends z.ZodType>(
|
|
184
|
-
functionName: TFunc,
|
|
185
|
-
args: RPCFunctionArgs<TFunc> | undefined,
|
|
186
|
-
// biome-ignore lint/suspicious/noExplicitAny: 允许传入 schema
|
|
187
|
-
options: { schema: TSchema } & Omit<any, "queryKey" | "queryFn">,
|
|
188
|
-
): { data: z.infer<TSchema>; [key: string]: unknown };
|
|
189
|
-
|
|
190
|
-
// Overload 2: No schema
|
|
191
|
-
export function useRpcSuspenseQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
|
|
192
|
-
functionName: TFunc,
|
|
193
|
-
args?: RPCFunctionArgs<TFunc>,
|
|
194
|
-
// biome-ignore lint/suspicious/noExplicitAny: 普通模式
|
|
195
|
-
options?: { schema?: undefined } & Omit<any, "queryKey" | "queryFn">,
|
|
196
|
-
): { data: TData; [key: string]: unknown };
|
|
197
|
-
|
|
198
|
-
export function useRpcSuspenseQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
|
|
199
|
-
functionName: TFunc,
|
|
200
|
-
args?: RPCFunctionArgs<TFunc>,
|
|
201
|
-
// biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 和 ReactQuery 过于复杂的类型推断系统,保持对外类型安全
|
|
202
|
-
options?: RpcQueryOptions & Omit<any, "queryKey" | "queryFn">,
|
|
203
|
-
): { data: TData; [key: string]: unknown } {
|
|
204
|
-
const sb = useSupabaseBrowser();
|
|
205
|
-
const query = sb.rpc(functionName, args as never);
|
|
206
|
-
|
|
207
|
-
const { schema, ...reactQueryConfig } = options || {};
|
|
208
|
-
|
|
209
|
-
// biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 内部类型系统
|
|
210
|
-
const baseResult = useSbSuspenseQuery(query as any, reactQueryConfig);
|
|
211
|
-
|
|
212
|
-
// 如果提供了 schema,对数据进行验证和转换
|
|
213
|
-
const transformedResult = useMemo(() => {
|
|
214
|
-
if (!schema) {
|
|
215
|
-
return baseResult;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
try {
|
|
219
|
-
const validatedData = schema.parse(baseResult.data);
|
|
220
|
-
return {
|
|
221
|
-
...baseResult,
|
|
222
|
-
data: validatedData as TData,
|
|
223
|
-
};
|
|
224
|
-
} catch (error) {
|
|
225
|
-
console.error(`[useRpcSuspenseQuery] Schema validation failed for ${String(functionName)}:`, error);
|
|
226
|
-
return baseResult;
|
|
227
|
-
}
|
|
228
|
-
}, [schema, baseResult, functionName]);
|
|
229
|
-
|
|
230
|
-
return transformedResult as { data: TData; [key: string]: unknown };
|
|
231
|
-
}
|